Skip to content

Commit 7d69403

Browse files
committed
feat(lib): support bulma v0.9.3
1 parent ae7a05f commit 7d69403

File tree

6 files changed

+7381
-10775
lines changed

6 files changed

+7381
-10775
lines changed

demo/package-lock.json

Lines changed: 2815 additions & 4028 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
"html-webpack-plugin": "^5.0.0-alpha.14",
3535
"json-loader": "^0.5.7",
3636
"mini-css-extract-plugin": "^1.2.1",
37-
"sass": "^1.26.11",
38-
"sass-loader": "^10.0.2",
39-
"style-loader": "^2.0.0",
37+
"sass": "^1.35.2",
38+
"sass-loader": "^12.1.0",
39+
"style-loader": "^3.0.0",
4040
"ts-loader": "^8.0.4",
4141
"typescript": "^4.0.3",
4242
"webpack": "^5.3.2",

docs/main.css

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/functions.sass

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
$value: $value * $number
6363
@else if $exp < 0
6464
@for $i from 1 through -$exp
65-
$value: $value / $number
65+
$value: divide($value, $number)
6666
@return $value
6767

6868
@function colorLuminance($color)
@@ -71,11 +71,11 @@
7171
$color-rgb: ('red': red($color),'green': green($color),'blue': blue($color))
7272
@each $name, $value in $color-rgb
7373
$adjusted: 0
74-
$value: $value / 255
74+
$value: divide($value, 255)
7575
@if $value < 0.03928
76-
$value: $value / 12.92
76+
$value: divide($value, 12.92)
7777
@else
78-
$value: ($value + .055) / 1.055
78+
$value: divide(($value + .055), 1.055)
7979
$value: powerNumber($value, 2)
8080
$color-rgb: map-merge($color-rgb, ($name: $value))
8181
@return (map-get($color-rgb, 'red') * .2126) + (map-get($color-rgb, 'green') * .7152) + (map-get($color-rgb, 'blue') * .0722)
@@ -195,11 +195,11 @@
195195
$color-rgb: ('red': red($color),'green': green($color),'blue': blue($color))
196196
@each $name, $value in $color-rgb
197197
$adjusted: 0
198-
$value: $value / 255
198+
$value: divide($value, 255)
199199
@if $value < 0.03928
200-
$value: $value / 12.92
200+
$value: divide($value, 12.92)
201201
@else
202-
$value: ($value + .055) / 1.055
202+
$value: divide(($value + .055), 1.055)
203203
$value: powerNumber($value, 2)
204204
$color-rgb: map-merge($color-rgb, ($name: $value))
205205
@return (map-get($color-rgb, 'red') * .2126) + (map-get($color-rgb, 'green') * .7152) + (map-get($color-rgb, 'blue') * .0722)
@@ -242,3 +242,24 @@
242242
@if type-of($color) != 'color'
243243
@return $color
244244
@return lighten($color, $amount)
245+
246+
// Custom divide function by @mdo from https://github.com/twbs/bootstrap/pull/34245
247+
// Replaces old slash division deprecated in Dart Sass
248+
@function divide($dividend, $divisor, $precision: 10)
249+
$sign: if($dividend > 0 and $divisor > 0, 1, -1)
250+
$dividend: abs($dividend)
251+
$divisor: abs($divisor)
252+
$quotient: 0
253+
$remainder: $dividend
254+
@if $dividend == 0
255+
@return 0
256+
@if $divisor == 0
257+
@error "Cannot divide by 0"
258+
@if $divisor == 1
259+
@return $dividend
260+
@while $remainder >= $divisor
261+
$quotient: $quotient + 1
262+
$remainder: $remainder - $divisor
263+
@if $remainder > 0 and $precision > 0
264+
$remainder: divide($remainder * 10, $divisor, $precision - 1) * .1
265+
@return ($quotient + $remainder) * $sign

0 commit comments

Comments
 (0)