@luzmo/lucero 1.0.1-alpha.4 → 1.0.1-alpha.40
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/components/accordion/index.cjs +6 -6
- package/components/accordion/index.js +14 -13
- package/components/action-bar/index.cjs +4 -4
- package/components/action-bar/index.js +20 -18
- package/components/action-button/index.cjs +3 -3
- package/components/action-button/index.js +7 -6
- package/components/action-group/index.cjs +1 -1
- package/components/action-group/index.js +2 -2
- package/components/{action-group-DBImibFn.js → action-group-Bwt9w8Vh.js} +10 -9
- package/components/action-group-D917z7XF.cjs +20 -0
- package/components/action-menu/index.cjs +9 -9
- package/components/action-menu/index.js +10 -10
- package/components/avatar/index.cjs +3 -3
- package/components/avatar/index.js +7 -7
- package/components/base-5nDSSNeT.cjs +18 -0
- package/components/base-CdYjmV_8.js +96 -0
- package/components/button/button-base.d.ts +16 -0
- package/components/button/button.d.ts +38 -2
- package/components/button/index.cjs +2 -2
- package/components/button/index.js +37 -32
- package/components/{button-base-DbkDzb71.js → button-base-B5uul3tZ.js} +54 -39
- package/components/button-base-C7or8-FB.cjs +25 -0
- package/components/button-group/index.cjs +1 -1
- package/components/button-group/index.js +11 -9
- package/components/calendar/index.cjs +96 -1
- package/components/calendar/index.js +538 -6
- package/components/checkbox/index.cjs +4 -4
- package/components/checkbox/index.js +10 -8
- package/components/{checkbox-mixin-Do7EgtpQ.js → checkbox-mixin-DUbGDm7f.js} +9 -9
- package/components/{checkbox-mixin-BDN0dBtS.cjs → checkbox-mixin-DhN8CIXY.cjs} +3 -3
- package/components/{clear-button-DoeRUWQ3.js → clear-button-Bjp7N52G.js} +14 -13
- package/components/clear-button-C39c3PH0.cjs +18 -0
- package/components/close-button-C4zqQJRL.cjs +18 -0
- package/components/close-button-R-Cyxi_j.js +52 -0
- package/components/color-area/index.cjs +5 -5
- package/components/color-area/index.js +12 -11
- package/components/color-controller-7sNUf7SP.js +386 -0
- package/components/color-controller-ChN-A9Ft.cjs +18 -0
- package/components/color-field/color-field.d.ts +8 -0
- package/components/color-field/index.cjs +4 -4
- package/components/color-field/index.js +38 -25
- package/components/color-handle/index.cjs +2 -2
- package/components/color-handle/index.js +8 -6
- package/components/color-loupe/index.cjs +1 -1
- package/components/color-loupe/index.js +2 -2
- package/components/color-loupe-CIEFp7ln.cjs +56 -0
- package/components/{color-loupe-CmMsXbjT.js → color-loupe-CLPX6xVb.js} +6 -4
- package/components/color-menu/index.cjs +8 -8
- package/components/color-menu/index.js +46 -46
- package/components/color-palette/color-palette.d.ts +6 -2
- package/components/color-palette/index.cjs +1 -1
- package/components/color-palette/index.js +35 -34
- package/components/color-palette-group/color-palette-group.d.ts +79 -0
- package/components/color-palette-group/index.cjs +28 -0
- package/components/color-palette-group/index.d.ts +7 -0
- package/components/color-palette-group/index.js +206 -0
- package/components/color-picker/color-picker.d.ts +31 -2
- package/components/color-picker/index.cjs +6 -5
- package/components/color-picker/index.js +16 -12
- package/components/color-slider/index.cjs +40 -1
- package/components/color-slider/index.js +452 -6
- package/components/date-time-picker/index.cjs +16 -16
- package/components/date-time-picker/index.js +105 -106
- package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-CO-VPlqq.js} +4 -4
- package/components/{dependency-manger-C5HCkMMB.cjs → dependency-manger-uthev62E.cjs} +1 -1
- package/components/divider/index.cjs +1 -1
- package/components/divider/index.js +11 -9
- package/components/field-group/index.cjs +1 -1
- package/components/field-group/index.js +2 -2
- package/components/field-group-BYHNJmv0.cjs +23 -0
- package/components/{field-group-DXfBWrkO.js → field-group-CHmw159R.js} +7 -5
- package/components/field-label/index.cjs +1 -1
- package/components/field-label/index.js +2 -2
- package/components/{field-label-CZ2zzChK.js → field-label-Cy3xMWZ-.js} +9 -8
- package/components/field-label-DZoeqJJX.cjs +25 -0
- package/components/{focus-visible-DBlJGoEW.js → focus-visible-BvScGDCE.js} +20 -20
- package/components/focus-visible-D4BXb5RB.cjs +18 -0
- package/components/{focusable-BxtpnzWp.js → focusable-BjvsvVam.js} +3 -2
- package/components/focusable-CbVKgGfS.cjs +18 -0
- package/components/icon/index.cjs +1 -1
- package/components/icon/index.js +22 -20
- package/components/index.cjs +1 -1
- package/components/index.js +140 -138
- package/components/infield-button/index.cjs +2 -2
- package/components/infield-button/index.js +6 -5
- package/components/label/index.cjs +1 -1
- package/components/label/index.js +7 -5
- package/components/{language-resolution-8yZa5r_P.js → language-resolution-B-wjV5bb.js} +9 -8
- package/components/{directive-C7oCP5Bh.cjs → language-resolution-EUER43cg.cjs} +1 -5
- package/components/like-anchor-B2EqJPdw.cjs +32 -0
- package/components/{like-anchor-Bvn_vLQ8.js → like-anchor-CgqCU210.js} +23 -22
- package/components/{manage-help-text-DhgARkZX.cjs → manage-help-text-Bat9yGvF.cjs} +3 -3
- package/components/{manage-help-text-syYnjKGL.js → manage-help-text-C9sCHK3R.js} +8 -8
- package/components/menu/index.cjs +38 -13
- package/components/menu/index.js +138 -105
- package/components/menu/menu-item.d.ts +8 -1
- package/components/multi-language-field/index.cjs +2 -2
- package/components/multi-language-field/index.js +9 -7
- package/components/number-field/index.cjs +5 -5
- package/components/number-field/index.js +122 -85
- package/components/number-field/number-field.d.ts +145 -0
- package/components/observe-slot-presence-CNltc0C0.cjs +18 -0
- package/components/{observe-slot-presence-CmVi0zTc.js → observe-slot-presence-DFi6GE3H.js} +1 -1
- package/components/observe-slot-text-CBMHpuIK.cjs +18 -0
- package/components/{observe-slot-text-BPfIQQtz.js → observe-slot-text-DorVpCL4.js} +14 -15
- package/components/options/index.cjs +26 -58
- package/components/options/index.js +205 -849
- package/components/overlay/index.cjs +6 -6
- package/components/overlay/index.js +31 -32
- package/components/overlay-BhrVS5h7.cjs +47 -0
- package/components/overlay-C-No3oJQ.js +1736 -0
- package/components/{pending-state-CaH1si5b.cjs → pending-state-DQctFHI8.cjs} +2 -2
- package/components/{pending-state-DTX7ggyF.js → pending-state-Dx1u3EXA.js} +2 -2
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +3 -3
- package/components/{picker-BmoXv1jt.js → picker-Cm6_didQ.js} +44 -44
- package/components/picker-DxYgh4LR.cjs +123 -0
- package/components/picker-button/index.cjs +4 -4
- package/components/picker-button/index.js +8 -7
- package/components/{platform-BiXhwqk3.cjs → platform-BJnOJJag.cjs} +1 -1
- package/components/{platform-BM-uMWpX.js → platform-CqwNrovd.js} +12 -12
- package/components/popover/index.cjs +1 -1
- package/components/popover/index.js +2 -2
- package/components/popover-lcZnODPK.cjs +30 -0
- package/components/{popover-DjX0aAnY.js → popover-ucIgjbQs.js} +8 -7
- package/components/progress-circle/index.cjs +1 -1
- package/components/progress-circle/index.js +2 -2
- package/components/{progress-circle-DXH9z8-6.js → progress-circle-D5J0ZwY0.js} +8 -7
- package/components/progress-circle-DgMbqrzG.cjs +33 -0
- package/components/radio/index.cjs +2 -2
- package/components/radio/index.js +12 -11
- package/components/search/index.cjs +6 -6
- package/components/search/index.js +6 -6
- package/components/select/index.cjs +43 -42
- package/components/select/index.js +142 -126
- package/components/select/select.d.ts +1 -1
- package/components/{base-BjTwmyRF.cjs → sized-mixin-DcvJLFeo.cjs} +1 -5
- package/components/{sized-mixin-D4ACoVUr.js → sized-mixin-cJbo3PKR.js} +5 -5
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +48 -1101
- package/components/{strategies-9indNIEb.js → strategies-Bk97oVn1.js} +15 -50
- package/components/strategies-CNgBb6dM.cjs +18 -0
- package/components/{streaming-listener-CP-JE6Fa.js → streaming-listener-BlWm-XZU.js} +5 -6
- package/components/streaming-listener-D9Wc7skA.cjs +18 -0
- package/components/swatch/index.cjs +7 -7
- package/components/swatch/index.js +18 -17
- package/components/switch/index.cjs +2 -2
- package/components/switch/index.js +6 -5
- package/components/tabs/index.cjs +16 -24
- package/components/tabs/index.js +94 -162
- package/components/tags/index.cjs +4 -4
- package/components/tags/index.js +15 -14
- package/components/text-field/index.cjs +3 -3
- package/components/text-field/index.js +13 -11
- package/components/text-field/text-field.d.ts +1 -0
- package/components/{text-field-BIADXoLC.js → text-field-BHaLKkf1.js} +73 -99
- package/components/text-field-DFP7p8Rv.cjs +81 -0
- package/components/text-field.module-Bp4Mwuvj.js +21 -0
- package/components/text-field.module-eAEqjvZu.cjs +18 -0
- package/components/toast/index.cjs +11 -11
- package/components/toast/index.js +11 -9
- package/components/tooltip/index.cjs +4 -4
- package/components/tooltip/index.js +60 -36
- package/components/tooltip/tooltip.d.ts +12 -1
- package/components/unit-input/index.cjs +6 -6
- package/components/unit-input/index.js +12 -11
- package/components/utils.cjs +1 -1
- package/components/utils.js +6 -6
- package/custom-elements.json +1 -1
- package/index.d.ts +1 -0
- package/package.json +67 -1
- package/components/NumberFormatter-DewVDY5w.cjs +0 -18
- package/components/NumberFormatter-DgOUVrge.js +0 -136
- package/components/NumberParser-Dik4a0h-.cjs +0 -18
- package/components/NumberParser-ci9J5EKv.js +0 -173
- package/components/action-group-DJGMcRHb.cjs +0 -20
- package/components/async-directive-BX1T1e1_.cjs +0 -22
- package/components/async-directive-BfcqVjDp.js +0 -82
- package/components/base-CBCg3yyw.cjs +0 -40
- package/components/base-D76d76ww.js +0 -26
- package/components/base-WsynuqaS.js +0 -677
- package/components/button-base-XgPLmwP-.cjs +0 -25
- package/components/class-map-Di1D_rCm.cjs +0 -22
- package/components/class-map-NbVXqBU0.js +0 -51
- package/components/clear-button-Qi1pMA5S.cjs +0 -18
- package/components/close-button-BFMBEw3q.cjs +0 -18
- package/components/close-button-BWXdHSx3.js +0 -51
- package/components/color-controller-DTp1juRz.js +0 -3198
- package/components/color-controller-_ZwyhvaU.cjs +0 -18
- package/components/color-loupe-CaA_Lfkk.cjs +0 -56
- package/components/directive-helpers-Cm6gitnu.js +0 -62
- package/components/directive-helpers-DyIRTWwA.cjs +0 -22
- package/components/directive-oAbCiebi.js +0 -44
- package/components/field-group-DkGst3r5.cjs +0 -23
- package/components/field-label-mO1AkUgR.cjs +0 -25
- package/components/flow-D-0MTYCm.js +0 -527
- package/components/flow-DM3dNAKs.cjs +0 -30
- package/components/focus-visible-B0P9aY_G.cjs +0 -18
- package/components/focusable-EbipgXRh.cjs +0 -18
- package/components/if-defined-C9YGdo33.cjs +0 -22
- package/components/if-defined-DOaE2coe.js +0 -27
- package/components/index-A-yOTB_d.js +0 -1490
- package/components/index-BLWuwZXx.cjs +0 -113
- package/components/index-BwxgAdzi.cjs +0 -57
- package/components/index-HjQa8tew.js +0 -1174
- package/components/language-resolution-DJzmyzZq.cjs +0 -18
- package/components/like-anchor-sod1C1fR.cjs +0 -32
- package/components/luzmo-icons-DbwDQtuO.js +0 -229
- package/components/luzmo-icons-DletXGWU.cjs +0 -29
- package/components/mutation-controller-DH7YOCyj.js +0 -52
- package/components/mutation-controller-DkOMCW-c.cjs +0 -22
- package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
- package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
- package/components/overlay-Cig9r6uU.js +0 -2747
- package/components/overlay-KSKMzzkh.cjs +0 -47
- package/components/picker-DWsBWdPN.cjs +0 -123
- package/components/popover-KFfO0IYL.cjs +0 -30
- package/components/progress-circle-BvRJNuNo.cjs +0 -33
- package/components/query-BL-TJj7K.cjs +0 -22
- package/components/query-D_KR_GUc.js +0 -51
- package/components/query-assigned-elements-DjfhL1cl.js +0 -36
- package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
- package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
- package/components/query-assigned-nodes-C76XVPWY.js +0 -36
- package/components/sized-mixin-CPxE5C96.cjs +0 -18
- package/components/state-D8JEtYqe.cjs +0 -22
- package/components/state-Deh-vKYE.js +0 -29
- package/components/strategies-BACP6MhR.cjs +0 -18
- package/components/streaming-listener-B00MvALi.cjs +0 -18
- package/components/style-map-CeilmSgs.cjs +0 -22
- package/components/style-map-IgqIKvlE.js +0 -53
- package/components/text-field-D5d_Gt0t.cjs +0 -85
- package/components/text-field.module-ColtFhf_.js +0 -21
- package/components/text-field.module-p_VF2tC_.cjs +0 -18
- package/components/when-CDK1Tt5Y.js +0 -28
- package/components/when-CDZyJPvd.cjs +0 -22
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { unsafeCSS as z, html as v } from "lit";
|
|
19
|
+
import { property as s, query as b } from "lit/decorators.js";
|
|
20
|
+
import { ifDefined as m } from "lit/directives/if-defined.js";
|
|
21
21
|
import "../color-handle/index.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
22
|
+
import { a as y } from "../base-CdYjmV_8.js";
|
|
23
|
+
import { j as x, c as w } from "../platform-CqwNrovd.js";
|
|
24
|
+
import { C } from "../color-controller-7sNUf7SP.js";
|
|
25
|
+
import { L as $ } from "../language-resolution-B-wjV5bb.js";
|
|
26
|
+
import { s as k } from "../streaming-listener-BlWm-XZU.js";
|
|
26
27
|
const g = () => {
|
|
27
28
|
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
28
29
|
const u = document.createElement("style");
|
|
29
|
-
u.setAttribute("data-luzmo-vars", ""), u.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-
|
|
30
|
+
u.setAttribute("data-luzmo-vars", ""), u.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}', document.head.appendChild(u);
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
g();
|
|
@@ -36,12 +37,12 @@ var A = Object.defineProperty, P = Object.getOwnPropertyDescriptor, i = (u, e, o
|
|
|
36
37
|
(n = u[a]) && (r = (t ? n(e, o, r) : n(r)) || r);
|
|
37
38
|
return t && r && A(e, o, r), r;
|
|
38
39
|
};
|
|
39
|
-
class l extends
|
|
40
|
+
class l extends y {
|
|
40
41
|
constructor() {
|
|
41
42
|
super(...arguments), this.disabled = !1, this.focused = !1, this.labelX = "saturation", this.labelY = "luminosity", this.isLTR = !0, this.languageResolver = new $(this), this.colorController = new C(this, { manageAs: "hsv" }), this.activeAxis = "x", this.step = 0.01, this.altered = 0, this.activeKeys = /* @__PURE__ */ new Set(), this._valueChanged = !1, this._pointerDown = !1;
|
|
42
43
|
}
|
|
43
44
|
static get styles() {
|
|
44
|
-
return [
|
|
45
|
+
return [z(R)];
|
|
45
46
|
}
|
|
46
47
|
get hue() {
|
|
47
48
|
return this.colorController.hue;
|
|
@@ -215,7 +216,7 @@ class l extends z {
|
|
|
215
216
|
}).format(this.y), f = {
|
|
216
217
|
background: `linear-gradient(to top, black 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%),linear-gradient(to right, white 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%), hsl(${this.hue}, 100%, 50%);`
|
|
217
218
|
};
|
|
218
|
-
return
|
|
219
|
+
return v`
|
|
219
220
|
<div
|
|
220
221
|
@pointerdown=${this.handleAreaPointerdown}
|
|
221
222
|
class="gradient"
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/*! * Lucero - The design system for Luzmo.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2025 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
+
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
+
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
+
*
|
|
10
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
+
* SOFTWARE.
|
|
17
|
+
* */
|
|
18
|
+
import f from "colorjs.io";
|
|
19
|
+
class N {
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of ColorController.
|
|
22
|
+
*
|
|
23
|
+
* @param host - The ReactiveElement that this controller is associated with.
|
|
24
|
+
* @param options - An object containing optional parameters.
|
|
25
|
+
* @param options.manageAs - A string to manage the controller as a specific type.
|
|
26
|
+
*/
|
|
27
|
+
constructor(t, {
|
|
28
|
+
manageAs: s
|
|
29
|
+
} = {}) {
|
|
30
|
+
this._color = new f("hsv", [0, 100, 100], 1), this.host = t, this.manageAs = s;
|
|
31
|
+
}
|
|
32
|
+
get color() {
|
|
33
|
+
return this._color;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validates a color string and returns a result indicating the color space,
|
|
37
|
+
* coordinates, alpha value, and whether the color is valid.
|
|
38
|
+
*
|
|
39
|
+
* @param color - The color string to validate. Supported formats include:
|
|
40
|
+
* - RGB: `rgb(r, g, b)`, `rgba(r, g, b, a)`, `rgb r g b`, `rgba r g b a`
|
|
41
|
+
* - HSL: `hsl(h, s, l)`, `hsla(h, s, l, a)`, `hsl h s l`, `hsla h s l a`
|
|
42
|
+
* - HSV: `hsv(h, s, v)`, `hsva(h, s, v, a)`, `hsv h s v`, `hsva h s v a`
|
|
43
|
+
* - HEX: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`
|
|
44
|
+
*
|
|
45
|
+
* @returns An object containing the following properties:
|
|
46
|
+
* - `spaceId`: The color space identifier (`'srgb'`, `'hsl'`, or `'hsv'`).
|
|
47
|
+
* - `coords`: An array of numeric values representing the color coordinates.
|
|
48
|
+
* - `alpha`: The alpha value of the color (0 to 1).
|
|
49
|
+
* - `isValid`: A boolean indicating whether the color string is valid.
|
|
50
|
+
*/
|
|
51
|
+
validateColorString(t) {
|
|
52
|
+
var M, O, A, x;
|
|
53
|
+
const s = {
|
|
54
|
+
spaceId: null,
|
|
55
|
+
coords: [0, 0, 0],
|
|
56
|
+
isValid: !1,
|
|
57
|
+
alpha: 1
|
|
58
|
+
}, r = [
|
|
59
|
+
// With commas
|
|
60
|
+
/rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d*\.?\d+)\s*\)/i,
|
|
61
|
+
// rgba(r, g, b, a)
|
|
62
|
+
/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i,
|
|
63
|
+
// rgb(r, g, b)
|
|
64
|
+
// With spaces
|
|
65
|
+
/^rgba\s+(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s+(0|0?\.\d+|1)\s*$/i,
|
|
66
|
+
// rgba r g b a
|
|
67
|
+
/^rgb\s+(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s*$/i,
|
|
68
|
+
// rgb r g b
|
|
69
|
+
// Spaces inside parentheses
|
|
70
|
+
/^rgba\(\s*(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s+(\d*\.?\d+)\s*\)$/i,
|
|
71
|
+
// rgba(r g b a)
|
|
72
|
+
/^rgb\(\s*(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s*\)$/i,
|
|
73
|
+
// rgb(r g b)
|
|
74
|
+
// Percentage values
|
|
75
|
+
/rgb\(\s*(100|[0-9]{1,2}%)\s*,\s*(100|[0-9]{1,2}%)\s*,\s*(100|[0-9]{1,2}%)\s*\)/i,
|
|
76
|
+
// rgb(r%, g%, b%)
|
|
77
|
+
/rgba\(\s*(100|[0-9]{1,2})%\s*,\s*(100|[0-9]{1,2})%\s*,\s*(100|[0-9]{1,2})%\s*,\s*(\d*\.?\d+)\s*\)/i
|
|
78
|
+
// rgba(r%, g%, b%, a)
|
|
79
|
+
], o = [
|
|
80
|
+
// With commas
|
|
81
|
+
/hsla\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d*\.?\d+)\s*\)/i,
|
|
82
|
+
// hsla(h, s, l, a)
|
|
83
|
+
/hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*\)/i,
|
|
84
|
+
// hsl(h, s, l)
|
|
85
|
+
// With spaces
|
|
86
|
+
/^hsla\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*$/i,
|
|
87
|
+
// hsla h s l a
|
|
88
|
+
/^hsl\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*$/i,
|
|
89
|
+
// hsl h s l
|
|
90
|
+
// Spaces inside parentheses
|
|
91
|
+
/^hsla\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*\)$/i,
|
|
92
|
+
// hsla(h s l a)
|
|
93
|
+
/^hsl\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*\)$/i
|
|
94
|
+
// hsl(h s l)
|
|
95
|
+
], i = [
|
|
96
|
+
// With commas
|
|
97
|
+
/hsva\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d*\.?\d+)\s*\)/i,
|
|
98
|
+
// hsva(h, s, v, a)
|
|
99
|
+
/hsv\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*\)/i,
|
|
100
|
+
// hsv(h, s, v)
|
|
101
|
+
// With spaces
|
|
102
|
+
/^hsva\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*$/i,
|
|
103
|
+
// hsva h s v a
|
|
104
|
+
/^hsv\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*$/i,
|
|
105
|
+
// hsv h s v
|
|
106
|
+
// Spaces inside parentheses
|
|
107
|
+
/^hsva\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*\)$/i,
|
|
108
|
+
// hsva(h s v a)
|
|
109
|
+
/^hsv\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*\)$/i
|
|
110
|
+
// hsv(h s v)
|
|
111
|
+
], a = [
|
|
112
|
+
/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})?$/,
|
|
113
|
+
// 6-digit hex with optional hex alpha
|
|
114
|
+
/^#([A-Fa-f0-9]{3})([A-Fa-f0-9]{1})?$/
|
|
115
|
+
// 3-digit hex with optional hex alpha
|
|
116
|
+
], u = (M = r.find((e) => e.test(t))) == null ? void 0 : M.exec(t), p = (O = o.find((e) => e.test(t))) == null ? void 0 : O.exec(t), b = (A = i.find((e) => e.test(t))) == null ? void 0 : A.exec(t), _ = (x = a.find((e) => e.test(t))) == null ? void 0 : x.exec(t);
|
|
117
|
+
if (u) {
|
|
118
|
+
const [, e, m, d, c] = u.filter(
|
|
119
|
+
($) => typeof $ == "string"
|
|
120
|
+
), g = c === void 0 ? 1 : Number(c), h = ($) => $.includes("%") ? Number($.replace("%", "")) / 100 : Number($) / 255, l = h(e), n = h(m), v = h(d);
|
|
121
|
+
s.spaceId = "srgb", s.coords = [l, n, v], s.alpha = g, s.isValid = l >= 0 && l <= 1 && n >= 0 && n <= 1 && v >= 0 && v <= 1 && g >= 0 && g <= 1;
|
|
122
|
+
} else if (p) {
|
|
123
|
+
const [, e, m, d, c] = p, g = [e, m, d, c === void 0 ? "1" : c].map(
|
|
124
|
+
($) => Number($.replaceAll(/[^\d.]/g, ""))
|
|
125
|
+
), [h, l, n, v] = g;
|
|
126
|
+
s.spaceId = "hsl", s.coords = [h, l, n], s.alpha = v, s.isValid = h >= 0 && h <= 360 && l >= 0 && l <= 100 && n >= 0 && n <= 100 && v >= 0 && v <= 1;
|
|
127
|
+
} else if (b) {
|
|
128
|
+
const [, e, m, d, c] = b, g = [e, m, d, c === void 0 ? "1" : c].map(
|
|
129
|
+
($) => Number($.replaceAll(/[^\d.]/g, ""))
|
|
130
|
+
), [h, l, n, v] = g;
|
|
131
|
+
s.spaceId = "hsv", s.coords = [h, l, n], s.alpha = v, s.isValid = h >= 0 && h <= 360 && l >= 0 && l <= 100 && n >= 0 && n <= 100 && v >= 0 && v <= 1;
|
|
132
|
+
} else if (_) {
|
|
133
|
+
const [, e, m] = _, d = (n) => (n.length === 1 && (n = n + n), Number.parseInt(n, 16) / 255);
|
|
134
|
+
let c, g, h;
|
|
135
|
+
e.length === 3 ? (c = d(e.slice(0, 1)), g = d(e.slice(1, 2)), h = d(e.slice(2, 3))) : (c = d(e.slice(0, 2)), g = d(e.slice(2, 4)), h = d(e.slice(4, 6)));
|
|
136
|
+
const l = m ? d(m) : 1;
|
|
137
|
+
s.spaceId = "srgb", s.coords = [c, g, h], s.alpha = l, s.isValid = c >= 0 && c <= 1 && g >= 0 && g <= 1 && h >= 0 && h <= 1 && l >= 0 && l <= 1;
|
|
138
|
+
}
|
|
139
|
+
return s;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Gets the original color value provided by the user.
|
|
143
|
+
*
|
|
144
|
+
* @returns The original color value.
|
|
145
|
+
*/
|
|
146
|
+
get colorOrigin() {
|
|
147
|
+
return this._colorOrigin;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Sets the original color value provided by the user.
|
|
151
|
+
*
|
|
152
|
+
* @param colorOrigin - The original color value to set.
|
|
153
|
+
*/
|
|
154
|
+
set colorOrigin(t) {
|
|
155
|
+
this._colorOrigin = t;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Sets the color value for the controller. The color can be provided in various formats:
|
|
159
|
+
* - A string representing a color name, hex code, or other color format.
|
|
160
|
+
* - An instance of the `Color` class.
|
|
161
|
+
* - An object containing color properties such as `h`, `s`, `l`, `v`, `r`, `g`, `b`, and optionally `a`.
|
|
162
|
+
*
|
|
163
|
+
* The method validates and parses the input color, converting it to a `Color` instance.
|
|
164
|
+
* If the color is invalid, it attempts to parse it as a hex code or returns without setting a new color.
|
|
165
|
+
*
|
|
166
|
+
* @param color - The color value to set. It can be a string, an instance of `Color`, or an object with color properties.
|
|
167
|
+
*/
|
|
168
|
+
set color(t) {
|
|
169
|
+
this._colorOrigin = t;
|
|
170
|
+
let s;
|
|
171
|
+
if (typeof t == "string") {
|
|
172
|
+
const r = this.validateColorString(t);
|
|
173
|
+
if (r.isValid) {
|
|
174
|
+
const [o, i, a] = r.coords;
|
|
175
|
+
s = new f(
|
|
176
|
+
`${r.spaceId}`,
|
|
177
|
+
[o, i, a],
|
|
178
|
+
r.alpha
|
|
179
|
+
);
|
|
180
|
+
} else
|
|
181
|
+
try {
|
|
182
|
+
f.parse(t);
|
|
183
|
+
} catch {
|
|
184
|
+
try {
|
|
185
|
+
s = new f(`#${t}`);
|
|
186
|
+
} catch {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
} else if (t instanceof f)
|
|
191
|
+
s = t;
|
|
192
|
+
else if (!Array.isArray(t)) {
|
|
193
|
+
const { h: r, s: o, l: i, v: a, r: u, g: p, b, a: _ } = t;
|
|
194
|
+
if (r !== void 0 && o !== void 0) {
|
|
195
|
+
const M = i ?? a;
|
|
196
|
+
s = new f(
|
|
197
|
+
i === void 0 ? "hsv" : "hsl",
|
|
198
|
+
[
|
|
199
|
+
Number.parseFloat(r),
|
|
200
|
+
typeof o == "string" ? Number.parseFloat(o) : o * 100,
|
|
201
|
+
typeof M == "string" ? Number.parseFloat(M) : M * 100
|
|
202
|
+
],
|
|
203
|
+
Number.parseFloat(_ || "1")
|
|
204
|
+
);
|
|
205
|
+
} else u !== void 0 && p !== void 0 && b !== void 0 && (s = new f(
|
|
206
|
+
"srgb",
|
|
207
|
+
[
|
|
208
|
+
Number.parseFloat(u) / 255,
|
|
209
|
+
Number.parseFloat(p) / 255,
|
|
210
|
+
Number.parseFloat(b) / 255
|
|
211
|
+
],
|
|
212
|
+
Number.parseFloat(_ || "1")
|
|
213
|
+
));
|
|
214
|
+
}
|
|
215
|
+
s || (s = new f(t)), this._color = this.manageAs ? s.to(this.manageAs) : s, this.host.requestUpdate();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Gets the color value in various formats based on the original color input.
|
|
219
|
+
*
|
|
220
|
+
* The method determines the color space of the original color input and converts
|
|
221
|
+
* the color to the appropriate format. The supported color spaces are:
|
|
222
|
+
* - HSV (Hue, Saturation, Value)
|
|
223
|
+
* - HSL (Hue, Saturation, Lightness)
|
|
224
|
+
* - Hexadecimal (with or without alpha)
|
|
225
|
+
* - RGB (Red, Green, Blue) with optional alpha
|
|
226
|
+
*
|
|
227
|
+
* @returns The color value in the appropriate format.
|
|
228
|
+
*
|
|
229
|
+
* The method handles the following cases:
|
|
230
|
+
* - If the original color input is a string, it checks the prefix to determine the color space.
|
|
231
|
+
* - If the original color input is an object, it checks the properties to determine the color space.
|
|
232
|
+
* - If the original color input is not provided, it defaults to the current color space of the color object.
|
|
233
|
+
*
|
|
234
|
+
* The returned color value can be in one of the following formats:
|
|
235
|
+
* - `hsv(h, s%, v%)` or `hsva(h, s%, v%, a)`
|
|
236
|
+
* - `hsl(h, s%, l%)` or `hsla(h, s%, l%, a)`
|
|
237
|
+
* - `#rrggbb` or `#rrggbbaa`
|
|
238
|
+
* - `rgb(r, g, b)` or `rgba(r, g, b, a)`
|
|
239
|
+
* - `{ h, s, v, a }` for HSV object
|
|
240
|
+
* - `{ h, s, l, a }` for HSL object
|
|
241
|
+
* - `{ r, g, b, a }` for RGB object
|
|
242
|
+
*/
|
|
243
|
+
get colorValue() {
|
|
244
|
+
let t;
|
|
245
|
+
if (typeof this._colorOrigin == "string")
|
|
246
|
+
switch (this._colorOrigin.startsWith("#") ? t = "hex string" : this._colorOrigin.startsWith("rgb") ? t = "rgb" : this._colorOrigin.startsWith("hsl") ? t = "hsl" : this._colorOrigin.startsWith("hsv") ? t = "hsv" : t = "hex", t) {
|
|
247
|
+
case "hsv": {
|
|
248
|
+
const s = this._colorOrigin[3] === "a", { h: r, s: o, v: i } = this._color.to("hsv").hsv, a = this._color.alpha;
|
|
249
|
+
return `hsv${s ? "a" : ""}(${Math.round(
|
|
250
|
+
r
|
|
251
|
+
)}, ${Math.round(o)}%, ${Math.round(i)}%${s ? `, ${a}` : ""})`;
|
|
252
|
+
}
|
|
253
|
+
case "hsl": {
|
|
254
|
+
const s = this._colorOrigin[3] === "a", { h: r, s: o, l: i } = this._color.to("hsl").hsl, a = this._color.alpha;
|
|
255
|
+
return `hsl${s ? "a" : ""}(${Math.round(
|
|
256
|
+
r
|
|
257
|
+
)}, ${Math.round(o)}%, ${Math.round(i)}%${s ? `, ${a}` : ""})`;
|
|
258
|
+
}
|
|
259
|
+
case "hex string": {
|
|
260
|
+
const { r: s, g: r, b: o } = this._color.to("srgb").srgb, i = this._colorOrigin.length === 5 || this._colorOrigin.length === 9, a = this._color.alpha, u = Math.round(s * 255).toString(16), p = Math.round(r * 255).toString(16), b = Math.round(o * 255).toString(16), _ = Math.round(a * 255).toString(16);
|
|
261
|
+
return `#${u.padStart(2, "0")}${p.padStart(
|
|
262
|
+
2,
|
|
263
|
+
"0"
|
|
264
|
+
)}${b.padStart(2, "0")}${i ? _.padStart(2, "0") : ""}`;
|
|
265
|
+
}
|
|
266
|
+
case "hex": {
|
|
267
|
+
const { r: s, g: r, b: o } = this._color.to("srgb").srgb, i = this._colorOrigin.length === 4 || this._colorOrigin.length === 8, a = this._color.alpha, u = Math.round(s * 255).toString(16), p = Math.round(r * 255).toString(16), b = Math.round(o * 255).toString(16), _ = Math.round(a * 255).toString(16);
|
|
268
|
+
return `${u.padStart(2, "0")}${p.padStart(
|
|
269
|
+
2,
|
|
270
|
+
"0"
|
|
271
|
+
)}${b.padStart(2, "0")}${i ? _.padStart(2, "0") : ""}`;
|
|
272
|
+
}
|
|
273
|
+
// rgb
|
|
274
|
+
default: {
|
|
275
|
+
const { r: s, g: r, b: o } = this._color.to("srgb").srgb, i = this._colorOrigin[3] === "a", a = this._color.alpha;
|
|
276
|
+
return this._colorOrigin.search("%") > -1 ? `rgb${i ? "a" : ""}(${Math.round(s * 100)}%, ${Math.round(
|
|
277
|
+
r * 100
|
|
278
|
+
)}%, ${Math.round(o * 100)}%${i ? `,${Math.round(a * 100)}%` : ""})` : `rgb${i ? "a" : ""}(${Math.round(s * 255)}, ${Math.round(
|
|
279
|
+
r * 255
|
|
280
|
+
)}, ${Math.round(o * 255)}${i ? `, ${a}` : ""})`;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (this._colorOrigin)
|
|
284
|
+
try {
|
|
285
|
+
({ spaceId: t } = new f(this._colorOrigin));
|
|
286
|
+
} catch {
|
|
287
|
+
const { h: s, s: r, l: o, v: i, r: a, g: u, b: p } = this._colorOrigin;
|
|
288
|
+
s !== void 0 && r !== void 0 && o !== void 0 ? t = "hsl" : s !== void 0 && r !== void 0 && i !== void 0 ? t = "hsv" : a !== void 0 && u !== void 0 && p !== void 0 && (t = "srgb");
|
|
289
|
+
}
|
|
290
|
+
else
|
|
291
|
+
({ spaceId: t } = this.color);
|
|
292
|
+
switch (t) {
|
|
293
|
+
case "hsv": {
|
|
294
|
+
const { h: s, s: r, v: o } = this._color.to("hsv").hsv;
|
|
295
|
+
return {
|
|
296
|
+
h: s,
|
|
297
|
+
s: r / 100,
|
|
298
|
+
v: o / 100,
|
|
299
|
+
a: this._color.alpha
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
case "hsl": {
|
|
303
|
+
const { h: s, s: r, l: o } = this._color.to("hsl").hsl;
|
|
304
|
+
return {
|
|
305
|
+
h: s,
|
|
306
|
+
s: r / 100,
|
|
307
|
+
l: o / 100,
|
|
308
|
+
a: this._color.alpha
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
case "srgb": {
|
|
312
|
+
const { r: s, g: r, b: o } = this._color.to("srgb").srgb;
|
|
313
|
+
return this._colorOrigin && typeof this._colorOrigin.r == "string" && this._colorOrigin.r.search("%") ? {
|
|
314
|
+
r: `${Math.round(s * 255)}%`,
|
|
315
|
+
g: `${Math.round(r * 255)}%`,
|
|
316
|
+
b: `${Math.round(o * 255)}%`,
|
|
317
|
+
a: this._color.alpha
|
|
318
|
+
} : {
|
|
319
|
+
r: Math.round(s * 255),
|
|
320
|
+
g: Math.round(r * 255),
|
|
321
|
+
b: Math.round(o * 255),
|
|
322
|
+
a: this._color.alpha
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return this._color;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Gets the hue value of the current color in HSL format.
|
|
330
|
+
*
|
|
331
|
+
* @returns The hue value as a number.
|
|
332
|
+
*/
|
|
333
|
+
get hue() {
|
|
334
|
+
return Number(this._color.to("hsl").hsl.h);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Sets the hue value of the color and requests an update from the host.
|
|
338
|
+
*
|
|
339
|
+
* @param hue - The hue value to set, represented as a number.
|
|
340
|
+
*/
|
|
341
|
+
set hue(t) {
|
|
342
|
+
this._color.set("h", t), this.host.requestUpdate();
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Converts the current color to the specified format.
|
|
346
|
+
*
|
|
347
|
+
* @param format - The desired color format. It can be a string representing one of the valid formats
|
|
348
|
+
* ('srgb', 'hsva', 'hsv', 'hsl', 'hsla') or a ColorSpace object.
|
|
349
|
+
* @returns The color object in the specified format.
|
|
350
|
+
* @throws Will throw an error if the provided format is not a valid string format.
|
|
351
|
+
*/
|
|
352
|
+
getColor(t) {
|
|
353
|
+
if (typeof t == "string" && !["srgb", "hsva", "hsv", "hsl", "hsla"].includes(t))
|
|
354
|
+
throw new Error("not a valid format");
|
|
355
|
+
return this._color.to(t);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Converts the current color to an HSL string representation.
|
|
359
|
+
*
|
|
360
|
+
* @returns The HSL string representation of the current color.
|
|
361
|
+
*/
|
|
362
|
+
getHslString() {
|
|
363
|
+
return this._color.to("hsl").toString();
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Saves the current color state by cloning the current color and storing it
|
|
367
|
+
* as the previous color. This allows for the ability to revert to the previous
|
|
368
|
+
* color state if needed.
|
|
369
|
+
*
|
|
370
|
+
* @returns
|
|
371
|
+
*/
|
|
372
|
+
savePreviousColor() {
|
|
373
|
+
this._previousColor = this._color.clone();
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Restores the color to the previously saved color value.
|
|
377
|
+
*
|
|
378
|
+
* This method sets the current color (`_color`) to the previously stored color (`_previousColor`).
|
|
379
|
+
*/
|
|
380
|
+
restorePreviousColor() {
|
|
381
|
+
this._color = this._previousColor;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
export {
|
|
385
|
+
N as C
|
|
386
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*! * Lucero - The design system for Luzmo.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2025 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
+
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
+
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
+
*
|
|
10
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
+
* SOFTWARE.
|
|
17
|
+
* */
|
|
18
|
+
"use strict";const f=require("colorjs.io");class x{constructor(t,{manageAs:s}={}){this._color=new f("hsv",[0,100,100],1),this.host=t,this.manageAs=s}get color(){return this._color}validateColorString(t){var M,O,A,S;const s={spaceId:null,coords:[0,0,0],isValid:!1,alpha:1},r=[/rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d*\.?\d+)\s*\)/i,/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i,/^rgba\s+(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s+(0|0?\.\d+|1)\s*$/i,/^rgb\s+(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s*$/i,/^rgba\(\s*(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s+(\d*\.?\d+)\s*\)$/i,/^rgb\(\s*(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s*\)$/i,/rgb\(\s*(100|[0-9]{1,2}%)\s*,\s*(100|[0-9]{1,2}%)\s*,\s*(100|[0-9]{1,2}%)\s*\)/i,/rgba\(\s*(100|[0-9]{1,2})%\s*,\s*(100|[0-9]{1,2})%\s*,\s*(100|[0-9]{1,2})%\s*,\s*(\d*\.?\d+)\s*\)/i],o=[/hsla\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d*\.?\d+)\s*\)/i,/hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*\)/i,/^hsla\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*$/i,/^hsl\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*$/i,/^hsla\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*\)$/i,/^hsl\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*\)$/i],i=[/hsva\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d*\.?\d+)\s*\)/i,/hsv\(\s*(\d{1,3})\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*\)/i,/^hsva\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*$/i,/^hsv\s+(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*$/i,/^hsva\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s+(\d*\.?\d+)\s*\)$/i,/^hsv\(\s*(\d{1,3})\s+(\d{1,3}%?)\s+(\d{1,3}%?)\s*\)$/i],a=[/^#([A-Fa-f0-9]{6})([A-Fa-f0-9]{2})?$/,/^#([A-Fa-f0-9]{3})([A-Fa-f0-9]{1})?$/],u=(M=r.find(e=>e.test(t)))==null?void 0:M.exec(t),p=(O=o.find(e=>e.test(t)))==null?void 0:O.exec(t),b=(A=i.find(e=>e.test(t)))==null?void 0:A.exec(t),_=(S=a.find(e=>e.test(t)))==null?void 0:S.exec(t);if(u){const[,e,m,d,c]=u.filter($=>typeof $=="string"),g=c===void 0?1:Number(c),h=$=>$.includes("%")?Number($.replace("%",""))/100:Number($)/255,l=h(e),n=h(m),v=h(d);s.spaceId="srgb",s.coords=[l,n,v],s.alpha=g,s.isValid=l>=0&&l<=1&&n>=0&&n<=1&&v>=0&&v<=1&&g>=0&&g<=1}else if(p){const[,e,m,d,c]=p,g=[e,m,d,c===void 0?"1":c].map($=>Number($.replaceAll(/[^\d.]/g,""))),[h,l,n,v]=g;s.spaceId="hsl",s.coords=[h,l,n],s.alpha=v,s.isValid=h>=0&&h<=360&&l>=0&&l<=100&&n>=0&&n<=100&&v>=0&&v<=1}else if(b){const[,e,m,d,c]=b,g=[e,m,d,c===void 0?"1":c].map($=>Number($.replaceAll(/[^\d.]/g,""))),[h,l,n,v]=g;s.spaceId="hsv",s.coords=[h,l,n],s.alpha=v,s.isValid=h>=0&&h<=360&&l>=0&&l<=100&&n>=0&&n<=100&&v>=0&&v<=1}else if(_){const[,e,m]=_,d=n=>(n.length===1&&(n=n+n),Number.parseInt(n,16)/255);let c,g,h;e.length===3?(c=d(e.slice(0,1)),g=d(e.slice(1,2)),h=d(e.slice(2,3))):(c=d(e.slice(0,2)),g=d(e.slice(2,4)),h=d(e.slice(4,6)));const l=m?d(m):1;s.spaceId="srgb",s.coords=[c,g,h],s.alpha=l,s.isValid=c>=0&&c<=1&&g>=0&&g<=1&&h>=0&&h<=1&&l>=0&&l<=1}return s}get colorOrigin(){return this._colorOrigin}set colorOrigin(t){this._colorOrigin=t}set color(t){this._colorOrigin=t;let s;if(typeof t=="string"){const r=this.validateColorString(t);if(r.isValid){const[o,i,a]=r.coords;s=new f(`${r.spaceId}`,[o,i,a],r.alpha)}else try{f.parse(t)}catch{try{s=new f(`#${t}`)}catch{return}}}else if(t instanceof f)s=t;else if(!Array.isArray(t)){const{h:r,s:o,l:i,v:a,r:u,g:p,b,a:_}=t;if(r!==void 0&&o!==void 0){const M=i??a;s=new f(i===void 0?"hsv":"hsl",[Number.parseFloat(r),typeof o=="string"?Number.parseFloat(o):o*100,typeof M=="string"?Number.parseFloat(M):M*100],Number.parseFloat(_||"1"))}else u!==void 0&&p!==void 0&&b!==void 0&&(s=new f("srgb",[Number.parseFloat(u)/255,Number.parseFloat(p)/255,Number.parseFloat(b)/255],Number.parseFloat(_||"1")))}s||(s=new f(t)),this._color=this.manageAs?s.to(this.manageAs):s,this.host.requestUpdate()}get colorValue(){let t;if(typeof this._colorOrigin=="string")switch(this._colorOrigin.startsWith("#")?t="hex string":this._colorOrigin.startsWith("rgb")?t="rgb":this._colorOrigin.startsWith("hsl")?t="hsl":this._colorOrigin.startsWith("hsv")?t="hsv":t="hex",t){case"hsv":{const s=this._colorOrigin[3]==="a",{h:r,s:o,v:i}=this._color.to("hsv").hsv,a=this._color.alpha;return`hsv${s?"a":""}(${Math.round(r)}, ${Math.round(o)}%, ${Math.round(i)}%${s?`, ${a}`:""})`}case"hsl":{const s=this._colorOrigin[3]==="a",{h:r,s:o,l:i}=this._color.to("hsl").hsl,a=this._color.alpha;return`hsl${s?"a":""}(${Math.round(r)}, ${Math.round(o)}%, ${Math.round(i)}%${s?`, ${a}`:""})`}case"hex string":{const{r:s,g:r,b:o}=this._color.to("srgb").srgb,i=this._colorOrigin.length===5||this._colorOrigin.length===9,a=this._color.alpha,u=Math.round(s*255).toString(16),p=Math.round(r*255).toString(16),b=Math.round(o*255).toString(16),_=Math.round(a*255).toString(16);return`#${u.padStart(2,"0")}${p.padStart(2,"0")}${b.padStart(2,"0")}${i?_.padStart(2,"0"):""}`}case"hex":{const{r:s,g:r,b:o}=this._color.to("srgb").srgb,i=this._colorOrigin.length===4||this._colorOrigin.length===8,a=this._color.alpha,u=Math.round(s*255).toString(16),p=Math.round(r*255).toString(16),b=Math.round(o*255).toString(16),_=Math.round(a*255).toString(16);return`${u.padStart(2,"0")}${p.padStart(2,"0")}${b.padStart(2,"0")}${i?_.padStart(2,"0"):""}`}default:{const{r:s,g:r,b:o}=this._color.to("srgb").srgb,i=this._colorOrigin[3]==="a",a=this._color.alpha;return this._colorOrigin.search("%")>-1?`rgb${i?"a":""}(${Math.round(s*100)}%, ${Math.round(r*100)}%, ${Math.round(o*100)}%${i?`,${Math.round(a*100)}%`:""})`:`rgb${i?"a":""}(${Math.round(s*255)}, ${Math.round(r*255)}, ${Math.round(o*255)}${i?`, ${a}`:""})`}}if(this._colorOrigin)try{({spaceId:t}=new f(this._colorOrigin))}catch{const{h:s,s:r,l:o,v:i,r:a,g:u,b:p}=this._colorOrigin;s!==void 0&&r!==void 0&&o!==void 0?t="hsl":s!==void 0&&r!==void 0&&i!==void 0?t="hsv":a!==void 0&&u!==void 0&&p!==void 0&&(t="srgb")}else({spaceId:t}=this.color);switch(t){case"hsv":{const{h:s,s:r,v:o}=this._color.to("hsv").hsv;return{h:s,s:r/100,v:o/100,a:this._color.alpha}}case"hsl":{const{h:s,s:r,l:o}=this._color.to("hsl").hsl;return{h:s,s:r/100,l:o/100,a:this._color.alpha}}case"srgb":{const{r:s,g:r,b:o}=this._color.to("srgb").srgb;return this._colorOrigin&&typeof this._colorOrigin.r=="string"&&this._colorOrigin.r.search("%")?{r:`${Math.round(s*255)}%`,g:`${Math.round(r*255)}%`,b:`${Math.round(o*255)}%`,a:this._color.alpha}:{r:Math.round(s*255),g:Math.round(r*255),b:Math.round(o*255),a:this._color.alpha}}}return this._color}get hue(){return Number(this._color.to("hsl").hsl.h)}set hue(t){this._color.set("h",t),this.host.requestUpdate()}getColor(t){if(typeof t=="string"&&!["srgb","hsva","hsv","hsl","hsla"].includes(t))throw new Error("not a valid format");return this._color.to(t)}getHslString(){return this._color.to("hsl").toString()}savePreviousColor(){this._previousColor=this._color.clone()}restorePreviousColor(){this._color=this._previousColor}}exports.ColorController=x;
|
|
@@ -7,12 +7,20 @@ import { LuzmoTextFieldBase } from './../text-field/text-field';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class LuzmoColorField extends LuzmoTextFieldBase {
|
|
9
9
|
static get styles(): CSSResultArray;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the color handle with the preview color is shown
|
|
12
|
+
*/
|
|
10
13
|
viewColor: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the alpha channel is not allowed
|
|
16
|
+
*/
|
|
17
|
+
noAlphaChannel: boolean;
|
|
11
18
|
private colorController;
|
|
12
19
|
constructor();
|
|
13
20
|
set value(value: string);
|
|
14
21
|
get value(): string;
|
|
15
22
|
protected _value: string;
|
|
23
|
+
protected updated(changedProperties: Map<string, any>): void;
|
|
16
24
|
private renderColorHandle;
|
|
17
25
|
getColorValue(): string;
|
|
18
26
|
protected render(): TemplateResult;
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("
|
|
19
|
-
<
|
|
18
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lit"),h=require("lit/decorators.js"),d=require("../color-controller-ChN-A9Ft.cjs"),v=require("../text-field-DFP7p8Rv.cjs"),c=":host{position:relative}";var f=Object.defineProperty,u=(s,e,l,t)=>{for(var r=void 0,a=s.length-1,n;a>=0;a--)(n=s[a])&&(r=n(e,l,r)||r);return r&&f(e,l,r),r};class i extends v.LuzmoTextFieldBase{constructor(){super(),this.viewColor=!1,this.noAlphaChannel=!1,this._value="",this.colorController=new d.ColorController(this)}static get styles(){return[...super.styles,o.unsafeCSS(c)]}set value(e){if(e===this.value)return;const l=this._value;this._value=e,this.requestUpdate("value",l)}get value(){return this._value}updated(e){super.updated(e),e.has("noAlphaChannel")&&this.checkValidity()}renderColorHandle(){return this.viewColor&&this.valid?o.html`
|
|
19
|
+
<luzmo-color-handle
|
|
20
20
|
size="m"
|
|
21
21
|
color=${this.colorController.getColor("srgb").toString()}
|
|
22
|
-
></
|
|
23
|
-
`:o.
|
|
22
|
+
></luzmo-color-handle>
|
|
23
|
+
`:o.html``}getColorValue(){return this.valid?this.colorController.getColor("srgb").toString():""}render(){return this.viewColor&&Promise.resolve().then(()=>require("../color-handle/index.cjs")),o.html` ${super.render()} ${this.renderColorHandle()} `}checkValidity(){let e=super.checkValidity();if(this.value){const l=this.colorController.validateColorString(this.value);let t=!1;this.value.startsWith("rgba")?t=!0:this.value.startsWith("rgb")?t=!1:this.value.startsWith("hsla")?t=!0:this.value.startsWith("hsl")?t=!1:this.value.startsWith("#")&&(t=this.value.length===9),this.valid=e=l.isValid&&(!this.noAlphaChannel||!t),this.invalid=!e,this.valid&&(this.colorController.color=this.value)}else this.valid=this.invalid=!1;return e}}u([h.property({type:Boolean,attribute:"view-color"})],i.prototype,"viewColor");u([h.property({type:Boolean,attribute:"no-alpha-channel"})],i.prototype,"noAlphaChannel");customElements.get("luzmo-color-field")||customElements.define("luzmo-color-field",i);exports.LuzmoColorField=i;
|
|
@@ -15,28 +15,29 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { unsafeCSS as d, html as u } from "lit";
|
|
19
|
+
import { property as n } from "lit/decorators.js";
|
|
20
|
+
import { C as z } from "../color-controller-7sNUf7SP.js";
|
|
21
|
+
import { a as h } from "../text-field-BHaLKkf1.js";
|
|
21
22
|
const c = () => {
|
|
22
23
|
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
23
24
|
const l = document.createElement("style");
|
|
24
|
-
l.setAttribute("data-luzmo-vars", ""), l.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-
|
|
25
|
+
l.setAttribute("data-luzmo-vars", ""), l.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}', document.head.appendChild(l);
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
c();
|
|
28
|
-
const
|
|
29
|
-
var
|
|
30
|
-
for (var
|
|
31
|
-
(
|
|
32
|
-
return
|
|
29
|
+
const f = ":host{position:relative}";
|
|
30
|
+
var g = Object.defineProperty, m = (l, o, e, r) => {
|
|
31
|
+
for (var t = void 0, i = l.length - 1, a; i >= 0; i--)
|
|
32
|
+
(a = l[i]) && (t = a(o, e, t) || t);
|
|
33
|
+
return t && g(o, e, t), t;
|
|
33
34
|
};
|
|
34
|
-
class
|
|
35
|
+
class s extends h {
|
|
35
36
|
constructor() {
|
|
36
|
-
super(), this.viewColor = !1, this._value = "", this.colorController = new
|
|
37
|
+
super(), this.viewColor = !1, this.noAlphaChannel = !1, this._value = "", this.colorController = new z(this);
|
|
37
38
|
}
|
|
38
39
|
static get styles() {
|
|
39
|
-
return [...super.styles,
|
|
40
|
+
return [...super.styles, d(f)];
|
|
40
41
|
}
|
|
41
42
|
set value(o) {
|
|
42
43
|
if (o === this.value)
|
|
@@ -47,31 +48,43 @@ class m extends d {
|
|
|
47
48
|
get value() {
|
|
48
49
|
return this._value;
|
|
49
50
|
}
|
|
51
|
+
updated(o) {
|
|
52
|
+
super.updated(o), o.has("noAlphaChannel") && this.checkValidity();
|
|
53
|
+
}
|
|
50
54
|
renderColorHandle() {
|
|
51
|
-
return this.viewColor && this.valid ?
|
|
52
|
-
<
|
|
55
|
+
return this.viewColor && this.valid ? u`
|
|
56
|
+
<luzmo-color-handle
|
|
53
57
|
size="m"
|
|
54
58
|
color=${this.colorController.getColor("srgb").toString()}
|
|
55
|
-
></
|
|
56
|
-
` :
|
|
59
|
+
></luzmo-color-handle>
|
|
60
|
+
` : u``;
|
|
57
61
|
}
|
|
58
62
|
getColorValue() {
|
|
59
63
|
return this.valid ? this.colorController.getColor("srgb").toString() : "";
|
|
60
64
|
}
|
|
61
65
|
render() {
|
|
62
|
-
return this.viewColor && import("../color-handle/index.js"),
|
|
66
|
+
return this.viewColor && import("../color-handle/index.js"), u` ${super.render()} ${this.renderColorHandle()} `;
|
|
63
67
|
}
|
|
64
68
|
checkValidity() {
|
|
65
69
|
let o = super.checkValidity();
|
|
66
|
-
|
|
67
|
-
this.
|
|
68
|
-
|
|
70
|
+
if (this.value) {
|
|
71
|
+
const e = this.colorController.validateColorString(
|
|
72
|
+
this.value
|
|
73
|
+
);
|
|
74
|
+
let r = !1;
|
|
75
|
+
this.value.startsWith("rgba") ? r = !0 : this.value.startsWith("rgb") ? r = !1 : this.value.startsWith("hsla") ? r = !0 : this.value.startsWith("hsl") ? r = !1 : this.value.startsWith("#") && (r = this.value.length === 9), this.valid = o = e.isValid && (!this.noAlphaChannel || !r), this.invalid = !o, this.valid && (this.colorController.color = this.value);
|
|
76
|
+
} else
|
|
77
|
+
this.valid = this.invalid = !1;
|
|
78
|
+
return o;
|
|
69
79
|
}
|
|
70
80
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
],
|
|
74
|
-
|
|
81
|
+
m([
|
|
82
|
+
n({ type: Boolean, attribute: "view-color" })
|
|
83
|
+
], s.prototype, "viewColor");
|
|
84
|
+
m([
|
|
85
|
+
n({ type: Boolean, attribute: "no-alpha-channel" })
|
|
86
|
+
], s.prototype, "noAlphaChannel");
|
|
87
|
+
customElements.get("luzmo-color-field") || customElements.define("luzmo-color-field", s);
|
|
75
88
|
export {
|
|
76
|
-
|
|
89
|
+
s as LuzmoColorField
|
|
77
90
|
};
|