@luzmo/lucero 0.0.3 → 0.0.6
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/accordion-item.d.ts +24 -0
- package/components/accordion/accordion.d.ts +42 -0
- package/components/accordion/index.cjs +43 -0
- package/components/accordion/index.d.ts +10 -0
- package/components/accordion/index.js +181 -0
- package/components/action-bar/action-bar.d.ts +42 -0
- package/components/action-bar/index.cjs +39 -0
- package/components/action-bar/index.d.ts +7 -0
- package/components/action-bar/index.js +107 -0
- package/components/action-button/action-button.d.ts +81 -0
- package/components/action-button/index.cjs +24 -0
- package/components/action-button/index.d.ts +7 -0
- package/components/action-button/index.js +161 -0
- package/components/action-group/action-group.d.ts +50 -0
- package/components/action-group/index.cjs +18 -0
- package/components/action-group/index.d.ts +7 -0
- package/components/action-group/index.js +29 -0
- package/components/action-group-B7oQXv30.js +258 -0
- package/components/action-group-C8YUQzt8.cjs +20 -0
- package/components/action-menu/action-menu.d.ts +40 -0
- package/components/action-menu/index.cjs +56 -0
- package/components/action-menu/index.d.ts +7 -0
- package/components/action-menu/index.js +126 -0
- package/components/async-directive-BhRGSTWB.js +82 -0
- package/components/async-directive-_65ULPLK.cjs +22 -0
- package/components/avatar/avatar.d.ts +31 -0
- package/components/avatar/index.cjs +24 -0
- package/components/avatar/index.d.ts +7 -0
- package/components/avatar/index.js +81 -0
- package/components/base-BjTwmyRF.cjs +22 -0
- package/components/base-CxUap9HL.js +665 -0
- package/components/base-D76d76ww.js +26 -0
- package/components/base-rtxi7uaR.cjs +40 -0
- package/components/button/button-base.d.ts +44 -0
- package/components/button/button.d.ts +59 -0
- package/components/button/clear-button.d.ts +22 -0
- package/components/button/close-button.d.ts +24 -0
- package/components/button/index.cjs +20 -0
- package/components/button/index.d.ts +13 -0
- package/components/button/index.js +127 -0
- package/components/button-base-CgrTYVgq.js +142 -0
- package/components/button-base-DjqSZyn2.cjs +25 -0
- package/components/button-group/button-group.d.ts +19 -0
- package/components/button-group/index.cjs +18 -0
- package/components/button-group/index.d.ts +7 -0
- package/components/button-group/index.js +59 -0
- package/components/checkbox/checkbox-base.d.ts +9 -0
- package/components/checkbox/checkbox-mixin.d.ts +14 -0
- package/components/checkbox/checkbox.d.ts +54 -0
- package/components/checkbox/index.cjs +25 -0
- package/components/checkbox/index.d.ts +7 -0
- package/components/checkbox/index.js +96 -0
- package/components/checkbox-mixin-BRluTF9s.js +70 -0
- package/components/checkbox-mixin-iB-0ivgo.cjs +27 -0
- package/components/clear-button-CyLF5dx_.js +53 -0
- package/components/clear-button-DFXE6MLx.cjs +18 -0
- package/components/close-button-CcD-aVqh.cjs +18 -0
- package/components/close-button-CzpdWCWI.js +51 -0
- package/components/color-Bg3tYsAQ.js +178 -0
- package/components/color-DphK4hwx.cjs +18 -0
- package/components/color-area/color-area.d.ts +67 -0
- package/components/color-area/index.cjs +80 -0
- package/components/color-area/index.d.ts +7 -0
- package/components/color-area/index.js +372 -0
- package/components/color-field/color-field.d.ts +20 -0
- package/components/color-field/index.cjs +23 -0
- package/components/color-field/index.d.ts +7 -0
- package/components/color-field/index.js +80 -0
- package/components/color-handle/color-handle.d.ts +13 -0
- package/components/color-handle/index.cjs +24 -0
- package/components/color-handle/index.d.ts +7 -0
- package/components/color-handle/index.js +73 -0
- package/components/color-loupe/color-loupe.d.ts +7 -0
- package/components/color-loupe/index.cjs +18 -0
- package/components/color-loupe/index.d.ts +7 -0
- package/components/color-loupe/index.js +29 -0
- package/components/color-loupe-BN3k1ACF.cjs +56 -0
- package/components/color-loupe-CD-dhmB1.js +81 -0
- package/components/color-menu/color-menu.d.ts +54 -0
- package/components/color-menu/index.cjs +86 -0
- package/components/color-menu/index.d.ts +7 -0
- package/components/color-menu/index.js +203 -0
- package/components/color-picker/color-picker.d.ts +39 -0
- package/components/color-picker/index.cjs +48 -0
- package/components/color-picker/index.d.ts +7 -0
- package/components/color-picker/index.js +141 -0
- package/components/color-slider/color-slider.d.ts +57 -0
- package/components/color-slider/index.cjs +57 -0
- package/components/color-slider/index.d.ts +7 -0
- package/components/color-slider/index.js +317 -0
- package/components/condition-attribute-with-id-DrQYZzFS.cjs +18 -0
- package/components/condition-attribute-with-id-Dv4lSRbe.js +31 -0
- package/components/dependency-manger-C5HCkMMB.cjs +18 -0
- package/components/dependency-manger-CEXvGQUV.js +54 -0
- package/components/directive-C7oCP5Bh.cjs +22 -0
- package/components/directive-helpers-C3pAxRR3.cjs +22 -0
- package/components/directive-helpers-D0vm0gvF.js +28 -0
- package/components/directive-oAbCiebi.js +44 -0
- package/components/divider/divider.d.ts +24 -0
- package/components/divider/index.cjs +18 -0
- package/components/divider/index.d.ts +7 -0
- package/components/divider/index.js +61 -0
- package/components/divider.module-CXMNveQc.cjs +18 -0
- package/components/divider.module-DwOuLGU3.js +21 -0
- package/components/element-resolution-BvRLGqIU.cjs +18 -0
- package/components/element-resolution-FCUT-wql.js +91 -0
- package/components/field-group/field-group.d.ts +24 -0
- package/components/field-group/index.cjs +18 -0
- package/components/field-group/index.d.ts +7 -0
- package/components/field-group/index.js +29 -0
- package/components/field-group-DAImvhSF.js +66 -0
- package/components/field-group-d5Hkb8UW.cjs +23 -0
- package/components/field-label/field-label.d.ts +50 -0
- package/components/field-label/index.cjs +18 -0
- package/components/field-label/index.d.ts +7 -0
- package/components/field-label/index.js +29 -0
- package/components/field-label-D1zKXSG6.cjs +25 -0
- package/components/field-label-DY9iRmRI.js +106 -0
- package/components/focus-group-DHeTq18L.js +218 -0
- package/components/focus-group-DnxZUBhQ.cjs +18 -0
- package/components/focus-visible-B0P9aY_G.cjs +18 -0
- package/components/focus-visible-DBlJGoEW.js +74 -0
- package/components/focusable-Bze9xE25.js +153 -0
- package/components/focusable-DyyBr-J-.cjs +18 -0
- package/components/focusable-selectors-B4YgbghQ.js +31 -0
- package/components/focusable-selectors-BgFlyFcY.cjs +18 -0
- package/components/icon/icon-base.d.ts +11 -0
- package/components/icon/icon.d.ts +12 -0
- package/components/icon/index.cjs +18 -0
- package/components/icon/index.d.ts +7 -0
- package/components/icon/index.js +88 -0
- package/components/if-defined-C-8FyBSN.cjs +22 -0
- package/components/if-defined-XzWkhMhg.js +27 -0
- package/components/index-C1chwzNp.js +727 -0
- package/components/index-CNtoBntg.cjs +77 -0
- package/components/index-Ci6Jnhu4.js +927 -0
- package/components/index-DCKCHDTt.cjs +18 -0
- package/components/index.cjs +27 -0
- package/components/index.js +207 -0
- package/components/infield-button/index.cjs +22 -0
- package/components/infield-button/index.d.ts +7 -0
- package/components/infield-button/index.js +64 -0
- package/components/infield-button/infield-button.d.ts +25 -0
- package/components/label/index.cjs +18 -0
- package/components/label/index.d.ts +7 -0
- package/components/label/index.js +51 -0
- package/components/label/label.d.ts +7 -0
- package/components/legend-position/index.d.ts +7 -0
- package/components/legend-position/legend-position.d.ts +10 -0
- package/components/like-anchor-DKuw8fJA.cjs +32 -0
- package/components/like-anchor-DnsAwo_O.js +69 -0
- package/components/manage-help-text-B-FXFXgT.js +92 -0
- package/components/manage-help-text-I5aYDAKT.cjs +30 -0
- package/components/menu/index.cjs +18 -0
- package/components/menu/index.d.ts +16 -0
- package/components/menu/index.js +32 -0
- package/components/menu/menu-divider.d.ts +14 -0
- package/components/menu/menu-group.d.ts +17 -0
- package/components/menu/menu-item.d.ts +125 -0
- package/components/menu/menu.d.ts +119 -0
- package/components/multi-language-field/index.cjs +39 -0
- package/components/multi-language-field/index.d.ts +7 -0
- package/components/multi-language-field/index.js +148 -0
- package/components/multi-language-field/multi-language-field.d.ts +41 -0
- package/components/mutation-controller-DH7YOCyj.js +52 -0
- package/components/mutation-controller-DkOMCW-c.cjs +22 -0
- package/components/number-field/index.cjs +57 -0
- package/components/number-field/index.d.ts +7 -0
- package/components/number-field/index.js +735 -0
- package/components/number-field/number-field.d.ts +113 -0
- package/components/observe-slot-text-DeSKIzvP.cjs +18 -0
- package/components/observe-slot-text-DrM71me1.js +87 -0
- package/components/overlay/abstract-overlay.d.ts +72 -0
- package/components/overlay/click-controller.d.ts +14 -0
- package/components/overlay/events.d.ts +23 -0
- package/components/overlay/full-size-plugin.d.ts +12 -0
- package/components/overlay/hover-controller.d.ts +20 -0
- package/components/overlay/index.cjs +73 -0
- package/components/overlay/index.d.ts +22 -0
- package/components/overlay/index.js +342 -0
- package/components/overlay/interaction-controller.d.ts +38 -0
- package/components/overlay/loader.d.ts +4 -0
- package/components/overlay/longpress-controller.d.ts +21 -0
- package/components/overlay/overlay-dialog.d.ts +4 -0
- package/components/overlay/overlay-events.d.ts +11 -0
- package/components/overlay/overlay-no-popover.d.ts +4 -0
- package/components/overlay/overlay-popover.d.ts +4 -0
- package/components/overlay/overlay-stack.d.ts +44 -0
- package/components/overlay/overlay-timer.d.ts +21 -0
- package/components/overlay/overlay-trigger-directive.d.ts +26 -0
- package/components/overlay/overlay-trigger.d.ts +53 -0
- package/components/overlay/overlay-types.d.ts +50 -0
- package/components/overlay/overlay.d.ts +464 -0
- package/components/overlay/placement-controller.d.ts +157 -0
- package/components/overlay/slottable-request-directive.d.ts +17 -0
- package/components/overlay/slottable-request-event.d.ts +12 -0
- package/components/overlay/strategies.d.ts +8 -0
- package/components/overlay/virtual-trigger.d.ts +7 -0
- package/components/overlay-C2Cck0Az.js +2712 -0
- package/components/overlay-dn6Xe_vz.cjs +47 -0
- package/components/pending-state--XOfTjzE.js +61 -0
- package/components/pending-state-BeJ7iP-O.cjs +26 -0
- package/components/picker/desktop-controller.d.ts +7 -0
- package/components/picker/index.cjs +18 -0
- package/components/picker/index.d.ts +7 -0
- package/components/picker/index.js +32 -0
- package/components/picker/interaction-controller.d.ts +43 -0
- package/components/picker/mobile-controller.d.ts +9 -0
- package/components/picker/picker.d.ts +154 -0
- package/components/picker/strategies.d.ts +6 -0
- package/components/picker-8cOc-jjh.cjs +127 -0
- package/components/picker-BZAWrSDk.js +655 -0
- package/components/platform-CQzYNWKq.cjs +18 -0
- package/components/platform-DQYMG7JI.js +54 -0
- package/components/popover/index.cjs +18 -0
- package/components/popover/index.d.ts +7 -0
- package/components/popover/index.js +29 -0
- package/components/popover/popover.d.ts +29 -0
- package/components/popover-CCzs4VH8.cjs +30 -0
- package/components/popover-D0EliN0L.js +67 -0
- package/components/progress-circle/index.cjs +18 -0
- package/components/progress-circle/index.d.ts +7 -0
- package/components/progress-circle/index.js +29 -0
- package/components/progress-circle/progress-circle.d.ts +35 -0
- package/components/progress-circle-DYSSkjlY.cjs +33 -0
- package/components/progress-circle-_-9sAlMM.js +97 -0
- package/components/query-BL-TJj7K.cjs +22 -0
- package/components/query-D_KR_GUc.js +51 -0
- package/components/query-assigned-elements-DjfhL1cl.js +36 -0
- package/components/query-assigned-elements-DsKsfk7G.cjs +22 -0
- package/components/query-assigned-nodes-BcKWmGzy.cjs +22 -0
- package/components/query-assigned-nodes-C76XVPWY.js +36 -0
- package/components/radio/index.cjs +22 -0
- package/components/radio/index.d.ts +10 -0
- package/components/radio/index.js +191 -0
- package/components/radio/radio-group.d.ts +27 -0
- package/components/radio/radio.d.ts +39 -0
- package/components/random-id-ByCz1xaq.js +26 -0
- package/components/random-id-CqvckpWe.cjs +18 -0
- package/components/roving-tabindex-By_fCy_e.cjs +18 -0
- package/components/roving-tabindex-DOg4z6ZU.js +66 -0
- package/components/search/index.cjs +45 -0
- package/components/search/index.d.ts +7 -0
- package/components/search/index.js +131 -0
- package/components/search/search.d.ts +27 -0
- package/components/sized-mixin-BAI6NiE2.cjs +18 -0
- package/components/sized-mixin-DcJTTohI.js +63 -0
- package/components/slider/index.cjs +18 -0
- package/components/slider/index.d.ts +7 -0
- package/components/slider/index.js +1158 -0
- package/components/slider/slider.d.ts +24 -0
- package/components/slottable-request-event-BfUUt1Mh.cjs +18 -0
- package/components/slottable-request-event-DggLA4Rx.js +31 -0
- package/components/state-D8vot9IB.js +29 -0
- package/components/state-WWHLNMRG.cjs +22 -0
- package/components/streaming-listener-BbmNyKWO.js +125 -0
- package/components/streaming-listener-C2A7ZJZP.cjs +18 -0
- package/components/style-map-CoBJRbvu.js +53 -0
- package/components/style-map-DH0jkl7s.cjs +22 -0
- package/components/swatch/index.cjs +49 -0
- package/components/swatch/index.d.ts +10 -0
- package/components/swatch/index.js +342 -0
- package/components/swatch/swatch-group.d.ts +41 -0
- package/components/swatch/swatch.d.ts +40 -0
- package/components/switch/index.cjs +22 -0
- package/components/switch/index.d.ts +7 -0
- package/components/switch/index.js +73 -0
- package/components/switch/switch.d.ts +27 -0
- package/components/tags/index.cjs +32 -0
- package/components/tags/index.d.ts +10 -0
- package/components/tags/index.js +173 -0
- package/components/tags/tag.d.ts +29 -0
- package/components/tags/tags.d.ts +28 -0
- package/components/text-field/help-text-manager.d.ts +19 -0
- package/components/text-field/help-text.d.ts +20 -0
- package/components/text-field/index.cjs +21 -0
- package/components/text-field/index.d.ts +14 -0
- package/components/text-field/index.js +62 -0
- package/components/text-field/manage-help-text.d.ts +13 -0
- package/components/text-field/text-field.d.ts +142 -0
- package/components/text-field-05QNK_Lj.js +313 -0
- package/components/text-field-BU7yxiOR.cjs +85 -0
- package/components/toast/index.cjs +51 -0
- package/components/toast/index.d.ts +7 -0
- package/components/toast/index.js +153 -0
- package/components/toast/toast.d.ts +77 -0
- package/components/tooltip/index.cjs +45 -0
- package/components/tooltip/index.d.ts +8 -0
- package/components/tooltip/index.js +220 -0
- package/components/tooltip/tooltip-directive.d.ts +5 -0
- package/components/tooltip/tooltip.d.ts +55 -0
- package/components/unit-input/index.cjs +43 -0
- package/components/unit-input/index.d.ts +7 -0
- package/components/unit-input/index.js +183 -0
- package/components/unit-input/unit-input.d.ts +33 -0
- package/components/when-CDK1Tt5Y.js +28 -0
- package/components/when-CDZyJPvd.cjs +22 -0
- package/index.d.ts +39 -0
- package/package.json +139 -101
- package/utils/base.d.ts +16 -0
- package/utils/condition-attribute-with-id.d.ts +2 -0
- package/utils/first-focusable-in.d.ts +3 -0
- package/utils/focus-visible.d.ts +29 -0
- package/utils/focusable-selectors.d.ts +2 -0
- package/utils/focusable.d.ts +58 -0
- package/utils/get-css-variable.d.ts +1 -0
- package/utils/get-label-from-slot.d.ts +1 -0
- package/utils/like-anchor.d.ts +23 -0
- package/utils/observe-slot-presence.d.ts +12 -0
- package/utils/observe-slot-text.d.ts +11 -0
- package/utils/platform.d.ts +10 -0
- package/utils/random-id.d.ts +1 -0
- package/utils/reactive-controllers/color.d.ts +54 -0
- package/utils/reactive-controllers/dependency-manger.d.ts +26 -0
- package/utils/reactive-controllers/element-resolution.d.ts +23 -0
- package/utils/reactive-controllers/focus-group.d.ts +62 -0
- package/utils/reactive-controllers/language-resolution.d.ts +11 -0
- package/utils/reactive-controllers/match-media.d.ts +13 -0
- package/utils/reactive-controllers/pending-state.d.ts +41 -0
- package/utils/reactive-controllers/roving-tabindex.d.ts +19 -0
- package/utils/reparent-child.d.ts +4 -0
- package/utils/sized-mixin.d.ts +17 -0
- package/utils/streaming-listener.d.ts +48 -0
|
@@ -0,0 +1,80 @@
|
|
|
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../base-rtxi7uaR.cjs"),f=require("../query-BL-TJj7K.cjs"),b=require("../if-defined-C-8FyBSN.cjs");require("../color-handle/index.cjs");const m=require("../platform-CQzYNWKq.cjs"),y=require("../color-DphK4hwx.cjs"),v=require("../streaming-listener-C2A7ZJZP.cjs"),w="@media (forced-colors: active){:host{--highcontrast-color-area-border-color-disabled: GrayText;--highcontrast-color-area-border-color: Canvas;--highcontrast-color-area-fill-color-disabled: Canvas}.gradient,:host([disabled]){forced-color-adjust:none}}:host{cursor:default;-webkit-user-select:none;user-select:none;min-inline-size:var(--luzmo-color-area-min-width, 64px);min-block-size:var(--luzmo-color-area-min-height, 64px);inline-size:var(--luzmo-color-area-width, 192px);block-size:var(--luzmo-color-area-height, 192px);box-sizing:border-box;border-radius:var(--luzmo-color-area-border-radius, var(--luzmo-border-radius-s));border:var(--luzmo-color-area-border-width, var(--luzmo-border-width)) solid var(--highcontrast-color-area-border-color, var(--luzmo-color-area-border-color, var(--luzmo-border-color)));display:inline-block;position:relative}:host([focused]){z-index:1}:host([disabled]){pointer-events:none;background:var(--highcontrast-color-area-fill-color-disabled, var(--luzmo-color-area-disabled-background-color, var(--luzmo-dimmed-color)));border:var(--luzmo-color-area-border-width, var(--luzmo-border-width)) solid var(--highcontrast-color-area-border-color-disabled)}:host([disabled]) .gradient{display:none}.handle{transform:translate(calc(var(--luzmo-color-area-width, 192px) - var(--luzmo-border-width)));inset-block-start:0}.handle:dir(rtl),:host([dir=rtl]) .handle{inset-inline-end:0}.gradient{inline-size:100%;block-size:100%;border-radius:var(--luzmo-color-area-border-radius, var(--luzmo-border-radius-s))}.slider{opacity:0;inline-size:100%;block-size:100%;z-index:0;pointer-events:none;margin:0;position:absolute;inset-block-start:0;inset-inline-start:0}:host{touch-action:none}:host:before{pointer-events:none}.gradient{overflow:hidden}.handle{transform:translate(var(--luzmo-color-area-default-width))}::slotted(*){width:100%;height:100%}:host([dir=rtl]) .gradient{transform:scaleX(-1)}.slider[orient=vertical]{-webkit-appearance:slider-vertical;-moz-appearance:slider-vertical;appearance:slider-vertical}.slider:focus{z-index:1}.fieldset{border:0;margin:0;padding:0}";var x=Object.defineProperty,C=Object.getOwnPropertyDescriptor,a=(p,e,t,r)=>{for(var o=r>1?void 0:r?C(e,t):e,n=p.length-1,l;n>=0;n--)(l=p[n])&&(o=(r?l(e,t,o):l(o))||o);return r&&o&&x(e,t,o),o};class i extends s.LuzmoElement{constructor(){super(...arguments),this.disabled=!1,this.focused=!1,this.labelX="saturation",this.labelY="luminosity",this.isLTR=!0,this.languageResolver=new v.LanguageResolutionController(this),this.colorController=new y.ColorController(this,{extractColorFromState:()=>({h:this.hue,s:this.x,v:this.y}),applyColorToState:({s:e,v:t})=>{this._x=e,this._y=t,this.requestUpdate()}}),this.activeAxis="x",this._x=1,this._y=1,this.step=.01,this.altered=0,this.activeKeys=new Set,this._valueChanged=!1,this._pointerDown=!1}static get styles(){return[s.r(w)]}get hue(){return this.colorController.hue}set hue(e){this.colorController.hue=e}get value(){return this.colorController.color}get color(){return this.colorController.color}set color(e){this.colorController.color=e}get x(){return this._x}set x(e){if(e===this.x)return;const t=this.x;this._x=e,this.inputX&&(this.inputX.value=e.toString(),this._x=this.inputX.valueAsNumber),this.requestUpdate("x",t),this.colorController.applyColorFromState()}get y(){return this._y}set y(e){if(e===this.y)return;const t=this.y;this._y=e,this.inputY&&(this.inputY.value=e.toString(),this._y=this.inputY.valueAsNumber),this.requestUpdate("y",t),this.colorController.applyColorFromState()}focus(e={}){super.focus(e),this.forwardFocus()}forwardFocus(){this.activeAxis==="x"?this.inputX.focus():this.inputY.focus()}handleFocus(){this.focused=!0,this._valueChanged=!1}handleBlur(){this._pointerDown||(this.altered=0,this.focused=!1,this._valueChanged=!1)}handleKeydown(e){const{code:t}=e;this.focused=!0,this.altered=[e.shiftKey,e.ctrlKey,e.altKey].filter(o=>!!o).length,(t.search("Arrow")===0||t.search("Page")===0||t.search("Home")===0||t.search("End")===0)&&(e.preventDefault(),this.activeKeys.add(t),this.handleKeypress())}handleKeypress(){let e=0,t=0;const r=Math.max(this.step,this.altered*5*this.step);this.activeKeys.forEach(o=>{switch(o){case"ArrowUp":{t=r;break}case"ArrowDown":{t=r*-1;break}case"ArrowLeft":{e=this.step*(this.isLTR?-1:1);break}case"ArrowRight":{e=this.step*(this.isLTR?1:-1);break}case"PageUp":{t=r*10;break}case"PageDown":{t=r*-10;break}case"Home":{e=r*(this.isLTR?-10:10);break}case"End":{e=r*(this.isLTR?10:-10);break}}}),e!==0?(this.activeAxis="x",this.inputX.focus()):t!==0&&(this.activeAxis="y",this.inputY.focus()),this.x=Math.min(1,Math.max(this.x+e,0)),this.y=Math.min(1,Math.max(this.y+t,0)),this.colorController.savePreviousColor(),this.colorController.applyColorFromState(),(e!==0||t!==0)&&(this._valueChanged=!0,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0,cancelable:!0}))||this.colorController.restorePreviousColor())}handleKeyup(e){e.preventDefault();const{code:t}=e;this.activeKeys.delete(t)}handleInput(e){const{valueAsNumber:t,name:r}=e.target;this[r]=t,this.colorController.applyColorFromState()}handleChange(e){this.handleInput(e),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0,cancelable:!0}))}handlePointerdown(e){if(e.button!==0){e.preventDefault();return}this._pointerDown=!0,this.colorController.savePreviousColor(),this.boundingClientRect=this.getBoundingClientRect(),e.target.setPointerCapture(e.pointerId),e.pointerType==="mouse"&&(this.focused=!0)}handlePointermove(e){const[t,r]=this.calculateHandlePosition(e);this._valueChanged=!1,this.x=t,this.y=1-r,this.colorController.applyColorFromState(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))}handlePointerup(e){e.preventDefault(),this._pointerDown=!1,e.target.releasePointerCapture(e.pointerId);const t=this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0,cancelable:!0}));this.inputX.focus(),e.pointerType==="mouse"&&(this.focused=!1),t||this.colorController.restorePreviousColor()}calculateHandlePosition(e){if(!this.boundingClientRect)return[this.x,this.y];const t=this.boundingClientRect,r=t.left,o=t.top,n=e.clientX,l=e.clientY,h=t.width,d=t.height,u=Math.max(0,Math.min(1,(n-r)/h)),c=Math.max(0,Math.min(1,(l-o)/d));return[this.isLTR?u:1-u,c]}handleAreaPointerdown(e){e.button===0&&(e.stopPropagation(),e.preventDefault(),this.handle.dispatchEvent(new PointerEvent("pointerdown",e)),this.handlePointermove(e))}render(){const{width:e=0,height:t=0}=this.boundingClientRect||{},r=m.isAndroid()||m.isIOS(),n="Color Picker",l=b.o(r?void 0:"2d slider"),h=this.labelX,d=this.labelY,u=new Intl.NumberFormat(this.languageResolver.language,{style:"percent",unitDisplay:"narrow"}).format(this.x),c=new Intl.NumberFormat(this.languageResolver.language,{style:"percent",unitDisplay:"narrow"}).format(this.y),g=`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%);`;return s.x`
|
|
19
|
+
<div
|
|
20
|
+
@pointerdown=${this.handleAreaPointerdown}
|
|
21
|
+
class="gradient"
|
|
22
|
+
style="background: ${g}"
|
|
23
|
+
>
|
|
24
|
+
<slot name="gradient"></slot>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<luzmo-color-handle
|
|
28
|
+
tabindex=${b.o(this.focused?void 0:"0")}
|
|
29
|
+
@focus=${this.forwardFocus}
|
|
30
|
+
?focused=${this.focused}
|
|
31
|
+
class="handle"
|
|
32
|
+
color=${this.colorController.getHslString()}
|
|
33
|
+
?disabled=${this.disabled}
|
|
34
|
+
style=${`transform: translate(${(this.isLTR?this.x:1-this.x)*e}px, ${t-this.y*t}px);`}
|
|
35
|
+
${v.streamingListener({start:["pointerdown",this.handlePointerdown],streamInside:["pointermove",this.handlePointermove],end:[["pointerup","pointercancel","pointerleave"],this.handlePointerup]})}
|
|
36
|
+
></luzmo-color-handle>
|
|
37
|
+
|
|
38
|
+
<fieldset
|
|
39
|
+
class="fieldset"
|
|
40
|
+
aria-label=${b.o(r?n:void 0)}
|
|
41
|
+
>
|
|
42
|
+
<div role="presentation">
|
|
43
|
+
<input
|
|
44
|
+
type="range"
|
|
45
|
+
class="slider"
|
|
46
|
+
name="x"
|
|
47
|
+
aria-label=${r?h:`${h} ${n}`}
|
|
48
|
+
aria-roledescription=${l}
|
|
49
|
+
aria-orientation="horizontal"
|
|
50
|
+
aria-valuetext=${r?u:`${u}, ${h}${this._valueChanged?"":`, ${c}, ${d}`}`}
|
|
51
|
+
min="0"
|
|
52
|
+
max="1"
|
|
53
|
+
step=${this.step}
|
|
54
|
+
tabindex="-1"
|
|
55
|
+
.value=${String(this.x)}
|
|
56
|
+
@input=${this.handleInput}
|
|
57
|
+
@change=${this.handleChange}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
<div role="presentation">
|
|
61
|
+
<input
|
|
62
|
+
type="range"
|
|
63
|
+
class="slider"
|
|
64
|
+
name="y"
|
|
65
|
+
aria-label=${r?d:`${d} ${n}`}
|
|
66
|
+
aria-roledescription=${l}
|
|
67
|
+
aria-orientation="vertical"
|
|
68
|
+
aria-valuetext=${r?c:`${c}, ${d}${this._valueChanged?"":`, ${u}, ${h}`}`}
|
|
69
|
+
orient="vertical"
|
|
70
|
+
min="0"
|
|
71
|
+
max="1"
|
|
72
|
+
step=${this.step}
|
|
73
|
+
tabindex="-1"
|
|
74
|
+
.value=${String(this.y)}
|
|
75
|
+
@input=${this.handleInput}
|
|
76
|
+
@change=${this.handleChange}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
</fieldset>
|
|
80
|
+
`}firstUpdated(e){super.firstUpdated(e),this.boundingClientRect=this.getBoundingClientRect(),this.addEventListener("focus",this.handleFocus),this.addEventListener("blur",this.handleBlur),this.addEventListener("keyup",this.handleKeyup),this.addEventListener("keydown",this.handleKeydown)}updated(e){if(super.updated(e),this.x!==this.inputX.valueAsNumber&&(this._x=this.inputX.valueAsNumber),this.y!==this.inputY.valueAsNumber&&(this._y=this.inputY.valueAsNumber),e.has("focused")&&this.focused){const t=this.inputX.parentElement,r=this.inputY.parentElement;if(!t.shadowRoot&&!r.shadowRoot){t.attachShadow({mode:"open"}),r.attachShadow({mode:"open"});const o='<div tabindex="-1"><slot></slot></div>';t.shadowRoot.innerHTML=o,r.shadowRoot.innerHTML=o}}}connectedCallback(){var e;super.connectedCallback(),!this.observer&&window.ResizeObserver&&(this.observer=new window.ResizeObserver(t=>{for(const r of t)this.boundingClientRect=r.contentRect;this.requestUpdate()})),(e=this.observer)==null||e.observe(this)}disconnectedCallback(){var e;(e=this.observer)==null||e.unobserve(this),super.disconnectedCallback()}}a([s.n({type:String,reflect:!0})],i.prototype,"dir",2);a([s.n({type:Boolean,reflect:!0})],i.prototype,"disabled",2);a([s.n({type:Boolean,reflect:!0})],i.prototype,"focused",2);a([s.n({type:String,attribute:"label-x"})],i.prototype,"labelX",2);a([s.n({type:String,attribute:"label-y"})],i.prototype,"labelY",2);a([s.n({type:Boolean,attribute:"is-ltr"})],i.prototype,"isLTR",2);a([f.e(".handle")],i.prototype,"handle",2);a([s.n({type:Number})],i.prototype,"hue",1);a([s.n({type:String})],i.prototype,"value",1);a([s.n({type:String})],i.prototype,"color",1);a([s.n({attribute:!1})],i.prototype,"activeAxis",2);a([s.n({type:Number})],i.prototype,"x",1);a([s.n({type:Number})],i.prototype,"y",1);a([s.n({type:Number})],i.prototype,"step",2);a([f.e('[name="x"]')],i.prototype,"inputX",2);a([f.e('[name="y"]')],i.prototype,"inputY",2);customElements.get("luzmo-color-area")||customElements.define("luzmo-color-area",i);exports.LuzmoColorArea=i;
|
|
@@ -0,0 +1,372 @@
|
|
|
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 { L as z, r as v, x as y, n as s } from "../base-CxUap9HL.js";
|
|
19
|
+
import { e as b } from "../query-D_KR_GUc.js";
|
|
20
|
+
import { o as m } from "../if-defined-XzWkhMhg.js";
|
|
21
|
+
import "../color-handle/index.js";
|
|
22
|
+
import { i as x, a as w } from "../platform-DQYMG7JI.js";
|
|
23
|
+
import { C } from "../color-Bg3tYsAQ.js";
|
|
24
|
+
import { L as $, s as k } from "../streaming-listener-BbmNyKWO.js";
|
|
25
|
+
const g = () => {
|
|
26
|
+
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
27
|
+
const u = document.createElement("style");
|
|
28
|
+
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-hard: #000;--luzmo-font-color-disabled: var(--luzmo-color-disabled);--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-color-negative: #ca221c;--luzmo-color-negative-hover: #b3241f;--luzmo-color-negative-down: #9f231f;--luzmo-color-negative-focus: #b3241f;--luzmo-color-negative-rgb: 202, 34, 28;--luzmo-color-positive: rgb(20, 150, 101);--luzmo-color-positive-hover: rgb(17, 128, 86);--luzmo-color-positive-down: rgb(16, 105, 71);--luzmo-color-positive-focus: rgb(17, 128, 86);--luzmo-color-positive-rgb: 20, 150, 101;--luzmo-color-selected: rgb(110, 110, 110);--luzmo-color-selected-hover: rgb(70, 70, 70);--luzmo-color-selected-down: rgb(40, 40, 40);--luzmo-color-selected-focus: rgb(70, 70, 70);--luzmo-color-selected-hard: #1e1e1e;--luzmo-color-selected-hard-hover: rgb(0, 0, 0);--luzmo-color-selected-hard-down: rgb(0, 0, 0);--luzmo-color-selected-hard-focus: rgb(0, 0, 0);--luzmo-color-informative: #1a77e9;--luzmo-color-informative-rgb: 26, 119, 233;--luzmo-color-disabled: #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);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
g();
|
|
32
|
+
const R = "@media (forced-colors: active){:host{--highcontrast-color-area-border-color-disabled: GrayText;--highcontrast-color-area-border-color: Canvas;--highcontrast-color-area-fill-color-disabled: Canvas}.gradient,:host([disabled]){forced-color-adjust:none}}:host{cursor:default;-webkit-user-select:none;user-select:none;min-inline-size:var(--luzmo-color-area-min-width, 64px);min-block-size:var(--luzmo-color-area-min-height, 64px);inline-size:var(--luzmo-color-area-width, 192px);block-size:var(--luzmo-color-area-height, 192px);box-sizing:border-box;border-radius:var(--luzmo-color-area-border-radius, var(--luzmo-border-radius-s));border:var(--luzmo-color-area-border-width, var(--luzmo-border-width)) solid var(--highcontrast-color-area-border-color, var(--luzmo-color-area-border-color, var(--luzmo-border-color)));display:inline-block;position:relative}:host([focused]){z-index:1}:host([disabled]){pointer-events:none;background:var(--highcontrast-color-area-fill-color-disabled, var(--luzmo-color-area-disabled-background-color, var(--luzmo-dimmed-color)));border:var(--luzmo-color-area-border-width, var(--luzmo-border-width)) solid var(--highcontrast-color-area-border-color-disabled)}:host([disabled]) .gradient{display:none}.handle{transform:translate(calc(var(--luzmo-color-area-width, 192px) - var(--luzmo-border-width)));inset-block-start:0}.handle:dir(rtl),:host([dir=rtl]) .handle{inset-inline-end:0}.gradient{inline-size:100%;block-size:100%;border-radius:var(--luzmo-color-area-border-radius, var(--luzmo-border-radius-s))}.slider{opacity:0;inline-size:100%;block-size:100%;z-index:0;pointer-events:none;margin:0;position:absolute;inset-block-start:0;inset-inline-start:0}:host{touch-action:none}:host:before{pointer-events:none}.gradient{overflow:hidden}.handle{transform:translate(var(--luzmo-color-area-default-width))}::slotted(*){width:100%;height:100%}:host([dir=rtl]) .gradient{transform:scaleX(-1)}.slider[orient=vertical]{-webkit-appearance:slider-vertical;-moz-appearance:slider-vertical;appearance:slider-vertical}.slider:focus{z-index:1}.fieldset{border:0;margin:0;padding:0}";
|
|
33
|
+
var _ = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (u, e, o, t) => {
|
|
34
|
+
for (var r = t > 1 ? void 0 : t ? A(e, o) : e, a = u.length - 1, n; a >= 0; a--)
|
|
35
|
+
(n = u[a]) && (r = (t ? n(e, o, r) : n(r)) || r);
|
|
36
|
+
return t && r && _(e, o, r), r;
|
|
37
|
+
};
|
|
38
|
+
class i extends z {
|
|
39
|
+
constructor() {
|
|
40
|
+
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, {
|
|
41
|
+
extractColorFromState: () => ({
|
|
42
|
+
h: this.hue,
|
|
43
|
+
s: this.x,
|
|
44
|
+
v: this.y
|
|
45
|
+
}),
|
|
46
|
+
applyColorToState: ({ s: e, v: o }) => {
|
|
47
|
+
this._x = e, this._y = o, this.requestUpdate();
|
|
48
|
+
}
|
|
49
|
+
}), this.activeAxis = "x", this._x = 1, this._y = 1, this.step = 0.01, this.altered = 0, this.activeKeys = /* @__PURE__ */ new Set(), this._valueChanged = !1, this._pointerDown = !1;
|
|
50
|
+
}
|
|
51
|
+
static get styles() {
|
|
52
|
+
return [v(R)];
|
|
53
|
+
}
|
|
54
|
+
get hue() {
|
|
55
|
+
return this.colorController.hue;
|
|
56
|
+
}
|
|
57
|
+
set hue(e) {
|
|
58
|
+
this.colorController.hue = e;
|
|
59
|
+
}
|
|
60
|
+
get value() {
|
|
61
|
+
return this.colorController.color;
|
|
62
|
+
}
|
|
63
|
+
get color() {
|
|
64
|
+
return this.colorController.color;
|
|
65
|
+
}
|
|
66
|
+
set color(e) {
|
|
67
|
+
this.colorController.color = e;
|
|
68
|
+
}
|
|
69
|
+
get x() {
|
|
70
|
+
return this._x;
|
|
71
|
+
}
|
|
72
|
+
set x(e) {
|
|
73
|
+
if (e === this.x)
|
|
74
|
+
return;
|
|
75
|
+
const o = this.x;
|
|
76
|
+
this._x = e, this.inputX && (this.inputX.value = e.toString(), this._x = this.inputX.valueAsNumber), this.requestUpdate("x", o), this.colorController.applyColorFromState();
|
|
77
|
+
}
|
|
78
|
+
get y() {
|
|
79
|
+
return this._y;
|
|
80
|
+
}
|
|
81
|
+
set y(e) {
|
|
82
|
+
if (e === this.y)
|
|
83
|
+
return;
|
|
84
|
+
const o = this.y;
|
|
85
|
+
this._y = e, this.inputY && (this.inputY.value = e.toString(), this._y = this.inputY.valueAsNumber), this.requestUpdate("y", o), this.colorController.applyColorFromState();
|
|
86
|
+
}
|
|
87
|
+
focus(e = {}) {
|
|
88
|
+
super.focus(e), this.forwardFocus();
|
|
89
|
+
}
|
|
90
|
+
forwardFocus() {
|
|
91
|
+
this.activeAxis === "x" ? this.inputX.focus() : this.inputY.focus();
|
|
92
|
+
}
|
|
93
|
+
handleFocus() {
|
|
94
|
+
this.focused = !0, this._valueChanged = !1;
|
|
95
|
+
}
|
|
96
|
+
handleBlur() {
|
|
97
|
+
this._pointerDown || (this.altered = 0, this.focused = !1, this._valueChanged = !1);
|
|
98
|
+
}
|
|
99
|
+
handleKeydown(e) {
|
|
100
|
+
const { code: o } = e;
|
|
101
|
+
this.focused = !0, this.altered = [e.shiftKey, e.ctrlKey, e.altKey].filter(
|
|
102
|
+
(r) => !!r
|
|
103
|
+
).length, (o.search("Arrow") === 0 || o.search("Page") === 0 || o.search("Home") === 0 || o.search("End") === 0) && (e.preventDefault(), this.activeKeys.add(o), this.handleKeypress());
|
|
104
|
+
}
|
|
105
|
+
handleKeypress() {
|
|
106
|
+
let e = 0, o = 0;
|
|
107
|
+
const t = Math.max(this.step, this.altered * 5 * this.step);
|
|
108
|
+
this.activeKeys.forEach((r) => {
|
|
109
|
+
switch (r) {
|
|
110
|
+
case "ArrowUp": {
|
|
111
|
+
o = t;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case "ArrowDown": {
|
|
115
|
+
o = t * -1;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "ArrowLeft": {
|
|
119
|
+
e = this.step * (this.isLTR ? -1 : 1);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
case "ArrowRight": {
|
|
123
|
+
e = this.step * (this.isLTR ? 1 : -1);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case "PageUp": {
|
|
127
|
+
o = t * 10;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "PageDown": {
|
|
131
|
+
o = t * -10;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case "Home": {
|
|
135
|
+
e = t * (this.isLTR ? -10 : 10);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case "End": {
|
|
139
|
+
e = t * (this.isLTR ? 10 : -10);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}), e !== 0 ? (this.activeAxis = "x", this.inputX.focus()) : o !== 0 && (this.activeAxis = "y", this.inputY.focus()), this.x = Math.min(1, Math.max(this.x + e, 0)), this.y = Math.min(1, Math.max(this.y + o, 0)), this.colorController.savePreviousColor(), this.colorController.applyColorFromState(), (e !== 0 || o !== 0) && (this._valueChanged = !0, this.dispatchEvent(
|
|
144
|
+
new Event("input", {
|
|
145
|
+
bubbles: !0,
|
|
146
|
+
composed: !0
|
|
147
|
+
})
|
|
148
|
+
), this.dispatchEvent(
|
|
149
|
+
new Event("change", {
|
|
150
|
+
bubbles: !0,
|
|
151
|
+
composed: !0,
|
|
152
|
+
cancelable: !0
|
|
153
|
+
})
|
|
154
|
+
) || this.colorController.restorePreviousColor());
|
|
155
|
+
}
|
|
156
|
+
handleKeyup(e) {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
const { code: o } = e;
|
|
159
|
+
this.activeKeys.delete(o);
|
|
160
|
+
}
|
|
161
|
+
handleInput(e) {
|
|
162
|
+
const { valueAsNumber: o, name: t } = e.target;
|
|
163
|
+
this[t] = o, this.colorController.applyColorFromState();
|
|
164
|
+
}
|
|
165
|
+
handleChange(e) {
|
|
166
|
+
this.handleInput(e), this.dispatchEvent(
|
|
167
|
+
new Event("change", {
|
|
168
|
+
bubbles: !0,
|
|
169
|
+
composed: !0,
|
|
170
|
+
cancelable: !0
|
|
171
|
+
})
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
handlePointerdown(e) {
|
|
175
|
+
if (e.button !== 0) {
|
|
176
|
+
e.preventDefault();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
this._pointerDown = !0, this.colorController.savePreviousColor(), this.boundingClientRect = this.getBoundingClientRect(), e.target.setPointerCapture(e.pointerId), e.pointerType === "mouse" && (this.focused = !0);
|
|
180
|
+
}
|
|
181
|
+
handlePointermove(e) {
|
|
182
|
+
const [o, t] = this.calculateHandlePosition(e);
|
|
183
|
+
this._valueChanged = !1, this.x = o, this.y = 1 - t, this.colorController.applyColorFromState(), this.dispatchEvent(
|
|
184
|
+
new Event("input", {
|
|
185
|
+
bubbles: !0,
|
|
186
|
+
composed: !0,
|
|
187
|
+
cancelable: !0
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
handlePointerup(e) {
|
|
192
|
+
e.preventDefault(), this._pointerDown = !1, e.target.releasePointerCapture(e.pointerId);
|
|
193
|
+
const o = this.dispatchEvent(
|
|
194
|
+
new Event("change", {
|
|
195
|
+
bubbles: !0,
|
|
196
|
+
composed: !0,
|
|
197
|
+
cancelable: !0
|
|
198
|
+
})
|
|
199
|
+
);
|
|
200
|
+
this.inputX.focus(), e.pointerType === "mouse" && (this.focused = !1), o || this.colorController.restorePreviousColor();
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Returns the value under the cursor
|
|
204
|
+
* @param: PointerEvent on slider
|
|
205
|
+
* @return: Slider value that correlates to the position under the pointer
|
|
206
|
+
*/
|
|
207
|
+
calculateHandlePosition(e) {
|
|
208
|
+
if (!this.boundingClientRect)
|
|
209
|
+
return [this.x, this.y];
|
|
210
|
+
const o = this.boundingClientRect, t = o.left, r = o.top, a = e.clientX, n = e.clientY, c = o.width, d = o.height, h = Math.max(0, Math.min(1, (a - t) / c)), p = Math.max(0, Math.min(1, (n - r) / d));
|
|
211
|
+
return [this.isLTR ? h : 1 - h, p];
|
|
212
|
+
}
|
|
213
|
+
handleAreaPointerdown(e) {
|
|
214
|
+
e.button === 0 && (e.stopPropagation(), e.preventDefault(), this.handle.dispatchEvent(new PointerEvent("pointerdown", e)), this.handlePointermove(e));
|
|
215
|
+
}
|
|
216
|
+
render() {
|
|
217
|
+
const { width: e = 0, height: o = 0 } = this.boundingClientRect || {}, t = x() || w(), a = "Color Picker", n = m(t ? void 0 : "2d slider"), c = this.labelX, d = this.labelY, h = new Intl.NumberFormat(this.languageResolver.language, {
|
|
218
|
+
style: "percent",
|
|
219
|
+
unitDisplay: "narrow"
|
|
220
|
+
}).format(this.x), p = new Intl.NumberFormat(this.languageResolver.language, {
|
|
221
|
+
style: "percent",
|
|
222
|
+
unitDisplay: "narrow"
|
|
223
|
+
}).format(this.y), f = `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%);`;
|
|
224
|
+
return y`
|
|
225
|
+
<div
|
|
226
|
+
@pointerdown=${this.handleAreaPointerdown}
|
|
227
|
+
class="gradient"
|
|
228
|
+
style="background: ${f}"
|
|
229
|
+
>
|
|
230
|
+
<slot name="gradient"></slot>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<luzmo-color-handle
|
|
234
|
+
tabindex=${m(this.focused ? void 0 : "0")}
|
|
235
|
+
@focus=${this.forwardFocus}
|
|
236
|
+
?focused=${this.focused}
|
|
237
|
+
class="handle"
|
|
238
|
+
color=${this.colorController.getHslString()}
|
|
239
|
+
?disabled=${this.disabled}
|
|
240
|
+
style=${`transform: translate(${(this.isLTR ? this.x : 1 - this.x) * e}px, ${o - this.y * o}px);`}
|
|
241
|
+
${k({
|
|
242
|
+
start: ["pointerdown", this.handlePointerdown],
|
|
243
|
+
streamInside: ["pointermove", this.handlePointermove],
|
|
244
|
+
end: [
|
|
245
|
+
["pointerup", "pointercancel", "pointerleave"],
|
|
246
|
+
this.handlePointerup
|
|
247
|
+
]
|
|
248
|
+
})}
|
|
249
|
+
></luzmo-color-handle>
|
|
250
|
+
|
|
251
|
+
<fieldset
|
|
252
|
+
class="fieldset"
|
|
253
|
+
aria-label=${m(t ? a : void 0)}
|
|
254
|
+
>
|
|
255
|
+
<div role="presentation">
|
|
256
|
+
<input
|
|
257
|
+
type="range"
|
|
258
|
+
class="slider"
|
|
259
|
+
name="x"
|
|
260
|
+
aria-label=${t ? c : `${c} ${a}`}
|
|
261
|
+
aria-roledescription=${n}
|
|
262
|
+
aria-orientation="horizontal"
|
|
263
|
+
aria-valuetext=${t ? h : `${h}, ${c}${this._valueChanged ? "" : `, ${p}, ${d}`}`}
|
|
264
|
+
min="0"
|
|
265
|
+
max="1"
|
|
266
|
+
step=${this.step}
|
|
267
|
+
tabindex="-1"
|
|
268
|
+
.value=${String(this.x)}
|
|
269
|
+
@input=${this.handleInput}
|
|
270
|
+
@change=${this.handleChange}
|
|
271
|
+
/>
|
|
272
|
+
</div>
|
|
273
|
+
<div role="presentation">
|
|
274
|
+
<input
|
|
275
|
+
type="range"
|
|
276
|
+
class="slider"
|
|
277
|
+
name="y"
|
|
278
|
+
aria-label=${t ? d : `${d} ${a}`}
|
|
279
|
+
aria-roledescription=${n}
|
|
280
|
+
aria-orientation="vertical"
|
|
281
|
+
aria-valuetext=${t ? p : `${p}, ${d}${this._valueChanged ? "" : `, ${h}, ${c}`}`}
|
|
282
|
+
orient="vertical"
|
|
283
|
+
min="0"
|
|
284
|
+
max="1"
|
|
285
|
+
step=${this.step}
|
|
286
|
+
tabindex="-1"
|
|
287
|
+
.value=${String(this.y)}
|
|
288
|
+
@input=${this.handleInput}
|
|
289
|
+
@change=${this.handleChange}
|
|
290
|
+
/>
|
|
291
|
+
</div>
|
|
292
|
+
</fieldset>
|
|
293
|
+
`;
|
|
294
|
+
}
|
|
295
|
+
firstUpdated(e) {
|
|
296
|
+
super.firstUpdated(e), this.boundingClientRect = this.getBoundingClientRect(), this.addEventListener("focus", this.handleFocus), this.addEventListener("blur", this.handleBlur), this.addEventListener("keyup", this.handleKeyup), this.addEventListener("keydown", this.handleKeydown);
|
|
297
|
+
}
|
|
298
|
+
updated(e) {
|
|
299
|
+
if (super.updated(e), this.x !== this.inputX.valueAsNumber && (this._x = this.inputX.valueAsNumber), this.y !== this.inputY.valueAsNumber && (this._y = this.inputY.valueAsNumber), e.has("focused") && this.focused) {
|
|
300
|
+
const o = this.inputX.parentElement, t = this.inputY.parentElement;
|
|
301
|
+
if (!o.shadowRoot && !t.shadowRoot) {
|
|
302
|
+
o.attachShadow({ mode: "open" }), t.attachShadow({ mode: "open" });
|
|
303
|
+
const r = '<div tabindex="-1"><slot></slot></div>';
|
|
304
|
+
o.shadowRoot.innerHTML = r, t.shadowRoot.innerHTML = r;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
connectedCallback() {
|
|
309
|
+
var e;
|
|
310
|
+
super.connectedCallback(), !this.observer && window.ResizeObserver && (this.observer = new window.ResizeObserver((o) => {
|
|
311
|
+
for (const t of o)
|
|
312
|
+
this.boundingClientRect = t.contentRect;
|
|
313
|
+
this.requestUpdate();
|
|
314
|
+
})), (e = this.observer) == null || e.observe(this);
|
|
315
|
+
}
|
|
316
|
+
disconnectedCallback() {
|
|
317
|
+
var e;
|
|
318
|
+
(e = this.observer) == null || e.unobserve(this), super.disconnectedCallback();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
l([
|
|
322
|
+
s({ type: String, reflect: !0 })
|
|
323
|
+
], i.prototype, "dir", 2);
|
|
324
|
+
l([
|
|
325
|
+
s({ type: Boolean, reflect: !0 })
|
|
326
|
+
], i.prototype, "disabled", 2);
|
|
327
|
+
l([
|
|
328
|
+
s({ type: Boolean, reflect: !0 })
|
|
329
|
+
], i.prototype, "focused", 2);
|
|
330
|
+
l([
|
|
331
|
+
s({ type: String, attribute: "label-x" })
|
|
332
|
+
], i.prototype, "labelX", 2);
|
|
333
|
+
l([
|
|
334
|
+
s({ type: String, attribute: "label-y" })
|
|
335
|
+
], i.prototype, "labelY", 2);
|
|
336
|
+
l([
|
|
337
|
+
s({ type: Boolean, attribute: "is-ltr" })
|
|
338
|
+
], i.prototype, "isLTR", 2);
|
|
339
|
+
l([
|
|
340
|
+
b(".handle")
|
|
341
|
+
], i.prototype, "handle", 2);
|
|
342
|
+
l([
|
|
343
|
+
s({ type: Number })
|
|
344
|
+
], i.prototype, "hue", 1);
|
|
345
|
+
l([
|
|
346
|
+
s({ type: String })
|
|
347
|
+
], i.prototype, "value", 1);
|
|
348
|
+
l([
|
|
349
|
+
s({ type: String })
|
|
350
|
+
], i.prototype, "color", 1);
|
|
351
|
+
l([
|
|
352
|
+
s({ attribute: !1 })
|
|
353
|
+
], i.prototype, "activeAxis", 2);
|
|
354
|
+
l([
|
|
355
|
+
s({ type: Number })
|
|
356
|
+
], i.prototype, "x", 1);
|
|
357
|
+
l([
|
|
358
|
+
s({ type: Number })
|
|
359
|
+
], i.prototype, "y", 1);
|
|
360
|
+
l([
|
|
361
|
+
s({ type: Number })
|
|
362
|
+
], i.prototype, "step", 2);
|
|
363
|
+
l([
|
|
364
|
+
b('[name="x"]')
|
|
365
|
+
], i.prototype, "inputX", 2);
|
|
366
|
+
l([
|
|
367
|
+
b('[name="y"]')
|
|
368
|
+
], i.prototype, "inputY", 2);
|
|
369
|
+
customElements.get("luzmo-color-area") || customElements.define("luzmo-color-area", i);
|
|
370
|
+
export {
|
|
371
|
+
i as LuzmoColorArea
|
|
372
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
|
2
|
+
import { LuzmoTextFieldBase } from './../text-field/text-field';
|
|
3
|
+
/**
|
|
4
|
+
* @element luzmo-color-field
|
|
5
|
+
* @fires input - The value of the color-field has changed.
|
|
6
|
+
* @fires change - An alteration to the value of the color-field has been committed by the user.
|
|
7
|
+
*/
|
|
8
|
+
export declare class LuzmoColorField extends LuzmoTextFieldBase {
|
|
9
|
+
static get styles(): CSSResultArray;
|
|
10
|
+
viewColor: boolean;
|
|
11
|
+
set value(value: string);
|
|
12
|
+
get value(): string;
|
|
13
|
+
protected _value: string;
|
|
14
|
+
private cachedColor;
|
|
15
|
+
getColorValue(): string;
|
|
16
|
+
private renderColorHandle;
|
|
17
|
+
protected render(): TemplateResult;
|
|
18
|
+
private cachedTinyColor;
|
|
19
|
+
checkValidity(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../base-rtxi7uaR.cjs"),a=require("../text-field-BU7yxiOR.cjs"),u=require("../index-DCKCHDTt.cjs");var h=Object.defineProperty,c=(l,e,t,d)=>{for(var o=void 0,r=l.length-1,n;r>=0;r--)(n=l[r])&&(o=n(e,t,o)||o);return o&&h(e,t,o),o};class s extends a.LuzmoTextFieldBase{constructor(){super(...arguments),this.viewColor=!1,this._value="",this.cachedColor=null,this.cachedTinyColor=null}static get styles(){return[...super.styles]}set value(e){if(e===this.value)return;const t=this._value;this._value=e,this.requestUpdate("value",t)}get value(){return this._value}getColorValue(){if(!this.value)return"";if(!this.cachedColor||this.cachedColor!==this.value){const e=new u.TinyColor(this.value);this.cachedColor=e.isValid?e.toRgbString():""}return this.cachedColor}renderColorHandle(){return this.viewColor?i.x`
|
|
19
|
+
<luzmo-color-handle
|
|
20
|
+
size="m"
|
|
21
|
+
color=${this.getColorValue()}
|
|
22
|
+
></luzmo-color-handle>
|
|
23
|
+
`:i.x``}render(){return this.viewColor&&Promise.resolve().then(()=>require("../color-handle/index.cjs")),i.x` ${super.render()} ${this.renderColorHandle()} `}checkValidity(){let e=super.checkValidity();return this.value&&((!this.cachedTinyColor||this.cachedTinyColor.originalInput!==this.value)&&(this.cachedTinyColor=new u.TinyColor(this.value)),this.valid=e=this.cachedTinyColor.isValid,this.invalid=!e),e}}c([i.n({type:Boolean,attribute:"view-color"})],s.prototype,"viewColor");customElements.get("luzmo-color-field")||customElements.define("luzmo-color-field",s);exports.LuzmoColorField=s;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { x as i, n as a } from "../base-CxUap9HL.js";
|
|
19
|
+
import { a as s } from "../text-field-05QNK_Lj.js";
|
|
20
|
+
import { T as c } from "../index-C1chwzNp.js";
|
|
21
|
+
const n = () => {
|
|
22
|
+
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
23
|
+
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-hard: #000;--luzmo-font-color-disabled: var(--luzmo-color-disabled);--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-color-negative: #ca221c;--luzmo-color-negative-hover: #b3241f;--luzmo-color-negative-down: #9f231f;--luzmo-color-negative-focus: #b3241f;--luzmo-color-negative-rgb: 202, 34, 28;--luzmo-color-positive: rgb(20, 150, 101);--luzmo-color-positive-hover: rgb(17, 128, 86);--luzmo-color-positive-down: rgb(16, 105, 71);--luzmo-color-positive-focus: rgb(17, 128, 86);--luzmo-color-positive-rgb: 20, 150, 101;--luzmo-color-selected: rgb(110, 110, 110);--luzmo-color-selected-hover: rgb(70, 70, 70);--luzmo-color-selected-down: rgb(40, 40, 40);--luzmo-color-selected-focus: rgb(70, 70, 70);--luzmo-color-selected-hard: #1e1e1e;--luzmo-color-selected-hard-hover: rgb(0, 0, 0);--luzmo-color-selected-hard-down: rgb(0, 0, 0);--luzmo-color-selected-hard-focus: rgb(0, 0, 0);--luzmo-color-informative: #1a77e9;--luzmo-color-informative-rgb: 26, 119, 233;--luzmo-color-disabled: #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
|
+
};
|
|
27
|
+
n();
|
|
28
|
+
var d = Object.defineProperty, z = (l, o, e, f) => {
|
|
29
|
+
for (var r = void 0, u = l.length - 1, t; u >= 0; u--)
|
|
30
|
+
(t = l[u]) && (r = t(o, e, r) || r);
|
|
31
|
+
return r && d(o, e, r), r;
|
|
32
|
+
};
|
|
33
|
+
class m extends s {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments), this.viewColor = !1, this._value = "", this.cachedColor = null, this.cachedTinyColor = null;
|
|
36
|
+
}
|
|
37
|
+
static get styles() {
|
|
38
|
+
return [...super.styles];
|
|
39
|
+
}
|
|
40
|
+
set value(o) {
|
|
41
|
+
if (o === this.value)
|
|
42
|
+
return;
|
|
43
|
+
const e = this._value;
|
|
44
|
+
this._value = o, this.requestUpdate("value", e);
|
|
45
|
+
}
|
|
46
|
+
get value() {
|
|
47
|
+
return this._value;
|
|
48
|
+
}
|
|
49
|
+
getColorValue() {
|
|
50
|
+
if (!this.value)
|
|
51
|
+
return "";
|
|
52
|
+
if (!this.cachedColor || this.cachedColor !== this.value) {
|
|
53
|
+
const o = new c(this.value);
|
|
54
|
+
this.cachedColor = o.isValid ? o.toRgbString() : "";
|
|
55
|
+
}
|
|
56
|
+
return this.cachedColor;
|
|
57
|
+
}
|
|
58
|
+
renderColorHandle() {
|
|
59
|
+
return this.viewColor ? i`
|
|
60
|
+
<luzmo-color-handle
|
|
61
|
+
size="m"
|
|
62
|
+
color=${this.getColorValue()}
|
|
63
|
+
></luzmo-color-handle>
|
|
64
|
+
` : i``;
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
return this.viewColor && import("../color-handle/index.js"), i` ${super.render()} ${this.renderColorHandle()} `;
|
|
68
|
+
}
|
|
69
|
+
checkValidity() {
|
|
70
|
+
let o = super.checkValidity();
|
|
71
|
+
return this.value && ((!this.cachedTinyColor || this.cachedTinyColor.originalInput !== this.value) && (this.cachedTinyColor = new c(this.value)), this.valid = o = this.cachedTinyColor.isValid, this.invalid = !o), o;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
z([
|
|
75
|
+
a({ type: Boolean, attribute: "view-color" })
|
|
76
|
+
], m.prototype, "viewColor");
|
|
77
|
+
customElements.get("luzmo-color-field") || customElements.define("luzmo-color-field", m);
|
|
78
|
+
export {
|
|
79
|
+
m as LuzmoColorField
|
|
80
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './../color-loupe/color-loupe';
|
|
2
|
+
import { LuzmoElement } from '../../utils/base';
|
|
3
|
+
export declare class LuzmoColorHandle extends LuzmoElement {
|
|
4
|
+
static styles: import("lit").CSSResult;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
focused: boolean;
|
|
7
|
+
open: boolean;
|
|
8
|
+
color: string;
|
|
9
|
+
private handlePointerdown;
|
|
10
|
+
private handlePointerup;
|
|
11
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
protected firstUpdated(changedProperties: Map<string, any>): void;
|
|
13
|
+
}
|