Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit ee362a6

Browse files
committed
initial commit
0 parents  commit ee362a6

File tree

7 files changed

+1398
-0
lines changed

7 files changed

+1398
-0
lines changed

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
publish-npm:
9+
name: Publish to npm
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 20
19+
registry-url: https://registry.npmjs.org/
20+
cache: npm
21+
- run: npm install -g npm@latest
22+
- run: npm ci
23+
- run: npm version ${TAG_NAME} --git-tag-version=false
24+
env:
25+
TAG_NAME: ${{ github.event.release.tag_name }}
26+
- run: npm publish --provenance --access public
27+
env:
28+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.idea

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 cloudnode.pro
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# tailwindcss-focus-visible-within
2+
3+
This plugin allows you to target parent nodes with a child that has `:focus-visible`.
4+
5+
## Usage
6+
7+
Install as dev-dependency using:
8+
9+
```sh
10+
npm i -D tailwindcss-focus-visible-within
11+
```
12+
Add the plugin to your `tailwind.config.js`:
13+
14+
```js
15+
module.exports = {
16+
theme: {
17+
//
18+
},
19+
plugins: [
20+
require('tailwindcss-focus-visible-within')
21+
//
22+
],
23+
}
24+
```
25+
You can now apply Tailwind classes to a parent node that has an element child with the `focus-visible` state.
26+
27+
```html
28+
<div class="focus-visible-within:…">
29+
```
30+
31+
## Demo
32+
33+
[**Tailwind Play**](https://play.tailwindcss.com/6iJG2qn9re)
34+
35+
```html
36+
<div class="p-3 relative rounded-lg focus-visible-within:outline focus-visible-within:outline-2 focus-visible-within:outline-blue-600">
37+
<a href="#" class="font-semibold focus-visible:outline-none">
38+
Link title
39+
<span class="absolute inset-0"></span>
40+
</a>
41+
<p class="text-neutral-600">Link description</p>
42+
</div>
43+
```

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const plugin = require('tailwindcss/plugin');
2+
3+
module.exports = plugin(function ({addVariant}) {
4+
addVariant('focus-visible-within', ['&:has(:focus-visible)'])
5+
});

0 commit comments

Comments
 (0)