@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/core.d.ts
CHANGED
|
@@ -473,6 +473,15 @@ interface AtomixGlassProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
473
473
|
* @default false
|
|
474
474
|
*/
|
|
475
475
|
disableResponsiveBreakpoints?: boolean;
|
|
476
|
+
/**
|
|
477
|
+
* Priority level for rendering and performance scheduling
|
|
478
|
+
*
|
|
479
|
+
* Controls the rendering priority of the glass effect, allowing for performance
|
|
480
|
+
* optimization in complex scenes. Higher priority elements are rendered first.
|
|
481
|
+
*
|
|
482
|
+
* @default undefined
|
|
483
|
+
*/
|
|
484
|
+
priority?: number;
|
|
476
485
|
}
|
|
477
486
|
/**
|
|
478
487
|
* Common component size options
|
package/dist/core.js
CHANGED
|
@@ -583,6 +583,10 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
583
583
|
MIN_BLUR: .1,
|
|
584
584
|
MOUSE_INFLUENCE_DIVISOR: 100,
|
|
585
585
|
EDGE_FADE_PIXELS: 2,
|
|
586
|
+
// Elasticity physics constants
|
|
587
|
+
ELASTICITY_TRANSLATION_FACTOR: .1,
|
|
588
|
+
ELASTICITY_DISTANCE_THRESHOLD: 200,
|
|
589
|
+
ELASTICITY_COMPRESSION_FACTOR: .3,
|
|
586
590
|
// Note: This default must match the SCSS variable --atomix-radius-md
|
|
587
591
|
// @see src/styles/01-settings/_settings.global.scss
|
|
588
592
|
DEFAULT_CORNER_RADIUS: 16,
|
|
@@ -1281,9 +1285,21 @@ class {
|
|
|
1281
1285
|
y: this.lastEvent.clientY
|
|
1282
1286
|
},
|
|
1283
1287
|
// Notify all subscribers
|
|
1284
|
-
this.listeners.forEach((
|
|
1288
|
+
this.listeners.forEach((listener => {
|
|
1285
1289
|
try {
|
|
1286
|
-
|
|
1290
|
+
// If the listener has an element, calculate distance-based attenuation
|
|
1291
|
+
if (listener.element) {
|
|
1292
|
+
const elementRect = listener.element.getBoundingClientRect(), elementCenter = {
|
|
1293
|
+
x: elementRect.left + elementRect.width / 2,
|
|
1294
|
+
y: elementRect.top + elementRect.height / 2
|
|
1295
|
+
}, distance = this.calculateDistance(this.position, elementCenter), maxDistance = listener.maxDistance || 300, attenuation = Math.max(0, 1 - distance / maxDistance), attenuatedRelativePosition = {
|
|
1296
|
+
x: (this.position.x - elementCenter.x) / elementRect.width * 100 * attenuation,
|
|
1297
|
+
y: (this.position.y - elementCenter.y) / elementRect.height * 100 * attenuation
|
|
1298
|
+
};
|
|
1299
|
+
listener.callback(attenuatedRelativePosition);
|
|
1300
|
+
} else
|
|
1301
|
+
// Send original position for listeners without distance-based attenuation
|
|
1302
|
+
listener.callback(this.position);
|
|
1287
1303
|
} catch (error) {
|
|
1288
1304
|
console.error("GlobalMouseTracker: Error in subscriber callback", error);
|
|
1289
1305
|
}
|
|
@@ -1294,10 +1310,17 @@ class {
|
|
|
1294
1310
|
/**
|
|
1295
1311
|
* Subscribe to mouse position updates
|
|
1296
1312
|
* @param callback Function to call when mouse position changes
|
|
1313
|
+
* @param element Optional element for distance-based attenuation
|
|
1314
|
+
* @param maxDistance Optional maximum distance for full effect
|
|
1297
1315
|
* @returns Unsubscribe function
|
|
1298
|
-
*/ subscribe(callback) {
|
|
1316
|
+
*/ subscribe(callback, element, maxDistance) {
|
|
1317
|
+
const listener = {
|
|
1318
|
+
callback: callback,
|
|
1319
|
+
element: element,
|
|
1320
|
+
maxDistance: maxDistance
|
|
1321
|
+
};
|
|
1299
1322
|
// Return unsubscribe function
|
|
1300
|
-
return this.listeners.add(
|
|
1323
|
+
return this.listeners.add(listener),
|
|
1301
1324
|
// Start tracking if this is the first subscriber
|
|
1302
1325
|
1 === this.listeners.size && this.startTracking(),
|
|
1303
1326
|
// Immediately notify with current position
|
|
@@ -1308,9 +1331,13 @@ class {
|
|
|
1308
1331
|
/**
|
|
1309
1332
|
* Unsubscribe from mouse position updates
|
|
1310
1333
|
*/ unsubscribe(callback) {
|
|
1311
|
-
|
|
1334
|
+
// Find and remove the listener with the given callback
|
|
1335
|
+
for (const listener of this.listeners) if (listener.callback === callback) {
|
|
1336
|
+
this.listeners.delete(listener);
|
|
1337
|
+
break;
|
|
1338
|
+
}
|
|
1312
1339
|
// Stop tracking if no more subscribers
|
|
1313
|
-
|
|
1340
|
+
0 === this.listeners.size && this.stopTracking();
|
|
1314
1341
|
}
|
|
1315
1342
|
/**
|
|
1316
1343
|
* Start tracking mouse movement
|
|
@@ -1329,6 +1356,12 @@ class {
|
|
|
1329
1356
|
null !== this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = null), this.lastEvent = null);
|
|
1330
1357
|
}
|
|
1331
1358
|
/**
|
|
1359
|
+
* Calculate distance between two points
|
|
1360
|
+
*/ calculateDistance(point1, point2) {
|
|
1361
|
+
const dx = point1.x - point2.x, dy = point1.y - point2.y;
|
|
1362
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1332
1365
|
* Get current mouse position (synchronous)
|
|
1333
1366
|
*/ getPosition() {
|
|
1334
1367
|
return {
|
|
@@ -1613,7 +1646,8 @@ const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new Weak
|
|
|
1613
1646
|
* Composable hook for AtomixGlass component logic
|
|
1614
1647
|
* Manages all state, calculations, and event handlers
|
|
1615
1648
|
*/
|
|
1616
|
-
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 = .
|
|
1649
|
+
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:
|
|
1650
|
+
// Default priority
|
|
1617
1651
|
// Phase 1: Animation System Props
|
|
1618
1652
|
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}) {
|
|
1619
1653
|
// State
|
|
@@ -2010,7 +2044,8 @@ withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: a
|
|
|
2010
2044
|
useEffect((() => {
|
|
2011
2045
|
if (externalGlobalMousePosition && externalMouseOffset) return;
|
|
2012
2046
|
if (effectiveWithoutEffects) return;
|
|
2013
|
-
const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition);
|
|
2047
|
+
const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition, glassRef.current || void 0, 300);
|
|
2048
|
+
// 300px max distance for full effect
|
|
2014
2049
|
// Initial start
|
|
2015
2050
|
startLerpLoop();
|
|
2016
2051
|
const container = mouseContainer?.current || glassRef.current;
|