@luzmo/lucero 0.0.38 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/components/action-menu/index.cjs +1 -1
  2. package/components/action-menu/index.js +1 -1
  3. package/components/button/index.cjs +1 -1
  4. package/components/button/index.js +17 -17
  5. package/components/color-area/color-area.d.ts +44 -6
  6. package/components/color-area/index.cjs +5 -5
  7. package/components/color-area/index.js +70 -62
  8. package/components/color-controller-DTp1juRz.js +3198 -0
  9. package/components/color-controller-_ZwyhvaU.cjs +18 -0
  10. package/components/color-field/color-field.d.ts +3 -3
  11. package/components/color-field/index.cjs +5 -5
  12. package/components/color-field/index.js +25 -28
  13. package/components/color-menu/color-menu.d.ts +5 -3
  14. package/components/color-menu/index.cjs +6 -6
  15. package/components/color-menu/index.js +11 -8
  16. package/components/color-picker/index.cjs +2 -3
  17. package/components/color-picker/index.js +22 -22
  18. package/components/color-slider/index.cjs +1 -40
  19. package/components/color-slider/index.js +6 -296
  20. package/components/index-BwxgAdzi.cjs +57 -0
  21. package/components/index-HjQa8tew.js +1174 -0
  22. package/components/index.cjs +1 -1
  23. package/components/index.js +58 -56
  24. package/components/menu/index.cjs +1 -1
  25. package/components/menu/index.js +1 -1
  26. package/components/overlay/hover-controller.d.ts +2 -0
  27. package/components/overlay/index.cjs +7 -7
  28. package/components/overlay/index.js +114 -110
  29. package/components/overlay/interaction-controller.d.ts +11 -5
  30. package/components/overlay/overlay-stack.d.ts +1 -0
  31. package/components/overlay/overlay-trigger.d.ts +25 -2
  32. package/components/{overlay-BBNyvs8F.js → overlay-BtZCJ2M0.js} +421 -386
  33. package/components/overlay-DTCm3y_-.cjs +47 -0
  34. package/components/picker/index.cjs +1 -1
  35. package/components/picker/index.js +2 -2
  36. package/components/{picker-daUT4cUN.js → picker-BmoXv1jt.js} +1 -1
  37. package/components/{picker-0tQg3Aob.cjs → picker-DWsBWdPN.cjs} +1 -1
  38. package/components/select/index.cjs +1 -1
  39. package/components/select/index.js +1 -1
  40. package/components/strategies-BACP6MhR.cjs +18 -0
  41. package/custom-elements.json +1 -1
  42. package/package.json +1 -1
  43. package/utils/button-interaction-controllers/interaction-controller.d.ts +1 -0
  44. package/utils/button-interaction-controllers/mobile-controller.d.ts +0 -1
  45. package/utils/reactive-controllers/color-controller.d.ts +224 -0
  46. package/components/color-Bg3tYsAQ.js +0 -178
  47. package/components/color-DphK4hwx.cjs +0 -18
  48. package/components/index-C1chwzNp.js +0 -727
  49. package/components/index-DCKCHDTt.cjs +0 -18
  50. package/components/overlay-o0tLxsk-.cjs +0 -47
  51. package/components/strategies-DGwsR7Xf.cjs +0 -18
  52. package/components/{strategies-Bc3hG-HA.js → strategies-9indNIEb.js} +1 -1
@@ -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-Bg3tYsAQ.js";
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 _ = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (u, e, o, t) => {
35
- for (var r = t > 1 ? void 0 : t ? A(e, o) : e, a = u.length - 1, n; a >= 0; a--)
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 && _(e, o, r), r;
37
+ return t && r && A(e, o, r), r;
38
38
  };
39
- class i extends z {
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.color;
53
+ return this.colorController.colorValue;
63
54
  }
64
55
  get color() {
65
- return this.colorController.color;
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._x;
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._x = e, this.inputX && (this.inputX.value = e.toString(), this._x = this.inputX.valueAsNumber), this.requestUpdate("x", o), this.colorController.applyColorFromState();
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._y;
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._y = e, this.inputY && (this.inputY.value = e.toString(), this._y = this.inputY.valueAsNumber), this.requestUpdate("y", o), this.colorController.applyColorFromState();
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(), this.colorController.applyColorFromState(), (e !== 0 || o !== 0) && (this._valueChanged = !0, this.dispatchEvent(
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, this.colorController.applyColorFromState();
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 = 1 - t, this.colorController.applyColorFromState(), this.dispatchEvent(
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 = `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%);`;
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 && (this._x = this.inputX.valueAsNumber), this.y !== this.inputY.valueAsNumber && (this._y = this.inputY.valueAsNumber), e.has("focused") && this.focused) {
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
- l([
330
+ i([
323
331
  s({ type: String, reflect: !0 })
324
- ], i.prototype, "dir", 2);
325
- l([
332
+ ], l.prototype, "dir", 2);
333
+ i([
326
334
  s({ type: Boolean, reflect: !0 })
327
- ], i.prototype, "disabled", 2);
328
- l([
335
+ ], l.prototype, "disabled", 2);
336
+ i([
329
337
  s({ type: Boolean, reflect: !0 })
330
- ], i.prototype, "focused", 2);
331
- l([
338
+ ], l.prototype, "focused", 2);
339
+ i([
332
340
  s({ type: String, attribute: "label-x" })
333
- ], i.prototype, "labelX", 2);
334
- l([
341
+ ], l.prototype, "labelX", 2);
342
+ i([
335
343
  s({ type: String, attribute: "label-y" })
336
- ], i.prototype, "labelY", 2);
337
- l([
344
+ ], l.prototype, "labelY", 2);
345
+ i([
338
346
  s({ type: Boolean, attribute: "is-ltr" })
339
- ], i.prototype, "isLTR", 2);
340
- l([
347
+ ], l.prototype, "isLTR", 2);
348
+ i([
341
349
  b(".handle")
342
- ], i.prototype, "handle", 2);
343
- l([
350
+ ], l.prototype, "handle", 2);
351
+ i([
344
352
  s({ type: Number })
345
- ], i.prototype, "hue", 1);
346
- l([
353
+ ], l.prototype, "hue", 1);
354
+ i([
347
355
  s({ type: String })
348
- ], i.prototype, "value", 1);
349
- l([
356
+ ], l.prototype, "value", 1);
357
+ i([
350
358
  s({ type: String })
351
- ], i.prototype, "color", 1);
352
- l([
359
+ ], l.prototype, "color", 1);
360
+ i([
353
361
  s({ attribute: !1 })
354
- ], i.prototype, "activeAxis", 2);
355
- l([
362
+ ], l.prototype, "activeAxis", 2);
363
+ i([
356
364
  s({ type: Number })
357
- ], i.prototype, "x", 1);
358
- l([
365
+ ], l.prototype, "x", 1);
366
+ i([
359
367
  s({ type: Number })
360
- ], i.prototype, "y", 1);
361
- l([
368
+ ], l.prototype, "y", 1);
369
+ i([
362
370
  s({ type: Number })
363
- ], i.prototype, "step", 2);
364
- l([
371
+ ], l.prototype, "step", 2);
372
+ i([
365
373
  b('[name="x"]')
366
- ], i.prototype, "inputX", 2);
367
- l([
374
+ ], l.prototype, "inputX", 2);
375
+ i([
368
376
  b('[name="y"]')
369
- ], i.prototype, "inputY", 2);
370
- customElements.get("luzmo-color-area") || customElements.define("luzmo-color-area", i);
377
+ ], l.prototype, "inputY", 2);
378
+ customElements.get("luzmo-color-area") || customElements.define("luzmo-color-area", l);
371
379
  export {
372
- i as LuzmoColorArea
380
+ l as LuzmoColorArea
373
381
  };