@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/heavy.js
CHANGED
|
@@ -63,20 +63,20 @@ import { Pause, Play, SkipBack, SkipForward, SpeakerX, SpeakerHigh, Gear, Downlo
|
|
|
63
63
|
SHADER: "c-atomix-glass--shader"
|
|
64
64
|
},
|
|
65
65
|
DEFAULTS: {
|
|
66
|
-
DISPLACEMENT_SCALE:
|
|
67
|
-
BLUR_AMOUNT:
|
|
66
|
+
DISPLACEMENT_SCALE: 70,
|
|
67
|
+
BLUR_AMOUNT: 0,
|
|
68
68
|
SATURATION: 140,
|
|
69
|
-
ABERRATION_INTENSITY: 2
|
|
70
|
-
ELASTICITY: .
|
|
71
|
-
CORNER_RADIUS:
|
|
69
|
+
ABERRATION_INTENSITY: 2,
|
|
70
|
+
ELASTICITY: .15,
|
|
71
|
+
CORNER_RADIUS: 20,
|
|
72
72
|
// Default border-radius matching design system
|
|
73
|
-
PADDING: "0
|
|
73
|
+
PADDING: "0",
|
|
74
74
|
MODE: "standard",
|
|
75
75
|
OVER_LIGHT: !1,
|
|
76
76
|
ENABLE_OVER_LIGHT_LAYERS: !0
|
|
77
77
|
},
|
|
78
78
|
CONSTANTS: {
|
|
79
|
-
ACTIVATION_ZONE:
|
|
79
|
+
ACTIVATION_ZONE: 200,
|
|
80
80
|
LERP_FACTOR: .08,
|
|
81
81
|
SMOOTHSTEP_POWER: 2.5,
|
|
82
82
|
MIN_BLUR: .1,
|
|
@@ -479,10 +479,7 @@ let idCounter = 0;
|
|
|
479
479
|
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 = {
|
|
480
480
|
x: 0,
|
|
481
481
|
y: 0
|
|
482
|
-
},
|
|
483
|
-
x: 0,
|
|
484
|
-
y: 0
|
|
485
|
-
}, 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 = {
|
|
482
|
+
}, 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 = {
|
|
486
483
|
width: 0,
|
|
487
484
|
height: 0
|
|
488
485
|
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, contentRef: contentRef}, ref) => {
|
|
@@ -626,21 +623,18 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
626
623
|
backdropFilter: `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`
|
|
627
624
|
};
|
|
628
625
|
}
|
|
629
|
-
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur ]), containerVars = useMemo((() => {
|
|
626
|
+
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur, overLightConfig ]), containerVars = useMemo((() => {
|
|
630
627
|
try {
|
|
631
628
|
// Safe extraction of mouse offset values
|
|
632
629
|
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;
|
|
633
630
|
return {
|
|
634
|
-
"--atomix-glass-container-width": `${glassSize?.width}`,
|
|
635
|
-
"--atomix-glass-container-height": `${glassSize?.height}`,
|
|
636
|
-
"--atomix-glass-container-padding": padding || "0 0",
|
|
637
631
|
"--atomix-glass-container-radius": `${"number" != typeof borderRadius || isNaN(borderRadius) ? 0 : borderRadius}px`,
|
|
638
632
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
639
633
|
"--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",
|
|
640
634
|
"--atomix-glass-container-shadow-opacity": effectiveWithoutEffects ? 0 : 1,
|
|
641
635
|
// Background and shadow values use design token-aligned RGB values
|
|
642
636
|
"--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",
|
|
643
|
-
"--atomix-glass-container-text-shadow": overLight ? "0px 2px
|
|
637
|
+
"--atomix-glass-container-text-shadow": overLight ? "0px 1px 2px rgba(255, 255, 255, 0.15)" : "0px 2px 12px rgba(0, 0, 0, 0.4)",
|
|
644
638
|
"--atomix-glass-container-box-shadow": overLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0px 12px 40px rgba(0, 0, 0, 0.25)"
|
|
645
639
|
};
|
|
646
640
|
} catch (error) {
|
|
@@ -655,7 +649,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
655
649
|
"--atomix-glass-container-text-shadow": "none"
|
|
656
650
|
};
|
|
657
651
|
}
|
|
658
|
-
}), [
|
|
652
|
+
}), [ borderRadius, backdropStyle, mouseOffset, overLight, effectiveWithoutEffects, overLightConfig ]);
|
|
659
653
|
return jsx("div", {
|
|
660
654
|
ref: el => {
|
|
661
655
|
// Apply force no-transition
|
|
@@ -684,10 +678,6 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
684
678
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
685
679
|
shaderMapUrl: shaderMapUrl
|
|
686
680
|
}), jsx("div", {
|
|
687
|
-
ref: el => {
|
|
688
|
-
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
689
|
-
el.style.setProperty("transition-delay", "0s", "important"));
|
|
690
|
-
},
|
|
691
681
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
692
682
|
style: {
|
|
693
683
|
filter: `url(#${filterId})`
|
|
@@ -792,7 +782,7 @@ class {
|
|
|
792
782
|
}
|
|
793
783
|
}, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
794
784
|
if (!wrapperElement && !containerElement) return;
|
|
795
|
-
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 = {
|
|
785
|
+
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 = {
|
|
796
786
|
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
797
787
|
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
798
788
|
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
@@ -882,7 +872,7 @@ class {
|
|
|
882
872
|
}
|
|
883
873
|
// Update Container Styles (containerVars)
|
|
884
874
|
if (containerElement) {
|
|
885
|
-
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER =
|
|
875
|
+
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();
|
|
886
876
|
let liquidBlur = {
|
|
887
877
|
baseBlur: blurAmount,
|
|
888
878
|
edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
|
|
@@ -904,14 +894,15 @@ class {
|
|
|
904
894
|
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})`;
|
|
905
895
|
// Container variables
|
|
906
896
|
const style = containerElement.style;
|
|
907
|
-
style.setProperty("--atomix-glass-container-width", `${glassSize.width}`
|
|
897
|
+
style.setProperty("--atomix-glass-container-width", isFixedOrSticky ? `${glassSize.width}` : "100%"),
|
|
898
|
+
style.setProperty("--atomix-glass-container-height", isFixedOrSticky ? `${glassSize.height}` : "100%"),
|
|
908
899
|
style.setProperty("--atomix-glass-container-padding", padding), style.setProperty("--atomix-glass-container-radius", `${effectiveBorderRadius}px`),
|
|
909
900
|
style.setProperty("--atomix-glass-container-backdrop", backdropFilterString),
|
|
910
901
|
// Shadows
|
|
911
902
|
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"),
|
|
912
903
|
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
913
904
|
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"),
|
|
914
|
-
style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 2px
|
|
905
|
+
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)"),
|
|
915
906
|
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)");
|
|
916
907
|
}
|
|
917
908
|
}, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
@@ -932,7 +923,7 @@ class {
|
|
|
932
923
|
* Composable hook for AtomixGlass component logic
|
|
933
924
|
* Manages all state, calculations, and event handlers
|
|
934
925
|
*/
|
|
935
|
-
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,
|
|
926
|
+
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}) {
|
|
936
927
|
// State
|
|
937
928
|
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), cachedRectRef = useRef(null), internalGlobalMousePositionRef = useRef({
|
|
938
929
|
x: 0,
|
|
@@ -1243,12 +1234,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1243
1234
|
withLiquidBlur: withLiquidBlur,
|
|
1244
1235
|
blurAmount: blurAmount,
|
|
1245
1236
|
saturation: saturation,
|
|
1246
|
-
padding: padding
|
|
1237
|
+
padding: padding,
|
|
1238
|
+
isFixedOrSticky: isFixedOrSticky
|
|
1247
1239
|
}), lerpRafRef.current = requestAnimationFrame(tick);
|
|
1248
1240
|
};
|
|
1249
1241
|
// 0.08 – lower = more viscous
|
|
1250
1242
|
lerpRafRef.current = requestAnimationFrame(tick);
|
|
1251
|
-
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]), stopLerpLoop = useCallback((() => {
|
|
1243
|
+
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding, isFixedOrSticky ]), stopLerpLoop = useCallback((() => {
|
|
1252
1244
|
lerpActiveRef.current = !1, null !== lerpRafRef.current && (cancelAnimationFrame(lerpRafRef.current),
|
|
1253
1245
|
lerpRafRef.current = null);
|
|
1254
1246
|
}), []);
|
|
@@ -1395,7 +1387,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1395
1387
|
* <div>Content with debug logging enabled</div>
|
|
1396
1388
|
* </AtomixGlass>
|
|
1397
1389
|
*/ 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}) {
|
|
1398
|
-
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({
|
|
1390
|
+
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({
|
|
1399
1391
|
glassRef: glassRef,
|
|
1400
1392
|
contentRef: contentRef,
|
|
1401
1393
|
borderRadius: borderRadius,
|
|
@@ -1416,8 +1408,9 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1416
1408
|
saturation: saturation,
|
|
1417
1409
|
withLiquidBlur: withLiquidBlur,
|
|
1418
1410
|
padding: padding,
|
|
1419
|
-
style: style
|
|
1420
|
-
|
|
1411
|
+
style: style,
|
|
1412
|
+
isFixedOrSticky: isFixedOrSticky
|
|
1413
|
+
}), isOverLight = useMemo((() => overLightConfig.isOverLight), [ overLightConfig.isOverLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, rootLayoutStyle = useMemo((() => {
|
|
1421
1414
|
if (!isFixedOrSticky) return {};
|
|
1422
1415
|
const {position: p, top: t, left: l, right: r, bottom: b} = restStyle;
|
|
1423
1416
|
return {
|
|
@@ -1437,7 +1430,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1437
1430
|
bottom: b
|
|
1438
1431
|
}
|
|
1439
1432
|
};
|
|
1440
|
-
}), [ isFixedOrSticky, restStyle ])
|
|
1433
|
+
}), [ isFixedOrSticky, restStyle ]);
|
|
1434
|
+
// Calculate base style with transforms
|
|
1435
|
+
// When layout is hoisted to the root, strip those props from the container
|
|
1436
|
+
useMemo((() => {
|
|
1441
1437
|
if (isFixedOrSticky) {
|
|
1442
1438
|
const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
|
|
1443
1439
|
return {
|
|
@@ -1453,18 +1449,20 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1453
1449
|
transform: transformStyle
|
|
1454
1450
|
}
|
|
1455
1451
|
};
|
|
1456
|
-
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ])
|
|
1452
|
+
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ]);
|
|
1453
|
+
// Build className with state modifiers
|
|
1454
|
+
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((() => ({
|
|
1457
1455
|
position: isFixedOrSticky ? "absolute" : restStyle.position || "absolute",
|
|
1458
1456
|
top: isFixedOrSticky ? 0 : restStyle.top || 0,
|
|
1459
1457
|
left: isFixedOrSticky ? 0 : restStyle.left || 0
|
|
1460
1458
|
})), [ isFixedOrSticky, restStyle.position, restStyle.top, restStyle.left ]), adjustedSize = useMemo((() => {
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
};
|
|
1459
|
+
// Keep a reference to positionStyles to avoid unused-variable lint,
|
|
1460
|
+
// but sizing is driven by explicit width/height or measured size.
|
|
1461
|
+
positionStyles.position;
|
|
1462
|
+
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;
|
|
1465
1463
|
return {
|
|
1466
|
-
width:
|
|
1467
|
-
height:
|
|
1464
|
+
width: resolveLength(effectiveWidth, glassSize.width),
|
|
1465
|
+
height: resolveLength(effectiveHeight, glassSize.height)
|
|
1468
1466
|
};
|
|
1469
1467
|
}), [ width, height, restStyle.width, restStyle.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
1470
1468
|
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
@@ -1513,9 +1511,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1513
1511
|
},
|
|
1514
1512
|
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
1515
1513
|
"--atomix-glass-transform": transformStyle || "none",
|
|
1516
|
-
|
|
1517
|
-
"--atomix-glass-
|
|
1518
|
-
"--atomix-glass-
|
|
1514
|
+
// Internal decorative layers are positioned relative to the root;
|
|
1515
|
+
"--atomix-glass-position": rootLayoutStyle.position,
|
|
1516
|
+
"--atomix-glass-top": `${isFixedOrSticky ? rootLayoutStyle.top : 0}px`,
|
|
1517
|
+
"--atomix-glass-left": `${isFixedOrSticky ? rootLayoutStyle.left : 0}px`,
|
|
1519
1518
|
"--atomix-glass-width": adjustedSize.width,
|
|
1520
1519
|
"--atomix-glass-height": adjustedSize.height,
|
|
1521
1520
|
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
@@ -1535,10 +1534,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1535
1534
|
"--atomix-glass-overlay-highlight-opacity": opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
|
|
1536
1535
|
"--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}%)`
|
|
1537
1536
|
};
|
|
1538
|
-
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle,
|
|
1537
|
+
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, adjustedSize, isOverLight, overLightConfig.borderOpacity, customZIndex, rootLayoutStyle, isFixedOrSticky ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
1539
1538
|
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(" ")
|
|
1540
1539
|
});
|
|
1541
|
-
|
|
1540
|
+
// Calculate position and size styles for internal layers
|
|
1541
|
+
// When root is fixed/sticky, internal layers use absolute (relative to root)
|
|
1542
|
+
return jsxs("div", {
|
|
1542
1543
|
...rest,
|
|
1543
1544
|
className: componentClassName,
|
|
1544
1545
|
style: {
|
|
@@ -1555,7 +1556,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1555
1556
|
ref: glassRef,
|
|
1556
1557
|
contentRef: contentRef,
|
|
1557
1558
|
className: className,
|
|
1558
|
-
style:
|
|
1559
|
+
style: {
|
|
1560
|
+
...restStyle,
|
|
1561
|
+
...!isFixedOrSticky && {
|
|
1562
|
+
position: "relative"
|
|
1563
|
+
}
|
|
1564
|
+
},
|
|
1559
1565
|
borderRadius: effectiveBorderRadius,
|
|
1560
1566
|
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
1561
1567
|
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
@@ -1586,7 +1592,6 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1586
1592
|
},
|
|
1587
1593
|
onClick: onClick,
|
|
1588
1594
|
mode: mode,
|
|
1589
|
-
transform: baseStyle.transform,
|
|
1590
1595
|
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
1591
1596
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
1592
1597
|
shaderVariant: shaderVariant,
|