@zakisheriff/liquid-glass 0.3.20 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -685,6 +685,12 @@ function canRefractBackdrop() {
|
|
|
685
685
|
const ua = navigator.userAgent;
|
|
686
686
|
return /Chrom(e|ium)\/|Edg\//.test(ua) && !/CriOS|FxiOS|EdgiOS/.test(ua);
|
|
687
687
|
}
|
|
688
|
+
function filtersTearWhileMoving() {
|
|
689
|
+
if (typeof navigator === "undefined" || typeof CSS === "undefined") return false;
|
|
690
|
+
const ua = navigator.userAgent;
|
|
691
|
+
const webkit = /AppleWebKit\//.test(ua) && !/Chrom(e|ium)\/|Edg\//.test(ua);
|
|
692
|
+
return webkit && !CSS.supports("anchor-name", "--lg");
|
|
693
|
+
}
|
|
688
694
|
function bevelProfile(bezel, thickness, ior) {
|
|
689
695
|
const N = 256;
|
|
690
696
|
const out = new Float32Array(N);
|
|
@@ -1063,7 +1069,8 @@ function useRefraction(ref, shape = {}, enabled = true, mirror, mirrorActive) {
|
|
|
1063
1069
|
let zoom = 1;
|
|
1064
1070
|
let zoomX = 1;
|
|
1065
1071
|
const chromium = canRefractBackdrop();
|
|
1066
|
-
const
|
|
1072
|
+
const tears = filtersTearWhileMoving();
|
|
1073
|
+
const bendCopy = !!mirror && (shape.copy === "refract" || !chromium) && !tears;
|
|
1067
1074
|
let copyFilter = "";
|
|
1068
1075
|
const applyCopyFilter = () => {
|
|
1069
1076
|
const viewport = element.querySelector(":scope > .lg-mirror > .lg-mirror__viewport");
|
|
@@ -1079,6 +1086,10 @@ function useRefraction(ref, shape = {}, enabled = true, mirror, mirrorActive) {
|
|
|
1079
1086
|
if (!live && mirror?.current) {
|
|
1080
1087
|
pad = Math.ceil(Math.min(width, height) * 0.45 + 6);
|
|
1081
1088
|
({ zoom, zoomX } = resolve(shape, width, height));
|
|
1089
|
+
if (tears) {
|
|
1090
|
+
zoom = Math.min(zoom, 1);
|
|
1091
|
+
zoomX = Math.min(zoomX, 1);
|
|
1092
|
+
}
|
|
1082
1093
|
element.style.setProperty("--lg-inner-mask", baked.inner);
|
|
1083
1094
|
if (bendCopy) {
|
|
1084
1095
|
copyFilter = glassFor(width, height, radius, { ...shape, zoom: 1, zoomX: 1 }, pad, false, true, !chromium).filter;
|