This repository has been archived by the owner on Dec 27, 2021. It is now read-only.
forked from Naoray/tailwind-caret-color
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
4,242 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
end_of_line = lf | ||
# editorconfig-tools is unable to ignore longs strings or urls | ||
max_line_length = off | ||
|
||
[CHANGELOG.md] | ||
indent_size = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2.3.3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v1.4.4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Use cached node_modules | ||
id: cache | ||
uses: actions/cache@v2.1.1 | ||
with: | ||
path: node_modules | ||
key: nodeModules-${{ hashFiles('**/yarn.lock') }}-${{ matrix.node-version }} | ||
restore-keys: | | ||
nodeModules- | ||
- name: Install dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: npm install | ||
env: | ||
CI: true | ||
|
||
- name: Execute tests | ||
run: npm test | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_STORE | ||
node_modules | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Changelog | ||
|
||
All notable changes to `@graxmonzo/tailwind-caret-color` will be documented in this file. | ||
|
||
## 2.0.0 - 18-01-2021 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) GraxMonzo <bekzatsmov@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
const plugin = require("tailwindcss/plugin"); | ||
|
||
module.exports = function () { | ||
return function ({ e, addUtilities, theme }) { | ||
colors = theme('colors'); | ||
module.exports = plugin.withOptions( | ||
({ className = "caret" } = {}) => { | ||
return ({ e, addUtilities, theme, variants }) => { | ||
const colors = theme("colors"); | ||
|
||
const caretColors = Object.keys(colors) | ||
.reduce((acc, key) => { | ||
if (typeof colors[key] === 'string') { | ||
const caretColors = Object.keys(colors).reduce((acc, key) => { | ||
if (typeof colors[key] === "string") { | ||
return { | ||
...acc, | ||
[`.caret-${e(key)}`]: { | ||
'caret-color': colors[key] | ||
[`.${className}-${e(key)}`]: { | ||
"caret-color": colors[key], | ||
}, | ||
}; | ||
} | ||
|
||
const variants = Object.keys(colors[key]); | ||
const colorShades = Object.keys(colors[key]); | ||
|
||
return { | ||
...acc, | ||
...variants.reduce((a, variant) => ({ | ||
...a, | ||
[`.caret-${e(key)}-${variant}`]: { | ||
'caret-color': colors[key][variant] | ||
}, | ||
}), {}), | ||
...colorShades.reduce( | ||
(a, shade) => ({ | ||
...a, | ||
[`.${className}-${e(key)}-${shade}`]: { | ||
"caret-color": colors[key][shade], | ||
}, | ||
}), | ||
{} | ||
), | ||
}; | ||
|
||
}, {}); | ||
|
||
addUtilities(caretColors); | ||
} | ||
} | ||
addUtilities(caretColors, variants("caretColor")); | ||
}; | ||
}, | ||
() => ({ | ||
variants: { caretColor: ["dark", "active"] }, | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
{ | ||
"name": "@graxmonzo/tailwind-caret-color", | ||
"version": "1.0.5", | ||
"version": "2.0.0", | ||
"description": "Tailwind plugin to create caret color classes", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/GraxMonzo/tailwind-caret-color.git" | ||
}, | ||
"author": "Krishan Koenig", | ||
"contributors": [ | ||
"Bekzat Samatov" | ||
], | ||
"author": { | ||
"name": "Beka", | ||
"email": "bekzatsmov@gmail.com", | ||
"url": "https://graxmonzo.com" | ||
}, | ||
"license": "MIT", | ||
"private": false, | ||
"bugs": { | ||
"url": "https://github.com/GraxMonzo/tailwind-caret-color/issues" | ||
}, | ||
"homepage": "https://github.com/GraxMonzo/tailwind-caret-color#readme", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "jest" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://npm.pkg.github.com/" | ||
}, | ||
"devDependencies": { | ||
"jest": "^26.6.3", | ||
"jest-matcher-css": "^1.1.0", | ||
"postcss": "^8.2.4", | ||
"tailwindcss": "^2.0.2" | ||
}, | ||
"dependencies": { | ||
"lodash.merge": "^4.6.2" | ||
} | ||
} |
Oops, something went wrong.