@shohojdhara/atomix 0.3.14 → 0.3.15
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/CHANGELOG.md +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +43 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +67 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +203 -90
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +3 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +43 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +67 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +9 -61
- package/dist/index.esm.js +237 -286
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -299
- 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 +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +369 -870
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +2 -2
- package/src/components/AtomixGlass/shader-utils.ts +5 -0
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -35
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +213 -1
- package/src/components/Badge/Badge.stories.tsx +121 -362
- package/src/components/Block/Block.stories.tsx +21 -12
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
- package/src/components/Button/Button.stories.tsx +463 -1126
- package/src/components/Button/Button.test.tsx +107 -0
- package/src/components/Button/Button.tsx +46 -50
- package/src/components/Button/ButtonGroup.stories.tsx +373 -217
- package/src/components/Callout/Callout.stories.tsx +289 -634
- package/src/components/Card/Card.stories.tsx +248 -68
- package/src/components/Chart/Chart.stories.tsx +150 -8
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
- package/src/components/Countdown/Countdown.stories.tsx +115 -8
- package/src/components/DataTable/DataTable.stories.tsx +346 -146
- package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
- package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
- package/src/components/Footer/Footer.stories.tsx +392 -328
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +87 -51
- package/src/components/Form/Form.stories.tsx +119 -20
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Radio.stories.tsx +140 -5
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Hero/Hero.stories.tsx +333 -32
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/Modal/Modal.stories.tsx +181 -42
- package/src/components/Popover/Popover.stories.tsx +448 -98
- package/src/components/Progress/Progress.stories.tsx +167 -5
- package/src/components/River/River.stories.tsx +1 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
- package/src/components/Spinner/Spinner.stories.tsx +102 -8
- package/src/components/Steps/Steps.stories.tsx +172 -43
- package/src/components/Tabs/Tabs.stories.tsx +136 -10
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +126 -39
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
- package/src/components/Upload/Upload.stories.tsx +113 -24
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +193 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/useAtomixGlass.ts +28 -56
- package/src/lib/composables/useChartExport.ts +2 -7
- package/src/lib/composables/useDataTable.ts +46 -29
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/types/components.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/csv.ts +17 -0
- package/src/lib/utils/dataTableExport.ts +1 -10
- package/src/styles/01-settings/_index.scss +2 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- package/src/styles/01-settings/_settings.typography.scss +5 -5
- package/src/styles/02-tools/_tools.utility-api.scss +14 -0
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.checkbox.scss +23 -17
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.scss +3 -1
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
package/dist/core.d.ts
CHANGED
|
@@ -403,7 +403,7 @@ interface AtomixGlassProps {
|
|
|
403
403
|
/**
|
|
404
404
|
* Shader variant for shader mode
|
|
405
405
|
*/
|
|
406
|
-
shaderVariant?: 'liquidGlass' | 'premiumGlass';
|
|
406
|
+
shaderVariant?: 'liquidGlass' | 'premiumGlass' | 'appleFluid' | 'liquidMetal' | 'plasma' | 'waves' | 'noise';
|
|
407
407
|
/**
|
|
408
408
|
* Accessibility props
|
|
409
409
|
*/
|
package/dist/core.js
CHANGED
|
@@ -206,10 +206,16 @@ import * as PhosphorIcons from "@phosphor-icons/react";
|
|
|
206
206
|
MIN_BLUR: .1,
|
|
207
207
|
MOUSE_INFLUENCE_DIVISOR: 100,
|
|
208
208
|
EDGE_FADE_PIXELS: 2,
|
|
209
|
+
// Note: This default must match the SCSS variable --atomix-radius-md
|
|
210
|
+
// @see src/styles/01-settings/_settings.global.scss
|
|
209
211
|
DEFAULT_CORNER_RADIUS: 16,
|
|
210
|
-
// Fallback value matching design system
|
|
211
212
|
MAX_SIZE: 4096,
|
|
212
213
|
// Maximum width/height for glass size
|
|
214
|
+
// Palette for internal calculations (matches design system base colors)
|
|
215
|
+
PALETTE: {
|
|
216
|
+
WHITE: "255, 255, 255",
|
|
217
|
+
BLACK: "0, 0, 0"
|
|
218
|
+
},
|
|
213
219
|
// Gradient calculation constants
|
|
214
220
|
GRADIENT: {
|
|
215
221
|
BASE_ANGLE: 135,
|
|
@@ -368,10 +374,10 @@ import * as PhosphorIcons from "@phosphor-icons/react";
|
|
|
368
374
|
y: 0
|
|
369
375
|
}, calculateMouseInfluence = mouseOffset => {
|
|
370
376
|
if (!mouseOffset || "number" != typeof mouseOffset.x || "number" != typeof mouseOffset.y) return 0;
|
|
371
|
-
//
|
|
377
|
+
// Bounded calculation — keeps the glass effect subtle and stable
|
|
372
378
|
const influence = Math.sqrt(mouseOffset.x * mouseOffset.x + mouseOffset.y * mouseOffset.y) / CONSTANTS$1.MOUSE_INFLUENCE_DIVISOR;
|
|
373
|
-
return Math.min(
|
|
374
|
-
//
|
|
379
|
+
return Math.min(.8, influence);
|
|
380
|
+
// Tighter cap to prevent blur/filter blow-out
|
|
375
381
|
}, clampBlur = value => "number" != typeof value || isNaN(value) ? CONSTANTS$1.MIN_BLUR : Math.max(CONSTANTS$1.MIN_BLUR, Math.min(50, value)), validateGlassSize = size => size && "number" == typeof size.width && "number" == typeof size.height && size.width > 0 && size.height > 0 && size.width <= CONSTANTS$1.MAX_SIZE && size.height <= CONSTANTS$1.MAX_SIZE, parseBorderRadiusValue = value => {
|
|
376
382
|
if ("number" == typeof value) return Math.max(0, value);
|
|
377
383
|
if ("string" != typeof value || !value.trim()) return CONSTANTS$1.DEFAULT_CORNER_RADIUS;
|
|
@@ -600,7 +606,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
600
606
|
}, globalMousePosition: globalMousePosition = {
|
|
601
607
|
x: 0,
|
|
602
608
|
y: 0
|
|
603
|
-
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp,
|
|
609
|
+
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isHovered: isHovered = !1, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, cornerRadius: cornerRadius = 0, padding: padding = "0 0", glassSize: glassSize = {
|
|
604
610
|
width: 0,
|
|
605
611
|
height: 0
|
|
606
612
|
}, onClick: onClick, mode: mode = "standard", effectiveDisableEffects: effectiveDisableEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", enableLiquidBlur: enableLiquidBlur = !1, elasticity: elasticity = 0, contentRef: contentRef}, ref) => {
|
|
@@ -713,28 +719,29 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
713
719
|
flowBlur: 1.2 * blurAmount
|
|
714
720
|
};
|
|
715
721
|
// Enhanced validation for liquid blur
|
|
716
|
-
if (!enableLiquidBlur || !rectCache || !
|
|
722
|
+
if (!enableLiquidBlur || !rectCache || !mouseOffset || "number" != typeof mouseOffset.x || "number" != typeof mouseOffset.y || isNaN(mouseOffset.x) || isNaN(mouseOffset.y)) return defaultBlur;
|
|
717
723
|
try {
|
|
718
|
-
|
|
719
|
-
|
|
724
|
+
const mouseInfluence = calculateMouseInfluence(mouseOffset), maxBlur = 2 * blurAmount, baseBlur = Math.min(maxBlur, blurAmount + mouseInfluence * blurAmount * .15), edgeIntensity = .15 * mouseInfluence, edgeBlur = Math.min(maxBlur, baseBlur * (.8 + .4 * edgeIntensity)), centerIntensity = .1 * mouseInfluence, centerBlur = Math.min(maxBlur, baseBlur * (.3 + .3 * centerIntensity)), flowBlur = Math.min(maxBlur, 1.2 * baseBlur);
|
|
725
|
+
// NOTE: hover/active multipliers intentionally omitted here —
|
|
726
|
+
// they belong on opacity layers, not the blur filter itself.
|
|
720
727
|
return {
|
|
721
|
-
baseBlur: clampBlur(baseBlur
|
|
722
|
-
edgeBlur: clampBlur(edgeBlur
|
|
723
|
-
centerBlur: clampBlur(centerBlur
|
|
724
|
-
flowBlur: clampBlur(flowBlur
|
|
728
|
+
baseBlur: clampBlur(baseBlur),
|
|
729
|
+
edgeBlur: clampBlur(edgeBlur),
|
|
730
|
+
centerBlur: clampBlur(centerBlur),
|
|
731
|
+
flowBlur: clampBlur(flowBlur)
|
|
725
732
|
};
|
|
726
733
|
} catch (error) {
|
|
727
734
|
return console.warn("AtomixGlassContainer: Error calculating liquid blur", error),
|
|
728
735
|
defaultBlur;
|
|
729
736
|
}
|
|
730
|
-
}), [ enableLiquidBlur, blurAmount,
|
|
737
|
+
}), [ enableLiquidBlur, blurAmount, mouseOffset, rectCache ]), backdropStyle = useMemo((() => {
|
|
731
738
|
try {
|
|
732
739
|
const dynamicSaturation = saturation + 20 * (liquidBlur.baseBlur || 0), validatedBaseBlur = "number" != typeof liquidBlur.baseBlur || isNaN(liquidBlur.baseBlur) ? 0 : liquidBlur.baseBlur, validatedEdgeBlur = "number" != typeof liquidBlur.edgeBlur || isNaN(liquidBlur.edgeBlur) ? 0 : liquidBlur.edgeBlur, validatedCenterBlur = "number" != typeof liquidBlur.centerBlur || isNaN(liquidBlur.centerBlur) ? 0 : liquidBlur.centerBlur, validatedFlowBlur = "number" != typeof liquidBlur.flowBlur || isNaN(liquidBlur.flowBlur) ? 0 : liquidBlur.flowBlur, area = rectCache ? rectCache.width * rectCache.height : 0;
|
|
733
740
|
// Validate blur values before using them
|
|
734
741
|
return !enableLiquidBlur || effectiveReducedMotion || effectiveDisableEffects || area > 18e4 ? {
|
|
735
|
-
backdropFilter: `blur(${clampBlur(Math.max(validatedBaseBlur, .8 * validatedEdgeBlur, 1.1 * validatedCenterBlur, .9 * validatedFlowBlur))}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(1.05) brightness(1.05)`
|
|
742
|
+
backdropFilter: `blur(${clampBlur(Math.max(validatedBaseBlur, .8 * validatedEdgeBlur, 1.1 * validatedCenterBlur, .9 * validatedFlowBlur))}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1.05}) brightness(${overLightConfig?.brightness || 1.05})`
|
|
736
743
|
} : {
|
|
737
|
-
backdropFilter:
|
|
744
|
+
backdropFilter: `blur(${clampBlur(.4 * validatedBaseBlur + .25 * validatedEdgeBlur + .15 * validatedCenterBlur + .2 * validatedFlowBlur)}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1.05}) brightness(${overLightConfig?.brightness || 1.05})`
|
|
738
745
|
};
|
|
739
746
|
// Single-pass fallback: stronger radius to match perceived blur of multi-pass
|
|
740
747
|
} catch (error) {
|
|
@@ -753,7 +760,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
753
760
|
"--atomix-glass-container-padding": padding || "0 0",
|
|
754
761
|
"--atomix-glass-container-radius": `${"number" != typeof cornerRadius || isNaN(cornerRadius) ? 0 : cornerRadius}px`,
|
|
755
762
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
756
|
-
"--atomix-glass-container-shadow": overLight ? [ `inset 0 1px 0 rgba(255, 255, 255, ${.4 + .002 * mx})`, `inset 0 -1px 0 rgba(0, 0, 0, ${.2 + .001 * Math.abs(my)})`, `inset 0 0 20px rgba(0, 0, 0, ${.08 + .001 * Math.abs(mx + my)})`, `0 2px 12px rgba(0, 0, 0, ${.12 + .002 * Math.abs(my)})` ].join(", ") : "0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset",
|
|
763
|
+
"--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",
|
|
757
764
|
"--atomix-glass-container-shadow-opacity": effectiveDisableEffects ? 0 : 1,
|
|
758
765
|
// Background and shadow values use design token-aligned RGB values
|
|
759
766
|
"--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",
|
|
@@ -772,10 +779,18 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
772
779
|
"--atomix-glass-container-text-shadow": "none"
|
|
773
780
|
};
|
|
774
781
|
}
|
|
775
|
-
}), [ glassSize, padding, cornerRadius, backdropStyle, mouseOffset, overLight, effectiveDisableEffects ])
|
|
782
|
+
}), [ glassSize, padding, cornerRadius, backdropStyle, mouseOffset, overLight, effectiveDisableEffects ]), setForceNoTransition = el => {
|
|
783
|
+
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
784
|
+
el.style.setProperty("transition-delay", "0s", "important"));
|
|
785
|
+
};
|
|
776
786
|
return jsx("div", {
|
|
777
|
-
ref:
|
|
778
|
-
|
|
787
|
+
ref: el => {
|
|
788
|
+
// Apply force no-transition
|
|
789
|
+
setForceNoTransition(el),
|
|
790
|
+
// Handle forwarded ref
|
|
791
|
+
"function" == typeof ref ? ref(el) : ref && (ref.current = el);
|
|
792
|
+
},
|
|
793
|
+
className: `${ATOMIX_GLASS.CONTAINER_CLASS} ${className} ${isActive ? ATOMIX_GLASS.CLASSES.ACTIVE : ""} ${overLight ? ATOMIX_GLASS.CLASSES.OVER_LIGHT : ""}`,
|
|
779
794
|
style: {
|
|
780
795
|
...style,
|
|
781
796
|
...containerVars
|
|
@@ -793,6 +808,11 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
793
808
|
onMouseUp: onMouseUp,
|
|
794
809
|
children: [ jsxs("div", {
|
|
795
810
|
className: ATOMIX_GLASS.FILTER_CLASS,
|
|
811
|
+
style: {
|
|
812
|
+
zIndex: 1,
|
|
813
|
+
position: "absolute",
|
|
814
|
+
inset: 0
|
|
815
|
+
},
|
|
796
816
|
children: [ jsx(GlassFilter, {
|
|
797
817
|
blurAmount: blurAmount,
|
|
798
818
|
mode: mode,
|
|
@@ -801,6 +821,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
801
821
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
802
822
|
shaderMapUrl: shaderMapUrl
|
|
803
823
|
}), jsx("div", {
|
|
824
|
+
ref: setForceNoTransition,
|
|
804
825
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
805
826
|
style: {
|
|
806
827
|
filter: `url(#${filterId})`,
|
|
@@ -822,9 +843,8 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
822
843
|
style: {
|
|
823
844
|
position: "relative",
|
|
824
845
|
textShadow: "var(--atomix-glass-container-text-shadow)",
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
} : {}
|
|
846
|
+
// Ensure content is always above the filter layer (zIndex 1)
|
|
847
|
+
zIndex: elasticity > 0 ? 100 : 2
|
|
828
848
|
},
|
|
829
849
|
children: children
|
|
830
850
|
}) ]
|
|
@@ -942,12 +962,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
942
962
|
}), [internalMouseOffset, setInternalMouseOffset] = useState({
|
|
943
963
|
x: 0,
|
|
944
964
|
y: 0
|
|
945
|
-
}), [dynamicCornerRadius, setDynamicCornerRadius] = useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1), effectiveCornerRadius = useMemo((() => void 0 !== cornerRadius ? Math.max(0, cornerRadius) : Math.max(0, dynamicCornerRadius)), [ cornerRadius, dynamicCornerRadius
|
|
965
|
+
}), [dynamicCornerRadius, setDynamicCornerRadius] = useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1), effectiveCornerRadius = useMemo((() => void 0 !== cornerRadius ? Math.max(0, cornerRadius) : Math.max(0, dynamicCornerRadius)), [ cornerRadius, dynamicCornerRadius ]), effectiveReducedMotion = useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveHighContrast = useMemo((() => highContrast || userPrefersHighContrast), [ highContrast, userPrefersHighContrast ]), effectiveDisableEffects = useMemo((() => disableEffects || effectiveReducedMotion), [ disableEffects, effectiveReducedMotion ]), globalMousePosition = useMemo((() => externalGlobalMousePosition || internalGlobalMousePosition), [ externalGlobalMousePosition, internalGlobalMousePosition ]), mouseOffset = useMemo((() => externalMouseOffset || internalMouseOffset), [ externalMouseOffset, internalMouseOffset ]);
|
|
946
966
|
// Extract border-radius from children
|
|
947
967
|
useEffect((() => {
|
|
948
968
|
const extractRadius = () => {
|
|
949
969
|
try {
|
|
950
|
-
let extractedRadius = null
|
|
970
|
+
let extractedRadius = null;
|
|
951
971
|
if (contentRef.current) {
|
|
952
972
|
const firstChild = contentRef.current.firstElementChild;
|
|
953
973
|
if (firstChild) {
|
|
@@ -964,15 +984,14 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
964
984
|
return null;
|
|
965
985
|
}
|
|
966
986
|
})(firstChild);
|
|
967
|
-
null !== domRadius && domRadius > 0 && (extractedRadius = domRadius
|
|
987
|
+
null !== domRadius && domRadius > 0 && (extractedRadius = domRadius);
|
|
968
988
|
}
|
|
969
989
|
}
|
|
970
990
|
if (null === extractedRadius) {
|
|
971
991
|
const childRadius = extractBorderRadiusFromChildren(children);
|
|
972
|
-
childRadius > 0 && childRadius !== CONSTANTS.DEFAULT_CORNER_RADIUS && (extractedRadius = childRadius
|
|
973
|
-
extractionSource = "React children");
|
|
992
|
+
childRadius > 0 && childRadius !== CONSTANTS.DEFAULT_CORNER_RADIUS && (extractedRadius = childRadius);
|
|
974
993
|
}
|
|
975
|
-
null !== extractedRadius && extractedRadius > 0
|
|
994
|
+
null !== extractedRadius && extractedRadius > 0 && setDynamicCornerRadius(extractedRadius);
|
|
976
995
|
} catch (error) {
|
|
977
996
|
"undefined" != typeof process && "production" === process.env?.NODE_ENV || !debugCornerRadius || console.error("[AtomixGlass] Error extracting corner radius:", error);
|
|
978
997
|
}
|
|
@@ -1101,7 +1120,6 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1101
1120
|
}
|
|
1102
1121
|
if ("boolean" == typeof overLight &&
|
|
1103
1122
|
// For boolean values, disable auto-detection
|
|
1104
|
-
// Cache is automatically managed by WeakMap (no manual clearing needed)
|
|
1105
1123
|
setDetectedOverLight(!1), "function" == typeof window.matchMedia) try {
|
|
1106
1124
|
const mediaQueryReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"), mediaQueryHighContrast = window.matchMedia("(prefers-contrast: high)");
|
|
1107
1125
|
setUserPrefersReducedMotion(mediaQueryReducedMotion.matches), setUserPrefersHighContrast(mediaQueryHighContrast.matches);
|
|
@@ -1171,6 +1189,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1171
1189
|
}), [ handleGlobalMousePosition, mouseContainer, glassRef, externalGlobalMousePosition, externalMouseOffset, effectiveDisableEffects ]);
|
|
1172
1190
|
// Transform calculations
|
|
1173
1191
|
const calculateDirectionalScale = useCallback((() => {
|
|
1192
|
+
if (!0 === overLight || "auto" === overLight && detectedOverLight || "object" == typeof overLight && null !== overLight && detectedOverLight) return "scale(1)";
|
|
1174
1193
|
if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return "scale(1)";
|
|
1175
1194
|
const rect = glassRef.current.getBoundingClientRect(), center = calculateElementCenter(rect), deltaX = globalMousePosition.x - center.x, deltaY = globalMousePosition.y - center.y, edgeDistanceX = Math.max(0, Math.abs(deltaX) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(deltaY) - glassSize.height / 2), edgeDistance = calculateDistance({
|
|
1176
1195
|
x: edgeDistanceX,
|
|
@@ -1184,7 +1203,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1184
1203
|
if (0 === centerDistance) return "scale(1)";
|
|
1185
1204
|
const normalizedX = deltaX / centerDistance, normalizedY = deltaY / centerDistance, stretchIntensity = Math.min(centerDistance / 300, 1) * elasticity * fadeInFactor, scaleX = 1 + Math.abs(normalizedX) * stretchIntensity * .3 - Math.abs(normalizedY) * stretchIntensity * .15, scaleY = 1 + Math.abs(normalizedY) * stretchIntensity * .3 - Math.abs(normalizedX) * stretchIntensity * .15;
|
|
1186
1205
|
return `scaleX(${Math.max(.8, scaleX)}) scaleY(${Math.max(.8, scaleY)})`;
|
|
1187
|
-
}), [ globalMousePosition, elasticity, glassSize, glassRef ]), calculateFadeInFactor = useCallback((() => {
|
|
1206
|
+
}), [ globalMousePosition, elasticity, glassSize, glassRef, overLight, detectedOverLight ]), calculateFadeInFactor = useCallback((() => {
|
|
1188
1207
|
if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return 0;
|
|
1189
1208
|
const rect = glassRef.current.getBoundingClientRect(), center = calculateElementCenter(rect), edgeDistanceX = Math.max(0, Math.abs(globalMousePosition.x - center.x) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(globalMousePosition.y - center.y) - glassSize.height / 2), edgeDistance = calculateDistance({
|
|
1190
1209
|
x: edgeDistanceX,
|
|
@@ -1269,20 +1288,21 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1269
1288
|
isOverLight: isOverLight,
|
|
1270
1289
|
threshold: .7,
|
|
1271
1290
|
opacity: isOverLight ? Math.min(.6, Math.max(.2, .5 * hoverIntensity * activeIntensity)) : 0,
|
|
1272
|
-
contrast: Math.min(1.
|
|
1273
|
-
brightness: Math.min(1.
|
|
1274
|
-
saturationBoost:
|
|
1275
|
-
|
|
1276
|
-
|
|
1291
|
+
contrast: Math.min(1.6, Math.max(1, 1.4 + .1 * mouseInfluence)),
|
|
1292
|
+
brightness: Math.min(1.1, Math.max(.8, .9 + .05 * mouseInfluence)),
|
|
1293
|
+
saturationBoost: 1.3,
|
|
1294
|
+
// Fixed value — dynamic saturation amplifies perceived displacement
|
|
1295
|
+
shadowIntensity: Math.min(1.2, Math.max(.5, .9 + .2 * mouseInfluence)),
|
|
1296
|
+
borderOpacity: Math.min(1, Math.max(.3, .7 + .1 * mouseInfluence))
|
|
1277
1297
|
};
|
|
1278
1298
|
if ("object" == typeof overLight && null !== overLight) {
|
|
1279
1299
|
const objConfig = overLight, validatedThreshold = validateConfigValue(objConfig.threshold, .1, 1, baseConfig.threshold), validatedOpacity = validateConfigValue(objConfig.opacity, .1, 1, baseConfig.opacity), validatedContrast = validateConfigValue(objConfig.contrast, .5, 2.5, baseConfig.contrast), validatedBrightness = validateConfigValue(objConfig.brightness, .5, 2, baseConfig.brightness), validatedSaturationBoost = validateConfigValue(objConfig.saturationBoost, .5, 3, baseConfig.saturationBoost), finalConfig = {
|
|
1280
1300
|
...baseConfig,
|
|
1281
1301
|
threshold: validatedThreshold,
|
|
1282
1302
|
opacity: validatedOpacity * hoverIntensity * activeIntensity,
|
|
1283
|
-
contrast: validatedContrast + .
|
|
1284
|
-
brightness: validatedBrightness + .
|
|
1285
|
-
saturationBoost: validatedSaturationBoost
|
|
1303
|
+
contrast: Math.min(1.6, validatedContrast + .1 * mouseInfluence),
|
|
1304
|
+
brightness: Math.min(1.1, validatedBrightness + .05 * mouseInfluence),
|
|
1305
|
+
saturationBoost: validatedSaturationBoost
|
|
1286
1306
|
};
|
|
1287
1307
|
// Validate and apply object config values with proper clamping
|
|
1288
1308
|
return "undefined" == typeof process || process.env, finalConfig;
|
|
@@ -1416,19 +1436,19 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1416
1436
|
debugOverLight: debugOverLight,
|
|
1417
1437
|
enablePerformanceMonitoring: enablePerformanceMonitoring,
|
|
1418
1438
|
children: children
|
|
1419
|
-
}), isOverLight = overLightConfig
|
|
1439
|
+
}), isOverLight = useMemo((() => overLightConfig?.isOverLight), [ overLight ]), shouldRenderOverLightLayers = enableOverLightLayers && isOverLight, baseStyle = {
|
|
1420
1440
|
...style,
|
|
1421
|
-
|
|
1441
|
+
...!effectiveDisableEffects && {
|
|
1422
1442
|
transform: transformStyle
|
|
1423
1443
|
}
|
|
1424
|
-
}, componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`, effectiveDisableEffects && `${ATOMIX_GLASS.BASE_CLASS}--disabled-effects`, className ].filter(Boolean).join(" "), positionStyles = {
|
|
1444
|
+
}, componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`, effectiveDisableEffects && `${ATOMIX_GLASS.BASE_CLASS}--disabled-effects`, className ].filter(Boolean).join(" "), positionStyles = useMemo((() => ({
|
|
1425
1445
|
position: style.position || "absolute",
|
|
1426
1446
|
top: style.top || 0,
|
|
1427
1447
|
left: style.left || 0
|
|
1428
|
-
}, adjustedSize = {
|
|
1448
|
+
})), [ style.position, style.top, style.left ]), adjustedSize = useMemo((() => ({
|
|
1429
1449
|
width: "fixed" !== style.position ? "100%" : style.width ? style.width : Math.max(glassSize.width, 0),
|
|
1430
1450
|
height: "fixed" !== style.position ? "100%" : style.height ? style.height : Math.max(glassSize.height, 0)
|
|
1431
|
-
}, gradientValues = useMemo((() => {
|
|
1451
|
+
})), [ style.position, style.width, style.height, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
1432
1452
|
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
1433
1453
|
return {
|
|
1434
1454
|
borderGradientAngle: GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER,
|
|
@@ -1468,7 +1488,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1468
1488
|
over: isOverLight ? 1.1 * (overLightOpacity || .4) : 0
|
|
1469
1489
|
};
|
|
1470
1490
|
}), [ isHovered, isActive, isOverLight, overLightConfig.opacity ]), glassVars = useMemo((() => {
|
|
1471
|
-
const whiteColor =
|
|
1491
|
+
const whiteColor = ATOMIX_GLASS.CONSTANTS.PALETTE.WHITE, blackColor = ATOMIX_GLASS.CONSTANTS.PALETTE.BLACK, {borderGradientAngle: borderGradientAngle, borderStop1: borderStop1, borderStop2: borderStop2, borderOpacities: borderOpacities, hoverPositions: hoverPositions, basePosition: basePosition, mx: mx, my: my, absMx: absMx, absMy: absMy} = gradientValues, configBorderOpacity = overLightConfig?.borderOpacity ?? 1;
|
|
1472
1492
|
return {
|
|
1473
1493
|
"--atomix-glass-radius": `${effectiveCornerRadius}px`,
|
|
1474
1494
|
"--atomix-glass-transform": transformStyle || "none",
|
|
@@ -1479,20 +1499,20 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1479
1499
|
"--atomix-glass-height": "fixed" !== style.position ? adjustedSize.height : `${adjustedSize.height}px`,
|
|
1480
1500
|
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
1481
1501
|
"--atomix-glass-blend-mode": isOverLight ? "multiply" : "overlay",
|
|
1482
|
-
"--atomix-glass-border-gradient-1": `linear-gradient(${borderGradientAngle}deg, rgba(${whiteColor}, 0) 0%, rgba(${whiteColor}, ${borderOpacities[0]}) ${borderStop1}%, rgba(${whiteColor}, ${borderOpacities[1]}) ${borderStop2}%, rgba(${whiteColor}, 0) 100%)`,
|
|
1483
|
-
"--atomix-glass-border-gradient-2": `linear-gradient(${borderGradientAngle}deg, rgba(${whiteColor}, 0) 0%, rgba(${whiteColor}, ${borderOpacities[2]}) ${borderStop1}%, rgba(${whiteColor}, ${borderOpacities[3]}) ${borderStop2}%, rgba(${whiteColor}, 0) 100%)`,
|
|
1502
|
+
"--atomix-glass-border-gradient-1": `linear-gradient(${borderGradientAngle}deg, rgba(${whiteColor}, 0) 0%, rgba(${whiteColor}, ${(borderOpacities[0] ?? 1) * configBorderOpacity}) ${borderStop1}%, rgba(${whiteColor}, ${(borderOpacities[1] ?? 1) * configBorderOpacity}) ${borderStop2}%, rgba(${whiteColor}, 0) 100%)`,
|
|
1503
|
+
"--atomix-glass-border-gradient-2": `linear-gradient(${borderGradientAngle}deg, rgba(${whiteColor}, 0) 0%, rgba(${whiteColor}, ${(borderOpacities[2] ?? 1) * configBorderOpacity}) ${borderStop1}%, rgba(${whiteColor}, ${(borderOpacities[3] ?? 1) * configBorderOpacity}) ${borderStop2}%, rgba(${whiteColor}, 0) 100%)`,
|
|
1484
1504
|
"--atomix-glass-hover-1-opacity": opacityValues.hover1,
|
|
1485
|
-
"--atomix-glass-hover-1-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover1.x}% ${hoverPositions.hover1.y}%, rgba(
|
|
1505
|
+
"--atomix-glass-hover-1-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover1.x}% ${hoverPositions.hover1.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_START}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_STOP}%, rgba(${blackColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_END}%)` : `radial-gradient(circle at ${hoverPositions.hover1.x}% ${hoverPositions.hover1.y}%, rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.WHITE_START}) 0%, rgba(${whiteColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.WHITE_STOP}%)`,
|
|
1486
1506
|
"--atomix-glass-hover-2-opacity": opacityValues.hover2,
|
|
1487
|
-
"--atomix-glass-hover-2-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover2.x}% ${hoverPositions.hover2.y}%, rgba(
|
|
1507
|
+
"--atomix-glass-hover-2-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover2.x}% ${hoverPositions.hover2.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_START}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_STOP}%, rgba(${blackColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_END}%)` : `radial-gradient(circle at ${hoverPositions.hover2.x}% ${hoverPositions.hover2.y}%, rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.WHITE_START}) 0%, rgba(${whiteColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.WHITE_STOP}%)`,
|
|
1488
1508
|
"--atomix-glass-hover-3-opacity": opacityValues.hover3,
|
|
1489
|
-
"--atomix-glass-hover-3-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover3.x}% ${hoverPositions.hover3.y}%, rgba(
|
|
1509
|
+
"--atomix-glass-hover-3-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover3.x}% ${hoverPositions.hover3.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_START}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_STOP}%, rgba(${blackColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_END}%)` : `radial-gradient(circle at ${hoverPositions.hover3.x}% ${hoverPositions.hover3.y}%, rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.WHITE_START}) 0%, rgba(${whiteColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.WHITE_STOP}%)`,
|
|
1490
1510
|
"--atomix-glass-base-opacity": opacityValues.base,
|
|
1491
|
-
"--atomix-glass-base-gradient": isOverLight ? `linear-gradient(${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.ANGLE}deg, rgba(
|
|
1511
|
+
"--atomix-glass-base-gradient": isOverLight ? `linear-gradient(${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.ANGLE}deg, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_START_BASE + mx * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_START_MULTIPLIER}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_BASE + my * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_MULTIPLIER}) ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_STOP}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_END_BASE + absMx * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_END_MULTIPLIER}) 100%)` : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.WHITE_OPACITY})`,
|
|
1492
1512
|
"--atomix-glass-overlay-opacity": opacityValues.over,
|
|
1493
|
-
"--atomix-glass-overlay-gradient": isOverLight ? `radial-gradient(circle at ${basePosition.x}% ${basePosition.y}%, rgba(
|
|
1513
|
+
"--atomix-glass-overlay-gradient": isOverLight ? `radial-gradient(circle at ${basePosition.x}% ${basePosition.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_BASE + absMx * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_MULTIPLIER}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID_STOP}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_BASE + absMy * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_MULTIPLIER}) 100%)` : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.WHITE_OPACITY})`
|
|
1494
1514
|
};
|
|
1495
|
-
}), [ gradientValues, opacityValues, effectiveCornerRadius, transformStyle, positionStyles, adjustedSize, style.position, isOverLight ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
1515
|
+
}), [ gradientValues, opacityValues, effectiveCornerRadius, transformStyle, positionStyles, adjustedSize, style.position, isOverLight, overLightConfig.borderOpacity ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
1496
1516
|
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(" "),
|
|
1497
1517
|
style: {
|
|
1498
1518
|
...positionStyles,
|
|
@@ -1518,9 +1538,9 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1518
1538
|
className: className,
|
|
1519
1539
|
style: baseStyle,
|
|
1520
1540
|
cornerRadius: effectiveCornerRadius,
|
|
1521
|
-
displacementScale: effectiveDisableEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT :
|
|
1541
|
+
displacementScale: effectiveDisableEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
1522
1542
|
blurAmount: effectiveDisableEffects ? 0 : blurAmount,
|
|
1523
|
-
saturation: effectiveHighContrast ? ATOMIX_GLASS.CONSTANTS.SATURATION.HIGH_CONTRAST :
|
|
1543
|
+
saturation: effectiveHighContrast ? ATOMIX_GLASS.CONSTANTS.SATURATION.HIGH_CONTRAST : isOverLight ? saturation * overLightConfig.saturationBoost : saturation,
|
|
1524
1544
|
aberrationIntensity: effectiveDisableEffects ? 0 : "shader" === mode ? aberrationIntensity * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_ABERRATION : aberrationIntensity,
|
|
1525
1545
|
glassSize: glassSize,
|
|
1526
1546
|
padding: padding,
|
|
@@ -1536,10 +1556,15 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1536
1556
|
onMouseLeave: handleMouseLeave,
|
|
1537
1557
|
onMouseDown: handleMouseDown,
|
|
1538
1558
|
onMouseUp: handleMouseUp,
|
|
1539
|
-
active: isActive,
|
|
1540
1559
|
isHovered: isHovered,
|
|
1541
1560
|
isActive: isActive,
|
|
1542
|
-
overLight:
|
|
1561
|
+
overLight: isOverLight,
|
|
1562
|
+
overLightConfig: {
|
|
1563
|
+
contrast: overLightConfig.contrast,
|
|
1564
|
+
brightness: overLightConfig.brightness,
|
|
1565
|
+
shadowIntensity: overLightConfig.shadowIntensity,
|
|
1566
|
+
borderOpacity: overLightConfig.borderOpacity
|
|
1567
|
+
},
|
|
1543
1568
|
onClick: onClick,
|
|
1544
1569
|
mode: mode,
|
|
1545
1570
|
transform: baseStyle.transform,
|
|
@@ -2115,9 +2140,7 @@ const Button = React.memo( forwardRef((({label: label, children: children, onCl
|
|
|
2115
2140
|
const isDisabled = disabled || loading, shouldRenderAsLink = Boolean(href && !isDisabled), iconElement = iconName ? jsx(Icon, {
|
|
2116
2141
|
name: iconName,
|
|
2117
2142
|
size: iconSize
|
|
2118
|
-
}) : icon
|
|
2119
|
-
// Determine if we should render as a link
|
|
2120
|
-
const buttonClass = [ BUTTON.BASE_CLASS, ThemeNaming.variantClass("btn", variant), "md" !== size ? ThemeNaming.sizeClass("btn", size) : "", iconOnly ? ThemeNaming.stateClass("btn", "icon") : "", rounded ? ThemeNaming.stateClass("btn", "rounded") : "", isDisabled ? ThemeNaming.stateClass("btn", "disabled") : "", glass ? ThemeNaming.stateClass("btn", "glass") : "", loading ? BUTTON.CLASSES.LOADING : "", fullWidth ? BUTTON.CLASSES.FULL_WIDTH : "", block ? BUTTON.CLASSES.BLOCK : "", active ? BUTTON.CLASSES.ACTIVE : "", selected ? BUTTON.CLASSES.SELECTED : "", className ].filter(Boolean).join(" "), handleClickEvent = useCallback((event => {
|
|
2143
|
+
}) : icon, buttonClass = [ BUTTON.BASE_CLASS, ThemeNaming.variantClass("btn", variant), "md" !== size ? ThemeNaming.sizeClass("btn", size) : "", iconOnly ? ThemeNaming.stateClass("btn", "icon") : "", rounded ? ThemeNaming.stateClass("btn", "rounded") : "", isDisabled ? ThemeNaming.stateClass("btn", "disabled") : "", glass ? ThemeNaming.stateClass("btn", "glass") : "", loading ? BUTTON.CLASSES.LOADING : "", fullWidth ? BUTTON.CLASSES.FULL_WIDTH : "", block ? BUTTON.CLASSES.BLOCK : "", active ? BUTTON.CLASSES.ACTIVE : "", selected ? BUTTON.CLASSES.SELECTED : "", className ].filter(Boolean).join(" "), handleClickEvent = useCallback((event => {
|
|
2121
2144
|
isDisabled ? event.preventDefault() : onClick?.(event);
|
|
2122
2145
|
}), [ isDisabled, onClick ]), handleMouseEnter = useCallback((event => {
|
|
2123
2146
|
isDisabled || onHover?.(event);
|
|
@@ -2125,7 +2148,7 @@ const Button = React.memo( forwardRef((({label: label, children: children, onCl
|
|
|
2125
2148
|
isDisabled || onFocus?.(event);
|
|
2126
2149
|
}), [ isDisabled, onFocus ]), handleBlurEvent = useCallback((event => {
|
|
2127
2150
|
isDisabled || onBlur?.(event);
|
|
2128
|
-
}), [ isDisabled, onBlur ]), buttonText = loading && loadingText ? loadingText : label || children, spinnerSize = "sm" === size ? "sm" : "lg" === size ? "md" : "sm", buttonContent = jsxs(Fragment, {
|
|
2151
|
+
}), [ isDisabled, onBlur ]), buttonText = loading && loadingText ? loadingText : label || children, spinnerSize = "sm" === size ? "sm" : "lg" === size ? "md" : "sm", safeAriaLabel = ariaLabel || (iconOnly ? "string" == typeof label ? label : "string" == typeof children ? children : void 0 : void 0), buttonContent = jsxs(Fragment, {
|
|
2129
2152
|
children: [ loading && jsx("span", {
|
|
2130
2153
|
className: ThemeNaming.bemClass("btn", "spinner"),
|
|
2131
2154
|
"aria-hidden": "true",
|
|
@@ -2142,80 +2165,77 @@ const Button = React.memo( forwardRef((({label: label, children: children, onCl
|
|
|
2142
2165
|
children: buttonText
|
|
2143
2166
|
}) ]
|
|
2144
2167
|
}), buttonProps = {
|
|
2145
|
-
ref: ref,
|
|
2146
2168
|
className: buttonClass,
|
|
2147
|
-
type: "button" !== Component || shouldRenderAsLink ? void 0 : type,
|
|
2148
2169
|
onClick: handleClickEvent,
|
|
2149
2170
|
onMouseEnter: onHover ? handleMouseEnter : void 0,
|
|
2150
2171
|
onFocus: onFocus ? handleFocusEvent : void 0,
|
|
2151
2172
|
onBlur: onBlur ? handleBlurEvent : void 0,
|
|
2152
|
-
disabled: isDisabled && "button" === Component && !shouldRenderAsLink,
|
|
2153
2173
|
"aria-disabled": isDisabled,
|
|
2154
2174
|
"aria-busy": loading,
|
|
2155
|
-
"aria-label":
|
|
2175
|
+
"aria-label": safeAriaLabel,
|
|
2156
2176
|
"aria-describedby": ariaDescribedBy,
|
|
2157
2177
|
"aria-expanded": ariaExpanded,
|
|
2158
2178
|
"aria-controls": ariaControls,
|
|
2159
2179
|
tabIndex: void 0 !== tabIndex ? tabIndex : isDisabled ? -1 : 0,
|
|
2160
2180
|
style: style,
|
|
2161
2181
|
...props
|
|
2162
|
-
}, defaultGlassProps = {
|
|
2163
|
-
displacementScale: 20,
|
|
2164
|
-
blurAmount: 0,
|
|
2165
|
-
saturation: 200,
|
|
2166
|
-
elasticity: 0
|
|
2167
|
-
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
2168
|
-
...defaultGlassProps,
|
|
2169
|
-
...glass
|
|
2170
2182
|
};
|
|
2171
|
-
//
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
...anchorButtonProps,
|
|
2183
|
-
ref: ref,
|
|
2184
|
-
href: href,
|
|
2185
|
-
target: target,
|
|
2186
|
-
rel: "_blank" === target ? "noopener noreferrer" : void 0
|
|
2187
|
-
}, linkElement = jsx(LinkComp, {
|
|
2188
|
-
...linkProps,
|
|
2189
|
-
children: buttonContent
|
|
2190
|
-
});
|
|
2191
|
-
return glass ? jsx(AtomixGlass, {
|
|
2192
|
-
...glassProps,
|
|
2193
|
-
children: linkElement
|
|
2194
|
-
}) : linkElement;
|
|
2195
|
-
}
|
|
2196
|
-
// Fallback to regular anchor tag
|
|
2197
|
-
const anchorElement = jsx("a", {
|
|
2198
|
-
...anchorButtonProps,
|
|
2183
|
+
// Determine if we should render as a link
|
|
2184
|
+
// If disabled, we still check href, but we might want to render as button or anchor with aria-disabled
|
|
2185
|
+
// The previous logic was Boolean(href && !isDisabled). This meant if disabled, it renders as <button>.
|
|
2186
|
+
// This is a safe fallback for disabled links.
|
|
2187
|
+
let content;
|
|
2188
|
+
// Render as anchor if href is provided
|
|
2189
|
+
if (shouldRenderAsLink)
|
|
2190
|
+
// Use custom LinkComponent if provided (e.g., Next.js Link)
|
|
2191
|
+
if (LinkComponent) {
|
|
2192
|
+
const LinkComp = LinkComponent, linkProps = {
|
|
2193
|
+
...buttonProps,
|
|
2199
2194
|
ref: ref,
|
|
2195
|
+
// LinkComponent usually forwards ref to anchor
|
|
2200
2196
|
href: href,
|
|
2201
2197
|
target: target,
|
|
2202
|
-
rel: "_blank" === target ? "noopener noreferrer" : void 0
|
|
2198
|
+
rel: "_blank" === target ? "noopener noreferrer" : void 0
|
|
2199
|
+
};
|
|
2200
|
+
content = jsx(LinkComp, {
|
|
2201
|
+
...linkProps,
|
|
2203
2202
|
children: buttonContent
|
|
2204
2203
|
});
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2204
|
+
} else
|
|
2205
|
+
// Fallback to regular anchor tag
|
|
2206
|
+
content = jsx("a", {
|
|
2207
|
+
...buttonProps,
|
|
2208
|
+
ref: ref,
|
|
2209
|
+
href: href,
|
|
2210
|
+
target: target,
|
|
2211
|
+
rel: "_blank" === target ? "noopener noreferrer" : void 0,
|
|
2212
|
+
children: buttonContent
|
|
2213
|
+
}); else
|
|
2210
2214
|
// Default button rendering
|
|
2211
|
-
|
|
2215
|
+
content = jsx(Component, {
|
|
2212
2216
|
...buttonProps,
|
|
2217
|
+
ref: ref,
|
|
2218
|
+
type: "button" === Component ? type : void 0,
|
|
2219
|
+
disabled: isDisabled,
|
|
2213
2220
|
children: buttonContent
|
|
2214
2221
|
});
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2222
|
+
if (glass) {
|
|
2223
|
+
// Default glass props
|
|
2224
|
+
const defaultGlassProps = {
|
|
2225
|
+
displacementScale: 20,
|
|
2226
|
+
blurAmount: 0,
|
|
2227
|
+
saturation: 200,
|
|
2228
|
+
elasticity: 0
|
|
2229
|
+
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
2230
|
+
...defaultGlassProps,
|
|
2231
|
+
...glass
|
|
2232
|
+
};
|
|
2233
|
+
return jsx(AtomixGlass, {
|
|
2234
|
+
...glassProps,
|
|
2235
|
+
children: content
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
return content;
|
|
2219
2239
|
})));
|
|
2220
2240
|
|
|
2221
2241
|
Button.displayName = "Button";
|
|
@@ -3227,7 +3247,11 @@ const smoothStep = (a, b, t) => {
|
|
|
3227
3247
|
// Add input validation
|
|
3228
3248
|
"number" != typeof x || "number" != typeof y || "number" != typeof time || isNaN(x) || isNaN(y) || isNaN(time) ? .5 : .5 * (.7 * fbm(40 * x + .3 * time, 40 * y - .3 * time, 6) + .3 * fbm(80 * x, 80 * y, 4)))(ix, iy, time), microDetailX = .008 * (microSurface - .5), microDetailY = .008 * (microSurface - .5), centerDistance = calculateLength(ix, iy), dynamicRefraction = .35 * Math.pow(Math.min(centerDistance, 1), 1.8) * (1 + mouseFalloff * mouseDistance * .8), refractionX = Math.cos(refractionAngle) * dynamicRefraction, refractionY = Math.sin(refractionAngle) * dynamicRefraction, vortexAngle = Math.atan2(iy - mouseY, ix - mouseX), vortexDistance = calculateLength(ix - mouseX, iy - mouseY), vortexStrength = mouseFalloff * Math.sin(10 * vortexDistance - 3 * time) * .025, vortexX = Math.cos(vortexAngle + 2 * time) * vortexStrength, vortexY = Math.sin(vortexAngle + 2 * time) * vortexStrength, fluidX = Math.sin(10 * ix + 5 * mouseX + 2.5 * time) * Math.cos(8 * iy - 2 * time) * .018, fluidY = Math.cos(8 * ix - 2 * time) * Math.sin(10 * iy + 5 * mouseY + 2.5 * time) * .018, rippleEffect = (.012 * Math.sin(15 * Math.min(centerDistance, 10) - 4 * time) + .008 * Math.cos(20 * Math.min(centerDistance, 10) + 3 * time)) * mouseFalloff, rippleX = Math.cos(refractionAngle) * rippleEffect, rippleY = Math.sin(refractionAngle) * rippleEffect, distanceToEdge = roundedRectSDF(ix, iy, .44, .34, .39), edgeMask = smoothStep(.92, -.12, distanceToEdge), edgeSoftness = smoothStep(.85, .1, distanceToEdge), finalY = iy + (1.2 * refractionY + .8 * spectralY + 1.5 * parallaxY + .9 * scatteringY + 1 * turbulenceY + .6 * microDetailY + 1.3 * vortexY + 1.1 * fluidY + .7 * rippleY + .8 * causticDistortion) * edgeMask * edgeSoftness * .85;
|
|
3229
3249
|
return createTexture(clampValue(ix + (1.2 * refractionX + .8 * spectralX + 1.5 * parallaxX + .9 * scatteringX + 1 * turbulenceX + .6 * microDetailX + 1.3 * vortexX + 1.1 * fluidX + .7 * rippleX + causticDistortion) * edgeMask * edgeSoftness * .85 + .5, 0, 1), clampValue(finalY + .5, 0, 1));
|
|
3230
|
-
}
|
|
3250
|
+
},
|
|
3251
|
+
// Aliases for compatibility
|
|
3252
|
+
plasma: (uv, mousePosition) => fragmentShaders.premiumGlass(uv, mousePosition),
|
|
3253
|
+
waves: (uv, mousePosition) => fragmentShaders.liquidMetal(uv, mousePosition),
|
|
3254
|
+
noise: (uv, mousePosition) => fragmentShaders.appleFluid(uv, mousePosition)
|
|
3231
3255
|
}, shaderUtils = Object.freeze( Object.defineProperty({
|
|
3232
3256
|
__proto__: null,
|
|
3233
3257
|
ShaderDisplacementGenerator: class {
|