rescript-polished 1.15.0 → 2.1.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 +23 -20
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +1 -0
- package/.releaserc.json +79 -0
- package/README.md +1 -1
- package/__tests__/PolishedCssTest.res +66 -77
- package/__tests__/PolishedTest.res +231 -237
- package/__tests__/RunTests.res +5 -0
- package/__tests__/TestFramework.res +170 -0
- package/commitlint.config.js +0 -0
- package/package.json +24 -20
- package/{bsconfig.json → rescript.json} +7 -3
- package/src/PolishedCss__Color.res +16 -16
- package/src/Polished__Color.res +14 -14
- package/src/Polished__Mixins.res +12 -12
- package/lib/js/__tests__/PolishedCssTest.js +0 -171
- 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 -140
- 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
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
1
|
+
name: Release and Publish
|
|
3
2
|
on:
|
|
4
3
|
push:
|
|
5
|
-
branches:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
issues: write
|
|
9
|
+
pull-requests: write
|
|
10
|
+
id-token: write # Required for npm provenance
|
|
9
11
|
jobs:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
release:
|
|
13
|
+
name: Release
|
|
14
|
+
runs-on: ubuntu-latest
|
|
12
15
|
steps:
|
|
13
16
|
- name: Checkout
|
|
14
|
-
uses: actions/checkout@
|
|
15
|
-
- name: Setup node
|
|
16
|
-
uses: actions/setup-node@v1
|
|
17
|
+
uses: actions/checkout@v4
|
|
17
18
|
with:
|
|
18
|
-
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
persist-credentials: false
|
|
21
|
+
- name: Setup Node.js
|
|
22
|
+
uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: 'lts/*'
|
|
19
25
|
- name: Install dependencies
|
|
20
|
-
run:
|
|
21
|
-
- name:
|
|
22
|
-
run:
|
|
26
|
+
run: npm ci
|
|
27
|
+
- name: Build
|
|
28
|
+
run: npm run res:build
|
|
23
29
|
- name: Run tests
|
|
24
|
-
run:
|
|
25
|
-
- name: Report to codecov
|
|
26
|
-
uses: codecov/codecov-action@v1
|
|
30
|
+
run: npm run test:ci
|
|
27
31
|
- name: Release
|
|
28
32
|
env:
|
|
29
33
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
30
|
-
|
|
31
|
-
run: yarn global add semantic-release && semantic-release
|
|
34
|
+
run: npx semantic-release
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm test
|
package/.releaserc.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": ["main"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
[
|
|
5
|
+
"@semantic-release/commit-analyzer",
|
|
6
|
+
{
|
|
7
|
+
"preset": "conventionalcommits",
|
|
8
|
+
"releaseRules": [
|
|
9
|
+
{ "type": "feat", "release": "minor" },
|
|
10
|
+
{ "type": "fix", "release": "patch" },
|
|
11
|
+
{ "type": "perf", "release": "patch" },
|
|
12
|
+
{ "type": "revert", "release": "patch" },
|
|
13
|
+
{ "type": "docs", "release": false },
|
|
14
|
+
{ "type": "style", "release": false },
|
|
15
|
+
{ "type": "refactor", "release": "patch" },
|
|
16
|
+
{ "type": "test", "release": false },
|
|
17
|
+
{ "type": "build", "release": false },
|
|
18
|
+
{ "type": "ci", "release": false },
|
|
19
|
+
{ "type": "chore", "release": false },
|
|
20
|
+
{ "breaking": true, "release": "major" }
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
"@semantic-release/release-notes-generator",
|
|
26
|
+
{
|
|
27
|
+
"preset": "conventionalcommits",
|
|
28
|
+
"presetConfig": {
|
|
29
|
+
"types": [
|
|
30
|
+
{ "type": "feat", "section": "Features" },
|
|
31
|
+
{ "type": "fix", "section": "Bug Fixes" },
|
|
32
|
+
{ "type": "perf", "section": "Performance Improvements" },
|
|
33
|
+
{ "type": "revert", "section": "Reverts" },
|
|
34
|
+
{ "type": "docs", "section": "Documentation" },
|
|
35
|
+
{ "type": "style", "section": "Styles" },
|
|
36
|
+
{ "type": "refactor", "section": "Code Refactoring" },
|
|
37
|
+
{ "type": "test", "section": "Tests" },
|
|
38
|
+
{ "type": "build", "section": "Build System" },
|
|
39
|
+
{ "type": "ci", "section": "Continuous Integration" }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
"@semantic-release/changelog",
|
|
46
|
+
{
|
|
47
|
+
"changelogFile": "CHANGELOG.md",
|
|
48
|
+
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines."
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"@semantic-release/npm",
|
|
53
|
+
{
|
|
54
|
+
"npmPublish": true,
|
|
55
|
+
"pkgRoot": ".",
|
|
56
|
+
"tarballDir": "dist",
|
|
57
|
+
"provenance": true
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
"@semantic-release/github",
|
|
62
|
+
{
|
|
63
|
+
"assets": [
|
|
64
|
+
{
|
|
65
|
+
"path": "CHANGELOG.md",
|
|
66
|
+
"label": "Changelog"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"@semantic-release/git",
|
|
73
|
+
{
|
|
74
|
+
"assets": ["CHANGELOG.md", "package.json", "package-lock.json"],
|
|
75
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
]
|
|
79
|
+
}
|
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
|
|
|
@@ -1,83 +1,72 @@
|
|
|
1
|
-
open Jest
|
|
2
|
-
open Expect
|
|
3
1
|
open PolishedCss
|
|
2
|
+
open TestFramework
|
|
4
3
|
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
describe("Color", () => {
|
|
4
|
+
let colorTests = () => {
|
|
8
5
|
open Color
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
7
|
+
[
|
|
8
|
+
test("shade with hex", () => {
|
|
9
|
+
assertEqual(#hex("ff0000")->shade(~amount=0.25), #hex("bf0000"))
|
|
10
|
+
}),
|
|
11
|
+
test("shade with rgb", () => {
|
|
12
|
+
assertEqual(Css_Js_Core.Types.Color.rgb(255, 0, 0)->shade(~amount=0.25), #hex("bf0000"))
|
|
13
|
+
}),
|
|
14
|
+
test("shade with rgba", () => {
|
|
15
|
+
assertEqual(
|
|
16
|
+
Css_Js_Core.Types.Color.rgba(255, 0, 0, #num(0.25))->shade(~amount=0.25),
|
|
17
|
+
Css_Js_Core.Types.Color.rgba(76, 0, 0, #num(0.4375)),
|
|
18
|
+
)
|
|
19
|
+
}),
|
|
20
|
+
test("tint with hex", () => {
|
|
21
|
+
assertEqual(#hex("ff0000")->tint(~amount=0.25), #hex("ff3f3f"))
|
|
22
|
+
}),
|
|
23
|
+
test("tint with rgb", () => {
|
|
24
|
+
assertEqual(Css_Js_Core.Types.Color.rgb(255, 0, 0)->tint(~amount=0.25), #hex("ff3f3f"))
|
|
25
|
+
}),
|
|
26
|
+
test("darken with hex", () => {
|
|
27
|
+
assertEqual(#hex("ff0000")->darken(~amount=0.25), #hex("800000"))
|
|
28
|
+
}),
|
|
29
|
+
test("lighten with hex", () => {
|
|
30
|
+
assertEqual(#hex("ff0000")->lighten(~amount=0.25), #hex("ff8080"))
|
|
31
|
+
}),
|
|
32
|
+
test("transparentize with hex", () => {
|
|
33
|
+
assertEqual(
|
|
34
|
+
#hex("ff0000")->transparentize(~amount=0.5),
|
|
35
|
+
Utils.Rgba.fromString("rgba(255, 0, 0, 0.5)"),
|
|
36
|
+
)
|
|
37
|
+
}),
|
|
38
|
+
test("getContrast with hex", () => {
|
|
39
|
+
assertEqual(#hex("ff0000")->getContrast(#hex("0000ff")), 2.16)
|
|
40
|
+
}),
|
|
41
|
+
test("getLuminance with hex", () => {
|
|
42
|
+
assertEqual(#hex("ff0000")->getLuminance, 0.213)
|
|
43
|
+
}),
|
|
44
|
+
test("grayscale with hex", () => {
|
|
45
|
+
assertEqual(#hex("ff0000")->grayscale, #hex("808080"))
|
|
46
|
+
}),
|
|
47
|
+
test("desaturate with hex", () => {
|
|
48
|
+
assertEqual(#hex("ff0000")->desaturate(~amount=0.3), #hex("d92626"))
|
|
49
|
+
}),
|
|
50
|
+
test("complement with hex", () => {
|
|
51
|
+
assertEqual(#hex("ff0000")->complement, #hex("0ff"))
|
|
52
|
+
}),
|
|
53
|
+
test("adjustHue with hex", () => {
|
|
54
|
+
assertEqual(#hex("ff0000")->adjustHue(~degree=0.3), #hex("ff0100"))
|
|
55
|
+
}),
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let utilsTests = () => {
|
|
60
|
+
open Color.Utils
|
|
61
|
+
|
|
62
|
+
[
|
|
75
63
|
test("fromString with hex", () => {
|
|
76
|
-
"#ff0000"->fromString
|
|
77
|
-
})
|
|
78
|
-
|
|
64
|
+
assertEqual("#ff0000"->fromString, #hex("ff0000"))
|
|
65
|
+
}),
|
|
79
66
|
test("fromString with rgba", () => {
|
|
80
|
-
"rgba(255, 0, 0, 0.5)"->fromString
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
}
|
|
67
|
+
assertEqual("rgba(255, 0, 0, 0.5)"->fromString, #rgba(255, 0, 0, #num(0.5)))
|
|
68
|
+
}),
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let suites = [suite("Color", colorTests()), suite("Color.Utils", utilsTests())]
|