@shohojdhara/atomix 0.2.9 → 0.3.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/atomix.css +309 -105
  3. package/dist/atomix.min.css +3 -5
  4. package/dist/index.d.ts +807 -51
  5. package/dist/index.esm.js +16367 -16405
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +16277 -16330
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.min.js +1 -1
  10. package/dist/index.min.js.map +1 -1
  11. package/dist/themes/applemix.css +309 -105
  12. package/dist/themes/applemix.min.css +5 -7
  13. package/dist/themes/boomdevs.css +202 -10
  14. package/dist/themes/boomdevs.min.css +3 -5
  15. package/dist/themes/esrar.css +309 -105
  16. package/dist/themes/esrar.min.css +4 -6
  17. package/dist/themes/flashtrade.css +310 -105
  18. package/dist/themes/flashtrade.min.css +5 -7
  19. package/dist/themes/mashroom.css +300 -96
  20. package/dist/themes/mashroom.min.css +4 -6
  21. package/dist/themes/shaj-default.css +300 -96
  22. package/dist/themes/shaj-default.min.css +4 -6
  23. package/package.json +1 -1
  24. package/src/components/AtomixGlass/AtomixGlass.test.tsx +21 -32
  25. package/src/components/AtomixGlass/AtomixGlass.tsx +55 -42
  26. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +205 -57
  27. package/src/components/AtomixGlass/GlassFilter.tsx +22 -8
  28. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +221 -0
  29. package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -3
  30. package/src/components/AtomixGlass/shader-utils.ts +8 -0
  31. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +319 -100
  32. package/src/components/AtomixGlass/stories/Examples.stories.tsx +601 -105
  33. package/src/components/AtomixGlass/stories/Modes.stories.tsx +30 -12
  34. package/src/components/AtomixGlass/stories/Playground.stories.tsx +173 -38
  35. package/src/components/AtomixGlass/stories/ShaderVariants.stories.tsx +18 -18
  36. package/src/components/AtomixGlass/stories/shared-components.tsx +27 -5
  37. package/src/components/Breadcrumb/Breadcrumb.tsx +8 -3
  38. package/src/components/Button/Button.tsx +62 -17
  39. package/src/components/Callout/Callout.test.tsx +8 -14
  40. package/src/components/Card/Card.tsx +103 -1
  41. package/src/components/Card/index.ts +3 -2
  42. package/src/components/Footer/Footer.stories.tsx +1 -2
  43. package/src/components/Footer/Footer.tsx +0 -5
  44. package/src/components/Footer/FooterLink.tsx +3 -2
  45. package/src/components/Footer/FooterSection.tsx +0 -7
  46. package/src/components/Icon/index.ts +1 -1
  47. package/src/components/Modal/Modal.stories.tsx +29 -38
  48. package/src/components/Modal/Modal.tsx +4 -4
  49. package/src/components/Navigation/Nav/NavItem.tsx +8 -3
  50. package/src/components/Navigation/SideMenu/SideMenu.tsx +49 -41
  51. package/src/components/Navigation/SideMenu/SideMenuItem.tsx +63 -19
  52. package/src/components/Popover/Popover.tsx +1 -1
  53. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +977 -400
  54. package/src/components/VideoPlayer/VideoPlayer.tsx +1 -6
  55. package/src/lib/composables/shared-mouse-tracker.ts +133 -0
  56. package/src/lib/composables/useAtomixGlass.ts +303 -115
  57. package/src/lib/theme/ThemeManager.integration.test.ts +124 -0
  58. package/src/lib/theme/ThemeManager.stories.tsx +13 -13
  59. package/src/lib/theme/ThemeManager.test.ts +4 -0
  60. package/src/lib/theme/ThemeManager.ts +203 -59
  61. package/src/lib/theme/ThemeProvider.tsx +183 -33
  62. package/src/lib/theme/composeTheme.ts +375 -0
  63. package/src/lib/theme/createTheme.test.ts +475 -0
  64. package/src/lib/theme/createTheme.ts +510 -0
  65. package/src/lib/theme/generateCSSVariables.ts +713 -0
  66. package/src/lib/theme/index.ts +67 -0
  67. package/src/lib/theme/themeUtils.ts +333 -0
  68. package/src/lib/theme/types.ts +337 -8
  69. package/src/lib/theme/useTheme.test.tsx +2 -1
  70. package/src/lib/theme/useTheme.ts +6 -22
  71. package/src/lib/types/components.ts +152 -57
  72. package/src/styles/01-settings/_index.scss +2 -2
  73. package/src/styles/01-settings/_settings.badge.scss +2 -2
  74. package/src/styles/01-settings/_settings.border-radius.scss +1 -1
  75. package/src/styles/01-settings/{_settings.maps.scss → _settings.design-tokens.scss} +163 -49
  76. package/src/styles/01-settings/_settings.modal.scss +1 -1
  77. package/src/styles/01-settings/_settings.spacing.scss +14 -13
  78. package/src/styles/03-generic/_generic.root.scss +131 -50
  79. package/src/styles/05-objects/_objects.block.scss +1 -1
  80. package/src/styles/06-components/_components.atomix-glass.scss +20 -22
  81. package/src/styles/06-components/_components.badge.scss +2 -2
  82. package/src/styles/06-components/_components.button.scss +1 -1
  83. package/src/styles/06-components/_components.callout.scss +1 -1
  84. package/src/styles/06-components/_components.card.scss +74 -2
  85. package/src/styles/06-components/_components.chart.scss +1 -1
  86. package/src/styles/06-components/_components.dropdown.scss +6 -0
  87. package/src/styles/06-components/_components.footer.scss +1 -1
  88. package/src/styles/06-components/_components.list-group.scss +1 -1
  89. package/src/styles/06-components/_components.list.scss +1 -1
  90. package/src/styles/06-components/_components.menu.scss +1 -1
  91. package/src/styles/06-components/_components.messages.scss +1 -1
  92. package/src/styles/06-components/_components.modal.scss +7 -2
  93. package/src/styles/06-components/_components.navbar.scss +1 -1
  94. package/src/styles/06-components/_components.popover.scss +10 -0
  95. package/src/styles/06-components/_components.product-review.scss +1 -1
  96. package/src/styles/06-components/_components.progress.scss +1 -1
  97. package/src/styles/06-components/_components.rating.scss +1 -1
  98. package/src/styles/06-components/_components.spinner.scss +1 -1
  99. package/src/styles/99-utilities/_utilities.background.scss +1 -1
  100. package/src/styles/99-utilities/_utilities.border.scss +1 -1
  101. package/src/styles/99-utilities/_utilities.link.scss +1 -1
  102. package/src/styles/99-utilities/_utilities.text.scss +1 -1
@@ -463,15 +463,10 @@ export const VideoPlayer = forwardRef<HTMLVideoElement, VideoPlayerProps>(
463
463
  <div className={VIDEO_PLAYER.CLASSES.GLASS_OVERLAY}>
464
464
  <AtomixGlass
465
465
  {...(typeof glass === 'boolean' ? {} : glass)}
466
- style={{
467
- borderRadius: 'inherit',
468
- }}
469
466
  mouseContainer={containerRef}
470
- displacementScale={30}
467
+ displacementScale={100}
471
468
  blurAmount={0}
472
469
  saturation={100}
473
- aberrationIntensity={0}
474
- cornerRadius={containerBorderRadius}
475
470
  elasticity={0}
476
471
  >
477
472
  {!glassContent && (
@@ -0,0 +1,133 @@
1
+ import type { MousePosition } from '../types/components';
2
+
3
+ /**
4
+ * Global mouse tracker singleton
5
+ * Tracks mouse position at document level and distributes to subscribers
6
+ * Reduces event processing overhead when multiple AtomixGlass instances are present
7
+ */
8
+ class GlobalMouseTracker {
9
+ private listeners = new Set<(pos: MousePosition) => void>();
10
+ private position: MousePosition = { x: 0, y: 0 };
11
+ private rafId: number | null = null;
12
+ private lastEvent: MouseEvent | null = null;
13
+ private isTracking = false;
14
+
15
+ /**
16
+ * Subscribe to mouse position updates
17
+ * @param callback Function to call when mouse position changes
18
+ * @returns Unsubscribe function
19
+ */
20
+ subscribe(callback: (pos: MousePosition) => void): () => void {
21
+ this.listeners.add(callback);
22
+
23
+ // Start tracking if this is the first subscriber
24
+ if (this.listeners.size === 1) {
25
+ this.startTracking();
26
+ }
27
+
28
+ // Immediately notify with current position
29
+ callback(this.position);
30
+
31
+ // Return unsubscribe function
32
+ return () => {
33
+ this.unsubscribe(callback);
34
+ };
35
+ }
36
+
37
+ /**
38
+ * Unsubscribe from mouse position updates
39
+ */
40
+ private unsubscribe(callback: (pos: MousePosition) => void): void {
41
+ this.listeners.delete(callback);
42
+
43
+ // Stop tracking if no more subscribers
44
+ if (this.listeners.size === 0) {
45
+ this.stopTracking();
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Start tracking mouse movement
51
+ */
52
+ private startTracking(): void {
53
+ if (this.isTracking) {
54
+ return;
55
+ }
56
+
57
+ this.isTracking = true;
58
+
59
+ // Use document-level listener for global tracking
60
+ document.addEventListener('mousemove', this.handleMouseMove, { passive: true });
61
+ }
62
+
63
+ /**
64
+ * Stop tracking mouse movement
65
+ */
66
+ private stopTracking(): void {
67
+ if (!this.isTracking) {
68
+ return;
69
+ }
70
+
71
+ this.isTracking = false;
72
+ document.removeEventListener('mousemove', this.handleMouseMove);
73
+
74
+ // Cancel any pending RAF
75
+ if (this.rafId !== null) {
76
+ cancelAnimationFrame(this.rafId);
77
+ this.rafId = null;
78
+ }
79
+
80
+ this.lastEvent = null;
81
+ }
82
+
83
+ /**
84
+ * Handle mouse move event
85
+ */
86
+ private handleMouseMove = (e: MouseEvent): void => {
87
+ this.lastEvent = e;
88
+
89
+ // Use requestAnimationFrame to throttle updates
90
+ if (this.rafId === null) {
91
+ this.rafId = requestAnimationFrame(() => {
92
+ if (this.lastEvent) {
93
+ this.position = {
94
+ x: this.lastEvent.clientX,
95
+ y: this.lastEvent.clientY,
96
+ };
97
+
98
+ // Notify all subscribers
99
+ this.listeners.forEach((callback) => {
100
+ try {
101
+ callback(this.position);
102
+ } catch (error) {
103
+ console.error('GlobalMouseTracker: Error in subscriber callback', error);
104
+ }
105
+ });
106
+ }
107
+
108
+ this.rafId = null;
109
+ });
110
+ }
111
+ };
112
+
113
+ /**
114
+ * Get current mouse position (synchronous)
115
+ */
116
+ getPosition(): MousePosition {
117
+ return { ...this.position };
118
+ }
119
+
120
+ /**
121
+ * Get number of active subscribers (for debugging)
122
+ */
123
+ getSubscriberCount(): number {
124
+ return this.listeners.size;
125
+ }
126
+ }
127
+
128
+ // Singleton instance
129
+ const globalMouseTracker = new GlobalMouseTracker();
130
+
131
+ export { globalMouseTracker };
132
+ export type { GlobalMouseTracker };
133
+