@shohojdhara/atomix 0.6.5 → 0.6.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 (39) hide show
  1. package/dist/atomix.css +2 -2
  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/atomix.umd.js +1 -1
  6. package/dist/atomix.umd.js.map +1 -1
  7. package/dist/atomix.umd.min.js +1 -1
  8. package/dist/charts.js +65 -255
  9. package/dist/charts.js.map +1 -1
  10. package/dist/core.js +65 -255
  11. package/dist/core.js.map +1 -1
  12. package/dist/forms.js +65 -255
  13. package/dist/forms.js.map +1 -1
  14. package/dist/heavy.js +65 -255
  15. package/dist/heavy.js.map +1 -1
  16. package/dist/index.d.ts +6 -37
  17. package/dist/index.esm.js +66 -300
  18. package/dist/index.esm.js.map +1 -1
  19. package/dist/index.js +66 -300
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.min.js +1 -1
  22. package/dist/index.min.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/components/AtomixGlass/AtomixGlass.tsx +0 -9
  25. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +0 -2
  26. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +1 -1
  27. package/src/components/AtomixGlass/glass-utils.ts +82 -53
  28. package/src/components/AtomixGlass/shader-utils.ts +19 -77
  29. package/src/components/Form/Select.test.tsx +6 -6
  30. package/src/components/Form/Textarea.stories.tsx +5 -5
  31. package/src/lib/composables/useAtomixGlass.ts +2 -134
  32. package/src/lib/composables/useAtomixGlassStyles.ts +3 -3
  33. package/src/lib/composables/usePerformanceMonitor.ts +0 -66
  34. package/src/lib/constants/components.ts +6 -1
  35. package/src/styles/01-settings/_settings.atomix-glass.scss +2 -2
  36. package/src/styles/02-tools/_tools.button.scss +51 -42
  37. package/src/styles/06-components/_components.atomix-glass.scss +2 -2
  38. package/src/components/AtomixGlass/PerformanceDashboard.tsx +0 -171
  39. package/src/components/AtomixGlass/animation-system.ts +0 -578
package/dist/index.js CHANGED
@@ -2064,6 +2064,11 @@ const THEME_COLORS = [ "primary", "secondary", "success", "info", "warning", "er
2064
2064
  MIN_BLUR: .1,
2065
2065
  MOUSE_INFLUENCE_DIVISOR: 100,
2066
2066
  EDGE_FADE_PIXELS: 2,
2067
+ // Interaction intensity multipliers shared by the hook and the imperative style updater
2068
+ INTERACTION: {
2069
+ HOVER_INTENSITY: 1.4,
2070
+ ACTIVE_INTENSITY: 1.6
2071
+ },
2067
2072
  // Elasticity physics constants — Apple-tuned: soft springs, fast settling, minimal stretch
2068
2073
  ELASTICITY_TRANSLATION_FACTOR: .06,
2069
2074
  // Subtler elastic shift (was 0.1)
@@ -2261,7 +2266,7 @@ const THEME_COLORS = [ "primary", "secondary", "success", "info", "warning", "er
2261
2266
  },
2262
2267
  // Container shadows — hairline inner catch + soft floating lift (Apple player bar)
2263
2268
  CONTAINER_SHADOW: {
2264
- LIGHT: "inset 0 0.5px 0 rgba(255, 255, 255, 0.32), inset 0 1px 2px rgba(255, 255, 255, 0.06), 0 8px 32px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.16)"
2269
+ LIGHT: "inset 0 0.5px 0 rgba(255, 255, 255, 0.32), inset 0 1px 2px rgba(255, 255, 255, 0.06), 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08)"
2265
2270
  },
2266
2271
  // Phase 1: Animation System Constants
2267
2272
  ANIMATION: {
@@ -2710,7 +2715,28 @@ const {CONSTANTS: CONSTANTS$3} = ATOMIX_GLASS, calculateElementCenter = rect =>
2710
2715
  }, smoothstep = t => {
2711
2716
  const clamped = Math.max(0, Math.min(1, t));
2712
2717
  return clamped * clamped * (3 - 2 * clamped);
2713
- }, lerp$1 = (a, b, t) => a + (b - a) * t, softClamp = (value, max) => max <= 0 ? 0 : max * (1 - Math.exp(-value / max)), calculateSpring = (current, target, velocity, stiffness = .1, damping = .8) => {
2718
+ }, lerp = (a, b, t) => a + (b - a) * t, softClamp = (value, max) => max <= 0 ? 0 : max * (1 - Math.exp(-value / max)), clamp = (value, min, max) => "number" != typeof value || isNaN(value) ? min : Math.max(min, Math.min(max, value)), smoothstepEdge = (edge0, edge1, x) => "number" != typeof edge0 || "number" != typeof edge1 || "number" != typeof x ? 0 : smoothstep((x - edge0) / (edge1 - edge0)), easeInOutCubic = t => {
2719
+ if ("number" != typeof t || isNaN(t)) return 0;
2720
+ const clamped = Math.max(0, Math.min(1, t));
2721
+ return clamped < .5 ? 4 * clamped * clamped * clamped : 1 - Math.pow(-2 * clamped + 2, 3) / 2;
2722
+ }, easeOutQuart = t => {
2723
+ if ("number" != typeof t || isNaN(t)) return 0;
2724
+ const clamped = Math.max(0, Math.min(1, t));
2725
+ return 1 - Math.pow(1 - clamped, 4);
2726
+ }, vec2Length = (x, y) => {
2727
+ if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y)) return 0;
2728
+ const maxComponent = Math.max(Math.abs(x), Math.abs(y));
2729
+ if (0 === maxComponent) return 0;
2730
+ const scaledX = x / maxComponent, scaledY = y / maxComponent;
2731
+ return maxComponent * Math.sqrt(scaledX * scaledX + scaledY * scaledY);
2732
+ }, getInteractionIntensity = (isHovered, isActive) => ({
2733
+ hoverIntensity: isHovered ? CONSTANTS$3.INTERACTION.HOVER_INTENSITY : 1,
2734
+ activeIntensity: isActive ? CONSTANTS$3.INTERACTION.ACTIVE_INTENSITY : 1
2735
+ })
2736
+ /**
2737
+ * Spring-damper integration helper
2738
+ * Calculates the next value based on velocity, stiffness, and damping.
2739
+ */ , calculateSpring = (current, target, velocity, stiffness = .1, damping = .8) => {
2714
2740
  const newVelocity = (velocity + (target - current) * stiffness) * damping;
2715
2741
  return {
2716
2742
  value: current + newVelocity,
@@ -2916,7 +2942,7 @@ const GlassFilter = React.memo(GlassFilterComponent, ((prevProps, nextProps) =>
2916
2942
  }, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, borderRadius: borderRadius = 0, glassSize: glassSize = {
2917
2943
  width: 0,
2918
2944
  height: 0
2919
- }, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, isFixedOrSticky: isFixedOrSticky = !1, shaderTime: shaderTime, withTimeAnimation: withTimeAnimation = !1, animationSpeed: animationSpeed = 1, withMultiLayerDistortion: withMultiLayerDistortion = !1, distortionOctaves: distortionOctaves = 3, distortionLacunarity: distortionLacunarity = 2, distortionGain: distortionGain = .5, distortionQuality: distortionQuality = "medium", contentRef: contentRef}, ref) => {
2945
+ }, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, isFixedOrSticky: isFixedOrSticky = !1, withTimeAnimation: withTimeAnimation = !1, animationSpeed: animationSpeed = 1, withMultiLayerDistortion: withMultiLayerDistortion = !1, distortionOctaves: distortionOctaves = 3, distortionLacunarity: distortionLacunarity = 2, distortionGain: distortionGain = .5, distortionQuality: distortionQuality = "medium", contentRef: contentRef}, ref) => {
2920
2946
  // React 18 useId — stable, unique, and SSR-safe (no module-level counter)
2921
2947
  const rawId = React.useId(), filterId = React.useMemo((() => `atomix-glass-filter-${rawId.replace(/:/g, "")}`), [ rawId ]), containerRef = useForkRef(ref, null), [shaderMapUrl, setShaderMapUrl] = React.useState(""), shaderGeneratorRef = React.useRef(null), shaderUtilsRef = React.useRef(null), shaderDebounceTimeoutRef = React.useRef(null), shaderUpdateTimeoutRef = React.useRef(null), animationFrameRef = React.useRef(null);
2922
2948
  // Lazy load shader utilities only when shader mode is needed
@@ -3216,7 +3242,7 @@ class {
3216
3242
  }, {BORDER: BORDER, CONSTANTS: CONSTANTS$2} = ATOMIX_GLASS, BORDER_GRADIENT = BORDER.GRADIENT, WHITE = CONSTANTS$2.PALETTE.WHITE, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
3217
3243
  if (!wrapperElement && !containerElement) return;
3218
3244
  if (!validateGlassSize(params.glassSize)) return;
3219
- const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, elasticTranslation: elasticTranslation, elasticVelocity: elasticVelocity, mouseVelocity: mouseVelocity, directionalScale: directionalScale, scaleBase: scaleBase, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, isFixedOrSticky: isFixedOrSticky = !1, borderAnimated: borderAnimated = !0, borderOpacityMultiplier: borderOpacityMultiplier = 1} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, overLightConfig = {
3245
+ const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, elasticTranslation: elasticTranslation, elasticVelocity: elasticVelocity, mouseVelocity: mouseVelocity, directionalScale: directionalScale, scaleBase: scaleBase, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, isFixedOrSticky: isFixedOrSticky = !1, borderAnimated: borderAnimated = !0, borderOpacityMultiplier: borderOpacityMultiplier = 1} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), {hoverIntensity: hoverIntensity, activeIntensity: activeIntensity} = getInteractionIntensity(isHovered, isActive), overLightConfig = {
3220
3246
  opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
3221
3247
  contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
3222
3248
  brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
@@ -3347,140 +3373,9 @@ class {
3347
3373
  style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
3348
3374
  style.setProperty("--atomix-glass-container-bg", isOverLight ? `linear-gradient(${180 + .5 * mx}deg, rgba(255, 255, 255, 0.1) 0%, transparent 20%, transparent 80%, rgba(0, 0, 0, 0.05) 100%)` : "none"),
3349
3375
  style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 1px 2px rgba(255, 255, 255, 0.15)" : "0px 2px 12px rgba(0, 0, 0, 0.4)"),
3350
- style.setProperty("--atomix-glass-container-box-shadow", isOverLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0 8px 32px rgba(0, 0, 0, 0.32), 0 2px 8px rgba(0, 0, 0, 0.18)");
3376
+ style.setProperty("--atomix-glass-container-box-shadow", isOverLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0 4px 16px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.10)");
3351
3377
  }
3352
- };
3353
-
3354
- /**
3355
- * Animation System for AtomixGlass Component
3356
- *
3357
- * Implements Phase 1 features from the AtomixGlass Feature Implementation Roadmap:
3358
- * - Feature 1.1: Time-Based Animation System
3359
- * - Feature 1.2: Multi-Layer Distortion System (FBM)
3360
- *
3361
- * @packageDocumentation
3362
- */
3363
- // ============================================================================
3364
- // Noise Functions for FBM (Feature 1.2)
3365
- // ============================================================================
3366
- /**
3367
- * Perlin noise implementation for smooth gradient noise
3368
- *
3369
- * @param x - X coordinate
3370
- * @param y - Y coordinate
3371
- * @returns Noise value in range [0, 1]
3372
- */
3373
- function perlinNoise(x, y) {
3374
- // Simplified Perlin noise using pseudo-random gradients
3375
- const X = 255 & Math.floor(x), Y = 255 & Math.floor(y), xf = x - Math.floor(x), yf = y - Math.floor(y), u = fade(xf), v = fade(yf), A = p[X] + Y & 255, B = p[X + 1] + Y & 255, ga = grad(p[A], xf, yf), gb = grad(p[B], xf - 1, yf), gc = grad(p[A + 1 & 255], xf, yf - 1), gd = grad(p[B + 1 & 255], xf - 1, yf - 1), lerpX1 = lerp(ga, gb, u), lerpX2 = lerp(gc, gd, u);
3376
- // Scale to [0, 1] range
3377
- return (lerp(lerpX1, lerpX2, v) + 1) / 2;
3378
- }
3379
-
3380
- // ============================================================================
3381
- // Fractal Brownian Motion (FBM) Engine (Feature 1.2)
3382
- // ============================================================================
3383
- /**
3384
- * Creates an FBM engine with configurable parameters
3385
- *
3386
- * @param config - FBM configuration (octaves, lacunarity, gain)
3387
- * @returns Object with fbm function
3388
- *
3389
- * @example
3390
- * ```typescript
3391
- * const fbmEngine = createFBMEngine({ octaves: 5, lacunarity: 2, gain: 0.5 });
3392
- *
3393
- * // Generate noise at position (0.5, 0.5) with time animation
3394
- * const noiseValue = fbmEngine.fbm(0.5, 0.5, Date.now());
3395
- * ```
3396
- */ function createFBMEngine(config) {
3397
- /**
3398
- * Fractal Brownian Motion function
3399
- * Combines multiple octaves of noise for complex, natural patterns
3400
- *
3401
- * @param x - X coordinate
3402
- * @param y - Y coordinate
3403
- * @param time - Optional time value for animation
3404
- * @returns FBM noise value in range [0, 1]
3405
- */
3406
- const fbm = (x, y, time = 0) => {
3407
- let value = 0, amplitude = .5, frequency = 1, phase = .001 * time;
3408
- // Convert to seconds for reasonable animation speed
3409
- for (let i = 0; i < config.octaves; i++)
3410
- // Apply time-based phase shift to all octaves
3411
- value += perlinNoise(x * frequency + phase, y * frequency + phase) * amplitude,
3412
- frequency *= config.lacunarity, // Increase frequency
3413
- amplitude *= config.gain;
3414
- return value;
3415
- };
3416
- /**
3417
- * Get FBM with simple time factor
3418
- */ return {
3419
- fbm: fbm,
3420
- fbmWithTime: (x, y, time) => fbm(x, y, time)
3421
- };
3422
- }
3423
-
3424
- /**
3425
- * Gets optimal FBM config based on quality preset
3426
- *
3427
- * @param quality - Quality preset level
3428
- * @returns FBM configuration for the quality level
3429
- */ const fbmEngineCache = new Map;
3430
-
3431
- // ============================================================================
3432
- // Shader Utility Functions for Time-Based Effects
3433
- // ============================================================================
3434
- /**
3435
- * Liquid glass distortion with time-based animation
3436
- * Uses FBM to create organic, flowing liquid effects
3437
- *
3438
- * @param uv - UV coordinates (normalized 0-1)
3439
- * @param time - Elapsed time in milliseconds
3440
- * @param config - FBM configuration
3441
- * @returns Distorted UV coordinates
3442
- */ function liquidGlassWithTime(uv, time, config) {
3443
- const configKey = `${config.octaves}-${config.lacunarity}-${config.gain}`;
3444
- let fbmEngine = fbmEngineCache.get(configKey);
3445
- fbmEngine || (fbmEngine = createFBMEngine(config), fbmEngineCache.set(configKey, fbmEngine));
3446
- // Animate noise with time
3447
- const animatedNoise = fbmEngine.fbmWithTime(2 * uv.x + 1e-4 * time, 2 * uv.y + 15e-5 * time, time);
3448
- return {
3449
- x: uv.x + .04 * (animatedNoise - .5),
3450
- y: uv.y + .04 * (animatedNoise - .5)
3451
- };
3452
- }
3453
-
3454
- // ============================================================================
3455
- // Helper Functions
3456
- // ============================================================================
3457
- /**
3458
- * Fade curve for smooth interpolation (Perlin's fade function)
3459
- */ function fade(t) {
3460
- return t * t * t * (t * (6 * t - 15) + 10);
3461
- }
3462
-
3463
- /**
3464
- * Linear interpolation
3465
- */ function lerp(a, b, t) {
3466
- return a + t * (b - a);
3467
- }
3468
-
3469
- /**
3470
- * Gradient calculation for Perlin noise
3471
- */ function grad(hash, x, y) {
3472
- const h = 15 & hash, u = h < 8 ? x : y, v = h < 4 ? y : 12 === h || 14 === h ? x : 0;
3473
- return (1 & h ? -u : u) + (2 & h ? -v : v);
3474
- }
3475
-
3476
- /**
3477
- * Permutation table for Perlin noise
3478
- */ const p = (() => {
3479
- const permutation = [];
3480
- for (let i = 0; i < 256; i++) permutation[i] = Math.floor(256 * Math.random());
3481
- // Duplicate for overflow handling
3482
- return [ ...permutation, ...permutation ];
3483
- })(), {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
3378
+ }, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
3484
3379
 
3485
3380
  const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new WeakMap, setCachedBackgroundDetection = (parentElement, overLightConfig, result, threshold) => {
3486
3381
  parentElement && backgroundDetectionCache.set(parentElement, {
@@ -3495,10 +3390,7 @@ const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new Weak
3495
3390
  * Composable hook for AtomixGlass component logic
3496
3391
  * Manages all state, calculations, and event handlers
3497
3392
  */
3498
- function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef: wrapperRef, borderRadius: borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer: mouseContainer, overLight: overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT, reducedMotion: reducedMotion = !1, highContrast: highContrast = !1, withoutEffects: withoutEffects = !1, border: border, withBorder: withBorder = !0, elasticity: elasticity = ATOMIX_GLASS.DEFAULTS.ELASTICITY, onClick: onClick, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, children: children, blurAmount: blurAmount, saturation: saturation, withLiquidBlur: withLiquidBlur, isFixedOrSticky: isFixedOrSticky = !1, priority: priority = 1, withTimeAnimation:
3499
- // Default priority
3500
- // Phase 1: Animation System Props
3501
- withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: animationSpeed = ATOMIX_GLASS.DEFAULTS.ANIMATION_SPEED, withMultiLayerDistortion: withMultiLayerDistortion = ATOMIX_GLASS.DEFAULTS.WITH_MULTI_LAYER_DISTORTION, distortionOctaves: distortionOctaves = ATOMIX_GLASS.DEFAULTS.DISTORTION_OCTAVES, distortionLacunarity: distortionLacunarity = ATOMIX_GLASS.DEFAULTS.DISTORTION_LACUNARITY, distortionGain: distortionGain = ATOMIX_GLASS.DEFAULTS.DISTORTION_GAIN, distortionQuality: distortionQuality = ATOMIX_GLASS.DEFAULTS.DISTORTION_QUALITY}) {
3393
+ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef: wrapperRef, borderRadius: borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer: mouseContainer, overLight: overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT, reducedMotion: reducedMotion = !1, highContrast: highContrast = !1, withoutEffects: withoutEffects = !1, border: border, withBorder: withBorder = !0, elasticity: elasticity = ATOMIX_GLASS.DEFAULTS.ELASTICITY, onClick: onClick, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, children: children, blurAmount: blurAmount, saturation: saturation, withLiquidBlur: withLiquidBlur, isFixedOrSticky: isFixedOrSticky = !1, priority: priority = 1}) {
3502
3394
  // State
3503
3395
  const [isHovered, setIsHovered] = React.useState(!1), [isActive, setIsActive] = React.useState(!1), resolvedBorder = React.useMemo((() =>
3504
3396
  /**
@@ -3550,52 +3442,10 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
3550
3442
  }), scaleVelocityRef = React.useRef({
3551
3443
  x: 0,
3552
3444
  y: 0
3553
- });
3554
- React.useRef(0);
3555
- const mouseVelocityRef = React.useRef({
3445
+ }), mouseVelocityRef = React.useRef({
3556
3446
  x: 0,
3557
3447
  y: 0
3558
- }), [userPrefersReducedMotion, setUserPrefersReducedMotion] = React.useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = React.useState(!1), [detectedOverLight, setDetectedOverLight] = React.useState(!1), animationFrameIdRef = React.useRef(null), animationStartTimeRef = React.useRef(0), elapsedTimeRef = React.useRef(0), shaderTimeRef = React.useRef(0), fbmConfig = React.useMemo((() => {
3559
- // If quality preset is provided, use it as base
3560
- const preset = (quality = distortionQuality, ATOMIX_GLASS.CONSTANTS.DISTORTION_QUALITY_PRESETS[quality]);
3561
- // Override with custom values if provided
3562
- var quality;
3563
- return {
3564
- octaves: distortionOctaves ?? preset.octaves,
3565
- lacunarity: distortionLacunarity ?? preset.lacunarity,
3566
- gain: distortionGain ?? preset.gain
3567
- };
3568
- }), [ distortionQuality, distortionOctaves, distortionLacunarity, distortionGain ]), fbmEngine = React.useMemo((() => withMultiLayerDistortion ? createFBMEngine(fbmConfig) : null), [ withMultiLayerDistortion, fbmConfig ]), effectiveReducedMotion = React.useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveWithTimeAnimation = React.useMemo((() => withTimeAnimation && !effectiveReducedMotion), [ withTimeAnimation, effectiveReducedMotion ]);
3569
- /**
3570
- * Animation loop for time-based effects
3571
- */
3572
- React.useEffect((() => {
3573
- if (!effectiveWithTimeAnimation || "undefined" == typeof window) return;
3574
- let lastFrameTime = performance.now();
3575
- /**
3576
- * Animation frame handler
3577
- */ const animate = currentTime => {
3578
- // Calculate delta time
3579
- const deltaTime = currentTime - lastFrameTime;
3580
- lastFrameTime = currentTime;
3581
- // Apply animation speed multiplier
3582
- const scaledDelta = deltaTime * animationSpeed;
3583
- elapsedTimeRef.current += scaledDelta, shaderTimeRef.current = elapsedTimeRef.current,
3584
- // Continue animation loop
3585
- animationFrameIdRef.current = requestAnimationFrame(animate);
3586
- };
3587
- // Start animation
3588
- // Cleanup
3589
- return animationStartTimeRef.current = performance.now(), animationFrameIdRef.current = requestAnimationFrame(animate),
3590
- () => {
3591
- null !== animationFrameIdRef.current && (cancelAnimationFrame(animationFrameIdRef.current),
3592
- animationFrameIdRef.current = null);
3593
- };
3594
- }), [ effectiveWithTimeAnimation, animationSpeed ]);
3595
- /**
3596
- * Get current shader time for animations
3597
- */
3598
- const getShaderTime = React.useCallback((() => shaderTimeRef.current), []), applyTimeBasedDistortion = React.useCallback((uv => effectiveWithTimeAnimation && fbmEngine ? liquidGlassWithTime(uv, shaderTimeRef.current, fbmConfig) : uv), [ effectiveWithTimeAnimation, fbmEngine, fbmConfig ]), effectiveBorderRadius = React.useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
3448
+ }), [userPrefersReducedMotion, setUserPrefersReducedMotion] = React.useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = React.useState(!1), [detectedOverLight, setDetectedOverLight] = React.useState(!1), effectiveReducedMotion = React.useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveBorderRadius = React.useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
3599
3449
  const [glassSize, setGlassSize] = React.useState({
3600
3450
  width: 270,
3601
3451
  height: 69
@@ -3655,9 +3505,6 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
3655
3505
  effectiveBorderRadius: effectiveBorderRadius,
3656
3506
  cachedRectRef: cachedRectRef
3657
3507
  }), effectiveHighContrast = React.useMemo((() => highContrast || userPrefersHighContrast), [ highContrast, userPrefersHighContrast ]), effectiveWithoutEffects = React.useMemo((() => withoutEffects || effectiveReducedMotion), [ withoutEffects, effectiveReducedMotion ]), globalMousePosition = externalGlobalMousePosition || internalGlobalMousePositionRef.current, mouseOffset = externalMouseOffset || internalMouseOffsetRef.current;
3658
- /**
3659
- * Apply time-based distortion to UV coordinates
3660
- */
3661
3508
  // Extract border-radius from children
3662
3509
  React.useEffect((() => {
3663
3510
  const extractRadius = () => {
@@ -3817,7 +3664,7 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
3817
3664
  * Get effective overLight value based on configuration
3818
3665
  */
3819
3666
  const getEffectiveOverLight = React.useCallback((() => "boolean" == typeof overLight ? overLight : ("auto" === overLight || "object" == typeof overLight && null !== overLight) && detectedOverLight), [ overLight, detectedOverLight ]), validateConfigValue = React.useCallback(((value, min, max, defaultValue) => "number" != typeof value || isNaN(value) || !isFinite(value) ? defaultValue : Math.min(max, Math.max(min, value))), []), overLightConfig = React.useMemo((() => {
3820
- const isOverLight = getEffectiveOverLight(), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, baseConfig = {
3667
+ const isOverLight = getEffectiveOverLight(), {hoverIntensity: hoverIntensity, activeIntensity: activeIntensity} = getInteractionIntensity(isHovered, isActive), baseConfig = {
3821
3668
  isOverLight: isOverLight,
3822
3669
  threshold: .7,
3823
3670
  opacity: isOverLight ? Math.min(.6, Math.max(.2, .5 * hoverIntensity * activeIntensity)) : 0,
@@ -3861,8 +3708,8 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
3861
3708
  };
3862
3709
  const curG = internalGlobalMousePositionRef.current, tgtG = targetGlobalMousePositionRef.current;
3863
3710
  internalGlobalMousePositionRef.current = {
3864
- x: lerp$1(curG.x, tgtG.x, CONSTANTS.LERP_FACTOR),
3865
- y: lerp$1(curG.y, tgtG.y, CONSTANTS.LERP_FACTOR)
3711
+ x: lerp(curG.x, tgtG.x, CONSTANTS.LERP_FACTOR),
3712
+ y: lerp(curG.y, tgtG.y, CONSTANTS.LERP_FACTOR)
3866
3713
  };
3867
3714
  // ── Calculate Elastic Physics ─────────────────────────────────────
3868
3715
  let targetElasticTranslation = {
@@ -4029,8 +3876,6 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
4029
3876
  overLightConfig: overLightConfig,
4030
3877
  resolvedBorder: resolvedBorder,
4031
3878
  transformStyle: transformStyle,
4032
- getShaderTime: getShaderTime,
4033
- applyTimeBasedDistortion: applyTimeBasedDistortion,
4034
3879
  handleMouseEnter: handleMouseEnter,
4035
3880
  handleMouseLeave: handleMouseLeave,
4036
3881
  handleMouseDown: handleMouseDown,
@@ -4444,12 +4289,6 @@ function usePerformanceMonitor$1(config = {}) {
4444
4289
  };
4445
4290
  }
4446
4291
 
4447
- /**
4448
- * Debug Overlay Component (Optional)
4449
- *
4450
- * Shows real-time performance metrics on screen.
4451
- * Only rendered when showOverlay is enabled.
4452
- */
4453
4292
  /**
4454
4293
  * Mobile optimization presets
4455
4294
  *
@@ -4459,8 +4298,7 @@ function usePerformanceMonitor$1(config = {}) {
4459
4298
  /**
4460
4299
  * Performance preset - Maximum FPS, reduced quality
4461
4300
  * Best for low-end devices or when battery saving is priority
4462
- */
4463
- const PERFORMANCE_PRESET = {
4301
+ */ const PERFORMANCE_PRESET = {
4464
4302
  distortionOctaves: 2,
4465
4303
  // Minimal FBM layers
4466
4304
  displacementScale: 50,
@@ -4629,7 +4467,7 @@ function getDevicePreset(presetName) {
4629
4467
  var explicit, position;
4630
4468
  /**
4631
4469
  * Extracts layout-related properties from a React `CSSProperties` object.
4632
- */ const {isHovered: isHovered, isActive: isActive, glassSize: glassSize, effectiveBorderRadius: effectiveBorderRadius, effectiveReducedMotion: effectiveReducedMotion, effectiveHighContrast: effectiveHighContrast, effectiveWithoutEffects: effectiveWithoutEffects, overLightConfig: overLightConfig, globalMousePosition: globalMousePosition, mouseOffset: mouseOffset, transformStyle: transformStyle, getShaderTime: getShaderTime, handleMouseEnter: handleMouseEnter, handleMouseLeave: handleMouseLeave, handleMouseDown: handleMouseDown, handleMouseUp: handleMouseUp, handleKeyDown: handleKeyDown, resolvedBorder: resolvedBorder} = useAtomixGlass({
4470
+ */ const {isHovered: isHovered, isActive: isActive, glassSize: glassSize, effectiveBorderRadius: effectiveBorderRadius, effectiveReducedMotion: effectiveReducedMotion, effectiveHighContrast: effectiveHighContrast, effectiveWithoutEffects: effectiveWithoutEffects, overLightConfig: overLightConfig, globalMousePosition: globalMousePosition, mouseOffset: mouseOffset, transformStyle: transformStyle, handleMouseEnter: handleMouseEnter, handleMouseLeave: handleMouseLeave, handleMouseDown: handleMouseDown, handleMouseUp: handleMouseUp, handleKeyDown: handleKeyDown, resolvedBorder: resolvedBorder} = useAtomixGlass({
4633
4471
  glassRef: glassRef,
4634
4472
  contentRef: contentRef,
4635
4473
  wrapperRef: internalWrapperRef,
@@ -4653,14 +4491,7 @@ function getDevicePreset(presetName) {
4653
4491
  withBorder: withBorder,
4654
4492
  debugBorderRadius: debugBorderRadius,
4655
4493
  style: style,
4656
- isFixedOrSticky: isFixedOrSticky,
4657
- withTimeAnimation: withTimeAnimation,
4658
- animationSpeed: animationSpeed,
4659
- withMultiLayerDistortion: withMultiLayerDistortion,
4660
- distortionOctaves: distortionOctaves,
4661
- distortionLacunarity: distortionLacunarity,
4662
- distortionGain: distortionGain,
4663
- distortionQuality: distortionQuality
4494
+ isFixedOrSticky: isFixedOrSticky
4664
4495
  });
4665
4496
  useResponsiveGlass({
4666
4497
  baseParams: {
@@ -4898,7 +4729,6 @@ function getDevicePreset(presetName) {
4898
4729
  shaderVariant: shaderVariant,
4899
4730
  withLiquidBlur: withLiquidBlur,
4900
4731
  isFixedOrSticky: isFixedOrSticky,
4901
- shaderTime: getShaderTime(),
4902
4732
  withTimeAnimation: withTimeAnimation,
4903
4733
  animationSpeed: animationSpeed,
4904
4734
  withMultiLayerDistortion: withMultiLayerDistortion,
@@ -5192,40 +5022,15 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5192
5022
  d: "M12 6c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z",
5193
5023
  fill: color
5194
5024
  }) ]
5195
- }), smoothStep = (a, b, t) => {
5196
- // Add input validation
5197
- if ("number" != typeof a || "number" != typeof b || "number" != typeof t) return 0;
5198
- const clamped = Math.max(0, Math.min(1, (t - a) / (b - a)));
5199
- return clamped * clamped * (3 - 2 * clamped);
5200
- }, calculateLength = (x, y) => {
5201
- // Add input validation and error handling
5202
- if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y)) return 0;
5203
- // Prevent potential overflow
5204
- const maxX = Math.max(Math.abs(x), Math.abs(y));
5205
- if (0 === maxX) return 0;
5206
- const scaledX = x / maxX, scaledY = y / maxX;
5207
- return maxX * Math.sqrt(scaledX * scaledX + scaledY * scaledY);
5208
- }, roundedRectSDF = (x, y, width, height, radius) => {
5025
+ }), roundedRectSDF = (x, y, width, height, radius) => {
5209
5026
  // Add input validation
5210
5027
  if ("number" != typeof x || "number" != typeof y || "number" != typeof width || "number" != typeof height || "number" != typeof radius) return 0;
5211
5028
  const qx = Math.abs(x) - width + radius, qy = Math.abs(y) - height + radius;
5212
- return Math.min(Math.max(qx, qy), 0) + calculateLength(Math.max(qx, 0), Math.max(qy, 0)) - radius;
5029
+ return Math.min(Math.max(qx, qy), 0) + vec2Length(Math.max(qx, 0), Math.max(qy, 0)) - radius;
5213
5030
  }, createTexture = (x, y) => ({
5214
5031
  x: "number" != typeof x || isNaN(x) ? .5 : Math.max(0, Math.min(1, x)),
5215
5032
  y: "number" != typeof y || isNaN(y) ? .5 : Math.max(0, Math.min(1, y))
5216
- }), validateVec2 = vec => vec && "number" == typeof vec.x && "number" == typeof vec.y && !isNaN(vec.x) && !isNaN(vec.y), clampValue = (value, min, max) =>
5217
- // Add input validation
5218
- "number" != typeof value || "number" != typeof min || "number" != typeof max || isNaN(value) ? min : isNaN(min) ? 0 : isNaN(max) ? 1 : Math.max(min, Math.min(max, value)), easeInOutCubic = t => {
5219
- // Add input validation
5220
- if ("number" != typeof t || isNaN(t)) return 0;
5221
- const clampedT = Math.max(0, Math.min(1, t));
5222
- return clampedT < .5 ? 4 * clampedT * clampedT * clampedT : 1 - Math.pow(-2 * clampedT + 2, 3) / 2;
5223
- }, easeOutQuart = t => {
5224
- // Add input validation
5225
- if ("number" != typeof t || isNaN(t)) return 0;
5226
- const clampedT = Math.max(0, Math.min(1, t));
5227
- return 1 - Math.pow(1 - clampedT, 4);
5228
- }, noise2D = (x, y) => {
5033
+ }), validateVec2 = vec => vec && "number" == typeof vec.x && "number" == typeof vec.y && !isNaN(vec.x) && !isNaN(vec.y), noise2D = (x, y) => {
5229
5034
  // Add input validation
5230
5035
  if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y)) return 0;
5231
5036
  const X = 255 & Math.floor(x), Y = 255 & Math.floor(y), xf = x - Math.floor(x), yf = y - Math.floor(y), u = easeInOutCubic(xf), v = easeInOutCubic(yf), hash = (i, j) => {
@@ -5264,13 +5069,13 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5264
5069
  x: .5,
5265
5070
  y: .5
5266
5071
  };
5267
- const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now(), mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = calculateLength(mouseX, mouseY), mouseFalloff = easeOutQuart(1 - Math.min(2 * mouseDistance, 1)), organicFlow = fbm(12 * (ix + .5 * mouseX) + time, 12 * (iy + .5 * mouseY) + .7 * time, 3) - .5, distanceToEdge = roundedRectSDF(ix, iy, .4, .3, .35), baseDisplacement = smoothStep(.8, 0, distanceToEdge - .05), radialDist = ((x, y, strength) => {
5072
+ const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now(), mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = vec2Length(mouseX, mouseY), mouseFalloff = easeOutQuart(1 - Math.min(2 * mouseDistance, 1)), organicFlow = fbm(12 * (ix + .5 * mouseX) + time, 12 * (iy + .5 * mouseY) + .7 * time, 3) - .5, distanceToEdge = roundedRectSDF(ix, iy, .4, .3, .35), baseDisplacement = smoothstepEdge(.8, 0, distanceToEdge - .05), radialDist = ((x, y, strength) => {
5268
5073
  // Add input validation
5269
5074
  if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y) || isNaN(strength)) return {
5270
5075
  x: 0,
5271
5076
  y: 0
5272
5077
  };
5273
- const distance = calculateLength(x, y), distortion = Math.pow(Math.min(distance, 10), 2) * strength;
5078
+ const distance = vec2Length(x, y), distortion = Math.pow(Math.min(distance, 10), 2) * strength;
5274
5079
  // Limit distance to prevent extreme values
5275
5080
  return {
5276
5081
  x: x * (1 + distortion),
@@ -5282,7 +5087,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5282
5087
  x: 0,
5283
5088
  y: 0
5284
5089
  };
5285
- const distance = calculateLength(x, y);
5090
+ const distance = vec2Length(x, y);
5286
5091
  // Prevent division by zero and extreme values
5287
5092
  if (0 === distance) return {
5288
5093
  x: 0,
@@ -5293,8 +5098,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5293
5098
  x: Math.cos(angle) * distance * intensity,
5294
5099
  y: Math.sin(angle) * distance * intensity
5295
5100
  };
5296
- })(ix, iy, .015 * baseDisplacement), scaled = smoothStep(0, 1, 1.15 * baseDisplacement), finalX = ix + totalDistortionX + .5 * chromaticOffset.x, finalY = iy + totalDistortionY + .5 * chromaticOffset.y;
5297
- return createTexture(clampValue(finalX * scaled + .5, 0, 1), clampValue(finalY * scaled + .5, 0, 1));
5101
+ })(ix, iy, .015 * baseDisplacement), scaled = smoothstepEdge(0, 1, 1.15 * baseDisplacement), finalX = ix + totalDistortionX + .5 * chromaticOffset.x, finalY = iy + totalDistortionY + .5 * chromaticOffset.y;
5102
+ return createTexture(clamp(finalX * scaled + .5, 0, 1), clamp(finalY * scaled + .5, 0, 1));
5298
5103
  },
5299
5104
  // Premium Apple-style fluid glass with enhanced organic flow
5300
5105
  appleFluid: (uv, mousePosition) => {
@@ -5302,8 +5107,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5302
5107
  x: .5,
5303
5108
  y: .5
5304
5109
  };
5305
- const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * .6, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = calculateLength(mouseX, mouseY), mouseFalloff = easeOutQuart(1 - Math.min(1.5 * mouseDistance, 1)), organicX = fbm(10 * (ix + .3 * mouseX) + time, 10 * (iy + .3 * mouseY), 5) - .5, organicY = fbm(10 * (ix - .3 * mouseX), 10 * (iy - .3 * mouseY) + .8 * time, 5) - .5, distanceToEdge = roundedRectSDF(ix, iy, .42, .32, .38), mask = smoothStep(.85, -.1, distanceToEdge), fluidVelocityX = Math.sin(6 * ix + 2 * time) * Math.cos(4 * iy - time) * .025, fluidVelocityY = Math.cos(4 * ix - time) * Math.sin(6 * iy + 2 * time) * .025, vortexAngle = Math.atan2(iy - mouseY, ix - mouseX), vortexStrength = mouseFalloff * mouseDistance * .08, vortexX = Math.cos(vortexAngle + time) * vortexStrength, totalY = iy + (.035 * organicY + fluidVelocityY + Math.sin(vortexAngle + time) * vortexStrength) * mask;
5306
- return createTexture(clampValue(ix + (.035 * organicX + fluidVelocityX + vortexX) * mask + .5, 0, 1), clampValue(totalY + .5, 0, 1));
5110
+ const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * .6, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = vec2Length(mouseX, mouseY), mouseFalloff = easeOutQuart(1 - Math.min(1.5 * mouseDistance, 1)), organicX = fbm(10 * (ix + .3 * mouseX) + time, 10 * (iy + .3 * mouseY), 5) - .5, organicY = fbm(10 * (ix - .3 * mouseX), 10 * (iy - .3 * mouseY) + .8 * time, 5) - .5, distanceToEdge = roundedRectSDF(ix, iy, .42, .32, .38), mask = smoothstepEdge(.85, -.1, distanceToEdge), fluidVelocityX = Math.sin(6 * ix + 2 * time) * Math.cos(4 * iy - time) * .025, fluidVelocityY = Math.cos(4 * ix - time) * Math.sin(6 * iy + 2 * time) * .025, vortexAngle = Math.atan2(iy - mouseY, ix - mouseX), vortexStrength = mouseFalloff * mouseDistance * .08, vortexX = Math.cos(vortexAngle + time) * vortexStrength, totalY = iy + (.035 * organicY + fluidVelocityY + Math.sin(vortexAngle + time) * vortexStrength) * mask;
5111
+ return createTexture(clamp(ix + (.035 * organicX + fluidVelocityX + vortexX) * mask + .5, 0, 1), clamp(totalY + .5, 0, 1));
5307
5112
  },
5308
5113
  // High-end glass with advanced refraction and depth
5309
5114
  premiumGlass: (uv, mousePosition) => {
@@ -5311,7 +5116,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5311
5116
  x: .5,
5312
5117
  y: .5
5313
5118
  };
5314
- const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * .4, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = calculateLength(mouseX, mouseY), centerDistance = calculateLength(ix, iy), refractionStrength = .3 * Math.pow(Math.min(centerDistance, 1), 1.5), refractionAngle = Math.atan2(iy, ix);
5119
+ const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * .4, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = vec2Length(mouseX, mouseY), centerDistance = vec2Length(ix, iy), refractionStrength = .3 * Math.pow(Math.min(centerDistance, 1), 1.5), refractionAngle = Math.atan2(iy, ix);
5315
5120
  // Multi-layer depth effect
5316
5121
  let depthX = 0, depthY = 0;
5317
5122
  for (let layer = 0; layer < 3; layer++) {
@@ -5319,8 +5124,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5319
5124
  depthX += Math.sin(ix * layerScale + layerTime) * layerStrength, depthY += Math.cos(iy * layerScale - layerTime) * layerStrength;
5320
5125
  }
5321
5126
  // Glass refraction with mouse influence
5322
- const refractionX = Math.cos(refractionAngle) * refractionStrength * (1 + .5 * mouseDistance), refractionY = Math.sin(refractionAngle) * refractionStrength * (1 + .5 * mouseDistance), organicNoise = fbm(8 * ix + time, 8 * iy - time, 2) - .5, distanceToEdge = roundedRectSDF(ix, iy, .43, .33, .36), edgeMask = smoothStep(.9, -.05, distanceToEdge), finalY = iy + (refractionY + depthY + .015 * organicNoise) * edgeMask;
5323
- return createTexture(clampValue(ix + (refractionX + depthX + .015 * organicNoise) * edgeMask + .5, 0, 1), clampValue(finalY + .5, 0, 1));
5127
+ const refractionX = Math.cos(refractionAngle) * refractionStrength * (1 + .5 * mouseDistance), refractionY = Math.sin(refractionAngle) * refractionStrength * (1 + .5 * mouseDistance), organicNoise = fbm(8 * ix + time, 8 * iy - time, 2) - .5, distanceToEdge = roundedRectSDF(ix, iy, .43, .33, .36), edgeMask = smoothstepEdge(.9, -.05, distanceToEdge), finalY = iy + (refractionY + depthY + .015 * organicNoise) * edgeMask;
5128
+ return createTexture(clamp(ix + (refractionX + depthX + .015 * organicNoise) * edgeMask + .5, 0, 1), clamp(finalY + .5, 0, 1));
5324
5129
  },
5325
5130
  // Metallic liquid effect with shimmer
5326
5131
  liquidMetal: (uv, mousePosition) => {
@@ -5328,8 +5133,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5328
5133
  x: .5,
5329
5134
  y: .5
5330
5135
  };
5331
- const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * 1.2, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, wave1 = Math.sin(20 * ix + 4 * time) * Math.cos(15 * iy - 3 * time) * .02, wave2 = Math.cos(15 * ix - 2 * time) * Math.sin(20 * iy + 5 * time) * .015, shimmer = .025 * fbm(25 * ix + 2 * time, 25 * iy - 2 * time, 4), flowAngle = Math.atan2(iy - mouseY, ix - mouseX), flowDistance = calculateLength(ix - mouseX, iy - mouseY), flowEffect = .02 * Math.sin(15 * flowDistance - 6 * time) * easeOutQuart(1 - Math.min(2 * flowDistance, 1)), distanceToEdge = roundedRectSDF(ix, iy, .41, .31, .37), mask = smoothStep(.88, -.08, distanceToEdge), totalX = ix + (wave1 + shimmer + Math.cos(flowAngle) * flowEffect) * mask, totalY = iy + (wave2 + .8 * shimmer + Math.sin(flowAngle) * flowEffect) * mask;
5332
- return createTexture(clampValue(totalX + .5, 0, 1), clampValue(totalY + .5, 0, 1));
5136
+ const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * 1.2, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, wave1 = Math.sin(20 * ix + 4 * time) * Math.cos(15 * iy - 3 * time) * .02, wave2 = Math.cos(15 * ix - 2 * time) * Math.sin(20 * iy + 5 * time) * .015, shimmer = .025 * fbm(25 * ix + 2 * time, 25 * iy - 2 * time, 4), flowAngle = Math.atan2(iy - mouseY, ix - mouseX), flowDistance = vec2Length(ix - mouseX, iy - mouseY), flowEffect = .02 * Math.sin(15 * flowDistance - 6 * time) * easeOutQuart(1 - Math.min(2 * flowDistance, 1)), distanceToEdge = roundedRectSDF(ix, iy, .41, .31, .37), mask = smoothstepEdge(.88, -.08, distanceToEdge), totalX = ix + (wave1 + shimmer + Math.cos(flowAngle) * flowEffect) * mask, totalY = iy + (wave2 + .8 * shimmer + Math.sin(flowAngle) * flowEffect) * mask;
5137
+ return createTexture(clamp(totalX + .5, 0, 1), clamp(totalY + .5, 0, 1));
5333
5138
  },
5334
5139
  // basiBasi - Expert Premium Glass Shader
5335
5140
  // The most advanced shader with caustics, spectral dispersion, parallax depth, and volumetric effects
@@ -5338,7 +5143,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5338
5143
  x: .5,
5339
5144
  y: .5
5340
5145
  };
5341
- const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * .5, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = calculateLength(mouseX, mouseY), mouseFalloff = easeOutQuart(1 - Math.min(1.2 * mouseDistance, 1)), causticIntensity = ((x, y, time, intensity = 1) =>
5146
+ const ix = uv.x - .5, iy = uv.y - .5, time = 8e-4 * Date.now() * .5, mouseX = mousePosition && validateVec2(mousePosition) ? mousePosition.x - .5 : 0, mouseY = mousePosition && validateVec2(mousePosition) ? mousePosition.y - .5 : 0, mouseDistance = vec2Length(mouseX, mouseY), mouseFalloff = easeOutQuart(1 - Math.min(1.2 * mouseDistance, 1)), causticIntensity = ((x, y, time, intensity = 1) =>
5342
5147
  // Add input validation
5343
5148
  "number" != typeof x || "number" != typeof y || "number" != typeof time || "number" != typeof intensity || isNaN(x) || isNaN(y) || isNaN(time) || isNaN(intensity) ? .5 : .5 * (Math.sin(8 * x + 2 * time) * Math.cos(8 * y - 2 * time) * .5 + Math.sin(8 * (x + .5) * 1.3 - 2 * time * .8) * Math.cos(8 * (y - .3) * 1.3 + 2 * time * .8) * .3 + Math.sin(8 * (x - .3) * .7 + 2 * time * 1.2) * Math.cos(8 * (y + .4) * .7 - 2 * time * 1.2) * .2 + 1) * intensity)(ix, iy, time, .8), causticDistortion = .02 * (causticIntensity - .5), refractionAngle = Math.atan2(iy, ix), spectralDispersion = ((x, y, angle) => {
5344
5149
  // Add input validation
@@ -5356,7 +5161,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5356
5161
  y: 0
5357
5162
  }
5358
5163
  };
5359
- const distance = calculateLength(x, y), dispersionStrength = Math.min(.025 * distance, 1), redOffset = .8 * dispersionStrength, greenOffset = 1 * dispersionStrength, blueOffset = 1.2 * dispersionStrength;
5164
+ const distance = vec2Length(x, y), dispersionStrength = Math.min(.025 * distance, 1), redOffset = .8 * dispersionStrength, greenOffset = 1 * dispersionStrength, blueOffset = 1.2 * dispersionStrength;
5360
5165
  return {
5361
5166
  r: {
5362
5167
  x: Math.cos(angle) * redOffset,
@@ -5396,8 +5201,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
5396
5201
  return turbulence;
5397
5202
  })(6 * ix, 6 * iy, time, 6), turbulenceX = .012 * Math.cos(turbulence * Math.PI * 2), turbulenceY = .012 * Math.sin(turbulence * Math.PI * 2), microSurface = ((x, y, time) =>
5398
5203
  // Add input validation
5399
- "number" != typeof x || "number" != typeof y || "number" != typeof time || isNaN(x) || isNaN(y) || isNaN(time) ? .5 : .5 * (.7 * fbm(40 * x + .3 * time, 40 * y - .3 * time, 6) + .3 * fbm(80 * x, 80 * y, 4)))(ix, iy, time), microDetailX = .008 * (microSurface - .5), microDetailY = .008 * (microSurface - .5), centerDistance = calculateLength(ix, iy), dynamicRefraction = .35 * Math.pow(Math.min(centerDistance, 1), 1.8) * (1 + mouseFalloff * mouseDistance * .8), refractionX = Math.cos(refractionAngle) * dynamicRefraction, refractionY = Math.sin(refractionAngle) * dynamicRefraction, vortexAngle = Math.atan2(iy - mouseY, ix - mouseX), vortexDistance = calculateLength(ix - mouseX, iy - mouseY), vortexStrength = mouseFalloff * Math.sin(10 * vortexDistance - 3 * time) * .025, vortexX = Math.cos(vortexAngle + 2 * time) * vortexStrength, vortexY = Math.sin(vortexAngle + 2 * time) * vortexStrength, fluidX = Math.sin(10 * ix + 5 * mouseX + 2.5 * time) * Math.cos(8 * iy - 2 * time) * .018, fluidY = Math.cos(8 * ix - 2 * time) * Math.sin(10 * iy + 5 * mouseY + 2.5 * time) * .018, rippleEffect = (.012 * Math.sin(15 * Math.min(centerDistance, 10) - 4 * time) + .008 * Math.cos(20 * Math.min(centerDistance, 10) + 3 * time)) * mouseFalloff, rippleX = Math.cos(refractionAngle) * rippleEffect, rippleY = Math.sin(refractionAngle) * rippleEffect, distanceToEdge = roundedRectSDF(ix, iy, .44, .34, .39), edgeMask = smoothStep(.92, -.12, distanceToEdge), edgeSoftness = smoothStep(.85, .1, distanceToEdge), finalY = iy + (1.2 * refractionY + .8 * spectralY + 1.5 * parallaxY + .9 * scatteringY + 1 * turbulenceY + .6 * microDetailY + 1.3 * vortexY + 1.1 * fluidY + .7 * rippleY + .8 * causticDistortion) * edgeMask * edgeSoftness * .85;
5400
- return createTexture(clampValue(ix + (1.2 * refractionX + .8 * spectralX + 1.5 * parallaxX + .9 * scatteringX + 1 * turbulenceX + .6 * microDetailX + 1.3 * vortexX + 1.1 * fluidX + .7 * rippleX + causticDistortion) * edgeMask * edgeSoftness * .85 + .5, 0, 1), clampValue(finalY + .5, 0, 1));
5204
+ "number" != typeof x || "number" != typeof y || "number" != typeof time || isNaN(x) || isNaN(y) || isNaN(time) ? .5 : .5 * (.7 * fbm(40 * x + .3 * time, 40 * y - .3 * time, 6) + .3 * fbm(80 * x, 80 * y, 4)))(ix, iy, time), microDetailX = .008 * (microSurface - .5), microDetailY = .008 * (microSurface - .5), centerDistance = vec2Length(ix, iy), dynamicRefraction = .35 * Math.pow(Math.min(centerDistance, 1), 1.8) * (1 + mouseFalloff * mouseDistance * .8), refractionX = Math.cos(refractionAngle) * dynamicRefraction, refractionY = Math.sin(refractionAngle) * dynamicRefraction, vortexAngle = Math.atan2(iy - mouseY, ix - mouseX), vortexDistance = vec2Length(ix - mouseX, iy - mouseY), vortexStrength = mouseFalloff * Math.sin(10 * vortexDistance - 3 * time) * .025, vortexX = Math.cos(vortexAngle + 2 * time) * vortexStrength, vortexY = Math.sin(vortexAngle + 2 * time) * vortexStrength, fluidX = Math.sin(10 * ix + 5 * mouseX + 2.5 * time) * Math.cos(8 * iy - 2 * time) * .018, fluidY = Math.cos(8 * ix - 2 * time) * Math.sin(10 * iy + 5 * mouseY + 2.5 * time) * .018, rippleEffect = (.012 * Math.sin(15 * Math.min(centerDistance, 10) - 4 * time) + .008 * Math.cos(20 * Math.min(centerDistance, 10) + 3 * time)) * mouseFalloff, rippleX = Math.cos(refractionAngle) * rippleEffect, rippleY = Math.sin(refractionAngle) * rippleEffect, distanceToEdge = roundedRectSDF(ix, iy, .44, .34, .39), edgeMask = smoothstepEdge(.92, -.12, distanceToEdge), edgeSoftness = smoothstepEdge(.85, .1, distanceToEdge), finalY = iy + (1.2 * refractionY + .8 * spectralY + 1.5 * parallaxY + .9 * scatteringY + 1 * turbulenceY + .6 * microDetailY + 1.3 * vortexY + 1.1 * fluidY + .7 * rippleY + .8 * causticDistortion) * edgeMask * edgeSoftness * .85;
5205
+ return createTexture(clamp(ix + (1.2 * refractionX + .8 * spectralX + 1.5 * parallaxX + .9 * scatteringX + 1 * turbulenceX + .6 * microDetailX + 1.3 * vortexX + 1.1 * fluidX + .7 * rippleX + causticDistortion) * edgeMask * edgeSoftness * .85 + .5, 0, 1), clamp(finalY + .5, 0, 1));
5401
5206
  },
5402
5207
  // Aliases for compatibility
5403
5208
  plasma: (uv, mousePosition) => fragmentShaders.premiumGlass(uv, mousePosition),
@@ -5441,8 +5246,8 @@ var shaderUtils = Object.freeze({
5441
5246
  let dx = pos.x * w - x, dy = pos.y * h - y;
5442
5247
  // Apply edge smoothing for Apple-like effect
5443
5248
  const edgeX = 2 * Math.min(x / w, (w - x) / w), edgeY = 2 * Math.min(y / h, (h - y) / h), edgeFactor = Math.min(edgeX, edgeY);
5444
- dx *= smoothStep(0, .2, edgeFactor), dy *= smoothStep(0, .2, edgeFactor), maxScale = Math.max(maxScale, Math.abs(dx), Math.abs(dy)),
5445
- rawValues.push(dx, dy);
5249
+ dx *= smoothstepEdge(0, .2, edgeFactor), dy *= smoothstepEdge(0, .2, edgeFactor),
5250
+ maxScale = Math.max(maxScale, Math.abs(dx), Math.abs(dy)), rawValues.push(dx, dy);
5446
5251
  }
5447
5252
  // Improved normalization to prevent artifacts while maintaining intensity
5448
5253
  maxScale = Math.max(maxScale, 1);
@@ -5452,9 +5257,9 @@ var shaderUtils = Object.freeze({
5452
5257
  let rawIndex = 0;
5453
5258
  for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) {
5454
5259
  const dx = rawValues[rawIndex++] || 0, dy = rawValues[rawIndex++] || 0, edgeDistance = Math.min(x, y, w - x - 1, h - y - 1), edgeFactor = Math.min(1, edgeDistance / 2), r = dx * edgeFactor / maxScale + .5, g = dy * edgeFactor / maxScale + .5, pixelIndex = 4 * (y * w + x);
5455
- data[pixelIndex] = clampValue(255 * r, 0, 255), // Red channel (X displacement)
5456
- data[pixelIndex + 1] = clampValue(255 * g, 0, 255), // Green channel (Y displacement)
5457
- data[pixelIndex + 2] = clampValue(255 * g, 0, 255), // Blue channel (Y displacement for SVG filter compatibility)
5260
+ data[pixelIndex] = clamp(255 * r, 0, 255), // Red channel (X displacement)
5261
+ data[pixelIndex + 1] = clamp(255 * g, 0, 255), // Green channel (Y displacement)
5262
+ data[pixelIndex + 2] = clamp(255 * g, 0, 255), // Blue channel (Y displacement for SVG filter compatibility)
5458
5263
  data[pixelIndex + 3] = 255;
5459
5264
  }
5460
5265
  return this.context.putImageData(imageData, 0, 0), this.canvas.toDataURL();
@@ -5482,9 +5287,7 @@ var shaderUtils = Object.freeze({
5482
5287
  return this.canvasDPI;
5483
5288
  }
5484
5289
  },
5485
- createFBMEngine: createFBMEngine,
5486
- fragmentShaders: fragmentShaders,
5487
- liquidGlassWithTime: liquidGlassWithTime
5290
+ fragmentShaders: fragmentShaders
5488
5291
  });
5489
5292
 
5490
5293
  // Map string sizes to pixel values
@@ -13892,48 +13695,11 @@ var composablesImport = Object.freeze({
13892
13695
  DeviceDetector: DeviceDetector,
13893
13696
  MOBILE_OPTIMIZED_BREAKPOINTS: MOBILE_OPTIMIZED_BREAKPOINTS,
13894
13697
  PERFORMANCE_PRESET: PERFORMANCE_PRESET,
13895
- PerformanceOverlay: function({metrics: metrics}) {
13896
- return null;
13897
- // Performance overlay removed - will be implemented as separate component
13898
- }
13899
- /**
13900
- * Utility to get quality multipliers for glass parameters
13901
- */ ,
13902
13698
  QUALITY_PRESET: QUALITY_PRESET,
13903
13699
  createBreakpoints: createBreakpoints$1,
13904
13700
  getDefaultBreakpoints: getDefaultBreakpoints,
13905
13701
  getDevicePreset: getDevicePreset,
13906
13702
  getMobileOptimizedParams: getMobileOptimizedParams,
13907
- getQualityMultipliers: function(quality) {
13908
- switch (quality) {
13909
- case "low":
13910
- return {
13911
- distortionOctaves: 2,
13912
- displacementScale: .6,
13913
- blurAmount: .7,
13914
- animationSpeed: .8,
13915
- chromaticIntensity: .5
13916
- };
13917
-
13918
- case "medium":
13919
- return {
13920
- distortionOctaves: 4,
13921
- displacementScale: .85,
13922
- blurAmount: .9,
13923
- animationSpeed: .95,
13924
- chromaticIntensity: .75
13925
- };
13926
-
13927
- case "high":
13928
- return {
13929
- distortionOctaves: 5,
13930
- displacementScale: 1,
13931
- blurAmount: 1,
13932
- animationSpeed: 1,
13933
- chromaticIntensity: 1
13934
- };
13935
- }
13936
- },
13937
13703
  useAccordion: useAccordion,
13938
13704
  useAtomixGlass: useAtomixGlass,
13939
13705
  useBadge: useBadge,