2024-11-21 19:05:50 +00:00
|
|
|
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
|
|
|
|
import type { Config } from 'tailwindcss';
|
|
|
|
|
|
import tailwindcssAnimate from 'tailwindcss-animate';
|
|
|
|
|
|
import tailwindcssRadix from 'tailwindcss-radix';
|
|
|
|
|
|
import { fontFamily } from 'tailwindcss/defaultTheme';
|
|
|
|
|
|
import { default as flattenColorPalette } from 'tailwindcss/lib/util/flattenColorPalette';
|
|
|
|
|
|
import plugin from 'tailwindcss/plugin';
|
2025-01-27 14:58:08 +00:00
|
|
|
|
import type { PluginAPI } from 'tailwindcss/types/config';
|
2024-11-27 13:54:19 +00:00
|
|
|
|
import tailwindTypography from '@tailwindcss/typography';
|
2024-11-21 19:05:50 +00:00
|
|
|
|
import baseConfig from '@theguild/tailwind-config';
|
|
|
|
|
|
|
|
|
|
|
|
const config: Config = {
|
|
|
|
|
|
...baseConfig,
|
2025-01-27 14:58:08 +00:00
|
|
|
|
content: [...baseConfig.content, './mdx-components.js'],
|
2024-11-21 19:05:50 +00:00
|
|
|
|
theme: {
|
|
|
|
|
|
...baseConfig.theme,
|
|
|
|
|
|
extend: {
|
|
|
|
|
|
...baseConfig.theme.extend,
|
|
|
|
|
|
fontFamily: {
|
2025-01-27 14:58:08 +00:00
|
|
|
|
sans: ['var(--font-sans, ui-sans-serif)', ...fontFamily.sans],
|
2024-11-21 19:05:50 +00:00
|
|
|
|
},
|
|
|
|
|
|
colors: {
|
|
|
|
|
|
...baseConfig.theme.extend.colors,
|
|
|
|
|
|
primary: baseConfig.theme.extend.colors['hive-yellow'],
|
2024-12-30 18:28:20 +00:00
|
|
|
|
'nextra-primary': baseConfig.theme.extend.colors.primary,
|
2025-03-03 21:53:45 +00:00
|
|
|
|
'blueish-green': '#003834', // todo: move this to shared Tailwind config
|
2024-11-21 19:05:50 +00:00
|
|
|
|
},
|
|
|
|
|
|
keyframes: {
|
|
|
|
|
|
'accordion-down': {
|
|
|
|
|
|
from: { height: '0', opacity: '0' },
|
|
|
|
|
|
to: { height: 'var(--radix-accordion-content-height)', opacity: '1' },
|
|
|
|
|
|
},
|
|
|
|
|
|
'accordion-up': {
|
|
|
|
|
|
from: { height: 'var(--radix-accordion-content-height)', opacity: '1' },
|
|
|
|
|
|
to: { height: '0', opacity: '0' },
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
animation: {
|
|
|
|
|
|
'accordion-down': 'accordion-down 0.5s ease',
|
|
|
|
|
|
'accordion-up': 'accordion-up 0.5s ease',
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2024-11-27 13:54:19 +00:00
|
|
|
|
plugins: [
|
2025-04-02 13:32:49 +00:00
|
|
|
|
...baseConfig.plugins,
|
2024-11-27 13:54:19 +00:00
|
|
|
|
tailwindcssRadix({ variantPrefix: 'rdx' }),
|
|
|
|
|
|
tailwindcssAnimate,
|
|
|
|
|
|
blockquotesPlugin(),
|
|
|
|
|
|
tailwindTypography,
|
2025-03-05 15:03:25 +00:00
|
|
|
|
firefoxVariantPlugin(),
|
2024-11-27 13:54:19 +00:00
|
|
|
|
],
|
2024-11-21 19:05:50 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default config;
|
|
|
|
|
|
|
|
|
|
|
|
function blockquotesPlugin() {
|
2025-01-27 14:58:08 +00:00
|
|
|
|
return plugin(({ addUtilities, matchUtilities, theme }: PluginAPI) => {
|
2024-11-21 19:05:50 +00:00
|
|
|
|
addUtilities({
|
|
|
|
|
|
'.mask-image-none': {
|
|
|
|
|
|
'mask-image': 'none',
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
matchUtilities(
|
|
|
|
|
|
{
|
|
|
|
|
|
blockquote: color => ({
|
|
|
|
|
|
position: 'relative',
|
|
|
|
|
|
quotes: '"“" "”" "‘" "’"',
|
|
|
|
|
|
'&:before, &:after': {
|
|
|
|
|
|
lineHeight: '0',
|
|
|
|
|
|
position: 'relative',
|
|
|
|
|
|
fontSize: '2.25em',
|
|
|
|
|
|
display: 'inline-block',
|
|
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
|
|
width: '0',
|
|
|
|
|
|
color,
|
|
|
|
|
|
},
|
|
|
|
|
|
'&:before': {
|
|
|
|
|
|
content: 'open-quote',
|
|
|
|
|
|
left: '-0.375em',
|
|
|
|
|
|
},
|
|
|
|
|
|
'&:after': {
|
|
|
|
|
|
content: 'close-quote',
|
|
|
|
|
|
},
|
|
|
|
|
|
}),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
values: flattenColorPalette(theme('colors')),
|
|
|
|
|
|
type: 'color',
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-03-05 15:03:25 +00:00
|
|
|
|
|
2025-04-07 07:27:16 +00:00
|
|
|
|
// TODO: This should probably go to a shared Tailwind config
|
2025-03-05 15:03:25 +00:00
|
|
|
|
function firefoxVariantPlugin() {
|
|
|
|
|
|
return plugin((api: PluginAPI) => {
|
|
|
|
|
|
const { addVariant, e, postcss } = api as PluginAPI & { postcss: any };
|
|
|
|
|
|
// @ts-expect-error types are outdated
|
|
|
|
|
|
addVariant('firefox', ({ container, separator }) => {
|
|
|
|
|
|
if (!postcss || !container || !separator) {
|
|
|
|
|
|
throw new Error("can't add firefox variant, assumptions invalid. did the API change?");
|
|
|
|
|
|
}
|
|
|
|
|
|
const isFirefoxRule = postcss.atRule({
|
|
|
|
|
|
name: 'supports',
|
|
|
|
|
|
params: '(-moz-appearance:none)',
|
|
|
|
|
|
});
|
|
|
|
|
|
isFirefoxRule.append(container.nodes);
|
|
|
|
|
|
container.append(isFirefoxRule);
|
|
|
|
|
|
// @ts-expect-error types are outdated
|
|
|
|
|
|
isFirefoxRule.walkRules(rule => {
|
|
|
|
|
|
rule.selector = `.${e(
|
|
|
|
|
|
`firefox${separator}${rule.selector.slice(1).replaceAll('\\', '')}`,
|
|
|
|
|
|
)}`;
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|