@astuteo/breakout-grid 5.1.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.
- package/LICENSE +21 -0
- package/README.md +223 -0
- package/breakout-grid-visualizer-lite.js +659 -0
- package/breakout-grid-visualizer.js +2523 -0
- package/craft-integration.twig +58 -0
- package/dist/_objects.breakout-grid.css +656 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Astuteo LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Breakout Grid
|
|
2
|
+
|
|
3
|
+
A CSS Grid layout system for content that "breaks out" of containers. No build step required—just CSS.
|
|
4
|
+
|
|
5
|
+
Inspired by [Kevin Powell's video](https://www.youtube.com/watch?v=c13gpBrnGEw), [Ryan Mulligan's Layout Breakouts](https://ryanmulligan.dev/blog/layout-breakouts/), and [Viget's Fluid Breakout Layout](https://www.viget.com/articles/fluid-breakout-layout-css-grid/).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Pure CSS** - No JavaScript, no build step, no dependencies
|
|
10
|
+
- **5 content widths** - From optimal reading width to full viewport
|
|
11
|
+
- **Responsive gaps** - Automatic scaling based on viewport
|
|
12
|
+
- **CSS variables** - Customize by overriding `:root` properties
|
|
13
|
+
- **Visual configurator** - Optional tool for experimenting and exporting
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### CDN / Direct Download
|
|
18
|
+
|
|
19
|
+
Download the CSS file and include it directly:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<link rel="stylesheet" href="_objects.breakout-grid.css">
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### npm
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install github:astuteo-llc/breakout-grid
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Import the CSS in your build:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import '@astuteo/breakout-grid'
|
|
35
|
+
// or
|
|
36
|
+
import '@astuteo/breakout-grid/css'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For the visualizer:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import '@astuteo/breakout-grid/visualizer'
|
|
43
|
+
// or lite version
|
|
44
|
+
import '@astuteo/breakout-grid/visualizer-lite'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
1. Add the CSS (see Installation above)
|
|
50
|
+
|
|
51
|
+
2. Use the grid:
|
|
52
|
+
```html
|
|
53
|
+
<main class="grid-cols-breakout">
|
|
54
|
+
<article class="col-content">Reading width (optimal for text)</article>
|
|
55
|
+
<figure class="col-feature">Wider for images</figure>
|
|
56
|
+
<div class="col-full">Edge to edge</div>
|
|
57
|
+
</main>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Column Widths
|
|
61
|
+
|
|
62
|
+
From narrowest to widest:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
┌─────────────────────────────────────────┐
|
|
66
|
+
│ ╔══════════col-full════════════╗ │ Full width (with gap)
|
|
67
|
+
│ ╚══════════════════════════════╝ │
|
|
68
|
+
│ ╔════col-feature═══════╗ │ Extra wide
|
|
69
|
+
│ ╚══════════════════════╝ │
|
|
70
|
+
│ ╔═══col-popout══════╗ │ Slightly wider
|
|
71
|
+
│ ╚═══════════════════╝ │
|
|
72
|
+
│ ╔══col-content═══╗ │ Reading width (default)
|
|
73
|
+
│ ╚════════════════╝ │
|
|
74
|
+
└─────────────────────────────────────────┘
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Classes
|
|
78
|
+
|
|
79
|
+
### Grid Containers
|
|
80
|
+
- `.grid-cols-breakout` - Main centered grid
|
|
81
|
+
- `.grid-cols-breakout-subgrid` - CSS subgrid for nested alignment
|
|
82
|
+
- `.grid-cols-{feature|popout|content}-{left|right}` - Asymmetric layouts
|
|
83
|
+
|
|
84
|
+
### Column Placement
|
|
85
|
+
- `.col-full` - Edge to edge
|
|
86
|
+
- `.col-feature` - Wide content (images, videos)
|
|
87
|
+
- `.col-popout` - Slightly wider than content
|
|
88
|
+
- `.col-content` - Reading width (default)
|
|
89
|
+
- `.col-full-limit` - Full width with max-width cap
|
|
90
|
+
|
|
91
|
+
### Fine-Grained Control
|
|
92
|
+
- `.col-start-{full|feature|popout|content|center}`
|
|
93
|
+
- `.col-end-{full|feature|popout|content|center}`
|
|
94
|
+
- `.col-{area}-left` / `.col-{area}-right` - Asymmetric spans
|
|
95
|
+
|
|
96
|
+
### Spacing
|
|
97
|
+
- `.p-gap`, `.px-gap`, `.m-gap`, etc. - Gap-based spacing
|
|
98
|
+
- `.p-breakout`, `.px-breakout` - Responsive padding
|
|
99
|
+
- `.-mx-gap`, `.-mx-breakout` - Negative margins
|
|
100
|
+
|
|
101
|
+
## Customization
|
|
102
|
+
|
|
103
|
+
Override CSS variables in your own stylesheet:
|
|
104
|
+
|
|
105
|
+
```css
|
|
106
|
+
:root {
|
|
107
|
+
--base-gap: 1.5rem;
|
|
108
|
+
--content-max: 50rem;
|
|
109
|
+
--popout: minmax(0, 3rem);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### All Variables
|
|
114
|
+
|
|
115
|
+
| Variable | Default | Description |
|
|
116
|
+
|----------|---------|-------------|
|
|
117
|
+
| `--base-gap` | `1rem` | Minimum gap (mobile) |
|
|
118
|
+
| `--max-gap` | `15rem` | Maximum gap |
|
|
119
|
+
| `--content-min` | `53rem` | Min content width |
|
|
120
|
+
| `--content-max` | `61rem` | Max content width |
|
|
121
|
+
| `--content-base` | `75vw` | Preferred content width |
|
|
122
|
+
| `--full-limit` | `115rem` | Max width for col-full-limit |
|
|
123
|
+
|
|
124
|
+
See the CSS file header for the complete list.
|
|
125
|
+
|
|
126
|
+
## Visual Configurator
|
|
127
|
+
|
|
128
|
+
Want to experiment with values before committing? Use the visualizer:
|
|
129
|
+
|
|
130
|
+
```html
|
|
131
|
+
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
|
132
|
+
<script defer src="breakout-grid-visualizer.js"></script>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Press `Ctrl+G` / `Cmd+G` to toggle. Adjust values interactively, then click **Export CSS** to download your customized stylesheet.
|
|
136
|
+
|
|
137
|
+
### With Alpine.js (Vite)
|
|
138
|
+
|
|
139
|
+
If your project already uses Alpine, import the visualizer before `Alpine.start()`:
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
import Alpine from 'alpinejs'
|
|
143
|
+
|
|
144
|
+
if (import.meta.env.DEV) {
|
|
145
|
+
await import('@astuteo/breakout-grid/visualizer')
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
Alpine.start()
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Two versions available:
|
|
152
|
+
|
|
153
|
+
| Version | Size | Use Case |
|
|
154
|
+
|---------|------|----------|
|
|
155
|
+
| `breakout-grid-visualizer.js` | ~124 KB | Config editing + CSS export |
|
|
156
|
+
| `breakout-grid-visualizer-lite.js` | ~31 KB | Read-only debugging |
|
|
157
|
+
|
|
158
|
+
## Common Patterns
|
|
159
|
+
|
|
160
|
+
### Article Layout
|
|
161
|
+
```html
|
|
162
|
+
<article class="grid-cols-breakout">
|
|
163
|
+
<h1 class="col-content">Article Title</h1>
|
|
164
|
+
<p class="col-content">Body text at comfortable reading width.</p>
|
|
165
|
+
<img class="col-feature" src="hero.jpg" alt="Hero" />
|
|
166
|
+
<blockquote class="col-popout">Pull quote with slight emphasis.</blockquote>
|
|
167
|
+
<div class="col-full bg-gray-100 px-gap py-8">
|
|
168
|
+
Full-width section
|
|
169
|
+
</div>
|
|
170
|
+
</article>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Split Layout
|
|
174
|
+
```html
|
|
175
|
+
<section class="col-feature grid-cols-feature-left">
|
|
176
|
+
<img class="col-feature" src="product.jpg" />
|
|
177
|
+
<div class="col-content">
|
|
178
|
+
<h2>Product Title</h2>
|
|
179
|
+
<p>Description on the right side.</p>
|
|
180
|
+
</div>
|
|
181
|
+
</section>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Browser Support
|
|
185
|
+
|
|
186
|
+
Requires CSS Grid + `clamp()`:
|
|
187
|
+
- Chrome 79+
|
|
188
|
+
- Firefox 75+
|
|
189
|
+
- Safari 13.1+
|
|
190
|
+
- Edge 79+
|
|
191
|
+
|
|
192
|
+
## Migration from Tailwind Plugin
|
|
193
|
+
|
|
194
|
+
If you were using the Tailwind plugin:
|
|
195
|
+
|
|
196
|
+
1. Remove from `tailwind.config.js`:
|
|
197
|
+
```diff
|
|
198
|
+
- import breakoutGrid from '@astuteo/tailwind-breakout-grid'
|
|
199
|
+
plugins: [
|
|
200
|
+
- breakoutGrid({ ... })
|
|
201
|
+
]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
2. Add the CSS file:
|
|
205
|
+
```html
|
|
206
|
+
<link rel="stylesheet" href="breakout-grid.css">
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
3. All class names are identical—no HTML changes needed.
|
|
210
|
+
|
|
211
|
+
4. If you had custom config, use the visualizer to export matching CSS.
|
|
212
|
+
|
|
213
|
+
## Documentation
|
|
214
|
+
|
|
215
|
+
- [Visualizer](docs/visualizer.md) - Full configurator with CSS export
|
|
216
|
+
- [Visualizer Lite](docs/visualizer-lite.md) - Lightweight read-only version
|
|
217
|
+
- [Migration Guide](docs/migration-guide.md) - Integrating with existing projects
|
|
218
|
+
- [Nested Grids](docs/nested-grids.md) - `breakout-to-*` modifiers
|
|
219
|
+
- [Layout Examples](docs/layout-examples.md) - Real-world patterns
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
MIT
|