@nordcode/ui 1.3.2 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## 2.0.1 (2025-05-04)
2
+
3
+ ### improvements
4
+
5
+ - change theme default surface to --color-surface-base instead of transparent to fix contrast issue over colored backgrounds
6
+
7
+ ## 2.0.0 (2025-05-02)
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ Rename tokens:
12
+
13
+ --control-height-base: Used to be --button-height-base. Renamed for clarity, because it also affects inputs.
14
+ --control-height-small: Used to be --button-height-small. Renamed for clarity, because it also affects inputs.
15
+
16
+ Add new design tokens:
17
+
18
+ --control-spacing-minimal
19
+ --control-spacing-tiny
20
+ --control-spacing-nearest
21
+ --control-spacing-near
22
+ --control-spacing-base
23
+ --control-spacing-far
24
+ --control-spacing-farthest
25
+
26
+ These tokens are `em` based and are used to style the control elements, mostly inputs and buttons, but also other styled elements like your lists and details. Changing the spacings can be used for a more dense or more spacious layout.
27
+
1
28
  ## 1.3.2 (2025-04-18)
2
29
 
3
30
  ### improvements
package/out/bundle.css CHANGED
@@ -211,12 +211,10 @@
211
211
  }
212
212
 
213
213
  :where(html) {
214
- --button-height-base: 2.5rem;
215
- --button-height-small: 2rem;
214
+ --control-height-base: var(--button-height-base);
215
+ --control-height-small: var(--button-height-small);
216
216
  --font-family-link: var(--font-family-default);
217
217
  --font-family-button: var(--font-family-default);
218
- --input-height-base: 2.5rem;
219
- --input-height-small: 2rem;
220
218
  }
221
219
  }
222
220
 
@@ -331,7 +329,7 @@
331
329
 
332
330
  :where(:not(:active):focus-visible) {
333
331
  outline: var(--border-width-medium) solid var(--color-brand-primary-base);
334
- outline-offset: .5em;
332
+ outline-offset: var(--control-spacing-near, .5em);
335
333
  }
336
334
 
337
335
  :where(:focus:not(:focus-visible)) {
@@ -437,14 +435,14 @@
437
435
 
438
436
  :where(dd):not(:last-of-type) {
439
437
  border-bottom: var(--border-width-thin) solid var(--color-border-muted);
440
- padding-block-end: .5lh;
438
+ padding-block-end: var(--control-spacing-base, .75em);
441
439
  }
442
440
 
443
441
  :where(dl:not([class]), .nc-description-list) {
444
442
  overflow-wrap: anywhere;
445
- grid-template-columns: .25fr .75fr;
446
443
  align-items: flex-start;
447
- row-gap: .5lh;
444
+ row-gap: var(--control-spacing-base, .75em);
445
+ grid-template-columns: .25fr .75fr;
448
446
  inline-size: 100%;
449
447
  max-inline-size: 100%;
450
448
  display: grid;
@@ -466,7 +464,7 @@
466
464
 
467
465
  :where(dt):not(:last-of-type) {
468
466
  border-bottom: var(--border-width-thin) solid var(--color-border-muted);
469
- padding-block-end: .5lh;
467
+ padding-block-end: var(--control-spacing-base, .75em);
470
468
  }
471
469
 
472
470
  :where(dd) {
@@ -497,13 +495,13 @@
497
495
  :where(figcaption) {
498
496
  color: var(--color-surface-subtle);
499
497
  background-color: var(--color-text-base);
500
- padding: .35em .5em;
498
+ padding: var(--control-spacing-nearest, .375em) var(--control-spacing-base, .75em);
501
499
  display: block;
502
500
  }
503
501
 
504
502
  :where(details) {
505
- --p-x-details: 1em;
506
- --p-y-details: 1em;
503
+ --p-x-details: var(--control-spacing-far, 1em);
504
+ --p-y-details: var(--control-spacing-far, 1em);
507
505
  --b-r-details: var(--border-radius-medium);
508
506
  background-color: var(--color-surface-muted);
509
507
  border-radius: var(--b-r-details);
@@ -535,7 +533,7 @@
535
533
  font-size: var(--font-size-large);
536
534
  margin-inline: 0;
537
535
  padding: 0;
538
- padding-inline-start: 1em;
536
+ padding-inline-start: var(--control-spacing-far, 1em);
539
537
  position: relative;
540
538
  }
541
539
 
@@ -562,7 +560,7 @@
562
560
 
563
561
  :is(.note, blockquote) cite:before {
564
562
  content: "—";
565
- margin-inline-end: .5em;
563
+ margin-inline-end: var(--control-spacing-near, .5em);
566
564
  }
567
565
 
568
566
  cite {
@@ -625,7 +623,7 @@
625
623
  :where(a, .nc-link) {
626
624
  color: inherit;
627
625
  font-family: var(--font-family-link);
628
- text-underline-offset: .35em;
626
+ text-underline-offset: var(--control-spacing-nearest, .375em);
629
627
  font-weight: var(--font-weight-default);
630
628
  cursor: pointer;
631
629
  letter-spacing: var(--tracking-tight);
@@ -672,17 +670,18 @@
672
670
  }
673
671
 
674
672
  :where(del, ins, mark, code, kbd, var) {
673
+ padding-inline: var(--control-spacing-tiny, .25em);
675
674
  border-radius: var(--border-radius-small);
676
675
  line-height: inherit;
677
676
  -webkit-box-decoration-break: clone;
678
677
  box-decoration-break: clone;
679
- padding-inline: .25em;
680
678
  }
681
679
 
682
680
  :where(code, kbd, var) {
683
681
  font-family: var(--font-family-mono);
684
682
  letter-spacing: 0;
685
683
  font-weight: var(--font-weight-default);
684
+ padding-block: var(--control-spacing-minimal, .125em);
686
685
  -webkit-hyphens: none;
687
686
  hyphens: none;
688
687
  tab-size: 4;
@@ -690,7 +689,6 @@
690
689
  word-spacing: normal;
691
690
  overflow-wrap: normal;
692
691
  max-inline-size: fit-content;
693
- padding-block: .2em;
694
692
  font-style: normal;
695
693
  }
696
694
 
@@ -711,13 +709,13 @@
711
709
  }
712
710
 
713
711
  :where(pre) {
712
+ padding: var(--control-spacing-far, 1em);
714
713
  inline-size: 100%;
715
714
  color: var(--color-text-base);
716
715
  border: var(--border-width-medium) solid var(--color-border-base);
717
716
  border-radius: var(--border-radius-medium);
718
717
  background: var(--color-surface-subtle);
719
718
  -webkit-overflow-scrolling: touch;
720
- padding: 1em;
721
719
  overflow-x: auto;
722
720
  }
723
721
 
@@ -755,10 +753,10 @@
755
753
  }
756
754
 
757
755
  :where(td, th) {
756
+ padding: var(--control-spacing-near, .5em);
758
757
  line-height: var(--line-height-small);
759
758
  white-space: nowrap;
760
759
  font-variant-numeric: tabular-nums;
761
- padding: .5em;
762
760
  }
763
761
 
764
762
  :where(td), :where(thead th) {
@@ -828,11 +826,11 @@
828
826
  }
829
827
 
830
828
  :where(ul, ol) {
831
- padding-inline-start: 1em;
829
+ padding-inline-start: var(--control-spacing-farthest, 1.5em);
832
830
  }
833
831
 
834
832
  :where(li + li), :where(li > :is(ul, ol)) {
835
- margin-block-start: .5em;
833
+ margin-block-start: var(--control-spacing-near, .5em);
836
834
  }
837
835
 
838
836
  @supports (font-variant-position: sub) {
@@ -866,7 +864,7 @@
866
864
  content: close-quote;
867
865
  content: "“";
868
866
  content: "”";
869
- margin-inline-start: -.5em;
867
+ margin-inline-start: calc(-1 * var(--control-spacing-near, .5em));
870
868
  }
871
869
 
872
870
  :where(.quoted p) {
@@ -1213,7 +1211,7 @@
1213
1211
  * {
1214
1212
  --text: var(--color-text-muted);
1215
1213
  --color: var(--color-text-muted);
1216
- --surface: transparent;
1214
+ --surface: var(--color-surface-base);
1217
1215
  --border: var(--color-border-muted);
1218
1216
  --text-hover: var(--color-text-on-emphasis);
1219
1217
  --color-hover: var(--color-text-on-emphasis);
@@ -1246,7 +1244,7 @@
1246
1244
  .-neutral {
1247
1245
  --text: var(--color-text-muted);
1248
1246
  --color: var(--color-text-muted);
1249
- --surface: transparent;
1247
+ --surface: var(--color-surface-base);
1250
1248
  --border: var(--color-border-muted);
1251
1249
  --text-hover: var(--color-text-on-emphasis);
1252
1250
  --color-hover: var(--color-text-on-emphasis);
@@ -111,7 +111,7 @@
111
111
 
112
112
  :where(:not(:active):focus-visible) {
113
113
  outline: var(--border-width-medium) solid var(--color-brand-primary-base);
114
- outline-offset: .5em;
114
+ outline-offset: var(--control-spacing-near, .5em);
115
115
  }
116
116
 
117
117
  :where(:focus:not(:focus-visible)) {
@@ -217,14 +217,14 @@
217
217
 
218
218
  :where(dd):not(:last-of-type) {
219
219
  border-bottom: var(--border-width-thin) solid var(--color-border-muted);
220
- padding-block-end: .5lh;
220
+ padding-block-end: var(--control-spacing-base, .75em);
221
221
  }
222
222
 
223
223
  :where(dl:not([class]), .nc-description-list) {
224
224
  overflow-wrap: anywhere;
225
- grid-template-columns: .25fr .75fr;
226
225
  align-items: flex-start;
227
- row-gap: .5lh;
226
+ row-gap: var(--control-spacing-base, .75em);
227
+ grid-template-columns: .25fr .75fr;
228
228
  inline-size: 100%;
229
229
  max-inline-size: 100%;
230
230
  display: grid;
@@ -246,7 +246,7 @@
246
246
 
247
247
  :where(dt):not(:last-of-type) {
248
248
  border-bottom: var(--border-width-thin) solid var(--color-border-muted);
249
- padding-block-end: .5lh;
249
+ padding-block-end: var(--control-spacing-base, .75em);
250
250
  }
251
251
 
252
252
  :where(dd) {
@@ -277,13 +277,13 @@
277
277
  :where(figcaption) {
278
278
  color: var(--color-surface-subtle);
279
279
  background-color: var(--color-text-base);
280
- padding: .35em .5em;
280
+ padding: var(--control-spacing-nearest, .375em) var(--control-spacing-base, .75em);
281
281
  display: block;
282
282
  }
283
283
 
284
284
  :where(details) {
285
- --p-x-details: 1em;
286
- --p-y-details: 1em;
285
+ --p-x-details: var(--control-spacing-far, 1em);
286
+ --p-y-details: var(--control-spacing-far, 1em);
287
287
  --b-r-details: var(--border-radius-medium);
288
288
  background-color: var(--color-surface-muted);
289
289
  border-radius: var(--b-r-details);
@@ -315,7 +315,7 @@
315
315
  font-size: var(--font-size-large);
316
316
  margin-inline: 0;
317
317
  padding: 0;
318
- padding-inline-start: 1em;
318
+ padding-inline-start: var(--control-spacing-far, 1em);
319
319
  position: relative;
320
320
  }
321
321
 
@@ -342,7 +342,7 @@
342
342
 
343
343
  :is(.note, blockquote) cite:before {
344
344
  content: "—";
345
- margin-inline-end: .5em;
345
+ margin-inline-end: var(--control-spacing-near, .5em);
346
346
  }
347
347
 
348
348
  cite {
@@ -405,7 +405,7 @@
405
405
  :where(a, .nc-link) {
406
406
  color: inherit;
407
407
  font-family: var(--font-family-link);
408
- text-underline-offset: .35em;
408
+ text-underline-offset: var(--control-spacing-nearest, .375em);
409
409
  font-weight: var(--font-weight-default);
410
410
  cursor: pointer;
411
411
  letter-spacing: var(--tracking-tight);
@@ -452,17 +452,18 @@
452
452
  }
453
453
 
454
454
  :where(del, ins, mark, code, kbd, var) {
455
+ padding-inline: var(--control-spacing-tiny, .25em);
455
456
  border-radius: var(--border-radius-small);
456
457
  line-height: inherit;
457
458
  -webkit-box-decoration-break: clone;
458
459
  box-decoration-break: clone;
459
- padding-inline: .25em;
460
460
  }
461
461
 
462
462
  :where(code, kbd, var) {
463
463
  font-family: var(--font-family-mono);
464
464
  letter-spacing: 0;
465
465
  font-weight: var(--font-weight-default);
466
+ padding-block: var(--control-spacing-minimal, .125em);
466
467
  -webkit-hyphens: none;
467
468
  hyphens: none;
468
469
  tab-size: 4;
@@ -470,7 +471,6 @@
470
471
  word-spacing: normal;
471
472
  overflow-wrap: normal;
472
473
  max-inline-size: fit-content;
473
- padding-block: .2em;
474
474
  font-style: normal;
475
475
  }
476
476
 
@@ -491,13 +491,13 @@
491
491
  }
492
492
 
493
493
  :where(pre) {
494
+ padding: var(--control-spacing-far, 1em);
494
495
  inline-size: 100%;
495
496
  color: var(--color-text-base);
496
497
  border: var(--border-width-medium) solid var(--color-border-base);
497
498
  border-radius: var(--border-radius-medium);
498
499
  background: var(--color-surface-subtle);
499
500
  -webkit-overflow-scrolling: touch;
500
- padding: 1em;
501
501
  overflow-x: auto;
502
502
  }
503
503
 
@@ -535,10 +535,10 @@
535
535
  }
536
536
 
537
537
  :where(td, th) {
538
+ padding: var(--control-spacing-near, .5em);
538
539
  line-height: var(--line-height-small);
539
540
  white-space: nowrap;
540
541
  font-variant-numeric: tabular-nums;
541
- padding: .5em;
542
542
  }
543
543
 
544
544
  :where(td), :where(thead th) {
@@ -608,11 +608,11 @@
608
608
  }
609
609
 
610
610
  :where(ul, ol) {
611
- padding-inline-start: 1em;
611
+ padding-inline-start: var(--control-spacing-farthest, 1.5em);
612
612
  }
613
613
 
614
614
  :where(li + li), :where(li > :is(ul, ol)) {
615
- margin-block-start: .5em;
615
+ margin-block-start: var(--control-spacing-near, .5em);
616
616
  }
617
617
 
618
618
  @supports (font-variant-position: sub) {
@@ -646,7 +646,7 @@
646
646
  content: close-quote;
647
647
  content: "“";
648
648
  content: "”";
649
- margin-inline-start: -.5em;
649
+ margin-inline-start: calc(-1 * var(--control-spacing-near, .5em));
650
650
  }
651
651
 
652
652
  :where(.quoted p) {
@@ -993,7 +993,7 @@
993
993
  * {
994
994
  --text: var(--color-text-muted);
995
995
  --color: var(--color-text-muted);
996
- --surface: transparent;
996
+ --surface: var(--color-surface-base);
997
997
  --border: var(--color-border-muted);
998
998
  --text-hover: var(--color-text-on-emphasis);
999
999
  --color-hover: var(--color-text-on-emphasis);
@@ -1026,7 +1026,7 @@
1026
1026
  .-neutral {
1027
1027
  --text: var(--color-text-muted);
1028
1028
  --color: var(--color-text-muted);
1029
- --surface: transparent;
1029
+ --surface: var(--color-surface-base);
1030
1030
  --border: var(--color-border-muted);
1031
1031
  --text-hover: var(--color-text-on-emphasis);
1032
1032
  --color-hover: var(--color-text-on-emphasis);