unigrid.css 0.3.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.
Files changed (42) hide show
  1. package/README.md +101 -0
  2. package/dist/dropdown.js +36 -0
  3. package/dist/index.js +5 -0
  4. package/dist/scrollspy.js +57 -0
  5. package/dist/tabs.js +30 -0
  6. package/dist/unigrid.css +4501 -0
  7. package/dist/unigrid.js +124 -0
  8. package/dist/unigrid.min.css +1 -0
  9. package/dist/unigrid.min.js +1 -0
  10. package/package.json +41 -0
  11. package/src/js/dropdown.js +49 -0
  12. package/src/js/index.js +19 -0
  13. package/src/js/scrollspy.js +87 -0
  14. package/src/js/tabs.js +58 -0
  15. package/src/scss/_accordion.scss +123 -0
  16. package/src/scss/_broadside.scss +125 -0
  17. package/src/scss/_buttons.scss +241 -0
  18. package/src/scss/_card.scss +168 -0
  19. package/src/scss/_components.scss +140 -0
  20. package/src/scss/_container.scss +54 -0
  21. package/src/scss/_dropdown.scss +178 -0
  22. package/src/scss/_footer.scss +147 -0
  23. package/src/scss/_formats.scss +64 -0
  24. package/src/scss/_forms.scss +192 -0
  25. package/src/scss/_grid.scss +114 -0
  26. package/src/scss/_header.scss +169 -0
  27. package/src/scss/_hero.scss +262 -0
  28. package/src/scss/_mixins.scss +120 -0
  29. package/src/scss/_modules.scss +238 -0
  30. package/src/scss/_navbar.scss +341 -0
  31. package/src/scss/_pagination.scss +160 -0
  32. package/src/scss/_prose.scss +393 -0
  33. package/src/scss/_reset.scss +82 -0
  34. package/src/scss/_scrollspy.scss +62 -0
  35. package/src/scss/_section.scss +91 -0
  36. package/src/scss/_sidebar.scss +147 -0
  37. package/src/scss/_table.scss +122 -0
  38. package/src/scss/_tabs.scss +178 -0
  39. package/src/scss/_typography.scss +105 -0
  40. package/src/scss/_utilities.scss +79 -0
  41. package/src/scss/_variables.scss +183 -0
  42. package/src/scss/unigrid.scss +49 -0
@@ -0,0 +1,393 @@
1
+ // ==========================================================================
2
+ // Unigrid CSS Framework — Prose (BEM)
3
+ //
4
+ // Long-form typographic content with vertical rhythm, based on Gutenberg
5
+ // by Matej Latin. Apply .ug-prose to a container to get beautiful defaults
6
+ // for all HTML elements within it.
7
+ //
8
+ // Features:
9
+ // - Vertical rhythm based on leading (line-height as unit)
10
+ // - Configurable heading sizes via $ug-headings map
11
+ // - Mobile-first with desktop breakpoint at $ug-prose-max-width
12
+ // - Typography normalization (abbr, em, sub, sup, mark, etc.)
13
+ // - Blockquote, figcaption, code, list, table styling
14
+ // - Optional paragraph indent mode
15
+ // - Baseline grid debug overlay
16
+ //
17
+ // Block: .ug-prose
18
+ // Modifiers: --indent, --grid, --grid-double
19
+ //
20
+ // Credit: Based on Gutenberg (github.com/matejlatin/Gutenberg)
21
+ // Creative Commons Attribution 3.0
22
+ // ==========================================================================
23
+
24
+ @use "sass:list";
25
+ @use "sass:map";
26
+ @use "variables" as *;
27
+ @use "mixins" as *;
28
+
29
+ .ug-prose {
30
+ font-family: $ug-font-family;
31
+ color: $ug-color-font-body;
32
+ font-size: #{$ug-base}px;
33
+ font-size: #{$ug-base-font-size};
34
+ @include ug-rhythm-line-height(1);
35
+
36
+ @media screen and (min-width: #{$ug-prose-max-width}) {
37
+ font-size: #{$ug-base-desktop}px;
38
+ font-size: #{$ug-base-font-size-desktop};
39
+ }
40
+
41
+ @supports (font-variation-settings: normal) {
42
+ font-family: $ug-font-family-variable;
43
+ }
44
+
45
+ // ---- All elements: reset vertical spacing ----
46
+ * {
47
+ @include ug-rhythm-line-height(1);
48
+ @include ug-rhythm-margin-bottom(1);
49
+ margin-top: 0;
50
+ }
51
+
52
+
53
+
54
+ // ---- Max reading width ----
55
+ > * {
56
+ max-width: #{$ug-prose-max-width};
57
+
58
+ @media screen and (min-width: #{$ug-prose-max-width}) {
59
+ margin-left: auto;
60
+ margin-right: auto;
61
+ }
62
+ }
63
+
64
+ // ---- Headings ----
65
+ @each $heading, $props in $ug-headings {
66
+ #{$heading} {
67
+ @include ug-rhythm-font-size(list.nth($props, 1));
68
+ @include ug-rhythm-line-height(list.nth($props, 2));
69
+ @include ug-rhythm-margin-top(list.nth($props, 3));
70
+ @include ug-rhythm-margin-bottom(list.nth($props, 4));
71
+ @include ug-font-weight("bold");
72
+
73
+ @if $heading == "h1" {
74
+ @include ug-font-weight("black");
75
+ letter-spacing: -0.02em;
76
+ }
77
+ }
78
+ }
79
+
80
+ // Tighter margins between adjacent headings
81
+ h1 + h2 { @include ug-rhythm-margin-top(1); }
82
+ h2 + h3,
83
+ h3 + h4,
84
+ h4 + h5 { @include ug-rhythm-margin-top(0.5); }
85
+ h5 + h6 { @include ug-rhythm-margin-top(-0.5); }
86
+
87
+ h6 {
88
+ font-style: italic;
89
+ font-weight: normal;
90
+ }
91
+
92
+ // ---- Paragraph ----
93
+ p {
94
+ @include ug-rhythm-margin-bottom(1);
95
+ }
96
+
97
+ // Attention grabber / lead
98
+ .ug-prose__lead,
99
+ .attention-grabber {
100
+ @include ug-rhythm-font-size(1.2);
101
+ }
102
+
103
+ // ---- Links ----
104
+ a {
105
+ color: $ug-color-link;
106
+ transition: color 0.2s;
107
+
108
+ &:hover {
109
+ color: $ug-color-link-hover;
110
+ }
111
+
112
+ &:visited {
113
+ color: $ug-color-link-visited;
114
+
115
+ &:hover {
116
+ color: $ug-color-link-hover;
117
+ }
118
+ }
119
+ }
120
+
121
+ // ---- Inline elements ----
122
+ br {
123
+ margin-bottom: 0;
124
+ }
125
+
126
+ abbr {
127
+ letter-spacing: 0.1em;
128
+ }
129
+
130
+ abbr[title] {
131
+ border-bottom: 1px dotted;
132
+ text-decoration: none;
133
+ }
134
+
135
+ b,
136
+ strong {
137
+ @include ug-font-weight("bold");
138
+ }
139
+
140
+ dfn {
141
+ font-style: italic;
142
+ }
143
+
144
+ em,
145
+ i {
146
+ line-height: 0;
147
+ vertical-align: baseline;
148
+ }
149
+
150
+ mark {
151
+ background: #ff0;
152
+ color: #000;
153
+ padding: 0 0.2em;
154
+ }
155
+
156
+ small {
157
+ font-size: 70%;
158
+ @include ug-rhythm-line-height(0.5);
159
+ }
160
+
161
+ sub,
162
+ sup {
163
+ font-size: 75%;
164
+ line-height: 0;
165
+ position: relative;
166
+ vertical-align: baseline;
167
+ }
168
+
169
+ sup { top: -0.5em; }
170
+ sub { bottom: -0.25em; }
171
+
172
+ // ---- Blockquote ----
173
+ blockquote {
174
+ font-style: italic;
175
+ padding-left: 1.4375rem;
176
+ @include ug-rhythm-margin-top(1);
177
+ @include ug-rhythm-margin-bottom(1);
178
+
179
+ @media screen and (min-width: #{$ug-prose-max-width}) {
180
+ padding-left: 2rem;
181
+ }
182
+
183
+ cite {
184
+ display: block;
185
+ font-style: normal;
186
+ @include ug-font-size("sm");
187
+ color: $ug-color-font-light;
188
+ }
189
+ }
190
+
191
+ // Pull quote (in a figure)
192
+ figure blockquote {
193
+ @include ug-rhythm-padding(1, 0);
194
+ text-align: center;
195
+
196
+ p {
197
+ @include ug-rhythm-font-size(1.6875);
198
+ @include ug-rhythm-line-height(1.5);
199
+ }
200
+ }
201
+
202
+ // ---- Lists ----
203
+ ul,
204
+ ol {
205
+ padding-left: 1.5rem;
206
+
207
+ li {
208
+ margin-bottom: 0;
209
+ }
210
+ }
211
+
212
+ // ---- Code ----
213
+ pre {
214
+ overflow: auto;
215
+ @include ug-rhythm-padding(1, 1);
216
+ background-color: $ug-warm-gray;
217
+ border: 1px solid $ug-light-gray;
218
+ }
219
+
220
+ code,
221
+ kbd,
222
+ samp {
223
+ font-family: "SF Mono", "Fira Code", Consolas, monospace;
224
+ @include ug-font-size("sm");
225
+ }
226
+
227
+ :not(pre) > code {
228
+ background-color: $ug-warm-gray;
229
+ padding: 0.15em 0.4em;
230
+ border-radius: 2px;
231
+ }
232
+
233
+ // ---- Table ----
234
+ table {
235
+ border-collapse: collapse;
236
+ border-spacing: 0;
237
+ width: 100%;
238
+ @include ug-rhythm-margin-bottom(1);
239
+
240
+ th,
241
+ td {
242
+ padding: 0.5em 0.75em;
243
+ text-align: left;
244
+ border-bottom: 1px solid $ug-light-gray;
245
+ }
246
+
247
+ th {
248
+ @include ug-font-weight("bold");
249
+ @include ug-font-size("sm");
250
+ text-transform: uppercase;
251
+ letter-spacing: 0.05em;
252
+ }
253
+ }
254
+
255
+ // ---- Horizontal Rule ----
256
+ hr {
257
+ border: none;
258
+ border-bottom: 1px solid $ug-light-gray;
259
+ padding-top: calc(var(--ug-leading) - 1px);
260
+ @include ug-rhythm-margin-top(1);
261
+ @include ug-rhythm-margin-bottom(1);
262
+
263
+ &.ug-divider--bold {
264
+ border-bottom: 3px solid $ug-black;
265
+ padding-top: calc(var(--ug-leading) - 3px);
266
+ }
267
+ }
268
+
269
+ // ---- Figure & Image ----
270
+ figure {
271
+ display: block;
272
+ @include ug-rhythm-margin-bottom(1);
273
+ max-width: 100%;
274
+ }
275
+
276
+ figcaption {
277
+ display: block;
278
+ @include ug-font-size("xs");
279
+ @include ug-rhythm-line-height(1);
280
+ color: $ug-color-font-figcaption;
281
+ font-style: italic;
282
+ text-align: center;
283
+ margin-bottom: 0;
284
+ margin-top: 0.5rem;
285
+ }
286
+
287
+ img {
288
+ border: 0;
289
+ max-width: 100%;
290
+ display: block;
291
+ height: auto;
292
+ }
293
+
294
+ // ---- Form ----
295
+ input,
296
+ textarea,
297
+ select {
298
+ font: inherit;
299
+ color: inherit;
300
+ @include ug-rhythm-margin-bottom(1);
301
+ }
302
+
303
+ // ==============================
304
+ // Modifiers
305
+ // ==============================
306
+
307
+ // ---- Paragraph Indent Mode ----
308
+ &--indent {
309
+ p + p {
310
+ @include ug-rhythm-margin-top(-1);
311
+ text-indent: var(--ug-leading);
312
+ text-indent: var(--ug-leading);
313
+ }
314
+ }
315
+
316
+ // ---- Baseline Grid Debug Overlay ----
317
+ &--grid {
318
+ background-image: linear-gradient(
319
+ to bottom,
320
+ hsla(200, 100%, 50%, 0.3) 1px,
321
+ transparent 1px
322
+ );
323
+ background-position: left top;
324
+ background-repeat: repeat;
325
+ background-size: 100% var(--ug-leading);
326
+ background-size: 100% var(--ug-leading);
327
+ }
328
+
329
+ &--grid-double {
330
+ background-image: linear-gradient(
331
+ to bottom,
332
+ hsla(200, 100%, 50%, 0.3) 1px,
333
+ transparent 1px,
334
+ transparent calc(var(--ug-leading) * 0.5),
335
+ hsla(200, 100%, 50%, 0.15) calc(var(--ug-leading) * 0.5),
336
+ transparent calc(var(--ug-leading) * 0.5 + 1px),
337
+ transparent var(--ug-leading)
338
+ );
339
+ background-position: left top;
340
+ background-repeat: repeat;
341
+ background-size: 100% var(--ug-leading);
342
+ background-size: 100% var(--ug-leading);
343
+ }
344
+
345
+ // ---- Debug: Show Margins & Padding ----
346
+ // Blue outline = content box
347
+ // Orange = margins (top/bottom)
348
+ // Green = padding
349
+ &--debug {
350
+ > * {
351
+ outline: 1px solid hsla(210, 80%, 60%, 0.5);
352
+ position: relative;
353
+
354
+ // Margin visualization (orange glow)
355
+ box-shadow:
356
+ 0 calc(-1 * var(--debug-mt, 0px)) 0 0 hsla(30, 100%, 60%, 0.15),
357
+ 0 calc(var(--debug-mb, 0px)) 0 0 hsla(30, 100%, 60%, 0.15);
358
+
359
+ // Padding visualization (green tint) via inset box-shadow on ::before
360
+ &::after {
361
+ content: "";
362
+ position: absolute;
363
+ inset: 0;
364
+ pointer-events: none;
365
+ // Green inset shadow matching the element's padding
366
+ box-shadow: inset 0 var(--debug-pt, 0px) 0 0 hsla(140, 70%, 50%, 0.1),
367
+ inset 0 calc(-1 * var(--debug-pb, 0px)) 0 0 hsla(140, 70%, 50%, 0.1),
368
+ inset var(--debug-pl, 0px) 0 0 0 hsla(140, 70%, 50%, 0.1),
369
+ inset calc(-1 * var(--debug-pr, 0px)) 0 0 0 hsla(140, 70%, 50%, 0.1);
370
+ }
371
+ }
372
+
373
+ // Margin vars per element
374
+ h1 { --debug-mt: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h1), 3)}); --debug-mb: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h1), 4)}); }
375
+ h2 { --debug-mt: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h2), 3)}); --debug-mb: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h2), 4)}); }
376
+ h3 { --debug-mt: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h3), 3)}); --debug-mb: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h3), 4)}); }
377
+ h4 { --debug-mt: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h4), 3)}); --debug-mb: calc(var(--ug-leading) * #{list.nth(map.get($ug-headings, h4), 4)}); }
378
+ p, ul, ol, table, figure, hr { --debug-mt: 0px; --debug-mb: var(--ug-leading); }
379
+
380
+ // Padding vars for elements that have padding
381
+ blockquote { --debug-pl: 1.4375rem; --debug-pt: 0px; --debug-pb: 0px; --debug-pr: 0px; --debug-mt: var(--ug-leading); --debug-mb: var(--ug-leading); }
382
+ pre { --debug-pt: var(--ug-leading); --debug-pr: var(--ug-leading); --debug-pb: var(--ug-leading); --debug-pl: var(--ug-leading); --debug-mt: 0px; --debug-mb: var(--ug-leading); }
383
+ ul, ol { --debug-pl: 1.5rem; }
384
+ }
385
+
386
+ // ---- Combined: Grid + Debug ----
387
+ &--grid#{&}--debug,
388
+ &--grid-double#{&}--debug {
389
+ > * {
390
+ outline: 1px solid hsla(210, 80%, 60%, 0.5);
391
+ }
392
+ }
393
+ }
@@ -0,0 +1,82 @@
1
+ // ==========================================================================
2
+ // Unigrid CSS Framework — Reset / Base
3
+ //
4
+ // Line-height and font sizing aligned to Gutenberg vertical rhythm.
5
+ // ==========================================================================
6
+
7
+
8
+ @use "variables" as *;
9
+ @use "mixins" as *;
10
+
11
+ *,
12
+ *::before,
13
+ *::after {
14
+ box-sizing: border-box;
15
+ margin: 0;
16
+ padding: 0;
17
+ }
18
+
19
+ :root {
20
+ font-family: $ug-font-family;
21
+ font-feature-settings: 'liga' 1, 'calt' 1, 'ss07' 1; /* fix for Chrome */
22
+ }
23
+ @supports (font-variation-settings: normal) {
24
+ :root { font-family: $ug-font-family-variable; }
25
+ }
26
+
27
+ html {
28
+ font-size: #{$ug-base}px;
29
+ font-size: #{$ug-base-font-size};
30
+ -webkit-text-size-adjust: 100%;
31
+ --ug-leading: #{$ug-leading}px;
32
+ line-height: var(--ug-leading);
33
+
34
+ @media screen and (min-width: #{$ug-prose-max-width}) {
35
+ font-size: #{$ug-base-desktop}px;
36
+ font-size: #{$ug-base-font-size-desktop};
37
+ --ug-leading: #{$ug-leading-desktop}px;
38
+ }
39
+ }
40
+
41
+ body {
42
+ font-family: $ug-font-family;
43
+ font-feature-settings: 'liga' 1, 'calt' 1, 'ss07' 1;
44
+ @include ug-font-size("base");
45
+ @include ug-font-weight("regular");
46
+ color: $ug-black;
47
+ background-color: $ug-white;
48
+ -webkit-font-smoothing: antialiased;
49
+ -moz-osx-font-smoothing: grayscale;
50
+ }
51
+
52
+ @supports (font-variation-settings: normal) {
53
+ body {
54
+ font-family: $ug-font-family-variable;
55
+ }
56
+ }
57
+
58
+ img,
59
+ svg,
60
+ video {
61
+ display: block;
62
+ max-width: 100%;
63
+ height: auto;
64
+ }
65
+
66
+ a {
67
+ color: inherit;
68
+ text-decoration: underline;
69
+ }
70
+
71
+ table {
72
+ border-collapse: collapse;
73
+ border-spacing: 0;
74
+ }
75
+
76
+ button,
77
+ input,
78
+ select,
79
+ textarea {
80
+ font: inherit;
81
+ color: inherit;
82
+ }
@@ -0,0 +1,62 @@
1
+ // ==========================================================================
2
+ // Unigrid CSS Framework — Scrollspy (BEM)
3
+ //
4
+ // Highlights navigation links based on scroll position.
5
+ // Requires scrollspy.js for IntersectionObserver-based tracking.
6
+ //
7
+ // Block: .ug-scrollspy
8
+ // Elements: __nav, __link
9
+ // Modifiers: __link--active
10
+ //
11
+ // Usage:
12
+ // <nav class="ug-scrollspy" data-ug-scrollspy>
13
+ // <a class="ug-scrollspy__link" href="#section1">Section 1</a>
14
+ // <a class="ug-scrollspy__link" href="#section2">Section 2</a>
15
+ // </nav>
16
+ // ==========================================================================
17
+
18
+ @use "variables" as *;
19
+ @use "mixins" as *;
20
+
21
+ .ug-scrollspy {
22
+ position: sticky;
23
+ top: var(--ug-leading);
24
+ align-self: flex-start;
25
+
26
+ &__nav {
27
+ display: flex;
28
+ flex-direction: column;
29
+ list-style: none;
30
+ margin: 0;
31
+ padding: 0;
32
+ border-left: 2px solid $ug-light-gray;
33
+ }
34
+
35
+ &__link {
36
+ display: block;
37
+ padding: calc(var(--ug-leading) * 0.25) var(--ug-leading);
38
+ @include ug-font-size("sm");
39
+ @include ug-rhythm-line-height(1);
40
+ color: $ug-medium-gray;
41
+ text-decoration: none;
42
+ border-left: 2px solid transparent;
43
+ margin-left: -2px;
44
+ transition: color 0.15s, border-color 0.15s;
45
+
46
+ &:hover {
47
+ color: $ug-black;
48
+ }
49
+
50
+ &--active {
51
+ color: $ug-black;
52
+ @include ug-font-weight("bold");
53
+ border-left-color: $ug-black;
54
+ }
55
+ }
56
+
57
+ // Nested (indented sub-sections)
58
+ &__link--nested {
59
+ padding-left: calc(var(--ug-leading) * 1.5);
60
+ @include ug-font-size("xs");
61
+ }
62
+ }
@@ -0,0 +1,91 @@
1
+ // ==========================================================================
2
+ // Unigrid CSS Framework — Section Title (BEM)
3
+ //
4
+ // The signature black band with white heading spanning the full width.
5
+ // Padding aligned to the vertical rhythm (leading multiples).
6
+ //
7
+ // Block: .ug-section
8
+ // Elements: __title, __subtitle
9
+ // Modifiers: --brown, --red, --green, --blue, --light, --compact, --large
10
+ // ==========================================================================
11
+
12
+
13
+ @use "variables" as *;
14
+ @use "mixins" as *;
15
+
16
+ .ug-section {
17
+ width: 100%;
18
+ background-color: $ug-black;
19
+ color: $ug-white;
20
+ padding: var(--ug-leading) calc(var(--ug-leading) * 1.5);
21
+
22
+ // -- Title --
23
+ &__title {
24
+ @include ug-rhythm-font-size(1.6875);
25
+ @include ug-rhythm-line-height(1.5);
26
+ @include ug-font-weight("black");
27
+ letter-spacing: -0.01em;
28
+ margin: 0;
29
+ }
30
+
31
+ // -- Subtitle --
32
+ &__subtitle {
33
+ @include ug-font-size("sm");
34
+ @include ug-font-weight("light");
35
+ @include ug-rhythm-line-height(1);
36
+ opacity: 0.7;
37
+ margin: 0;
38
+ }
39
+
40
+ // ==============================
41
+ // Size Modifiers
42
+ // ==============================
43
+
44
+ &--compact {
45
+ padding: calc(var(--ug-leading) * 0.5) calc(var(--ug-leading) * 1.5);
46
+
47
+ .ug-section__title {
48
+ @include ug-rhythm-font-size(1.2);
49
+ @include ug-rhythm-line-height(1);
50
+ }
51
+ }
52
+
53
+ &--large {
54
+ padding: calc(var(--ug-leading) * 2) calc(var(--ug-leading) * 1.5);
55
+
56
+ .ug-section__title {
57
+ @include ug-rhythm-font-size(2.5);
58
+ @include ug-rhythm-line-height(2);
59
+ }
60
+ }
61
+
62
+ // ==============================
63
+ // Color Modifiers
64
+ // ==============================
65
+
66
+ &--brown { background-color: $ug-brown; }
67
+ &--red { background-color: $ug-red; }
68
+ &--green { background-color: $ug-green; }
69
+ &--blue { background-color: $ug-blue; }
70
+
71
+ &--light {
72
+ background-color: $ug-warm-gray;
73
+ color: $ug-black;
74
+ }
75
+
76
+ // ==============================
77
+ // Responsive
78
+ // ==============================
79
+
80
+ @include ug-breakpoint-down("md") {
81
+ padding: var(--ug-leading) var(--ug-leading);
82
+
83
+ &--large {
84
+ padding: calc(var(--ug-leading) * 1.5) var(--ug-leading);
85
+ }
86
+
87
+ &--compact {
88
+ padding: calc(var(--ug-leading) * 0.5) var(--ug-leading);
89
+ }
90
+ }
91
+ }