@lobergdesign/dot-grid 1.0.0

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.
@@ -0,0 +1,203 @@
1
+ // ========================================
2
+ // dot-grid Utilities
3
+ // ========================================
4
+
5
+ @use 'variables' as *;
6
+
7
+ @layer grid.utilities {
8
+
9
+ // ========================================
10
+ // Gap Utilities
11
+ // ========================================
12
+
13
+ .gap-none,
14
+ .no-gap {
15
+ gap: var(--grid-gap-none, 0) !important;
16
+ }
17
+
18
+ .gap-xs {
19
+ gap: var(--grid-gap-xs, 0.5rem) !important;
20
+ }
21
+
22
+ .gap-sm {
23
+ gap: var(--grid-gap-sm, 1rem) !important;
24
+ }
25
+
26
+ .gap,
27
+ .gap-md {
28
+ gap: var(--grid-gap-md, clamp(1rem, 2vw, 2rem)) !important;
29
+ }
30
+
31
+ .gap-lg {
32
+ gap: var(--grid-gap-lg, 3rem) !important;
33
+ }
34
+
35
+ .gap-xl {
36
+ gap: var(--grid-gap-xl, 4rem) !important;
37
+ }
38
+
39
+ // Gap directional utilities
40
+ .gap-b-none,
41
+ .no-gap-b {
42
+ row-gap: 0 !important;
43
+ }
44
+
45
+ .gap-sides-none,
46
+ .no-gap-sides {
47
+ column-gap: 0 !important;
48
+ }
49
+
50
+ // ========================================
51
+ // Placement Utilities (Grid Alignment)
52
+ // ========================================
53
+ // Pattern: .place-{vertical}-{horizontal}
54
+ // Using logical properties where appropriate
55
+
56
+ @mixin placement($align, $justify) {
57
+ display: grid;
58
+ align-items: $align;
59
+ justify-items: $justify;
60
+ }
61
+
62
+ // Top row
63
+ .place-t-l {
64
+ @include placement(start, start); // Fixed: 'top' is not a valid value
65
+ }
66
+
67
+ .place-t-c {
68
+ @include placement(start, center);
69
+ }
70
+
71
+ .place-t-r {
72
+ @include placement(start, end);
73
+ }
74
+
75
+ // Center row
76
+ .place-c-l {
77
+ @include placement(center, start);
78
+ }
79
+
80
+ .place-c-c {
81
+ @include placement(center, center);
82
+ }
83
+
84
+ .place-c-r {
85
+ @include placement(center, end);
86
+ }
87
+
88
+ // Bottom row
89
+ .place-b-l {
90
+ @include placement(end, start);
91
+ }
92
+
93
+ .place-b-c {
94
+ @include placement(end, center);
95
+ }
96
+
97
+ .place-b-r {
98
+ @include placement(end, end);
99
+ }
100
+
101
+ // ========================================
102
+ // Flexbox Justify Utilities
103
+ // ========================================
104
+
105
+ @mixin justify($justify) {
106
+ display: flex;
107
+ justify-content: $justify;
108
+ }
109
+
110
+ .justify-start {
111
+ @include justify(flex-start);
112
+ }
113
+
114
+ .justify-end {
115
+ @include justify(flex-end);
116
+ }
117
+
118
+ .justify-center,
119
+ .justify-space-center {
120
+ @include justify(center);
121
+ }
122
+
123
+ .justify-between,
124
+ .justify-space-between {
125
+ @include justify(space-between);
126
+ }
127
+
128
+ .justify-around,
129
+ .justify-space-around {
130
+ @include justify(space-around);
131
+ }
132
+
133
+ .justify-evenly {
134
+ @include justify(space-evenly);
135
+ }
136
+
137
+ // ========================================
138
+ // Aspect Ratio Utilities (Modern CSS)
139
+ // ========================================
140
+
141
+ .aspect-square {
142
+ aspect-ratio: 1 / 1;
143
+ }
144
+
145
+ .aspect-video {
146
+ aspect-ratio: 16 / 9;
147
+ }
148
+
149
+ .aspect-4-3 {
150
+ aspect-ratio: 4 / 3;
151
+ }
152
+
153
+ .aspect-21-9 {
154
+ aspect-ratio: 21 / 9;
155
+ }
156
+
157
+ .aspect-auto {
158
+ aspect-ratio: auto;
159
+ }
160
+
161
+ // ========================================
162
+ // Min/Max Content Utilities
163
+ // ========================================
164
+
165
+ .col-min {
166
+ width: min-content;
167
+ grid-column: auto;
168
+ }
169
+
170
+ .col-max {
171
+ width: max-content;
172
+ grid-column: auto;
173
+ }
174
+
175
+ .col-fit {
176
+ width: fit-content;
177
+ grid-column: auto;
178
+ }
179
+
180
+ // ========================================
181
+ // Display Utilities
182
+ // ========================================
183
+
184
+ .hidden {
185
+ display: none !important;
186
+ }
187
+
188
+ // ========================================
189
+ // Order Utilities (Grid/Flex)
190
+ // ========================================
191
+
192
+ .order-first {
193
+ order: -1;
194
+ }
195
+
196
+ .order-last {
197
+ order: 999;
198
+ }
199
+
200
+ .order-none {
201
+ order: 0;
202
+ }
203
+ }
@@ -0,0 +1,67 @@
1
+ // ========================================
2
+ // dot-grid Variables
3
+ // ========================================
4
+
5
+ // Breakpoints (Modern standard, aligned with Tailwind v3)
6
+ $breakpoints: (
7
+ sm: 640px,
8
+ md: 768px,
9
+ lg: 1024px,
10
+ xl: 1280px,
11
+ xxl: 1536px
12
+ );
13
+
14
+ // Grid configuration
15
+ $grid-columns: 12;
16
+ $grid-gap-default: clamp(1rem, 2vw, 2rem);
17
+
18
+ // Gap scale
19
+ $gap-scale: (
20
+ none: 0,
21
+ xs: 0.5rem,
22
+ sm: 1rem,
23
+ md: clamp(1rem, 2vw, 2rem), // default
24
+ lg: 3rem,
25
+ xl: 4rem
26
+ );
27
+
28
+ // Wrapper/Container
29
+ $wrap-max-width: 180rem;
30
+ $wrap-width: 90vw;
31
+
32
+ // CSS Custom Properties
33
+ // These will be output as CSS variables for user customization
34
+ :root {
35
+ // Grid
36
+ --grid-columns: #{$grid-columns};
37
+ --grid-gap: #{$grid-gap-default};
38
+
39
+ // Breakpoints (for reference/documentation)
40
+ --grid-bp-sm: 640px;
41
+ --grid-bp-md: 768px;
42
+ --grid-bp-lg: 1024px;
43
+ --grid-bp-xl: 1280px;
44
+ --grid-bp-xxl: 1536px;
45
+
46
+ // Container
47
+ --grid-wrap-max-width: #{$wrap-max-width};
48
+ --grid-wrap-width: #{$wrap-width};
49
+
50
+ // Gap scale
51
+ --grid-gap-none: 0;
52
+ --grid-gap-xs: 0.5rem;
53
+ --grid-gap-sm: 1rem;
54
+ --grid-gap-md: clamp(1rem, 2vw, 2rem);
55
+ --grid-gap-lg: 3rem;
56
+ --grid-gap-xl: 4rem;
57
+ }
58
+
59
+ // Helper function to get breakpoint value
60
+ @function breakpoint($name) {
61
+ @return map-get($breakpoints, $name);
62
+ }
63
+
64
+ // Helper function to get gap value
65
+ @function gap($name) {
66
+ @return map-get($gap-scale, $name);
67
+ }
package/src/grid.scss ADDED
@@ -0,0 +1,83 @@
1
+ /*!
2
+ * dot-grid v1.0.0
3
+ * A modern, flexible 12-column CSS Grid system
4
+ *
5
+ * Features:
6
+ * - Container queries for responsive layouts
7
+ * - Fluid/automatic layout utilities
8
+ * - Subgrid support
9
+ * - CSS custom properties for easy customization
10
+ * - Cascade layers for better specificity control
11
+ *
12
+ * (c) 2024 Jean Loberg
13
+ * Released under the MIT License
14
+ * https://github.com/lobergdesign/dot-grid
15
+ */
16
+
17
+ // ========================================
18
+ // Import all modules
19
+ // ========================================
20
+
21
+ @use 'variables';
22
+ @use 'base';
23
+ @use 'utilities';
24
+ @use 'responsive';
25
+ @use 'fluid';
26
+
27
+ // ========================================
28
+ // Export CSS Custom Properties
29
+ // ========================================
30
+ // Variables module already exports :root with custom properties
31
+ // Users can override these in their own CSS:
32
+ //
33
+ // :root {
34
+ // --grid-gap: 1.5rem;
35
+ // --grid-columns: 16;
36
+ // --grid-wrap-max-width: 1400px;
37
+ // }
38
+
39
+ // ========================================
40
+ // Usage Examples
41
+ // ========================================
42
+
43
+ /*
44
+
45
+ BASIC GRID:
46
+ <div class="wrap">
47
+ <div class="row">
48
+ <div class="col-12 col-md-6 col-lg-4">Column</div>
49
+ <div class="col-12 col-md-6 col-lg-4">Column</div>
50
+ <div class="col-12 col-md-6 col-lg-4">Column</div>
51
+ </div>
52
+ </div>
53
+
54
+ FLUID GRID (auto-responsive):
55
+ <div class="wrap">
56
+ <div class="grid-auto-fit">
57
+ <div>Card 1</div>
58
+ <div>Card 2</div>
59
+ <div>Card 3</div>
60
+ </div>
61
+ </div>
62
+
63
+ SUBGRID:
64
+ <div class="row">
65
+ <div class="col-12 row-subgrid">
66
+ <div class="col-4">Nested 1</div>
67
+ <div class="col-4">Nested 2</div>
68
+ <div class="col-4">Nested 3</div>
69
+ </div>
70
+ </div>
71
+
72
+ CUSTOM GAP:
73
+ <div class="row gap-lg">
74
+ <div class="col-6">Large gap</div>
75
+ <div class="col-6">Large gap</div>
76
+ </div>
77
+
78
+ PLACEMENT:
79
+ <div class="row">
80
+ <div class="col-6 place-c-c">Centered content</div>
81
+ </div>
82
+
83
+ */