@shohojdhara/atomix 0.5.0 → 0.5.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.
Files changed (168) hide show
  1. package/atomix.config.ts +12 -0
  2. package/build-tools/webpack-loader.js +5 -4
  3. package/dist/atomix.css +230 -83
  4. package/dist/atomix.css.map +1 -1
  5. package/dist/atomix.min.css +1 -1
  6. package/dist/atomix.min.css.map +1 -1
  7. package/dist/build-tools/webpack-loader.js +5 -4
  8. package/dist/charts.d.ts +24 -23
  9. package/dist/charts.js +271 -369
  10. package/dist/charts.js.map +1 -1
  11. package/dist/config.d.ts +624 -0
  12. package/dist/config.js +59 -0
  13. package/dist/config.js.map +1 -0
  14. package/dist/core.d.ts +3 -2
  15. package/dist/core.js +342 -382
  16. package/dist/core.js.map +1 -1
  17. package/dist/forms.d.ts +4 -6
  18. package/dist/forms.js +233 -334
  19. package/dist/forms.js.map +1 -1
  20. package/dist/heavy.d.ts +11 -2
  21. package/dist/heavy.js +406 -445
  22. package/dist/heavy.js.map +1 -1
  23. package/dist/index.d.ts +109 -65
  24. package/dist/index.esm.js +654 -748
  25. package/dist/index.esm.js.map +1 -1
  26. package/dist/index.js +621 -717
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.min.js +1 -1
  29. package/dist/index.min.js.map +1 -1
  30. package/dist/layout.js +59 -60
  31. package/dist/layout.js.map +1 -1
  32. package/dist/theme.js +4 -4
  33. package/dist/theme.js.map +1 -1
  34. package/package.json +24 -9
  35. package/scripts/atomix-cli.js +15 -1
  36. package/scripts/cli/__tests__/complexity-utils.test.js +24 -0
  37. package/scripts/cli/__tests__/detector.test.js +50 -0
  38. package/scripts/cli/__tests__/template-engine.test.js +23 -0
  39. package/scripts/cli/__tests__/test-setup.js +1 -133
  40. package/scripts/cli/commands/doctor.js +15 -3
  41. package/scripts/cli/commands/generate.js +113 -51
  42. package/scripts/cli/internal/ai-engine.js +30 -10
  43. package/scripts/cli/internal/complexity-utils.js +60 -0
  44. package/scripts/cli/internal/component-validator.js +49 -16
  45. package/scripts/cli/internal/generator.js +89 -36
  46. package/scripts/cli/internal/hook-generator.js +5 -2
  47. package/scripts/cli/internal/itcss-generator.js +16 -12
  48. package/scripts/cli/templates/next-templates.js +81 -30
  49. package/scripts/cli/templates/storybook-templates.js +12 -2
  50. package/scripts/cli/utils/detector.js +45 -7
  51. package/scripts/cli/utils/diagnostics.js +78 -0
  52. package/scripts/cli/utils/telemetry.js +13 -0
  53. package/src/components/Accordion/Accordion.stories.tsx +4 -0
  54. package/src/components/AtomixGlass/AtomixGlass.tsx +188 -128
  55. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +63 -91
  56. package/src/components/AtomixGlass/PerformanceDashboard.tsx +153 -201
  57. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +9 -6
  58. package/src/components/AtomixGlass/glass-utils.ts +51 -1
  59. package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +52 -46
  60. package/src/components/AtomixGlass/stories/Examples.stories.tsx +573 -236
  61. package/src/components/AtomixGlass/stories/Playground.stories.tsx +88 -41
  62. package/src/components/AtomixGlass/stories/argTypes.ts +19 -19
  63. package/src/components/AtomixGlass/stories/shared-components.tsx +7 -12
  64. package/src/components/AtomixGlass/stories/types.ts +3 -3
  65. package/src/components/Button/Button.tsx +114 -57
  66. package/src/components/Callout/Callout.tsx +4 -4
  67. package/src/components/Chart/ChartRenderer.tsx +1 -1
  68. package/src/components/Chart/DonutChart.tsx +11 -8
  69. package/src/components/EdgePanel/EdgePanel.tsx +119 -115
  70. package/src/components/Form/Select.tsx +4 -4
  71. package/src/components/List/List.tsx +4 -4
  72. package/src/components/Navigation/SideMenu/SideMenu.tsx +6 -6
  73. package/src/components/PhotoViewer/PhotoViewerImage.tsx +1 -1
  74. package/src/components/ProductReview/ProductReview.tsx +4 -2
  75. package/src/components/Rating/Rating.tsx +4 -2
  76. package/src/components/SectionIntro/SectionIntro.tsx +4 -2
  77. package/src/components/Steps/Steps.tsx +1 -1
  78. package/src/components/Tabs/Tabs.tsx +5 -5
  79. package/src/components/Testimonial/Testimonial.tsx +4 -2
  80. package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
  81. package/src/layouts/CssGrid/CssGrid.stories.tsx +464 -0
  82. package/src/layouts/CssGrid/CssGrid.tsx +215 -0
  83. package/src/layouts/CssGrid/index.ts +8 -0
  84. package/src/layouts/CssGrid/scripts/CssGrid.js +284 -0
  85. package/src/layouts/CssGrid/scripts/index.js +43 -0
  86. package/src/layouts/Grid/scripts/Container.js +139 -0
  87. package/src/layouts/Grid/scripts/Grid.js +184 -0
  88. package/src/layouts/Grid/scripts/GridCol.js +273 -0
  89. package/src/layouts/Grid/scripts/Row.js +154 -0
  90. package/src/layouts/Grid/scripts/index.js +48 -0
  91. package/src/layouts/MasonryGrid/MasonryGrid.tsx +71 -59
  92. package/src/lib/composables/atomix-glass/useGlassSize.ts +1 -1
  93. package/src/lib/composables/useAccordion.ts +5 -5
  94. package/src/lib/composables/useAtomixGlass.ts +111 -74
  95. package/src/lib/composables/useAtomixGlassStyles.ts +0 -2
  96. package/src/lib/composables/useBarChart.ts +2 -2
  97. package/src/lib/composables/useChart.ts +3 -2
  98. package/src/lib/composables/useChartToolbar.ts +48 -66
  99. package/src/lib/composables/useDataTable.ts +1 -1
  100. package/src/lib/composables/useDatePicker.ts +2 -2
  101. package/src/lib/composables/useEdgePanel.ts +45 -54
  102. package/src/lib/composables/useHeroBackgroundSlider.ts +5 -5
  103. package/src/lib/composables/usePhotoViewer.ts +2 -3
  104. package/src/lib/composables/usePieChart.ts +1 -1
  105. package/src/lib/composables/usePopover.ts +151 -139
  106. package/src/lib/composables/useSideMenu.ts +28 -41
  107. package/src/lib/composables/useSlider.ts +2 -6
  108. package/src/lib/composables/useTooltip.ts +2 -2
  109. package/src/lib/config/index.ts +39 -0
  110. package/src/lib/constants/components.ts +1 -0
  111. package/src/lib/theme/devtools/Comparator.tsx +1 -1
  112. package/src/lib/theme/devtools/Inspector.tsx +1 -1
  113. package/src/lib/theme/devtools/LiveEditor.tsx +1 -1
  114. package/src/lib/theme/runtime/ThemeProvider.tsx +1 -1
  115. package/src/lib/types/components.ts +1 -0
  116. package/src/styles/01-settings/_index.scss +1 -0
  117. package/src/styles/01-settings/_settings.atomix-glass.scss +174 -0
  118. package/src/styles/01-settings/_settings.masonry-grid.scss +42 -6
  119. package/src/styles/02-tools/_tools.glass.scss +6 -0
  120. package/src/styles/05-objects/_objects.masonry-grid.scss +162 -24
  121. package/src/styles/06-components/_components.atomix-glass.scss +160 -99
  122. package/scripts/cli/__tests__/README.md +0 -81
  123. package/scripts/cli/__tests__/basic.test.js +0 -116
  124. package/scripts/cli/__tests__/clean.test.js +0 -278
  125. package/scripts/cli/__tests__/component-generator.test.js +0 -332
  126. package/scripts/cli/__tests__/component-validator.test.js +0 -433
  127. package/scripts/cli/__tests__/generator.test.js +0 -613
  128. package/scripts/cli/__tests__/glass-motion.test.js +0 -256
  129. package/scripts/cli/__tests__/integration.test.js +0 -938
  130. package/scripts/cli/__tests__/migrate.test.js +0 -74
  131. package/scripts/cli/__tests__/security.test.js +0 -206
  132. package/scripts/cli/__tests__/theme-bridge.test.js +0 -507
  133. package/scripts/cli/__tests__/token-manager.test.js +0 -251
  134. package/scripts/cli/__tests__/token-provider.test.js +0 -361
  135. package/scripts/cli/__tests__/utils.test.js +0 -165
  136. package/src/components/AtomixGlass/stories/AnimationTests.stories.tsx +0 -95
  137. package/src/components/AtomixGlass/stories/CardExamples.stories.tsx +0 -212
  138. package/src/components/AtomixGlass/stories/Customization.stories.tsx +0 -131
  139. package/src/components/AtomixGlass/stories/DashboardExamples.stories.tsx +0 -348
  140. package/src/components/AtomixGlass/stories/EcommerceExamples.stories.tsx +0 -410
  141. package/src/components/AtomixGlass/stories/FormExamples.stories.tsx +0 -436
  142. package/src/components/AtomixGlass/stories/HeroExamples.stories.tsx +0 -264
  143. package/src/components/AtomixGlass/stories/InteractivePlayground.stories.tsx +0 -247
  144. package/src/components/AtomixGlass/stories/MobileUIExamples.stories.tsx +0 -418
  145. package/src/components/AtomixGlass/stories/ModalExamples.stories.tsx +0 -402
  146. package/src/components/AtomixGlass/stories/Modes.stories.tsx +0 -1082
  147. package/src/components/AtomixGlass/stories/Overview.stories.tsx +0 -497
  148. package/src/components/AtomixGlass/stories/Performance.stories.tsx +0 -103
  149. package/src/components/AtomixGlass/stories/PresetGallery.stories.tsx +0 -335
  150. package/src/components/AtomixGlass/stories/Shaders.stories.tsx +0 -395
  151. package/src/components/AtomixGlass/stories/WidgetExamples.stories.tsx +0 -441
  152. package/src/components/TypedButton/TypedButton.stories.tsx +0 -59
  153. package/src/components/TypedButton/TypedButton.tsx +0 -39
  154. package/src/components/TypedButton/index.ts +0 -2
  155. package/src/lib/composables/useBreadcrumb.ts +0 -81
  156. package/src/lib/composables/useChartInteractions.ts +0 -123
  157. package/src/lib/composables/useChartPerformance.ts +0 -347
  158. package/src/lib/composables/useDropdown.ts +0 -338
  159. package/src/lib/composables/useModal.ts +0 -110
  160. package/src/lib/composables/useTypedButton.ts +0 -66
  161. package/src/lib/hooks/usePerformanceMonitor.ts +0 -148
  162. package/src/lib/utils/displacement-generator.ts +0 -92
  163. package/src/lib/utils/memoryMonitor.ts +0 -191
  164. package/src/styles/01-settings/_settings.testtypecheck.scss +0 -53
  165. package/src/styles/01-settings/_settings.typedbutton.scss +0 -53
  166. package/src/styles/06-components/_components.testbutton.scss +0 -212
  167. package/src/styles/06-components/_components.testtypecheck.scss +0 -212
  168. package/src/styles/06-components/_components.typedbutton.scss +0 -212
@@ -0,0 +1,184 @@
1
+ /**
2
+ * @file Grid - Vanilla JavaScript implementation of the Grid component
3
+ * @description Provides DOM manipulation for grid layouts with responsive alignment controls
4
+ * @requires ../Grid.css (auto-generated)
5
+ */
6
+
7
+ /**
8
+ * Grid component class for responsive layout management
9
+ */
10
+ export class Grid {
11
+ /**
12
+ * Create a new Grid instance
13
+ * @param {Object} options - Grid configuration options
14
+ * @param {HTMLElement} options.element - The container element
15
+ * @param {string} [options.className=''] - Additional CSS classes
16
+ * @param {'start'|'end'|'center'|'between'|'around'|'evenly'} [options.justifyContent] - Horizontal alignment
17
+ * @param {'start'|'end'|'center'|'baseline'|'stretch'} [options.alignItems] - Vertical alignment
18
+ * @param {boolean} [options.noGutters=false] - Remove gutters between columns
19
+ * @param {'row'|'column'|'row-reverse'|'column-reverse'} [options.direction] - Flex direction
20
+ * @param {'nowrap'|'wrap'|'wrap-reverse'} [options.wrap] - Flex wrap behavior
21
+ */
22
+ constructor(options) {
23
+ this.element = options.element;
24
+ this.options = {
25
+ className: options.className || '',
26
+ justifyContent: options.justifyContent,
27
+ alignItems: options.alignItems,
28
+ noGutters: options.noGutters || false,
29
+ direction: options.direction,
30
+ wrap: options.wrap,
31
+ ...options
32
+ };
33
+
34
+ this.init();
35
+ }
36
+
37
+ /**
38
+ * Initialize the grid component
39
+ */
40
+ init() {
41
+ this.updateClasses();
42
+ }
43
+
44
+ /**
45
+ * Update CSS classes based on current options
46
+ */
47
+ updateClasses() {
48
+ const classes = ['o-grid'];
49
+
50
+ if (this.options.justifyContent) {
51
+ classes.push(`u-justify-content-${this.options.justifyContent}`);
52
+ }
53
+
54
+ if (this.options.alignItems) {
55
+ classes.push(`u-align-items-${this.options.alignItems}`);
56
+ }
57
+
58
+ if (this.options.noGutters) {
59
+ classes.push('o-grid--no-gutters');
60
+ }
61
+
62
+ if (this.options.direction) {
63
+ classes.push(`u-flex-direction-${this.options.direction}`);
64
+ }
65
+
66
+ if (this.options.wrap) {
67
+ classes.push(`u-flex-wrap-${this.options.wrap}`);
68
+ }
69
+
70
+ if (this.options.className) {
71
+ classes.push(this.options.className);
72
+ }
73
+
74
+ this.element.className = classes.join(' ');
75
+ }
76
+
77
+ /**
78
+ * Update grid options and refresh styling
79
+ * @param {Object} newOptions - New configuration options
80
+ */
81
+ update(newOptions) {
82
+ this.options = { ...this.options, ...newOptions };
83
+ this.updateClasses();
84
+ }
85
+
86
+ /**
87
+ * Set horizontal alignment
88
+ * @param {'start'|'end'|'center'|'between'|'around'|'evenly'} alignment - Horizontal alignment
89
+ */
90
+ setJustifyContent(alignment) {
91
+ this.update({ justifyContent: alignment });
92
+ }
93
+
94
+ /**
95
+ * Set vertical alignment
96
+ * @param {'start'|'end'|'center'|'baseline'|'stretch'} alignment - Vertical alignment
97
+ */
98
+ setAlignItems(alignment) {
99
+ this.update({ alignItems: alignment });
100
+ }
101
+
102
+ /**
103
+ * Toggle gutters
104
+ * @param {boolean} noGutters - Whether to remove gutters
105
+ */
106
+ setNoGutters(noGutters) {
107
+ this.update({ noGutters });
108
+ }
109
+
110
+ /**
111
+ * Set flex direction
112
+ * @param {'row'|'column'|'row-reverse'|'column-reverse'} direction - Flex direction
113
+ */
114
+ setDirection(direction) {
115
+ this.update({ direction });
116
+ }
117
+
118
+ /**
119
+ * Set flex wrap behavior
120
+ * @param {'nowrap'|'wrap'|'wrap-reverse'} wrap - Wrap behavior
121
+ */
122
+ setWrap(wrap) {
123
+ this.update({ wrap });
124
+ }
125
+
126
+ /**
127
+ * Reset grid to default state
128
+ */
129
+ reset() {
130
+ this.options = {
131
+ className: '',
132
+ justifyContent: undefined,
133
+ alignItems: undefined,
134
+ noGutters: false,
135
+ direction: undefined,
136
+ wrap: undefined
137
+ };
138
+ this.updateClasses();
139
+ }
140
+
141
+ /**
142
+ * Destroy the grid instance and clean up
143
+ */
144
+ destroy() {
145
+ this.element.className = '';
146
+ this.element = null;
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Create a grid instance for a DOM element
152
+ * @param {HTMLElement} element - The DOM element to initialize as grid
153
+ * @param {Object} options - Grid configuration options
154
+ * @returns {Grid} Grid instance
155
+ */
156
+ export function createGrid(element, options = {}) {
157
+ return new Grid({ element, ...options });
158
+ }
159
+
160
+ /**
161
+ * Initialize grid components on page load
162
+ * @param {string} [selector='[data-grid]'] - CSS selector for grid elements
163
+ * @param {Object} [defaultOptions={}] - Default grid options
164
+ */
165
+ export function initGrids(selector = '[data-grid]', defaultOptions = {}) {
166
+ const elements = document.querySelectorAll(selector);
167
+ const grids = [];
168
+
169
+ elements.forEach(element => {
170
+ const options = {
171
+ ...defaultOptions,
172
+ ...(element.dataset.gridOptions ? JSON.parse(element.dataset.gridOptions) : {})
173
+ };
174
+
175
+ grids.push(createGrid(element, options));
176
+ });
177
+
178
+ return grids;
179
+ }
180
+
181
+ // Auto-initialize on DOM ready
182
+ document.addEventListener('DOMContentLoaded', () => {
183
+ initGrids();
184
+ });
@@ -0,0 +1,273 @@
1
+ /**
2
+ * @file GridCol - Vanilla JavaScript implementation of the GridCol component
3
+ * @description Provides DOM manipulation for grid columns with responsive sizing and offset controls
4
+ * @requires ../Grid.css (auto-generated)
5
+ */
6
+
7
+ /**
8
+ * Grid column component class for responsive column management
9
+ */
10
+ export class GridCol {
11
+ /**
12
+ * Create a new GridCol instance
13
+ * @param {Object} options - Grid column configuration options
14
+ * @param {HTMLElement} options.element - The column element
15
+ * @param {string} [options.className=''] - Additional CSS classes
16
+ * @param {number|'auto'|boolean} [options.xs] - Extra small breakpoint size
17
+ * @param {number|'auto'|boolean} [options.sm] - Small breakpoint size
18
+ * @param {number|'auto'|boolean} [options.md] - Medium breakpoint size
19
+ * @param {number|'auto'|boolean} [options.lg] - Large breakpoint size
20
+ * @param {number|'auto'|boolean} [options.xl] - Extra large breakpoint size
21
+ * @param {number|'auto'|boolean} [options.xxl] - Extra extra large breakpoint size
22
+ * @param {number} [options.offsetXs] - Extra small offset
23
+ * @param {number} [options.offsetSm] - Small offset
24
+ * @param {number} [options.offsetMd] - Medium offset
25
+ * @param {number} [options.offsetLg] - Large offset
26
+ * @param {number} [options.offsetXl] - Extra large offset
27
+ * @param {number} [options.offsetXxl] - Extra extra large offset
28
+ * @param {boolean} [options.grow] - Flex grow property
29
+ * @param {boolean} [options.shrink] - Flex shrink property
30
+ * @param {string} [options.basis] - Flex basis property
31
+ * @param {'start'|'end'|'center'|'baseline'|'stretch'} [options.align] - Column alignment
32
+ */
33
+ constructor(options) {
34
+ this.element = options.element;
35
+ this.options = {
36
+ className: options.className || '',
37
+ xs: options.xs,
38
+ sm: options.sm,
39
+ md: options.md,
40
+ lg: options.lg,
41
+ xl: options.xl,
42
+ xxl: options.xxl,
43
+ offsetXs: options.offsetXs,
44
+ offsetSm: options.offsetSm,
45
+ offsetMd: options.offsetMd,
46
+ offsetLg: options.offsetLg,
47
+ offsetXl: options.offsetXl,
48
+ offsetXxl: options.offsetXxl,
49
+ grow: options.grow,
50
+ shrink: options.shrink,
51
+ basis: options.basis,
52
+ align: options.align,
53
+ ...options
54
+ };
55
+
56
+ this.init();
57
+ }
58
+
59
+ /**
60
+ * Initialize the grid column component
61
+ */
62
+ init() {
63
+ this.updateClasses();
64
+ }
65
+
66
+ /**
67
+ * Process responsive column sizing prop
68
+ * @param {number|'auto'|boolean} value - The prop value
69
+ * @param {string} breakpoint - The breakpoint name
70
+ * @returns {string|null} CSS class or null
71
+ */
72
+ processResponsiveProp(value, breakpoint) {
73
+ if (value === undefined || value === false) {
74
+ return null;
75
+ }
76
+
77
+ // Handle boolean values
78
+ if (value === true) {
79
+ return breakpoint === 'xs' ? 'o-grid__col--auto' : `o-grid__col--${breakpoint}-auto`;
80
+ }
81
+
82
+ // Handle string/number values
83
+ if (breakpoint === 'xs') {
84
+ return value === 'auto' ? 'o-grid__col--auto' : `o-grid__col--${value}`;
85
+ } else {
86
+ return value === 'auto' ? `o-grid__col--${breakpoint}-auto` : `o-grid__col--${breakpoint}-${value}`;
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Update CSS classes based on current options
92
+ */
93
+ updateClasses() {
94
+ const isDefaultAuto = !this.options.xs && !this.options.sm && !this.options.md &&
95
+ !this.options.lg && !this.options.xl && !this.options.xxl;
96
+
97
+ const classes = isDefaultAuto ? ['o-grid__col', 'o-grid__col--auto'] : ['o-grid__col'];
98
+
99
+ // Add column size classes
100
+ const sizeClasses = [
101
+ this.processResponsiveProp(this.options.xs, 'xs'),
102
+ this.processResponsiveProp(this.options.sm, 'sm'),
103
+ this.processResponsiveProp(this.options.md, 'md'),
104
+ this.processResponsiveProp(this.options.lg, 'lg'),
105
+ this.processResponsiveProp(this.options.xl, 'xl'),
106
+ this.processResponsiveProp(this.options.xxl, 'xxl')
107
+ ];
108
+
109
+ sizeClasses.forEach(cls => {
110
+ if (cls) classes.push(cls);
111
+ });
112
+
113
+ // Add offset classes
114
+ if (this.options.offsetXs) classes.push(`o-grid__offset--${this.options.offsetXs}`);
115
+ if (this.options.offsetSm) classes.push(`o-grid__offset--sm-${this.options.offsetSm}`);
116
+ if (this.options.offsetMd) classes.push(`o-grid__offset--md-${this.options.offsetMd}`);
117
+ if (this.options.offsetLg) classes.push(`o-grid__offset--lg-${this.options.offsetLg}`);
118
+ if (this.options.offsetXl) classes.push(`o-grid__offset--xl-${this.options.offsetXl}`);
119
+ if (this.options.offsetXxl) classes.push(`o-grid__offset--xxl-${this.options.offsetXxl}`);
120
+
121
+ // Add flex properties
122
+ if (this.options.grow !== undefined) {
123
+ classes.push(this.options.grow ? 'u-flex-grow-1' : 'u-flex-grow-0');
124
+ }
125
+
126
+ if (this.options.shrink !== undefined) {
127
+ classes.push(this.options.shrink ? 'u-flex-shrink-1' : 'u-flex-shrink-0');
128
+ }
129
+
130
+ if (this.options.basis) {
131
+ classes.push(`u-flex-basis-${this.options.basis}`);
132
+ }
133
+
134
+ if (this.options.align) {
135
+ classes.push(`u-align-self-${this.options.align}`);
136
+ }
137
+
138
+ if (this.options.className) {
139
+ classes.push(this.options.className);
140
+ }
141
+
142
+ this.element.className = classes.join(' ');
143
+ }
144
+
145
+ /**
146
+ * Update column options and refresh styling
147
+ * @param {Object} newOptions - New configuration options
148
+ */
149
+ update(newOptions) {
150
+ this.options = { ...this.options, ...newOptions };
151
+ this.updateClasses();
152
+ }
153
+
154
+ /**
155
+ * Set column size for a specific breakpoint
156
+ * @param {string} breakpoint - Breakpoint name (xs, sm, md, lg, xl, xxl)
157
+ * @param {number|'auto'|boolean} size - Column size
158
+ */
159
+ setSize(breakpoint, size) {
160
+ this.update({ [breakpoint]: size });
161
+ }
162
+
163
+ /**
164
+ * Set column offset for a specific breakpoint
165
+ * @param {string} breakpoint - Breakpoint name (xs, sm, md, lg, xl, xxl)
166
+ * @param {number} offset - Offset value
167
+ */
168
+ setOffset(breakpoint, offset) {
169
+ this.update({ [`offset${breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1)}`]: offset });
170
+ }
171
+
172
+ /**
173
+ * Set flex grow property
174
+ * @param {boolean} grow - Whether to grow
175
+ */
176
+ setGrow(grow) {
177
+ this.update({ grow });
178
+ }
179
+
180
+ /**
181
+ * Set flex shrink property
182
+ * @param {boolean} shrink - Whether to shrink
183
+ */
184
+ setShrink(shrink) {
185
+ this.update({ shrink });
186
+ }
187
+
188
+ /**
189
+ * Set flex basis property
190
+ * @param {string} basis - Flex basis value
191
+ */
192
+ setBasis(basis) {
193
+ this.update({ basis });
194
+ }
195
+
196
+ /**
197
+ * Set column alignment
198
+ * @param {'start'|'end'|'center'|'baseline'|'stretch'} align - Alignment value
199
+ */
200
+ setAlign(align) {
201
+ this.update({ align });
202
+ }
203
+
204
+ /**
205
+ * Reset column to default state
206
+ */
207
+ reset() {
208
+ this.options = {
209
+ className: '',
210
+ xs: undefined,
211
+ sm: undefined,
212
+ md: undefined,
213
+ lg: undefined,
214
+ xl: undefined,
215
+ xxl: undefined,
216
+ offsetXs: undefined,
217
+ offsetSm: undefined,
218
+ offsetMd: undefined,
219
+ offsetLg: undefined,
220
+ offsetXl: undefined,
221
+ offsetXxl: undefined,
222
+ grow: undefined,
223
+ shrink: undefined,
224
+ basis: undefined,
225
+ align: undefined
226
+ };
227
+ this.updateClasses();
228
+ }
229
+
230
+ /**
231
+ * Destroy the column instance and clean up
232
+ */
233
+ destroy() {
234
+ this.element.className = '';
235
+ this.element = null;
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Create a grid column instance for a DOM element
241
+ * @param {HTMLElement} element - The DOM element to initialize as grid column
242
+ * @param {Object} options - Grid column configuration options
243
+ * @returns {GridCol} Grid column instance
244
+ */
245
+ export function createGridCol(element, options = {}) {
246
+ return new GridCol({ element, ...options });
247
+ }
248
+
249
+ /**
250
+ * Initialize grid columns on page load
251
+ * @param {string} [selector='[data-grid-col]'] - CSS selector for grid column elements
252
+ * @param {Object} [defaultOptions={}] - Default grid column options
253
+ */
254
+ export function initGridCols(selector = '[data-grid-col]', defaultOptions = {}) {
255
+ const elements = document.querySelectorAll(selector);
256
+ const columns = [];
257
+
258
+ elements.forEach(element => {
259
+ const options = {
260
+ ...defaultOptions,
261
+ ...(element.dataset.gridColOptions ? JSON.parse(element.dataset.gridColOptions) : {})
262
+ };
263
+
264
+ columns.push(createGridCol(element, options));
265
+ });
266
+
267
+ return columns;
268
+ }
269
+
270
+ // Auto-initialize on DOM ready
271
+ document.addEventListener('DOMContentLoaded', () => {
272
+ initGridCols();
273
+ });
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @file Row - Vanilla JavaScript implementation of the Row component
3
+ * @description Provides DOM manipulation for grid rows with alignment controls
4
+ * @requires ../Grid.css (auto-generated)
5
+ */
6
+
7
+ /**
8
+ * Row component class for responsive row management
9
+ */
10
+ export class Row {
11
+ /**
12
+ * Create a new Row instance
13
+ * @param {Object} options - Row configuration options
14
+ * @param {HTMLElement} options.element - The row element
15
+ * @param {string} [options.className=''] - Additional CSS classes
16
+ * @param {'start'|'end'|'center'|'between'|'around'|'evenly'} [options.justifyContent] - Horizontal alignment
17
+ * @param {'start'|'end'|'center'|'baseline'|'stretch'} [options.alignItems] - Vertical alignment
18
+ * @param {boolean} [options.noGutters=false] - Remove gutters between columns
19
+ */
20
+ constructor(options) {
21
+ this.element = options.element;
22
+ this.options = {
23
+ className: options.className || '',
24
+ justifyContent: options.justifyContent,
25
+ alignItems: options.alignItems,
26
+ noGutters: options.noGutters || false,
27
+ ...options
28
+ };
29
+
30
+ this.init();
31
+ }
32
+
33
+ /**
34
+ * Initialize the row component
35
+ */
36
+ init() {
37
+ this.updateClasses();
38
+ }
39
+
40
+ /**
41
+ * Update CSS classes based on current options
42
+ */
43
+ updateClasses() {
44
+ const classes = ['o-grid'];
45
+
46
+ if (this.options.justifyContent) {
47
+ classes.push(`u-justify-content-${this.options.justifyContent}`);
48
+ }
49
+
50
+ if (this.options.alignItems) {
51
+ classes.push(`u-align-items-${this.options.alignItems}`);
52
+ }
53
+
54
+ if (this.options.noGutters) {
55
+ classes.push('o-grid--no-gutters');
56
+ }
57
+
58
+ if (this.options.className) {
59
+ classes.push(this.options.className);
60
+ }
61
+
62
+ this.element.className = classes.join(' ');
63
+ }
64
+
65
+ /**
66
+ * Update row options and refresh styling
67
+ * @param {Object} newOptions - New configuration options
68
+ */
69
+ update(newOptions) {
70
+ this.options = { ...this.options, ...newOptions };
71
+ this.updateClasses();
72
+ }
73
+
74
+ /**
75
+ * Set horizontal alignment
76
+ * @param {'start'|'end'|'center'|'between'|'around'|'evenly'} alignment - Horizontal alignment
77
+ */
78
+ setJustifyContent(alignment) {
79
+ this.update({ justifyContent: alignment });
80
+ }
81
+
82
+ /**
83
+ * Set vertical alignment
84
+ * @param {'start'|'end'|'center'|'baseline'|'stretch'} alignment - Vertical alignment
85
+ */
86
+ setAlignItems(alignment) {
87
+ this.update({ alignItems: alignment });
88
+ }
89
+
90
+ /**
91
+ * Toggle gutters
92
+ * @param {boolean} noGutters - Whether to remove gutters
93
+ */
94
+ setNoGutters(noGutters) {
95
+ this.update({ noGutters });
96
+ }
97
+
98
+ /**
99
+ * Reset row to default state
100
+ */
101
+ reset() {
102
+ this.options = {
103
+ className: '',
104
+ justifyContent: undefined,
105
+ alignItems: undefined,
106
+ noGutters: false
107
+ };
108
+ this.updateClasses();
109
+ }
110
+
111
+ /**
112
+ * Destroy the row instance and clean up
113
+ */
114
+ destroy() {
115
+ this.element.className = '';
116
+ this.element = null;
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Create a row instance for a DOM element
122
+ * @param {HTMLElement} element - The DOM element to initialize as row
123
+ * @param {Object} options - Row configuration options
124
+ * @returns {Row} Row instance
125
+ */
126
+ export function createRow(element, options = {}) {
127
+ return new Row({ element, ...options });
128
+ }
129
+
130
+ /**
131
+ * Initialize row components on page load
132
+ * @param {string} [selector='[data-row]'] - CSS selector for row elements
133
+ * @param {Object} [defaultOptions={}] - Default row options
134
+ */
135
+ export function initRows(selector = '[data-row]', defaultOptions = {}) {
136
+ const elements = document.querySelectorAll(selector);
137
+ const rows = [];
138
+
139
+ elements.forEach(element => {
140
+ const options = {
141
+ ...defaultOptions,
142
+ ...(element.dataset.rowOptions ? JSON.parse(element.dataset.rowOptions) : {})
143
+ };
144
+
145
+ rows.push(createRow(element, options));
146
+ });
147
+
148
+ return rows;
149
+ }
150
+
151
+ // Auto-initialize on DOM ready
152
+ document.addEventListener('DOMContentLoaded', () => {
153
+ initRows();
154
+ });
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @file Grid Scripts Index
3
+ * @description Entry point for vanilla JavaScript grid implementations
4
+ */
5
+
6
+ export * from './Grid.js';
7
+ export * from './GridCol.js';
8
+ export * from './Row.js';
9
+
10
+ /**
11
+ * Combine grid components for easy initialization
12
+ * @param {Object} options - Global initialization options
13
+ * @param {string} [options.gridSelector='[data-grid]'] - Grid element selector
14
+ * @param {string} [options.colSelector='[data-grid-col]'] - Grid column selector
15
+ * @param {string} [options.rowSelector='[data-row]'] - Row element selector
16
+ * @returns {Object} Grid instances by type
17
+ */
18
+ export function initGridComponents(options = {}) {
19
+ const {
20
+ gridSelector = '[data-grid]',
21
+ colSelector = '[data-grid-col]',
22
+ rowSelector = '[data-row]'
23
+ } = options;
24
+
25
+ const grids = typeof initGrids === 'function' ? initGrids(gridSelector) : [];
26
+ const columns = typeof initGridCols === 'function' ? initGridCols(colSelector) : [];
27
+ const rows = typeof initRows === 'function' ? initRows(rowSelector) : [];
28
+
29
+ return {
30
+ grids,
31
+ columns,
32
+ rows,
33
+ destroy: () => {
34
+ [...grids, ...columns, ...rows].forEach(instance => {
35
+ if (instance && typeof instance.destroy === 'function') {
36
+ instance.destroy();
37
+ }
38
+ });
39
+ }
40
+ };
41
+ }
42
+
43
+ // Auto-initialize when imported in browser environment
44
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
45
+ document.addEventListener('DOMContentLoaded', () => {
46
+ initGridComponents();
47
+ });
48
+ }