@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.
Files changed (317) hide show
  1. package/dist/assets/filler-bg0.webp +0 -0
  2. package/dist/assets.d.ts +38 -0
  3. package/dist/fonts.d.ts +0 -1
  4. package/dist/fonts.js +5 -7
  5. package/dist/hooks/use-capped-frame.d.ts +0 -1
  6. package/dist/hooks/use-capped-frame.js +12 -13
  7. package/dist/hooks/use-css-var-dims.d.ts +0 -1
  8. package/dist/hooks/use-css-var-dims.js +26 -21
  9. package/dist/hooks/use-gpu-tier.d.ts +0 -1
  10. package/dist/hooks/use-gpu-tier.js +90 -110
  11. package/dist/hooks/use-render-loop.d.ts +0 -1
  12. package/dist/hooks/use-render-loop.js +58 -58
  13. package/dist/hooks/use-smooth-controls.d.ts +0 -1
  14. package/dist/hooks/use-smooth-controls.js +204 -206
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +84 -58
  17. package/dist/ui/basic-page.d.ts +1 -2
  18. package/dist/ui/basic-page.js +15 -7
  19. package/dist/ui/components/animated-count.d.ts +1 -2
  20. package/dist/ui/components/animated-count.js +109 -85
  21. package/dist/ui/components/ascii.d.ts +2 -3
  22. package/dist/ui/components/ascii.js +75 -59
  23. package/dist/ui/components/badge.d.ts +1 -2
  24. package/dist/ui/components/badge.js +35 -18
  25. package/dist/ui/components/badges/nous-girl.d.ts +1 -2
  26. package/dist/ui/components/badges/nous-girl.js +80 -3
  27. package/dist/ui/components/blend-mode.d.ts +1 -2
  28. package/dist/ui/components/blend-mode.js +55 -63
  29. package/dist/ui/components/blink.d.ts +1 -2
  30. package/dist/ui/components/blink.js +15 -6
  31. package/dist/ui/components/button.d.ts +2 -3
  32. package/dist/ui/components/button.js +139 -90
  33. package/dist/ui/components/command-block.d.ts +2 -3
  34. package/dist/ui/components/command-block.js +52 -24
  35. package/dist/ui/components/cursor.d.ts +1 -2
  36. package/dist/ui/components/cursor.js +93 -54
  37. package/dist/ui/components/dropdown-menu.d.ts +1 -2
  38. package/dist/ui/components/dropdown-menu.js +99 -51
  39. package/dist/ui/components/fit-text/index.d.ts +0 -1
  40. package/dist/ui/components/fit-text/index.js +21 -13
  41. package/dist/ui/components/graphs/bar-chart.d.ts +1 -2
  42. package/dist/ui/components/graphs/bar-chart.js +116 -63
  43. package/dist/ui/components/graphs/index.d.ts +0 -1
  44. package/dist/ui/components/graphs/index.js +3 -4
  45. package/dist/ui/components/graphs/line-chart.d.ts +1 -2
  46. package/dist/ui/components/graphs/line-chart.js +159 -102
  47. package/dist/ui/components/graphs/utils.d.ts +2 -3
  48. package/dist/ui/components/graphs/utils.js +147 -114
  49. package/dist/ui/components/grid/index.d.ts +0 -1
  50. package/dist/ui/components/grid/index.js +12 -9
  51. package/dist/ui/components/hover-bg.d.ts +0 -1
  52. package/dist/ui/components/hover-bg.js +11 -6
  53. package/dist/ui/components/icons/arrow.d.ts +1 -2
  54. package/dist/ui/components/icons/arrow.js +42 -5
  55. package/dist/ui/components/icons/chevron.d.ts +1 -2
  56. package/dist/ui/components/icons/chevron.js +49 -5
  57. package/dist/ui/components/icons/discord.d.ts +1 -2
  58. package/dist/ui/components/icons/discord.js +12 -4
  59. package/dist/ui/components/icons/eye.d.ts +1 -2
  60. package/dist/ui/components/icons/eye.js +5 -3
  61. package/dist/ui/components/icons/gear.d.ts +1 -2
  62. package/dist/ui/components/icons/gear.js +28 -14
  63. package/dist/ui/components/icons/github.d.ts +1 -2
  64. package/dist/ui/components/icons/github.js +12 -4
  65. package/dist/ui/components/icons/hamburger.d.ts +1 -2
  66. package/dist/ui/components/icons/hamburger.js +54 -5
  67. package/dist/ui/components/icons/heart.d.ts +1 -2
  68. package/dist/ui/components/icons/heart.js +8 -3
  69. package/dist/ui/components/icons/index.d.ts +0 -1
  70. package/dist/ui/components/icons/index.js +11 -12
  71. package/dist/ui/components/icons/link.d.ts +1 -2
  72. package/dist/ui/components/icons/link.js +10 -3
  73. package/dist/ui/components/icons/minus.d.ts +1 -2
  74. package/dist/ui/components/icons/minus.js +10 -3
  75. package/dist/ui/components/icons/search.d.ts +1 -2
  76. package/dist/ui/components/icons/search.js +30 -3
  77. package/dist/ui/components/image-distortion.d.ts +1 -2
  78. package/dist/ui/components/image-distortion.js +300 -265
  79. package/dist/ui/components/leva-client.d.ts +1 -2
  80. package/dist/ui/components/leva-client.js +9 -10
  81. package/dist/ui/components/list-item.d.ts +0 -1
  82. package/dist/ui/components/list-item.js +26 -10
  83. package/dist/ui/components/modal/index.d.ts +1 -2
  84. package/dist/ui/components/modal/index.js +33 -14
  85. package/dist/ui/components/overlays/blend-modes.d.ts +0 -1
  86. package/dist/ui/components/overlays/blend-modes.js +11 -12
  87. package/dist/ui/components/overlays/glitch.d.ts +1 -2
  88. package/dist/ui/components/overlays/glitch.js +115 -110
  89. package/dist/ui/components/overlays/greys.d.ts +1 -2
  90. package/dist/ui/components/overlays/greys.js +200 -179
  91. package/dist/ui/components/overlays/index.d.ts +1 -2
  92. package/dist/ui/components/overlays/index.js +31 -17
  93. package/dist/ui/components/overlays/lens-layers.d.ts +1 -2
  94. package/dist/ui/components/overlays/lens-layers.js +89 -65
  95. package/dist/ui/components/overlays/lens.d.ts +0 -1
  96. package/dist/ui/components/overlays/lens.js +46 -52
  97. package/dist/ui/components/overlays/noise.d.ts +1 -2
  98. package/dist/ui/components/overlays/noise.js +112 -113
  99. package/dist/ui/components/overlays/vignette.d.ts +1 -2
  100. package/dist/ui/components/overlays/vignette.js +44 -38
  101. package/dist/ui/components/poster.d.ts +1 -2
  102. package/dist/ui/components/poster.js +240 -87
  103. package/dist/ui/components/progress.d.ts +1 -2
  104. package/dist/ui/components/progress.js +52 -12
  105. package/dist/ui/components/scene-canvas.d.ts +1 -2
  106. package/dist/ui/components/scene-canvas.js +169 -119
  107. package/dist/ui/components/scramble.d.ts +1 -2
  108. package/dist/ui/components/scramble.js +60 -59
  109. package/dist/ui/components/segmented.d.ts +2 -3
  110. package/dist/ui/components/segmented.js +47 -12
  111. package/dist/ui/components/select.d.ts +1 -2
  112. package/dist/ui/components/select.js +207 -120
  113. package/dist/ui/components/selection-switcher.d.ts +0 -1
  114. package/dist/ui/components/selection-switcher.js +29 -25
  115. package/dist/ui/components/shader.d.ts +1 -2
  116. package/dist/ui/components/shader.js +56 -38
  117. package/dist/ui/components/socials.d.ts +1 -2
  118. package/dist/ui/components/socials.js +18 -7
  119. package/dist/ui/components/spinner.d.ts +1 -2
  120. package/dist/ui/components/spinner.js +36 -25
  121. package/dist/ui/components/stats.d.ts +1 -2
  122. package/dist/ui/components/stats.js +33 -9
  123. package/dist/ui/components/switch.d.ts +0 -1
  124. package/dist/ui/components/switch.js +35 -11
  125. package/dist/ui/components/tabs.d.ts +3 -4
  126. package/dist/ui/components/tabs.js +38 -12
  127. package/dist/ui/components/terminal-demo.d.ts +1 -2
  128. package/dist/ui/components/terminal-demo.js +119 -74
  129. package/dist/ui/components/theme-toggle.d.ts +1 -2
  130. package/dist/ui/components/theme-toggle.js +63 -8
  131. package/dist/ui/components/tier-card.d.ts +1 -2
  132. package/dist/ui/components/tier-card.js +144 -24
  133. package/dist/ui/components/tv.d.ts +1 -2
  134. package/dist/ui/components/tv.js +138 -90
  135. package/dist/ui/components/typography/h1.d.ts +0 -1
  136. package/dist/ui/components/typography/h1.js +17 -8
  137. package/dist/ui/components/typography/h2.d.ts +0 -1
  138. package/dist/ui/components/typography/h2.js +17 -8
  139. package/dist/ui/components/typography/index.d.ts +0 -1
  140. package/dist/ui/components/typography/index.js +35 -24
  141. package/dist/ui/components/typography/legend.d.ts +1 -2
  142. package/dist/ui/components/typography/legend.js +18 -6
  143. package/dist/ui/components/typography/small.d.ts +0 -1
  144. package/dist/ui/components/typography/small.js +8 -7
  145. package/dist/ui/components/watchlist.d.ts +1 -2
  146. package/dist/ui/components/watchlist.js +77 -25
  147. package/dist/ui/fonts.css +7 -7
  148. package/dist/ui/footer.d.ts +1 -2
  149. package/dist/ui/footer.js +61 -25
  150. package/dist/ui/header.d.ts +1 -2
  151. package/dist/ui/header.js +255 -60
  152. package/dist/ui/layout-wrapper.d.ts +1 -2
  153. package/dist/ui/layout-wrapper.js +5 -4
  154. package/dist/utils/color.d.ts +0 -1
  155. package/dist/utils/color.js +8 -9
  156. package/dist/utils/index.d.ts +0 -1
  157. package/dist/utils/index.js +37 -38
  158. package/dist/utils/poly.d.ts +0 -1
  159. package/dist/utils/poly.js +1 -2
  160. package/package.json +41 -24
  161. package/dist/assets/filler-bg0.jpg +0 -0
  162. package/dist/fonts.d.ts.map +0 -1
  163. package/dist/fonts.js.map +0 -1
  164. package/dist/hooks/use-capped-frame.d.ts.map +0 -1
  165. package/dist/hooks/use-capped-frame.js.map +0 -1
  166. package/dist/hooks/use-css-var-dims.d.ts.map +0 -1
  167. package/dist/hooks/use-css-var-dims.js.map +0 -1
  168. package/dist/hooks/use-gpu-tier.d.ts.map +0 -1
  169. package/dist/hooks/use-gpu-tier.js.map +0 -1
  170. package/dist/hooks/use-render-loop.d.ts.map +0 -1
  171. package/dist/hooks/use-render-loop.js.map +0 -1
  172. package/dist/hooks/use-smooth-controls.d.ts.map +0 -1
  173. package/dist/hooks/use-smooth-controls.js.map +0 -1
  174. package/dist/index.d.ts.map +0 -1
  175. package/dist/index.js.map +0 -1
  176. package/dist/ui/basic-page.d.ts.map +0 -1
  177. package/dist/ui/basic-page.js.map +0 -1
  178. package/dist/ui/components/animated-count.d.ts.map +0 -1
  179. package/dist/ui/components/animated-count.js.map +0 -1
  180. package/dist/ui/components/ascii.d.ts.map +0 -1
  181. package/dist/ui/components/ascii.js.map +0 -1
  182. package/dist/ui/components/badge.d.ts.map +0 -1
  183. package/dist/ui/components/badge.js.map +0 -1
  184. package/dist/ui/components/badges/nous-girl.d.ts.map +0 -1
  185. package/dist/ui/components/badges/nous-girl.js.map +0 -1
  186. package/dist/ui/components/blend-mode.d.ts.map +0 -1
  187. package/dist/ui/components/blend-mode.js.map +0 -1
  188. package/dist/ui/components/blink.d.ts.map +0 -1
  189. package/dist/ui/components/blink.js.map +0 -1
  190. package/dist/ui/components/button.d.ts.map +0 -1
  191. package/dist/ui/components/button.js.map +0 -1
  192. package/dist/ui/components/command-block.d.ts.map +0 -1
  193. package/dist/ui/components/command-block.js.map +0 -1
  194. package/dist/ui/components/cursor.d.ts.map +0 -1
  195. package/dist/ui/components/cursor.js.map +0 -1
  196. package/dist/ui/components/dropdown-menu.d.ts.map +0 -1
  197. package/dist/ui/components/dropdown-menu.js.map +0 -1
  198. package/dist/ui/components/fit-text/index.d.ts.map +0 -1
  199. package/dist/ui/components/fit-text/index.js.map +0 -1
  200. package/dist/ui/components/graphs/bar-chart.d.ts.map +0 -1
  201. package/dist/ui/components/graphs/bar-chart.js.map +0 -1
  202. package/dist/ui/components/graphs/index.d.ts.map +0 -1
  203. package/dist/ui/components/graphs/index.js.map +0 -1
  204. package/dist/ui/components/graphs/line-chart.d.ts.map +0 -1
  205. package/dist/ui/components/graphs/line-chart.js.map +0 -1
  206. package/dist/ui/components/graphs/utils.d.ts.map +0 -1
  207. package/dist/ui/components/graphs/utils.js.map +0 -1
  208. package/dist/ui/components/grid/index.d.ts.map +0 -1
  209. package/dist/ui/components/grid/index.js.map +0 -1
  210. package/dist/ui/components/hover-bg.d.ts.map +0 -1
  211. package/dist/ui/components/hover-bg.js.map +0 -1
  212. package/dist/ui/components/icons/arrow.d.ts.map +0 -1
  213. package/dist/ui/components/icons/arrow.js.map +0 -1
  214. package/dist/ui/components/icons/chevron.d.ts.map +0 -1
  215. package/dist/ui/components/icons/chevron.js.map +0 -1
  216. package/dist/ui/components/icons/discord.d.ts.map +0 -1
  217. package/dist/ui/components/icons/discord.js.map +0 -1
  218. package/dist/ui/components/icons/eye.d.ts.map +0 -1
  219. package/dist/ui/components/icons/eye.js.map +0 -1
  220. package/dist/ui/components/icons/gear.d.ts.map +0 -1
  221. package/dist/ui/components/icons/gear.js.map +0 -1
  222. package/dist/ui/components/icons/github.d.ts.map +0 -1
  223. package/dist/ui/components/icons/github.js.map +0 -1
  224. package/dist/ui/components/icons/hamburger.d.ts.map +0 -1
  225. package/dist/ui/components/icons/hamburger.js.map +0 -1
  226. package/dist/ui/components/icons/heart.d.ts.map +0 -1
  227. package/dist/ui/components/icons/heart.js.map +0 -1
  228. package/dist/ui/components/icons/index.d.ts.map +0 -1
  229. package/dist/ui/components/icons/index.js.map +0 -1
  230. package/dist/ui/components/icons/link.d.ts.map +0 -1
  231. package/dist/ui/components/icons/link.js.map +0 -1
  232. package/dist/ui/components/icons/minus.d.ts.map +0 -1
  233. package/dist/ui/components/icons/minus.js.map +0 -1
  234. package/dist/ui/components/icons/search.d.ts.map +0 -1
  235. package/dist/ui/components/icons/search.js.map +0 -1
  236. package/dist/ui/components/image-distortion.d.ts.map +0 -1
  237. package/dist/ui/components/image-distortion.js.map +0 -1
  238. package/dist/ui/components/leva-client.d.ts.map +0 -1
  239. package/dist/ui/components/leva-client.js.map +0 -1
  240. package/dist/ui/components/list-item.d.ts.map +0 -1
  241. package/dist/ui/components/list-item.js.map +0 -1
  242. package/dist/ui/components/modal/index.d.ts.map +0 -1
  243. package/dist/ui/components/modal/index.js.map +0 -1
  244. package/dist/ui/components/overlays/blend-modes.d.ts.map +0 -1
  245. package/dist/ui/components/overlays/blend-modes.js.map +0 -1
  246. package/dist/ui/components/overlays/glitch.d.ts.map +0 -1
  247. package/dist/ui/components/overlays/glitch.js.map +0 -1
  248. package/dist/ui/components/overlays/greys.d.ts.map +0 -1
  249. package/dist/ui/components/overlays/greys.js.map +0 -1
  250. package/dist/ui/components/overlays/index.d.ts.map +0 -1
  251. package/dist/ui/components/overlays/index.js.map +0 -1
  252. package/dist/ui/components/overlays/lens-layers.d.ts.map +0 -1
  253. package/dist/ui/components/overlays/lens-layers.js.map +0 -1
  254. package/dist/ui/components/overlays/lens.d.ts.map +0 -1
  255. package/dist/ui/components/overlays/lens.js.map +0 -1
  256. package/dist/ui/components/overlays/noise.d.ts.map +0 -1
  257. package/dist/ui/components/overlays/noise.js.map +0 -1
  258. package/dist/ui/components/overlays/vignette.d.ts.map +0 -1
  259. package/dist/ui/components/overlays/vignette.js.map +0 -1
  260. package/dist/ui/components/poster.d.ts.map +0 -1
  261. package/dist/ui/components/poster.js.map +0 -1
  262. package/dist/ui/components/progress.d.ts.map +0 -1
  263. package/dist/ui/components/progress.js.map +0 -1
  264. package/dist/ui/components/scene-canvas.d.ts.map +0 -1
  265. package/dist/ui/components/scene-canvas.js.map +0 -1
  266. package/dist/ui/components/scramble.d.ts.map +0 -1
  267. package/dist/ui/components/scramble.js.map +0 -1
  268. package/dist/ui/components/segmented.d.ts.map +0 -1
  269. package/dist/ui/components/segmented.js.map +0 -1
  270. package/dist/ui/components/select.d.ts.map +0 -1
  271. package/dist/ui/components/select.js.map +0 -1
  272. package/dist/ui/components/selection-switcher.d.ts.map +0 -1
  273. package/dist/ui/components/selection-switcher.js.map +0 -1
  274. package/dist/ui/components/shader.d.ts.map +0 -1
  275. package/dist/ui/components/shader.js.map +0 -1
  276. package/dist/ui/components/socials.d.ts.map +0 -1
  277. package/dist/ui/components/socials.js.map +0 -1
  278. package/dist/ui/components/spinner.d.ts.map +0 -1
  279. package/dist/ui/components/spinner.js.map +0 -1
  280. package/dist/ui/components/stats.d.ts.map +0 -1
  281. package/dist/ui/components/stats.js.map +0 -1
  282. package/dist/ui/components/switch.d.ts.map +0 -1
  283. package/dist/ui/components/switch.js.map +0 -1
  284. package/dist/ui/components/tabs.d.ts.map +0 -1
  285. package/dist/ui/components/tabs.js.map +0 -1
  286. package/dist/ui/components/terminal-demo.d.ts.map +0 -1
  287. package/dist/ui/components/terminal-demo.js.map +0 -1
  288. package/dist/ui/components/theme-toggle.d.ts.map +0 -1
  289. package/dist/ui/components/theme-toggle.js.map +0 -1
  290. package/dist/ui/components/tier-card.d.ts.map +0 -1
  291. package/dist/ui/components/tier-card.js.map +0 -1
  292. package/dist/ui/components/tv.d.ts.map +0 -1
  293. package/dist/ui/components/tv.js.map +0 -1
  294. package/dist/ui/components/typography/h1.d.ts.map +0 -1
  295. package/dist/ui/components/typography/h1.js.map +0 -1
  296. package/dist/ui/components/typography/h2.d.ts.map +0 -1
  297. package/dist/ui/components/typography/h2.js.map +0 -1
  298. package/dist/ui/components/typography/index.d.ts.map +0 -1
  299. package/dist/ui/components/typography/index.js.map +0 -1
  300. package/dist/ui/components/typography/legend.d.ts.map +0 -1
  301. package/dist/ui/components/typography/legend.js.map +0 -1
  302. package/dist/ui/components/typography/small.d.ts.map +0 -1
  303. package/dist/ui/components/typography/small.js.map +0 -1
  304. package/dist/ui/components/watchlist.d.ts.map +0 -1
  305. package/dist/ui/components/watchlist.js.map +0 -1
  306. package/dist/ui/footer.d.ts.map +0 -1
  307. package/dist/ui/footer.js.map +0 -1
  308. package/dist/ui/header.d.ts.map +0 -1
  309. package/dist/ui/header.js.map +0 -1
  310. package/dist/ui/layout-wrapper.d.ts.map +0 -1
  311. package/dist/ui/layout-wrapper.js.map +0 -1
  312. package/dist/utils/color.d.ts.map +0 -1
  313. package/dist/utils/color.js.map +0 -1
  314. package/dist/utils/index.d.ts.map +0 -1
  315. package/dist/utils/index.js.map +0 -1
  316. package/dist/utils/poly.d.ts.map +0 -1
  317. package/dist/utils/poly.js.map +0 -1
@@ -1,20 +1,25 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from 'react';
4
- import * as THREE from 'three';
5
- import { $gpuTier, useGpuTier } from '../../../hooks/use-gpu-tier';
6
- import { runRenderLoop } from '../../../hooks/use-render-loop';
7
- import { useSmoothControls } from '../../../hooks/use-smooth-controls';
8
- import { cn } from '../../../utils';
9
- import { BLEND_MODES } from './blend-modes';
10
- const vert = /*glsl*/ `
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import * as THREE from "three";
5
+ import { $gpuTier, useGpuTier } from "../../../hooks/use-gpu-tier.js";
6
+ import { runRenderLoop } from "../../../hooks/use-render-loop.js";
7
+ import { useSmoothControls } from "../../../hooks/use-smooth-controls.js";
8
+ import { cn } from "../../../utils/index.js";
9
+ import { BLEND_MODES } from "./blend-modes.js";
10
+ const vert = (
11
+ /*glsl*/
12
+ `
11
13
  varying vec2 vUv;
12
14
  void main() {
13
15
  vUv = uv;
14
16
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
15
17
  }
16
- `;
17
- const sourceFrag = /*glsl*/ `
18
+ `
19
+ );
20
+ const sourceFrag = (
21
+ /*glsl*/
22
+ `
18
23
  uniform sampler2D uTex0, uTex1, uTex2, uTex3;
19
24
  uniform float uTime, uZoom, uSpeed, uRotate, uFolds, uDrift;
20
25
  varying vec2 vUv;
@@ -51,8 +56,11 @@ const sourceFrag = /*glsl*/ `
51
56
 
52
57
  gl_FragColor = vec4(mix(base, flip, .3 + sin(uTime * .2) * .2), 1.);
53
58
  }
54
- `;
55
- const moshFrag = /*glsl*/ `
59
+ `
60
+ );
61
+ const moshFrag = (
62
+ /*glsl*/
63
+ `
56
64
  uniform sampler2D uCurrent, uPrev, uTex0, uTex1, uTex2, uTex3;
57
65
  uniform float uTime, uIntensity, uMotion, uZoom, uSpeed;
58
66
  uniform vec2 uRes;
@@ -121,8 +129,11 @@ const moshFrag = /*glsl*/ `
121
129
  float d = mix(mix(.97, .99, noise(uv * 8. + t * .2)), 0., step(.994, hash(vec2(tS, 0.))));
122
130
  gl_FragColor = vec4(mix(texture2D(uCurrent, uv).rgb, prev, d), 1.);
123
131
  }
124
- `;
125
- const outputFrag = /*glsl*/ `
132
+ `
133
+ );
134
+ const outputFrag = (
135
+ /*glsl*/
136
+ `
126
137
  uniform sampler2D uInput;
127
138
  uniform float uTime, uAlpha, uHue;
128
139
  uniform vec3 uColor;
@@ -147,171 +158,181 @@ const outputFrag = /*glsl*/ `
147
158
  float lum = dot(m, vec3(.299, .587, .114));
148
159
  gl_FragColor = vec4(hueShift(mix(vec3(lum), uColor * lum * 2., length(uColor)), uHue) * uAlpha, smoothstep(.08, .18, lum * uAlpha));
149
160
  }
150
- `;
161
+ `
162
+ );
151
163
  const TEXTURES = [
152
- '/anatomy/grays-0.jpg',
153
- '/anatomy/grays-3.jpg',
154
- '/anatomy/grays-6.jpg',
155
- '/anatomy/grays-9.jpg'
164
+ "/anatomy/grays-0.jpg",
165
+ "/anatomy/grays-3.jpg",
166
+ "/anatomy/grays-6.jpg",
167
+ "/anatomy/grays-9.jpg"
156
168
  ];
157
169
  export function Greys({ className, style }) {
158
- const gpuTier = useGpuTier();
159
- const [blendOverride, setBlendOverride] = useState(null);
160
- const canvasRef = useRef(null);
161
- const c = useSmoothControls('Effects/Greys', {
162
- alpha: { max: 1, min: 0, step: 0.01, value: 0.19 },
163
- blend: { options: BLEND_MODES, value: 'color-burn' },
164
- color: { value: '#ffac02' },
165
- drift: { max: 2, min: 0, step: 0.1, value: 0.5 },
166
- enabled: { value: false },
167
- folds: { max: 12, min: 1, step: 1, value: 1 },
168
- hue: { max: 1, min: 0, step: 0.01, value: 0.37 },
169
- intensity: { max: 3, min: 0, step: 0.1, value: 0.1 },
170
- motion: { max: 2, min: 0, step: 0.1, value: 0.1 },
171
- rotate: { max: 2, min: -2, step: 0.1, value: 0.3 },
172
- speed: { max: 1, min: 0.01, step: 0.01, value: 0.21 },
173
- zoom: { max: 4, min: 0.5, step: 0.1, value: 0.7 }
174
- }, { collapsed: true });
175
- const cRef = useRef(c);
176
- cRef.current = c;
177
- useEffect(() => {
178
- const onKey = (e) => e.key.toLowerCase() === 'x' &&
179
- setBlendOverride(p => (p === 'screen' ? null : 'screen'));
180
- window.addEventListener('keydown', onKey);
181
- return () => window.removeEventListener('keydown', onKey);
182
- }, []);
183
- const enabled = c.enabled && gpuTier === 2;
184
- useEffect(() => {
185
- if (!canvasRef.current || !enabled) {
186
- return;
187
- }
188
- let renderer;
189
- try {
190
- renderer = new THREE.WebGLRenderer({
191
- alpha: true,
192
- canvas: canvasRef.current
193
- });
194
- }
195
- catch {
196
- // See note in noise.tsx — eager gpu-tier detection should keep us
197
- // out of here, but if the driver fails the renderer constructor
198
- // anyway, downgrade so other overlays stop trying too.
199
- $gpuTier.set(0);
200
- return;
201
- }
202
- const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
203
- const geo = new THREE.PlaneGeometry(2, 2);
204
- const [rtSource, rtA, rtB] = [0, 1, 2].map(() => new THREE.WebGLRenderTarget(innerWidth, innerHeight, {
205
- magFilter: THREE.NearestFilter,
206
- minFilter: THREE.NearestFilter
207
- }));
208
- const textures = TEXTURES.map(p => {
209
- const t = new THREE.TextureLoader().load(p);
210
- t.wrapS = t.wrapT = THREE.ClampToEdgeWrapping;
211
- t.minFilter = t.magFilter = THREE.LinearFilter;
212
- return t;
213
- });
214
- const texU = Object.fromEntries(textures.map((t, i) => [`uTex${i}`, { value: t }]));
215
- const srcU = {
216
- ...texU,
217
- uDrift: { value: 0 },
218
- uFolds: { value: 0 },
219
- uRotate: { value: 0 },
220
- uSpeed: { value: 0 },
221
- uTime: { value: 0 },
222
- uZoom: { value: 0 }
223
- };
224
- const moshU = {
225
- ...texU,
226
- uCurrent: { value: rtSource.texture },
227
- uIntensity: { value: 0 },
228
- uMotion: { value: 0 },
229
- uPrev: { value: rtA.texture },
230
- uRes: { value: new THREE.Vector2(innerWidth, innerHeight) },
231
- uSpeed: { value: 0 },
232
- uTime: { value: 0 },
233
- uZoom: { value: 0 }
234
- };
235
- const outU = {
236
- uAlpha: { value: 0 },
237
- uColor: { value: new THREE.Color() },
238
- uHue: { value: 0 },
239
- uInput: { value: rtB.texture },
240
- uTime: { value: 0 }
241
- };
242
- const mkScene = (frag, uniforms, transparent = false) => {
243
- const s = new THREE.Scene();
244
- s.add(new THREE.Mesh(geo.clone(), new THREE.ShaderMaterial({
245
- fragmentShader: frag,
246
- transparent,
247
- uniforms: uniforms,
248
- vertexShader: vert
249
- })));
250
- return s;
251
- };
252
- const srcScene = mkScene(sourceFrag, srcU);
253
- const moshScene = mkScene(moshFrag, moshU);
254
- const outScene = mkScene(outputFrag, outU, true);
255
- const resize = () => {
256
- renderer.setSize(innerWidth, innerHeight);
257
- // Cap at 1.5x — Greys does triple-buffered ping-pong rendering at
258
- // every frame, so retina x2 is brutal on fillrate.
259
- renderer.setPixelRatio(Math.min(devicePixelRatio, 1.5));
260
- [rtSource, rtA, rtB].forEach(rt => rt.setSize(innerWidth, innerHeight));
261
- moshU.uRes.value.set(innerWidth, innerHeight);
262
- };
263
- resize();
264
- window.addEventListener('resize', resize);
265
- let ping = true, time = 0;
266
- // 30fps cap — feedback effect, no perceptual loss vs 60fps but
267
- // halves the cost of the heaviest overlay we ship.
268
- const dispose = runRenderLoop({
269
- el: canvasRef.current,
270
- minIntervalMs: 33,
271
- onFrame: deltaSeconds => {
272
- time += deltaSeconds;
273
- const v = cRef.current;
274
- srcU.uTime.value = time;
275
- srcU.uSpeed.value = v.speed;
276
- srcU.uZoom.value = v.zoom;
277
- srcU.uRotate.value = v.rotate;
278
- srcU.uFolds.value = v.folds;
279
- srcU.uDrift.value = v.drift;
280
- moshU.uTime.value = time;
281
- moshU.uIntensity.value = v.intensity;
282
- moshU.uMotion.value = v.motion;
283
- moshU.uSpeed.value = v.speed;
284
- moshU.uZoom.value = v.zoom;
285
- outU.uTime.value = time;
286
- outU.uAlpha.value = v.alpha;
287
- outU.uHue.value = v.hue;
288
- outU.uColor.value.set(typeof v.color === 'string' ? v.color : '#fff');
289
- renderer.setRenderTarget(rtSource);
290
- renderer.render(srcScene, camera);
291
- const [read, write] = ping ? [rtA, rtB] : [rtB, rtA];
292
- moshU.uPrev.value = read.texture;
293
- renderer.setRenderTarget(write);
294
- renderer.render(moshScene, camera);
295
- outU.uInput.value = write.texture;
296
- renderer.setRenderTarget(null);
297
- renderer.render(outScene, camera);
298
- ping = !ping;
299
- }
300
- });
301
- return () => {
302
- window.removeEventListener('resize', resize);
303
- dispose();
304
- textures.forEach(t => t.dispose());
305
- [geo, rtSource, rtA, rtB, renderer].forEach(x => x.dispose());
306
- };
307
- }, [enabled]);
308
- if (!enabled) {
309
- return null;
170
+ const gpuTier = useGpuTier();
171
+ const [blendOverride, setBlendOverride] = useState(null);
172
+ const canvasRef = useRef(null);
173
+ const c = useSmoothControls(
174
+ "Effects/Greys",
175
+ {
176
+ alpha: { max: 1, min: 0, step: 0.01, value: 0.19 },
177
+ blend: { options: BLEND_MODES, value: "color-burn" },
178
+ color: { value: "#ffac02" },
179
+ drift: { max: 2, min: 0, step: 0.1, value: 0.5 },
180
+ enabled: { value: false },
181
+ folds: { max: 12, min: 1, step: 1, value: 1 },
182
+ hue: { max: 1, min: 0, step: 0.01, value: 0.37 },
183
+ intensity: { max: 3, min: 0, step: 0.1, value: 0.1 },
184
+ motion: { max: 2, min: 0, step: 0.1, value: 0.1 },
185
+ rotate: { max: 2, min: -2, step: 0.1, value: 0.3 },
186
+ speed: { max: 1, min: 0.01, step: 0.01, value: 0.21 },
187
+ zoom: { max: 4, min: 0.5, step: 0.1, value: 0.7 }
188
+ },
189
+ { collapsed: true }
190
+ );
191
+ const cRef = useRef(c);
192
+ cRef.current = c;
193
+ useEffect(() => {
194
+ const onKey = (e) => e.key.toLowerCase() === "x" && setBlendOverride((p) => p === "screen" ? null : "screen");
195
+ window.addEventListener("keydown", onKey);
196
+ return () => window.removeEventListener("keydown", onKey);
197
+ }, []);
198
+ const enabled = c.enabled && gpuTier === 2;
199
+ useEffect(() => {
200
+ if (!canvasRef.current || !enabled) {
201
+ return;
310
202
  }
311
- return (_jsx("canvas", { className: cn('h-full w-full', className), ref: canvasRef, style: {
312
- mixBlendMode: (blendOverride ??
313
- c.blend),
314
- ...style
315
- } }));
203
+ let renderer;
204
+ try {
205
+ renderer = new THREE.WebGLRenderer({
206
+ alpha: true,
207
+ canvas: canvasRef.current
208
+ });
209
+ } catch {
210
+ $gpuTier.set(0);
211
+ return;
212
+ }
213
+ const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
214
+ const geo = new THREE.PlaneGeometry(2, 2);
215
+ const [rtSource, rtA, rtB] = [0, 1, 2].map(
216
+ () => new THREE.WebGLRenderTarget(innerWidth, innerHeight, {
217
+ magFilter: THREE.NearestFilter,
218
+ minFilter: THREE.NearestFilter
219
+ })
220
+ );
221
+ const textures = TEXTURES.map((p) => {
222
+ const t = new THREE.TextureLoader().load(p);
223
+ t.wrapS = t.wrapT = THREE.ClampToEdgeWrapping;
224
+ t.minFilter = t.magFilter = THREE.LinearFilter;
225
+ return t;
226
+ });
227
+ const texU = Object.fromEntries(
228
+ textures.map((t, i) => [`uTex${i}`, { value: t }])
229
+ );
230
+ const srcU = {
231
+ ...texU,
232
+ uDrift: { value: 0 },
233
+ uFolds: { value: 0 },
234
+ uRotate: { value: 0 },
235
+ uSpeed: { value: 0 },
236
+ uTime: { value: 0 },
237
+ uZoom: { value: 0 }
238
+ };
239
+ const moshU = {
240
+ ...texU,
241
+ uCurrent: { value: rtSource.texture },
242
+ uIntensity: { value: 0 },
243
+ uMotion: { value: 0 },
244
+ uPrev: { value: rtA.texture },
245
+ uRes: { value: new THREE.Vector2(innerWidth, innerHeight) },
246
+ uSpeed: { value: 0 },
247
+ uTime: { value: 0 },
248
+ uZoom: { value: 0 }
249
+ };
250
+ const outU = {
251
+ uAlpha: { value: 0 },
252
+ uColor: { value: new THREE.Color() },
253
+ uHue: { value: 0 },
254
+ uInput: { value: rtB.texture },
255
+ uTime: { value: 0 }
256
+ };
257
+ const mkScene = (frag, uniforms, transparent = false) => {
258
+ const s = new THREE.Scene();
259
+ s.add(
260
+ new THREE.Mesh(
261
+ geo.clone(),
262
+ new THREE.ShaderMaterial({
263
+ fragmentShader: frag,
264
+ transparent,
265
+ uniforms,
266
+ vertexShader: vert
267
+ })
268
+ )
269
+ );
270
+ return s;
271
+ };
272
+ const srcScene = mkScene(sourceFrag, srcU);
273
+ const moshScene = mkScene(moshFrag, moshU);
274
+ const outScene = mkScene(outputFrag, outU, true);
275
+ const resize = () => {
276
+ renderer.setSize(innerWidth, innerHeight);
277
+ renderer.setPixelRatio(Math.min(devicePixelRatio, 1.5));
278
+ [rtSource, rtA, rtB].forEach((rt) => rt.setSize(innerWidth, innerHeight));
279
+ moshU.uRes.value.set(innerWidth, innerHeight);
280
+ };
281
+ resize();
282
+ window.addEventListener("resize", resize);
283
+ let ping = true, time = 0;
284
+ const dispose = runRenderLoop({
285
+ el: canvasRef.current,
286
+ minIntervalMs: 33,
287
+ onFrame: (deltaSeconds) => {
288
+ time += deltaSeconds;
289
+ const v = cRef.current;
290
+ srcU.uTime.value = time;
291
+ srcU.uSpeed.value = v.speed;
292
+ srcU.uZoom.value = v.zoom;
293
+ srcU.uRotate.value = v.rotate;
294
+ srcU.uFolds.value = v.folds;
295
+ srcU.uDrift.value = v.drift;
296
+ moshU.uTime.value = time;
297
+ moshU.uIntensity.value = v.intensity;
298
+ moshU.uMotion.value = v.motion;
299
+ moshU.uSpeed.value = v.speed;
300
+ moshU.uZoom.value = v.zoom;
301
+ outU.uTime.value = time;
302
+ outU.uAlpha.value = v.alpha;
303
+ outU.uHue.value = v.hue;
304
+ outU.uColor.value.set(typeof v.color === "string" ? v.color : "#fff");
305
+ renderer.setRenderTarget(rtSource);
306
+ renderer.render(srcScene, camera);
307
+ const [read, write] = ping ? [rtA, rtB] : [rtB, rtA];
308
+ moshU.uPrev.value = read.texture;
309
+ renderer.setRenderTarget(write);
310
+ renderer.render(moshScene, camera);
311
+ outU.uInput.value = write.texture;
312
+ renderer.setRenderTarget(null);
313
+ renderer.render(outScene, camera);
314
+ ping = !ping;
315
+ }
316
+ });
317
+ return () => {
318
+ window.removeEventListener("resize", resize);
319
+ dispose();
320
+ textures.forEach((t) => t.dispose());
321
+ [geo, rtSource, rtA, rtB, renderer].forEach((x) => x.dispose());
322
+ };
323
+ }, [enabled]);
324
+ if (!enabled) {
325
+ return null;
326
+ }
327
+ return /* @__PURE__ */ jsx(
328
+ "canvas",
329
+ {
330
+ className: cn("h-full w-full", className),
331
+ ref: canvasRef,
332
+ style: {
333
+ mixBlendMode: blendOverride ?? c.blend,
334
+ ...style
335
+ }
336
+ }
337
+ );
316
338
  }
317
- //# sourceMappingURL=greys.js.map
@@ -7,9 +7,8 @@ export { Noise } from './noise';
7
7
  export { Vignette } from './vignette';
8
8
  export { $lightMode, applyLens, lens0, lens5i, LENS_0, LENS_5I, LENSES, toggleLens } from './lens';
9
9
  export type { LensPreset } from './lens';
10
- export declare function Overlays({ dark, initial }: OverlaysProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function Overlays({ dark, initial }: OverlaysProps): import("react").JSX.Element;
11
11
  interface OverlaysProps {
12
12
  dark?: boolean;
13
13
  initial?: LensPreset;
14
14
  }
15
- //# sourceMappingURL=index.d.ts.map
@@ -1,19 +1,33 @@
1
- 'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Glitch } from './glitch';
4
- import { Greys } from './greys';
5
- import { Lens } from './lens-layers';
6
- import { Noise } from './noise';
7
- import { Vignette } from './vignette';
8
- export { BLEND_MODES } from './blend-modes';
9
- export { Glitch } from './glitch';
10
- export { Greys } from './greys';
11
- export { Lens } from './lens-layers';
12
- export { Noise } from './noise';
13
- export { Vignette } from './vignette';
14
- export { $lightMode, applyLens, lens0, lens5i, LENS_0, LENS_5I, LENSES, toggleLens } from './lens';
15
- const LAYER = 'pointer-events-none fixed inset-0';
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { Glitch } from "./glitch.js";
4
+ import { Greys } from "./greys.js";
5
+ import { Lens } from "./lens-layers.js";
6
+ import { Noise } from "./noise.js";
7
+ import { Vignette } from "./vignette.js";
8
+ export { BLEND_MODES } from "./blend-modes.js";
9
+ export { Glitch } from "./glitch.js";
10
+ export { Greys } from "./greys.js";
11
+ export { Lens } from "./lens-layers.js";
12
+ export { Noise } from "./noise.js";
13
+ export { Vignette } from "./vignette.js";
14
+ export {
15
+ $lightMode,
16
+ applyLens,
17
+ lens0,
18
+ lens5i,
19
+ LENS_0,
20
+ LENS_5I,
21
+ LENSES,
22
+ toggleLens
23
+ } from "./lens";
24
+ const LAYER = "pointer-events-none fixed inset-0";
16
25
  export function Overlays({ dark, initial }) {
17
- return (_jsxs(_Fragment, { children: [_jsx(Lens, { dark: dark, initial: initial }), _jsx(Noise, { className: LAYER, style: { zIndex: 101 } }), _jsx(Vignette, { className: LAYER, style: { zIndex: 99 } }), _jsx(Greys, { className: LAYER, style: { zIndex: 200 } }), _jsx(Glitch, { className: LAYER, style: { zIndex: 201 } })] }));
26
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
27
+ /* @__PURE__ */ jsx(Lens, { dark, initial }),
28
+ /* @__PURE__ */ jsx(Noise, { className: LAYER, style: { zIndex: 101 } }),
29
+ /* @__PURE__ */ jsx(Vignette, { className: LAYER, style: { zIndex: 99 } }),
30
+ /* @__PURE__ */ jsx(Greys, { className: LAYER, style: { zIndex: 200 } }),
31
+ /* @__PURE__ */ jsx(Glitch, { className: LAYER, style: { zIndex: 201 } })
32
+ ] });
18
33
  }
19
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { type LensPreset } from './lens';
2
- export declare function Lens({ dark, initial }: LensProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Lens({ dark, initial }: LensProps): import("react").JSX.Element;
3
3
  interface LensProps {
4
4
  dark?: boolean;
5
5
  /**
@@ -12,4 +12,3 @@ interface LensProps {
12
12
  initial?: LensPreset;
13
13
  }
14
14
  export {};
15
- //# sourceMappingURL=lens-layers.d.ts.map
@@ -1,68 +1,92 @@
1
- 'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect } from 'react';
4
- import { useSmoothControls } from '../../../hooks/use-smooth-controls';
5
- import { colorMix } from '../../../utils/color';
6
- import fillerBg from '../../../assets/filler-bg0.jpg';
7
- import { BLEND_MODES } from './blend-modes';
8
- import { $lightMode, LENS_0, LENS_5I, toggleLens } from './lens';
9
- const LAYER = 'pointer-events-none fixed inset-0';
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import { useSmoothControls } from "../../../hooks/use-smooth-controls.js";
5
+ import { colorMix } from "../../../utils/color.js";
6
+ import fillerBg from "../../../assets/filler-bg0.webp";
7
+ import { BLEND_MODES } from "./blend-modes.js";
8
+ import { $lightMode, LENS_0, LENS_5I, toggleLens } from "./lens.js";
9
+ const LAYER = "pointer-events-none fixed inset-0";
10
10
  export function Lens({ dark, initial }) {
11
- // `initial` lets the host (e.g. Storybook) seed the Leva/atom state with
12
- // the *exact* lens preset the user selected, avoiding a one-cycle lag
13
- // where useSmoothControls emits old colors for the first paint (and, on
14
- // Storybook's fast iframe reload, sometimes never catches up because
15
- // useControls' ready-gate swallows the instant color writes).
16
- const base = initial?.Lens ?? (dark ? LENS_0.Lens : LENS_5I.Lens);
17
- const lens = useSmoothControls('Lens', {
18
- bgBlend: { options: BLEND_MODES, value: base.bgBlend },
19
- bgColor: { value: base.bgColor },
20
- bgOpacity: { max: 1, min: 0, step: 0.01, value: base.bgOpacity },
21
- fgBlend: { options: BLEND_MODES, value: 'difference' },
22
- fgColor: { value: base.fgColor },
23
- fgOpacity: { max: 1, min: 0, step: 0.01, value: base.fgOpacity },
24
- fillerBlend: { options: BLEND_MODES, value: 'difference' },
25
- fillerOpacity: { max: 1, min: 0, step: 0.01, value: base.fillerOpacity },
26
- mgColor: { value: base.mgColor },
27
- mgOpacity: { max: 1, min: 0, step: 0.01, value: base.mgOpacity }
28
- }, { collapsed: false });
29
- useEffect(() => {
30
- $lightMode.set(!dark);
31
- }, [dark]);
32
- useEffect(() => {
33
- const s = document.documentElement.style;
34
- for (const [name, color, alpha] of [
35
- ['foreground', lens.fgColor, lens.fgOpacity],
36
- ['midground', lens.mgColor, lens.mgOpacity],
37
- ['background', lens.bgColor, lens.bgOpacity]
38
- ]) {
39
- s.setProperty(`--${name}`, colorMix(color, alpha));
40
- s.setProperty(`--${name}-base`, color);
41
- s.setProperty(`--${name}-alpha`, `${alpha}`);
11
+ const base = initial?.Lens ?? (dark ? LENS_0.Lens : LENS_5I.Lens);
12
+ const lens = useSmoothControls(
13
+ "Lens",
14
+ {
15
+ bgBlend: { options: BLEND_MODES, value: base.bgBlend },
16
+ bgColor: { value: base.bgColor },
17
+ bgOpacity: { max: 1, min: 0, step: 0.01, value: base.bgOpacity },
18
+ fgBlend: { options: BLEND_MODES, value: "difference" },
19
+ fgColor: { value: base.fgColor },
20
+ fgOpacity: { max: 1, min: 0, step: 0.01, value: base.fgOpacity },
21
+ fillerBlend: { options: BLEND_MODES, value: "difference" },
22
+ fillerOpacity: { max: 1, min: 0, step: 0.01, value: base.fillerOpacity },
23
+ mgColor: { value: base.mgColor },
24
+ mgOpacity: { max: 1, min: 0, step: 0.01, value: base.mgOpacity }
25
+ },
26
+ { collapsed: false }
27
+ );
28
+ useEffect(() => {
29
+ $lightMode.set(!dark);
30
+ }, [dark]);
31
+ useEffect(() => {
32
+ const s = document.documentElement.style;
33
+ for (const [name, color, alpha] of [
34
+ ["foreground", lens.fgColor, lens.fgOpacity],
35
+ ["midground", lens.mgColor, lens.mgOpacity],
36
+ ["background", lens.bgColor, lens.bgOpacity]
37
+ ]) {
38
+ s.setProperty(`--${name}`, colorMix(color, alpha));
39
+ s.setProperty(`--${name}-base`, color);
40
+ s.setProperty(`--${name}-alpha`, `${alpha}`);
41
+ }
42
+ }, [lens]);
43
+ useEffect(() => {
44
+ const handle = (e) => e.key === "x" && toggleLens();
45
+ window.addEventListener("keydown", handle);
46
+ return () => window.removeEventListener("keydown", handle);
47
+ }, []);
48
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ /* @__PURE__ */ jsx(
50
+ "div",
51
+ {
52
+ className: LAYER,
53
+ style: {
54
+ backgroundColor: colorMix(lens.fgColor, lens.fgOpacity),
55
+ mixBlendMode: lens.fgBlend,
56
+ zIndex: 100
42
57
  }
43
- }, [lens]);
44
- useEffect(() => {
45
- const handle = (e) => e.key === 'x' && toggleLens();
46
- window.addEventListener('keydown', handle);
47
- return () => window.removeEventListener('keydown', handle);
48
- }, []);
49
- // NOTE: z-index is inlined because Tailwind's JIT sometimes doesn't emit
50
- // these non-default utilities (e.g. in Storybook's isolated content
51
- // scan), which silently collapses the overlay stack to DOM order and
52
- // breaks the mix-blend-mode inversion — producing a muddy warm wash
53
- // instead of the intended clean black/white inversion.
54
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: LAYER, style: {
55
- backgroundColor: colorMix(lens.fgColor, lens.fgOpacity),
56
- mixBlendMode: lens.fgBlend,
57
- zIndex: 100
58
- } }), _jsx("div", { className: LAYER, style: {
59
- mixBlendMode: lens.fillerBlend,
60
- opacity: lens.fillerOpacity,
61
- zIndex: 2
62
- }, children: _jsx("img", { alt: "", className: "h-[150dvh] w-auto min-w-dvw object-cover object-top-left invert", fetchPriority: "low", src: fillerBg.src }) }), _jsx("div", { className: LAYER, style: {
63
- backgroundColor: colorMix(lens.bgColor, lens.bgOpacity),
64
- mixBlendMode: lens.bgBlend,
65
- zIndex: 1
66
- } })] }));
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx(
61
+ "div",
62
+ {
63
+ className: LAYER,
64
+ style: {
65
+ mixBlendMode: lens.fillerBlend,
66
+ opacity: lens.fillerOpacity,
67
+ zIndex: 2
68
+ },
69
+ children: /* @__PURE__ */ jsx(
70
+ "img",
71
+ {
72
+ alt: "",
73
+ className: "h-[150dvh] w-auto min-w-dvw object-cover object-top-left invert",
74
+ fetchPriority: "low",
75
+ src: fillerBg.src
76
+ }
77
+ )
78
+ }
79
+ ),
80
+ /* @__PURE__ */ jsx(
81
+ "div",
82
+ {
83
+ className: LAYER,
84
+ style: {
85
+ backgroundColor: colorMix(lens.bgColor, lens.bgOpacity),
86
+ mixBlendMode: lens.bgBlend,
87
+ zIndex: 1
88
+ }
89
+ }
90
+ )
91
+ ] });
67
92
  }
68
- //# sourceMappingURL=lens-layers.js.map
@@ -42,4 +42,3 @@ export interface LensPreset {
42
42
  Globe: typeof LENS_0.Globe;
43
43
  Lens: typeof LENS_0.Lens;
44
44
  }
45
- //# sourceMappingURL=lens.d.ts.map