@tempots/beatui 0.85.0 → 0.86.1

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.
@@ -1,8 +1,8 @@
1
- import { Value as p, prop as rt, computedOf as D, html as k, attr as u, svg as tt, svgAttr as Y, on as M, Empty as A, When as H, Fragment as E, aria as N, emitValue as Z, Use as lt, input as ot, emitValueAsNullableDate as et, emitValueAsNullableDateTime as nt, Repeat as ut, style as pt, emit as dt, emitValueAsNumber as V } from "@tempots/dom";
1
+ import { Value as p, prop as rt, computedOf as D, html as k, attr as u, svg as tt, svgAttr as Y, on as M, Empty as A, When as W, Fragment as j, aria as N, emitValue as Z, Use as lt, input as ot, emitValueAsNullableDate as et, emitValueAsNullableDateTime as nt, Repeat as ut, style as pt, emit as dt, emitValueAsNumber as V } from "@tempots/dom";
2
2
  import { F as ht, N as z, T as gt, U as ft, a as mt } from "./deep-merge-CmQoIYPC.js";
3
3
  import { $ as bt } from "./string-DYyMxBl-.js";
4
- import { I as U } from "./input-container-Nx0gMAzS.js";
5
- import { C as L, T as wt } from "./text-input-CPJzUC2r.js";
4
+ import { I as E } from "./input-container-Nx0gMAzS.js";
5
+ import { C as U, T as wt } from "./text-input-CPJzUC2r.js";
6
6
  import { B as yt, I as q, b as st, a as It } from "./translations-BGblCUBj.js";
7
7
  import { AutoSelect as Mt } from "@tempots/ui";
8
8
  import { E as $t, P as xt } from "./notice-Dz4nX57_.js";
@@ -49,7 +49,7 @@ function Q(t, e, s) {
49
49
  };
50
50
  return `#${n(t)}${n(e)}${n(s)}`;
51
51
  }
52
- function j(t) {
52
+ function H(t) {
53
53
  const e = At(t);
54
54
  if (!e) return null;
55
55
  const s = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
@@ -60,7 +60,7 @@ function j(t) {
60
60
  } : null;
61
61
  }
62
62
  function oe(t, e) {
63
- const s = j(t), n = j(e);
63
+ const s = H(t), n = H(e);
64
64
  if (!s || !n) return null;
65
65
  const r = (l, d, f) => {
66
66
  const [m, h, w] = [l, d, f].map((I) => (I = I / 255, I <= 0.03928 ? I / 12.92 : Math.pow((I + 0.055) / 1.055, 2.4)));
@@ -131,7 +131,7 @@ function St(t) {
131
131
  const l = i[1], d = parseFloat(i[2]), f = parseFloat(i[3]), m = i[4] != null ? parseFloat(i[4]) : 1, h = l.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(l) / 100)) : Math.max(0, Math.min(1, parseFloat(l))), [w, I, x] = Bt(h, d, f);
132
132
  return [w, I, x, m];
133
133
  }
134
- const c = j(t);
134
+ const c = H(t);
135
135
  return c ? [c.r, c.g, c.b, 1] : [0, 0, 0, 1];
136
136
  }
137
137
  function vt(t, e, s, n) {
@@ -204,7 +204,7 @@ function Vt(t, e, s) {
204
204
  let x = Math.atan2(w, h) * 180 / Math.PI;
205
205
  return x < 0 && (x += 360), [m, I, x];
206
206
  }
207
- function O(t, e, s, n, r, a) {
207
+ function P(t, e, s, n, r, a) {
208
208
  switch (r) {
209
209
  case "hex":
210
210
  if (a) {
@@ -234,7 +234,7 @@ function O(t, e, s, n, r, a) {
234
234
  }
235
235
  }
236
236
  }
237
- function W(t, e) {
237
+ function O(t, e) {
238
238
  return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
239
239
  }
240
240
  async function Et(t) {
@@ -342,7 +342,7 @@ const ce = (t) => {
342
342
  w,
343
343
  h
344
344
  )(
345
- ([g, $, F], S, v, R) => O(g, $, F, S ?? 1, W(v, R), R)
345
+ ([g, $, F], S, v, R) => P(g, $, F, S ?? 1, O(v, R), R)
346
346
  ), x = p.map(
347
347
  t.colorTextFormat ?? "hex",
348
348
  (g) => g
@@ -375,7 +375,7 @@ const ce = (t) => {
375
375
  // Invisible native input overlays the blob for picker and accessibility
376
376
  k.input(
377
377
  u.type("color"),
378
- L(t),
378
+ U(t),
379
379
  // Native color input needs hex without alpha
380
380
  u.value(p.map(d, ([g, $, F]) => Q(g, $, F))),
381
381
  u.class(
@@ -385,23 +385,23 @@ const ce = (t) => {
385
385
  n != null ? M.change((g) => {
386
386
  const $ = g.target.value;
387
387
  if (!n) return;
388
- const { r: F, g: S, b: v } = j($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = W(
388
+ const { r: F, g: S, b: v } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = O(
389
389
  p.get(x),
390
390
  p.get(h)
391
- ), X = O(F, S, v, R, B, p.get(h));
391
+ ), X = P(F, S, v, R, B, p.get(h));
392
392
  n(X);
393
393
  }) : A,
394
394
  r != null ? M.input((g) => {
395
395
  const $ = g.target.value;
396
396
  if (!r) return;
397
- const { r: F, g: S, b: v } = j($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = W(
397
+ const { r: F, g: S, b: v } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = O(
398
398
  p.get(x),
399
399
  p.get(h)
400
- ), X = O(F, S, v, R, B, p.get(h));
400
+ ), X = P(F, S, v, R, B, p.get(h));
401
401
  r(X);
402
402
  }) : A
403
403
  )
404
- ), C = H(
404
+ ), C = W(
405
405
  h,
406
406
  () => k.input(
407
407
  u.type("range"),
@@ -414,32 +414,32 @@ const ce = (t) => {
414
414
  M.input((g) => {
415
415
  const $ = parseFloat(g.target.value);
416
416
  m.set($);
417
- const [F, S, v] = p.get(d), R = W(
417
+ const [F, S, v] = p.get(d), R = O(
418
418
  p.get(x),
419
419
  p.get(h)
420
- ), B = O(F, S, v, $, R, p.get(h));
420
+ ), B = P(F, S, v, $, R, p.get(h));
421
421
  r?.(B);
422
422
  }),
423
423
  M.change((g) => {
424
424
  const $ = parseFloat(g.target.value);
425
425
  m.set($);
426
- const [F, S, v] = p.get(d), R = W(
426
+ const [F, S, v] = p.get(d), R = O(
427
427
  p.get(x),
428
428
  p.get(h)
429
- ), B = O(F, S, v, $, R, p.get(h));
429
+ ), B = P(F, S, v, $, R, p.get(h));
430
430
  n?.(B);
431
431
  })
432
432
  )
433
433
  );
434
- return U({
434
+ return E({
435
435
  baseContainer: !0,
436
436
  ...t,
437
437
  // ensure our control does not try to grow
438
438
  growInput: !1,
439
439
  input: T,
440
440
  // If caller provided an `after`, append RGB before it
441
- after: E(
442
- H(
441
+ after: j(
442
+ W(
443
443
  a ?? !1,
444
444
  () => k.span(u.class("bc-color-swatch-input__rgb"), I)
445
445
  ),
@@ -464,7 +464,7 @@ const ce = (t) => {
464
464
  )
465
465
  ),
466
466
  N.disabled(i),
467
- H(
467
+ W(
468
468
  a,
469
469
  () => k.input(
470
470
  u.placeholder(n),
@@ -489,7 +489,7 @@ const ce = (t) => {
489
489
  p.get(i) || a.set(!0);
490
490
  }),
491
491
  u.class("bc-editable-text__display"),
492
- H(
492
+ W(
493
493
  p.map(e, (c) => c != null && c.trim() !== ""),
494
494
  () => k.span(u.class("bc-editable-text__text"), e),
495
495
  () => k.span(
@@ -497,7 +497,7 @@ const ce = (t) => {
497
497
  n
498
498
  )
499
499
  ),
500
- H(
500
+ W(
501
501
  p.map(i, (c) => !c),
502
502
  () => k.button(
503
503
  u.type("button"),
@@ -512,37 +512,37 @@ const ce = (t) => {
512
512
  );
513
513
  }, ue = (t) => {
514
514
  const { value: e, onBlur: s, onChange: n, onInput: r, after: a, disabled: o } = t, i = z(e, o, n ?? r);
515
- return U({
515
+ return E({
516
516
  ...t,
517
517
  input: ot.date(
518
- L(t),
518
+ U(t),
519
519
  u.valueAsDate(e),
520
520
  u.class("bc-input"),
521
521
  s != null ? M.blur(Z(s)) : A,
522
522
  n != null ? M.change(et(n)) : A,
523
523
  r != null ? M.input(et(r)) : A
524
524
  ),
525
- after: a != null ? E(i, a) : i
525
+ after: a != null ? j(i, a) : i
526
526
  });
527
527
  }, Ht = (t) => {
528
528
  const e = t.getFullYear(), s = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), a = t.getMinutes(), o = t.getSeconds();
529
529
  return `${e}-${s.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}T${r.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
530
530
  }, pe = (t) => {
531
531
  const { value: e, onBlur: s, onChange: n, onInput: r, after: a, disabled: o } = t, i = p.map(e, (l) => l != null ? Ht(l) : null), c = z(e, o, n ?? r);
532
- return U({
532
+ return E({
533
533
  ...t,
534
534
  input: ot["datetime-local"](
535
- L(t),
535
+ U(t),
536
536
  u.value(p.map(i, (l) => l ?? null)),
537
537
  u.class("bc-input"),
538
538
  s != null ? M.blur(Z(s)) : A,
539
539
  n != null ? M.change(nt(n)) : A,
540
540
  r != null ? M.input(nt(r)) : A
541
541
  ),
542
- after: a != null ? E(c, a) : c
542
+ after: a != null ? j(c, a) : c
543
543
  });
544
544
  }, at = (t) => typeof t == "string" && t.trim() === "" ? null : t, jt = (t) => t ?? "";
545
- function P(t) {
545
+ function L(t) {
546
546
  return (e) => {
547
547
  const { value: s, onBlur: n, onChange: r, onInput: a, after: o, disabled: i, ...c } = e, l = z(s, i, r ?? a);
548
548
  return t({
@@ -552,11 +552,11 @@ function P(t) {
552
552
  onChange: r != null ? (d) => r(at(d)) : void 0,
553
553
  onInput: a != null ? (d) => a(at(d)) : void 0,
554
554
  onBlur: n,
555
- after: o != null ? E(l, o) : l
555
+ after: o != null ? j(l, o) : l
556
556
  });
557
557
  };
558
558
  }
559
- const de = P($t), he = P(wt), ge = P(xt), fe = P(
559
+ const de = L($t), he = L(wt), ge = L(xt), fe = L(
560
560
  gt
561
561
  ), me = ({
562
562
  value: t,
@@ -660,7 +660,7 @@ const de = P($t), he = P(wt), ge = P(xt), fe = P(
660
660
  )
661
661
  )
662
662
  );
663
- }, be = P(ft), zt = "line-md:star-alt-filled", Xt = "line-md:star-alt", Yt = (t) => {
663
+ }, be = L(ft), zt = "line-md:star-alt-filled", Xt = "line-md:star-alt", Yt = (t) => {
664
664
  const {
665
665
  value: e,
666
666
  onChange: s,
@@ -741,14 +741,14 @@ const de = P($t), he = P(wt), ge = P(xt), fe = P(
741
741
  })
742
742
  )
743
743
  );
744
- return U({
744
+ return E({
745
745
  baseContainer: !0,
746
746
  growInput: !1,
747
747
  focusableSelector: '[role="slider"]',
748
748
  ...t,
749
749
  input: k.div(
750
750
  // Common input attributes (id, required, invalid, custom classes, etc.)
751
- L(t),
751
+ U(t),
752
752
  u.class("bc-rating-input"),
753
753
  // ARIA slider semantics
754
754
  u.role("slider"),
@@ -782,17 +782,17 @@ const de = P($t), he = P(wt), ge = P(xt), fe = P(
782
782
  onChange: s,
783
783
  onInput: n,
784
784
  onBlur: r,
785
- after: a != null ? E(c, a) : c
785
+ after: a != null ? j(c, a) : c
786
786
  });
787
787
  }, ye = (t) => {
788
788
  const { value: e, step: s, min: n, max: r, onBlur: a, onChange: o, onInput: i } = t;
789
- return U({
789
+ return E({
790
790
  ...t,
791
791
  // Make sure clicks anywhere focus the range input
792
792
  focusableSelector: 'input[type="range"]',
793
793
  input: k.input(
794
794
  u.type("range"),
795
- L(t),
795
+ U(t),
796
796
  u.min(n),
797
797
  u.max(r),
798
798
  u.step(s),
@@ -814,36 +814,32 @@ const de = P($t), he = P(wt), ge = P(xt), fe = P(
814
814
  t.disabled,
815
815
  o ?? i
816
816
  );
817
- return U(
818
- {
819
- ...t,
820
- focusableSelector: 'input[type="range"]',
821
- after: l,
822
- input: k.input(
823
- u.type("range"),
824
- L(t),
825
- u.min(n),
826
- u.max(r),
827
- u.step(s),
828
- u.valueAsNumber(c),
829
- u.class("bc-input bc-slider-input"),
830
- a != null ? M.blur(V(a)) : A,
831
- o != null ? M.change(
832
- V((d) => {
833
- o(d);
834
- })
835
- ) : A,
836
- i != null ? M.input(
837
- V((d) => {
838
- i(d);
839
- })
840
- ) : A
841
- )
842
- },
843
- // Ensure container grows input naturally
844
- E()
845
- );
846
- }, Me = P(mt);
817
+ return E({
818
+ ...t,
819
+ focusableSelector: 'input[type="range"]',
820
+ after: l,
821
+ input: k.input(
822
+ u.type("range"),
823
+ U(t),
824
+ u.min(n),
825
+ u.max(r),
826
+ u.step(s),
827
+ u.valueAsNumber(c),
828
+ u.class("bc-input bc-slider-input"),
829
+ a != null ? M.blur(V(a)) : A,
830
+ o != null ? M.change(
831
+ V((d) => {
832
+ o(d);
833
+ })
834
+ ) : A,
835
+ i != null ? M.input(
836
+ V((d) => {
837
+ i(d);
838
+ })
839
+ ) : A
840
+ )
841
+ });
842
+ }, Me = L(mt);
847
843
  class Gt {
848
844
  widgets = /* @__PURE__ */ new Map();
849
845
  typeMapping = /* @__PURE__ */ new Map();
@@ -994,7 +990,7 @@ function Fe(t) {
994
990
  };
995
991
  }
996
992
  export {
997
- j as A,
993
+ H as A,
998
994
  ie as B,
999
995
  ce as C,
1000
996
  oe as D,
@@ -1013,8 +1009,8 @@ export {
1013
1009
  Vt as Q,
1014
1010
  Yt as R,
1015
1011
  ye as S,
1016
- O as T,
1017
- W as U,
1012
+ P as T,
1013
+ O as U,
1018
1014
  Gt as W,
1019
1015
  fe as a,
1020
1016
  be as b,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/beatui",
3
- "version": "0.85.0",
3
+ "version": "0.86.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -218,7 +218,7 @@
218
218
  "prosemirror-view": "^1.41.3"
219
219
  },
220
220
  "scripts": {
221
- "build": "vite build && tsc -p tsconfig.build.json && node scripts/build-css-entries.mjs",
221
+ "build": "vite build && (tsc -p tsconfig.build.json & node scripts/build-css-entries.mjs & wait)",
222
222
  "build:watch": "node scripts/build-css-entries.mjs && vite build --watch",
223
223
  "test": "vitest run",
224
224
  "test:watch": "vitest",