@nous-research/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/dist/assets/filler-bg0.jpg +0 -0
- package/dist/fonts/Collapse-Bold.woff2 +0 -0
- package/dist/fonts/Collapse-BoldItalic.woff2 +0 -0
- package/dist/fonts/Collapse-Italic.woff2 +0 -0
- package/dist/fonts/Collapse-Light.woff2 +0 -0
- package/dist/fonts/Collapse-LightItalic.woff2 +0 -0
- package/dist/fonts/Collapse-Regular.woff2 +0 -0
- package/dist/fonts/Collapse-Thin.woff2 +0 -0
- package/dist/fonts/Collapse-ThinItalic.woff2 +0 -0
- package/dist/fonts/Mondwest-Regular.woff2 +0 -0
- package/dist/fonts/Neuebit-Bold.woff2 +0 -0
- package/dist/fonts/RulesCompressed-Medium.woff2 +0 -0
- package/dist/fonts/RulesCompressed-Regular.woff2 +0 -0
- package/dist/fonts/RulesExpanded-Bold.woff2 +0 -0
- package/dist/fonts/RulesExpanded-Regular.woff2 +0 -0
- package/dist/fonts.d.ts +6 -0
- package/dist/fonts.js +7 -0
- package/dist/fonts.js.map +1 -0
- package/dist/hooks/use-capped-frame.d.ts +2 -0
- package/dist/hooks/use-capped-frame.js +15 -0
- package/dist/hooks/use-capped-frame.js.map +1 -0
- package/dist/hooks/use-css-var-dims.d.ts +1 -0
- package/dist/hooks/use-css-var-dims.js +23 -0
- package/dist/hooks/use-css-var-dims.js.map +1 -0
- package/dist/hooks/use-gpu-tier.d.ts +10 -0
- package/dist/hooks/use-gpu-tier.js +92 -0
- package/dist/hooks/use-gpu-tier.js.map +1 -0
- package/dist/hooks/use-smooth-controls.d.ts +16 -0
- package/dist/hooks/use-smooth-controls.js +202 -0
- package/dist/hooks/use-smooth-controls.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/basic-page.d.ts +7 -0
- package/dist/ui/basic-page.js +9 -0
- package/dist/ui/basic-page.js.map +1 -0
- package/dist/ui/components/animated-count.d.ts +10 -0
- package/dist/ui/components/animated-count.js +88 -0
- package/dist/ui/components/animated-count.js.map +1 -0
- package/dist/ui/components/ascii.d.ts +10 -0
- package/dist/ui/components/ascii.js +62 -0
- package/dist/ui/components/ascii.js.map +1 -0
- package/dist/ui/components/badge.d.ts +2 -0
- package/dist/ui/components/badge.js +5 -0
- package/dist/ui/components/badge.js.map +1 -0
- package/dist/ui/components/badges/nous-girl.d.ts +2 -0
- package/dist/ui/components/badges/nous-girl.js +5 -0
- package/dist/ui/components/badges/nous-girl.js.map +1 -0
- package/dist/ui/components/blend-mode.d.ts +28 -0
- package/dist/ui/components/blend-mode.js +76 -0
- package/dist/ui/components/blend-mode.js.map +1 -0
- package/dist/ui/components/blink.d.ts +6 -0
- package/dist/ui/components/blink.js +7 -0
- package/dist/ui/components/blink.js.map +1 -0
- package/dist/ui/components/button.d.ts +11 -0
- package/dist/ui/components/button.js +52 -0
- package/dist/ui/components/button.js.map +1 -0
- package/dist/ui/components/cursor.d.ts +3 -0
- package/dist/ui/components/cursor.js +57 -0
- package/dist/ui/components/cursor.js.map +1 -0
- package/dist/ui/components/dropdown-menu.d.ts +12 -0
- package/dist/ui/components/dropdown-menu.js +53 -0
- package/dist/ui/components/dropdown-menu.js.map +1 -0
- package/dist/ui/components/fit-text/fit-text.css +42 -0
- package/dist/ui/components/fit-text/index.d.ts +9 -0
- package/dist/ui/components/fit-text/index.js +16 -0
- package/dist/ui/components/fit-text/index.js.map +1 -0
- package/dist/ui/components/graphs/bar-chart.d.ts +12 -0
- package/dist/ui/components/graphs/bar-chart.js +75 -0
- package/dist/ui/components/graphs/bar-chart.js.map +1 -0
- package/dist/ui/components/graphs/index.d.ts +3 -0
- package/dist/ui/components/graphs/index.js +4 -0
- package/dist/ui/components/graphs/index.js.map +1 -0
- package/dist/ui/components/graphs/line-chart.d.ts +14 -0
- package/dist/ui/components/graphs/line-chart.js +117 -0
- package/dist/ui/components/graphs/line-chart.js.map +1 -0
- package/dist/ui/components/graphs/utils.d.ts +52 -0
- package/dist/ui/components/graphs/utils.js +128 -0
- package/dist/ui/components/graphs/utils.js.map +1 -0
- package/dist/ui/components/grid/grid.css +78 -0
- package/dist/ui/components/grid/index.d.ts +2 -0
- package/dist/ui/components/grid/index.js +13 -0
- package/dist/ui/components/grid/index.js.map +1 -0
- package/dist/ui/components/hover-bg.d.ts +1 -0
- package/dist/ui/components/hover-bg.js +8 -0
- package/dist/ui/components/hover-bg.js.map +1 -0
- package/dist/ui/components/icons/arrow.d.ts +6 -0
- package/dist/ui/components/icons/arrow.js +6 -0
- package/dist/ui/components/icons/arrow.js.map +1 -0
- package/dist/ui/components/icons/chevron.d.ts +6 -0
- package/dist/ui/components/icons/chevron.js +6 -0
- package/dist/ui/components/icons/chevron.js.map +1 -0
- package/dist/ui/components/icons/eye.d.ts +2 -0
- package/dist/ui/components/icons/eye.js +5 -0
- package/dist/ui/components/icons/eye.js.map +1 -0
- package/dist/ui/components/icons/gear.d.ts +6 -0
- package/dist/ui/components/icons/gear.js +15 -0
- package/dist/ui/components/icons/gear.js.map +1 -0
- package/dist/ui/components/icons/heart.d.ts +2 -0
- package/dist/ui/components/icons/heart.js +5 -0
- package/dist/ui/components/icons/heart.js.map +1 -0
- package/dist/ui/components/icons/index.d.ts +8 -0
- package/dist/ui/components/icons/index.js +9 -0
- package/dist/ui/components/icons/index.js.map +1 -0
- package/dist/ui/components/icons/link.d.ts +2 -0
- package/dist/ui/components/icons/link.js +5 -0
- package/dist/ui/components/icons/link.js.map +1 -0
- package/dist/ui/components/icons/minus.d.ts +2 -0
- package/dist/ui/components/icons/minus.js +5 -0
- package/dist/ui/components/icons/minus.js.map +1 -0
- package/dist/ui/components/icons/search.d.ts +2 -0
- package/dist/ui/components/icons/search.js +5 -0
- package/dist/ui/components/icons/search.js.map +1 -0
- package/dist/ui/components/leva-client.d.ts +1 -0
- package/dist/ui/components/leva-client.js +12 -0
- package/dist/ui/components/leva-client.js.map +1 -0
- package/dist/ui/components/modal/index.d.ts +8 -0
- package/dist/ui/components/modal/index.js +15 -0
- package/dist/ui/components/modal/index.js.map +1 -0
- package/dist/ui/components/modal/modal.css +36 -0
- package/dist/ui/components/overlays/glitch.d.ts +6 -0
- package/dist/ui/components/overlays/glitch.js +191 -0
- package/dist/ui/components/overlays/glitch.js.map +1 -0
- package/dist/ui/components/overlays/greys.d.ts +6 -0
- package/dist/ui/components/overlays/greys.js +300 -0
- package/dist/ui/components/overlays/greys.js.map +1 -0
- package/dist/ui/components/overlays/index.d.ts +44 -0
- package/dist/ui/components/overlays/index.js +125 -0
- package/dist/ui/components/overlays/index.js.map +1 -0
- package/dist/ui/components/overlays/noise.d.ts +6 -0
- package/dist/ui/components/overlays/noise.js +115 -0
- package/dist/ui/components/overlays/noise.js.map +1 -0
- package/dist/ui/components/overlays/vignette.d.ts +6 -0
- package/dist/ui/components/overlays/vignette.js +40 -0
- package/dist/ui/components/overlays/vignette.js.map +1 -0
- package/dist/ui/components/progress.d.ts +9 -0
- package/dist/ui/components/progress.js +12 -0
- package/dist/ui/components/progress.js.map +1 -0
- package/dist/ui/components/scene-canvas.d.ts +15 -0
- package/dist/ui/components/scene-canvas.js +117 -0
- package/dist/ui/components/scene-canvas.js.map +1 -0
- package/dist/ui/components/scramble.d.ts +9 -0
- package/dist/ui/components/scramble.js +61 -0
- package/dist/ui/components/scramble.js.map +1 -0
- package/dist/ui/components/selection-switcher.d.ts +1 -0
- package/dist/ui/components/selection-switcher.js +29 -0
- package/dist/ui/components/selection-switcher.js.map +1 -0
- package/dist/ui/components/shader.d.ts +7 -0
- package/dist/ui/components/shader.js +41 -0
- package/dist/ui/components/shader.js.map +1 -0
- package/dist/ui/components/stats.d.ts +9 -0
- package/dist/ui/components/stats.js +7 -0
- package/dist/ui/components/stats.js.map +1 -0
- package/dist/ui/components/tv.d.ts +3 -0
- package/dist/ui/components/tv.js +163 -0
- package/dist/ui/components/tv.js.map +1 -0
- package/dist/ui/components/typography/h1.d.ts +11 -0
- package/dist/ui/components/typography/h1.js +8 -0
- package/dist/ui/components/typography/h1.js.map +1 -0
- package/dist/ui/components/typography/h2.d.ts +11 -0
- package/dist/ui/components/typography/h2.js +8 -0
- package/dist/ui/components/typography/h2.js.map +1 -0
- package/dist/ui/components/typography/index.d.ts +15 -0
- package/dist/ui/components/typography/index.js +29 -0
- package/dist/ui/components/typography/index.js.map +1 -0
- package/dist/ui/components/typography/legend.d.ts +6 -0
- package/dist/ui/components/typography/legend.js +7 -0
- package/dist/ui/components/typography/legend.js.map +1 -0
- package/dist/ui/components/typography/small.d.ts +2 -0
- package/dist/ui/components/typography/small.js +7 -0
- package/dist/ui/components/typography/small.js.map +1 -0
- package/dist/ui/components/watchlist.d.ts +11 -0
- package/dist/ui/components/watchlist.js +27 -0
- package/dist/ui/components/watchlist.js.map +1 -0
- package/dist/ui/fonts.css +63 -0
- package/dist/ui/footer.d.ts +1 -0
- package/dist/ui/footer.js +19 -0
- package/dist/ui/footer.js.map +1 -0
- package/dist/ui/globals.css +340 -0
- package/dist/ui/header.d.ts +1 -0
- package/dist/ui/header.js +22 -0
- package/dist/ui/header.js.map +1 -0
- package/dist/ui/layout-wrapper.d.ts +1 -0
- package/dist/ui/layout-wrapper.js +5 -0
- package/dist/ui/layout-wrapper.js.map +1 -0
- package/dist/utils/color.d.ts +4 -0
- package/dist/utils/color.js +14 -0
- package/dist/utils/color.js.map +1 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +48 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/poly.d.ts +8 -0
- package/dist/utils/poly.js +3 -0
- package/dist/utils/poly.js.map +1 -0
- package/package.json +95 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# nous design language
|
|
2
|
+
|
|
3
|
+
the shared design system for react ui @ nous. components, hooks, utils, fonts, overlays, etc.
|
|
4
|
+
|
|
5
|
+
## setup
|
|
6
|
+
|
|
7
|
+
add it as a submodule for now.
|
|
8
|
+
|
|
9
|
+
if you're using next.js, add to your config:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
transpilePackages: ['@nous/design-language']
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
import tailwind and the design language styles in your global css:
|
|
16
|
+
|
|
17
|
+
```css
|
|
18
|
+
@import 'tailwindcss';
|
|
19
|
+
@import 'tw-animate-css';
|
|
20
|
+
@import '@nous/design-language/styles/globals.css';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## usage
|
|
24
|
+
|
|
25
|
+
everything exports from the top level export:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import {
|
|
29
|
+
Button,
|
|
30
|
+
Grid
|
|
31
|
+
// whatever else!
|
|
32
|
+
} from '@nous/design-language'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## buiold
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
pnpm build
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
compiles typescript, resolves path aliases, copies fonts + assets + css to `dist/`.
|
|
42
|
+
|
|
43
|
+
## demo app
|
|
44
|
+
|
|
45
|
+
there's a next.js showcase app in `app/` for previewing components:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
pnpm dev
|
|
49
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/fonts.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** CSS variable names for the design language fonts. Set automatically by fonts.css. */
|
|
2
|
+
export declare const FONT_SANS = "--font-sans";
|
|
3
|
+
export declare const FONT_MONO = "--font-mono";
|
|
4
|
+
export declare const FONT_RULES_COMPRESSED = "--font-rules-compressed";
|
|
5
|
+
export declare const FONT_RULES_EXPANDED = "--font-rules-expanded";
|
|
6
|
+
export declare const FONT_MONDWEST = "--font-mondwest";
|
package/dist/fonts.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** CSS variable names for the design language fonts. Set automatically by fonts.css. */
|
|
2
|
+
export const FONT_SANS = '--font-sans';
|
|
3
|
+
export const FONT_MONO = '--font-mono';
|
|
4
|
+
export const FONT_RULES_COMPRESSED = '--font-rules-compressed';
|
|
5
|
+
export const FONT_RULES_EXPANDED = '--font-rules-expanded';
|
|
6
|
+
export const FONT_MONDWEST = '--font-mondwest';
|
|
7
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../src/fonts.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAA;AACtC,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAA;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAA;AAC9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAA;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useFrame, useThree } from '@react-three/fiber';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
export function useCappedFrame(cb, max) {
|
|
5
|
+
const last = useRef(performance.now());
|
|
6
|
+
const { size } = useThree();
|
|
7
|
+
const interval = 1e3 / (max ?? (size.width < 1024 ? 60 : 120));
|
|
8
|
+
useFrame((st, delta) => {
|
|
9
|
+
if (performance.now() - last.current > interval) {
|
|
10
|
+
last.current = performance.now();
|
|
11
|
+
cb(st, delta);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=use-capped-frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-capped-frame.js","sourceRoot":"","sources":["../../src/hooks/use-capped-frame.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE9B,MAAM,UAAU,cAAc,CAAC,EAAkB,EAAE,GAAY;IAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAA;IACtC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC3B,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAE9D,QAAQ,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;QACrB,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;YAChD,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;YAChC,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;QACf,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCssVarDims(name: string, ref: React.RefObject<HTMLElement | null>): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
export function useCssVarDims(name, ref) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!ref.current) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const update = (width, height) => {
|
|
9
|
+
document.documentElement.style.setProperty(`--${name}-width`, `${width}px`);
|
|
10
|
+
document.documentElement.style.setProperty(`--${name}-height`, `${height}px`);
|
|
11
|
+
};
|
|
12
|
+
const { height, width } = ref.current.getBoundingClientRect();
|
|
13
|
+
update(width, height);
|
|
14
|
+
const ro = new ResizeObserver(entries => {
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
update(entry.contentRect.width, entry.contentRect.height);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
ro.observe(ref.current);
|
|
20
|
+
return () => ro.disconnect();
|
|
21
|
+
}, [name, ref]);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=use-css-var-dims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-css-var-dims.js","sourceRoot":"","sources":["../../src/hooks/use-css-var-dims.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,GAAwC;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,OAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE;YAC/C,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CACxC,KAAK,IAAI,QAAQ,EACjB,GAAG,KAAK,IAAI,CACb,CAAA;YAED,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CACxC,KAAK,IAAI,SAAS,EAClB,GAAG,MAAM,IAAI,CACd,CAAA;QACH,CAAC,CAAA;QAED,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAA;QAC7D,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAErB,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;YACtC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;YAC3D,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAEvB,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAA;IAC9B,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiers:
|
|
3
|
+
* 0 — no WebGL / software renderer / prefers-reduced-motion
|
|
4
|
+
* 1 — low-end GPU (integrated, mobile, or failed perf benchmark)
|
|
5
|
+
* 2 — capable GPU (discrete / high-end integrated)
|
|
6
|
+
*/
|
|
7
|
+
export declare const $gpuTier: import("nanostores").PreinitializedWritableAtom<GpuTier> & object;
|
|
8
|
+
export declare function useGpuTier(): GpuTier;
|
|
9
|
+
type GpuTier = 0 | 1 | 2;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useStore } from '@nanostores/react';
|
|
3
|
+
import { atom, onMount } from 'nanostores';
|
|
4
|
+
/**
|
|
5
|
+
* Tiers:
|
|
6
|
+
* 0 — no WebGL / software renderer / prefers-reduced-motion
|
|
7
|
+
* 1 — low-end GPU (integrated, mobile, or failed perf benchmark)
|
|
8
|
+
* 2 — capable GPU (discrete / high-end integrated)
|
|
9
|
+
*/
|
|
10
|
+
export const $gpuTier = atom(2);
|
|
11
|
+
const SOFTWARE_PATTERNS = /swiftshader|llvmpipe|softpipe|software|microsoft basic/i;
|
|
12
|
+
const LOW_END_PATTERNS = /intel.*hd|intel.*uhd|intel.*iris|mali|adreno\s?[1-5]|powervr|apple gpu/i;
|
|
13
|
+
onMount($gpuTier, () => {
|
|
14
|
+
if (typeof window === 'undefined') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
18
|
+
$gpuTier.set(0);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const canvas = document.createElement('canvas');
|
|
22
|
+
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
|
|
23
|
+
if (!gl) {
|
|
24
|
+
$gpuTier.set(0);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const glCtx = gl;
|
|
28
|
+
const ext = glCtx.getExtension('WEBGL_debug_renderer_info');
|
|
29
|
+
const renderer = ext
|
|
30
|
+
? glCtx.getParameter(ext.UNMASKED_RENDERER_WEBGL)
|
|
31
|
+
: glCtx.getParameter(glCtx.RENDERER);
|
|
32
|
+
if (SOFTWARE_PATTERNS.test(renderer)) {
|
|
33
|
+
$gpuTier.set(0);
|
|
34
|
+
glCtx.getExtension('WEBGL_lose_context')?.loseContext();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (LOW_END_PATTERNS.test(renderer)) {
|
|
38
|
+
$gpuTier.set(1);
|
|
39
|
+
glCtx.getExtension('WEBGL_lose_context')?.loseContext();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
runBenchmark(glCtx).then(fps => {
|
|
43
|
+
$gpuTier.set(fps < 30 ? 1 : 2);
|
|
44
|
+
glCtx.getExtension('WEBGL_lose_context')?.loseContext();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
function runBenchmark(gl) {
|
|
48
|
+
return new Promise(resolve => {
|
|
49
|
+
const vs = gl.createShader(gl.VERTEX_SHADER);
|
|
50
|
+
const fs = gl.createShader(gl.FRAGMENT_SHADER);
|
|
51
|
+
gl.shaderSource(vs, 'attribute vec2 a;void main(){gl_Position=vec4(a,0,1);}');
|
|
52
|
+
gl.shaderSource(fs, 'precision highp float;uniform float t;void main(){float v=0.;for(int i=0;i<64;i++)v+=sin(float(i)*t*.01);gl_FragColor=vec4(v*.001);}');
|
|
53
|
+
gl.compileShader(vs);
|
|
54
|
+
gl.compileShader(fs);
|
|
55
|
+
const prog = gl.createProgram();
|
|
56
|
+
gl.attachShader(prog, vs);
|
|
57
|
+
gl.attachShader(prog, fs);
|
|
58
|
+
gl.linkProgram(prog);
|
|
59
|
+
gl.useProgram(prog);
|
|
60
|
+
const buf = gl.createBuffer();
|
|
61
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
|
|
62
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);
|
|
63
|
+
const a = gl.getAttribLocation(prog, 'a');
|
|
64
|
+
gl.enableVertexAttribArray(a);
|
|
65
|
+
gl.vertexAttribPointer(a, 2, gl.FLOAT, false, 0, 0);
|
|
66
|
+
const uT = gl.getUniformLocation(prog, 't');
|
|
67
|
+
let frames = 0;
|
|
68
|
+
const start = performance.now();
|
|
69
|
+
const tick = () => {
|
|
70
|
+
gl.uniform1f(uT, frames);
|
|
71
|
+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
72
|
+
gl.finish();
|
|
73
|
+
frames++;
|
|
74
|
+
if (performance.now() - start < 200) {
|
|
75
|
+
requestAnimationFrame(tick);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const elapsed = performance.now() - start;
|
|
79
|
+
gl.deleteProgram(prog);
|
|
80
|
+
gl.deleteShader(vs);
|
|
81
|
+
gl.deleteShader(fs);
|
|
82
|
+
gl.deleteBuffer(buf);
|
|
83
|
+
resolve((frames / elapsed) * 1000);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
requestAnimationFrame(tick);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export function useGpuTier() {
|
|
90
|
+
return useStore($gpuTier);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=use-gpu-tier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,GAAG,KAAK,GAAG,GAAG,EAAE,CAAC;gBACpC,qBAAqB,CAAC,IAAI,CAAC,CAAA;YAC7B,CAAC;iBAAM,CAAC;gBACN,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAA;gBACzC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;gBACtB,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;gBACnB,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;gBACnB,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;gBACpB,OAAO,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;YACpC,CAAC;QACH,CAAC,CAAA;QAED,qBAAqB,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useControls } from 'leva';
|
|
2
|
+
import { type WritableAtom } from 'nanostores';
|
|
3
|
+
export declare function useSmoothControls<T extends Record<string, any>>(label: string, initialArgs: T, options?: UseSmoothControlsOptions, dependencies?: Parameters<typeof useControls>[3]): { [K in keyof T]: T[K] extends {
|
|
4
|
+
value: infer V;
|
|
5
|
+
} ? V : never; };
|
|
6
|
+
export declare const getControlAtom: <T = any>(label: string, key: string) => undefined | WritableAtom<T>;
|
|
7
|
+
export declare const setControlValue: <T = any>(label: string, key: string, value: T, options?: {
|
|
8
|
+
animate?: boolean;
|
|
9
|
+
duration?: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
type UseSmoothControlsOptions = Parameters<typeof useControls>[2] & {
|
|
12
|
+
duration?: number;
|
|
13
|
+
onRandomize?: () => void;
|
|
14
|
+
onReset?: () => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import gsap from 'gsap';
|
|
3
|
+
import { buttonGroup, useControls } from 'leva';
|
|
4
|
+
import { atom } from 'nanostores';
|
|
5
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
const atomRegistry = new Map();
|
|
7
|
+
const val = (v) => v && typeof v === 'object' && 'value' in v ? v.value : v;
|
|
8
|
+
const isHex = (v) => /color/i.test(v?.type) || /^#[0-9a-f]{3,8}$/i.test(val(v));
|
|
9
|
+
const randHex = () => `#${Math.floor(Math.random() * 0xffffff)
|
|
10
|
+
.toString(16)
|
|
11
|
+
.padStart(6, '0')}`;
|
|
12
|
+
const randNum = (v) => typeof v === 'object' && ('min' in v || 'max' in v)
|
|
13
|
+
? gsap.utils.random(v.min ?? 0, v.max ?? 1, v.step ?? 0.01)
|
|
14
|
+
: gsap.utils.random(0, 1);
|
|
15
|
+
export function useSmoothControls(label, initialArgs, options, dependencies) {
|
|
16
|
+
const entries = useMemo(() => Object.entries(initialArgs ?? {}), [initialArgs]);
|
|
17
|
+
const values = useMemo(() => entries.filter(([, v]) => !/button|folder/i.test(v?.type)), [entries]);
|
|
18
|
+
const atoms = useMemo(() => {
|
|
19
|
+
const map = atomRegistry.get(label) ?? new Map();
|
|
20
|
+
if (!atomRegistry.has(label)) {
|
|
21
|
+
atomRegistry.set(label, map);
|
|
22
|
+
}
|
|
23
|
+
entries.forEach(([k, v]) => {
|
|
24
|
+
if (v?.schema) {
|
|
25
|
+
Object.keys(v.schema).forEach(sk => {
|
|
26
|
+
const key = `${k}.${sk}`;
|
|
27
|
+
if (!map.has(key)) {
|
|
28
|
+
map.set(key, atom(val(v.schema[sk])));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else if (!map.has(k)) {
|
|
33
|
+
map.set(k, atom(val(v)));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return map;
|
|
37
|
+
}, [label, entries]);
|
|
38
|
+
const hydrate = useCallback(() => Object.fromEntries(entries.flatMap(([k, v]) => v?.schema
|
|
39
|
+
? Object.entries(v.schema).map(([k0, v0]) => [
|
|
40
|
+
k0,
|
|
41
|
+
atoms.get(`${k}.${k0}`)?.get() ?? val(v0)
|
|
42
|
+
])
|
|
43
|
+
: [[k, atoms.get(k)?.get() ?? val(v)]])), [entries, atoms]);
|
|
44
|
+
const [args, update] = useState(hydrate);
|
|
45
|
+
const setRef = useRef(null);
|
|
46
|
+
const atomVals = useRef({});
|
|
47
|
+
const fromAtom = useRef(false);
|
|
48
|
+
const fromControl = useRef(new Set());
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (Object.keys(args).length !== Object.keys(initialArgs).length) {
|
|
51
|
+
update(hydrate);
|
|
52
|
+
}
|
|
53
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
+
}, [initialArgs, args]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!setRef.current) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const unsubs = [];
|
|
60
|
+
let ready = false;
|
|
61
|
+
const initTimeout = setTimeout(() => (ready = true), 100);
|
|
62
|
+
const subscribe = (fullKey, updateFn) => {
|
|
63
|
+
const a = atoms.get(fullKey);
|
|
64
|
+
if (!a) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
unsubs.push(a.subscribe(v => {
|
|
68
|
+
const prev = atomVals.current[fullKey];
|
|
69
|
+
atomVals.current[fullKey] = v;
|
|
70
|
+
if (setRef.current &&
|
|
71
|
+
ready &&
|
|
72
|
+
prev !== v &&
|
|
73
|
+
!fromControl.current.has(fullKey)) {
|
|
74
|
+
fromAtom.current = true;
|
|
75
|
+
try {
|
|
76
|
+
updateFn(v);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
//
|
|
80
|
+
}
|
|
81
|
+
setTimeout(() => (fromAtom.current = false), 0);
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
atomVals.current[fullKey] = a.get();
|
|
85
|
+
};
|
|
86
|
+
entries.forEach(([k, v]) => {
|
|
87
|
+
if (v?.schema) {
|
|
88
|
+
Object.keys(v.schema).forEach(sk => {
|
|
89
|
+
subscribe(`${k}.${sk}`, v => {
|
|
90
|
+
try {
|
|
91
|
+
setRef.current({
|
|
92
|
+
[k]: { ...(args[k] ?? {}), [sk]: v }
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
//
|
|
97
|
+
}
|
|
98
|
+
update(st => ({
|
|
99
|
+
...st,
|
|
100
|
+
[k]: { ...(st[k] ?? {}), [sk]: v }
|
|
101
|
+
}));
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
subscribe(k, v => {
|
|
107
|
+
try {
|
|
108
|
+
setRef.current({ [k]: v });
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
//
|
|
112
|
+
}
|
|
113
|
+
update(st => ({ ...st, [k]: v }));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return () => {
|
|
118
|
+
clearTimeout(initTimeout);
|
|
119
|
+
unsubs.forEach(fn => fn());
|
|
120
|
+
};
|
|
121
|
+
}, [label, entries, atoms, args]);
|
|
122
|
+
const onChange = (k, orig) => (e, k0) => {
|
|
123
|
+
if (fromAtom.current) {
|
|
124
|
+
return orig?.(e, k0);
|
|
125
|
+
}
|
|
126
|
+
const key = k0?.split('.')?.pop() ?? k;
|
|
127
|
+
const fullKey = k0 ?? k;
|
|
128
|
+
const a = atoms.get(fullKey);
|
|
129
|
+
fromControl.current.add(fullKey);
|
|
130
|
+
const sync = (v) => {
|
|
131
|
+
update(st => ({ ...st, [key]: v }));
|
|
132
|
+
a?.set(v);
|
|
133
|
+
orig?.(v, k0);
|
|
134
|
+
};
|
|
135
|
+
if (typeof e === 'number' && args[key] !== e) {
|
|
136
|
+
gsap.to(args, {
|
|
137
|
+
duration: options?.duration ?? 0.35,
|
|
138
|
+
ease: 'circ.out',
|
|
139
|
+
[key]: e,
|
|
140
|
+
onComplete: () => void fromControl.current.delete(fullKey),
|
|
141
|
+
onUpdate: () => {
|
|
142
|
+
fromControl.current.add(fullKey);
|
|
143
|
+
sync(args[key]);
|
|
144
|
+
setTimeout(() => fromControl.current.delete(fullKey), 0);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
sync(e);
|
|
150
|
+
setTimeout(() => fromControl.current.delete(fullKey), 0);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const [, set] = useControls(label, () => ({
|
|
154
|
+
...Object.fromEntries(entries.map(([k, v]) => v?.schema
|
|
155
|
+
? [
|
|
156
|
+
k,
|
|
157
|
+
{
|
|
158
|
+
...v,
|
|
159
|
+
schema: Object.fromEntries(Object.entries(v.schema).map(([sk, sv]) => [
|
|
160
|
+
sk,
|
|
161
|
+
{ ...sv, onChange: onChange(k, sv?.onChange) }
|
|
162
|
+
]))
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
: [k, { ...v, onChange: onChange(k, v?.onChange) }])),
|
|
166
|
+
' ': buttonGroup({
|
|
167
|
+
flatten: () => void set(Object.fromEntries(values.map(([k]) => [k, 0]))),
|
|
168
|
+
randomize: () => {
|
|
169
|
+
set(Object.fromEntries(values.map(([k, v]) => [k, isHex(v) ? randHex() : randNum(v)])));
|
|
170
|
+
options?.onRandomize?.();
|
|
171
|
+
},
|
|
172
|
+
reset: () => {
|
|
173
|
+
set(Object.fromEntries(values.map(([k, v]) => [k, val(v)])));
|
|
174
|
+
options?.onReset?.();
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
}), { collapsed: true, ...options }, dependencies ?? []);
|
|
178
|
+
setRef.current = set;
|
|
179
|
+
return args;
|
|
180
|
+
}
|
|
181
|
+
export const getControlAtom = (label, key) => atomRegistry.get(label)?.get(key);
|
|
182
|
+
export const setControlValue = (label, key, value, options) => {
|
|
183
|
+
const a = getControlAtom(label, key);
|
|
184
|
+
if (!a) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (options?.animate &&
|
|
188
|
+
typeof value === 'number' &&
|
|
189
|
+
typeof a.get() === 'number') {
|
|
190
|
+
const t = { v: a.get() };
|
|
191
|
+
gsap.to(t, {
|
|
192
|
+
duration: options.duration ?? 0.35,
|
|
193
|
+
ease: 'circ.out',
|
|
194
|
+
onUpdate: () => a.set(t.v),
|
|
195
|
+
v: value
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
a.set(value);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=use-smooth-controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-smooth-controls.js","sourceRoot":"","sources":["../../src/hooks/use-smooth-controls.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAqB,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEzE,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0C,CAAA;AAEtE,MAAM,GAAG,GAAG,CAAC,CAAM,EAAE,EAAE,CACrB,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1D,MAAM,KAAK,GAAG,CAAC,CAAM,EAAE,EAAE,CACvB,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,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,QAAQ;QACzB,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,QAAQ,EAC3B,CAAC;QACD,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,CAAA;QAExB,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE;YACT,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI;YAClC,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC,EAAE,KAAK;SACT,CAAC,CAAA;IACJ,CAAC;SAAM,CAAC;QACN,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;AACH,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export { AnimatedCount, useAnimatedCount } from './ui/components/animated-count';
|
|
2
|
+
export { AsciiSkeleton, Scramble as AsciiScramble } from './ui/components/ascii';
|
|
3
|
+
export { Badge } from './ui/components/badge';
|
|
4
|
+
export { NouseGirlBadge } from './ui/components/badges/nous-girl';
|
|
5
|
+
export { BlendMode, useBlendMode, withBlendMode } from './ui/components/blend-mode';
|
|
6
|
+
export type { BlendModeProps } from './ui/components/blend-mode';
|
|
7
|
+
export { Blink } from './ui/components/blink';
|
|
8
|
+
export { Button } from './ui/components/button';
|
|
9
|
+
export { Cursor } from './ui/components/cursor';
|
|
10
|
+
export { DropdownMenu } from './ui/components/dropdown-menu';
|
|
11
|
+
export { FitText } from './ui/components/fit-text';
|
|
12
|
+
export { BarChart, LineChart } from './ui/components/graphs';
|
|
13
|
+
export { Cell, Grid } from './ui/components/grid';
|
|
14
|
+
export { HoverBg } from './ui/components/hover-bg';
|
|
15
|
+
export * as Icons from './ui/components/icons';
|
|
16
|
+
export { LevaClient } from './ui/components/leva-client';
|
|
17
|
+
export { Modal } from './ui/components/modal';
|
|
18
|
+
export { applyLens, LENSES, LENS_0, LENS_5I, toggleLens, $lightMode } from './ui/components/overlays';
|
|
19
|
+
export { Overlays } from './ui/components/overlays';
|
|
20
|
+
export type { LensPreset } from './ui/components/overlays';
|
|
21
|
+
export { Progress } from './ui/components/progress';
|
|
22
|
+
export { SceneCanvas } from './ui/components/scene-canvas';
|
|
23
|
+
export { Scramble } from './ui/components/scramble';
|
|
24
|
+
export { SelectionSwitcher } from './ui/components/selection-switcher';
|
|
25
|
+
export { Stats } from './ui/components/stats';
|
|
26
|
+
export { TV } from './ui/components/tv';
|
|
27
|
+
export { Watchlist } from './ui/components/watchlist';
|
|
28
|
+
export { Typography } from './ui/components/typography';
|
|
29
|
+
export type { TypographyProps } from './ui/components/typography';
|
|
30
|
+
export { H1 } from './ui/components/typography/h1';
|
|
31
|
+
export { H2 } from './ui/components/typography/h2';
|
|
32
|
+
export { Legend } from './ui/components/typography/legend';
|
|
33
|
+
export { Small } from './ui/components/typography/small';
|
|
34
|
+
export { BasicPage } from './ui/basic-page';
|
|
35
|
+
export { Header } from './ui/header';
|
|
36
|
+
export { Footer } from './ui/footer';
|
|
37
|
+
export { LayoutWrapper } from './ui/layout-wrapper';
|
|
38
|
+
export { FONT_SANS, FONT_MONO, FONT_RULES_COMPRESSED, FONT_RULES_EXPANDED, FONT_MONDWEST } from './fonts';
|
|
39
|
+
export { cn, clamp, smoothstep, hexToVec3, truncate, stripWpStyles } from './utils';
|
|
40
|
+
export { polyRef } from './utils';
|
|
41
|
+
export type { PolyComponent, PolyProps, PolyRef } from './utils';
|
|
42
|
+
export { hexToRgb, rgbToHex, colorDodge, colorMix } from './utils/color';
|
|
43
|
+
export { useCappedFrame } from './hooks/use-capped-frame';
|
|
44
|
+
export { useCssVarDims } from './hooks/use-css-var-dims';
|
|
45
|
+
export { useSmoothControls, getControlAtom, setControlValue } from './hooks/use-smooth-controls';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Components
|
|
2
|
+
export { AnimatedCount, useAnimatedCount } from './ui/components/animated-count';
|
|
3
|
+
export { AsciiSkeleton, Scramble as AsciiScramble } from './ui/components/ascii';
|
|
4
|
+
export { Badge } from './ui/components/badge';
|
|
5
|
+
export { NouseGirlBadge } from './ui/components/badges/nous-girl';
|
|
6
|
+
export { BlendMode, useBlendMode, withBlendMode } from './ui/components/blend-mode';
|
|
7
|
+
export { Blink } from './ui/components/blink';
|
|
8
|
+
export { Button } from './ui/components/button';
|
|
9
|
+
export { Cursor } from './ui/components/cursor';
|
|
10
|
+
export { DropdownMenu } from './ui/components/dropdown-menu';
|
|
11
|
+
export { FitText } from './ui/components/fit-text';
|
|
12
|
+
export { BarChart, LineChart } from './ui/components/graphs';
|
|
13
|
+
export { Cell, Grid } from './ui/components/grid';
|
|
14
|
+
export { HoverBg } from './ui/components/hover-bg';
|
|
15
|
+
export * as Icons from './ui/components/icons';
|
|
16
|
+
export { LevaClient } from './ui/components/leva-client';
|
|
17
|
+
export { Modal } from './ui/components/modal';
|
|
18
|
+
export { applyLens, LENSES, LENS_0, LENS_5I, toggleLens, $lightMode } from './ui/components/overlays';
|
|
19
|
+
export { Overlays } from './ui/components/overlays';
|
|
20
|
+
export { Progress } from './ui/components/progress';
|
|
21
|
+
export { SceneCanvas } from './ui/components/scene-canvas';
|
|
22
|
+
export { Scramble } from './ui/components/scramble';
|
|
23
|
+
export { SelectionSwitcher } from './ui/components/selection-switcher';
|
|
24
|
+
export { Stats } from './ui/components/stats';
|
|
25
|
+
export { TV } from './ui/components/tv';
|
|
26
|
+
export { Watchlist } from './ui/components/watchlist';
|
|
27
|
+
// Typography
|
|
28
|
+
export { Typography } from './ui/components/typography';
|
|
29
|
+
export { H1 } from './ui/components/typography/h1';
|
|
30
|
+
export { H2 } from './ui/components/typography/h2';
|
|
31
|
+
export { Legend } from './ui/components/typography/legend';
|
|
32
|
+
export { Small } from './ui/components/typography/small';
|
|
33
|
+
// Layout
|
|
34
|
+
export { BasicPage } from './ui/basic-page';
|
|
35
|
+
export { Header } from './ui/header';
|
|
36
|
+
export { Footer } from './ui/footer';
|
|
37
|
+
export { LayoutWrapper } from './ui/layout-wrapper';
|
|
38
|
+
// Fonts
|
|
39
|
+
export { FONT_SANS, FONT_MONO, FONT_RULES_COMPRESSED, FONT_RULES_EXPANDED, FONT_MONDWEST } from './fonts';
|
|
40
|
+
// Utils
|
|
41
|
+
export { cn, clamp, smoothstep, hexToVec3, truncate, stripWpStyles } from './utils';
|
|
42
|
+
export { polyRef } from './utils';
|
|
43
|
+
export { hexToRgb, rgbToHex, colorDodge, colorMix } from './utils/color';
|
|
44
|
+
// Hooks
|
|
45
|
+
export { useCappedFrame } from './hooks/use-capped-frame';
|
|
46
|
+
export { useCssVarDims } from './hooks/use-css-var-dims';
|
|
47
|
+
export { useSmoothControls, getControlAtom, setControlValue } from './hooks/use-smooth-controls';
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAChF,OAAO,EAAE,aAAa,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA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C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAQ;AACR,OAAO,EACL,SAAS,EACT,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,SAAS,CAAA;AAEhB,QAAQ;AACR,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExE,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,EAChB,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare function BasicPage({ children, subtitle, title }: BasicPageProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
interface BasicPageProps extends React.PropsWithChildren {
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Cell, Grid } from './components/grid';
|
|
3
|
+
import { Progress } from './components/progress';
|
|
4
|
+
import { H1 } from './components/typography/h1';
|
|
5
|
+
import { Small } from './components/typography/small';
|
|
6
|
+
export function BasicPage({ children, subtitle, title }) {
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(Grid, { children: _jsx(Cell, { children: _jsx(Progress, { value: 0 }) }) }), _jsxs(Grid, { className: "lg:grid-cols-[max-content_1fr]", children: [_jsx(Cell, { className: "-order-1", children: _jsxs("div", { className: "sticky top-4 flex flex-col gap-4", children: [title ? _jsx(H1, { className: "-mb-2 pr-10 opacity-90", children: title }) : null, subtitle ? _jsx(Small, { className: "opacity-60", children: subtitle }) : null] }) }), _jsx(Cell, { className: "post bg-current/3", children: children })] })] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=basic-page.js.map
|