|
| 1 | +import type { APISchema } from '$lib/types/schema'; |
| 2 | + |
| 3 | +export default [ |
| 4 | + { |
| 5 | + title: 'ColorPicker', |
| 6 | + description: 'A full color picker with a saturation/value area, hue slider, and optional quick-select swatches. Supports RGB, OKLab, and OKHsv color spaces.', |
| 7 | + props: { |
| 8 | + rgb: { |
| 9 | + type: { type: 'object', definition: '{ r: number; g: number; b: number }' }, |
| 10 | + description: 'The current color in RGB format (0-255).', |
| 11 | + bindable: true |
| 12 | + }, |
| 13 | + oklab: { |
| 14 | + type: { type: 'object', definition: '{ l: number; a: number; b: number }' }, |
| 15 | + description: 'The current color in OKLab format.', |
| 16 | + bindable: true |
| 17 | + }, |
| 18 | + okhsv: { |
| 19 | + type: { type: 'object', definition: '{ h: number; s: number; v: number }' }, |
| 20 | + description: 'The current color in OKHsv format.', |
| 21 | + bindable: true |
| 22 | + }, |
| 23 | + onchange: { |
| 24 | + type: { type: 'function', definition: '(color: { hex: string; rgb: RGB; oklab: OKlab; okhsv: OKhsv; oklch: OKlch }) => void' }, |
| 25 | + description: 'Callback invoked when the color changes. Provides the color in all supported formats.' |
| 26 | + }, |
| 27 | + quickSelects: { |
| 28 | + type: { type: 'array', definition: '{ label: string; rgb?: RGB; oklab?: OKlab; okhsv?: OKhsv }[]' }, |
| 29 | + description: 'Quick-select color swatches displayed below the picker.', |
| 30 | + default: '[]', |
| 31 | + bindable: true |
| 32 | + }, |
| 33 | + class: { |
| 34 | + type: 'string', |
| 35 | + description: 'Additional CSS classes to apply.' |
| 36 | + } |
| 37 | + } |
| 38 | + }, |
| 39 | + { |
| 40 | + title: 'PopoverColorPicker', |
| 41 | + description: 'A color picker wrapped in a popover, triggered by a color swatch button.', |
| 42 | + props: { |
| 43 | + rgb: { |
| 44 | + type: { type: 'object', definition: '{ r: number; g: number; b: number }' }, |
| 45 | + description: 'The current color in RGB format (0-255).', |
| 46 | + bindable: true |
| 47 | + }, |
| 48 | + oklab: { |
| 49 | + type: { type: 'object', definition: '{ l: number; a: number; b: number }' }, |
| 50 | + description: 'The current color in OKLab format.', |
| 51 | + bindable: true |
| 52 | + }, |
| 53 | + okhsv: { |
| 54 | + type: { type: 'object', definition: '{ h: number; s: number; v: number }' }, |
| 55 | + description: 'The current color in OKHsv format.', |
| 56 | + bindable: true |
| 57 | + }, |
| 58 | + onchange: { |
| 59 | + type: { type: 'function', definition: '(color: { hex: string; rgb: RGB; oklab: OKlab; okhsv: OKhsv; oklch: OKlch }) => void' }, |
| 60 | + description: 'Callback invoked when the color changes.' |
| 61 | + }, |
| 62 | + quickSelects: { |
| 63 | + type: { type: 'array', definition: '{ label: string; rgb?: RGB; oklab?: OKlab; okhsv?: OKhsv }[]' }, |
| 64 | + description: 'Quick-select color swatches.', |
| 65 | + default: '[]', |
| 66 | + bindable: true |
| 67 | + }, |
| 68 | + side: { |
| 69 | + type: { type: 'enum', definition: "'top' | 'right' | 'bottom' | 'left'" }, |
| 70 | + description: 'The preferred side of the trigger to render the popover.', |
| 71 | + default: "'bottom'" |
| 72 | + }, |
| 73 | + sideOffset: { |
| 74 | + type: 'number', |
| 75 | + description: 'The distance in pixels from the trigger.', |
| 76 | + default: '10' |
| 77 | + }, |
| 78 | + class: { |
| 79 | + type: 'string', |
| 80 | + description: 'Additional CSS classes to apply.' |
| 81 | + } |
| 82 | + } |
| 83 | + } |
| 84 | +] satisfies APISchema[]; |
0 commit comments