bulma-rails 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/bulma.scss +1 -1
  3. data/app/assets/stylesheets/sass/elements/button.scss +6 -0
  4. data/app/assets/stylesheets/sass/elements/image.scss +4 -2
  5. data/app/assets/stylesheets/sass/elements/title.scss +4 -2
  6. data/app/assets/stylesheets/sass/form/input-textarea.scss +3 -1
  7. data/app/assets/stylesheets/sass/form/shared.scss +7 -5
  8. data/app/assets/stylesheets/sass/helpers/aspect-ratio.scss +5 -3
  9. data/app/assets/stylesheets/sass/helpers/border.scss +1 -1
  10. data/app/assets/stylesheets/sass/helpers/color.scss +40 -40
  11. data/app/assets/stylesheets/sass/helpers/flexbox.scss +7 -7
  12. data/app/assets/stylesheets/sass/helpers/float.scss +7 -7
  13. data/app/assets/stylesheets/sass/helpers/gap.scss +3 -3
  14. data/app/assets/stylesheets/sass/helpers/other.scss +4 -4
  15. data/app/assets/stylesheets/sass/helpers/overflow.scss +4 -4
  16. data/app/assets/stylesheets/sass/helpers/position.scss +4 -4
  17. data/app/assets/stylesheets/sass/helpers/spacing.scss +6 -6
  18. data/app/assets/stylesheets/sass/helpers/typography.scss +29 -27
  19. data/app/assets/stylesheets/sass/helpers/visibility.scss +61 -61
  20. data/app/assets/stylesheets/sass/layout/hero.scss +6 -3
  21. data/app/assets/stylesheets/sass/themes/dark.scss +2 -1
  22. data/app/assets/stylesheets/sass/themes/light.scss +6 -5
  23. data/app/assets/stylesheets/sass/utilities/css-variables.scss +98 -22
  24. data/app/assets/stylesheets/sass/utilities/functions.scss +100 -48
  25. data/app/assets/stylesheets/sass/utilities/mixins.scss +5 -3
  26. data/bulma-rails.gemspec +1 -1
  27. metadata +2 -2
@@ -48,16 +48,35 @@
48
48
  @mixin register-rgb($name, $value) {
49
49
  @include register-var(
50
50
  $name,
51
- (red($value), green($value), blue($value)),
51
+ (
52
+ color.channel($value, "red", $space: rgb),
53
+ color.channel($value, "green", $space: rgb),
54
+ color.channel($value, "blue", $space: rgb)
55
+ ),
52
56
  "",
53
57
  "-rgb"
54
58
  );
55
59
  }
56
60
 
57
61
  @mixin register-hsl($name, $value) {
58
- @include register-var($name, round(hue($value)), "", "-h");
59
- @include register-var($name, round(saturation($value)), "", "-s");
60
- @include register-var($name, round(lightness($value)), "", "-l");
62
+ @include register-var(
63
+ $name,
64
+ math.round(color.channel($value, "hue", $space: hsl)),
65
+ "",
66
+ "-h"
67
+ );
68
+ @include register-var(
69
+ $name,
70
+ math.round(color.channel($value, "saturation", $space: hsl)),
71
+ "",
72
+ "-s"
73
+ );
74
+ @include register-var(
75
+ $name,
76
+ math.round(color.channel($value, "lightness", $space: hsl)),
77
+ "",
78
+ "-l"
79
+ );
61
80
  }
62
81
 
63
82
  @mixin generate-on-scheme-colors($name, $base, $scheme-main) {
@@ -76,7 +95,11 @@
76
95
  @if $ratio > 5 {
77
96
  $found-decent-color: true;
78
97
  } @else {
79
- $on-scheme-color: lighten($on-scheme-color, 5%);
98
+ $on-scheme-color: color.adjust(
99
+ $on-scheme-color,
100
+ $lightness: 5%,
101
+ $space: hsl
102
+ );
80
103
  $fg-lum: fn.bulmaColorLuminance($on-scheme-color);
81
104
  }
82
105
  }
@@ -87,13 +110,21 @@
87
110
  @if $ratio > 5 {
88
111
  $found-decent-color: true;
89
112
  } @else {
90
- $on-scheme-color: darken($on-scheme-color, 5%);
113
+ $on-scheme-color: color.adjust(
114
+ $on-scheme-color,
115
+ $lightness: -5%,
116
+ $space: hsl
117
+ );
91
118
  $fg-lum: fn.bulmaColorLuminance($on-scheme-color);
92
119
  }
93
120
  }
94
121
  }
95
122
 
96
- $on-scheme-lightness: lightness($on-scheme-color);
123
+ $on-scheme-lightness: color.channel(
124
+ $on-scheme-color,
125
+ "lightness",
126
+ $space: hsl
127
+ );
97
128
  @include register-var($name, $on-scheme-lightness, "", "-on-scheme-l");
98
129
  $on-scheme-l: getVar($name, "", "-on-scheme-l");
99
130
  @include register-var(
@@ -110,16 +141,28 @@
110
141
  @if ($scheme-main-brightness == "bright") {
111
142
  @while (fn.bulmaEnoughContrast($on-scheme-color, #fff) == false) {
112
143
  // We're on a light background, so we'll darken the test color step by step.
113
- $on-scheme-color: darken($on-scheme-color, 5%);
144
+ $on-scheme-color: color.adjust(
145
+ $on-scheme-color,
146
+ $lightness: -5%,
147
+ $space: hsl
148
+ );
114
149
  }
115
150
  } @else {
116
151
  @while (fn.bulmaEnoughContrast($on-scheme-color, #000) == false) {
117
152
  // We're on a dark background, so we'll lighten the test color step by step.
118
- $on-scheme-color: lighten($on-scheme-color, 5%);
153
+ $on-scheme-color: color.adjust(
154
+ $on-scheme-color,
155
+ $lightness: 5%,
156
+ $space: hsl
157
+ );
119
158
  }
120
159
  }
121
160
 
122
- $on-scheme-lightness: lightness($on-scheme-color);
161
+ $on-scheme-lightness: color.channel(
162
+ $on-scheme-color,
163
+ "lightness",
164
+ $space: hsl
165
+ );
123
166
  @include register-var($name, $on-scheme-lightness, "", "-on-scheme-l");
124
167
  }
125
168
 
@@ -135,7 +178,12 @@
135
178
  @include register-base-color($name, $base);
136
179
 
137
180
  @if $invert {
138
- @include register-var($name, lightness($invert), "", "-invert-l");
181
+ @include register-var(
182
+ $name,
183
+ color.channel($invert, "lightness", $space: hsl),
184
+ "",
185
+ "-invert-l"
186
+ );
139
187
  @include register-var("#{$name}-invert", $invert);
140
188
  }
141
189
  }
@@ -148,11 +196,11 @@
148
196
  $light: null,
149
197
  $dark: null
150
198
  ) {
151
- $h: round(hue($base)); // Hue
152
- $s: round(saturation($base)); // Saturation
153
- $l: round(lightness($base)); // Lightness
199
+ $h:math.round(color.channel($base, "hue", $space: hsl)); // Hue
200
+ $s:math.round(color.channel($base, "saturation", $space: hsl)); // Saturation
201
+ $l:math.round(color.channel($base, "lightness", $space: hsl)); // Lightness
154
202
  $base-lum: fn.bulmaColorLuminance($base);
155
- $l-base: round($l % 10); // Get lightness second digit: 53% -> 3%
203
+ $l-base: math.round($l % 10); // Get lightness second digit: 53% -> 3%
156
204
  $l-0: 0%; // 5% or less
157
205
  $l-5: 5%; // More than 5%
158
206
  $a: 1; // Alpha
@@ -160,7 +208,7 @@
160
208
 
161
209
  // Calculate digits like "40" for the scheme-main
162
210
  $scheme-l-0: 0%;
163
- $scheme-l-base: round($scheme-main-l % 10);
211
+ $scheme-l-base: math.round($scheme-main-l % 10);
164
212
  $closest-5: math.round(math.div($scheme-main-l, 5)) * 5;
165
213
  $pct-to-int: math.div($closest-5, 100%) * 100;
166
214
  $scheme-main-digits: #{$pct-to-int};
@@ -254,7 +302,10 @@
254
302
  // Source: https://www.w3.org/TR/WCAG20-TECHS/G17.html
255
303
  $fg-lum: fn.bulmaColorLuminance($foreground);
256
304
 
257
- @if (lightness($foreground) > lightness($background)) {
305
+ @if (
306
+ color.channel($foreground, "lightness", $space: hsl) >
307
+ color.channel($background, "lightness", $space: hsl)
308
+ ) {
258
309
  $is-light-fg: true;
259
310
  $ratio: math.div(($fg-lum + 0.05), ($bg-lum + 0.05));
260
311
  } @else {
@@ -323,7 +374,12 @@
323
374
 
324
375
  // If an invert color is provided by the user
325
376
  @if $invert {
326
- @include register-var($name, lightness($invert), "", "-invert-l");
377
+ @include register-var(
378
+ $name,
379
+ color.channel($invert, "lightness", $space: hsl),
380
+ "",
381
+ "-invert-l"
382
+ );
327
383
  @include register-var("#{$name}-invert", $invert);
328
384
  } @else {
329
385
  $base-invert-l-digits: map.get($combos, $base-digits);
@@ -343,13 +399,33 @@
343
399
 
344
400
  // Good color on light background (90% lightness)
345
401
  @if $light and $dark {
346
- @include register-var($name, lightness($light), "", "-light-l");
347
- @include register-var($name, lightness($light), "", "-dark-invert-l");
402
+ @include register-var(
403
+ $name,
404
+ color.channel($light, "lightness", $space: hsl),
405
+ "",
406
+ "-light-l"
407
+ );
408
+ @include register-var(
409
+ $name,
410
+ color.channel($light, "lightness", $space: hsl),
411
+ "",
412
+ "-dark-invert-l"
413
+ );
348
414
  @include register-var("#{$name}-light", $light);
349
415
  @include register-var("#{$name}-dark-invert", $light);
350
416
 
351
- @include register-var($name, lightness($dark), "", "-dark-l");
352
- @include register-var($name, lightness($dark), "", "-light-invert-l");
417
+ @include register-var(
418
+ $name,
419
+ color.channel($dark, "lightness", $space: hsl),
420
+ "",
421
+ "-dark-l"
422
+ );
423
+ @include register-var(
424
+ $name,
425
+ color.channel($dark, "lightness", $space: hsl),
426
+ "",
427
+ "-light-invert-l"
428
+ );
353
429
  @include register-var("#{$name}-dark", $dark);
354
430
  @include register-var("#{$name}-light-invert", $dark);
355
431
  } @else {
@@ -1,20 +1,29 @@
1
+ @use "sass:color";
1
2
  @use "sass:list";
3
+ @use "sass:map";
2
4
  @use "sass:math";
5
+ @use "sass:meta";
6
+ @use "sass:string";
3
7
 
4
8
  @function mergeColorMaps($bulma-colors, $custom-colors) {
5
9
  // We return at least Bulma's hard-coded colors
6
10
  $merged-colors: $bulma-colors;
7
11
 
8
12
  // We want a map as input
9
- @if type-of($custom-colors) == "map" {
13
+ @if meta.type-of($custom-colors) == "map" {
10
14
  @each $name, $components in $custom-colors {
11
15
  // The color name should be a string
12
16
  // and the components either a single color
13
17
  // or a colors list with at least one element
14
- @if type-of($name) ==
18
+ @if meta.type-of($name) ==
15
19
  "string" and
16
- (type-of($components) == "list" or type-of($components) == "color") and
17
- length($components) >=
20
+ (
21
+ meta.type-of($components) ==
22
+ "list" or
23
+ meta.type-of($components) ==
24
+ "color"
25
+ ) and
26
+ list.length($components) >=
18
27
  1
19
28
  {
20
29
  $color-base: null;
@@ -25,22 +34,22 @@
25
34
 
26
35
  // The param can either be a single color
27
36
  // or a list of 2 colors
28
- @if type-of($components) == "color" {
37
+ @if meta.type-of($components) == "color" {
29
38
  $color-base: $components;
30
39
  $color-invert: bulmaFindColorInvert($color-base);
31
40
  $color-light: bulmaFindLightColor($color-base);
32
41
  $color-dark: bulmaFindDarkColor($color-base);
33
- } @else if type-of($components) == "list" {
42
+ } @else if meta.type-of($components) == "list" {
34
43
  $color-base: list.nth($components, 1);
35
44
 
36
45
  // If Invert, Light and Dark are provided
37
- @if length($components) > 3 {
46
+ @if list.length($components) > 3 {
38
47
  $color-invert: list.nth($components, 2);
39
48
  $color-light: list.nth($components, 3);
40
49
  $color-dark: list.nth($components, 4);
41
50
 
42
51
  // If only Invert and Light are provided
43
- } @else if length($components) > 2 {
52
+ } @else if list.length($components) > 2 {
44
53
  $color-invert: list.nth($components, 2);
45
54
  $color-light: list.nth($components, 3);
46
55
  $color-dark: bulmaFindDarkColor($color-base);
@@ -56,11 +65,11 @@
56
65
  $value: $color-base, $color-invert, $color-light, $color-dark;
57
66
 
58
67
  // We only want to merge the map if the color base is an actual color
59
- @if type-of($color-base) == "color" {
68
+ @if meta.type-of($color-base) == "color" {
60
69
  // We merge this colors elements as map with Bulma's colors map
61
70
  // (we can override them this way, no multiple definition for the same name)
62
71
  // $merged-colors: map_merge($merged-colors, ($name: ($color-base, $color-invert, $color-light, $color-dark)))
63
- $merged-colors: map_merge(
72
+ $merged-colors: map.merge(
64
73
  $merged-colors,
65
74
  (
66
75
  $name: $value,
@@ -91,14 +100,14 @@
91
100
  }
92
101
 
93
102
  @function bulmaColorLuminance($color) {
94
- @if type-of($color) != "color" {
103
+ @if meta.type-of($color) != "color" {
95
104
  @return 0.55;
96
105
  }
97
106
 
98
107
  $color-rgb: (
99
- "red": red($color),
100
- "green": green($color),
101
- "blue": blue($color),
108
+ "red": color.channel($color, "red", $space: rgb),
109
+ "green": color.channel($color, "green", $space: rgb),
110
+ "blue": color.channel($color, "blue", $space: rgb),
102
111
  );
103
112
 
104
113
  @each $name, $value in $color-rgb {
@@ -112,7 +121,7 @@
112
121
  $value: powerNumber($value, 2);
113
122
  }
114
123
 
115
- $color-rgb: map-merge(
124
+ $color-rgb: map.merge(
116
125
  $color-rgb,
117
126
  (
118
127
  $name: $value,
@@ -120,8 +129,8 @@
120
129
  );
121
130
  }
122
131
 
123
- @return map-get($color-rgb, "red") * 0.2126 + map-get($color-rgb, "green") *
124
- 0.7152 + map-get($color-rgb, "blue") * 0.0722;
132
+ @return map.get($color-rgb, "red") * 0.2126 + map.get($color-rgb, "green") *
133
+ 0.7152 + map.get($color-rgb, "blue") * 0.0722;
125
134
  }
126
135
 
127
136
  @function bulmaFindColorInvert($color) {
@@ -133,33 +142,33 @@
133
142
  }
134
143
 
135
144
  @function bulmaFindLightColor($color, $l: 96%) {
136
- @if type-of($color) == "color" {
145
+ @if meta.type-of($color) == "color" {
137
146
  $l: 96%;
138
147
 
139
- @if lightness($color) > 96% {
140
- $l: lightness($color);
148
+ @if color.channel($color, "lightness", $space: hsl) > 96% {
149
+ $l: color.channel($color, "lightness", $space: hsl);
141
150
  }
142
151
 
143
- @return change-color($color, $lightness: $l);
152
+ @return color.change($color, $lightness: $l);
144
153
  }
145
154
 
146
155
  @return $background;
147
156
  }
148
157
 
149
158
  @function bulmaFindDarkColor($color, $base-l: 29%) {
150
- @if type-of($color) == "color" {
159
+ @if meta.type-of($color) == "color" {
151
160
  $luminance: bulmaColorLuminance($color);
152
161
  $luminance-delta: 0.53 - $luminance;
153
- $target-l: round($base-l + $luminance-delta * 53);
162
+ $target-l: math.round($base-l + $luminance-delta * 53);
154
163
 
155
- @return change-color($color, $lightness: max($base-l, $target-l));
164
+ @return color.change($color, $lightness: max($base-l, $target-l));
156
165
  }
157
166
 
158
167
  @return $text-strong;
159
168
  }
160
169
 
161
170
  @function bulmaRgba($color, $alpha) {
162
- @if type-of($color) != "color" {
171
+ @if meta.type-of($color) != "color" {
163
172
  @return $color;
164
173
  }
165
174
 
@@ -167,27 +176,37 @@
167
176
  }
168
177
 
169
178
  @function bulmaDarken($color, $amount) {
170
- @if type-of($color) != "color" {
179
+ @if meta.type-of($color) != "color" {
171
180
  @return $color;
172
181
  }
173
182
 
174
- @return darken($color, $amount);
183
+ @return color.adjust($color, $lightness: -$amount, $space: hsl);
175
184
  }
176
185
 
177
186
  @function bulmaLighten($color, $amount) {
178
- @if type-of($color) != "color" {
187
+ @if meta.type-of($color) != "color" {
179
188
  @return $color;
180
189
  }
181
190
 
182
- @return lighten($color, $amount);
191
+ @return color.adjust($color, $lightness: $amount, $space: hsl);
183
192
  }
184
193
 
185
194
  @function bulmaColorBrightness($n) {
186
- $color-brightness: round(
187
- math.div((red($n) * 299) + (green($n) * 587) + (blue($n) * 114), 1000)
195
+ $color-brightness: math.round(
196
+ math.div(
197
+ (color.channel($n, "red", $space: rgb) * 299) +
198
+ (color.channel($n, "green", $space: rgb) * 587) +
199
+ (color.channel($n, "blue", $space: rgb) * 114),
200
+ 1000
201
+ )
188
202
  );
189
- $light-color: round(
190
- math.div((red(#ffffff) * 299) + (green(#ffffff) * 587) + (blue(#ffffff) * 114), 1000)
203
+ $light-color: math.round(
204
+ math.div(
205
+ (color.channel(#ffffff, "red", $space: rgb) * 299) +
206
+ (color.channel(#ffffff, "green", $space: rgb) * 587) +
207
+ (color.channel(#ffffff, "blue", $space: rgb) * 114),
208
+ 1000
209
+ )
191
210
  );
192
211
 
193
212
  @if abs($color-brightness) < math.div($light-color, 2) {
@@ -198,12 +217,42 @@
198
217
  }
199
218
 
200
219
  @function bulmaEnoughContrast($foreground, $background) {
201
- $r: (max(red($foreground), red($background))) -
202
- (min(red($foreground), red($background)));
203
- $g: (max(green($foreground), green($background))) -
204
- (min(green($foreground), green($background)));
205
- $b: (max(blue($foreground), blue($background))) -
206
- (min(blue($foreground), blue($background)));
220
+ $r: (
221
+ max(
222
+ color.channel($foreground, "red", $space: rgb),
223
+ color.channel($background, "red", $space: rgb)
224
+ )
225
+ ) -
226
+ (
227
+ min(
228
+ color.channel($foreground, "red", $space: rgb),
229
+ color.channel($background, "red", $space: rgb)
230
+ )
231
+ );
232
+ $g: (
233
+ max(
234
+ color.channel($foreground, "green", $space: rgb),
235
+ color.channel($background, "green", $space: rgb)
236
+ )
237
+ ) -
238
+ (
239
+ min(
240
+ color.channel($foreground, "green", $space: rgb),
241
+ color.channel($background, "green", $space: rgb)
242
+ )
243
+ );
244
+ $b: (
245
+ max(
246
+ color.channel($foreground, "blue", $space: rgb),
247
+ color.channel($background, "blue", $space: rgb)
248
+ )
249
+ ) -
250
+ (
251
+ min(
252
+ color.channel($foreground, "blue", $space: rgb),
253
+ color.channel($background, "blue", $space: rgb)
254
+ )
255
+ );
207
256
  $sum-rgb: $r + $g + $b;
208
257
 
209
258
  @if $sum-rgb < 500 {
@@ -215,15 +264,15 @@
215
264
 
216
265
  // By Cory Simmons https://corysimmons.com/
217
266
  @function bulmaStringToNumber($value) {
218
- @if type-of($value) == "number" {
267
+ @if meta.type-of($value) == "number" {
219
268
  @return $value;
220
- } @else if type-of($value) != "string" {
269
+ } @else if meta.type-of($value) != "string" {
221
270
  $_: log("Value for `to-number` should be a number or a string.");
222
271
  }
223
272
 
224
273
  $result: 0;
225
274
  $digits: 0;
226
- $minus: str-slice($value, 1, 1) == "-";
275
+ $minus: string.slice($value, 1, 1) == "-";
227
276
  $numbers: (
228
277
  "0": 0,
229
278
  "1": 1,
@@ -237,20 +286,23 @@
237
286
  "9": 9,
238
287
  );
239
288
 
240
- @for $i from if($minus, 2, 1) through str-length($value) {
241
- $character: str-slice($value, $i, $i);
289
+ @for $i from if($minus, 2, 1) through string.length($value) {
290
+ $character: string.slice($value, $i, $i);
242
291
 
243
- @if not(index(map-keys($numbers), $character) or $character == ".") {
244
- @return to-length(if($minus, -$result, $result), str-slice($value, $i));
292
+ @if not(list.index(map.keys($numbers), $character) or $character == ".") {
293
+ @return to-length(
294
+ if($minus, -$result, $result),
295
+ string.slice($value, $i)
296
+ );
245
297
  }
246
298
 
247
299
  @if $character == "." {
248
300
  $digits: 1;
249
301
  } @else if $digits == 0 {
250
- $result: $result * 10 + map-get($numbers, $character);
302
+ $result: $result * 10 + map.get($numbers, $character);
251
303
  } @else {
252
304
  $digits: $digits * 10;
253
- $result: $result + map-get($numbers, $character) / $digits;
305
+ $result: $result + map.get($numbers, $character) / $digits;
254
306
  }
255
307
  }
256
308
 
@@ -1,3 +1,5 @@
1
+ @use "sass:map";
2
+
1
3
  @use "initial-variables" as iv;
2
4
  @use "css-variables" as cv;
3
5
 
@@ -360,11 +362,11 @@
360
362
  }
361
363
 
362
364
  @mixin breakpoint($name) {
363
- $breakpoint: map-get(iv.$breakpoints, $name);
365
+ $breakpoint: map.get(iv.$breakpoints, $name);
364
366
 
365
367
  @if $breakpoint {
366
- $from: map-get($breakpoint, "from");
367
- $until: map-get($breakpoint, "until");
368
+ $from: map.get($breakpoint, "from");
369
+ $until: map.get($breakpoint, "until");
368
370
 
369
371
  @if $from and $until {
370
372
  @include between($from, $until) {
data/bulma-rails.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "bulma-rails"
3
- gem.version = "1.0.2"
3
+ gem.version = "1.0.3"
4
4
  gem.authors = ["Joshua Jansen"]
5
5
  gem.email = ["joshuajansen88@gmail.com"]
6
6
  gem.description = %q{A modern CSS framework based on Flexbox}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulma-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Jansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-01 00:00:00.000000000 Z
11
+ date: 2024-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dartsass-rails