mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
- share shadcn neutral color tokens between both Tailwind configs - rewrite Tailwind dark selectors into LCUI-compatible descendant selectors - theme style-nova components and doc-viewer surfaces for dark mode - generate GitHub Light and GitHub Dark syntax line pairs for code blocks - support alpha channels in text style tag colors - keep focus rings and scrollbars visible on dark surfaces - use a neutral code surface instead of GitHub's blue-tinted background
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
const plugin = require("tailwindcss/plugin");
|
|
|
|
/**
|
|
* Box-shadow utilities that inline the configured shadow value.
|
|
*
|
|
* Tailwind's built-in `box-shadow` plugin emits `--tw-shadow` /
|
|
* `--tw-shadow-colored` custom properties and a `var(...)` chain. LCUI's CSS
|
|
* parser has no custom-property support, so those declarations are ignored and
|
|
* the utilities would silently do nothing. This plugin keeps the familiar
|
|
* `shadow-<name>` class names while writing the literal value instead.
|
|
*
|
|
* Pass the shadow map explicitly so only the values this project defines are
|
|
* emitted; otherwise Tailwind's default theme would also expose `shadow`,
|
|
* `shadow-xl`, `shadow-inner` and friends.
|
|
*
|
|
* Only utilities that actually appear in the scanned content are emitted,
|
|
* because Tailwind still applies its candidate-based tree shaking.
|
|
*/
|
|
module.exports = plugin.withOptions((options = {}) => {
|
|
return ({ addUtilities, theme }) => {
|
|
const shadows = options.shadows || theme("boxShadow") || {};
|
|
const utilities = {};
|
|
|
|
for (const [name, value] of Object.entries(shadows)) {
|
|
if (typeof value !== "string" || value.length === 0) {
|
|
continue;
|
|
}
|
|
utilities[name === "DEFAULT" ? ".shadow" : `.shadow-${name}`] = {
|
|
boxShadow: value,
|
|
};
|
|
}
|
|
addUtilities(utilities);
|
|
};
|
|
});
|