@shohojdhara/atomix 0.6.0 → 0.6.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.
- package/dist/atomix.css +121 -119
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +5 -5
- package/dist/atomix.min.css.map +1 -1
- package/dist/atomix.umd.js +1 -1
- package/dist/atomix.umd.js.map +1 -1
- package/dist/atomix.umd.min.js +1 -1
- package/dist/charts.d.ts +9 -0
- package/dist/charts.js +43 -8
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +9 -0
- package/dist/core.js +43 -8
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +9 -0
- package/dist/forms.js +43 -8
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +9 -0
- package/dist/heavy.js +43 -8
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.esm.js +43 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -8
- 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/src/components/AtomixGlass/deprecated/AtomixGlass.deprecated.tsx +390 -0
- package/src/lib/composables/shared-mouse-tracker.ts +62 -6
- package/src/lib/composables/useAtomixGlass.ts +4 -2
- package/src/lib/constants/components.ts +4 -0
- package/src/lib/types/components.ts +10 -4
- package/src/styles/01-settings/_settings.background.scss +5 -5
- package/src/styles/06-components/_components.navbar.scss +2 -0
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +0 -215
package/dist/index.d.ts
CHANGED
|
@@ -1419,6 +1419,15 @@ interface AtomixGlassProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1419
1419
|
* @default false
|
|
1420
1420
|
*/
|
|
1421
1421
|
disableResponsiveBreakpoints?: boolean;
|
|
1422
|
+
/**
|
|
1423
|
+
* Priority level for rendering and performance scheduling
|
|
1424
|
+
*
|
|
1425
|
+
* Controls the rendering priority of the glass effect, allowing for performance
|
|
1426
|
+
* optimization in complex scenes. Higher priority elements are rendered first.
|
|
1427
|
+
*
|
|
1428
|
+
* @default undefined
|
|
1429
|
+
*/
|
|
1430
|
+
priority?: number;
|
|
1422
1431
|
}
|
|
1423
1432
|
/**
|
|
1424
1433
|
* Common component size options
|
|
@@ -3022,10 +3031,6 @@ interface SpinnerProps extends BaseComponentProps {
|
|
|
3022
3031
|
* Icon size options
|
|
3023
3032
|
*/
|
|
3024
3033
|
type IconSize$1 = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3025
|
-
/**
|
|
3026
|
-
* Icon size options
|
|
3027
|
-
*/
|
|
3028
|
-
type IconSize$1 = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3029
3034
|
/**
|
|
3030
3035
|
* Icon component properties
|
|
3031
3036
|
*/
|
|
@@ -10807,6 +10812,9 @@ declare const ATOMIX_GLASS: {
|
|
|
10807
10812
|
MIN_BLUR: number;
|
|
10808
10813
|
MOUSE_INFLUENCE_DIVISOR: number;
|
|
10809
10814
|
EDGE_FADE_PIXELS: number;
|
|
10815
|
+
ELASTICITY_TRANSLATION_FACTOR: number;
|
|
10816
|
+
ELASTICITY_DISTANCE_THRESHOLD: number;
|
|
10817
|
+
ELASTICITY_COMPRESSION_FACTOR: number;
|
|
10810
10818
|
DEFAULT_CORNER_RADIUS: number;
|
|
10811
10819
|
MAX_SIZE: number;
|
|
10812
10820
|
PALETTE: {
|
|
@@ -11637,6 +11645,7 @@ interface UseAtomixGlassOptions extends Omit<AtomixGlassProps, 'children'> {
|
|
|
11637
11645
|
wrapperRef?: React__default.RefObject<HTMLDivElement | null>;
|
|
11638
11646
|
children?: React__default.ReactNode;
|
|
11639
11647
|
isFixedOrSticky?: boolean;
|
|
11648
|
+
priority?: number;
|
|
11640
11649
|
withLiquidBlur?: boolean;
|
|
11641
11650
|
animationQuality?: 'low' | 'medium' | 'high';
|
|
11642
11651
|
timeSpeed?: number;
|
|
@@ -11685,7 +11694,8 @@ interface UseAtomixGlassReturn {
|
|
|
11685
11694
|
* Composable hook for AtomixGlass component logic
|
|
11686
11695
|
* Manages all state, calculations, and event handlers
|
|
11687
11696
|
*/
|
|
11688
|
-
declare function useAtomixGlass({ glassRef, contentRef, wrapperRef, borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer, overLight, reducedMotion, highContrast, withoutEffects, elasticity, onClick, debugBorderRadius, debugOverLight, children, blurAmount, saturation, padding, withLiquidBlur, isFixedOrSticky,
|
|
11697
|
+
declare function useAtomixGlass({ glassRef, contentRef, wrapperRef, borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer, overLight, reducedMotion, highContrast, withoutEffects, elasticity, onClick, debugBorderRadius, debugOverLight, children, blurAmount, saturation, padding, withLiquidBlur, isFixedOrSticky, priority, // Default priority
|
|
11698
|
+
withTimeAnimation, animationSpeed, withMultiLayerDistortion, distortionOctaves, distortionLacunarity, distortionGain, distortionQuality, }: UseAtomixGlassOptions): UseAtomixGlassReturn;
|
|
11689
11699
|
|
|
11690
11700
|
/**
|
|
11691
11701
|
* Input state and functionality
|
package/dist/index.esm.js
CHANGED
|
@@ -1754,6 +1754,10 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
1754
1754
|
MIN_BLUR: .1,
|
|
1755
1755
|
MOUSE_INFLUENCE_DIVISOR: 100,
|
|
1756
1756
|
EDGE_FADE_PIXELS: 2,
|
|
1757
|
+
// Elasticity physics constants
|
|
1758
|
+
ELASTICITY_TRANSLATION_FACTOR: .1,
|
|
1759
|
+
ELASTICITY_DISTANCE_THRESHOLD: 200,
|
|
1760
|
+
ELASTICITY_COMPRESSION_FACTOR: .3,
|
|
1757
1761
|
// Note: This default must match the SCSS variable --atomix-radius-md
|
|
1758
1762
|
// @see src/styles/01-settings/_settings.global.scss
|
|
1759
1763
|
DEFAULT_CORNER_RADIUS: 16,
|
|
@@ -2506,9 +2510,21 @@ class {
|
|
|
2506
2510
|
y: this.lastEvent.clientY
|
|
2507
2511
|
},
|
|
2508
2512
|
// Notify all subscribers
|
|
2509
|
-
this.listeners.forEach((
|
|
2513
|
+
this.listeners.forEach((listener => {
|
|
2510
2514
|
try {
|
|
2511
|
-
|
|
2515
|
+
// If the listener has an element, calculate distance-based attenuation
|
|
2516
|
+
if (listener.element) {
|
|
2517
|
+
const elementRect = listener.element.getBoundingClientRect(), elementCenter = {
|
|
2518
|
+
x: elementRect.left + elementRect.width / 2,
|
|
2519
|
+
y: elementRect.top + elementRect.height / 2
|
|
2520
|
+
}, distance = this.calculateDistance(this.position, elementCenter), maxDistance = listener.maxDistance || 300, attenuation = Math.max(0, 1 - distance / maxDistance), attenuatedRelativePosition = {
|
|
2521
|
+
x: (this.position.x - elementCenter.x) / elementRect.width * 100 * attenuation,
|
|
2522
|
+
y: (this.position.y - elementCenter.y) / elementRect.height * 100 * attenuation
|
|
2523
|
+
};
|
|
2524
|
+
listener.callback(attenuatedRelativePosition);
|
|
2525
|
+
} else
|
|
2526
|
+
// Send original position for listeners without distance-based attenuation
|
|
2527
|
+
listener.callback(this.position);
|
|
2512
2528
|
} catch (error) {
|
|
2513
2529
|
console.error("GlobalMouseTracker: Error in subscriber callback", error);
|
|
2514
2530
|
}
|
|
@@ -2519,10 +2535,17 @@ class {
|
|
|
2519
2535
|
/**
|
|
2520
2536
|
* Subscribe to mouse position updates
|
|
2521
2537
|
* @param callback Function to call when mouse position changes
|
|
2538
|
+
* @param element Optional element for distance-based attenuation
|
|
2539
|
+
* @param maxDistance Optional maximum distance for full effect
|
|
2522
2540
|
* @returns Unsubscribe function
|
|
2523
|
-
*/ subscribe(callback) {
|
|
2541
|
+
*/ subscribe(callback, element, maxDistance) {
|
|
2542
|
+
const listener = {
|
|
2543
|
+
callback: callback,
|
|
2544
|
+
element: element,
|
|
2545
|
+
maxDistance: maxDistance
|
|
2546
|
+
};
|
|
2524
2547
|
// Return unsubscribe function
|
|
2525
|
-
return this.listeners.add(
|
|
2548
|
+
return this.listeners.add(listener),
|
|
2526
2549
|
// Start tracking if this is the first subscriber
|
|
2527
2550
|
1 === this.listeners.size && this.startTracking(),
|
|
2528
2551
|
// Immediately notify with current position
|
|
@@ -2533,9 +2556,13 @@ class {
|
|
|
2533
2556
|
/**
|
|
2534
2557
|
* Unsubscribe from mouse position updates
|
|
2535
2558
|
*/ unsubscribe(callback) {
|
|
2536
|
-
|
|
2559
|
+
// Find and remove the listener with the given callback
|
|
2560
|
+
for (const listener of this.listeners) if (listener.callback === callback) {
|
|
2561
|
+
this.listeners.delete(listener);
|
|
2562
|
+
break;
|
|
2563
|
+
}
|
|
2537
2564
|
// Stop tracking if no more subscribers
|
|
2538
|
-
|
|
2565
|
+
0 === this.listeners.size && this.stopTracking();
|
|
2539
2566
|
}
|
|
2540
2567
|
/**
|
|
2541
2568
|
* Start tracking mouse movement
|
|
@@ -2554,6 +2581,12 @@ class {
|
|
|
2554
2581
|
null !== this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = null), this.lastEvent = null);
|
|
2555
2582
|
}
|
|
2556
2583
|
/**
|
|
2584
|
+
* Calculate distance between two points
|
|
2585
|
+
*/ calculateDistance(point1, point2) {
|
|
2586
|
+
const dx = point1.x - point2.x, dy = point1.y - point2.y;
|
|
2587
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2557
2590
|
* Get current mouse position (synchronous)
|
|
2558
2591
|
*/ getPosition() {
|
|
2559
2592
|
return {
|
|
@@ -2838,7 +2871,8 @@ const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new Weak
|
|
|
2838
2871
|
* Composable hook for AtomixGlass component logic
|
|
2839
2872
|
* Manages all state, calculations, and event handlers
|
|
2840
2873
|
*/
|
|
2841
|
-
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 = .
|
|
2874
|
+
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 = ATOMIX_GLASS.DEFAULTS.ELASTICITY, onClick: onClick, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, children: children, blurAmount: blurAmount, saturation: saturation, padding: padding, withLiquidBlur: withLiquidBlur, isFixedOrSticky: isFixedOrSticky = !1, priority: priority = 1, withTimeAnimation:
|
|
2875
|
+
// Default priority
|
|
2842
2876
|
// Phase 1: Animation System Props
|
|
2843
2877
|
withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: animationSpeed = ATOMIX_GLASS.DEFAULTS.ANIMATION_SPEED, withMultiLayerDistortion: withMultiLayerDistortion = ATOMIX_GLASS.DEFAULTS.WITH_MULTI_LAYER_DISTORTION, distortionOctaves: distortionOctaves = ATOMIX_GLASS.DEFAULTS.DISTORTION_OCTAVES, distortionLacunarity: distortionLacunarity = ATOMIX_GLASS.DEFAULTS.DISTORTION_LACUNARITY, distortionGain: distortionGain = ATOMIX_GLASS.DEFAULTS.DISTORTION_GAIN, distortionQuality: distortionQuality = ATOMIX_GLASS.DEFAULTS.DISTORTION_QUALITY}) {
|
|
2844
2878
|
// State
|
|
@@ -3235,7 +3269,8 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
|
|
|
3235
3269
|
useEffect((() => {
|
|
3236
3270
|
if (externalGlobalMousePosition && externalMouseOffset) return;
|
|
3237
3271
|
if (effectiveWithoutEffects) return;
|
|
3238
|
-
const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition);
|
|
3272
|
+
const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition, glassRef.current || void 0, 300);
|
|
3273
|
+
// 300px max distance for full effect
|
|
3239
3274
|
// Initial start
|
|
3240
3275
|
startLerpLoop();
|
|
3241
3276
|
const container = mouseContainer?.current || glassRef.current;
|