feat: establish shared color state and area interaction foundation

This commit is contained in:
maoyingjie
2026-10-25 11:10:47 +08:00
parent 58ca16e774
commit 57d7cbb2d6
26 changed files with 2429 additions and 88 deletions
+24
View File
@@ -0,0 +1,24 @@
import {
parseColor,
type ColorValue,
} from "../../packages/vue/src/components/color/value";
import type { ColorAreaOptions } from "../../packages/vue/src/components/color/area";
const color = parseColor("hsb(240,50%,50%)");
const value: ColorValue = color.withAlpha(0.5).toFormat("rgb");
const options: ColorAreaOptions = {
colorSpace: "rgb",
xChannel: "blue",
yChannel: "red",
};
void value;
void options;
// @ts-expect-error nonexistent channel
color.withChannelValue("opacity", 1);
// @ts-expect-error unsupported color format
color.toString("oklch");
// @ts-expect-error two-dimensional area axes exclude alpha
const alpha: ColorAreaOptions = { xChannel: "alpha" };
// @ts-expect-error no arbitrary foreign mutable plain object as library model
const foreign: ColorValue = { space: "rgb", r: 0, g: 0, b: 0, alpha: 1 };
void alpha;
void foreign;