bootstrap-email 1.6.0 → 1.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 470d415dd6870a956a17076a8bd4869e10e6c5714c1ced9d4d94c244aa4c807b
4
- data.tar.gz: f47493294d7933d1cf6f4ad88bd5b609ab0018351dc5917ac2422a6abf6c71ac
3
+ metadata.gz: 5dac3404a2b0e1ea4f18290c2275e22dff41c9f04299b02098c9ad7d6558ea93
4
+ data.tar.gz: 49d3d4a4061fd8c9420cd662340c33b7fc3384b03d497c071c63f99ce56d5dbe
5
5
  SHA512:
6
- metadata.gz: 6f391d28adc30f2e02abc5bf1a0c8c81281f11bf9901305fef1e1d278ccc9ebb57875a0fba4fe26e2d1f47270065be6deca7671180b71c82ea4d58e033dfa49f
7
- data.tar.gz: 1b948ffc86509b61be6b81d2d7903df9af7cf6c18df1a23f0a3d2444181f1cc22d86c6c4bec17f47c1c7610c8cebcc8668b96cd50ff388ab5aa0bed51fb2ed07
6
+ metadata.gz: 7e4a56cda71b8d97d780c0bdbc5df8338822e0f34772c962a0c067bd379e884d73367d5f153c606ca084b9edcec4a6d52057fe2091c113ae340ddc0c5f638e47
7
+ data.tar.gz: d3117be6c0a13e0abfa183c52095fe7f383109a7720e461d2af504c8d9471259903916c4f403d8fbd7ff4ecab4914e2fb558cccb733ff675d7560b2c86b67e5d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.0
1
+ 1.8.0
@@ -1,5 +1,6 @@
1
1
  @use "sass:color";
2
2
  @use "../variable";
3
+ @use "../helper";
3
4
 
4
5
  .alert {
5
6
  border-collapse: separate !important;
@@ -7,18 +8,19 @@
7
8
  width: 100%;
8
9
  & > tbody > tr > td {
9
10
  padding: 0.75 * variable.$font-size-base 1.25 * variable.$font-size-base;
10
- border: 1px solid transparent;
11
+ border-width: 1px;
12
+ border-style: solid;
11
13
  border-radius: 0.25 * variable.$font-size-base;
12
14
  }
13
15
  }
14
16
 
15
17
  @each $color, $value in variable.$theme-colors {
16
18
  .alert-#{$color} td {
17
- background-color: color.adjust($value, $lightness: 40%);
18
- border-color: color.adjust($value, $lightness: 35%);
19
- color: color.adjust($value, $lightness: -30%);
19
+ background-color: helper.hex(helper.tint-color($value, 85%));
20
+ border-color: helper.hex(helper.tint-color($value, 75%));
21
+ color: helper.hex(helper.shade-color($value, 65%));
20
22
  .hr > table > tbody > tr > td {
21
- border-top: 1px solid color.adjust($value, $lightness: 35%);
23
+ border-top: 1px solid helper.hex(helper.tint-color($value, 35%));
22
24
  }
23
25
  }
24
26
  }
@@ -1,5 +1,6 @@
1
1
  @use "sass:map";
2
2
  @use "../variable";
3
+ @use "../helper";
3
4
 
4
5
  .badge > tbody > tr > td {
5
6
  display: inline-block;
@@ -15,12 +16,12 @@
15
16
 
16
17
  @each $name, $theme in variable.$btn-themes {
17
18
  .badge-#{$name} td {
18
- background-color: map.get($theme, "background-color");
19
+ background-color: helper.hex(map.get($theme, "background-color"));
19
20
  }
20
21
  .badge-#{$name} td span {
21
- background-color: map.get($theme, "background-color");
22
- color: map.get($theme, "color");
23
- border-color: map.get($theme, "border-color");
22
+ background-color: helper.hex(map.get($theme, "background-color"));
23
+ color: helper.hex(map.get($theme, "color"));
24
+ border-color: helper.hex(map.get($theme, "border-color"));
24
25
  }
25
26
  }
26
27
 
@@ -1,5 +1,6 @@
1
1
  @use "sass:map";
2
2
  @use "../variable";
3
+ @use "../helper";
3
4
 
4
5
  .btn {
5
6
  border-radius: variable.$btn-border-radius;
@@ -26,12 +27,12 @@
26
27
 
27
28
  @each $name, $theme in variable.$btn-themes {
28
29
  .btn-#{$name} td {
29
- background-color: map.get($theme, "background-color");
30
+ background-color: helper.hex(map.get($theme, "background-color"));
30
31
  }
31
32
  .btn-#{$name} td a {
32
- background-color: map.get($theme, "background-color");
33
- color: map.get($theme, "color");
34
- border-color: map.get($theme, "border-color");
33
+ background-color: helper.hex(map.get($theme, "background-color"));
34
+ color: helper.hex(map.get($theme, "color"));
35
+ border-color: helper.hex(map.get($theme, "border-color"));
35
36
  }
36
37
  }
37
38
 
@@ -1,14 +1,15 @@
1
1
  @use "../variable";
2
+ @use "../helper";
2
3
 
3
4
  .card {
4
- background-color: variable.$white;
5
+ background-color: helper.hex(variable.$white);
5
6
  border-radius: variable.$border-radius;
6
- border: 1px solid variable.$border-color;
7
+ border: 1px solid helper.hex(variable.$border-color);
7
8
  border-collapse: separate !important;
8
9
  width: 100%;
9
10
  overflow: hidden;
10
11
  & > tbody > tr > td {
11
- background-color: variable.$white;
12
+ background-color: helper.hex(variable.$white);
12
13
  width: 100%;
13
14
  }
14
15
  .card-body {
@@ -1,9 +1,10 @@
1
1
  @use "../variable";
2
+ @use "../helper";
2
3
 
3
4
  table.hr {
4
5
  width: 100%;
5
6
  & > tbody > tr > td {
6
- border-top: 1px solid variable.$border-color;
7
+ border-top: 1px solid helper.hex(variable.$border-color);
7
8
  height: 1px;
8
9
  width: 100%;
9
10
  }
@@ -1,5 +1,6 @@
1
1
  @use "sass:color";
2
2
  @use "../variable";
3
+ @use "../helper";
3
4
 
4
5
  //
5
6
  // Basic Bootstrap table
@@ -8,7 +9,7 @@
8
9
  .table {
9
10
  width: 100%;
10
11
  max-width: 100%;
11
- background-color: variable.$table-background-color; // Reset for nesting within parents with `background-color`.
12
+ background-color: helper.hex(variable.$table-background-color); // Reset for nesting within parents with `background-color`.
12
13
 
13
14
  & > thead > tr > th {
14
15
  text-align: left;
@@ -55,12 +56,12 @@
55
56
  // Add borders all around the table and between all the columns.
56
57
 
57
58
  .table-bordered {
58
- border: variable.$table-border-width solid variable.$table-border-color;
59
+ border: variable.$table-border-width solid helper.hex(variable.$table-border-color);
59
60
 
60
61
  & > thead > tr > th,
61
62
  & > tbody > tr > td,
62
63
  & > tfoot > tr > td {
63
- border: variable.$table-border-width solid variable.$table-border-color;
64
+ border: variable.$table-border-width solid helper.hex(variable.$table-border-color);
64
65
  }
65
66
 
66
67
  & > thead {
@@ -78,7 +79,7 @@
78
79
 
79
80
  .table-striped {
80
81
  & > tbody > tr:nth-of-type(odd) {
81
- background-color: variable.$table-accent-bg;
82
+ background-color: helper.hex(variable.$table-accent-bg);
82
83
  }
83
84
  }
84
85
 
@@ -93,7 +94,7 @@
93
94
  &,
94
95
  > th,
95
96
  > td {
96
- background-color: color.adjust($value, $lightness: 40%);
97
+ background-color: helper.hex(helper.tint-color($value, 85%));
97
98
  }
98
99
  }
99
100
  }
@@ -106,21 +107,21 @@
106
107
 
107
108
  .thead-dark {
108
109
  th {
109
- color: variable.$white;
110
- background-color: variable.$gray-900;
110
+ color: helper.hex(variable.$white);
111
+ background-color: helper.hex(variable.$gray-900);
111
112
  }
112
113
  }
113
114
 
114
115
  .thead-light {
115
116
  th {
116
- color: variable.$gray-700;
117
- background-color: variable.$gray-200;
117
+ color: helper.hex(variable.$gray-700);
118
+ background-color: helper.hex(variable.$gray-200);
118
119
  }
119
120
  }
120
121
 
121
122
  .table-dark {
122
- color: variable.$white;
123
- background-color: variable.$gray-900;
123
+ color: helper.hex(variable.$white);
124
+ background-color: helper.hex(variable.$gray-900);
124
125
 
125
126
  & > thead > tr > th,
126
127
  & > tbody > tr > td,
@@ -1,7 +1,9 @@
1
1
  @use "sass:color";
2
2
  @use "sass:math";
3
3
  @use "sass:meta";
4
+ @use "sass:string";
4
5
 
6
+ // Calculate the color contrast for a given color and returns white or black based on the YIQ formula
5
7
  @function color-contrast($color) {
6
8
  $r: color.channel($color, "red", $space: rgb);
7
9
  $g: color.channel($color, "green", $space: rgb);
@@ -16,22 +18,25 @@
16
18
  }
17
19
  }
18
20
 
21
+ // Lighten a color by adding white to it
19
22
  @function tint-color($color, $level) {
20
- @return remix-color(color.mix(white, $color, $level, $method: rgb));
23
+ @return color.mix(white, $color, $level);
21
24
  }
22
25
 
26
+ // Darken a color by adding black to it
23
27
  @function shade-color($color, $level) {
24
- @return remix-color(color.mix(black, $color, $level, $method: rgb));
28
+ @return color.mix(black, $color, $level);
25
29
  }
26
30
 
27
- @function remix-color($color) {
28
- @return rgb(round-color($color, 'red'), round-color($color, 'green'), round-color($color, 'blue'));
29
- }
30
-
31
- @function round-color($color, $channel) {
32
- @return math.round(color.channel($color, $channel));
31
+ // Convert a color to a hex string, needed so sass doesn't return an rgb string
32
+ @function hex($color) {
33
+ @if not meta.type-of($color) == 'color' or $color == null or $color == transparent {
34
+ @return $color;
35
+ }
36
+ @return string.unquote('#' + string.slice(color.ie-hex-str($color), 4));
33
37
  }
34
38
 
39
+ // Strip the unit from a number
35
40
  @function strip-unit($number) {
36
41
  @if meta.type-of($number) == 'number' and not math.is-unitless($number) {
37
42
  @return math.div($number, ($number * 0 + 1));
@@ -3,6 +3,6 @@
3
3
 
4
4
  @each $name, $color in variable.$all-colors {
5
5
  @include helper.background-color-util('.bg-#{$name}') {
6
- background-color: $color;
6
+ background-color: helper.hex($color);
7
7
  }
8
8
  }
@@ -2,15 +2,15 @@
2
2
  @use "../variable";
3
3
 
4
4
  @each $name, $width in variable.$border-widths {
5
- .border#{$name} { border: $width solid variable.$border-color !important; }
6
- .border-top#{$name} { border-top: $width solid variable.$border-color !important; }
7
- .border-right#{$name} { border-right: $width solid variable.$border-color !important; }
8
- .border-bottom#{$name} { border-bottom: $width solid variable.$border-color !important; }
9
- .border-left#{$name} { border-left: $width solid variable.$border-color !important; }
5
+ .border#{$name} { border: $width solid helper.hex(variable.$border-color) !important; }
6
+ .border-top#{$name} { border-top: $width solid helper.hex(variable.$border-color) !important; }
7
+ .border-right#{$name} { border-right: $width solid helper.hex(variable.$border-color) !important; }
8
+ .border-bottom#{$name} { border-bottom: $width solid helper.hex(variable.$border-color) !important; }
9
+ .border-left#{$name} { border-left: $width solid helper.hex(variable.$border-color) !important; }
10
10
  }
11
11
 
12
12
  @each $name, $color in variable.$all-colors {
13
13
  @include helper.border-color-util('.border-#{$name}') {
14
- border-color: $color !important;
14
+ border-color: helper.hex($color) !important;
15
15
  }
16
16
  }
@@ -3,10 +3,10 @@
3
3
 
4
4
  @each $name, $color in variable.$all-colors {
5
5
  @include helper.color-util('.text-#{$name}') {
6
- color: $color;
6
+ color: helper.hex($color);
7
7
  }
8
8
  }
9
9
 
10
10
  @include helper.color-util('.text-muted') {
11
- color: variable.$gray-600;
11
+ color: helper.hex(variable.$gray-600);
12
12
  }
@@ -8,7 +8,7 @@ h1, h2, h3, h4, h5, h6,
8
8
  padding-bottom: variable.$headings-margin-bottom;
9
9
  font-family: variable.$headings-font-family;
10
10
  font-weight: variable.$headings-font-weight;
11
- color: variable.$headings-color;
11
+ color: helper.hex(variable.$headings-color);
12
12
  text-align: left;
13
13
  vertical-align: baseline;
14
14
  }
@@ -10,7 +10,8 @@ module BootstrapEmail
10
10
  :sass_load_paths, # array of directories for loading sass imports
11
11
  :sass_cache_location, # path to tmp folder for sass cache
12
12
  :sass_log_enabled, # turn on or off sass log when caching new sass
13
- :generate_rails_text_part # boolean for whether or not to generate the text part in rails, default: true
13
+ :generate_rails_text_part, # boolean for whether or not to generate the text part in rails, default: true
14
+ :override_mail_method # method to override the mail method in rails, default: false
14
15
  ].freeze
15
16
 
16
17
  attr_accessor(*OPTIONS)
@@ -28,6 +29,7 @@ module BootstrapEmail
28
29
 
29
30
  def defaults
30
31
  self.generate_rails_text_part = true
32
+ self.override_mail_method = false
31
33
  end
32
34
  end
33
35
  end
@@ -2,8 +2,16 @@
2
2
 
3
3
  ActiveSupport.on_load(:action_mailer, { yield: true }) do |action_mailer|
4
4
  action_mailer.class_eval do # To support Rails less than 6
5
+ # Only override mail method if override_mail_method is enabled
6
+ if BootstrapEmail.static_config.override_mail_method
7
+ alias_method :rails_mail, :mail unless method_defined?(:rails_mail)
8
+ def mail(*args, &block)
9
+ bootstrap_mail(*args, &block)
10
+ end
11
+ end
12
+
5
13
  def bootstrap_mail(*args, &block)
6
- message = mail(*args, &block)
14
+ message = method_defined?(:rails_mail) ? rails_mail(*args, &block) : mail(*args, &block)
7
15
  BootstrapEmail::Rails::MailBuilder.perform(message)
8
16
  end
9
17
  alias_method :bootstrap_email, :bootstrap_mail
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-email
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Yamartino
@@ -57,14 +57,28 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '1.53'
60
+ version: '1.55'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '1.53'
67
+ version: '1.55'
68
+ - !ruby/object:Gem::Dependency
69
+ name: ostruct
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.6'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.6'
68
82
  email: stu@stuyam.com
69
83
  executables:
70
84
  - bootstrap-email