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
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
const assert = require("node:assert/strict");
|
|
const test = require("node:test");
|
|
const postcss = require("postcss");
|
|
const plugin = require("./postcss-lcui-dark");
|
|
|
|
async function transform(css) {
|
|
const result = await postcss([plugin()]).process(css, { from: undefined });
|
|
return result.css;
|
|
}
|
|
|
|
test("rewrites :is dark selectors to a descendant selector", async () => {
|
|
assert.equal(
|
|
await transform(".foo:is(.dark *) { color: red }"),
|
|
".dark .foo { color: red }",
|
|
);
|
|
});
|
|
|
|
test("rewrites comma-separated selectors independently", async () => {
|
|
assert.equal(
|
|
await transform(".a, .b:where(.dark, .dark *) { color: red }"),
|
|
".a, .dark .b { color: red }",
|
|
);
|
|
});
|
|
|
|
test("preserves escaped tailwind class names", async () => {
|
|
assert.equal(
|
|
await transform(".dark\\:bg-card:is(.dark *) { color: red }"),
|
|
".dark .dark\\:bg-card { color: red }",
|
|
);
|
|
});
|
|
|
|
test("rewrites pseudo-class variants", async () => {
|
|
assert.equal(
|
|
await transform(".button:hover:is(.dark *) { color: red }"),
|
|
".dark .button:hover { color: red }",
|
|
);
|
|
});
|