@zakisheriff/liquid-glass 0.3.8 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +5 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2373,13 +2373,13 @@ var GlassSwitch = React10.forwardRef(
|
|
|
2373
2373
|
const el2 = ref.current;
|
|
2374
2374
|
const thumb = thumbRef.current;
|
|
2375
2375
|
const fill = fillRef.current;
|
|
2376
|
-
const v = { x: checked ? 1 : 0, lift: 0, stretch: 0 };
|
|
2376
|
+
const v = { x: checked ? 1 : 0, lift: 0, glass: 0, stretch: 0 };
|
|
2377
2377
|
const paint = () => {
|
|
2378
2378
|
const s = REST + (1 - REST) * v.lift;
|
|
2379
2379
|
const sx = s * (1 + v.stretch);
|
|
2380
2380
|
const sy = s * (1 - v.stretch * 0.5);
|
|
2381
2381
|
thumb.style.transform = `translate(${v.x * TRAVEL}px, -50%) scale(${sx}, ${sy})`;
|
|
2382
|
-
const l = clamp(v.
|
|
2382
|
+
const l = clamp(v.glass, 0, 1);
|
|
2383
2383
|
el2.style.setProperty("--lg-knob-x", `${(21 + v.x * TRAVEL).toFixed(2)}px`);
|
|
2384
2384
|
el2.style.setProperty("--lg-hole", `${(l > 0.01 ? 23 * sx : 0).toFixed(2)}px`);
|
|
2385
2385
|
el2.style.setProperty("--lg-lift", String(l));
|
|
@@ -2396,6 +2396,7 @@ var GlassSwitch = React10.forwardRef(
|
|
|
2396
2396
|
});
|
|
2397
2397
|
const lift = createSpring(0, SPRINGS.lift, (value) => {
|
|
2398
2398
|
v.lift = value;
|
|
2399
|
+
v.glass = lift.target ? value : Math.min(v.glass, value);
|
|
2399
2400
|
paint();
|
|
2400
2401
|
});
|
|
2401
2402
|
const color = createSpring(checked ? 1 : 0, SPRINGS.fade, (value) => {
|