@leftium/nimble.css 0.1.0 → 0.2.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,64 @@
1
+ // ==========================================================================
2
+ // nimble.css — Customizable Select
3
+ // Optional: styled <select> using appearance: base-select (progressive enhancement)
4
+ // Falls back to classic <select> in unsupported browsers
5
+ // ==========================================================================
6
+
7
+ @use 'config' as *;
8
+
9
+ @layer nimble.base {
10
+
11
+ @supports (appearance: base-select) {
12
+ :where(select),
13
+ :where(select)::picker(select) {
14
+ appearance: base-select;
15
+ }
16
+
17
+ // Picker icon (chevron)
18
+ :where(select)::picker-icon {
19
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 2l6 6 6-6'/%3E%3C/svg%3E");
20
+ transition: rotate 0.4s;
21
+ }
22
+
23
+ :where(select):open::picker-icon {
24
+ rotate: 180deg;
25
+ }
26
+
27
+ // Drop-down picker
28
+ :where(select)::picker(select) {
29
+ border: 1px solid var(#{$prefix}border);
30
+ border-radius: var(#{$prefix}radius);
31
+ background-color: var(#{$prefix}surface-1);
32
+ padding: 0.25em;
33
+ // Fade in/out animation
34
+ opacity: 0;
35
+ transition: opacity 0.2s, overlay 0.2s allow-discrete, display 0.2s allow-discrete;
36
+ }
37
+
38
+ :where(select):open::picker(select) {
39
+ opacity: 1;
40
+ }
41
+
42
+ @starting-style {
43
+ :where(select):open::picker(select) {
44
+ opacity: 0;
45
+ }
46
+ }
47
+
48
+ // Options inside the picker
49
+ :where(select) option {
50
+ padding: 0.5em 0.75em;
51
+ border-radius: var(#{$prefix}radius);
52
+ transition: background-color 0.15s;
53
+ }
54
+
55
+ :where(select) option:hover {
56
+ background-color: var(#{$prefix}surface-2);
57
+ }
58
+
59
+ :where(select) option:checked {
60
+ font-weight: 600;
61
+ }
62
+ }
63
+
64
+ }
@@ -7,15 +7,18 @@
7
7
  @use 'sass:string';
8
8
  @use 'config' as *;
9
9
 
10
- // Heading scale: size and line-height
10
+ // Heading scale: size, line-height, and top margin
11
+ // h1 has no top margin (page title / first heading).
12
+ // h2–h6 always carry top margin so they breathe above any preceding content,
13
+ // regardless of DOM nesting (first-child of section, etc.).
11
14
  // Spec §8.3
12
15
  $_heading-scale: (
13
- h1: (size: 2rem, lh: 1.1),
14
- h2: (size: 1.75rem, lh: 1.15),
15
- h3: (size: 1.5rem, lh: 1.2),
16
- h4: (size: 1.25rem, lh: 1.3),
17
- h5: (size: 1.125rem, lh: 1.4),
18
- h6: (size: 1rem, lh: 1.5),
16
+ h1: (size: 2rem, lh: 1.1, mt: 0),
17
+ h2: (size: 1.75rem, lh: 1.15, mt: 2rem),
18
+ h3: (size: 1.5rem, lh: 1.2, mt: 1.5rem),
19
+ h4: (size: 1.25rem, lh: 1.3, mt: 1.5rem),
20
+ h5: (size: 1.125rem, lh: 1.4, mt: 1.5rem),
21
+ h6: (size: 1rem, lh: 1.5, mt: 1.5rem),
19
22
  );
20
23
 
21
24
  // Phone breakpoint heading overrides
@@ -34,7 +37,7 @@ $_heading-phone: (
34
37
  #{$tag} {
35
38
  font-size: map.get($vals, size);
36
39
  line-height: map.get($vals, lh);
37
- margin-top: 0;
40
+ margin-top: map.get($vals, mt);
38
41
  margin-bottom: var(#{$prefix}spacing);
39
42
  font-weight: 700;
40
43
  text-wrap: balance;
@@ -59,10 +62,7 @@ $_heading-phone: (
59
62
  margin-bottom: var(#{$prefix}spacing);
60
63
  }
61
64
 
62
- // Extra top margin on headings that follow block content
63
- :where(p, ul, ol, dl, blockquote, pre, table, figure, form) + :is(h1, h2, h3, h4, h5, h6) {
64
- margin-top: calc(var(#{$prefix}spacing) * 2);
65
- }
65
+
66
66
 
67
67
  // ----- Lists -----
68
68
 
@@ -103,7 +103,7 @@ $_heading-phone: (
103
103
  :where(blockquote) cite {
104
104
  font-style: normal;
105
105
  font-size: 0.9em;
106
- color: var(#{$prefix}text-2);
106
+ color: color-mix(in oklch, var(#{$prefix}text), transparent 40%);
107
107
  }
108
108
 
109
109
  // ----- Horizontal Rule -----
@@ -1,11 +1,10 @@
1
1
  // ==========================================================================
2
2
  // nimble.css — Base Sub-bundle
3
- // Reset + colors + document + typography — the classless core
3
+ // Colors + document + typography (no reset use nimble-reset for that)
4
4
  // ==========================================================================
5
5
 
6
6
  @use 'config' as *;
7
7
  @use 'layers-base';
8
- @use 'reset';
9
8
  @use 'colors';
10
9
  @use 'document';
11
10
  @use 'typography';
@@ -0,0 +1,30 @@
1
+ // ==========================================================================
2
+ // nimble.css — Core Entry Point
3
+ // Everything except progress, meter, and select add-ons
4
+ // ==========================================================================
5
+
6
+ @use 'config' as *;
7
+
8
+ // Layer order declaration — emitted first in CSS output.
9
+ // Lower layers lose to higher layers in cascade.
10
+ @use 'layers';
11
+
12
+ // Phase 2: Core
13
+ @use 'reset';
14
+ @use 'colors';
15
+ @use 'document';
16
+ @use 'typography';
17
+
18
+ // Phase 3: Elements
19
+ @use 'links';
20
+ @use 'buttons';
21
+ @use 'forms';
22
+ @use 'tables';
23
+ @use 'code';
24
+ @use 'media';
25
+ @use 'details';
26
+ @use 'dialog';
27
+ @use 'print';
28
+
29
+ // Phase 4: Utilities
30
+ @use 'utilities';
@@ -0,0 +1,8 @@
1
+ // ==========================================================================
2
+ // nimble.css — Meter Sub-bundle
3
+ // Add to nimble.css for styled <meter> elements
4
+ // ==========================================================================
5
+
6
+ @use 'config' as *;
7
+ @use 'layers-base';
8
+ @use 'meter';
@@ -0,0 +1,8 @@
1
+ // ==========================================================================
2
+ // nimble.css — Progress Sub-bundle
3
+ // Add to nimble.css for styled <progress> elements
4
+ // ==========================================================================
5
+
6
+ @use 'config' as *;
7
+ @use 'layers-base';
8
+ @use 'progress';
@@ -0,0 +1,8 @@
1
+ // ==========================================================================
2
+ // nimble.css — Customizable Select Sub-bundle
3
+ // Add to nimble.css for styled <select> using appearance: base-select
4
+ // ==========================================================================
5
+
6
+ @use 'config' as *;
7
+ @use 'layers-base';
8
+ @use 'select';
package/src/nimble.scss CHANGED
@@ -1,6 +1,6 @@
1
1
  // ==========================================================================
2
2
  // nimble.css — Entry Point
3
- // A minimal class/classless CSS library
3
+ // Everything: core + progress, meter, and select
4
4
  // ==========================================================================
5
5
 
6
6
  @use 'config' as *;
@@ -26,5 +26,10 @@
26
26
  @use 'dialog';
27
27
  @use 'print';
28
28
 
29
+ // Phase 3: Optional extras
30
+ @use 'progress';
31
+ @use 'meter';
32
+ @use 'select';
33
+
29
34
  // Phase 4: Utilities
30
35
  @use 'utilities';