@nous-research/ui 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/filler-bg0.webp +0 -0
- package/dist/assets.d.ts +38 -0
- package/dist/fonts.d.ts +0 -1
- package/dist/fonts.js +5 -7
- package/dist/hooks/use-capped-frame.d.ts +0 -1
- package/dist/hooks/use-capped-frame.js +12 -13
- package/dist/hooks/use-css-var-dims.d.ts +0 -1
- package/dist/hooks/use-css-var-dims.js +26 -21
- package/dist/hooks/use-gpu-tier.d.ts +0 -1
- package/dist/hooks/use-gpu-tier.js +90 -110
- package/dist/hooks/use-render-loop.d.ts +0 -1
- package/dist/hooks/use-render-loop.js +58 -58
- package/dist/hooks/use-smooth-controls.d.ts +0 -1
- package/dist/hooks/use-smooth-controls.js +204 -206
- package/dist/index.d.ts +0 -1
- package/dist/index.js +84 -58
- package/dist/ui/basic-page.d.ts +1 -2
- package/dist/ui/basic-page.js +15 -7
- package/dist/ui/components/animated-count.d.ts +1 -2
- package/dist/ui/components/animated-count.js +109 -85
- package/dist/ui/components/ascii.d.ts +2 -3
- package/dist/ui/components/ascii.js +75 -59
- package/dist/ui/components/badge.d.ts +1 -2
- package/dist/ui/components/badge.js +35 -18
- package/dist/ui/components/badges/nous-girl.d.ts +1 -2
- package/dist/ui/components/badges/nous-girl.js +80 -3
- package/dist/ui/components/blend-mode.d.ts +1 -2
- package/dist/ui/components/blend-mode.js +55 -63
- package/dist/ui/components/blink.d.ts +1 -2
- package/dist/ui/components/blink.js +15 -6
- package/dist/ui/components/button.d.ts +2 -3
- package/dist/ui/components/button.js +139 -90
- package/dist/ui/components/command-block.d.ts +2 -3
- package/dist/ui/components/command-block.js +52 -24
- package/dist/ui/components/cursor.d.ts +1 -2
- package/dist/ui/components/cursor.js +93 -54
- package/dist/ui/components/dropdown-menu.d.ts +1 -2
- package/dist/ui/components/dropdown-menu.js +99 -51
- package/dist/ui/components/fit-text/index.d.ts +0 -1
- package/dist/ui/components/fit-text/index.js +21 -13
- package/dist/ui/components/graphs/bar-chart.d.ts +1 -2
- package/dist/ui/components/graphs/bar-chart.js +116 -63
- package/dist/ui/components/graphs/index.d.ts +0 -1
- package/dist/ui/components/graphs/index.js +3 -4
- package/dist/ui/components/graphs/line-chart.d.ts +1 -2
- package/dist/ui/components/graphs/line-chart.js +159 -102
- package/dist/ui/components/graphs/utils.d.ts +2 -3
- package/dist/ui/components/graphs/utils.js +147 -114
- package/dist/ui/components/grid/index.d.ts +0 -1
- package/dist/ui/components/grid/index.js +12 -9
- package/dist/ui/components/hover-bg.d.ts +0 -1
- package/dist/ui/components/hover-bg.js +11 -6
- package/dist/ui/components/icons/arrow.d.ts +1 -2
- package/dist/ui/components/icons/arrow.js +42 -5
- package/dist/ui/components/icons/chevron.d.ts +1 -2
- package/dist/ui/components/icons/chevron.js +49 -5
- package/dist/ui/components/icons/discord.d.ts +1 -2
- package/dist/ui/components/icons/discord.js +12 -4
- package/dist/ui/components/icons/eye.d.ts +1 -2
- package/dist/ui/components/icons/eye.js +5 -3
- package/dist/ui/components/icons/gear.d.ts +1 -2
- package/dist/ui/components/icons/gear.js +28 -14
- package/dist/ui/components/icons/github.d.ts +1 -2
- package/dist/ui/components/icons/github.js +12 -4
- package/dist/ui/components/icons/hamburger.d.ts +1 -2
- package/dist/ui/components/icons/hamburger.js +54 -5
- package/dist/ui/components/icons/heart.d.ts +1 -2
- package/dist/ui/components/icons/heart.js +8 -3
- package/dist/ui/components/icons/index.d.ts +0 -1
- package/dist/ui/components/icons/index.js +11 -12
- package/dist/ui/components/icons/link.d.ts +1 -2
- package/dist/ui/components/icons/link.js +10 -3
- package/dist/ui/components/icons/minus.d.ts +1 -2
- package/dist/ui/components/icons/minus.js +10 -3
- package/dist/ui/components/icons/search.d.ts +1 -2
- package/dist/ui/components/icons/search.js +30 -3
- package/dist/ui/components/image-distortion.d.ts +1 -2
- package/dist/ui/components/image-distortion.js +300 -265
- package/dist/ui/components/leva-client.d.ts +1 -2
- package/dist/ui/components/leva-client.js +9 -10
- package/dist/ui/components/list-item.d.ts +0 -1
- package/dist/ui/components/list-item.js +26 -10
- package/dist/ui/components/modal/index.d.ts +1 -2
- package/dist/ui/components/modal/index.js +33 -14
- package/dist/ui/components/overlays/blend-modes.d.ts +0 -1
- package/dist/ui/components/overlays/blend-modes.js +11 -12
- package/dist/ui/components/overlays/glitch.d.ts +1 -2
- package/dist/ui/components/overlays/glitch.js +115 -110
- package/dist/ui/components/overlays/greys.d.ts +1 -2
- package/dist/ui/components/overlays/greys.js +200 -179
- package/dist/ui/components/overlays/index.d.ts +1 -2
- package/dist/ui/components/overlays/index.js +31 -17
- package/dist/ui/components/overlays/lens-layers.d.ts +1 -2
- package/dist/ui/components/overlays/lens-layers.js +89 -65
- package/dist/ui/components/overlays/lens.d.ts +0 -1
- package/dist/ui/components/overlays/lens.js +46 -52
- package/dist/ui/components/overlays/noise.d.ts +1 -2
- package/dist/ui/components/overlays/noise.js +112 -113
- package/dist/ui/components/overlays/vignette.d.ts +1 -2
- package/dist/ui/components/overlays/vignette.js +44 -38
- package/dist/ui/components/poster.d.ts +1 -2
- package/dist/ui/components/poster.js +240 -87
- package/dist/ui/components/progress.d.ts +1 -2
- package/dist/ui/components/progress.js +52 -12
- package/dist/ui/components/scene-canvas.d.ts +1 -2
- package/dist/ui/components/scene-canvas.js +169 -119
- package/dist/ui/components/scramble.d.ts +1 -2
- package/dist/ui/components/scramble.js +60 -59
- package/dist/ui/components/segmented.d.ts +2 -3
- package/dist/ui/components/segmented.js +47 -12
- package/dist/ui/components/select.d.ts +1 -2
- package/dist/ui/components/select.js +207 -120
- package/dist/ui/components/selection-switcher.d.ts +0 -1
- package/dist/ui/components/selection-switcher.js +29 -25
- package/dist/ui/components/shader.d.ts +1 -2
- package/dist/ui/components/shader.js +56 -38
- package/dist/ui/components/socials.d.ts +1 -2
- package/dist/ui/components/socials.js +18 -7
- package/dist/ui/components/spinner.d.ts +1 -2
- package/dist/ui/components/spinner.js +36 -25
- package/dist/ui/components/stats.d.ts +1 -2
- package/dist/ui/components/stats.js +33 -9
- package/dist/ui/components/switch.d.ts +0 -1
- package/dist/ui/components/switch.js +35 -11
- package/dist/ui/components/tabs.d.ts +3 -4
- package/dist/ui/components/tabs.js +38 -12
- package/dist/ui/components/terminal-demo.d.ts +1 -2
- package/dist/ui/components/terminal-demo.js +119 -74
- package/dist/ui/components/theme-toggle.d.ts +1 -2
- package/dist/ui/components/theme-toggle.js +63 -8
- package/dist/ui/components/tier-card.d.ts +1 -2
- package/dist/ui/components/tier-card.js +144 -24
- package/dist/ui/components/tv.d.ts +1 -2
- package/dist/ui/components/tv.js +138 -90
- package/dist/ui/components/typography/h1.d.ts +0 -1
- package/dist/ui/components/typography/h1.js +17 -8
- package/dist/ui/components/typography/h2.d.ts +0 -1
- package/dist/ui/components/typography/h2.js +17 -8
- package/dist/ui/components/typography/index.d.ts +0 -1
- package/dist/ui/components/typography/index.js +35 -24
- package/dist/ui/components/typography/legend.d.ts +1 -2
- package/dist/ui/components/typography/legend.js +18 -6
- package/dist/ui/components/typography/small.d.ts +0 -1
- package/dist/ui/components/typography/small.js +8 -7
- package/dist/ui/components/watchlist.d.ts +1 -2
- package/dist/ui/components/watchlist.js +77 -25
- package/dist/ui/fonts.css +7 -7
- package/dist/ui/footer.d.ts +1 -2
- package/dist/ui/footer.js +61 -25
- package/dist/ui/header.d.ts +1 -2
- package/dist/ui/header.js +255 -60
- package/dist/ui/layout-wrapper.d.ts +1 -2
- package/dist/ui/layout-wrapper.js +5 -4
- package/dist/utils/color.d.ts +0 -1
- package/dist/utils/color.js +8 -9
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +37 -38
- package/dist/utils/poly.d.ts +0 -1
- package/dist/utils/poly.js +1 -2
- package/package.json +41 -24
- package/dist/assets/filler-bg0.jpg +0 -0
- package/dist/fonts.d.ts.map +0 -1
- package/dist/fonts.js.map +0 -1
- package/dist/hooks/use-capped-frame.d.ts.map +0 -1
- package/dist/hooks/use-capped-frame.js.map +0 -1
- package/dist/hooks/use-css-var-dims.d.ts.map +0 -1
- package/dist/hooks/use-css-var-dims.js.map +0 -1
- package/dist/hooks/use-gpu-tier.d.ts.map +0 -1
- package/dist/hooks/use-gpu-tier.js.map +0 -1
- package/dist/hooks/use-render-loop.d.ts.map +0 -1
- package/dist/hooks/use-render-loop.js.map +0 -1
- package/dist/hooks/use-smooth-controls.d.ts.map +0 -1
- package/dist/hooks/use-smooth-controls.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/ui/basic-page.d.ts.map +0 -1
- package/dist/ui/basic-page.js.map +0 -1
- package/dist/ui/components/animated-count.d.ts.map +0 -1
- package/dist/ui/components/animated-count.js.map +0 -1
- package/dist/ui/components/ascii.d.ts.map +0 -1
- package/dist/ui/components/ascii.js.map +0 -1
- package/dist/ui/components/badge.d.ts.map +0 -1
- package/dist/ui/components/badge.js.map +0 -1
- package/dist/ui/components/badges/nous-girl.d.ts.map +0 -1
- package/dist/ui/components/badges/nous-girl.js.map +0 -1
- package/dist/ui/components/blend-mode.d.ts.map +0 -1
- package/dist/ui/components/blend-mode.js.map +0 -1
- package/dist/ui/components/blink.d.ts.map +0 -1
- package/dist/ui/components/blink.js.map +0 -1
- package/dist/ui/components/button.d.ts.map +0 -1
- package/dist/ui/components/button.js.map +0 -1
- package/dist/ui/components/command-block.d.ts.map +0 -1
- package/dist/ui/components/command-block.js.map +0 -1
- package/dist/ui/components/cursor.d.ts.map +0 -1
- package/dist/ui/components/cursor.js.map +0 -1
- package/dist/ui/components/dropdown-menu.d.ts.map +0 -1
- package/dist/ui/components/dropdown-menu.js.map +0 -1
- package/dist/ui/components/fit-text/index.d.ts.map +0 -1
- package/dist/ui/components/fit-text/index.js.map +0 -1
- package/dist/ui/components/graphs/bar-chart.d.ts.map +0 -1
- package/dist/ui/components/graphs/bar-chart.js.map +0 -1
- package/dist/ui/components/graphs/index.d.ts.map +0 -1
- package/dist/ui/components/graphs/index.js.map +0 -1
- package/dist/ui/components/graphs/line-chart.d.ts.map +0 -1
- package/dist/ui/components/graphs/line-chart.js.map +0 -1
- package/dist/ui/components/graphs/utils.d.ts.map +0 -1
- package/dist/ui/components/graphs/utils.js.map +0 -1
- package/dist/ui/components/grid/index.d.ts.map +0 -1
- package/dist/ui/components/grid/index.js.map +0 -1
- package/dist/ui/components/hover-bg.d.ts.map +0 -1
- package/dist/ui/components/hover-bg.js.map +0 -1
- package/dist/ui/components/icons/arrow.d.ts.map +0 -1
- package/dist/ui/components/icons/arrow.js.map +0 -1
- package/dist/ui/components/icons/chevron.d.ts.map +0 -1
- package/dist/ui/components/icons/chevron.js.map +0 -1
- package/dist/ui/components/icons/discord.d.ts.map +0 -1
- package/dist/ui/components/icons/discord.js.map +0 -1
- package/dist/ui/components/icons/eye.d.ts.map +0 -1
- package/dist/ui/components/icons/eye.js.map +0 -1
- package/dist/ui/components/icons/gear.d.ts.map +0 -1
- package/dist/ui/components/icons/gear.js.map +0 -1
- package/dist/ui/components/icons/github.d.ts.map +0 -1
- package/dist/ui/components/icons/github.js.map +0 -1
- package/dist/ui/components/icons/hamburger.d.ts.map +0 -1
- package/dist/ui/components/icons/hamburger.js.map +0 -1
- package/dist/ui/components/icons/heart.d.ts.map +0 -1
- package/dist/ui/components/icons/heart.js.map +0 -1
- package/dist/ui/components/icons/index.d.ts.map +0 -1
- package/dist/ui/components/icons/index.js.map +0 -1
- package/dist/ui/components/icons/link.d.ts.map +0 -1
- package/dist/ui/components/icons/link.js.map +0 -1
- package/dist/ui/components/icons/minus.d.ts.map +0 -1
- package/dist/ui/components/icons/minus.js.map +0 -1
- package/dist/ui/components/icons/search.d.ts.map +0 -1
- package/dist/ui/components/icons/search.js.map +0 -1
- package/dist/ui/components/image-distortion.d.ts.map +0 -1
- package/dist/ui/components/image-distortion.js.map +0 -1
- package/dist/ui/components/leva-client.d.ts.map +0 -1
- package/dist/ui/components/leva-client.js.map +0 -1
- package/dist/ui/components/list-item.d.ts.map +0 -1
- package/dist/ui/components/list-item.js.map +0 -1
- package/dist/ui/components/modal/index.d.ts.map +0 -1
- package/dist/ui/components/modal/index.js.map +0 -1
- package/dist/ui/components/overlays/blend-modes.d.ts.map +0 -1
- package/dist/ui/components/overlays/blend-modes.js.map +0 -1
- package/dist/ui/components/overlays/glitch.d.ts.map +0 -1
- package/dist/ui/components/overlays/glitch.js.map +0 -1
- package/dist/ui/components/overlays/greys.d.ts.map +0 -1
- package/dist/ui/components/overlays/greys.js.map +0 -1
- package/dist/ui/components/overlays/index.d.ts.map +0 -1
- package/dist/ui/components/overlays/index.js.map +0 -1
- package/dist/ui/components/overlays/lens-layers.d.ts.map +0 -1
- package/dist/ui/components/overlays/lens-layers.js.map +0 -1
- package/dist/ui/components/overlays/lens.d.ts.map +0 -1
- package/dist/ui/components/overlays/lens.js.map +0 -1
- package/dist/ui/components/overlays/noise.d.ts.map +0 -1
- package/dist/ui/components/overlays/noise.js.map +0 -1
- package/dist/ui/components/overlays/vignette.d.ts.map +0 -1
- package/dist/ui/components/overlays/vignette.js.map +0 -1
- package/dist/ui/components/poster.d.ts.map +0 -1
- package/dist/ui/components/poster.js.map +0 -1
- package/dist/ui/components/progress.d.ts.map +0 -1
- package/dist/ui/components/progress.js.map +0 -1
- package/dist/ui/components/scene-canvas.d.ts.map +0 -1
- package/dist/ui/components/scene-canvas.js.map +0 -1
- package/dist/ui/components/scramble.d.ts.map +0 -1
- package/dist/ui/components/scramble.js.map +0 -1
- package/dist/ui/components/segmented.d.ts.map +0 -1
- package/dist/ui/components/segmented.js.map +0 -1
- package/dist/ui/components/select.d.ts.map +0 -1
- package/dist/ui/components/select.js.map +0 -1
- package/dist/ui/components/selection-switcher.d.ts.map +0 -1
- package/dist/ui/components/selection-switcher.js.map +0 -1
- package/dist/ui/components/shader.d.ts.map +0 -1
- package/dist/ui/components/shader.js.map +0 -1
- package/dist/ui/components/socials.d.ts.map +0 -1
- package/dist/ui/components/socials.js.map +0 -1
- package/dist/ui/components/spinner.d.ts.map +0 -1
- package/dist/ui/components/spinner.js.map +0 -1
- package/dist/ui/components/stats.d.ts.map +0 -1
- package/dist/ui/components/stats.js.map +0 -1
- package/dist/ui/components/switch.d.ts.map +0 -1
- package/dist/ui/components/switch.js.map +0 -1
- package/dist/ui/components/tabs.d.ts.map +0 -1
- package/dist/ui/components/tabs.js.map +0 -1
- package/dist/ui/components/terminal-demo.d.ts.map +0 -1
- package/dist/ui/components/terminal-demo.js.map +0 -1
- package/dist/ui/components/theme-toggle.d.ts.map +0 -1
- package/dist/ui/components/theme-toggle.js.map +0 -1
- package/dist/ui/components/tier-card.d.ts.map +0 -1
- package/dist/ui/components/tier-card.js.map +0 -1
- package/dist/ui/components/tv.d.ts.map +0 -1
- package/dist/ui/components/tv.js.map +0 -1
- package/dist/ui/components/typography/h1.d.ts.map +0 -1
- package/dist/ui/components/typography/h1.js.map +0 -1
- package/dist/ui/components/typography/h2.d.ts.map +0 -1
- package/dist/ui/components/typography/h2.js.map +0 -1
- package/dist/ui/components/typography/index.d.ts.map +0 -1
- package/dist/ui/components/typography/index.js.map +0 -1
- package/dist/ui/components/typography/legend.d.ts.map +0 -1
- package/dist/ui/components/typography/legend.js.map +0 -1
- package/dist/ui/components/typography/small.d.ts.map +0 -1
- package/dist/ui/components/typography/small.js.map +0 -1
- package/dist/ui/components/watchlist.d.ts.map +0 -1
- package/dist/ui/components/watchlist.js.map +0 -1
- package/dist/ui/footer.d.ts.map +0 -1
- package/dist/ui/footer.js.map +0 -1
- package/dist/ui/header.d.ts.map +0 -1
- package/dist/ui/header.js.map +0 -1
- package/dist/ui/layout-wrapper.d.ts.map +0 -1
- package/dist/ui/layout-wrapper.js.map +0 -1
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/color.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/poly.d.ts.map +0 -1
- package/dist/utils/poly.js.map +0 -1
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import { useEffect, useRef, useState } from
|
|
4
|
-
import * as THREE from
|
|
5
|
-
import { $gpuTier, useGpuTier } from
|
|
6
|
-
import { runRenderLoop } from
|
|
7
|
-
import { useSmoothControls } from
|
|
8
|
-
import { cn } from
|
|
9
|
-
import { BLEND_MODES } from
|
|
10
|
-
const vert =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
|
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
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { Glitch } from
|
|
4
|
-
import { Greys } from
|
|
5
|
-
import { Lens } from
|
|
6
|
-
import { Noise } from
|
|
7
|
-
import { Vignette } from
|
|
8
|
-
export { BLEND_MODES } from
|
|
9
|
-
export { Glitch } from
|
|
10
|
-
export { Greys } from
|
|
11
|
-
export { Lens } from
|
|
12
|
-
export { Noise } from
|
|
13
|
-
export { Vignette } from
|
|
14
|
-
export {
|
|
15
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useEffect } from
|
|
4
|
-
import { useSmoothControls } from
|
|
5
|
-
import { colorMix } from
|
|
6
|
-
import fillerBg from
|
|
7
|
-
import { BLEND_MODES } from
|
|
8
|
-
import { $lightMode, LENS_0, LENS_5I, toggleLens } from
|
|
9
|
-
const LAYER =
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|