-
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.
- Added JSDoc support - [breaking] ESM support (dropped CJS) - Added hocus variants - [breaking] Rewrote the API - Can import plugins individually - [breaking] Renamed `notVariants` to `not` - [breaking] Renamed `tap-highlight` to `tab` - [breaking] Renamed `screenToDynamicScreen` to `dynamicScreen` - [breaking] Removed `resetInputs` and added `resetNumberInput` and `resetSearchInput` utils. - [breaking] Renamed `fontWeightRegular` to `fontRegular` - [breaking] Renamed `moreDefaultValues` to `extraDefaults` - [breaking] Enabled `dynamicScreen` by default
- Loading branch information
Showing
33 changed files
with
371 additions
and
410 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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
{ | ||
"name": "tailwindcss-addons", | ||
"description": "A TailwindCSS plugin that adds extra utilities and more.", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"license": "MIT", | ||
"main": "src/index.cjs", | ||
"main": "./src/index.js", | ||
"repository": "github:babakfp/tailwindcss-addons", | ||
"homepage": "https://babakfp.ir/docs/tailwindcss-addons", | ||
"scripts": { | ||
"format": "prettier -w ." | ||
}, | ||
"peerDependencies": { | ||
"tailwindcss": "3.x" | ||
"tailwindcss": ">= 3.4.1 < 4" | ||
}, | ||
"devDependencies": { | ||
"prettier": "3.2.4" | ||
} | ||
"prettier": "3.2.5", | ||
"tailwindcss": "3.4.1" | ||
}, | ||
"keywords": [ | ||
"tailwindcss" | ||
], | ||
"type": "module" | ||
} |
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ export default { | |
semi: false, | ||
tabWidth: 4, | ||
arrowParens: "avoid", | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,79 @@ | ||
import bgGrid from "./plugins/bgGrid" | ||
import bgRadial from "./plugins/bgRadial" | ||
import dir from "./plugins/dir" | ||
import drag from "./plugins/drag" | ||
import dynamicScreen from "./plugins/dynamicScreen" | ||
import extraDefaults from "./plugins/extraDefaults" | ||
import flexGrid from "./plugins/flexGrid" | ||
import flip from "./plugins/flip" | ||
import fontRegular from "./plugins/fontRegular" | ||
import hideShow from "./plugins/hideShow" | ||
import hocus from "./plugins/hocus" | ||
import insetCenter from "./plugins/insetCenter" | ||
import not from "./plugins/not" | ||
import overflowUnset from "./plugins/overflowUnset" | ||
import resetNumberInput from "./plugins/resetNumberInput" | ||
import resetSearchInput from "./plugins/resetSearchInput" | ||
import tap from "./plugins/tap" | ||
|
||
export { | ||
bgGrid, | ||
bgRadial, | ||
dir, | ||
drag, | ||
dynamicScreen, | ||
extraDefaults, | ||
flexGrid, | ||
flip, | ||
fontRegular, | ||
hideShow, | ||
hocus, | ||
insetCenter, | ||
not, | ||
overflowUnset, | ||
resetNumberInput, | ||
resetSearchInput, | ||
tap, | ||
} | ||
|
||
/** @param {Options} [options] */ | ||
export default options => [ | ||
...(options?.bgGrid || true ? [bgGrid] : []), | ||
...(options?.bgRadial || true ? [bgRadial] : []), | ||
...(options?.dir || true ? [dir] : []), | ||
...(options?.drag || true ? [drag] : []), | ||
...(options?.dynamicScreen || true ? [dynamicScreen] : []), | ||
...(options?.extraDefaults || true ? [extraDefaults] : []), | ||
...(options?.flexGrid || false ? [flexGrid] : []), | ||
...(options?.flip || true ? [flip] : []), | ||
...(options?.fontRegular || false ? [fontRegular] : []), | ||
...(options?.hideShow || true ? [hideShow] : []), | ||
...(options?.hocus || true ? [hocus] : []), | ||
...(options?.insetCenter || true ? [insetCenter] : []), | ||
...(options?.not || true ? [not] : []), | ||
...(options?.overflowUnset || true ? [overflowUnset] : []), | ||
...(options?.resetNumberInput || true ? [resetNumberInput] : []), | ||
...(options?.resetSearchInput || true ? [resetSearchInput] : []), | ||
...(options?.tap || true ? [tap] : []), | ||
] | ||
|
||
/** | ||
* @typedef {Object} Options | ||
* @property {boolean} [bgGrid] Default: `true` | ||
* @property {boolean} [bgRadial] Default: `true` | ||
* @property {boolean} [dir] Default: `true` | ||
* @property {boolean} [drag] Default: `true` | ||
* @property {boolean} [dynamicScreen] Default: `true` | ||
* @property {boolean} [extraDefaults] Default: `true` | ||
* @property {boolean} [flexGrid] Default: `false` | ||
* @property {boolean} [flip] Default: `true` | ||
* @property {boolean} [fontRegular] Default: `false` | ||
* @property {boolean} [hideShow] Default: `true` | ||
* @property {boolean} [hocus] Default: `true` | ||
* @property {boolean} [insetCenter] Default: `true` | ||
* @property {boolean} [not] Default: `true` | ||
* @property {boolean} [overflowUnset] Default: `true` | ||
* @property {boolean} [resetNumberInput] Default: `true` | ||
* @property {boolean} [resetSearchInput] Default: `true` | ||
* @property {boolean} [tap] Default: `true` | ||
*/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
import _flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette" | ||
|
||
/** | ||
* @param {Record<string, string>} colors | ||
*/ | ||
export const flattenColorPalette = colors => { | ||
return _flattenColorPalette(colors) | ||
} |
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,5 @@ | ||
/** | ||
* @param {number[]} sizes | ||
*/ | ||
export const spacing = sizes => | ||
Object.fromEntries(sizes.map(size => [size, `${size / 4}rem`])) |
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
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
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,29 @@ | ||
import plugin from "tailwindcss/plugin" | ||
|
||
/** [Docs](https://babakfp.ir/docs/tailwindcss-addons/dynamic-screen) */ | ||
export default plugin( | ||
({ addBase }) => { | ||
addBase({ | ||
":root": { | ||
"--tw-screen-h": "100vh", | ||
"--tw-screen-w": "100vw", | ||
}, | ||
}) | ||
addBase({ | ||
":root": { | ||
"--tw-screen-h": "100dvh", | ||
"--tw-screen-w": "100dvw", | ||
}, | ||
}) | ||
}, | ||
{ | ||
theme: { | ||
extend: { | ||
height: { screen: "var(--tw-screen-h)" }, | ||
maxHeight: { screen: "var(--tw-screen-h)" }, | ||
minHeight: { screen: "var(--tw-screen-h)" }, | ||
width: { screen: "var(--tw-screen-w)" }, | ||
}, | ||
}, | ||
}, | ||
) |
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,48 @@ | ||
import plugin from "tailwindcss/plugin" | ||
import { spacing } from "../lib/spacing" | ||
|
||
/** [Docs](https://babakfp.ir/docs/tailwindcss-addons/more-default-values) */ | ||
export default plugin(() => {}, { | ||
theme: { | ||
extend: { | ||
spacing: spacing([ | ||
4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 13, 15, 17, 18, 19, 21, 22, 23, | ||
]), | ||
minWidth: ({ theme }) => theme("spacing"), | ||
maxWidth: ({ theme }) => theme("spacing"), | ||
minHeight: ({ theme }) => theme("spacing"), | ||
maxHeight: ({ theme }) => theme("spacing"), | ||
zIndex: { | ||
1: "1", | ||
2: "2", | ||
3: "3", | ||
4: "4", | ||
}, | ||
blur: { | ||
px: "1px", | ||
xs: "2px", | ||
}, | ||
borderWidth: { | ||
3: "3px", | ||
}, | ||
ringWidth: { | ||
3: "3px", | ||
}, | ||
ringOffsetWidth: { | ||
3: "3px", | ||
}, | ||
outlineOffset: { | ||
3: "3px", | ||
}, | ||
fontSize: { | ||
"2xs": ["0.625rem", { lineHeight: "1" }], | ||
}, | ||
letterSpacing: { | ||
"widest-2": ".25em", | ||
"widest-3": ".5em", | ||
"widest-4": ".75em", | ||
"widest-5": "1em", | ||
}, | ||
}, | ||
}, | ||
}) |
Oops, something went wrong.