@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.
Files changed (196) hide show
  1. package/README.md +49 -0
  2. package/dist/assets/filler-bg0.jpg +0 -0
  3. package/dist/fonts/Collapse-Bold.woff2 +0 -0
  4. package/dist/fonts/Collapse-BoldItalic.woff2 +0 -0
  5. package/dist/fonts/Collapse-Italic.woff2 +0 -0
  6. package/dist/fonts/Collapse-Light.woff2 +0 -0
  7. package/dist/fonts/Collapse-LightItalic.woff2 +0 -0
  8. package/dist/fonts/Collapse-Regular.woff2 +0 -0
  9. package/dist/fonts/Collapse-Thin.woff2 +0 -0
  10. package/dist/fonts/Collapse-ThinItalic.woff2 +0 -0
  11. package/dist/fonts/Mondwest-Regular.woff2 +0 -0
  12. package/dist/fonts/Neuebit-Bold.woff2 +0 -0
  13. package/dist/fonts/RulesCompressed-Medium.woff2 +0 -0
  14. package/dist/fonts/RulesCompressed-Regular.woff2 +0 -0
  15. package/dist/fonts/RulesExpanded-Bold.woff2 +0 -0
  16. package/dist/fonts/RulesExpanded-Regular.woff2 +0 -0
  17. package/dist/fonts.d.ts +6 -0
  18. package/dist/fonts.js +7 -0
  19. package/dist/fonts.js.map +1 -0
  20. package/dist/hooks/use-capped-frame.d.ts +2 -0
  21. package/dist/hooks/use-capped-frame.js +15 -0
  22. package/dist/hooks/use-capped-frame.js.map +1 -0
  23. package/dist/hooks/use-css-var-dims.d.ts +1 -0
  24. package/dist/hooks/use-css-var-dims.js +23 -0
  25. package/dist/hooks/use-css-var-dims.js.map +1 -0
  26. package/dist/hooks/use-gpu-tier.d.ts +10 -0
  27. package/dist/hooks/use-gpu-tier.js +92 -0
  28. package/dist/hooks/use-gpu-tier.js.map +1 -0
  29. package/dist/hooks/use-smooth-controls.d.ts +16 -0
  30. package/dist/hooks/use-smooth-controls.js +202 -0
  31. package/dist/hooks/use-smooth-controls.js.map +1 -0
  32. package/dist/index.d.ts +45 -0
  33. package/dist/index.js +48 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/ui/basic-page.d.ts +7 -0
  36. package/dist/ui/basic-page.js +9 -0
  37. package/dist/ui/basic-page.js.map +1 -0
  38. package/dist/ui/components/animated-count.d.ts +10 -0
  39. package/dist/ui/components/animated-count.js +88 -0
  40. package/dist/ui/components/animated-count.js.map +1 -0
  41. package/dist/ui/components/ascii.d.ts +10 -0
  42. package/dist/ui/components/ascii.js +62 -0
  43. package/dist/ui/components/ascii.js.map +1 -0
  44. package/dist/ui/components/badge.d.ts +2 -0
  45. package/dist/ui/components/badge.js +5 -0
  46. package/dist/ui/components/badge.js.map +1 -0
  47. package/dist/ui/components/badges/nous-girl.d.ts +2 -0
  48. package/dist/ui/components/badges/nous-girl.js +5 -0
  49. package/dist/ui/components/badges/nous-girl.js.map +1 -0
  50. package/dist/ui/components/blend-mode.d.ts +28 -0
  51. package/dist/ui/components/blend-mode.js +76 -0
  52. package/dist/ui/components/blend-mode.js.map +1 -0
  53. package/dist/ui/components/blink.d.ts +6 -0
  54. package/dist/ui/components/blink.js +7 -0
  55. package/dist/ui/components/blink.js.map +1 -0
  56. package/dist/ui/components/button.d.ts +11 -0
  57. package/dist/ui/components/button.js +52 -0
  58. package/dist/ui/components/button.js.map +1 -0
  59. package/dist/ui/components/cursor.d.ts +3 -0
  60. package/dist/ui/components/cursor.js +57 -0
  61. package/dist/ui/components/cursor.js.map +1 -0
  62. package/dist/ui/components/dropdown-menu.d.ts +12 -0
  63. package/dist/ui/components/dropdown-menu.js +53 -0
  64. package/dist/ui/components/dropdown-menu.js.map +1 -0
  65. package/dist/ui/components/fit-text/fit-text.css +42 -0
  66. package/dist/ui/components/fit-text/index.d.ts +9 -0
  67. package/dist/ui/components/fit-text/index.js +16 -0
  68. package/dist/ui/components/fit-text/index.js.map +1 -0
  69. package/dist/ui/components/graphs/bar-chart.d.ts +12 -0
  70. package/dist/ui/components/graphs/bar-chart.js +75 -0
  71. package/dist/ui/components/graphs/bar-chart.js.map +1 -0
  72. package/dist/ui/components/graphs/index.d.ts +3 -0
  73. package/dist/ui/components/graphs/index.js +4 -0
  74. package/dist/ui/components/graphs/index.js.map +1 -0
  75. package/dist/ui/components/graphs/line-chart.d.ts +14 -0
  76. package/dist/ui/components/graphs/line-chart.js +117 -0
  77. package/dist/ui/components/graphs/line-chart.js.map +1 -0
  78. package/dist/ui/components/graphs/utils.d.ts +52 -0
  79. package/dist/ui/components/graphs/utils.js +128 -0
  80. package/dist/ui/components/graphs/utils.js.map +1 -0
  81. package/dist/ui/components/grid/grid.css +78 -0
  82. package/dist/ui/components/grid/index.d.ts +2 -0
  83. package/dist/ui/components/grid/index.js +13 -0
  84. package/dist/ui/components/grid/index.js.map +1 -0
  85. package/dist/ui/components/hover-bg.d.ts +1 -0
  86. package/dist/ui/components/hover-bg.js +8 -0
  87. package/dist/ui/components/hover-bg.js.map +1 -0
  88. package/dist/ui/components/icons/arrow.d.ts +6 -0
  89. package/dist/ui/components/icons/arrow.js +6 -0
  90. package/dist/ui/components/icons/arrow.js.map +1 -0
  91. package/dist/ui/components/icons/chevron.d.ts +6 -0
  92. package/dist/ui/components/icons/chevron.js +6 -0
  93. package/dist/ui/components/icons/chevron.js.map +1 -0
  94. package/dist/ui/components/icons/eye.d.ts +2 -0
  95. package/dist/ui/components/icons/eye.js +5 -0
  96. package/dist/ui/components/icons/eye.js.map +1 -0
  97. package/dist/ui/components/icons/gear.d.ts +6 -0
  98. package/dist/ui/components/icons/gear.js +15 -0
  99. package/dist/ui/components/icons/gear.js.map +1 -0
  100. package/dist/ui/components/icons/heart.d.ts +2 -0
  101. package/dist/ui/components/icons/heart.js +5 -0
  102. package/dist/ui/components/icons/heart.js.map +1 -0
  103. package/dist/ui/components/icons/index.d.ts +8 -0
  104. package/dist/ui/components/icons/index.js +9 -0
  105. package/dist/ui/components/icons/index.js.map +1 -0
  106. package/dist/ui/components/icons/link.d.ts +2 -0
  107. package/dist/ui/components/icons/link.js +5 -0
  108. package/dist/ui/components/icons/link.js.map +1 -0
  109. package/dist/ui/components/icons/minus.d.ts +2 -0
  110. package/dist/ui/components/icons/minus.js +5 -0
  111. package/dist/ui/components/icons/minus.js.map +1 -0
  112. package/dist/ui/components/icons/search.d.ts +2 -0
  113. package/dist/ui/components/icons/search.js +5 -0
  114. package/dist/ui/components/icons/search.js.map +1 -0
  115. package/dist/ui/components/leva-client.d.ts +1 -0
  116. package/dist/ui/components/leva-client.js +12 -0
  117. package/dist/ui/components/leva-client.js.map +1 -0
  118. package/dist/ui/components/modal/index.d.ts +8 -0
  119. package/dist/ui/components/modal/index.js +15 -0
  120. package/dist/ui/components/modal/index.js.map +1 -0
  121. package/dist/ui/components/modal/modal.css +36 -0
  122. package/dist/ui/components/overlays/glitch.d.ts +6 -0
  123. package/dist/ui/components/overlays/glitch.js +191 -0
  124. package/dist/ui/components/overlays/glitch.js.map +1 -0
  125. package/dist/ui/components/overlays/greys.d.ts +6 -0
  126. package/dist/ui/components/overlays/greys.js +300 -0
  127. package/dist/ui/components/overlays/greys.js.map +1 -0
  128. package/dist/ui/components/overlays/index.d.ts +44 -0
  129. package/dist/ui/components/overlays/index.js +125 -0
  130. package/dist/ui/components/overlays/index.js.map +1 -0
  131. package/dist/ui/components/overlays/noise.d.ts +6 -0
  132. package/dist/ui/components/overlays/noise.js +115 -0
  133. package/dist/ui/components/overlays/noise.js.map +1 -0
  134. package/dist/ui/components/overlays/vignette.d.ts +6 -0
  135. package/dist/ui/components/overlays/vignette.js +40 -0
  136. package/dist/ui/components/overlays/vignette.js.map +1 -0
  137. package/dist/ui/components/progress.d.ts +9 -0
  138. package/dist/ui/components/progress.js +12 -0
  139. package/dist/ui/components/progress.js.map +1 -0
  140. package/dist/ui/components/scene-canvas.d.ts +15 -0
  141. package/dist/ui/components/scene-canvas.js +117 -0
  142. package/dist/ui/components/scene-canvas.js.map +1 -0
  143. package/dist/ui/components/scramble.d.ts +9 -0
  144. package/dist/ui/components/scramble.js +61 -0
  145. package/dist/ui/components/scramble.js.map +1 -0
  146. package/dist/ui/components/selection-switcher.d.ts +1 -0
  147. package/dist/ui/components/selection-switcher.js +29 -0
  148. package/dist/ui/components/selection-switcher.js.map +1 -0
  149. package/dist/ui/components/shader.d.ts +7 -0
  150. package/dist/ui/components/shader.js +41 -0
  151. package/dist/ui/components/shader.js.map +1 -0
  152. package/dist/ui/components/stats.d.ts +9 -0
  153. package/dist/ui/components/stats.js +7 -0
  154. package/dist/ui/components/stats.js.map +1 -0
  155. package/dist/ui/components/tv.d.ts +3 -0
  156. package/dist/ui/components/tv.js +163 -0
  157. package/dist/ui/components/tv.js.map +1 -0
  158. package/dist/ui/components/typography/h1.d.ts +11 -0
  159. package/dist/ui/components/typography/h1.js +8 -0
  160. package/dist/ui/components/typography/h1.js.map +1 -0
  161. package/dist/ui/components/typography/h2.d.ts +11 -0
  162. package/dist/ui/components/typography/h2.js +8 -0
  163. package/dist/ui/components/typography/h2.js.map +1 -0
  164. package/dist/ui/components/typography/index.d.ts +15 -0
  165. package/dist/ui/components/typography/index.js +29 -0
  166. package/dist/ui/components/typography/index.js.map +1 -0
  167. package/dist/ui/components/typography/legend.d.ts +6 -0
  168. package/dist/ui/components/typography/legend.js +7 -0
  169. package/dist/ui/components/typography/legend.js.map +1 -0
  170. package/dist/ui/components/typography/small.d.ts +2 -0
  171. package/dist/ui/components/typography/small.js +7 -0
  172. package/dist/ui/components/typography/small.js.map +1 -0
  173. package/dist/ui/components/watchlist.d.ts +11 -0
  174. package/dist/ui/components/watchlist.js +27 -0
  175. package/dist/ui/components/watchlist.js.map +1 -0
  176. package/dist/ui/fonts.css +63 -0
  177. package/dist/ui/footer.d.ts +1 -0
  178. package/dist/ui/footer.js +19 -0
  179. package/dist/ui/footer.js.map +1 -0
  180. package/dist/ui/globals.css +340 -0
  181. package/dist/ui/header.d.ts +1 -0
  182. package/dist/ui/header.js +22 -0
  183. package/dist/ui/header.js.map +1 -0
  184. package/dist/ui/layout-wrapper.d.ts +1 -0
  185. package/dist/ui/layout-wrapper.js +5 -0
  186. package/dist/ui/layout-wrapper.js.map +1 -0
  187. package/dist/utils/color.d.ts +4 -0
  188. package/dist/utils/color.js +14 -0
  189. package/dist/utils/color.js.map +1 -0
  190. package/dist/utils/index.d.ts +15 -0
  191. package/dist/utils/index.js +48 -0
  192. package/dist/utils/index.js.map +1 -0
  193. package/dist/utils/poly.d.ts +8 -0
  194. package/dist/utils/poly.js +3 -0
  195. package/dist/utils/poly.js.map +1 -0
  196. package/package.json +95 -0
@@ -0,0 +1,191 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect, useRef } from 'react';
4
+ import * as THREE from 'three';
5
+ import { useGpuTier } from '../../../hooks/use-gpu-tier';
6
+ import { useSmoothControls } from '../../../hooks/use-smooth-controls';
7
+ import { cn } from '../../../utils';
8
+ import { BLEND_MODES } from '.';
9
+ const vert = /*glsl*/ `
10
+ varying vec2 vUv;
11
+ void main() {
12
+ vUv = uv;
13
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
14
+ }
15
+ `;
16
+ const frag = /*glsl*/ `
17
+ uniform float uTime, uAlpha, uIntensity, uChroma, uSpeed, uSparsity;
18
+ uniform vec3 uColor;
19
+ varying vec2 vUv;
20
+
21
+ float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
22
+
23
+ vec2 hash2(vec2 p) {
24
+ vec3 q = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));
25
+ q += dot(q, q.yzx + 33.33);
26
+ return fract((q.xx + q.yz) * q.zy);
27
+ }
28
+
29
+ float dither(vec2 p, float a) {
30
+ return step(mod(floor(p.x) + floor(p.y) * 2.0, 4.0) / 4.0, a);
31
+ }
32
+
33
+ void main() {
34
+ vec3 col = vec3(0.0);
35
+ float t = uTime * uSpeed;
36
+ float tSlow = floor(t / 3.0);
37
+ float dit = dither(gl_FragCoord.xy * 0.5, 0.7);
38
+
39
+ for (float i = 0.0; i < 6.0; i++) {
40
+ float seed = i * 137.3;
41
+ float epoch = floor((t + hash(vec2(seed, 77.7)) * 200.0) / (4.0 + hash(vec2(seed, 0.0)) * 6.0));
42
+ float life = fract((t + hash(vec2(seed, 77.7)) * 200.0) / (4.0 + hash(vec2(seed, 0.0)) * 6.0));
43
+
44
+ if (hash(vec2(epoch, seed)) > 1.0 - uSparsity * 0.7) continue;
45
+
46
+ vec2 center = vec2(hash(vec2(epoch, seed + 13.1)), hash(vec2(epoch, seed + 27.3)));
47
+ vec2 size = vec2(0.015 + hash(vec2(epoch, seed + 41.5)) * 0.08, 0.008 + hash(vec2(epoch, seed + 53.7)) * 0.04);
48
+ vec2 d = abs(vUv - center);
49
+
50
+ if (d.x < size.x && d.y < size.y) {
51
+ float fade = smoothstep(0.0, 0.05, life) * smoothstep(1.0, 0.95, life);
52
+ vec2 gUV = vUv + (hash2(vec2(epoch, seed + 200.0)) - 0.5) * 0.08 * uIntensity;
53
+ float shift = uChroma * 0.015 * (sin(t * 2.0 + hash(vec2(epoch, seed)) * 6.28) * 0.3 + 0.7);
54
+
55
+ col += uColor * vec3(
56
+ hash(gUV * 50.0 + vec2(shift, 0.0) + epoch),
57
+ hash(gUV * 50.0 + epoch),
58
+ hash(gUV * 50.0 - vec2(shift, 0.0) + epoch)
59
+ ) * dither(gl_FragCoord.xy * 0.5, fade * 0.8 + 0.2) * uIntensity * 0.7;
60
+ }
61
+ }
62
+
63
+ for (float i = 0.0; i < 12.0; i++) {
64
+ float seed = i * 211.7 + 1000.0;
65
+ float epoch = floor((t + hash(vec2(seed, 77.7)) * 150.0) / (3.0 + hash(vec2(seed, 0.0)) * 5.0));
66
+ float life = fract((t + hash(vec2(seed, 77.7)) * 150.0) / (3.0 + hash(vec2(seed, 0.0)) * 5.0));
67
+
68
+ if (hash(vec2(epoch, seed)) > 1.0 - uSparsity * 0.5) continue;
69
+
70
+ vec2 pos = vec2(hash(vec2(epoch, seed + 13.1)), hash(vec2(epoch, seed + 27.3)));
71
+ float px = 0.003 + hash(vec2(epoch, seed + 41.5)) * 0.008;
72
+
73
+ if (abs(vUv.x - pos.x) < px && abs(vUv.y - pos.y) < px) {
74
+ float fade = smoothstep(0.0, 0.1, life) * smoothstep(1.0, 0.9, life);
75
+ vec3 c = uColor;
76
+ float cs = hash(vec2(epoch, seed + 700.0));
77
+
78
+ if (cs < 0.2) c.r *= 1.8 * uChroma;
79
+ else if (cs < 0.4) c.b *= 1.8 * uChroma;
80
+
81
+ col += c * dither(gl_FragCoord.xy * 0.5, fade * 0.9) * uIntensity;
82
+ }
83
+ }
84
+
85
+ float tearSize = 25.0 + uSparsity * 10.0;
86
+ float tearThresh = 0.85 + uSparsity * 0.1;
87
+
88
+ float hY = floor(vUv.y * tearSize);
89
+ if (step(tearThresh, hash(vec2(hY, tSlow))) > 0.0) {
90
+ float shift = (hash(vec2(hY, tSlow + 50.0)) - 0.5) * 0.25 * uIntensity;
91
+ col += uColor * step(0.4, hash(vec2(vUv.x + shift, hY + tSlow))) * dit * uIntensity * 0.5;
92
+ }
93
+
94
+ float vX = floor(vUv.x * tearSize);
95
+ if (step(tearThresh, hash(vec2(vX, tSlow + 100.0))) > 0.0) {
96
+ float shift = (hash(vec2(vX, tSlow + 150.0)) - 0.5) * 0.25 * uIntensity;
97
+ col += uColor * step(0.4, hash(vec2(vX + tSlow, vUv.y + shift))) * dit * uIntensity * 0.5;
98
+ }
99
+
100
+ gl_FragColor = vec4(col * uAlpha, max(col.r, max(col.g, col.b)) * uAlpha);
101
+ }
102
+ `;
103
+ export function Glitch({ className, style }) {
104
+ const gpuTier = useGpuTier();
105
+ const c = useSmoothControls('Effects/Glitch', {
106
+ alpha: { max: 2, min: 0, step: 0.01, value: 0.25 },
107
+ blend: { options: BLEND_MODES, value: 'difference' },
108
+ chroma: { max: 3, min: 0, step: 0.01, value: 1.17 },
109
+ color: { value: '#ffe6cb' },
110
+ enabled: { value: true },
111
+ intensity: { max: 1, min: 0, step: 0.01, value: 0.59 },
112
+ sparsity: { max: 1, min: 0, step: 0.01, value: 0.21 },
113
+ speed: { max: 10, min: 0.1, step: 0.1, value: 1 }
114
+ }, { collapsed: true });
115
+ const ref = useRef(null);
116
+ const cRef = useRef(c);
117
+ cRef.current = c;
118
+ const enabled = c.enabled && gpuTier > 0;
119
+ useEffect(() => {
120
+ if (!ref.current || !enabled) {
121
+ return;
122
+ }
123
+ const renderer = new THREE.WebGLRenderer({
124
+ alpha: true,
125
+ canvas: ref.current
126
+ });
127
+ const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
128
+ const geo = new THREE.PlaneGeometry(2, 2);
129
+ const scene = new THREE.Scene();
130
+ const mat = new THREE.ShaderMaterial({
131
+ fragmentShader: frag,
132
+ transparent: true,
133
+ uniforms: {
134
+ uAlpha: { value: c.alpha },
135
+ uChroma: { value: c.chroma },
136
+ uColor: { value: new THREE.Color(c.color) },
137
+ uIntensity: { value: c.intensity },
138
+ uSparsity: { value: c.sparsity },
139
+ uSpeed: { value: c.speed },
140
+ uTime: { value: 0 }
141
+ },
142
+ vertexShader: vert
143
+ });
144
+ scene.add(new THREE.Mesh(geo, mat));
145
+ const resize = () => {
146
+ renderer.setSize(innerWidth, innerHeight);
147
+ renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
148
+ };
149
+ resize();
150
+ window.addEventListener('resize', resize);
151
+ let raf, time = 0;
152
+ const interval = gpuTier === 1 ? 100 : 0;
153
+ const loop = () => {
154
+ raf = interval
155
+ ? setTimeout(loop, interval)
156
+ : requestAnimationFrame(loop);
157
+ time += interval ? interval / 1000 : 0.016;
158
+ const v = cRef.current;
159
+ mat.uniforms.uTime.value = time;
160
+ mat.uniforms.uAlpha.value = v.alpha;
161
+ mat.uniforms.uChroma.value = v.chroma;
162
+ mat.uniforms.uIntensity.value = v.intensity;
163
+ mat.uniforms.uSparsity.value = v.sparsity;
164
+ mat.uniforms.uSpeed.value = v.speed;
165
+ mat.uniforms.uColor.value.set(v.color);
166
+ renderer.render(scene, camera);
167
+ };
168
+ loop();
169
+ return () => {
170
+ window.removeEventListener('resize', resize);
171
+ if (interval) {
172
+ clearTimeout(raf);
173
+ }
174
+ else {
175
+ cancelAnimationFrame(raf);
176
+ }
177
+ mat.dispose();
178
+ geo.dispose();
179
+ renderer.dispose();
180
+ };
181
+ // eslint-disable-next-line react-hooks/exhaustive-deps
182
+ }, [enabled, gpuTier]);
183
+ if (!enabled) {
184
+ return null;
185
+ }
186
+ return (_jsx("canvas", { className: cn('h-full w-full', className), ref: ref, style: {
187
+ mixBlendMode: c.blend,
188
+ ...style
189
+ } }));
190
+ }
191
+ //# sourceMappingURL=glitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glitch.js","sourceRoot":"","sources":["../../../../src/ui/components/overlays/glitch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAA;AAE/B,MAAM,IAAI,GAAG,QAAQ,CAAC;;;;;;CAMrB,CAAA;AAED,MAAM,IAAI,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFrB,CAAA;AAED,MAAM,UAAU,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,EAAe;IACtD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAE5B,MAAM,CAAC,GAAG,iBAAiB,CACzB,gBAAgB,EAChB;QACE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,E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AA;QAEN,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YAE5C,IAAI,QAAQ,EAAE,CAAC;gBACb,YAAY,CAAC,GAAG,CAAC,CAAA;YACnB,CAAC;iBAAM,CAAC;gBACN,oBAAoB,CAAC,GAAG,CAAC,CAAA;YAC3B,CAAC;YAED,GAAG,CAAC,OAAO,EAAE,CAAA;YACb,GAAG,CAAC,OAAO,EAAE,CAAA;YACb,QAAQ,CAAC,OAAO,EAAE,CAAA;QACpB,CAAC,CAAA;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAEtB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,iBACE,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,EACzC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE;YACL,YAAY,EAAE,CAAC,CAAC,KAA4C;YAC5D,GAAG,KAAK;SACT,GACD,CACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function Greys({ className, style }: GreysProps): import("react/jsx-runtime").JSX.Element | null;
2
+ interface GreysProps {
3
+ className?: string;
4
+ style?: React.CSSProperties;
5
+ }
6
+ export {};
@@ -0,0 +1,300 @@
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 { useGpuTier } from '../../../hooks/use-gpu-tier';
6
+ import { useSmoothControls } from '../../../hooks/use-smooth-controls';
7
+ import { cn } from '../../../utils';
8
+ import { BLEND_MODES } from '.';
9
+ const vert = /*glsl*/ `
10
+ varying vec2 vUv;
11
+ void main() {
12
+ vUv = uv;
13
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
14
+ }
15
+ `;
16
+ const sourceFrag = /*glsl*/ `
17
+ uniform sampler2D uTex0, uTex1, uTex2, uTex3;
18
+ uniform float uTime, uZoom, uSpeed, uRotate, uFolds, uDrift;
19
+ varying vec2 vUv;
20
+
21
+ vec3 gray(vec3 c) { return vec3(dot(c, vec3(.299, .587, .114))); }
22
+ vec2 rot(vec2 p, float a) { return vec2(p.x * cos(a) - p.y * sin(a), p.x * sin(a) + p.y * cos(a)); }
23
+
24
+ vec2 kaleid(vec2 p, float n) {
25
+ float a = mod(atan(p.y, p.x), 6.28318 / n) - 3.14159 / n;
26
+ return length(p) * vec2(cos(a), sin(a));
27
+ }
28
+
29
+ vec4 tex(int i, vec2 uv) {
30
+ if (i == 0) return texture2D(uTex0, uv);
31
+ if (i == 1) return texture2D(uTex1, uv);
32
+ if (i == 2) return texture2D(uTex2, uv);
33
+ return texture2D(uTex3, uv);
34
+ }
35
+
36
+ void main() {
37
+ vec2 uv = rot(vUv - .5, uTime * uRotate * .05);
38
+ if (uFolds > 1.) uv = kaleid(uv, uFolds);
39
+
40
+ float dt = uTime * uDrift * .1;
41
+ uv = uv / uZoom + .5 + vec2(sin(dt * .7) * cos(dt * .3), cos(dt * .5) * sin(dt * .9)) * .15 * uDrift;
42
+
43
+ float cycle = mod(uTime * uSpeed * .01, 4.);
44
+ int i0 = int(floor(cycle)), i1 = int(mod(float(i0) + 1., 4.));
45
+ float t = smoothstep(0., 1., fract(cycle));
46
+
47
+ vec3 base = mix(gray(vec3(1.) - tex(i0, uv).rgb), gray(vec3(1.) - tex(i1, uv).rgb), t);
48
+ vec2 uvF = vec2(1. - uv.x, uv.y);
49
+ vec3 flip = mix(gray(vec3(1.) - tex(i0, uvF).rgb), gray(vec3(1.) - tex(i1, uvF).rgb), t);
50
+
51
+ gl_FragColor = vec4(mix(base, flip, .3 + sin(uTime * .2) * .2), 1.);
52
+ }
53
+ `;
54
+ const moshFrag = /*glsl*/ `
55
+ uniform sampler2D uCurrent, uPrev, uTex0, uTex1, uTex2, uTex3;
56
+ uniform float uTime, uIntensity, uMotion, uZoom, uSpeed;
57
+ uniform vec2 uRes;
58
+ varying vec2 vUv;
59
+
60
+ float hash(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
61
+ vec2 hash2(vec2 p) { return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)))) * 43758.5453); }
62
+
63
+ float noise(vec2 p) {
64
+ vec2 i = floor(p), f = fract(p) * fract(p) * (3. - 2. * fract(p));
65
+ return mix(mix(hash(i), hash(i + vec2(1., 0.)), f.x), mix(hash(i + vec2(0., 1.)), hash(i + vec2(1., 1.)), f.x), f.y);
66
+ }
67
+
68
+ vec3 gray(vec3 c) { return vec3(dot(c, vec3(.299, .587, .114))); }
69
+
70
+ vec2 distort(vec2 uv, float k, float t) {
71
+ float n1 = noise(uv * 8. + t * .5), n2 = noise(uv * 12. + t * .7), flow = noise(uv * 4. + t * .3);
72
+ return uv + vec2(cos(n1 * 6.28 + t * 1.2), sin(n2 * 6.28 + t * .9)) * .02 * k
73
+ + vec2(cos(flow * 6.28 + uv.y * 10.), sin(flow * 6.28 + uv.x * 10.)) * .015 * k;
74
+ }
75
+
76
+ vec3 tex(int i, vec2 uv) {
77
+ vec2 zuv = (uv - .5) / uZoom + .5;
78
+ if (i == 0) return gray(vec3(1.) - texture2D(uTex0, zuv).rgb);
79
+ if (i == 1) return gray(vec3(1.) - texture2D(uTex1, zuv).rgb);
80
+ if (i == 2) return gray(vec3(1.) - texture2D(uTex2, zuv).rgb);
81
+ return gray(vec3(1.) - texture2D(uTex3, zuv).rgb);
82
+ }
83
+
84
+ void main() {
85
+ vec2 uv = vUv;
86
+ float t = uTime * uSpeed, tS = floor(t * .1), pS = 80.;
87
+ float amt = uIntensity * uMotion * .8 * (.7 + (sin(t * .5) * .5 + .5) * .3);
88
+
89
+ vec2 mUV = distort(uv, uIntensity * .4, t);
90
+
91
+ float hS = floor(uv.y * pS), hA = smoothstep(0., .8, hash(vec2(hS, tS)));
92
+ float hO = (hash(vec2(hS, tS + 50.)) - .5) * .25 * hA * amt;
93
+ float vS = floor(uv.x * pS), vA = smoothstep(0., .8, hash(vec2(vS, tS + 100.)));
94
+ float vO = (hash(vec2(vS, tS + 150.)) - .5) * .25 * vA * amt;
95
+ mUV += vec2(hO, vO);
96
+
97
+ float bS = pS * .25;
98
+ float hBA = step(.5, hash(vec2(floor(uv.y * bS), tS + 200.)));
99
+ float hBO = (hash(vec2(floor(uv.y * bS), 200.)) - .5) * .35 * hBA * amt;
100
+ float vBA = step(.5, hash(vec2(floor(uv.x * bS), tS + 300.)));
101
+ float vBO = (hash(vec2(floor(uv.x * bS), 250.)) - .5) * .35 * vBA * amt;
102
+ mUV += vec2(hBO, vBO);
103
+
104
+ vec2 blk = floor(uv * pS * .15);
105
+ mUV += (hash2(vec2(blk.x, blk.y + 500.)) - .5) * .4 * step(.7, hash(vec2(blk.x, blk.y + tS))) * amt;
106
+ mUV = clamp(mUV, 0., 1.);
107
+
108
+ vec3 prev = texture2D(uPrev, mUV).rgb;
109
+ prev = mix(prev, texture2D(uPrev, clamp(uv + vec2(hBO, vBO), 0., 1.)).rgb, max(hBA, vBA) * .9);
110
+
111
+ float tY = floor(uv.y * pS * .4);
112
+ if (hash(vec2(tY, tS + 400.)) > .75) {
113
+ prev = mix(prev, texture2D(uPrev, clamp(vec2(uv.x + (hash(vec2(tY, 400.)) - .5) * .5 * amt, uv.y), 0., 1.)).rgb, .85);
114
+ }
115
+
116
+ if (hA > 0. && amt > .01) {
117
+ prev = mix(prev, gray(texture2D(uPrev, clamp(vec2(uv.x + (gray(prev).r - uv.x) * amt + hO, uv.y), 0., 1.)).rgb), hA);
118
+ }
119
+
120
+ float d = mix(mix(.97, .99, noise(uv * 8. + t * .2)), 0., step(.994, hash(vec2(tS, 0.))));
121
+ gl_FragColor = vec4(mix(texture2D(uCurrent, uv).rgb, prev, d), 1.);
122
+ }
123
+ `;
124
+ const outputFrag = /*glsl*/ `
125
+ uniform sampler2D uInput;
126
+ uniform float uTime, uAlpha, uHue;
127
+ uniform vec3 uColor;
128
+ varying vec2 vUv;
129
+
130
+ float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
131
+
132
+ vec3 hueShift(vec3 c, float h) {
133
+ float a = h * 6.28318, s = sin(a), co = cos(a);
134
+ vec3 w = vec3(.299, .587, .114);
135
+ return clamp(vec3(
136
+ dot(c, w) + dot(c, vec3(.701, -.587, -.114) * co + vec3(.168, .330, -.497) * s),
137
+ dot(c, w) + dot(c, vec3(-.299, .413, -.114) * co + vec3(.328, .035, -.363) * s),
138
+ dot(c, w) + dot(c, vec3(-.299, -.587, .886) * co + vec3(-.497, .330, .168) * s)
139
+ ), 0., 1.);
140
+ }
141
+
142
+ void main() {
143
+ vec3 m = texture2D(uInput, vUv).rgb;
144
+ m *= 1. - step(.5, fract(vUv.y * 200.)) * .06 * step(.97, hash(vec2(floor(vUv.y * 30.), floor(uTime * .5))));
145
+
146
+ float lum = dot(m, vec3(.299, .587, .114));
147
+ gl_FragColor = vec4(hueShift(mix(vec3(lum), uColor * lum * 2., length(uColor)), uHue) * uAlpha, smoothstep(.08, .18, lum * uAlpha));
148
+ }
149
+ `;
150
+ const TEXTURES = [
151
+ '/anatomy/grays-0.jpg',
152
+ '/anatomy/grays-3.jpg',
153
+ '/anatomy/grays-6.jpg',
154
+ '/anatomy/grays-9.jpg'
155
+ ];
156
+ export function Greys({ className, style }) {
157
+ const gpuTier = useGpuTier();
158
+ const [blendOverride, setBlendOverride] = useState(null);
159
+ const canvasRef = useRef(null);
160
+ const c = useSmoothControls('Effects/Greys', {
161
+ alpha: { max: 1, min: 0, step: 0.01, value: 0.19 },
162
+ blend: { options: BLEND_MODES, value: 'color-burn' },
163
+ color: { value: '#ffac02' },
164
+ drift: { max: 2, min: 0, step: 0.1, value: 0.5 },
165
+ enabled: { value: false },
166
+ folds: { max: 12, min: 1, step: 1, value: 1 },
167
+ hue: { max: 1, min: 0, step: 0.01, value: 0.37 },
168
+ intensity: { max: 3, min: 0, step: 0.1, value: 0.1 },
169
+ motion: { max: 2, min: 0, step: 0.1, value: 0.1 },
170
+ rotate: { max: 2, min: -2, step: 0.1, value: 0.3 },
171
+ speed: { max: 1, min: 0.01, step: 0.01, value: 0.21 },
172
+ zoom: { max: 4, min: 0.5, step: 0.1, value: 0.7 }
173
+ }, { collapsed: true });
174
+ const cRef = useRef(c);
175
+ cRef.current = c;
176
+ useEffect(() => {
177
+ const onKey = (e) => e.key.toLowerCase() === 'x' &&
178
+ setBlendOverride(p => (p === 'screen' ? null : 'screen'));
179
+ window.addEventListener('keydown', onKey);
180
+ return () => window.removeEventListener('keydown', onKey);
181
+ }, []);
182
+ const enabled = c.enabled && gpuTier === 2;
183
+ useEffect(() => {
184
+ if (!canvasRef.current || !enabled) {
185
+ return;
186
+ }
187
+ const renderer = new THREE.WebGLRenderer({
188
+ alpha: true,
189
+ canvas: canvasRef.current
190
+ });
191
+ const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
192
+ const geo = new THREE.PlaneGeometry(2, 2);
193
+ const [rtSource, rtA, rtB] = [0, 1, 2].map(() => new THREE.WebGLRenderTarget(innerWidth, innerHeight, {
194
+ magFilter: THREE.NearestFilter,
195
+ minFilter: THREE.NearestFilter
196
+ }));
197
+ const textures = TEXTURES.map(p => {
198
+ const t = new THREE.TextureLoader().load(p);
199
+ t.wrapS = t.wrapT = THREE.ClampToEdgeWrapping;
200
+ t.minFilter = t.magFilter = THREE.LinearFilter;
201
+ return t;
202
+ });
203
+ const texU = Object.fromEntries(textures.map((t, i) => [`uTex${i}`, { value: t }]));
204
+ const srcU = {
205
+ ...texU,
206
+ uDrift: { value: 0 },
207
+ uFolds: { value: 0 },
208
+ uRotate: { value: 0 },
209
+ uSpeed: { value: 0 },
210
+ uTime: { value: 0 },
211
+ uZoom: { value: 0 }
212
+ };
213
+ const moshU = {
214
+ ...texU,
215
+ uCurrent: { value: rtSource.texture },
216
+ uIntensity: { value: 0 },
217
+ uMotion: { value: 0 },
218
+ uPrev: { value: rtA.texture },
219
+ uRes: { value: new THREE.Vector2(innerWidth, innerHeight) },
220
+ uSpeed: { value: 0 },
221
+ uTime: { value: 0 },
222
+ uZoom: { value: 0 }
223
+ };
224
+ const outU = {
225
+ uAlpha: { value: 0 },
226
+ uColor: { value: new THREE.Color() },
227
+ uHue: { value: 0 },
228
+ uInput: { value: rtB.texture },
229
+ uTime: { value: 0 }
230
+ };
231
+ const mkScene = (frag, uniforms, transparent = false) => {
232
+ const s = new THREE.Scene();
233
+ s.add(new THREE.Mesh(geo.clone(), new THREE.ShaderMaterial({
234
+ fragmentShader: frag,
235
+ transparent,
236
+ uniforms: uniforms,
237
+ vertexShader: vert
238
+ })));
239
+ return s;
240
+ };
241
+ const srcScene = mkScene(sourceFrag, srcU);
242
+ const moshScene = mkScene(moshFrag, moshU);
243
+ const outScene = mkScene(outputFrag, outU, true);
244
+ const resize = () => {
245
+ renderer.setSize(innerWidth, innerHeight);
246
+ renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
247
+ [rtSource, rtA, rtB].forEach(rt => rt.setSize(innerWidth, innerHeight));
248
+ moshU.uRes.value.set(innerWidth, innerHeight);
249
+ };
250
+ resize();
251
+ window.addEventListener('resize', resize);
252
+ let raf, ping = true, time = 0;
253
+ const loop = () => {
254
+ raf = requestAnimationFrame(loop);
255
+ time += 0.016;
256
+ const v = cRef.current;
257
+ srcU.uTime.value = time;
258
+ srcU.uSpeed.value = v.speed;
259
+ srcU.uZoom.value = v.zoom;
260
+ srcU.uRotate.value = v.rotate;
261
+ srcU.uFolds.value = v.folds;
262
+ srcU.uDrift.value = v.drift;
263
+ moshU.uTime.value = time;
264
+ moshU.uIntensity.value = v.intensity;
265
+ moshU.uMotion.value = v.motion;
266
+ moshU.uSpeed.value = v.speed;
267
+ moshU.uZoom.value = v.zoom;
268
+ outU.uTime.value = time;
269
+ outU.uAlpha.value = v.alpha;
270
+ outU.uHue.value = v.hue;
271
+ outU.uColor.value.set(typeof v.color === 'string' ? v.color : '#fff');
272
+ renderer.setRenderTarget(rtSource);
273
+ renderer.render(srcScene, camera);
274
+ const [read, write] = ping ? [rtA, rtB] : [rtB, rtA];
275
+ moshU.uPrev.value = read.texture;
276
+ renderer.setRenderTarget(write);
277
+ renderer.render(moshScene, camera);
278
+ outU.uInput.value = write.texture;
279
+ renderer.setRenderTarget(null);
280
+ renderer.render(outScene, camera);
281
+ ping = !ping;
282
+ };
283
+ loop();
284
+ return () => {
285
+ window.removeEventListener('resize', resize);
286
+ cancelAnimationFrame(raf);
287
+ textures.forEach(t => t.dispose());
288
+ [geo, rtSource, rtA, rtB, renderer].forEach(x => x.dispose());
289
+ };
290
+ }, [enabled]);
291
+ if (!enabled) {
292
+ return null;
293
+ }
294
+ return (_jsx("canvas", { className: cn('h-full w-full', className), ref: canvasRef, style: {
295
+ mixBlendMode: (blendOverride ??
296
+ c.blend),
297
+ ...style
298
+ } }));
299
+ }
300
+ //# sourceMappingURL=greys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"greys.js","sourceRoot":"","sources":["../../../../src/ui/components/overlays/greys.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAA;AAE/B,MAAM,IAAI,GAAG,QAAQ,CAAC;;;;;;CAMrB,CAAA;AAED,MAAM,UAAU,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC3B,CAAA;AAED,MAAM,QAAQ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AC,CAAC,CAAA;IAEb,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,iBACE,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,EACzC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE;YACL,YAAY,EAAE,CAAC,aAAa;gBAC1B,CAAC,CAAC,KAAK,CAAwC;YACjD,GAAG,KAAK;SACT,GACD,CACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ export declare const BLEND_MODES: React.CSSProperties["mixBlendMode"][];
2
+ export declare const LENS_0: {
3
+ Globe: {
4
+ innerColor: string;
5
+ innerOpacity: number;
6
+ outerColor: string;
7
+ };
8
+ Lens: {
9
+ bgBlend: string;
10
+ bgColor: string;
11
+ bgOpacity: number;
12
+ fgColor: string;
13
+ fgOpacity: number;
14
+ fillerOpacity: number;
15
+ mgColor: string;
16
+ mgOpacity: number;
17
+ };
18
+ };
19
+ export declare const LENS_5I: {
20
+ Globe: {
21
+ innerColor: string;
22
+ innerOpacity: number;
23
+ outerColor: string;
24
+ };
25
+ Lens: {
26
+ bgBlend: string;
27
+ bgColor: string;
28
+ bgOpacity: number;
29
+ fgColor: string;
30
+ fgOpacity: number;
31
+ fillerOpacity: number;
32
+ mgColor: string;
33
+ mgOpacity: number;
34
+ };
35
+ };
36
+ export declare const lens0: (l?: Partial<typeof LENS_0.Lens>, g?: Partial<typeof LENS_0.Globe>) => LensPreset;
37
+ export declare const LENSES: [string, LensPreset][];
38
+ export declare const applyLens: (preset: LensPreset, animate?: boolean) => void;
39
+ export declare const $lightMode: import("nanostores").PreinitializedWritableAtom<boolean> & object;
40
+ export declare const toggleLens: () => void;
41
+ export declare function Overlays({ dark }: {
42
+ dark?: boolean;
43
+ }): import("react/jsx-runtime").JSX.Element;
44
+ export type LensPreset = Record<string, Record<string, unknown>>;