@igorkowalczyk/is-browser 5.0.4 → 5.1.1

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/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  ## 📥 Installation
18
18
 
19
- **Tailwind.css v3 or newer is required**.
19
+ Install the package using your package manager of choice. Tailwind CSS v3 and v4 are supported.
20
20
 
21
21
  ```
22
22
  npm install @igorkowalczyk/is-browser
@@ -26,23 +26,38 @@ pnpm add @igorkowalczyk/is-browser
26
26
 
27
27
  ## 📦 Usage
28
28
 
29
- Add to `plugins` in your **tailwind.config.js**:
29
+ ### Tailwind CSS v4
30
+
31
+ Import the plugin in your CSS file.
32
+
33
+ ```css
34
+ @import "tailwindcss";
35
+ @plugin "@igorkowalczyk/is-browser";
36
+ ```
37
+
38
+ That's it! You can now use the plugin in your components.
39
+
40
+ ### Tailwind CSS v3
41
+
42
+ Add to `plugins` in your `tailwind.config.js`.
30
43
 
31
44
  ```js
32
45
  module.exports = {
33
- // ...
34
- plugins: [
35
- require("@igorkowalczyk/is-browser"),
36
- // ...other plugins.
37
- ],
46
+ // ...
47
+ plugins: [
48
+ require("@igorkowalczyk/is-browser"),
49
+ // ...other plugins.
50
+ ],
38
51
  };
39
52
  ```
40
53
 
54
+ ## 🎨 Examples
55
+
41
56
  Style your components using `{browser_name}:{class}`, e.g. `firefox:bg-red-100`, `chrome:bg-blue-100`, etc.
42
57
 
43
58
  ```jsx
44
59
  <div className="firefox:bg-red-400 chrome:bg-blue-400 bg-yellow-400">
45
- <p>On firefox background should be red, on chrome should be blue and on other browsers it should be yellow</p>
60
+ <p>On firefox background should be red, on chrome should be blue and on other browsers it should be yellow</p>
46
61
  </div>
47
62
  ```
48
63
 
@@ -56,15 +71,15 @@ Style your components using `{browser_name}:{class}`, e.g. `firefox:bg-red-100`,
56
71
 
57
72
  ## ⁉️ Issues
58
73
 
59
- If you have any issues with the page please create [new issue here](https://github.com/igorkowalczyk/is-browser/issues)
74
+ If you come across any errors or have suggestions for improvements, please create a [new issue here](https://github.com/igorkowalczyk/is-browser/issues) and describe it clearly.
60
75
 
61
76
  ## 📥 Pull Requests
62
77
 
63
- When submitting a pull request:
78
+ When submitting a pull request, please follow these steps:
64
79
 
65
- - Clone the repo.
66
- - Create a branch off of `main` and give it a meaningful name (e.g. `my-awesome-new-feature`).
67
- - Open a [pull request](https://github.com/igorkowalczyk/is-browser/pulls) on [GitHub](https://github.com) and describe the feature or fix.
80
+ - Clone [this repository](https://github.com/igorkowalczyk/is-browser) `https://github.com/igorkowalczyk/is-browser.git`
81
+ - Create a branch from `main` and give it a meaningful name (e.g. `my-awesome-new-feature`).
82
+ - Open a [pull request](https://github.com/igorkowalczyk/is-browser/pulls) on [GitHub](https://github.com/) and clearly describe the feature or fix you are proposing.
68
83
 
69
84
  ## 📋 License
70
85
 
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ 'use strict';var createPlugin=require('tailwindcss/plugin');/* eslint-disable func-names */
2
+ const isBrowser = createPlugin(function ({ addVariant }) {
3
+ addVariant("firefox", "@supports (-moz-appearance: none)");
4
+ addVariant("safari", "@supports (background: -webkit-named-image(i))");
5
+ addVariant("chrome", "@supports (-webkit-app-region: inherit)");
6
+ }); // So rollup can infer the return type
7
+ module.exports=isBrowser;
@@ -0,0 +1,3 @@
1
+ import createPlugin from "tailwindcss/plugin";
2
+ declare const isBrowser: ReturnType<typeof createPlugin>;
3
+ export default isBrowser;
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import createPlugin from'tailwindcss/plugin';/* eslint-disable func-names */
2
+ const isBrowser = createPlugin(function ({ addVariant }) {
3
+ addVariant("firefox", "@supports (-moz-appearance: none)");
4
+ addVariant("safari", "@supports (background: -webkit-named-image(i))");
5
+ addVariant("chrome", "@supports (-webkit-app-region: inherit)");
6
+ }); // So rollup can infer the return type
7
+ export{isBrowser as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@igorkowalczyk/is-browser",
3
3
  "description": "🏔️ Add support for browser specific variants in Tailwind.css",
4
- "version": "5.0.4",
4
+ "version": "5.1.1",
5
5
  "author": "Igor Kowalczyk",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
@@ -10,20 +10,29 @@
10
10
  "bugs": "https://github.com/IgorKowalczyk/is-browser/issues",
11
11
  "homepage": "https://github.com/IgorKowalczyk/is-browser#readme",
12
12
  "type": "module",
13
+ "main": "dist/index.cjs",
14
+ "module": "dist/index.js",
15
+ "types": "dist/index.d.ts",
13
16
  "exports": {
14
- "import": "./dist/mjs/index.js",
15
- "require": "./dist/cjs/index.cjs"
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.cjs",
19
+ "types": "./dist/index.d.ts"
16
20
  },
17
21
  "devDependencies": {
18
- "@igorkowalczyk/eslint-config": "2.2.0",
19
- "@igorkowalczyk/prettier-config": "2.2.0",
20
- "eslint": "9.8.0",
21
- "prettier": "3.3.3",
22
- "rollup": "4.19.1",
23
- "tailwindcss": "3.4.7"
22
+ "@igorkowalczyk/eslint-config": "^3.2.1",
23
+ "@igorkowalczyk/prettier-config": "^3.2.1",
24
+ "@rollup/plugin-node-resolve": "^16.0.3",
25
+ "@rollup/plugin-typescript": "^12.3.0",
26
+ "eslint": "^9.39.2",
27
+ "prettier": "^3.7.4",
28
+ "rimraf": "^6.1.2",
29
+ "rollup": "^4.54.0",
30
+ "tailwindcss": "^4.1.18",
31
+ "tslib": "^2.8.1",
32
+ "typescript": "^5.9.3"
24
33
  },
25
34
  "peerDependencies": {
26
- "tailwindcss": ">=3.0.0"
35
+ "tailwindcss": ">=3.0.0 || >=4.0.0"
27
36
  },
28
37
  "files": [
29
38
  "README.md",
@@ -40,7 +49,8 @@
40
49
  "node": ">=16"
41
50
  },
42
51
  "scripts": {
43
- "build": "rollup -c",
52
+ "build": "pnpm run clean && rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
53
+ "clean": "rimraf dist",
44
54
  "format": "prettier . --write --ignore-unknown --cache",
45
55
  "format:check": "prettier . --check --cache",
46
56
  "lint": "eslint .",
@@ -1,6 +0,0 @@
1
- 'use strict';var plugin=require('tailwindcss/plugin');/* eslint-disable func-names,prefer-arrow-callback,space-before-function-paren */
2
- const isBrowser = plugin(function ({ addVariant }) {
3
- addVariant("firefox", "@supports (-moz-appearance: none)");
4
- addVariant("safari", "@supports (background: -webkit-named-image(i))");
5
- addVariant("chrome", "@supports (-webkit-app-region: inherit)");
6
- });module.exports=isBrowser;
package/dist/mjs/index.js DELETED
@@ -1,6 +0,0 @@
1
- import plugin from'tailwindcss/plugin';/* eslint-disable func-names,prefer-arrow-callback,space-before-function-paren */
2
- const isBrowser = plugin(function ({ addVariant }) {
3
- addVariant("firefox", "@supports (-moz-appearance: none)");
4
- addVariant("safari", "@supports (background: -webkit-named-image(i))");
5
- addVariant("chrome", "@supports (-webkit-app-region: inherit)");
6
- });export{isBrowser as default};