use-scroll-animate 3.3.0 → 3.4.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 (42) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -0
  3. package/README_ja.md +1 -0
  4. package/README_zh.md +1 -0
  5. package/dist/chunks/{index-tags-Cz4iTBEK.cjs → index-tags-BKcHAxBK.cjs} +2 -1
  6. package/dist/chunks/{index-tags-Cz4iTBEK.cjs.map → index-tags-BKcHAxBK.cjs.map} +1 -1
  7. package/dist/chunks/{index-tags-Dc_Z4yAY.js → index-tags-qc6OWsJ8.js} +2 -1
  8. package/dist/chunks/{index-tags-Dc_Z4yAY.js.map → index-tags-qc6OWsJ8.js.map} +1 -1
  9. package/dist/components/jsx.d.cts +1 -0
  10. package/dist/components/jsx.d.ts +1 -0
  11. package/dist/components/lazy.cjs +2 -1
  12. package/dist/components/lazy.cjs.map +1 -1
  13. package/dist/components/lazy.d.cts +1 -0
  14. package/dist/components/lazy.d.ts +1 -0
  15. package/dist/components/lazy.js +2 -1
  16. package/dist/components/lazy.js.map +1 -1
  17. package/dist/components/react.cjs +1 -1
  18. package/dist/components/react.js +1 -1
  19. package/dist/components/vue.cjs +2 -1
  20. package/dist/components/vue.cjs.map +1 -1
  21. package/dist/components/vue.d.cts +27 -0
  22. package/dist/components/vue.d.ts +27 -0
  23. package/dist/components/vue.js +2 -1
  24. package/dist/components/vue.js.map +1 -1
  25. package/dist/components/webgl.cjs +277 -0
  26. package/dist/components/webgl.cjs.map +1 -0
  27. package/dist/components/webgl.css +3 -0
  28. package/dist/components/webgl.d.cts +114 -0
  29. package/dist/components/webgl.d.ts +114 -0
  30. package/dist/components/webgl.js +267 -0
  31. package/dist/components/webgl.js.map +1 -0
  32. package/dist/components.cjs +11 -1
  33. package/dist/components.cjs.map +1 -1
  34. package/dist/components.css +1 -0
  35. package/dist/components.d.cts +70 -2
  36. package/dist/components.d.ts +70 -2
  37. package/dist/components.js +5 -2
  38. package/dist/components.js.map +1 -1
  39. package/dist/components.umd.js +2 -2
  40. package/dist/components.umd.js.map +1 -1
  41. package/docs/components.md +11 -0
  42. package/package.json +13 -2
@@ -0,0 +1,277 @@
1
+ 'use strict';
2
+
3
+ var base = require('../chunks/base-CXx7jZ-o.cjs');
4
+
5
+ /** Minimal WebGL runner: one full-canvas quad, one fragment shader, optional image texture. */
6
+ const VERTEX = 'attribute vec2 p;varying vec2 v_uv;void main(){v_uv=p*.5+.5;gl_Position=vec4(p,0.,1.);}';
7
+ const HEAD = 'precision mediump float;varying vec2 v_uv;uniform float u_time;uniform vec2 u_resolution;uniform vec2 u_mouse;uniform float u_hover;uniform sampler2D u_tex;uniform vec4 u_ripples[4];\n';
8
+ /** Built-in fragment shaders (bodies; uniforms `u_time`, `u_resolution`, `u_mouse` 0–1, `u_hover` 0–1, `u_tex`, `u_ripples[4]` = x, y, age, strength). */
9
+ const SHADERS = {
10
+ gradient: 'void main(){vec2 u=v_uv;float t=u_time*.15;vec3 a=vec3(.39,.4,.95),b=vec3(.93,.29,.6),c=vec3(.13,.83,.93);float k=.5+.5*sin(u.x*3.+t*2.)*cos(u.y*2.-t);vec3 col=mix(mix(a,b,u.x+.2*sin(t)),c,k*.6);gl_FragColor=vec4(col,1.);}',
11
+ plasma: 'void main(){vec2 u=v_uv*4.;float t=u_time*.6;float v=sin(u.x+t)+sin(u.y+t*.7)+sin(u.x+u.y+t*.5)+sin(length(u-2.+vec2(sin(t),cos(t)))*2.);vec3 col=.5+.5*cos(v+vec3(0.,2.,4.));gl_FragColor=vec4(col,1.);}',
12
+ waves: 'void main(){vec2 u=v_uv;float t=u_time*.4;float w=0.;for(int i=0;i<4;i++){float f=float(i)+1.;w+=sin(u.x*6.*f+t*f)*.08/f;}float l=smoothstep(.0,.02,abs(u.y-.5-w));vec3 col=mix(vec3(.2,.5,1.),vec3(.04,.06,.15),l)+vec3(.1,.0,.2)*u.y;gl_FragColor=vec4(col,1.);}',
13
+ aurora: 'void main(){vec2 u=v_uv;float t=u_time*.2;float b=0.;for(int i=0;i<3;i++){float f=float(i);b+=.4/abs((u.y-.6+.15*sin(u.x*3.+t+f*1.7))*(8.+f*4.));}vec3 col=vec3(.02,.03,.08)+b*mix(vec3(.1,.9,.6),vec3(.6,.3,1.),u.x)*.35;gl_FragColor=vec4(col,1.);}',
14
+ distort: 'void main(){vec2 u=v_uv;vec2 d=u-u_mouse;float r=length(d);float k=u_hover*.08*exp(-r*r*18.);u-=normalize(d+1e-4)*k;float s=u_hover*.006;vec3 col=vec3(texture2D(u_tex,u+vec2(s,0.)).r,texture2D(u_tex,u).g,texture2D(u_tex,u-vec2(s,0.)).b);gl_FragColor=vec4(col,1.);}',
15
+ liquid: 'void main(){vec2 u=v_uv;vec2 o=vec2(0.);for(int i=0;i<4;i++){vec4 r=u_ripples[i];if(r.w>0.){float d=distance(u,r.xy);float w=sin(d*60.-r.z*12.)*exp(-d*6.)*exp(-r.z*1.6)*r.w*.02;o+=normalize(u-r.xy+1e-4)*w;}}o+=vec2(sin(u.y*10.+u_time),cos(u.x*10.+u_time))*.002*u_hover;gl_FragColor=texture2D(u_tex,u+o);}',
16
+ };
17
+ /** Full fragment source for a preset or custom body (adds the shared header). */
18
+ function fragmentSource(body) {
19
+ const src = SHADERS[body] || body;
20
+ return /precision\s+\w+\s+float/.test(src) ? src : HEAD + src;
21
+ }
22
+ /** `true` when the browser can create a WebGL context (cached). */
23
+ let support;
24
+ function supportsWebGL() {
25
+ if (support !== undefined)
26
+ return support;
27
+ try {
28
+ const c = typeof document !== 'undefined' ? document.createElement('canvas') : null;
29
+ support = !!(c && (c.getContext('webgl') || c.getContext('experimental-webgl')));
30
+ }
31
+ catch {
32
+ support = false;
33
+ }
34
+ return support;
35
+ }
36
+ /** Compile `frag` on a full-canvas quad, or `null` when WebGL / compilation is unavailable. */
37
+ function glQuad(canvas, frag) {
38
+ let gl = null;
39
+ try {
40
+ gl = (canvas.getContext('webgl', { premultipliedAlpha: false, antialias: false }) || canvas.getContext('experimental-webgl'));
41
+ }
42
+ catch {
43
+ gl = null;
44
+ }
45
+ if (!gl)
46
+ return null;
47
+ const g = gl;
48
+ const sh = (type, src) => {
49
+ const s = g.createShader(type);
50
+ g.shaderSource(s, src);
51
+ g.compileShader(s);
52
+ return g.getShaderParameter(s, g.COMPILE_STATUS) ? s : null;
53
+ };
54
+ const vs = sh(g.VERTEX_SHADER, VERTEX);
55
+ const fs = sh(g.FRAGMENT_SHADER, fragmentSource(frag));
56
+ if (!vs || !fs)
57
+ return null;
58
+ const prog = g.createProgram();
59
+ g.attachShader(prog, vs);
60
+ g.attachShader(prog, fs);
61
+ g.linkProgram(prog);
62
+ if (!g.getProgramParameter(prog, g.LINK_STATUS))
63
+ return null;
64
+ g.useProgram(prog);
65
+ const buf = g.createBuffer();
66
+ g.bindBuffer(g.ARRAY_BUFFER, buf);
67
+ g.bufferData(g.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), g.STATIC_DRAW);
68
+ const loc = g.getAttribLocation(prog, 'p');
69
+ g.enableVertexAttribArray(loc);
70
+ g.vertexAttribPointer(loc, 2, g.FLOAT, false, 0, 0);
71
+ const U = (n) => g.getUniformLocation(prog, n);
72
+ const uT = U('u_time'), uR = U('u_resolution'), uM = U('u_mouse'), uH = U('u_hover'), uRp = U('u_ripples');
73
+ let tex = null;
74
+ const quad = {
75
+ resize() {
76
+ const dpr = Math.min(2, (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1);
77
+ const w = Math.max(1, Math.round((canvas.clientWidth || 300) * dpr));
78
+ const h = Math.max(1, Math.round((canvas.clientHeight || 150) * dpr));
79
+ if (canvas.width !== w || canvas.height !== h)
80
+ ((canvas.width = w), (canvas.height = h));
81
+ g.viewport(0, 0, w, h);
82
+ },
83
+ texture(img) {
84
+ tex = tex || g.createTexture();
85
+ g.bindTexture(g.TEXTURE_2D, tex);
86
+ g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL, true);
87
+ g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_S, g.CLAMP_TO_EDGE);
88
+ g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_T, g.CLAMP_TO_EDGE);
89
+ g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MIN_FILTER, g.LINEAR);
90
+ g.texImage2D(g.TEXTURE_2D, 0, g.RGBA, g.RGBA, g.UNSIGNED_BYTE, img);
91
+ },
92
+ render(u) {
93
+ g.uniform1f(uT, u.time ?? 0);
94
+ g.uniform2f(uR, canvas.width, canvas.height);
95
+ g.uniform2f(uM, ...(u.mouse ?? [0.5, 0.5]));
96
+ g.uniform1f(uH, u.hover ?? 0);
97
+ if (uRp)
98
+ g.uniform4fv(uRp, new Float32Array((u.ripples ?? []).concat(Array(16).fill(0)).slice(0, 16)));
99
+ g.drawArrays(g.TRIANGLES, 0, 6);
100
+ },
101
+ dispose() {
102
+ g.deleteProgram(prog);
103
+ g.deleteBuffer(buf);
104
+ if (tex)
105
+ g.deleteTexture(tex);
106
+ g.getExtension('WEBGL_lose_context')?.loseContext();
107
+ },
108
+ };
109
+ quad.resize();
110
+ return quad;
111
+ }
112
+
113
+ var css = "usa-shader,usa-distort,usa-liquid{display:block;position:relative;isolation:isolate;overflow:hidden}usa-shader{background:linear-gradient(120deg,#6366f1,#ec4899 50%,#22d3ee)}usa-shader>canvas.usa-gl{position:absolute;inset:0;width:100%;height:100%;z-index:-1;display:block}usa-distort>canvas.usa-gl,usa-liquid>canvas.usa-gl{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}usa-distort>img,usa-liquid>img{display:block;width:100%;height:auto}usa-distort[data-active]>img,usa-liquid[data-active]>img{visibility:hidden}usa-distort[data-fallback]>img{transition:transform 0.6s cubic-bezier(0.22,1,0.36,1),filter 0.6s}usa-distort[data-fallback]:hover>img{transform:scale(1.04);filter:saturate(1.2)}@media (prefers-reduced-motion:reduce){usa-distort[data-fallback]:hover>img{transform:none}}";
114
+
115
+ function make(kind) {
116
+ return (Base) => class extends Base {
117
+ constructor() {
118
+ super(...arguments);
119
+ this._q = null;
120
+ this._c = null;
121
+ this._id = 0;
122
+ this._mouse = [0.5, 0.5];
123
+ this._hover = 0;
124
+ this._hoverTo = 0;
125
+ this._ripples = [];
126
+ }
127
+ static get observedAttributes() {
128
+ return kind === 'shader' ? ['preset', 'speed'] : ['src'];
129
+ }
130
+ get active() {
131
+ return !!this._q;
132
+ }
133
+ fallback(reason) {
134
+ this.setAttribute('data-fallback', reason);
135
+ this._c?.remove();
136
+ this._c = null;
137
+ this._q?.dispose();
138
+ this._q = null;
139
+ }
140
+ frame() {
141
+ const q = this._q;
142
+ if (!q)
143
+ return;
144
+ this._hover += (this._hoverTo - this._hover) * 0.12;
145
+ const t = base.now();
146
+ this._ripples = this._ripples.filter((r) => t - r.t < 2500);
147
+ q.render({
148
+ time: (t / 1000) * this.num('speed', 1),
149
+ mouse: this._mouse,
150
+ hover: this._hover,
151
+ ripples: this._ripples.flatMap((r) => [r.x, r.y, (t - r.t) / 1000, this.num('strength', 1)]),
152
+ });
153
+ }
154
+ mount() {
155
+ this.removeAttribute('data-fallback');
156
+ const custom = this.querySelector('script[type="x-shader/x-fragment"]');
157
+ const frag = kind === 'shader' ? custom?.textContent || this.str('preset', 'gradient') : kind;
158
+ const img = kind === 'shader' ? null : this.querySelector('img');
159
+ if (kind !== 'shader' && !img)
160
+ return this.fallback('no-image');
161
+ const c = (this._c = document.createElement('canvas'));
162
+ c.setAttribute('aria-hidden', 'true');
163
+ c.className = 'usa-gl';
164
+ this.prepend(c);
165
+ const q = (this._q = glQuad(c, frag));
166
+ if (!q)
167
+ return this.fallback('webgl');
168
+ this.onCleanup(() => this.fallback('off'));
169
+ const start = () => {
170
+ if (!img)
171
+ return true;
172
+ try {
173
+ q.texture(img);
174
+ return true;
175
+ }
176
+ catch {
177
+ this.fallback('image');
178
+ return false;
179
+ }
180
+ };
181
+ const draw = () => {
182
+ q.resize();
183
+ this.frame();
184
+ };
185
+ if (img && !(img.complete && img.naturalWidth)) {
186
+ if (!img.crossOrigin && /^https?:/.test(img.src) && !img.src.startsWith(location.origin))
187
+ img.crossOrigin = 'anonymous';
188
+ this.listen(img, 'load', () => start() && draw());
189
+ this.listen(img, 'error', () => this.fallback('image'));
190
+ }
191
+ else if (!start())
192
+ return;
193
+ this.setAttribute('data-active', '');
194
+ this.onCleanup(() => this.removeAttribute('data-active'));
195
+ draw();
196
+ if (kind !== 'shader') {
197
+ const pos = (e) => {
198
+ const r = this.getBoundingClientRect();
199
+ this._mouse = [base.clamp((e.clientX - r.left) / (r.width || 1), 0, 1), base.clamp(1 - (e.clientY - r.top) / (r.height || 1), 0, 1)];
200
+ };
201
+ this.listen(this, 'pointermove', pos);
202
+ this.listen(this, 'pointerenter', (e) => (pos(e), (this._hoverTo = 1)));
203
+ this.listen(this, 'pointerleave', () => (this._hoverTo = 0));
204
+ if (kind === 'liquid')
205
+ this.listen(this, 'pointerdown', (e) => {
206
+ pos(e);
207
+ this._ripples = [...this._ripples.slice(-3), { x: this._mouse[0], y: this._mouse[1], t: base.now() }];
208
+ });
209
+ }
210
+ if (this.reduced)
211
+ return; // one static frame, no loop
212
+ let visible = false;
213
+ const loop = () => {
214
+ this.frame();
215
+ this._id = base.raf(loop);
216
+ };
217
+ const sync = () => {
218
+ base.caf(this._id);
219
+ this._id = 0;
220
+ if (visible && !document.hidden)
221
+ this._id = base.raf(loop);
222
+ };
223
+ this.inView((v) => ((visible = v), sync()));
224
+ this.listen(document, 'visibilitychange', sync);
225
+ this.listen(window, 'resize', () => q.resize(), { passive: true });
226
+ this.onCleanup(() => base.caf(this._id));
227
+ }
228
+ };
229
+ }
230
+ /**
231
+ * `<usa-shader>` — GPU shader background behind its content. `preset`
232
+ * (`gradient` · `plasma` · `waves` · `aurora`) or your own fragment shader in
233
+ * `<script type="x-shader/x-fragment">` (uniforms `u_time`, `u_resolution`,
234
+ * `u_mouse`, `v_uv`); `speed`. Without WebGL: the element's CSS background.
235
+ */
236
+ function defineShader(tag = 'usa-shader') {
237
+ return base.defineElement(tag, make('shader'), { id: 'webgl', text: css });
238
+ }
239
+ /**
240
+ * `<usa-distort>` — hover distortion + RGB split on the `<img>` inside,
241
+ * following the pointer. Without WebGL / CORS: a gentle CSS zoom.
242
+ */
243
+ function defineDistort(tag = 'usa-distort') {
244
+ return base.defineElement(tag, make('distort'), { id: 'webgl', text: css });
245
+ }
246
+ /**
247
+ * `<usa-liquid>` — liquid image: clicks / taps send ripples through the
248
+ * `<img>` inside, hover adds a gentle wobble; `strength`. Fallback: plain image.
249
+ */
250
+ function defineLiquid(tag = 'usa-liquid') {
251
+ return base.defineElement(tag, make('liquid'), { id: 'webgl', text: css });
252
+ }
253
+
254
+ /**
255
+ * use-scroll-animate/components/webgl — lightweight canvas / WebGL (v3.4).
256
+ * `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image
257
+ * distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner
258
+ * (`glQuad()`), with graceful fallbacks when WebGL is unavailable.
259
+ */
260
+ /** Register every component of this category under its default tag. */
261
+ function defineWebglComponents() {
262
+ defineShader();
263
+ defineDistort();
264
+ defineLiquid();
265
+ }
266
+
267
+ exports.configureComponents = base.configureComponents;
268
+ exports.prefersReducedMotion = base.prefersReducedMotion;
269
+ exports.SHADERS = SHADERS;
270
+ exports.defineDistort = defineDistort;
271
+ exports.defineLiquid = defineLiquid;
272
+ exports.defineShader = defineShader;
273
+ exports.defineWebglComponents = defineWebglComponents;
274
+ exports.fragmentSource = fragmentSource;
275
+ exports.glQuad = glQuad;
276
+ exports.supportsWebGL = supportsWebGL;
277
+ //# sourceMappingURL=webgl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl.cjs","sources":["../../src/components/webgl/gl.ts","../../src/components/webgl/elements.ts","../../src/components/webgl/index.ts"],"sourcesContent":["/** Minimal WebGL runner: one full-canvas quad, one fragment shader, optional image texture. */\n\nexport const VERTEX = 'attribute vec2 p;varying vec2 v_uv;void main(){v_uv=p*.5+.5;gl_Position=vec4(p,0.,1.);}';\nconst HEAD = 'precision mediump float;varying vec2 v_uv;uniform float u_time;uniform vec2 u_resolution;uniform vec2 u_mouse;uniform float u_hover;uniform sampler2D u_tex;uniform vec4 u_ripples[4];\\n';\n\n/** Built-in fragment shaders (bodies; uniforms `u_time`, `u_resolution`, `u_mouse` 0–1, `u_hover` 0–1, `u_tex`, `u_ripples[4]` = x, y, age, strength). */\nexport const SHADERS: Record<string, string> = {\n gradient: 'void main(){vec2 u=v_uv;float t=u_time*.15;vec3 a=vec3(.39,.4,.95),b=vec3(.93,.29,.6),c=vec3(.13,.83,.93);float k=.5+.5*sin(u.x*3.+t*2.)*cos(u.y*2.-t);vec3 col=mix(mix(a,b,u.x+.2*sin(t)),c,k*.6);gl_FragColor=vec4(col,1.);}',\n plasma: 'void main(){vec2 u=v_uv*4.;float t=u_time*.6;float v=sin(u.x+t)+sin(u.y+t*.7)+sin(u.x+u.y+t*.5)+sin(length(u-2.+vec2(sin(t),cos(t)))*2.);vec3 col=.5+.5*cos(v+vec3(0.,2.,4.));gl_FragColor=vec4(col,1.);}',\n waves: 'void main(){vec2 u=v_uv;float t=u_time*.4;float w=0.;for(int i=0;i<4;i++){float f=float(i)+1.;w+=sin(u.x*6.*f+t*f)*.08/f;}float l=smoothstep(.0,.02,abs(u.y-.5-w));vec3 col=mix(vec3(.2,.5,1.),vec3(.04,.06,.15),l)+vec3(.1,.0,.2)*u.y;gl_FragColor=vec4(col,1.);}',\n aurora: 'void main(){vec2 u=v_uv;float t=u_time*.2;float b=0.;for(int i=0;i<3;i++){float f=float(i);b+=.4/abs((u.y-.6+.15*sin(u.x*3.+t+f*1.7))*(8.+f*4.));}vec3 col=vec3(.02,.03,.08)+b*mix(vec3(.1,.9,.6),vec3(.6,.3,1.),u.x)*.35;gl_FragColor=vec4(col,1.);}',\n distort: 'void main(){vec2 u=v_uv;vec2 d=u-u_mouse;float r=length(d);float k=u_hover*.08*exp(-r*r*18.);u-=normalize(d+1e-4)*k;float s=u_hover*.006;vec3 col=vec3(texture2D(u_tex,u+vec2(s,0.)).r,texture2D(u_tex,u).g,texture2D(u_tex,u-vec2(s,0.)).b);gl_FragColor=vec4(col,1.);}',\n liquid: 'void main(){vec2 u=v_uv;vec2 o=vec2(0.);for(int i=0;i<4;i++){vec4 r=u_ripples[i];if(r.w>0.){float d=distance(u,r.xy);float w=sin(d*60.-r.z*12.)*exp(-d*6.)*exp(-r.z*1.6)*r.w*.02;o+=normalize(u-r.xy+1e-4)*w;}}o+=vec2(sin(u.y*10.+u_time),cos(u.x*10.+u_time))*.002*u_hover;gl_FragColor=texture2D(u_tex,u+o);}',\n};\n\n/** Full fragment source for a preset or custom body (adds the shared header). */\nexport function fragmentSource(body: string): string {\n const src = SHADERS[body] || body;\n return /precision\\s+\\w+\\s+float/.test(src) ? src : HEAD + src;\n}\n\n/** `true` when the browser can create a WebGL context (cached). */\nlet support: boolean | undefined;\nexport function supportsWebGL(): boolean {\n if (support !== undefined) return support;\n try {\n const c = typeof document !== 'undefined' ? document.createElement('canvas') : null;\n support = !!(c && (c.getContext('webgl') || c.getContext('experimental-webgl')));\n } catch {\n support = false;\n }\n return support;\n}\n\nexport interface GLQuad {\n /** Draw a frame with these uniform values. */\n render(u: { time?: number; mouse?: [number, number]; hover?: number; ripples?: number[] }): void;\n /** Resize the drawing buffer to the canvas' CSS size × DPR (≤ 2). */\n resize(): void;\n /** Upload an image as `u_tex`. */\n texture(img: TexImageSource): void;\n dispose(): void;\n}\n\n/** Compile `frag` on a full-canvas quad, or `null` when WebGL / compilation is unavailable. */\nexport function glQuad(canvas: HTMLCanvasElement, frag: string): GLQuad | null {\n let gl: WebGLRenderingContext | null = null;\n try {\n gl = (canvas.getContext('webgl', { premultipliedAlpha: false, antialias: false }) || canvas.getContext('experimental-webgl')) as WebGLRenderingContext | null;\n } catch {\n gl = null;\n }\n if (!gl) return null;\n const g = gl;\n const sh = (type: number, src: string) => {\n const s = g.createShader(type)!;\n g.shaderSource(s, src);\n g.compileShader(s);\n return g.getShaderParameter(s, g.COMPILE_STATUS) ? s : null;\n };\n const vs = sh(g.VERTEX_SHADER, VERTEX);\n const fs = sh(g.FRAGMENT_SHADER, fragmentSource(frag));\n if (!vs || !fs) return null;\n const prog = g.createProgram()!;\n g.attachShader(prog, vs);\n g.attachShader(prog, fs);\n g.linkProgram(prog);\n if (!g.getProgramParameter(prog, g.LINK_STATUS)) return null;\n g.useProgram(prog);\n const buf = g.createBuffer();\n g.bindBuffer(g.ARRAY_BUFFER, buf);\n g.bufferData(g.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), g.STATIC_DRAW);\n const loc = g.getAttribLocation(prog, 'p');\n g.enableVertexAttribArray(loc);\n g.vertexAttribPointer(loc, 2, g.FLOAT, false, 0, 0);\n const U = (n: string) => g.getUniformLocation(prog, n);\n const uT = U('u_time'), uR = U('u_resolution'), uM = U('u_mouse'), uH = U('u_hover'), uRp = U('u_ripples');\n let tex: WebGLTexture | null = null;\n const quad: GLQuad = {\n resize() {\n const dpr = Math.min(2, (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1);\n const w = Math.max(1, Math.round((canvas.clientWidth || 300) * dpr));\n const h = Math.max(1, Math.round((canvas.clientHeight || 150) * dpr));\n if (canvas.width !== w || canvas.height !== h) ((canvas.width = w), (canvas.height = h));\n g.viewport(0, 0, w, h);\n },\n texture(img) {\n tex = tex || g.createTexture();\n g.bindTexture(g.TEXTURE_2D, tex);\n g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL, true);\n g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_S, g.CLAMP_TO_EDGE);\n g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_T, g.CLAMP_TO_EDGE);\n g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MIN_FILTER, g.LINEAR);\n g.texImage2D(g.TEXTURE_2D, 0, g.RGBA, g.RGBA, g.UNSIGNED_BYTE, img);\n },\n render(u) {\n g.uniform1f(uT, u.time ?? 0);\n g.uniform2f(uR, canvas.width, canvas.height);\n g.uniform2f(uM, ...(u.mouse ?? [0.5, 0.5]));\n g.uniform1f(uH, u.hover ?? 0);\n if (uRp) g.uniform4fv(uRp, new Float32Array((u.ripples ?? []).concat(Array(16).fill(0)).slice(0, 16)));\n g.drawArrays(g.TRIANGLES, 0, 6);\n },\n dispose() {\n g.deleteProgram(prog);\n g.deleteBuffer(buf);\n if (tex) g.deleteTexture(tex);\n g.getExtension('WEBGL_lose_context')?.loseContext();\n },\n };\n quad.resize();\n return quad;\n}\n","import { defineElement, raf, caf, now, clamp, type UsaElement, getBase } from '../base';\n\ntype BaseCtor = ReturnType<typeof getBase>;\nimport { glQuad, type GLQuad } from './gl';\nimport css from './webgl.css?raw';\n\n/**\n * Shared shell for the WebGL elements: a canvas over (or behind) the\n * content that renders only while visible and the tab is shown, a DPR cap\n * of 2, and a graceful fallback (`data-fallback`) when WebGL, the shader\n * or the image (CORS) is unavailable — the original content / CSS stays.\n */\nexport interface UsaGLElement extends UsaElement {\n /** `true` once WebGL rendering is active (otherwise the CSS fallback shows). */\n readonly active: boolean;\n}\n\ntype Kind = 'shader' | 'distort' | 'liquid';\n\nfunction make(kind: Kind) {\n return (Base: BaseCtor): CustomElementConstructor =>\n class extends Base {\n static get observedAttributes(): string[] {\n return kind === 'shader' ? ['preset', 'speed'] : ['src'];\n }\n private _q: GLQuad | null = null;\n private _c: HTMLCanvasElement | null = null;\n private _id = 0;\n private _mouse: [number, number] = [0.5, 0.5];\n private _hover = 0;\n private _hoverTo = 0;\n private _ripples: { x: number; y: number; t: number }[] = [];\n\n get active(): boolean {\n return !!this._q;\n }\n\n private fallback(reason: string): void {\n this.setAttribute('data-fallback', reason);\n this._c?.remove();\n this._c = null;\n this._q?.dispose();\n this._q = null;\n }\n\n private frame(): void {\n const q = this._q;\n if (!q) return;\n this._hover += (this._hoverTo - this._hover) * 0.12;\n const t = now();\n this._ripples = this._ripples.filter((r) => t - r.t < 2500);\n q.render({\n time: (t / 1000) * this.num('speed', 1),\n mouse: this._mouse,\n hover: this._hover,\n ripples: this._ripples.flatMap((r) => [r.x, r.y, (t - r.t) / 1000, this.num('strength', 1)]),\n });\n }\n\n mount(): void {\n this.removeAttribute('data-fallback');\n const custom = this.querySelector('script[type=\"x-shader/x-fragment\"]');\n const frag = kind === 'shader' ? custom?.textContent || this.str('preset', 'gradient') : kind;\n const img = kind === 'shader' ? null : (this.querySelector('img') as HTMLImageElement | null);\n if (kind !== 'shader' && !img) return this.fallback('no-image');\n const c = (this._c = document.createElement('canvas'));\n c.setAttribute('aria-hidden', 'true');\n c.className = 'usa-gl';\n this.prepend(c);\n const q = (this._q = glQuad(c, frag));\n if (!q) return this.fallback('webgl');\n this.onCleanup(() => this.fallback('off'));\n const start = () => {\n if (!img) return true;\n try {\n q.texture(img);\n return true;\n } catch {\n this.fallback('image');\n return false;\n }\n };\n const draw = () => {\n q.resize();\n this.frame();\n };\n if (img && !(img.complete && img.naturalWidth)) {\n if (!img.crossOrigin && /^https?:/.test(img.src) && !img.src.startsWith(location.origin)) img.crossOrigin = 'anonymous';\n this.listen(img, 'load', () => start() && draw());\n this.listen(img, 'error', () => this.fallback('image'));\n } else if (!start()) return;\n this.setAttribute('data-active', '');\n this.onCleanup(() => this.removeAttribute('data-active'));\n draw();\n if (kind !== 'shader') {\n const pos = (e: PointerEvent) => {\n const r = this.getBoundingClientRect();\n this._mouse = [clamp((e.clientX - r.left) / (r.width || 1), 0, 1), clamp(1 - (e.clientY - r.top) / (r.height || 1), 0, 1)];\n };\n this.listen(this, 'pointermove', pos);\n this.listen(this, 'pointerenter', (e: PointerEvent) => (pos(e), (this._hoverTo = 1)));\n this.listen(this, 'pointerleave', () => (this._hoverTo = 0));\n if (kind === 'liquid')\n this.listen(this, 'pointerdown', (e: PointerEvent) => {\n pos(e);\n this._ripples = [...this._ripples.slice(-3), { x: this._mouse[0], y: this._mouse[1], t: now() }];\n });\n }\n if (this.reduced) return; // one static frame, no loop\n let visible = false;\n const loop = () => {\n this.frame();\n this._id = raf(loop);\n };\n const sync = () => {\n caf(this._id);\n this._id = 0;\n if (visible && !document.hidden) this._id = raf(loop);\n };\n this.inView((v: boolean) => ((visible = v), sync()));\n this.listen(document, 'visibilitychange', sync);\n this.listen(window, 'resize', () => q.resize(), { passive: true });\n this.onCleanup(() => caf(this._id));\n }\n };\n}\n\n/**\n * `<usa-shader>` — GPU shader background behind its content. `preset`\n * (`gradient` · `plasma` · `waves` · `aurora`) or your own fragment shader in\n * `<script type=\"x-shader/x-fragment\">` (uniforms `u_time`, `u_resolution`,\n * `u_mouse`, `v_uv`); `speed`. Without WebGL: the element's CSS background.\n */\nexport function defineShader(tag = 'usa-shader'): CustomElementConstructor | undefined {\n return defineElement(tag, make('shader'), { id: 'webgl', text: css });\n}\n\n/**\n * `<usa-distort>` — hover distortion + RGB split on the `<img>` inside,\n * following the pointer. Without WebGL / CORS: a gentle CSS zoom.\n */\nexport function defineDistort(tag = 'usa-distort'): CustomElementConstructor | undefined {\n return defineElement(tag, make('distort'), { id: 'webgl', text: css });\n}\n\n/**\n * `<usa-liquid>` — liquid image: clicks / taps send ripples through the\n * `<img>` inside, hover adds a gentle wobble; `strength`. Fallback: plain image.\n */\nexport function defineLiquid(tag = 'usa-liquid'): CustomElementConstructor | undefined {\n return defineElement(tag, make('liquid'), { id: 'webgl', text: css });\n}\n","/**\n * use-scroll-animate/components/webgl — lightweight canvas / WebGL (v3.4).\n * `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image\n * distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner\n * (`glQuad()`), with graceful fallbacks when WebGL is unavailable.\n */\nimport { defineShader, defineDistort, defineLiquid, type UsaGLElement } from './elements';\n\nexport { defineShader, defineDistort, defineLiquid };\nexport { glQuad, supportsWebGL, fragmentSource, SHADERS } from './gl';\nexport type { GLQuad } from './gl';\nexport type { UsaGLElement };\nexport { configureComponents, prefersReducedMotion } from '../base';\nexport type { ComponentsConfig, UsaElement } from '../base';\n\n/** Register every component of this category under its default tag. */\nexport function defineWebglComponents(): void {\n defineShader();\n defineDistort();\n defineLiquid();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-shader': UsaGLElement;\n 'usa-distort': UsaGLElement;\n 'usa-liquid': UsaGLElement;\n }\n}\n"],"names":["now","clamp","raf","caf","defineElement"],"mappings":";;;;AAAA;AAEO,MAAM,MAAM,GAAG,yFAAyF;AAC/G,MAAM,IAAI,GAAG,0LAA0L;AAEvM;AACO,MAAM,OAAO,GAA2B;AAC7C,IAAA,QAAQ,EAAE,gOAAgO;AAC1O,IAAA,MAAM,EAAE,2MAA2M;AACnN,IAAA,KAAK,EAAE,oQAAoQ;AAC3Q,IAAA,MAAM,EAAE,uPAAuP;AAC/P,IAAA,OAAO,EAAE,0QAA0Q;AACnR,IAAA,MAAM,EAAE,kTAAkT;;AAG5T;AACM,SAAU,cAAc,CAAC,IAAY,EAAA;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI;AACjC,IAAA,OAAO,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG;AAC/D;AAEA;AACA,IAAI,OAA4B;SAChB,aAAa,GAAA;IAC3B,IAAI,OAAO,KAAK,SAAS;AAAE,QAAA,OAAO,OAAO;AACzC,IAAA,IAAI;AACF,QAAA,MAAM,CAAC,GAAG,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,IAAI;QACnF,OAAO,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClF;AAAE,IAAA,MAAM;QACN,OAAO,GAAG,KAAK;IACjB;AACA,I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AAG,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACvE;AAEA;;;AAGG;AACG,SAAU,aAAa,CAAC,GAAG,GAAG,aAAa,EAAA;AAC/C,IAAA,OAAOA,kBAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACxE;AAEA;;;AAGG;AACG,SAAU,YAAY,CAAC,GAAG,GAAG,YAAY,EAAA;AAC7C,IAAA,OAAOA,kBAAa,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACvE;;ACvJA;;;;;AAKG;AAUH;SACgB,qBAAqB,GAAA;AACnC,IAAA,YAAY,EAAE;AACd,IAAA,aAAa,EAAE;AACf,IAAA,YAAY,EAAE;AAChB;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ /* use-scroll-animate/components/webgl */
2
+ .usa-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
3
+ usa-shader,usa-distort,usa-liquid{display:block;position:relative;isolation:isolate;overflow:hidden}usa-shader{background:linear-gradient(120deg,#6366f1,#ec4899 50%,#22d3ee)}usa-shader>canvas.usa-gl{position:absolute;inset:0;width:100%;height:100%;z-index:-1;display:block}usa-distort>canvas.usa-gl,usa-liquid>canvas.usa-gl{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}usa-distort>img,usa-liquid>img{display:block;width:100%;height:auto}usa-distort[data-active]>img,usa-liquid[data-active]>img{visibility:hidden}usa-distort[data-fallback]>img{transition:transform 0.6s cubic-bezier(0.22,1,0.36,1),filter 0.6s}usa-distort[data-fallback]:hover>img{transform:scale(1.04);filter:saturate(1.2)}@media (prefers-reduced-motion:reduce){usa-distort[data-fallback]:hover>img{transform:none}}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.
3
+ *
4
+ * Everything here is lazy: nothing touches `window`, `document`,
5
+ * `HTMLElement` or `matchMedia` at import time, so the components can be
6
+ * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload
7
+ * scripts. Classes are created the first time a `define*()` function runs.
8
+ */
9
+ interface ComponentsConfig {
10
+ /**
11
+ * Inject each component's CSS when it is defined (default `true`). Uses a
12
+ * constructable stylesheet (`document.adoptedStyleSheets`, which a strict
13
+ * `style-src` CSP does not block) and falls back to a `<style>` tag. Set
14
+ * to `false` when you load `use-scroll-animate/components.css` yourself.
15
+ */
16
+ injectStyles?: boolean;
17
+ /**
18
+ * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always
19
+ * uses the reduced variants (e.g. a kiosk / battery-saver mode);
20
+ * `'no-preference'` ignores the OS setting (only for demos — respect your users).
21
+ */
22
+ reducedMotion?: 'user' | 'reduce' | 'no-preference';
23
+ /**
24
+ * Global motion intensity (v2.7): `'off'` (same as reduced motion),
25
+ * `'low'` (shorter, calmer), `'normal'` (default) or `'high'`. Scales every
26
+ * component animation's duration and sets `--usa-motion` (0 / 0.6 / 1 /
27
+ * 1.25) on `<html>` for your own CSS. See `setMotionIntensity()`.
28
+ */
29
+ motionIntensity?: MotionIntensity;
30
+ }
31
+ type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
32
+ /** Change global component settings (call before `define*()` for `injectStyles`). */
33
+ declare function configureComponents(options: ComponentsConfig): void;
34
+ /** `true` when animations should be reduced (OS setting or `configureComponents`). */
35
+ declare function prefersReducedMotion(): boolean;
36
+ /**
37
+ * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
38
+ * bag that is emptied on disconnect, and motion helpers that degrade to the
39
+ * final state without WAAPI or under reduced motion.
40
+ */
41
+ interface UsaElement extends HTMLElement {
42
+ /** `true` while reduced motion applies to this element. */
43
+ readonly reduced: boolean;
44
+ }
45
+
46
+ /**
47
+ * Shared shell for the WebGL elements: a canvas over (or behind) the
48
+ * content that renders only while visible and the tab is shown, a DPR cap
49
+ * of 2, and a graceful fallback (`data-fallback`) when WebGL, the shader
50
+ * or the image (CORS) is unavailable — the original content / CSS stays.
51
+ */
52
+ interface UsaGLElement extends UsaElement {
53
+ /** `true` once WebGL rendering is active (otherwise the CSS fallback shows). */
54
+ readonly active: boolean;
55
+ }
56
+ /**
57
+ * `<usa-shader>` — GPU shader background behind its content. `preset`
58
+ * (`gradient` · `plasma` · `waves` · `aurora`) or your own fragment shader in
59
+ * `<script type="x-shader/x-fragment">` (uniforms `u_time`, `u_resolution`,
60
+ * `u_mouse`, `v_uv`); `speed`. Without WebGL: the element's CSS background.
61
+ */
62
+ declare function defineShader(tag?: string): CustomElementConstructor | undefined;
63
+ /**
64
+ * `<usa-distort>` — hover distortion + RGB split on the `<img>` inside,
65
+ * following the pointer. Without WebGL / CORS: a gentle CSS zoom.
66
+ */
67
+ declare function defineDistort(tag?: string): CustomElementConstructor | undefined;
68
+ /**
69
+ * `<usa-liquid>` — liquid image: clicks / taps send ripples through the
70
+ * `<img>` inside, hover adds a gentle wobble; `strength`. Fallback: plain image.
71
+ */
72
+ declare function defineLiquid(tag?: string): CustomElementConstructor | undefined;
73
+
74
+ /** Built-in fragment shaders (bodies; uniforms `u_time`, `u_resolution`, `u_mouse` 0–1, `u_hover` 0–1, `u_tex`, `u_ripples[4]` = x, y, age, strength). */
75
+ declare const SHADERS: Record<string, string>;
76
+ /** Full fragment source for a preset or custom body (adds the shared header). */
77
+ declare function fragmentSource(body: string): string;
78
+ declare function supportsWebGL(): boolean;
79
+ interface GLQuad {
80
+ /** Draw a frame with these uniform values. */
81
+ render(u: {
82
+ time?: number;
83
+ mouse?: [number, number];
84
+ hover?: number;
85
+ ripples?: number[];
86
+ }): void;
87
+ /** Resize the drawing buffer to the canvas' CSS size × DPR (≤ 2). */
88
+ resize(): void;
89
+ /** Upload an image as `u_tex`. */
90
+ texture(img: TexImageSource): void;
91
+ dispose(): void;
92
+ }
93
+ /** Compile `frag` on a full-canvas quad, or `null` when WebGL / compilation is unavailable. */
94
+ declare function glQuad(canvas: HTMLCanvasElement, frag: string): GLQuad | null;
95
+
96
+ /**
97
+ * use-scroll-animate/components/webgl — lightweight canvas / WebGL (v3.4).
98
+ * `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image
99
+ * distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner
100
+ * (`glQuad()`), with graceful fallbacks when WebGL is unavailable.
101
+ */
102
+
103
+ /** Register every component of this category under its default tag. */
104
+ declare function defineWebglComponents(): void;
105
+ declare global {
106
+ interface HTMLElementTagNameMap {
107
+ 'usa-shader': UsaGLElement;
108
+ 'usa-distort': UsaGLElement;
109
+ 'usa-liquid': UsaGLElement;
110
+ }
111
+ }
112
+
113
+ export { SHADERS, configureComponents, defineDistort, defineLiquid, defineShader, defineWebglComponents, fragmentSource, glQuad, prefersReducedMotion, supportsWebGL };
114
+ export type { ComponentsConfig, GLQuad, UsaElement, UsaGLElement };
@@ -0,0 +1,114 @@
1
+ /**
2
+ * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.
3
+ *
4
+ * Everything here is lazy: nothing touches `window`, `document`,
5
+ * `HTMLElement` or `matchMedia` at import time, so the components can be
6
+ * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload
7
+ * scripts. Classes are created the first time a `define*()` function runs.
8
+ */
9
+ interface ComponentsConfig {
10
+ /**
11
+ * Inject each component's CSS when it is defined (default `true`). Uses a
12
+ * constructable stylesheet (`document.adoptedStyleSheets`, which a strict
13
+ * `style-src` CSP does not block) and falls back to a `<style>` tag. Set
14
+ * to `false` when you load `use-scroll-animate/components.css` yourself.
15
+ */
16
+ injectStyles?: boolean;
17
+ /**
18
+ * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always
19
+ * uses the reduced variants (e.g. a kiosk / battery-saver mode);
20
+ * `'no-preference'` ignores the OS setting (only for demos — respect your users).
21
+ */
22
+ reducedMotion?: 'user' | 'reduce' | 'no-preference';
23
+ /**
24
+ * Global motion intensity (v2.7): `'off'` (same as reduced motion),
25
+ * `'low'` (shorter, calmer), `'normal'` (default) or `'high'`. Scales every
26
+ * component animation's duration and sets `--usa-motion` (0 / 0.6 / 1 /
27
+ * 1.25) on `<html>` for your own CSS. See `setMotionIntensity()`.
28
+ */
29
+ motionIntensity?: MotionIntensity;
30
+ }
31
+ type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
32
+ /** Change global component settings (call before `define*()` for `injectStyles`). */
33
+ declare function configureComponents(options: ComponentsConfig): void;
34
+ /** `true` when animations should be reduced (OS setting or `configureComponents`). */
35
+ declare function prefersReducedMotion(): boolean;
36
+ /**
37
+ * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
38
+ * bag that is emptied on disconnect, and motion helpers that degrade to the
39
+ * final state without WAAPI or under reduced motion.
40
+ */
41
+ interface UsaElement extends HTMLElement {
42
+ /** `true` while reduced motion applies to this element. */
43
+ readonly reduced: boolean;
44
+ }
45
+
46
+ /**
47
+ * Shared shell for the WebGL elements: a canvas over (or behind) the
48
+ * content that renders only while visible and the tab is shown, a DPR cap
49
+ * of 2, and a graceful fallback (`data-fallback`) when WebGL, the shader
50
+ * or the image (CORS) is unavailable — the original content / CSS stays.
51
+ */
52
+ interface UsaGLElement extends UsaElement {
53
+ /** `true` once WebGL rendering is active (otherwise the CSS fallback shows). */
54
+ readonly active: boolean;
55
+ }
56
+ /**
57
+ * `<usa-shader>` — GPU shader background behind its content. `preset`
58
+ * (`gradient` · `plasma` · `waves` · `aurora`) or your own fragment shader in
59
+ * `<script type="x-shader/x-fragment">` (uniforms `u_time`, `u_resolution`,
60
+ * `u_mouse`, `v_uv`); `speed`. Without WebGL: the element's CSS background.
61
+ */
62
+ declare function defineShader(tag?: string): CustomElementConstructor | undefined;
63
+ /**
64
+ * `<usa-distort>` — hover distortion + RGB split on the `<img>` inside,
65
+ * following the pointer. Without WebGL / CORS: a gentle CSS zoom.
66
+ */
67
+ declare function defineDistort(tag?: string): CustomElementConstructor | undefined;
68
+ /**
69
+ * `<usa-liquid>` — liquid image: clicks / taps send ripples through the
70
+ * `<img>` inside, hover adds a gentle wobble; `strength`. Fallback: plain image.
71
+ */
72
+ declare function defineLiquid(tag?: string): CustomElementConstructor | undefined;
73
+
74
+ /** Built-in fragment shaders (bodies; uniforms `u_time`, `u_resolution`, `u_mouse` 0–1, `u_hover` 0–1, `u_tex`, `u_ripples[4]` = x, y, age, strength). */
75
+ declare const SHADERS: Record<string, string>;
76
+ /** Full fragment source for a preset or custom body (adds the shared header). */
77
+ declare function fragmentSource(body: string): string;
78
+ declare function supportsWebGL(): boolean;
79
+ interface GLQuad {
80
+ /** Draw a frame with these uniform values. */
81
+ render(u: {
82
+ time?: number;
83
+ mouse?: [number, number];
84
+ hover?: number;
85
+ ripples?: number[];
86
+ }): void;
87
+ /** Resize the drawing buffer to the canvas' CSS size × DPR (≤ 2). */
88
+ resize(): void;
89
+ /** Upload an image as `u_tex`. */
90
+ texture(img: TexImageSource): void;
91
+ dispose(): void;
92
+ }
93
+ /** Compile `frag` on a full-canvas quad, or `null` when WebGL / compilation is unavailable. */
94
+ declare function glQuad(canvas: HTMLCanvasElement, frag: string): GLQuad | null;
95
+
96
+ /**
97
+ * use-scroll-animate/components/webgl — lightweight canvas / WebGL (v3.4).
98
+ * `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image
99
+ * distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner
100
+ * (`glQuad()`), with graceful fallbacks when WebGL is unavailable.
101
+ */
102
+
103
+ /** Register every component of this category under its default tag. */
104
+ declare function defineWebglComponents(): void;
105
+ declare global {
106
+ interface HTMLElementTagNameMap {
107
+ 'usa-shader': UsaGLElement;
108
+ 'usa-distort': UsaGLElement;
109
+ 'usa-liquid': UsaGLElement;
110
+ }
111
+ }
112
+
113
+ export { SHADERS, configureComponents, defineDistort, defineLiquid, defineShader, defineWebglComponents, fragmentSource, glQuad, prefersReducedMotion, supportsWebGL };
114
+ export type { ComponentsConfig, GLQuad, UsaElement, UsaGLElement };