@urcolor/vue 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +155 -0
  2. package/dist/components/ColorArea/ColorAreaCheckerboard.vue.d.ts +10 -0
  3. package/dist/components/ColorArea/ColorAreaGradient.vue.d.ts +36 -0
  4. package/dist/components/ColorArea/ColorAreaImpl.vue.d.ts +45 -0
  5. package/dist/components/ColorArea/ColorAreaRegion.vue.d.ts +15 -0
  6. package/dist/components/ColorArea/ColorAreaRoot.vue.d.ts +101 -0
  7. package/dist/components/ColorArea/ColorAreaThumb.vue.d.ts +17 -0
  8. package/dist/components/ColorArea/ColorAreaThumbX.vue.d.ts +17 -0
  9. package/dist/components/ColorArea/ColorAreaThumbY.vue.d.ts +17 -0
  10. package/dist/components/ColorArea/ColorAreaTrack.vue.d.ts +17 -0
  11. package/dist/components/ColorArea/index.d.ts +9 -0
  12. package/dist/components/ColorArea/utils.d.ts +62 -0
  13. package/dist/components/ColorField/ColorFieldDecrement.vue.d.ts +19 -0
  14. package/dist/components/ColorField/ColorFieldIncrement.vue.d.ts +19 -0
  15. package/dist/components/ColorField/ColorFieldInput.vue.d.ts +17 -0
  16. package/dist/components/ColorField/ColorFieldRoot.vue.d.ts +74 -0
  17. package/dist/components/ColorField/ColorFieldSwatch.vue.d.ts +15 -0
  18. package/dist/components/ColorField/index.d.ts +5 -0
  19. package/dist/components/ColorField/utils.d.ts +8 -0
  20. package/dist/components/ColorSlider/ColorSliderCheckerboard.vue.d.ts +10 -0
  21. package/dist/components/ColorSlider/ColorSliderGradient.vue.d.ts +33 -0
  22. package/dist/components/ColorSlider/ColorSliderRange.vue.d.ts +13 -0
  23. package/dist/components/ColorSlider/ColorSliderRoot.vue.d.ts +49 -0
  24. package/dist/components/ColorSlider/ColorSliderThumb.vue.d.ts +13 -0
  25. package/dist/components/ColorSlider/ColorSliderTrack.vue.d.ts +13 -0
  26. package/dist/components/ColorSlider/index.d.ts +6 -0
  27. package/dist/components/ColorSwatch/ColorSwatchRoot.vue.d.ts +26 -0
  28. package/dist/components/ColorSwatch/index.d.ts +2 -0
  29. package/dist/components/ColorSwatchGroup/ColorSwatchGroupItem.vue.d.ts +25 -0
  30. package/dist/components/ColorSwatchGroup/ColorSwatchGroupRoot.vue.d.ts +58 -0
  31. package/dist/components/ColorSwatchGroup/index.d.ts +5 -0
  32. package/dist/composables/useColor.d.ts +3 -0
  33. package/dist/index.d.ts +5 -0
  34. package/dist/index.js +2852 -0
  35. package/package.json +58 -0
package/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # @urcolor/vue
2
+
3
+ Headless, accessible color picker components for Vue 3. Unstyled primitives — bring your own styles.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @urcolor/vue
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - **Headless** — Radix/Reka UI-style unstyled primitives with full styling freedom
14
+ - **12 Color Spaces** — HSL, HSV, HWB, OKLCh, OKLab, LCh, Lab, RGB, Display P3, A98 RGB, ProPhoto RGB, Rec. 2020
15
+ - **Accessible** — Keyboard navigation, ARIA attributes, roving focus
16
+ - **WebGL Gradients** — GPU-accelerated canvas backgrounds via `@urcolor/core`
17
+ - **Alpha Support** — Built-in transparency controls with checkerboard backgrounds
18
+ - **Form Integration** — Hidden inputs for native form submission
19
+
20
+ ## Components
21
+
22
+ ### ColorArea
23
+
24
+ Two-dimensional color selection for any pair of channels.
25
+
26
+ ```vue
27
+ <script setup>
28
+ import {
29
+ ColorAreaRoot,
30
+ ColorAreaTrack,
31
+ ColorAreaThumb,
32
+ ColorAreaGradient,
33
+ } from '@urcolor/vue'
34
+
35
+ const color = ref('hsl(200, 100%, 50%)')
36
+ </script>
37
+
38
+ <template>
39
+ <ColorAreaRoot v-model="color" color-space="hsl" channel-x="saturation" channel-y="lightness">
40
+ <ColorAreaTrack>
41
+ <ColorAreaGradient />
42
+ <ColorAreaThumb />
43
+ </ColorAreaTrack>
44
+ </ColorAreaRoot>
45
+ </template>
46
+ ```
47
+
48
+ **Props:** `modelValue`, `colorSpace`, `channelX`, `channelY`, `disabled`, `invertedX`, `invertedY`, `thumbAlignment` ("contain" | "overflow"), `name`, `dir`
49
+
50
+ **Sub-components:** `ColorAreaRoot`, `ColorAreaTrack`, `ColorAreaThumb`, `ColorAreaGradient`, `ColorAreaCheckerboard`
51
+
52
+ ### ColorSlider
53
+
54
+ Single-channel color adjustment slider.
55
+
56
+ ```vue
57
+ <script setup>
58
+ import {
59
+ ColorSliderRoot,
60
+ ColorSliderTrack,
61
+ ColorSliderThumb,
62
+ ColorSliderGradient,
63
+ } from '@urcolor/vue'
64
+
65
+ const color = ref('hsl(200, 100%, 50%)')
66
+ </script>
67
+
68
+ <template>
69
+ <ColorSliderRoot v-model="color" color-space="hsl" channel="hue">
70
+ <ColorSliderTrack>
71
+ <ColorSliderGradient />
72
+ <ColorSliderThumb />
73
+ </ColorSliderTrack>
74
+ </ColorSliderRoot>
75
+ </template>
76
+ ```
77
+
78
+ **Props:** `modelValue`, `colorSpace`, `channel`, `disabled`, `orientation` ("horizontal" | "vertical"), `inverted`, `dir`
79
+
80
+ **Sub-components:** `ColorSliderRoot`, `ColorSliderTrack`, `ColorSliderRange`, `ColorSliderThumb`, `ColorSliderGradient`, `ColorSliderCheckerboard`
81
+
82
+ ### ColorField
83
+
84
+ Text input for precise numeric color values.
85
+
86
+ ```vue
87
+ <script setup>
88
+ import {
89
+ ColorFieldRoot,
90
+ ColorFieldInput,
91
+ ColorFieldIncrement,
92
+ ColorFieldDecrement,
93
+ } from '@urcolor/vue'
94
+
95
+ const color = ref('hsl(200, 100%, 50%)')
96
+ </script>
97
+
98
+ <template>
99
+ <ColorFieldRoot v-model="color" color-space="hsl" channel="hue">
100
+ <ColorFieldDecrement>−</ColorFieldDecrement>
101
+ <ColorFieldInput />
102
+ <ColorFieldIncrement>+</ColorFieldIncrement>
103
+ </ColorFieldRoot>
104
+ </template>
105
+ ```
106
+
107
+ **Props:** `modelValue`, `colorSpace`, `channel`, `format` ("number" | "degree" | "percentage" | "hex"), `min`, `max`, `step`, `disabled`, `name`
108
+
109
+ **Keyboard:** Arrow Up/Down to increment, Page Up/Down for 10x steps, Home/End for min/max.
110
+
111
+ **Sub-components:** `ColorFieldRoot`, `ColorFieldInput`, `ColorFieldIncrement`, `ColorFieldDecrement`, `ColorFieldSwatch`
112
+
113
+ ### ColorSwatch
114
+
115
+ Display a color with optional transparency checkerboard.
116
+
117
+ ```vue
118
+ <template>
119
+ <ColorSwatchRoot model-value="oklch(70% 0.15 200)" :alpha="true" />
120
+ </template>
121
+ ```
122
+
123
+ **Props:** `modelValue`, `checkerSize`, `alpha`
124
+
125
+ ### ColorSwatchGroup
126
+
127
+ Select one or multiple colors from a palette.
128
+
129
+ ```vue
130
+ <script setup>
131
+ import { ColorSwatchGroupRoot, ColorSwatchGroupItem } from '@urcolor/vue'
132
+
133
+ const selected = ref(['red'])
134
+ </script>
135
+
136
+ <template>
137
+ <ColorSwatchGroupRoot v-model="selected" type="multiple">
138
+ <ColorSwatchGroupItem value="red" />
139
+ <ColorSwatchGroupItem value="green" />
140
+ <ColorSwatchGroupItem value="blue" />
141
+ </ColorSwatchGroupRoot>
142
+ </template>
143
+ ```
144
+
145
+ **Props:** `modelValue`, `type` ("single" | "multiple"), `disabled`, `orientation`, `loop`, `rovingFocus`, `dir`
146
+
147
+ **Sub-components:** `ColorSwatchGroupRoot`, `ColorSwatchGroupItem`
148
+
149
+ ## Supported Color Spaces
150
+
151
+ HSL, HSV, HWB, OKLCh, OKLab, LCh, Lab, RGB, Display P3, A98 RGB, ProPhoto RGB, Rec. 2020 — all with alpha channel support.
152
+
153
+ ## License
154
+
155
+ MIT
@@ -0,0 +1,10 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorAreaCheckerboardProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ }
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ declare const __VLS_export: import("vue").DefineComponent<ColorAreaCheckerboardProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorAreaCheckerboardProps> & Readonly<{}>, {
9
+ as: string;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,36 @@
1
+ import "internationalized-color/css";
2
+ import type { PrimitiveProps } from "reka-ui";
3
+ export interface ColorAreaGradientProps extends /* @vue-ignore */ PrimitiveProps {
4
+ as?: string;
5
+ asChild?: boolean;
6
+ /** Color for the top-left corner. Accepts any CSS color string supported by culori (hex, rgb(), hsl(), oklch(), color(), named colors, etc.). */
7
+ topLeft?: string;
8
+ /** Color for the top-right corner. */
9
+ topRight?: string;
10
+ /** Color for the bottom-left corner. */
11
+ bottomLeft?: string;
12
+ /** Color for the bottom-right corner. */
13
+ bottomRight?: string;
14
+ /** When set to a non-RGB color space, uses 2D canvas with perceptual interpolation in that space instead of WebGL (sRGB). */
15
+ interpolationSpace?: string;
16
+ /**
17
+ * Lock specific channels to fixed values in the gradient.
18
+ * - `{ alpha: 1 }` (default) — lock alpha to 1
19
+ * - `{ s: 1, v: 1 }` — lock saturation and value
20
+ * - `false` — no overrides, gradient reflects all channels from current color
21
+ */
22
+ channelOverrides?: Record<string, number> | false;
23
+ }
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
26
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaGradientProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorAreaGradientProps> & Readonly<{}>, {
27
+ as: string;
28
+ channelOverrides: Record<string, number> | false;
29
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
30
+ default?: (props: {}) => any;
31
+ }>;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -0,0 +1,45 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export type ColorAreaImplEmits = {
3
+ slideStart: [event: PointerEvent];
4
+ slideMove: [event: PointerEvent];
5
+ slideEnd: [event: PointerEvent];
6
+ homeKeyDown: [event: KeyboardEvent];
7
+ endKeyDown: [event: KeyboardEvent];
8
+ pageUpKeyDown: [event: KeyboardEvent];
9
+ pageDownKeyDown: [event: KeyboardEvent];
10
+ stepKeyDown: [event: KeyboardEvent];
11
+ };
12
+ export interface ColorAreaImplProps extends /* @vue-ignore */ PrimitiveProps {
13
+ as?: string;
14
+ asChild?: boolean;
15
+ }
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
18
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaImplProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ slideStart: (event: PointerEvent) => any;
20
+ slideMove: (event: PointerEvent) => any;
21
+ slideEnd: (event: PointerEvent) => any;
22
+ homeKeyDown: (event: KeyboardEvent) => any;
23
+ endKeyDown: (event: KeyboardEvent) => any;
24
+ pageUpKeyDown: (event: KeyboardEvent) => any;
25
+ pageDownKeyDown: (event: KeyboardEvent) => any;
26
+ stepKeyDown: (event: KeyboardEvent) => any;
27
+ }, string, import("vue").PublicProps, Readonly<ColorAreaImplProps> & Readonly<{
28
+ onSlideStart?: ((event: PointerEvent) => any) | undefined;
29
+ onSlideMove?: ((event: PointerEvent) => any) | undefined;
30
+ onSlideEnd?: ((event: PointerEvent) => any) | undefined;
31
+ onHomeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
32
+ onEndKeyDown?: ((event: KeyboardEvent) => any) | undefined;
33
+ onPageUpKeyDown?: ((event: KeyboardEvent) => any) | undefined;
34
+ onPageDownKeyDown?: ((event: KeyboardEvent) => any) | undefined;
35
+ onStepKeyDown?: ((event: KeyboardEvent) => any) | undefined;
36
+ }>, {
37
+ as: string;
38
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
39
+ default?: (props: {}) => any;
40
+ }>;
41
+ type __VLS_WithSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
@@ -0,0 +1,15 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorAreaRegionProps extends /* @vue-ignore */ PrimitiveProps {
3
+ }
4
+ declare const _default: typeof __VLS_export;
5
+ export default _default;
6
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaRegionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorAreaRegionProps> & Readonly<{}>, {
7
+ as: import("reka-ui").AsTag | import("vue").Component;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
9
+ default?: (props: {}) => any;
10
+ }>;
11
+ type __VLS_WithSlots<T, S> = T & {
12
+ new (): {
13
+ $slots: S;
14
+ };
15
+ };
@@ -0,0 +1,101 @@
1
+ import type { Ref } from "vue";
2
+ import type { PrimitiveProps } from "reka-ui";
3
+ import "internationalized-color/css";
4
+ import { Color } from "internationalized-color";
5
+ import type { ActiveDirection } from "./utils";
6
+ type Direction = "ltr" | "rtl";
7
+ type ThumbAlignment = "contain" | "overflow";
8
+ export interface ColorAreaRootProps extends /* @vue-ignore */ PrimitiveProps {
9
+ as?: string;
10
+ asChild?: boolean;
11
+ /** The name of the hidden input field for form submission. */
12
+ name?: string | undefined;
13
+ /** Whether the field is required for form submission. */
14
+ required?: boolean;
15
+ /** The controlled color value. Can be bind as `v-model`. */
16
+ modelValue?: Color | string | null;
17
+ /** The default color value when uncontrolled. */
18
+ defaultValue?: Color | string;
19
+ /** When `true`, prevents the user from interacting with the slider area. */
20
+ disabled?: boolean;
21
+ /** The reading direction. If omitted, inherits globally from `ConfigProvider` or assumes LTR. */
22
+ dir?: Direction;
23
+ /** Whether the X axis is visually inverted. */
24
+ invertedX?: boolean;
25
+ /** Whether the Y axis is visually inverted. */
26
+ invertedY?: boolean;
27
+ /** The color space mode to work in (e.g. 'hsl', 'oklch'). */
28
+ colorSpace?: string;
29
+ /** Which channel maps to the X axis (e.g. 's' for HSL saturation, or 'alpha' for opacity). */
30
+ channelX?: string;
31
+ /** Which channel maps to the Y axis (e.g. 'l' for HSL lightness, or 'alpha' for opacity). */
32
+ channelY?: string;
33
+ /** The minimum permitted steps between multiple thumbs on the X axis. */
34
+ minXStepsBetweenThumbs?: number;
35
+ /** The minimum permitted steps between multiple thumbs on the Y axis. */
36
+ minYStepsBetweenThumbs?: number;
37
+ /**
38
+ * The alignment of the slider area thumb.
39
+ * - `contain`: thumbs will be contained within the bounds of the track.
40
+ * - `overflow`: thumbs will not be bound by the track. No extra offset will be added.
41
+ * @defaultValue 'overflow'
42
+ */
43
+ thumbAlignment?: ThumbAlignment;
44
+ }
45
+ export type ColorAreaRootEmits = {
46
+ /** Event handler called when the color value changes */
47
+ "update:modelValue": [payload: Color | undefined];
48
+ /** Event handler called when the value changes at the end of an interaction. */
49
+ "valueCommit": [payload: Color];
50
+ };
51
+ export interface ColorAreaRootContext {
52
+ disabled: Ref<boolean>;
53
+ minX: Ref<number>;
54
+ maxX: Ref<number>;
55
+ minY: Ref<number>;
56
+ maxY: Ref<number>;
57
+ modelValue?: Readonly<Ref<number[][] | null | undefined>>;
58
+ currentModelValue: Ref<number[][]>;
59
+ valueIndexToChangeRef: Ref<number>;
60
+ thumbXElements: Ref<HTMLElement[]>;
61
+ thumbYElements: Ref<HTMLElement[]>;
62
+ activeDirection: Ref<ActiveDirection>;
63
+ isSlidingFromLeft: Ref<boolean>;
64
+ isSlidingFromTop: Ref<boolean>;
65
+ thumbAlignment: Ref<ThumbAlignment>;
66
+ colorSpace: Ref<string>;
67
+ xChannelKey: Ref<string>;
68
+ yChannelKey: Ref<string>;
69
+ colorRef: Readonly<Ref<Color | undefined>>;
70
+ dir: Ref<Direction>;
71
+ }
72
+ export declare const injectColorAreaRootContext: <T extends ColorAreaRootContext | null | undefined = ColorAreaRootContext>(fallback?: T | undefined) => T extends null ? ColorAreaRootContext | null : ColorAreaRootContext, provideColorAreaRootContext: (contextValue: ColorAreaRootContext) => ColorAreaRootContext;
73
+ declare const _default: typeof __VLS_export;
74
+ export default _default;
75
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaRootProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
76
+ "update:modelValue": (payload: Color | undefined) => any;
77
+ valueCommit: (payload: Color) => any;
78
+ }, string, import("vue").PublicProps, Readonly<ColorAreaRootProps> & Readonly<{
79
+ "onUpdate:modelValue"?: ((payload: Color | undefined) => any) | undefined;
80
+ onValueCommit?: ((payload: Color) => any) | undefined;
81
+ }>, {
82
+ disabled: boolean;
83
+ as: string;
84
+ defaultValue: Color | string;
85
+ invertedX: boolean;
86
+ invertedY: boolean;
87
+ colorSpace: string;
88
+ minXStepsBetweenThumbs: number;
89
+ minYStepsBetweenThumbs: number;
90
+ thumbAlignment: ThumbAlignment;
91
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
92
+ default?: (props: {
93
+ /** Current color value */
94
+ modelValue: Color | undefined;
95
+ }) => any;
96
+ }>;
97
+ type __VLS_WithSlots<T, S> = T & {
98
+ new (): {
99
+ $slots: S;
100
+ };
101
+ };
@@ -0,0 +1,17 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorAreaThumbProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ }
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaThumbProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorAreaThumbProps> & Readonly<{}>, {
9
+ as: string;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
+ default?: (props: {}) => any;
12
+ }>;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,17 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorAreaThumbXProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ }
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaThumbXProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorAreaThumbXProps> & Readonly<{}>, {
9
+ as: string;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
+ default?: (props: {}) => any;
12
+ }>;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,17 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorAreaThumbYProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ }
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaThumbYProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorAreaThumbYProps> & Readonly<{}>, {
9
+ as: string;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
+ default?: (props: {}) => any;
12
+ }>;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,17 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorAreaTrackProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ }
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorAreaTrackProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorAreaTrackProps> & Readonly<{}>, {
9
+ as: string;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
+ default?: (props: {}) => any;
12
+ }>;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,9 @@
1
+ export { default as ColorAreaRegion, type ColorAreaRegionProps, } from "./ColorAreaRegion.vue";
2
+ export { injectColorAreaRootContext, default as ColorAreaRoot, type ColorAreaRootEmits, type ColorAreaRootProps, } from "./ColorAreaRoot.vue";
3
+ export { default as ColorAreaThumb, type ColorAreaThumbProps, } from "./ColorAreaThumb.vue";
4
+ export { default as ColorAreaThumbX, type ColorAreaThumbXProps, } from "./ColorAreaThumbX.vue";
5
+ export { default as ColorAreaThumbY, type ColorAreaThumbYProps, } from "./ColorAreaThumbY.vue";
6
+ export { default as ColorAreaTrack, type ColorAreaTrackProps, } from "./ColorAreaTrack.vue";
7
+ export { default as ColorAreaGradient, type ColorAreaGradientProps, } from "./ColorAreaGradient.vue";
8
+ export { default as ColorAreaCheckerboard, type ColorAreaCheckerboardProps, } from "./ColorAreaCheckerboard.vue";
9
+ export { type ActiveDirection, } from "./utils";
@@ -0,0 +1,62 @@
1
+ import type { MaybeElementRef } from "@vueuse/core";
2
+ import type { PropType, Ref } from "vue";
3
+ export type ActiveDirection = "x" | "y";
4
+ export interface ColorAreaThumbContext {
5
+ index: Ref<number>;
6
+ }
7
+ export declare const injectColorAreaThumbContext: <T extends ColorAreaThumbContext | null | undefined = ColorAreaThumbContext>(fallback?: T | undefined) => T extends null ? ColorAreaThumbContext | null : ColorAreaThumbContext, provideColorAreaThumbContext: (contextValue: ColorAreaThumbContext) => ColorAreaThumbContext;
8
+ export declare function clamp(value: number, min?: number, max?: number): number;
9
+ export declare function getDecimalCount(value: number): number;
10
+ export declare function roundValue(value: number, decimalCount: number): number;
11
+ /**
12
+ * Snap a value to the nearest step, then clamp it within [min, max].
13
+ */
14
+ export declare function snapToStep(value: number, min: number, max: number, step: number): number;
15
+ export declare function linearScale(input: readonly [number, number], output: readonly [number, number]): (value: number) => number;
16
+ export declare function convertValueToPercentage(value: number, min: number, max: number): number;
17
+ export declare function getLabel(index: number, totalValues: number): string | undefined;
18
+ export declare function getThumbInBoundsOffset(width: number, left: number, direction: number): number;
19
+ export declare function hasMinStepsBetweenValues(values: number[], minStepsBetweenValues: number): boolean;
20
+ /**
21
+ * Find the closest thumb to a given point using Euclidean distance.
22
+ */
23
+ export declare function getClosestThumbIndex(values: number[][], point: number[], minX: number, maxX: number, minY: number, maxY: number): number;
24
+ export declare const PAGE_KEYS: string[];
25
+ export declare const ARROW_KEYS: string[];
26
+ export declare function useFormControl(el: MaybeElementRef): import("vue").ComputedRef<boolean>;
27
+ export declare function useSize(element: MaybeElementRef): {
28
+ width: import("vue").ComputedRef<number>;
29
+ height: import("vue").ComputedRef<number>;
30
+ };
31
+ export declare function useCollection<ItemData = {}>(options?: {
32
+ key?: string;
33
+ isProvider?: boolean;
34
+ }): {
35
+ getItems: (includeDisabledItem?: boolean) => ({
36
+ ref: HTMLElement;
37
+ } & ItemData)[];
38
+ reactiveItems: import("vue").ComputedRef<({
39
+ ref: HTMLElement;
40
+ } & ItemData)[]>;
41
+ itemMapSize: import("vue").ComputedRef<number>;
42
+ CollectionSlot: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
43
+ [key: string]: any;
44
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
45
+ CollectionItem: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
46
+ value: {
47
+ type: PropType<unknown>;
48
+ default: undefined;
49
+ validator: () => boolean;
50
+ };
51
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
52
+ [key: string]: any;
53
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
54
+ value: {
55
+ type: PropType<unknown>;
56
+ default: undefined;
57
+ validator: () => boolean;
58
+ };
59
+ }>> & Readonly<{}>, {
60
+ value: undefined;
61
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
62
+ };
@@ -0,0 +1,19 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorFieldDecrementProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ disabled?: boolean;
6
+ }
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorFieldDecrementProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorFieldDecrementProps> & Readonly<{}>, {
10
+ disabled: boolean;
11
+ as: string;
12
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
13
+ default?: (props: {}) => any;
14
+ }>;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,19 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorFieldIncrementProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ disabled?: boolean;
6
+ }
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorFieldIncrementProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorFieldIncrementProps> & Readonly<{}>, {
10
+ disabled: boolean;
11
+ as: string;
12
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
13
+ default?: (props: {}) => any;
14
+ }>;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,17 @@
1
+ import type { PrimitiveProps } from "reka-ui";
2
+ export interface ColorFieldInputProps extends /* @vue-ignore */ PrimitiveProps {
3
+ as?: string;
4
+ asChild?: boolean;
5
+ }
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorFieldInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorFieldInputProps> & Readonly<{}>, {
9
+ as: string;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
+ default?: (props: {}) => any;
12
+ }>;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,74 @@
1
+ import type { Ref } from "vue";
2
+ import type { PrimitiveProps } from "reka-ui";
3
+ import "internationalized-color/css";
4
+ import { Color } from "internationalized-color";
5
+ export interface ColorFieldRootProps extends /* @vue-ignore */ PrimitiveProps {
6
+ as?: string;
7
+ asChild?: boolean;
8
+ /** The controlled color value. v-model binding. */
9
+ modelValue?: Color | string | null;
10
+ /** The color space mode (e.g. 'hsl', 'oklch'). */
11
+ colorSpace?: string;
12
+ /** Which channel this field controls (e.g. 'h', 's', 'l'). */
13
+ channel?: string;
14
+ /** Channel display format. Auto-derived from colorSpace config if not set. */
15
+ format?: "number" | "degree" | "percentage" | "hex";
16
+ /** Minimum allowed value. Auto-derived from colorSpace config if not set. */
17
+ min?: number;
18
+ /** Maximum allowed value. Auto-derived from colorSpace config if not set. */
19
+ max?: number;
20
+ /** Step increment for arrow keys. Auto-derived from colorSpace config if not set. */
21
+ step?: number;
22
+ /** Whether the field is disabled. */
23
+ disabled?: boolean;
24
+ /** Whether the field is read-only. */
25
+ readOnly?: boolean;
26
+ /** Hidden input name for form submission. */
27
+ name?: string;
28
+ /** Whether required for form submission. */
29
+ required?: boolean;
30
+ }
31
+ export type ColorFieldRootEmits = {
32
+ "update:modelValue": [value: Color | undefined];
33
+ "valueCommit": [value: Color];
34
+ };
35
+ export interface ColorFieldRootContext {
36
+ modelValue: Ref<number | undefined>;
37
+ displayValue: Ref<string>;
38
+ disabled: Ref<boolean>;
39
+ readOnly: Ref<boolean>;
40
+ isDecreaseDisabled: Ref<boolean>;
41
+ isIncreaseDisabled: Ref<boolean>;
42
+ handleIncrease: (multiplier?: number) => void;
43
+ handleDecrease: (multiplier?: number) => void;
44
+ handleMinMaxValue: (type: "min" | "max") => void;
45
+ commitValue: (val: number | undefined) => void;
46
+ onInputChange: (text: string) => void;
47
+ inputEl: Ref<HTMLInputElement | undefined>;
48
+ onInputElement: (el: HTMLInputElement) => void;
49
+ format: Ref<"number" | "degree" | "percentage" | "hex">;
50
+ }
51
+ export declare const injectColorFieldRootContext: <T extends ColorFieldRootContext | null | undefined = ColorFieldRootContext>(fallback?: T | undefined) => T extends null ? ColorFieldRootContext | null : ColorFieldRootContext, provideColorFieldRootContext: (contextValue: ColorFieldRootContext) => ColorFieldRootContext;
52
+ declare const _default: typeof __VLS_export;
53
+ export default _default;
54
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorFieldRootProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
55
+ "update:modelValue": (value: Color | undefined) => any;
56
+ valueCommit: (value: Color) => any;
57
+ }, string, import("vue").PublicProps, Readonly<ColorFieldRootProps> & Readonly<{
58
+ "onUpdate:modelValue"?: ((value: Color | undefined) => any) | undefined;
59
+ onValueCommit?: ((value: Color) => any) | undefined;
60
+ }>, {
61
+ disabled: boolean;
62
+ as: string;
63
+ required: boolean;
64
+ colorSpace: string;
65
+ channel: string;
66
+ readOnly: boolean;
67
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
68
+ default?: (props: {}) => any;
69
+ }>;
70
+ type __VLS_WithSlots<T, S> = T & {
71
+ new (): {
72
+ $slots: S;
73
+ };
74
+ };
@@ -0,0 +1,15 @@
1
+ import type { ColorSwatchRootProps } from "../ColorSwatch/ColorSwatchRoot.vue";
2
+ export interface ColorFieldSwatchProps extends /* @vue-ignore */ ColorSwatchRootProps {
3
+ }
4
+ declare const _default: typeof __VLS_export;
5
+ export default _default;
6
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorFieldSwatchProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorFieldSwatchProps> & Readonly<{}>, {
7
+ as: string;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
9
+ default?: (props: {}) => any;
10
+ }>;
11
+ type __VLS_WithSlots<T, S> = T & {
12
+ new (): {
13
+ $slots: S;
14
+ };
15
+ };