@luzmo/lucero 0.0.39 → 1.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion/index.cjs +4 -4
- package/components/accordion/index.js +5 -5
- package/components/action-bar/index.cjs +1 -1
- package/components/action-bar/index.js +1 -1
- package/components/action-button/index.cjs +2 -2
- package/components/action-button/index.js +1 -1
- package/components/action-menu/index.cjs +1 -1
- package/components/action-menu/index.js +2 -2
- package/components/button/index.cjs +1 -1
- package/components/button/index.js +2 -2
- package/components/calendar/index.cjs +1 -1
- package/components/calendar/index.js +1 -1
- package/components/checkbox/index.cjs +1 -1
- package/components/checkbox/index.js +1 -1
- package/components/{clear-button-DoeRUWQ3.js → clear-button-BbVqNU-g.js} +1 -1
- package/components/{clear-button-Qi1pMA5S.cjs → clear-button-DYdeFsS8.cjs} +1 -1
- package/components/{close-button-BFMBEw3q.cjs → close-button-CpfKibqg.cjs} +1 -1
- package/components/{close-button-BWXdHSx3.js → close-button-DzOZZmkY.js} +1 -1
- package/components/color-area/color-area.d.ts +44 -6
- package/components/color-area/index.cjs +5 -5
- package/components/color-area/index.js +70 -62
- package/components/color-controller-DTp1juRz.js +3198 -0
- package/components/color-controller-_ZwyhvaU.cjs +18 -0
- package/components/color-field/color-field.d.ts +3 -3
- package/components/color-field/index.cjs +5 -5
- package/components/color-field/index.js +25 -28
- package/components/color-menu/index.cjs +3 -3
- package/components/color-menu/index.js +2 -3
- package/components/color-slider/index.cjs +1 -40
- package/components/color-slider/index.js +6 -296
- package/components/date-time-picker/index.cjs +3 -3
- package/components/date-time-picker/index.js +2 -2
- package/components/icon/index.cjs +1 -1
- package/components/icon/index.js +1 -1
- package/components/{index-BLWuwZXx.cjs → index-BQoI8AD3.cjs} +3 -3
- package/components/index-BwxgAdzi.cjs +57 -0
- package/components/{index-A-yOTB_d.js → index-Cb9zsiz6.js} +1 -1
- package/components/index-HjQa8tew.js +1174 -0
- package/components/index.cjs +1 -1
- package/components/index.js +7 -7
- package/components/{luzmo-icons-DletXGWU.cjs → luzmo-icons-D47EGj-3.cjs} +2 -2
- package/components/{luzmo-icons-DbwDQtuO.js → luzmo-icons-NEyaMpEM.js} +24 -24
- package/components/menu/index.cjs +5 -5
- package/components/menu/index.js +2 -2
- package/components/number-field/index.cjs +3 -3
- package/components/number-field/index.js +5 -5
- package/components/options/index.cjs +4 -4
- package/components/options/index.js +15 -15
- package/components/overlay/index.cjs +1 -1
- package/components/overlay/index.js +2 -2
- package/components/{overlay-DaOKAKMl.js → overlay-BtZCJ2M0.js} +1 -2
- package/components/{overlay-lzq2PziH.cjs → overlay-DTCm3y_-.cjs} +1 -1
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +2 -2
- package/components/{picker-BmoXv1jt.js → picker-CAYj4hBD.js} +1 -1
- package/components/{picker-DWsBWdPN.cjs → picker-apS0Zrly.cjs} +5 -5
- package/components/picker-button/index.cjs +1 -1
- package/components/picker-button/index.js +1 -1
- package/components/search/index.cjs +4 -4
- package/components/search/index.js +2 -2
- package/components/select/index.cjs +9 -9
- package/components/select/index.js +1 -1
- package/components/swatch/index.cjs +2 -2
- package/components/swatch/index.js +3 -3
- package/components/tabs/index.cjs +3 -3
- package/components/tabs/index.js +1 -1
- package/components/tags/index.cjs +1 -1
- package/components/tags/index.js +1 -1
- package/components/text-field/index.cjs +2 -2
- package/components/text-field/index.js +5 -5
- package/components/{text-field-BIADXoLC.js → text-field-B9IkRRxO.js} +1 -1
- package/components/{text-field-D5d_Gt0t.cjs → text-field-BSIXGkFs.cjs} +3 -3
- package/components/toast/index.cjs +3 -3
- package/components/toast/index.js +2 -2
- package/components/unit-input/index.cjs +3 -3
- package/components/unit-input/index.js +1 -1
- package/custom-elements.json +1 -1
- package/package.json +1 -1
- package/utils/reactive-controllers/color-controller.d.ts +224 -0
- package/components/color-Bg3tYsAQ.js +0 -178
- package/components/color-DphK4hwx.cjs +0 -18
- package/components/index-C1chwzNp.js +0 -727
- package/components/index-DCKCHDTt.cjs +0 -18
|
@@ -20,7 +20,7 @@ import { e as b } from "../query-D_KR_GUc.js";
|
|
|
20
20
|
import { o as m } from "../if-defined-DOaE2coe.js";
|
|
21
21
|
import "../color-handle/index.js";
|
|
22
22
|
import { j as x, c as w } from "../platform-BM-uMWpX.js";
|
|
23
|
-
import { C } from "../color-
|
|
23
|
+
import { C } from "../color-controller-DTp1juRz.js";
|
|
24
24
|
import { L as $ } from "../language-resolution-8yZa5r_P.js";
|
|
25
25
|
import { s as k } from "../streaming-listener-CP-JE6Fa.js";
|
|
26
26
|
const g = () => {
|
|
@@ -31,23 +31,14 @@ const g = () => {
|
|
|
31
31
|
};
|
|
32
32
|
g();
|
|
33
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
|
|
35
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
34
|
+
var A = Object.defineProperty, P = Object.getOwnPropertyDescriptor, i = (u, e, o, t) => {
|
|
35
|
+
for (var r = t > 1 ? void 0 : t ? P(e, o) : e, a = u.length - 1, n; a >= 0; a--)
|
|
36
36
|
(n = u[a]) && (r = (t ? n(e, o, r) : n(r)) || r);
|
|
37
|
-
return t && r &&
|
|
37
|
+
return t && r && A(e, o, r), r;
|
|
38
38
|
};
|
|
39
|
-
class
|
|
39
|
+
class l extends z {
|
|
40
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;
|
|
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, { manageAs: "hsv" }), this.activeAxis = "x", this.step = 0.01, this.altered = 0, this.activeKeys = /* @__PURE__ */ new Set(), this._valueChanged = !1, this._pointerDown = !1;
|
|
51
42
|
}
|
|
52
43
|
static get styles() {
|
|
53
44
|
return [v(R)];
|
|
@@ -59,31 +50,31 @@ class i extends z {
|
|
|
59
50
|
this.colorController.hue = e;
|
|
60
51
|
}
|
|
61
52
|
get value() {
|
|
62
|
-
return this.colorController.
|
|
53
|
+
return this.colorController.colorValue;
|
|
63
54
|
}
|
|
64
55
|
get color() {
|
|
65
|
-
return this.colorController.
|
|
56
|
+
return this.colorController.colorValue;
|
|
66
57
|
}
|
|
67
58
|
set color(e) {
|
|
68
59
|
this.colorController.color = e;
|
|
69
60
|
}
|
|
70
61
|
get x() {
|
|
71
|
-
return this.
|
|
62
|
+
return this.colorController.color.hsv.s / 100;
|
|
72
63
|
}
|
|
73
64
|
set x(e) {
|
|
74
65
|
if (e === this.x)
|
|
75
66
|
return;
|
|
76
67
|
const o = this.x;
|
|
77
|
-
this.
|
|
68
|
+
this.inputX ? (this.inputX.value = e.toString(), this.colorController.color.set("s", this.inputX.valueAsNumber * 100)) : this.colorController.color.set("s", e * 100), this.requestUpdate("x", o);
|
|
78
69
|
}
|
|
79
70
|
get y() {
|
|
80
|
-
return this.
|
|
71
|
+
return this.colorController.color.hsv.v / 100;
|
|
81
72
|
}
|
|
82
73
|
set y(e) {
|
|
83
74
|
if (e === this.y)
|
|
84
75
|
return;
|
|
85
76
|
const o = this.y;
|
|
86
|
-
this.
|
|
77
|
+
this.inputY && (this.inputY.value = e.toString(), this.colorController.color.set("v", this.inputY.valueAsNumber * 100)), this.requestUpdate("y", o);
|
|
87
78
|
}
|
|
88
79
|
focus(e = {}) {
|
|
89
80
|
super.focus(e), this.forwardFocus();
|
|
@@ -141,7 +132,7 @@ class i extends z {
|
|
|
141
132
|
break;
|
|
142
133
|
}
|
|
143
134
|
}
|
|
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(),
|
|
135
|
+
}), 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(), (e !== 0 || o !== 0) && (this._valueChanged = !0, this.dispatchEvent(
|
|
145
136
|
new Event("input", {
|
|
146
137
|
bubbles: !0,
|
|
147
138
|
composed: !0
|
|
@@ -161,7 +152,7 @@ class i extends z {
|
|
|
161
152
|
}
|
|
162
153
|
handleInput(e) {
|
|
163
154
|
const { valueAsNumber: o, name: t } = e.target;
|
|
164
|
-
this[t] = o
|
|
155
|
+
this[t] = o;
|
|
165
156
|
}
|
|
166
157
|
handleChange(e) {
|
|
167
158
|
this.handleInput(e), this.dispatchEvent(
|
|
@@ -181,7 +172,7 @@ class i extends z {
|
|
|
181
172
|
}
|
|
182
173
|
handlePointermove(e) {
|
|
183
174
|
const [o, t] = this.calculateHandlePosition(e);
|
|
184
|
-
this._valueChanged = !1, this.x = o, this.y =
|
|
175
|
+
this._valueChanged = !1, this.x = o, this.y = t, this.dispatchEvent(
|
|
185
176
|
new Event("input", {
|
|
186
177
|
bubbles: !0,
|
|
187
178
|
composed: !0,
|
|
@@ -209,7 +200,7 @@ class i extends z {
|
|
|
209
200
|
if (!this.boundingClientRect)
|
|
210
201
|
return [this.x, this.y];
|
|
211
202
|
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];
|
|
203
|
+
return [this.isLTR ? h : 1 - h, 1 - p];
|
|
213
204
|
}
|
|
214
205
|
handleAreaPointerdown(e) {
|
|
215
206
|
e.button === 0 && (e.stopPropagation(), e.preventDefault(), this.handle.dispatchEvent(new PointerEvent("pointerdown", e)), this.handlePointermove(e));
|
|
@@ -221,12 +212,14 @@ class i extends z {
|
|
|
221
212
|
}).format(this.x), p = new Intl.NumberFormat(this.languageResolver.language, {
|
|
222
213
|
style: "percent",
|
|
223
214
|
unitDisplay: "narrow"
|
|
224
|
-
}).format(this.y), f =
|
|
215
|
+
}).format(this.y), f = {
|
|
216
|
+
background: `linear-gradient(to top, black 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%),linear-gradient(to right, white 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%), hsl(${this.hue}, 100%, 50%);`
|
|
217
|
+
};
|
|
225
218
|
return y`
|
|
226
219
|
<div
|
|
227
220
|
@pointerdown=${this.handleAreaPointerdown}
|
|
228
221
|
class="gradient"
|
|
229
|
-
style="background: ${f}"
|
|
222
|
+
style="background: ${f.background}"
|
|
230
223
|
>
|
|
231
224
|
<slot name="gradient"></slot>
|
|
232
225
|
</div>
|
|
@@ -296,8 +289,23 @@ class i extends z {
|
|
|
296
289
|
firstUpdated(e) {
|
|
297
290
|
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
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Overrides the `updated` method to handle changes in property values.
|
|
294
|
+
*
|
|
295
|
+
* @param changed - A map of changed properties with their previous values.
|
|
296
|
+
*
|
|
297
|
+
* This method performs the following actions:
|
|
298
|
+
* - Updates the saturation (`s`) of the color if `x` has changed.
|
|
299
|
+
* - Updates the value (`v`) of the color if `y` has changed.
|
|
300
|
+
* - If the `focused` property has changed and is now true, it lazily binds
|
|
301
|
+
* the `input[type="range"]` elements in shadow roots to prevent multiple
|
|
302
|
+
* tab stops within the Color Area for certain browser settings (e.g., Webkit).
|
|
303
|
+
*/
|
|
299
304
|
updated(e) {
|
|
300
|
-
if (super.updated(e), this.x !== this.inputX.valueAsNumber &&
|
|
305
|
+
if (super.updated(e), this.x !== this.inputX.valueAsNumber && this.colorController.color.set("s", this.inputX.valueAsNumber * 100), this.y !== this.inputY.valueAsNumber && this.colorController.color.set(
|
|
306
|
+
"v",
|
|
307
|
+
(1 - this.inputY.valueAsNumber) * 100
|
|
308
|
+
), e.has("focused") && this.focused) {
|
|
301
309
|
const o = this.inputX.parentElement, t = this.inputY.parentElement;
|
|
302
310
|
if (!o.shadowRoot && !t.shadowRoot) {
|
|
303
311
|
o.attachShadow({ mode: "open" }), t.attachShadow({ mode: "open" });
|
|
@@ -319,55 +327,55 @@ class i extends z {
|
|
|
319
327
|
(e = this.observer) == null || e.unobserve(this), super.disconnectedCallback();
|
|
320
328
|
}
|
|
321
329
|
}
|
|
322
|
-
|
|
330
|
+
i([
|
|
323
331
|
s({ type: String, reflect: !0 })
|
|
324
|
-
],
|
|
325
|
-
|
|
332
|
+
], l.prototype, "dir", 2);
|
|
333
|
+
i([
|
|
326
334
|
s({ type: Boolean, reflect: !0 })
|
|
327
|
-
],
|
|
328
|
-
|
|
335
|
+
], l.prototype, "disabled", 2);
|
|
336
|
+
i([
|
|
329
337
|
s({ type: Boolean, reflect: !0 })
|
|
330
|
-
],
|
|
331
|
-
|
|
338
|
+
], l.prototype, "focused", 2);
|
|
339
|
+
i([
|
|
332
340
|
s({ type: String, attribute: "label-x" })
|
|
333
|
-
],
|
|
334
|
-
|
|
341
|
+
], l.prototype, "labelX", 2);
|
|
342
|
+
i([
|
|
335
343
|
s({ type: String, attribute: "label-y" })
|
|
336
|
-
],
|
|
337
|
-
|
|
344
|
+
], l.prototype, "labelY", 2);
|
|
345
|
+
i([
|
|
338
346
|
s({ type: Boolean, attribute: "is-ltr" })
|
|
339
|
-
],
|
|
340
|
-
|
|
347
|
+
], l.prototype, "isLTR", 2);
|
|
348
|
+
i([
|
|
341
349
|
b(".handle")
|
|
342
|
-
],
|
|
343
|
-
|
|
350
|
+
], l.prototype, "handle", 2);
|
|
351
|
+
i([
|
|
344
352
|
s({ type: Number })
|
|
345
|
-
],
|
|
346
|
-
|
|
353
|
+
], l.prototype, "hue", 1);
|
|
354
|
+
i([
|
|
347
355
|
s({ type: String })
|
|
348
|
-
],
|
|
349
|
-
|
|
356
|
+
], l.prototype, "value", 1);
|
|
357
|
+
i([
|
|
350
358
|
s({ type: String })
|
|
351
|
-
],
|
|
352
|
-
|
|
359
|
+
], l.prototype, "color", 1);
|
|
360
|
+
i([
|
|
353
361
|
s({ attribute: !1 })
|
|
354
|
-
],
|
|
355
|
-
|
|
362
|
+
], l.prototype, "activeAxis", 2);
|
|
363
|
+
i([
|
|
356
364
|
s({ type: Number })
|
|
357
|
-
],
|
|
358
|
-
|
|
365
|
+
], l.prototype, "x", 1);
|
|
366
|
+
i([
|
|
359
367
|
s({ type: Number })
|
|
360
|
-
],
|
|
361
|
-
|
|
368
|
+
], l.prototype, "y", 1);
|
|
369
|
+
i([
|
|
362
370
|
s({ type: Number })
|
|
363
|
-
],
|
|
364
|
-
|
|
371
|
+
], l.prototype, "step", 2);
|
|
372
|
+
i([
|
|
365
373
|
b('[name="x"]')
|
|
366
|
-
],
|
|
367
|
-
|
|
374
|
+
], l.prototype, "inputX", 2);
|
|
375
|
+
i([
|
|
368
376
|
b('[name="y"]')
|
|
369
|
-
],
|
|
370
|
-
customElements.get("luzmo-color-area") || customElements.define("luzmo-color-area",
|
|
377
|
+
], l.prototype, "inputY", 2);
|
|
378
|
+
customElements.get("luzmo-color-area") || customElements.define("luzmo-color-area", l);
|
|
371
379
|
export {
|
|
372
|
-
|
|
380
|
+
l as LuzmoColorArea
|
|
373
381
|
};
|