pickit-color 1.0.2 → 1.0.4

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.
@@ -73,6 +73,8 @@
73
73
  border-radius: 6px;
74
74
  cursor: crosshair;
75
75
  overflow: hidden;
76
+ -ms-touch-action: none;
77
+ touch-action: none;
76
78
  }
77
79
  .colorpicker-saturation:focus {
78
80
  outline: 2px solid #3b82f6;
@@ -105,6 +107,13 @@
105
107
  transition: transform 0.1s ease;
106
108
  transition: transform 0.1s ease, -webkit-transform 0.1s ease;
107
109
  }
110
+ @media (pointer: coarse) {
111
+ .colorpicker-saturation-pointer {
112
+ width: 28px;
113
+ height: 28px;
114
+ border-width: 4px;
115
+ }
116
+ }
108
117
  @media (prefers-reduced-motion: reduce) {
109
118
  .colorpicker-saturation-pointer {
110
119
  -webkit-transition: none;
@@ -156,11 +165,13 @@
156
165
  -webkit-appearance: none;
157
166
  -moz-appearance: none;
158
167
  appearance: none;
159
- width: 100%;
160
- height: 8px;
161
- border-radius: 4px;
162
- outline: none;
163
- cursor: pointer;
168
+ -ms-touch-action: none;
169
+ touch-action: none;
170
+ }
171
+ @media (pointer: coarse) {
172
+ .colorpicker-slider {
173
+ height: 12px;
174
+ }
164
175
  }
165
176
  .colorpicker-slider:focus {
166
177
  -webkit-box-shadow: 0 0 0 2px #3b82f6;
@@ -182,6 +193,13 @@
182
193
  transition: transform 0.1s ease;
183
194
  transition: transform 0.1s ease, -webkit-transform 0.1s ease;
184
195
  }
196
+ @media (pointer: coarse) {
197
+ .colorpicker-slider::-webkit-slider-thumb {
198
+ width: 28px;
199
+ height: 28px;
200
+ border-width: 3px;
201
+ }
202
+ }
185
203
  .colorpicker-slider::-webkit-slider-thumb:hover {
186
204
  -webkit-transform: scale(1.1);
187
205
  transform: scale(1.1);
@@ -202,6 +220,18 @@
202
220
  transition: -webkit-transform 0.1s ease;
203
221
  transition: transform 0.1s ease;
204
222
  transition: transform 0.1s ease, -webkit-transform 0.1s ease;
223
+ background: #fff;
224
+ border: 2px solid #3b82f6;
225
+ cursor: pointer;
226
+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);
227
+ transition: transform 0.1s ease;
228
+ }
229
+ @media (pointer: coarse) {
230
+ .colorpicker-slider::-moz-range-thumb {
231
+ width: 28px;
232
+ height: 28px;
233
+ border-width: 3px;
234
+ }
205
235
  }
206
236
  .colorpicker-slider::-moz-range-thumb:hover {
207
237
  transform: scale(1.1);
@@ -373,6 +403,12 @@
373
403
  -ms-flex-negative: 0;
374
404
  flex-shrink: 0;
375
405
  }
406
+ @media (pointer: coarse) {
407
+ .colorpicker-eyedropper-btn {
408
+ width: 44px;
409
+ height: 44px;
410
+ }
411
+ }
376
412
  .colorpicker-eyedropper-btn:hover {
377
413
  background: #f3f4f6;
378
414
  border-color: #3b82f6;
@@ -456,6 +492,11 @@
456
492
  position: relative;
457
493
  overflow: hidden;
458
494
  }
495
+ @media (pointer: coarse) {
496
+ .colorpicker-preset {
497
+ min-height: 44px;
498
+ }
499
+ }
459
500
  .colorpicker-preset::before {
460
501
  content: '';
461
502
  position: absolute;
@@ -475,6 +516,12 @@
475
516
  -webkit-box-shadow: 0 2px 8px rgba(0,0,0,0.15);
476
517
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
477
518
  }
519
+ @media (pointer: coarse) {
520
+ .colorpicker-preset:hover {
521
+ -webkit-transform: scale(1.05);
522
+ transform: scale(1.05);
523
+ }
524
+ }
478
525
  .colorpicker-preset:focus {
479
526
  outline: none;
480
527
  border-color: #3b82f6;
@@ -497,6 +544,13 @@
497
544
  gap: 12px;
498
545
  padding: 8px 12px;
499
546
  background: #f9fafb;
547
+ min-height: 48px;
548
+ }
549
+ @media (pointer: coarse) {
550
+ .colorpicker-preset-list-item {
551
+ min-height: 56px;
552
+ padding: 12px;
553
+ }
500
554
  }
501
555
  .colorpicker-preset-list-item:hover {
502
556
  -webkit-transform: none;
@@ -1,4 +1,4 @@
1
- /* Pickit Color v1.0.2, @license Donationware */
1
+ /* Pickit Color v1.0.4, @license Donationware */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -152,9 +152,11 @@
152
152
  this.setupEventListeners();
153
153
  // Update display
154
154
  this.updateColorDisplay();
155
- // Open if inline
156
- if (this.options.inline) {
157
- this.open();
155
+ // Open if inline (without scrolling)
156
+ if (this.options.inline && this.container) {
157
+ this.isOpen = true;
158
+ this.container.style.display = "block";
159
+ this.options.onOpen();
158
160
  }
159
161
  };
160
162
  ColorPicker.prototype.buildColorPicker = function () {
@@ -328,6 +330,9 @@
328
330
  _this.updateColorDisplay();
329
331
  _this.announceColorChange();
330
332
  });
333
+ this.hueSlider.addEventListener("touchstart", function (e) {
334
+ _this.handleSliderTouch(e, _this.hueSlider, 'h', 0, 360);
335
+ });
331
336
  }
332
337
  // Saturation slider (sliderMode only)
333
338
  if (this.saturationSlider) {
@@ -336,6 +341,9 @@
336
341
  _this.updateColorDisplay();
337
342
  _this.announceColorChange();
338
343
  });
344
+ this.saturationSlider.addEventListener("touchstart", function (e) {
345
+ _this.handleSliderTouch(e, _this.saturationSlider, 's', 0, 100);
346
+ });
339
347
  }
340
348
  // Lightness slider (sliderMode only)
341
349
  if (this.lightnessSlider) {
@@ -344,6 +352,9 @@
344
352
  _this.updateColorDisplay();
345
353
  _this.announceColorChange();
346
354
  });
355
+ this.lightnessSlider.addEventListener("touchstart", function (e) {
356
+ _this.handleSliderTouch(e, _this.lightnessSlider, 'l', 0, 100);
357
+ });
347
358
  }
348
359
  // Alpha slider
349
360
  if (this.alphaSlider) {
@@ -353,12 +364,18 @@
353
364
  _this.updateColorDisplay();
354
365
  _this.announceColorChange();
355
366
  });
367
+ this.alphaSlider.addEventListener("touchstart", function (e) {
368
+ _this.handleSliderTouch(e, _this.alphaSlider, 'a', 0, 100, true);
369
+ });
356
370
  }
357
371
  // Saturation box
358
372
  if (this.colorBox) {
359
373
  this.colorBox.addEventListener("mousedown", function (e) {
360
374
  return _this.onSaturationMouseDown(e);
361
375
  });
376
+ this.colorBox.addEventListener("touchstart", function (e) {
377
+ return _this.onSaturationTouchStart(e);
378
+ });
362
379
  this.colorBox.addEventListener("keydown", function (e) {
363
380
  return _this.onSaturationKeyDown(e);
364
381
  });
@@ -503,6 +520,66 @@
503
520
  document.addEventListener("mousemove", onMouseMove);
504
521
  document.addEventListener("mouseup", onMouseUp);
505
522
  };
523
+ ColorPicker.prototype.onSaturationTouchStart = function (e) {
524
+ var _this = this;
525
+ e.preventDefault();
526
+ var touch = e.touches[0];
527
+ this.updateSaturationFromTouch(touch);
528
+ var onTouchMove = function (e) {
529
+ e.preventDefault();
530
+ var touch = e.touches[0];
531
+ _this.updateSaturationFromTouch(touch);
532
+ };
533
+ var onTouchEnd = function () {
534
+ document.removeEventListener("touchmove", onTouchMove);
535
+ document.removeEventListener("touchend", onTouchEnd);
536
+ };
537
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
538
+ document.addEventListener("touchend", onTouchEnd);
539
+ };
540
+ ColorPicker.prototype.updateSaturationFromTouch = function (touch) {
541
+ if (!this.colorBox)
542
+ return;
543
+ var rect = this.colorBox.getBoundingClientRect();
544
+ var x = Math.max(0, Math.min(touch.clientX - rect.left, rect.width));
545
+ var y = Math.max(0, Math.min(touch.clientY - rect.top, rect.height));
546
+ this.currentColor.s = (x / rect.width) * 100;
547
+ this.currentColor.l = 100 - (y / rect.height) * 100;
548
+ this.updateColorDisplay();
549
+ this.announceColorChange();
550
+ };
551
+ ColorPicker.prototype.handleSliderTouch = function (e, slider, property, min, max, isAlpha) {
552
+ var _this = this;
553
+ if (isAlpha === void 0) { isAlpha = false; }
554
+ var updateFromTouch = function (touch) {
555
+ var rect = slider.getBoundingClientRect();
556
+ var x = Math.max(0, Math.min(touch.clientX - rect.left, rect.width));
557
+ var ratio = x / rect.width;
558
+ var value = min + ratio * (max - min);
559
+ if (isAlpha) {
560
+ _this.currentColor[property] = value / 100;
561
+ }
562
+ else {
563
+ _this.currentColor[property] = Math.round(value);
564
+ }
565
+ slider.value = String(Math.round(value));
566
+ _this.updateColorDisplay();
567
+ _this.announceColorChange();
568
+ };
569
+ var touch = e.touches[0];
570
+ updateFromTouch(touch);
571
+ var onTouchMove = function (e) {
572
+ e.preventDefault();
573
+ var touch = e.touches[0];
574
+ updateFromTouch(touch);
575
+ };
576
+ var onTouchEnd = function () {
577
+ document.removeEventListener("touchmove", onTouchMove);
578
+ document.removeEventListener("touchend", onTouchEnd);
579
+ };
580
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
581
+ document.addEventListener("touchend", onTouchEnd);
582
+ };
506
583
  ColorPicker.prototype.updateSaturationFromMouse = function (e) {
507
584
  if (!this.colorBox)
508
585
  return;
@@ -791,26 +868,28 @@
791
868
  this.positionPicker();
792
869
  }
793
870
  this.options.onOpen();
794
- // Focus first interactive element based on mode
795
- setTimeout(function () {
796
- var _a;
797
- var focusTarget = null;
798
- if (_this.options.presetsOnly) {
799
- // In presets-only mode, focus first preset
800
- focusTarget = (_a = _this.container) === null || _a === void 0 ? void 0 : _a.querySelector('.colorpicker-preset');
801
- }
802
- else if (_this.options.sliderMode) {
803
- // In slider mode, focus first slider (hue)
804
- focusTarget = _this.hueSlider;
805
- }
806
- else {
807
- // In standard mode, focus saturation box
808
- focusTarget = _this.colorBox;
809
- }
810
- if (focusTarget) {
811
- focusTarget.focus();
812
- }
813
- }, 0);
871
+ // Auto-focus only for popup mode, not inline
872
+ if (!this.options.inline) {
873
+ setTimeout(function () {
874
+ var _a;
875
+ var focusTarget = null;
876
+ if (_this.options.presetsOnly) {
877
+ // In presets-only mode, focus first preset
878
+ focusTarget = (_a = _this.container) === null || _a === void 0 ? void 0 : _a.querySelector('.colorpicker-preset');
879
+ }
880
+ else if (_this.options.sliderMode) {
881
+ // In slider mode, focus first slider (hue)
882
+ focusTarget = _this.hueSlider;
883
+ }
884
+ else {
885
+ // In standard mode, focus saturation box
886
+ focusTarget = _this.colorBox;
887
+ }
888
+ if (focusTarget) {
889
+ focusTarget.focus();
890
+ }
891
+ }, 0);
892
+ }
814
893
  };
815
894
  ColorPicker.prototype.close = function () {
816
895
  if (!this.isOpen || !this.container)
@@ -1 +1 @@
1
- .colorpicker-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.colorpicker-container{font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#fff;border:1px solid #e5e7eb;border-radius:8px;-webkit-box-shadow:0 4px 12px rgba(0,0,0,0.15);box-shadow:0 4px 12px rgba(0,0,0,0.15);padding:16px;width:280px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.colorpicker-container:focus-within{outline:2px solid #3b82f6;outline-offset:2px}.colorpicker-container.colorpicker-inline{width:100%;max-width:100%;-webkit-box-shadow:none;box-shadow:none}.colorpicker-container.colorpicker-inline .colorpicker-saturation{height:200px}.colorpicker-container.colorpicker-presets-only{width:auto;min-width:200px;max-width:400px}.colorpicker-container.colorpicker-presets-only .colorpicker-presets{margin:0;padding:0}.colorpicker-container.colorpicker-presets-only.colorpicker-inline{max-width:100%}.colorpicker-content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:16px}.colorpicker-saturation{position:relative;width:100%;height:180px;background:-webkit-gradient(linear,left bottom, left top,from(#000),to(transparent)),-webkit-gradient(linear,left top, right top,from(#fff),to(transparent));background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent);border-radius:6px;cursor:crosshair;overflow:hidden}.colorpicker-saturation:focus{outline:2px solid #3b82f6;outline-offset:2px}.colorpicker-saturation:focus:not(:focus-visible){outline:none}.colorpicker-saturation-overlay{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none}.colorpicker-saturation-pointer{position:absolute;width:20px;height:20px;border:3px solid #fff;border-radius:50%;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.3),inset 0 0 0 1px rgba(0,0,0,0.1);box-shadow:0 2px 4px rgba(0,0,0,0.3),inset 0 0 0 1px rgba(0,0,0,0.1);-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none;-webkit-transition:-webkit-transform .1s ease;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease}@media (prefers-reduced-motion:reduce){.colorpicker-saturation-pointer{-webkit-transition:none;transition:none}}.colorpicker-controls{display:-webkit-box;display:-ms-flexbox;display:flex;gap:12px;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.colorpicker-sliders{-webkit-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:12px}.colorpicker-slider-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px}.colorpicker-label{font-size:12px;font-weight:500;color:#6b7280;text-transform:uppercase;letter-spacing:.5px}.colorpicker-slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:8px;border-radius:4px;outline:none;cursor:pointer}.colorpicker-slider:focus{-webkit-box-shadow:0 0 0 2px #3b82f6;box-shadow:0 0 0 2px #3b82f6}.colorpicker-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid #3b82f6;cursor:pointer;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-transition:-webkit-transform .1s ease;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease}.colorpicker-slider::-webkit-slider-thumb:hover{-webkit-transform:scale(1.1);transform:scale(1.1)}.colorpicker-slider::-webkit-slider-thumb:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-slider::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid #3b82f6;cursor:pointer;box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-transition:-webkit-transform .1s ease;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease}.colorpicker-slider::-moz-range-thumb:hover{transform:scale(1.1)}.colorpicker-slider::-moz-range-thumb:active{transform:scale(.95)}.colorpicker-hue-slider{background:-webkit-gradient(linear,left top, right top,from(#f00),color-stop(#ff0),color-stop(#0f0),color-stop(#0ff),color-stop(#00f),color-stop(#f0f),to(#f00));background:linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)}.colorpicker-alpha-slider{background:linear-gradient(to right,transparent,currentColor),linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:100%,10px 10px,10px 10px,10px 10px,10px 10px;background-position:0 0,0 0,0 5px,5px -5px,-5px 0}.colorpicker-sliders-only{gap:12px}.colorpicker-controls{display:-webkit-box;display:-ms-flexbox;display:flex;gap:12px}.colorpicker-controls:has(.colorpicker-sliders:not(.colorpicker-sliders-only)){-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.colorpicker-controls:has(.colorpicker-sliders-only){-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.colorpicker-controls:has(.colorpicker-sliders-only) .colorpicker-preview{width:100%;height:48px;min-height:48px;-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.colorpicker-controls:has(.colorpicker-sliders-only) .colorpicker-preview .colorpicker-preview-color{min-height:48px}.colorpicker-preview{width:40px;min-width:40px;height:40px;min-height:40px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-ms-flex-negative:0;flex-shrink:0}.colorpicker-preview-color{-webkit-box-flex:1;-ms-flex:1;flex:1;border-radius:6px;border:2px solid #e5e7eb;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.05);position:relative}.colorpicker-preview-color::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0;border-radius:4px;z-index:-1}.colorpicker-input-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px}.colorpicker-input-row{display:-webkit-box;display:-ms-flexbox;display:flex;gap:8px;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.colorpicker-input{-webkit-box-flex:1;-ms-flex:1;flex:1;padding:8px 12px;border:1px solid #e5e7eb;border-radius:6px;font-family:'Monaco','Menlo',monospace;font-size:14px;color:#1f2937;background:#fff;-webkit-transition:border-color .2s ease,-webkit-box-shadow .2s ease;transition:border-color .2s ease,-webkit-box-shadow .2s ease;transition:border-color .2s ease,box-shadow .2s ease;transition:border-color .2s ease,box-shadow .2s ease,-webkit-box-shadow .2s ease}.colorpicker-input:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-input::-webkit-input-placeholder{color:#9ca3af}.colorpicker-input::-moz-placeholder{color:#9ca3af}.colorpicker-input:-ms-input-placeholder{color:#9ca3af}.colorpicker-input::-ms-input-placeholder{color:#9ca3af}.colorpicker-input::placeholder{color:#9ca3af}.colorpicker-eyedropper-btn{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:36px;height:36px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#1f2937;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;-ms-flex-negative:0;flex-shrink:0}.colorpicker-eyedropper-btn:hover{background:#f3f4f6;border-color:#3b82f6}.colorpicker-eyedropper-btn:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-eyedropper-btn:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-eyedropper-btn svg{width:20px;height:20px;display:block}.colorpicker-system-picker-btn{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:36px;height:36px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#1f2937;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;-ms-flex-negative:0;flex-shrink:0}.colorpicker-system-picker-btn:hover{background:#f3f4f6;border-color:#3b82f6}.colorpicker-system-picker-btn:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-system-picker-btn:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-system-picker-btn svg{width:20px;height:20px;display:block}.colorpicker-presets{display:grid;grid-template-columns:repeat(8,1fr);gap:8px;padding-top:4px}.colorpicker-presets.colorpicker-presets-list{grid-template-columns:1fr;gap:6px}.colorpicker-preset{width:100%;aspect-ratio:1;border:2px solid transparent;border-radius:4px;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;position:relative;overflow:hidden}.colorpicker-preset::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:6px 6px;background-position:0 0,0 3px,3px -3px,-3px 0;z-index:-1}.colorpicker-preset:hover{-webkit-transform:scale(1.15);transform:scale(1.15);border-color:#3b82f6;-webkit-box-shadow:0 2px 8px rgba(0,0,0,0.15);box-shadow:0 2px 8px rgba(0,0,0,0.15)}.colorpicker-preset:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 2px rgba(59,130,246,0.3);box-shadow:0 0 0 2px rgba(59,130,246,0.3)}.colorpicker-preset:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-preset-list-item{aspect-ratio:unset;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:12px;padding:8px 12px;background:#f9fafb}.colorpicker-preset-list-item:hover{-webkit-transform:none;transform:none;background:#f3f4f6}.colorpicker-preset-list-item:focus{background:#f3f4f6}.colorpicker-preset-color{width:32px;height:32px;border-radius:6px;-ms-flex-negative:0;flex-shrink:0;position:relative}.colorpicker-preset-color::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:6px 6px;background-position:0 0,0 3px,3px -3px,-3px 0;border-radius:6px;z-index:-1}.colorpicker-preset-label{font-size:14px;font-weight:500;color:#1f2937;text-align:left;-webkit-box-flex:1;-ms-flex:1;flex:1}.colorpicker-input-group{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;width:100%;max-width:400px;border:2px solid #e5e7eb;border-radius:8px;overflow:hidden;-webkit-transition:all .2s ease;transition:all .2s ease;background:#fff}.colorpicker-input-group:focus-within{border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-input-preview{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:48px;min-width:48px;border-right:2px solid #e5e7eb;position:relative;cursor:pointer;-webkit-transition:background-color .2s ease;transition:background-color .2s ease}.colorpicker-input-preview::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:8px 8px;background-position:0 0,0 4px,4px -4px,-4px 0;z-index:-1}input.colorpicker-has-preview{border:none;-webkit-box-flex:1;-ms-flex:1;flex:1;padding:10px 14px;font-size:15px;font-family:'Monaco','Menlo',monospace;background:transparent}input.colorpicker-has-preview:focus{outline:none;-webkit-box-shadow:none;box-shadow:none}.colorpicker-compact-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:40px;height:40px;padding:4px;border:2px solid #e5e7eb;border-radius:6px;background:#fff;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;vertical-align:middle}.colorpicker-compact-button:hover{border-color:#3b82f6;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.1);box-shadow:0 2px 4px rgba(0,0,0,0.1);-webkit-transform:translateY(-1px);transform:translateY(-1px)}.colorpicker-compact-button:active{-webkit-transform:translateY(0) scale(.98);transform:translateY(0) scale(.98)}.colorpicker-compact-button:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-compact-button svg{width:20px;height:20px;display:block;color:#1f2937}.colorpicker-compact-button:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-compact-button:active{-webkit-transform:translateY(0);transform:translateY(0)}@media (prefers-reduced-motion:reduce){.colorpicker-compact-button{-webkit-transition:none;transition:none}.colorpicker-compact-button:hover{-webkit-transform:none;transform:none}.colorpicker-compact-button:active{-webkit-transform:none;transform:none}}.colorpicker-compact-preview{display:block;width:100%;height:100%;border-radius:4px;border:1px solid rgba(0,0,0,0.1);position:relative;overflow:hidden}.colorpicker-compact-preview::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:6px 6px;background-position:0 0,0 3px,3px -3px,-3px 0;z-index:-1}@media (prefers-color-scheme:dark){.colorpicker-container{background:#1f2937;border-color:#374151;color:#e5e7eb}.colorpicker-compact-button{background:#1f2937;border-color:#374151}.colorpicker-compact-button:hover{border-color:#60a5fa;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.3);box-shadow:0 2px 4px rgba(0,0,0,0.3)}.colorpicker-compact-button:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-label{color:#9ca3af}.colorpicker-input{background:#111827;border-color:#374151;color:#f9fafb}.colorpicker-input:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-preview-color{border-color:#374151}.colorpicker-eyedropper-btn{background:#1f2937;border-color:#374151;color:#e5e7eb}.colorpicker-eyedropper-btn:hover{background:#111827;border-color:#60a5fa}.colorpicker-eyedropper-btn:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-system-picker-btn{background:#1f2937;border-color:#374151;color:#e5e7eb}.colorpicker-system-picker-btn:hover{background:#111827;border-color:#60a5fa}.colorpicker-system-picker-btn:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-slider:focus{-webkit-box-shadow:0 0 0 2px #60a5fa;box-shadow:0 0 0 2px #60a5fa}.colorpicker-slider::-webkit-slider-thumb{border-color:#60a5fa}.colorpicker-slider::-moz-range-thumb{border-color:#60a5fa}.colorpicker-preset:hover{border-color:#60a5fa}.colorpicker-preset:focus{border-color:#60a5fa}.colorpicker-preset-list-item{background:#1f2937}.colorpicker-preset-list-item:hover{background:#111827;border-color:#374151}.colorpicker-preset-list-item:focus{background:#111827;border-color:#374151}.colorpicker-preset-label{color:#e5e7eb}.colorpicker-input-group{background:#1f2937;border-color:#374151}.colorpicker-input-group:focus-within{border-color:#60a5fa}.colorpicker-input-preview{border-right-color:#374151}input.colorpicker-has-preview{color:#f9fafb}input.colorpicker-has-preview:focus{-webkit-box-shadow:0 0 0 2px rgba(96,165,250,0.3);box-shadow:0 0 0 2px rgba(96,165,250,0.3)}}@media (prefers-contrast:high){.colorpicker-container{border-width:2px}.colorpicker-saturation{outline:2px solid currentColor}.colorpicker-saturation-pointer{border-width:4px}.colorpicker-preset{border-width:3px}}@media (prefers-reduced-motion:reduce){.colorpicker-slider::-webkit-slider-thumb{-webkit-transition:none;transition:none}.colorpicker-slider::-moz-range-thumb{-webkit-transition:none;transition:none}.colorpicker-preset{-webkit-transition:none;transition:none}.colorpicker-input{-webkit-transition:none;transition:none}.colorpicker-saturation-pointer{-webkit-transition:none;transition:none}}.colorpicker-container:not([style*="display: none"]){-webkit-animation:colorpicker-fadeIn .2s ease-out;animation:colorpicker-fadeIn .2s ease-out}@media (prefers-reduced-motion:reduce){.colorpicker-container:not([style*="display: none"]){-webkit-animation:none;animation:none}}@-webkit-keyframes colorpicker-fadeIn{from{opacity:0;-webkit-transform:translateY(-8px);transform:translateY(-8px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes colorpicker-fadeIn{from{opacity:0;-webkit-transform:translateY(-8px);transform:translateY(-8px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}
1
+ .colorpicker-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.colorpicker-container{font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#fff;border:1px solid #e5e7eb;border-radius:8px;-webkit-box-shadow:0 4px 12px rgba(0,0,0,0.15);box-shadow:0 4px 12px rgba(0,0,0,0.15);padding:16px;width:280px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.colorpicker-container:focus-within{outline:2px solid #3b82f6;outline-offset:2px}.colorpicker-container.colorpicker-inline{width:100%;max-width:100%;-webkit-box-shadow:none;box-shadow:none}.colorpicker-container.colorpicker-inline .colorpicker-saturation{height:200px}.colorpicker-container.colorpicker-presets-only{width:auto;min-width:200px;max-width:400px}.colorpicker-container.colorpicker-presets-only .colorpicker-presets{margin:0;padding:0}.colorpicker-container.colorpicker-presets-only.colorpicker-inline{max-width:100%}.colorpicker-content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:16px}.colorpicker-saturation{position:relative;width:100%;height:180px;background:-webkit-gradient(linear,left bottom, left top,from(#000),to(transparent)),-webkit-gradient(linear,left top, right top,from(#fff),to(transparent));background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent);border-radius:6px;cursor:crosshair;overflow:hidden;-ms-touch-action:none;touch-action:none}.colorpicker-saturation:focus{outline:2px solid #3b82f6;outline-offset:2px}.colorpicker-saturation:focus:not(:focus-visible){outline:none}.colorpicker-saturation-overlay{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none}.colorpicker-saturation-pointer{position:absolute;width:20px;height:20px;border:3px solid #fff;border-radius:50%;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.3),inset 0 0 0 1px rgba(0,0,0,0.1);box-shadow:0 2px 4px rgba(0,0,0,0.3),inset 0 0 0 1px rgba(0,0,0,0.1);-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none;-webkit-transition:-webkit-transform .1s ease;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease}@media (pointer:coarse){.colorpicker-saturation-pointer{width:28px;height:28px;border-width:4px}}@media (prefers-reduced-motion:reduce){.colorpicker-saturation-pointer{-webkit-transition:none;transition:none}}.colorpicker-controls{display:-webkit-box;display:-ms-flexbox;display:flex;gap:12px;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.colorpicker-sliders{-webkit-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:12px}.colorpicker-slider-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px}.colorpicker-label{font-size:12px;font-weight:500;color:#6b7280;text-transform:uppercase;letter-spacing:.5px}.colorpicker-slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;-ms-touch-action:none;touch-action:none}@media (pointer:coarse){.colorpicker-slider{height:12px}}.colorpicker-slider:focus{-webkit-box-shadow:0 0 0 2px #3b82f6;box-shadow:0 0 0 2px #3b82f6}.colorpicker-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid #3b82f6;cursor:pointer;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-transition:-webkit-transform .1s ease;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease}@media (pointer:coarse){.colorpicker-slider::-webkit-slider-thumb{width:28px;height:28px;border-width:3px}}.colorpicker-slider::-webkit-slider-thumb:hover{-webkit-transform:scale(1.1);transform:scale(1.1)}.colorpicker-slider::-webkit-slider-thumb:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-slider::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid #3b82f6;cursor:pointer;box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-transition:-webkit-transform .1s ease;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease;background:#fff;border:2px solid #3b82f6;cursor:pointer;box-shadow:0 2px 4px rgba(0,0,0,0.2);transition:transform .1s ease}@media (pointer:coarse){.colorpicker-slider::-moz-range-thumb{width:28px;height:28px;border-width:3px}}.colorpicker-slider::-moz-range-thumb:hover{transform:scale(1.1)}.colorpicker-slider::-moz-range-thumb:active{transform:scale(.95)}.colorpicker-hue-slider{background:-webkit-gradient(linear,left top, right top,from(#f00),color-stop(#ff0),color-stop(#0f0),color-stop(#0ff),color-stop(#00f),color-stop(#f0f),to(#f00));background:linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)}.colorpicker-alpha-slider{background:linear-gradient(to right,transparent,currentColor),linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:100%,10px 10px,10px 10px,10px 10px,10px 10px;background-position:0 0,0 0,0 5px,5px -5px,-5px 0}.colorpicker-sliders-only{gap:12px}.colorpicker-controls{display:-webkit-box;display:-ms-flexbox;display:flex;gap:12px}.colorpicker-controls:has(.colorpicker-sliders:not(.colorpicker-sliders-only)){-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.colorpicker-controls:has(.colorpicker-sliders-only){-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.colorpicker-controls:has(.colorpicker-sliders-only) .colorpicker-preview{width:100%;height:48px;min-height:48px;-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.colorpicker-controls:has(.colorpicker-sliders-only) .colorpicker-preview .colorpicker-preview-color{min-height:48px}.colorpicker-preview{width:40px;min-width:40px;height:40px;min-height:40px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-ms-flex-negative:0;flex-shrink:0}.colorpicker-preview-color{-webkit-box-flex:1;-ms-flex:1;flex:1;border-radius:6px;border:2px solid #e5e7eb;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.05);position:relative}.colorpicker-preview-color::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0;border-radius:4px;z-index:-1}.colorpicker-input-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px}.colorpicker-input-row{display:-webkit-box;display:-ms-flexbox;display:flex;gap:8px;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.colorpicker-input{-webkit-box-flex:1;-ms-flex:1;flex:1;padding:8px 12px;border:1px solid #e5e7eb;border-radius:6px;font-family:'Monaco','Menlo',monospace;font-size:14px;color:#1f2937;background:#fff;-webkit-transition:border-color .2s ease,-webkit-box-shadow .2s ease;transition:border-color .2s ease,-webkit-box-shadow .2s ease;transition:border-color .2s ease,box-shadow .2s ease;transition:border-color .2s ease,box-shadow .2s ease,-webkit-box-shadow .2s ease}.colorpicker-input:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-input::-webkit-input-placeholder{color:#9ca3af}.colorpicker-input::-moz-placeholder{color:#9ca3af}.colorpicker-input:-ms-input-placeholder{color:#9ca3af}.colorpicker-input::-ms-input-placeholder{color:#9ca3af}.colorpicker-input::placeholder{color:#9ca3af}.colorpicker-eyedropper-btn{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:36px;height:36px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#1f2937;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;-ms-flex-negative:0;flex-shrink:0}@media (pointer:coarse){.colorpicker-eyedropper-btn{width:44px;height:44px}}.colorpicker-eyedropper-btn:hover{background:#f3f4f6;border-color:#3b82f6}.colorpicker-eyedropper-btn:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-eyedropper-btn:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-eyedropper-btn svg{width:20px;height:20px;display:block}.colorpicker-system-picker-btn{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:36px;height:36px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#1f2937;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;-ms-flex-negative:0;flex-shrink:0}.colorpicker-system-picker-btn:hover{background:#f3f4f6;border-color:#3b82f6}.colorpicker-system-picker-btn:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-system-picker-btn:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-system-picker-btn svg{width:20px;height:20px;display:block}.colorpicker-presets{display:grid;grid-template-columns:repeat(8,1fr);gap:8px;padding-top:4px}.colorpicker-presets.colorpicker-presets-list{grid-template-columns:1fr;gap:6px}.colorpicker-preset{width:100%;aspect-ratio:1;border:2px solid transparent;border-radius:4px;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;position:relative;overflow:hidden}@media (pointer:coarse){.colorpicker-preset{min-height:44px}}.colorpicker-preset::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:6px 6px;background-position:0 0,0 3px,3px -3px,-3px 0;z-index:-1}.colorpicker-preset:hover{-webkit-transform:scale(1.15);transform:scale(1.15);border-color:#3b82f6;-webkit-box-shadow:0 2px 8px rgba(0,0,0,0.15);box-shadow:0 2px 8px rgba(0,0,0,0.15)}@media (pointer:coarse){.colorpicker-preset:hover{-webkit-transform:scale(1.05);transform:scale(1.05)}}.colorpicker-preset:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 2px rgba(59,130,246,0.3);box-shadow:0 0 0 2px rgba(59,130,246,0.3)}.colorpicker-preset:active{-webkit-transform:scale(.95);transform:scale(.95)}.colorpicker-preset-list-item{aspect-ratio:unset;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:12px;padding:8px 12px;background:#f9fafb;min-height:48px}@media (pointer:coarse){.colorpicker-preset-list-item{min-height:56px;padding:12px}}.colorpicker-preset-list-item:hover{-webkit-transform:none;transform:none;background:#f3f4f6}.colorpicker-preset-list-item:focus{background:#f3f4f6}.colorpicker-preset-color{width:32px;height:32px;border-radius:6px;-ms-flex-negative:0;flex-shrink:0;position:relative}.colorpicker-preset-color::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:6px 6px;background-position:0 0,0 3px,3px -3px,-3px 0;border-radius:6px;z-index:-1}.colorpicker-preset-label{font-size:14px;font-weight:500;color:#1f2937;text-align:left;-webkit-box-flex:1;-ms-flex:1;flex:1}.colorpicker-input-group{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;width:100%;max-width:400px;border:2px solid #e5e7eb;border-radius:8px;overflow:hidden;-webkit-transition:all .2s ease;transition:all .2s ease;background:#fff}.colorpicker-input-group:focus-within{border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-input-preview{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:48px;min-width:48px;border-right:2px solid #e5e7eb;position:relative;cursor:pointer;-webkit-transition:background-color .2s ease;transition:background-color .2s ease}.colorpicker-input-preview::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:8px 8px;background-position:0 0,0 4px,4px -4px,-4px 0;z-index:-1}input.colorpicker-has-preview{border:none;-webkit-box-flex:1;-ms-flex:1;flex:1;padding:10px 14px;font-size:15px;font-family:'Monaco','Menlo',monospace;background:transparent}input.colorpicker-has-preview:focus{outline:none;-webkit-box-shadow:none;box-shadow:none}.colorpicker-compact-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:40px;height:40px;padding:4px;border:2px solid #e5e7eb;border-radius:6px;background:#fff;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease;vertical-align:middle}.colorpicker-compact-button:hover{border-color:#3b82f6;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.1);box-shadow:0 2px 4px rgba(0,0,0,0.1);-webkit-transform:translateY(-1px);transform:translateY(-1px)}.colorpicker-compact-button:active{-webkit-transform:translateY(0) scale(.98);transform:translateY(0) scale(.98)}.colorpicker-compact-button:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-compact-button svg{width:20px;height:20px;display:block;color:#1f2937}.colorpicker-compact-button:focus{outline:none;border-color:#3b82f6;-webkit-box-shadow:0 0 0 3px rgba(59,130,246,0.1);box-shadow:0 0 0 3px rgba(59,130,246,0.1)}.colorpicker-compact-button:active{-webkit-transform:translateY(0);transform:translateY(0)}@media (prefers-reduced-motion:reduce){.colorpicker-compact-button{-webkit-transition:none;transition:none}.colorpicker-compact-button:hover{-webkit-transform:none;transform:none}.colorpicker-compact-button:active{-webkit-transform:none;transform:none}}.colorpicker-compact-preview{display:block;width:100%;height:100%;border-radius:4px;border:1px solid rgba(0,0,0,0.1);position:relative;overflow:hidden}.colorpicker-compact-preview::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:6px 6px;background-position:0 0,0 3px,3px -3px,-3px 0;z-index:-1}@media (prefers-color-scheme:dark){.colorpicker-container{background:#1f2937;border-color:#374151;color:#e5e7eb}.colorpicker-compact-button{background:#1f2937;border-color:#374151}.colorpicker-compact-button:hover{border-color:#60a5fa;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.3);box-shadow:0 2px 4px rgba(0,0,0,0.3)}.colorpicker-compact-button:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-label{color:#9ca3af}.colorpicker-input{background:#111827;border-color:#374151;color:#f9fafb}.colorpicker-input:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-preview-color{border-color:#374151}.colorpicker-eyedropper-btn{background:#1f2937;border-color:#374151;color:#e5e7eb}.colorpicker-eyedropper-btn:hover{background:#111827;border-color:#60a5fa}.colorpicker-eyedropper-btn:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-system-picker-btn{background:#1f2937;border-color:#374151;color:#e5e7eb}.colorpicker-system-picker-btn:hover{background:#111827;border-color:#60a5fa}.colorpicker-system-picker-btn:focus{border-color:#60a5fa;-webkit-box-shadow:0 0 0 3px rgba(96,165,250,0.2);box-shadow:0 0 0 3px rgba(96,165,250,0.2)}.colorpicker-slider:focus{-webkit-box-shadow:0 0 0 2px #60a5fa;box-shadow:0 0 0 2px #60a5fa}.colorpicker-slider::-webkit-slider-thumb{border-color:#60a5fa}.colorpicker-slider::-moz-range-thumb{border-color:#60a5fa}.colorpicker-preset:hover{border-color:#60a5fa}.colorpicker-preset:focus{border-color:#60a5fa}.colorpicker-preset-list-item{background:#1f2937}.colorpicker-preset-list-item:hover{background:#111827;border-color:#374151}.colorpicker-preset-list-item:focus{background:#111827;border-color:#374151}.colorpicker-preset-label{color:#e5e7eb}.colorpicker-input-group{background:#1f2937;border-color:#374151}.colorpicker-input-group:focus-within{border-color:#60a5fa}.colorpicker-input-preview{border-right-color:#374151}input.colorpicker-has-preview{color:#f9fafb}input.colorpicker-has-preview:focus{-webkit-box-shadow:0 0 0 2px rgba(96,165,250,0.3);box-shadow:0 0 0 2px rgba(96,165,250,0.3)}}@media (prefers-contrast:high){.colorpicker-container{border-width:2px}.colorpicker-saturation{outline:2px solid currentColor}.colorpicker-saturation-pointer{border-width:4px}.colorpicker-preset{border-width:3px}}@media (prefers-reduced-motion:reduce){.colorpicker-slider::-webkit-slider-thumb{-webkit-transition:none;transition:none}.colorpicker-slider::-moz-range-thumb{-webkit-transition:none;transition:none}.colorpicker-preset{-webkit-transition:none;transition:none}.colorpicker-input{-webkit-transition:none;transition:none}.colorpicker-saturation-pointer{-webkit-transition:none;transition:none}}.colorpicker-container:not([style*="display: none"]){-webkit-animation:colorpicker-fadeIn .2s ease-out;animation:colorpicker-fadeIn .2s ease-out}@media (prefers-reduced-motion:reduce){.colorpicker-container:not([style*="display: none"]){-webkit-animation:none;animation:none}}@-webkit-keyframes colorpicker-fadeIn{from{opacity:0;-webkit-transform:translateY(-8px);transform:translateY(-8px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes colorpicker-fadeIn{from{opacity:0;-webkit-transform:translateY(-8px);transform:translateY(-8px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}
@@ -1,2 +1,2 @@
1
- /* Pickit Color v1.0.2, @license Donationware */
2
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).colorpicker={})}(this,(function(t){"use strict";function e(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{l(n.next(t))}catch(t){i(t)}}function a(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))}function o(t,e){var o,n,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(o=1,n&&(r=2&a[0]?n.return:a[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;switch(n=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{o=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}"function"==typeof SuppressedError&&SuppressedError;var n=function(){function t(e,o){var n,r,i,s,a,l,c,p,u,h,d,v,f,y;if(void 0===o&&(o={}),this.container=null,this.colorBox=null,this.hueSlider=null,this.saturationSlider=null,this.lightnessSlider=null,this.alphaSlider=null,this.hexInput=null,this.currentColor={h:0,s:100,l:50,a:1},this.isOpen=!1,this.saturationPointer=null,this.compactButton=null,this.inputPreview=null,this.announceTimeout=null,this.input="string"==typeof e?document.querySelector(e):e,!this.input)throw new Error("ColorPicker: Invalid element selector");var b=this.input.getAttribute("data-preset-colors"),g=b?b.split(",").map((function(t){return t.trim()})):null;this.options={defaultColor:o.defaultColor||"#3b82f6",format:o.format||"hex",showAlpha:null!==(n=o.showAlpha)&&void 0!==n&&n,sliderMode:null!==(r=o.sliderMode)&&void 0!==r&&r,eyeDropper:null!==(i=o.eyeDropper)&&void 0!==i&&i,presetColors:o.presetColors||g||["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899","#000000","#ffffff"],presetLabels:o.presetLabels||[],presetsOnly:null!==(s=o.presetsOnly)&&void 0!==s&&s,listView:null!==(a=o.listView)&&void 0!==a&&a,inline:null!==(l=o.inline)&&void 0!==l&&l,compact:null!==(c=o.compact)&&void 0!==c&&c,inputPreview:null!==(p=o.inputPreview)&&void 0!==p&&p,onChange:o.onChange||function(){},onOpen:o.onOpen||function(){},onClose:o.onClose||function(){},appendTo:o.appendTo||document.body,position:o.position||"auto",closeOnSelect:null===(u=o.closeOnSelect)||void 0===u||u,ariaLabels:{hue:(null===(h=o.ariaLabels)||void 0===h?void 0:h.hue)||"Hue",saturation:(null===(d=o.ariaLabels)||void 0===d?void 0:d.saturation)||"Saturation and Lightness",lightness:(null===(v=o.ariaLabels)||void 0===v?void 0:v.lightness)||"Lightness",alpha:(null===(f=o.ariaLabels)||void 0===f?void 0:f.alpha)||"Alpha",presets:(null===(y=o.ariaLabels)||void 0===y?void 0:y.presets)||"Preset colors"}},this.init(),t.instances.set(this.input,this)}return t.prototype.init=function(){var t=this.input.value||this.options.defaultColor;this.currentColor=this.parseColor(t),this.options.compact&&this.createCompactButton(),this.options.inputPreview&&!this.options.compact&&this.createInputPreview(),this.buildColorPicker(),this.setupEventListeners(),this.updateColorDisplay(),this.options.inline&&this.open()},t.prototype.buildColorPicker=function(){var t,e=this;this.container=document.createElement("div"),this.container.className="colorpicker-container",this.options.presetsOnly&&this.container.classList.add("colorpicker-presets-only"),this.options.inline&&this.container.classList.add("colorpicker-inline"),this.container.setAttribute("role","dialog"),this.container.setAttribute("aria-label","Color picker"),this.container.style.display="none";var o='\n <div class="colorpicker-content">\n '.concat(this.options.presetsOnly?"":"\n ".concat(this.options.sliderMode?"":'\n <div class="colorpicker-saturation" \n role="slider" \n aria-label="'.concat(this.options.ariaLabels.saturation,'"\n aria-valuemin="0"\n aria-valuemax="100"\n aria-valuenow="').concat(this.currentColor.s,'"\n tabindex="0">\n <div class="colorpicker-saturation-overlay"></div>\n <div class="colorpicker-saturation-pointer" role="presentation"></div>\n </div>\n '),'\n \n <div class="colorpicker-controls">\n <div class="colorpicker-sliders').concat(this.options.sliderMode?" colorpicker-sliders-only":"",'">\n <div class="colorpicker-slider-group">\n <label for="colorpicker-hue">\n <span class="colorpicker-label">').concat(this.options.ariaLabels.hue,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-hue"\n class="colorpicker-slider colorpicker-hue-slider"\n min="0" \n max="360" \n value="').concat(this.currentColor.h,'"\n aria-label="').concat(this.options.ariaLabels.hue,'"\n tabindex="0"\n />\n </div>\n ').concat(this.options.sliderMode?'\n <div class="colorpicker-slider-group">\n <label for="colorpicker-saturation">\n <span class="colorpicker-label">'.concat(this.options.ariaLabels.saturation,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-saturation"\n class="colorpicker-slider colorpicker-saturation-slider"\n min="0" \n max="100" \n value="').concat(this.currentColor.s,'"\n aria-label="').concat(this.options.ariaLabels.saturation,'"\n tabindex="0"\n />\n </div>\n <div class="colorpicker-slider-group">\n <label for="colorpicker-lightness">\n <span class="colorpicker-label">').concat(this.options.ariaLabels.lightness,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-lightness"\n class="colorpicker-slider colorpicker-lightness-slider"\n min="0" \n max="100" \n value="').concat(this.currentColor.l,'"\n aria-label="').concat(this.options.ariaLabels.lightness,'"\n tabindex="0"\n />\n </div>\n '):"","\n ").concat(this.options.showAlpha?'\n <div class="colorpicker-slider-group">\n <label for="colorpicker-alpha">\n <span class="colorpicker-label">'.concat(this.options.ariaLabels.alpha,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-alpha"\n class="colorpicker-slider colorpicker-alpha-slider"\n min="0" \n max="100" \n value="').concat(100*this.currentColor.a,'"\n aria-label="').concat(this.options.ariaLabels.alpha,'"\n tabindex="0"\n />\n </div>\n '):"",'\n </div>\n \n <div class="colorpicker-preview">\n <div class="colorpicker-preview-color" role="presentation"></div>\n </div>\n </div>\n \n <div class="colorpicker-input-wrapper">\n <label for="colorpicker-hex">\n <span class="colorpicker-sr-only">Color value</span>\n </label>\n <div class="colorpicker-input-row">\n <input \n type="text" \n id="colorpicker-hex"\n class="colorpicker-input"\n placeholder="').concat(this.getPlaceholder(),'"\n aria-label="Color value in ').concat(this.options.format,' format"\n />\n ').concat(this.options.eyeDropper?"\n ".concat(this.supportsEyeDropper()?'\n <button \n type="button"\n class="colorpicker-eyedropper-btn"\n aria-label="Pick color from screen"\n title="Pick color from screen"\n >\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M2 22l1-1"/>\n <path d="M8.5 16.5l-1-1"/>\n <path d="M17 3l4 4"/>\n <path d="M12 8l4 4"/>\n <path d="M3 21l9-9"/>\n <path d="M14.5 9.5l-1 1"/>\n <path d="M20 14l-8 8"/>\n </svg>\n </button>\n ':"",'\n <button \n type="button"\n class="colorpicker-system-picker-btn"\n aria-label="Open system color picker"\n title="Open system color picker"\n >\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <circle cx="12" cy="12" r="10"/>\n <path d="M12 2v20"/>\n <path d="M2 12h20"/>\n <circle cx="12" cy="12" r="3"/>\n </svg>\n </button>\n <input \n type="color"\n class="colorpicker-system-picker-input"\n style="position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;"\n />\n '):"","\n </div>\n </div>\n "),"\n \n ").concat(this.options.presetColors.length>0?'\n <div class="colorpicker-presets'.concat(this.options.listView?" colorpicker-presets-list":"",'" role="group" aria-label="').concat(this.options.ariaLabels.presets,'">\n ').concat(this.options.presetColors.map((function(t,o){var n=e.options.presetLabels[o]||"";return e.options.listView&&n?'\n <button \n type="button"\n class="colorpicker-preset colorpicker-preset-list-item" \n data-color="'.concat(t,'"\n aria-label="Select color ').concat(n,'"\n tabindex="').concat(0===o?"0":"-1",'"\n >\n <span class="colorpicker-preset-color" style="background-color: ').concat(t,'"></span>\n <span class="colorpicker-preset-label">').concat(n,"</span>\n </button>\n "):'\n <button \n type="button"\n class="colorpicker-preset" \n style="background-color: '.concat(t,'"\n data-color="').concat(t,'"\n aria-label="Select color ').concat(n||t,'"\n tabindex="').concat(0===o?"0":"-1",'"\n ></button>\n ')})).join(""),"\n </div>\n "):"","\n </div>\n ");this.container.innerHTML=o,this.colorBox=this.container.querySelector(".colorpicker-saturation"),this.saturationPointer=this.container.querySelector(".colorpicker-saturation-pointer"),this.hueSlider=this.container.querySelector(".colorpicker-hue-slider"),this.saturationSlider=this.container.querySelector(".colorpicker-saturation-slider"),this.lightnessSlider=this.container.querySelector(".colorpicker-lightness-slider"),this.alphaSlider=this.container.querySelector(".colorpicker-alpha-slider"),this.hexInput=this.container.querySelector(".colorpicker-input"),this.options.inline?(null===(t=this.input.parentNode)||void 0===t||t.insertBefore(this.container,this.input.nextSibling),this.input.style.display="none"):this.options.appendTo.appendChild(this.container)},t.prototype.createCompactButton=function(){var t,e=this;this.input.style.position="absolute",this.input.style.opacity="0",this.input.style.pointerEvents="none",this.input.style.width="0",this.input.style.height="0",this.compactButton=document.createElement("button"),this.compactButton.type="button",this.compactButton.className="colorpicker-compact-button",this.compactButton.setAttribute("aria-label","Select color"),this.compactButton.tabIndex=0;var o=document.createElement("span");o.className="colorpicker-compact-preview",o.style.backgroundColor=this.input.value||this.options.defaultColor,this.compactButton.appendChild(o),null===(t=this.input.parentNode)||void 0===t||t.insertBefore(this.compactButton,this.input.nextSibling),this.compactButton.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation(),e.toggle()})),this.compactButton.addEventListener("keydown",(function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e.toggle())}))},t.prototype.createInputPreview=function(){var t,e=document.createElement("div");e.className="colorpicker-input-group",this.inputPreview=document.createElement("span"),this.inputPreview.className="colorpicker-input-preview",this.inputPreview.style.backgroundColor=this.input.value||this.options.defaultColor,null===(t=this.input.parentNode)||void 0===t||t.insertBefore(e,this.input),e.appendChild(this.inputPreview),e.appendChild(this.input),this.input.classList.add("colorpicker-has-preview")},t.prototype.supportsEyeDropper=function(){return"undefined"!=typeof window&&"EyeDropper"in window},t.prototype.openEyeDropper=function(){return e(this,void 0,Promise,(function(){var t,e;return o(this,(function(o){switch(o.label){case 0:if(!this.supportsEyeDropper())return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,(new EyeDropper).open()];case 2:return(t=o.sent()).sRGBHex&&(this.currentColor=this.parseColor(t.sRGBHex),this.input.value=t.sRGBHex,this.updateColorDisplay(),this.options.onChange(t.sRGBHex)),[3,4];case 3:return"AbortError"!==(e=o.sent()).name&&console.error("EyeDropper error:",e),[3,4];case 4:return[2]}}))}))},t.prototype.setupEventListeners=function(){var t,n,r,i,s=this;this.options.compact||(this.input.addEventListener("click",(function(){s.options.inline||s.toggle()})),this.input.addEventListener("keydown",(function(t){"Enter"!==t.key&&" "!==t.key||s.options.inline||(t.preventDefault(),s.toggle())}))),this.input.addEventListener("change",(function(){s.currentColor=s.parseColor(s.input.value),s.updateColorDisplay()})),this.hueSlider&&this.hueSlider.addEventListener("input",(function(t){s.currentColor.h=parseInt(t.target.value),s.updateColorDisplay(),s.announceColorChange()})),this.saturationSlider&&this.saturationSlider.addEventListener("input",(function(t){s.currentColor.s=parseInt(t.target.value),s.updateColorDisplay(),s.announceColorChange()})),this.lightnessSlider&&this.lightnessSlider.addEventListener("input",(function(t){s.currentColor.l=parseInt(t.target.value),s.updateColorDisplay(),s.announceColorChange()})),this.alphaSlider&&this.alphaSlider.addEventListener("input",(function(t){s.currentColor.a=parseInt(t.target.value)/100,s.updateColorDisplay(),s.announceColorChange()})),this.colorBox&&(this.colorBox.addEventListener("mousedown",(function(t){return s.onSaturationMouseDown(t)})),this.colorBox.addEventListener("keydown",(function(t){return s.onSaturationKeyDown(t)}))),this.hexInput&&this.hexInput.addEventListener("input",(function(t){var e=t.target.value.trim();s.isValidColor(e)&&(s.currentColor=s.parseColor(e),s.updateColorDisplay(!1))}));var a=null===(t=this.container)||void 0===t?void 0:t.querySelectorAll(".colorpicker-preset");a&&a.length>0&&a.forEach((function(t,e){t.addEventListener("click",(function(t){var e=t.currentTarget.dataset.color;s.currentColor=s.parseColor(e),s.updateColorDisplay(),s.options.closeOnSelect&&s.close()})),t.addEventListener("keydown",(function(t){var o=t.key,n=!1,r=e;switch(o){case"ArrowRight":case"ArrowDown":r=Math.min(a.length-1,e+1),n=!0;break;case"ArrowLeft":case"ArrowUp":r=Math.max(0,e-1),n=!0;break;case"Home":r=0,n=!0;break;case"End":r=a.length-1,n=!0;break;case"Enter":case" ":var i=t.currentTarget.dataset.color;s.currentColor=s.parseColor(i),s.updateColorDisplay(),s.options.closeOnSelect&&s.close(),n=!0}n&&(t.preventDefault(),r!==e&&(a.forEach((function(t,e){t.setAttribute("tabindex",e===r?"0":"-1")})),a[r].focus()))}))}));var l=null===(n=this.container)||void 0===n?void 0:n.querySelector(".colorpicker-eyedropper-btn");l&&l.addEventListener("click",(function(t){return e(s,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t.preventDefault(),t.stopPropagation(),[4,this.openEyeDropper()];case 1:return e.sent(),[2]}}))}))}));var c=null===(r=this.container)||void 0===r?void 0:r.querySelector(".colorpicker-system-picker-btn"),p=null===(i=this.container)||void 0===i?void 0:i.querySelector(".colorpicker-system-picker-input");c&&p&&(p.value=this.formatColor(this.currentColor).substring(0,7),c.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation(),p.click()})),p.addEventListener("change",(function(){var t=p.value;s.currentColor=s.parseColor(t),s.input.value=t,s.updateColorDisplay(),s.options.onChange(t)}))),this.options.inline||document.addEventListener("mousedown",(function(t){var e;s.isOpen&&!(null===(e=s.container)||void 0===e?void 0:e.contains(t.target))&&t.target!==s.input&&s.close()})),document.addEventListener("keydown",(function(t){"Escape"===t.key&&s.isOpen&&!s.options.inline&&(s.close(),s.input.focus())}))},t.prototype.onSaturationMouseDown=function(t){var e=this;t.preventDefault(),this.updateSaturationFromMouse(t);var o=function(t){e.updateSaturationFromMouse(t)},n=function(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",n)},t.prototype.updateSaturationFromMouse=function(t){if(this.colorBox){var e=this.colorBox.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientX-e.left,e.width)),n=Math.max(0,Math.min(t.clientY-e.top,e.height));this.currentColor.s=o/e.width*100,this.currentColor.l=100-n/e.height*100,this.updateColorDisplay(),this.announceColorChange()}},t.prototype.onSaturationKeyDown=function(t){var e=t.shiftKey?10:1,o=!1;switch(t.key){case"ArrowRight":this.currentColor.s=Math.min(100,this.currentColor.s+e),o=!0;break;case"ArrowLeft":this.currentColor.s=Math.max(0,this.currentColor.s-e),o=!0;break;case"ArrowUp":this.currentColor.l=Math.min(100,this.currentColor.l+e),o=!0;break;case"ArrowDown":this.currentColor.l=Math.max(0,this.currentColor.l-e),o=!0}o&&(t.preventDefault(),this.updateColorDisplay(),this.announceColorChange())},t.prototype.updateColorDisplay=function(t){var e;if(void 0===t&&(t=!0),this.colorBox&&(this.colorBox.style.backgroundColor="hsl(".concat(this.currentColor.h,", 100%, 50%)")),this.saturationPointer&&this.colorBox){var o=this.currentColor.s/100*100,n=100*(1-this.currentColor.l/100);this.saturationPointer.style.left="".concat(o,"%"),this.saturationPointer.style.top="".concat(n,"%")}this.saturationSlider&&(this.saturationSlider.style.background="linear-gradient(to right, hsl(".concat(this.currentColor.h,", 0%, 50%), hsl(").concat(this.currentColor.h,", 100%, 50%))")),this.lightnessSlider&&(this.lightnessSlider.style.background="linear-gradient(to right, hsl(".concat(this.currentColor.h,", ").concat(this.currentColor.s,"%, 0%), hsl(").concat(this.currentColor.h,", ").concat(this.currentColor.s,"%, 50%), hsl(").concat(this.currentColor.h,", ").concat(this.currentColor.s,"%, 100%))"));var r=null===(e=this.container)||void 0===e?void 0:e.querySelector(".colorpicker-preview-color");if(r&&(r.style.backgroundColor=this.toHSLString(this.currentColor)),this.hexInput&&t&&(this.hexInput.value=this.formatColor(this.currentColor)),this.hueSlider&&(this.hueSlider.value=String(this.currentColor.h)),this.saturationSlider&&(this.saturationSlider.value=String(this.currentColor.s)),this.lightnessSlider&&(this.lightnessSlider.value=String(this.currentColor.l)),this.alphaSlider&&(this.alphaSlider.value=String(100*this.currentColor.a)),t){if(this.input.value=this.formatColor(this.currentColor),this.options.onChange(this.input.value),this.compactButton){var i=this.compactButton.querySelector(".colorpicker-compact-preview");i&&(i.style.backgroundColor=this.toHSLString(this.currentColor))}this.inputPreview&&(this.inputPreview.style.backgroundColor=this.toHSLString(this.currentColor))}},t.prototype.formatColor=function(t){switch(this.options.format){case"hsl":return this.toHSLString(t);case"rgb":return this.toRGBString(this.hslToRgb(t));case"hex":default:return this.toHex(t)}},t.prototype.getPlaceholder=function(){switch(this.options.format){case"hsl":return this.options.showAlpha?"hsla(0, 0%, 0%, 1)":"hsl(0, 0%, 0%)";case"rgb":return this.options.showAlpha?"rgba(0, 0, 0, 1)":"rgb(0, 0, 0)";case"hex":default:return"#000000"}},t.prototype.parseColor=function(t){if((t=t.trim()).startsWith("#"))return this.hexToHsl(t);var e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(e){var o={r:parseInt(e[1]),g:parseInt(e[2]),b:parseInt(e[3]),a:e[4]?parseFloat(e[4]):1};return this.rgbToHsl(o)}var n=t.match(/hsla?\((\d+),\s*(\d+)%,\s*(\d+)%(?:,\s*([\d.]+))?\)/);return n?{h:parseInt(n[1]),s:parseInt(n[2]),l:parseInt(n[3]),a:n[4]?parseFloat(n[4]):1}:this.currentColor},t.prototype.hexToHsl=function(t){t=t.replace("#","");var e=parseInt(t.substring(0,2),16)/255,o=parseInt(t.substring(2,4),16)/255,n=parseInt(t.substring(4,6),16)/255,r=8===t.length?parseInt(t.substring(6,8),16)/255:1;return this.rgbToHsl({r:255*e,g:255*o,b:255*n,a:r})},t.prototype.rgbToHsl=function(t){var e=t.r/255,o=t.g/255,n=t.b/255,r=Math.max(e,o,n),i=Math.min(e,o,n),s=0,a=0,l=(r+i)/2;if(r!==i){var c=r-i;switch(a=l>.5?c/(2-r-i):c/(r+i),r){case e:s=((o-n)/c+(o<n?6:0))/6;break;case o:s=((n-e)/c+2)/6;break;case n:s=((e-o)/c+4)/6}}return{h:Math.round(360*s),s:Math.round(100*a),l:Math.round(100*l),a:t.a}},t.prototype.hslToRgb=function(t){var e,o,n,r=t.h/360,i=t.s/100,s=t.l/100;if(0===i)e=o=n=s;else{var a=function(t,e,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t},l=s<.5?s*(1+i):s+i-s*i,c=2*s-l;e=a(c,l,r+1/3),o=a(c,l,r),n=a(c,l,r-1/3)}return{r:Math.round(255*e),g:Math.round(255*o),b:Math.round(255*n),a:t.a}},t.prototype.toHex=function(t){var e=this.hslToRgb(t),o=function(t){return t.toString(16).padStart(2,"0")};if(this.options.showAlpha&&t.a<1){var n=Math.round(255*t.a);return"#".concat(o(e.r)).concat(o(e.g)).concat(o(e.b)).concat(o(n))}return"#".concat(o(e.r)).concat(o(e.g)).concat(o(e.b))},t.prototype.toHSLString=function(t){return this.options.showAlpha&&t.a<1?"hsla(".concat(t.h,", ").concat(t.s,"%, ").concat(t.l,"%, ").concat(t.a,")"):"hsl(".concat(t.h,", ").concat(t.s,"%, ").concat(t.l,"%)")},t.prototype.toRGBString=function(t){return this.options.showAlpha&&t.a<1?"rgba(".concat(t.r,", ").concat(t.g,", ").concat(t.b,", ").concat(t.a,")"):"rgb(".concat(t.r,", ").concat(t.g,", ").concat(t.b,")")},t.prototype.isValidHex=function(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(t)},t.prototype.isValidColor=function(t){return!!this.isValidHex(t)||(!!/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+\s*)?\)$/.test(t)||!!/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+\s*)?\)$/.test(t))},t.prototype.announceColorChange=function(){var t=this;this.announceTimeout||(this.announceTimeout=setTimeout((function(){var e,o=document.createElement("div");o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),o.className="colorpicker-sr-only",o.textContent="Color changed to ".concat(t.formatColor(t.currentColor)),null===(e=t.container)||void 0===e||e.appendChild(o),setTimeout((function(){return o.remove()}),1e3),t.announceTimeout=null}),500))},t.prototype.open=function(){var t=this;!this.isOpen&&this.container&&(this.isOpen=!0,this.container.style.display="block",this.options.inline||this.positionPicker(),this.options.onOpen(),setTimeout((function(){var e,o=null;(o=t.options.presetsOnly?null===(e=t.container)||void 0===e?void 0:e.querySelector(".colorpicker-preset"):t.options.sliderMode?t.hueSlider:t.colorBox)&&o.focus()}),0))},t.prototype.close=function(){this.isOpen&&this.container&&(this.isOpen=!1,this.options.inline||(this.container.style.display="none"),this.options.onClose())},t.prototype.toggle=function(){this.isOpen?this.close():this.open()},t.prototype.positionPicker=function(){if(this.container){var t=this.input.getBoundingClientRect(),e=this.container.getBoundingClientRect(),o=window.innerHeight,n=t.bottom+window.scrollY+4,r=t.left+window.scrollX;if("auto"===this.options.position){var i=o-t.bottom,s=t.top;i<e.height&&s>i&&(n=t.top+window.scrollY-e.height-4)}else"above"===this.options.position&&(n=t.top+window.scrollY-e.height-4);this.container.style.position="absolute",this.container.style.top="".concat(n,"px"),this.container.style.left="".concat(r,"px"),this.container.style.zIndex="9999"}},t.prototype.setColor=function(t){this.currentColor=this.parseColor(t),this.updateColorDisplay()},t.prototype.getColor=function(){return this.formatColor(this.currentColor)},t.prototype.destroy=function(){var e,o,n;if(null===(e=this.container)||void 0===e||e.remove(),null===(o=this.compactButton)||void 0===o||o.remove(),this.options.compact&&this.input&&(this.input.style.position="",this.input.style.opacity="",this.input.style.pointerEvents="",this.input.style.width="",this.input.style.height=""),this.options.inputPreview&&this.input){this.input.classList.remove("colorpicker-has-preview");var r=this.input.parentElement;r&&r.classList.contains("colorpicker-input-group")&&(null===(n=r.parentNode)||void 0===n||n.insertBefore(this.input,r),r.remove())}t.instances.delete(this.input)},t.getInstance=function(e){return t.instances.get(e)},t.instances=new Map,t}();function r(t){void 0===t&&(t=document);var e=[];return t.querySelectorAll('[data-colorpicker], .colorpicker, input[type="color"][data-format]').forEach((function(t){if(!n.getInstance(t)){var o=t.dataset,r={};if(o.colorpicker)o.colorpicker.split(/[,;]/).forEach((function(t){var e=t.split(":").map((function(t){return t.trim()})),o=e[0],n=e[1];switch(o){case"format":"hex"!==n&&"rgb"!==n&&"hsl"!==n||(r.format=n);break;case"alpha":case"showAlpha":r.showAlpha="true"===n||"1"===n;break;case"compact":r.compact="true"===n||"1"===n;break;case"inline":r.inline="true"===n||"1"===n;break;case"presets":r.presetsOnly="true"===n||"1"===n;break;case"list":r.listView="true"===n||"1"===n;break;case"sliderMode":r.sliderMode="true"===n||"1"===n;break;case"eyeDropper":r.eyeDropper="true"===n||"1"===n;break;case"inputPreview":r.inputPreview="true"===n||"1"===n}}));!o.format||"hex"!==o.format&&"rgb"!==o.format&&"hsl"!==o.format||(r.format=o.format),void 0!==o.alpha&&(r.showAlpha="true"===o.alpha||"1"===o.alpha),void 0!==o.compact&&(r.compact="true"===o.compact||"1"===o.compact),void 0!==o.inline&&(r.inline="true"===o.inline||"1"===o.inline),void 0!==o.presetsOnly&&(r.presetsOnly="true"===o.presetsOnly||"1"===o.presetsOnly),void 0!==o.listView&&(r.listView="true"===o.listView||"1"===o.listView),o.defaultColor&&(r.defaultColor=o.defaultColor);var i=new n(t,r);e.push(i)}})),e}"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",(function(){return r()})):r()),t.ColorPicker=n,t.default=function(t,e){return new n(t,e)},t.initColorPickers=r,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ /* Pickit Color v1.0.4, @license Donationware */
2
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).colorpicker={})}(this,(function(t){"use strict";function e(t,e,o,n){return new(o||(o=Promise))((function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))}function o(t,e){var o,n,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(o=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,n=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){r.label=a[1];break}if(6===a[0]&&r.label<i[1]){r.label=i[1],i=a;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(a);break}i[2]&&r.ops.pop(),r.trys.pop();continue}a=e.call(t,r)}catch(t){a=[6,t],n=0}finally{o=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}"function"==typeof SuppressedError&&SuppressedError;var n=function(){function t(e,o){var n,i,r,s,a,l,c,u,p,h,d,v,f,y;if(void 0===o&&(o={}),this.container=null,this.colorBox=null,this.hueSlider=null,this.saturationSlider=null,this.lightnessSlider=null,this.alphaSlider=null,this.hexInput=null,this.currentColor={h:0,s:100,l:50,a:1},this.isOpen=!1,this.saturationPointer=null,this.compactButton=null,this.inputPreview=null,this.announceTimeout=null,this.input="string"==typeof e?document.querySelector(e):e,!this.input)throw new Error("ColorPicker: Invalid element selector");var m=this.input.getAttribute("data-preset-colors"),b=m?m.split(",").map((function(t){return t.trim()})):null;this.options={defaultColor:o.defaultColor||"#3b82f6",format:o.format||"hex",showAlpha:null!==(n=o.showAlpha)&&void 0!==n&&n,sliderMode:null!==(i=o.sliderMode)&&void 0!==i&&i,eyeDropper:null!==(r=o.eyeDropper)&&void 0!==r&&r,presetColors:o.presetColors||b||["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899","#000000","#ffffff"],presetLabels:o.presetLabels||[],presetsOnly:null!==(s=o.presetsOnly)&&void 0!==s&&s,listView:null!==(a=o.listView)&&void 0!==a&&a,inline:null!==(l=o.inline)&&void 0!==l&&l,compact:null!==(c=o.compact)&&void 0!==c&&c,inputPreview:null!==(u=o.inputPreview)&&void 0!==u&&u,onChange:o.onChange||function(){},onOpen:o.onOpen||function(){},onClose:o.onClose||function(){},appendTo:o.appendTo||document.body,position:o.position||"auto",closeOnSelect:null===(p=o.closeOnSelect)||void 0===p||p,ariaLabels:{hue:(null===(h=o.ariaLabels)||void 0===h?void 0:h.hue)||"Hue",saturation:(null===(d=o.ariaLabels)||void 0===d?void 0:d.saturation)||"Saturation and Lightness",lightness:(null===(v=o.ariaLabels)||void 0===v?void 0:v.lightness)||"Lightness",alpha:(null===(f=o.ariaLabels)||void 0===f?void 0:f.alpha)||"Alpha",presets:(null===(y=o.ariaLabels)||void 0===y?void 0:y.presets)||"Preset colors"}},this.init(),t.instances.set(this.input,this)}return t.prototype.init=function(){var t=this.input.value||this.options.defaultColor;this.currentColor=this.parseColor(t),this.options.compact&&this.createCompactButton(),this.options.inputPreview&&!this.options.compact&&this.createInputPreview(),this.buildColorPicker(),this.setupEventListeners(),this.updateColorDisplay(),this.options.inline&&this.container&&(this.isOpen=!0,this.container.style.display="block",this.options.onOpen())},t.prototype.buildColorPicker=function(){var t,e=this;this.container=document.createElement("div"),this.container.className="colorpicker-container",this.options.presetsOnly&&this.container.classList.add("colorpicker-presets-only"),this.options.inline&&this.container.classList.add("colorpicker-inline"),this.container.setAttribute("role","dialog"),this.container.setAttribute("aria-label","Color picker"),this.container.style.display="none";var o='\n <div class="colorpicker-content">\n '.concat(this.options.presetsOnly?"":"\n ".concat(this.options.sliderMode?"":'\n <div class="colorpicker-saturation" \n role="slider" \n aria-label="'.concat(this.options.ariaLabels.saturation,'"\n aria-valuemin="0"\n aria-valuemax="100"\n aria-valuenow="').concat(this.currentColor.s,'"\n tabindex="0">\n <div class="colorpicker-saturation-overlay"></div>\n <div class="colorpicker-saturation-pointer" role="presentation"></div>\n </div>\n '),'\n \n <div class="colorpicker-controls">\n <div class="colorpicker-sliders').concat(this.options.sliderMode?" colorpicker-sliders-only":"",'">\n <div class="colorpicker-slider-group">\n <label for="colorpicker-hue">\n <span class="colorpicker-label">').concat(this.options.ariaLabels.hue,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-hue"\n class="colorpicker-slider colorpicker-hue-slider"\n min="0" \n max="360" \n value="').concat(this.currentColor.h,'"\n aria-label="').concat(this.options.ariaLabels.hue,'"\n tabindex="0"\n />\n </div>\n ').concat(this.options.sliderMode?'\n <div class="colorpicker-slider-group">\n <label for="colorpicker-saturation">\n <span class="colorpicker-label">'.concat(this.options.ariaLabels.saturation,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-saturation"\n class="colorpicker-slider colorpicker-saturation-slider"\n min="0" \n max="100" \n value="').concat(this.currentColor.s,'"\n aria-label="').concat(this.options.ariaLabels.saturation,'"\n tabindex="0"\n />\n </div>\n <div class="colorpicker-slider-group">\n <label for="colorpicker-lightness">\n <span class="colorpicker-label">').concat(this.options.ariaLabels.lightness,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-lightness"\n class="colorpicker-slider colorpicker-lightness-slider"\n min="0" \n max="100" \n value="').concat(this.currentColor.l,'"\n aria-label="').concat(this.options.ariaLabels.lightness,'"\n tabindex="0"\n />\n </div>\n '):"","\n ").concat(this.options.showAlpha?'\n <div class="colorpicker-slider-group">\n <label for="colorpicker-alpha">\n <span class="colorpicker-label">'.concat(this.options.ariaLabels.alpha,'</span>\n </label>\n <input \n type="range" \n id="colorpicker-alpha"\n class="colorpicker-slider colorpicker-alpha-slider"\n min="0" \n max="100" \n value="').concat(100*this.currentColor.a,'"\n aria-label="').concat(this.options.ariaLabels.alpha,'"\n tabindex="0"\n />\n </div>\n '):"",'\n </div>\n \n <div class="colorpicker-preview">\n <div class="colorpicker-preview-color" role="presentation"></div>\n </div>\n </div>\n \n <div class="colorpicker-input-wrapper">\n <label for="colorpicker-hex">\n <span class="colorpicker-sr-only">Color value</span>\n </label>\n <div class="colorpicker-input-row">\n <input \n type="text" \n id="colorpicker-hex"\n class="colorpicker-input"\n placeholder="').concat(this.getPlaceholder(),'"\n aria-label="Color value in ').concat(this.options.format,' format"\n />\n ').concat(this.options.eyeDropper?"\n ".concat(this.supportsEyeDropper()?'\n <button \n type="button"\n class="colorpicker-eyedropper-btn"\n aria-label="Pick color from screen"\n title="Pick color from screen"\n >\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M2 22l1-1"/>\n <path d="M8.5 16.5l-1-1"/>\n <path d="M17 3l4 4"/>\n <path d="M12 8l4 4"/>\n <path d="M3 21l9-9"/>\n <path d="M14.5 9.5l-1 1"/>\n <path d="M20 14l-8 8"/>\n </svg>\n </button>\n ':"",'\n <button \n type="button"\n class="colorpicker-system-picker-btn"\n aria-label="Open system color picker"\n title="Open system color picker"\n >\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <circle cx="12" cy="12" r="10"/>\n <path d="M12 2v20"/>\n <path d="M2 12h20"/>\n <circle cx="12" cy="12" r="3"/>\n </svg>\n </button>\n <input \n type="color"\n class="colorpicker-system-picker-input"\n style="position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;"\n />\n '):"","\n </div>\n </div>\n "),"\n \n ").concat(this.options.presetColors.length>0?'\n <div class="colorpicker-presets'.concat(this.options.listView?" colorpicker-presets-list":"",'" role="group" aria-label="').concat(this.options.ariaLabels.presets,'">\n ').concat(this.options.presetColors.map((function(t,o){var n=e.options.presetLabels[o]||"";return e.options.listView&&n?'\n <button \n type="button"\n class="colorpicker-preset colorpicker-preset-list-item" \n data-color="'.concat(t,'"\n aria-label="Select color ').concat(n,'"\n tabindex="').concat(0===o?"0":"-1",'"\n >\n <span class="colorpicker-preset-color" style="background-color: ').concat(t,'"></span>\n <span class="colorpicker-preset-label">').concat(n,"</span>\n </button>\n "):'\n <button \n type="button"\n class="colorpicker-preset" \n style="background-color: '.concat(t,'"\n data-color="').concat(t,'"\n aria-label="Select color ').concat(n||t,'"\n tabindex="').concat(0===o?"0":"-1",'"\n ></button>\n ')})).join(""),"\n </div>\n "):"","\n </div>\n ");this.container.innerHTML=o,this.colorBox=this.container.querySelector(".colorpicker-saturation"),this.saturationPointer=this.container.querySelector(".colorpicker-saturation-pointer"),this.hueSlider=this.container.querySelector(".colorpicker-hue-slider"),this.saturationSlider=this.container.querySelector(".colorpicker-saturation-slider"),this.lightnessSlider=this.container.querySelector(".colorpicker-lightness-slider"),this.alphaSlider=this.container.querySelector(".colorpicker-alpha-slider"),this.hexInput=this.container.querySelector(".colorpicker-input"),this.options.inline?(null===(t=this.input.parentNode)||void 0===t||t.insertBefore(this.container,this.input.nextSibling),this.input.style.display="none"):this.options.appendTo.appendChild(this.container)},t.prototype.createCompactButton=function(){var t,e=this;this.input.style.position="absolute",this.input.style.opacity="0",this.input.style.pointerEvents="none",this.input.style.width="0",this.input.style.height="0",this.compactButton=document.createElement("button"),this.compactButton.type="button",this.compactButton.className="colorpicker-compact-button",this.compactButton.setAttribute("aria-label","Select color"),this.compactButton.tabIndex=0;var o=document.createElement("span");o.className="colorpicker-compact-preview",o.style.backgroundColor=this.input.value||this.options.defaultColor,this.compactButton.appendChild(o),null===(t=this.input.parentNode)||void 0===t||t.insertBefore(this.compactButton,this.input.nextSibling),this.compactButton.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation(),e.toggle()})),this.compactButton.addEventListener("keydown",(function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e.toggle())}))},t.prototype.createInputPreview=function(){var t,e=document.createElement("div");e.className="colorpicker-input-group",this.inputPreview=document.createElement("span"),this.inputPreview.className="colorpicker-input-preview",this.inputPreview.style.backgroundColor=this.input.value||this.options.defaultColor,null===(t=this.input.parentNode)||void 0===t||t.insertBefore(e,this.input),e.appendChild(this.inputPreview),e.appendChild(this.input),this.input.classList.add("colorpicker-has-preview")},t.prototype.supportsEyeDropper=function(){return"undefined"!=typeof window&&"EyeDropper"in window},t.prototype.openEyeDropper=function(){return e(this,void 0,Promise,(function(){var t,e;return o(this,(function(o){switch(o.label){case 0:if(!this.supportsEyeDropper())return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,(new EyeDropper).open()];case 2:return(t=o.sent()).sRGBHex&&(this.currentColor=this.parseColor(t.sRGBHex),this.input.value=t.sRGBHex,this.updateColorDisplay(),this.options.onChange(t.sRGBHex)),[3,4];case 3:return"AbortError"!==(e=o.sent()).name&&console.error("EyeDropper error:",e),[3,4];case 4:return[2]}}))}))},t.prototype.setupEventListeners=function(){var t,n,i,r,s=this;this.options.compact||(this.input.addEventListener("click",(function(){s.options.inline||s.toggle()})),this.input.addEventListener("keydown",(function(t){"Enter"!==t.key&&" "!==t.key||s.options.inline||(t.preventDefault(),s.toggle())}))),this.input.addEventListener("change",(function(){s.currentColor=s.parseColor(s.input.value),s.updateColorDisplay()})),this.hueSlider&&(this.hueSlider.addEventListener("input",(function(t){s.currentColor.h=parseInt(t.target.value),s.updateColorDisplay(),s.announceColorChange()})),this.hueSlider.addEventListener("touchstart",(function(t){s.handleSliderTouch(t,s.hueSlider,"h",0,360)}))),this.saturationSlider&&(this.saturationSlider.addEventListener("input",(function(t){s.currentColor.s=parseInt(t.target.value),s.updateColorDisplay(),s.announceColorChange()})),this.saturationSlider.addEventListener("touchstart",(function(t){s.handleSliderTouch(t,s.saturationSlider,"s",0,100)}))),this.lightnessSlider&&(this.lightnessSlider.addEventListener("input",(function(t){s.currentColor.l=parseInt(t.target.value),s.updateColorDisplay(),s.announceColorChange()})),this.lightnessSlider.addEventListener("touchstart",(function(t){s.handleSliderTouch(t,s.lightnessSlider,"l",0,100)}))),this.alphaSlider&&(this.alphaSlider.addEventListener("input",(function(t){s.currentColor.a=parseInt(t.target.value)/100,s.updateColorDisplay(),s.announceColorChange()})),this.alphaSlider.addEventListener("touchstart",(function(t){s.handleSliderTouch(t,s.alphaSlider,"a",0,100,!0)}))),this.colorBox&&(this.colorBox.addEventListener("mousedown",(function(t){return s.onSaturationMouseDown(t)})),this.colorBox.addEventListener("touchstart",(function(t){return s.onSaturationTouchStart(t)})),this.colorBox.addEventListener("keydown",(function(t){return s.onSaturationKeyDown(t)}))),this.hexInput&&this.hexInput.addEventListener("input",(function(t){var e=t.target.value.trim();s.isValidColor(e)&&(s.currentColor=s.parseColor(e),s.updateColorDisplay(!1))}));var a=null===(t=this.container)||void 0===t?void 0:t.querySelectorAll(".colorpicker-preset");a&&a.length>0&&a.forEach((function(t,e){t.addEventListener("click",(function(t){var e=t.currentTarget.dataset.color;s.currentColor=s.parseColor(e),s.updateColorDisplay(),s.options.closeOnSelect&&s.close()})),t.addEventListener("keydown",(function(t){var o=t.key,n=!1,i=e;switch(o){case"ArrowRight":case"ArrowDown":i=Math.min(a.length-1,e+1),n=!0;break;case"ArrowLeft":case"ArrowUp":i=Math.max(0,e-1),n=!0;break;case"Home":i=0,n=!0;break;case"End":i=a.length-1,n=!0;break;case"Enter":case" ":var r=t.currentTarget.dataset.color;s.currentColor=s.parseColor(r),s.updateColorDisplay(),s.options.closeOnSelect&&s.close(),n=!0}n&&(t.preventDefault(),i!==e&&(a.forEach((function(t,e){t.setAttribute("tabindex",e===i?"0":"-1")})),a[i].focus()))}))}));var l=null===(n=this.container)||void 0===n?void 0:n.querySelector(".colorpicker-eyedropper-btn");l&&l.addEventListener("click",(function(t){return e(s,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t.preventDefault(),t.stopPropagation(),[4,this.openEyeDropper()];case 1:return e.sent(),[2]}}))}))}));var c=null===(i=this.container)||void 0===i?void 0:i.querySelector(".colorpicker-system-picker-btn"),u=null===(r=this.container)||void 0===r?void 0:r.querySelector(".colorpicker-system-picker-input");c&&u&&(u.value=this.formatColor(this.currentColor).substring(0,7),c.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation(),u.click()})),u.addEventListener("change",(function(){var t=u.value;s.currentColor=s.parseColor(t),s.input.value=t,s.updateColorDisplay(),s.options.onChange(t)}))),this.options.inline||document.addEventListener("mousedown",(function(t){var e;s.isOpen&&!(null===(e=s.container)||void 0===e?void 0:e.contains(t.target))&&t.target!==s.input&&s.close()})),document.addEventListener("keydown",(function(t){"Escape"===t.key&&s.isOpen&&!s.options.inline&&(s.close(),s.input.focus())}))},t.prototype.onSaturationMouseDown=function(t){var e=this;t.preventDefault(),this.updateSaturationFromMouse(t);var o=function(t){e.updateSaturationFromMouse(t)},n=function(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",n)},t.prototype.onSaturationTouchStart=function(t){var e=this;t.preventDefault();var o=t.touches[0];this.updateSaturationFromTouch(o);var n=function(t){t.preventDefault();var o=t.touches[0];e.updateSaturationFromTouch(o)},i=function(){document.removeEventListener("touchmove",n),document.removeEventListener("touchend",i)};document.addEventListener("touchmove",n,{passive:!1}),document.addEventListener("touchend",i)},t.prototype.updateSaturationFromTouch=function(t){if(this.colorBox){var e=this.colorBox.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientX-e.left,e.width)),n=Math.max(0,Math.min(t.clientY-e.top,e.height));this.currentColor.s=o/e.width*100,this.currentColor.l=100-n/e.height*100,this.updateColorDisplay(),this.announceColorChange()}},t.prototype.handleSliderTouch=function(t,e,o,n,i,r){var s=this;void 0===r&&(r=!1);var a=function(t){var a=e.getBoundingClientRect(),l=Math.max(0,Math.min(t.clientX-a.left,a.width))/a.width,c=n+l*(i-n);s.currentColor[o]=r?c/100:Math.round(c),e.value=String(Math.round(c)),s.updateColorDisplay(),s.announceColorChange()},l=t.touches[0];a(l);var c=function(t){t.preventDefault();var e=t.touches[0];a(e)},u=function(){document.removeEventListener("touchmove",c),document.removeEventListener("touchend",u)};document.addEventListener("touchmove",c,{passive:!1}),document.addEventListener("touchend",u)},t.prototype.updateSaturationFromMouse=function(t){if(this.colorBox){var e=this.colorBox.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientX-e.left,e.width)),n=Math.max(0,Math.min(t.clientY-e.top,e.height));this.currentColor.s=o/e.width*100,this.currentColor.l=100-n/e.height*100,this.updateColorDisplay(),this.announceColorChange()}},t.prototype.onSaturationKeyDown=function(t){var e=t.shiftKey?10:1,o=!1;switch(t.key){case"ArrowRight":this.currentColor.s=Math.min(100,this.currentColor.s+e),o=!0;break;case"ArrowLeft":this.currentColor.s=Math.max(0,this.currentColor.s-e),o=!0;break;case"ArrowUp":this.currentColor.l=Math.min(100,this.currentColor.l+e),o=!0;break;case"ArrowDown":this.currentColor.l=Math.max(0,this.currentColor.l-e),o=!0}o&&(t.preventDefault(),this.updateColorDisplay(),this.announceColorChange())},t.prototype.updateColorDisplay=function(t){var e;if(void 0===t&&(t=!0),this.colorBox&&(this.colorBox.style.backgroundColor="hsl(".concat(this.currentColor.h,", 100%, 50%)")),this.saturationPointer&&this.colorBox){var o=this.currentColor.s/100*100,n=100*(1-this.currentColor.l/100);this.saturationPointer.style.left="".concat(o,"%"),this.saturationPointer.style.top="".concat(n,"%")}this.saturationSlider&&(this.saturationSlider.style.background="linear-gradient(to right, hsl(".concat(this.currentColor.h,", 0%, 50%), hsl(").concat(this.currentColor.h,", 100%, 50%))")),this.lightnessSlider&&(this.lightnessSlider.style.background="linear-gradient(to right, hsl(".concat(this.currentColor.h,", ").concat(this.currentColor.s,"%, 0%), hsl(").concat(this.currentColor.h,", ").concat(this.currentColor.s,"%, 50%), hsl(").concat(this.currentColor.h,", ").concat(this.currentColor.s,"%, 100%))"));var i=null===(e=this.container)||void 0===e?void 0:e.querySelector(".colorpicker-preview-color");if(i&&(i.style.backgroundColor=this.toHSLString(this.currentColor)),this.hexInput&&t&&(this.hexInput.value=this.formatColor(this.currentColor)),this.hueSlider&&(this.hueSlider.value=String(this.currentColor.h)),this.saturationSlider&&(this.saturationSlider.value=String(this.currentColor.s)),this.lightnessSlider&&(this.lightnessSlider.value=String(this.currentColor.l)),this.alphaSlider&&(this.alphaSlider.value=String(100*this.currentColor.a)),t){if(this.input.value=this.formatColor(this.currentColor),this.options.onChange(this.input.value),this.compactButton){var r=this.compactButton.querySelector(".colorpicker-compact-preview");r&&(r.style.backgroundColor=this.toHSLString(this.currentColor))}this.inputPreview&&(this.inputPreview.style.backgroundColor=this.toHSLString(this.currentColor))}},t.prototype.formatColor=function(t){switch(this.options.format){case"hsl":return this.toHSLString(t);case"rgb":return this.toRGBString(this.hslToRgb(t));case"hex":default:return this.toHex(t)}},t.prototype.getPlaceholder=function(){switch(this.options.format){case"hsl":return this.options.showAlpha?"hsla(0, 0%, 0%, 1)":"hsl(0, 0%, 0%)";case"rgb":return this.options.showAlpha?"rgba(0, 0, 0, 1)":"rgb(0, 0, 0)";case"hex":default:return"#000000"}},t.prototype.parseColor=function(t){if((t=t.trim()).startsWith("#"))return this.hexToHsl(t);var e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(e){var o={r:parseInt(e[1]),g:parseInt(e[2]),b:parseInt(e[3]),a:e[4]?parseFloat(e[4]):1};return this.rgbToHsl(o)}var n=t.match(/hsla?\((\d+),\s*(\d+)%,\s*(\d+)%(?:,\s*([\d.]+))?\)/);return n?{h:parseInt(n[1]),s:parseInt(n[2]),l:parseInt(n[3]),a:n[4]?parseFloat(n[4]):1}:this.currentColor},t.prototype.hexToHsl=function(t){t=t.replace("#","");var e=parseInt(t.substring(0,2),16)/255,o=parseInt(t.substring(2,4),16)/255,n=parseInt(t.substring(4,6),16)/255,i=8===t.length?parseInt(t.substring(6,8),16)/255:1;return this.rgbToHsl({r:255*e,g:255*o,b:255*n,a:i})},t.prototype.rgbToHsl=function(t){var e=t.r/255,o=t.g/255,n=t.b/255,i=Math.max(e,o,n),r=Math.min(e,o,n),s=0,a=0,l=(i+r)/2;if(i!==r){var c=i-r;switch(a=l>.5?c/(2-i-r):c/(i+r),i){case e:s=((o-n)/c+(o<n?6:0))/6;break;case o:s=((n-e)/c+2)/6;break;case n:s=((e-o)/c+4)/6}}return{h:Math.round(360*s),s:Math.round(100*a),l:Math.round(100*l),a:t.a}},t.prototype.hslToRgb=function(t){var e,o,n,i=t.h/360,r=t.s/100,s=t.l/100;if(0===r)e=o=n=s;else{var a=function(t,e,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t},l=s<.5?s*(1+r):s+r-s*r,c=2*s-l;e=a(c,l,i+1/3),o=a(c,l,i),n=a(c,l,i-1/3)}return{r:Math.round(255*e),g:Math.round(255*o),b:Math.round(255*n),a:t.a}},t.prototype.toHex=function(t){var e=this.hslToRgb(t),o=function(t){return t.toString(16).padStart(2,"0")};if(this.options.showAlpha&&t.a<1){var n=Math.round(255*t.a);return"#".concat(o(e.r)).concat(o(e.g)).concat(o(e.b)).concat(o(n))}return"#".concat(o(e.r)).concat(o(e.g)).concat(o(e.b))},t.prototype.toHSLString=function(t){return this.options.showAlpha&&t.a<1?"hsla(".concat(t.h,", ").concat(t.s,"%, ").concat(t.l,"%, ").concat(t.a,")"):"hsl(".concat(t.h,", ").concat(t.s,"%, ").concat(t.l,"%)")},t.prototype.toRGBString=function(t){return this.options.showAlpha&&t.a<1?"rgba(".concat(t.r,", ").concat(t.g,", ").concat(t.b,", ").concat(t.a,")"):"rgb(".concat(t.r,", ").concat(t.g,", ").concat(t.b,")")},t.prototype.isValidHex=function(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(t)},t.prototype.isValidColor=function(t){return!!this.isValidHex(t)||(!!/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+\s*)?\)$/.test(t)||!!/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+\s*)?\)$/.test(t))},t.prototype.announceColorChange=function(){var t=this;this.announceTimeout||(this.announceTimeout=setTimeout((function(){var e,o=document.createElement("div");o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),o.className="colorpicker-sr-only",o.textContent="Color changed to ".concat(t.formatColor(t.currentColor)),null===(e=t.container)||void 0===e||e.appendChild(o),setTimeout((function(){return o.remove()}),1e3),t.announceTimeout=null}),500))},t.prototype.open=function(){var t=this;!this.isOpen&&this.container&&(this.isOpen=!0,this.container.style.display="block",this.options.inline||this.positionPicker(),this.options.onOpen(),this.options.inline||setTimeout((function(){var e,o=null;(o=t.options.presetsOnly?null===(e=t.container)||void 0===e?void 0:e.querySelector(".colorpicker-preset"):t.options.sliderMode?t.hueSlider:t.colorBox)&&o.focus()}),0))},t.prototype.close=function(){this.isOpen&&this.container&&(this.isOpen=!1,this.options.inline||(this.container.style.display="none"),this.options.onClose())},t.prototype.toggle=function(){this.isOpen?this.close():this.open()},t.prototype.positionPicker=function(){if(this.container){var t=this.input.getBoundingClientRect(),e=this.container.getBoundingClientRect(),o=window.innerHeight,n=t.bottom+window.scrollY+4,i=t.left+window.scrollX;if("auto"===this.options.position){var r=o-t.bottom,s=t.top;r<e.height&&s>r&&(n=t.top+window.scrollY-e.height-4)}else"above"===this.options.position&&(n=t.top+window.scrollY-e.height-4);this.container.style.position="absolute",this.container.style.top="".concat(n,"px"),this.container.style.left="".concat(i,"px"),this.container.style.zIndex="9999"}},t.prototype.setColor=function(t){this.currentColor=this.parseColor(t),this.updateColorDisplay()},t.prototype.getColor=function(){return this.formatColor(this.currentColor)},t.prototype.destroy=function(){var e,o,n;if(null===(e=this.container)||void 0===e||e.remove(),null===(o=this.compactButton)||void 0===o||o.remove(),this.options.compact&&this.input&&(this.input.style.position="",this.input.style.opacity="",this.input.style.pointerEvents="",this.input.style.width="",this.input.style.height=""),this.options.inputPreview&&this.input){this.input.classList.remove("colorpicker-has-preview");var i=this.input.parentElement;i&&i.classList.contains("colorpicker-input-group")&&(null===(n=i.parentNode)||void 0===n||n.insertBefore(this.input,i),i.remove())}t.instances.delete(this.input)},t.getInstance=function(e){return t.instances.get(e)},t.instances=new Map,t}();function i(t){void 0===t&&(t=document);var e=[];return t.querySelectorAll('[data-colorpicker], .colorpicker, input[type="color"][data-format]').forEach((function(t){if(!n.getInstance(t)){var o=t.dataset,i={};if(o.colorpicker)o.colorpicker.split(/[,;]/).forEach((function(t){var e=t.split(":").map((function(t){return t.trim()})),o=e[0],n=e[1];switch(o){case"format":"hex"!==n&&"rgb"!==n&&"hsl"!==n||(i.format=n);break;case"alpha":case"showAlpha":i.showAlpha="true"===n||"1"===n;break;case"compact":i.compact="true"===n||"1"===n;break;case"inline":i.inline="true"===n||"1"===n;break;case"presets":i.presetsOnly="true"===n||"1"===n;break;case"list":i.listView="true"===n||"1"===n;break;case"sliderMode":i.sliderMode="true"===n||"1"===n;break;case"eyeDropper":i.eyeDropper="true"===n||"1"===n;break;case"inputPreview":i.inputPreview="true"===n||"1"===n}}));!o.format||"hex"!==o.format&&"rgb"!==o.format&&"hsl"!==o.format||(i.format=o.format),void 0!==o.alpha&&(i.showAlpha="true"===o.alpha||"1"===o.alpha),void 0!==o.compact&&(i.compact="true"===o.compact||"1"===o.compact),void 0!==o.inline&&(i.inline="true"===o.inline||"1"===o.inline),void 0!==o.presetsOnly&&(i.presetsOnly="true"===o.presetsOnly||"1"===o.presetsOnly),void 0!==o.listView&&(i.listView="true"===o.listView||"1"===o.listView),o.defaultColor&&(i.defaultColor=o.defaultColor);var r=new n(t,i);e.push(r)}})),e}"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",(function(){return i()})):i()),t.ColorPicker=n,t.default=function(t,e){return new n(t,e)},t.initColorPickers=i,Object.defineProperty(t,"__esModule",{value:!0})}));
package/dist/esm/index.js CHANGED
@@ -111,8 +111,10 @@ var ColorPicker = (function () {
111
111
  this.buildColorPicker();
112
112
  this.setupEventListeners();
113
113
  this.updateColorDisplay();
114
- if (this.options.inline) {
115
- this.open();
114
+ if (this.options.inline && this.container) {
115
+ this.isOpen = true;
116
+ this.container.style.display = "block";
117
+ this.options.onOpen();
116
118
  }
117
119
  };
118
120
  ColorPicker.prototype.buildColorPicker = function () {
@@ -267,6 +269,9 @@ var ColorPicker = (function () {
267
269
  _this.updateColorDisplay();
268
270
  _this.announceColorChange();
269
271
  });
272
+ this.hueSlider.addEventListener("touchstart", function (e) {
273
+ _this.handleSliderTouch(e, _this.hueSlider, 'h', 0, 360);
274
+ });
270
275
  }
271
276
  if (this.saturationSlider) {
272
277
  this.saturationSlider.addEventListener("input", function (e) {
@@ -274,6 +279,9 @@ var ColorPicker = (function () {
274
279
  _this.updateColorDisplay();
275
280
  _this.announceColorChange();
276
281
  });
282
+ this.saturationSlider.addEventListener("touchstart", function (e) {
283
+ _this.handleSliderTouch(e, _this.saturationSlider, 's', 0, 100);
284
+ });
277
285
  }
278
286
  if (this.lightnessSlider) {
279
287
  this.lightnessSlider.addEventListener("input", function (e) {
@@ -281,6 +289,9 @@ var ColorPicker = (function () {
281
289
  _this.updateColorDisplay();
282
290
  _this.announceColorChange();
283
291
  });
292
+ this.lightnessSlider.addEventListener("touchstart", function (e) {
293
+ _this.handleSliderTouch(e, _this.lightnessSlider, 'l', 0, 100);
294
+ });
284
295
  }
285
296
  if (this.alphaSlider) {
286
297
  this.alphaSlider.addEventListener("input", function (e) {
@@ -289,11 +300,17 @@ var ColorPicker = (function () {
289
300
  _this.updateColorDisplay();
290
301
  _this.announceColorChange();
291
302
  });
303
+ this.alphaSlider.addEventListener("touchstart", function (e) {
304
+ _this.handleSliderTouch(e, _this.alphaSlider, 'a', 0, 100, true);
305
+ });
292
306
  }
293
307
  if (this.colorBox) {
294
308
  this.colorBox.addEventListener("mousedown", function (e) {
295
309
  return _this.onSaturationMouseDown(e);
296
310
  });
311
+ this.colorBox.addEventListener("touchstart", function (e) {
312
+ return _this.onSaturationTouchStart(e);
313
+ });
297
314
  this.colorBox.addEventListener("keydown", function (e) {
298
315
  return _this.onSaturationKeyDown(e);
299
316
  });
@@ -428,6 +445,66 @@ var ColorPicker = (function () {
428
445
  document.addEventListener("mousemove", onMouseMove);
429
446
  document.addEventListener("mouseup", onMouseUp);
430
447
  };
448
+ ColorPicker.prototype.onSaturationTouchStart = function (e) {
449
+ var _this = this;
450
+ e.preventDefault();
451
+ var touch = e.touches[0];
452
+ this.updateSaturationFromTouch(touch);
453
+ var onTouchMove = function (e) {
454
+ e.preventDefault();
455
+ var touch = e.touches[0];
456
+ _this.updateSaturationFromTouch(touch);
457
+ };
458
+ var onTouchEnd = function () {
459
+ document.removeEventListener("touchmove", onTouchMove);
460
+ document.removeEventListener("touchend", onTouchEnd);
461
+ };
462
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
463
+ document.addEventListener("touchend", onTouchEnd);
464
+ };
465
+ ColorPicker.prototype.updateSaturationFromTouch = function (touch) {
466
+ if (!this.colorBox)
467
+ return;
468
+ var rect = this.colorBox.getBoundingClientRect();
469
+ var x = Math.max(0, Math.min(touch.clientX - rect.left, rect.width));
470
+ var y = Math.max(0, Math.min(touch.clientY - rect.top, rect.height));
471
+ this.currentColor.s = (x / rect.width) * 100;
472
+ this.currentColor.l = 100 - (y / rect.height) * 100;
473
+ this.updateColorDisplay();
474
+ this.announceColorChange();
475
+ };
476
+ ColorPicker.prototype.handleSliderTouch = function (e, slider, property, min, max, isAlpha) {
477
+ var _this = this;
478
+ if (isAlpha === void 0) { isAlpha = false; }
479
+ var updateFromTouch = function (touch) {
480
+ var rect = slider.getBoundingClientRect();
481
+ var x = Math.max(0, Math.min(touch.clientX - rect.left, rect.width));
482
+ var ratio = x / rect.width;
483
+ var value = min + ratio * (max - min);
484
+ if (isAlpha) {
485
+ _this.currentColor[property] = value / 100;
486
+ }
487
+ else {
488
+ _this.currentColor[property] = Math.round(value);
489
+ }
490
+ slider.value = String(Math.round(value));
491
+ _this.updateColorDisplay();
492
+ _this.announceColorChange();
493
+ };
494
+ var touch = e.touches[0];
495
+ updateFromTouch(touch);
496
+ var onTouchMove = function (e) {
497
+ e.preventDefault();
498
+ var touch = e.touches[0];
499
+ updateFromTouch(touch);
500
+ };
501
+ var onTouchEnd = function () {
502
+ document.removeEventListener("touchmove", onTouchMove);
503
+ document.removeEventListener("touchend", onTouchEnd);
504
+ };
505
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
506
+ document.addEventListener("touchend", onTouchEnd);
507
+ };
431
508
  ColorPicker.prototype.updateSaturationFromMouse = function (e) {
432
509
  if (!this.colorBox)
433
510
  return;
@@ -698,22 +775,24 @@ var ColorPicker = (function () {
698
775
  this.positionPicker();
699
776
  }
700
777
  this.options.onOpen();
701
- setTimeout(function () {
702
- var _a;
703
- var focusTarget = null;
704
- if (_this.options.presetsOnly) {
705
- focusTarget = (_a = _this.container) === null || _a === void 0 ? void 0 : _a.querySelector('.colorpicker-preset');
706
- }
707
- else if (_this.options.sliderMode) {
708
- focusTarget = _this.hueSlider;
709
- }
710
- else {
711
- focusTarget = _this.colorBox;
712
- }
713
- if (focusTarget) {
714
- focusTarget.focus();
715
- }
716
- }, 0);
778
+ if (!this.options.inline) {
779
+ setTimeout(function () {
780
+ var _a;
781
+ var focusTarget = null;
782
+ if (_this.options.presetsOnly) {
783
+ focusTarget = (_a = _this.container) === null || _a === void 0 ? void 0 : _a.querySelector('.colorpicker-preset');
784
+ }
785
+ else if (_this.options.sliderMode) {
786
+ focusTarget = _this.hueSlider;
787
+ }
788
+ else {
789
+ focusTarget = _this.colorBox;
790
+ }
791
+ if (focusTarget) {
792
+ focusTarget.focus();
793
+ }
794
+ }, 0);
795
+ }
717
796
  };
718
797
  ColorPicker.prototype.close = function () {
719
798
  if (!this.isOpen || !this.container)
@@ -1 +1 @@
1
- {"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../src/colorpicker.d.ts","../../src/index.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/ts3.4/base.d.ts","../../node_modules/@types/node/globals.global.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/ts3.6/base.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/base.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/@types/stylus/index.d.ts"],"fileIdsList":[[80,81],[48,49,56,65],[40,48,56],[72],[44,49,57],[65],[46,48,56],[48],[48,50,65,71],[49],[56,65,71],[48,49,51,56,65,68,71],[48,51,68,71],[82],[71],[46,48,65],[38],[70],[48,65],[63,72,74],[44,46,56,65],[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76],[77,78,79],[56],[62],[48,50,65,71,74],[48,83]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"e7662e79ae21b1f16ea6bd668b238d79a7f4337f5ad95de573356bfa086275f8","64c91f3dca4624f2fc50937da74ff1ecbc4fccef580ce082f05e8d0bf8868f26",{"version":"215d8d9a2c480fd460127edc048d68d9931d3b27f95132253a6e71975f060bb1","affectsGlobalScope":true,"impliedFormat":1},{"version":"c438b413e94ff76dfa20ae005f33a1c84f2480d1d66e0fd687501020d0de9b50","impliedFormat":1},{"version":"bc6a78961535181265845bf9b9e8a147ffd0ca275097ceb670a9b92afa825152","impliedFormat":1},{"version":"987249e7b75023387c5fd9dc2f959ee777cb8989b7900f5a9eb4a67d290f2cba","impliedFormat":1},{"version":"123ec69e4b3a686eb49afd94ebe3292a5c84a867ecbcb6bb84bdd720a12af803","impliedFormat":1},{"version":"eb5197aade83cb0e360ac407289c53a8009e8fdae7939892a0240d30444496b6","affectsGlobalScope":true,"impliedFormat":1},{"version":"90c85ddbb8de82cd19198bda062065fc51b7407c0f206f2e399e65a52e979720","impliedFormat":1},{"version":"2636f61a2d5f76d4039c7110f65c407a028ec5265e03d855fc2cf62b198ac415","impliedFormat":1},{"version":"7e050b767ed10c7ffbc01f314defbf420bf0b5d54ce666e1c87507c035dfc191","impliedFormat":1},{"version":"7db7569fbb3e2b01ba8751c761cdd3f0debd104170d5665b7dc20a11630df3a9","impliedFormat":1},{"version":"cde4d7f6274468180fa39847b183aec22626e8212ff885d535c53f4cd7c225fd","affectsGlobalScope":true,"impliedFormat":1},{"version":"365e8358843a23944be84b810b1f774ea0223adfccc085f30fd7f4c13dc8a09f","affectsGlobalScope":true,"impliedFormat":1},{"version":"f87f95c015900102a5c0edcdebb17596de1382510e6cc17ab79f375d3505bb12","impliedFormat":1},{"version":"05b5679a897598ebe556ee93415b3af1f456e674ea82e4d7afcd716bfe43aa98","impliedFormat":1},{"version":"35fe02b2c10616cc7ac3db9c15778df7ed9c99276889efdd9be31f342841cfcd","impliedFormat":1},{"version":"1c3fe66943f587685aa4a42f664f794655da1767401d2f85910177dac78aa45d","impliedFormat":1},{"version":"c969bf4c7cdfe4d5dd28aa09432f99d09ad1d8d8b839959646579521d0467d1a","impliedFormat":1},{"version":"6c3857edaeeaaf43812f527830ebeece9266b6e8eb5271ab6d2f0008306c9947","impliedFormat":1},{"version":"bc6a77e750f4d34584e46b1405b771fb69a224197dd6bafe5b0392a29a70b665","impliedFormat":1},{"version":"8de97668870cfb20fc9d355d2ef379e897bdd8a98c889c7d8a6de40ee408ad52","impliedFormat":1},{"version":"ed4ae81196cccc10f297d228bca8d02e31058e6d723a3c5bc4be5fb3c61c6a34","impliedFormat":1},{"version":"84044697c8b3e08ef24e4b32cfe6440143d07e469a5e34bda0635276d32d9f35","impliedFormat":1},{"version":"4982d94cb6427263c8839d8d6324a8bbe129e931deb61a7380f8fad17ba2cfc0","impliedFormat":1},{"version":"ae4bc1dd4d9de7bbea6ce419db45af82a81358e6014c9e1235b5d252e06f8ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f6a1fd73c9dc3bd7f4b79bc075297ca6527904df69b0f2c2c94e4c4c7d9a32c","impliedFormat":1},{"version":"884560fda6c3868f925f022adc3a1289fe6507bbb45adb10fa1bbcc73a941bb0","impliedFormat":1},{"version":"6b2bb67b0942bcfce93e1d6fad5f70afd54940a2b13df7f311201fba54b2cbe9","impliedFormat":1},{"version":"acbed967a379b3e9f73237ba9473f8b337eeea14b7dc64d445430b5d695751da","impliedFormat":1},{"version":"272a46cc8f494677af587d17939e61e7db2b1925633e4da0c186ba17f6732521","impliedFormat":1},{"version":"d67e08745494b000da9410c1ae2fdc9965fc6d593fe0f381a47491f75417d457","impliedFormat":1},{"version":"b40652bf8ce4a18133b31349086523b219724dca8df3448c1a0742528e7ad5b9","impliedFormat":1},{"version":"c52eb62e3388a01b966c57bd14ca0ee9d5f6e656d6a18f6ce6b7cdece63734a3","impliedFormat":1},{"version":"a77fdb357c78b70142b2fdbbfb72958d69e8f765fd2a3c69946c1018e89d4638","impliedFormat":1},{"version":"3c2ac350c3baa61fd2b1925844109e098f4376d0768a4643abc82754fd752748","impliedFormat":1},{"version":"80ffc1786a5dab91b4aa59a72720f02f25df8b7c76b593e04d5e381aec284ccb","impliedFormat":1},{"version":"f5b9d446783f075eed9e93dfba1a5055b3fd61aab285fef3bbc761eadf598204","impliedFormat":1},{"version":"289be113bad7ee27ee7fa5b1e373c964c9789a5e9ed7db5ddcb631371120b953","impliedFormat":1},{"version":"baf0b82ffc5d2616f44a6fb1f81e8d798545bebf0c30f5d8b003a1dba1acfb3f","impliedFormat":1},{"version":"c6a5b34f1e725019445754f1e733585f113e0dced75f137bd3c4af5853d3f6ab","impliedFormat":1},{"version":"15fbe50526244954eb2f933546bca6cdcf0db16c9428d099b3b386c1db5799ab","impliedFormat":1},{"version":"d44028ae0127eb3e9fcfa5f55a8b81d64775ce15aca1020fe25c511bbb055834","impliedFormat":1},{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true,"impliedFormat":1},{"version":"4e0a4d84b15692ea8669fe4f3d05a4f204567906b1347da7a58b75f45bae48d3","impliedFormat":1},{"version":"ad1ae5ae98eceb9af99061e83e867b9897d267aebc8f3b938c9424deabadf4bb","impliedFormat":1},{"version":"6fbe72eed85e363ad83b763e03be824558c6ea7456c7259a48bcf0afdeb9d7e4","impliedFormat":1},{"version":"e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","impliedFormat":1},{"version":"5825520e2099309182c6e2a2b3061b060d42a098c58f67d1754880a7e2cce99a","impliedFormat":1},{"version":"c6db2268b4c7189a5d33b3bbf6616f3cc83bdad97468a25a172901d7ec28ff82","impliedFormat":1}],"root":[35,36],"options":{"allowSyntheticDefaultImports":true,"esModuleInterop":true,"module":5,"noImplicitAny":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","removeComments":true,"strict":true,"target":1},"referencedMap":[[82,1],[40,2],[41,3],[42,4],[43,5],[44,6],[45,7],[47,8],[49,9],[50,10],[51,11],[52,12],[53,13],[83,14],[54,8],[55,15],[56,16],[59,17],[60,18],[63,19],[64,20],[65,8],[68,21],[77,22],[80,23],[70,24],[71,25],[73,6],[75,26],[76,6],[84,27]],"version":"5.9.3"}
1
+ {"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../src/colorpicker.d.ts","../../src/index.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/ts3.4/base.d.ts","../../node_modules/@types/node/globals.global.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/ts3.6/base.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/base.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/@types/stylus/index.d.ts"],"fileIdsList":[[80,81],[48,49,56,65],[40,48,56],[72],[44,49,57],[65],[46,48,56],[48],[48,50,65,71],[49],[56,65,71],[48,49,51,56,65,68,71],[48,51,68,71],[82],[71],[46,48,65],[38],[70],[48,65],[63,72,74],[44,46,56,65],[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76],[77,78,79],[56],[62],[48,50,65,71,74],[48,83]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"e7662e79ae21b1f16ea6bd668b238d79a7f4337f5ad95de573356bfa086275f8","83d376f5ff4b7cffe8606e72ce25fd85ae9ea88b32ab988bff7442ea97c51eba",{"version":"215d8d9a2c480fd460127edc048d68d9931d3b27f95132253a6e71975f060bb1","affectsGlobalScope":true,"impliedFormat":1},{"version":"c438b413e94ff76dfa20ae005f33a1c84f2480d1d66e0fd687501020d0de9b50","impliedFormat":1},{"version":"bc6a78961535181265845bf9b9e8a147ffd0ca275097ceb670a9b92afa825152","impliedFormat":1},{"version":"987249e7b75023387c5fd9dc2f959ee777cb8989b7900f5a9eb4a67d290f2cba","impliedFormat":1},{"version":"123ec69e4b3a686eb49afd94ebe3292a5c84a867ecbcb6bb84bdd720a12af803","impliedFormat":1},{"version":"eb5197aade83cb0e360ac407289c53a8009e8fdae7939892a0240d30444496b6","affectsGlobalScope":true,"impliedFormat":1},{"version":"90c85ddbb8de82cd19198bda062065fc51b7407c0f206f2e399e65a52e979720","impliedFormat":1},{"version":"2636f61a2d5f76d4039c7110f65c407a028ec5265e03d855fc2cf62b198ac415","impliedFormat":1},{"version":"7e050b767ed10c7ffbc01f314defbf420bf0b5d54ce666e1c87507c035dfc191","impliedFormat":1},{"version":"7db7569fbb3e2b01ba8751c761cdd3f0debd104170d5665b7dc20a11630df3a9","impliedFormat":1},{"version":"cde4d7f6274468180fa39847b183aec22626e8212ff885d535c53f4cd7c225fd","affectsGlobalScope":true,"impliedFormat":1},{"version":"365e8358843a23944be84b810b1f774ea0223adfccc085f30fd7f4c13dc8a09f","affectsGlobalScope":true,"impliedFormat":1},{"version":"f87f95c015900102a5c0edcdebb17596de1382510e6cc17ab79f375d3505bb12","impliedFormat":1},{"version":"05b5679a897598ebe556ee93415b3af1f456e674ea82e4d7afcd716bfe43aa98","impliedFormat":1},{"version":"35fe02b2c10616cc7ac3db9c15778df7ed9c99276889efdd9be31f342841cfcd","impliedFormat":1},{"version":"1c3fe66943f587685aa4a42f664f794655da1767401d2f85910177dac78aa45d","impliedFormat":1},{"version":"c969bf4c7cdfe4d5dd28aa09432f99d09ad1d8d8b839959646579521d0467d1a","impliedFormat":1},{"version":"6c3857edaeeaaf43812f527830ebeece9266b6e8eb5271ab6d2f0008306c9947","impliedFormat":1},{"version":"bc6a77e750f4d34584e46b1405b771fb69a224197dd6bafe5b0392a29a70b665","impliedFormat":1},{"version":"8de97668870cfb20fc9d355d2ef379e897bdd8a98c889c7d8a6de40ee408ad52","impliedFormat":1},{"version":"ed4ae81196cccc10f297d228bca8d02e31058e6d723a3c5bc4be5fb3c61c6a34","impliedFormat":1},{"version":"84044697c8b3e08ef24e4b32cfe6440143d07e469a5e34bda0635276d32d9f35","impliedFormat":1},{"version":"4982d94cb6427263c8839d8d6324a8bbe129e931deb61a7380f8fad17ba2cfc0","impliedFormat":1},{"version":"ae4bc1dd4d9de7bbea6ce419db45af82a81358e6014c9e1235b5d252e06f8ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f6a1fd73c9dc3bd7f4b79bc075297ca6527904df69b0f2c2c94e4c4c7d9a32c","impliedFormat":1},{"version":"884560fda6c3868f925f022adc3a1289fe6507bbb45adb10fa1bbcc73a941bb0","impliedFormat":1},{"version":"6b2bb67b0942bcfce93e1d6fad5f70afd54940a2b13df7f311201fba54b2cbe9","impliedFormat":1},{"version":"acbed967a379b3e9f73237ba9473f8b337eeea14b7dc64d445430b5d695751da","impliedFormat":1},{"version":"272a46cc8f494677af587d17939e61e7db2b1925633e4da0c186ba17f6732521","impliedFormat":1},{"version":"d67e08745494b000da9410c1ae2fdc9965fc6d593fe0f381a47491f75417d457","impliedFormat":1},{"version":"b40652bf8ce4a18133b31349086523b219724dca8df3448c1a0742528e7ad5b9","impliedFormat":1},{"version":"c52eb62e3388a01b966c57bd14ca0ee9d5f6e656d6a18f6ce6b7cdece63734a3","impliedFormat":1},{"version":"a77fdb357c78b70142b2fdbbfb72958d69e8f765fd2a3c69946c1018e89d4638","impliedFormat":1},{"version":"3c2ac350c3baa61fd2b1925844109e098f4376d0768a4643abc82754fd752748","impliedFormat":1},{"version":"80ffc1786a5dab91b4aa59a72720f02f25df8b7c76b593e04d5e381aec284ccb","impliedFormat":1},{"version":"f5b9d446783f075eed9e93dfba1a5055b3fd61aab285fef3bbc761eadf598204","impliedFormat":1},{"version":"289be113bad7ee27ee7fa5b1e373c964c9789a5e9ed7db5ddcb631371120b953","impliedFormat":1},{"version":"baf0b82ffc5d2616f44a6fb1f81e8d798545bebf0c30f5d8b003a1dba1acfb3f","impliedFormat":1},{"version":"c6a5b34f1e725019445754f1e733585f113e0dced75f137bd3c4af5853d3f6ab","impliedFormat":1},{"version":"15fbe50526244954eb2f933546bca6cdcf0db16c9428d099b3b386c1db5799ab","impliedFormat":1},{"version":"d44028ae0127eb3e9fcfa5f55a8b81d64775ce15aca1020fe25c511bbb055834","impliedFormat":1},{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true,"impliedFormat":1},{"version":"4e0a4d84b15692ea8669fe4f3d05a4f204567906b1347da7a58b75f45bae48d3","impliedFormat":1},{"version":"ad1ae5ae98eceb9af99061e83e867b9897d267aebc8f3b938c9424deabadf4bb","impliedFormat":1},{"version":"6fbe72eed85e363ad83b763e03be824558c6ea7456c7259a48bcf0afdeb9d7e4","impliedFormat":1},{"version":"e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","impliedFormat":1},{"version":"5825520e2099309182c6e2a2b3061b060d42a098c58f67d1754880a7e2cce99a","impliedFormat":1},{"version":"c6db2268b4c7189a5d33b3bbf6616f3cc83bdad97468a25a172901d7ec28ff82","impliedFormat":1}],"root":[35,36],"options":{"allowSyntheticDefaultImports":true,"esModuleInterop":true,"module":5,"noImplicitAny":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","removeComments":true,"strict":true,"target":1},"referencedMap":[[82,1],[40,2],[41,3],[42,4],[43,5],[44,6],[45,7],[47,8],[49,9],[50,10],[51,11],[52,12],[53,13],[83,14],[54,8],[55,15],[56,16],[59,17],[60,18],[63,19],[64,20],[65,8],[68,21],[77,22],[80,23],[70,24],[71,25],[73,6],[75,26],[76,6],[84,27]],"version":"5.9.3"}
package/dist/index.d.ts CHANGED
@@ -50,6 +50,9 @@ export declare class ColorPicker {
50
50
  private openEyeDropper;
51
51
  private setupEventListeners;
52
52
  private onSaturationMouseDown;
53
+ private onSaturationTouchStart;
54
+ private updateSaturationFromTouch;
55
+ private handleSliderTouch;
53
56
  private updateSaturationFromMouse;
54
57
  private onSaturationKeyDown;
55
58
  private updateColorDisplay;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pickit-color",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A modern, accessible color picker with HSL support, presets, slider mode, and screen color picking",
5
5
  "main": "dist/colorpicker.js",
6
6
  "module": "dist/esm/colorpicker/index.js",
@@ -47,7 +47,8 @@
47
47
  "build:build": "ts-node --transpile-only build.ts",
48
48
  "build:esm": "tsc -p tsconfig.esm.json",
49
49
  "build:types": "tsc -p tsconfig.declarations.json",
50
- "prepublishOnly": "npm run build"
50
+ "prepublishOnly": "npm run build",
51
+ "release": "./release.sh"
51
52
  },
52
53
  "devDependencies": {
53
54
  "@types/node": "^14.14.14",
@@ -73,6 +73,7 @@ $cp-text = #1f2937
73
73
  border-radius ($cp-radius - 2px)
74
74
  cursor crosshair
75
75
  overflow hidden
76
+ touch-action none
76
77
 
77
78
  &:focus
78
79
  outline 2px solid $cp-primary
@@ -100,6 +101,11 @@ $cp-text = #1f2937
100
101
  pointer-events none
101
102
  transition transform 0.1s ease
102
103
 
104
+ @media (pointer: coarse)
105
+ width 28px
106
+ height 28px
107
+ border-width 4px
108
+
103
109
  @media (prefers-reduced-motion: reduce)
104
110
  transition none
105
111
 
@@ -131,11 +137,10 @@ $cp-text = #1f2937
131
137
  .colorpicker-slider
132
138
  -webkit-appearance none
133
139
  appearance none
134
- width 100%
135
- height 8px
136
- border-radius 4px
137
- outline none
138
- cursor pointer
140
+ touch-action none
141
+
142
+ @media (pointer: coarse)
143
+ height 12px
139
144
 
140
145
  &:focus
141
146
  box-shadow 0 0 0 2px $cp-primary
@@ -152,6 +157,11 @@ $cp-text = #1f2937
152
157
  box-shadow 0 2px 4px rgba(0, 0, 0, 0.2)
153
158
  transition transform 0.1s ease
154
159
 
160
+ @media (pointer: coarse)
161
+ width 28px
162
+ height 28px
163
+ border-width 3px
164
+
155
165
  &:hover
156
166
  transform scale(1.1)
157
167
 
@@ -168,6 +178,16 @@ $cp-text = #1f2937
168
178
  box-shadow 0 2px 4px rgba(0, 0, 0, 0.2)
169
179
  transition transform 0.1s ease
170
180
 
181
+ @media (pointer: coarse)
182
+ width 28px
183
+ height 28px
184
+ border-width 3px
185
+ background #ffffff
186
+ border 2px solid $cp-primary
187
+ cursor pointer
188
+ box-shadow 0 2px 4px rgba(0, 0, 0, 0.2)
189
+ transition transform 0.1s ease
190
+
171
191
  &:hover
172
192
  transform scale(1.1)
173
193
 
@@ -299,6 +319,10 @@ $cp-text = #1f2937
299
319
  transition all 0.2s ease
300
320
  flex-shrink 0
301
321
 
322
+ @media (pointer: coarse)
323
+ width 44px
324
+ height 44px
325
+
302
326
  &:hover
303
327
  background #f3f4f6
304
328
  border-color $cp-primary
@@ -369,6 +393,9 @@ $cp-text = #1f2937
369
393
  position relative
370
394
  overflow hidden
371
395
 
396
+ @media (pointer: coarse)
397
+ min-height 44px
398
+
372
399
  // Schachbrettmuster für Transparenz (als Pseudo-Element unter der Farbe)
373
400
  &::before
374
401
  content ''
@@ -387,6 +414,10 @@ $cp-text = #1f2937
387
414
  border-color $cp-primary
388
415
  box-shadow 0 2px 8px rgba(0, 0, 0, 0.15)
389
416
 
417
+ @media (pointer: coarse)
418
+ &:hover
419
+ transform scale(1.05)
420
+
390
421
  &:focus
391
422
  outline none
392
423
  border-color $cp-primary
@@ -403,6 +434,11 @@ $cp-text = #1f2937
403
434
  gap 12px
404
435
  padding 8px 12px
405
436
  background #f9fafb
437
+ min-height 48px
438
+
439
+ @media (pointer: coarse)
440
+ min-height 56px
441
+ padding 12px
406
442
 
407
443
  &:hover
408
444
  transform none
package/src/index.ts CHANGED
@@ -147,9 +147,11 @@ export class ColorPicker {
147
147
  // Update display
148
148
  this.updateColorDisplay();
149
149
 
150
- // Open if inline
151
- if (this.options.inline) {
152
- this.open();
150
+ // Open if inline (without scrolling)
151
+ if (this.options.inline && this.container) {
152
+ this.isOpen = true;
153
+ this.container.style.display = "block";
154
+ this.options.onOpen();
153
155
  }
154
156
  }
155
157
 
@@ -518,6 +520,9 @@ export class ColorPicker {
518
520
  this.updateColorDisplay();
519
521
  this.announceColorChange();
520
522
  });
523
+ this.hueSlider.addEventListener("touchstart", (e) => {
524
+ this.handleSliderTouch(e, this.hueSlider!, 'h', 0, 360);
525
+ });
521
526
  }
522
527
 
523
528
  // Saturation slider (sliderMode only)
@@ -527,6 +532,9 @@ export class ColorPicker {
527
532
  this.updateColorDisplay();
528
533
  this.announceColorChange();
529
534
  });
535
+ this.saturationSlider.addEventListener("touchstart", (e) => {
536
+ this.handleSliderTouch(e, this.saturationSlider!, 's', 0, 100);
537
+ });
530
538
  }
531
539
 
532
540
  // Lightness slider (sliderMode only)
@@ -536,6 +544,9 @@ export class ColorPicker {
536
544
  this.updateColorDisplay();
537
545
  this.announceColorChange();
538
546
  });
547
+ this.lightnessSlider.addEventListener("touchstart", (e) => {
548
+ this.handleSliderTouch(e, this.lightnessSlider!, 'l', 0, 100);
549
+ });
539
550
  }
540
551
 
541
552
  // Alpha slider
@@ -546,6 +557,9 @@ export class ColorPicker {
546
557
  this.updateColorDisplay();
547
558
  this.announceColorChange();
548
559
  });
560
+ this.alphaSlider.addEventListener("touchstart", (e) => {
561
+ this.handleSliderTouch(e, this.alphaSlider!, 'a', 0, 100, true);
562
+ });
549
563
  }
550
564
 
551
565
  // Saturation box
@@ -553,6 +567,9 @@ export class ColorPicker {
553
567
  this.colorBox.addEventListener("mousedown", (e) =>
554
568
  this.onSaturationMouseDown(e)
555
569
  );
570
+ this.colorBox.addEventListener("touchstart", (e) =>
571
+ this.onSaturationTouchStart(e)
572
+ );
556
573
  this.colorBox.addEventListener("keydown", (e) =>
557
574
  this.onSaturationKeyDown(e)
558
575
  );
@@ -706,6 +723,83 @@ export class ColorPicker {
706
723
  document.addEventListener("mouseup", onMouseUp);
707
724
  }
708
725
 
726
+ private onSaturationTouchStart(e: TouchEvent): void {
727
+ e.preventDefault();
728
+ const touch = e.touches[0];
729
+ this.updateSaturationFromTouch(touch);
730
+
731
+ const onTouchMove = (e: TouchEvent) => {
732
+ e.preventDefault();
733
+ const touch = e.touches[0];
734
+ this.updateSaturationFromTouch(touch);
735
+ };
736
+
737
+ const onTouchEnd = () => {
738
+ document.removeEventListener("touchmove", onTouchMove);
739
+ document.removeEventListener("touchend", onTouchEnd);
740
+ };
741
+
742
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
743
+ document.addEventListener("touchend", onTouchEnd);
744
+ }
745
+
746
+ private updateSaturationFromTouch(touch: Touch): void {
747
+ if (!this.colorBox) return;
748
+
749
+ const rect = this.colorBox.getBoundingClientRect();
750
+ const x = Math.max(0, Math.min(touch.clientX - rect.left, rect.width));
751
+ const y = Math.max(0, Math.min(touch.clientY - rect.top, rect.height));
752
+
753
+ this.currentColor.s = (x / rect.width) * 100;
754
+ this.currentColor.l = 100 - (y / rect.height) * 100;
755
+
756
+ this.updateColorDisplay();
757
+ this.announceColorChange();
758
+ }
759
+
760
+ private handleSliderTouch(
761
+ e: TouchEvent,
762
+ slider: HTMLInputElement,
763
+ property: 'h' | 's' | 'l' | 'a',
764
+ min: number,
765
+ max: number,
766
+ isAlpha: boolean = false
767
+ ): void {
768
+ const updateFromTouch = (touch: Touch) => {
769
+ const rect = slider.getBoundingClientRect();
770
+ const x = Math.max(0, Math.min(touch.clientX - rect.left, rect.width));
771
+ const ratio = x / rect.width;
772
+ const value = min + ratio * (max - min);
773
+
774
+ if (isAlpha) {
775
+ this.currentColor[property] = value / 100;
776
+ } else {
777
+ this.currentColor[property] = Math.round(value);
778
+ }
779
+
780
+ slider.value = String(Math.round(value));
781
+ this.updateColorDisplay();
782
+ this.announceColorChange();
783
+ };
784
+
785
+ const touch = e.touches[0];
786
+ updateFromTouch(touch);
787
+
788
+ const onTouchMove = (e: TouchEvent) => {
789
+ e.preventDefault();
790
+ const touch = e.touches[0];
791
+ updateFromTouch(touch);
792
+ };
793
+
794
+ const onTouchEnd = () => {
795
+ document.removeEventListener("touchmove", onTouchMove);
796
+ document.removeEventListener("touchend", onTouchEnd);
797
+ };
798
+
799
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
800
+ document.addEventListener("touchend", onTouchEnd);
801
+ }
802
+
709
803
  private updateSaturationFromMouse(e: MouseEvent): void {
710
804
  if (!this.colorBox) return;
711
805
 
@@ -1038,25 +1132,27 @@ export class ColorPicker {
1038
1132
 
1039
1133
  this.options.onOpen();
1040
1134
 
1041
- // Focus first interactive element based on mode
1042
- setTimeout(() => {
1043
- let focusTarget: HTMLElement | null = null;
1044
-
1045
- if (this.options.presetsOnly) {
1046
- // In presets-only mode, focus first preset
1047
- focusTarget = this.container?.querySelector('.colorpicker-preset') as HTMLElement;
1048
- } else if (this.options.sliderMode) {
1049
- // In slider mode, focus first slider (hue)
1050
- focusTarget = this.hueSlider;
1051
- } else {
1052
- // In standard mode, focus saturation box
1053
- focusTarget = this.colorBox;
1054
- }
1055
-
1056
- if (focusTarget) {
1057
- focusTarget.focus();
1058
- }
1059
- }, 0);
1135
+ // Auto-focus only for popup mode, not inline
1136
+ if (!this.options.inline) {
1137
+ setTimeout(() => {
1138
+ let focusTarget: HTMLElement | null = null;
1139
+
1140
+ if (this.options.presetsOnly) {
1141
+ // In presets-only mode, focus first preset
1142
+ focusTarget = this.container?.querySelector('.colorpicker-preset') as HTMLElement;
1143
+ } else if (this.options.sliderMode) {
1144
+ // In slider mode, focus first slider (hue)
1145
+ focusTarget = this.hueSlider;
1146
+ } else {
1147
+ // In standard mode, focus saturation box
1148
+ focusTarget = this.colorBox;
1149
+ }
1150
+
1151
+ if (focusTarget) {
1152
+ focusTarget.focus();
1153
+ }
1154
+ }, 0);
1155
+ }
1060
1156
  }
1061
1157
 
1062
1158
  public close(): void {