@luminescent/ui 0.7.7 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -661
- package/README.md +48 -48
- package/lib/index.qwik.cjs +323 -566
- package/lib/index.qwik.mjs +324 -567
- package/lib-types/components/elements/ColorInput.d.ts +12 -2
- package/lib-types/utils/simple-color-picker/color.d.ts +6 -21
- package/package.json +62 -62
- package/src/tailwind.config.js +71 -71
- package/lib-types/utils/simple-color-picker/index.d.ts +0 -145
- package/lib-types/utils/simple-color-picker/utils.d.ts +0 -6
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _wrapSignal,
|
|
2
|
-
import { isServer } from "@builder.io/qwik/build";
|
|
1
|
+
import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _wrapSignal, useStore, useLexicalScope, _IMMUTABLE, _wrapProp, useOn, _jsxBranch, useStylesQrl } from "@builder.io/qwik";
|
|
3
2
|
import { Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
4
3
|
const Anchor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => /* @__PURE__ */ _jsxQ("span", null, {
|
|
5
4
|
class: "block h-32 -mt-32",
|
|
@@ -305,80 +304,6 @@ function getMousePosition(e) {
|
|
|
305
304
|
};
|
|
306
305
|
}
|
|
307
306
|
const pad2 = (c) => c.length == 1 ? "0" + c : "" + c;
|
|
308
|
-
class Color {
|
|
309
|
-
constructor(color) {
|
|
310
|
-
this._rgba = {
|
|
311
|
-
r: 0,
|
|
312
|
-
g: 0,
|
|
313
|
-
b: 0,
|
|
314
|
-
a: 1
|
|
315
|
-
};
|
|
316
|
-
this._hsva = {
|
|
317
|
-
h: 0,
|
|
318
|
-
s: 0,
|
|
319
|
-
v: 0,
|
|
320
|
-
a: 1
|
|
321
|
-
};
|
|
322
|
-
this.fromHex(color);
|
|
323
|
-
}
|
|
324
|
-
fromHex(color = 0) {
|
|
325
|
-
if (typeof color === "number") {
|
|
326
|
-
this._hexNumber = color;
|
|
327
|
-
this._hexString = numberToHexString(this._hexNumber);
|
|
328
|
-
} else {
|
|
329
|
-
this._hexString = color.toUpperCase();
|
|
330
|
-
this._hexNumber = hexStringToNumber(this._hexString);
|
|
331
|
-
}
|
|
332
|
-
const { r, g, b } = hexNumberToRgb(this._hexNumber);
|
|
333
|
-
this._rgba.r = r;
|
|
334
|
-
this._rgba.g = g;
|
|
335
|
-
this._rgba.b = b;
|
|
336
|
-
const { h, s, v } = rgbToHsv(this._rgba);
|
|
337
|
-
this._hsva.h = h;
|
|
338
|
-
this._hsva.s = s;
|
|
339
|
-
this._hsva.v = v;
|
|
340
|
-
this._updateBrightness();
|
|
341
|
-
}
|
|
342
|
-
fromHsv(color) {
|
|
343
|
-
const { h, s, v } = color;
|
|
344
|
-
this._hsva.h = h;
|
|
345
|
-
this._hsva.s = s;
|
|
346
|
-
this._hsva.v = v;
|
|
347
|
-
const { r, g, b } = hsvToRgb(this._hsva);
|
|
348
|
-
this._rgba.r = r;
|
|
349
|
-
this._rgba.g = g;
|
|
350
|
-
this._rgba.b = b;
|
|
351
|
-
this._hexString = rgbToHex(this._rgba);
|
|
352
|
-
this._hexNumber = hexStringToNumber(this._hexString);
|
|
353
|
-
this._updateBrightness();
|
|
354
|
-
}
|
|
355
|
-
_updateBrightness() {
|
|
356
|
-
this._brightness = getBrightness(this._rgba);
|
|
357
|
-
this._isDark = this._brightness < 0.5;
|
|
358
|
-
this._isLight = !this._isDark;
|
|
359
|
-
}
|
|
360
|
-
get rgb() {
|
|
361
|
-
return this._rgba;
|
|
362
|
-
}
|
|
363
|
-
get hsv() {
|
|
364
|
-
return this._hsva;
|
|
365
|
-
}
|
|
366
|
-
get hex() {
|
|
367
|
-
return this._hexNumber;
|
|
368
|
-
}
|
|
369
|
-
get hexString() {
|
|
370
|
-
return this._hexString;
|
|
371
|
-
}
|
|
372
|
-
get brightness() {
|
|
373
|
-
return this._brightness;
|
|
374
|
-
}
|
|
375
|
-
get isDark() {
|
|
376
|
-
return this._isDark;
|
|
377
|
-
}
|
|
378
|
-
get isLight() {
|
|
379
|
-
return this._isLight;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
307
|
function getBrightness(color) {
|
|
383
308
|
const { r, g, b } = color;
|
|
384
309
|
return (r * 299 + g * 587 + b * 114) / 1e3;
|
|
@@ -403,7 +328,6 @@ function rgbToHex(color) {
|
|
|
403
328
|
];
|
|
404
329
|
return hex.join("").toUpperCase();
|
|
405
330
|
}
|
|
406
|
-
const numberToHexString = (color) => "#" + ("00000" + (color | 0).toString(16)).substr(-6).toUpperCase();
|
|
407
331
|
const hexStringToNumber = (color) => parseInt(color.replace("#", ""), 16);
|
|
408
332
|
function hsvToRgb(color) {
|
|
409
333
|
let { h } = color;
|
|
@@ -473,338 +397,6 @@ function rgbToHsv(color) {
|
|
|
473
397
|
v
|
|
474
398
|
};
|
|
475
399
|
}
|
|
476
|
-
class ColorPicker {
|
|
477
|
-
constructor(options = {}) {
|
|
478
|
-
this._widthUnits = "px";
|
|
479
|
-
this._heightUnits = "px";
|
|
480
|
-
this._huePosition = 0;
|
|
481
|
-
this._hueHeight = 0;
|
|
482
|
-
this._maxHue = 0;
|
|
483
|
-
this._inputIsNumber = false;
|
|
484
|
-
this._saturationWidth = 0;
|
|
485
|
-
this._isChoosing = false;
|
|
486
|
-
this._callbacks = [];
|
|
487
|
-
this.width = 0;
|
|
488
|
-
this.height = 0;
|
|
489
|
-
this.hue = 0;
|
|
490
|
-
this.position = {
|
|
491
|
-
x: 0,
|
|
492
|
-
y: 0
|
|
493
|
-
};
|
|
494
|
-
this.color = new Color(0);
|
|
495
|
-
this.backgroundColor = new Color(0);
|
|
496
|
-
this.hueColor = new Color(0);
|
|
497
|
-
this._onSaturationMouseDown = (e) => {
|
|
498
|
-
const sbOffset = this.$saturation.getBoundingClientRect();
|
|
499
|
-
const { x, y } = getMousePosition(e);
|
|
500
|
-
this._isChoosing = true;
|
|
501
|
-
this._moveSelectorTo(x - sbOffset.left, y - sbOffset.top);
|
|
502
|
-
this._updateColorFromPosition();
|
|
503
|
-
this._window.addEventListener("mouseup", this._onSaturationMouseUp);
|
|
504
|
-
this._window.addEventListener("touchend", this._onSaturationMouseUp);
|
|
505
|
-
this._window.addEventListener("mousemove", this._onSaturationMouseMove);
|
|
506
|
-
this._window.addEventListener("touchmove", this._onSaturationMouseMove);
|
|
507
|
-
e.preventDefault();
|
|
508
|
-
};
|
|
509
|
-
this._onSaturationMouseMove = (e) => {
|
|
510
|
-
const sbOffset = this.$saturation.getBoundingClientRect();
|
|
511
|
-
const { x, y } = getMousePosition(e);
|
|
512
|
-
this._moveSelectorTo(x - sbOffset.left, y - sbOffset.top);
|
|
513
|
-
this._updateColorFromPosition();
|
|
514
|
-
};
|
|
515
|
-
this._onSaturationMouseUp = () => {
|
|
516
|
-
this._isChoosing = false;
|
|
517
|
-
this._window.removeEventListener("mouseup", this._onSaturationMouseUp);
|
|
518
|
-
this._window.removeEventListener("touchend", this._onSaturationMouseUp);
|
|
519
|
-
this._window.removeEventListener("mousemove", this._onSaturationMouseMove);
|
|
520
|
-
this._window.removeEventListener("touchmove", this._onSaturationMouseMove);
|
|
521
|
-
};
|
|
522
|
-
this._onHueMouseDown = (e) => {
|
|
523
|
-
const hOffset = this.$hue.getBoundingClientRect();
|
|
524
|
-
const { y } = getMousePosition(e);
|
|
525
|
-
this._isChoosing = true;
|
|
526
|
-
this._moveHueTo(y - hOffset.top);
|
|
527
|
-
this._updateHueFromPosition();
|
|
528
|
-
this._window.addEventListener("mouseup", this._onHueMouseUp);
|
|
529
|
-
this._window.addEventListener("touchend", this._onHueMouseUp);
|
|
530
|
-
this._window.addEventListener("mousemove", this._onHueMouseMove);
|
|
531
|
-
this._window.addEventListener("touchmove", this._onHueMouseMove);
|
|
532
|
-
e.preventDefault();
|
|
533
|
-
};
|
|
534
|
-
this._onHueMouseMove = (e) => {
|
|
535
|
-
const hOffset = this.$hue.getBoundingClientRect();
|
|
536
|
-
const { y } = getMousePosition(e);
|
|
537
|
-
this._moveHueTo(y - hOffset.top);
|
|
538
|
-
this._updateHueFromPosition();
|
|
539
|
-
};
|
|
540
|
-
this._onHueMouseUp = () => {
|
|
541
|
-
this._isChoosing = false;
|
|
542
|
-
this._window.removeEventListener("mouseup", this._onHueMouseUp);
|
|
543
|
-
this._window.removeEventListener("touchend", this._onHueMouseUp);
|
|
544
|
-
this._window.removeEventListener("mousemove", this._onHueMouseMove);
|
|
545
|
-
this._window.removeEventListener("touchmove", this._onHueMouseMove);
|
|
546
|
-
};
|
|
547
|
-
this._window = options.window || window;
|
|
548
|
-
this._document = this._window.document;
|
|
549
|
-
this.$el = this._document.createElement("div");
|
|
550
|
-
this.$el.className = "color-picker";
|
|
551
|
-
this.$el.innerHTML = `
|
|
552
|
-
<div class="color-picker-saturation">
|
|
553
|
-
<div class="color-picker-brightness"></div>
|
|
554
|
-
<div class="color-picker-sbSelector"></div>
|
|
555
|
-
</div>
|
|
556
|
-
<div class="color-picker-hue">
|
|
557
|
-
<div class="color-picker-hSelector"></div>
|
|
558
|
-
</div>
|
|
559
|
-
`;
|
|
560
|
-
this.$saturation = this.$el.querySelector(".color-picker-saturation");
|
|
561
|
-
this.$hue = this.$el.querySelector(".color-picker-hue");
|
|
562
|
-
this.$sbSelector = this.$el.querySelector(".color-picker-sbSelector");
|
|
563
|
-
this.$hSelector = this.$el.querySelector(".color-picker-hSelector");
|
|
564
|
-
this.$saturation.addEventListener("mousedown", this._onSaturationMouseDown);
|
|
565
|
-
this.$saturation.addEventListener("touchstart", this._onSaturationMouseDown);
|
|
566
|
-
this.$hue.addEventListener("mousedown", this._onHueMouseDown);
|
|
567
|
-
this.$hue.addEventListener("touchstart", this._onHueMouseDown);
|
|
568
|
-
if (options.el)
|
|
569
|
-
this.appendTo(options.el);
|
|
570
|
-
if (options.background)
|
|
571
|
-
this.setBackgroundColor(options.background);
|
|
572
|
-
if (options.widthUnits)
|
|
573
|
-
this._widthUnits = options.widthUnits;
|
|
574
|
-
if (options.heightUnits)
|
|
575
|
-
this._heightUnits = options.heightUnits;
|
|
576
|
-
if (options.colors) {
|
|
577
|
-
this.$colors = this._document.createElement("div");
|
|
578
|
-
this.$colors.className = "color-picker-colors";
|
|
579
|
-
this.$el.appendChild(this.$colors);
|
|
580
|
-
options.colors.forEach((color) => {
|
|
581
|
-
const $color = this._document.createElement("button");
|
|
582
|
-
$color.className = "color-picker-color";
|
|
583
|
-
$color.style.background = `${color}`;
|
|
584
|
-
$color.addEventListener("mousedown", (e) => {
|
|
585
|
-
this.setColor(color);
|
|
586
|
-
e.preventDefault();
|
|
587
|
-
});
|
|
588
|
-
$color.addEventListener("touchstart", (e) => {
|
|
589
|
-
this.setColor(color);
|
|
590
|
-
e.preventDefault();
|
|
591
|
-
});
|
|
592
|
-
this.$colors.appendChild($color);
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
this.setSize(options.width || 175, options.height || 150);
|
|
596
|
-
this.setColor(options.color);
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Add the ColorPicker instance to a DOM element.
|
|
600
|
-
* @param {HTMLElement} el
|
|
601
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
602
|
-
*/
|
|
603
|
-
appendTo(el) {
|
|
604
|
-
if (typeof el === "string")
|
|
605
|
-
document.querySelector(el).appendChild(this.$el);
|
|
606
|
-
else
|
|
607
|
-
el.appendChild(this.$el);
|
|
608
|
-
return this;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Removes picker from its parent and kill all listeners.
|
|
612
|
-
* Call this method for proper destroy.
|
|
613
|
-
*/
|
|
614
|
-
remove() {
|
|
615
|
-
this._callbacks = [];
|
|
616
|
-
this._onSaturationMouseUp();
|
|
617
|
-
this._onHueMouseUp();
|
|
618
|
-
this.$saturation.removeEventListener("mousedown", this._onSaturationMouseDown);
|
|
619
|
-
this.$saturation.removeEventListener("touchstart", this._onSaturationMouseDown);
|
|
620
|
-
this.$hue.removeEventListener("mousedown", this._onHueMouseDown);
|
|
621
|
-
this.$hue.removeEventListener("touchstart", this._onHueMouseDown);
|
|
622
|
-
if (this.$el.parentNode)
|
|
623
|
-
this.$el.parentNode.removeChild(this.$el);
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* Manually set the current color of the picker. This is the method
|
|
627
|
-
* used on instantiation to convert `color` option to actual color for
|
|
628
|
-
* the picker. Param can be a hexadecimal number or an hex String.
|
|
629
|
-
* @param {String|Number} color hex color desired
|
|
630
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
631
|
-
*/
|
|
632
|
-
setColor(color) {
|
|
633
|
-
this._inputIsNumber = !isNaN(Number(color));
|
|
634
|
-
this.color.fromHex(color);
|
|
635
|
-
const { h, s, v } = this.color.hsv;
|
|
636
|
-
if (!isNaN(h))
|
|
637
|
-
this.hue = h;
|
|
638
|
-
this._moveSelectorTo(this._saturationWidth * s, (1 - v) * this._hueHeight);
|
|
639
|
-
this._moveHueTo((1 - this.hue) * this._hueHeight);
|
|
640
|
-
this._updateHue();
|
|
641
|
-
return this;
|
|
642
|
-
}
|
|
643
|
-
/**
|
|
644
|
-
* Set size of the color picker for a given width and height. Note that
|
|
645
|
-
* a padding of 5px will be added if you chose to use the background option
|
|
646
|
-
* of the constructor.
|
|
647
|
-
* @param {Number} width
|
|
648
|
-
* @param {Number} height
|
|
649
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
650
|
-
*/
|
|
651
|
-
setSize(width, height) {
|
|
652
|
-
this.width = width;
|
|
653
|
-
this.height = height;
|
|
654
|
-
this.$el.style.width = this.width + this._widthUnits;
|
|
655
|
-
this.$el.style.height = this.height + this._heightUnits;
|
|
656
|
-
this._saturationWidth = this.width - 25;
|
|
657
|
-
this.$saturation.style.width = this._saturationWidth + "px";
|
|
658
|
-
this._hueHeight = this.height;
|
|
659
|
-
this._maxHue = this._hueHeight - 2;
|
|
660
|
-
return this;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Set the background color of the picker. It also adds a 5px padding
|
|
664
|
-
* for design purpose.
|
|
665
|
-
* @param {String|Number} color hex color desired for background
|
|
666
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
667
|
-
*/
|
|
668
|
-
setBackgroundColor(color) {
|
|
669
|
-
this.backgroundColor.fromHex(color);
|
|
670
|
-
this.$el.style.padding = "5px";
|
|
671
|
-
this.$el.style.background = this.backgroundColor.hexString;
|
|
672
|
-
return this;
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Removes background of the picker if previously set. It's no use
|
|
676
|
-
* calling this method if you didn't set the background option on start
|
|
677
|
-
* or if you didn't call setBackgroundColor previously.
|
|
678
|
-
*/
|
|
679
|
-
setNoBackground() {
|
|
680
|
-
this.$el.style.padding = "0px";
|
|
681
|
-
this.$el.style.background = "none";
|
|
682
|
-
return this;
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Registers callback to the update event of the picker.
|
|
686
|
-
* picker inherits from [component/emitter](https://github.com/component/emitter)
|
|
687
|
-
* so you could do the same thing by calling `colorPicker.on('update');`
|
|
688
|
-
* @param {Function} callback
|
|
689
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
690
|
-
*/
|
|
691
|
-
onChange(callback) {
|
|
692
|
-
if (this._callbacks.indexOf(callback) < 0) {
|
|
693
|
-
this._callbacks.push(callback);
|
|
694
|
-
callback(this.getHexString());
|
|
695
|
-
}
|
|
696
|
-
return this;
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Is true when mouse is down and user is currently choosing a color.
|
|
700
|
-
*/
|
|
701
|
-
get isChoosing() {
|
|
702
|
-
return this._isChoosing;
|
|
703
|
-
}
|
|
704
|
-
/* =============================================================================
|
|
705
|
-
Color getters
|
|
706
|
-
============================================================================= */
|
|
707
|
-
/**
|
|
708
|
-
* Main color getter, will return a formatted color string depending on input
|
|
709
|
-
* or a number depending on the last setColor call.
|
|
710
|
-
* @return {Number|String}
|
|
711
|
-
*/
|
|
712
|
-
getColor() {
|
|
713
|
-
if (this._inputIsNumber)
|
|
714
|
-
return this.getHexNumber();
|
|
715
|
-
return this.getHexString();
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Returns color as css hex string (ex: '#FF0000').
|
|
719
|
-
* @return {String}
|
|
720
|
-
*/
|
|
721
|
-
getHexString() {
|
|
722
|
-
return this.color.hexString.toUpperCase();
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Returns color as number (ex: 0xFF0000).
|
|
726
|
-
* @return {Number}
|
|
727
|
-
*/
|
|
728
|
-
getHexNumber() {
|
|
729
|
-
return this.color.hex;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Returns color as {r: 1, g: 0, b: 0} object.
|
|
733
|
-
* @return {Object}
|
|
734
|
-
*/
|
|
735
|
-
getRGB() {
|
|
736
|
-
return this.color.rgb;
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* Returns color as {h: 100, s: 1, v: 1} object.
|
|
740
|
-
* @return {Object}
|
|
741
|
-
*/
|
|
742
|
-
getHSV() {
|
|
743
|
-
return this.color.hsv;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Returns true if color is perceived as dark
|
|
747
|
-
* @return {Boolean}
|
|
748
|
-
*/
|
|
749
|
-
isDark() {
|
|
750
|
-
return this.color.isDark;
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* Returns true if color is perceived as light
|
|
754
|
-
* @return {Boolean}
|
|
755
|
-
*/
|
|
756
|
-
isLight() {
|
|
757
|
-
return this.color.isLight;
|
|
758
|
-
}
|
|
759
|
-
/* =============================================================================
|
|
760
|
-
Private methods
|
|
761
|
-
============================================================================= */
|
|
762
|
-
_moveSelectorTo(x, y) {
|
|
763
|
-
this.position.x = clamp(x, 0, this._saturationWidth);
|
|
764
|
-
this.position.y = clamp(y, 0, this._hueHeight);
|
|
765
|
-
this.$sbSelector.style.transform = `translate(${this.position.x}px, ${this.position.y}px)`;
|
|
766
|
-
}
|
|
767
|
-
_updateColorFromPosition() {
|
|
768
|
-
this.color.fromHsv({
|
|
769
|
-
h: this.hue,
|
|
770
|
-
s: this.position.x / this._saturationWidth,
|
|
771
|
-
v: 1 - this.position.y / this._hueHeight
|
|
772
|
-
});
|
|
773
|
-
this._updateColor();
|
|
774
|
-
}
|
|
775
|
-
_moveHueTo(y) {
|
|
776
|
-
this._huePosition = clamp(y, 0, this._maxHue);
|
|
777
|
-
this.$hSelector.style.transform = `translateY(${this._huePosition}px)`;
|
|
778
|
-
}
|
|
779
|
-
_updateHueFromPosition() {
|
|
780
|
-
const hsvColor = this.getHSV();
|
|
781
|
-
this.hue = 1 - this._huePosition / this._maxHue;
|
|
782
|
-
this.color.fromHsv({
|
|
783
|
-
h: this.hue,
|
|
784
|
-
s: hsvColor.s,
|
|
785
|
-
v: hsvColor.v
|
|
786
|
-
});
|
|
787
|
-
this._updateHue();
|
|
788
|
-
}
|
|
789
|
-
_updateHue() {
|
|
790
|
-
this.hueColor.fromHsv({
|
|
791
|
-
h: this.hue,
|
|
792
|
-
s: 1,
|
|
793
|
-
v: 1
|
|
794
|
-
});
|
|
795
|
-
this.$hSelector.style.background = this.hueColor.hexString;
|
|
796
|
-
this.$saturation.style.background = `linear-gradient(to right, #fff, ${this.hueColor.hexString})`;
|
|
797
|
-
this._updateColor();
|
|
798
|
-
}
|
|
799
|
-
_updateColor() {
|
|
800
|
-
this.$sbSelector.style.background = this.getHexString();
|
|
801
|
-
this.$sbSelector.style.borderColor = this.isDark() ? "#fff" : "#000";
|
|
802
|
-
this._triggerChange();
|
|
803
|
-
}
|
|
804
|
-
_triggerChange() {
|
|
805
|
-
this._callbacks.forEach((callback) => callback(this.getHexString()));
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
400
|
const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
809
401
|
const props1 = _restProps(props, [
|
|
810
402
|
"onInput$",
|
|
@@ -812,101 +404,12 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
812
404
|
"presetColors",
|
|
813
405
|
"preview"
|
|
814
406
|
]);
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
padding: 15px;
|
|
822
|
-
border-radius: 10px;
|
|
823
|
-
border: 1px solid rgb(31 41 55);
|
|
824
|
-
filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.5));
|
|
825
|
-
background: rgba(31 41 55 / 40%);
|
|
826
|
-
backdrop-filter: blur(10px);
|
|
827
|
-
user-select: none;
|
|
828
|
-
position: relative;
|
|
829
|
-
z-index: 1000;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
.color-picker-saturation {
|
|
833
|
-
position: relative;
|
|
834
|
-
height: 100%;
|
|
835
|
-
width: 100%;
|
|
836
|
-
background: linear-gradient(to right, #FFFFFF, #FF0000);
|
|
837
|
-
float: left;
|
|
838
|
-
border-radius: 5px;
|
|
839
|
-
border: 1px solid rgb(31 41 55);
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
.color-picker-brightness {
|
|
843
|
-
width: 100%;
|
|
844
|
-
height: 100%;
|
|
845
|
-
background: linear-gradient(rgba(255, 255, 255, 0), rgba(0, 0, 0, 1));
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
.color-picker-sbSelector {
|
|
849
|
-
border: 1px solid white;
|
|
850
|
-
position: absolute;
|
|
851
|
-
width: 14px;
|
|
852
|
-
height: 14px;
|
|
853
|
-
background: white;
|
|
854
|
-
border-radius: 10px;
|
|
855
|
-
top: -7px;
|
|
856
|
-
left: -7px;
|
|
857
|
-
box-sizing: border-box;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
.color-picker-hue {
|
|
861
|
-
width: 8px;
|
|
862
|
-
border-radius: 5px;
|
|
863
|
-
height: 100%;
|
|
864
|
-
position: relative;
|
|
865
|
-
float: left;
|
|
866
|
-
background: linear-gradient(rgb(255, 0, 0) 0%, rgb(255, 0, 255) 17%, rgb(0, 0, 255) 34%, rgb(0, 255, 255) 50%, rgb(0, 255, 0) 67%, rgb(255, 255, 0) 84%, rgb(255, 0, 0) 100%);
|
|
867
|
-
border: 1px solid rgb(31 41 55);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
.color-picker-colors {
|
|
871
|
-
height: 100%;
|
|
872
|
-
position: relative;
|
|
873
|
-
display: flex;
|
|
874
|
-
flex-direction: column;
|
|
875
|
-
gap: 5px;
|
|
876
|
-
float: left;
|
|
877
|
-
justify-content: space-evenly;
|
|
878
|
-
flex-wrap: wrap;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
.color-picker-color {
|
|
882
|
-
transition: all 0.2s;
|
|
883
|
-
height: 25px;
|
|
884
|
-
width: 25px;
|
|
885
|
-
border-radius: 5px;
|
|
886
|
-
position: relative;
|
|
887
|
-
background: red;
|
|
888
|
-
border: 1px solid rgb(31 41 55);
|
|
889
|
-
cursor: pointer;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
.color-picker-color:hover {
|
|
893
|
-
border: 1px solid white;
|
|
894
|
-
transform: scale(1.1);
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
.color-picker-hSelector {
|
|
898
|
-
border: 1px solid white;
|
|
899
|
-
position: absolute;
|
|
900
|
-
width: 14px;
|
|
901
|
-
height: 14px;
|
|
902
|
-
background: white;
|
|
903
|
-
border-radius: 10px;
|
|
904
|
-
top: -6px;
|
|
905
|
-
left: -4px;
|
|
906
|
-
box-sizing: border-box;
|
|
907
|
-
}
|
|
908
|
-
`, "ColorInput_component_useStyles_SMNFl4Oy0IA"));
|
|
909
|
-
return /* @__PURE__ */ _jsxQ("div", null, null, [
|
|
407
|
+
const store = useStore({
|
|
408
|
+
opened: false
|
|
409
|
+
});
|
|
410
|
+
return /* @__PURE__ */ _jsxQ("div", null, {
|
|
411
|
+
class: "relative"
|
|
412
|
+
}, [
|
|
910
413
|
/* @__PURE__ */ _jsxQ("label", {
|
|
911
414
|
for: _wrapSignal(props1, "id")
|
|
912
415
|
}, {
|
|
@@ -917,66 +420,25 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
917
420
|
get value() {
|
|
918
421
|
return props.value ?? "#000000";
|
|
919
422
|
},
|
|
920
|
-
onBlur$: /* @__PURE__ */ inlinedQrl((
|
|
921
|
-
const [
|
|
922
|
-
|
|
923
|
-
const pickerDiv = document.getElementById(`${props12.id}-color-picker`);
|
|
924
|
-
pickerDiv.classList.add("opacity-0", "pointer-events-none", "scale-95");
|
|
423
|
+
onBlur$: /* @__PURE__ */ inlinedQrl(() => {
|
|
424
|
+
const [store2] = useLexicalScope();
|
|
425
|
+
store2.opened = false;
|
|
925
426
|
}, "ColorInput_component_div_TextInputRaw_onBlur_giB7aSy8tnc", [
|
|
926
|
-
|
|
427
|
+
store
|
|
927
428
|
]),
|
|
928
|
-
onFocus$: /* @__PURE__ */ inlinedQrl((
|
|
929
|
-
const [
|
|
930
|
-
|
|
931
|
-
if (!pickerDiv.children.length) {
|
|
932
|
-
if (isServer)
|
|
933
|
-
return;
|
|
934
|
-
const picker = new ColorPicker({
|
|
935
|
-
el: pickerDiv,
|
|
936
|
-
color: props2.value ?? "#000000",
|
|
937
|
-
colors: [
|
|
938
|
-
"#FAEDCB",
|
|
939
|
-
"#C9E4DE",
|
|
940
|
-
"#C6DEF1",
|
|
941
|
-
"#DBCDF0",
|
|
942
|
-
"#F2C6DE",
|
|
943
|
-
"#FCD05C",
|
|
944
|
-
"#5FE2C5",
|
|
945
|
-
"#4498DB",
|
|
946
|
-
"#9863E7",
|
|
947
|
-
"#E43A96",
|
|
948
|
-
...props2.presetColors ?? []
|
|
949
|
-
],
|
|
950
|
-
width: 150,
|
|
951
|
-
height: 150
|
|
952
|
-
});
|
|
953
|
-
picker.onChange((color) => {
|
|
954
|
-
element.value = color;
|
|
955
|
-
switch (props2.preview ?? "left") {
|
|
956
|
-
case "full":
|
|
957
|
-
element.style.backgroundColor = color;
|
|
958
|
-
element.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
|
|
959
|
-
break;
|
|
960
|
-
case "left":
|
|
961
|
-
element.style.borderLeft = `40px solid ${color}`;
|
|
962
|
-
break;
|
|
963
|
-
case "right":
|
|
964
|
-
element.style.borderRight = `40px solid ${color}`;
|
|
965
|
-
break;
|
|
966
|
-
case "top":
|
|
967
|
-
element.style.borderTop = `10px solid ${color}`;
|
|
968
|
-
break;
|
|
969
|
-
case "bottom":
|
|
970
|
-
element.style.borderBottom = `10px solid ${color}`;
|
|
971
|
-
break;
|
|
972
|
-
}
|
|
973
|
-
if (props2.onInput$)
|
|
974
|
-
props2.onInput$(color, element);
|
|
975
|
-
});
|
|
976
|
-
element.addEventListener("input", () => picker.setColor(element.value));
|
|
977
|
-
}
|
|
978
|
-
pickerDiv.classList.remove("opacity-0", "pointer-events-none", "scale-95");
|
|
429
|
+
onFocus$: /* @__PURE__ */ inlinedQrl(() => {
|
|
430
|
+
const [store2] = useLexicalScope();
|
|
431
|
+
store2.opened = true;
|
|
979
432
|
}, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
|
|
433
|
+
store
|
|
434
|
+
]),
|
|
435
|
+
onInput$: /* @__PURE__ */ inlinedQrl((e, el) => {
|
|
436
|
+
const [props12, props2] = useLexicalScope();
|
|
437
|
+
const div = document.getElementById(`${props12.id}-picker`);
|
|
438
|
+
const event = new Event("change");
|
|
439
|
+
div.dispatchEvent(event);
|
|
440
|
+
props2.onInput$?.(el.value);
|
|
441
|
+
}, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
|
|
980
442
|
props1,
|
|
981
443
|
props
|
|
982
444
|
]),
|
|
@@ -993,18 +455,312 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
993
455
|
borderBottom: `10px solid ${props.value ?? "#000000"}`
|
|
994
456
|
} : {},
|
|
995
457
|
[_IMMUTABLE]: {
|
|
458
|
+
onBlur$: _IMMUTABLE,
|
|
459
|
+
onFocus$: _IMMUTABLE,
|
|
996
460
|
value: _fnSignal((p0) => p0.value ?? "#000000", [
|
|
997
461
|
props
|
|
998
462
|
], 'p0.value??"#000000"')
|
|
999
463
|
}
|
|
1000
464
|
}, 0, "0s_1"),
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
id
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
465
|
+
/* @__PURE__ */ _jsxC(ColorPickerRaw, {
|
|
466
|
+
get id() {
|
|
467
|
+
return props1.id;
|
|
468
|
+
},
|
|
469
|
+
get color() {
|
|
470
|
+
return props.value ?? "#000000";
|
|
471
|
+
},
|
|
472
|
+
get colors() {
|
|
473
|
+
return [
|
|
474
|
+
"#FAEDCB",
|
|
475
|
+
"#C9E4DE",
|
|
476
|
+
"#C6DEF1",
|
|
477
|
+
"#DBCDF0",
|
|
478
|
+
"#F2C6DE",
|
|
479
|
+
"#FCD05C",
|
|
480
|
+
"#5FE2C5",
|
|
481
|
+
"#4498DB",
|
|
482
|
+
"#9863E7",
|
|
483
|
+
"#E43A96",
|
|
484
|
+
...props.presetColors ?? []
|
|
485
|
+
];
|
|
486
|
+
},
|
|
487
|
+
get class() {
|
|
488
|
+
return {
|
|
489
|
+
"transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
|
|
490
|
+
"opacity-0 pointer-events-none scale-95": !store.opened
|
|
491
|
+
};
|
|
492
|
+
},
|
|
493
|
+
onInput$: /* @__PURE__ */ inlinedQrl((color) => {
|
|
494
|
+
const [props12, props2] = useLexicalScope();
|
|
495
|
+
const el = document.getElementById(props12.id);
|
|
496
|
+
el.value = color;
|
|
497
|
+
switch (props2.preview ?? "left") {
|
|
498
|
+
case "full":
|
|
499
|
+
el.style.backgroundColor = color;
|
|
500
|
+
el.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
|
|
501
|
+
break;
|
|
502
|
+
case "left":
|
|
503
|
+
el.style.borderLeft = `40px solid ${color}`;
|
|
504
|
+
break;
|
|
505
|
+
case "right":
|
|
506
|
+
el.style.borderRight = `40px solid ${color}`;
|
|
507
|
+
break;
|
|
508
|
+
case "top":
|
|
509
|
+
el.style.borderTop = `10px solid ${color}`;
|
|
510
|
+
break;
|
|
511
|
+
case "bottom":
|
|
512
|
+
el.style.borderBottom = `10px solid ${color}`;
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
props2.onInput$?.(color);
|
|
516
|
+
}, "ColorInput_component_div_ColorPickerRaw_onInput_wTO4B2czR7s", [
|
|
517
|
+
props1,
|
|
518
|
+
props
|
|
519
|
+
]),
|
|
520
|
+
[_IMMUTABLE]: {
|
|
521
|
+
class: _fnSignal((p0) => ({
|
|
522
|
+
"transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
|
|
523
|
+
"opacity-0 pointer-events-none scale-95": !p0.opened
|
|
524
|
+
}), [
|
|
525
|
+
store
|
|
526
|
+
], '{"transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]":true,"opacity-0 pointer-events-none scale-95":!p0.opened}'),
|
|
527
|
+
color: _fnSignal((p0) => p0.value ?? "#000000", [
|
|
528
|
+
props
|
|
529
|
+
], 'p0.value??"#000000"'),
|
|
530
|
+
colors: _fnSignal((p0) => [
|
|
531
|
+
"#FAEDCB",
|
|
532
|
+
"#C9E4DE",
|
|
533
|
+
"#C6DEF1",
|
|
534
|
+
"#DBCDF0",
|
|
535
|
+
"#F2C6DE",
|
|
536
|
+
"#FCD05C",
|
|
537
|
+
"#5FE2C5",
|
|
538
|
+
"#4498DB",
|
|
539
|
+
"#9863E7",
|
|
540
|
+
"#E43A96",
|
|
541
|
+
...p0.presetColors ?? []
|
|
542
|
+
], [
|
|
543
|
+
props
|
|
544
|
+
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]'),
|
|
545
|
+
id: _wrapProp(props1, "id")
|
|
546
|
+
}
|
|
547
|
+
}, 3, "0s_2")
|
|
548
|
+
], 1, "0s_3");
|
|
1007
549
|
}, "ColorInput_component_jilGo0Bn3Ps"));
|
|
550
|
+
const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
551
|
+
const props1 = _restProps(props, [
|
|
552
|
+
"id",
|
|
553
|
+
"color",
|
|
554
|
+
"colors",
|
|
555
|
+
"onInput$"
|
|
556
|
+
]);
|
|
557
|
+
const width = 125;
|
|
558
|
+
const maxHue = 148;
|
|
559
|
+
const hsvColor = rgbToHsv(hexNumberToRgb(hexStringToNumber(props.color)));
|
|
560
|
+
const store = useStore({
|
|
561
|
+
hue: {
|
|
562
|
+
position: hsvColor.h * maxHue,
|
|
563
|
+
color: rgbToHex(hsvToRgb({
|
|
564
|
+
h: hsvColor.h,
|
|
565
|
+
s: 1,
|
|
566
|
+
v: 1
|
|
567
|
+
}))
|
|
568
|
+
},
|
|
569
|
+
bPosition: (1 - hsvColor.v) * maxHue,
|
|
570
|
+
sPosition: hsvColor.s * width,
|
|
571
|
+
color: props.color
|
|
572
|
+
});
|
|
573
|
+
const setColor = /* @__PURE__ */ inlinedQrl((color) => {
|
|
574
|
+
const [maxHue2, props2, store2, width2] = useLexicalScope();
|
|
575
|
+
store2.color = color;
|
|
576
|
+
const hsv = rgbToHsv(hexNumberToRgb(hexStringToNumber(color)));
|
|
577
|
+
store2.hue.position = hsv.h * maxHue2;
|
|
578
|
+
store2.hue.color = rgbToHex(hsvToRgb({
|
|
579
|
+
h: hsv.h,
|
|
580
|
+
s: 1,
|
|
581
|
+
v: 1
|
|
582
|
+
}));
|
|
583
|
+
store2.sPosition = hsv.s * width2;
|
|
584
|
+
store2.bPosition = (1 - hsv.v) * maxHue2;
|
|
585
|
+
props2.onInput$?.(color);
|
|
586
|
+
}, "ColorPickerRaw_component_setColor_KSE5T0GnULs", [
|
|
587
|
+
maxHue,
|
|
588
|
+
props,
|
|
589
|
+
store,
|
|
590
|
+
width
|
|
591
|
+
]);
|
|
592
|
+
const hueChange = /* @__PURE__ */ inlinedQrl((e, hOffset) => {
|
|
593
|
+
const [maxHue2, props2, store2] = useLexicalScope();
|
|
594
|
+
const { y } = getMousePosition(e);
|
|
595
|
+
store2.hue.position = clamp(maxHue2 - (y - hOffset), 0, maxHue2);
|
|
596
|
+
const hsvColor2 = rgbToHsv(hexNumberToRgb(hexStringToNumber(store2.color)));
|
|
597
|
+
const h = store2.hue.position / maxHue2;
|
|
598
|
+
hsvColor2.h = h;
|
|
599
|
+
store2.hue.color = rgbToHex(hsvToRgb({
|
|
600
|
+
h,
|
|
601
|
+
s: 1,
|
|
602
|
+
v: 1
|
|
603
|
+
}));
|
|
604
|
+
store2.color = rgbToHex(hsvToRgb(hsvColor2));
|
|
605
|
+
props2.onInput$?.(store2.color);
|
|
606
|
+
}, "ColorPickerRaw_component_hueChange_za4ruRb84uA", [
|
|
607
|
+
maxHue,
|
|
608
|
+
props,
|
|
609
|
+
store
|
|
610
|
+
]);
|
|
611
|
+
const hueMouseDown = /* @__PURE__ */ inlinedQrl((e, el) => {
|
|
612
|
+
const [hueChange2] = useLexicalScope();
|
|
613
|
+
const hOffset = el.getBoundingClientRect().top;
|
|
614
|
+
hueChange2(e, hOffset);
|
|
615
|
+
const eventListener = (e2) => hueChange2(e2, hOffset);
|
|
616
|
+
window.addEventListener("mousemove", eventListener);
|
|
617
|
+
window.addEventListener("touchmove", eventListener);
|
|
618
|
+
const mouseUpListener = () => {
|
|
619
|
+
window.removeEventListener("mousemove", eventListener);
|
|
620
|
+
window.removeEventListener("touchmove", eventListener);
|
|
621
|
+
window.removeEventListener("mouseup", mouseUpListener);
|
|
622
|
+
window.removeEventListener("touchend", mouseUpListener);
|
|
623
|
+
};
|
|
624
|
+
window.addEventListener("mouseup", mouseUpListener);
|
|
625
|
+
window.addEventListener("touchend", mouseUpListener);
|
|
626
|
+
}, "ColorPickerRaw_component_hueMouseDown_IbHBnI0jzpg", [
|
|
627
|
+
hueChange
|
|
628
|
+
]);
|
|
629
|
+
const sbChange = /* @__PURE__ */ inlinedQrl((e, hOffset) => {
|
|
630
|
+
const [maxHue2, props2, store2, width2] = useLexicalScope();
|
|
631
|
+
const { x, y } = getMousePosition(e);
|
|
632
|
+
store2.bPosition = clamp(y - hOffset.top, 0, maxHue2);
|
|
633
|
+
store2.sPosition = clamp(x - hOffset.left, 0, width2);
|
|
634
|
+
const s = store2.sPosition / width2;
|
|
635
|
+
const v = 1 - store2.bPosition / maxHue2;
|
|
636
|
+
store2.color = rgbToHex(hsvToRgb({
|
|
637
|
+
h: store2.hue.position / maxHue2,
|
|
638
|
+
s,
|
|
639
|
+
v
|
|
640
|
+
}));
|
|
641
|
+
props2.onInput$?.(store2.color);
|
|
642
|
+
}, "ColorPickerRaw_component_sbChange_yhwlg2HYP8Y", [
|
|
643
|
+
maxHue,
|
|
644
|
+
props,
|
|
645
|
+
store,
|
|
646
|
+
width
|
|
647
|
+
]);
|
|
648
|
+
const sbMouseDown = /* @__PURE__ */ inlinedQrl((e, el) => {
|
|
649
|
+
const [sbChange2] = useLexicalScope();
|
|
650
|
+
const offset = el.getBoundingClientRect();
|
|
651
|
+
sbChange2(e, offset);
|
|
652
|
+
const eventListener = (e2) => sbChange2(e2, offset);
|
|
653
|
+
window.addEventListener("mousemove", eventListener);
|
|
654
|
+
window.addEventListener("touchmove", eventListener);
|
|
655
|
+
const mouseUpListener = () => {
|
|
656
|
+
window.removeEventListener("mousemove", eventListener);
|
|
657
|
+
window.removeEventListener("touchmove", eventListener);
|
|
658
|
+
window.removeEventListener("mouseup", mouseUpListener);
|
|
659
|
+
window.removeEventListener("touchend", mouseUpListener);
|
|
660
|
+
};
|
|
661
|
+
window.addEventListener("mouseup", mouseUpListener);
|
|
662
|
+
window.addEventListener("touchend", mouseUpListener);
|
|
663
|
+
}, "ColorPickerRaw_component_sbMouseDown_hRgkP7lymfY", [
|
|
664
|
+
sbChange
|
|
665
|
+
]);
|
|
666
|
+
useOn("change", /* @__PURE__ */ inlinedQrl(() => {
|
|
667
|
+
const [props2, setColor2] = useLexicalScope();
|
|
668
|
+
if (!props2.id)
|
|
669
|
+
return;
|
|
670
|
+
const inputElement = document.getElementById(props2.id);
|
|
671
|
+
if (!inputElement)
|
|
672
|
+
return;
|
|
673
|
+
setColor2(inputElement.value);
|
|
674
|
+
}, "ColorPickerRaw_component_useOn_hsh00WCnzOE", [
|
|
675
|
+
props,
|
|
676
|
+
setColor
|
|
677
|
+
]));
|
|
678
|
+
return /* @__PURE__ */ _jsxQ("div", {
|
|
679
|
+
class: {
|
|
680
|
+
"transition-all p-4 bg-gray-800/50 backdrop-blur-xl flex flex-col gap-6 rounded-lg border border-gray-700 touch-none": true,
|
|
681
|
+
...props1.class
|
|
682
|
+
}
|
|
683
|
+
}, {
|
|
684
|
+
id: _fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
|
|
685
|
+
props
|
|
686
|
+
], "p0.id?`${p0.id}-picker`:undefined"),
|
|
687
|
+
"preventdefault:mousedown": true,
|
|
688
|
+
"preventdefault:touchstart": true
|
|
689
|
+
}, [
|
|
690
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
691
|
+
class: "flex gap-4"
|
|
692
|
+
}, [
|
|
693
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
694
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md relative",
|
|
695
|
+
onMouseDown$: sbMouseDown,
|
|
696
|
+
onTouchStart$: sbMouseDown,
|
|
697
|
+
"preventdefault:mousedown": true,
|
|
698
|
+
"preventdefault:touchstart": true,
|
|
699
|
+
style: _fnSignal((p0) => ({
|
|
700
|
+
background: `linear-gradient(to right, #FFFFFF, ${p0.hue.color})`
|
|
701
|
+
}), [
|
|
702
|
+
store
|
|
703
|
+
], "{background:`linear-gradient(to right, #FFFFFF, ${p0.hue.color})`}")
|
|
704
|
+
}, [
|
|
705
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
706
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md bg-gradient-to-b from-transparent to-black"
|
|
707
|
+
}, null, 3, null),
|
|
708
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
709
|
+
class: "absolute -top-2 -left-2 w-4 h-4 border border-white rounded-full bg-white",
|
|
710
|
+
style: _fnSignal((p0) => ({
|
|
711
|
+
background: p0.color,
|
|
712
|
+
transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
|
|
713
|
+
}), [
|
|
714
|
+
store
|
|
715
|
+
], "{background:p0.color,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
|
|
716
|
+
}, null, 3, null)
|
|
717
|
+
], 3, null),
|
|
718
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
719
|
+
class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
|
|
720
|
+
onMouseDown$: hueMouseDown,
|
|
721
|
+
onTouchStart$: hueMouseDown,
|
|
722
|
+
"preventdefault:mousedown": true,
|
|
723
|
+
"preventdefault:touchstart": true,
|
|
724
|
+
style: {
|
|
725
|
+
background: "linear-gradient(to bottom, #ff0000, #ff00ff, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000)"
|
|
726
|
+
}
|
|
727
|
+
}, /* @__PURE__ */ _jsxQ("div", null, {
|
|
728
|
+
class: "absolute -bottom-2 -left-[5px] w-4 h-4 border border-white rounded-full bg-[#ff0000]",
|
|
729
|
+
style: _fnSignal((p0) => ({
|
|
730
|
+
transform: `translateY(${-p0.hue.position}px)`,
|
|
731
|
+
background: p0.hue.color
|
|
732
|
+
}), [
|
|
733
|
+
store
|
|
734
|
+
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
735
|
+
}, null, 3, null), 3, null)
|
|
736
|
+
], 3, null),
|
|
737
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
738
|
+
class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
|
|
739
|
+
}, props.colors.map((color, i) => {
|
|
740
|
+
return /* @__PURE__ */ _jsxQ("button", {
|
|
741
|
+
onMouseDown$: /* @__PURE__ */ inlinedQrl(() => {
|
|
742
|
+
const [color2, setColor2] = useLexicalScope();
|
|
743
|
+
setColor2(color2);
|
|
744
|
+
}, "ColorPickerRaw_component_div_div_button_onMouseDown_C5tqQYvx7wA", [
|
|
745
|
+
color,
|
|
746
|
+
setColor
|
|
747
|
+
]),
|
|
748
|
+
onTouchStart$: /* @__PURE__ */ inlinedQrl(() => {
|
|
749
|
+
const [color2, setColor2] = useLexicalScope();
|
|
750
|
+
setColor2(color2);
|
|
751
|
+
}, "ColorPickerRaw_component_div_div_button_onTouchStart_qgiiO8Blb88", [
|
|
752
|
+
color,
|
|
753
|
+
setColor
|
|
754
|
+
]),
|
|
755
|
+
style: `background: ${color}`
|
|
756
|
+
}, {
|
|
757
|
+
class: "w-[25px] h-[25px] border border-gray-700 rounded-md hover:scale-110 transition-all",
|
|
758
|
+
"preventdefault:mousedown": true,
|
|
759
|
+
"preventdefault:touchstart": true
|
|
760
|
+
}, null, 2, i);
|
|
761
|
+
}), 1, null)
|
|
762
|
+
], 1, "0s_4");
|
|
763
|
+
}, "ColorPickerRaw_component_CWQPPcezhyA"));
|
|
1008
764
|
const LoadingIcon = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1009
765
|
const props1 = _restProps(props, [
|
|
1010
766
|
"width",
|
|
@@ -1970,6 +1726,7 @@ export {
|
|
|
1970
1726
|
ButtonAnchor,
|
|
1971
1727
|
Card,
|
|
1972
1728
|
ColorInput,
|
|
1729
|
+
ColorPickerRaw,
|
|
1973
1730
|
Header,
|
|
1974
1731
|
InputClasses,
|
|
1975
1732
|
LoadingIcon,
|