@luminescent/ui 0.7.6 → 0.8.0

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