use-scroll-animate 3.3.0 → 3.5.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/CHANGELOG.md +24 -0
- package/README.md +2 -0
- package/README_ja.md +2 -0
- package/README_zh.md +2 -0
- package/dist/chunks/{base-Cu-86Z31.js → base-BpROOcey.js} +2 -2
- package/dist/chunks/{base-Cu-86Z31.js.map → base-BpROOcey.js.map} +1 -1
- package/dist/chunks/core-IaorbTdu.cjs +185 -0
- package/dist/chunks/core-IaorbTdu.cjs.map +1 -0
- package/dist/chunks/core-uxs3ETou.js +181 -0
- package/dist/chunks/core-uxs3ETou.js.map +1 -0
- package/dist/chunks/{index-tags-Cz4iTBEK.cjs → index-tags-CLFrjVR7.cjs} +3 -1
- package/dist/chunks/{index-tags-Cz4iTBEK.cjs.map → index-tags-CLFrjVR7.cjs.map} +1 -1
- package/dist/chunks/{index-tags-Dc_Z4yAY.js → index-tags-uw1Fospg.js} +3 -1
- package/dist/chunks/{index-tags-Dc_Z4yAY.js.map → index-tags-uw1Fospg.js.map} +1 -1
- package/dist/chunks/{spring-BV-cpTHC.js → spring-C-fw7_9f.js} +2 -2
- package/dist/chunks/{spring-BV-cpTHC.js.map → spring-C-fw7_9f.js.map} +1 -1
- package/dist/chunks/{variants-BQ3gCb5L.js → variants-CHe1VbSn.js} +2 -2
- package/dist/chunks/{variants-BQ3gCb5L.js.map → variants-CHe1VbSn.js.map} +1 -1
- package/dist/components/background.js +3 -3
- package/dist/components/cards.js +3 -3
- package/dist/components/click.js +3 -3
- package/dist/components/depth.cjs +252 -0
- package/dist/components/depth.cjs.map +1 -0
- package/dist/components/depth.css +3 -0
- package/dist/components/depth.d.cts +121 -0
- package/dist/components/depth.d.ts +121 -0
- package/dist/components/depth.js +243 -0
- package/dist/components/depth.js.map +1 -0
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.cjs +6 -182
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.js +6 -181
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/jsx.d.cts +2 -0
- package/dist/components/jsx.d.ts +2 -0
- package/dist/components/lazy.cjs +3 -1
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +2 -0
- package/dist/components/lazy.d.ts +2 -0
- package/dist/components/lazy.js +3 -1
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/physics.js +4 -4
- package/dist/components/react.cjs +1 -1
- package/dist/components/react.js +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/svg.js +2 -2
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.js +2 -2
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +4 -1
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +74 -0
- package/dist/components/vue.d.ts +74 -0
- package/dist/components/vue.js +7 -4
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +277 -0
- package/dist/components/webgl.cjs.map +1 -0
- package/dist/components/webgl.css +3 -0
- package/dist/components/webgl.d.cts +114 -0
- package/dist/components/webgl.d.ts +114 -0
- package/dist/components/webgl.js +267 -0
- package/dist/components/webgl.js.map +1 -0
- package/dist/components.cjs +24 -4
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +2 -0
- package/dist/components.d.cts +145 -2
- package/dist/components.d.ts +145 -2
- package/dist/components.js +15 -8
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/components.md +21 -0
- package/package.json +24 -2
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { h as defineElement, n as now, e as caf, b as clamp, r as raf } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
3
|
+
|
|
4
|
+
/** Minimal WebGL runner: one full-canvas quad, one fragment shader, optional image texture. */
|
|
5
|
+
const VERTEX = 'attribute vec2 p;varying vec2 v_uv;void main(){v_uv=p*.5+.5;gl_Position=vec4(p,0.,1.);}';
|
|
6
|
+
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';
|
|
7
|
+
/** 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). */
|
|
8
|
+
const SHADERS = {
|
|
9
|
+
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.);}',
|
|
10
|
+
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.);}',
|
|
11
|
+
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.);}',
|
|
12
|
+
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.);}',
|
|
13
|
+
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.);}',
|
|
14
|
+
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);}',
|
|
15
|
+
};
|
|
16
|
+
/** Full fragment source for a preset or custom body (adds the shared header). */
|
|
17
|
+
function fragmentSource(body) {
|
|
18
|
+
const src = SHADERS[body] || body;
|
|
19
|
+
return /precision\s+\w+\s+float/.test(src) ? src : HEAD + src;
|
|
20
|
+
}
|
|
21
|
+
/** `true` when the browser can create a WebGL context (cached). */
|
|
22
|
+
let support;
|
|
23
|
+
function supportsWebGL() {
|
|
24
|
+
if (support !== undefined)
|
|
25
|
+
return support;
|
|
26
|
+
try {
|
|
27
|
+
const c = typeof document !== 'undefined' ? document.createElement('canvas') : null;
|
|
28
|
+
support = !!(c && (c.getContext('webgl') || c.getContext('experimental-webgl')));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
support = false;
|
|
32
|
+
}
|
|
33
|
+
return support;
|
|
34
|
+
}
|
|
35
|
+
/** Compile `frag` on a full-canvas quad, or `null` when WebGL / compilation is unavailable. */
|
|
36
|
+
function glQuad(canvas, frag) {
|
|
37
|
+
let gl = null;
|
|
38
|
+
try {
|
|
39
|
+
gl = (canvas.getContext('webgl', { premultipliedAlpha: false, antialias: false }) || canvas.getContext('experimental-webgl'));
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
gl = null;
|
|
43
|
+
}
|
|
44
|
+
if (!gl)
|
|
45
|
+
return null;
|
|
46
|
+
const g = gl;
|
|
47
|
+
const sh = (type, src) => {
|
|
48
|
+
const s = g.createShader(type);
|
|
49
|
+
g.shaderSource(s, src);
|
|
50
|
+
g.compileShader(s);
|
|
51
|
+
return g.getShaderParameter(s, g.COMPILE_STATUS) ? s : null;
|
|
52
|
+
};
|
|
53
|
+
const vs = sh(g.VERTEX_SHADER, VERTEX);
|
|
54
|
+
const fs = sh(g.FRAGMENT_SHADER, fragmentSource(frag));
|
|
55
|
+
if (!vs || !fs)
|
|
56
|
+
return null;
|
|
57
|
+
const prog = g.createProgram();
|
|
58
|
+
g.attachShader(prog, vs);
|
|
59
|
+
g.attachShader(prog, fs);
|
|
60
|
+
g.linkProgram(prog);
|
|
61
|
+
if (!g.getProgramParameter(prog, g.LINK_STATUS))
|
|
62
|
+
return null;
|
|
63
|
+
g.useProgram(prog);
|
|
64
|
+
const buf = g.createBuffer();
|
|
65
|
+
g.bindBuffer(g.ARRAY_BUFFER, buf);
|
|
66
|
+
g.bufferData(g.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), g.STATIC_DRAW);
|
|
67
|
+
const loc = g.getAttribLocation(prog, 'p');
|
|
68
|
+
g.enableVertexAttribArray(loc);
|
|
69
|
+
g.vertexAttribPointer(loc, 2, g.FLOAT, false, 0, 0);
|
|
70
|
+
const U = (n) => g.getUniformLocation(prog, n);
|
|
71
|
+
const uT = U('u_time'), uR = U('u_resolution'), uM = U('u_mouse'), uH = U('u_hover'), uRp = U('u_ripples');
|
|
72
|
+
let tex = null;
|
|
73
|
+
const quad = {
|
|
74
|
+
resize() {
|
|
75
|
+
const dpr = Math.min(2, (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1);
|
|
76
|
+
const w = Math.max(1, Math.round((canvas.clientWidth || 300) * dpr));
|
|
77
|
+
const h = Math.max(1, Math.round((canvas.clientHeight || 150) * dpr));
|
|
78
|
+
if (canvas.width !== w || canvas.height !== h)
|
|
79
|
+
((canvas.width = w), (canvas.height = h));
|
|
80
|
+
g.viewport(0, 0, w, h);
|
|
81
|
+
},
|
|
82
|
+
texture(img) {
|
|
83
|
+
tex = tex || g.createTexture();
|
|
84
|
+
g.bindTexture(g.TEXTURE_2D, tex);
|
|
85
|
+
g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL, true);
|
|
86
|
+
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_S, g.CLAMP_TO_EDGE);
|
|
87
|
+
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_T, g.CLAMP_TO_EDGE);
|
|
88
|
+
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MIN_FILTER, g.LINEAR);
|
|
89
|
+
g.texImage2D(g.TEXTURE_2D, 0, g.RGBA, g.RGBA, g.UNSIGNED_BYTE, img);
|
|
90
|
+
},
|
|
91
|
+
render(u) {
|
|
92
|
+
g.uniform1f(uT, u.time ?? 0);
|
|
93
|
+
g.uniform2f(uR, canvas.width, canvas.height);
|
|
94
|
+
g.uniform2f(uM, ...(u.mouse ?? [0.5, 0.5]));
|
|
95
|
+
g.uniform1f(uH, u.hover ?? 0);
|
|
96
|
+
if (uRp)
|
|
97
|
+
g.uniform4fv(uRp, new Float32Array((u.ripples ?? []).concat(Array(16).fill(0)).slice(0, 16)));
|
|
98
|
+
g.drawArrays(g.TRIANGLES, 0, 6);
|
|
99
|
+
},
|
|
100
|
+
dispose() {
|
|
101
|
+
g.deleteProgram(prog);
|
|
102
|
+
g.deleteBuffer(buf);
|
|
103
|
+
if (tex)
|
|
104
|
+
g.deleteTexture(tex);
|
|
105
|
+
g.getExtension('WEBGL_lose_context')?.loseContext();
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
quad.resize();
|
|
109
|
+
return quad;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
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}}";
|
|
113
|
+
|
|
114
|
+
function make(kind) {
|
|
115
|
+
return (Base) => class extends Base {
|
|
116
|
+
constructor() {
|
|
117
|
+
super(...arguments);
|
|
118
|
+
this._q = null;
|
|
119
|
+
this._c = null;
|
|
120
|
+
this._id = 0;
|
|
121
|
+
this._mouse = [0.5, 0.5];
|
|
122
|
+
this._hover = 0;
|
|
123
|
+
this._hoverTo = 0;
|
|
124
|
+
this._ripples = [];
|
|
125
|
+
}
|
|
126
|
+
static get observedAttributes() {
|
|
127
|
+
return kind === 'shader' ? ['preset', 'speed'] : ['src'];
|
|
128
|
+
}
|
|
129
|
+
get active() {
|
|
130
|
+
return !!this._q;
|
|
131
|
+
}
|
|
132
|
+
fallback(reason) {
|
|
133
|
+
this.setAttribute('data-fallback', reason);
|
|
134
|
+
this._c?.remove();
|
|
135
|
+
this._c = null;
|
|
136
|
+
this._q?.dispose();
|
|
137
|
+
this._q = null;
|
|
138
|
+
}
|
|
139
|
+
frame() {
|
|
140
|
+
const q = this._q;
|
|
141
|
+
if (!q)
|
|
142
|
+
return;
|
|
143
|
+
this._hover += (this._hoverTo - this._hover) * 0.12;
|
|
144
|
+
const t = now();
|
|
145
|
+
this._ripples = this._ripples.filter((r) => t - r.t < 2500);
|
|
146
|
+
q.render({
|
|
147
|
+
time: (t / 1000) * this.num('speed', 1),
|
|
148
|
+
mouse: this._mouse,
|
|
149
|
+
hover: this._hover,
|
|
150
|
+
ripples: this._ripples.flatMap((r) => [r.x, r.y, (t - r.t) / 1000, this.num('strength', 1)]),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
mount() {
|
|
154
|
+
this.removeAttribute('data-fallback');
|
|
155
|
+
const custom = this.querySelector('script[type="x-shader/x-fragment"]');
|
|
156
|
+
const frag = kind === 'shader' ? custom?.textContent || this.str('preset', 'gradient') : kind;
|
|
157
|
+
const img = kind === 'shader' ? null : this.querySelector('img');
|
|
158
|
+
if (kind !== 'shader' && !img)
|
|
159
|
+
return this.fallback('no-image');
|
|
160
|
+
const c = (this._c = document.createElement('canvas'));
|
|
161
|
+
c.setAttribute('aria-hidden', 'true');
|
|
162
|
+
c.className = 'usa-gl';
|
|
163
|
+
this.prepend(c);
|
|
164
|
+
const q = (this._q = glQuad(c, frag));
|
|
165
|
+
if (!q)
|
|
166
|
+
return this.fallback('webgl');
|
|
167
|
+
this.onCleanup(() => this.fallback('off'));
|
|
168
|
+
const start = () => {
|
|
169
|
+
if (!img)
|
|
170
|
+
return true;
|
|
171
|
+
try {
|
|
172
|
+
q.texture(img);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
this.fallback('image');
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const draw = () => {
|
|
181
|
+
q.resize();
|
|
182
|
+
this.frame();
|
|
183
|
+
};
|
|
184
|
+
if (img && !(img.complete && img.naturalWidth)) {
|
|
185
|
+
if (!img.crossOrigin && /^https?:/.test(img.src) && !img.src.startsWith(location.origin))
|
|
186
|
+
img.crossOrigin = 'anonymous';
|
|
187
|
+
this.listen(img, 'load', () => start() && draw());
|
|
188
|
+
this.listen(img, 'error', () => this.fallback('image'));
|
|
189
|
+
}
|
|
190
|
+
else if (!start())
|
|
191
|
+
return;
|
|
192
|
+
this.setAttribute('data-active', '');
|
|
193
|
+
this.onCleanup(() => this.removeAttribute('data-active'));
|
|
194
|
+
draw();
|
|
195
|
+
if (kind !== 'shader') {
|
|
196
|
+
const pos = (e) => {
|
|
197
|
+
const r = this.getBoundingClientRect();
|
|
198
|
+
this._mouse = [clamp((e.clientX - r.left) / (r.width || 1), 0, 1), clamp(1 - (e.clientY - r.top) / (r.height || 1), 0, 1)];
|
|
199
|
+
};
|
|
200
|
+
this.listen(this, 'pointermove', pos);
|
|
201
|
+
this.listen(this, 'pointerenter', (e) => (pos(e), (this._hoverTo = 1)));
|
|
202
|
+
this.listen(this, 'pointerleave', () => (this._hoverTo = 0));
|
|
203
|
+
if (kind === 'liquid')
|
|
204
|
+
this.listen(this, 'pointerdown', (e) => {
|
|
205
|
+
pos(e);
|
|
206
|
+
this._ripples = [...this._ripples.slice(-3), { x: this._mouse[0], y: this._mouse[1], t: now() }];
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (this.reduced)
|
|
210
|
+
return; // one static frame, no loop
|
|
211
|
+
let visible = false;
|
|
212
|
+
const loop = () => {
|
|
213
|
+
this.frame();
|
|
214
|
+
this._id = raf(loop);
|
|
215
|
+
};
|
|
216
|
+
const sync = () => {
|
|
217
|
+
caf(this._id);
|
|
218
|
+
this._id = 0;
|
|
219
|
+
if (visible && !document.hidden)
|
|
220
|
+
this._id = raf(loop);
|
|
221
|
+
};
|
|
222
|
+
this.inView((v) => ((visible = v), sync()));
|
|
223
|
+
this.listen(document, 'visibilitychange', sync);
|
|
224
|
+
this.listen(window, 'resize', () => q.resize(), { passive: true });
|
|
225
|
+
this.onCleanup(() => caf(this._id));
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* `<usa-shader>` — GPU shader background behind its content. `preset`
|
|
231
|
+
* (`gradient` · `plasma` · `waves` · `aurora`) or your own fragment shader in
|
|
232
|
+
* `<script type="x-shader/x-fragment">` (uniforms `u_time`, `u_resolution`,
|
|
233
|
+
* `u_mouse`, `v_uv`); `speed`. Without WebGL: the element's CSS background.
|
|
234
|
+
*/
|
|
235
|
+
function defineShader(tag = 'usa-shader') {
|
|
236
|
+
return defineElement(tag, make('shader'), { id: 'webgl', text: css });
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* `<usa-distort>` — hover distortion + RGB split on the `<img>` inside,
|
|
240
|
+
* following the pointer. Without WebGL / CORS: a gentle CSS zoom.
|
|
241
|
+
*/
|
|
242
|
+
function defineDistort(tag = 'usa-distort') {
|
|
243
|
+
return defineElement(tag, make('distort'), { id: 'webgl', text: css });
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* `<usa-liquid>` — liquid image: clicks / taps send ripples through the
|
|
247
|
+
* `<img>` inside, hover adds a gentle wobble; `strength`. Fallback: plain image.
|
|
248
|
+
*/
|
|
249
|
+
function defineLiquid(tag = 'usa-liquid') {
|
|
250
|
+
return defineElement(tag, make('liquid'), { id: 'webgl', text: css });
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* use-scroll-animate/components/webgl — lightweight canvas / WebGL (v3.4).
|
|
255
|
+
* `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image
|
|
256
|
+
* distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner
|
|
257
|
+
* (`glQuad()`), with graceful fallbacks when WebGL is unavailable.
|
|
258
|
+
*/
|
|
259
|
+
/** Register every component of this category under its default tag. */
|
|
260
|
+
function defineWebglComponents() {
|
|
261
|
+
defineShader();
|
|
262
|
+
defineDistort();
|
|
263
|
+
defineLiquid();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export { SHADERS, defineDistort, defineLiquid, defineShader, defineWebglComponents, fragmentSource, glQuad, supportsWebGL };
|
|
267
|
+
//# sourceMappingURL=webgl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl.js","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":[],"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,G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AClE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC;KACD;AACL;AAEA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,GAAG,GAAG,YAAY,EAAA;AAC7C,IAAA,OAAO,aAAa,CAAC,GAAG,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,OAAO,aAAa,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,OAAO,aAAa,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;;;;"}
|
package/dist/components.cjs
CHANGED
|
@@ -14,10 +14,13 @@ var components_page = require('./components/page.cjs');
|
|
|
14
14
|
var components_timeline = require('./components/timeline.cjs');
|
|
15
15
|
var components_gesture = require('./components/gesture.cjs');
|
|
16
16
|
var components_svg = require('./components/svg.cjs');
|
|
17
|
+
var components_webgl = require('./components/webgl.cjs');
|
|
18
|
+
var components_depth = require('./components/depth.cjs');
|
|
17
19
|
var variants = require('./chunks/variants-BNIrn4ch.cjs');
|
|
18
20
|
var base = require('./chunks/base-CXx7jZ-o.cjs');
|
|
19
|
-
var indexTags = require('./chunks/index-tags-
|
|
21
|
+
var indexTags = require('./chunks/index-tags-CLFrjVR7.cjs');
|
|
20
22
|
var spring = require('./chunks/spring-2OTnYCzm.cjs');
|
|
23
|
+
var core = require('./chunks/core-IaorbTdu.cjs');
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* use-scroll-animate/components
|
|
@@ -54,6 +57,8 @@ const BY_CATEGORY = {
|
|
|
54
57
|
timeline: components_timeline.defineTimelineComponents,
|
|
55
58
|
gesture: components_gesture.defineGestureComponents,
|
|
56
59
|
svg: components_svg.defineSvgComponents,
|
|
60
|
+
webgl: components_webgl.defineWebglComponents,
|
|
61
|
+
depth: components_depth.defineDepthComponents,
|
|
57
62
|
};
|
|
58
63
|
/**
|
|
59
64
|
* Register every `<usa-*>` component (or only the given categories).
|
|
@@ -191,9 +196,6 @@ exports.timeline = components_timeline.timeline;
|
|
|
191
196
|
exports.defineGestureComponents = components_gesture.defineGestureComponents;
|
|
192
197
|
exports.definePinchZoom = components_gesture.definePinchZoom;
|
|
193
198
|
exports.defineSwipeable = components_gesture.defineSwipeable;
|
|
194
|
-
exports.gesture = components_gesture.gesture;
|
|
195
|
-
exports.pinchScale = components_gesture.pinchScale;
|
|
196
|
-
exports.swipeDirection = components_gesture.swipeDirection;
|
|
197
199
|
exports.ANIM_ICONS = components_svg.ANIM_ICONS;
|
|
198
200
|
exports.MASK_SHAPES = components_svg.MASK_SHAPES;
|
|
199
201
|
exports.defineAnimIcon = components_svg.defineAnimIcon;
|
|
@@ -205,6 +207,21 @@ exports.drawLines = components_svg.drawLines;
|
|
|
205
207
|
exports.interpolatePath = components_svg.interpolatePath;
|
|
206
208
|
exports.morphTo = components_svg.morphTo;
|
|
207
209
|
exports.pathsCompatible = components_svg.pathsCompatible;
|
|
210
|
+
exports.SHADERS = components_webgl.SHADERS;
|
|
211
|
+
exports.defineDistort = components_webgl.defineDistort;
|
|
212
|
+
exports.defineLiquid = components_webgl.defineLiquid;
|
|
213
|
+
exports.defineShader = components_webgl.defineShader;
|
|
214
|
+
exports.defineWebglComponents = components_webgl.defineWebglComponents;
|
|
215
|
+
exports.fragmentSource = components_webgl.fragmentSource;
|
|
216
|
+
exports.glQuad = components_webgl.glQuad;
|
|
217
|
+
exports.supportsWebGL = components_webgl.supportsWebGL;
|
|
218
|
+
exports.defineCube = components_depth.defineCube;
|
|
219
|
+
exports.defineDepth = components_depth.defineDepth;
|
|
220
|
+
exports.defineDepthComponents = components_depth.defineDepthComponents;
|
|
221
|
+
exports.deviceTilt = components_depth.deviceTilt;
|
|
222
|
+
exports.orientationToTilt = components_depth.orientationToTilt;
|
|
223
|
+
exports.requestOrientationPermission = components_depth.requestOrientationPermission;
|
|
224
|
+
exports.supportsOrientation = components_depth.supportsOrientation;
|
|
208
225
|
exports.VARIANTS = variants.VARIANTS;
|
|
209
226
|
exports.adoptVariants = variants.adoptVariants;
|
|
210
227
|
exports.setVariant = variants.setVariant;
|
|
@@ -225,5 +242,8 @@ exports.springEasing = spring.springEasing;
|
|
|
225
242
|
exports.springSamples = spring.springSamples;
|
|
226
243
|
exports.stepSpring = spring.stepSpring;
|
|
227
244
|
exports.supportsLinearEasing = spring.supportsLinearEasing;
|
|
245
|
+
exports.gesture = core.gesture;
|
|
246
|
+
exports.pinchScale = core.pinchScale;
|
|
247
|
+
exports.swipeDirection = core.swipeDirection;
|
|
228
248
|
exports.defineComponents = defineComponents;
|
|
229
249
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.cjs","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\nimport { defineUiComponents } from './ui/index';\nimport { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { defineGestureComponents } from './gesture/index';\nimport { defineSvgComponents } from './svg/index';\nimport { adoptVariants } from './ui/variants';\nimport { canDefine } from './base';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\nexport * from './ui/index';\nexport * from './page/index';\nexport * from './timeline/index';\nexport * from './gesture/index';\nexport * from './svg/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n ui: defineUiComponents,\n page: definePageComponents,\n timeline: defineTimelineComponents,\n gesture: defineGestureComponents,\n svg: defineSvgComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n if (canDefine()) adoptVariants();\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":["defineRevealComponents","defineTextComponents","defineInteractionComponents","defineFeedbackComponents","defineBackgroundComponents","defineTransitionComponents","definePhysicsComponents","defineCardComponents","defineClickComponents","defineUiComponents","definePageComponents","defineTimelineComponents","defineGestureComponents","defineSvgComponents","canDefine","adoptVariants"],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.cjs","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\nimport { defineUiComponents } from './ui/index';\nimport { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { defineGestureComponents } from './gesture/index';\nimport { defineSvgComponents } from './svg/index';\nimport { defineWebglComponents } from './webgl/index';\nimport { defineDepthComponents } from './depth/index';\nimport { adoptVariants } from './ui/variants';\nimport { canDefine } from './base';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\nexport * from './ui/index';\nexport * from './page/index';\nexport * from './timeline/index';\nexport * from './gesture/index';\nexport * from './svg/index';\nexport * from './webgl/index';\nexport * from './depth/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n ui: defineUiComponents,\n page: definePageComponents,\n timeline: defineTimelineComponents,\n gesture: defineGestureComponents,\n svg: defineSvgComponents,\n webgl: defineWebglComponents,\n depth: defineDepthComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n if (canDefine()) adoptVariants();\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":["defineRevealComponents","defineTextComponents","defineInteractionComponents","defineFeedbackComponents","defineBackgroundComponents","defineTransitionComponents","definePhysicsComponents","defineCardComponents","defineClickComponents","defineUiComponents","definePageComponents","defineTimelineComponents","defineGestureComponents","defineSvgComponents","defineWebglComponents","defineDepthComponents","canDefine","adoptVariants"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAyCH,MAAM,WAAW,GAA0C;AACzD,IAAA,MAAM,EAAEA,wCAAsB;AAC9B,IAAA,IAAI,EAAEC,oCAAoB;AAC1B,IAAA,WAAW,EAAEC,kDAA2B;AACxC,IAAA,QAAQ,EAAEC,4CAAwB;AAClC,IAAA,UAAU,EAAEC,gDAA0B;AACtC,IAAA,WAAW,EAAEC,iDAA0B;AACvC,IAAA,OAAO,EAAEC,0CAAuB;AAChC,IAAA,KAAK,EAAEC,qCAAoB;AAC3B,IAAA,KAAK,EAAEC,sCAAqB;AAC5B,IAAA,EAAE,EAAEC,gCAAkB;AACtB,IAAA,IAAI,EAAEC,oCAAoB;AAC1B,IAAA,QAAQ,EAAEC,4CAAwB;AAClC,IAAA,OAAO,EAAEC,0CAAuB;AAChC,IAAA,GAAG,EAAEC,kCAAmB;AACxB,IAAA,KAAK,EAAEC,sCAAqB;AAC5B,IAAA,KAAK,EAAEC,sCAAqB;CAC7B;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;AAC/D,IAAA,IAAIC,cAAS,EAAE;AAAE,QAAAC,sBAAa,EAAE;IAChC,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/components.css
CHANGED
|
@@ -69,3 +69,5 @@ usa-splash{position:fixed;inset:0;z-index:2147483400;display:grid;place-items:ce
|
|
|
69
69
|
usa-timeline{display:block}usa-timeline[scrub]{position:relative}@media (prefers-reduced-motion:reduce){usa-timeline [data-tl]{opacity:1 !important;transform:none !important;filter:none !important;clip-path:none !important}}
|
|
70
70
|
usa-swipeable{display:block;touch-action:pan-y;user-select:none;-webkit-user-select:none}usa-swipeable[axis="y"]{touch-action:pan-x}usa-swipeable>*{transform:translate3d(var(--usa-swipe,0px),0,0);opacity:calc(1 - var(--usa-swipe-p,0) * 0.5)}usa-swipeable[axis="y"]>*{transform:translate3d(0,var(--usa-swipe,0px),0)}usa-swipeable:focus-visible{outline:2px solid currentColor;outline-offset:2px}usa-pinch-zoom{display:block;overflow:hidden;touch-action:none;position:relative}usa-pinch-zoom>*{transform:translate3d(var(--usa-zoom-x,0px),var(--usa-zoom-y,0px),0) scale(var(--usa-zoom,1));transform-origin:50% 50%}usa-pinch-zoom[data-zoomed]{cursor:grab}usa-pinch-zoom:focus-visible{outline:2px solid currentColor;outline-offset:2px}
|
|
71
71
|
usa-draw{display:inline-block}usa-draw svg :is(path,line,polyline,polygon,circle,ellipse,rect){transition:fill-opacity 0.6s ease}usa-draw[fill]:not([data-drawn]) svg :is(path,polygon,circle,ellipse,rect){fill-opacity:0}usa-morph{display:inline-block;line-height:0}usa-morph svg{width:100%;height:100%;fill:currentColor}usa-morph[role="button"]{cursor:pointer}usa-mask-reveal{display:block}usa-mask-reveal[data-state="visible"]{clip-path:none !important}usa-anim-icon{display:inline-flex;line-height:0;vertical-align:middle}usa-anim-icon svg{overflow:visible}@media (prefers-reduced-motion:reduce){usa-mask-reveal{clip-path:none !important}usa-draw svg *{stroke-dashoffset:0 !important}}
|
|
72
|
+
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}}
|
|
73
|
+
usa-cube{--usa-cube-size:200px;display:block;width:var(--usa-cube-size);height:var(--usa-cube-size);perspective:var(--usa-cube-perspective,900px);touch-action:pan-y;user-select:none;-webkit-user-select:none;position:relative}usa-cube>[data-face]{position:absolute;inset:0;backface-visibility:hidden;transform:translateZ(calc(var(--usa-cube-size) / -2)) rotateX(var(--usa-cube-rx,0deg)) rotateY(var(--usa-cube-ry,0deg)) var(--usa-face) translateZ(calc(var(--usa-cube-size) / 2));transform-origin:50% 50%}usa-cube>[data-face="front"]{--usa-face:rotateY(0deg)}usa-cube>[data-face="right"]{--usa-face:rotateY(90deg)}usa-cube>[data-face="back"]{--usa-face:rotateY(180deg)}usa-cube>[data-face="left"]{--usa-face:rotateY(-90deg)}usa-cube>[data-face="top"]{--usa-face:rotateX(90deg)}usa-cube>[data-face="bottom"]{--usa-face:rotateX(-90deg)}usa-cube:focus-visible{outline:2px solid currentColor;outline-offset:6px}usa-depth{display:block;position:relative;perspective:1000px}usa-depth>*{transform:var(--usa-depth-rot,none);transform-style:preserve-3d}usa-depth [data-depth]{will-change:transform;transition:transform 0.12s linear}@media (prefers-reduced-motion:reduce){usa-depth [data-depth]{transform:none !important}}
|
package/dist/components.d.cts
CHANGED
|
@@ -2114,6 +2114,147 @@ declare global {
|
|
|
2114
2114
|
}
|
|
2115
2115
|
}
|
|
2116
2116
|
|
|
2117
|
+
/**
|
|
2118
|
+
* Shared shell for the WebGL elements: a canvas over (or behind) the
|
|
2119
|
+
* content that renders only while visible and the tab is shown, a DPR cap
|
|
2120
|
+
* of 2, and a graceful fallback (`data-fallback`) when WebGL, the shader
|
|
2121
|
+
* or the image (CORS) is unavailable — the original content / CSS stays.
|
|
2122
|
+
*/
|
|
2123
|
+
interface UsaGLElement extends UsaElement {
|
|
2124
|
+
/** `true` once WebGL rendering is active (otherwise the CSS fallback shows). */
|
|
2125
|
+
readonly active: boolean;
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* `<usa-shader>` — GPU shader background behind its content. `preset`
|
|
2129
|
+
* (`gradient` · `plasma` · `waves` · `aurora`) or your own fragment shader in
|
|
2130
|
+
* `<script type="x-shader/x-fragment">` (uniforms `u_time`, `u_resolution`,
|
|
2131
|
+
* `u_mouse`, `v_uv`); `speed`. Without WebGL: the element's CSS background.
|
|
2132
|
+
*/
|
|
2133
|
+
declare function defineShader(tag?: string): CustomElementConstructor | undefined;
|
|
2134
|
+
/**
|
|
2135
|
+
* `<usa-distort>` — hover distortion + RGB split on the `<img>` inside,
|
|
2136
|
+
* following the pointer. Without WebGL / CORS: a gentle CSS zoom.
|
|
2137
|
+
*/
|
|
2138
|
+
declare function defineDistort(tag?: string): CustomElementConstructor | undefined;
|
|
2139
|
+
/**
|
|
2140
|
+
* `<usa-liquid>` — liquid image: clicks / taps send ripples through the
|
|
2141
|
+
* `<img>` inside, hover adds a gentle wobble; `strength`. Fallback: plain image.
|
|
2142
|
+
*/
|
|
2143
|
+
declare function defineLiquid(tag?: string): CustomElementConstructor | undefined;
|
|
2144
|
+
|
|
2145
|
+
/** 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). */
|
|
2146
|
+
declare const SHADERS: Record<string, string>;
|
|
2147
|
+
/** Full fragment source for a preset or custom body (adds the shared header). */
|
|
2148
|
+
declare function fragmentSource(body: string): string;
|
|
2149
|
+
declare function supportsWebGL(): boolean;
|
|
2150
|
+
interface GLQuad {
|
|
2151
|
+
/** Draw a frame with these uniform values. */
|
|
2152
|
+
render(u: {
|
|
2153
|
+
time?: number;
|
|
2154
|
+
mouse?: [number, number];
|
|
2155
|
+
hover?: number;
|
|
2156
|
+
ripples?: number[];
|
|
2157
|
+
}): void;
|
|
2158
|
+
/** Resize the drawing buffer to the canvas' CSS size × DPR (≤ 2). */
|
|
2159
|
+
resize(): void;
|
|
2160
|
+
/** Upload an image as `u_tex`. */
|
|
2161
|
+
texture(img: TexImageSource): void;
|
|
2162
|
+
dispose(): void;
|
|
2163
|
+
}
|
|
2164
|
+
/** Compile `frag` on a full-canvas quad, or `null` when WebGL / compilation is unavailable. */
|
|
2165
|
+
declare function glQuad(canvas: HTMLCanvasElement, frag: string): GLQuad | null;
|
|
2166
|
+
|
|
2167
|
+
/**
|
|
2168
|
+
* use-scroll-animate/components/webgl — lightweight canvas / WebGL (v3.4).
|
|
2169
|
+
* `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image
|
|
2170
|
+
* distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner
|
|
2171
|
+
* (`glQuad()`), with graceful fallbacks when WebGL is unavailable.
|
|
2172
|
+
*/
|
|
2173
|
+
|
|
2174
|
+
/** Register every component of this category under its default tag. */
|
|
2175
|
+
declare function defineWebglComponents(): void;
|
|
2176
|
+
declare global {
|
|
2177
|
+
interface HTMLElementTagNameMap {
|
|
2178
|
+
'usa-shader': UsaGLElement;
|
|
2179
|
+
'usa-distort': UsaGLElement;
|
|
2180
|
+
'usa-liquid': UsaGLElement;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* `<usa-cube>` — a CSS 3D cube whose up-to-six element children are its faces
|
|
2186
|
+
* (front, right, back, left, top, bottom). Rotate with drag / swipe, arrow
|
|
2187
|
+
* keys, `autoplay` (ms) or `show(face | index)`; spring-driven.
|
|
2188
|
+
* Attributes: `size` (px, 200), `autoplay`, `perspective` (900).
|
|
2189
|
+
* `usa:change` (`{ index, face }`). Reduced motion: instant face switch.
|
|
2190
|
+
*/
|
|
2191
|
+
interface UsaCubeElement extends UsaElement {
|
|
2192
|
+
readonly index: number;
|
|
2193
|
+
show(face: number | string): void;
|
|
2194
|
+
next(): void;
|
|
2195
|
+
prev(): void;
|
|
2196
|
+
}
|
|
2197
|
+
declare function defineCube(tag?: string): CustomElementConstructor | undefined;
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* `<usa-depth>` — depth parallax: children with `data-depth` (-1…1, 0 = the
|
|
2201
|
+
* screen plane) move and scale by depth as the pointer moves, the device
|
|
2202
|
+
* tilts (`orientation`) or the page scrolls (`scroll`).
|
|
2203
|
+
* Attributes: `source` (`pointer` default · `orientation` · `scroll` ·
|
|
2204
|
+
* space-separated mix), `strength` (px at depth 1, 40), `rotate` (max tilt
|
|
2205
|
+
* of the whole scene in deg, 0). `requestPermission()` for iOS motion.
|
|
2206
|
+
* Reduced motion: layers stay flat.
|
|
2207
|
+
*/
|
|
2208
|
+
interface UsaDepthElement extends UsaElement {
|
|
2209
|
+
/** Current -1…1 input. */
|
|
2210
|
+
readonly tilt: {
|
|
2211
|
+
x: number;
|
|
2212
|
+
y: number;
|
|
2213
|
+
};
|
|
2214
|
+
requestPermission(): Promise<boolean>;
|
|
2215
|
+
}
|
|
2216
|
+
declare function defineDepth(tag?: string): CustomElementConstructor | undefined;
|
|
2217
|
+
|
|
2218
|
+
interface TiltReading {
|
|
2219
|
+
/** Left/right tilt, -1…1. */
|
|
2220
|
+
x: number;
|
|
2221
|
+
/** Front/back tilt, -1…1. */
|
|
2222
|
+
y: number;
|
|
2223
|
+
}
|
|
2224
|
+
/** Map a DeviceOrientation reading (beta/gamma degrees) to -1…1 tilt around a resting pose (pure). */
|
|
2225
|
+
declare function orientationToTilt(beta: number | null, gamma: number | null, range?: number, rest?: number): TiltReading;
|
|
2226
|
+
/** `true` when DeviceOrientation events exist. */
|
|
2227
|
+
declare const supportsOrientation: () => boolean;
|
|
2228
|
+
/**
|
|
2229
|
+
* Ask for motion-sensor permission where required (iOS 13+; must run inside
|
|
2230
|
+
* a user gesture). Resolves `true` when tilt events can be used.
|
|
2231
|
+
*/
|
|
2232
|
+
declare function requestOrientationPermission(): Promise<boolean>;
|
|
2233
|
+
/**
|
|
2234
|
+
* Listen to device tilt (smoothed); falls back to nothing on desktops.
|
|
2235
|
+
* Returns a stop function.
|
|
2236
|
+
*/
|
|
2237
|
+
declare function deviceTilt(cb: (t: TiltReading) => void, o?: {
|
|
2238
|
+
range?: number;
|
|
2239
|
+
smooth?: number;
|
|
2240
|
+
}): () => void;
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* use-scroll-animate/components/depth — 3D (v3.5).
|
|
2244
|
+
* `<usa-cube>` (CSS 3D cube), `<usa-depth>` (layered depth parallax driven by
|
|
2245
|
+
* pointer, device orientation or scroll) and `deviceTilt()`. The 3D ring
|
|
2246
|
+
* carousel is `<usa-carousel-3d>` in `components/cards`.
|
|
2247
|
+
*/
|
|
2248
|
+
|
|
2249
|
+
/** Register every component of this category under its default tag. */
|
|
2250
|
+
declare function defineDepthComponents(): void;
|
|
2251
|
+
declare global {
|
|
2252
|
+
interface HTMLElementTagNameMap {
|
|
2253
|
+
'usa-cube': UsaCubeElement;
|
|
2254
|
+
'usa-depth': UsaDepthElement;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2117
2258
|
/** The component categories and their default tags. */
|
|
2118
2259
|
declare const COMPONENT_CATEGORIES: {
|
|
2119
2260
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -2130,6 +2271,8 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
2130
2271
|
readonly timeline: readonly ["usa-timeline"];
|
|
2131
2272
|
readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
|
|
2132
2273
|
readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
|
|
2274
|
+
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
2275
|
+
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
2133
2276
|
};
|
|
2134
2277
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
2135
2278
|
|
|
@@ -2139,5 +2282,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
|
2139
2282
|
*/
|
|
2140
2283
|
declare function defineComponents(categories?: ComponentCategory[]): void;
|
|
2141
2284
|
|
|
2142
|
-
export { AMBIENT_EFFECTS, ANIM_ICONS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MASK_SHAPES, MORPH_ICONS, MOTION_SCALE, PAGE_EFFECTS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAnimIcon, defineAurora, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCursor, defineDialog, defineDotNetwork, defineDoubleTap, defineDraggable, defineDraw, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineLoadingBar, defineMagnetic, defineMarquee, defineMaskReveal, defineMorph, defineMotionSwitch, defineNavbar, defineOverscroll, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSvgComponents, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, drawLines, easeOutExpo, enableMpaTransitions, flip, fluentPreset, gesture, getMotionIntensity, haptic, interpolatePath, linearEasing, loadingBar, morphPath, morphTo, pageTransition, pathsCompatible, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsViewTransitions, swipeDirection, themeTransition, timeline, toast, viewTransition };
|
|
2143
|
-
export type { AmbientEffect, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, GestureHandlers, GestureOptions, MorphOptions, MotionIntensity, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAnimIconElement, UsaAuroraElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCursorElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaFullpageElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMaskRevealElement, UsaMorphElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
|
|
2285
|
+
export { AMBIENT_EFFECTS, ANIM_ICONS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MASK_SHAPES, MORPH_ICONS, MOTION_SCALE, PAGE_EFFECTS, REVEAL_EFFECTS, SHADERS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAnimIcon, defineAurora, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCube, defineCursor, defineDepth, defineDepthComponents, defineDialog, defineDistort, defineDotNetwork, defineDoubleTap, defineDraggable, defineDraw, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineLiquid, defineLoadingBar, defineMagnetic, defineMarquee, defineMaskReveal, defineMorph, defineMotionSwitch, defineNavbar, defineOverscroll, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShader, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSvgComponents, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, defineWebglComponents, deviceTilt, drawLines, easeOutExpo, enableMpaTransitions, flip, fluentPreset, fragmentSource, gesture, getMotionIntensity, glQuad, haptic, interpolatePath, linearEasing, loadingBar, morphPath, morphTo, orientationToTilt, pageTransition, pathsCompatible, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, requestOrientationPermission, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsOrientation, supportsViewTransitions, supportsWebGL, swipeDirection, themeTransition, timeline, toast, viewTransition };
|
|
2286
|
+
export type { AmbientEffect, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, GLQuad, GestureHandlers, GestureOptions, MorphOptions, MotionIntensity, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, TiltReading, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAnimIconElement, UsaAuroraElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCubeElement, UsaCursorElement, UsaDepthElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaFullpageElement, UsaGLElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMaskRevealElement, UsaMorphElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
|