@shohojdhara/atomix 0.3.4 → 0.3.5
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 +9 -10
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15108 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6482 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3357 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2450 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4550 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5161 -4990
- package/dist/index.esm.js +1457 -784
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1473 -790
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.d.ts +300 -0
- package/dist/layout.js +336 -0
- package/dist/layout.js.map +1 -0
- package/dist/theme.d.ts +1992 -0
- package/dist/theme.js +5348 -0
- package/dist/theme.js.map +1 -0
- package/package.json +66 -20
- package/scripts/atomix-cli.js +544 -16
- package/scripts/cli/__tests__/cli-commands.test.js +204 -0
- package/scripts/cli/__tests__/utils.test.js +201 -0
- package/scripts/cli/__tests__/vitest.config.js +26 -0
- package/scripts/cli/interactive-init.js +1 -1
- package/scripts/cli/token-manager.js +32 -7
- package/scripts/cli/utils.js +347 -0
- package/src/components/Accordion/Accordion.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -17
- package/src/components/Chart/AreaChart.tsx +5 -1
- package/src/components/Chart/BarChart.tsx +1 -0
- package/src/components/Chart/BubbleChart.tsx +6 -5
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/FunnelChart.tsx +1 -1
- package/src/components/Chart/RadarChart.tsx +19 -12
- package/src/components/Chart/ScatterChart.tsx +3 -3
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/List/List.stories.tsx +3 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Pagination/Pagination.tsx +6 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/index.ts +5 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- package/src/lib/composables/useChartPerformance.ts +102 -78
- package/src/lib/composables/useChartScale.ts +10 -0
- package/src/lib/composables/useHero.ts +9 -2
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
- package/src/lib/composables/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +55 -13
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +10 -14
- package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
- package/src/lib/patterns/index.ts +2 -2
- package/src/lib/patterns/slots.tsx +2 -2
- package/src/lib/theme/composeTheme.ts +1 -1
- package/src/lib/theme/core/ThemeEngine.ts +8 -0
- package/src/lib/theme/core/ThemeValidator.ts +5 -2
- package/src/lib/theme/devtools/Inspector.tsx +1 -1
- package/src/lib/theme/devtools/LiveEditor.tsx +11 -5
- package/src/lib/theme/generateCSSVariables.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +2 -1
- package/src/lib/theme/runtime/ThemeApplicator.ts +28 -11
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +3 -3
- package/src/lib/theme/runtime/ThemeManager.ts +4 -0
- package/src/lib/theme-tools.ts +1 -1
- package/src/lib/types/components.ts +183 -34
- package/src/lib/types/partProps.ts +0 -16
- package/src/lib/utils/fontPreloader.ts +148 -0
- package/src/lib/utils/index.ts +11 -0
- package/src/lib/utils/memoryMonitor.ts +189 -0
- package/src/styles/01-settings/_settings.fonts.scss +2 -5
- package/src/styles/03-generic/_generated-root.css +22 -1
- package/src/styles/06-components/_components.navbar.scss +0 -6
- package/src/themes/themes.config.js +37 -4
- package/scripts/build-themes.js +0 -208
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
|
@@ -631,6 +631,69 @@ export interface BadgeProps extends BaseComponentProps {
|
|
|
631
631
|
};
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
+
/**
|
|
635
|
+
* Block component properties (legacy - use BlockProps from component instead)
|
|
636
|
+
* @deprecated Use BlockProps from '@atomix/components/Block' instead
|
|
637
|
+
*/
|
|
638
|
+
export interface LegacyBlockProps extends BaseComponentProps {
|
|
639
|
+
/**
|
|
640
|
+
* The content to be rendered within the block
|
|
641
|
+
*/
|
|
642
|
+
children: ReactNode;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* The HTML element to render as
|
|
646
|
+
* @default 'section'
|
|
647
|
+
*/
|
|
648
|
+
as?: 'section' | 'div' | 'article' | 'aside' | 'main';
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Spacing size for vertical padding
|
|
652
|
+
* @default 'md'
|
|
653
|
+
*/
|
|
654
|
+
spacing?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none';
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Container configuration
|
|
658
|
+
*/
|
|
659
|
+
container?: {
|
|
660
|
+
/**
|
|
661
|
+
* Container type for content width
|
|
662
|
+
*/
|
|
663
|
+
type?: 'sm' | 'md' | 'lg' | 'xl' | 'fluid';
|
|
664
|
+
/**
|
|
665
|
+
* Additional container classes
|
|
666
|
+
*/
|
|
667
|
+
className?: string;
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Whether to enable full-width content
|
|
672
|
+
* @default false
|
|
673
|
+
*/
|
|
674
|
+
fullWidth?: boolean;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Background color variant
|
|
678
|
+
*/
|
|
679
|
+
background?:
|
|
680
|
+
| 'primary'
|
|
681
|
+
| 'secondary'
|
|
682
|
+
| 'tertiary'
|
|
683
|
+
| 'invert'
|
|
684
|
+
| 'brand'
|
|
685
|
+
| 'error'
|
|
686
|
+
| 'success'
|
|
687
|
+
| 'warning'
|
|
688
|
+
| 'info'
|
|
689
|
+
| 'light';
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Custom style for the block
|
|
693
|
+
*/
|
|
694
|
+
style?: React.CSSProperties;
|
|
695
|
+
}
|
|
696
|
+
|
|
634
697
|
/**
|
|
635
698
|
* Callout component properties
|
|
636
699
|
*/
|
|
@@ -716,6 +779,27 @@ export interface AccordionProps extends BaseComponentProps {
|
|
|
716
779
|
*/
|
|
717
780
|
icon?: ReactNode;
|
|
718
781
|
|
|
782
|
+
/**
|
|
783
|
+
* Whether the accordion is open
|
|
784
|
+
*/
|
|
785
|
+
isOpen?: boolean;
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Whether the accordion is disabled
|
|
789
|
+
*/
|
|
790
|
+
disabled?: boolean;
|
|
791
|
+
|
|
792
|
+
onOpenChange?: (open: boolean) => void;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Optional open handler
|
|
796
|
+
*/
|
|
797
|
+
onOpen?: () => void;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Optional close handler
|
|
801
|
+
*/
|
|
802
|
+
onClose?: () => void;
|
|
719
803
|
/**
|
|
720
804
|
* Glass morphism effect for the accordion
|
|
721
805
|
* Can be a boolean to enable with default settings, or an object with AtomixGlassProps to customize the effect
|
|
@@ -996,6 +1080,60 @@ export interface SpinnerProps extends BaseComponentProps {
|
|
|
996
1080
|
glass?: AtomixGlassProps | boolean;
|
|
997
1081
|
}
|
|
998
1082
|
|
|
1083
|
+
/**
|
|
1084
|
+
* Icon size options
|
|
1085
|
+
*/
|
|
1086
|
+
export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Icon weight/style options
|
|
1090
|
+
*/
|
|
1091
|
+
export type IconWeight = 'thin' | 'light' | 'regular' | 'bold' | 'fill' | 'duotone';
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Phosphor icon type - excludes internal Phosphor exports
|
|
1095
|
+
*/
|
|
1096
|
+
export type PhosphorIconsType = Exclude<
|
|
1097
|
+
keyof typeof import('@phosphor-icons/react'),
|
|
1098
|
+
'IconContext' | 'IconBase' | 'createIcon' | 'default' | 'SSR'
|
|
1099
|
+
>;
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* Icon component properties (legacy - use IconProps from component instead)
|
|
1103
|
+
* @deprecated Use IconProps from '@atomix/components/Icon' instead
|
|
1104
|
+
*/
|
|
1105
|
+
export interface LegacyIconProps extends BaseComponentProps {
|
|
1106
|
+
/**
|
|
1107
|
+
* Icon name from Phosphor Icons
|
|
1108
|
+
*/
|
|
1109
|
+
name: PhosphorIconsType;
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Icon size
|
|
1113
|
+
*/
|
|
1114
|
+
size?: IconSize | number;
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Icon weight/style
|
|
1118
|
+
*/
|
|
1119
|
+
weight?: IconWeight;
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Icon color
|
|
1123
|
+
*/
|
|
1124
|
+
color?: string;
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Alt text for accessibility
|
|
1128
|
+
*/
|
|
1129
|
+
alt?: string;
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Custom style
|
|
1133
|
+
*/
|
|
1134
|
+
style?: React.CSSProperties;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
999
1137
|
/**
|
|
1000
1138
|
* Navbar position options
|
|
1001
1139
|
*/
|
|
@@ -2728,18 +2866,59 @@ export interface BreadcrumbItem {
|
|
|
2728
2866
|
active?: boolean;
|
|
2729
2867
|
|
|
2730
2868
|
/**
|
|
2731
|
-
* Icon name from Phosphor Icons
|
|
2869
|
+
* Icon name from Phosphor Icons or ReactNode
|
|
2732
2870
|
*/
|
|
2733
|
-
icon?: string;
|
|
2871
|
+
icon?: string | ReactNode;
|
|
2734
2872
|
|
|
2735
2873
|
/**
|
|
2736
2874
|
* Optional click handler
|
|
2737
2875
|
*/
|
|
2738
|
-
onClick?: (event: MouseEvent) => void;
|
|
2876
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
2877
|
+
|
|
2878
|
+
/**
|
|
2879
|
+
* Custom style for the breadcrumb item
|
|
2880
|
+
*/
|
|
2881
|
+
style?: React.CSSProperties;
|
|
2882
|
+
|
|
2883
|
+
/**
|
|
2884
|
+
* Additional className
|
|
2885
|
+
*/
|
|
2886
|
+
className?: string;
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
/**
|
|
2890
|
+
* Breadcrumb component properties (legacy - use BreadcrumbProps from component instead)
|
|
2891
|
+
* @deprecated Use BreadcrumbProps from '@atomix/components/Breadcrumb' instead
|
|
2892
|
+
*/
|
|
2893
|
+
export interface LegacyBreadcrumbProps extends BaseComponentProps {
|
|
2894
|
+
/**
|
|
2895
|
+
* Array of breadcrumb items
|
|
2896
|
+
*/
|
|
2897
|
+
items: BreadcrumbItem[];
|
|
2898
|
+
|
|
2899
|
+
/**
|
|
2900
|
+
* Custom divider character or element
|
|
2901
|
+
*/
|
|
2902
|
+
divider?: ReactNode;
|
|
2903
|
+
|
|
2904
|
+
/**
|
|
2905
|
+
* Aria label for the navigation
|
|
2906
|
+
*/
|
|
2907
|
+
ariaLabel?: string;
|
|
2908
|
+
|
|
2909
|
+
/**
|
|
2910
|
+
* Optional custom link component
|
|
2911
|
+
*/
|
|
2912
|
+
LinkComponent?: React.ElementType;
|
|
2913
|
+
|
|
2914
|
+
/**
|
|
2915
|
+
* Custom style for the breadcrumb
|
|
2916
|
+
*/
|
|
2917
|
+
style?: React.CSSProperties;
|
|
2739
2918
|
}
|
|
2740
2919
|
|
|
2741
2920
|
/**
|
|
2742
|
-
* Breadcrumb options interface
|
|
2921
|
+
* Breadcrumb options interface (for vanilla JS)
|
|
2743
2922
|
*/
|
|
2744
2923
|
export interface BreadcrumbOptions {
|
|
2745
2924
|
/**
|
|
@@ -6227,36 +6406,6 @@ export interface FooterSocialLinkProps extends BaseComponentProps {
|
|
|
6227
6406
|
*/
|
|
6228
6407
|
export type GlassMode = 'standard' | 'polar' | 'prominent' | 'shader';
|
|
6229
6408
|
|
|
6230
|
-
/**
|
|
6231
|
-
* Glass container size configuration
|
|
6232
|
-
*/
|
|
6233
|
-
export interface GlassSize {
|
|
6234
|
-
/**
|
|
6235
|
-
* Width of the glass container
|
|
6236
|
-
*/
|
|
6237
|
-
width: number;
|
|
6238
|
-
|
|
6239
|
-
/**
|
|
6240
|
-
* Height of the glass container
|
|
6241
|
-
*/
|
|
6242
|
-
height: number;
|
|
6243
|
-
}
|
|
6244
|
-
|
|
6245
|
-
/**
|
|
6246
|
-
* Mouse position coordinates
|
|
6247
|
-
*/
|
|
6248
|
-
export interface MousePosition {
|
|
6249
|
-
/**
|
|
6250
|
-
* X coordinate
|
|
6251
|
-
*/
|
|
6252
|
-
x: number;
|
|
6253
|
-
|
|
6254
|
-
/**
|
|
6255
|
-
* Y coordinate
|
|
6256
|
-
*/
|
|
6257
|
-
y: number;
|
|
6258
|
-
}
|
|
6259
|
-
|
|
6260
6409
|
/**
|
|
6261
6410
|
* Glass container component properties
|
|
6262
6411
|
*/
|
|
@@ -384,22 +384,6 @@ export function mergePartStyles(
|
|
|
384
384
|
};
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
/**
|
|
388
|
-
* Utility function to apply part styles to props
|
|
389
|
-
*/
|
|
390
|
-
export function applyPartStyles<T extends Record<string, any>>(
|
|
391
|
-
props: T,
|
|
392
|
-
part?: PartStyleProps
|
|
393
|
-
): T {
|
|
394
|
-
if (!part) return props;
|
|
395
|
-
|
|
396
|
-
return {
|
|
397
|
-
...props,
|
|
398
|
-
className: [props.className, part.className].filter(Boolean).join(' '),
|
|
399
|
-
style: { ...props.style, ...part.style },
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
|
|
403
387
|
/**
|
|
404
388
|
* Map of component names to their part types
|
|
405
389
|
*/
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Font Preloading Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for preloading fonts to improve performance
|
|
5
|
+
* and prevent Flash of Invisible Text (FOIT).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface FontPreloadConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Font family name
|
|
11
|
+
*/
|
|
12
|
+
family: string;
|
|
13
|
+
/**
|
|
14
|
+
* Font file path (relative to public/assets/fonts or absolute URL)
|
|
15
|
+
*/
|
|
16
|
+
path: string;
|
|
17
|
+
/**
|
|
18
|
+
* Font weight
|
|
19
|
+
*/
|
|
20
|
+
weight?: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* Font style
|
|
23
|
+
*/
|
|
24
|
+
style?: 'normal' | 'italic';
|
|
25
|
+
/**
|
|
26
|
+
* Font format (woff2 is preferred)
|
|
27
|
+
*/
|
|
28
|
+
format?: 'woff2' | 'woff';
|
|
29
|
+
/**
|
|
30
|
+
* Cross-origin setting
|
|
31
|
+
*/
|
|
32
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates a preload link element for a font
|
|
37
|
+
*
|
|
38
|
+
* @param config - Font preload configuration
|
|
39
|
+
* @returns HTML link element for preloading
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* const preloadLink = createFontPreloadLink({
|
|
44
|
+
* family: 'Nunito Sans',
|
|
45
|
+
* path: '/fonts/nunito-sans/nunito-sans-regular.woff2',
|
|
46
|
+
* weight: 400
|
|
47
|
+
* });
|
|
48
|
+
* document.head.appendChild(preloadLink);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function createFontPreloadLink(config: FontPreloadConfig): HTMLLinkElement {
|
|
52
|
+
const {
|
|
53
|
+
path,
|
|
54
|
+
format = 'woff2',
|
|
55
|
+
crossorigin = 'anonymous',
|
|
56
|
+
} = config;
|
|
57
|
+
|
|
58
|
+
const link = document.createElement('link');
|
|
59
|
+
link.rel = 'preload';
|
|
60
|
+
link.as = 'font';
|
|
61
|
+
link.href = path;
|
|
62
|
+
link.type = `font/${format}`;
|
|
63
|
+
link.crossOrigin = crossorigin;
|
|
64
|
+
|
|
65
|
+
return link;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Preloads multiple fonts
|
|
70
|
+
*
|
|
71
|
+
* @param fonts - Array of font configurations to preload
|
|
72
|
+
* @returns Array of created link elements
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* const links = preloadFonts([
|
|
77
|
+
* { family: 'Nunito Sans', path: '/fonts/nunito-sans/nunito-sans-regular.woff2', weight: 400 },
|
|
78
|
+
* { family: 'Nunito Sans', path: '/fonts/nunito-sans/nunito-sans-bold.woff2', weight: 700 },
|
|
79
|
+
* ]);
|
|
80
|
+
* links.forEach(link => document.head.appendChild(link));
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export function preloadFonts(fonts: FontPreloadConfig[]): HTMLLinkElement[] {
|
|
84
|
+
return fonts.map(createFontPreloadLink);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Generates preload link HTML tags as strings
|
|
89
|
+
* Useful for server-side rendering or static HTML generation
|
|
90
|
+
*
|
|
91
|
+
* @param fonts - Array of font configurations
|
|
92
|
+
* @returns Array of HTML string representations
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* const htmlTags = generateFontPreloadTags([
|
|
97
|
+
* { family: 'Nunito Sans', path: '/fonts/nunito-sans/nunito-sans-regular.woff2' },
|
|
98
|
+
* ]);
|
|
99
|
+
* // Returns: ['<link rel="preload" as="font" href="/fonts/..." type="font/woff2" crossorigin="anonymous">']
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export function generateFontPreloadTags(fonts: FontPreloadConfig[]): string[] {
|
|
103
|
+
return fonts.map((config) => {
|
|
104
|
+
const {
|
|
105
|
+
path,
|
|
106
|
+
format = 'woff2',
|
|
107
|
+
crossorigin = 'anonymous',
|
|
108
|
+
} = config;
|
|
109
|
+
|
|
110
|
+
return `<link rel="preload" as="font" href="${path}" type="font/${format}" crossorigin="${crossorigin}">`;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Default font configurations for Atomix Design System
|
|
116
|
+
* These can be used as a starting point for font preloading
|
|
117
|
+
*/
|
|
118
|
+
export const DEFAULT_ATOMIX_FONTS: FontPreloadConfig[] = [
|
|
119
|
+
{
|
|
120
|
+
family: 'Nunito Sans',
|
|
121
|
+
path: '/fonts/nunito-sans/nunito-sans-regular.woff2',
|
|
122
|
+
weight: 400,
|
|
123
|
+
style: 'normal',
|
|
124
|
+
format: 'woff2',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
family: 'Nunito Sans',
|
|
128
|
+
path: '/fonts/nunito-sans/nunito-sans-bold.woff2',
|
|
129
|
+
weight: 700,
|
|
130
|
+
style: 'normal',
|
|
131
|
+
format: 'woff2',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
family: 'Nunito Sans',
|
|
135
|
+
path: '/fonts/nunito-sans/nunito-sans-italic.woff2',
|
|
136
|
+
weight: 400,
|
|
137
|
+
style: 'italic',
|
|
138
|
+
format: 'woff2',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
family: 'Nunito Sans',
|
|
142
|
+
path: '/fonts/nunito-sans/nunito-sans-bold-italic.woff2',
|
|
143
|
+
weight: 700,
|
|
144
|
+
style: 'italic',
|
|
145
|
+
format: 'woff2',
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
|
package/src/lib/utils/index.ts
CHANGED
|
@@ -19,3 +19,14 @@ export {
|
|
|
19
19
|
export type {
|
|
20
20
|
MergePropsOptions,
|
|
21
21
|
} from './componentUtils';
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
createFontPreloadLink,
|
|
25
|
+
preloadFonts,
|
|
26
|
+
generateFontPreloadTags,
|
|
27
|
+
DEFAULT_ATOMIX_FONTS,
|
|
28
|
+
} from './fontPreloader';
|
|
29
|
+
|
|
30
|
+
export type {
|
|
31
|
+
FontPreloadConfig,
|
|
32
|
+
} from './fontPreloader';
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Monitoring Utilities
|
|
3
|
+
*
|
|
4
|
+
* Detects memory leaks and tracks component lifecycle memory usage
|
|
5
|
+
* Only available in development mode
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Memory snapshot for comparison
|
|
10
|
+
*/
|
|
11
|
+
export interface MemorySnapshot {
|
|
12
|
+
/**
|
|
13
|
+
* Used JavaScript heap size in bytes
|
|
14
|
+
*/
|
|
15
|
+
usedJSHeapSize: number;
|
|
16
|
+
/**
|
|
17
|
+
* Total JavaScript heap size in bytes
|
|
18
|
+
*/
|
|
19
|
+
totalJSHeapSize: number;
|
|
20
|
+
/**
|
|
21
|
+
* JavaScript heap size limit in bytes
|
|
22
|
+
*/
|
|
23
|
+
jsHeapSizeLimit: number;
|
|
24
|
+
/**
|
|
25
|
+
* Timestamp of the snapshot
|
|
26
|
+
*/
|
|
27
|
+
timestamp: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if memory monitoring is available
|
|
32
|
+
*/
|
|
33
|
+
export function isMemoryMonitoringAvailable(): boolean {
|
|
34
|
+
return (
|
|
35
|
+
typeof performance !== 'undefined' &&
|
|
36
|
+
'memory' in performance &&
|
|
37
|
+
process.env.NODE_ENV === 'development'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get current memory usage snapshot
|
|
43
|
+
*
|
|
44
|
+
* @returns Memory snapshot or null if not available
|
|
45
|
+
*/
|
|
46
|
+
export function getMemorySnapshot(): MemorySnapshot | null {
|
|
47
|
+
if (!isMemoryMonitoringAvailable()) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const memory = (performance as any).memory;
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
usedJSHeapSize: memory.usedJSHeapSize,
|
|
55
|
+
totalJSHeapSize: memory.totalJSHeapSize,
|
|
56
|
+
jsHeapSizeLimit: memory.jsHeapSizeLimit,
|
|
57
|
+
timestamp: performance.now(),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Format bytes to human-readable string
|
|
63
|
+
*
|
|
64
|
+
* @param bytes - Number of bytes
|
|
65
|
+
* @returns Formatted string (e.g., "1.5 MB")
|
|
66
|
+
*/
|
|
67
|
+
export function formatBytes(bytes: number): string {
|
|
68
|
+
if (bytes === 0) return '0 Bytes';
|
|
69
|
+
|
|
70
|
+
const k = 1024;
|
|
71
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
72
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
73
|
+
|
|
74
|
+
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + ' ' + sizes[i];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Compare two memory snapshots and detect potential leaks
|
|
79
|
+
*
|
|
80
|
+
* @param before - Snapshot before operation
|
|
81
|
+
* @param after - Snapshot after operation
|
|
82
|
+
* @param threshold - Threshold in bytes to consider a leak (default: 5MB)
|
|
83
|
+
* @returns Object with leak detection results
|
|
84
|
+
*/
|
|
85
|
+
export function detectMemoryLeak(
|
|
86
|
+
before: MemorySnapshot | null,
|
|
87
|
+
after: MemorySnapshot | null,
|
|
88
|
+
threshold: number = 5 * 1024 * 1024 // 5MB
|
|
89
|
+
): {
|
|
90
|
+
hasLeak: boolean;
|
|
91
|
+
memoryIncrease: number;
|
|
92
|
+
formattedIncrease: string;
|
|
93
|
+
percentageIncrease: number;
|
|
94
|
+
} {
|
|
95
|
+
if (!before || !after) {
|
|
96
|
+
return {
|
|
97
|
+
hasLeak: false,
|
|
98
|
+
memoryIncrease: 0,
|
|
99
|
+
formattedIncrease: '0 Bytes',
|
|
100
|
+
percentageIncrease: 0,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const memoryIncrease = after.usedJSHeapSize - before.usedJSHeapSize;
|
|
105
|
+
const percentageIncrease = (memoryIncrease / before.usedJSHeapSize) * 100;
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
hasLeak: memoryIncrease > threshold,
|
|
109
|
+
memoryIncrease,
|
|
110
|
+
formattedIncrease: formatBytes(memoryIncrease),
|
|
111
|
+
percentageIncrease,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Monitor memory usage over time
|
|
117
|
+
*
|
|
118
|
+
* @param interval - Interval in milliseconds to check memory
|
|
119
|
+
* @param callback - Callback function called with each snapshot
|
|
120
|
+
* @returns Function to stop monitoring
|
|
121
|
+
*/
|
|
122
|
+
export function monitorMemoryUsage(
|
|
123
|
+
interval: number = 5000,
|
|
124
|
+
callback?: (snapshot: MemorySnapshot) => void
|
|
125
|
+
): () => void {
|
|
126
|
+
if (!isMemoryMonitoringAvailable()) {
|
|
127
|
+
console.warn('[Memory Monitor] Memory monitoring is not available');
|
|
128
|
+
return () => {};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const checkMemory = () => {
|
|
132
|
+
const snapshot = getMemorySnapshot();
|
|
133
|
+
if (snapshot) {
|
|
134
|
+
if (callback) {
|
|
135
|
+
callback(snapshot);
|
|
136
|
+
} else if (process.env.NODE_ENV === 'development') {
|
|
137
|
+
console.log('[Memory Monitor]', {
|
|
138
|
+
used: formatBytes(snapshot.usedJSHeapSize),
|
|
139
|
+
total: formatBytes(snapshot.totalJSHeapSize),
|
|
140
|
+
limit: formatBytes(snapshot.jsHeapSizeLimit),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const intervalId = setInterval(checkMemory, interval);
|
|
147
|
+
|
|
148
|
+
// Initial check
|
|
149
|
+
checkMemory();
|
|
150
|
+
|
|
151
|
+
// Return cleanup function
|
|
152
|
+
return () => {
|
|
153
|
+
clearInterval(intervalId);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Track component lifecycle memory usage
|
|
159
|
+
*
|
|
160
|
+
* @param componentName - Name of the component
|
|
161
|
+
* @returns Object with start and end tracking functions
|
|
162
|
+
*/
|
|
163
|
+
export function trackComponentMemory(componentName: string) {
|
|
164
|
+
const before = getMemorySnapshot();
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
/**
|
|
168
|
+
* Get memory snapshot at component mount
|
|
169
|
+
*/
|
|
170
|
+
getBeforeSnapshot: () => before,
|
|
171
|
+
/**
|
|
172
|
+
* Get memory snapshot at component unmount and detect leaks
|
|
173
|
+
*/
|
|
174
|
+
getAfterSnapshot: () => {
|
|
175
|
+
const after = getMemorySnapshot();
|
|
176
|
+
if (before && after) {
|
|
177
|
+
const leakInfo = detectMemoryLeak(before, after);
|
|
178
|
+
if (leakInfo.hasLeak && process.env.NODE_ENV === 'development') {
|
|
179
|
+
console.warn(
|
|
180
|
+
`[Memory Monitor] Potential memory leak detected in ${componentName}:`,
|
|
181
|
+
leakInfo
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return after;
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
@@ -3,15 +3,12 @@ $assets-fonts-path: '../assets/fonts/' !default;
|
|
|
3
3
|
@mixin font-face($name, $foldername, $filename, $weight: normal, $style: normal) {
|
|
4
4
|
@font-face {
|
|
5
5
|
font-family: $name;
|
|
6
|
-
src: url('#{$assets-fonts-path}/#{$foldername}/#{$filename}.eot');
|
|
7
6
|
src:
|
|
8
|
-
url('#{$assets-fonts-path}/#{$foldername}/#{$filename}.eot?#iefix')
|
|
9
|
-
format('embedded-opentype'),
|
|
10
7
|
url('#{$assets-fonts-path}/#{$foldername}/#{$filename}.woff2') format('woff2'),
|
|
11
|
-
url('#{$assets-fonts-path}/#{$foldername}/#{$filename}.woff') format('woff')
|
|
12
|
-
url('#{$assets-fonts-path}/#{$foldername}/#{$filename}.ttf') format('truetype');
|
|
8
|
+
url('#{$assets-fonts-path}/#{$foldername}/#{$filename}.woff') format('woff');
|
|
13
9
|
font-weight: $weight;
|
|
14
10
|
font-style: $style;
|
|
11
|
+
font-display: swap;
|
|
15
12
|
text-rendering: optimizeLegibility;
|
|
16
13
|
}
|
|
17
14
|
}
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
/* AUTO-GENERATED - DO NOT EDIT MANUALLY */
|
|
2
|
+
/* Generated on: 2025-12-23T09:44:24.463Z */
|
|
3
|
+
/* This file is generated from atomix.config.ts */
|
|
4
|
+
/* Edit atomix.config.ts and run 'npm run sync:config' to regenerate */
|
|
2
5
|
|
|
3
6
|
:root {
|
|
4
|
-
--atomix-
|
|
7
|
+
--atomix-primary: #3b82f6;
|
|
8
|
+
--atomix-primary-1: #d8e6fd;
|
|
9
|
+
--atomix-primary-10: #183462;
|
|
10
|
+
--atomix-primary-2: #b8d2fc;
|
|
11
|
+
--atomix-primary-3: #99befa;
|
|
12
|
+
--atomix-primary-4: #7aaaf9;
|
|
13
|
+
--atomix-primary-5: #5a96f7;
|
|
14
|
+
--atomix-primary-6: #3b82f6;
|
|
15
|
+
--atomix-primary-7: #326fd1;
|
|
16
|
+
--atomix-primary-8: #295bac;
|
|
17
|
+
--atomix-primary-9: #204887;
|
|
18
|
+
--atomix-primary-bg-subtle: rgba(59, 130, 246, 0.1);
|
|
19
|
+
--atomix-primary-border-subtle: rgba(59, 130, 246, 0.2);
|
|
20
|
+
--atomix-primary-dark: #204887;
|
|
21
|
+
--atomix-primary-hover: #326fd1;
|
|
22
|
+
--atomix-primary-light: #99befa;
|
|
23
|
+
--atomix-primary-main: #3b82f6;
|
|
24
|
+
--atomix-primary-rgb: 59, 130, 246;
|
|
25
|
+
--atomix-primary-text-emphasis: #5895f7;
|
|
5
26
|
}
|
|
@@ -48,12 +48,6 @@
|
|
|
48
48
|
max-width: var(--#{$prefix}navbar-container-max-width);
|
|
49
49
|
padding: 0 var(--#{$prefix}navbar-padding-x);
|
|
50
50
|
margin: 0 auto;
|
|
51
|
-
gap: var(--#{$prefix}navbar-padding-x);
|
|
52
|
-
|
|
53
|
-
@include media.media-down('md') {
|
|
54
|
-
flex-wrap: nowrap;
|
|
55
|
-
gap: 0.5rem;
|
|
56
|
-
}
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
// 3. Element Styles (BEM Elements)
|