feat: migrate ColorSwatch and public color boundary

This commit is contained in:
maoyingjie
2026-10-26 13:25:21 +08:00
parent 60af6ee40b
commit 270dea5cff
29 changed files with 1427 additions and 18 deletions
+36
View File
@@ -49,6 +49,42 @@ for (const id of process.argv.slice(2)) {
.base()
.includes("hv-select--secondary"),
);
if (id === "color-swatch") {
assert(lib.ColorSwatch === lib.ColorSwatchRoot);
assert(
lib
.colorSwatchVariants({ shape: "square", size: "xl" })
.includes("hv-color-swatch--square"),
);
assert(
lib
.colorSwatchVariants({ shape: "square", size: "xl" })
.includes("hv-color-swatch--xl"),
);
assert(lib.parseColor("#f008").toString("hexa") === "#FF000088");
assert(
lib.parseColor("rgba(4, 133, 247, 0.5)").getChannelValue("alpha") === 0.5,
);
const valueDts = readFileSync(
new URL(
"./node_modules/@heroui-vue/components/dist/components/color/value.d.ts",
import.meta.url,
),
"utf8",
);
const swatchDts = readFileSync(
new URL(
"./node_modules/@heroui-vue/components/dist/components/color-swatch/ColorSwatch.vue.d.ts",
import.meta.url,
),
"utf8",
);
assert(!valueDts.includes("reka-ui"), "Color declarations leak Reka types");
assert(
!swatchDts.includes("reka-ui"),
"ColorSwatch declarations leak Reka types",
);
}
if (id === "b03-tag-error-message") {
assert(/\.hv-tag-group\s*\[data-slot=["']?error-message/.test(css));
assert(lib.tagVariants({ size: "sm" }).base().includes("hv-tag--sm"));