@shohojdhara/atomix 0.5.0 → 0.5.1
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 +95 -69
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +1 -0
- package/dist/charts.js +231 -332
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +232 -333
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +1 -0
- package/dist/forms.js +231 -332
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +11 -2
- package/dist/heavy.js +233 -334
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.esm.js +228 -327
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +227 -326
- 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 +11 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +188 -128
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +62 -90
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +153 -201
- package/src/components/AtomixGlass/glass-utils.ts +50 -0
- package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +52 -46
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +573 -236
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +88 -41
- package/src/components/AtomixGlass/stories/argTypes.ts +19 -19
- package/src/components/AtomixGlass/stories/shared-components.tsx +7 -12
- package/src/components/AtomixGlass/stories/types.ts +3 -3
- package/src/lib/composables/useAtomixGlass.ts +108 -71
- package/src/lib/composables/useAtomixGlassStyles.ts +0 -2
- package/src/lib/constants/components.ts +1 -0
- package/src/lib/types/components.ts +1 -0
- package/src/lib/utils/displacement-generator.ts +1 -1
- package/src/styles/06-components/_components.atomix-glass.scss +158 -97
- package/scripts/cli/__tests__/README.md +0 -81
- package/scripts/cli/__tests__/basic.test.js +0 -116
- package/scripts/cli/__tests__/clean.test.js +0 -278
- package/scripts/cli/__tests__/component-generator.test.js +0 -332
- package/scripts/cli/__tests__/component-validator.test.js +0 -433
- package/scripts/cli/__tests__/generator.test.js +0 -613
- package/scripts/cli/__tests__/glass-motion.test.js +0 -256
- package/scripts/cli/__tests__/integration.test.js +0 -938
- package/scripts/cli/__tests__/migrate.test.js +0 -74
- package/scripts/cli/__tests__/security.test.js +0 -206
- package/scripts/cli/__tests__/test-setup.js +0 -135
- package/scripts/cli/__tests__/theme-bridge.test.js +0 -507
- package/scripts/cli/__tests__/token-manager.test.js +0 -251
- package/scripts/cli/__tests__/token-provider.test.js +0 -361
- package/scripts/cli/__tests__/utils.test.js +0 -165
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +0 -216
- package/src/components/AtomixGlass/stories/AnimationTests.stories.tsx +0 -95
- package/src/components/AtomixGlass/stories/CardExamples.stories.tsx +0 -212
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +0 -131
- package/src/components/AtomixGlass/stories/DashboardExamples.stories.tsx +0 -348
- package/src/components/AtomixGlass/stories/EcommerceExamples.stories.tsx +0 -410
- package/src/components/AtomixGlass/stories/FormExamples.stories.tsx +0 -436
- package/src/components/AtomixGlass/stories/HeroExamples.stories.tsx +0 -264
- package/src/components/AtomixGlass/stories/InteractivePlayground.stories.tsx +0 -247
- package/src/components/AtomixGlass/stories/MobileUIExamples.stories.tsx +0 -418
- package/src/components/AtomixGlass/stories/ModalExamples.stories.tsx +0 -402
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +0 -1082
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +0 -497
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +0 -103
- package/src/components/AtomixGlass/stories/PresetGallery.stories.tsx +0 -335
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +0 -395
- package/src/components/AtomixGlass/stories/WidgetExamples.stories.tsx +0 -441
- package/src/components/TypedButton/TypedButton.stories.tsx +0 -59
- package/src/components/TypedButton/TypedButton.tsx +0 -39
- package/src/components/TypedButton/index.ts +0 -2
- package/src/lib/composables/useTypedButton.ts +0 -66
|
@@ -775,49 +775,14 @@ export function useAtomixGlass({
|
|
|
775
775
|
// ── Raw mouse handler — writes to TARGET refs only ──────────────────
|
|
776
776
|
// The lerp loop (below) reads the targets and incrementally
|
|
777
777
|
// moves the "current" refs toward them for liquid smoothing.
|
|
778
|
-
const handleGlobalMousePosition = useCallback(
|
|
779
|
-
(globalPos: MousePosition) => {
|
|
780
|
-
if (externalGlobalMousePosition && externalMouseOffset) {
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
if (effectiveWithoutEffects) {
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
const container = mouseContainer?.current || glassRef.current;
|
|
789
|
-
if (!container) {
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
// Use cached rect if available, otherwise get new one
|
|
794
|
-
let rect = cachedRectRef.current;
|
|
795
|
-
if (!rect || rect.width === 0 || rect.height === 0) {
|
|
796
|
-
rect = container.getBoundingClientRect();
|
|
797
|
-
cachedRectRef.current = rect;
|
|
798
|
-
}
|
|
799
778
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
targetMouseOffsetRef.current = {
|
|
808
|
-
x: ((globalPos.x - center.x) / rect.width) * 100,
|
|
809
|
-
y: ((globalPos.y - center.y) / rect.height) * 100,
|
|
810
|
-
};
|
|
811
|
-
targetGlobalMousePositionRef.current = globalPos;
|
|
812
|
-
},
|
|
813
|
-
[
|
|
814
|
-
mouseContainer,
|
|
815
|
-
glassRef,
|
|
816
|
-
externalGlobalMousePosition,
|
|
817
|
-
externalMouseOffset,
|
|
818
|
-
effectiveWithoutEffects,
|
|
819
|
-
]
|
|
820
|
-
);
|
|
779
|
+
const stopLerpLoop = useCallback(() => {
|
|
780
|
+
lerpActiveRef.current = false;
|
|
781
|
+
if (lerpRafRef.current !== null) {
|
|
782
|
+
cancelAnimationFrame(lerpRafRef.current);
|
|
783
|
+
lerpRafRef.current = null;
|
|
784
|
+
}
|
|
785
|
+
}, []);
|
|
821
786
|
|
|
822
787
|
// ── Lerp animation loop ─────────────────────────────────────────────
|
|
823
788
|
// Continuously interpolates the current offset toward the target.
|
|
@@ -827,20 +792,18 @@ export function useAtomixGlass({
|
|
|
827
792
|
lerpActiveRef.current = true;
|
|
828
793
|
|
|
829
794
|
const LERP_T = CONSTANTS.LERP_FACTOR; // 0.08 – lower = more viscous
|
|
830
|
-
const EPSILON = 0.
|
|
795
|
+
const EPSILON = 0.01; // Snap when close enough
|
|
831
796
|
|
|
832
797
|
const tick = () => {
|
|
833
798
|
if (!lerpActiveRef.current) return;
|
|
834
799
|
|
|
835
|
-
|
|
836
|
-
if (!glassRef.current || !wrapperRef?.current) {
|
|
800
|
+
if (!glassRef.current) {
|
|
837
801
|
lerpActiveRef.current = false;
|
|
838
802
|
return;
|
|
839
803
|
}
|
|
840
804
|
|
|
841
805
|
const cur = internalMouseOffsetRef.current;
|
|
842
806
|
const tgt = targetMouseOffsetRef.current;
|
|
843
|
-
|
|
844
807
|
const dx = tgt.x - cur.x;
|
|
845
808
|
const dy = tgt.y - cur.y;
|
|
846
809
|
|
|
@@ -848,22 +811,53 @@ export function useAtomixGlass({
|
|
|
848
811
|
if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) {
|
|
849
812
|
internalMouseOffsetRef.current = { ...tgt };
|
|
850
813
|
internalGlobalMousePositionRef.current = { ...targetGlobalMousePositionRef.current };
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
814
|
+
|
|
815
|
+
// Final update and stop
|
|
816
|
+
updateAtomixGlassStyles(
|
|
817
|
+
wrapperRef?.current || null,
|
|
818
|
+
glassRef.current,
|
|
819
|
+
{
|
|
820
|
+
mouseOffset: internalMouseOffsetRef.current,
|
|
821
|
+
globalMousePosition: internalGlobalMousePositionRef.current,
|
|
822
|
+
glassSize,
|
|
823
|
+
isHovered,
|
|
824
|
+
isActive,
|
|
825
|
+
isOverLight: overLightConfig.isOverLight,
|
|
826
|
+
baseOverLightConfig: overLightConfig,
|
|
827
|
+
effectiveBorderRadius,
|
|
828
|
+
effectiveWithoutEffects,
|
|
829
|
+
effectiveReducedMotion,
|
|
830
|
+
elasticity,
|
|
831
|
+
directionalScale: isActive && Boolean(onClick) ? 'scale(0.96)' : 'scale(1)',
|
|
832
|
+
onClick,
|
|
833
|
+
withLiquidBlur,
|
|
834
|
+
blurAmount,
|
|
835
|
+
saturation,
|
|
836
|
+
padding,
|
|
837
|
+
isFixedOrSticky,
|
|
838
|
+
}
|
|
839
|
+
);
|
|
840
|
+
|
|
841
|
+
stopLerpLoop();
|
|
842
|
+
return;
|
|
862
843
|
}
|
|
863
844
|
|
|
864
|
-
//
|
|
845
|
+
// Smooth step
|
|
846
|
+
internalMouseOffsetRef.current = {
|
|
847
|
+
x: lerp(cur.x, tgt.x, LERP_T),
|
|
848
|
+
y: lerp(cur.y, tgt.y, LERP_T),
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
const curG = internalGlobalMousePositionRef.current;
|
|
852
|
+
const tgtG = targetGlobalMousePositionRef.current;
|
|
853
|
+
internalGlobalMousePositionRef.current = {
|
|
854
|
+
x: lerp(curG.x, tgtG.x, LERP_T),
|
|
855
|
+
y: lerp(curG.y, tgtG.y, LERP_T),
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
// Imperative style update
|
|
865
859
|
updateAtomixGlassStyles(
|
|
866
|
-
wrapperRef
|
|
860
|
+
wrapperRef?.current || null,
|
|
867
861
|
glassRef.current,
|
|
868
862
|
{
|
|
869
863
|
mouseOffset: internalMouseOffsetRef.current,
|
|
@@ -908,15 +902,58 @@ export function useAtomixGlass({
|
|
|
908
902
|
saturation,
|
|
909
903
|
padding,
|
|
910
904
|
isFixedOrSticky,
|
|
905
|
+
stopLerpLoop,
|
|
911
906
|
]);
|
|
912
907
|
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
908
|
+
const handleGlobalMousePosition = useCallback(
|
|
909
|
+
(globalPos: MousePosition) => {
|
|
910
|
+
if (externalGlobalMousePosition && externalMouseOffset) {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
if (effectiveWithoutEffects) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
const container = mouseContainer?.current || glassRef.current;
|
|
919
|
+
if (!container) {
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
// Use cached rect if available, otherwise get new one
|
|
924
|
+
let rect = cachedRectRef.current;
|
|
925
|
+
if (!rect || rect.width === 0 || rect.height === 0) {
|
|
926
|
+
rect = container.getBoundingClientRect();
|
|
927
|
+
cachedRectRef.current = rect;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const center = calculateElementCenter(rect);
|
|
935
|
+
|
|
936
|
+
// Write raw target — the lerp loop will smoothly pursue it
|
|
937
|
+
targetMouseOffsetRef.current = {
|
|
938
|
+
x: ((globalPos.x - center.x) / rect.width) * 100,
|
|
939
|
+
y: ((globalPos.y - center.y) / rect.height) * 100,
|
|
940
|
+
};
|
|
941
|
+
targetGlobalMousePositionRef.current = globalPos;
|
|
942
|
+
|
|
943
|
+
// Ensure the lerp loop is running to smoothly chase the new target
|
|
944
|
+
if (!lerpActiveRef.current) {
|
|
945
|
+
startLerpLoop();
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
[
|
|
949
|
+
mouseContainer,
|
|
950
|
+
glassRef,
|
|
951
|
+
externalGlobalMousePosition,
|
|
952
|
+
externalMouseOffset,
|
|
953
|
+
effectiveWithoutEffects,
|
|
954
|
+
startLerpLoop,
|
|
955
|
+
]
|
|
956
|
+
);
|
|
920
957
|
|
|
921
958
|
// Subscribe to shared mouse tracker
|
|
922
959
|
useEffect(() => {
|
|
@@ -929,8 +966,8 @@ export function useAtomixGlass({
|
|
|
929
966
|
}
|
|
930
967
|
|
|
931
968
|
const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition);
|
|
932
|
-
|
|
933
|
-
//
|
|
969
|
+
|
|
970
|
+
// Initial start
|
|
934
971
|
startLerpLoop();
|
|
935
972
|
|
|
936
973
|
const updateRect = () => {
|
|
@@ -966,14 +1003,14 @@ export function useAtomixGlass({
|
|
|
966
1003
|
}
|
|
967
1004
|
};
|
|
968
1005
|
}, [
|
|
1006
|
+
externalGlobalMousePosition,
|
|
1007
|
+
externalMouseOffset,
|
|
1008
|
+
effectiveWithoutEffects,
|
|
969
1009
|
handleGlobalMousePosition,
|
|
970
1010
|
startLerpLoop,
|
|
971
1011
|
stopLerpLoop,
|
|
972
1012
|
mouseContainer,
|
|
973
1013
|
glassRef,
|
|
974
|
-
externalGlobalMousePosition,
|
|
975
|
-
externalMouseOffset,
|
|
976
|
-
effectiveWithoutEffects,
|
|
977
1014
|
]);
|
|
978
1015
|
|
|
979
1016
|
// Also call updateStyles on other state changes (hover, active, etc)
|
|
@@ -298,8 +298,6 @@ export const updateAtomixGlassStyles = (
|
|
|
298
298
|
// Container variables
|
|
299
299
|
const style = containerElement.style;
|
|
300
300
|
|
|
301
|
-
style.setProperty('--atomix-glass-container-width', !isFixedOrSticky ? '100%' : `${glassSize.width}`);
|
|
302
|
-
style.setProperty('--atomix-glass-container-height', !isFixedOrSticky ? '100%' : `${glassSize.height}`);
|
|
303
301
|
style.setProperty('--atomix-glass-container-padding', padding);
|
|
304
302
|
style.setProperty('--atomix-glass-container-radius', `${effectiveBorderRadius}px`);
|
|
305
303
|
|
|
@@ -1631,6 +1631,7 @@ export const ATOMIX_GLASS = {
|
|
|
1631
1631
|
FILTER_OVERLAY_CLASS: 'c-atomix-glass__filter-overlay',
|
|
1632
1632
|
FILTER_SHADOW_CLASS: 'c-atomix-glass__filter-shadow',
|
|
1633
1633
|
CONTENT_CLASS: 'c-atomix-glass__content',
|
|
1634
|
+
BORDER_BACKDROP_CLASS: 'c-atomix-glass__border-backdrop',
|
|
1634
1635
|
BORDER_1_CLASS: 'c-atomix-glass__border-1',
|
|
1635
1636
|
BORDER_2_CLASS: 'c-atomix-glass__border-2',
|
|
1636
1637
|
HOVER_1_CLASS: 'c-atomix-glass__hover-1',
|