@shohojdhara/atomix 0.4.7 → 0.4.8
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 +24 -37
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +51 -46
- package/dist/charts.js.map +1 -1
- package/dist/core.js +51 -46
- package/dist/core.js.map +1 -1
- package/dist/forms.js +51 -46
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +51 -46
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +51 -46
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +51 -46
- 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/scripts/atomix-cli.js +40 -1875
- package/scripts/cli/commands/build-theme.js +112 -0
- package/scripts/cli/commands/generate.js +97 -0
- package/scripts/cli/commands/init.js +46 -0
- package/scripts/cli/internal/compiler.js +114 -0
- package/scripts/cli/internal/filesystem.js +58 -0
- package/scripts/cli/internal/generator.js +110 -0
- package/scripts/cli/internal/wizard.js +61 -0
- package/scripts/cli/utils/error.js +47 -0
- package/scripts/cli/utils/helpers.js +43 -0
- package/scripts/cli/utils/logger.js +75 -0
- package/scripts/cli/utils/validation.js +71 -0
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +37 -3
- package/src/components/AtomixGlass/AtomixGlass.tsx +41 -29
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +4 -19
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +216 -0
- package/src/lib/composables/useAtomixGlass.ts +4 -1
- package/src/lib/composables/useAtomixGlassStyles.ts +9 -7
- package/src/lib/constants/components.ts +7 -7
- package/src/styles/06-components/_components.atomix-glass.scss +17 -21
- package/src/styles/06-components/_components.edge-panel.scss +1 -5
- package/src/styles/06-components/_components.modal.scss +1 -4
- package/src/styles/06-components/_components.navbar.scss +1 -1
- package/src/styles/06-components/_components.tooltip.scss +9 -5
- package/scripts/cli/component-generator.js +0 -564
- package/scripts/cli/interactive-init.js +0 -357
- package/scripts/cli/utils.js +0 -359
package/dist/forms.js
CHANGED
|
@@ -45,20 +45,20 @@ import React, { memo, forwardRef, useMemo, useState, useRef, useEffect, useCallb
|
|
|
45
45
|
SHADER: "c-atomix-glass--shader"
|
|
46
46
|
},
|
|
47
47
|
DEFAULTS: {
|
|
48
|
-
DISPLACEMENT_SCALE:
|
|
49
|
-
BLUR_AMOUNT:
|
|
48
|
+
DISPLACEMENT_SCALE: 70,
|
|
49
|
+
BLUR_AMOUNT: 0,
|
|
50
50
|
SATURATION: 140,
|
|
51
|
-
ABERRATION_INTENSITY: 2
|
|
52
|
-
ELASTICITY: .
|
|
53
|
-
CORNER_RADIUS:
|
|
51
|
+
ABERRATION_INTENSITY: 2,
|
|
52
|
+
ELASTICITY: .15,
|
|
53
|
+
CORNER_RADIUS: 20,
|
|
54
54
|
// Default border-radius matching design system
|
|
55
|
-
PADDING: "0
|
|
55
|
+
PADDING: "0",
|
|
56
56
|
MODE: "standard",
|
|
57
57
|
OVER_LIGHT: !1,
|
|
58
58
|
ENABLE_OVER_LIGHT_LAYERS: !0
|
|
59
59
|
},
|
|
60
60
|
CONSTANTS: {
|
|
61
|
-
ACTIVATION_ZONE:
|
|
61
|
+
ACTIVATION_ZONE: 200,
|
|
62
62
|
LERP_FACTOR: .08,
|
|
63
63
|
SMOOTHSTEP_POWER: 2.5,
|
|
64
64
|
MIN_BLUR: .1,
|
|
@@ -463,10 +463,7 @@ let idCounter = 0;
|
|
|
463
463
|
const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({children: children, className: className = "", style: style, displacementScale: displacementScale = 25, blurAmount: blurAmount = .0625, saturation: saturation = 180, aberrationIntensity: aberrationIntensity = 2, mouseOffset: mouseOffset = {
|
|
464
464
|
x: 0,
|
|
465
465
|
y: 0
|
|
466
|
-
},
|
|
467
|
-
x: 0,
|
|
468
|
-
y: 0
|
|
469
|
-
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isHovered: isHovered = !1, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, borderRadius: borderRadius = 0, padding: padding = "0 0", glassSize: glassSize = {
|
|
466
|
+
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, borderRadius: borderRadius = 0, padding: padding = "0 0", glassSize: glassSize = {
|
|
470
467
|
width: 0,
|
|
471
468
|
height: 0
|
|
472
469
|
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, contentRef: contentRef}, ref) => {
|
|
@@ -610,21 +607,18 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
610
607
|
backdropFilter: `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`
|
|
611
608
|
};
|
|
612
609
|
}
|
|
613
|
-
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur ]), containerVars = useMemo((() => {
|
|
610
|
+
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur, overLightConfig ]), containerVars = useMemo((() => {
|
|
614
611
|
try {
|
|
615
612
|
// Safe extraction of mouse offset values
|
|
616
613
|
const mx = mouseOffset && "number" == typeof mouseOffset.x && !isNaN(mouseOffset.x) ? mouseOffset.x : 0, my = mouseOffset && "number" == typeof mouseOffset.y && !isNaN(mouseOffset.y) ? mouseOffset.y : 0;
|
|
617
614
|
return {
|
|
618
|
-
"--atomix-glass-container-width": `${glassSize?.width}`,
|
|
619
|
-
"--atomix-glass-container-height": `${glassSize?.height}`,
|
|
620
|
-
"--atomix-glass-container-padding": padding || "0 0",
|
|
621
615
|
"--atomix-glass-container-radius": `${"number" != typeof borderRadius || isNaN(borderRadius) ? 0 : borderRadius}px`,
|
|
622
616
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
623
617
|
"--atomix-glass-container-shadow": overLight ? [ `inset 0 1px 0 rgba(255, 255, 255, ${(.4 + .002 * mx) * (overLightConfig?.shadowIntensity || 1)})`, `inset 0 -1px 0 rgba(0, 0, 0, ${(.2 + .001 * Math.abs(my)) * (overLightConfig?.shadowIntensity || 1)})`, `inset 0 0 20px rgba(0, 0, 0, ${(.08 + .001 * Math.abs(mx + my)) * (overLightConfig?.shadowIntensity || 1)})`, `0 2px 12px rgba(0, 0, 0, ${(.12 + .002 * Math.abs(my)) * (overLightConfig?.shadowIntensity || 1)})` ].join(", ") : "0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset",
|
|
624
618
|
"--atomix-glass-container-shadow-opacity": effectiveWithoutEffects ? 0 : 1,
|
|
625
619
|
// Background and shadow values use design token-aligned RGB values
|
|
626
620
|
"--atomix-glass-container-bg": overLight ? `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",
|
|
627
|
-
"--atomix-glass-container-text-shadow": overLight ? "0px 2px
|
|
621
|
+
"--atomix-glass-container-text-shadow": overLight ? "0px 1px 2px rgba(255, 255, 255, 0.15)" : "0px 2px 12px rgba(0, 0, 0, 0.4)",
|
|
628
622
|
"--atomix-glass-container-box-shadow": overLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0px 12px 40px rgba(0, 0, 0, 0.25)"
|
|
629
623
|
};
|
|
630
624
|
} catch (error) {
|
|
@@ -639,7 +633,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
639
633
|
"--atomix-glass-container-text-shadow": "none"
|
|
640
634
|
};
|
|
641
635
|
}
|
|
642
|
-
}), [
|
|
636
|
+
}), [ borderRadius, backdropStyle, mouseOffset, overLight, effectiveWithoutEffects, overLightConfig ]);
|
|
643
637
|
return jsx("div", {
|
|
644
638
|
ref: el => {
|
|
645
639
|
// Apply force no-transition
|
|
@@ -668,10 +662,6 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
668
662
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
669
663
|
shaderMapUrl: shaderMapUrl
|
|
670
664
|
}), jsx("div", {
|
|
671
|
-
ref: el => {
|
|
672
|
-
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
673
|
-
el.style.setProperty("transition-delay", "0s", "important"));
|
|
674
|
-
},
|
|
675
665
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
676
666
|
style: {
|
|
677
667
|
filter: `url(#${filterId})`
|
|
@@ -776,7 +766,7 @@ class {
|
|
|
776
766
|
}
|
|
777
767
|
}, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
778
768
|
if (!wrapperElement && !containerElement) return;
|
|
779
|
-
const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, directionalScale: directionalScale, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, overLightConfig = {
|
|
769
|
+
const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, directionalScale: directionalScale, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING, isFixedOrSticky: isFixedOrSticky = !1} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, overLightConfig = {
|
|
780
770
|
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
781
771
|
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
782
772
|
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
@@ -866,7 +856,7 @@ class {
|
|
|
866
856
|
}
|
|
867
857
|
// Update Container Styles (containerVars)
|
|
868
858
|
if (containerElement) {
|
|
869
|
-
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER =
|
|
859
|
+
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER = .5, CENTER_BLUR_MULTIPLIER = .2, FLOW_BLUR_MULTIPLIER = .3, MOUSE_INFLUENCE_BLUR_FACTOR = .4, EDGE_INTENSITY_MOUSE_FACTOR = .15, CENTER_INTENSITY_MOUSE_FACTOR = .1, MAX_BLUR_RELATIVE = 2, rect = containerElement.getBoundingClientRect();
|
|
870
860
|
let liquidBlur = {
|
|
871
861
|
baseBlur: blurAmount,
|
|
872
862
|
edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
|
|
@@ -888,14 +878,15 @@ class {
|
|
|
888
878
|
backdropFilterString = !withLiquidBlur || effectiveReducedMotion || effectiveWithoutEffects || area > 18e4 ? `blur(${clampBlur(Math.max(liquidBlur.baseBlur, .8 * liquidBlur.edgeBlur, 1.1 * liquidBlur.centerBlur, .9 * liquidBlur.flowBlur))}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig.contrast}) brightness(${overLightConfig.brightness})` : `blur(${clampBlur(.4 * liquidBlur.baseBlur + .25 * liquidBlur.edgeBlur + .15 * liquidBlur.centerBlur + .2 * liquidBlur.flowBlur)}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig.contrast}) brightness(${overLightConfig.brightness})`;
|
|
889
879
|
// Container variables
|
|
890
880
|
const style = containerElement.style;
|
|
891
|
-
style.setProperty("--atomix-glass-container-width", `${glassSize.width}`
|
|
881
|
+
style.setProperty("--atomix-glass-container-width", isFixedOrSticky ? `${glassSize.width}` : "100%"),
|
|
882
|
+
style.setProperty("--atomix-glass-container-height", isFixedOrSticky ? `${glassSize.height}` : "100%"),
|
|
892
883
|
style.setProperty("--atomix-glass-container-padding", padding), style.setProperty("--atomix-glass-container-radius", `${effectiveBorderRadius}px`),
|
|
893
884
|
style.setProperty("--atomix-glass-container-backdrop", backdropFilterString),
|
|
894
885
|
// Shadows
|
|
895
886
|
style.setProperty("--atomix-glass-container-shadow", isOverLight ? [ `inset 0 1px 0 rgba(255, 255, 255, ${(.4 + .002 * mx) * (overLightConfig.shadowIntensity || 1)})`, `inset 0 -1px 0 rgba(0, 0, 0, ${(.2 + .001 * Math.abs(my)) * (overLightConfig.shadowIntensity || 1)})`, `inset 0 0 20px rgba(0, 0, 0, ${(.08 + .001 * Math.abs(mx + my)) * (overLightConfig.shadowIntensity || 1)})`, `0 2px 12px rgba(0, 0, 0, ${(.12 + .002 * Math.abs(my)) * (overLightConfig.shadowIntensity || 1)})` ].join(", ") : "0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset"),
|
|
896
887
|
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
897
888
|
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"),
|
|
898
|
-
style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 2px
|
|
889
|
+
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)"),
|
|
899
890
|
style.setProperty("--atomix-glass-container-box-shadow", isOverLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0px 12px 40px rgba(0, 0, 0, 0.25)");
|
|
900
891
|
}
|
|
901
892
|
}, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
@@ -916,7 +907,7 @@ class {
|
|
|
916
907
|
* Composable hook for AtomixGlass component logic
|
|
917
908
|
* Manages all state, calculations, and event handlers
|
|
918
909
|
*/
|
|
919
|
-
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, elasticity: elasticity = .05, onClick: onClick, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1,
|
|
910
|
+
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, elasticity: elasticity = .05, onClick: onClick, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, children: children, blurAmount: blurAmount, saturation: saturation, padding: padding, withLiquidBlur: withLiquidBlur, isFixedOrSticky: isFixedOrSticky = !1}) {
|
|
920
911
|
// State
|
|
921
912
|
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), cachedRectRef = useRef(null), internalGlobalMousePositionRef = useRef({
|
|
922
913
|
x: 0,
|
|
@@ -1227,12 +1218,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1227
1218
|
withLiquidBlur: withLiquidBlur,
|
|
1228
1219
|
blurAmount: blurAmount,
|
|
1229
1220
|
saturation: saturation,
|
|
1230
|
-
padding: padding
|
|
1221
|
+
padding: padding,
|
|
1222
|
+
isFixedOrSticky: isFixedOrSticky
|
|
1231
1223
|
}), lerpRafRef.current = requestAnimationFrame(tick);
|
|
1232
1224
|
};
|
|
1233
1225
|
// 0.08 – lower = more viscous
|
|
1234
1226
|
lerpRafRef.current = requestAnimationFrame(tick);
|
|
1235
|
-
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]), stopLerpLoop = useCallback((() => {
|
|
1227
|
+
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding, isFixedOrSticky ]), stopLerpLoop = useCallback((() => {
|
|
1236
1228
|
lerpActiveRef.current = !1, null !== lerpRafRef.current && (cancelAnimationFrame(lerpRafRef.current),
|
|
1237
1229
|
lerpRafRef.current = null);
|
|
1238
1230
|
}), []);
|
|
@@ -1379,7 +1371,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1379
1371
|
* <div>Content with debug logging enabled</div>
|
|
1380
1372
|
* </AtomixGlass>
|
|
1381
1373
|
*/ function AtomixGlass({children: children, displacementScale: displacementScale = ATOMIX_GLASS.DEFAULTS.DISPLACEMENT_SCALE, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, aberrationIntensity: aberrationIntensity = ATOMIX_GLASS.DEFAULTS.ABERRATION_INTENSITY, elasticity: elasticity = ATOMIX_GLASS.DEFAULTS.ELASTICITY, borderRadius: borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer: mouseContainer = null, className: className = "", padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING, overLight: overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT, style: style = {}, mode: mode = ATOMIX_GLASS.DEFAULTS.MODE, onClick: onClick, shaderVariant: shaderVariant = "liquidGlass", "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, reducedMotion: reducedMotion = !1, highContrast: highContrast = !1, withoutEffects: withoutEffects = !1, withLiquidBlur: withLiquidBlur = !1, withBorder: withBorder = !0, withOverLightLayers: withOverLightLayers = ATOMIX_GLASS.DEFAULTS.ENABLE_OVER_LIGHT_LAYERS, debugPerformance: debugPerformance = !1, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, height: height, width: width, ...rest}) {
|
|
1382
|
-
const glassRef = useRef(null), contentRef = useRef(null), {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} = useAtomixGlass({
|
|
1374
|
+
const glassRef = useRef(null), contentRef = useRef(null), {zIndex: customZIndex, ...restStyle} = style, isFixedOrSticky = "fixed" === restStyle.position || "sticky" === restStyle.position, {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} = useAtomixGlass({
|
|
1383
1375
|
glassRef: glassRef,
|
|
1384
1376
|
contentRef: contentRef,
|
|
1385
1377
|
borderRadius: borderRadius,
|
|
@@ -1400,8 +1392,9 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1400
1392
|
saturation: saturation,
|
|
1401
1393
|
withLiquidBlur: withLiquidBlur,
|
|
1402
1394
|
padding: padding,
|
|
1403
|
-
style: style
|
|
1404
|
-
|
|
1395
|
+
style: style,
|
|
1396
|
+
isFixedOrSticky: isFixedOrSticky
|
|
1397
|
+
}), isOverLight = useMemo((() => overLightConfig.isOverLight), [ overLightConfig.isOverLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, rootLayoutStyle = useMemo((() => {
|
|
1405
1398
|
if (!isFixedOrSticky) return {};
|
|
1406
1399
|
const {position: p, top: t, left: l, right: r, bottom: b} = restStyle;
|
|
1407
1400
|
return {
|
|
@@ -1421,7 +1414,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1421
1414
|
bottom: b
|
|
1422
1415
|
}
|
|
1423
1416
|
};
|
|
1424
|
-
}), [ isFixedOrSticky, restStyle ])
|
|
1417
|
+
}), [ isFixedOrSticky, restStyle ]);
|
|
1418
|
+
// Calculate base style with transforms
|
|
1419
|
+
// When layout is hoisted to the root, strip those props from the container
|
|
1420
|
+
useMemo((() => {
|
|
1425
1421
|
if (isFixedOrSticky) {
|
|
1426
1422
|
const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
|
|
1427
1423
|
return {
|
|
@@ -1437,18 +1433,20 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1437
1433
|
transform: transformStyle
|
|
1438
1434
|
}
|
|
1439
1435
|
};
|
|
1440
|
-
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ])
|
|
1436
|
+
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ]);
|
|
1437
|
+
// Build className with state modifiers
|
|
1438
|
+
const componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`, effectiveWithoutEffects && `${ATOMIX_GLASS.BASE_CLASS}--disabled-effects`, className ].filter(Boolean).join(" "), positionStyles = useMemo((() => ({
|
|
1441
1439
|
position: isFixedOrSticky ? "absolute" : restStyle.position || "absolute",
|
|
1442
1440
|
top: isFixedOrSticky ? 0 : restStyle.top || 0,
|
|
1443
1441
|
left: isFixedOrSticky ? 0 : restStyle.left || 0
|
|
1444
1442
|
})), [ isFixedOrSticky, restStyle.position, restStyle.top, restStyle.left ]), adjustedSize = useMemo((() => {
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
};
|
|
1443
|
+
// Keep a reference to positionStyles to avoid unused-variable lint,
|
|
1444
|
+
// but sizing is driven by explicit width/height or measured size.
|
|
1445
|
+
positionStyles.position;
|
|
1446
|
+
const resolveLength = (value, measured) => void 0 !== value ? "number" == typeof value ? `${value}px` : value : measured > 0 ? `${measured}px` : "100%", effectiveWidth = width ?? restStyle.width, effectiveHeight = height ?? restStyle.height;
|
|
1449
1447
|
return {
|
|
1450
|
-
width:
|
|
1451
|
-
height:
|
|
1448
|
+
width: resolveLength(effectiveWidth, glassSize.width),
|
|
1449
|
+
height: resolveLength(effectiveHeight, glassSize.height)
|
|
1452
1450
|
};
|
|
1453
1451
|
}), [ width, height, restStyle.width, restStyle.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
1454
1452
|
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
@@ -1497,9 +1495,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1497
1495
|
},
|
|
1498
1496
|
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
1499
1497
|
"--atomix-glass-transform": transformStyle || "none",
|
|
1500
|
-
|
|
1501
|
-
"--atomix-glass-
|
|
1502
|
-
"--atomix-glass-
|
|
1498
|
+
// Internal decorative layers are positioned relative to the root;
|
|
1499
|
+
"--atomix-glass-position": rootLayoutStyle.position,
|
|
1500
|
+
"--atomix-glass-top": `${isFixedOrSticky ? rootLayoutStyle.top : 0}px`,
|
|
1501
|
+
"--atomix-glass-left": `${isFixedOrSticky ? rootLayoutStyle.left : 0}px`,
|
|
1503
1502
|
"--atomix-glass-width": adjustedSize.width,
|
|
1504
1503
|
"--atomix-glass-height": adjustedSize.height,
|
|
1505
1504
|
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
@@ -1519,10 +1518,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1519
1518
|
"--atomix-glass-overlay-highlight-opacity": opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
|
|
1520
1519
|
"--atomix-glass-overlay-highlight-bg": `radial-gradient(circle at ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_X}% ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_Y}%, rgba(255, 255, 255, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.WHITE_OPACITY}) 0%, transparent ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.STOP}%)`
|
|
1521
1520
|
};
|
|
1522
|
-
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle,
|
|
1521
|
+
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, adjustedSize, isOverLight, overLightConfig.borderOpacity, customZIndex, rootLayoutStyle, isFixedOrSticky ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
1523
1522
|
className: [ ATOMIX_GLASS.BACKGROUND_LAYER_CLASS, "dark" === layerType ? ATOMIX_GLASS.BACKGROUND_LAYER_DARK_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_BLACK_CLASS, isOverLight ? ATOMIX_GLASS.BACKGROUND_LAYER_OVER_LIGHT_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_HIDDEN_CLASS ].filter(Boolean).join(" ")
|
|
1524
1523
|
});
|
|
1525
|
-
|
|
1524
|
+
// Calculate position and size styles for internal layers
|
|
1525
|
+
// When root is fixed/sticky, internal layers use absolute (relative to root)
|
|
1526
|
+
return jsxs("div", {
|
|
1526
1527
|
...rest,
|
|
1527
1528
|
className: componentClassName,
|
|
1528
1529
|
style: {
|
|
@@ -1539,7 +1540,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1539
1540
|
ref: glassRef,
|
|
1540
1541
|
contentRef: contentRef,
|
|
1541
1542
|
className: className,
|
|
1542
|
-
style:
|
|
1543
|
+
style: {
|
|
1544
|
+
...restStyle,
|
|
1545
|
+
...!isFixedOrSticky && {
|
|
1546
|
+
position: "relative"
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1543
1549
|
borderRadius: effectiveBorderRadius,
|
|
1544
1550
|
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
1545
1551
|
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
@@ -1570,7 +1576,6 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1570
1576
|
},
|
|
1571
1577
|
onClick: onClick,
|
|
1572
1578
|
mode: mode,
|
|
1573
|
-
transform: baseStyle.transform,
|
|
1574
1579
|
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
1575
1580
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
1576
1581
|
shaderVariant: shaderVariant,
|