@pathscale/ui 1.1.0 → 1.1.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 (38) hide show
  1. package/dist/components/color-area/ColorArea.css +54 -0
  2. package/dist/components/color-area/ColorArea.d.ts +15 -0
  3. package/dist/components/color-area/ColorArea.js +211 -0
  4. package/dist/components/color-area/index.d.ts +3 -0
  5. package/dist/components/color-area/index.js +3 -0
  6. package/dist/components/color-field/ColorField.css +88 -0
  7. package/dist/components/color-field/ColorField.d.ts +15 -0
  8. package/dist/components/color-field/ColorField.js +165 -0
  9. package/dist/components/color-field/index.d.ts +3 -0
  10. package/dist/components/color-field/index.js +3 -0
  11. package/dist/components/color-picker/ColorPicker.css +28 -0
  12. package/dist/components/color-picker/ColorPicker.d.ts +33 -0
  13. package/dist/components/color-picker/ColorPicker.js +369 -0
  14. package/dist/components/color-picker/index.d.ts +2 -0
  15. package/dist/components/color-picker/index.js +8 -0
  16. package/dist/components/color-slider/ColorSlider.css +57 -0
  17. package/dist/components/color-slider/ColorSlider.d.ts +13 -0
  18. package/dist/components/color-slider/ColorSlider.js +178 -0
  19. package/dist/components/color-slider/index.d.ts +3 -0
  20. package/dist/components/color-slider/index.js +3 -0
  21. package/dist/components/color-swatch/ColorSwatch.css +84 -0
  22. package/dist/components/color-swatch/ColorSwatch.d.ts +17 -0
  23. package/dist/components/color-swatch/ColorSwatch.js +143 -0
  24. package/dist/components/color-swatch/index.d.ts +3 -0
  25. package/dist/components/color-swatch/index.js +3 -0
  26. package/dist/components/color-swatch-picker/ColorSwatchPicker.css +12 -0
  27. package/dist/components/color-swatch-picker/ColorSwatchPicker.d.ts +18 -0
  28. package/dist/components/color-swatch-picker/ColorSwatchPicker.js +109 -0
  29. package/dist/components/color-swatch-picker/index.d.ts +3 -0
  30. package/dist/components/color-swatch-picker/index.js +5 -0
  31. package/dist/components/colorpicker/ColorWheelFlower.css +147 -0
  32. package/dist/components/colorpicker/ColorWheelFlower.d.ts +1 -0
  33. package/dist/components/colorpicker/ColorWheelFlower.js +302 -243
  34. package/dist/components/tabs/Tabs.css +1 -0
  35. package/dist/components/theme-color-picker/ThemeColorPicker.js +50 -29
  36. package/dist/index.d.ts +14 -2
  37. package/dist/index.js +14 -2
  38. package/package.json +1 -1
@@ -1,21 +1,24 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web";
2
+ import "./ColorWheelFlower.css";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
3
4
  import * as __WEBPACK_EXTERNAL_MODULE_clsx__ from "clsx";
4
5
  import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__color_swatch_index_js_6938a92b__ from "../color-swatch/index.js";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__color_swatch_picker_index_js_d4d4ca4f__ from "../color-swatch-picker/index.js";
5
8
  import * as __WEBPACK_EXTERNAL_MODULE__colorpickerContext_js_45c33b20__ from "./colorpickerContext.js";
6
9
  import * as __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__ from "./ColorUtils.js";
7
10
  import * as __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__ from "../../motion/index.js";
8
- var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div><div class="absolute inset-0"><div class="absolute inset-0"><div class="absolute inset-0 rounded-full"></div></div><div class="absolute inset-0"><div class="absolute inset-0 rounded-full"></div></div></div><div class="relative z-10 w-[calc(100%-5px)] h-[calc(100%-5px)] rounded-full">'), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div class=absolute><div class="relative w-[32px] h-[32px]"><div class="relative w-full h-full"><span class="absolute rounded-full pointer-events-none"></span><button type=button><span>');
11
+ var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div data-slot=color-wheel-flower><div class=color-wheel-flower__rings><div class="color-wheel-flower__ring-shell color-wheel-flower__ring-shell--outer"><div class="color-wheel-flower__ring color-wheel-flower__ring--outer"></div></div><div class="color-wheel-flower__ring-shell color-wheel-flower__ring-shell--inner"><div class="color-wheel-flower__ring color-wheel-flower__ring--inner">'), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div class=color-wheel-flower__dot><div class=color-wheel-flower__dot-frame><div class=color-wheel-flower__dot-motion><span class=color-wheel-flower__halo></span><span>");
9
12
  const parseRgbToHsl = (rgbString)=>{
10
- const match = rgbString.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
13
+ const match = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
11
14
  if (!match) return {
12
15
  hue: 0,
13
16
  saturation: 0,
14
17
  lightness: 100
15
18
  };
16
- const r = parseInt(match[1]);
17
- const g = parseInt(match[2]);
18
- const b = parseInt(match[3]);
19
+ const r = Number.parseInt(match[1], 10);
20
+ const g = Number.parseInt(match[2], 10);
21
+ const b = Number.parseInt(match[3], 10);
19
22
  const hsl = (0, __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__.rgbToHsl)(r, g, b);
20
23
  return {
21
24
  hue: hsl.h,
@@ -23,12 +26,24 @@ const parseRgbToHsl = (rgbString)=>{
23
26
  lightness: hsl.l
24
27
  };
25
28
  };
26
- const createColorItem = (rgb, offsetX, offsetY)=>({
29
+ const createColorItem = (id, rgb, offsetX, offsetY, options)=>{
30
+ const hsl = parseRgbToHsl(rgb);
31
+ const rgbMatch = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
32
+ const r = Number.parseInt(rgbMatch?.[1] ?? "255", 10);
33
+ const g = Number.parseInt(rgbMatch?.[2] ?? "255", 10);
34
+ const b = Number.parseInt(rgbMatch?.[3] ?? "255", 10);
35
+ return {
36
+ id,
27
37
  rgb,
38
+ hex: (0, __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__.rgbToHex)(r, g, b).toUpperCase(),
28
39
  offsetX,
29
40
  offsetY,
30
- ...parseRgbToHsl(rgb)
31
- });
41
+ hue: hsl.hue,
42
+ saturation: hsl.saturation,
43
+ lightness: hsl.lightness,
44
+ isCenter: options?.isCenter
45
+ };
46
+ };
32
47
  const readMotionState = (el)=>{
33
48
  const styles = getComputedStyle(el);
34
49
  const opacityValue = Number.parseFloat(styles.opacity);
@@ -85,39 +100,52 @@ const toRgba = (rgb, alpha)=>{
85
100
  if (!match) return rgb;
86
101
  return `rgba(${match[1]}, ${match[2]}, ${match[3]}, ${alpha})`;
87
102
  };
103
+ const hueDistance = (a, b)=>{
104
+ const wrapped = Math.abs(a - b) % 360;
105
+ return wrapped > 180 ? 360 - wrapped : wrapped;
106
+ };
107
+ const isNearColor = (color, item)=>{
108
+ const hueDelta = hueDistance(color.hsl.h, item.hue);
109
+ const saturationDelta = Math.abs(color.hsl.s - item.saturation);
110
+ const lightnessDelta = Math.abs(color.hsl.l - item.lightness);
111
+ return hueDelta <= 2 && saturationDelta <= 2 && lightnessDelta <= 2;
112
+ };
88
113
  const COLORS = [
89
- createColorItem("rgb(80,80,80)", 47.631, -27.5),
90
- createColorItem("rgb(80,60,50)", 27.5, -47.631),
91
- createColorItem("rgb(80,50,50)", 0, -55),
92
- createColorItem("rgb(80,50,70)", -27.5, -47.631),
93
- createColorItem("rgb(70,50,80)", -47.631, -27.5),
94
- createColorItem("rgb(55,50,80)", -55, 0),
95
- createColorItem("rgb(50,55,80)", -47.631, 27.5),
96
- createColorItem("rgb(50,65,80)", -27.5, 47.631),
97
- createColorItem("rgb(50,80,80)", 0, 55),
98
- createColorItem("rgb(50,80,65)", 27.5, 47.631),
99
- createColorItem("rgb(55,80,50)", 47.631, 27.5),
100
- createColorItem("rgb(70,80,50)", 55, 0),
101
- createColorItem("rgb(245,245,61)", 34.641, -20),
102
- createColorItem("rgb(245,153,61)", 20, -34.641),
103
- createColorItem("rgb(245,61,61)", 0, -40),
104
- createColorItem("rgb(245,61,153)", -20, -34.641),
105
- createColorItem("rgb(245,61,245)", -34.641, -20),
106
- createColorItem("rgb(153,61,245)", -40, 0),
107
- createColorItem("rgb(61,61,245)", -34.641, 20),
108
- createColorItem("rgb(61,153,245)", -20, 34.641),
109
- createColorItem("rgb(61,245,245)", 0, 40),
110
- createColorItem("rgb(61,245,153)", 20, 34.641),
111
- createColorItem("rgb(61,245,61)", 34.641, 20),
112
- createColorItem("rgb(153,245,61)", 40, 0),
113
- createColorItem("rgb(240,217,194)", 10, -17.3205),
114
- createColorItem("rgb(240,194,217)", -10, -17.3205),
115
- createColorItem("rgb(217,194,240)", -20, 0),
116
- createColorItem("rgb(194,217,240)", -10, 17.3205),
117
- createColorItem("rgb(194,240,217)", 10, 17.3205),
118
- createColorItem("rgb(217,240,194)", 20, 0),
119
- createColorItem("rgb(255,255,255)", 0, 0)
114
+ createColorItem("outer-1", "rgb(80,80,80)", 47.631, -27.5),
115
+ createColorItem("outer-2", "rgb(80,60,50)", 27.5, -47.631),
116
+ createColorItem("outer-3", "rgb(80,50,50)", 0, -55),
117
+ createColorItem("outer-4", "rgb(80,50,70)", -27.5, -47.631),
118
+ createColorItem("outer-5", "rgb(70,50,80)", -47.631, -27.5),
119
+ createColorItem("outer-6", "rgb(55,50,80)", -55, 0),
120
+ createColorItem("outer-7", "rgb(50,55,80)", -47.631, 27.5),
121
+ createColorItem("outer-8", "rgb(50,65,80)", -27.5, 47.631),
122
+ createColorItem("outer-9", "rgb(50,80,80)", 0, 55),
123
+ createColorItem("outer-10", "rgb(50,80,65)", 27.5, 47.631),
124
+ createColorItem("outer-11", "rgb(55,80,50)", 47.631, 27.5),
125
+ createColorItem("outer-12", "rgb(70,80,50)", 55, 0),
126
+ createColorItem("middle-1", "rgb(245,245,61)", 34.641, -20),
127
+ createColorItem("middle-2", "rgb(245,153,61)", 20, -34.641),
128
+ createColorItem("middle-3", "rgb(245,61,61)", 0, -40),
129
+ createColorItem("middle-4", "rgb(245,61,153)", -20, -34.641),
130
+ createColorItem("middle-5", "rgb(245,61,245)", -34.641, -20),
131
+ createColorItem("middle-6", "rgb(153,61,245)", -40, 0),
132
+ createColorItem("middle-7", "rgb(61,61,245)", -34.641, 20),
133
+ createColorItem("middle-8", "rgb(61,153,245)", -20, 34.641),
134
+ createColorItem("middle-9", "rgb(61,245,245)", 0, 40),
135
+ createColorItem("middle-10", "rgb(61,245,153)", 20, 34.641),
136
+ createColorItem("middle-11", "rgb(61,245,61)", 34.641, 20),
137
+ createColorItem("middle-12", "rgb(153,245,61)", 40, 0),
138
+ createColorItem("inner-1", "rgb(240,217,194)", 10, -17.3205),
139
+ createColorItem("inner-2", "rgb(240,194,217)", -10, -17.3205),
140
+ createColorItem("inner-3", "rgb(217,194,240)", -20, 0),
141
+ createColorItem("inner-4", "rgb(194,217,240)", -10, 17.3205),
142
+ createColorItem("inner-5", "rgb(194,240,217)", 10, 17.3205),
143
+ createColorItem("inner-6", "rgb(217,240,194)", 20, 0),
144
+ createColorItem("center", "rgb(255,255,255)", 0, 0, {
145
+ isCenter: true
146
+ })
120
147
  ];
148
+ const CENTER_INDEX = COLORS.findIndex((item)=>item.isCenter);
121
149
  const MAX_RADIUS = Math.max(...COLORS.map((item)=>Math.sqrt(item.offsetX ** 2 + item.offsetY ** 2)));
122
150
  const MAX_WAVE_DISTANCE = 2 * MAX_RADIUS;
123
151
  const MAX_WAVE_DELAY = 0.12;
@@ -158,8 +186,27 @@ const ColorWheelFlower = (props)=>{
158
186
  let pulseTimeout;
159
187
  let outerRingRef;
160
188
  let outerRingControl = null;
161
- const handleDotClick = (index)=>{
162
- if (context.disabled()) return;
189
+ const closestIndex = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
190
+ const current = context.color();
191
+ if (current.hsl.s <= 6 && current.hsl.l >= 95 && CENTER_INDEX >= 0) return CENTER_INDEX;
192
+ let closest = 0;
193
+ let bestScore = Number.POSITIVE_INFINITY;
194
+ for(let index = 0; index < COLORS.length; index += 1){
195
+ const item = COLORS[index];
196
+ if (item.isCenter) continue;
197
+ const hueDelta = hueDistance(current.hsl.h, item.hue);
198
+ const saturationDelta = Math.abs(current.hsl.s - item.saturation);
199
+ const lightnessDelta = Math.abs(current.hsl.l - item.lightness);
200
+ const score = 1.4 * hueDelta + 0.8 * saturationDelta + 0.55 * lightnessDelta;
201
+ if (score < bestScore) {
202
+ bestScore = score;
203
+ closest = index;
204
+ }
205
+ }
206
+ return closest;
207
+ });
208
+ const visualSelectedIndex = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>selectedIndex() ?? closestIndex());
209
+ const triggerPulse = (index)=>{
163
210
  const pulseKey = Date.now();
164
211
  setPulseState({
165
212
  index,
@@ -169,17 +216,31 @@ const ColorWheelFlower = (props)=>{
169
216
  pulseTimeout = window.setTimeout(()=>{
170
217
  setPulseState((prev)=>prev?.index === index && prev?.key === pulseKey ? null : prev);
171
218
  }, reduceMotion ? 0 : 220);
172
- if (selectedIndex() === index) {
219
+ };
220
+ const handlePickerChange = (selectedHex)=>{
221
+ if (context.disabled()) return;
222
+ const index = COLORS.findIndex((item)=>item.hex === selectedHex.toUpperCase());
223
+ if (index < 0) return;
224
+ triggerPulse(index);
225
+ const selected = selectedIndex();
226
+ const item = COLORS[index];
227
+ if (selected === index && !item.isCenter) {
173
228
  setSelectedIndex(null);
174
- const whiteColor = (0, __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__.createColorFromHsl)(0, 0, 100, context.color().hsl.a);
175
- context.onChange(whiteColor);
176
- } else {
177
- setSelectedIndex(index);
178
- const color = COLORS[index];
179
- const newColor = (0, __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__.createColorFromHsl)(color.hue, color.saturation, color.lightness, context.color().hsl.a);
180
- context.onChange(newColor);
229
+ context.onChange((0, __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__.createColorFromHsl)(0, 0, 100, context.color().hsl.a));
230
+ return;
181
231
  }
232
+ setSelectedIndex(index);
233
+ if (item.isCenter) return void context.onChange((0, __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__.createColorFromHsl)(0, 0, 100, context.color().hsl.a));
234
+ context.onChange((0, __WEBPACK_EXTERNAL_MODULE__ColorUtils_js_8c38ee50__.createColorFromHsl)(item.hue, item.saturation, item.lightness, context.color().hsl.a));
182
235
  };
236
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
237
+ const selected = selectedIndex();
238
+ const current = context.color();
239
+ if (null === selected) return;
240
+ const selectedItem = COLORS[selected];
241
+ if (!selectedItem) return;
242
+ if (!isNearColor(current, selectedItem)) setSelectedIndex(null);
243
+ });
183
244
  const handlePointerMove = (event)=>{
184
245
  if (!containerRef) return;
185
246
  const rect = containerRef.getBoundingClientRect();
@@ -206,12 +267,11 @@ const ColorWheelFlower = (props)=>{
206
267
  setHoveredIndex(null);
207
268
  if (void 0 !== pointerTimeout) clearTimeout(pointerTimeout);
208
269
  };
209
- const containerClasses = ()=>(0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("relative w-[190px] h-[190px] flex items-center justify-center", (0, __WEBPACK_EXTERNAL_MODULE_clsx__.clsx)({
210
- "opacity-50 cursor-not-allowed": context.disabled()
211
- }), props.class, props.className);
212
270
  const outerRingBackground = ()=>{
213
- const idx = selectedIndex();
214
- return null === idx ? RAINBOW_GRADIENT : `conic-gradient(${COLORS[idx].rgb}, ${COLORS[idx].rgb})`;
271
+ const selected = selectedIndex();
272
+ if (null === selected) return RAINBOW_GRADIENT;
273
+ const color = COLORS[selected];
274
+ return `conic-gradient(${color.rgb}, ${color.rgb})`;
215
275
  };
216
276
  const outerRingTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
217
277
  if (context.disabled()) return {
@@ -233,9 +293,9 @@ const ColorWheelFlower = (props)=>{
233
293
  });
234
294
  const outerRingGlow = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
235
295
  if (context.disabled()) return "none";
236
- const idx = hoveredIndex() ?? selectedIndex();
237
- if (null === idx) return "0 0 10px rgba(255,255,255,0.08)";
238
- const color = COLORS[idx].rgb;
296
+ const index = hoveredIndex() ?? selectedIndex();
297
+ if (null === index) return "0 0 10px rgba(255,255,255,0.08)";
298
+ const color = COLORS[index].rgb;
239
299
  return `0 0 10px rgba(255,255,255,0.16), 0 0 20px ${toRgba(color, 0.35)}`;
240
300
  });
241
301
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
@@ -249,214 +309,213 @@ const ColorWheelFlower = (props)=>{
249
309
  if (void 0 !== pulseTimeout) clearTimeout(pulseTimeout);
250
310
  if (void 0 !== pointerTimeout) clearTimeout(pointerTimeout);
251
311
  });
312
+ const pickerValue = ()=>COLORS[visualSelectedIndex()]?.hex;
252
313
  return (()=>{
253
- var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$2.nextSibling;
314
+ var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
254
315
  _el$.addEventListener("mouseleave", handlePointerLeave);
255
316
  _el$.$$mousemove = handlePointerMove;
256
317
  var _ref$ = containerRef;
257
318
  "function" == typeof _ref$ ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)(_ref$, _el$) : containerRef = _el$;
258
- _el$3.style.setProperty("transform", "scale(1.1)");
259
319
  var _ref$2 = outerRingRef;
260
320
  "function" == typeof _ref$2 ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)(_ref$2, _el$4) : outerRingRef = _el$4;
261
321
  _el$4.style.setProperty("transition", reduceMotion ? "none" : "background 450ms ease-in-out, box-shadow 300ms ease-out");
262
- _el$5.style.setProperty("transform", "scale(0.9)");
263
- _el$6.style.setProperty("background", "#0b1012");
264
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$7, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
265
- each: COLORS,
266
- children: (item, index)=>{
267
- let motionRef;
268
- let dotControl = null;
269
- const isHovered = ()=>hoveredIndex() === index();
270
- const isPressed = ()=>pressedIndex() === index();
271
- const isPulsing = ()=>pulseState()?.index === index();
272
- const dotBaseTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
273
- if (context.disabled()) return {
274
- opacity: 0.5,
275
- scale: 1,
276
- x: 0,
277
- y: 0
278
- };
279
- const pointerState = pointer();
280
- const anchorIndex = hoveredIndex();
281
- let scale = 1;
282
- let offsetX = 0;
283
- let offsetY = 0;
284
- if (null !== anchorIndex && pointerState.active) {
285
- const anchor = COLORS[anchorIndex];
286
- const distance = Math.sqrt((item.offsetX - anchor.offsetX) ** 2 + (item.offsetY - anchor.offsetY) ** 2);
287
- const waveRadius = 0.9 * MAX_RADIUS;
288
- const influence = Math.max(0, 1 - distance / waveRadius);
289
- if (influence > 0) {
290
- const maxDelta = 16;
291
- const deltaX = Math.max(-maxDelta, Math.min(maxDelta, pointerState.x - anchor.offsetX));
292
- const deltaY = Math.max(-maxDelta, Math.min(maxDelta, pointerState.y - anchor.offsetY));
293
- const waveStrength = isHovered() ? 0.25 : 0.18;
294
- offsetX += deltaX * influence * waveStrength;
295
- offsetY += deltaY * influence * waveStrength;
296
- const liftStrength = isHovered() ? 0.8 : 0.35;
297
- const lift = getLiftOffset(item, hoverLift * liftStrength);
298
- offsetX += lift.x * influence;
299
- offsetY += lift.y * influence;
300
- const scaleBoost = isHovered() ? 0.06 : 0.03;
301
- scale += influence * scaleBoost;
302
- }
322
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__color_swatch_picker_index_js_d4d4ca4f__["default"], {
323
+ class: "color-wheel-flower__picker",
324
+ get value () {
325
+ return pickerValue();
326
+ },
327
+ onChange: handlePickerChange,
328
+ get isDisabled () {
329
+ return context.disabled();
330
+ },
331
+ "aria-label": "Flower color palette",
332
+ get children () {
333
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
334
+ each: COLORS,
335
+ children: (item, index)=>{
336
+ let motionRef;
337
+ let dotControl = null;
338
+ const isHovered = ()=>hoveredIndex() === index();
339
+ const isPressed = ()=>pressedIndex() === index();
340
+ const isPulsing = ()=>pulseState()?.index === index();
341
+ const dotBaseTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
342
+ if (context.disabled()) return {
343
+ opacity: 0.5,
344
+ scale: 1,
345
+ x: 0,
346
+ y: 0
347
+ };
348
+ const pointerState = pointer();
349
+ const anchorIndex = hoveredIndex();
350
+ let scale = 1;
351
+ let offsetX = 0;
352
+ let offsetY = 0;
353
+ if (null !== anchorIndex && pointerState.active) {
354
+ const anchor = COLORS[anchorIndex];
355
+ const distance = Math.sqrt((item.offsetX - anchor.offsetX) ** 2 + (item.offsetY - anchor.offsetY) ** 2);
356
+ const waveRadius = 0.9 * MAX_RADIUS;
357
+ const influence = Math.max(0, 1 - distance / waveRadius);
358
+ if (influence > 0) {
359
+ const maxDelta = 16;
360
+ const deltaX = Math.max(-maxDelta, Math.min(maxDelta, pointerState.x - anchor.offsetX));
361
+ const deltaY = Math.max(-maxDelta, Math.min(maxDelta, pointerState.y - anchor.offsetY));
362
+ const waveStrength = isHovered() ? 0.25 : 0.18;
363
+ offsetX += deltaX * influence * waveStrength;
364
+ offsetY += deltaY * influence * waveStrength;
365
+ const liftStrength = isHovered() ? 0.8 : 0.35;
366
+ const lift = getLiftOffset(item, hoverLift * liftStrength);
367
+ offsetX += lift.x * influence;
368
+ offsetY += lift.y * influence;
369
+ const scaleBoost = isHovered() ? 0.06 : 0.03;
370
+ scale += influence * scaleBoost;
371
+ }
372
+ }
373
+ return {
374
+ opacity: 1,
375
+ scale,
376
+ x: offsetX,
377
+ y: offsetY
378
+ };
379
+ });
380
+ const dotTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
381
+ const base = dotBaseTarget();
382
+ let scale = base.scale ?? 1;
383
+ if (isPulsing()) scale *= pulseScale;
384
+ if (isPressed()) scale *= pressScale;
385
+ return {
386
+ ...base,
387
+ scale
388
+ };
389
+ });
390
+ const glowOpacity = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
391
+ if (context.disabled()) return 0;
392
+ if (isHovered()) return 0.6;
393
+ if (isPulsing()) return 0.35;
394
+ return 0;
395
+ });
396
+ const dotTransition = ()=>{
397
+ if (reduceMotion) return {
398
+ duration: 0
399
+ };
400
+ const anchorIndex = hoveredIndex();
401
+ const pointerState = pointer();
402
+ let delay = 0;
403
+ if (null !== anchorIndex && pointerState.active) {
404
+ const anchor = COLORS[anchorIndex];
405
+ const distance = Math.sqrt((item.offsetX - anchor.offsetX) ** 2 + (item.offsetY - anchor.offsetY) ** 2);
406
+ delay = Math.min(MAX_WAVE_DELAY, distance / MAX_WAVE_DISTANCE * MAX_WAVE_DELAY);
407
+ }
408
+ if (isPulsing()) return {
409
+ duration: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionDurations.fast,
410
+ easing: easeOutBack(1.25)
411
+ };
412
+ if (isHovered()) return {
413
+ duration: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionDurations.fast,
414
+ easing: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionEasings.out,
415
+ delay
416
+ };
417
+ return {
418
+ duration: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionDurations.base,
419
+ easing: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionEasings.out,
420
+ delay
421
+ };
422
+ };
423
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
424
+ if (!motionRef) return;
425
+ const target = dotTarget();
426
+ const transition = dotTransition();
427
+ dotControl?.stop();
428
+ dotControl = (0, __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.runMotion)(motionRef, readMotionState(motionRef), target, transition);
429
+ });
430
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
431
+ dotControl?.stop();
432
+ });
433
+ return (()=>{
434
+ var _el$5 = _tmpl$2(), _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling;
435
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)((el)=>{
436
+ motionRef = el;
437
+ }, _el$7);
438
+ _el$8.style.setProperty("transition", reduceMotion ? "none" : "opacity 200ms ease-out, box-shadow 200ms ease-out");
439
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$7, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__color_swatch_index_js_6938a92b__["default"], {
440
+ get color () {
441
+ return item.hex;
442
+ },
443
+ size: "lg",
444
+ get ["class"] () {
445
+ return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("color-wheel-flower__swatch", item.isCenter && "color-wheel-flower__swatch--center");
446
+ },
447
+ get colorName () {
448
+ return item.isCenter ? "Reset to neutral" : `Theme color ${item.hex}`;
449
+ },
450
+ get isDisabled () {
451
+ return context.disabled();
452
+ },
453
+ onMouseEnter: ()=>{
454
+ if (!context.disabled()) setHoveredIndex(index());
455
+ },
456
+ onMouseLeave: ()=>{
457
+ if (!context.disabled()) setHoveredIndex(null);
458
+ },
459
+ onFocus: ()=>{
460
+ if (!context.disabled()) setHoveredIndex(index());
461
+ },
462
+ onBlur: ()=>{
463
+ if (!context.disabled()) setHoveredIndex(null);
464
+ },
465
+ onPointerDown: ()=>{
466
+ if (!context.disabled()) setPressedIndex(index());
467
+ },
468
+ onPointerUp: ()=>{
469
+ if (!context.disabled()) setPressedIndex(null);
470
+ },
471
+ onPointerLeave: ()=>{
472
+ if (!context.disabled()) setPressedIndex(null);
473
+ },
474
+ onPointerCancel: ()=>{
475
+ if (!context.disabled()) setPressedIndex(null);
476
+ }
477
+ }), _el$9);
478
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
479
+ var _v$5 = `calc(50% + ${item.offsetX}px)`, _v$6 = `calc(50% + ${item.offsetY}px)`, _v$7 = glowOpacity(), _v$8 = `0 0 8px ${toRgba(item.rgb, 0.3)}, 0 0 3px rgba(255,255,255,0.35)`, _v$9 = (0, __WEBPACK_EXTERNAL_MODULE_clsx__.clsx)("color-wheel-flower__highlight", isHovered() && "color-wheel-flower__highlight--hovered", isPulsing() && "color-wheel-flower__highlight--pulsing");
480
+ _v$5 !== _p$.e && (null != (_p$.e = _v$5) ? _el$5.style.setProperty("left", _v$5) : _el$5.style.removeProperty("left"));
481
+ _v$6 !== _p$.t && (null != (_p$.t = _v$6) ? _el$5.style.setProperty("top", _v$6) : _el$5.style.removeProperty("top"));
482
+ _v$7 !== _p$.a && (null != (_p$.a = _v$7) ? _el$8.style.setProperty("opacity", _v$7) : _el$8.style.removeProperty("opacity"));
483
+ _v$8 !== _p$.o && (null != (_p$.o = _v$8) ? _el$8.style.setProperty("box-shadow", _v$8) : _el$8.style.removeProperty("box-shadow"));
484
+ _v$9 !== _p$.i && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$9, _p$.i = _v$9);
485
+ return _p$;
486
+ }, {
487
+ e: void 0,
488
+ t: void 0,
489
+ a: void 0,
490
+ o: void 0,
491
+ i: void 0
492
+ });
493
+ return _el$5;
494
+ })();
303
495
  }
304
- return {
305
- opacity: 1,
306
- scale,
307
- x: offsetX,
308
- y: offsetY
309
- };
310
- });
311
- const dotTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
312
- const base = dotBaseTarget();
313
- let scale = base.scale ?? 1;
314
- if (isPulsing()) scale *= pulseScale;
315
- if (isPressed()) scale *= pressScale;
316
- return {
317
- ...base,
318
- scale
319
- };
320
- });
321
- const glowOpacity = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
322
- if (context.disabled()) return 0;
323
- if (isHovered()) return 0.6;
324
- if (isPulsing()) return 0.35;
325
- return 0;
326
- });
327
- const dotTransition = ()=>{
328
- if (reduceMotion) return {
329
- duration: 0
330
- };
331
- const anchorIndex = hoveredIndex();
332
- const pointerState = pointer();
333
- let delay = 0;
334
- if (null !== anchorIndex && pointerState.active) {
335
- const anchor = COLORS[anchorIndex];
336
- const distance = Math.sqrt((item.offsetX - anchor.offsetX) ** 2 + (item.offsetY - anchor.offsetY) ** 2);
337
- delay = Math.min(MAX_WAVE_DELAY, distance / MAX_WAVE_DISTANCE * MAX_WAVE_DELAY);
338
- }
339
- if (isPulsing()) return {
340
- duration: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionDurations.fast,
341
- easing: easeOutBack(1.25)
342
- };
343
- if (isHovered()) return {
344
- duration: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionDurations.fast,
345
- easing: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionEasings.out,
346
- delay
347
- };
348
- return {
349
- duration: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionDurations.base,
350
- easing: __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.motionEasings.out,
351
- delay
352
- };
353
- };
354
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
355
- if (!motionRef) return;
356
- const target = dotTarget();
357
- const transition = dotTransition();
358
- dotControl?.stop();
359
- dotControl = (0, __WEBPACK_EXTERNAL_MODULE__motion_index_js_58495715__.runMotion)(motionRef, readMotionState(motionRef), target, transition);
360
- });
361
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
362
- dotControl?.stop();
363
496
  });
364
- return (()=>{
365
- var _el$8 = _tmpl$2(), _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$1 = _el$0.firstChild, _el$10 = _el$1.nextSibling, _el$11 = _el$10.firstChild;
366
- _el$8.style.setProperty("transform", "translate(-50%, -50%)");
367
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)((el)=>{
368
- motionRef = el;
369
- }, _el$0);
370
- _el$1.style.setProperty("top", "-5px");
371
- _el$1.style.setProperty("left", "-5px");
372
- _el$1.style.setProperty("right", "-5px");
373
- _el$1.style.setProperty("bottom", "-5px");
374
- _el$1.style.setProperty("background", "radial-gradient(circle, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 70%)");
375
- _el$1.style.setProperty("transition", reduceMotion ? "none" : "opacity 200ms ease-out, box-shadow 200ms ease-out");
376
- _el$10.addEventListener("pointercancel", ()=>{
377
- if (!context.disabled()) setPressedIndex(null);
378
- });
379
- _el$10.addEventListener("pointerleave", ()=>{
380
- if (!context.disabled()) setPressedIndex(null);
381
- });
382
- _el$10.$$pointerup = ()=>{
383
- if (!context.disabled()) setPressedIndex(null);
384
- };
385
- _el$10.$$pointerdown = ()=>{
386
- if (!context.disabled()) setPressedIndex(index());
387
- };
388
- _el$10.addEventListener("blur", ()=>{
389
- if (!context.disabled()) setHoveredIndex(null);
390
- });
391
- _el$10.addEventListener("focus", ()=>{
392
- if (!context.disabled()) setHoveredIndex(index());
393
- });
394
- _el$10.addEventListener("mouseleave", ()=>{
395
- if (!context.disabled()) setHoveredIndex(null);
396
- });
397
- _el$10.addEventListener("mouseenter", ()=>{
398
- if (!context.disabled()) setHoveredIndex(index());
399
- });
400
- _el$10.$$click = ()=>handleDotClick(index());
401
- _el$10.style.setProperty("transition", reduceMotion ? "none" : "box-shadow 200ms ease-out");
402
- _el$11.style.setProperty("mix-blend-mode", "overlay");
403
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
404
- var _v$4 = `calc(50% + ${item.offsetX}px)`, _v$5 = `calc(50% + ${item.offsetY}px)`, _v$6 = glowOpacity(), _v$7 = `0 0 8px ${toRgba(item.rgb, 0.3)}, 0 0 3px rgba(255,255,255,0.35)`, _v$8 = context.disabled() ? -1 : 0, _v$9 = (0, __WEBPACK_EXTERNAL_MODULE_clsx__.clsx)("w-full h-full rounded-full", "transition-shadow duration-200 ease-out", "focus:outline-none focus:ring-2 focus:ring-white/50", "relative z-10", {
405
- "cursor-not-allowed": context.disabled(),
406
- "cursor-pointer": !context.disabled()
407
- }), _v$0 = item.rgb, _v$1 = isHovered() || isPulsing() ? "0 3px 10px rgba(0,0,0,0.25)" : "0 2px 8px rgba(0,0,0,0.25)", _v$10 = `Select color ${item.rgb}`, _v$11 = selectedIndex() === index(), _v$12 = (0, __WEBPACK_EXTERNAL_MODULE_clsx__.clsx)("absolute inset-0 rounded-full border-2 border-white", "transition-opacity duration-300 ease-out"), _v$13 = isHovered() ? "0.75" : isPulsing() ? "0.45" : "0", _v$14 = isHovered() ? "0 0 6px rgba(255,255,255,0.45)" : isPulsing() ? "0 0 4px rgba(255,255,255,0.35)" : "none";
408
- _v$4 !== _p$.e && (null != (_p$.e = _v$4) ? _el$8.style.setProperty("left", _v$4) : _el$8.style.removeProperty("left"));
409
- _v$5 !== _p$.t && (null != (_p$.t = _v$5) ? _el$8.style.setProperty("top", _v$5) : _el$8.style.removeProperty("top"));
410
- _v$6 !== _p$.a && (null != (_p$.a = _v$6) ? _el$1.style.setProperty("opacity", _v$6) : _el$1.style.removeProperty("opacity"));
411
- _v$7 !== _p$.o && (null != (_p$.o = _v$7) ? _el$1.style.setProperty("box-shadow", _v$7) : _el$1.style.removeProperty("box-shadow"));
412
- _v$8 !== _p$.i && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "tabindex", _p$.i = _v$8);
413
- _v$9 !== _p$.n && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$10, _p$.n = _v$9);
414
- _v$0 !== _p$.s && (null != (_p$.s = _v$0) ? _el$10.style.setProperty("background", _v$0) : _el$10.style.removeProperty("background"));
415
- _v$1 !== _p$.h && (null != (_p$.h = _v$1) ? _el$10.style.setProperty("box-shadow", _v$1) : _el$10.style.removeProperty("box-shadow"));
416
- _v$10 !== _p$.r && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "aria-label", _p$.r = _v$10);
417
- _v$11 !== _p$.d && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "aria-pressed", _p$.d = _v$11);
418
- _v$12 !== _p$.l && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$11, _p$.l = _v$12);
419
- _v$13 !== _p$.u && (null != (_p$.u = _v$13) ? _el$11.style.setProperty("opacity", _v$13) : _el$11.style.removeProperty("opacity"));
420
- _v$14 !== _p$.c && (null != (_p$.c = _v$14) ? _el$11.style.setProperty("box-shadow", _v$14) : _el$11.style.removeProperty("box-shadow"));
421
- return _p$;
422
- }, {
423
- e: void 0,
424
- t: void 0,
425
- a: void 0,
426
- o: void 0,
427
- i: void 0,
428
- n: void 0,
429
- s: void 0,
430
- h: void 0,
431
- r: void 0,
432
- d: void 0,
433
- l: void 0,
434
- u: void 0,
435
- c: void 0
436
- });
437
- return _el$8;
438
- })();
439
497
  }
440
- }));
498
+ }), null);
441
499
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
442
- var _v$ = containerClasses(), _v$2 = outerRingBackground(), _v$3 = outerRingGlow();
500
+ var _v$ = (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("color-wheel-flower", (0, __WEBPACK_EXTERNAL_MODULE_clsx__.clsx)({
501
+ "color-wheel-flower--disabled": context.disabled()
502
+ }), props.class, props.className), _v$2 = context.disabled() ? "true" : "false", _v$3 = outerRingBackground(), _v$4 = outerRingGlow();
443
503
  _v$ !== _p$.e && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$, _p$.e = _v$);
444
- _v$2 !== _p$.t && (null != (_p$.t = _v$2) ? _el$4.style.setProperty("background", _v$2) : _el$4.style.removeProperty("background"));
445
- _v$3 !== _p$.a && (null != (_p$.a = _v$3) ? _el$4.style.setProperty("box-shadow", _v$3) : _el$4.style.removeProperty("box-shadow"));
504
+ _v$2 !== _p$.t && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$, "data-disabled", _p$.t = _v$2);
505
+ _v$3 !== _p$.a && (null != (_p$.a = _v$3) ? _el$4.style.setProperty("background", _v$3) : _el$4.style.removeProperty("background"));
506
+ _v$4 !== _p$.o && (null != (_p$.o = _v$4) ? _el$4.style.setProperty("box-shadow", _v$4) : _el$4.style.removeProperty("box-shadow"));
446
507
  return _p$;
447
508
  }, {
448
509
  e: void 0,
449
510
  t: void 0,
450
- a: void 0
511
+ a: void 0,
512
+ o: void 0
451
513
  });
452
514
  return _el$;
453
515
  })();
454
516
  };
455
517
  const colorpicker_ColorWheelFlower = ColorWheelFlower;
456
518
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
457
- "mousemove",
458
- "click",
459
- "pointerdown",
460
- "pointerup"
519
+ "mousemove"
461
520
  ]);
462
521
  export { colorpicker_ColorWheelFlower as default };