-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add components customization + nui-slimscroll + nui-tooltip
- Loading branch information
1 parent
46b895c
commit f252c4a
Showing
18 changed files
with
778 additions
and
184 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,7 @@ | ||
import plugin from 'tailwindcss/plugin' | ||
|
||
export default plugin(function ({ addBase }) { | ||
addBase({ | ||
'.dark': { colorScheme: 'dark' }, | ||
}) | ||
}) |
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,37 @@ | ||
import plugin from 'tailwindcss/plugin' | ||
import { defu } from 'defu' | ||
import { type PluginOption, defaultPluginOptions } from '../options' | ||
|
||
const defaultDropdownDividerConfig = { | ||
space: '2', | ||
border: 'muted-200', | ||
borderDark: 'muted-600', | ||
} | ||
|
||
export default plugin.withOptions( | ||
function (options: PluginOption) { | ||
const { prefix } = defu(options, defaultPluginOptions) | ||
|
||
return function ({ addComponents, theme }) { | ||
const config = theme( | ||
'shurikenUi.dropdownDivider' | ||
) satisfies typeof defaultDropdownDividerConfig | ||
|
||
addComponents({ | ||
[`.${prefix}-dropdown-divider`]: { | ||
[`@apply my-${config.space} block h-px w-full border-t border-${config.border} dark:border-${config.borderDark}`]: | ||
{}, | ||
}, | ||
}) | ||
} | ||
}, | ||
function () { | ||
return { | ||
theme: { | ||
shurikenUi: { | ||
dropdownDivider: defaultDropdownDividerConfig, | ||
}, | ||
}, | ||
} | ||
} | ||
) |
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 { defu } from 'defu' | ||
import { type PluginOption, defaultPluginOptions } from '../options' | ||
|
||
const defaultFocusConfig = { | ||
offset: '2', | ||
width: '1', | ||
style: 'dashed', | ||
color: 'muted-300', | ||
colorDark: 'muted-600', | ||
} | ||
|
||
export default plugin.withOptions( | ||
function (options: PluginOption) { | ||
const { prefix } = defu(options, defaultPluginOptions) | ||
|
||
return function ({ addComponents, theme }) { | ||
const config = theme( | ||
'shurikenUi.focus' | ||
) satisfies typeof defaultFocusConfig | ||
|
||
addComponents({ | ||
[`.${prefix}-focus`]: { | ||
[`@apply outline-${config.width} outline-${config.style} outline-offset-${config.offset}`]: | ||
{}, | ||
'@apply outline-transparent': {}, | ||
'&:focus-within': { | ||
[`@apply outline-${config.color} dark:outline-${config.colorDark}`]: | ||
{}, | ||
[`@apply outline-${config.style} ring-0`]: {}, | ||
}, | ||
'&:focus-visible': { | ||
[`@apply outline-${config.width}`]: {}, | ||
}, | ||
}, | ||
}) | ||
} | ||
}, | ||
function () { | ||
return { | ||
theme: { | ||
shurikenUi: { | ||
focus: defaultFocusConfig, | ||
}, | ||
}, | ||
} | ||
} | ||
) |
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,41 @@ | ||
import plugin from 'tailwindcss/plugin' | ||
import { defu } from 'defu' | ||
import { type PluginOption } from '../options' | ||
import dropdown from './dropdown' | ||
import focus from './focus' | ||
import label from './label' | ||
import mark from './mark' | ||
import mask from './mask' | ||
import placeload from './placeload' | ||
import slimscroll from './slimscroll' | ||
import tooltip from './tooltip' | ||
|
||
const components = [ | ||
dropdown, | ||
focus, | ||
label, | ||
mark, | ||
mask, | ||
placeload, | ||
slimscroll, | ||
tooltip, | ||
] | ||
|
||
export default plugin.withOptions( | ||
function (options: PluginOption) { | ||
return function (api) { | ||
for (const component of components) { | ||
component(options).handler(api) | ||
} | ||
} | ||
}, | ||
function (options) { | ||
let config = {} | ||
|
||
for (const component of components) { | ||
config = defu(config, component(options).config) | ||
} | ||
|
||
return config | ||
} | ||
) |
Oops, something went wrong.