@luminescent/ui 0.8.0 → 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/lib/index.qwik.cjs
CHANGED
|
@@ -434,6 +434,16 @@ const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
434
434
|
}, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
|
|
435
435
|
store
|
|
436
436
|
]),
|
|
437
|
+
onInput$: /* @__PURE__ */ qwik.inlinedQrl((e, el) => {
|
|
438
|
+
const [props12, props2] = qwik.useLexicalScope();
|
|
439
|
+
const div = document.getElementById(`${props12.id}-picker`);
|
|
440
|
+
const event = new Event("change");
|
|
441
|
+
div.dispatchEvent(event);
|
|
442
|
+
props2.onInput$?.(el.value);
|
|
443
|
+
}, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
|
|
444
|
+
props1,
|
|
445
|
+
props
|
|
446
|
+
]),
|
|
437
447
|
style: (props.preview ?? "left") == "full" ? {
|
|
438
448
|
backgroundColor: `${props.value ?? "#000000"}`,
|
|
439
449
|
color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
|
|
@@ -455,6 +465,9 @@ const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
455
465
|
}
|
|
456
466
|
}, 0, "0s_1"),
|
|
457
467
|
/* @__PURE__ */ qwik._jsxC(ColorPickerRaw, {
|
|
468
|
+
get id() {
|
|
469
|
+
return props1.id;
|
|
470
|
+
},
|
|
458
471
|
get color() {
|
|
459
472
|
return props.value ?? "#000000";
|
|
460
473
|
},
|
|
@@ -530,13 +543,15 @@ const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
530
543
|
...p0.presetColors ?? []
|
|
531
544
|
], [
|
|
532
545
|
props
|
|
533
|
-
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]')
|
|
546
|
+
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]'),
|
|
547
|
+
id: qwik._wrapProp(props1, "id")
|
|
534
548
|
}
|
|
535
549
|
}, 3, "0s_2")
|
|
536
550
|
], 1, "0s_3");
|
|
537
551
|
}, "ColorInput_component_jilGo0Bn3Ps"));
|
|
538
552
|
const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
539
553
|
const props1 = qwik._restProps(props, [
|
|
554
|
+
"id",
|
|
540
555
|
"color",
|
|
541
556
|
"colors",
|
|
542
557
|
"onInput$"
|
|
@@ -650,60 +665,79 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
650
665
|
}, "ColorPickerRaw_component_sbMouseDown_hRgkP7lymfY", [
|
|
651
666
|
sbChange
|
|
652
667
|
]);
|
|
668
|
+
qwik.useOn("change", /* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
669
|
+
const [props2, setColor2] = qwik.useLexicalScope();
|
|
670
|
+
if (!props2.id)
|
|
671
|
+
return;
|
|
672
|
+
const inputElement = document.getElementById(props2.id);
|
|
673
|
+
if (!inputElement)
|
|
674
|
+
return;
|
|
675
|
+
setColor2(inputElement.value);
|
|
676
|
+
}, "ColorPickerRaw_component_useOn_hsh00WCnzOE", [
|
|
677
|
+
props,
|
|
678
|
+
setColor
|
|
679
|
+
]));
|
|
653
680
|
return /* @__PURE__ */ qwik._jsxQ("div", {
|
|
654
681
|
class: {
|
|
655
|
-
"transition-all p-4
|
|
682
|
+
"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,
|
|
656
683
|
...props1.class
|
|
657
684
|
}
|
|
658
685
|
}, {
|
|
686
|
+
id: qwik._fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
|
|
687
|
+
props
|
|
688
|
+
], "p0.id?`${p0.id}-picker`:undefined"),
|
|
659
689
|
"preventdefault:mousedown": true,
|
|
660
690
|
"preventdefault:touchstart": true
|
|
661
691
|
}, [
|
|
662
692
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
663
|
-
class: "
|
|
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})`}")
|
|
693
|
+
class: "flex gap-4"
|
|
673
694
|
}, [
|
|
674
695
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
675
|
-
class: "w-[125px] h-[150px] border border-gray-700 rounded-md
|
|
676
|
-
|
|
696
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md relative",
|
|
697
|
+
onMouseDown$: sbMouseDown,
|
|
698
|
+
onTouchStart$: sbMouseDown,
|
|
699
|
+
"preventdefault:mousedown": true,
|
|
700
|
+
"preventdefault:touchstart": true,
|
|
701
|
+
style: qwik._fnSignal((p0) => ({
|
|
702
|
+
background: `linear-gradient(to right, #FFFFFF, ${p0.hue.color})`
|
|
703
|
+
}), [
|
|
704
|
+
store
|
|
705
|
+
], "{background:`linear-gradient(to right, #FFFFFF, ${p0.hue.color})`}")
|
|
706
|
+
}, [
|
|
707
|
+
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
708
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md bg-gradient-to-b from-transparent to-black"
|
|
709
|
+
}, null, 3, null),
|
|
710
|
+
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
711
|
+
class: "absolute -top-2 -left-2 w-4 h-4 border border-white rounded-full bg-white",
|
|
712
|
+
style: qwik._fnSignal((p0) => ({
|
|
713
|
+
background: p0.color,
|
|
714
|
+
transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
|
|
715
|
+
}), [
|
|
716
|
+
store
|
|
717
|
+
], "{background:p0.color,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
|
|
718
|
+
}, null, 3, null)
|
|
719
|
+
], 3, null),
|
|
677
720
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
678
|
-
class: "
|
|
721
|
+
class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
|
|
722
|
+
onMouseDown$: hueMouseDown,
|
|
723
|
+
onTouchStart$: hueMouseDown,
|
|
724
|
+
"preventdefault:mousedown": true,
|
|
725
|
+
"preventdefault:touchstart": true,
|
|
726
|
+
style: {
|
|
727
|
+
background: "linear-gradient(to bottom, #ff0000, #ff00ff, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000)"
|
|
728
|
+
}
|
|
729
|
+
}, /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
730
|
+
class: "absolute -bottom-2 -left-[5px] w-4 h-4 border border-white rounded-full bg-[#ff0000]",
|
|
679
731
|
style: qwik._fnSignal((p0) => ({
|
|
680
|
-
|
|
681
|
-
|
|
732
|
+
transform: `translateY(${-p0.hue.position}px)`,
|
|
733
|
+
background: p0.hue.color
|
|
682
734
|
}), [
|
|
683
735
|
store
|
|
684
|
-
], "{
|
|
685
|
-
}, null, 3, null)
|
|
736
|
+
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
737
|
+
}, null, 3, null), 3, null)
|
|
686
738
|
], 3, null),
|
|
687
739
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
688
|
-
class: "
|
|
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"
|
|
740
|
+
class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
|
|
707
741
|
}, props.colors.map((color, i) => {
|
|
708
742
|
return /* @__PURE__ */ qwik._jsxQ("button", {
|
|
709
743
|
onMouseDown$: /* @__PURE__ */ qwik.inlinedQrl(() => {
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _wrapSignal, useStore, useLexicalScope, _IMMUTABLE, _jsxBranch, useStylesQrl } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _wrapSignal, useStore, useLexicalScope, _IMMUTABLE, _wrapProp, useOn, _jsxBranch, useStylesQrl } from "@builder.io/qwik";
|
|
2
2
|
import { Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const Anchor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => /* @__PURE__ */ _jsxQ("span", null, {
|
|
4
4
|
class: "block h-32 -mt-32",
|
|
@@ -432,6 +432,16 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
432
432
|
}, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
|
|
433
433
|
store
|
|
434
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", [
|
|
442
|
+
props1,
|
|
443
|
+
props
|
|
444
|
+
]),
|
|
435
445
|
style: (props.preview ?? "left") == "full" ? {
|
|
436
446
|
backgroundColor: `${props.value ?? "#000000"}`,
|
|
437
447
|
color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
|
|
@@ -453,6 +463,9 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
453
463
|
}
|
|
454
464
|
}, 0, "0s_1"),
|
|
455
465
|
/* @__PURE__ */ _jsxC(ColorPickerRaw, {
|
|
466
|
+
get id() {
|
|
467
|
+
return props1.id;
|
|
468
|
+
},
|
|
456
469
|
get color() {
|
|
457
470
|
return props.value ?? "#000000";
|
|
458
471
|
},
|
|
@@ -528,13 +541,15 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
528
541
|
...p0.presetColors ?? []
|
|
529
542
|
], [
|
|
530
543
|
props
|
|
531
|
-
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]')
|
|
544
|
+
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]'),
|
|
545
|
+
id: _wrapProp(props1, "id")
|
|
532
546
|
}
|
|
533
547
|
}, 3, "0s_2")
|
|
534
548
|
], 1, "0s_3");
|
|
535
549
|
}, "ColorInput_component_jilGo0Bn3Ps"));
|
|
536
550
|
const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
537
551
|
const props1 = _restProps(props, [
|
|
552
|
+
"id",
|
|
538
553
|
"color",
|
|
539
554
|
"colors",
|
|
540
555
|
"onInput$"
|
|
@@ -648,60 +663,79 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
648
663
|
}, "ColorPickerRaw_component_sbMouseDown_hRgkP7lymfY", [
|
|
649
664
|
sbChange
|
|
650
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
|
+
]));
|
|
651
678
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
652
679
|
class: {
|
|
653
|
-
"transition-all p-4
|
|
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,
|
|
654
681
|
...props1.class
|
|
655
682
|
}
|
|
656
683
|
}, {
|
|
684
|
+
id: _fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
|
|
685
|
+
props
|
|
686
|
+
], "p0.id?`${p0.id}-picker`:undefined"),
|
|
657
687
|
"preventdefault:mousedown": true,
|
|
658
688
|
"preventdefault:touchstart": true
|
|
659
689
|
}, [
|
|
660
690
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
661
|
-
class: "
|
|
662
|
-
onMouseDown$: sbMouseDown,
|
|
663
|
-
onTouchStart$: sbMouseDown,
|
|
664
|
-
"preventdefault:mousedown": true,
|
|
665
|
-
"preventdefault:touchstart": true,
|
|
666
|
-
style: _fnSignal((p0) => ({
|
|
667
|
-
background: `linear-gradient(to right, #FFFFFF, ${p0.hue.color})`
|
|
668
|
-
}), [
|
|
669
|
-
store
|
|
670
|
-
], "{background:`linear-gradient(to right, #FFFFFF, ${p0.hue.color})`}")
|
|
691
|
+
class: "flex gap-4"
|
|
671
692
|
}, [
|
|
672
693
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
673
|
-
class: "w-[125px] h-[150px] border border-gray-700 rounded-md
|
|
674
|
-
|
|
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),
|
|
675
718
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
676
|
-
class: "
|
|
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]",
|
|
677
729
|
style: _fnSignal((p0) => ({
|
|
678
|
-
|
|
679
|
-
|
|
730
|
+
transform: `translateY(${-p0.hue.position}px)`,
|
|
731
|
+
background: p0.hue.color
|
|
680
732
|
}), [
|
|
681
733
|
store
|
|
682
|
-
], "{
|
|
683
|
-
}, null, 3, null)
|
|
734
|
+
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
735
|
+
}, null, 3, null), 3, null)
|
|
684
736
|
], 3, null),
|
|
685
737
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
686
|
-
class: "
|
|
687
|
-
onMouseDown$: hueMouseDown,
|
|
688
|
-
onTouchStart$: hueMouseDown,
|
|
689
|
-
"preventdefault:mousedown": true,
|
|
690
|
-
"preventdefault:touchstart": true,
|
|
691
|
-
style: {
|
|
692
|
-
background: "linear-gradient(to bottom, #ff0000, #ff00ff, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000)"
|
|
693
|
-
}
|
|
694
|
-
}, /* @__PURE__ */ _jsxQ("div", null, {
|
|
695
|
-
class: "absolute -bottom-2 -left-[5px] w-4 h-4 border border-white rounded-full bg-[#ff0000]",
|
|
696
|
-
style: _fnSignal((p0) => ({
|
|
697
|
-
transform: `translateY(${-p0.hue.position}px)`,
|
|
698
|
-
background: p0.hue.color
|
|
699
|
-
}), [
|
|
700
|
-
store
|
|
701
|
-
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
702
|
-
}, null, 3, null), 3, null),
|
|
703
|
-
/* @__PURE__ */ _jsxQ("div", null, {
|
|
704
|
-
class: "h-[150px] flex flex-col flex-wrap gap-1 justify-evenly"
|
|
738
|
+
class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
|
|
705
739
|
}, props.colors.map((color, i) => {
|
|
706
740
|
return /* @__PURE__ */ _jsxQ("button", {
|
|
707
741
|
onMouseDown$: /* @__PURE__ */ inlinedQrl(() => {
|
package/package.json
CHANGED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { Color } from './color';
|
|
2
|
-
type ColorPickerOptions = {
|
|
3
|
-
window?: Window;
|
|
4
|
-
el?: HTMLElement | string;
|
|
5
|
-
background?: string | number;
|
|
6
|
-
widthUnits?: string;
|
|
7
|
-
heightUnits?: string;
|
|
8
|
-
width?: number;
|
|
9
|
-
height?: number;
|
|
10
|
-
color?: string | number;
|
|
11
|
-
colors?: string[] | number[];
|
|
12
|
-
};
|
|
13
|
-
export declare class ColorPicker {
|
|
14
|
-
private _window;
|
|
15
|
-
private _document;
|
|
16
|
-
private _widthUnits;
|
|
17
|
-
private _heightUnits;
|
|
18
|
-
private _huePosition;
|
|
19
|
-
private _hueHeight;
|
|
20
|
-
private _maxHue;
|
|
21
|
-
_inputIsNumber: boolean;
|
|
22
|
-
private _saturationWidth;
|
|
23
|
-
private _isChoosing;
|
|
24
|
-
private _callbacks;
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
hue: number;
|
|
28
|
-
position: {
|
|
29
|
-
x: number;
|
|
30
|
-
y: number;
|
|
31
|
-
};
|
|
32
|
-
color: Color;
|
|
33
|
-
backgroundColor: Color;
|
|
34
|
-
hueColor: Color;
|
|
35
|
-
$el: HTMLElement;
|
|
36
|
-
$saturation: HTMLElement;
|
|
37
|
-
$hue: HTMLElement;
|
|
38
|
-
$sbSelector: HTMLElement;
|
|
39
|
-
$hSelector: HTMLElement;
|
|
40
|
-
$colors?: HTMLElement;
|
|
41
|
-
constructor(options?: ColorPickerOptions);
|
|
42
|
-
/**
|
|
43
|
-
* Add the ColorPicker instance to a DOM element.
|
|
44
|
-
* @param {HTMLElement} el
|
|
45
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
46
|
-
*/
|
|
47
|
-
appendTo(el: HTMLElement | string): this;
|
|
48
|
-
/**
|
|
49
|
-
* Removes picker from its parent and kill all listeners.
|
|
50
|
-
* Call this method for proper destroy.
|
|
51
|
-
*/
|
|
52
|
-
remove(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Manually set the current color of the picker. This is the method
|
|
55
|
-
* used on instantiation to convert `color` option to actual color for
|
|
56
|
-
* the picker. Param can be a hexadecimal number or an hex String.
|
|
57
|
-
* @param {String|Number} color hex color desired
|
|
58
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
59
|
-
*/
|
|
60
|
-
setColor(color: string | number): this;
|
|
61
|
-
/**
|
|
62
|
-
* Set size of the color picker for a given width and height. Note that
|
|
63
|
-
* a padding of 5px will be added if you chose to use the background option
|
|
64
|
-
* of the constructor.
|
|
65
|
-
* @param {Number} width
|
|
66
|
-
* @param {Number} height
|
|
67
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
68
|
-
*/
|
|
69
|
-
setSize(width: number, height: number): this;
|
|
70
|
-
/**
|
|
71
|
-
* Set the background color of the picker. It also adds a 5px padding
|
|
72
|
-
* for design purpose.
|
|
73
|
-
* @param {String|Number} color hex color desired for background
|
|
74
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
75
|
-
*/
|
|
76
|
-
setBackgroundColor(color: string | number): this;
|
|
77
|
-
/**
|
|
78
|
-
* Removes background of the picker if previously set. It's no use
|
|
79
|
-
* calling this method if you didn't set the background option on start
|
|
80
|
-
* or if you didn't call setBackgroundColor previously.
|
|
81
|
-
*/
|
|
82
|
-
setNoBackground(): this;
|
|
83
|
-
/**
|
|
84
|
-
* Registers callback to the update event of the picker.
|
|
85
|
-
* picker inherits from [component/emitter](https://github.com/component/emitter)
|
|
86
|
-
* so you could do the same thing by calling `colorPicker.on('update');`
|
|
87
|
-
* @param {Function} callback
|
|
88
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
89
|
-
*/
|
|
90
|
-
onChange(callback: Function): this;
|
|
91
|
-
/**
|
|
92
|
-
* Is true when mouse is down and user is currently choosing a color.
|
|
93
|
-
*/
|
|
94
|
-
get isChoosing(): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Main color getter, will return a formatted color string depending on input
|
|
97
|
-
* or a number depending on the last setColor call.
|
|
98
|
-
* @return {Number|String}
|
|
99
|
-
*/
|
|
100
|
-
getColor(): string | number;
|
|
101
|
-
/**
|
|
102
|
-
* Returns color as css hex string (ex: '#FF0000').
|
|
103
|
-
* @return {String}
|
|
104
|
-
*/
|
|
105
|
-
getHexString(): string;
|
|
106
|
-
/**
|
|
107
|
-
* Returns color as number (ex: 0xFF0000).
|
|
108
|
-
* @return {Number}
|
|
109
|
-
*/
|
|
110
|
-
getHexNumber(): number;
|
|
111
|
-
/**
|
|
112
|
-
* Returns color as {r: 1, g: 0, b: 0} object.
|
|
113
|
-
* @return {Object}
|
|
114
|
-
*/
|
|
115
|
-
getRGB(): import("./color").RGBAColor;
|
|
116
|
-
/**
|
|
117
|
-
* Returns color as {h: 100, s: 1, v: 1} object.
|
|
118
|
-
* @return {Object}
|
|
119
|
-
*/
|
|
120
|
-
getHSV(): import("./color").HSVAColor;
|
|
121
|
-
/**
|
|
122
|
-
* Returns true if color is perceived as dark
|
|
123
|
-
* @return {Boolean}
|
|
124
|
-
*/
|
|
125
|
-
isDark(): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Returns true if color is perceived as light
|
|
128
|
-
* @return {Boolean}
|
|
129
|
-
*/
|
|
130
|
-
isLight(): boolean;
|
|
131
|
-
private _moveSelectorTo;
|
|
132
|
-
private _updateColorFromPosition;
|
|
133
|
-
private _moveHueTo;
|
|
134
|
-
private _updateHueFromPosition;
|
|
135
|
-
private _updateHue;
|
|
136
|
-
private _updateColor;
|
|
137
|
-
private _triggerChange;
|
|
138
|
-
private _onSaturationMouseDown;
|
|
139
|
-
private _onSaturationMouseMove;
|
|
140
|
-
private _onSaturationMouseUp;
|
|
141
|
-
private _onHueMouseDown;
|
|
142
|
-
private _onHueMouseMove;
|
|
143
|
-
private _onHueMouseUp;
|
|
144
|
-
}
|
|
145
|
-
export {};
|