@luzmo/lucero 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accordion/index.cjs +43 -0
- package/lib/accordion/index.js +182 -0
- package/lib/action-bar/index.cjs +39 -0
- package/lib/action-bar/index.js +108 -0
- package/lib/action-button/index.cjs +24 -0
- package/lib/action-button/index.js +162 -0
- package/lib/action-group/index.cjs +18 -0
- package/lib/action-group/index.js +29 -0
- package/lib/action-group-BoIH8s8R.js +259 -0
- package/lib/action-group-D4MxBrq8.cjs +20 -0
- package/lib/action-menu/index.cjs +56 -0
- package/lib/action-menu/index.js +127 -0
- package/lib/async-directive-CV2MII86.cjs +22 -0
- package/lib/async-directive-FGzMycjH.js +82 -0
- package/lib/avatar/index.cjs +24 -0
- package/lib/avatar/index.js +82 -0
- package/lib/base-BCmA9Wxv.cjs +30 -0
- package/lib/base-BjTwmyRF.cjs +22 -0
- package/lib/base-D76d76ww.js +26 -0
- package/lib/base-nYalvNMy.js +390 -0
- package/lib/button/index.cjs +20 -0
- package/lib/button/index.js +128 -0
- package/lib/button-base-B0iB_JTv.cjs +25 -0
- package/lib/button-base-DgtT6sU5.js +143 -0
- package/lib/button-group/index.cjs +18 -0
- package/lib/button-group/index.js +60 -0
- package/lib/checkbox/index.cjs +25 -0
- package/lib/checkbox/index.js +97 -0
- package/lib/checkbox-mixin-DegQlk5C.js +71 -0
- package/lib/checkbox-mixin-H0Hm-VLk.cjs +27 -0
- package/lib/clear-button-Ap5H3UyH.js +54 -0
- package/lib/clear-button-D0djuaLb.cjs +18 -0
- package/lib/close-button-BrfeZvjk.cjs +18 -0
- package/lib/close-button-CGISEF33.js +52 -0
- package/lib/color-Bg3tYsAQ.js +178 -0
- package/lib/color-DphK4hwx.cjs +18 -0
- package/lib/color-area/index.cjs +80 -0
- package/lib/color-area/index.js +373 -0
- package/lib/color-field/index.cjs +23 -0
- package/lib/color-field/index.js +81 -0
- package/lib/color-handle/index.cjs +24 -0
- package/lib/color-handle/index.js +74 -0
- package/lib/color-loupe/index.cjs +18 -0
- package/lib/color-loupe/index.js +29 -0
- package/lib/color-loupe-BICpNqFs.cjs +56 -0
- package/lib/color-loupe-DBEApMDT.js +82 -0
- package/lib/color-menu/index.cjs +86 -0
- package/lib/color-menu/index.js +204 -0
- package/lib/color-picker/index.cjs +48 -0
- package/lib/color-picker/index.js +142 -0
- package/lib/color-slider/index.cjs +57 -0
- package/lib/color-slider/index.js +318 -0
- package/lib/condition-attribute-with-id-DrQYZzFS.cjs +18 -0
- package/lib/condition-attribute-with-id-Dv4lSRbe.js +31 -0
- package/lib/dependency-manger-C5HCkMMB.cjs +18 -0
- package/lib/dependency-manger-CEXvGQUV.js +54 -0
- package/lib/directive-C7oCP5Bh.cjs +22 -0
- package/lib/directive-helpers-BLDZnGQv.js +28 -0
- package/lib/directive-helpers-C2vOfhFx.cjs +22 -0
- package/lib/directive-oAbCiebi.js +44 -0
- package/lib/divider/index.cjs +18 -0
- package/lib/divider/index.js +62 -0
- package/lib/divider.module-CXMNveQc.cjs +18 -0
- package/lib/divider.module-DwOuLGU3.js +21 -0
- package/lib/element-resolution-BvRLGqIU.cjs +18 -0
- package/lib/element-resolution-FCUT-wql.js +91 -0
- package/lib/field-group/index.cjs +18 -0
- package/lib/field-group/index.js +29 -0
- package/lib/field-group-CBWafIUV.js +67 -0
- package/lib/field-group-TUFvhJkk.cjs +23 -0
- package/lib/field-label/index.cjs +18 -0
- package/lib/field-label/index.js +29 -0
- package/lib/field-label-BK_tk8vP.js +107 -0
- package/lib/field-label-BrJaeORz.cjs +25 -0
- package/lib/focus-group-DHeTq18L.js +218 -0
- package/lib/focus-group-DnxZUBhQ.cjs +18 -0
- package/lib/focus-visible-B0P9aY_G.cjs +18 -0
- package/lib/focus-visible-DBlJGoEW.js +74 -0
- package/lib/focusable-DbUg-3Vp.js +153 -0
- package/lib/focusable-Dv_6CFaY.cjs +18 -0
- package/lib/focusable-selectors-B4YgbghQ.js +31 -0
- package/lib/focusable-selectors-BgFlyFcY.cjs +18 -0
- package/lib/icon/index.cjs +18 -0
- package/lib/icon/index.js +89 -0
- package/lib/if-defined-CYpcjGCb.js +27 -0
- package/lib/if-defined-Cv6xanXh.cjs +22 -0
- package/lib/index-C1chwzNp.js +727 -0
- package/lib/index-DCKCHDTt.cjs +18 -0
- package/lib/index-ovT-qVzf.js +928 -0
- package/lib/index-yNcLzjhM.cjs +77 -0
- package/lib/index.cjs +18 -0
- package/lib/index.js +133 -0
- package/lib/infield-button/index.cjs +22 -0
- package/lib/infield-button/index.js +65 -0
- package/lib/label/index.cjs +18 -0
- package/lib/label/index.js +52 -0
- package/lib/legend-position/index.cjs +27 -0
- package/lib/legend-position/index.js +85 -0
- package/lib/like-anchor-K8W0QYwC.cjs +32 -0
- package/lib/like-anchor-cDeGGeHh.js +70 -0
- package/lib/lit-html-B3ugcwD9.js +248 -0
- package/lib/lit-html-p4Oxv2-5.cjs +24 -0
- package/lib/manage-help-text-2mSEy-AD.js +92 -0
- package/lib/manage-help-text-iOk-zmy8.cjs +30 -0
- package/lib/menu/index.cjs +18 -0
- package/lib/menu/index.js +32 -0
- package/lib/multi-language-field/index.cjs +39 -0
- package/lib/multi-language-field/index.js +149 -0
- package/lib/mutation-controller-DH7YOCyj.js +52 -0
- package/lib/mutation-controller-DkOMCW-c.cjs +22 -0
- package/lib/number-field/index.cjs +57 -0
- package/lib/number-field/index.js +736 -0
- package/lib/observe-slot-text-BmsCNJig.cjs +18 -0
- package/lib/observe-slot-text-BoFRF-VI.js +87 -0
- package/lib/overlay/index.cjs +73 -0
- package/lib/overlay/index.js +325 -0
- package/lib/overlay-C7QKFqRc.js +2702 -0
- package/lib/overlay-DScraBAi.cjs +47 -0
- package/lib/pending-state-D5KTK4_1.js +61 -0
- package/lib/pending-state-Dbc2HIM2.cjs +26 -0
- package/lib/picker/index.cjs +18 -0
- package/lib/picker/index.js +32 -0
- package/lib/picker--2OCYWnV.js +657 -0
- package/lib/picker-B9W7Haf4.cjs +127 -0
- package/lib/platform-CQzYNWKq.cjs +18 -0
- package/lib/platform-DQYMG7JI.js +54 -0
- package/lib/popover/index.cjs +18 -0
- package/lib/popover/index.js +29 -0
- package/lib/popover-CVbjhSnx.cjs +30 -0
- package/lib/popover-ZRVxogyp.js +68 -0
- package/lib/progress-circle/index.cjs +18 -0
- package/lib/progress-circle/index.js +29 -0
- package/lib/progress-circle-CiJoS8J7.cjs +33 -0
- package/lib/progress-circle-DpXiqW6a.js +98 -0
- package/lib/query-BL-TJj7K.cjs +22 -0
- package/lib/query-D_KR_GUc.js +51 -0
- package/lib/query-assigned-elements-DjfhL1cl.js +36 -0
- package/lib/query-assigned-elements-DsKsfk7G.cjs +22 -0
- package/lib/query-assigned-nodes-BcKWmGzy.cjs +22 -0
- package/lib/query-assigned-nodes-C76XVPWY.js +36 -0
- package/lib/radio/index.cjs +22 -0
- package/lib/radio/index.js +192 -0
- package/lib/random-id-ByCz1xaq.js +26 -0
- package/lib/random-id-CqvckpWe.cjs +18 -0
- package/lib/roving-tabindex-By_fCy_e.cjs +18 -0
- package/lib/roving-tabindex-DOg4z6ZU.js +66 -0
- package/lib/search/index.cjs +45 -0
- package/lib/search/index.js +132 -0
- package/lib/sized-mixin-BSYHt8nT.cjs +18 -0
- package/lib/sized-mixin-Dl0KoEcV.js +63 -0
- package/lib/slider/index.cjs +18 -0
- package/lib/slider/index.js +1159 -0
- package/lib/slottable-request-event-BfUUt1Mh.cjs +18 -0
- package/lib/slottable-request-event-DggLA4Rx.js +31 -0
- package/lib/state-BAO-13Bs.js +29 -0
- package/lib/state-DReJ3hB6.cjs +22 -0
- package/lib/streaming-listener-Bw4jE33f.cjs +18 -0
- package/lib/streaming-listener-DLo0wkMc.js +125 -0
- package/lib/style-map-BjBGQ_u3.cjs +22 -0
- package/lib/style-map-BqvQDFJt.js +53 -0
- package/lib/swatch/index.cjs +49 -0
- package/lib/swatch/index.js +343 -0
- package/lib/switch/index.cjs +22 -0
- package/lib/switch/index.js +74 -0
- package/lib/tags/index.cjs +32 -0
- package/lib/tags/index.js +174 -0
- package/lib/text-field/index.cjs +21 -0
- package/lib/text-field/index.js +62 -0
- package/lib/text-field-C6Aa7XOb.cjs +85 -0
- package/lib/text-field-DPk332j9.js +315 -0
- package/lib/toast/index.cjs +51 -0
- package/lib/toast/index.js +154 -0
- package/lib/tooltip/index.cjs +45 -0
- package/lib/tooltip/index.js +221 -0
- package/lib/unit-input/index.cjs +43 -0
- package/lib/unit-input/index.js +184 -0
- package/lib/when-CDK1Tt5Y.js +28 -0
- package/lib/when-CDZyJPvd.cjs +22 -0
- package/package.json +2 -2
|
@@ -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 c=require("./index-DCKCHDTt.cjs"),_=/^hs[v|l]a?\s?\((\d{1,3}\.?\d*?),?\s?(\d{1,3})/,f=/(^hs[v|l]a?\s?\()\d{1,3}\.?\d*?(,?\s?)\d{1,3}/,S=/(^hs[v|l]a?\()\d{1,3}/,g=(p,s)=>s?p.toHexString():p.toHex();class H{constructor(s,{applyColorToState:i,extractColorFromState:e,maintains:r}){this.maintains="hue",this._hue=0,this._opacity=1,this.getColorProcesses={rgb:(t,o)=>o?t.toRgbString():t.toRgb(),prgb:(t,o)=>o?t.toPercentageRgbString():t.toPercentageRgb(),hex8:(t,o)=>o?t.toHex8String():t.toHex8(),name:t=>t.toName()||t.toRgbString(),hsl:(t,o)=>{if(this.maintains==="hue"){if(o)return t.toHslString().replace(S,`$1${this.hue}`);const{s:n,l:u,a:v}=t.toHsl();return{h:this.hue,s:n,l:u,a:v}}if(o)return t.toHslString().replace(f,`$1${this.hue}$2${this.saturation}`);const{s:h,l:a,a:l}=t.toHsl();return{h:this.hue,s:h,l:a,a:l}},hsv:(t,o)=>{if(this.maintains==="hue"){if(o)return t.toHsvString().replace(S,`$1${this.hue}`);const{s:n,v:u,a:v}=t.toHsv();return{h:this.hue,s:n,v:u,a:v}}if(o)return t.toHsvString().replace(f,`$1${this.hue}$2${this.saturation}`);const{s:h,v:a,a:l}=t.toHsv();return{h:this.hue,s:h,v:a,a:l}},hex:g,hex3:g,hex4:g,hex6:g},this._color=new c.TinyColor({h:0,s:1,v:1}),this._previousColor=new c.TinyColor({h:0,s:1,v:1}),this._format={format:"",isString:!1},this.host=s,this.applyColorToState=i,this.extractColorFromState=e,this.maintains=r||this.maintains}setColorProcess(s,i,e,r){this.maintains==="hue"?this.setColorMaintainHue(s,i,e,r):this.maintains==="saturation"&&this.setColorMaintainSaturation(s,i,e,r)}setColorMaintainHue(s,i,e,r){const{h:t,s:o,v:h,a}=this._color.toHsv();let l;if(r&&e.startsWith("hs")){const n=_.exec(i);if(n!==null){const[,u]=n;l=Number(u)}}else if(!r&&e.startsWith("hs")){const n=s.originalInput;l=Object.values(n)[0]}this.hue=l||t,this.opacity=a??1,this.applyColorToState({h:t,s:o,v:h,a})}setColorMaintainSaturation(s,i,e,r){const{a:t}=this._color.toHsv();if(r&&e.startsWith("hs")){const o=_.exec(i);if(o!==null){const[,h,a]=o;this.hue=Number(h),this.saturation=Number(a)}}else if(!r&&e.startsWith("hs")){const o=s.originalInput,h=Object.values(o);this.hue=h[0],this.saturation=h[1]}else{const{h:o}=s.toHsv();this.hue=o}this.opacity=t??1,this.applyColorToState(s.toHsv())}applyColorFromState(){this._color=new c.TinyColor(this.extractColorFromState(this))}get hue(){return this._hue}set hue(s){const i=Math.min(360,Math.max(0,s));if(i===this.hue)return;const e=this.hue,{s:r,v:t,a:o}=this._color.toHsv();this._color=new c.TinyColor({h:i,s:r,v:t,a:o}),this._hue=i,this.host.requestUpdate("hue",e)}get opacity(){return this._opacity}set opacity(s){const i=Math.min(1,Math.max(0,s));if(i===this.opacity)return;const e=this.opacity,{h:r,s:t,v:o}=this._color.toHsv();this._color=new c.TinyColor({h:r,s:t,v:o,a:i}),this._opacity=i,this.host.requestUpdate("opacity",e)}get value(){return this.color}get color(){return this.getColorProcesses[this._format.format||"hex"](this._color,this._format.isString)}set color(s){if(s===this.color)return;const i=this._color;this._color=new c.TinyColor(s);const e=this._color.format;let r=typeof s=="string"||s instanceof String;e.startsWith("hex")&&(r=s.startsWith("#")),this._format={format:e,isString:r},this.setColorProcess(this._color,s,e,r),this.host.requestUpdate("color",i)}getColor(s){const i={hsl:"toHsl"};return this._color[i[s]]()}setColor(s){this._color=s;const i=typeof this._color.originalInput=="string"||this._color.originalInput instanceof String;this.setColorProcess(this._color,s,this._color.format,i)}getHslString(){return this._color.toHslString()}savePreviousColor(){this._previousColor=this._color.clone()}restorePreviousColor(){this.setColor(this._previousColor)}}exports.ColorController=H;
|
|
@@ -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 m=require("lit"),a=require("../base-BCmA9Wxv.cjs"),f=require("../query-BL-TJj7K.cjs"),b=require("../if-defined-Cv6xanXh.cjs");require("../color-handle/index.cjs");const v=require("../platform-CQzYNWKq.cjs"),w=require("../color-DphK4hwx.cjs"),g=require("../streaming-listener-Bw4jE33f.cjs"),C="@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,$=Object.getOwnPropertyDescriptor,s=(p,e,t,r)=>{for(var o=r>1?void 0:r?$(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 a.LuzmoElement{constructor(){super(...arguments),this.disabled=!1,this.focused=!1,this.labelX="saturation",this.labelY="luminosity",this.isLTR=!0,this.languageResolver=new g.LanguageResolutionController(this),this.colorController=new w.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[m.unsafeCSS(C)]}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=v.isAndroid()||v.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),y=`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 m.html`
|
|
19
|
+
<div
|
|
20
|
+
@pointerdown=${this.handleAreaPointerdown}
|
|
21
|
+
class="gradient"
|
|
22
|
+
style="background: ${y}"
|
|
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
|
+
${g.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()}}s([a.n({type:String,reflect:!0})],i.prototype,"dir",2);s([a.n({type:Boolean,reflect:!0})],i.prototype,"disabled",2);s([a.n({type:Boolean,reflect:!0})],i.prototype,"focused",2);s([a.n({type:String,attribute:"label-x"})],i.prototype,"labelX",2);s([a.n({type:String,attribute:"label-y"})],i.prototype,"labelY",2);s([a.n({type:Boolean,attribute:"is-ltr"})],i.prototype,"isLTR",2);s([f.e(".handle")],i.prototype,"handle",2);s([a.n({type:Number})],i.prototype,"hue",1);s([a.n({type:String})],i.prototype,"value",1);s([a.n({type:String})],i.prototype,"color",1);s([a.n({attribute:!1})],i.prototype,"activeAxis",2);s([a.n({type:Number})],i.prototype,"x",1);s([a.n({type:Number})],i.prototype,"y",1);s([a.n({type:Number})],i.prototype,"step",2);s([f.e('[name="x"]')],i.prototype,"inputX",2);s([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,373 @@
|
|
|
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 { unsafeCSS as z, html as v } from "lit";
|
|
19
|
+
import { L as y, n as s } from "../base-nYalvNMy.js";
|
|
20
|
+
import { e as b } from "../query-D_KR_GUc.js";
|
|
21
|
+
import { o as m } from "../if-defined-CYpcjGCb.js";
|
|
22
|
+
import "../color-handle/index.js";
|
|
23
|
+
import { i as x, a as w } from "../platform-DQYMG7JI.js";
|
|
24
|
+
import { C } from "../color-Bg3tYsAQ.js";
|
|
25
|
+
import { L as $, s as k } from "../streaming-listener-DLo0wkMc.js";
|
|
26
|
+
const g = () => {
|
|
27
|
+
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
28
|
+
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-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);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
g();
|
|
33
|
+
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}";
|
|
34
|
+
var S = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, l = (u, e, o, t) => {
|
|
35
|
+
for (var r = t > 1 ? void 0 : t ? _(e, o) : e, a = u.length - 1, n; a >= 0; a--)
|
|
36
|
+
(n = u[a]) && (r = (t ? n(e, o, r) : n(r)) || r);
|
|
37
|
+
return t && r && S(e, o, r), r;
|
|
38
|
+
};
|
|
39
|
+
class i extends y {
|
|
40
|
+
constructor() {
|
|
41
|
+
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, {
|
|
42
|
+
extractColorFromState: () => ({
|
|
43
|
+
h: this.hue,
|
|
44
|
+
s: this.x,
|
|
45
|
+
v: this.y
|
|
46
|
+
}),
|
|
47
|
+
applyColorToState: ({ s: e, v: o }) => {
|
|
48
|
+
this._x = e, this._y = o, this.requestUpdate();
|
|
49
|
+
}
|
|
50
|
+
}), 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;
|
|
51
|
+
}
|
|
52
|
+
static get styles() {
|
|
53
|
+
return [z(R)];
|
|
54
|
+
}
|
|
55
|
+
get hue() {
|
|
56
|
+
return this.colorController.hue;
|
|
57
|
+
}
|
|
58
|
+
set hue(e) {
|
|
59
|
+
this.colorController.hue = e;
|
|
60
|
+
}
|
|
61
|
+
get value() {
|
|
62
|
+
return this.colorController.color;
|
|
63
|
+
}
|
|
64
|
+
get color() {
|
|
65
|
+
return this.colorController.color;
|
|
66
|
+
}
|
|
67
|
+
set color(e) {
|
|
68
|
+
this.colorController.color = e;
|
|
69
|
+
}
|
|
70
|
+
get x() {
|
|
71
|
+
return this._x;
|
|
72
|
+
}
|
|
73
|
+
set x(e) {
|
|
74
|
+
if (e === this.x)
|
|
75
|
+
return;
|
|
76
|
+
const o = this.x;
|
|
77
|
+
this._x = e, this.inputX && (this.inputX.value = e.toString(), this._x = this.inputX.valueAsNumber), this.requestUpdate("x", o), this.colorController.applyColorFromState();
|
|
78
|
+
}
|
|
79
|
+
get y() {
|
|
80
|
+
return this._y;
|
|
81
|
+
}
|
|
82
|
+
set y(e) {
|
|
83
|
+
if (e === this.y)
|
|
84
|
+
return;
|
|
85
|
+
const o = this.y;
|
|
86
|
+
this._y = e, this.inputY && (this.inputY.value = e.toString(), this._y = this.inputY.valueAsNumber), this.requestUpdate("y", o), this.colorController.applyColorFromState();
|
|
87
|
+
}
|
|
88
|
+
focus(e = {}) {
|
|
89
|
+
super.focus(e), this.forwardFocus();
|
|
90
|
+
}
|
|
91
|
+
forwardFocus() {
|
|
92
|
+
this.activeAxis === "x" ? this.inputX.focus() : this.inputY.focus();
|
|
93
|
+
}
|
|
94
|
+
handleFocus() {
|
|
95
|
+
this.focused = !0, this._valueChanged = !1;
|
|
96
|
+
}
|
|
97
|
+
handleBlur() {
|
|
98
|
+
this._pointerDown || (this.altered = 0, this.focused = !1, this._valueChanged = !1);
|
|
99
|
+
}
|
|
100
|
+
handleKeydown(e) {
|
|
101
|
+
const { code: o } = e;
|
|
102
|
+
this.focused = !0, this.altered = [e.shiftKey, e.ctrlKey, e.altKey].filter(
|
|
103
|
+
(r) => !!r
|
|
104
|
+
).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());
|
|
105
|
+
}
|
|
106
|
+
handleKeypress() {
|
|
107
|
+
let e = 0, o = 0;
|
|
108
|
+
const t = Math.max(this.step, this.altered * 5 * this.step);
|
|
109
|
+
this.activeKeys.forEach((r) => {
|
|
110
|
+
switch (r) {
|
|
111
|
+
case "ArrowUp": {
|
|
112
|
+
o = t;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case "ArrowDown": {
|
|
116
|
+
o = t * -1;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case "ArrowLeft": {
|
|
120
|
+
e = this.step * (this.isLTR ? -1 : 1);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case "ArrowRight": {
|
|
124
|
+
e = this.step * (this.isLTR ? 1 : -1);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "PageUp": {
|
|
128
|
+
o = t * 10;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case "PageDown": {
|
|
132
|
+
o = t * -10;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case "Home": {
|
|
136
|
+
e = t * (this.isLTR ? -10 : 10);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
case "End": {
|
|
140
|
+
e = t * (this.isLTR ? 10 : -10);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}), 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(
|
|
145
|
+
new Event("input", {
|
|
146
|
+
bubbles: !0,
|
|
147
|
+
composed: !0
|
|
148
|
+
})
|
|
149
|
+
), this.dispatchEvent(
|
|
150
|
+
new Event("change", {
|
|
151
|
+
bubbles: !0,
|
|
152
|
+
composed: !0,
|
|
153
|
+
cancelable: !0
|
|
154
|
+
})
|
|
155
|
+
) || this.colorController.restorePreviousColor());
|
|
156
|
+
}
|
|
157
|
+
handleKeyup(e) {
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
const { code: o } = e;
|
|
160
|
+
this.activeKeys.delete(o);
|
|
161
|
+
}
|
|
162
|
+
handleInput(e) {
|
|
163
|
+
const { valueAsNumber: o, name: t } = e.target;
|
|
164
|
+
this[t] = o, this.colorController.applyColorFromState();
|
|
165
|
+
}
|
|
166
|
+
handleChange(e) {
|
|
167
|
+
this.handleInput(e), this.dispatchEvent(
|
|
168
|
+
new Event("change", {
|
|
169
|
+
bubbles: !0,
|
|
170
|
+
composed: !0,
|
|
171
|
+
cancelable: !0
|
|
172
|
+
})
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
handlePointerdown(e) {
|
|
176
|
+
if (e.button !== 0) {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this._pointerDown = !0, this.colorController.savePreviousColor(), this.boundingClientRect = this.getBoundingClientRect(), e.target.setPointerCapture(e.pointerId), e.pointerType === "mouse" && (this.focused = !0);
|
|
181
|
+
}
|
|
182
|
+
handlePointermove(e) {
|
|
183
|
+
const [o, t] = this.calculateHandlePosition(e);
|
|
184
|
+
this._valueChanged = !1, this.x = o, this.y = 1 - t, this.colorController.applyColorFromState(), this.dispatchEvent(
|
|
185
|
+
new Event("input", {
|
|
186
|
+
bubbles: !0,
|
|
187
|
+
composed: !0,
|
|
188
|
+
cancelable: !0
|
|
189
|
+
})
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
handlePointerup(e) {
|
|
193
|
+
e.preventDefault(), this._pointerDown = !1, e.target.releasePointerCapture(e.pointerId);
|
|
194
|
+
const o = this.dispatchEvent(
|
|
195
|
+
new Event("change", {
|
|
196
|
+
bubbles: !0,
|
|
197
|
+
composed: !0,
|
|
198
|
+
cancelable: !0
|
|
199
|
+
})
|
|
200
|
+
);
|
|
201
|
+
this.inputX.focus(), e.pointerType === "mouse" && (this.focused = !1), o || this.colorController.restorePreviousColor();
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Returns the value under the cursor
|
|
205
|
+
* @param: PointerEvent on slider
|
|
206
|
+
* @return: Slider value that correlates to the position under the pointer
|
|
207
|
+
*/
|
|
208
|
+
calculateHandlePosition(e) {
|
|
209
|
+
if (!this.boundingClientRect)
|
|
210
|
+
return [this.x, this.y];
|
|
211
|
+
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));
|
|
212
|
+
return [this.isLTR ? h : 1 - h, p];
|
|
213
|
+
}
|
|
214
|
+
handleAreaPointerdown(e) {
|
|
215
|
+
e.button === 0 && (e.stopPropagation(), e.preventDefault(), this.handle.dispatchEvent(new PointerEvent("pointerdown", e)), this.handlePointermove(e));
|
|
216
|
+
}
|
|
217
|
+
render() {
|
|
218
|
+
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, {
|
|
219
|
+
style: "percent",
|
|
220
|
+
unitDisplay: "narrow"
|
|
221
|
+
}).format(this.x), p = new Intl.NumberFormat(this.languageResolver.language, {
|
|
222
|
+
style: "percent",
|
|
223
|
+
unitDisplay: "narrow"
|
|
224
|
+
}).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%);`;
|
|
225
|
+
return v`
|
|
226
|
+
<div
|
|
227
|
+
@pointerdown=${this.handleAreaPointerdown}
|
|
228
|
+
class="gradient"
|
|
229
|
+
style="background: ${f}"
|
|
230
|
+
>
|
|
231
|
+
<slot name="gradient"></slot>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<luzmo-color-handle
|
|
235
|
+
tabindex=${m(this.focused ? void 0 : "0")}
|
|
236
|
+
@focus=${this.forwardFocus}
|
|
237
|
+
?focused=${this.focused}
|
|
238
|
+
class="handle"
|
|
239
|
+
color=${this.colorController.getHslString()}
|
|
240
|
+
?disabled=${this.disabled}
|
|
241
|
+
style=${`transform: translate(${(this.isLTR ? this.x : 1 - this.x) * e}px, ${o - this.y * o}px);`}
|
|
242
|
+
${k({
|
|
243
|
+
start: ["pointerdown", this.handlePointerdown],
|
|
244
|
+
streamInside: ["pointermove", this.handlePointermove],
|
|
245
|
+
end: [
|
|
246
|
+
["pointerup", "pointercancel", "pointerleave"],
|
|
247
|
+
this.handlePointerup
|
|
248
|
+
]
|
|
249
|
+
})}
|
|
250
|
+
></luzmo-color-handle>
|
|
251
|
+
|
|
252
|
+
<fieldset
|
|
253
|
+
class="fieldset"
|
|
254
|
+
aria-label=${m(t ? a : void 0)}
|
|
255
|
+
>
|
|
256
|
+
<div role="presentation">
|
|
257
|
+
<input
|
|
258
|
+
type="range"
|
|
259
|
+
class="slider"
|
|
260
|
+
name="x"
|
|
261
|
+
aria-label=${t ? c : `${c} ${a}`}
|
|
262
|
+
aria-roledescription=${n}
|
|
263
|
+
aria-orientation="horizontal"
|
|
264
|
+
aria-valuetext=${t ? h : `${h}, ${c}${this._valueChanged ? "" : `, ${p}, ${d}`}`}
|
|
265
|
+
min="0"
|
|
266
|
+
max="1"
|
|
267
|
+
step=${this.step}
|
|
268
|
+
tabindex="-1"
|
|
269
|
+
.value=${String(this.x)}
|
|
270
|
+
@input=${this.handleInput}
|
|
271
|
+
@change=${this.handleChange}
|
|
272
|
+
/>
|
|
273
|
+
</div>
|
|
274
|
+
<div role="presentation">
|
|
275
|
+
<input
|
|
276
|
+
type="range"
|
|
277
|
+
class="slider"
|
|
278
|
+
name="y"
|
|
279
|
+
aria-label=${t ? d : `${d} ${a}`}
|
|
280
|
+
aria-roledescription=${n}
|
|
281
|
+
aria-orientation="vertical"
|
|
282
|
+
aria-valuetext=${t ? p : `${p}, ${d}${this._valueChanged ? "" : `, ${h}, ${c}`}`}
|
|
283
|
+
orient="vertical"
|
|
284
|
+
min="0"
|
|
285
|
+
max="1"
|
|
286
|
+
step=${this.step}
|
|
287
|
+
tabindex="-1"
|
|
288
|
+
.value=${String(this.y)}
|
|
289
|
+
@input=${this.handleInput}
|
|
290
|
+
@change=${this.handleChange}
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
</fieldset>
|
|
294
|
+
`;
|
|
295
|
+
}
|
|
296
|
+
firstUpdated(e) {
|
|
297
|
+
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);
|
|
298
|
+
}
|
|
299
|
+
updated(e) {
|
|
300
|
+
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) {
|
|
301
|
+
const o = this.inputX.parentElement, t = this.inputY.parentElement;
|
|
302
|
+
if (!o.shadowRoot && !t.shadowRoot) {
|
|
303
|
+
o.attachShadow({ mode: "open" }), t.attachShadow({ mode: "open" });
|
|
304
|
+
const r = '<div tabindex="-1"><slot></slot></div>';
|
|
305
|
+
o.shadowRoot.innerHTML = r, t.shadowRoot.innerHTML = r;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
connectedCallback() {
|
|
310
|
+
var e;
|
|
311
|
+
super.connectedCallback(), !this.observer && window.ResizeObserver && (this.observer = new window.ResizeObserver((o) => {
|
|
312
|
+
for (const t of o)
|
|
313
|
+
this.boundingClientRect = t.contentRect;
|
|
314
|
+
this.requestUpdate();
|
|
315
|
+
})), (e = this.observer) == null || e.observe(this);
|
|
316
|
+
}
|
|
317
|
+
disconnectedCallback() {
|
|
318
|
+
var e;
|
|
319
|
+
(e = this.observer) == null || e.unobserve(this), super.disconnectedCallback();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
l([
|
|
323
|
+
s({ type: String, reflect: !0 })
|
|
324
|
+
], i.prototype, "dir", 2);
|
|
325
|
+
l([
|
|
326
|
+
s({ type: Boolean, reflect: !0 })
|
|
327
|
+
], i.prototype, "disabled", 2);
|
|
328
|
+
l([
|
|
329
|
+
s({ type: Boolean, reflect: !0 })
|
|
330
|
+
], i.prototype, "focused", 2);
|
|
331
|
+
l([
|
|
332
|
+
s({ type: String, attribute: "label-x" })
|
|
333
|
+
], i.prototype, "labelX", 2);
|
|
334
|
+
l([
|
|
335
|
+
s({ type: String, attribute: "label-y" })
|
|
336
|
+
], i.prototype, "labelY", 2);
|
|
337
|
+
l([
|
|
338
|
+
s({ type: Boolean, attribute: "is-ltr" })
|
|
339
|
+
], i.prototype, "isLTR", 2);
|
|
340
|
+
l([
|
|
341
|
+
b(".handle")
|
|
342
|
+
], i.prototype, "handle", 2);
|
|
343
|
+
l([
|
|
344
|
+
s({ type: Number })
|
|
345
|
+
], i.prototype, "hue", 1);
|
|
346
|
+
l([
|
|
347
|
+
s({ type: String })
|
|
348
|
+
], i.prototype, "value", 1);
|
|
349
|
+
l([
|
|
350
|
+
s({ type: String })
|
|
351
|
+
], i.prototype, "color", 1);
|
|
352
|
+
l([
|
|
353
|
+
s({ attribute: !1 })
|
|
354
|
+
], i.prototype, "activeAxis", 2);
|
|
355
|
+
l([
|
|
356
|
+
s({ type: Number })
|
|
357
|
+
], i.prototype, "x", 1);
|
|
358
|
+
l([
|
|
359
|
+
s({ type: Number })
|
|
360
|
+
], i.prototype, "y", 1);
|
|
361
|
+
l([
|
|
362
|
+
s({ type: Number })
|
|
363
|
+
], i.prototype, "step", 2);
|
|
364
|
+
l([
|
|
365
|
+
b('[name="x"]')
|
|
366
|
+
], i.prototype, "inputX", 2);
|
|
367
|
+
l([
|
|
368
|
+
b('[name="y"]')
|
|
369
|
+
], i.prototype, "inputY", 2);
|
|
370
|
+
customElements.get("luzmo-color-area") || customElements.define("luzmo-color-area", i);
|
|
371
|
+
export {
|
|
372
|
+
i as LuzmoColorArea
|
|
373
|
+
};
|
|
@@ -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 r=require("lit"),a=require("../base-BCmA9Wxv.cjs"),h=require("../text-field-C6Aa7XOb.cjs"),u=require("../index-DCKCHDTt.cjs");var c=Object.defineProperty,d=(i,e,l,v)=>{for(var t=void 0,o=i.length-1,n;o>=0;o--)(n=i[o])&&(t=n(e,l,t)||t);return t&&c(e,l,t),t};class s extends h.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 l=this._value;this._value=e,this.requestUpdate("value",l)}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?r.html`
|
|
19
|
+
<luzmo-color-handle
|
|
20
|
+
size="m"
|
|
21
|
+
color=${this.getColorValue()}
|
|
22
|
+
></luzmo-color-handle>
|
|
23
|
+
`:r.html``}render(){return this.viewColor&&Promise.resolve().then(()=>require("../color-handle/index.cjs")),r.html` ${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}}d([a.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,81 @@
|
|
|
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 { html as i } from "lit";
|
|
19
|
+
import { n as a } from "../base-nYalvNMy.js";
|
|
20
|
+
import { L as s } from "../text-field-DPk332j9.js";
|
|
21
|
+
import { T as c } from "../index-C1chwzNp.js";
|
|
22
|
+
const n = () => {
|
|
23
|
+
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
24
|
+
const l = document.createElement("style");
|
|
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-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);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
n();
|
|
29
|
+
var d = Object.defineProperty, z = (l, o, e, f) => {
|
|
30
|
+
for (var r = void 0, u = l.length - 1, t; u >= 0; u--)
|
|
31
|
+
(t = l[u]) && (r = t(o, e, r) || r);
|
|
32
|
+
return r && d(o, e, r), r;
|
|
33
|
+
};
|
|
34
|
+
class m extends s {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments), this.viewColor = !1, this._value = "", this.cachedColor = null, this.cachedTinyColor = null;
|
|
37
|
+
}
|
|
38
|
+
static get styles() {
|
|
39
|
+
return [...super.styles];
|
|
40
|
+
}
|
|
41
|
+
set value(o) {
|
|
42
|
+
if (o === this.value)
|
|
43
|
+
return;
|
|
44
|
+
const e = this._value;
|
|
45
|
+
this._value = o, this.requestUpdate("value", e);
|
|
46
|
+
}
|
|
47
|
+
get value() {
|
|
48
|
+
return this._value;
|
|
49
|
+
}
|
|
50
|
+
getColorValue() {
|
|
51
|
+
if (!this.value)
|
|
52
|
+
return "";
|
|
53
|
+
if (!this.cachedColor || this.cachedColor !== this.value) {
|
|
54
|
+
const o = new c(this.value);
|
|
55
|
+
this.cachedColor = o.isValid ? o.toRgbString() : "";
|
|
56
|
+
}
|
|
57
|
+
return this.cachedColor;
|
|
58
|
+
}
|
|
59
|
+
renderColorHandle() {
|
|
60
|
+
return this.viewColor ? i`
|
|
61
|
+
<luzmo-color-handle
|
|
62
|
+
size="m"
|
|
63
|
+
color=${this.getColorValue()}
|
|
64
|
+
></luzmo-color-handle>
|
|
65
|
+
` : i``;
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return this.viewColor && import("../color-handle/index.js"), i` ${super.render()} ${this.renderColorHandle()} `;
|
|
69
|
+
}
|
|
70
|
+
checkValidity() {
|
|
71
|
+
let o = super.checkValidity();
|
|
72
|
+
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;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
z([
|
|
76
|
+
a({ type: Boolean, attribute: "view-color" })
|
|
77
|
+
], m.prototype, "viewColor");
|
|
78
|
+
customElements.get("luzmo-color-field") || customElements.define("luzmo-color-field", m);
|
|
79
|
+
export {
|
|
80
|
+
m as LuzmoColorField
|
|
81
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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"});require("../color-loupe-BICpNqFs.cjs");const l=require("../base-BCmA9Wxv.cjs"),c=require("lit"),u=':host{touch-action:none;transition:inline-size var(--luzmo-color-handle-animation-duration, .13s) var(--luzmo-color-handle-animation-easing, ease-in-out),block-size var(--luzmo-color-handle-animation-duration, .13s) var(--luzmo-color-handle-animation-easing, ease-in-out),border-width var(--luzmo-color-handle-animation-duration, .13s) var(--luzmo-color-handle-animation-easing, ease-in-out),margin-inline var(--luzmo-color-handle-animation-duration, .13s) var(--luzmo-color-handle-animation-easing, ease-in-out),margin-block var(--luzmo-color-handle-animation-duration, .13s) var(--luzmo-color-handle-animation-easing, ease-in-out)}:host{background:repeating-conic-gradient(var(--luzmo-color-loupe-checkerboard-light, rgb(255, 255, 255)) 0 25%,var(--luzmo-color-loupe-checkerboard-dark, rgb(230, 230, 230)) 0 50%) var(--luzmo-color-loupe-checkerboard-position, left top)/calc(var(--luzmo-color-loupe-checkerboard-size, 8px) * 2) calc(var(--luzmo-color-loupe-checkerboard-size, 8px) * 2);background-position:50%}:host(:focus){outline:none}:host{z-index:1;box-sizing:border-box;inline-size:var(--luzmo-color-handle-size, 16px);block-size:var(--luzmo-color-handle-size, 16px);margin-inline:calc(var(--luzmo-color-handle-size, 16px) / 2 * -1);margin-block:calc(var(--luzmo-color-handle-size, 16px) / 2 * -1);border-width:var(--luzmo-color-handle-border-width, 2px);border-color:var(--luzmo-color-handle-border-color, rgb(255, 255, 255));box-shadow:0 0 0 var(--luzmo-color-handle-outer-border-width, 1px) var(--luzmo-color-handle-outer-border-color, rgba(0, 0, 0, .42));transition:all var(--luzmo-color-handle-animation-duration, 0) var(--luzmo-color-handle-animation-easing, ease-in-out);border-style:solid}:host,:host:after{border-radius:100%;display:block;position:absolute}:host:after{content:"";inset-inline:calc(50% - var(--luzmo-color-handle-hitarea-size, 24px) / 2);inset-block:calc(50% - var(--luzmo-color-handle-hitarea-size, 24px) / 2);inline-size:var(--luzmo-color-handle-hitarea-size, 24px);block-size:var(--luzmo-color-handle-hitarea-size, 24px);border-radius:var(--luzmo-color-handle-hitarea-border-radius, 100%)}:host([focused]),:host(:focus-visible){inline-size:var(--luzmo-color-handle-focused-size, 32px);block-size:var(--luzmo-color-handle-focused-size, 32px);margin-inline:calc(var(--luzmo-color-handle-size, 16px) * -1);margin-block:calc(var(--luzmo-color-handle-size, 16px) * -1);outline:none}:host([disabled]){pointer-events:none;border-color:var(--highcontrast-color-handle-border-color-disabled, var(--luzmo-color-handle-border-color-disabled, var(--luzmo-font-color-disabled)));background:var(--highcontrast-color-handle-fill-color-disabled, var(--luzmo-color-handle-fill-color-disabled, var(--luzmo-font-color-disabled)));box-shadow:none}:host([disabled]) .inner{display:none}.inner{inline-size:100%;block-size:100%;box-shadow:inset 0 0 0 var(--luzmo-color-handle-inner-border-width, var(--luzmo-border-width)) var(--luzmo-color-handle-inner-border-color, rgba(0, 0, 0, .42));background-color:var(--luzmo-picked-color);border-radius:100%}@media (forced-colors: active){:host{forced-color-adjust:none}:host([disabled]){--highcontrast-color-handle-border-color-disabled: GrayText;--highcontrast-color-handle-fill-color-disabled: Canvas}}';var h=Object.defineProperty,a=(t,o,s,m)=>{for(var r=void 0,n=t.length-1,d;n>=0;n--)(d=t[n])&&(r=d(o,s,r)||r);return r&&h(o,s,r),r};const i=class i extends l.LuzmoElement{constructor(){super(...arguments),this.disabled=!1,this.focused=!1,this.open=!1,this.color="rgba(255, 0, 0, 0.5)"}handlePointerdown(o){o.pointerType==="touch"&&(this.open=!0),this.setPointerCapture(o.pointerId)}handlePointerup(o){this.open=!1,this.releasePointerCapture(o.pointerId)}render(){return c.html`
|
|
19
|
+
<div class="inner" style="background-color: ${this.color}"></div>
|
|
20
|
+
<luzmo-color-loupe
|
|
21
|
+
color=${this.color}
|
|
22
|
+
?open=${this.open&&!this.disabled}
|
|
23
|
+
></luzmo-color-loupe>
|
|
24
|
+
`}firstUpdated(o){super.firstUpdated(o),this.addEventListener("pointerdown",this.handlePointerdown),this.addEventListener("pointerup",this.handlePointerup),this.addEventListener("pointercancel",this.handlePointerup)}};i.styles=c.unsafeCSS(u);let e=i;a([l.n({type:Boolean,reflect:!0})],e.prototype,"disabled");a([l.n({type:Boolean,reflect:!0})],e.prototype,"focused");a([l.n({type:Boolean,reflect:!0})],e.prototype,"open");a([l.n({type:String})],e.prototype,"color");customElements.get("luzmo-color-handle")||customElements.define("luzmo-color-handle",e);exports.LuzmoColorHandle=e;
|