@proyecto-viviana/solid-stately 0.0.5 → 0.1.0
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.
- package/README.md +312 -0
- package/dist/index.d.ts +3363 -6
- package/dist/index.js +6194 -19
- package/dist/index.js.map +1 -1
- package/package.json +52 -48
- package/src/autocomplete/createAutocompleteState.d.ts +46 -0
- package/src/autocomplete/createAutocompleteState.d.ts.map +1 -0
- package/src/autocomplete/createAutocompleteState.ts +90 -0
- package/src/autocomplete/index.d.ts +2 -0
- package/src/autocomplete/index.d.ts.map +1 -0
- package/src/autocomplete/index.ts +5 -0
- package/src/calendar/createCalendarState.d.ts +130 -0
- package/src/calendar/createCalendarState.d.ts.map +1 -0
- package/src/calendar/createCalendarState.ts +461 -0
- package/src/calendar/createDateFieldState.d.ts +110 -0
- package/src/calendar/createDateFieldState.d.ts.map +1 -0
- package/src/calendar/createDateFieldState.ts +562 -0
- package/src/calendar/createRangeCalendarState.d.ts +146 -0
- package/src/calendar/createRangeCalendarState.d.ts.map +1 -0
- package/src/calendar/createRangeCalendarState.ts +535 -0
- package/src/calendar/createTimeFieldState.d.ts +95 -0
- package/src/calendar/createTimeFieldState.d.ts.map +1 -0
- package/src/calendar/createTimeFieldState.ts +483 -0
- package/src/calendar/index.d.ts +7 -0
- package/src/calendar/index.d.ts.map +1 -0
- package/src/calendar/index.ts +81 -0
- package/{dist → src}/checkbox/createCheckboxGroupState.d.ts +1 -0
- package/src/checkbox/createCheckboxGroupState.d.ts.map +1 -0
- package/{dist → src}/checkbox/index.d.ts +1 -0
- package/src/checkbox/index.d.ts.map +1 -0
- package/src/collections/ListCollection.d.ts +37 -0
- package/src/collections/ListCollection.d.ts.map +1 -0
- package/src/collections/ListCollection.ts +146 -0
- package/src/collections/createListState.d.ts +79 -0
- package/src/collections/createListState.d.ts.map +1 -0
- package/src/collections/createListState.ts +264 -0
- package/src/collections/createMenuState.d.ts +50 -0
- package/src/collections/createMenuState.d.ts.map +1 -0
- package/src/collections/createMenuState.ts +106 -0
- package/src/collections/createSelectionState.d.ts +76 -0
- package/src/collections/createSelectionState.d.ts.map +1 -0
- package/src/collections/createSelectionState.ts +336 -0
- package/src/collections/index.d.ts +6 -0
- package/src/collections/index.d.ts.map +1 -0
- package/src/collections/index.ts +46 -0
- package/src/collections/types.d.ts +147 -0
- package/src/collections/types.d.ts.map +1 -0
- package/src/collections/types.ts +169 -0
- package/src/color/Color.d.ts +28 -0
- package/src/color/Color.d.ts.map +1 -0
- package/src/color/Color.ts +951 -0
- package/src/color/createColorAreaState.d.ts +76 -0
- package/src/color/createColorAreaState.d.ts.map +1 -0
- package/src/color/createColorAreaState.ts +293 -0
- package/src/color/createColorFieldState.d.ts +55 -0
- package/src/color/createColorFieldState.d.ts.map +1 -0
- package/src/color/createColorFieldState.ts +292 -0
- package/src/color/createColorSliderState.d.ts +67 -0
- package/src/color/createColorSliderState.d.ts.map +1 -0
- package/src/color/createColorSliderState.ts +241 -0
- package/src/color/createColorWheelState.d.ts +51 -0
- package/src/color/createColorWheelState.d.ts.map +1 -0
- package/src/color/createColorWheelState.ts +211 -0
- package/src/color/index.d.ts +10 -0
- package/src/color/index.d.ts.map +1 -0
- package/src/color/index.ts +47 -0
- package/src/color/types.d.ts +106 -0
- package/src/color/types.d.ts.map +1 -0
- package/src/color/types.ts +127 -0
- package/src/combobox/createComboBoxState.d.ts +125 -0
- package/src/combobox/createComboBoxState.d.ts.map +1 -0
- package/src/combobox/createComboBoxState.ts +703 -0
- package/src/combobox/index.d.ts +5 -0
- package/src/combobox/index.d.ts.map +1 -0
- package/src/combobox/index.ts +13 -0
- package/src/disclosure/createDisclosureState.d.ts +64 -0
- package/src/disclosure/createDisclosureState.d.ts.map +1 -0
- package/src/disclosure/createDisclosureState.ts +193 -0
- package/src/disclosure/index.d.ts +2 -0
- package/src/disclosure/index.d.ts.map +1 -0
- package/src/disclosure/index.ts +9 -0
- package/src/dnd/createDragState.d.ts +59 -0
- package/src/dnd/createDragState.d.ts.map +1 -0
- package/src/dnd/createDragState.ts +153 -0
- package/src/dnd/createDraggableCollectionState.d.ts +57 -0
- package/src/dnd/createDraggableCollectionState.d.ts.map +1 -0
- package/src/dnd/createDraggableCollectionState.ts +165 -0
- package/src/dnd/createDropState.d.ts +61 -0
- package/src/dnd/createDropState.d.ts.map +1 -0
- package/src/dnd/createDropState.ts +212 -0
- package/src/dnd/createDroppableCollectionState.d.ts +78 -0
- package/src/dnd/createDroppableCollectionState.d.ts.map +1 -0
- package/src/dnd/createDroppableCollectionState.ts +357 -0
- package/src/dnd/index.d.ts +11 -0
- package/src/dnd/index.d.ts.map +1 -0
- package/src/dnd/index.ts +76 -0
- package/src/dnd/types.d.ts +264 -0
- package/src/dnd/types.d.ts.map +1 -0
- package/src/dnd/types.ts +317 -0
- package/src/form/createFormValidationState.d.ts +100 -0
- package/src/form/createFormValidationState.d.ts.map +1 -0
- package/src/form/createFormValidationState.ts +389 -0
- package/src/form/index.d.ts +2 -0
- package/src/form/index.d.ts.map +1 -0
- package/src/form/index.ts +15 -0
- package/src/grid/createGridState.d.ts +12 -0
- package/src/grid/createGridState.d.ts.map +1 -0
- package/src/grid/createGridState.ts +327 -0
- package/src/grid/index.d.ts +7 -0
- package/src/grid/index.d.ts.map +1 -0
- package/src/grid/index.ts +13 -0
- package/src/grid/types.d.ts +156 -0
- package/src/grid/types.d.ts.map +1 -0
- package/src/grid/types.ts +179 -0
- package/src/index.d.ts +26 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.ts +350 -1
- package/src/numberfield/createNumberFieldState.d.ts +65 -0
- package/src/numberfield/createNumberFieldState.d.ts.map +1 -0
- package/src/numberfield/createNumberFieldState.ts +383 -0
- package/src/numberfield/index.d.ts +2 -0
- package/src/numberfield/index.d.ts.map +1 -0
- package/src/numberfield/index.ts +5 -0
- package/src/overlays/createOverlayTriggerState.d.ts +32 -0
- package/src/overlays/createOverlayTriggerState.d.ts.map +1 -0
- package/src/overlays/createOverlayTriggerState.ts +67 -0
- package/src/overlays/index.d.ts +2 -0
- package/src/overlays/index.d.ts.map +1 -0
- package/src/overlays/index.ts +5 -0
- package/{dist → src}/radio/createRadioGroupState.d.ts +1 -0
- package/src/radio/createRadioGroupState.d.ts.map +1 -0
- package/{dist → src}/radio/index.d.ts +1 -0
- package/src/radio/index.d.ts.map +1 -0
- package/src/searchfield/createSearchFieldState.d.ts +25 -0
- package/src/searchfield/createSearchFieldState.d.ts.map +1 -0
- package/src/searchfield/createSearchFieldState.ts +62 -0
- package/src/searchfield/index.d.ts +3 -0
- package/src/searchfield/index.d.ts.map +1 -0
- package/src/searchfield/index.ts +5 -0
- package/src/select/createSelectState.d.ts +73 -0
- package/src/select/createSelectState.d.ts.map +1 -0
- package/src/select/createSelectState.ts +181 -0
- package/src/select/index.d.ts +2 -0
- package/src/select/index.d.ts.map +1 -0
- package/src/select/index.ts +5 -0
- package/src/slider/createSliderState.d.ts +72 -0
- package/src/slider/createSliderState.d.ts.map +1 -0
- package/src/slider/createSliderState.ts +211 -0
- package/src/slider/index.d.ts +3 -0
- package/src/slider/index.d.ts.map +1 -0
- package/src/slider/index.ts +6 -0
- package/{dist → src}/ssr/index.d.ts +5 -0
- package/src/ssr/index.d.ts.map +1 -0
- package/src/ssr/index.ts +6 -1
- package/src/table/TableCollection.d.ts +52 -0
- package/src/table/TableCollection.d.ts.map +1 -0
- package/src/table/TableCollection.ts +388 -0
- package/src/table/createTableState.d.ts +12 -0
- package/src/table/createTableState.d.ts.map +1 -0
- package/src/table/createTableState.ts +127 -0
- package/src/table/index.d.ts +8 -0
- package/src/table/index.d.ts.map +1 -0
- package/src/table/index.ts +18 -0
- package/src/table/types.d.ts +139 -0
- package/src/table/types.d.ts.map +1 -0
- package/src/table/types.ts +150 -0
- package/src/tabs/createTabListState.d.ts +68 -0
- package/src/tabs/createTabListState.d.ts.map +1 -0
- package/src/tabs/createTabListState.ts +240 -0
- package/src/tabs/index.d.ts +2 -0
- package/src/tabs/index.d.ts.map +1 -0
- package/src/tabs/index.ts +7 -0
- package/{dist → src}/textfield/createTextFieldState.d.ts +1 -0
- package/src/textfield/createTextFieldState.d.ts.map +1 -0
- package/{dist → src}/textfield/index.d.ts +1 -0
- package/src/textfield/index.d.ts.map +1 -0
- package/src/toast/createToastState.d.ts +118 -0
- package/src/toast/createToastState.d.ts.map +1 -0
- package/src/toast/createToastState.ts +316 -0
- package/src/toast/index.d.ts +2 -0
- package/src/toast/index.d.ts.map +1 -0
- package/src/toast/index.ts +11 -0
- package/{dist → src}/toggle/createToggleState.d.ts +1 -0
- package/src/toggle/createToggleState.d.ts.map +1 -0
- package/{dist → src}/toggle/index.d.ts +1 -0
- package/src/toggle/index.d.ts.map +1 -0
- package/src/tooltip/createTooltipTriggerState.d.ts +39 -0
- package/src/tooltip/createTooltipTriggerState.d.ts.map +1 -0
- package/src/tooltip/createTooltipTriggerState.ts +183 -0
- package/src/tooltip/index.d.ts +2 -0
- package/src/tooltip/index.d.ts.map +1 -0
- package/src/tooltip/index.ts +6 -0
- package/src/tree/TreeCollection.d.ts +40 -0
- package/src/tree/TreeCollection.d.ts.map +1 -0
- package/src/tree/TreeCollection.ts +175 -0
- package/src/tree/createTreeState.d.ts +14 -0
- package/src/tree/createTreeState.d.ts.map +1 -0
- package/src/tree/createTreeState.ts +392 -0
- package/src/tree/index.d.ts +7 -0
- package/src/tree/index.d.ts.map +1 -0
- package/src/tree/index.ts +13 -0
- package/src/tree/types.d.ts +157 -0
- package/src/tree/types.d.ts.map +1 -0
- package/src/tree/types.ts +174 -0
- package/{dist → src}/utils/index.d.ts +1 -0
- package/src/utils/index.d.ts.map +1 -0
- package/{dist → src}/utils/reactivity.d.ts +1 -0
- package/src/utils/reactivity.d.ts.map +1 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ColorWheel state management.
|
|
3
|
+
* Based on @react-stately/color useColorWheelState.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { createSignal, createMemo, type Accessor } from 'solid-js';
|
|
7
|
+
import type { Color, ColorChannel } from './types';
|
|
8
|
+
import { normalizeColor } from './Color';
|
|
9
|
+
|
|
10
|
+
export interface ColorWheelStateOptions {
|
|
11
|
+
/** The current color value (controlled). */
|
|
12
|
+
value?: Color | string;
|
|
13
|
+
/** The default color value (uncontrolled). */
|
|
14
|
+
defaultValue?: Color | string;
|
|
15
|
+
/** Handler called when the color changes. */
|
|
16
|
+
onChange?: (color: Color) => void;
|
|
17
|
+
/** Handler called when dragging ends. */
|
|
18
|
+
onChangeEnd?: (color: Color) => void;
|
|
19
|
+
/** Whether the wheel is disabled. */
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ColorWheelState {
|
|
24
|
+
/** The current color value. */
|
|
25
|
+
readonly value: Color;
|
|
26
|
+
/** Whether the wheel is being dragged. */
|
|
27
|
+
readonly isDragging: boolean;
|
|
28
|
+
/** Whether the wheel is disabled. */
|
|
29
|
+
readonly isDisabled: boolean;
|
|
30
|
+
/** Step value for hue changes. */
|
|
31
|
+
readonly step: number;
|
|
32
|
+
/** Page step value for hue changes. */
|
|
33
|
+
readonly pageStep: number;
|
|
34
|
+
|
|
35
|
+
/** Get the current hue value (0-360). */
|
|
36
|
+
getHue(): number;
|
|
37
|
+
/** Set the hue value. */
|
|
38
|
+
setHue(value: number): void;
|
|
39
|
+
/** Set hue from an angle in radians. */
|
|
40
|
+
setHueFromAngle(angle: number): void;
|
|
41
|
+
/** Get the thumb angle in radians (0 = right, increases counterclockwise). */
|
|
42
|
+
getThumbAngle(): number;
|
|
43
|
+
/** Increment hue value. */
|
|
44
|
+
increment(stepSize?: number): void;
|
|
45
|
+
/** Decrement hue value. */
|
|
46
|
+
decrement(stepSize?: number): void;
|
|
47
|
+
/** Set the dragging state. */
|
|
48
|
+
setDragging(isDragging: boolean): void;
|
|
49
|
+
/** Get the display color (with full saturation/brightness for wheel). */
|
|
50
|
+
getDisplayColor(): Color;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Creates state for a color wheel (circular hue picker).
|
|
55
|
+
*/
|
|
56
|
+
export function createColorWheelState(
|
|
57
|
+
options: Accessor<ColorWheelStateOptions>
|
|
58
|
+
): ColorWheelState {
|
|
59
|
+
const getOptions = () => options();
|
|
60
|
+
|
|
61
|
+
// Internal value state
|
|
62
|
+
const [internalValue, setInternalValue] = createSignal<Color | null>(null);
|
|
63
|
+
const [isDragging, setIsDragging] = createSignal(false);
|
|
64
|
+
|
|
65
|
+
// Initialize internal value
|
|
66
|
+
const initValue = () => {
|
|
67
|
+
const opts = getOptions();
|
|
68
|
+
if (opts.defaultValue) {
|
|
69
|
+
return normalizeColor(opts.defaultValue);
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Set initial value
|
|
75
|
+
if (internalValue() === null) {
|
|
76
|
+
const init = initValue();
|
|
77
|
+
if (init) {
|
|
78
|
+
setInternalValue(init);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Controlled vs uncontrolled value
|
|
83
|
+
const value = createMemo(() => {
|
|
84
|
+
const opts = getOptions();
|
|
85
|
+
if (opts.value !== undefined) {
|
|
86
|
+
return normalizeColor(opts.value);
|
|
87
|
+
}
|
|
88
|
+
return internalValue() ?? normalizeColor('#ff0000');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const isDisabled = createMemo(() => getOptions().isDisabled ?? false);
|
|
92
|
+
|
|
93
|
+
// Hue step and page step
|
|
94
|
+
const hueRange = createMemo(() => value().getChannelRange('hue'));
|
|
95
|
+
const step = createMemo(() => hueRange().step);
|
|
96
|
+
const pageStep = createMemo(() => hueRange().pageSize);
|
|
97
|
+
|
|
98
|
+
// Update value
|
|
99
|
+
const updateValue = (newColor: Color) => {
|
|
100
|
+
const opts = getOptions();
|
|
101
|
+
|
|
102
|
+
// Controlled mode
|
|
103
|
+
if (opts.value !== undefined) {
|
|
104
|
+
opts.onChange?.(newColor);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Uncontrolled mode
|
|
109
|
+
setInternalValue(newColor);
|
|
110
|
+
opts.onChange?.(newColor);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Get hue value (0-360)
|
|
114
|
+
const getHue = () => value().getChannelValue('hue');
|
|
115
|
+
|
|
116
|
+
// Set hue value
|
|
117
|
+
const setHue = (newValue: number) => {
|
|
118
|
+
// Wrap hue to 0-360 range
|
|
119
|
+
let hue = newValue % 360;
|
|
120
|
+
if (hue < 0) hue += 360;
|
|
121
|
+
|
|
122
|
+
// Round to step
|
|
123
|
+
const range = hueRange();
|
|
124
|
+
const rounded = Math.round(hue / range.step) * range.step;
|
|
125
|
+
|
|
126
|
+
const newColor = value().withChannelValue('hue', rounded);
|
|
127
|
+
updateValue(newColor);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Set hue from angle (radians, 0 = right, counterclockwise)
|
|
131
|
+
const setHueFromAngle = (angle: number) => {
|
|
132
|
+
// Convert angle to degrees (0-360)
|
|
133
|
+
// angle 0 = right (3 o'clock) = hue 0
|
|
134
|
+
// angle increases counterclockwise
|
|
135
|
+
let degrees = (angle * 180) / Math.PI;
|
|
136
|
+
degrees = 360 - degrees; // Convert to clockwise
|
|
137
|
+
if (degrees < 0) degrees += 360;
|
|
138
|
+
if (degrees >= 360) degrees -= 360;
|
|
139
|
+
|
|
140
|
+
setHue(degrees);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// Get thumb angle in radians
|
|
144
|
+
const getThumbAngle = () => {
|
|
145
|
+
const hue = getHue();
|
|
146
|
+
// Convert hue to angle (radians)
|
|
147
|
+
// hue 0 = angle 0 (right)
|
|
148
|
+
// hue increases clockwise, angle increases counterclockwise
|
|
149
|
+
const degrees = 360 - hue;
|
|
150
|
+
return (degrees * Math.PI) / 180;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// Increment hue
|
|
154
|
+
const increment = (stepSize?: number) => {
|
|
155
|
+
const s = stepSize ?? step();
|
|
156
|
+
setHue(getHue() + s);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// Decrement hue
|
|
160
|
+
const decrement = (stepSize?: number) => {
|
|
161
|
+
const s = stepSize ?? step();
|
|
162
|
+
setHue(getHue() - s);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Set dragging state
|
|
166
|
+
const setDraggingState = (dragging: boolean) => {
|
|
167
|
+
const wasDragging = isDragging();
|
|
168
|
+
setIsDragging(dragging);
|
|
169
|
+
|
|
170
|
+
// Call onChangeEnd when dragging ends
|
|
171
|
+
if (wasDragging && !dragging) {
|
|
172
|
+
getOptions().onChangeEnd?.(value());
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// Get display color (full saturation and brightness for wheel preview)
|
|
177
|
+
const getDisplayColor = () => {
|
|
178
|
+
// For display, we want the color at full saturation and brightness
|
|
179
|
+
// to show the pure hue on the wheel
|
|
180
|
+
return value()
|
|
181
|
+
.withChannelValue('saturation', 100)
|
|
182
|
+
.withChannelValue('brightness', 100)
|
|
183
|
+
.withChannelValue('alpha', 1);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
get value() {
|
|
188
|
+
return value();
|
|
189
|
+
},
|
|
190
|
+
get isDragging() {
|
|
191
|
+
return isDragging();
|
|
192
|
+
},
|
|
193
|
+
get isDisabled() {
|
|
194
|
+
return isDisabled();
|
|
195
|
+
},
|
|
196
|
+
get step() {
|
|
197
|
+
return step();
|
|
198
|
+
},
|
|
199
|
+
get pageStep() {
|
|
200
|
+
return pageStep();
|
|
201
|
+
},
|
|
202
|
+
getHue,
|
|
203
|
+
setHue,
|
|
204
|
+
setHueFromAngle,
|
|
205
|
+
getThumbAngle,
|
|
206
|
+
increment,
|
|
207
|
+
decrement,
|
|
208
|
+
setDragging: setDraggingState,
|
|
209
|
+
getDisplayColor,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color state management exports.
|
|
3
|
+
*/
|
|
4
|
+
export type { Color, ColorFormat, ColorSpace, ColorChannel, ColorChannelRange, ColorAxes, } from './types';
|
|
5
|
+
export { parseColor, normalizeColor, createRGBColor, createHSLColor, createHSBColor, } from './Color';
|
|
6
|
+
export { createColorSliderState, type ColorSliderStateOptions, type ColorSliderState, } from './createColorSliderState';
|
|
7
|
+
export { createColorAreaState, type ColorAreaStateOptions, type ColorAreaState, } from './createColorAreaState';
|
|
8
|
+
export { createColorWheelState, type ColorWheelStateOptions, type ColorWheelState, } from './createColorWheelState';
|
|
9
|
+
export { createColorFieldState, type ColorFieldStateOptions, type ColorFieldState, } from './createColorFieldState';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,KAAK,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,SAAS,GACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color state management exports.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Types
|
|
6
|
+
export type {
|
|
7
|
+
Color,
|
|
8
|
+
ColorFormat,
|
|
9
|
+
ColorSpace,
|
|
10
|
+
ColorChannel,
|
|
11
|
+
ColorChannelRange,
|
|
12
|
+
ColorAxes,
|
|
13
|
+
} from './types';
|
|
14
|
+
|
|
15
|
+
// Color class and utilities
|
|
16
|
+
export {
|
|
17
|
+
parseColor,
|
|
18
|
+
normalizeColor,
|
|
19
|
+
createRGBColor,
|
|
20
|
+
createHSLColor,
|
|
21
|
+
createHSBColor,
|
|
22
|
+
} from './Color';
|
|
23
|
+
|
|
24
|
+
// State hooks
|
|
25
|
+
export {
|
|
26
|
+
createColorSliderState,
|
|
27
|
+
type ColorSliderStateOptions,
|
|
28
|
+
type ColorSliderState,
|
|
29
|
+
} from './createColorSliderState';
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
createColorAreaState,
|
|
33
|
+
type ColorAreaStateOptions,
|
|
34
|
+
type ColorAreaState,
|
|
35
|
+
} from './createColorAreaState';
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
createColorWheelState,
|
|
39
|
+
type ColorWheelStateOptions,
|
|
40
|
+
type ColorWheelState,
|
|
41
|
+
} from './createColorWheelState';
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
createColorFieldState,
|
|
45
|
+
type ColorFieldStateOptions,
|
|
46
|
+
type ColorFieldState,
|
|
47
|
+
} from './createColorFieldState';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color types for color picker components.
|
|
3
|
+
* Based on @react-stately/color.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Supported color formats.
|
|
7
|
+
*/
|
|
8
|
+
export type ColorFormat = 'hex' | 'hexa' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hsb' | 'hsba';
|
|
9
|
+
/**
|
|
10
|
+
* Color spaces.
|
|
11
|
+
*/
|
|
12
|
+
export type ColorSpace = 'rgb' | 'hsl' | 'hsb';
|
|
13
|
+
/**
|
|
14
|
+
* Color channels.
|
|
15
|
+
*/
|
|
16
|
+
export type ColorChannel = 'hue' | 'saturation' | 'brightness' | 'lightness' | 'red' | 'green' | 'blue' | 'alpha';
|
|
17
|
+
/**
|
|
18
|
+
* Range for a color channel.
|
|
19
|
+
*/
|
|
20
|
+
export interface ColorChannelRange {
|
|
21
|
+
/** Minimum value. */
|
|
22
|
+
minValue: number;
|
|
23
|
+
/** Maximum value. */
|
|
24
|
+
maxValue: number;
|
|
25
|
+
/** Step for keyboard increment. */
|
|
26
|
+
step: number;
|
|
27
|
+
/** Page step for larger increments. */
|
|
28
|
+
pageSize: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Color axes for a color space.
|
|
32
|
+
*/
|
|
33
|
+
export interface ColorAxes {
|
|
34
|
+
/** X-axis channel. */
|
|
35
|
+
xChannel: ColorChannel;
|
|
36
|
+
/** Y-axis channel. */
|
|
37
|
+
yChannel: ColorChannel;
|
|
38
|
+
/** Z-axis channel (the one not on x or y). */
|
|
39
|
+
zChannel: ColorChannel;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Color interface representing a color value.
|
|
43
|
+
*/
|
|
44
|
+
export interface Color {
|
|
45
|
+
/** Convert to a different format. */
|
|
46
|
+
toFormat(format: ColorFormat): Color;
|
|
47
|
+
/** Convert to a CSS string. */
|
|
48
|
+
toString(format?: ColorFormat | 'css'): string;
|
|
49
|
+
/** Clone this color. */
|
|
50
|
+
clone(): Color;
|
|
51
|
+
/** Get the hex value as an integer. */
|
|
52
|
+
toHexInt(): number;
|
|
53
|
+
/** Get the value of a specific channel. */
|
|
54
|
+
getChannelValue(channel: ColorChannel): number;
|
|
55
|
+
/** Create a new color with a channel value changed. */
|
|
56
|
+
withChannelValue(channel: ColorChannel, value: number): Color;
|
|
57
|
+
/** Get the range for a channel. */
|
|
58
|
+
getChannelRange(channel: ColorChannel): ColorChannelRange;
|
|
59
|
+
/** Get the localized name of a channel. */
|
|
60
|
+
getChannelName(channel: ColorChannel, locale: string): string;
|
|
61
|
+
/** Get the format options for a channel. */
|
|
62
|
+
getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
|
|
63
|
+
/** Format the value of a channel. */
|
|
64
|
+
formatChannelValue(channel: ColorChannel, locale: string): string;
|
|
65
|
+
/** Get the color space. */
|
|
66
|
+
getColorSpace(): ColorSpace;
|
|
67
|
+
/** Get the axes for a color space. */
|
|
68
|
+
getColorSpaceAxes(xyChannels?: {
|
|
69
|
+
xChannel?: ColorChannel;
|
|
70
|
+
yChannel?: ColorChannel;
|
|
71
|
+
}): ColorAxes;
|
|
72
|
+
/** Get all channels for this color space. */
|
|
73
|
+
getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
|
|
74
|
+
/** Get a human-readable color name. */
|
|
75
|
+
getColorName(locale: string): string;
|
|
76
|
+
/** Get the hue name (e.g., "red", "blue"). */
|
|
77
|
+
getHueName(locale: string): string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* RGB color value.
|
|
81
|
+
*/
|
|
82
|
+
export interface RGBColor {
|
|
83
|
+
red: number;
|
|
84
|
+
green: number;
|
|
85
|
+
blue: number;
|
|
86
|
+
alpha: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* HSL color value.
|
|
90
|
+
*/
|
|
91
|
+
export interface HSLColor {
|
|
92
|
+
hue: number;
|
|
93
|
+
saturation: number;
|
|
94
|
+
lightness: number;
|
|
95
|
+
alpha: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* HSB color value.
|
|
99
|
+
*/
|
|
100
|
+
export interface HSBColor {
|
|
101
|
+
hue: number;
|
|
102
|
+
saturation: number;
|
|
103
|
+
brightness: number;
|
|
104
|
+
alpha: number;
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;AACH,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color types for color picker components.
|
|
3
|
+
* Based on @react-stately/color.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Supported color formats.
|
|
8
|
+
*/
|
|
9
|
+
export type ColorFormat =
|
|
10
|
+
| 'hex'
|
|
11
|
+
| 'hexa'
|
|
12
|
+
| 'rgb'
|
|
13
|
+
| 'rgba'
|
|
14
|
+
| 'hsl'
|
|
15
|
+
| 'hsla'
|
|
16
|
+
| 'hsb'
|
|
17
|
+
| 'hsba';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Color spaces.
|
|
21
|
+
*/
|
|
22
|
+
export type ColorSpace = 'rgb' | 'hsl' | 'hsb';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Color channels.
|
|
26
|
+
*/
|
|
27
|
+
export type ColorChannel =
|
|
28
|
+
| 'hue'
|
|
29
|
+
| 'saturation'
|
|
30
|
+
| 'brightness'
|
|
31
|
+
| 'lightness'
|
|
32
|
+
| 'red'
|
|
33
|
+
| 'green'
|
|
34
|
+
| 'blue'
|
|
35
|
+
| 'alpha';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Range for a color channel.
|
|
39
|
+
*/
|
|
40
|
+
export interface ColorChannelRange {
|
|
41
|
+
/** Minimum value. */
|
|
42
|
+
minValue: number;
|
|
43
|
+
/** Maximum value. */
|
|
44
|
+
maxValue: number;
|
|
45
|
+
/** Step for keyboard increment. */
|
|
46
|
+
step: number;
|
|
47
|
+
/** Page step for larger increments. */
|
|
48
|
+
pageSize: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Color axes for a color space.
|
|
53
|
+
*/
|
|
54
|
+
export interface ColorAxes {
|
|
55
|
+
/** X-axis channel. */
|
|
56
|
+
xChannel: ColorChannel;
|
|
57
|
+
/** Y-axis channel. */
|
|
58
|
+
yChannel: ColorChannel;
|
|
59
|
+
/** Z-axis channel (the one not on x or y). */
|
|
60
|
+
zChannel: ColorChannel;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Color interface representing a color value.
|
|
65
|
+
*/
|
|
66
|
+
export interface Color {
|
|
67
|
+
/** Convert to a different format. */
|
|
68
|
+
toFormat(format: ColorFormat): Color;
|
|
69
|
+
/** Convert to a CSS string. */
|
|
70
|
+
toString(format?: ColorFormat | 'css'): string;
|
|
71
|
+
/** Clone this color. */
|
|
72
|
+
clone(): Color;
|
|
73
|
+
/** Get the hex value as an integer. */
|
|
74
|
+
toHexInt(): number;
|
|
75
|
+
/** Get the value of a specific channel. */
|
|
76
|
+
getChannelValue(channel: ColorChannel): number;
|
|
77
|
+
/** Create a new color with a channel value changed. */
|
|
78
|
+
withChannelValue(channel: ColorChannel, value: number): Color;
|
|
79
|
+
/** Get the range for a channel. */
|
|
80
|
+
getChannelRange(channel: ColorChannel): ColorChannelRange;
|
|
81
|
+
/** Get the localized name of a channel. */
|
|
82
|
+
getChannelName(channel: ColorChannel, locale: string): string;
|
|
83
|
+
/** Get the format options for a channel. */
|
|
84
|
+
getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
|
|
85
|
+
/** Format the value of a channel. */
|
|
86
|
+
formatChannelValue(channel: ColorChannel, locale: string): string;
|
|
87
|
+
/** Get the color space. */
|
|
88
|
+
getColorSpace(): ColorSpace;
|
|
89
|
+
/** Get the axes for a color space. */
|
|
90
|
+
getColorSpaceAxes(xyChannels?: { xChannel?: ColorChannel; yChannel?: ColorChannel }): ColorAxes;
|
|
91
|
+
/** Get all channels for this color space. */
|
|
92
|
+
getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
|
|
93
|
+
/** Get a human-readable color name. */
|
|
94
|
+
getColorName(locale: string): string;
|
|
95
|
+
/** Get the hue name (e.g., "red", "blue"). */
|
|
96
|
+
getHueName(locale: string): string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* RGB color value.
|
|
101
|
+
*/
|
|
102
|
+
export interface RGBColor {
|
|
103
|
+
red: number;
|
|
104
|
+
green: number;
|
|
105
|
+
blue: number;
|
|
106
|
+
alpha: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* HSL color value.
|
|
111
|
+
*/
|
|
112
|
+
export interface HSLColor {
|
|
113
|
+
hue: number;
|
|
114
|
+
saturation: number;
|
|
115
|
+
lightness: number;
|
|
116
|
+
alpha: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* HSB color value.
|
|
121
|
+
*/
|
|
122
|
+
export interface HSBColor {
|
|
123
|
+
hue: number;
|
|
124
|
+
saturation: number;
|
|
125
|
+
brightness: number;
|
|
126
|
+
alpha: number;
|
|
127
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State management for ComboBox components.
|
|
3
|
+
* Based on @react-stately/combobox useComboBoxState.
|
|
4
|
+
*
|
|
5
|
+
* ComboBox combines a text input with a dropdown list, allowing users to
|
|
6
|
+
* either type to filter options or select from a list.
|
|
7
|
+
*/
|
|
8
|
+
import { type Accessor } from 'solid-js';
|
|
9
|
+
import { type MaybeAccessor } from '../utils';
|
|
10
|
+
import type { Key, CollectionNode, Collection, FocusStrategy } from '../collections/types';
|
|
11
|
+
export type MenuTriggerAction = 'focus' | 'input' | 'manual';
|
|
12
|
+
export type { FocusStrategy } from '../collections/types';
|
|
13
|
+
export type FilterFn = (textValue: string, inputValue: string) => boolean;
|
|
14
|
+
export interface ComboBoxStateProps<T = unknown> {
|
|
15
|
+
/** The items to display in the combobox dropdown. */
|
|
16
|
+
items: T[];
|
|
17
|
+
/** Default items when uncontrolled. */
|
|
18
|
+
defaultItems?: T[];
|
|
19
|
+
/** Function to get the key for an item. */
|
|
20
|
+
getKey?: (item: T) => Key;
|
|
21
|
+
/** Function to get the text value for an item. */
|
|
22
|
+
getTextValue?: (item: T) => string;
|
|
23
|
+
/** Function to check if an item is disabled. */
|
|
24
|
+
getDisabled?: (item: T) => boolean;
|
|
25
|
+
/** Keys of disabled items. */
|
|
26
|
+
disabledKeys?: Iterable<Key>;
|
|
27
|
+
/** The currently selected key (controlled). */
|
|
28
|
+
selectedKey?: Key | null;
|
|
29
|
+
/** The default selected key (uncontrolled). */
|
|
30
|
+
defaultSelectedKey?: Key | null;
|
|
31
|
+
/** Handler called when the selection changes. */
|
|
32
|
+
onSelectionChange?: (key: Key | null) => void;
|
|
33
|
+
/** The current input value (controlled). */
|
|
34
|
+
inputValue?: string;
|
|
35
|
+
/** The default input value (uncontrolled). */
|
|
36
|
+
defaultInputValue?: string;
|
|
37
|
+
/** Handler called when the input value changes. */
|
|
38
|
+
onInputChange?: (value: string) => void;
|
|
39
|
+
/** Whether the combobox is open (controlled). */
|
|
40
|
+
isOpen?: boolean;
|
|
41
|
+
/** Whether the combobox is open by default (uncontrolled). */
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
/** Handler called when the open state changes. */
|
|
44
|
+
onOpenChange?: (isOpen: boolean, trigger?: MenuTriggerAction) => void;
|
|
45
|
+
/** Whether the combobox is disabled. */
|
|
46
|
+
isDisabled?: boolean;
|
|
47
|
+
/** Whether the combobox is read-only. */
|
|
48
|
+
isReadOnly?: boolean;
|
|
49
|
+
/** Whether the combobox is required. */
|
|
50
|
+
isRequired?: boolean;
|
|
51
|
+
/** The filter function to use when filtering items. */
|
|
52
|
+
defaultFilter?: FilterFn;
|
|
53
|
+
/** Whether to allow the menu to open when there are no items. */
|
|
54
|
+
allowsEmptyCollection?: boolean;
|
|
55
|
+
/** Whether to allow custom values that don't match any option. */
|
|
56
|
+
allowsCustomValue?: boolean;
|
|
57
|
+
/** What triggers the menu to open. */
|
|
58
|
+
menuTrigger?: MenuTriggerAction;
|
|
59
|
+
/** Whether to close the menu on blur. */
|
|
60
|
+
shouldCloseOnBlur?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ComboBoxState<T = unknown> {
|
|
63
|
+
/** The collection of items (may be filtered). */
|
|
64
|
+
readonly collection: Accessor<Collection<T>>;
|
|
65
|
+
/** Whether the combobox dropdown is open. */
|
|
66
|
+
readonly isOpen: Accessor<boolean>;
|
|
67
|
+
/** Open the combobox dropdown. */
|
|
68
|
+
open(focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction): void;
|
|
69
|
+
/** Close the combobox dropdown. */
|
|
70
|
+
close(): void;
|
|
71
|
+
/** Toggle the combobox dropdown. */
|
|
72
|
+
toggle(focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction): void;
|
|
73
|
+
/** The currently selected key. */
|
|
74
|
+
readonly selectedKey: Accessor<Key | null>;
|
|
75
|
+
/** The default selected key. */
|
|
76
|
+
readonly defaultSelectedKey: Key | null;
|
|
77
|
+
/** The currently selected item. */
|
|
78
|
+
readonly selectedItem: Accessor<CollectionNode<T> | null>;
|
|
79
|
+
/** Set the selected key. */
|
|
80
|
+
setSelectedKey(key: Key | null): void;
|
|
81
|
+
/** The current input value. */
|
|
82
|
+
readonly inputValue: Accessor<string>;
|
|
83
|
+
/** The default input value. */
|
|
84
|
+
readonly defaultInputValue: string;
|
|
85
|
+
/** Set the input value. */
|
|
86
|
+
setInputValue(value: string): void;
|
|
87
|
+
/** The currently focused key in the list. */
|
|
88
|
+
readonly focusedKey: Accessor<Key | null>;
|
|
89
|
+
/** Set the focused key. */
|
|
90
|
+
setFocusedKey(key: Key | null): void;
|
|
91
|
+
/** Whether the combobox input has focus. */
|
|
92
|
+
readonly isFocused: Accessor<boolean>;
|
|
93
|
+
/** Set whether the combobox has focus. */
|
|
94
|
+
setFocused(isFocused: boolean): void;
|
|
95
|
+
/** The focus strategy to use when opening. */
|
|
96
|
+
readonly focusStrategy: Accessor<FocusStrategy | null>;
|
|
97
|
+
/** Commit the current selection (select focused item or custom value). */
|
|
98
|
+
commit(): void;
|
|
99
|
+
/** Revert input to the selected item's text and close menu. */
|
|
100
|
+
revert(): void;
|
|
101
|
+
/** Whether a specific key is disabled. */
|
|
102
|
+
isKeyDisabled(key: Key): boolean;
|
|
103
|
+
/** Select a key and close the menu (for ListState compatibility). */
|
|
104
|
+
select(key: Key): void;
|
|
105
|
+
/** The selection mode (always 'single' for combobox). */
|
|
106
|
+
readonly selectionMode: Accessor<'single'>;
|
|
107
|
+
/** Check if a key is selected. */
|
|
108
|
+
isSelected(key: Key): boolean;
|
|
109
|
+
/** Whether the combobox is disabled. */
|
|
110
|
+
readonly isDisabled: boolean;
|
|
111
|
+
/** Whether the combobox is read-only. */
|
|
112
|
+
readonly isReadOnly: boolean;
|
|
113
|
+
/** Whether the combobox is required. */
|
|
114
|
+
readonly isRequired: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Default filter function that does case-insensitive "contains" matching.
|
|
118
|
+
*/
|
|
119
|
+
export declare const defaultContainsFilter: FilterFn;
|
|
120
|
+
/**
|
|
121
|
+
* Creates state for a combobox component.
|
|
122
|
+
* Combines list state with input value management and filtering.
|
|
123
|
+
*/
|
|
124
|
+
export declare function createComboBoxState<T = unknown>(props: MaybeAccessor<ComboBoxStateProps<T>>): ComboBoxState<T>;
|
|
125
|
+
//# sourceMappingURL=createComboBoxState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createComboBoxState.d.ts","sourceRoot":"","sources":["createComboBoxState.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA0C,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAGtD,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,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