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.
@@ -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: [master]
6
- pull_request:
7
- branches: [master]
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
- build:
11
- runs-on: macos-latest
12
+ release:
13
+ name: Release
14
+ runs-on: ubuntu-latest
12
15
  steps:
13
16
  - name: Checkout
14
- uses: actions/checkout@v2
15
- - name: Setup node
16
- uses: actions/setup-node@v1
17
+ uses: actions/checkout@v4
17
18
  with:
18
- node-version: "12.x"
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: yarn --frozen-lockfile --ignore-engines
21
- - name: Compile ReScript files
22
- run: yarn res:build
26
+ run: npm ci
27
+ - name: Build
28
+ run: npm run res:build
23
29
  - name: Run tests
24
- run: yarn test:ci
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
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
31
- run: yarn global add semantic-release && semantic-release
34
+ run: npx semantic-release
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no -- commitlint --edit $1
@@ -0,0 +1 @@
1
+ npm test
@@ -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/master/src/Polished.res) module to see the available functions.
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 toEqual = (x, y) => x |> toEqual(y)
6
-
7
- describe("Color", () => {
4
+ let colorTests = () => {
8
5
  open Color
9
6
 
10
- test("shade with hex", () => {
11
- #hex("ff0000")->shade(~amount=0.25)->expect->toEqual(#hex("bf0000"))
12
- })
13
-
14
- test("shade with rgb", () => {
15
- Css_AtomicTypes.Color.rgb(255, 0, 0)->shade(~amount=0.25)->expect->toEqual(#hex("bf0000"))
16
- })
17
-
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"))
35
- })
36
-
37
- test("lighten with hex", () => {
38
- #hex("ff0000")->lighten(~amount=0.25)->expect->toEqual(#hex("ff8080"))
39
- })
40
-
41
- test("transparentize with hex", () => {
42
- #hex("ff0000")
43
- ->transparentize(~amount=0.5)
44
- ->expect
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
-
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->expect->toEqual(#hex("ff0000"))
77
- })
78
-
64
+ assertEqual("#ff0000"->fromString, #hex("ff0000"))
65
+ }),
79
66
  test("fromString with rgba", () => {
80
- "rgba(255, 0, 0, 0.5)"->fromString->expect->toEqual(#rgba(255, 0, 0, #num(0.5)))
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())]