@shohojdhara/atomix 0.4.0 → 0.4.2

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.
Files changed (150) hide show
  1. package/dist/atomix.css +0 -14
  2. package/dist/atomix.css.map +1 -1
  3. package/dist/atomix.min.css +4 -4
  4. package/dist/atomix.min.css.map +1 -1
  5. package/dist/charts.d.ts +12 -19
  6. package/dist/charts.js +555 -359
  7. package/dist/charts.js.map +1 -1
  8. package/dist/core.d.ts +98 -28
  9. package/dist/core.js +1082 -733
  10. package/dist/core.js.map +1 -1
  11. package/dist/forms.d.ts +26 -21
  12. package/dist/forms.js +937 -350
  13. package/dist/forms.js.map +1 -1
  14. package/dist/heavy.d.ts +14 -21
  15. package/dist/heavy.js +409 -256
  16. package/dist/heavy.js.map +1 -1
  17. package/dist/index.d.ts +518 -284
  18. package/dist/index.esm.js +1993 -1237
  19. package/dist/index.esm.js.map +1 -1
  20. package/dist/index.js +1994 -1237
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.min.js +1 -1
  23. package/dist/index.min.js.map +1 -1
  24. package/package.json +2 -2
  25. package/scripts/atomix-cli.js +43 -1
  26. package/scripts/cli/__tests__/utils.test.js +6 -2
  27. package/scripts/cli/migration-tools.js +2 -2
  28. package/scripts/cli/theme-bridge.js +7 -9
  29. package/scripts/cli/utils.js +2 -1
  30. package/src/components/Accordion/Accordion.stories.tsx +40 -0
  31. package/src/components/Accordion/Accordion.tsx +174 -56
  32. package/src/components/Accordion/AccordionCompound.test.tsx +70 -0
  33. package/src/components/AtomixGlass/AtomixGlass.tsx +82 -54
  34. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +17 -18
  35. package/src/components/AtomixGlass/README.md +5 -5
  36. package/src/components/AtomixGlass/stories/Customization.stories.tsx +2 -2
  37. package/src/components/AtomixGlass/stories/Examples.stories.tsx +42 -42
  38. package/src/components/AtomixGlass/stories/Modes.stories.tsx +5 -5
  39. package/src/components/AtomixGlass/stories/Overview.stories.tsx +3 -3
  40. package/src/components/AtomixGlass/stories/Performance.stories.tsx +2 -2
  41. package/src/components/AtomixGlass/stories/Playground.stories.tsx +45 -45
  42. package/src/components/AtomixGlass/stories/Shaders.stories.tsx +3 -3
  43. package/src/components/Badge/Badge.stories.tsx +1 -1
  44. package/src/components/Badge/Badge.tsx +1 -1
  45. package/src/components/Breadcrumb/Breadcrumb.tsx +185 -65
  46. package/src/components/Breadcrumb/BreadcrumbCompound.test.tsx +84 -0
  47. package/src/components/Breadcrumb/index.ts +2 -2
  48. package/src/components/Button/Button.stories.tsx +1 -1
  49. package/src/components/Button/README.md +2 -2
  50. package/src/components/Callout/Callout.stories.tsx +166 -1011
  51. package/src/components/Callout/Callout.test.tsx +3 -3
  52. package/src/components/Callout/Callout.tsx +196 -84
  53. package/src/components/Callout/CalloutCompound.test.tsx +72 -0
  54. package/src/components/Callout/README.md +2 -2
  55. package/src/components/Chart/Chart.stories.tsx +1 -1
  56. package/src/components/Chart/Chart.tsx +5 -5
  57. package/src/components/Chart/TreemapChart.tsx +37 -29
  58. package/src/components/DatePicker/readme.md +3 -3
  59. package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
  60. package/src/components/Dropdown/Dropdown.tsx +133 -20
  61. package/src/components/Dropdown/DropdownCompound.test.tsx +64 -0
  62. package/src/components/EdgePanel/EdgePanel.stories.tsx +7 -7
  63. package/src/components/EdgePanel/EdgePanel.tsx +164 -112
  64. package/src/components/EdgePanel/EdgePanelCompound.test.tsx +53 -0
  65. package/src/components/Form/Checkbox.stories.tsx +1 -1
  66. package/src/components/Form/Checkbox.tsx +1 -1
  67. package/src/components/Form/Input.stories.tsx +1 -1
  68. package/src/components/Form/Input.tsx +1 -1
  69. package/src/components/Form/Radio.stories.tsx +1 -1
  70. package/src/components/Form/Radio.tsx +1 -1
  71. package/src/components/Form/Select.stories.tsx +24 -1
  72. package/src/components/Form/Select.test.tsx +99 -0
  73. package/src/components/Form/Select.tsx +145 -94
  74. package/src/components/Form/SelectOption.tsx +88 -0
  75. package/src/components/Form/Textarea.stories.tsx +1 -1
  76. package/src/components/Form/Textarea.tsx +1 -1
  77. package/src/components/Hero/Hero.stories.tsx +39 -2
  78. package/src/components/Hero/Hero.test.tsx +142 -0
  79. package/src/components/Hero/Hero.tsx +143 -4
  80. package/src/components/List/List.test.tsx +62 -0
  81. package/src/components/List/List.tsx +16 -5
  82. package/src/components/List/ListItem.tsx +20 -0
  83. package/src/components/Messages/Messages.stories.tsx +1 -1
  84. package/src/components/Messages/Messages.tsx +2 -2
  85. package/src/components/Modal/Modal.stories.tsx +66 -2
  86. package/src/components/Modal/Modal.tsx +115 -35
  87. package/src/components/Modal/ModalCompound.test.tsx +94 -0
  88. package/src/components/Navigation/Nav/Nav.stories.tsx +2 -2
  89. package/src/components/Navigation/Nav/Nav.tsx +1 -1
  90. package/src/components/Navigation/Navbar/Navbar.stories.tsx +3 -3
  91. package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
  92. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +2 -2
  93. package/src/components/Navigation/SideMenu/SideMenu.tsx +1 -1
  94. package/src/components/Pagination/Pagination.stories.tsx +1 -1
  95. package/src/components/Pagination/Pagination.tsx +1 -1
  96. package/src/components/Popover/Popover.stories.tsx +1 -1
  97. package/src/components/Popover/Popover.tsx +1 -1
  98. package/src/components/Progress/Progress.tsx +1 -1
  99. package/src/components/Rating/Rating.stories.tsx +1 -1
  100. package/src/components/Rating/Rating.test.tsx +73 -0
  101. package/src/components/Rating/Rating.tsx +25 -37
  102. package/src/components/Spinner/Spinner.tsx +1 -1
  103. package/src/components/Steps/Steps.stories.tsx +1 -1
  104. package/src/components/Steps/Steps.tsx +125 -22
  105. package/src/components/Steps/StepsCompound.test.tsx +81 -0
  106. package/src/components/Tabs/Tabs.stories.tsx +1 -1
  107. package/src/components/Tabs/Tabs.tsx +198 -45
  108. package/src/components/Tabs/TabsCompound.test.tsx +64 -0
  109. package/src/components/Todo/Todo.tsx +0 -1
  110. package/src/components/Toggle/Toggle.stories.tsx +1 -1
  111. package/src/components/Toggle/Toggle.tsx +1 -1
  112. package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
  113. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +2 -2
  114. package/src/lib/composables/__tests__/useAtomixGlassPerf.test.tsx +88 -0
  115. package/src/lib/composables/__tests__/useChart.test.ts +50 -0
  116. package/src/lib/composables/__tests__/useChart.test.tsx +139 -0
  117. package/src/lib/composables/__tests__/useHeroBackgroundSlider.test.tsx +59 -0
  118. package/src/lib/composables/__tests__/useSliderAutoplay.test.tsx +68 -0
  119. package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +329 -0
  120. package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +82 -0
  121. package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +153 -0
  122. package/src/lib/composables/atomix-glass/useGlassOverLight.ts +198 -0
  123. package/src/lib/composables/atomix-glass/useGlassSize.ts +117 -0
  124. package/src/lib/composables/atomix-glass/useGlassState.ts +112 -0
  125. package/src/lib/composables/atomix-glass/useGlassTransforms.ts +160 -0
  126. package/src/lib/composables/glass-styles.ts +302 -0
  127. package/src/lib/composables/index.ts +0 -8
  128. package/src/lib/composables/useAtomixGlass.ts +331 -537
  129. package/src/lib/composables/useAtomixGlassStyles.ts +307 -0
  130. package/src/lib/composables/useBarChart.ts +1 -1
  131. package/src/lib/composables/useBreadcrumb.ts +6 -6
  132. package/src/lib/composables/useChart.ts +104 -21
  133. package/src/lib/composables/useHeroBackgroundSlider.ts +16 -7
  134. package/src/lib/composables/useSlider.ts +66 -34
  135. package/src/lib/theme/devtools/CLI.ts +2 -10
  136. package/src/lib/theme/utils/__tests__/themeUtils.test.ts +213 -0
  137. package/src/lib/types/components.ts +21 -23
  138. package/src/lib/utils/__tests__/componentUtils.test.ts +57 -2
  139. package/src/lib/utils/__tests__/dom.test.ts +100 -0
  140. package/src/lib/utils/__tests__/fontPreloader.test.ts +102 -0
  141. package/src/lib/utils/__tests__/themeNaming.test.ts +117 -0
  142. package/src/lib/utils/themeNaming.ts +1 -1
  143. package/src/styles/06-components/_components.accordion.scss +0 -2
  144. package/src/styles/06-components/_components.chart.scss +0 -1
  145. package/src/styles/06-components/_components.dropdown.scss +0 -1
  146. package/src/styles/06-components/_components.edge-panel.scss +0 -2
  147. package/src/styles/06-components/_components.photoviewer.scss +0 -1
  148. package/src/styles/06-components/_components.river.scss +0 -1
  149. package/src/styles/06-components/_components.slider.scss +0 -3
  150. package/src/styles/99-utilities/_utilities.glass-fixes.scss +0 -1
@@ -0,0 +1,302 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type {
3
+ GlassSize,
4
+ MousePosition,
5
+ } from '../types/components';
6
+ import { ATOMIX_GLASS } from '../constants/components';
7
+ import { calculateMouseInfluence, clampBlur } from '../../components/AtomixGlass/glass-utils';
8
+
9
+ const { CONSTANTS } = ATOMIX_GLASS;
10
+
11
+ export interface ResolvedOverLightConfig {
12
+ isOverLight: boolean;
13
+ threshold: number;
14
+ opacity: number;
15
+ contrast: number;
16
+ brightness: number;
17
+ saturationBoost: number;
18
+ shadowIntensity: number;
19
+ borderOpacity: number;
20
+ }
21
+
22
+ interface CalculateGlassVarsOptions {
23
+ mouseOffset: MousePosition;
24
+ overLightConfig: ResolvedOverLightConfig;
25
+ effectiveBorderRadius: number;
26
+ transformStyle: string;
27
+ adjustedSize: { width: string | number; height: string | number };
28
+ positionStyles: { position: any; top: any; left: any };
29
+ style: CSSProperties;
30
+ isOverLight: boolean;
31
+ isActive: boolean;
32
+ isHovered: boolean;
33
+ }
34
+
35
+ export const calculateGlassVars = ({
36
+ mouseOffset,
37
+ overLightConfig,
38
+ effectiveBorderRadius,
39
+ transformStyle,
40
+ adjustedSize,
41
+ positionStyles,
42
+ style,
43
+ isOverLight,
44
+ isActive,
45
+ isHovered,
46
+ }: CalculateGlassVarsOptions): CSSProperties => {
47
+ const mx = mouseOffset.x;
48
+ const my = mouseOffset.y;
49
+ const absMx = Math.abs(mx);
50
+ const absMy = Math.abs(my);
51
+ const GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
52
+
53
+ // Gradient Values
54
+ const borderGradientAngle = GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER;
55
+ const borderStop1 = Math.max(
56
+ GRADIENT.BORDER_STOP_1.MIN,
57
+ GRADIENT.BORDER_STOP_1.BASE + my * GRADIENT.BORDER_STOP_1.MULTIPLIER
58
+ );
59
+ const borderStop2 = Math.min(
60
+ GRADIENT.BORDER_STOP_2.MAX,
61
+ GRADIENT.BORDER_STOP_2.BASE + my * GRADIENT.BORDER_STOP_2.MULTIPLIER
62
+ );
63
+ const borderOpacities = [
64
+ GRADIENT.BORDER_OPACITY.BASE_1 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_LOW,
65
+ GRADIENT.BORDER_OPACITY.BASE_2 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_HIGH,
66
+ GRADIENT.BORDER_OPACITY.BASE_3 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_LOW,
67
+ GRADIENT.BORDER_OPACITY.BASE_4 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_HIGH,
68
+ ];
69
+
70
+ const hoverPositions = {
71
+ hover1: {
72
+ x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_1,
73
+ y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_1,
74
+ },
75
+ hover2: {
76
+ x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_2,
77
+ y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_2,
78
+ },
79
+ hover3: {
80
+ x: GRADIENT.CENTER_POSITION + mx * GRADIENT.HOVER_POSITION.MULTIPLIER_3,
81
+ y: GRADIENT.CENTER_POSITION + my * GRADIENT.HOVER_POSITION.MULTIPLIER_3,
82
+ },
83
+ };
84
+
85
+ const basePosition = {
86
+ x: GRADIENT.CENTER_POSITION + mx * GRADIENT.BASE_LAYER_MULTIPLIER,
87
+ y: GRADIENT.CENTER_POSITION + my * GRADIENT.BASE_LAYER_MULTIPLIER,
88
+ };
89
+
90
+ // Opacity Values
91
+ const overLightOpacity = overLightConfig.opacity;
92
+ const BASE_OVER_LIGHT_OPACITY = 0.4;
93
+ const OVER_OPACITY_MULTIPLIER = 1.1;
94
+
95
+ const opacityValues = {
96
+ hover1: isHovered || isActive ? 0.5 : 0,
97
+ hover2: isActive ? 0.5 : 0,
98
+ hover3: isHovered ? 0.4 : isActive ? 0.8 : 0,
99
+ base: isOverLight ? overLightOpacity || BASE_OVER_LIGHT_OPACITY : 0,
100
+ over: isOverLight
101
+ ? (overLightOpacity || BASE_OVER_LIGHT_OPACITY) * OVER_OPACITY_MULTIPLIER
102
+ : 0,
103
+ };
104
+
105
+ const whiteColor = ATOMIX_GLASS.CONSTANTS.PALETTE.WHITE;
106
+ const blackColor = ATOMIX_GLASS.CONSTANTS.PALETTE.BLACK;
107
+ const configBorderOpacity = overLightConfig?.borderOpacity ?? 1;
108
+
109
+ return {
110
+ '--atomix-glass-radius': `${effectiveBorderRadius}px`,
111
+ '--atomix-glass-transform': transformStyle || 'none',
112
+ '--atomix-glass-position': positionStyles.position,
113
+ '--atomix-glass-top': positionStyles.top !== 'fixed' ? `${positionStyles.top}px` : '0',
114
+ '--atomix-glass-left': positionStyles.left !== 'fixed' ? `${positionStyles.left}px` : '0',
115
+ '--atomix-glass-width':
116
+ style.position !== 'fixed' ? adjustedSize.width : `${adjustedSize.width}px`,
117
+ '--atomix-glass-height':
118
+ style.position !== 'fixed' ? adjustedSize.height : `${adjustedSize.height}px`,
119
+ '--atomix-glass-border-width': 'var(--atomix-spacing-0-5, 0.09375rem)',
120
+ '--atomix-glass-blend-mode': isOverLight ? 'multiply' : 'overlay',
121
+ '--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%)`,
122
+ '--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%)`,
123
+ '--atomix-glass-hover-1-opacity': opacityValues.hover1,
124
+ '--atomix-glass-hover-1-gradient': isOverLight
125
+ ? `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}%)`
126
+ : `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}%)`,
127
+ '--atomix-glass-hover-2-opacity': opacityValues.hover2,
128
+ '--atomix-glass-hover-2-gradient': isOverLight
129
+ ? `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}%)`
130
+ : `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}%)`,
131
+ '--atomix-glass-hover-3-opacity': opacityValues.hover3,
132
+ '--atomix-glass-hover-3-gradient': isOverLight
133
+ ? `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}%)`
134
+ : `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}%)`,
135
+ '--atomix-glass-base-opacity': opacityValues.base,
136
+ '--atomix-glass-base-gradient': isOverLight
137
+ ? `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%)`
138
+ : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.WHITE_OPACITY})`,
139
+ '--atomix-glass-overlay-opacity': opacityValues.over,
140
+ '--atomix-glass-overlay-gradient': isOverLight
141
+ ? `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%)`
142
+ : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.WHITE_OPACITY})`,
143
+ } as CSSProperties;
144
+ };
145
+
146
+ interface CalculateContainerVarsOptions {
147
+ mouseOffset: MousePosition;
148
+ glassSize: GlassSize;
149
+ padding: string;
150
+ borderRadius: number;
151
+ overLightConfig: ResolvedOverLightConfig;
152
+ isOverLight: boolean;
153
+ effectiveWithoutEffects: boolean;
154
+ effectiveReducedMotion: boolean;
155
+ withLiquidBlur: boolean;
156
+ blurAmount: number;
157
+ saturation: number;
158
+ }
159
+
160
+ export const calculateContainerVars = ({
161
+ mouseOffset,
162
+ glassSize,
163
+ padding,
164
+ borderRadius,
165
+ overLightConfig,
166
+ isOverLight,
167
+ effectiveWithoutEffects,
168
+ effectiveReducedMotion,
169
+ withLiquidBlur,
170
+ blurAmount,
171
+ saturation,
172
+ }: CalculateContainerVarsOptions): CSSProperties => {
173
+ // Pre-calculate static multipliers
174
+ const EDGE_BLUR_MULTIPLIER = 1.25;
175
+ const CENTER_BLUR_MULTIPLIER = 1.1;
176
+ const FLOW_BLUR_MULTIPLIER = 1.2;
177
+ const MOUSE_INFLUENCE_BLUR_FACTOR = 0.15;
178
+ const EDGE_INTENSITY_MOUSE_FACTOR = 0.15;
179
+ const CENTER_INTENSITY_MOUSE_FACTOR = 0.1;
180
+ // Maximum blur multiplier relative to base — prevents runaway blur
181
+ const MAX_BLUR_RELATIVE = 2;
182
+
183
+ const defaultBlur = {
184
+ baseBlur: blurAmount,
185
+ edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
186
+ centerBlur: blurAmount * CENTER_BLUR_MULTIPLIER,
187
+ flowBlur: blurAmount * FLOW_BLUR_MULTIPLIER,
188
+ };
189
+
190
+ let liquidBlur = defaultBlur;
191
+
192
+ if (
193
+ withLiquidBlur &&
194
+ mouseOffset &&
195
+ typeof mouseOffset.x === 'number' &&
196
+ typeof mouseOffset.y === 'number' &&
197
+ !isNaN(mouseOffset.x) &&
198
+ !isNaN(mouseOffset.y)
199
+ ) {
200
+ const mouseInfluence = calculateMouseInfluence(mouseOffset);
201
+ const maxBlur = blurAmount * MAX_BLUR_RELATIVE;
202
+
203
+ const baseBlur = Math.min(
204
+ maxBlur,
205
+ blurAmount + mouseInfluence * blurAmount * MOUSE_INFLUENCE_BLUR_FACTOR
206
+ );
207
+ const edgeIntensity = mouseInfluence * EDGE_INTENSITY_MOUSE_FACTOR;
208
+ const edgeBlur = Math.min(maxBlur, baseBlur * (0.8 + edgeIntensity * 0.4));
209
+ const centerIntensity = mouseInfluence * CENTER_INTENSITY_MOUSE_FACTOR;
210
+ const centerBlur = Math.min(maxBlur, baseBlur * (0.3 + centerIntensity * 0.3));
211
+ const flowBlur = Math.min(maxBlur, baseBlur * FLOW_BLUR_MULTIPLIER);
212
+
213
+ liquidBlur = {
214
+ baseBlur: clampBlur(baseBlur),
215
+ edgeBlur: clampBlur(edgeBlur),
216
+ centerBlur: clampBlur(centerBlur),
217
+ flowBlur: clampBlur(flowBlur),
218
+ };
219
+ }
220
+
221
+ const dynamicSaturation = saturation + (liquidBlur.baseBlur || 0) * 20;
222
+
223
+ // Validate blur values before using them
224
+ const validatedBaseBlur =
225
+ typeof liquidBlur.baseBlur === 'number' && !isNaN(liquidBlur.baseBlur)
226
+ ? liquidBlur.baseBlur
227
+ : 0;
228
+ const validatedEdgeBlur =
229
+ typeof liquidBlur.edgeBlur === 'number' && !isNaN(liquidBlur.edgeBlur)
230
+ ? liquidBlur.edgeBlur
231
+ : 0;
232
+ const validatedCenterBlur =
233
+ typeof liquidBlur.centerBlur === 'number' && !isNaN(liquidBlur.centerBlur)
234
+ ? liquidBlur.centerBlur
235
+ : 0;
236
+ const validatedFlowBlur =
237
+ typeof liquidBlur.flowBlur === 'number' && !isNaN(liquidBlur.flowBlur)
238
+ ? liquidBlur.flowBlur
239
+ : 0;
240
+
241
+ // Adaptive strategy: prefer single-pass blur for large areas or when effects are reduced
242
+ const area = glassSize ? glassSize.width * glassSize.height : 0;
243
+ const areaIsLarge = area > 180000; // ~600x300 threshold; tune as needed
244
+ const devicePrefersPerformance = effectiveReducedMotion || effectiveWithoutEffects;
245
+ const useMultiPass = withLiquidBlur && !devicePrefersPerformance && !areaIsLarge;
246
+
247
+ let backdropFilter = `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`;
248
+
249
+ if (useMultiPass) {
250
+ const weightedBlur = clampBlur(
251
+ validatedBaseBlur * 0.4 +
252
+ validatedEdgeBlur * 0.25 +
253
+ validatedCenterBlur * 0.15 +
254
+ validatedFlowBlur * 0.2
255
+ );
256
+
257
+ backdropFilter = `blur(${weightedBlur}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1.05}) brightness(${overLightConfig?.brightness || 1.05})`;
258
+ } else {
259
+ // Single-pass fallback: stronger radius to match perceived blur of multi-pass
260
+ const effectiveBlur = clampBlur(
261
+ Math.max(
262
+ validatedBaseBlur,
263
+ validatedEdgeBlur * 0.8,
264
+ validatedCenterBlur * 1.1,
265
+ validatedFlowBlur * 0.9
266
+ )
267
+ );
268
+
269
+ backdropFilter = `blur(${effectiveBlur}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1.05}) brightness(${overLightConfig?.brightness || 1.05})`;
270
+ }
271
+
272
+ const mx =
273
+ mouseOffset && typeof mouseOffset.x === 'number' && !isNaN(mouseOffset.x) ? mouseOffset.x : 0;
274
+ const my =
275
+ mouseOffset && typeof mouseOffset.y === 'number' && !isNaN(mouseOffset.y) ? mouseOffset.y : 0;
276
+
277
+ return {
278
+ '--atomix-glass-container-width': `${glassSize?.width}`,
279
+ '--atomix-glass-container-height': `${glassSize?.height}`,
280
+ '--atomix-glass-container-padding': padding || '0 0',
281
+ '--atomix-glass-container-radius': `${typeof borderRadius === 'number' && !isNaN(borderRadius) ? borderRadius : 0}px`,
282
+ '--atomix-glass-container-backdrop': backdropFilter,
283
+ '--atomix-glass-container-shadow': isOverLight
284
+ ? [
285
+ `inset 0 1px 0 rgba(255, 255, 255, ${(0.4 + mx * 0.002) * (overLightConfig?.shadowIntensity || 1)})`,
286
+ `inset 0 -1px 0 rgba(0, 0, 0, ${(0.2 + Math.abs(my) * 0.001) * (overLightConfig?.shadowIntensity || 1)})`,
287
+ `inset 0 0 20px rgba(0, 0, 0, ${(0.08 + Math.abs(mx + my) * 0.001) * (overLightConfig?.shadowIntensity || 1)})`,
288
+ `0 2px 12px rgba(0, 0, 0, ${(0.12 + Math.abs(my) * 0.002) * (overLightConfig?.shadowIntensity || 1)})`,
289
+ ].join(', ')
290
+ : '0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset',
291
+ '--atomix-glass-container-shadow-opacity': effectiveWithoutEffects ? 0 : 1,
292
+ '--atomix-glass-container-bg': isOverLight
293
+ ? `linear-gradient(${180 + mx * 0.5}deg, rgba(255, 255, 255, 0.1) 0%, transparent 20%, transparent 80%, rgba(0, 0, 0, 0.05) 100%)`
294
+ : 'none',
295
+ '--atomix-glass-container-text-shadow': isOverLight
296
+ ? '0px 2px 12px rgba(0, 0, 0, 0)'
297
+ : '0px 2px 12px rgba(0, 0, 0, 0.4)',
298
+ '--atomix-glass-container-box-shadow': isOverLight
299
+ ? '0px 16px 70px rgba(0, 0, 0, 0.75)'
300
+ : '0px 12px 40px rgba(0, 0, 0, 0.25)',
301
+ } as CSSProperties;
302
+ };
@@ -1,6 +1,3 @@
1
- // Button composables
2
- // export * from './useButton';
3
-
4
1
  // Accordion composables
5
2
  export * from './useAccordion';
6
3
 
@@ -29,7 +26,6 @@ export * from './useEdgePanel';
29
26
  export * from './useTodo';
30
27
 
31
28
  // Form composables
32
- // export * from './useCheckbox';
33
29
  export * from './useForm';
34
30
  export * from './useFormGroup';
35
31
 
@@ -41,8 +37,6 @@ export * from './useRadio';
41
37
  export * from './useSelect';
42
38
  export * from './useTextarea';
43
39
 
44
- // Export other composables as needed
45
-
46
40
  // New composables
47
41
  export * from './useBreadcrumb';
48
42
  export * from './useCard';
@@ -61,7 +55,5 @@ export * from './useLineChart';
61
55
  export * from './useBarChart';
62
56
  export * from './usePieChart';
63
57
 
64
- // Theme composables
65
-
66
58
  // Block composables
67
59
  export * from './useBlock';