@lobergdesign/dot-grid 1.0.0 → 1.0.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.
- package/README.md +69 -94
- package/dist/grid.css +352 -572
- package/dist/grid.min.css +1 -71
- package/package.json +3 -2
- package/src/_base.scss +12 -12
- package/src/_fluid.scss +35 -22
- package/src/_responsive.scss +18 -46
- package/src/_utilities.scss +6 -80
- package/src/_variables.scss +4 -27
- package/src/grid.scss +18 -38
package/README.md
CHANGED
|
@@ -19,25 +19,31 @@ A modern, flexible 12-column CSS Grid system with container queries, fluid layou
|
|
|
19
19
|
### npm
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npm install dot-grid
|
|
22
|
+
npm install @lobergdesign/dot-grid
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Then import in your CSS/SCSS:
|
|
26
26
|
|
|
27
27
|
```css
|
|
28
|
-
@import 'dot-grid';
|
|
28
|
+
@import '@lobergdesign/dot-grid';
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Or in your HTML:
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<link
|
|
34
|
+
<link
|
|
35
|
+
rel="stylesheet"
|
|
36
|
+
href="node_modules/@lobergdesign/dot-grid/dist/grid.min.css"
|
|
37
|
+
/>
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
### CDN
|
|
38
41
|
|
|
39
42
|
```html
|
|
40
|
-
<link
|
|
43
|
+
<link
|
|
44
|
+
rel="stylesheet"
|
|
45
|
+
href="https://unpkg.com/@lobergdesign/dot-grid@latest/dist/grid.min.css"
|
|
46
|
+
/>
|
|
41
47
|
```
|
|
42
48
|
|
|
43
49
|
## 🚀 Quick Start
|
|
@@ -45,11 +51,11 @@ Or in your HTML:
|
|
|
45
51
|
### Basic Grid
|
|
46
52
|
|
|
47
53
|
```html
|
|
48
|
-
<div class="
|
|
49
|
-
<div class="
|
|
50
|
-
<div class="
|
|
51
|
-
<div class="
|
|
52
|
-
<div class="
|
|
54
|
+
<div class="grid-w">
|
|
55
|
+
<div class="grid-r">
|
|
56
|
+
<div class="grid-c-12 grid-c-md-6 grid-c-lg-4">Column 1</div>
|
|
57
|
+
<div class="grid-c-12 grid-c-md-6 grid-c-lg-4">Column 2</div>
|
|
58
|
+
<div class="grid-c-12 grid-c-md-6 grid-c-lg-4">Column 3</div>
|
|
53
59
|
</div>
|
|
54
60
|
</div>
|
|
55
61
|
```
|
|
@@ -57,7 +63,7 @@ Or in your HTML:
|
|
|
57
63
|
### Fluid/Auto Grid (No Breakpoints Needed!)
|
|
58
64
|
|
|
59
65
|
```html
|
|
60
|
-
<div class="
|
|
66
|
+
<div class="grid-w">
|
|
61
67
|
<div class="grid-auto-fit">
|
|
62
68
|
<div>Card 1</div>
|
|
63
69
|
<div>Card 2</div>
|
|
@@ -73,35 +79,39 @@ Or in your HTML:
|
|
|
73
79
|
|
|
74
80
|
#### Container
|
|
75
81
|
|
|
76
|
-
- `.
|
|
82
|
+
- `.grid-w` - Centers content with max-width and responsive padding
|
|
77
83
|
|
|
78
84
|
#### Grid Container
|
|
79
85
|
|
|
80
|
-
- `.
|
|
86
|
+
- `.grid-r` - Creates a 12-column grid container with container query support
|
|
81
87
|
|
|
82
88
|
### Column Classes
|
|
83
89
|
|
|
84
90
|
#### Basic Columns
|
|
85
91
|
|
|
86
92
|
```html
|
|
87
|
-
<div class="
|
|
88
|
-
|
|
89
|
-
<div class="
|
|
93
|
+
<div class="grid-c-1">...</div>
|
|
94
|
+
<!-- Spans 1 column -->
|
|
95
|
+
<div class="grid-c-6">...</div>
|
|
96
|
+
<!-- Spans 6 columns (50%) -->
|
|
97
|
+
<div class="grid-c-12">...</div>
|
|
98
|
+
<!-- Spans 12 columns (100%) -->
|
|
90
99
|
```
|
|
91
100
|
|
|
92
|
-
All classes from `.
|
|
101
|
+
All classes from `.grid-c-1` through `.grid-c-12` are available.
|
|
93
102
|
|
|
94
103
|
#### Container Query Responsive (Modern, Recommended)
|
|
95
104
|
|
|
96
105
|
Responds to the **container width**, not viewport:
|
|
97
106
|
|
|
98
107
|
```html
|
|
99
|
-
<div class="
|
|
108
|
+
<div class="grid-c-12 grid-c-sm-6 grid-c-md-4 grid-c-lg-3">
|
|
100
109
|
Responsive column
|
|
101
110
|
</div>
|
|
102
111
|
```
|
|
103
112
|
|
|
104
113
|
**Breakpoints:**
|
|
114
|
+
|
|
105
115
|
- `sm`: 640px
|
|
106
116
|
- `md`: 768px
|
|
107
117
|
- `lg`: 1024px
|
|
@@ -113,9 +123,7 @@ Responds to the **container width**, not viewport:
|
|
|
113
123
|
If you need viewport-based responsive behavior instead:
|
|
114
124
|
|
|
115
125
|
```html
|
|
116
|
-
<div class="
|
|
117
|
-
Responds to viewport size
|
|
118
|
-
</div>
|
|
126
|
+
<div class="grid-c-vp-md-6 grid-c-vp-lg-4">Responds to viewport size</div>
|
|
119
127
|
```
|
|
120
128
|
|
|
121
129
|
### Column Positioning
|
|
@@ -123,15 +131,13 @@ If you need viewport-based responsive behavior instead:
|
|
|
123
131
|
#### Start Position
|
|
124
132
|
|
|
125
133
|
```html
|
|
126
|
-
<div class="
|
|
127
|
-
Starts at column 4, spans 3 columns
|
|
128
|
-
</div>
|
|
134
|
+
<div class="grid-c-3 grid-c-start-4">Starts at column 4, spans 3 columns</div>
|
|
129
135
|
```
|
|
130
136
|
|
|
131
137
|
Responsive start positions:
|
|
132
138
|
|
|
133
139
|
```html
|
|
134
|
-
<div class="
|
|
140
|
+
<div class="grid-c-6 grid-c-start-md-7 grid-c-start-lg-4">
|
|
135
141
|
Different start positions at different sizes
|
|
136
142
|
</div>
|
|
137
143
|
```
|
|
@@ -139,25 +145,8 @@ Responsive start positions:
|
|
|
139
145
|
### Gap Utilities
|
|
140
146
|
|
|
141
147
|
```html
|
|
142
|
-
<!--
|
|
143
|
-
<div class="
|
|
144
|
-
<div class="row gap-xs">...</div> <!-- 0.5rem -->
|
|
145
|
-
<div class="row gap-sm">...</div> <!-- 1rem -->
|
|
146
|
-
<div class="row gap-md">...</div> <!-- clamp(1rem, 2vw, 2rem) - default -->
|
|
147
|
-
<div class="row gap-lg">...</div> <!-- 3rem -->
|
|
148
|
-
<div class="row gap-xl">...</div> <!-- 4rem -->
|
|
149
|
-
|
|
150
|
-
<!-- Directional gaps -->
|
|
151
|
-
<div class="row gap-b-none">...</div> <!-- No row gap -->
|
|
152
|
-
<div class="row gap-sides-none">...</div> <!-- No column gap -->
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Responsive gaps:
|
|
156
|
-
|
|
157
|
-
```html
|
|
158
|
-
<div class="row gap-sm gap-md-lg gap-lg-xl">
|
|
159
|
-
Different gaps at different sizes
|
|
160
|
-
</div>
|
|
148
|
+
<!-- Remove all gaps -->
|
|
149
|
+
<div class="grid-r no-gap">...</div>
|
|
161
150
|
```
|
|
162
151
|
|
|
163
152
|
### Subgrid
|
|
@@ -165,12 +154,12 @@ Responsive gaps:
|
|
|
165
154
|
Perfect alignment for nested grids:
|
|
166
155
|
|
|
167
156
|
```html
|
|
168
|
-
<div class="
|
|
169
|
-
<div class="
|
|
157
|
+
<div class="grid-r">
|
|
158
|
+
<div class="grid-c-12 grid-r-subgrid">
|
|
170
159
|
<!-- These inherit the parent's column tracks -->
|
|
171
|
-
<div class="
|
|
172
|
-
<div class="
|
|
173
|
-
<div class="
|
|
160
|
+
<div class="grid-c-4">Aligned 1</div>
|
|
161
|
+
<div class="grid-c-4">Aligned 2</div>
|
|
162
|
+
<div class="grid-c-4">Aligned 3</div>
|
|
174
163
|
</div>
|
|
175
164
|
</div>
|
|
176
165
|
```
|
|
@@ -199,19 +188,19 @@ Automatically fits as many columns as possible:
|
|
|
199
188
|
|
|
200
189
|
```html
|
|
201
190
|
<!-- Adapts to 2 columns on larger screens -->
|
|
202
|
-
<div class="
|
|
191
|
+
<div class="grid-r-fluid-2">
|
|
203
192
|
<div>Item 1</div>
|
|
204
193
|
<div>Item 2</div>
|
|
205
194
|
<div>Item 3</div>
|
|
206
195
|
</div>
|
|
207
196
|
|
|
208
|
-
<!-- Also available:
|
|
197
|
+
<!-- Also available: grid-r-fluid-3, grid-r-fluid-4 -->
|
|
209
198
|
```
|
|
210
199
|
|
|
211
200
|
#### RAM Pattern (Repeat Auto Minmax)
|
|
212
201
|
|
|
213
202
|
```html
|
|
214
|
-
<div class="
|
|
203
|
+
<div class="grid-r-ram" style="--col-min: 250px">
|
|
215
204
|
<div>Equal column 1</div>
|
|
216
205
|
<div>Equal column 2</div>
|
|
217
206
|
<div>Equal column 3</div>
|
|
@@ -220,9 +209,9 @@ Automatically fits as many columns as possible:
|
|
|
220
209
|
|
|
221
210
|
#### Other Fluid Patterns
|
|
222
211
|
|
|
223
|
-
- `.
|
|
224
|
-
- `.
|
|
225
|
-
- `.
|
|
212
|
+
- `.grid-r-intrinsic` - Columns size based on content
|
|
213
|
+
- `.grid-r-even` - Even columns sharing space equally
|
|
214
|
+
- `.grid-r-dense` - Fills gaps in the grid (masonry style)
|
|
226
215
|
|
|
227
216
|
### Content Placement
|
|
228
217
|
|
|
@@ -230,9 +219,9 @@ Align content within a column:
|
|
|
230
219
|
|
|
231
220
|
```html
|
|
232
221
|
<!-- Pattern: place-{vertical}-{horizontal} -->
|
|
233
|
-
<div class="
|
|
234
|
-
<div class="
|
|
235
|
-
<div class="
|
|
222
|
+
<div class="grid-c-6 place-t-l">Top Left</div>
|
|
223
|
+
<div class="grid-c-6 place-c-c">Center Center</div>
|
|
224
|
+
<div class="grid-c-6 place-b-r">Bottom Right</div>
|
|
236
225
|
```
|
|
237
226
|
|
|
238
227
|
**Vertical options:** `t` (top), `c` (center), `b` (bottom)
|
|
@@ -243,7 +232,7 @@ Align content within a column:
|
|
|
243
232
|
For flex-based alignment within columns:
|
|
244
233
|
|
|
245
234
|
```html
|
|
246
|
-
<div class="
|
|
235
|
+
<div class="grid-c-12 justify-between">
|
|
247
236
|
<span>Left</span>
|
|
248
237
|
<span>Right</span>
|
|
249
238
|
</div>
|
|
@@ -251,14 +240,6 @@ For flex-based alignment within columns:
|
|
|
251
240
|
|
|
252
241
|
Available: `.justify-start`, `.justify-end`, `.justify-center`, `.justify-between`, `.justify-around`, `.justify-evenly`
|
|
253
242
|
|
|
254
|
-
### Aspect Ratio
|
|
255
|
-
|
|
256
|
-
```html
|
|
257
|
-
<div class="col-4 aspect-square">Square</div>
|
|
258
|
-
<div class="col-8 aspect-video">16:9 Video</div>
|
|
259
|
-
<div class="col-6 aspect-4-3">4:3</div>
|
|
260
|
-
```
|
|
261
|
-
|
|
262
243
|
### Display Utilities
|
|
263
244
|
|
|
264
245
|
```html
|
|
@@ -276,17 +257,10 @@ Available: `.justify-start`, `.justify-end`, `.justify-center`, `.justify-betwee
|
|
|
276
257
|
### Sizing Utilities
|
|
277
258
|
|
|
278
259
|
```html
|
|
279
|
-
<div class="
|
|
280
|
-
<div class="
|
|
281
|
-
<div class="
|
|
282
|
-
<div class="
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Order
|
|
286
|
-
|
|
287
|
-
```html
|
|
288
|
-
<div class="col-6 order-last">Appears last</div>
|
|
289
|
-
<div class="col-6 order-first">Appears first</div>
|
|
260
|
+
<div class="grid-c-min">Shrinks to min content</div>
|
|
261
|
+
<div class="grid-c-max">Expands to max content</div>
|
|
262
|
+
<div class="grid-c-fit">Fits content</div>
|
|
263
|
+
<div class="grid-c-auto">Auto-sized</div>
|
|
290
264
|
```
|
|
291
265
|
|
|
292
266
|
## 🎨 Customization
|
|
@@ -302,16 +276,12 @@ Override CSS custom properties in your own stylesheet:
|
|
|
302
276
|
--grid-columns: 16;
|
|
303
277
|
|
|
304
278
|
/* Change container max width */
|
|
305
|
-
--grid-
|
|
306
|
-
--grid-
|
|
307
|
-
|
|
308
|
-
/* Customize gap scale */
|
|
309
|
-
--grid-gap-sm: 0.75rem;
|
|
310
|
-
--grid-gap-lg: 4rem;
|
|
279
|
+
--grid-w-max-width: 1400px;
|
|
280
|
+
--grid-w-width: 95vw;
|
|
311
281
|
|
|
312
282
|
/* Customize fluid layouts */
|
|
313
283
|
--grid-auto-min: 300px; /* For grid-auto-fit */
|
|
314
|
-
--
|
|
284
|
+
--grid-c-min-width: 250px; /* For grid-c-fluid */
|
|
315
285
|
}
|
|
316
286
|
```
|
|
317
287
|
|
|
@@ -328,10 +298,10 @@ $breakpoints: (
|
|
|
328
298
|
md: 768px,
|
|
329
299
|
lg: 992px,
|
|
330
300
|
xl: 1200px,
|
|
331
|
-
xxl: 1600px
|
|
301
|
+
xxl: 1600px,
|
|
332
302
|
);
|
|
333
303
|
|
|
334
|
-
@use 'dot-grid/src/grid';
|
|
304
|
+
@use '@lobergdesign/dot-grid/src/grid';
|
|
335
305
|
```
|
|
336
306
|
|
|
337
307
|
## 🌐 Browser Support
|
|
@@ -356,13 +326,22 @@ See the `/examples` directory for complete working examples:
|
|
|
356
326
|
|
|
357
327
|
### Breaking Changes
|
|
358
328
|
|
|
359
|
-
1. **
|
|
360
|
-
|
|
329
|
+
1. **Class names updated** - All core classes have been renamed for better clarity:
|
|
330
|
+
|
|
331
|
+
- `.wrap` → `.grid-w`
|
|
332
|
+
- `.row` → `.grid-r`
|
|
333
|
+
- `.col-*` → `.grid-c-*`
|
|
334
|
+
- **Migration:** Update all class names in your HTML
|
|
335
|
+
|
|
336
|
+
2. **Container queries by default** - Responsive classes now use `@container` instead of `@media`
|
|
337
|
+
|
|
338
|
+
- **Migration:** Use `.grid-c-vp-{size}-{num}` if you need viewport-based behavior
|
|
339
|
+
|
|
340
|
+
3. **Placement utilities fixed** - `align-items: top` → `align-items: start`
|
|
361
341
|
|
|
362
|
-
2. **Placement utilities fixed** - `align-items: top` → `align-items: start`
|
|
363
342
|
- **Migration:** No action needed, now uses correct CSS values
|
|
364
343
|
|
|
365
|
-
|
|
344
|
+
4. **New breakpoints** - Added `xxl` (1536px), adjusted `lg` from 1025px to 1024px
|
|
366
345
|
- **Migration:** Update breakpoints in your HTML if using exact pixel values
|
|
367
346
|
|
|
368
347
|
### New Features (Additive)
|
|
@@ -377,7 +356,3 @@ See the `/examples` directory for complete working examples:
|
|
|
377
356
|
## 📄 License
|
|
378
357
|
|
|
379
358
|
MIT © Jean Loberg
|
|
380
|
-
|
|
381
|
-
## 🤝 Contributing
|
|
382
|
-
|
|
383
|
-
Issues and pull requests welcome at [github.com/lobergdesign/dot-grid](https://github.com/lobergdesign/dot-grid)
|