rescript-polished 1.13.0 → 2.0.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.
- package/.github/dependabot.yml +26 -0
- package/.github/workflows/release.yml +4 -4
- package/README.md +30 -5
- package/__tests__/PolishedCssTest.res +61 -10
- package/bsconfig.json +6 -0
- package/package.json +28 -11
- package/src/PolishedCss__Color.res +57 -31
- package/lib/js/__tests__/PolishedCssTest.js +0 -63
- package/lib/js/__tests__/PolishedTest.js +0 -183
- package/lib/js/__tests__/__snapshots__/PolishedTest.js.snap +0 -63
- package/lib/js/src/Polished.js +0 -14
- package/lib/js/src/PolishedCss.js +0 -8
- package/lib/js/src/PolishedCss__Color.js +0 -92
- package/lib/js/src/Polished__Color.js +0 -144
- package/lib/js/src/Polished__Math.js +0 -11
- package/lib/js/src/Polished__Mixins.js +0 -51
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: npm
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
time: "04:00"
|
|
8
|
+
open-pull-requests-limit: 10
|
|
9
|
+
ignore:
|
|
10
|
+
- dependency-name: semantic-release
|
|
11
|
+
versions:
|
|
12
|
+
- 17.4.1
|
|
13
|
+
- dependency-name: rescript-dom-testing-library
|
|
14
|
+
versions:
|
|
15
|
+
- 1.12.0
|
|
16
|
+
- dependency-name: bs-platform
|
|
17
|
+
versions:
|
|
18
|
+
- 8.4.2
|
|
19
|
+
- 9.0.0
|
|
20
|
+
- 9.0.1
|
|
21
|
+
- dependency-name: polished
|
|
22
|
+
versions:
|
|
23
|
+
- 4.1.0
|
|
24
|
+
- dependency-name: mem
|
|
25
|
+
versions:
|
|
26
|
+
- 8.0.0
|
|
@@ -2,9 +2,9 @@ name: Release
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [
|
|
5
|
+
branches: [main]
|
|
6
6
|
pull_request:
|
|
7
|
-
branches: [
|
|
7
|
+
branches: [main]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
10
|
build:
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
- name: Setup node
|
|
16
16
|
uses: actions/setup-node@v1
|
|
17
17
|
with:
|
|
18
|
-
node-version: "
|
|
18
|
+
node-version: "14.x"
|
|
19
19
|
- name: Install dependencies
|
|
20
20
|
run: yarn --frozen-lockfile --ignore-engines
|
|
21
21
|
- name: Compile ReScript files
|
|
@@ -28,4 +28,4 @@ jobs:
|
|
|
28
28
|
env:
|
|
29
29
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
30
30
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
31
|
-
run: yarn global add semantic-release && semantic-release
|
|
31
|
+
run: yarn global add semantic-release && semantic-release
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Bindings for [polished](https://polished.js.org/), _a lightweight toolset for writing styles in JavaScript_, **now in ReScript** ✨.
|
|
8
8
|
|
|
9
|
-
**Note:** these bindings are still under development, check the [Polished](https://github.com/brnrdog/rescript-polished/blob/
|
|
9
|
+
**Note:** these bindings are still under development, check the [Polished](https://github.com/brnrdog/rescript-polished/blob/main/src/Polished.res) module to see the available functions.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -33,10 +33,35 @@ For better convenience in ReScript, these bindings were written in a data-first
|
|
|
33
33
|
```rescript
|
|
34
34
|
open Polished
|
|
35
35
|
|
|
36
|
-
let primaryColor
|
|
37
|
-
let primaryColorLight = primaryColor
|
|
38
|
-
let primaryColorDark
|
|
39
|
-
let secondaryColor
|
|
36
|
+
let primaryColor = "#ed5051"
|
|
37
|
+
let primaryColorLight = primaryColor->Color.lighten(~amount=0.25) // #f9c4c4
|
|
38
|
+
let primaryColorDark = primaryColor->Color.darken(~amount=0.25) // #ac1213
|
|
39
|
+
let secondaryColor = primaryColor->Color.complement // #50edec
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If you're using `bs-css` or `bs-css-emotion`, you can use `PolishedCss`:
|
|
43
|
+
|
|
44
|
+
```rescript
|
|
45
|
+
module Style = {
|
|
46
|
+
open CssJs
|
|
47
|
+
open PolishedCss
|
|
48
|
+
|
|
49
|
+
let primary = #hex("e6484f") // or any possible Css_AtomicTypes.Color.t
|
|
50
|
+
|
|
51
|
+
let button = style(. [
|
|
52
|
+
background(primary),
|
|
53
|
+
hover([background(primary->Color.lighten(0.25))])
|
|
54
|
+
active([background(primary->Color.darken(0.25)]),
|
|
55
|
+
focus([
|
|
56
|
+
boxShadow(
|
|
57
|
+
Shadow.box(
|
|
58
|
+
primary->Color.transparentize(~amount=0.8),
|
|
59
|
+
~spread=#rem(0.25),
|
|
60
|
+
),
|
|
61
|
+
),
|
|
62
|
+
]),
|
|
63
|
+
])
|
|
64
|
+
}
|
|
40
65
|
```
|
|
41
66
|
|
|
42
67
|
## License
|
|
@@ -7,26 +7,77 @@ let toEqual = (x, y) => x |> toEqual(y)
|
|
|
7
7
|
describe("Color", () => {
|
|
8
8
|
open Color
|
|
9
9
|
|
|
10
|
-
test("shade", () => {
|
|
11
|
-
#hex("ff0000")->shade(~amount=0.25)->expect->toEqual(#hex("
|
|
10
|
+
test("shade with hex", () => {
|
|
11
|
+
#hex("ff0000")->shade(~amount=0.25)->expect->toEqual(#hex("bf0000"))
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
test("
|
|
15
|
-
|
|
14
|
+
test("shade with rgb", () => {
|
|
15
|
+
Css_AtomicTypes.Color.rgb(255, 0, 0)->shade(~amount=0.25)->expect->toEqual(#hex("bf0000"))
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
test("
|
|
19
|
-
#
|
|
18
|
+
test("shade with rgba", () => {
|
|
19
|
+
Css_AtomicTypes.Color.rgba(255, 0, 0, #num(0.25))
|
|
20
|
+
->shade(~amount=0.25)
|
|
21
|
+
->expect
|
|
22
|
+
->toEqual(Css_AtomicTypes.Color.rgba(76, 0, 0, #num(0.4375)))
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test("tint with hex", () => {
|
|
26
|
+
#hex("ff0000")->tint(~amount=0.25)->expect->toEqual(#hex("ff3f3f"))
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test("tint with rgb", () => {
|
|
30
|
+
Css_AtomicTypes.Color.rgb(255, 0, 0)->tint(~amount=0.25)->expect->toEqual(#hex("ff3f3f"))
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test("darken with hex", () => {
|
|
34
|
+
#hex("ff0000")->darken(~amount=0.25)->expect->toEqual(#hex("800000"))
|
|
20
35
|
})
|
|
21
36
|
|
|
22
|
-
test("lighten", () => {
|
|
23
|
-
#hex("ff0000")->lighten(~amount=0.25)->expect->toEqual(#hex("
|
|
37
|
+
test("lighten with hex", () => {
|
|
38
|
+
#hex("ff0000")->lighten(~amount=0.25)->expect->toEqual(#hex("ff8080"))
|
|
24
39
|
})
|
|
25
40
|
|
|
26
|
-
test("transparentize", () => {
|
|
41
|
+
test("transparentize with hex", () => {
|
|
27
42
|
#hex("ff0000")
|
|
28
43
|
->transparentize(~amount=0.5)
|
|
29
44
|
->expect
|
|
30
|
-
->toEqual(Rgba.fromString("rgba(255, 0, 0, 0.5)"))
|
|
45
|
+
->toEqual(Utils.Rgba.fromString("rgba(255, 0, 0, 0.5)"))
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test("getContrast with hex", () => {
|
|
49
|
+
#hex("ff0000")->getContrast(#hex("0000ff"))->expect->toEqual(2.16)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test("getLuminance with hex", () => {
|
|
53
|
+
#hex("ff0000")->getLuminance->expect->toEqual(0.213)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test("grayscale with hex", () => {
|
|
57
|
+
#hex("ff0000")->grayscale->expect->toEqual(#hex("808080"))
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test("desaturate with hex", () => {
|
|
61
|
+
#hex("ff0000")->desaturate(~amount=0.3)->expect->toEqual(#hex("d92626"))
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test("complement with hex", () => {
|
|
65
|
+
#hex("ff0000")->complement->expect->toEqual(#hex("0ff"))
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test("adjustHue with hex", () => {
|
|
69
|
+
#hex("ff0000")->adjustHue(~degree=0.3)->expect->toEqual(#hex("ff0100"))
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
describe("Utils", () => {
|
|
73
|
+
open Color.Utils
|
|
74
|
+
|
|
75
|
+
test("fromString with hex", () => {
|
|
76
|
+
"#ff0000"->fromString->expect->toEqual(#hex("ff0000"))
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test("fromString with rgba", () => {
|
|
80
|
+
"rgba(255, 0, 0, 0.5)"->fromString->expect->toEqual(#rgba(255, 0, 0, #num(0.5)))
|
|
81
|
+
})
|
|
31
82
|
})
|
|
32
83
|
})
|
package/bsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,31 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rescript-polished",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "ReScript bindings for polished.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://github.com/brnrdog/rescript-polished",
|
|
7
7
|
"author": "Bernardo Gurgel <brnrdog@hey.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"rescript",
|
|
11
|
+
"polished",
|
|
12
|
+
"color",
|
|
13
|
+
"css-in-js",
|
|
14
|
+
"color manipulate",
|
|
15
|
+
"color manipulation",
|
|
16
|
+
"colour",
|
|
17
|
+
"styled-components"
|
|
18
|
+
],
|
|
19
|
+
"release": {
|
|
20
|
+
"branches": [
|
|
21
|
+
"main"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
9
24
|
"scripts": {
|
|
10
|
-
"res:start": "
|
|
11
|
-
"res:build": "
|
|
12
|
-
"res:clean": "
|
|
25
|
+
"res:start": "rescript build -w",
|
|
26
|
+
"res:build": "rescript build -with-deps",
|
|
27
|
+
"res:clean": "rescript clean -with-deps",
|
|
13
28
|
"test": "jest",
|
|
14
29
|
"test:ci": "jest --collect-coverage"
|
|
15
30
|
},
|
|
16
31
|
"dependencies": {
|
|
17
|
-
"bs-css": "^
|
|
18
|
-
"
|
|
19
|
-
"
|
|
32
|
+
"bs-css": "^15.0.1",
|
|
33
|
+
"polished": "^4.0.3",
|
|
34
|
+
"rescript": "^9.1.4"
|
|
20
35
|
},
|
|
21
36
|
"devDependencies": {
|
|
22
|
-
"@glennsl/bs-jest": "^0.
|
|
23
|
-
"jest": "^
|
|
24
|
-
"semantic-release": "^
|
|
37
|
+
"@glennsl/bs-jest": "^0.7.0",
|
|
38
|
+
"jest": "^27.0.4",
|
|
39
|
+
"semantic-release": "^18.0.0"
|
|
25
40
|
},
|
|
26
41
|
"jest": {
|
|
27
42
|
"collectCoverageFrom": [
|
|
28
|
-
"<rootDir>/lib/js/src/**/*.js"
|
|
43
|
+
"<rootDir>/{lib/js/src/**/*.js",
|
|
44
|
+
"!<rootDir>/lib/js/src/Polished.js",
|
|
45
|
+
"!<rootDir>/lib/js/src/PolishedCss.js"
|
|
29
46
|
],
|
|
30
47
|
"verbose": true
|
|
31
48
|
}
|
|
@@ -1,46 +1,72 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Utils = {
|
|
2
2
|
open Css_AtomicTypes
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
module Rgba = {
|
|
5
|
+
let regex = "rgba\(\s*(-?\d+|-?\d*\.\d+(?=%))\s*,\s*(-?\d+|-?\d*\.\d+(?=%))\s*,\s*(-?\d+|-?\d*\.\d+(?=%))\s*,\s*(-?\d+|-?\d*.\d+)\s*\)"
|
|
6
|
+
let rgbaRegexGroups = (_, i) => [1, 2, 3, 4]->Js.Array2.includes(i)
|
|
7
|
+
let rgbValue = v => v->Js.Nullable.toOption->Belt.Option.getExn->int_of_string
|
|
8
|
+
let alphaValue = v => v->Js.Nullable.toOption->Belt.Option.getUnsafe->float_of_string
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
let fromString = string => {
|
|
11
|
+
let result = regex->Js.Re.fromString->Js.Re.exec_(string)
|
|
12
|
+
|
|
13
|
+
switch result {
|
|
14
|
+
| None => None
|
|
15
|
+
| Some(result) => {
|
|
16
|
+
let values = result->Js.Re.captures->Js.Array2.filteri(rgbaRegexGroups)
|
|
17
|
+
|
|
18
|
+
let red = values->Array.get(0)->rgbValue
|
|
19
|
+
let green = values->Array.get(1)->rgbValue
|
|
20
|
+
let blue = values->Array.get(2)->rgbValue
|
|
21
|
+
let alpha = values->Array.get(3)->alphaValue
|
|
22
|
+
|
|
23
|
+
Some(Color.rgba(red, green, blue, #num(alpha)))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
|
-
}
|
|
26
28
|
|
|
27
|
-
module Hex = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
module Hex = {
|
|
30
|
+
let fromString = string =>
|
|
31
|
+
#hex(string->Js.String2.slice(~from=1, ~to_=Js.String.length(string)))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let toString = Color.toString
|
|
35
|
+
|
|
36
|
+
let fromString = string => {
|
|
37
|
+
switch string->Js.String2.slice(~from=0, ~to_=4) {
|
|
38
|
+
| "rgba" => string->Rgba.fromString->Belt.Option.getExn
|
|
39
|
+
| _ => string->Hex.fromString
|
|
32
40
|
}
|
|
41
|
+
}
|
|
33
42
|
}
|
|
34
43
|
|
|
35
|
-
let shade = (color, ~amount) =>
|
|
44
|
+
let shade = (color, ~amount) => {
|
|
45
|
+
color->Utils.toString->Polished__Color.shade(~amount)->Utils.fromString
|
|
46
|
+
}
|
|
36
47
|
|
|
37
|
-
let tint = (color, ~amount) =>
|
|
48
|
+
let tint = (color, ~amount) =>
|
|
49
|
+
color->Utils.toString->Polished__Color.tint(~amount)->Utils.fromString
|
|
38
50
|
|
|
39
51
|
let lighten = (color, ~amount) =>
|
|
40
|
-
color->
|
|
52
|
+
color->Utils.toString->Polished__Color.lighten(~amount)->Utils.fromString
|
|
41
53
|
|
|
42
54
|
let darken = (color, ~amount) =>
|
|
43
|
-
color->
|
|
55
|
+
color->Utils.toString->Polished__Color.darken(~amount)->Utils.fromString
|
|
44
56
|
|
|
45
57
|
let transparentize = (color, ~amount) =>
|
|
46
|
-
color->
|
|
58
|
+
color->Utils.toString->Polished__Color.transparentize(~amount)->Utils.Rgba.fromString
|
|
59
|
+
|
|
60
|
+
let getContrast = (c1, c2) => c1->Utils.toString->Polished__Color.getContrast(c2->Utils.toString)
|
|
61
|
+
|
|
62
|
+
let getLuminance = color => color->Utils.toString->Polished__Color.getLuminance
|
|
63
|
+
|
|
64
|
+
let grayscale = color => color->Utils.toString->Polished__Color.grayscale->Utils.fromString
|
|
65
|
+
|
|
66
|
+
let desaturate = (color, ~amount) =>
|
|
67
|
+
color->Utils.toString->Polished__Color.desaturate(~amount)->Utils.fromString
|
|
68
|
+
|
|
69
|
+
let complement = color => color->Utils.toString->Polished__Color.complement->Utils.fromString
|
|
70
|
+
|
|
71
|
+
let adjustHue = (color, ~degree) =>
|
|
72
|
+
color->Utils.toString->Polished__Color.adjustHue(~degree)->Utils.fromString
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var Jest = require("@glennsl/bs-jest/lib/js/src/jest.js");
|
|
5
|
-
var PolishedCss__Color = require("../src/PolishedCss__Color.js");
|
|
6
|
-
|
|
7
|
-
function toEqual(x, y) {
|
|
8
|
-
return Jest.Expect.toEqual(y, x);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
Jest.describe("Color", (function (param) {
|
|
12
|
-
Jest.test("shade", (function (param) {
|
|
13
|
-
var x = Jest.Expect.expect(PolishedCss__Color.shade({
|
|
14
|
-
NAME: "hex",
|
|
15
|
-
VAL: "ff0000"
|
|
16
|
-
}, 0.25));
|
|
17
|
-
return Jest.Expect.toEqual({
|
|
18
|
-
NAME: "hex",
|
|
19
|
-
VAL: "bf000"
|
|
20
|
-
}, x);
|
|
21
|
-
}));
|
|
22
|
-
Jest.test("tint", (function (param) {
|
|
23
|
-
var x = Jest.Expect.expect(PolishedCss__Color.tint({
|
|
24
|
-
NAME: "hex",
|
|
25
|
-
VAL: "ff0000"
|
|
26
|
-
}, 0.25));
|
|
27
|
-
return Jest.Expect.toEqual({
|
|
28
|
-
NAME: "hex",
|
|
29
|
-
VAL: "ff3f3"
|
|
30
|
-
}, x);
|
|
31
|
-
}));
|
|
32
|
-
Jest.test("darken", (function (param) {
|
|
33
|
-
var x = Jest.Expect.expect(PolishedCss__Color.darken({
|
|
34
|
-
NAME: "hex",
|
|
35
|
-
VAL: "ff0000"
|
|
36
|
-
}, 0.25));
|
|
37
|
-
return Jest.Expect.toEqual({
|
|
38
|
-
NAME: "hex",
|
|
39
|
-
VAL: "80000"
|
|
40
|
-
}, x);
|
|
41
|
-
}));
|
|
42
|
-
Jest.test("lighten", (function (param) {
|
|
43
|
-
var x = Jest.Expect.expect(PolishedCss__Color.lighten({
|
|
44
|
-
NAME: "hex",
|
|
45
|
-
VAL: "ff0000"
|
|
46
|
-
}, 0.25));
|
|
47
|
-
return Jest.Expect.toEqual({
|
|
48
|
-
NAME: "hex",
|
|
49
|
-
VAL: "ff808"
|
|
50
|
-
}, x);
|
|
51
|
-
}));
|
|
52
|
-
return Jest.test("transparentize", (function (param) {
|
|
53
|
-
var y = PolishedCss__Color.Rgba.fromString("rgba(255, 0, 0, 0.5)");
|
|
54
|
-
var x = Jest.Expect.expect(PolishedCss__Color.transparentize({
|
|
55
|
-
NAME: "hex",
|
|
56
|
-
VAL: "ff0000"
|
|
57
|
-
}, 0.5));
|
|
58
|
-
return Jest.Expect.toEqual(y, x);
|
|
59
|
-
}));
|
|
60
|
-
}));
|
|
61
|
-
|
|
62
|
-
exports.toEqual = toEqual;
|
|
63
|
-
/* Not a pure module */
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var Jest = require("@glennsl/bs-jest/lib/js/src/jest.js");
|
|
5
|
-
var Caml_option = require("bs-platform/lib/js/caml_option.js");
|
|
6
|
-
var Polished__Math = require("../src/Polished__Math.js");
|
|
7
|
-
var Polished__Color = require("../src/Polished__Color.js");
|
|
8
|
-
var Polished__Mixins = require("../src/Polished__Mixins.js");
|
|
9
|
-
|
|
10
|
-
function keepGoing(param) {
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
Jest.describe("Color", (function (param) {
|
|
15
|
-
Jest.test("shade", (function (param) {
|
|
16
|
-
return Jest.Expect.toBe("#b13c3c", Jest.Expect.expect(Polished__Color.shade("#ed5051", 0.25)));
|
|
17
|
-
}));
|
|
18
|
-
Jest.test("tint", (function (param) {
|
|
19
|
-
return Jest.Expect.toBe("#f17b7c", Jest.Expect.expect(Polished__Color.tint("#ed5051", 0.25)));
|
|
20
|
-
}));
|
|
21
|
-
Jest.test("lighten", (function (param) {
|
|
22
|
-
return Jest.Expect.toBe("#f9c4c4", Jest.Expect.expect(Polished__Color.lighten("#ed5051", 0.25)));
|
|
23
|
-
}));
|
|
24
|
-
Jest.test("darken", (function (param) {
|
|
25
|
-
return Jest.Expect.toBe("#ac1213", Jest.Expect.expect(Polished__Color.darken("#ed5051", 0.25)));
|
|
26
|
-
}));
|
|
27
|
-
Jest.test("hsl", (function (param) {
|
|
28
|
-
return Jest.Expect.toBe("#734d26", Jest.Expect.expect(Polished__Color.hsl(30, 0.5, 0.3)));
|
|
29
|
-
}));
|
|
30
|
-
Jest.test("adjustHue", (function (param) {
|
|
31
|
-
return Jest.Expect.toBe("#ed9f50", Jest.Expect.expect(Polished__Color.adjustHue("#ed5051", 30.5)));
|
|
32
|
-
}));
|
|
33
|
-
Jest.test("complement", (function (param) {
|
|
34
|
-
return Jest.Expect.toBe("#50edec", Jest.Expect.expect(Polished__Color.complement("#ed5051")));
|
|
35
|
-
}));
|
|
36
|
-
Jest.test("desaturate", (function (param) {
|
|
37
|
-
return Jest.Expect.toBe("#9f9f9f", Jest.Expect.expect(Polished__Color.desaturate("#ed5051", 25.5)));
|
|
38
|
-
}));
|
|
39
|
-
Jest.test("getContrast", (function (param) {
|
|
40
|
-
return Jest.Expect.toBe(3.58, Jest.Expect.expect(Polished__Color.getContrast("#ed5051", "#fff")));
|
|
41
|
-
}));
|
|
42
|
-
Jest.test("getLuminance", (function (param) {
|
|
43
|
-
return Jest.Expect.toBe(0.243, Jest.Expect.expect(Polished__Color.getLuminance("#ed5051")));
|
|
44
|
-
}));
|
|
45
|
-
Jest.test("grayscale", (function (param) {
|
|
46
|
-
return Jest.Expect.toBe("#9f9f9f", Jest.Expect.expect(Polished__Color.grayscale("#ed5051")));
|
|
47
|
-
}));
|
|
48
|
-
Jest.test("hsla", (function (param) {
|
|
49
|
-
return Jest.Expect.toBe("rgba(96,159,106,0.5)", Jest.Expect.expect(Polished__Color.hsla(130, 0.25, 0.5, 0.5)));
|
|
50
|
-
}));
|
|
51
|
-
Jest.test("invert", (function (param) {
|
|
52
|
-
return Jest.Expect.toBe("#12a6ae", Jest.Expect.expect(Polished__Color.invert("#ed5951")));
|
|
53
|
-
}));
|
|
54
|
-
Jest.test("meetsContrastGuidelines", (function (param) {
|
|
55
|
-
var expected = {
|
|
56
|
-
AA: true,
|
|
57
|
-
AALarge: true,
|
|
58
|
-
AAA: true,
|
|
59
|
-
AAALarge: true
|
|
60
|
-
};
|
|
61
|
-
return Jest.Expect.toEqual(expected, Jest.Expect.expect(Polished__Color.meetsContrastGuidelines("#000000", "#ffffff")));
|
|
62
|
-
}));
|
|
63
|
-
Jest.test("transparentize", (function (param) {
|
|
64
|
-
return Jest.Expect.toBe("rgba(237,80,81,0.5)", Jest.Expect.expect(Polished__Color.transparentize("#ed5051", 0.5)));
|
|
65
|
-
}));
|
|
66
|
-
Jest.test("hslToColorString", (function (param) {
|
|
67
|
-
var hsl = {
|
|
68
|
-
hue: 240,
|
|
69
|
-
lightness: 1.0,
|
|
70
|
-
saturation: 0.5
|
|
71
|
-
};
|
|
72
|
-
return Jest.Expect.toBe("#fff", Jest.Expect.expect(Polished__Color.hslToColorString(hsl)));
|
|
73
|
-
}));
|
|
74
|
-
Jest.test("mix", (function (param) {
|
|
75
|
-
return Jest.Expect.toBe("#c58383", Jest.Expect.expect(Polished__Color.mix("#ed5051", "#bc9090", 0.2)));
|
|
76
|
-
}));
|
|
77
|
-
Jest.test("opacify", (function (param) {
|
|
78
|
-
return Jest.Expect.toBe("rgba(237,80,81,0.5)", Jest.Expect.expect(Polished__Color.opacify("#ed505100", 0.5)));
|
|
79
|
-
}));
|
|
80
|
-
Jest.test("parseToHsl", (function (param) {
|
|
81
|
-
var expected = {
|
|
82
|
-
hue: 0.0,
|
|
83
|
-
lightness: 0.5,
|
|
84
|
-
saturation: 1.0
|
|
85
|
-
};
|
|
86
|
-
return Jest.Expect.toEqual(expected, Jest.Expect.expect(Polished__Color.parseToHsl("#FF0000")));
|
|
87
|
-
}));
|
|
88
|
-
Jest.test("parseToRgb", (function (param) {
|
|
89
|
-
var expected = {
|
|
90
|
-
red: 237,
|
|
91
|
-
green: 80,
|
|
92
|
-
blue: 81
|
|
93
|
-
};
|
|
94
|
-
return Jest.Expect.toEqual(expected, Jest.Expect.expect(Polished__Color.parseToRgb("#ed5051")));
|
|
95
|
-
}));
|
|
96
|
-
Jest.test("readableColor", (function (param) {
|
|
97
|
-
Jest.Expect.toBe("#fff", Jest.Expect.expect(Polished__Color.readableColor("#ed5051", undefined, undefined, false, undefined)));
|
|
98
|
-
Jest.Expect.toBe("#000", Jest.Expect.expect(Polished__Color.readableColor("#000", undefined, undefined, undefined, undefined)));
|
|
99
|
-
Jest.Expect.toBe("#ff8", Jest.Expect.expect(Polished__Color.readableColor("black", undefined, "#ff8", undefined, undefined)));
|
|
100
|
-
Jest.Expect.toBe("#001", Jest.Expect.expect(Polished__Color.readableColor("white", "#001", undefined, undefined, undefined)));
|
|
101
|
-
Jest.Expect.toBe("#000", Jest.Expect.expect(Polished__Color.readableColor("red", "#333", "#ddd", true, undefined)));
|
|
102
|
-
Jest.Expect.toBe("#333", Jest.Expect.expect(Polished__Color.readableColor("yellow", "#333", "#ddd", true, undefined)));
|
|
103
|
-
return Jest.Expect.toBe("#ddd", Jest.Expect.expect(Polished__Color.readableColor("blue", "#333", "#ddd", true, undefined)));
|
|
104
|
-
}));
|
|
105
|
-
Jest.test("rgb", (function (param) {
|
|
106
|
-
var subject = {
|
|
107
|
-
red: 255,
|
|
108
|
-
green: 255,
|
|
109
|
-
blue: 255
|
|
110
|
-
};
|
|
111
|
-
return Jest.Expect.toBe("#fff", Jest.Expect.expect(Polished__Color.rgb(subject)));
|
|
112
|
-
}));
|
|
113
|
-
Jest.test("rgba", (function (param) {
|
|
114
|
-
var subject = {
|
|
115
|
-
red: 255,
|
|
116
|
-
green: 205,
|
|
117
|
-
blue: 100,
|
|
118
|
-
alpha: 0.7
|
|
119
|
-
};
|
|
120
|
-
return Jest.Expect.toBe("rgba(255,205,100,0.7)", Jest.Expect.expect(Polished__Color.rgba(subject)));
|
|
121
|
-
}));
|
|
122
|
-
Jest.test("saturate", (function (param) {
|
|
123
|
-
return Jest.Expect.toBe("#ff3e3f", Jest.Expect.expect(Polished__Color.saturate("#ed5051", 0.5)));
|
|
124
|
-
}));
|
|
125
|
-
Jest.test("setHue", (function (param) {
|
|
126
|
-
return Jest.Expect.toBe("#cdae64", Jest.Expect.expect(Polished__Color.setHue("#CCCD64", 42)));
|
|
127
|
-
}));
|
|
128
|
-
Jest.test("setLightness", (function (param) {
|
|
129
|
-
return Jest.Expect.toBe("#4d4d19", Jest.Expect.expect(Polished__Color.setLightness("#CCCD64", 0.2)));
|
|
130
|
-
}));
|
|
131
|
-
return Jest.test("setSaturation", (function (param) {
|
|
132
|
-
return Jest.Expect.toBe("#adad84", Jest.Expect.expect(Polished__Color.setSaturation("#CCCD64", 0.2)));
|
|
133
|
-
}));
|
|
134
|
-
}));
|
|
135
|
-
|
|
136
|
-
Jest.describe("Math", (function (param) {
|
|
137
|
-
return Jest.test("math", (function (param) {
|
|
138
|
-
Jest.Expect.toBe("20px", Jest.Expect.expect(Polished__Math.math("12px + 8px", undefined)));
|
|
139
|
-
Jest.Expect.toBe("20rem", Jest.Expect.expect(Polished__Math.math("12rem + 8rem", undefined)));
|
|
140
|
-
return Jest.Expect.toThrow(Jest.Expect.expect(function (param) {
|
|
141
|
-
return Polished__Math.math("10px + 8rem", param);
|
|
142
|
-
}));
|
|
143
|
-
}));
|
|
144
|
-
}));
|
|
145
|
-
|
|
146
|
-
Jest.describe("Mixins", (function (param) {
|
|
147
|
-
Jest.test("between", (function (param) {
|
|
148
|
-
return Jest.Expect.toMatchSnapshot(Jest.Expect.expect(Polished__Mixins.between("400px", "1000px", Polished__Mixins.Size.makeString("16px"), Polished__Mixins.Size.makeString("100px"), undefined)));
|
|
149
|
-
}));
|
|
150
|
-
Jest.test("clearfix", (function (param) {
|
|
151
|
-
return Jest.Expect.toMatchSnapshot(Jest.Expect.expect(Polished__Mixins.clearFix("div")));
|
|
152
|
-
}));
|
|
153
|
-
Jest.test("cover", (function (param) {
|
|
154
|
-
return Jest.Expect.toMatchSnapshot(Jest.Expect.expect(Polished__Mixins.cover(Caml_option.some(Polished__Mixins.Size.makeString("16px")), undefined)));
|
|
155
|
-
}));
|
|
156
|
-
Jest.test("ellipsis", (function (param) {
|
|
157
|
-
return Jest.Expect.toMatchSnapshot(Jest.Expect.expect(Polished__Mixins.ellipsis(Caml_option.some(Polished__Mixins.Size.makeString("16px")), 10, undefined)));
|
|
158
|
-
}));
|
|
159
|
-
Jest.test("fluidRange", (function (param) {
|
|
160
|
-
return Jest.Expect.toMatchSnapshot(Jest.Expect.expect(Polished__Mixins.fluidRange("320px", "1024px", {
|
|
161
|
-
prop: "padding",
|
|
162
|
-
fromSize: Polished__Mixins.Size.makeString("20px"),
|
|
163
|
-
toSize: Polished__Mixins.Size.makeString("20px")
|
|
164
|
-
})));
|
|
165
|
-
}));
|
|
166
|
-
return Jest.test("fluidRangeWithArray", (function (param) {
|
|
167
|
-
return Jest.Expect.toMatchSnapshot(Jest.Expect.expect(Polished__Mixins.fluidRangeWithArray("320px", "1024px", [
|
|
168
|
-
{
|
|
169
|
-
prop: "padding",
|
|
170
|
-
fromSize: Polished__Mixins.Size.makeString("16px"),
|
|
171
|
-
toSize: Polished__Mixins.Size.makeString("32px")
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
prop: "margin",
|
|
175
|
-
fromSize: Polished__Mixins.Size.makeString("16px"),
|
|
176
|
-
toSize: Polished__Mixins.Size.makeString("32px")
|
|
177
|
-
}
|
|
178
|
-
])));
|
|
179
|
-
}));
|
|
180
|
-
}));
|
|
181
|
-
|
|
182
|
-
exports.keepGoing = keepGoing;
|
|
183
|
-
/* Not a pure module */
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Mixins between 1`] = `"calc(-40.00px + 14.00vw)"`;
|
|
4
|
-
|
|
5
|
-
exports[`Mixins clearfix 1`] = `
|
|
6
|
-
Object {
|
|
7
|
-
"div::after": Object {
|
|
8
|
-
"clear": "both",
|
|
9
|
-
"content": "\\"\\"",
|
|
10
|
-
"display": "table",
|
|
11
|
-
},
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`Mixins cover 1`] = `
|
|
16
|
-
Object {
|
|
17
|
-
"bottom": "16px",
|
|
18
|
-
"left": "16px",
|
|
19
|
-
"position": "absolute",
|
|
20
|
-
"right": "16px",
|
|
21
|
-
"top": "16px",
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
exports[`Mixins ellipsis 1`] = `
|
|
26
|
-
Object {
|
|
27
|
-
"WebkitBoxOrient": "vertical",
|
|
28
|
-
"WebkitLineClamp": 10,
|
|
29
|
-
"display": "-webkit-box",
|
|
30
|
-
"maxWidth": "16px",
|
|
31
|
-
"overflow": "hidden",
|
|
32
|
-
"textOverflow": "ellipsis",
|
|
33
|
-
"whiteSpace": "normal",
|
|
34
|
-
"wordWrap": "normal",
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
exports[`Mixins fluidRange 1`] = `
|
|
39
|
-
Object {
|
|
40
|
-
"@media (min-width: 1024px)": Object {
|
|
41
|
-
"padding": "20px",
|
|
42
|
-
},
|
|
43
|
-
"@media (min-width: 320px)": Object {
|
|
44
|
-
"padding": "calc(20.00px + 0.00vw)",
|
|
45
|
-
},
|
|
46
|
-
"padding": "20px",
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
exports[`Mixins fluidRangeWithArray 1`] = `
|
|
51
|
-
Object {
|
|
52
|
-
"@media (min-width: 1024px)": Object {
|
|
53
|
-
"margin": "32px",
|
|
54
|
-
"padding": "32px",
|
|
55
|
-
},
|
|
56
|
-
"@media (min-width: 320px)": Object {
|
|
57
|
-
"margin": "calc(8.73px + 2.27vw)",
|
|
58
|
-
"padding": "calc(8.73px + 2.27vw)",
|
|
59
|
-
},
|
|
60
|
-
"margin": "16px",
|
|
61
|
-
"padding": "16px",
|
|
62
|
-
}
|
|
63
|
-
`;
|
package/lib/js/src/Polished.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var Caml_array = require("bs-platform/lib/js/caml_array.js");
|
|
5
|
-
var Caml_format = require("bs-platform/lib/js/caml_format.js");
|
|
6
|
-
var Caml_option = require("bs-platform/lib/js/caml_option.js");
|
|
7
|
-
var Css_AtomicTypes = require("bs-css/lib/js/src/Css_AtomicTypes.js");
|
|
8
|
-
var Polished__Color = require("./Polished__Color.js");
|
|
9
|
-
|
|
10
|
-
var regex = "rgba\\(\\s*(-?\\d+|-?\\d*\\.\\d+(?=%))\\s*,\\s*(-?\\d+|-?\\d*\\.\\d+(?=%))\\s*,\\s*(-?\\d+|-?\\d*\\.\\d+(?=%))\\s*,\\s*(-?\\d+|-?\\d*.\\d+)\\s*\\)";
|
|
11
|
-
|
|
12
|
-
function rgbaRegexGroups(param, i) {
|
|
13
|
-
return [
|
|
14
|
-
1,
|
|
15
|
-
2,
|
|
16
|
-
3,
|
|
17
|
-
4
|
|
18
|
-
].includes(i);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function rgbValue(v) {
|
|
22
|
-
return Caml_format.caml_int_of_string((v == null) ? undefined : Caml_option.some(v));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function alphaValue(v) {
|
|
26
|
-
return Caml_format.caml_float_of_string((v == null) ? undefined : Caml_option.some(v));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function fromString(string) {
|
|
30
|
-
var values = Caml_option.null_to_opt(new RegExp(regex).exec(string)).filter(rgbaRegexGroups);
|
|
31
|
-
var red = Caml_format.caml_int_of_string(Caml_option.nullable_to_opt(Caml_array.get(values, 0)));
|
|
32
|
-
var green = Caml_format.caml_int_of_string(Caml_option.nullable_to_opt(Caml_array.get(values, 1)));
|
|
33
|
-
var blue = Caml_format.caml_int_of_string(Caml_option.nullable_to_opt(Caml_array.get(values, 2)));
|
|
34
|
-
var alpha = Caml_format.caml_float_of_string(Caml_option.nullable_to_opt(Caml_array.get(values, 3)));
|
|
35
|
-
return Css_AtomicTypes.Color.rgba(red, green, blue, {
|
|
36
|
-
NAME: "num",
|
|
37
|
-
VAL: alpha
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
var Rgba = {
|
|
42
|
-
regex: regex,
|
|
43
|
-
rgbaRegexGroups: rgbaRegexGroups,
|
|
44
|
-
rgbValue: rgbValue,
|
|
45
|
-
alphaValue: alphaValue,
|
|
46
|
-
fromString: fromString
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
function fromString$1(string) {
|
|
50
|
-
return {
|
|
51
|
-
NAME: "hex",
|
|
52
|
-
VAL: string.slice(1, -1)
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function toString(hex) {
|
|
57
|
-
return "#" + hex.VAL;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var Hex = {
|
|
61
|
-
fromString: fromString$1,
|
|
62
|
-
toString: toString
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
function shade(color, amount) {
|
|
66
|
-
return fromString$1(Polished__Color.shade(toString(color), amount));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function tint(color, amount) {
|
|
70
|
-
return fromString$1(Polished__Color.tint(toString(color), amount));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function lighten(color, amount) {
|
|
74
|
-
return fromString$1(Polished__Color.lighten(toString(color), amount));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function darken(color, amount) {
|
|
78
|
-
return fromString$1(Polished__Color.darken(toString(color), amount));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function transparentize(color, amount) {
|
|
82
|
-
return fromString(Polished__Color.transparentize(toString(color), amount));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
exports.Rgba = Rgba;
|
|
86
|
-
exports.Hex = Hex;
|
|
87
|
-
exports.shade = shade;
|
|
88
|
-
exports.tint = tint;
|
|
89
|
-
exports.lighten = lighten;
|
|
90
|
-
exports.darken = darken;
|
|
91
|
-
exports.transparentize = transparentize;
|
|
92
|
-
/* Polished__Color Not a pure module */
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var Polished = require("polished");
|
|
5
|
-
|
|
6
|
-
function shade(color, amount) {
|
|
7
|
-
return Polished.shade(amount, color);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function tint(color, amount) {
|
|
11
|
-
return Polished.tint(amount, color);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function lighten(color, amount) {
|
|
15
|
-
return Polished.lighten(amount, color);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function darken(color, amount) {
|
|
19
|
-
return Polished.darken(amount, color);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function hsl(hue, saturation, lightness) {
|
|
23
|
-
return Polished.hsl(hue, saturation, lightness);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function adjustHue(color, degree) {
|
|
27
|
-
return Polished.adjustHue(degree, color);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function complement(prim) {
|
|
31
|
-
return Polished.complement(prim);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function desaturate(color, amount) {
|
|
35
|
-
return Polished.desaturate(amount, color);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getContrast(prim, prim$1) {
|
|
39
|
-
return Polished.getContrast(prim, prim$1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function getLuminance(prim) {
|
|
43
|
-
return Polished.getLuminance(prim);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function grayscale(prim) {
|
|
47
|
-
return Polished.grayscale(prim);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function hsla(hue, saturation, lightness, alpha) {
|
|
51
|
-
return Polished.hsla(hue, saturation, lightness, alpha);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function invert(prim) {
|
|
55
|
-
return Polished.invert(prim);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function meetsContrastGuidelines(prim, prim$1) {
|
|
59
|
-
return Polished.meetsContrastGuidelines(prim, prim$1);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function transparentize(color, amount) {
|
|
63
|
-
return Polished.transparentize(amount, color);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function hslToColorString(prim) {
|
|
67
|
-
return Polished.hslToColorString(prim);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function mix(color1, color2, weight) {
|
|
71
|
-
return Polished.mix(weight, color1, color2);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function opacify(color, amount) {
|
|
75
|
-
return Polished.opacify(amount, color);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function parseToHsl(prim) {
|
|
79
|
-
return Polished.parseToHsl(prim);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function parseToRgb(prim) {
|
|
83
|
-
return Polished.parseToRgb(prim);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function readableColor(color, lightReturnColorOpt, darkReturnColorOpt, strictOpt, param) {
|
|
87
|
-
var lightReturnColor = lightReturnColorOpt !== undefined ? lightReturnColorOpt : "#fff";
|
|
88
|
-
var darkReturnColor = darkReturnColorOpt !== undefined ? darkReturnColorOpt : "#000";
|
|
89
|
-
var strict = strictOpt !== undefined ? strictOpt : true;
|
|
90
|
-
return Polished.readableColor(color, lightReturnColor, darkReturnColor, strict);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function rgb(prim) {
|
|
94
|
-
return Polished.rgb(prim);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function rgba(prim) {
|
|
98
|
-
return Polished.rgba(prim);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function saturate(color, amount) {
|
|
102
|
-
return Polished.saturate(amount, color);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function setHue(color, hue) {
|
|
106
|
-
return Polished.setHue(hue, color);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function setLightness(color, lightness) {
|
|
110
|
-
return Polished.setLightness(lightness, color);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function setSaturation(color, saturation) {
|
|
114
|
-
return Polished.setSaturation(saturation, color);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
exports.shade = shade;
|
|
118
|
-
exports.tint = tint;
|
|
119
|
-
exports.lighten = lighten;
|
|
120
|
-
exports.darken = darken;
|
|
121
|
-
exports.hsl = hsl;
|
|
122
|
-
exports.adjustHue = adjustHue;
|
|
123
|
-
exports.complement = complement;
|
|
124
|
-
exports.desaturate = desaturate;
|
|
125
|
-
exports.getContrast = getContrast;
|
|
126
|
-
exports.getLuminance = getLuminance;
|
|
127
|
-
exports.grayscale = grayscale;
|
|
128
|
-
exports.hsla = hsla;
|
|
129
|
-
exports.invert = invert;
|
|
130
|
-
exports.meetsContrastGuidelines = meetsContrastGuidelines;
|
|
131
|
-
exports.transparentize = transparentize;
|
|
132
|
-
exports.hslToColorString = hslToColorString;
|
|
133
|
-
exports.mix = mix;
|
|
134
|
-
exports.opacify = opacify;
|
|
135
|
-
exports.parseToHsl = parseToHsl;
|
|
136
|
-
exports.parseToRgb = parseToRgb;
|
|
137
|
-
exports.readableColor = readableColor;
|
|
138
|
-
exports.rgb = rgb;
|
|
139
|
-
exports.rgba = rgba;
|
|
140
|
-
exports.saturate = saturate;
|
|
141
|
-
exports.setHue = setHue;
|
|
142
|
-
exports.setLightness = setLightness;
|
|
143
|
-
exports.setSaturation = setSaturation;
|
|
144
|
-
/* polished Not a pure module */
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var Polished = require("polished");
|
|
5
|
-
var Js_undefined = require("bs-platform/lib/js/js_undefined.js");
|
|
6
|
-
|
|
7
|
-
function makeString(s) {
|
|
8
|
-
return s;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function makeFloat(i) {
|
|
12
|
-
return i;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
var Size = {
|
|
16
|
-
makeString: makeString,
|
|
17
|
-
makeFloat: makeFloat
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
function between(minScreen, maxScreen, fromSize, toSize, param) {
|
|
21
|
-
return Polished.between(fromSize, toSize, minScreen, maxScreen);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function clearFix(parent) {
|
|
25
|
-
return Polished.clearFix(parent);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function cover(offset, param) {
|
|
29
|
-
return Polished.cover(Js_undefined.fromOption(offset));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function ellipsis(width, lines, param) {
|
|
33
|
-
return Polished.ellipsis(Js_undefined.fromOption(width), lines);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function fluidRange(minScreen, maxScreen, cssProp) {
|
|
37
|
-
return Polished.fluidRange(cssProp, Js_undefined.fromOption(minScreen), Js_undefined.fromOption(maxScreen));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function fluidRangeWithArray(minScreen, maxScreen, cssProps) {
|
|
41
|
-
return Polished.fluidRange(cssProps, Js_undefined.fromOption(minScreen), Js_undefined.fromOption(maxScreen));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
exports.Size = Size;
|
|
45
|
-
exports.between = between;
|
|
46
|
-
exports.clearFix = clearFix;
|
|
47
|
-
exports.cover = cover;
|
|
48
|
-
exports.ellipsis = ellipsis;
|
|
49
|
-
exports.fluidRange = fluidRange;
|
|
50
|
-
exports.fluidRangeWithArray = fluidRangeWithArray;
|
|
51
|
-
/* polished Not a pure module */
|