@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.
- package/dist/atomix.css +2 -2
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/atomix.umd.js +1 -1
- package/dist/atomix.umd.js.map +1 -1
- package/dist/atomix.umd.min.js +1 -1
- package/dist/charts.js +65 -255
- package/dist/charts.js.map +1 -1
- package/dist/core.js +65 -255
- package/dist/core.js.map +1 -1
- package/dist/forms.js +65 -255
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +65 -255
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +6 -37
- package/dist/index.esm.js +66 -300
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +66 -300
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +0 -9
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +0 -2
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +1 -1
- package/src/components/AtomixGlass/glass-utils.ts +82 -53
- package/src/components/AtomixGlass/shader-utils.ts +19 -77
- package/src/components/Form/Select.test.tsx +6 -6
- package/src/components/Form/Textarea.stories.tsx +5 -5
- package/src/lib/composables/useAtomixGlass.ts +2 -134
- package/src/lib/composables/useAtomixGlassStyles.ts +3 -3
- package/src/lib/composables/usePerformanceMonitor.ts +0 -66
- package/src/lib/constants/components.ts +6 -1
- package/src/styles/01-settings/_settings.atomix-glass.scss +2 -2
- package/src/styles/02-tools/_tools.button.scss +51 -42
- package/src/styles/06-components/_components.atomix-glass.scss +2 -2
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +0 -171
- package/src/components/AtomixGlass/animation-system.ts +0 -578
package/dist/index.esm.js
CHANGED
|
@@ -2041,6 +2041,11 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
2041
2041
|
MIN_BLUR: .1,
|
|
2042
2042
|
MOUSE_INFLUENCE_DIVISOR: 100,
|
|
2043
2043
|
EDGE_FADE_PIXELS: 2,
|
|
2044
|
+
// Interaction intensity multipliers shared by the hook and the imperative style updater
|
|
2045
|
+
INTERACTION: {
|
|
2046
|
+
HOVER_INTENSITY: 1.4,
|
|
2047
|
+
ACTIVE_INTENSITY: 1.6
|
|
2048
|
+
},
|
|
2044
2049
|
// Elasticity physics constants — Apple-tuned: soft springs, fast settling, minimal stretch
|
|
2045
2050
|
ELASTICITY_TRANSLATION_FACTOR: .06,
|
|
2046
2051
|
// Subtler elastic shift (was 0.1)
|
|
@@ -2238,7 +2243,7 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
2238
2243
|
},
|
|
2239
2244
|
// Container shadows — hairline inner catch + soft floating lift (Apple player bar)
|
|
2240
2245
|
CONTAINER_SHADOW: {
|
|
2241
|
-
LIGHT: "inset 0 0.5px 0 rgba(255, 255, 255, 0.32), inset 0 1px 2px rgba(255, 255, 255, 0.06), 0
|
|
2246
|
+
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)"
|
|
2242
2247
|
},
|
|
2243
2248
|
// Phase 1: Animation System Constants
|
|
2244
2249
|
ANIMATION: {
|
|
@@ -2688,7 +2693,28 @@ const {CONSTANTS: CONSTANTS$3} = ATOMIX_GLASS, calculateElementCenter = rect =>
|
|
|
2688
2693
|
}, smoothstep = t => {
|
|
2689
2694
|
const clamped = Math.max(0, Math.min(1, t));
|
|
2690
2695
|
return clamped * clamped * (3 - 2 * clamped);
|
|
2691
|
-
}, lerp
|
|
2696
|
+
}, 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 => {
|
|
2697
|
+
if ("number" != typeof t || isNaN(t)) return 0;
|
|
2698
|
+
const clamped = Math.max(0, Math.min(1, t));
|
|
2699
|
+
return clamped < .5 ? 4 * clamped * clamped * clamped : 1 - Math.pow(-2 * clamped + 2, 3) / 2;
|
|
2700
|
+
}, easeOutQuart = t => {
|
|
2701
|
+
if ("number" != typeof t || isNaN(t)) return 0;
|
|
2702
|
+
const clamped = Math.max(0, Math.min(1, t));
|
|
2703
|
+
return 1 - Math.pow(1 - clamped, 4);
|
|
2704
|
+
}, vec2Length = (x, y) => {
|
|
2705
|
+
if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y)) return 0;
|
|
2706
|
+
const maxComponent = Math.max(Math.abs(x), Math.abs(y));
|
|
2707
|
+
if (0 === maxComponent) return 0;
|
|
2708
|
+
const scaledX = x / maxComponent, scaledY = y / maxComponent;
|
|
2709
|
+
return maxComponent * Math.sqrt(scaledX * scaledX + scaledY * scaledY);
|
|
2710
|
+
}, getInteractionIntensity = (isHovered, isActive) => ({
|
|
2711
|
+
hoverIntensity: isHovered ? CONSTANTS$3.INTERACTION.HOVER_INTENSITY : 1,
|
|
2712
|
+
activeIntensity: isActive ? CONSTANTS$3.INTERACTION.ACTIVE_INTENSITY : 1
|
|
2713
|
+
})
|
|
2714
|
+
/**
|
|
2715
|
+
* Spring-damper integration helper
|
|
2716
|
+
* Calculates the next value based on velocity, stiffness, and damping.
|
|
2717
|
+
*/ , calculateSpring = (current, target, velocity, stiffness = .1, damping = .8) => {
|
|
2692
2718
|
const newVelocity = (velocity + (target - current) * stiffness) * damping;
|
|
2693
2719
|
return {
|
|
2694
2720
|
value: current + newVelocity,
|
|
@@ -2894,7 +2920,7 @@ const GlassFilter = memo(GlassFilterComponent, ((prevProps, nextProps) => prevP
|
|
|
2894
2920
|
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, borderRadius: borderRadius = 0, glassSize: glassSize = {
|
|
2895
2921
|
width: 0,
|
|
2896
2922
|
height: 0
|
|
2897
|
-
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, isFixedOrSticky: isFixedOrSticky = !1,
|
|
2923
|
+
}, 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) => {
|
|
2898
2924
|
// React 18 useId — stable, unique, and SSR-safe (no module-level counter)
|
|
2899
2925
|
const rawId = useId(), filterId = useMemo((() => `atomix-glass-filter-${rawId.replace(/:/g, "")}`), [ rawId ]), containerRef = useForkRef(ref, null), [shaderMapUrl, setShaderMapUrl] = useState(""), shaderGeneratorRef = useRef(null), shaderUtilsRef = useRef(null), shaderDebounceTimeoutRef = useRef(null), shaderUpdateTimeoutRef = useRef(null), animationFrameRef = useRef(null);
|
|
2900
2926
|
// Lazy load shader utilities only when shader mode is needed
|
|
@@ -3192,7 +3218,7 @@ class {
|
|
|
3192
3218
|
}, {BORDER: BORDER, CONSTANTS: CONSTANTS$2} = ATOMIX_GLASS, BORDER_GRADIENT = BORDER.GRADIENT, WHITE = CONSTANTS$2.PALETTE.WHITE, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
3193
3219
|
if (!wrapperElement && !containerElement) return;
|
|
3194
3220
|
if (!validateGlassSize(params.glassSize)) return;
|
|
3195
|
-
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
|
|
3221
|
+
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 = {
|
|
3196
3222
|
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
3197
3223
|
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
3198
3224
|
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
@@ -3323,140 +3349,9 @@ class {
|
|
|
3323
3349
|
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
3324
3350
|
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"),
|
|
3325
3351
|
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)"),
|
|
3326
|
-
style.setProperty("--atomix-glass-container-box-shadow", isOverLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0
|
|
3352
|
+
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)");
|
|
3327
3353
|
}
|
|
3328
|
-
};
|
|
3329
|
-
|
|
3330
|
-
/**
|
|
3331
|
-
* Animation System for AtomixGlass Component
|
|
3332
|
-
*
|
|
3333
|
-
* Implements Phase 1 features from the AtomixGlass Feature Implementation Roadmap:
|
|
3334
|
-
* - Feature 1.1: Time-Based Animation System
|
|
3335
|
-
* - Feature 1.2: Multi-Layer Distortion System (FBM)
|
|
3336
|
-
*
|
|
3337
|
-
* @packageDocumentation
|
|
3338
|
-
*/
|
|
3339
|
-
// ============================================================================
|
|
3340
|
-
// Noise Functions for FBM (Feature 1.2)
|
|
3341
|
-
// ============================================================================
|
|
3342
|
-
/**
|
|
3343
|
-
* Perlin noise implementation for smooth gradient noise
|
|
3344
|
-
*
|
|
3345
|
-
* @param x - X coordinate
|
|
3346
|
-
* @param y - Y coordinate
|
|
3347
|
-
* @returns Noise value in range [0, 1]
|
|
3348
|
-
*/
|
|
3349
|
-
function perlinNoise(x, y) {
|
|
3350
|
-
// Simplified Perlin noise using pseudo-random gradients
|
|
3351
|
-
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);
|
|
3352
|
-
// Scale to [0, 1] range
|
|
3353
|
-
return (lerp(lerpX1, lerpX2, v) + 1) / 2;
|
|
3354
|
-
}
|
|
3355
|
-
|
|
3356
|
-
// ============================================================================
|
|
3357
|
-
// Fractal Brownian Motion (FBM) Engine (Feature 1.2)
|
|
3358
|
-
// ============================================================================
|
|
3359
|
-
/**
|
|
3360
|
-
* Creates an FBM engine with configurable parameters
|
|
3361
|
-
*
|
|
3362
|
-
* @param config - FBM configuration (octaves, lacunarity, gain)
|
|
3363
|
-
* @returns Object with fbm function
|
|
3364
|
-
*
|
|
3365
|
-
* @example
|
|
3366
|
-
* ```typescript
|
|
3367
|
-
* const fbmEngine = createFBMEngine({ octaves: 5, lacunarity: 2, gain: 0.5 });
|
|
3368
|
-
*
|
|
3369
|
-
* // Generate noise at position (0.5, 0.5) with time animation
|
|
3370
|
-
* const noiseValue = fbmEngine.fbm(0.5, 0.5, Date.now());
|
|
3371
|
-
* ```
|
|
3372
|
-
*/ function createFBMEngine(config) {
|
|
3373
|
-
/**
|
|
3374
|
-
* Fractal Brownian Motion function
|
|
3375
|
-
* Combines multiple octaves of noise for complex, natural patterns
|
|
3376
|
-
*
|
|
3377
|
-
* @param x - X coordinate
|
|
3378
|
-
* @param y - Y coordinate
|
|
3379
|
-
* @param time - Optional time value for animation
|
|
3380
|
-
* @returns FBM noise value in range [0, 1]
|
|
3381
|
-
*/
|
|
3382
|
-
const fbm = (x, y, time = 0) => {
|
|
3383
|
-
let value = 0, amplitude = .5, frequency = 1, phase = .001 * time;
|
|
3384
|
-
// Convert to seconds for reasonable animation speed
|
|
3385
|
-
for (let i = 0; i < config.octaves; i++)
|
|
3386
|
-
// Apply time-based phase shift to all octaves
|
|
3387
|
-
value += perlinNoise(x * frequency + phase, y * frequency + phase) * amplitude,
|
|
3388
|
-
frequency *= config.lacunarity, // Increase frequency
|
|
3389
|
-
amplitude *= config.gain;
|
|
3390
|
-
return value;
|
|
3391
|
-
};
|
|
3392
|
-
/**
|
|
3393
|
-
* Get FBM with simple time factor
|
|
3394
|
-
*/ return {
|
|
3395
|
-
fbm: fbm,
|
|
3396
|
-
fbmWithTime: (x, y, time) => fbm(x, y, time)
|
|
3397
|
-
};
|
|
3398
|
-
}
|
|
3399
|
-
|
|
3400
|
-
/**
|
|
3401
|
-
* Gets optimal FBM config based on quality preset
|
|
3402
|
-
*
|
|
3403
|
-
* @param quality - Quality preset level
|
|
3404
|
-
* @returns FBM configuration for the quality level
|
|
3405
|
-
*/ const fbmEngineCache = new Map;
|
|
3406
|
-
|
|
3407
|
-
// ============================================================================
|
|
3408
|
-
// Shader Utility Functions for Time-Based Effects
|
|
3409
|
-
// ============================================================================
|
|
3410
|
-
/**
|
|
3411
|
-
* Liquid glass distortion with time-based animation
|
|
3412
|
-
* Uses FBM to create organic, flowing liquid effects
|
|
3413
|
-
*
|
|
3414
|
-
* @param uv - UV coordinates (normalized 0-1)
|
|
3415
|
-
* @param time - Elapsed time in milliseconds
|
|
3416
|
-
* @param config - FBM configuration
|
|
3417
|
-
* @returns Distorted UV coordinates
|
|
3418
|
-
*/ function liquidGlassWithTime(uv, time, config) {
|
|
3419
|
-
const configKey = `${config.octaves}-${config.lacunarity}-${config.gain}`;
|
|
3420
|
-
let fbmEngine = fbmEngineCache.get(configKey);
|
|
3421
|
-
fbmEngine || (fbmEngine = createFBMEngine(config), fbmEngineCache.set(configKey, fbmEngine));
|
|
3422
|
-
// Animate noise with time
|
|
3423
|
-
const animatedNoise = fbmEngine.fbmWithTime(2 * uv.x + 1e-4 * time, 2 * uv.y + 15e-5 * time, time);
|
|
3424
|
-
return {
|
|
3425
|
-
x: uv.x + .04 * (animatedNoise - .5),
|
|
3426
|
-
y: uv.y + .04 * (animatedNoise - .5)
|
|
3427
|
-
};
|
|
3428
|
-
}
|
|
3429
|
-
|
|
3430
|
-
// ============================================================================
|
|
3431
|
-
// Helper Functions
|
|
3432
|
-
// ============================================================================
|
|
3433
|
-
/**
|
|
3434
|
-
* Fade curve for smooth interpolation (Perlin's fade function)
|
|
3435
|
-
*/ function fade(t) {
|
|
3436
|
-
return t * t * t * (t * (6 * t - 15) + 10);
|
|
3437
|
-
}
|
|
3438
|
-
|
|
3439
|
-
/**
|
|
3440
|
-
* Linear interpolation
|
|
3441
|
-
*/ function lerp(a, b, t) {
|
|
3442
|
-
return a + t * (b - a);
|
|
3443
|
-
}
|
|
3444
|
-
|
|
3445
|
-
/**
|
|
3446
|
-
* Gradient calculation for Perlin noise
|
|
3447
|
-
*/ function grad(hash, x, y) {
|
|
3448
|
-
const h = 15 & hash, u = h < 8 ? x : y, v = h < 4 ? y : 12 === h || 14 === h ? x : 0;
|
|
3449
|
-
return (1 & h ? -u : u) + (2 & h ? -v : v);
|
|
3450
|
-
}
|
|
3451
|
-
|
|
3452
|
-
/**
|
|
3453
|
-
* Permutation table for Perlin noise
|
|
3454
|
-
*/ const p = (() => {
|
|
3455
|
-
const permutation = [];
|
|
3456
|
-
for (let i = 0; i < 256; i++) permutation[i] = Math.floor(256 * Math.random());
|
|
3457
|
-
// Duplicate for overflow handling
|
|
3458
|
-
return [ ...permutation, ...permutation ];
|
|
3459
|
-
})(), {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
3354
|
+
}, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
3460
3355
|
|
|
3461
3356
|
const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new WeakMap, setCachedBackgroundDetection = (parentElement, overLightConfig, result, threshold) => {
|
|
3462
3357
|
parentElement && backgroundDetectionCache.set(parentElement, {
|
|
@@ -3471,10 +3366,7 @@ const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new Weak
|
|
|
3471
3366
|
* Composable hook for AtomixGlass component logic
|
|
3472
3367
|
* Manages all state, calculations, and event handlers
|
|
3473
3368
|
*/
|
|
3474
|
-
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
|
|
3475
|
-
// Default priority
|
|
3476
|
-
// Phase 1: Animation System Props
|
|
3477
|
-
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}) {
|
|
3369
|
+
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}) {
|
|
3478
3370
|
// State
|
|
3479
3371
|
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), resolvedBorder = useMemo((() =>
|
|
3480
3372
|
/**
|
|
@@ -3526,52 +3418,10 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
|
|
|
3526
3418
|
}), scaleVelocityRef = useRef({
|
|
3527
3419
|
x: 0,
|
|
3528
3420
|
y: 0
|
|
3529
|
-
})
|
|
3530
|
-
useRef(0);
|
|
3531
|
-
const mouseVelocityRef = useRef({
|
|
3421
|
+
}), mouseVelocityRef = useRef({
|
|
3532
3422
|
x: 0,
|
|
3533
3423
|
y: 0
|
|
3534
|
-
}), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1),
|
|
3535
|
-
// If quality preset is provided, use it as base
|
|
3536
|
-
const preset = (quality = distortionQuality, ATOMIX_GLASS.CONSTANTS.DISTORTION_QUALITY_PRESETS[quality]);
|
|
3537
|
-
// Override with custom values if provided
|
|
3538
|
-
var quality;
|
|
3539
|
-
return {
|
|
3540
|
-
octaves: distortionOctaves ?? preset.octaves,
|
|
3541
|
-
lacunarity: distortionLacunarity ?? preset.lacunarity,
|
|
3542
|
-
gain: distortionGain ?? preset.gain
|
|
3543
|
-
};
|
|
3544
|
-
}), [ distortionQuality, distortionOctaves, distortionLacunarity, distortionGain ]), fbmEngine = useMemo((() => withMultiLayerDistortion ? createFBMEngine(fbmConfig) : null), [ withMultiLayerDistortion, fbmConfig ]), effectiveReducedMotion = useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveWithTimeAnimation = useMemo((() => withTimeAnimation && !effectiveReducedMotion), [ withTimeAnimation, effectiveReducedMotion ]);
|
|
3545
|
-
/**
|
|
3546
|
-
* Animation loop for time-based effects
|
|
3547
|
-
*/
|
|
3548
|
-
useEffect((() => {
|
|
3549
|
-
if (!effectiveWithTimeAnimation || "undefined" == typeof window) return;
|
|
3550
|
-
let lastFrameTime = performance.now();
|
|
3551
|
-
/**
|
|
3552
|
-
* Animation frame handler
|
|
3553
|
-
*/ const animate = currentTime => {
|
|
3554
|
-
// Calculate delta time
|
|
3555
|
-
const deltaTime = currentTime - lastFrameTime;
|
|
3556
|
-
lastFrameTime = currentTime;
|
|
3557
|
-
// Apply animation speed multiplier
|
|
3558
|
-
const scaledDelta = deltaTime * animationSpeed;
|
|
3559
|
-
elapsedTimeRef.current += scaledDelta, shaderTimeRef.current = elapsedTimeRef.current,
|
|
3560
|
-
// Continue animation loop
|
|
3561
|
-
animationFrameIdRef.current = requestAnimationFrame(animate);
|
|
3562
|
-
};
|
|
3563
|
-
// Start animation
|
|
3564
|
-
// Cleanup
|
|
3565
|
-
return animationStartTimeRef.current = performance.now(), animationFrameIdRef.current = requestAnimationFrame(animate),
|
|
3566
|
-
() => {
|
|
3567
|
-
null !== animationFrameIdRef.current && (cancelAnimationFrame(animationFrameIdRef.current),
|
|
3568
|
-
animationFrameIdRef.current = null);
|
|
3569
|
-
};
|
|
3570
|
-
}), [ effectiveWithTimeAnimation, animationSpeed ]);
|
|
3571
|
-
/**
|
|
3572
|
-
* Get current shader time for animations
|
|
3573
|
-
*/
|
|
3574
|
-
const getShaderTime = useCallback((() => shaderTimeRef.current), []), applyTimeBasedDistortion = useCallback((uv => effectiveWithTimeAnimation && fbmEngine ? liquidGlassWithTime(uv, shaderTimeRef.current, fbmConfig) : uv), [ effectiveWithTimeAnimation, fbmEngine, fbmConfig ]), effectiveBorderRadius = useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
|
|
3424
|
+
}), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1), effectiveReducedMotion = useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveBorderRadius = useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
|
|
3575
3425
|
const [glassSize, setGlassSize] = useState({
|
|
3576
3426
|
width: 270,
|
|
3577
3427
|
height: 69
|
|
@@ -3631,9 +3481,6 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
|
|
|
3631
3481
|
effectiveBorderRadius: effectiveBorderRadius,
|
|
3632
3482
|
cachedRectRef: cachedRectRef
|
|
3633
3483
|
}), effectiveHighContrast = useMemo((() => highContrast || userPrefersHighContrast), [ highContrast, userPrefersHighContrast ]), effectiveWithoutEffects = useMemo((() => withoutEffects || effectiveReducedMotion), [ withoutEffects, effectiveReducedMotion ]), globalMousePosition = externalGlobalMousePosition || internalGlobalMousePositionRef.current, mouseOffset = externalMouseOffset || internalMouseOffsetRef.current;
|
|
3634
|
-
/**
|
|
3635
|
-
* Apply time-based distortion to UV coordinates
|
|
3636
|
-
*/
|
|
3637
3484
|
// Extract border-radius from children
|
|
3638
3485
|
useEffect((() => {
|
|
3639
3486
|
const extractRadius = () => {
|
|
@@ -3793,7 +3640,7 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
|
|
|
3793
3640
|
* Get effective overLight value based on configuration
|
|
3794
3641
|
*/
|
|
3795
3642
|
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((() => {
|
|
3796
|
-
const isOverLight = getEffectiveOverLight(), hoverIntensity
|
|
3643
|
+
const isOverLight = getEffectiveOverLight(), {hoverIntensity: hoverIntensity, activeIntensity: activeIntensity} = getInteractionIntensity(isHovered, isActive), baseConfig = {
|
|
3797
3644
|
isOverLight: isOverLight,
|
|
3798
3645
|
threshold: .7,
|
|
3799
3646
|
opacity: isOverLight ? Math.min(.6, Math.max(.2, .5 * hoverIntensity * activeIntensity)) : 0,
|
|
@@ -3837,8 +3684,8 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
|
|
|
3837
3684
|
};
|
|
3838
3685
|
const curG = internalGlobalMousePositionRef.current, tgtG = targetGlobalMousePositionRef.current;
|
|
3839
3686
|
internalGlobalMousePositionRef.current = {
|
|
3840
|
-
x: lerp
|
|
3841
|
-
y: lerp
|
|
3687
|
+
x: lerp(curG.x, tgtG.x, CONSTANTS.LERP_FACTOR),
|
|
3688
|
+
y: lerp(curG.y, tgtG.y, CONSTANTS.LERP_FACTOR)
|
|
3842
3689
|
};
|
|
3843
3690
|
// ── Calculate Elastic Physics ─────────────────────────────────────
|
|
3844
3691
|
let targetElasticTranslation = {
|
|
@@ -4005,8 +3852,6 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
|
|
|
4005
3852
|
overLightConfig: overLightConfig,
|
|
4006
3853
|
resolvedBorder: resolvedBorder,
|
|
4007
3854
|
transformStyle: transformStyle,
|
|
4008
|
-
getShaderTime: getShaderTime,
|
|
4009
|
-
applyTimeBasedDistortion: applyTimeBasedDistortion,
|
|
4010
3855
|
handleMouseEnter: handleMouseEnter,
|
|
4011
3856
|
handleMouseLeave: handleMouseLeave,
|
|
4012
3857
|
handleMouseDown: handleMouseDown,
|
|
@@ -4420,12 +4265,6 @@ function usePerformanceMonitor$1(config = {}) {
|
|
|
4420
4265
|
};
|
|
4421
4266
|
}
|
|
4422
4267
|
|
|
4423
|
-
/**
|
|
4424
|
-
* Debug Overlay Component (Optional)
|
|
4425
|
-
*
|
|
4426
|
-
* Shows real-time performance metrics on screen.
|
|
4427
|
-
* Only rendered when showOverlay is enabled.
|
|
4428
|
-
*/
|
|
4429
4268
|
/**
|
|
4430
4269
|
* Mobile optimization presets
|
|
4431
4270
|
*
|
|
@@ -4435,8 +4274,7 @@ function usePerformanceMonitor$1(config = {}) {
|
|
|
4435
4274
|
/**
|
|
4436
4275
|
* Performance preset - Maximum FPS, reduced quality
|
|
4437
4276
|
* Best for low-end devices or when battery saving is priority
|
|
4438
|
-
*/
|
|
4439
|
-
const PERFORMANCE_PRESET = {
|
|
4277
|
+
*/ const PERFORMANCE_PRESET = {
|
|
4440
4278
|
distortionOctaves: 2,
|
|
4441
4279
|
// Minimal FBM layers
|
|
4442
4280
|
displacementScale: 50,
|
|
@@ -4605,7 +4443,7 @@ function getDevicePreset(presetName) {
|
|
|
4605
4443
|
var explicit, position;
|
|
4606
4444
|
/**
|
|
4607
4445
|
* Extracts layout-related properties from a React `CSSProperties` object.
|
|
4608
|
-
*/ const {isHovered: isHovered, isActive: isActive, glassSize: glassSize, effectiveBorderRadius: effectiveBorderRadius, effectiveReducedMotion: effectiveReducedMotion, effectiveHighContrast: effectiveHighContrast, effectiveWithoutEffects: effectiveWithoutEffects, overLightConfig: overLightConfig, globalMousePosition: globalMousePosition, mouseOffset: mouseOffset, transformStyle: transformStyle,
|
|
4446
|
+
*/ 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({
|
|
4609
4447
|
glassRef: glassRef,
|
|
4610
4448
|
contentRef: contentRef,
|
|
4611
4449
|
wrapperRef: internalWrapperRef,
|
|
@@ -4629,14 +4467,7 @@ function getDevicePreset(presetName) {
|
|
|
4629
4467
|
withBorder: withBorder,
|
|
4630
4468
|
debugBorderRadius: debugBorderRadius,
|
|
4631
4469
|
style: style,
|
|
4632
|
-
isFixedOrSticky: isFixedOrSticky
|
|
4633
|
-
withTimeAnimation: withTimeAnimation,
|
|
4634
|
-
animationSpeed: animationSpeed,
|
|
4635
|
-
withMultiLayerDistortion: withMultiLayerDistortion,
|
|
4636
|
-
distortionOctaves: distortionOctaves,
|
|
4637
|
-
distortionLacunarity: distortionLacunarity,
|
|
4638
|
-
distortionGain: distortionGain,
|
|
4639
|
-
distortionQuality: distortionQuality
|
|
4470
|
+
isFixedOrSticky: isFixedOrSticky
|
|
4640
4471
|
});
|
|
4641
4472
|
useResponsiveGlass({
|
|
4642
4473
|
baseParams: {
|
|
@@ -4874,7 +4705,6 @@ function getDevicePreset(presetName) {
|
|
|
4874
4705
|
shaderVariant: shaderVariant,
|
|
4875
4706
|
withLiquidBlur: withLiquidBlur,
|
|
4876
4707
|
isFixedOrSticky: isFixedOrSticky,
|
|
4877
|
-
shaderTime: getShaderTime(),
|
|
4878
4708
|
withTimeAnimation: withTimeAnimation,
|
|
4879
4709
|
animationSpeed: animationSpeed,
|
|
4880
4710
|
withMultiLayerDistortion: withMultiLayerDistortion,
|
|
@@ -5168,40 +4998,15 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5168
4998
|
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",
|
|
5169
4999
|
fill: color
|
|
5170
5000
|
}) ]
|
|
5171
|
-
}),
|
|
5172
|
-
// Add input validation
|
|
5173
|
-
if ("number" != typeof a || "number" != typeof b || "number" != typeof t) return 0;
|
|
5174
|
-
const clamped = Math.max(0, Math.min(1, (t - a) / (b - a)));
|
|
5175
|
-
return clamped * clamped * (3 - 2 * clamped);
|
|
5176
|
-
}, calculateLength = (x, y) => {
|
|
5177
|
-
// Add input validation and error handling
|
|
5178
|
-
if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y)) return 0;
|
|
5179
|
-
// Prevent potential overflow
|
|
5180
|
-
const maxX = Math.max(Math.abs(x), Math.abs(y));
|
|
5181
|
-
if (0 === maxX) return 0;
|
|
5182
|
-
const scaledX = x / maxX, scaledY = y / maxX;
|
|
5183
|
-
return maxX * Math.sqrt(scaledX * scaledX + scaledY * scaledY);
|
|
5184
|
-
}, roundedRectSDF = (x, y, width, height, radius) => {
|
|
5001
|
+
}), roundedRectSDF = (x, y, width, height, radius) => {
|
|
5185
5002
|
// Add input validation
|
|
5186
5003
|
if ("number" != typeof x || "number" != typeof y || "number" != typeof width || "number" != typeof height || "number" != typeof radius) return 0;
|
|
5187
5004
|
const qx = Math.abs(x) - width + radius, qy = Math.abs(y) - height + radius;
|
|
5188
|
-
return Math.min(Math.max(qx, qy), 0) +
|
|
5005
|
+
return Math.min(Math.max(qx, qy), 0) + vec2Length(Math.max(qx, 0), Math.max(qy, 0)) - radius;
|
|
5189
5006
|
}, createTexture = (x, y) => ({
|
|
5190
5007
|
x: "number" != typeof x || isNaN(x) ? .5 : Math.max(0, Math.min(1, x)),
|
|
5191
5008
|
y: "number" != typeof y || isNaN(y) ? .5 : Math.max(0, Math.min(1, y))
|
|
5192
|
-
}), validateVec2 = vec => vec && "number" == typeof vec.x && "number" == typeof vec.y && !isNaN(vec.x) && !isNaN(vec.y),
|
|
5193
|
-
// Add input validation
|
|
5194
|
-
"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 => {
|
|
5195
|
-
// Add input validation
|
|
5196
|
-
if ("number" != typeof t || isNaN(t)) return 0;
|
|
5197
|
-
const clampedT = Math.max(0, Math.min(1, t));
|
|
5198
|
-
return clampedT < .5 ? 4 * clampedT * clampedT * clampedT : 1 - Math.pow(-2 * clampedT + 2, 3) / 2;
|
|
5199
|
-
}, easeOutQuart = t => {
|
|
5200
|
-
// Add input validation
|
|
5201
|
-
if ("number" != typeof t || isNaN(t)) return 0;
|
|
5202
|
-
const clampedT = Math.max(0, Math.min(1, t));
|
|
5203
|
-
return 1 - Math.pow(1 - clampedT, 4);
|
|
5204
|
-
}, noise2D = (x, y) => {
|
|
5009
|
+
}), validateVec2 = vec => vec && "number" == typeof vec.x && "number" == typeof vec.y && !isNaN(vec.x) && !isNaN(vec.y), noise2D = (x, y) => {
|
|
5205
5010
|
// Add input validation
|
|
5206
5011
|
if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y)) return 0;
|
|
5207
5012
|
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) => {
|
|
@@ -5240,13 +5045,13 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5240
5045
|
x: .5,
|
|
5241
5046
|
y: .5
|
|
5242
5047
|
};
|
|
5243
|
-
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 =
|
|
5048
|
+
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) => {
|
|
5244
5049
|
// Add input validation
|
|
5245
5050
|
if ("number" != typeof x || "number" != typeof y || isNaN(x) || isNaN(y) || isNaN(strength)) return {
|
|
5246
5051
|
x: 0,
|
|
5247
5052
|
y: 0
|
|
5248
5053
|
};
|
|
5249
|
-
const distance =
|
|
5054
|
+
const distance = vec2Length(x, y), distortion = Math.pow(Math.min(distance, 10), 2) * strength;
|
|
5250
5055
|
// Limit distance to prevent extreme values
|
|
5251
5056
|
return {
|
|
5252
5057
|
x: x * (1 + distortion),
|
|
@@ -5258,7 +5063,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5258
5063
|
x: 0,
|
|
5259
5064
|
y: 0
|
|
5260
5065
|
};
|
|
5261
|
-
const distance =
|
|
5066
|
+
const distance = vec2Length(x, y);
|
|
5262
5067
|
// Prevent division by zero and extreme values
|
|
5263
5068
|
if (0 === distance) return {
|
|
5264
5069
|
x: 0,
|
|
@@ -5269,8 +5074,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5269
5074
|
x: Math.cos(angle) * distance * intensity,
|
|
5270
5075
|
y: Math.sin(angle) * distance * intensity
|
|
5271
5076
|
};
|
|
5272
|
-
})(ix, iy, .015 * baseDisplacement), scaled =
|
|
5273
|
-
return createTexture(
|
|
5077
|
+
})(ix, iy, .015 * baseDisplacement), scaled = smoothstepEdge(0, 1, 1.15 * baseDisplacement), finalX = ix + totalDistortionX + .5 * chromaticOffset.x, finalY = iy + totalDistortionY + .5 * chromaticOffset.y;
|
|
5078
|
+
return createTexture(clamp(finalX * scaled + .5, 0, 1), clamp(finalY * scaled + .5, 0, 1));
|
|
5274
5079
|
},
|
|
5275
5080
|
// Premium Apple-style fluid glass with enhanced organic flow
|
|
5276
5081
|
appleFluid: (uv, mousePosition) => {
|
|
@@ -5278,8 +5083,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5278
5083
|
x: .5,
|
|
5279
5084
|
y: .5
|
|
5280
5085
|
};
|
|
5281
|
-
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 =
|
|
5282
|
-
return createTexture(
|
|
5086
|
+
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;
|
|
5087
|
+
return createTexture(clamp(ix + (.035 * organicX + fluidVelocityX + vortexX) * mask + .5, 0, 1), clamp(totalY + .5, 0, 1));
|
|
5283
5088
|
},
|
|
5284
5089
|
// High-end glass with advanced refraction and depth
|
|
5285
5090
|
premiumGlass: (uv, mousePosition) => {
|
|
@@ -5287,7 +5092,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5287
5092
|
x: .5,
|
|
5288
5093
|
y: .5
|
|
5289
5094
|
};
|
|
5290
|
-
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 =
|
|
5095
|
+
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);
|
|
5291
5096
|
// Multi-layer depth effect
|
|
5292
5097
|
let depthX = 0, depthY = 0;
|
|
5293
5098
|
for (let layer = 0; layer < 3; layer++) {
|
|
@@ -5295,8 +5100,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5295
5100
|
depthX += Math.sin(ix * layerScale + layerTime) * layerStrength, depthY += Math.cos(iy * layerScale - layerTime) * layerStrength;
|
|
5296
5101
|
}
|
|
5297
5102
|
// Glass refraction with mouse influence
|
|
5298
|
-
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 =
|
|
5299
|
-
return createTexture(
|
|
5103
|
+
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;
|
|
5104
|
+
return createTexture(clamp(ix + (refractionX + depthX + .015 * organicNoise) * edgeMask + .5, 0, 1), clamp(finalY + .5, 0, 1));
|
|
5300
5105
|
},
|
|
5301
5106
|
// Metallic liquid effect with shimmer
|
|
5302
5107
|
liquidMetal: (uv, mousePosition) => {
|
|
@@ -5304,8 +5109,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5304
5109
|
x: .5,
|
|
5305
5110
|
y: .5
|
|
5306
5111
|
};
|
|
5307
|
-
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 =
|
|
5308
|
-
return createTexture(
|
|
5112
|
+
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;
|
|
5113
|
+
return createTexture(clamp(totalX + .5, 0, 1), clamp(totalY + .5, 0, 1));
|
|
5309
5114
|
},
|
|
5310
5115
|
// basiBasi - Expert Premium Glass Shader
|
|
5311
5116
|
// The most advanced shader with caustics, spectral dispersion, parallax depth, and volumetric effects
|
|
@@ -5314,7 +5119,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5314
5119
|
x: .5,
|
|
5315
5120
|
y: .5
|
|
5316
5121
|
};
|
|
5317
|
-
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 =
|
|
5122
|
+
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) =>
|
|
5318
5123
|
// Add input validation
|
|
5319
5124
|
"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) => {
|
|
5320
5125
|
// Add input validation
|
|
@@ -5332,7 +5137,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5332
5137
|
y: 0
|
|
5333
5138
|
}
|
|
5334
5139
|
};
|
|
5335
|
-
const distance =
|
|
5140
|
+
const distance = vec2Length(x, y), dispersionStrength = Math.min(.025 * distance, 1), redOffset = .8 * dispersionStrength, greenOffset = 1 * dispersionStrength, blueOffset = 1.2 * dispersionStrength;
|
|
5336
5141
|
return {
|
|
5337
5142
|
r: {
|
|
5338
5143
|
x: Math.cos(angle) * redOffset,
|
|
@@ -5372,8 +5177,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5372
5177
|
return turbulence;
|
|
5373
5178
|
})(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) =>
|
|
5374
5179
|
// Add input validation
|
|
5375
|
-
"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 =
|
|
5376
|
-
return createTexture(
|
|
5180
|
+
"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;
|
|
5181
|
+
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));
|
|
5377
5182
|
},
|
|
5378
5183
|
// Aliases for compatibility
|
|
5379
5184
|
plasma: (uv, mousePosition) => fragmentShaders.premiumGlass(uv, mousePosition),
|
|
@@ -5415,8 +5220,8 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5415
5220
|
let dx = pos.x * w - x, dy = pos.y * h - y;
|
|
5416
5221
|
// Apply edge smoothing for Apple-like effect
|
|
5417
5222
|
const edgeX = 2 * Math.min(x / w, (w - x) / w), edgeY = 2 * Math.min(y / h, (h - y) / h), edgeFactor = Math.min(edgeX, edgeY);
|
|
5418
|
-
dx *=
|
|
5419
|
-
rawValues.push(dx, dy);
|
|
5223
|
+
dx *= smoothstepEdge(0, .2, edgeFactor), dy *= smoothstepEdge(0, .2, edgeFactor),
|
|
5224
|
+
maxScale = Math.max(maxScale, Math.abs(dx), Math.abs(dy)), rawValues.push(dx, dy);
|
|
5420
5225
|
}
|
|
5421
5226
|
// Improved normalization to prevent artifacts while maintaining intensity
|
|
5422
5227
|
maxScale = Math.max(maxScale, 1);
|
|
@@ -5426,9 +5231,9 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5426
5231
|
let rawIndex = 0;
|
|
5427
5232
|
for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) {
|
|
5428
5233
|
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);
|
|
5429
|
-
data[pixelIndex] =
|
|
5430
|
-
data[pixelIndex + 1] =
|
|
5431
|
-
data[pixelIndex + 2] =
|
|
5234
|
+
data[pixelIndex] = clamp(255 * r, 0, 255), // Red channel (X displacement)
|
|
5235
|
+
data[pixelIndex + 1] = clamp(255 * g, 0, 255), // Green channel (Y displacement)
|
|
5236
|
+
data[pixelIndex + 2] = clamp(255 * g, 0, 255), // Blue channel (Y displacement for SVG filter compatibility)
|
|
5432
5237
|
data[pixelIndex + 3] = 255;
|
|
5433
5238
|
}
|
|
5434
5239
|
return this.context.putImageData(imageData, 0, 0), this.canvas.toDataURL();
|
|
@@ -5456,9 +5261,7 @@ const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24
|
|
|
5456
5261
|
return this.canvasDPI;
|
|
5457
5262
|
}
|
|
5458
5263
|
},
|
|
5459
|
-
|
|
5460
|
-
fragmentShaders: fragmentShaders,
|
|
5461
|
-
liquidGlassWithTime: liquidGlassWithTime
|
|
5264
|
+
fragmentShaders: fragmentShaders
|
|
5462
5265
|
}, Symbol.toStringTag, {
|
|
5463
5266
|
value: "Module"
|
|
5464
5267
|
})), sizeMap = {
|
|
@@ -13888,48 +13691,11 @@ const composablesImport = Object.freeze( Object.defineProperty({
|
|
|
13888
13691
|
DeviceDetector: DeviceDetector,
|
|
13889
13692
|
MOBILE_OPTIMIZED_BREAKPOINTS: MOBILE_OPTIMIZED_BREAKPOINTS,
|
|
13890
13693
|
PERFORMANCE_PRESET: PERFORMANCE_PRESET,
|
|
13891
|
-
PerformanceOverlay: function({metrics: metrics}) {
|
|
13892
|
-
return null;
|
|
13893
|
-
// Performance overlay removed - will be implemented as separate component
|
|
13894
|
-
}
|
|
13895
|
-
/**
|
|
13896
|
-
* Utility to get quality multipliers for glass parameters
|
|
13897
|
-
*/ ,
|
|
13898
13694
|
QUALITY_PRESET: QUALITY_PRESET,
|
|
13899
13695
|
createBreakpoints: createBreakpoints$1,
|
|
13900
13696
|
getDefaultBreakpoints: getDefaultBreakpoints,
|
|
13901
13697
|
getDevicePreset: getDevicePreset,
|
|
13902
13698
|
getMobileOptimizedParams: getMobileOptimizedParams,
|
|
13903
|
-
getQualityMultipliers: function(quality) {
|
|
13904
|
-
switch (quality) {
|
|
13905
|
-
case "low":
|
|
13906
|
-
return {
|
|
13907
|
-
distortionOctaves: 2,
|
|
13908
|
-
displacementScale: .6,
|
|
13909
|
-
blurAmount: .7,
|
|
13910
|
-
animationSpeed: .8,
|
|
13911
|
-
chromaticIntensity: .5
|
|
13912
|
-
};
|
|
13913
|
-
|
|
13914
|
-
case "medium":
|
|
13915
|
-
return {
|
|
13916
|
-
distortionOctaves: 4,
|
|
13917
|
-
displacementScale: .85,
|
|
13918
|
-
blurAmount: .9,
|
|
13919
|
-
animationSpeed: .95,
|
|
13920
|
-
chromaticIntensity: .75
|
|
13921
|
-
};
|
|
13922
|
-
|
|
13923
|
-
case "high":
|
|
13924
|
-
return {
|
|
13925
|
-
distortionOctaves: 5,
|
|
13926
|
-
displacementScale: 1,
|
|
13927
|
-
blurAmount: 1,
|
|
13928
|
-
animationSpeed: 1,
|
|
13929
|
-
chromaticIntensity: 1
|
|
13930
|
-
};
|
|
13931
|
-
}
|
|
13932
|
-
},
|
|
13933
13699
|
useAccordion: useAccordion,
|
|
13934
13700
|
useAtomixGlass: useAtomixGlass,
|
|
13935
13701
|
useBadge: useBadge,
|