@keenmate/pure-css 1.0.0-rc01

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,292 @@
1
+ // ============================================================================
2
+ // NATIVE GRID SYSTEM
3
+ // ============================================================================
4
+ // Flexbox-based grid with percentage and fraction columns.
5
+ // (Replaces the legacy PureCSS `.pure-g` / `.pure-u-*` grid — Pure v3.)
6
+ @use 'variables/index' as *;
7
+ //
8
+ // Naming convention:
9
+ // - .pa-row → flex container
10
+ // - .pa-col → auto-equal width column
11
+ // - .pa-col-{n} → percentage width in 5% increments (5, 10, 15... 100)
12
+ // - .pa-col-{x}-{y} → fraction width (1-2, 1-3, 2-3, 1-4, 3-4, 1-6, 5-6, etc.)
13
+ // - .pa-col-{bp}-{n} → responsive variants (sm, md, lg, xl)
14
+ // - .pa-offset-{n} → left margin offset
15
+ // ============================================================================
16
+
17
+ @use "sass:math";
18
+
19
+ // Configuration (note: $grid-breakpoints is in variables/_spacing.scss for shared use)
20
+ $grid-gutter: 0.8rem !default; // 8px gutter on each side (with 10px base), total gap = 16px
21
+
22
+ // Column sizes - 5% increments (n*5, n=1-20)
23
+ $grid-columns-5: (5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100);
24
+
25
+ // Column sizes - fractions (for unintuitive percentages)
26
+ $grid-columns-fractions: (
27
+ '1-2': 50%,
28
+ '1-3': 33.333%,
29
+ '2-3': 66.667%,
30
+ '1-4': 25%,
31
+ '3-4': 75%,
32
+ '1-5': 20%,
33
+ '2-5': 40%,
34
+ '3-5': 60%,
35
+ '4-5': 80%,
36
+ '1-6': 16.667%,
37
+ '5-6': 83.333%,
38
+ '1-12': 8.333%,
39
+ '5-12': 41.667%,
40
+ '7-12': 58.333%,
41
+ '11-12': 91.667%
42
+ );
43
+
44
+ // ============================================================================
45
+ // ROW (Container)
46
+ // ============================================================================
47
+ .pa-row {
48
+ display: flex;
49
+ flex-wrap: wrap;
50
+ margin-inline: -$grid-gutter; // RTL: flips automatically
51
+ row-gap: $grid-gutter; // Vertical gap when columns wrap (half the horizontal gutter total)
52
+
53
+ // Nested rows reset margins
54
+ .pa-row {
55
+ margin-inline: 0;
56
+ }
57
+ }
58
+
59
+ // Row modifiers
60
+ .pa-row--no-gutter {
61
+ margin-inline: 0;
62
+
63
+ > [class*="pa-col"] {
64
+ padding-inline: 0;
65
+ }
66
+ }
67
+
68
+ .pa-row--center {
69
+ justify-content: center;
70
+ }
71
+
72
+ .pa-row--end {
73
+ justify-content: flex-end;
74
+ }
75
+
76
+ .pa-row--between {
77
+ justify-content: space-between;
78
+ }
79
+
80
+ .pa-row--around {
81
+ justify-content: space-around;
82
+ }
83
+
84
+ .pa-row--stretch {
85
+ align-items: stretch;
86
+ }
87
+
88
+ .pa-row--top {
89
+ align-items: flex-start;
90
+ }
91
+
92
+ .pa-row--middle {
93
+ align-items: center;
94
+ }
95
+
96
+ .pa-row--bottom {
97
+ align-items: flex-end;
98
+ }
99
+
100
+ .pa-row--same-height {
101
+ > [class*="pa-col"] {
102
+ > .pa-card {
103
+ height: 100%;
104
+ }
105
+ }
106
+ }
107
+
108
+ // ============================================================================
109
+ // COLUMN (Base)
110
+ // ============================================================================
111
+ .pa-col {
112
+ flex: 1;
113
+ padding-inline: $grid-gutter; // RTL: flips automatically
114
+ min-width: 0; // Prevent content overflow
115
+ }
116
+
117
+ // Auto-width column
118
+ .pa-col-auto {
119
+ flex: 0 0 auto;
120
+ width: auto;
121
+ padding-inline: $grid-gutter;
122
+ }
123
+
124
+ // ============================================================================
125
+ // PERCENTAGE COLUMNS (Base - 5% increments)
126
+ // ============================================================================
127
+ @each $size in $grid-columns-5 {
128
+ .pa-col-#{$size} {
129
+ flex: 0 0 math.percentage(math.div($size, 100));
130
+ max-width: math.percentage(math.div($size, 100));
131
+ padding-inline: $grid-gutter; // RTL: flips automatically
132
+ min-width: 0; // Prevent content overflow
133
+ }
134
+ }
135
+
136
+ // ============================================================================
137
+ // FRACTION COLUMNS (Base - intuitive naming)
138
+ // ============================================================================
139
+ @each $name, $width in $grid-columns-fractions {
140
+ .pa-col-#{$name} {
141
+ flex: 0 0 $width;
142
+ max-width: $width;
143
+ padding-inline: $grid-gutter; // RTL: flips automatically
144
+ min-width: 0; // Prevent content overflow
145
+ }
146
+ }
147
+
148
+ // ============================================================================
149
+ // OFFSETS (Base - 5% increments)
150
+ // ============================================================================
151
+ @each $size in $grid-columns-5 {
152
+ @if $size < 100 {
153
+ .pa-offset-#{$size} {
154
+ margin-inline-start: math.percentage(math.div($size, 100)); // RTL: flips to margin-right
155
+ }
156
+ }
157
+ }
158
+
159
+ // ============================================================================
160
+ // RESPONSIVE COLUMNS & OFFSETS (Container-query based)
161
+ // Requires a containment context ancestor: .pa-layout__main (automatic) or .pa-cq
162
+ // ============================================================================
163
+ @each $bp, $min-width in $grid-breakpoints {
164
+ @container (min-width: #{$min-width}) {
165
+ // Responsive percentage columns (5% increments)
166
+ @each $size in $grid-columns-5 {
167
+ .pa-col-#{$bp}-#{$size} {
168
+ flex: 0 0 math.percentage(math.div($size, 100));
169
+ max-width: math.percentage(math.div($size, 100));
170
+ padding-inline: $grid-gutter; // RTL: flips automatically
171
+ min-width: 0; // Prevent content overflow
172
+ }
173
+ }
174
+
175
+ // Responsive fraction columns
176
+ @each $name, $width in $grid-columns-fractions {
177
+ .pa-col-#{$bp}-#{$name} {
178
+ flex: 0 0 $width;
179
+ max-width: $width;
180
+ padding-inline: $grid-gutter; // RTL: flips automatically
181
+ min-width: 0; // Prevent content overflow
182
+ }
183
+ }
184
+
185
+ // Responsive offsets (5% increments)
186
+ @each $size in $grid-columns-5 {
187
+ @if $size < 100 {
188
+ .pa-offset-#{$bp}-#{$size} {
189
+ margin-inline-start: math.percentage(math.div($size, 100)); // RTL: flips to margin-right
190
+ }
191
+ }
192
+ }
193
+
194
+ // Responsive auto column
195
+ .pa-col-#{$bp}-auto {
196
+ flex: 0 0 auto;
197
+ width: auto;
198
+ }
199
+ }
200
+ }
201
+
202
+ // ============================================================================
203
+ // COLUMN MODIFIERS
204
+ // ============================================================================
205
+ .pa-col--no-padding {
206
+ padding-inline: 0;
207
+ }
208
+
209
+ .pa-col--grow {
210
+ flex-grow: 1;
211
+ }
212
+
213
+ .pa-col--shrink {
214
+ flex-shrink: 1;
215
+ }
216
+
217
+ // ============================================================================
218
+ // VISIBILITY HELPERS (Responsive)
219
+ // ============================================================================
220
+ .pa-hide {
221
+ display: none !important;
222
+ }
223
+
224
+ .pa-show {
225
+ display: block !important;
226
+ }
227
+
228
+ @each $bp, $min-width in $grid-breakpoints {
229
+ // Hide at breakpoint and up
230
+ @media (min-width: $min-width) {
231
+ .pa-hide-#{$bp} {
232
+ display: none !important;
233
+ }
234
+
235
+ .pa-show-#{$bp} {
236
+ display: block !important;
237
+ }
238
+ }
239
+
240
+ // Hide below breakpoint
241
+ @media (max-width: $min-width - 1px) {
242
+ .pa-hide-below-#{$bp} {
243
+ display: none !important;
244
+ }
245
+
246
+ .pa-show-below-#{$bp} {
247
+ display: block !important;
248
+ }
249
+ }
250
+ }
251
+
252
+ // ============================================================================
253
+ // REMOVE BOTTOM PADDING IN CARDS
254
+ // ============================================================================
255
+ // Remove bottom padding from grid columns inside cards to avoid conflicts
256
+ .pa-card__body .pa-row > [class*="pa-col"] {
257
+ padding-bottom: 0;
258
+ }
259
+
260
+ // ============================================================================
261
+ // AUTO-STACK ON MOBILE
262
+ // ============================================================================
263
+ // Base percentage/fraction columns auto-stack to 100% on mobile
264
+ // Use explicit responsive classes (pa-col-sm-*, pa-col-md-*) to override
265
+ @media (max-width: $mobile-breakpoint) {
266
+ // Stack percentage columns
267
+ @each $size in $grid-columns-5 {
268
+ @if $size < 100 {
269
+ .pa-col-#{$size} {
270
+ flex: 0 0 100%;
271
+ max-width: 100%;
272
+ }
273
+ }
274
+ }
275
+
276
+ // Stack fraction columns
277
+ @each $name, $width in $grid-columns-fractions {
278
+ .pa-col-#{$name} {
279
+ flex: 0 0 100%;
280
+ max-width: 100%;
281
+ }
282
+ }
283
+
284
+ // Reset base offsets when stacking
285
+ @each $size in $grid-columns-5 {
286
+ @if $size < 100 {
287
+ .pa-offset-#{$size} {
288
+ margin-inline-start: 0;
289
+ }
290
+ }
291
+ }
292
+ }
@@ -0,0 +1,15 @@
1
+ // @keenmate/pure-css — theming contract only
2
+ // ============================================================================
3
+ // Emits nothing but the `:root` custom-property defaults (--base-* + derived
4
+ // --pa-* + light alert vars). Link this when you only need the variables — to
5
+ // theme embedded web/svelte components, or as the base a theme override layers
6
+ // on top of — without pulling in the grid or utility classes.
7
+ // ============================================================================
8
+
9
+ @use 'base-css-variables' as bcv;
10
+
11
+ :root {
12
+ @include bcv.output-base-css-variables;
13
+ @include bcv.output-pa-css-variables;
14
+ @include bcv.output-pa-alert-variables-light;
15
+ }
@@ -0,0 +1,7 @@
1
+ // @keenmate/pure-css — grid only
2
+ // The native flexbox grid: .pa-row / .pa-col (percentage + fraction columns,
3
+ // container-query responsive variants, offsets, visibility helpers).
4
+ // No variables, no utilities — link alongside base.css when you want layout
5
+ // without the full bundle.
6
+
7
+ @use 'pa-grid';
@@ -0,0 +1,28 @@
1
+ // @keenmate/pure-css — full foundation bundle
2
+ // ============================================================================
3
+ // The KeenMate CSS foundation, extracted from @keenmate/pure-admin-core so it
4
+ // can be consumed on its own (docs sites, standalone pages, non-admin portals)
5
+ // and so pure-admin-core, themes and any web/svelte component share ONE
6
+ // theming contract: the `--base-*` (and derived `--pa-*`) custom properties.
7
+ //
8
+ // This bundle emits:
9
+ // 1. `:root` defaults for every --base-*/--pa-* variable (light values)
10
+ // 2. the native flexbox grid (.pa-row / .pa-col)
11
+ // 3. the utility classes (.m-*, .d-flex, .w-*, …)
12
+ //
13
+ // A *theme* is just an override of the `$base-*` SCSS variables (or the
14
+ // `--base-*` custom properties) — everything else re-derives. See README.
15
+ // ============================================================================
16
+
17
+ @use 'base-css-variables' as bcv;
18
+ @use 'pa-grid';
19
+ @use 'utilities';
20
+
21
+ // CSS variable defaults at :root. Themes ship their own values by overriding
22
+ // $base-* before importing base-css-variables; this only affects the unthemed
23
+ // bundle and the FOUC window before a theme stylesheet resolves.
24
+ :root {
25
+ @include bcv.output-base-css-variables;
26
+ @include bcv.output-pa-css-variables;
27
+ @include bcv.output-pa-alert-variables-light;
28
+ }