@nous-research/ui 0.13.2 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/README.md +16 -0
  2. package/dist/assets/filler-bg0.webp +0 -0
  3. package/dist/assets.d.ts +38 -0
  4. package/dist/fonts.d.ts +0 -1
  5. package/dist/fonts.js +5 -7
  6. package/dist/hooks/use-capped-frame.d.ts +0 -1
  7. package/dist/hooks/use-capped-frame.js +12 -13
  8. package/dist/hooks/use-css-var-dims.d.ts +0 -1
  9. package/dist/hooks/use-css-var-dims.js +26 -21
  10. package/dist/hooks/use-gpu-tier.d.ts +0 -1
  11. package/dist/hooks/use-gpu-tier.js +90 -110
  12. package/dist/hooks/use-render-loop.d.ts +0 -1
  13. package/dist/hooks/use-render-loop.js +58 -58
  14. package/dist/hooks/use-smooth-controls.d.ts +0 -1
  15. package/dist/hooks/use-smooth-controls.js +204 -206
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.js +84 -58
  18. package/dist/ui/basic-page.d.ts +1 -2
  19. package/dist/ui/basic-page.js +15 -7
  20. package/dist/ui/build.css +1 -0
  21. package/dist/ui/components/animated-count.d.ts +1 -2
  22. package/dist/ui/components/animated-count.js +109 -85
  23. package/dist/ui/components/ascii.d.ts +2 -3
  24. package/dist/ui/components/ascii.js +75 -59
  25. package/dist/ui/components/badge.d.ts +1 -2
  26. package/dist/ui/components/badge.js +35 -18
  27. package/dist/ui/components/badges/nous-girl.d.ts +1 -2
  28. package/dist/ui/components/badges/nous-girl.js +80 -3
  29. package/dist/ui/components/blend-mode.d.ts +1 -2
  30. package/dist/ui/components/blend-mode.js +55 -63
  31. package/dist/ui/components/blink.d.ts +1 -2
  32. package/dist/ui/components/blink.js +15 -6
  33. package/dist/ui/components/button.d.ts +2 -3
  34. package/dist/ui/components/button.js +139 -90
  35. package/dist/ui/components/command-block.d.ts +2 -3
  36. package/dist/ui/components/command-block.js +52 -24
  37. package/dist/ui/components/cursor.d.ts +1 -2
  38. package/dist/ui/components/cursor.js +93 -54
  39. package/dist/ui/components/dropdown-menu.d.ts +1 -2
  40. package/dist/ui/components/dropdown-menu.js +99 -51
  41. package/dist/ui/components/fit-text/index.d.ts +0 -1
  42. package/dist/ui/components/fit-text/index.js +21 -13
  43. package/dist/ui/components/graphs/bar-chart.d.ts +1 -2
  44. package/dist/ui/components/graphs/bar-chart.js +116 -63
  45. package/dist/ui/components/graphs/index.d.ts +0 -1
  46. package/dist/ui/components/graphs/index.js +3 -4
  47. package/dist/ui/components/graphs/line-chart.d.ts +1 -2
  48. package/dist/ui/components/graphs/line-chart.js +159 -102
  49. package/dist/ui/components/graphs/utils.d.ts +2 -3
  50. package/dist/ui/components/graphs/utils.js +147 -114
  51. package/dist/ui/components/grid/index.d.ts +0 -1
  52. package/dist/ui/components/grid/index.js +12 -9
  53. package/dist/ui/components/hover-bg.d.ts +0 -1
  54. package/dist/ui/components/hover-bg.js +11 -6
  55. package/dist/ui/components/icons/arrow.d.ts +1 -2
  56. package/dist/ui/components/icons/arrow.js +42 -5
  57. package/dist/ui/components/icons/chevron.d.ts +1 -2
  58. package/dist/ui/components/icons/chevron.js +49 -5
  59. package/dist/ui/components/icons/discord.d.ts +1 -2
  60. package/dist/ui/components/icons/discord.js +12 -4
  61. package/dist/ui/components/icons/eye.d.ts +1 -2
  62. package/dist/ui/components/icons/eye.js +5 -3
  63. package/dist/ui/components/icons/gear.d.ts +1 -2
  64. package/dist/ui/components/icons/gear.js +28 -14
  65. package/dist/ui/components/icons/github.d.ts +1 -2
  66. package/dist/ui/components/icons/github.js +12 -4
  67. package/dist/ui/components/icons/hamburger.d.ts +1 -2
  68. package/dist/ui/components/icons/hamburger.js +54 -5
  69. package/dist/ui/components/icons/heart.d.ts +1 -2
  70. package/dist/ui/components/icons/heart.js +8 -3
  71. package/dist/ui/components/icons/index.d.ts +0 -1
  72. package/dist/ui/components/icons/index.js +11 -12
  73. package/dist/ui/components/icons/link.d.ts +1 -2
  74. package/dist/ui/components/icons/link.js +10 -3
  75. package/dist/ui/components/icons/minus.d.ts +1 -2
  76. package/dist/ui/components/icons/minus.js +10 -3
  77. package/dist/ui/components/icons/search.d.ts +1 -2
  78. package/dist/ui/components/icons/search.js +30 -3
  79. package/dist/ui/components/image-distortion.d.ts +1 -2
  80. package/dist/ui/components/image-distortion.js +300 -265
  81. package/dist/ui/components/leva-client.d.ts +1 -2
  82. package/dist/ui/components/leva-client.js +9 -10
  83. package/dist/ui/components/list-item.d.ts +0 -1
  84. package/dist/ui/components/list-item.js +26 -10
  85. package/dist/ui/components/modal/index.d.ts +1 -2
  86. package/dist/ui/components/modal/index.js +33 -14
  87. package/dist/ui/components/overlays/blend-modes.d.ts +0 -1
  88. package/dist/ui/components/overlays/blend-modes.js +11 -12
  89. package/dist/ui/components/overlays/glitch.d.ts +1 -2
  90. package/dist/ui/components/overlays/glitch.js +115 -110
  91. package/dist/ui/components/overlays/greys.d.ts +1 -2
  92. package/dist/ui/components/overlays/greys.js +200 -179
  93. package/dist/ui/components/overlays/index.d.ts +1 -2
  94. package/dist/ui/components/overlays/index.js +31 -17
  95. package/dist/ui/components/overlays/lens-layers.d.ts +1 -2
  96. package/dist/ui/components/overlays/lens-layers.js +89 -65
  97. package/dist/ui/components/overlays/lens.d.ts +0 -1
  98. package/dist/ui/components/overlays/lens.js +46 -52
  99. package/dist/ui/components/overlays/noise.d.ts +1 -2
  100. package/dist/ui/components/overlays/noise.js +112 -113
  101. package/dist/ui/components/overlays/vignette.d.ts +1 -2
  102. package/dist/ui/components/overlays/vignette.js +44 -38
  103. package/dist/ui/components/poster.d.ts +1 -2
  104. package/dist/ui/components/poster.js +240 -87
  105. package/dist/ui/components/progress.d.ts +1 -2
  106. package/dist/ui/components/progress.js +52 -12
  107. package/dist/ui/components/scene-canvas.d.ts +1 -2
  108. package/dist/ui/components/scene-canvas.js +169 -119
  109. package/dist/ui/components/scramble.d.ts +1 -2
  110. package/dist/ui/components/scramble.js +60 -59
  111. package/dist/ui/components/segmented.d.ts +2 -3
  112. package/dist/ui/components/segmented.js +47 -12
  113. package/dist/ui/components/select.d.ts +1 -2
  114. package/dist/ui/components/select.js +207 -120
  115. package/dist/ui/components/selection-switcher.d.ts +0 -1
  116. package/dist/ui/components/selection-switcher.js +29 -25
  117. package/dist/ui/components/shader.d.ts +1 -2
  118. package/dist/ui/components/shader.js +56 -38
  119. package/dist/ui/components/socials.d.ts +1 -2
  120. package/dist/ui/components/socials.js +18 -7
  121. package/dist/ui/components/spinner.d.ts +1 -2
  122. package/dist/ui/components/spinner.js +36 -25
  123. package/dist/ui/components/stats.d.ts +1 -2
  124. package/dist/ui/components/stats.js +33 -9
  125. package/dist/ui/components/switch.d.ts +0 -1
  126. package/dist/ui/components/switch.js +35 -11
  127. package/dist/ui/components/tabs.d.ts +3 -4
  128. package/dist/ui/components/tabs.js +38 -12
  129. package/dist/ui/components/terminal-demo.d.ts +1 -2
  130. package/dist/ui/components/terminal-demo.js +119 -74
  131. package/dist/ui/components/theme-toggle.d.ts +1 -2
  132. package/dist/ui/components/theme-toggle.js +63 -8
  133. package/dist/ui/components/tier-card.d.ts +1 -2
  134. package/dist/ui/components/tier-card.js +144 -24
  135. package/dist/ui/components/tv.d.ts +1 -2
  136. package/dist/ui/components/tv.js +138 -90
  137. package/dist/ui/components/typography/h1.d.ts +0 -1
  138. package/dist/ui/components/typography/h1.js +17 -8
  139. package/dist/ui/components/typography/h2.d.ts +0 -1
  140. package/dist/ui/components/typography/h2.js +17 -8
  141. package/dist/ui/components/typography/index.d.ts +0 -1
  142. package/dist/ui/components/typography/index.js +35 -24
  143. package/dist/ui/components/typography/legend.d.ts +1 -2
  144. package/dist/ui/components/typography/legend.js +18 -6
  145. package/dist/ui/components/typography/small.d.ts +0 -1
  146. package/dist/ui/components/typography/small.js +8 -7
  147. package/dist/ui/components/watchlist.d.ts +1 -2
  148. package/dist/ui/components/watchlist.js +77 -25
  149. package/dist/ui/fonts.css +7 -7
  150. package/dist/ui/footer.d.ts +1 -2
  151. package/dist/ui/footer.js +61 -25
  152. package/dist/ui/globals.css +5 -1
  153. package/dist/ui/header.d.ts +1 -2
  154. package/dist/ui/header.js +255 -60
  155. package/dist/ui/layout-wrapper.d.ts +1 -2
  156. package/dist/ui/layout-wrapper.js +5 -4
  157. package/dist/utils/color.d.ts +0 -1
  158. package/dist/utils/color.js +8 -9
  159. package/dist/utils/index.d.ts +0 -1
  160. package/dist/utils/index.js +37 -38
  161. package/dist/utils/poly.d.ts +0 -1
  162. package/dist/utils/poly.js +1 -2
  163. package/package.json +42 -24
  164. package/dist/assets/filler-bg0.jpg +0 -0
  165. package/dist/fonts.d.ts.map +0 -1
  166. package/dist/fonts.js.map +0 -1
  167. package/dist/hooks/use-capped-frame.d.ts.map +0 -1
  168. package/dist/hooks/use-capped-frame.js.map +0 -1
  169. package/dist/hooks/use-css-var-dims.d.ts.map +0 -1
  170. package/dist/hooks/use-css-var-dims.js.map +0 -1
  171. package/dist/hooks/use-gpu-tier.d.ts.map +0 -1
  172. package/dist/hooks/use-gpu-tier.js.map +0 -1
  173. package/dist/hooks/use-render-loop.d.ts.map +0 -1
  174. package/dist/hooks/use-render-loop.js.map +0 -1
  175. package/dist/hooks/use-smooth-controls.d.ts.map +0 -1
  176. package/dist/hooks/use-smooth-controls.js.map +0 -1
  177. package/dist/index.d.ts.map +0 -1
  178. package/dist/index.js.map +0 -1
  179. package/dist/ui/basic-page.d.ts.map +0 -1
  180. package/dist/ui/basic-page.js.map +0 -1
  181. package/dist/ui/components/animated-count.d.ts.map +0 -1
  182. package/dist/ui/components/animated-count.js.map +0 -1
  183. package/dist/ui/components/ascii.d.ts.map +0 -1
  184. package/dist/ui/components/ascii.js.map +0 -1
  185. package/dist/ui/components/badge.d.ts.map +0 -1
  186. package/dist/ui/components/badge.js.map +0 -1
  187. package/dist/ui/components/badges/nous-girl.d.ts.map +0 -1
  188. package/dist/ui/components/badges/nous-girl.js.map +0 -1
  189. package/dist/ui/components/blend-mode.d.ts.map +0 -1
  190. package/dist/ui/components/blend-mode.js.map +0 -1
  191. package/dist/ui/components/blink.d.ts.map +0 -1
  192. package/dist/ui/components/blink.js.map +0 -1
  193. package/dist/ui/components/button.d.ts.map +0 -1
  194. package/dist/ui/components/button.js.map +0 -1
  195. package/dist/ui/components/command-block.d.ts.map +0 -1
  196. package/dist/ui/components/command-block.js.map +0 -1
  197. package/dist/ui/components/cursor.d.ts.map +0 -1
  198. package/dist/ui/components/cursor.js.map +0 -1
  199. package/dist/ui/components/dropdown-menu.d.ts.map +0 -1
  200. package/dist/ui/components/dropdown-menu.js.map +0 -1
  201. package/dist/ui/components/fit-text/index.d.ts.map +0 -1
  202. package/dist/ui/components/fit-text/index.js.map +0 -1
  203. package/dist/ui/components/graphs/bar-chart.d.ts.map +0 -1
  204. package/dist/ui/components/graphs/bar-chart.js.map +0 -1
  205. package/dist/ui/components/graphs/index.d.ts.map +0 -1
  206. package/dist/ui/components/graphs/index.js.map +0 -1
  207. package/dist/ui/components/graphs/line-chart.d.ts.map +0 -1
  208. package/dist/ui/components/graphs/line-chart.js.map +0 -1
  209. package/dist/ui/components/graphs/utils.d.ts.map +0 -1
  210. package/dist/ui/components/graphs/utils.js.map +0 -1
  211. package/dist/ui/components/grid/index.d.ts.map +0 -1
  212. package/dist/ui/components/grid/index.js.map +0 -1
  213. package/dist/ui/components/hover-bg.d.ts.map +0 -1
  214. package/dist/ui/components/hover-bg.js.map +0 -1
  215. package/dist/ui/components/icons/arrow.d.ts.map +0 -1
  216. package/dist/ui/components/icons/arrow.js.map +0 -1
  217. package/dist/ui/components/icons/chevron.d.ts.map +0 -1
  218. package/dist/ui/components/icons/chevron.js.map +0 -1
  219. package/dist/ui/components/icons/discord.d.ts.map +0 -1
  220. package/dist/ui/components/icons/discord.js.map +0 -1
  221. package/dist/ui/components/icons/eye.d.ts.map +0 -1
  222. package/dist/ui/components/icons/eye.js.map +0 -1
  223. package/dist/ui/components/icons/gear.d.ts.map +0 -1
  224. package/dist/ui/components/icons/gear.js.map +0 -1
  225. package/dist/ui/components/icons/github.d.ts.map +0 -1
  226. package/dist/ui/components/icons/github.js.map +0 -1
  227. package/dist/ui/components/icons/hamburger.d.ts.map +0 -1
  228. package/dist/ui/components/icons/hamburger.js.map +0 -1
  229. package/dist/ui/components/icons/heart.d.ts.map +0 -1
  230. package/dist/ui/components/icons/heart.js.map +0 -1
  231. package/dist/ui/components/icons/index.d.ts.map +0 -1
  232. package/dist/ui/components/icons/index.js.map +0 -1
  233. package/dist/ui/components/icons/link.d.ts.map +0 -1
  234. package/dist/ui/components/icons/link.js.map +0 -1
  235. package/dist/ui/components/icons/minus.d.ts.map +0 -1
  236. package/dist/ui/components/icons/minus.js.map +0 -1
  237. package/dist/ui/components/icons/search.d.ts.map +0 -1
  238. package/dist/ui/components/icons/search.js.map +0 -1
  239. package/dist/ui/components/image-distortion.d.ts.map +0 -1
  240. package/dist/ui/components/image-distortion.js.map +0 -1
  241. package/dist/ui/components/leva-client.d.ts.map +0 -1
  242. package/dist/ui/components/leva-client.js.map +0 -1
  243. package/dist/ui/components/list-item.d.ts.map +0 -1
  244. package/dist/ui/components/list-item.js.map +0 -1
  245. package/dist/ui/components/modal/index.d.ts.map +0 -1
  246. package/dist/ui/components/modal/index.js.map +0 -1
  247. package/dist/ui/components/overlays/blend-modes.d.ts.map +0 -1
  248. package/dist/ui/components/overlays/blend-modes.js.map +0 -1
  249. package/dist/ui/components/overlays/glitch.d.ts.map +0 -1
  250. package/dist/ui/components/overlays/glitch.js.map +0 -1
  251. package/dist/ui/components/overlays/greys.d.ts.map +0 -1
  252. package/dist/ui/components/overlays/greys.js.map +0 -1
  253. package/dist/ui/components/overlays/index.d.ts.map +0 -1
  254. package/dist/ui/components/overlays/index.js.map +0 -1
  255. package/dist/ui/components/overlays/lens-layers.d.ts.map +0 -1
  256. package/dist/ui/components/overlays/lens-layers.js.map +0 -1
  257. package/dist/ui/components/overlays/lens.d.ts.map +0 -1
  258. package/dist/ui/components/overlays/lens.js.map +0 -1
  259. package/dist/ui/components/overlays/noise.d.ts.map +0 -1
  260. package/dist/ui/components/overlays/noise.js.map +0 -1
  261. package/dist/ui/components/overlays/vignette.d.ts.map +0 -1
  262. package/dist/ui/components/overlays/vignette.js.map +0 -1
  263. package/dist/ui/components/poster.d.ts.map +0 -1
  264. package/dist/ui/components/poster.js.map +0 -1
  265. package/dist/ui/components/progress.d.ts.map +0 -1
  266. package/dist/ui/components/progress.js.map +0 -1
  267. package/dist/ui/components/scene-canvas.d.ts.map +0 -1
  268. package/dist/ui/components/scene-canvas.js.map +0 -1
  269. package/dist/ui/components/scramble.d.ts.map +0 -1
  270. package/dist/ui/components/scramble.js.map +0 -1
  271. package/dist/ui/components/segmented.d.ts.map +0 -1
  272. package/dist/ui/components/segmented.js.map +0 -1
  273. package/dist/ui/components/select.d.ts.map +0 -1
  274. package/dist/ui/components/select.js.map +0 -1
  275. package/dist/ui/components/selection-switcher.d.ts.map +0 -1
  276. package/dist/ui/components/selection-switcher.js.map +0 -1
  277. package/dist/ui/components/shader.d.ts.map +0 -1
  278. package/dist/ui/components/shader.js.map +0 -1
  279. package/dist/ui/components/socials.d.ts.map +0 -1
  280. package/dist/ui/components/socials.js.map +0 -1
  281. package/dist/ui/components/spinner.d.ts.map +0 -1
  282. package/dist/ui/components/spinner.js.map +0 -1
  283. package/dist/ui/components/stats.d.ts.map +0 -1
  284. package/dist/ui/components/stats.js.map +0 -1
  285. package/dist/ui/components/switch.d.ts.map +0 -1
  286. package/dist/ui/components/switch.js.map +0 -1
  287. package/dist/ui/components/tabs.d.ts.map +0 -1
  288. package/dist/ui/components/tabs.js.map +0 -1
  289. package/dist/ui/components/terminal-demo.d.ts.map +0 -1
  290. package/dist/ui/components/terminal-demo.js.map +0 -1
  291. package/dist/ui/components/theme-toggle.d.ts.map +0 -1
  292. package/dist/ui/components/theme-toggle.js.map +0 -1
  293. package/dist/ui/components/tier-card.d.ts.map +0 -1
  294. package/dist/ui/components/tier-card.js.map +0 -1
  295. package/dist/ui/components/tv.d.ts.map +0 -1
  296. package/dist/ui/components/tv.js.map +0 -1
  297. package/dist/ui/components/typography/h1.d.ts.map +0 -1
  298. package/dist/ui/components/typography/h1.js.map +0 -1
  299. package/dist/ui/components/typography/h2.d.ts.map +0 -1
  300. package/dist/ui/components/typography/h2.js.map +0 -1
  301. package/dist/ui/components/typography/index.d.ts.map +0 -1
  302. package/dist/ui/components/typography/index.js.map +0 -1
  303. package/dist/ui/components/typography/legend.d.ts.map +0 -1
  304. package/dist/ui/components/typography/legend.js.map +0 -1
  305. package/dist/ui/components/typography/small.d.ts.map +0 -1
  306. package/dist/ui/components/typography/small.js.map +0 -1
  307. package/dist/ui/components/watchlist.d.ts.map +0 -1
  308. package/dist/ui/components/watchlist.js.map +0 -1
  309. package/dist/ui/footer.d.ts.map +0 -1
  310. package/dist/ui/footer.js.map +0 -1
  311. package/dist/ui/header.d.ts.map +0 -1
  312. package/dist/ui/header.js.map +0 -1
  313. package/dist/ui/layout-wrapper.d.ts.map +0 -1
  314. package/dist/ui/layout-wrapper.js.map +0 -1
  315. package/dist/utils/color.d.ts.map +0 -1
  316. package/dist/utils/color.js.map +0 -1
  317. package/dist/utils/index.d.ts.map +0 -1
  318. package/dist/utils/index.js.map +0 -1
  319. package/dist/utils/poly.d.ts.map +0 -1
  320. package/dist/utils/poly.js.map +0 -1
@@ -1,128 +1,178 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Canvas, useFrame, useThree } from '@react-three/fiber';
4
- import { Suspense, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
5
- import * as THREE from 'three';
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Canvas, useFrame, useThree } from "@react-three/fiber";
4
+ import {
5
+ Suspense,
6
+ useEffect,
7
+ useLayoutEffect,
8
+ useMemo,
9
+ useRef,
10
+ useState
11
+ } from "react";
12
+ import * as THREE from "three";
6
13
  const GL = {
7
- alpha: true,
8
- antialias: true,
9
- depth: true,
10
- outputColorSpace: 'srgb',
11
- powerPreference: 'high-performance',
12
- stencil: false
14
+ alpha: true,
15
+ antialias: true,
16
+ depth: true,
17
+ outputColorSpace: "srgb",
18
+ powerPreference: "high-performance",
19
+ stencil: false
13
20
  };
14
21
  const tmp = {
15
- camDir: new THREE.Vector3(),
16
- hit: new THREE.Vector3(),
17
- ndc: new THREE.Vector2(),
18
- origin: new THREE.Vector3(0, 0, 0),
19
- plane: new THREE.Plane(),
20
- ray: new THREE.Raycaster()
22
+ camDir: new THREE.Vector3(),
23
+ hit: new THREE.Vector3(),
24
+ ndc: new THREE.Vector2(),
25
+ origin: new THREE.Vector3(0, 0, 0),
26
+ plane: new THREE.Plane(),
27
+ ray: new THREE.Raycaster()
21
28
  };
22
29
  function useBounds(target) {
23
- const bounds = useRef(null);
24
- useLayoutEffect(() => {
25
- if (!target) {
26
- return;
27
- }
28
- const measure = () => {
29
- const b = target.getBoundingClientRect();
30
- bounds.current = {
31
- height: b.height,
32
- pageX: b.left + window.scrollX,
33
- pageY: b.top + window.scrollY,
34
- width: b.width
35
- };
36
- };
37
- measure();
38
- const ro = new ResizeObserver(measure);
39
- ro.observe(target);
40
- ro.observe(document.body);
41
- window.addEventListener('resize', measure, { passive: true });
42
- return () => {
43
- ro.disconnect();
44
- window.removeEventListener('resize', measure);
45
- };
46
- }, [target]);
47
- return bounds;
30
+ const bounds = useRef(null);
31
+ useLayoutEffect(() => {
32
+ if (!target) {
33
+ return;
34
+ }
35
+ const measure = () => {
36
+ const b = target.getBoundingClientRect();
37
+ bounds.current = {
38
+ height: b.height,
39
+ pageX: b.left + window.scrollX,
40
+ pageY: b.top + window.scrollY,
41
+ width: b.width
42
+ };
43
+ };
44
+ measure();
45
+ const ro = new ResizeObserver(measure);
46
+ ro.observe(target);
47
+ ro.observe(document.body);
48
+ window.addEventListener("resize", measure, { passive: true });
49
+ return () => {
50
+ ro.disconnect();
51
+ window.removeEventListener("resize", measure);
52
+ };
53
+ }, [target]);
54
+ return bounds;
48
55
  }
49
- function PositionedGroup({ baseZoom, bounds, children }) {
50
- const ref = useRef(null);
51
- const { camera, size, viewport } = useThree();
52
- useFrame(() => {
53
- const g = ref.current;
54
- const b = bounds.current;
55
- if (!g || !b) {
56
- return;
57
- }
58
- const left = b.pageX - window.scrollX;
59
- const top = b.pageY - window.scrollY;
60
- tmp.ndc.set(((left + b.width / 2) / size.width) * 2 - 1, 1 - ((top + b.height / 2) / size.height) * 2);
61
- camera.getWorldDirection(tmp.camDir);
62
- tmp.plane.setFromNormalAndCoplanarPoint(tmp.camDir, tmp.origin);
63
- tmp.ray.setFromCamera(tmp.ndc, camera);
64
- const hit = tmp.ray.ray.intersectPlane(tmp.plane, tmp.hit);
65
- if (hit) {
66
- g.position.copy(hit);
67
- }
68
- const zoom = camera.zoom ?? 1;
69
- g.scale.setScalar(Math.min((b.width / size.width) * viewport.width, (b.height / size.height) * viewport.height) * (baseZoom > 0 ? zoom / baseZoom : 1));
70
- });
71
- return _jsx("group", { ref: ref, children: children });
56
+ function PositionedGroup({
57
+ baseZoom,
58
+ bounds,
59
+ children
60
+ }) {
61
+ const ref = useRef(null);
62
+ const { camera, size, viewport } = useThree();
63
+ useFrame(() => {
64
+ const g = ref.current;
65
+ const b = bounds.current;
66
+ if (!g || !b) {
67
+ return;
68
+ }
69
+ const left = b.pageX - window.scrollX;
70
+ const top = b.pageY - window.scrollY;
71
+ tmp.ndc.set(
72
+ (left + b.width / 2) / size.width * 2 - 1,
73
+ 1 - (top + b.height / 2) / size.height * 2
74
+ );
75
+ camera.getWorldDirection(tmp.camDir);
76
+ tmp.plane.setFromNormalAndCoplanarPoint(tmp.camDir, tmp.origin);
77
+ tmp.ray.setFromCamera(tmp.ndc, camera);
78
+ const hit = tmp.ray.ray.intersectPlane(tmp.plane, tmp.hit);
79
+ if (hit) {
80
+ g.position.copy(hit);
81
+ }
82
+ const zoom = camera.zoom ?? 1;
83
+ g.scale.setScalar(
84
+ Math.min(
85
+ b.width / size.width * viewport.width,
86
+ b.height / size.height * viewport.height
87
+ ) * (baseZoom > 0 ? zoom / baseZoom : 1)
88
+ );
89
+ });
90
+ return /* @__PURE__ */ jsx("group", { ref, children });
72
91
  }
73
- export function SceneCanvas({ camera, children, className, contained, frameloop = 'always', noEvents, style }) {
74
- const [container, setContainer] = useState(null);
75
- const baseZoom = camera?.zoom ?? 150;
76
- const bounds = useBounds(contained ? (container?.parentElement ?? null) : null);
77
- useEffect(() => {
78
- const el = contained && !noEvents ? container : null;
79
- if (!el) {
80
- return;
92
+ export function SceneCanvas({
93
+ camera,
94
+ children,
95
+ className,
96
+ contained,
97
+ frameloop = "always",
98
+ noEvents,
99
+ style
100
+ }) {
101
+ const [container, setContainer] = useState(null);
102
+ const baseZoom = camera?.zoom ?? 150;
103
+ const bounds = useBounds(
104
+ contained ? container?.parentElement ?? null : null
105
+ );
106
+ useEffect(() => {
107
+ const el = contained && !noEvents ? container : null;
108
+ if (!el) {
109
+ return;
110
+ }
111
+ const lock = () => document.body.style.userSelect = "none";
112
+ const unlock = () => document.body.style.userSelect = "";
113
+ el.addEventListener("pointerdown", lock);
114
+ window.addEventListener("pointerup", unlock);
115
+ return () => {
116
+ el.removeEventListener("pointerdown", lock);
117
+ window.removeEventListener("pointerup", unlock);
118
+ };
119
+ }, [container, contained, noEvents]);
120
+ const [pageHidden, setPageHidden] = useState(
121
+ typeof document !== "undefined" && document.hidden
122
+ );
123
+ useEffect(() => {
124
+ const onVisibility = () => setPageHidden(document.hidden);
125
+ document.addEventListener("visibilitychange", onVisibility);
126
+ return () => document.removeEventListener("visibilitychange", onVisibility);
127
+ }, []);
128
+ const effectiveFrameloop = pageHidden ? "never" : frameloop;
129
+ const cam = useMemo(
130
+ () => ({
131
+ far: camera?.far ?? 100,
132
+ near: camera?.near ?? -100,
133
+ position: camera?.position ?? [0, 0, 10],
134
+ zoom: baseZoom * (contained ? 1 : 2)
135
+ }),
136
+ [baseZoom, camera, contained]
137
+ );
138
+ const canvas = /* @__PURE__ */ jsx(
139
+ Canvas,
140
+ {
141
+ camera: cam,
142
+ className,
143
+ dpr: [1, 2],
144
+ eventPrefix: contained ? "client" : "offset",
145
+ eventSource: contained ? container ?? void 0 : void 0,
146
+ frameloop: effectiveFrameloop,
147
+ gl: GL,
148
+ orthographic: true,
149
+ style: contained ? {
150
+ height: "100dvh",
151
+ inset: 0,
152
+ pointerEvents: "none",
153
+ position: "fixed",
154
+ width: "100dvw",
155
+ zIndex: 0,
156
+ ...style
157
+ } : { height: "100%", width: "100%", ...style },
158
+ children: contained ? /* @__PURE__ */ jsx(PositionedGroup, { baseZoom, bounds, children: children() }) : children()
159
+ }
160
+ );
161
+ return contained ? /* @__PURE__ */ jsxs(Suspense, { children: [
162
+ /* @__PURE__ */ jsx(
163
+ "div",
164
+ {
165
+ ref: setContainer,
166
+ style: {
167
+ height: "100%",
168
+ inset: 0,
169
+ pointerEvents: noEvents ? "none" : "auto",
170
+ position: "absolute",
171
+ width: "100%",
172
+ zIndex: 1
81
173
  }
82
- const lock = () => (document.body.style.userSelect = 'none');
83
- const unlock = () => (document.body.style.userSelect = '');
84
- el.addEventListener('pointerdown', lock);
85
- window.addEventListener('pointerup', unlock);
86
- return () => {
87
- el.removeEventListener('pointerdown', lock);
88
- window.removeEventListener('pointerup', unlock);
89
- };
90
- }, [container, contained, noEvents]);
91
- // Pause the R3F render loop when the tab is hidden. Even on
92
- // `frameloop="always"` scenes we don't want the GPU running while the
93
- // user can't see anything — this is the dominant fix for the "fans
94
- // crank up after hours of idle" symptom.
95
- const [pageHidden, setPageHidden] = useState(typeof document !== 'undefined' && document.hidden);
96
- useEffect(() => {
97
- const onVisibility = () => setPageHidden(document.hidden);
98
- document.addEventListener('visibilitychange', onVisibility);
99
- return () => document.removeEventListener('visibilitychange', onVisibility);
100
- }, []);
101
- const effectiveFrameloop = pageHidden ? 'never' : frameloop;
102
- const cam = useMemo(() => ({
103
- far: camera?.far ?? 100,
104
- near: camera?.near ?? -100,
105
- position: camera?.position ?? [0, 0, 10],
106
- zoom: baseZoom * (contained ? 1 : 2)
107
- }), [baseZoom, camera, contained]);
108
- const canvas = (_jsx(Canvas, { camera: cam, className: className, dpr: [1, 2], eventPrefix: contained ? 'client' : 'offset', eventSource: contained ? (container ?? undefined) : undefined, frameloop: effectiveFrameloop, gl: GL, orthographic: true, style: contained
109
- ? {
110
- height: '100dvh',
111
- inset: 0,
112
- pointerEvents: 'none',
113
- position: 'fixed',
114
- width: '100dvw',
115
- zIndex: 0,
116
- ...style
117
- }
118
- : { height: '100%', width: '100%', ...style }, children: contained ? (_jsx(PositionedGroup, { baseZoom: baseZoom, bounds: bounds, children: children() })) : (children()) }));
119
- return contained ? (_jsxs(Suspense, { children: [_jsx("div", { ref: setContainer, style: {
120
- height: '100%',
121
- inset: 0,
122
- pointerEvents: noEvents ? 'none' : 'auto',
123
- position: 'absolute',
124
- width: '100%',
125
- zIndex: 1
126
- } }), canvas] })) : (canvas);
174
+ }
175
+ ),
176
+ canvas
177
+ ] }) : canvas;
127
178
  }
128
- //# sourceMappingURL=scene-canvas.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RefObject } from 'react';
2
- export declare function Scramble({ children, dur, spread, target }: ScrambleProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Scramble({ children, dur, spread, target }: ScrambleProps): import("react").JSX.Element;
3
3
  interface ScrambleProps {
4
4
  children: string;
5
5
  dur?: number;
@@ -7,4 +7,3 @@ interface ScrambleProps {
7
7
  target?: RefObject<HTMLElement | null>;
8
8
  }
9
9
  export {};
10
- //# sourceMappingURL=scramble.d.ts.map
@@ -1,61 +1,62 @@
1
- 'use client';
2
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from 'react';
4
- const CHARS = '.,·-─~+:;=*π""┐┌┘┴┬╗╔╝╚╬╠╣╩╦║░▒▓█▄▀▌▐■!?&#$@0123456789*';
5
- export function Scramble({ children, dur = 666, spread = 1, target }) {
6
- const text = String(children);
7
- const len = text.length;
8
- const [display, setDisplay] = useState(text);
9
- const frame = useRef(null);
10
- const waves = useRef([]);
11
- useEffect(() => {
12
- const el = target?.current;
13
- if (!el) {
14
- return;
15
- }
16
- const animate = () => {
17
- const t = Date.now();
18
- waves.current = waves.current.filter(w => t - w.time < dur);
19
- if (!waves.current.length) {
20
- setDisplay(text);
21
- frame.current = null;
22
- return;
23
- }
24
- setDisplay(text
25
- .split('')
26
- .map((c, i) => {
27
- if (c === ' ') {
28
- return c;
29
- }
30
- for (const w of waves.current) {
31
- const age = t - w.time;
32
- const rad = (Math.min(age / dur, 1) *
33
- (Math.max(w.pos, len - w.pos - 1) + 5)) /
34
- spread;
35
- const dist = Math.abs(i - w.pos);
36
- const int = rad - dist;
37
- if (dist <= rad && int > 0 && int <= 3) {
38
- return CHARS[(dist * 3 + ((age / 40) | 0)) % CHARS.length];
39
- }
40
- }
41
- return c;
42
- })
43
- .join(''));
44
- frame.current = requestAnimationFrame(animate);
45
- };
46
- const onEnter = () => {
47
- waves.current.push({ pos: len >> 1, time: Date.now() });
48
- frame.current ?? (frame.current = requestAnimationFrame(animate));
49
- };
50
- el.addEventListener('mouseenter', onEnter);
51
- return () => {
52
- el.removeEventListener('mouseenter', onEnter);
53
- frame.current && cancelAnimationFrame(frame.current);
54
- };
55
- }, [target, text, len, dur, spread]);
56
- useEffect(() => {
1
+ "use client";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ const CHARS = '.,\xB7-\u2500~+:;=*\u03C0""\u2510\u250C\u2518\u2534\u252C\u2557\u2554\u255D\u255A\u256C\u2560\u2563\u2569\u2566\u2551\u2591\u2592\u2593\u2588\u2584\u2580\u258C\u2590\u25A0!?&#$@0123456789*';
5
+ export function Scramble({
6
+ children,
7
+ dur = 666,
8
+ spread = 1,
9
+ target
10
+ }) {
11
+ const text = String(children);
12
+ const len = text.length;
13
+ const [display, setDisplay] = useState(text);
14
+ const frame = useRef(null);
15
+ const waves = useRef([]);
16
+ useEffect(() => {
17
+ const el = target?.current;
18
+ if (!el) {
19
+ return;
20
+ }
21
+ const animate = () => {
22
+ const t = Date.now();
23
+ waves.current = waves.current.filter((w) => t - w.time < dur);
24
+ if (!waves.current.length) {
57
25
  setDisplay(text);
58
- }, [text]);
59
- return _jsx(_Fragment, { children: display });
26
+ frame.current = null;
27
+ return;
28
+ }
29
+ setDisplay(
30
+ text.split("").map((c, i) => {
31
+ if (c === " ") {
32
+ return c;
33
+ }
34
+ for (const w of waves.current) {
35
+ const age = t - w.time;
36
+ const rad = Math.min(age / dur, 1) * (Math.max(w.pos, len - w.pos - 1) + 5) / spread;
37
+ const dist = Math.abs(i - w.pos);
38
+ const int = rad - dist;
39
+ if (dist <= rad && int > 0 && int <= 3) {
40
+ return CHARS[(dist * 3 + (age / 40 | 0)) % CHARS.length];
41
+ }
42
+ }
43
+ return c;
44
+ }).join("")
45
+ );
46
+ frame.current = requestAnimationFrame(animate);
47
+ };
48
+ const onEnter = () => {
49
+ waves.current.push({ pos: len >> 1, time: Date.now() });
50
+ frame.current ??= requestAnimationFrame(animate);
51
+ };
52
+ el.addEventListener("mouseenter", onEnter);
53
+ return () => {
54
+ el.removeEventListener("mouseenter", onEnter);
55
+ frame.current && cancelAnimationFrame(frame.current);
56
+ };
57
+ }, [target, text, len, dur, spread]);
58
+ useEffect(() => {
59
+ setDisplay(text);
60
+ }, [text]);
61
+ return /* @__PURE__ */ jsx(Fragment, { children: display });
60
62
  }
61
- //# sourceMappingURL=scramble.js.map
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
- export declare function Segmented<T extends string>({ className, onChange, options, size, value }: SegmentedProps<T>): import("react/jsx-runtime").JSX.Element;
3
- export declare function FilterGroup({ children, className, label }: FilterGroupProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Segmented<T extends string>({ className, onChange, options, size, value }: SegmentedProps<T>): import("react").JSX.Element;
3
+ export declare function FilterGroup({ children, className, label }: FilterGroupProps): import("react").JSX.Element;
4
4
  interface FilterGroupProps {
5
5
  children: ReactNode;
6
6
  className?: string;
@@ -18,4 +18,3 @@ interface SegmentedProps<T extends string> {
18
18
  value: T;
19
19
  }
20
20
  export {};
21
- //# sourceMappingURL=segmented.d.ts.map
@@ -1,15 +1,50 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { cn } from '../../utils';
4
- export function Segmented({ className, onChange, options, size = 'sm', value }) {
5
- return (_jsx("div", { className: cn('inline-flex border border-midground/15 bg-background/30', className), role: "radiogroup", children: options.map(opt => {
6
- const active = opt.value === value;
7
- return (_jsx("button", { "aria-checked": active, className: cn('font-mondwest tracking-[0.1em] uppercase', 'transition-colors cursor-pointer whitespace-nowrap', 'border-r border-midground/15 last:border-r-0', 'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-midground/30', size === 'sm' && 'h-7 px-2.5 text-[0.65rem]', size === 'md' && 'h-8 px-3 text-xs', active
8
- ? 'bg-midground text-background'
9
- : 'text-midground/60 hover:bg-midground/10 hover:text-midground'), onClick: () => onChange(opt.value), role: "radio", type: "button", children: opt.label }, opt.value));
10
- }) }));
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../utils/index.js";
4
+ export function Segmented({
5
+ className,
6
+ onChange,
7
+ options,
8
+ size = "sm",
9
+ value
10
+ }) {
11
+ return /* @__PURE__ */ jsx(
12
+ "div",
13
+ {
14
+ className: cn(
15
+ "inline-flex border border-midground/15 bg-background/30",
16
+ className
17
+ ),
18
+ role: "radiogroup",
19
+ children: options.map((opt) => {
20
+ const active = opt.value === value;
21
+ return /* @__PURE__ */ jsx(
22
+ "button",
23
+ {
24
+ "aria-checked": active,
25
+ className: cn(
26
+ "font-mondwest tracking-[0.1em] uppercase",
27
+ "transition-colors cursor-pointer whitespace-nowrap",
28
+ "border-r border-midground/15 last:border-r-0",
29
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-midground/30",
30
+ size === "sm" && "h-7 px-2.5 text-[0.65rem]",
31
+ size === "md" && "h-8 px-3 text-xs",
32
+ active ? "bg-midground text-background" : "text-midground/60 hover:bg-midground/10 hover:text-midground"
33
+ ),
34
+ onClick: () => onChange(opt.value),
35
+ role: "radio",
36
+ type: "button",
37
+ children: opt.label
38
+ },
39
+ opt.value
40
+ );
41
+ })
42
+ }
43
+ );
11
44
  }
12
45
  export function FilterGroup({ children, className, label }) {
13
- return (_jsxs("div", { className: cn('flex items-center gap-2', className), children: [_jsx("span", { className: "font-mondwest text-[0.65rem] tracking-[0.12em] uppercase text-midground/50", children: label }), children] }));
46
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
47
+ /* @__PURE__ */ jsx("span", { className: "font-mondwest text-[0.65rem] tracking-[0.12em] uppercase text-midground/50", children: label }),
48
+ children
49
+ ] });
14
50
  }
15
- //# sourceMappingURL=segmented.js.map
@@ -1,5 +1,5 @@
1
1
  import { type CSSProperties, type ReactNode } from 'react';
2
- export declare function Select({ children, className, disabled, id, onValueChange, placeholder, style, value }: SelectProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Select({ children, className, disabled, id, onValueChange, placeholder, style, value }: SelectProps): import("react").JSX.Element;
3
3
  export declare function SelectOption(_props: SelectOptionProps): null;
4
4
  interface SelectOptionProps {
5
5
  children: ReactNode;
@@ -16,4 +16,3 @@ interface SelectProps {
16
16
  value?: string;
17
17
  }
18
18
  export {};
19
- //# sourceMappingURL=select.d.ts.map