@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/charts.js
CHANGED
|
@@ -497,20 +497,20 @@ const _reduceInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
497
497
|
SHADER: "c-atomix-glass--shader"
|
|
498
498
|
},
|
|
499
499
|
DEFAULTS: {
|
|
500
|
-
DISPLACEMENT_SCALE:
|
|
501
|
-
BLUR_AMOUNT:
|
|
500
|
+
DISPLACEMENT_SCALE: 70,
|
|
501
|
+
BLUR_AMOUNT: 0,
|
|
502
502
|
SATURATION: 140,
|
|
503
|
-
ABERRATION_INTENSITY: 2
|
|
504
|
-
ELASTICITY: .
|
|
505
|
-
CORNER_RADIUS:
|
|
503
|
+
ABERRATION_INTENSITY: 2,
|
|
504
|
+
ELASTICITY: .15,
|
|
505
|
+
CORNER_RADIUS: 20,
|
|
506
506
|
// Default border-radius matching design system
|
|
507
|
-
PADDING: "0
|
|
507
|
+
PADDING: "0",
|
|
508
508
|
MODE: "standard",
|
|
509
509
|
OVER_LIGHT: !1,
|
|
510
510
|
ENABLE_OVER_LIGHT_LAYERS: !0
|
|
511
511
|
},
|
|
512
512
|
CONSTANTS: {
|
|
513
|
-
ACTIVATION_ZONE:
|
|
513
|
+
ACTIVATION_ZONE: 200,
|
|
514
514
|
LERP_FACTOR: .08,
|
|
515
515
|
SMOOTHSTEP_POWER: 2.5,
|
|
516
516
|
MIN_BLUR: .1,
|
|
@@ -1769,10 +1769,7 @@ let idCounter = 0;
|
|
|
1769
1769
|
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 = {
|
|
1770
1770
|
x: 0,
|
|
1771
1771
|
y: 0
|
|
1772
|
-
},
|
|
1773
|
-
x: 0,
|
|
1774
|
-
y: 0
|
|
1775
|
-
}, 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 = {
|
|
1772
|
+
}, 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 = {
|
|
1776
1773
|
width: 0,
|
|
1777
1774
|
height: 0
|
|
1778
1775
|
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, contentRef: contentRef}, ref) => {
|
|
@@ -1916,21 +1913,18 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
1916
1913
|
backdropFilter: `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`
|
|
1917
1914
|
};
|
|
1918
1915
|
}
|
|
1919
|
-
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur ]), containerVars = useMemo((() => {
|
|
1916
|
+
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur, overLightConfig ]), containerVars = useMemo((() => {
|
|
1920
1917
|
try {
|
|
1921
1918
|
// Safe extraction of mouse offset values
|
|
1922
1919
|
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;
|
|
1923
1920
|
return {
|
|
1924
|
-
"--atomix-glass-container-width": `${glassSize?.width}`,
|
|
1925
|
-
"--atomix-glass-container-height": `${glassSize?.height}`,
|
|
1926
|
-
"--atomix-glass-container-padding": padding || "0 0",
|
|
1927
1921
|
"--atomix-glass-container-radius": `${"number" != typeof borderRadius || isNaN(borderRadius) ? 0 : borderRadius}px`,
|
|
1928
1922
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
1929
1923
|
"--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",
|
|
1930
1924
|
"--atomix-glass-container-shadow-opacity": effectiveWithoutEffects ? 0 : 1,
|
|
1931
1925
|
// Background and shadow values use design token-aligned RGB values
|
|
1932
1926
|
"--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",
|
|
1933
|
-
"--atomix-glass-container-text-shadow": overLight ? "0px 2px
|
|
1927
|
+
"--atomix-glass-container-text-shadow": overLight ? "0px 1px 2px rgba(255, 255, 255, 0.15)" : "0px 2px 12px rgba(0, 0, 0, 0.4)",
|
|
1934
1928
|
"--atomix-glass-container-box-shadow": overLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0px 12px 40px rgba(0, 0, 0, 0.25)"
|
|
1935
1929
|
};
|
|
1936
1930
|
} catch (error) {
|
|
@@ -1945,7 +1939,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
1945
1939
|
"--atomix-glass-container-text-shadow": "none"
|
|
1946
1940
|
};
|
|
1947
1941
|
}
|
|
1948
|
-
}), [
|
|
1942
|
+
}), [ borderRadius, backdropStyle, mouseOffset, overLight, effectiveWithoutEffects, overLightConfig ]);
|
|
1949
1943
|
return jsx("div", {
|
|
1950
1944
|
ref: el => {
|
|
1951
1945
|
// Apply force no-transition
|
|
@@ -1974,10 +1968,6 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
1974
1968
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
1975
1969
|
shaderMapUrl: shaderMapUrl
|
|
1976
1970
|
}), jsx("div", {
|
|
1977
|
-
ref: el => {
|
|
1978
|
-
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
1979
|
-
el.style.setProperty("transition-delay", "0s", "important"));
|
|
1980
|
-
},
|
|
1981
1971
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
1982
1972
|
style: {
|
|
1983
1973
|
filter: `url(#${filterId})`
|
|
@@ -2082,7 +2072,7 @@ class {
|
|
|
2082
2072
|
}
|
|
2083
2073
|
}, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
2084
2074
|
if (!wrapperElement && !containerElement) return;
|
|
2085
|
-
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 = {
|
|
2075
|
+
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 = {
|
|
2086
2076
|
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
2087
2077
|
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
2088
2078
|
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
@@ -2172,7 +2162,7 @@ class {
|
|
|
2172
2162
|
}
|
|
2173
2163
|
// Update Container Styles (containerVars)
|
|
2174
2164
|
if (containerElement) {
|
|
2175
|
-
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER =
|
|
2165
|
+
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();
|
|
2176
2166
|
let liquidBlur = {
|
|
2177
2167
|
baseBlur: blurAmount,
|
|
2178
2168
|
edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
|
|
@@ -2194,14 +2184,15 @@ class {
|
|
|
2194
2184
|
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})`;
|
|
2195
2185
|
// Container variables
|
|
2196
2186
|
const style = containerElement.style;
|
|
2197
|
-
style.setProperty("--atomix-glass-container-width", `${glassSize.width}`
|
|
2187
|
+
style.setProperty("--atomix-glass-container-width", isFixedOrSticky ? `${glassSize.width}` : "100%"),
|
|
2188
|
+
style.setProperty("--atomix-glass-container-height", isFixedOrSticky ? `${glassSize.height}` : "100%"),
|
|
2198
2189
|
style.setProperty("--atomix-glass-container-padding", padding), style.setProperty("--atomix-glass-container-radius", `${effectiveBorderRadius}px`),
|
|
2199
2190
|
style.setProperty("--atomix-glass-container-backdrop", backdropFilterString),
|
|
2200
2191
|
// Shadows
|
|
2201
2192
|
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"),
|
|
2202
2193
|
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
2203
2194
|
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"),
|
|
2204
|
-
style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 2px
|
|
2195
|
+
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)"),
|
|
2205
2196
|
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)");
|
|
2206
2197
|
}
|
|
2207
2198
|
}, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
@@ -2222,7 +2213,7 @@ class {
|
|
|
2222
2213
|
* Composable hook for AtomixGlass component logic
|
|
2223
2214
|
* Manages all state, calculations, and event handlers
|
|
2224
2215
|
*/
|
|
2225
|
-
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,
|
|
2216
|
+
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}) {
|
|
2226
2217
|
// State
|
|
2227
2218
|
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), cachedRectRef = useRef(null), internalGlobalMousePositionRef = useRef({
|
|
2228
2219
|
x: 0,
|
|
@@ -2533,12 +2524,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2533
2524
|
withLiquidBlur: withLiquidBlur,
|
|
2534
2525
|
blurAmount: blurAmount,
|
|
2535
2526
|
saturation: saturation,
|
|
2536
|
-
padding: padding
|
|
2527
|
+
padding: padding,
|
|
2528
|
+
isFixedOrSticky: isFixedOrSticky
|
|
2537
2529
|
}), lerpRafRef.current = requestAnimationFrame(tick);
|
|
2538
2530
|
};
|
|
2539
2531
|
// 0.08 – lower = more viscous
|
|
2540
2532
|
lerpRafRef.current = requestAnimationFrame(tick);
|
|
2541
|
-
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]), stopLerpLoop = useCallback((() => {
|
|
2533
|
+
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding, isFixedOrSticky ]), stopLerpLoop = useCallback((() => {
|
|
2542
2534
|
lerpActiveRef.current = !1, null !== lerpRafRef.current && (cancelAnimationFrame(lerpRafRef.current),
|
|
2543
2535
|
lerpRafRef.current = null);
|
|
2544
2536
|
}), []);
|
|
@@ -2685,7 +2677,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2685
2677
|
* <div>Content with debug logging enabled</div>
|
|
2686
2678
|
* </AtomixGlass>
|
|
2687
2679
|
*/ 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}) {
|
|
2688
|
-
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({
|
|
2680
|
+
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({
|
|
2689
2681
|
glassRef: glassRef,
|
|
2690
2682
|
contentRef: contentRef,
|
|
2691
2683
|
borderRadius: borderRadius,
|
|
@@ -2706,8 +2698,9 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2706
2698
|
saturation: saturation,
|
|
2707
2699
|
withLiquidBlur: withLiquidBlur,
|
|
2708
2700
|
padding: padding,
|
|
2709
|
-
style: style
|
|
2710
|
-
|
|
2701
|
+
style: style,
|
|
2702
|
+
isFixedOrSticky: isFixedOrSticky
|
|
2703
|
+
}), isOverLight = useMemo((() => overLightConfig.isOverLight), [ overLightConfig.isOverLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, rootLayoutStyle = useMemo((() => {
|
|
2711
2704
|
if (!isFixedOrSticky) return {};
|
|
2712
2705
|
const {position: p, top: t, left: l, right: r, bottom: b} = restStyle;
|
|
2713
2706
|
return {
|
|
@@ -2727,7 +2720,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2727
2720
|
bottom: b
|
|
2728
2721
|
}
|
|
2729
2722
|
};
|
|
2730
|
-
}), [ isFixedOrSticky, restStyle ])
|
|
2723
|
+
}), [ isFixedOrSticky, restStyle ]);
|
|
2724
|
+
// Calculate base style with transforms
|
|
2725
|
+
// When layout is hoisted to the root, strip those props from the container
|
|
2726
|
+
useMemo((() => {
|
|
2731
2727
|
if (isFixedOrSticky) {
|
|
2732
2728
|
const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
|
|
2733
2729
|
return {
|
|
@@ -2743,18 +2739,20 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2743
2739
|
transform: transformStyle
|
|
2744
2740
|
}
|
|
2745
2741
|
};
|
|
2746
|
-
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ])
|
|
2742
|
+
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ]);
|
|
2743
|
+
// Build className with state modifiers
|
|
2744
|
+
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((() => ({
|
|
2747
2745
|
position: isFixedOrSticky ? "absolute" : restStyle.position || "absolute",
|
|
2748
2746
|
top: isFixedOrSticky ? 0 : restStyle.top || 0,
|
|
2749
2747
|
left: isFixedOrSticky ? 0 : restStyle.left || 0
|
|
2750
2748
|
})), [ isFixedOrSticky, restStyle.position, restStyle.top, restStyle.left ]), adjustedSize = useMemo((() => {
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
};
|
|
2749
|
+
// Keep a reference to positionStyles to avoid unused-variable lint,
|
|
2750
|
+
// but sizing is driven by explicit width/height or measured size.
|
|
2751
|
+
positionStyles.position;
|
|
2752
|
+
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;
|
|
2755
2753
|
return {
|
|
2756
|
-
width:
|
|
2757
|
-
height:
|
|
2754
|
+
width: resolveLength(effectiveWidth, glassSize.width),
|
|
2755
|
+
height: resolveLength(effectiveHeight, glassSize.height)
|
|
2758
2756
|
};
|
|
2759
2757
|
}), [ width, height, restStyle.width, restStyle.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
2760
2758
|
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
@@ -2803,9 +2801,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2803
2801
|
},
|
|
2804
2802
|
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
2805
2803
|
"--atomix-glass-transform": transformStyle || "none",
|
|
2806
|
-
|
|
2807
|
-
"--atomix-glass-
|
|
2808
|
-
"--atomix-glass-
|
|
2804
|
+
// Internal decorative layers are positioned relative to the root;
|
|
2805
|
+
"--atomix-glass-position": rootLayoutStyle.position,
|
|
2806
|
+
"--atomix-glass-top": `${isFixedOrSticky ? rootLayoutStyle.top : 0}px`,
|
|
2807
|
+
"--atomix-glass-left": `${isFixedOrSticky ? rootLayoutStyle.left : 0}px`,
|
|
2809
2808
|
"--atomix-glass-width": adjustedSize.width,
|
|
2810
2809
|
"--atomix-glass-height": adjustedSize.height,
|
|
2811
2810
|
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
@@ -2825,10 +2824,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2825
2824
|
"--atomix-glass-overlay-highlight-opacity": opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
|
|
2826
2825
|
"--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}%)`
|
|
2827
2826
|
};
|
|
2828
|
-
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle,
|
|
2827
|
+
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, adjustedSize, isOverLight, overLightConfig.borderOpacity, customZIndex, rootLayoutStyle, isFixedOrSticky ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
2829
2828
|
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(" ")
|
|
2830
2829
|
});
|
|
2831
|
-
|
|
2830
|
+
// Calculate position and size styles for internal layers
|
|
2831
|
+
// When root is fixed/sticky, internal layers use absolute (relative to root)
|
|
2832
|
+
return jsxs("div", {
|
|
2832
2833
|
...rest,
|
|
2833
2834
|
className: componentClassName,
|
|
2834
2835
|
style: {
|
|
@@ -2845,7 +2846,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2845
2846
|
ref: glassRef,
|
|
2846
2847
|
contentRef: contentRef,
|
|
2847
2848
|
className: className,
|
|
2848
|
-
style:
|
|
2849
|
+
style: {
|
|
2850
|
+
...restStyle,
|
|
2851
|
+
...!isFixedOrSticky && {
|
|
2852
|
+
position: "relative"
|
|
2853
|
+
}
|
|
2854
|
+
},
|
|
2849
2855
|
borderRadius: effectiveBorderRadius,
|
|
2850
2856
|
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
2851
2857
|
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
@@ -2876,7 +2882,6 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2876
2882
|
},
|
|
2877
2883
|
onClick: onClick,
|
|
2878
2884
|
mode: mode,
|
|
2879
|
-
transform: baseStyle.transform,
|
|
2880
2885
|
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
2881
2886
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
2882
2887
|
shaderVariant: shaderVariant,
|