@shohojdhara/atomix 0.4.5 → 0.4.6

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 (40) hide show
  1. package/dist/atomix.css +33 -14
  2. package/dist/atomix.css.map +1 -1
  3. package/dist/atomix.min.css +1 -1
  4. package/dist/atomix.min.css.map +1 -1
  5. package/dist/charts.js +183 -184
  6. package/dist/charts.js.map +1 -1
  7. package/dist/core.js +183 -184
  8. package/dist/core.js.map +1 -1
  9. package/dist/forms.js +183 -184
  10. package/dist/forms.js.map +1 -1
  11. package/dist/heavy.js +183 -184
  12. package/dist/heavy.js.map +1 -1
  13. package/dist/index.d.ts +4 -31
  14. package/dist/index.esm.js +192 -283
  15. package/dist/index.esm.js.map +1 -1
  16. package/dist/index.js +194 -285
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.min.js +1 -1
  19. package/dist/index.min.js.map +1 -1
  20. package/package.json +1 -1
  21. package/src/components/AtomixGlass/AtomixGlass.tsx +60 -38
  22. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +6 -35
  23. package/src/components/AtomixGlass/glass-utils.ts +27 -14
  24. package/src/components/AtomixGlass/stories/Overview.stories.tsx +19 -21
  25. package/src/components/AtomixGlass/stories/Playground.stories.tsx +1162 -515
  26. package/src/components/AtomixGlass/stories/shared-components.tsx +11 -3
  27. package/src/components/Navigation/Navbar/Navbar.tsx +13 -5
  28. package/src/lib/composables/index.ts +1 -2
  29. package/src/lib/composables/useAtomixGlass.ts +246 -222
  30. package/src/lib/composables/useAtomixGlassStyles.ts +46 -23
  31. package/src/lib/constants/components.ts +3 -1
  32. package/src/styles/06-components/_components.atomix-glass.scss +45 -20
  33. package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +0 -329
  34. package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +0 -82
  35. package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +0 -153
  36. package/src/lib/composables/atomix-glass/useGlassOverLight.ts +0 -198
  37. package/src/lib/composables/atomix-glass/useGlassState.ts +0 -112
  38. package/src/lib/composables/atomix-glass/useGlassTransforms.ts +0 -160
  39. package/src/lib/composables/glass-styles.ts +0 -302
  40. package/src/lib/composables/useGlassContainer.ts +0 -177
package/dist/charts.js CHANGED
@@ -510,7 +510,9 @@ const _reduceInstanceProperty = getDefaultExportFromCjs((function(it) {
510
510
  ENABLE_OVER_LIGHT_LAYERS: !0
511
511
  },
512
512
  CONSTANTS: {
513
- ACTIVATION_ZONE: 200,
513
+ ACTIVATION_ZONE: 350,
514
+ LERP_FACTOR: .08,
515
+ SMOOTHSTEP_POWER: 2.5,
514
516
  MIN_BLUR: .1,
515
517
  MOUSE_INFLUENCE_DIVISOR: 100,
516
518
  EDGE_FADE_PIXELS: 2,
@@ -1600,7 +1602,7 @@ const {CONSTANTS: CONSTANTS$2} = ATOMIX_GLASS, calculateDistance = (pos1, pos2)
1600
1602
  // Silently handle errors
1601
1603
  }
1602
1604
  return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
1603
- }, getDisplacementMap = (mode, displacementMap, polarDisplacementMap, prominentDisplacementMap, shaderMapUrl) => {
1605
+ }, lerp = (a, b, t) => a + (b - a) * t, softClamp = (value, max) => max <= 0 ? 0 : max * (1 - Math.exp(-value / max)), getDisplacementMap = (mode, displacementMap, polarDisplacementMap, prominentDisplacementMap, shaderMapUrl) => {
1604
1606
  switch (mode) {
1605
1607
  case "standard":
1606
1608
  return displacementMap;
@@ -1958,20 +1960,12 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
1958
1960
  onClick: onClick,
1959
1961
  children: jsxs("div", {
1960
1962
  className: ATOMIX_GLASS.INNER_CLASS,
1961
- style: {
1962
- padding: "var(--atomix-glass-container-padding)",
1963
- boxShadow: "var(--atomix-glass-container-box-shadow)"
1964
- },
1965
1963
  onMouseEnter: onMouseEnter,
1966
1964
  onMouseLeave: onMouseLeave,
1967
1965
  onMouseDown: onMouseDown,
1968
1966
  onMouseUp: onMouseUp,
1969
1967
  children: [ jsxs("div", {
1970
1968
  className: ATOMIX_GLASS.FILTER_CLASS,
1971
- style: {
1972
- position: "absolute",
1973
- inset: 0
1974
- },
1975
1969
  children: [ jsx(GlassFilter, {
1976
1970
  blurAmount: blurAmount,
1977
1971
  mode: mode,
@@ -1986,26 +1980,14 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
1986
1980
  },
1987
1981
  className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
1988
1982
  style: {
1989
- filter: `url(#${filterId})`,
1990
- backdropFilter: "var(--atomix-glass-container-backdrop)",
1991
- borderRadius: "var(--atomix-glass-container-radius)"
1983
+ filter: `url(#${filterId})`
1992
1984
  }
1993
1985
  }), jsx("div", {
1994
- className: ATOMIX_GLASS.FILTER_SHADOW_CLASS,
1995
- style: {
1996
- boxShadow: "var(--atomix-glass-container-shadow)",
1997
- opacity: "var(--atomix-glass-container-shadow-opacity)",
1998
- background: "var(--atomix-glass-container-bg)",
1999
- borderRadius: "var(--atomix-glass-container-radius)"
2000
- }
1986
+ className: ATOMIX_GLASS.FILTER_SHADOW_CLASS
2001
1987
  }) ]
2002
1988
  }), jsx("div", {
2003
1989
  ref: contentRef,
2004
1990
  className: ATOMIX_GLASS.CONTENT_CLASS,
2005
- style: {
2006
- position: "relative",
2007
- textShadow: "var(--atomix-glass-container-text-shadow)"
2008
- },
2009
1991
  children: children
2010
1992
  }) ]
2011
1993
  })
@@ -2109,31 +2091,39 @@ class {
2109
2091
  saturationBoost: baseOverLightConfig.saturationBoost
2110
2092
  };
2111
2093
  // Calculate mouse influence
2112
- // Calculate elastic translation
2113
- let elasticTranslation = {
2094
+ let computedDirectionalScale = directionalScale, elasticTranslation = {
2114
2095
  x: 0,
2115
2096
  y: 0
2116
2097
  };
2117
- if (!effectiveWithoutEffects && wrapperElement) {
2098
+ // Calculate elastic translation and directional scale
2099
+ if (!effectiveWithoutEffects && wrapperElement) {
2118
2100
  const rect = wrapperElement.getBoundingClientRect(), center = calculateElementCenter(rect);
2119
- // Calculate fade in factor
2120
- let fadeInFactor = 0;
2101
+ // Mouse presence and edge distance logic
2121
2102
  if (globalMousePosition.x && globalMousePosition.y && validateGlassSize(glassSize)) {
2122
- const edgeDistanceX = Math.max(0, Math.abs(globalMousePosition.x - center.x) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(globalMousePosition.y - center.y) - glassSize.height / 2), edgeDistance = calculateDistance({
2103
+ const deltaX = globalMousePosition.x - center.x, deltaY = globalMousePosition.y - center.y, edgeDistanceX = Math.max(0, Math.abs(deltaX) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(deltaY) - glassSize.height / 2), edgeDistance = calculateDistance({
2123
2104
  x: edgeDistanceX,
2124
2105
  y: edgeDistanceY
2125
2106
  }, {
2126
2107
  x: 0,
2127
2108
  y: 0
2128
- });
2129
- fadeInFactor = edgeDistance > ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE ? 0 : 1 - edgeDistance / ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE;
2109
+ }), rawT = edgeDistance > ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE ? 0 : 1 - edgeDistance / ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE, fadeInFactor = (t => {
2110
+ const clamped = Math.max(0, Math.min(1, t));
2111
+ return clamped * clamped * (3 - 2 * clamped);
2112
+ })(rawT);
2113
+ // Directional scale
2114
+ if (elasticTranslation = {
2115
+ x: deltaX * elasticity * .1 * fadeInFactor,
2116
+ y: deltaY * elasticity * .1 * fadeInFactor
2117
+ }, !isOverLight && edgeDistance <= ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE) {
2118
+ const centerDistance = calculateDistance(globalMousePosition, center);
2119
+ if (centerDistance > 0) {
2120
+ const normalizedX = deltaX / centerDistance, normalizedY = deltaY / centerDistance, stretchIntensity = Math.min(centerDistance / 300, 1) * elasticity * rawT, scaleX = 1 + Math.abs(normalizedX) * stretchIntensity * .3 - Math.abs(normalizedY) * stretchIntensity * .15, scaleY = 1 + Math.abs(normalizedY) * stretchIntensity * .3 - Math.abs(normalizedX) * stretchIntensity * .15, softScaleX = 1 - softClamp(Math.max(0, 1 - scaleX), .2), softScaleY = 1 - softClamp(Math.max(0, 1 - scaleY), .2);
2121
+ computedDirectionalScale = `scaleX(${Math.max(.85, softScaleX)}) scaleY(${Math.max(.85, softScaleY)})`;
2122
+ }
2123
+ }
2130
2124
  }
2131
- elasticTranslation = {
2132
- x: (globalMousePosition.x - center.x) * elasticity * .1 * fadeInFactor,
2133
- y: (globalMousePosition.y - center.y) * elasticity * .1 * fadeInFactor
2134
- };
2135
2125
  }
2136
- const transformStyle = effectiveWithoutEffects ? isActive && Boolean(onClick) ? "scale(0.98)" : "scale(1)" : `translate(${elasticTranslation.x}px, ${elasticTranslation.y}px) ${isActive && Boolean(onClick) ? "scale(0.96)" : directionalScale}`;
2126
+ const transformStyle = effectiveWithoutEffects ? isActive && Boolean(onClick) ? "scale(0.98)" : "scale(1)" : `translate(${elasticTranslation.x}px, ${elasticTranslation.y}px) ${isActive && Boolean(onClick) ? "scale(0.96)" : computedDirectionalScale}`;
2137
2127
  // Update Wrapper Styles (glassVars)
2138
2128
  if (wrapperElement) {
2139
2129
  const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT, borderGradientAngle = GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER, borderStop1 = Math.max(GRADIENT.BORDER_STOP_1.MIN, GRADIENT.BORDER_STOP_1.BASE + my * GRADIENT.BORDER_STOP_1.MULTIPLIER), borderStop2 = Math.min(GRADIENT.BORDER_STOP_2.MAX, GRADIENT.BORDER_STOP_2.BASE + my * GRADIENT.BORDER_STOP_2.MULTIPLIER), borderOpacities = [ GRADIENT.BORDER_OPACITY.BASE_1 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_LOW, GRADIENT.BORDER_OPACITY.BASE_2 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_HIGH, GRADIENT.BORDER_OPACITY.BASE_3 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_LOW, GRADIENT.BORDER_OPACITY.BASE_4 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_HIGH ], configBorderOpacity = overLightConfig.borderOpacity, whiteColor = ATOMIX_GLASS.CONSTANTS.PALETTE.WHITE, blackColor = ATOMIX_GLASS.CONSTANTS.PALETTE.BLACK, hoverPositions = {
@@ -2240,7 +2230,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2240
2230
  }), internalMouseOffsetRef = useRef({
2241
2231
  x: 0,
2242
2232
  y: 0
2243
- }), [dynamicBorderRadius, setDynamicCornerRadius] = useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1), effectiveBorderRadius = useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
2233
+ }), targetMouseOffsetRef = useRef({
2234
+ x: 0,
2235
+ y: 0
2236
+ }), targetGlobalMousePositionRef = useRef({
2237
+ x: 0,
2238
+ y: 0
2239
+ }), lerpRafRef = useRef(null), lerpActiveRef = useRef(!1), [dynamicBorderRadius, setDynamicCornerRadius] = useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1), effectiveBorderRadius = useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
2244
2240
  const [glassSize, setGlassSize] = useState({
2245
2241
  width: 270,
2246
2242
  height: 69
@@ -2337,7 +2333,23 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2337
2333
  const timeoutId = setTimeout(extractRadius, 100);
2338
2334
  return () => clearTimeout(timeoutId);
2339
2335
  }), [ children, debugBorderRadius, contentRef ]),
2340
- // Media query handlers and background detection
2336
+ // Media query detection for reduced motion and high contrast
2337
+ useEffect((() => {
2338
+ if ("undefined" == typeof window || "function" != typeof window.matchMedia) return;
2339
+ const mediaQueryReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"), mediaQueryHighContrast = window.matchMedia("(prefers-contrast: high)");
2340
+ setUserPrefersReducedMotion(mediaQueryReducedMotion.matches), setUserPrefersHighContrast(mediaQueryHighContrast.matches);
2341
+ const handleReducedMotionChange = e => {
2342
+ setUserPrefersReducedMotion(e.matches);
2343
+ }, handleHighContrastChange = e => {
2344
+ setUserPrefersHighContrast(e.matches);
2345
+ };
2346
+ return mediaQueryReducedMotion.addEventListener("change", handleReducedMotionChange),
2347
+ mediaQueryHighContrast.addEventListener("change", handleHighContrastChange), () => {
2348
+ mediaQueryReducedMotion.removeEventListener("change", handleReducedMotionChange),
2349
+ mediaQueryHighContrast.removeEventListener("change", handleHighContrastChange);
2350
+ };
2351
+ }), []),
2352
+ // Background detection for overLight auto-detect
2341
2353
  useEffect((() => {
2342
2354
  if (("auto" === overLight || "object" == typeof overLight && null !== overLight) && glassRef.current) {
2343
2355
  const element = glassRef.current, cachedResult = ((parentElement, overLightConfig) => {
@@ -2437,102 +2449,36 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2437
2449
  }), 150);
2438
2450
  return () => clearTimeout(timeoutId);
2439
2451
  }
2440
- if ("boolean" == typeof overLight && setDetectedOverLight(!1), "function" == typeof window.matchMedia) try {
2441
- const mediaQueryReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"), mediaQueryHighContrast = window.matchMedia("(prefers-contrast: high)");
2442
- setUserPrefersReducedMotion(mediaQueryReducedMotion.matches), setUserPrefersHighContrast(mediaQueryHighContrast.matches);
2443
- const handleReducedMotionChange = e => {
2444
- setUserPrefersReducedMotion(e.matches);
2445
- }, handleHighContrastChange = e => {
2446
- setUserPrefersHighContrast(e.matches);
2447
- };
2448
- return mediaQueryReducedMotion.addEventListener ? (mediaQueryReducedMotion.addEventListener("change", handleReducedMotionChange),
2449
- mediaQueryHighContrast.addEventListener("change", handleHighContrastChange)) : mediaQueryReducedMotion.addListener && (mediaQueryReducedMotion.addListener(handleReducedMotionChange),
2450
- mediaQueryHighContrast.addListener(handleHighContrastChange)), () => {
2451
- // ignore
2452
- };
2453
- } catch (error) {
2454
- return;
2455
- }
2456
- }), [ overLight, glassRef, debugOverLight ]);
2452
+ "boolean" == typeof overLight && setDetectedOverLight(!1);
2453
+ }), [ overLight, glassRef ]);
2457
2454
  /**
2458
2455
  * Get effective overLight value based on configuration
2459
2456
  */
2460
- const getEffectiveOverLight = useCallback((() => "boolean" == typeof overLight ? overLight : ("auto" === overLight || "object" == typeof overLight && null !== overLight) && detectedOverLight), [ overLight, detectedOverLight ]), validateConfigValue = useCallback(((value, min, max, defaultValue) => "number" != typeof value || isNaN(value) || !isFinite(value) ? defaultValue : Math.min(max, Math.max(min, value))), []), baseOverLightConfig = useMemo((() => {
2461
- const isOverLight = getEffectiveOverLight(), baseConfig = {
2457
+ const getEffectiveOverLight = useCallback((() => "boolean" == typeof overLight ? overLight : ("auto" === overLight || "object" == typeof overLight && null !== overLight) && detectedOverLight), [ overLight, detectedOverLight ]), validateConfigValue = useCallback(((value, min, max, defaultValue) => "number" != typeof value || isNaN(value) || !isFinite(value) ? defaultValue : Math.min(max, Math.max(min, value))), []), overLightConfig = useMemo((() => {
2458
+ const isOverLight = getEffectiveOverLight(), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, baseConfig = {
2462
2459
  isOverLight: isOverLight,
2463
2460
  threshold: .7,
2464
- opacity: isOverLight ? Math.min(.6, Math.max(.2, .5)) : 0,
2465
- contrast: 1,
2466
- // Base contrast
2467
- brightness: 1,
2468
- // Base brightness
2461
+ opacity: isOverLight ? Math.min(.6, Math.max(.2, .5 * hoverIntensity * activeIntensity)) : 0,
2462
+ contrast: 1.4,
2463
+ brightness: .9,
2469
2464
  saturationBoost: 1.3,
2465
+ // Fixed value — dynamic saturation amplifies perceived displacement
2470
2466
  shadowIntensity: .9,
2471
2467
  borderOpacity: .7
2472
2468
  };
2473
2469
  if ("object" == typeof overLight && null !== overLight) {
2474
- const objConfig = overLight, validatedThreshold = validateConfigValue(objConfig.threshold, .1, 1, baseConfig.threshold), validatedOpacity = validateConfigValue(objConfig.opacity, .1, 1, baseConfig.opacity), validatedContrast = validateConfigValue(objConfig.contrast, .5, 2.5, baseConfig.contrast), validatedBrightness = validateConfigValue(objConfig.brightness, .5, 2, baseConfig.brightness), validatedSaturationBoost = validateConfigValue(objConfig.saturationBoost, .5, 3, baseConfig.saturationBoost);
2475
- return {
2470
+ const objConfig = overLight, validatedThreshold = validateConfigValue(objConfig.threshold, .1, 1, baseConfig.threshold), validatedOpacity = validateConfigValue(objConfig.opacity, .1, 1, baseConfig.opacity), validatedContrast = validateConfigValue(objConfig.contrast, .5, 2.5, baseConfig.contrast), validatedBrightness = validateConfigValue(objConfig.brightness, .5, 2, baseConfig.brightness), validatedSaturationBoost = validateConfigValue(objConfig.saturationBoost, .5, 3, baseConfig.saturationBoost), finalConfig = {
2476
2471
  ...baseConfig,
2477
2472
  threshold: validatedThreshold,
2478
- opacity: validatedOpacity,
2473
+ opacity: validatedOpacity * hoverIntensity * activeIntensity,
2479
2474
  contrast: validatedContrast,
2480
2475
  brightness: validatedBrightness,
2481
2476
  saturationBoost: validatedSaturationBoost
2482
2477
  };
2478
+ return "undefined" == typeof process || process.env, finalConfig;
2483
2479
  }
2484
- return baseConfig;
2485
- }), [ overLight, getEffectiveOverLight, validateConfigValue ]), overLightConfig = useMemo((() => {
2486
- const mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1;
2487
- return {
2488
- isOverLight: baseOverLightConfig.isOverLight,
2489
- threshold: baseOverLightConfig.threshold,
2490
- opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
2491
- contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
2492
- brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
2493
- saturationBoost: baseOverLightConfig.saturationBoost,
2494
- shadowIntensity: Math.min(1.2, Math.max(.5, baseOverLightConfig.shadowIntensity + .2 * mouseInfluence)),
2495
- borderOpacity: Math.min(1, Math.max(.3, baseOverLightConfig.borderOpacity + .1 * mouseInfluence))
2496
- };
2497
- }), [ baseOverLightConfig, mouseOffset, isHovered, isActive ]), updateRectRef = useRef(null), calculateDirectionalScale = useCallback((() => {
2498
- if (baseOverLightConfig.isOverLight) return "scale(1)";
2499
- if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return "scale(1)";
2500
- const rect = glassRef.current.getBoundingClientRect(), center = calculateElementCenter(rect), deltaX = globalMousePosition.x - center.x, deltaY = globalMousePosition.y - center.y, edgeDistanceX = Math.max(0, Math.abs(deltaX) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(deltaY) - glassSize.height / 2), edgeDistance = calculateDistance({
2501
- x: edgeDistanceX,
2502
- y: edgeDistanceY
2503
- }, {
2504
- x: 0,
2505
- y: 0
2506
- });
2507
- if (edgeDistance > CONSTANTS.ACTIVATION_ZONE) return "scale(1)";
2508
- const fadeInFactor = 1 - edgeDistance / CONSTANTS.ACTIVATION_ZONE, centerDistance = calculateDistance(globalMousePosition, center);
2509
- if (0 === centerDistance) return "scale(1)";
2510
- const normalizedX = deltaX / centerDistance, normalizedY = deltaY / centerDistance, stretchIntensity = Math.min(centerDistance / 300, 1) * elasticity * fadeInFactor, scaleX = 1 + Math.abs(normalizedX) * stretchIntensity * .3 - Math.abs(normalizedY) * stretchIntensity * .15, scaleY = 1 + Math.abs(normalizedY) * stretchIntensity * .3 - Math.abs(normalizedX) * stretchIntensity * .15;
2511
- return `scaleX(${Math.max(.8, scaleX)}) scaleY(${Math.max(.8, scaleY)})`;
2512
- }), [ globalMousePosition, elasticity, glassSize, glassRef, baseOverLightConfig ]), calculateFadeInFactor = useCallback((() => {
2513
- if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return 0;
2514
- const rect = glassRef.current.getBoundingClientRect(), center = calculateElementCenter(rect), edgeDistanceX = Math.max(0, Math.abs(globalMousePosition.x - center.x) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(globalMousePosition.y - center.y) - glassSize.height / 2), edgeDistance = calculateDistance({
2515
- x: edgeDistanceX,
2516
- y: edgeDistanceY
2517
- }, {
2518
- x: 0,
2519
- y: 0
2520
- });
2521
- return edgeDistance > CONSTANTS.ACTIVATION_ZONE ? 0 : 1 - edgeDistance / CONSTANTS.ACTIVATION_ZONE;
2522
- }), [ globalMousePosition, glassSize, glassRef ]), calculateElasticTranslation = useCallback((() => {
2523
- if (!glassRef.current) return {
2524
- x: 0,
2525
- y: 0
2526
- };
2527
- const fadeInFactor = calculateFadeInFactor(), rect = glassRef.current.getBoundingClientRect(), center = calculateElementCenter(rect);
2528
- return {
2529
- x: (globalMousePosition.x - center.x) * elasticity * .1 * fadeInFactor,
2530
- y: (globalMousePosition.y - center.y) * elasticity * .1 * fadeInFactor
2531
- };
2532
- }), [ globalMousePosition, elasticity, calculateFadeInFactor, glassRef ]), elasticTranslation = useMemo((() => effectiveWithoutEffects ? {
2533
- x: 0,
2534
- y: 0
2535
- } : calculateElasticTranslation()), [ calculateElasticTranslation, effectiveWithoutEffects ]), directionalScale = useMemo((() => effectiveWithoutEffects ? "scale(1)" : calculateDirectionalScale()), [ calculateDirectionalScale, effectiveWithoutEffects ]), transformStyle = useMemo((() => effectiveWithoutEffects ? isActive && Boolean(onClick) ? "scale(0.98)" : "scale(1)" : `translate(${elasticTranslation.x}px, ${elasticTranslation.y}px) ${isActive && Boolean(onClick) ? "scale(0.96)" : directionalScale}`), [ elasticTranslation, isActive, onClick, directionalScale, effectiveWithoutEffects ]), handleGlobalMousePosition = useCallback((globalPos => {
2480
+ return "undefined" == typeof process || process.env, baseConfig;
2481
+ }), [ overLight, getEffectiveOverLight, isHovered, isActive, validateConfigValue, debugOverLight ]), transformStyle = useMemo((() => effectiveWithoutEffects || isActive && Boolean(onClick) ? "scale(0.98)" : "scale(1)"), [ effectiveWithoutEffects, isActive, onClick ]), updateRectRef = useRef(null), handleGlobalMousePosition = useCallback((globalPos => {
2536
2482
  if (externalGlobalMousePosition && externalMouseOffset) return;
2537
2483
  if (effectiveWithoutEffects) return;
2538
2484
  const container = mouseContainer?.current || glassRef.current;
@@ -2541,35 +2487,61 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2541
2487
  let rect = cachedRectRef.current;
2542
2488
  if (rect && 0 !== rect.width && 0 !== rect.height || (rect = container.getBoundingClientRect(),
2543
2489
  cachedRectRef.current = rect), 0 === rect.width || 0 === rect.height) return;
2544
- const center = calculateElementCenter(rect), newOffset = {
2490
+ const center = calculateElementCenter(rect);
2491
+ // Write raw target — the lerp loop will smoothly pursue it
2492
+ targetMouseOffsetRef.current = {
2545
2493
  x: (globalPos.x - center.x) / rect.width * 100,
2546
2494
  y: (globalPos.y - center.y) / rect.height * 100
2495
+ }, targetGlobalMousePositionRef.current = globalPos;
2496
+ }), [ mouseContainer, glassRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects ]), startLerpLoop = useCallback((() => {
2497
+ if (lerpActiveRef.current) return;
2498
+ lerpActiveRef.current = !0;
2499
+ const LERP_T = CONSTANTS.LERP_FACTOR, tick = () => {
2500
+ if (!lerpActiveRef.current) return;
2501
+ const cur = internalMouseOffsetRef.current, tgt = targetMouseOffsetRef.current, dx = tgt.x - cur.x, dy = tgt.y - cur.y;
2502
+ // If we're close enough, snap and park
2503
+ if (Math.abs(dx) < .05 && Math.abs(dy) < .05) internalMouseOffsetRef.current = {
2504
+ ...tgt
2505
+ }, internalGlobalMousePositionRef.current = {
2506
+ ...targetGlobalMousePositionRef.current
2507
+ }; else {
2508
+ internalMouseOffsetRef.current = {
2509
+ x: lerp(cur.x, tgt.x, LERP_T),
2510
+ y: lerp(cur.y, tgt.y, LERP_T)
2511
+ };
2512
+ const curG = internalGlobalMousePositionRef.current, tgtG = targetGlobalMousePositionRef.current;
2513
+ internalGlobalMousePositionRef.current = {
2514
+ x: lerp(curG.x, tgtG.x, LERP_T),
2515
+ y: lerp(curG.y, tgtG.y, LERP_T)
2516
+ };
2517
+ }
2518
+ // Imperative style update with the smoothed values
2519
+ updateAtomixGlassStyles(wrapperRef?.current || null, glassRef.current, {
2520
+ mouseOffset: internalMouseOffsetRef.current,
2521
+ globalMousePosition: internalGlobalMousePositionRef.current,
2522
+ glassSize: glassSize,
2523
+ isHovered: isHovered,
2524
+ isActive: isActive,
2525
+ isOverLight: overLightConfig.isOverLight,
2526
+ baseOverLightConfig: overLightConfig,
2527
+ effectiveBorderRadius: effectiveBorderRadius,
2528
+ effectiveWithoutEffects: effectiveWithoutEffects,
2529
+ effectiveReducedMotion: effectiveReducedMotion,
2530
+ elasticity: elasticity,
2531
+ directionalScale: isActive && Boolean(onClick) ? "scale(0.96)" : "scale(1)",
2532
+ onClick: onClick,
2533
+ withLiquidBlur: withLiquidBlur,
2534
+ blurAmount: blurAmount,
2535
+ saturation: saturation,
2536
+ padding: padding
2537
+ }), lerpRafRef.current = requestAnimationFrame(tick);
2547
2538
  };
2548
- // Calculate offset relative to this container
2549
- // Store in refs instead of state
2550
- internalMouseOffsetRef.current = newOffset, internalGlobalMousePositionRef.current = globalPos,
2551
- // Imperative style update
2552
- updateAtomixGlassStyles(wrapperRef?.current || null, glassRef.current, {
2553
- mouseOffset: newOffset,
2554
- globalMousePosition: globalPos,
2555
- glassSize: glassSize,
2556
- isHovered: isHovered,
2557
- isActive: isActive,
2558
- isOverLight: baseOverLightConfig.isOverLight,
2559
- baseOverLightConfig: baseOverLightConfig,
2560
- effectiveBorderRadius: effectiveBorderRadius,
2561
- effectiveWithoutEffects: effectiveWithoutEffects,
2562
- effectiveReducedMotion: effectiveReducedMotion,
2563
- elasticity: elasticity,
2564
- directionalScale: isActive && Boolean(onClick) ? "scale(0.96)" : "scale(1)",
2565
- // Simplified directional scale for fast path
2566
- onClick: onClick,
2567
- withLiquidBlur: withLiquidBlur,
2568
- blurAmount: blurAmount,
2569
- saturation: saturation,
2570
- padding: padding
2571
- });
2572
- }), [ mouseContainer, glassRef, wrapperRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects, glassSize, isHovered, isActive, baseOverLightConfig, effectiveBorderRadius, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]);
2539
+ // 0.08 lower = more viscous
2540
+ lerpRafRef.current = requestAnimationFrame(tick);
2541
+ }), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]), stopLerpLoop = useCallback((() => {
2542
+ lerpActiveRef.current = !1, null !== lerpRafRef.current && (cancelAnimationFrame(lerpRafRef.current),
2543
+ lerpRafRef.current = null);
2544
+ }), []);
2573
2545
  /**
2574
2546
  * Validate and clamp a numeric config value
2575
2547
  */
@@ -2577,7 +2549,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2577
2549
  useEffect((() => {
2578
2550
  if (externalGlobalMousePosition && externalMouseOffset) return;
2579
2551
  if (effectiveWithoutEffects) return;
2580
- const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition), container = mouseContainer?.current || glassRef.current;
2552
+ const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition);
2553
+ // Start the lerp loop — it will smoothly chase the target
2554
+ startLerpLoop();
2555
+ const container = mouseContainer?.current || glassRef.current;
2581
2556
  let resizeObserver = null;
2582
2557
  return container && "undefined" != typeof ResizeObserver && (resizeObserver = new ResizeObserver((() => {
2583
2558
  null !== updateRectRef.current && cancelAnimationFrame(updateRectRef.current), updateRectRef.current = requestAnimationFrame((() => {
@@ -2585,10 +2560,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2585
2560
  container && (cachedRectRef.current = container.getBoundingClientRect()), updateRectRef.current = null;
2586
2561
  }));
2587
2562
  })), resizeObserver.observe(container)), () => {
2588
- unsubscribe(), null !== updateRectRef.current && (cancelAnimationFrame(updateRectRef.current),
2563
+ unsubscribe(), stopLerpLoop(), null !== updateRectRef.current && (cancelAnimationFrame(updateRectRef.current),
2589
2564
  updateRectRef.current = null), resizeObserver && resizeObserver.disconnect();
2590
2565
  };
2591
- }), [ handleGlobalMousePosition, mouseContainer, glassRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects ]),
2566
+ }), [ handleGlobalMousePosition, startLerpLoop, stopLerpLoop, mouseContainer, glassRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects ]),
2592
2567
  // Also call updateStyles on other state changes (hover, active, etc)
2593
2568
  useEffect((() => {
2594
2569
  updateAtomixGlassStyles(wrapperRef?.current || null, glassRef.current, {
@@ -2597,22 +2572,22 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2597
2572
  glassSize: glassSize,
2598
2573
  isHovered: isHovered,
2599
2574
  isActive: isActive,
2600
- isOverLight: baseOverLightConfig.isOverLight,
2601
- baseOverLightConfig: baseOverLightConfig,
2575
+ isOverLight: overLightConfig.isOverLight,
2576
+ baseOverLightConfig: overLightConfig,
2602
2577
  effectiveBorderRadius: effectiveBorderRadius,
2603
2578
  effectiveWithoutEffects: effectiveWithoutEffects,
2604
2579
  effectiveReducedMotion: effectiveReducedMotion,
2605
2580
  elasticity: elasticity,
2606
- directionalScale: directionalScale,
2581
+ directionalScale: isActive && Boolean(onClick) ? "scale(0.96)" : "scale(1)",
2607
2582
  onClick: onClick,
2608
2583
  withLiquidBlur: withLiquidBlur,
2609
2584
  blurAmount: blurAmount,
2610
2585
  saturation: saturation,
2611
2586
  padding: padding
2612
2587
  });
2613
- }), [ isHovered, isActive, glassSize, baseOverLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, directionalScale, wrapperRef, glassRef, externalMouseOffset, externalGlobalMousePosition, withLiquidBlur, blurAmount, saturation, padding, onClick ]);
2588
+ }), [ isHovered, isActive, glassSize, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, wrapperRef, glassRef, externalMouseOffset, externalGlobalMousePosition, withLiquidBlur, blurAmount, saturation, padding, onClick ]);
2614
2589
  // Event handlers
2615
- const handleMouseEnter = useCallback((() => setIsHovered(!0)), []), handleMouseLeave = useCallback((() => setIsHovered(!1)), []), handleMouseDown = useCallback((() => setIsActive(!0)), []), handleMouseUp = useCallback((() => setIsActive(!1)), []), handleMouseMove = useCallback((_e => {}), []), handleKeyDown = useCallback((e => {
2590
+ const handleMouseEnter = useCallback((() => setIsHovered(!0)), []), handleMouseLeave = useCallback((() => setIsHovered(!1)), []), handleMouseDown = useCallback((() => setIsActive(!0)), []), handleMouseUp = useCallback((() => setIsActive(!1)), []), handleKeyDown = useCallback((e => {
2616
2591
  !onClick || "Enter" !== e.key && " " !== e.key || (e.preventDefault(), onClick());
2617
2592
  }), [ onClick ]);
2618
2593
  return {
@@ -2630,14 +2605,11 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2630
2605
  mouseOffset: mouseOffset,
2631
2606
  // This is now static (refs or props) unless prop changes
2632
2607
  overLightConfig: overLightConfig,
2633
- elasticTranslation: elasticTranslation,
2634
- directionalScale: directionalScale,
2635
2608
  transformStyle: transformStyle,
2636
2609
  handleMouseEnter: handleMouseEnter,
2637
2610
  handleMouseLeave: handleMouseLeave,
2638
2611
  handleMouseDown: handleMouseDown,
2639
2612
  handleMouseUp: handleMouseUp,
2640
- handleMouseMove: handleMouseMove,
2641
2613
  handleKeyDown: handleKeyDown
2642
2614
  };
2643
2615
  }
@@ -2735,25 +2707,56 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2735
2707
  withLiquidBlur: withLiquidBlur,
2736
2708
  padding: padding,
2737
2709
  style: style
2738
- }), isOverLight = useMemo((() => overLightConfig?.isOverLight), [ overLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, baseStyle = {
2739
- ...style,
2740
- ...!effectiveWithoutEffects && {
2741
- transform: transformStyle
2710
+ }), isOverLight = useMemo((() => overLightConfig.isOverLight), [ overLightConfig.isOverLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, {zIndex: customZIndex, ...restStyle} = style, isFixedOrSticky = "fixed" === restStyle.position || "sticky" === restStyle.position, rootLayoutStyle = useMemo((() => {
2711
+ if (!isFixedOrSticky) return {};
2712
+ const {position: p, top: t, left: l, right: r, bottom: b} = restStyle;
2713
+ return {
2714
+ ...p && {
2715
+ position: p
2716
+ },
2717
+ ...void 0 !== t && {
2718
+ top: t
2719
+ },
2720
+ ...void 0 !== l && {
2721
+ left: l
2722
+ },
2723
+ ...void 0 !== r && {
2724
+ right: r
2725
+ },
2726
+ ...void 0 !== b && {
2727
+ bottom: b
2728
+ }
2729
+ };
2730
+ }), [ isFixedOrSticky, restStyle ]), baseStyle = useMemo((() => {
2731
+ if (isFixedOrSticky) {
2732
+ const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
2733
+ return {
2734
+ ...visualStyle,
2735
+ ...!effectiveWithoutEffects && {
2736
+ transform: transformStyle
2737
+ }
2738
+ };
2742
2739
  }
2743
- }, componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`, effectiveWithoutEffects && `${ATOMIX_GLASS.BASE_CLASS}--disabled-effects`, className ].filter(Boolean).join(" "), positionStyles = useMemo((() => ({
2744
- position: style.position || "absolute",
2745
- top: style.top || 0,
2746
- left: style.left || 0
2747
- })), [ style.position, style.top, style.left ]), adjustedSize = useMemo((() => {
2740
+ return {
2741
+ ...restStyle,
2742
+ ...!effectiveWithoutEffects && {
2743
+ transform: transformStyle
2744
+ }
2745
+ };
2746
+ }), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ]), componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`, effectiveWithoutEffects && `${ATOMIX_GLASS.BASE_CLASS}--disabled-effects`, className ].filter(Boolean).join(" "), positionStyles = useMemo((() => ({
2747
+ position: isFixedOrSticky ? "absolute" : restStyle.position || "absolute",
2748
+ top: isFixedOrSticky ? 0 : restStyle.top || 0,
2749
+ left: isFixedOrSticky ? 0 : restStyle.left || 0
2750
+ })), [ isFixedOrSticky, restStyle.position, restStyle.top, restStyle.left ]), adjustedSize = useMemo((() => {
2748
2751
  const resolveSize = (propValue, styleValue, measuredSize) => {
2749
2752
  const explicitSize = propValue ?? styleValue;
2750
2753
  return void 0 !== explicitSize ? "number" == typeof explicitSize ? `${explicitSize}px` : explicitSize : "fixed" === positionStyles.position ? `${Math.max(measuredSize, 0)}px` : "100%";
2751
2754
  };
2752
2755
  return {
2753
- width: resolveSize(width, style.width, glassSize.width),
2754
- height: resolveSize(height, style.height, glassSize.height)
2756
+ width: resolveSize(width, restStyle.width, glassSize.width),
2757
+ height: resolveSize(height, restStyle.height, glassSize.height)
2755
2758
  };
2756
- }), [ width, height, style.width, style.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
2759
+ }), [ width, height, restStyle.width, restStyle.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
2757
2760
  const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
2758
2761
  return {
2759
2762
  borderGradientAngle: GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER,
@@ -2795,6 +2798,9 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2795
2798
  }), [ isHovered, isActive, isOverLight, overLightConfig.opacity ]), glassVars = useMemo((() => {
2796
2799
  const whiteColor = ATOMIX_GLASS.CONSTANTS.PALETTE.WHITE, blackColor = ATOMIX_GLASS.CONSTANTS.PALETTE.BLACK, {borderGradientAngle: borderGradientAngle, borderStop1: borderStop1, borderStop2: borderStop2, borderOpacities: borderOpacities, hoverPositions: hoverPositions, basePosition: basePosition, mx: mx, my: my, absMx: absMx, absMy: absMy} = gradientValues, configBorderOpacity = overLightConfig?.borderOpacity ?? 1;
2797
2800
  return {
2801
+ ...void 0 !== customZIndex && {
2802
+ "--atomix-glass-base-z-index": customZIndex
2803
+ },
2798
2804
  "--atomix-glass-radius": `${effectiveBorderRadius}px`,
2799
2805
  "--atomix-glass-transform": transformStyle || "none",
2800
2806
  "--atomix-glass-position": positionStyles.position,
@@ -2815,22 +2821,19 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2815
2821
  "--atomix-glass-base-opacity": opacityValues.base,
2816
2822
  "--atomix-glass-base-gradient": isOverLight ? `linear-gradient(${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.ANGLE}deg, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_START_BASE + mx * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_START_MULTIPLIER}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_BASE + my * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_MULTIPLIER}) ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_STOP}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_END_BASE + absMx * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_END_MULTIPLIER}) 100%)` : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.WHITE_OPACITY})`,
2817
2823
  "--atomix-glass-overlay-opacity": opacityValues.over,
2818
- "--atomix-glass-overlay-gradient": isOverLight ? `radial-gradient(circle at ${basePosition.x}% ${basePosition.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_BASE + absMx * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_MULTIPLIER}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID_STOP}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_BASE + absMy * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_MULTIPLIER}) 100%)` : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.WHITE_OPACITY})`
2824
+ "--atomix-glass-overlay-gradient": isOverLight ? `radial-gradient(circle at ${basePosition.x}% ${basePosition.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_BASE + absMx * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_MULTIPLIER}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID_STOP}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_BASE + absMy * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_MULTIPLIER}) 100%)` : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.WHITE_OPACITY})`,
2825
+ "--atomix-glass-overlay-highlight-opacity": opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
2826
+ "--atomix-glass-overlay-highlight-bg": `radial-gradient(circle at ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_X}% ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_Y}%, rgba(255, 255, 255, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.WHITE_OPACITY}) 0%, transparent ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.STOP}%)`
2819
2827
  };
2820
- }), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, positionStyles, adjustedSize, isOverLight, overLightConfig.borderOpacity ]), renderBackgroundLayer = layerType => jsx("div", {
2821
- className: [ ATOMIX_GLASS.BACKGROUND_LAYER_CLASS, "dark" === layerType ? ATOMIX_GLASS.BACKGROUND_LAYER_DARK_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_BLACK_CLASS, isOverLight ? ATOMIX_GLASS.BACKGROUND_LAYER_OVER_LIGHT_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_HIDDEN_CLASS ].filter(Boolean).join(" "),
2822
- style: {
2823
- ...positionStyles,
2824
- height: adjustedSize.height,
2825
- width: adjustedSize.width,
2826
- borderRadius: `${effectiveBorderRadius}px`,
2827
- transform: baseStyle.transform
2828
- }
2828
+ }), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, positionStyles, adjustedSize, isOverLight, overLightConfig.borderOpacity, customZIndex ]), renderBackgroundLayer = layerType => jsx("div", {
2829
+ className: [ ATOMIX_GLASS.BACKGROUND_LAYER_CLASS, "dark" === layerType ? ATOMIX_GLASS.BACKGROUND_LAYER_DARK_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_BLACK_CLASS, isOverLight ? ATOMIX_GLASS.BACKGROUND_LAYER_OVER_LIGHT_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_HIDDEN_CLASS ].filter(Boolean).join(" ")
2829
2830
  });
2830
2831
  return jsxs("div", {
2831
2832
  ...rest,
2832
2833
  className: componentClassName,
2833
- style: glassVars,
2834
+ style: {
2835
+ ...glassVars
2836
+ },
2834
2837
  role: role || (onClick ? "button" : void 0),
2835
2838
  tabIndex: onClick ? tabIndex ?? 0 : tabIndex,
2836
2839
  "aria-label": ariaLabel,
@@ -2842,7 +2845,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2842
2845
  ref: glassRef,
2843
2846
  contentRef: contentRef,
2844
2847
  className: className,
2845
- style: baseStyle,
2848
+ style: rootLayoutStyle,
2846
2849
  borderRadius: effectiveBorderRadius,
2847
2850
  displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
2848
2851
  blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
@@ -2893,11 +2896,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
2893
2896
  }), jsx("div", {
2894
2897
  className: ATOMIX_GLASS.OVERLAY_LAYER_CLASS
2895
2898
  }), jsx("div", {
2896
- className: ATOMIX_GLASS.OVERLAY_HIGHLIGHT_CLASS,
2897
- style: {
2898
- opacity: opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
2899
- background: `radial-gradient(circle at ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_X}% ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_Y}%, rgba(255, 255, 255, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.WHITE_OPACITY}) 0%, transparent ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.STOP}%)`
2900
- }
2899
+ className: ATOMIX_GLASS.OVERLAY_HIGHLIGHT_CLASS
2901
2900
  }) ]
2902
2901
  }), withBorder && jsxs(Fragment, {
2903
2902
  children: [ jsx("span", {