@graupl/core 1.0.0-beta.17 → 1.0.0-beta.19

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.
@@ -5,7 +5,19 @@
5
5
  @use "sass:map";
6
6
  @use "../theme/color/variables" as color;
7
7
 
8
- // A function to get the specific theme shades.
8
+ /// Get a specific color shade in a specific theme.
9
+ ///
10
+ /// $color and $shade both have special values for returning specific colours.
11
+ /// "transparent", "none", "inherit", and "initial" will all return their respective
12
+ /// default CSS values.
13
+ ///
14
+ /// If a shade cannot be found in a requested colour, it will fall back to the `_default` shade before returning `null`.
15
+ ///
16
+ /// @param {string} $color - The color.
17
+ /// @param {string|number} $shade [null] - The shade.
18
+ /// @param {string} $theme [active] - The theme.
19
+ ///
20
+ /// @return {string|null} The custom property pointing to the correct colour or null if none is found.
9
21
  @function get($color, $shade: null, $theme: active) {
10
22
  @if $shade == transparent or $color == transparent {
11
23
  @return transparent;
@@ -34,6 +46,12 @@
34
46
  @return null;
35
47
  }
36
48
 
49
+ /// Gets a full shade map of a specific color in a specific theme.
50
+ ///
51
+ /// @param {string} $color - The color.
52
+ /// @param {string} $theme [active] - The theme.
53
+ ///
54
+ /// @return {map|null} The shade map or null if none is found.
37
55
  @function get-color($color, $theme: active) {
38
56
  @if map.has-key(color.$themes, $theme, $color) {
39
57
  @return map.get(map.get(color.$themes, $theme), $color);
@@ -42,6 +60,11 @@
42
60
  @return null;
43
61
  }
44
62
 
63
+ /// Gets the names of all colours in a specific theme.
64
+ ///
65
+ /// @param {string} $theme [active] - The theme.
66
+ ///
67
+ /// @return {map} The map of color names.
45
68
  @function get-colors($theme: active) {
46
69
  @if map.has-key(color.$themes, $theme) {
47
70
  @return map.keys(map.get(color.$themes, $theme));
@@ -49,3 +72,33 @@
49
72
 
50
73
  @return ();
51
74
  }
75
+
76
+ /// Generates a map to tie different properties to color/shade values based on all colors in a specific theme.
77
+ @function generate-property-map($mapping, $theme: active) {
78
+ $theme-map: ();
79
+
80
+ @each $color in map.keys(map.get(color.$themes, $theme)) {
81
+ $map: ();
82
+
83
+ @each $prop, $shade in $mapping {
84
+ $map: map.merge(
85
+ $map,
86
+ (
87
+ $prop: (
88
+ color: $color,
89
+ shade: $shade,
90
+ ),
91
+ )
92
+ );
93
+ }
94
+
95
+ $theme-map: map.merge(
96
+ $theme-map,
97
+ (
98
+ $color: $map,
99
+ )
100
+ );
101
+ }
102
+
103
+ @return $theme-map;
104
+ }
@@ -103,6 +103,8 @@
103
103
  // <div class="bordered">This element has a border.</div>
104
104
 
105
105
  @use "../../defaults" as root-defaults;
106
+ @use "../../base/table/defaults" as table-defaults;
107
+ @use "../../base/table/variables" as table-variables;
106
108
  @use "../../functions/important";
107
109
  @use "../../mixins/layer" as *;
108
110
  @use "../../mixins/screen";
@@ -138,6 +140,23 @@
138
140
  $important: defaults.$use-important
139
141
  );
140
142
 
143
+ // Checks to see if the table.bordered is already in place, then gives the tables variables instead.
144
+ /* stylelint-disable scss/operator-no-newline-after -- Prettier wants to format it this way. */
145
+ @if #{table-defaults.$table-bordered-selector-base}#{table-defaults.$table-bordered-selector} ==
146
+ $selector
147
+ {
148
+ /* stylelint-enable scss/operator-no-newline-after */
149
+ @include utility.create-mapped(
150
+ #{table-defaults.$table-selector-base}#{table-defaults.$table-selector}#{$selector},
151
+ (
152
+ border-width: table-variables.$table-border-width,
153
+ border-radius: table-variables.$table-border-radius,
154
+ border-style: table-variables.$table-border-style,
155
+ ),
156
+ $important: defaults.$use-important
157
+ );
158
+ }
159
+
141
160
  // For each border width, create a class to apply the border width.
142
161
  @each $width, $value in defaults.$border-width-properties {
143
162
  // e.g. `.border-thick` or `.border-thin`
@@ -222,6 +241,24 @@
222
241
  $screen: $screen-name
223
242
  );
224
243
 
244
+ // Checks to see if the table.bordered is already in place, then gives the tables variables instead.
245
+ /* stylelint-disable scss/operator-no-newline-after -- Prettier wants to format it this way. */
246
+ @if #{table-defaults.$table-bordered-selector-base}#{table-defaults.$table-bordered-selector} ==
247
+ #{defaults.$selector-base}#{defaults.$default-border-selector}
248
+ {
249
+ /* stylelint-enable scss/operator-no-newline-after */
250
+ @include utility.create-mapped(
251
+ #{table-defaults.$table-selector-base}#{table-defaults.$table-selector}#{$selector},
252
+ (
253
+ border-width: table-variables.$table-border-width,
254
+ border-radius: table-variables.$table-border-radius,
255
+ border-style: table-variables.$table-border-style,
256
+ ),
257
+ $important: defaults.$use-important,
258
+ $screen: $screen-name
259
+ );
260
+ }
261
+
225
262
  // For each border width, create a class to apply the border width.
226
263
  @each $width, $value in defaults.$border-width-properties {
227
264
  // e.g. `.md:border-thick` or `.lg:border-thin`
@@ -313,6 +350,24 @@
313
350
  $theme: $theme-name
314
351
  );
315
352
 
353
+ // Checks to see if the table.bordered is already in place, then gives the tables variables instead.
354
+ /* stylelint-disable scss/operator-no-newline-after -- Prettier wants to format it this way. */
355
+ @if #{table-defaults.$table-bordered-selector-base}#{table-defaults.$table-bordered-selector} ==
356
+ #{defaults.$selector-base}#{defaults.$default-border-selector}
357
+ {
358
+ /* stylelint-enable scss/operator-no-newline-after */
359
+ @include utility.create-mapped(
360
+ #{table-defaults.$table-selector-base}#{table-defaults.$table-selector}#{$selector},
361
+ (
362
+ border-width: table-variables.$table-border-width,
363
+ border-radius: table-variables.$table-border-radius,
364
+ border-style: table-variables.$table-border-style,
365
+ ),
366
+ $important: defaults.$use-important,
367
+ $theme: $theme-name
368
+ );
369
+ }
370
+
316
371
  // For each border width, create a class to apply the border width.
317
372
  @each $width, $value in defaults.$border-width-properties {
318
373
  // e.g. `.dark:border-thick` or `.light:border-thin`
@@ -404,6 +459,24 @@
404
459
  $state: $state-name
405
460
  );
406
461
 
462
+ // Checks to see if the table.bordered is already in place, then gives the tables variables instead.
463
+ /* stylelint-disable scss/operator-no-newline-after -- Prettier wants to format it this way. */
464
+ @if #{table-defaults.$table-bordered-selector-base}#{table-defaults.$table-bordered-selector} ==
465
+ #{defaults.$selector-base}#{defaults.$default-border-selector}
466
+ {
467
+ /* stylelint-enable scss/operator-no-newline-after */
468
+ @include utility.create-mapped(
469
+ #{table-defaults.$table-selector-base}#{table-defaults.$table-selector}#{$selector},
470
+ (
471
+ border-width: table-variables.$table-border-width,
472
+ border-radius: table-variables.$table-border-radius,
473
+ border-style: table-variables.$table-border-style,
474
+ ),
475
+ $important: defaults.$use-important,
476
+ $state: $state-name
477
+ );
478
+ }
479
+
407
480
  // For each border width, create a class to apply the border width.
408
481
  @each $width, $value in defaults.$border-width-properties {
409
482
  // e.g. `.hover:border-thick` or `.focus:border-thin`
@@ -494,6 +567,24 @@
494
567
  $container: $container-name
495
568
  );
496
569
 
570
+ // Checks to see if the table.bordered is already in place, then gives the tables variables instead.
571
+ /* stylelint-disable scss/operator-no-newline-after -- Prettier wants to format it this way. */
572
+ @if #{table-defaults.$table-bordered-selector-base}#{table-defaults.$table-bordered-selector} ==
573
+ #{defaults.$selector-base}#{defaults.$default-border-selector}
574
+ {
575
+ /* stylelint-enable scss/operator-no-newline-after */
576
+ @include utility.create-mapped(
577
+ #{table-defaults.$table-selector-base}#{table-defaults.$table-selector}#{$selector},
578
+ (
579
+ border-width: table-variables.$table-border-width,
580
+ border-radius: table-variables.$table-border-radius,
581
+ border-style: table-variables.$table-border-style,
582
+ ),
583
+ $important: defaults.$use-important,
584
+ $container: $container-name
585
+ );
586
+ }
587
+
497
588
  // For each border width, create a class to apply the border width.
498
589
  @each $width, $value in defaults.$border-width-properties {
499
590
  // e.g. `.md:border-thick` or `.lg:border-thin`