@llmnative/react 1.14.0 → 1.15.2

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/dist/index.mjs CHANGED
@@ -2537,7 +2537,9 @@ var bn = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10
2537
2537
  outputFile: "Output file",
2538
2538
  active: "active",
2539
2539
  removeVariant: "Remove {scale} variant",
2540
- fileName: "File name"
2540
+ fileName: "File name",
2541
+ altText: "Alt text",
2542
+ altTextPlaceholder: "Describe this image…"
2541
2543
  },
2542
2544
  imageEditor: {
2543
2545
  title: "Image Editor",
@@ -7371,19 +7373,19 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7371
7373
  let a = r ?? mc, o = Fn("crop"), s = m(null), c = m(null), u = () => {
7372
7374
  let t = Object.keys(e.variants ?? {}).filter((e) => e in a);
7373
7375
  return t.length ? t : Object.keys(a);
7374
- }, p = vc(), [g, _] = h(u), [v, y] = h(() => u()[0] ?? Object.keys(a)[0]), [b, x] = h(e.fileName), [S, C] = h(e.variants ?? {}), [w, T] = h(null), [E, D] = h(!1), [O, k] = h(!1), A = m(S), j = m(w), M = m(v), N = m(g), P = m(b);
7376
+ }, p = vc(), [g, _] = h(u), [v, y] = h(() => u()[0] ?? Object.keys(a)[0]), [b, x] = h(e.fileName), [S, C] = h(e.alt ?? ""), [w, T] = h(e.variants ?? {}), [E, D] = h(null), [O, k] = h(!1), [A, j] = h(!1), M = m(w), N = m(E), P = m(v), F = m(g), I = m(b);
7375
7377
  l(() => {
7376
- A.current = S;
7377
- }, [S]), l(() => {
7378
- j.current = w;
7378
+ M.current = w;
7379
7379
  }, [w]), l(() => {
7380
- M.current = v;
7380
+ N.current = E;
7381
+ }, [E]), l(() => {
7382
+ P.current = v;
7381
7383
  }, [v]), l(() => {
7382
- N.current = g;
7384
+ F.current = g;
7383
7385
  }, [g]), l(() => {
7384
- P.current = b;
7386
+ I.current = b;
7385
7387
  }, [b]), l(() => {
7386
- C((e) => {
7388
+ T((e) => {
7387
7389
  let t = {};
7388
7390
  for (let [n, r] of Object.entries(e)) t[n] = {
7389
7391
  ...r,
@@ -7392,17 +7394,17 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7392
7394
  return t;
7393
7395
  });
7394
7396
  }, [b]);
7395
- let F = m(null), I = m(null);
7397
+ let L = m(null), R = m(null);
7396
7398
  l(() => {
7397
7399
  let e = (e) => {
7398
- let t = F.current, n = I.current;
7400
+ let t = L.current, n = R.current;
7399
7401
  if (!t && !n) return;
7400
- let r = M.current, i = j.current, o = A.current[r];
7402
+ let r = P.current, i = N.current, o = M.current[r];
7401
7403
  if (!i || !o) return;
7402
7404
  let s = a[r] ?? 1;
7403
7405
  if (t) {
7404
7406
  let n = Math.max(0, Math.min(e.clientX - t.offsetX, i.width - o.width)), a = Math.max(0, Math.min(e.clientY - t.offsetY, i.height - o.height));
7405
- C((e) => ({
7407
+ T((e) => ({
7406
7408
  ...e,
7407
7409
  [r]: {
7408
7410
  ...e[r],
@@ -7429,7 +7431,7 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7429
7431
  let e = Math.min(v / g, y / _);
7430
7432
  g *= e, _ *= e;
7431
7433
  }
7432
- g < hc && (g = hc, _ = g / s), _ < hc && (_ = hc, g = _ * s), C((e) => ({
7434
+ g < hc && (g = hc, _ = g / s), _ < hc && (_ = hc, g = _ * s), T((e) => ({
7433
7435
  ...e,
7434
7436
  [r]: {
7435
7437
  ...e[r],
@@ -7441,25 +7443,25 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7441
7443
  }));
7442
7444
  }
7443
7445
  }, t = () => {
7444
- F.current = null, I.current = null, k(!1);
7446
+ L.current = null, R.current = null, j(!1);
7445
7447
  };
7446
7448
  return window.addEventListener("mousemove", e), window.addEventListener("mouseup", t), () => {
7447
7449
  window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t);
7448
7450
  };
7449
7451
  }, []), f(() => {
7450
- if (!E) return;
7452
+ if (!O) return;
7451
7453
  let t = c.current;
7452
7454
  if (!t) return;
7453
7455
  let { width: n, height: r } = t.getBoundingClientRect();
7454
- if (!(!n || !r) && (T((e) => e && e.width === n && e.height === r ? e : {
7456
+ if (!(!n || !r) && (D((e) => e && e.width === n && e.height === r ? e : {
7455
7457
  width: n,
7456
7458
  height: r
7457
- }), !A.current[v])) {
7459
+ }), !M.current[v])) {
7458
7460
  let t = a[v] ?? 1, i = Math.min(n * .78, r * t * .78), o = i / t;
7459
- C((t) => ({
7461
+ T((t) => ({
7460
7462
  ...t,
7461
7463
  [v]: {
7462
- fileName: gc(P.current, v),
7464
+ fileName: gc(I.current, v),
7463
7465
  type: e.type,
7464
7466
  scale: v,
7465
7467
  left: (n - i) / 2,
@@ -7470,15 +7472,16 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7470
7472
  }
7471
7473
  }));
7472
7474
  }
7473
- }, [v, E]), d(i, () => ({ handleSave: () => {
7475
+ }, [v, O]), d(i, () => ({ handleSave: () => {
7474
7476
  let e = s.current, t = e?.getContext("2d"), n = c.current;
7475
7477
  if (!e || !t || !n) return {
7476
- fileName: P.current,
7478
+ fileName: I.current,
7479
+ alt: S,
7477
7480
  variants: {}
7478
7481
  };
7479
- let r = j.current, i = {};
7480
- for (let a of N.current) {
7481
- let o = A.current[a];
7482
+ let r = N.current, i = {};
7483
+ for (let a of F.current) {
7484
+ let o = M.current[a];
7482
7485
  if (!o || !r) continue;
7483
7486
  let s = n.naturalWidth / r.width, c = n.naturalHeight / r.height, { top: l, left: u, width: d, height: f } = o;
7484
7487
  e.width = Math.round(d * s), e.height = Math.round(f * c), t.clearRect(0, 0, e.width, e.height), t.drawImage(n, u * s, l * c, d * s, f * c, 0, 0, e.width, e.height), i[a] = {
@@ -7487,30 +7490,31 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7487
7490
  };
7488
7491
  }
7489
7492
  return {
7490
- fileName: P.current,
7493
+ fileName: I.current,
7494
+ alt: S,
7491
7495
  variants: i
7492
7496
  };
7493
7497
  } }));
7494
- let L = (e) => {
7498
+ let z = (e) => {
7495
7499
  g.includes(e) || _((t) => [...t, e]), y(e);
7496
- }, R = (e, t) => {
7500
+ }, B = (e, t) => {
7497
7501
  t.stopPropagation();
7498
7502
  let n = g.filter((t) => t !== e);
7499
7503
  if (_(n), e === v) {
7500
7504
  let t = n.filter((e) => e in a);
7501
7505
  y(t[0] ?? Object.keys(a).find((t) => t !== e) ?? Object.keys(a)[0]);
7502
7506
  }
7503
- }, z = (e) => {
7507
+ }, V = (e) => {
7504
7508
  e.preventDefault(), e.stopPropagation();
7505
- let t = A.current[v];
7506
- t && (F.current = {
7509
+ let t = M.current[v];
7510
+ t && (L.current = {
7507
7511
  offsetX: e.clientX - t.left,
7508
7512
  offsetY: e.clientY - t.top
7509
- }, k(!0));
7510
- }, B = (e, t) => {
7513
+ }, j(!0));
7514
+ }, H = (e, t) => {
7511
7515
  e.preventDefault(), e.stopPropagation();
7512
- let n = A.current[v];
7513
- n && (I.current = {
7516
+ let n = M.current[v];
7517
+ n && (R.current = {
7514
7518
  handle: t,
7515
7519
  sx: e.clientX,
7516
7520
  sy: e.clientY,
@@ -7518,12 +7522,12 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7518
7522
  st: n.top,
7519
7523
  sw: n.width,
7520
7524
  sh: n.height
7521
- }, k(!0));
7522
- }, V = g.includes(v), H = S[v];
7525
+ }, j(!0));
7526
+ }, U = g.includes(v), W = w[v];
7523
7527
  return /* @__PURE__ */ t.createElement("div", { className: ["flex gap-4 h-full min-h-0", n ? "flex-col" : ""].join(" ") }, n && /* @__PURE__ */ t.createElement("h3", { className: "text-base font-semibold shrink-0" }, n), /* @__PURE__ */ t.createElement("div", { className: "flex gap-4 flex-1 min-h-0" }, /* @__PURE__ */ t.createElement("div", {
7524
7528
  className: "flex-1 min-w-0 min-h-0 flex items-center justify-center rounded-xl overflow-hidden",
7525
7529
  style: {
7526
- cursor: O ? "grabbing" : void 0,
7530
+ cursor: A ? "grabbing" : void 0,
7527
7531
  ...p ? {
7528
7532
  backgroundColor: "#1a1a1a",
7529
7533
  backgroundImage: "linear-gradient(45deg,#272727 25%,transparent 25%),linear-gradient(-45deg,#272727 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#272727 75%),linear-gradient(-45deg,transparent 75%,#272727 75%)"
@@ -7534,7 +7538,7 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7534
7538
  backgroundSize: "20px 20px",
7535
7539
  backgroundPosition: "0 0,0 10px,10px -10px,-10px 0"
7536
7540
  }
7537
- }, V ? /* @__PURE__ */ t.createElement("div", {
7541
+ }, U ? /* @__PURE__ */ t.createElement("div", {
7538
7542
  className: "relative select-none",
7539
7543
  style: {
7540
7544
  display: "inline-block",
@@ -7550,11 +7554,11 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7550
7554
  display: "block"
7551
7555
  },
7552
7556
  draggable: !1,
7553
- onLoad: () => D(!0)
7554
- }), H && w && /* @__PURE__ */ t.createElement(wc, {
7555
- crop: H,
7556
- onMoveStart: z,
7557
- onResizeStart: B
7557
+ onLoad: () => k(!0)
7558
+ }), W && E && /* @__PURE__ */ t.createElement(wc, {
7559
+ crop: W,
7560
+ onMoveStart: V,
7561
+ onResizeStart: H
7558
7562
  })) : /* @__PURE__ */ t.createElement("div", { className: "flex flex-col items-center gap-3 text-zinc-500 select-none" }, /* @__PURE__ */ t.createElement("svg", {
7559
7563
  className: "w-10 h-10 opacity-30",
7560
7564
  fill: "none",
@@ -7569,21 +7573,27 @@ var sc = a(null), cc = ({ registry: e, defaultKey: n, children: r }) => {
7569
7573
  value: b,
7570
7574
  onChange: x,
7571
7575
  label: o.fileName
7576
+ })), /* @__PURE__ */ t.createElement("div", { className: "flex flex-col gap-1 shrink-0" }, /* @__PURE__ */ t.createElement("label", { className: "text-xs font-medium text-muted-foreground" }, o.altText), /* @__PURE__ */ t.createElement("textarea", {
7577
+ defaultValue: S,
7578
+ onBlur: (e) => C(e.target.value),
7579
+ placeholder: o.altTextPlaceholder,
7580
+ rows: 2,
7581
+ className: "w-full min-w-0 resize-none rounded-md border border-input bg-background px-2.5 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-ring"
7572
7582
  })), /* @__PURE__ */ t.createElement("div", { className: "flex-1 min-h-0 flex flex-col gap-2 overflow-y-auto" }, /* @__PURE__ */ t.createElement("p", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide shrink-0" }, o.variants), Object.keys(a).map((n) => /* @__PURE__ */ t.createElement(Cc, {
7573
7583
  key: n,
7574
7584
  scale: n,
7575
7585
  ratio: a[n],
7576
7586
  img: e,
7577
- crop: S[n],
7578
- bounds: w,
7587
+ crop: w[n],
7588
+ bounds: E,
7579
7589
  enabled: g.includes(n),
7580
7590
  active: n === v,
7581
- onClick: () => L(n),
7582
- onRemove: (e) => R(n, e)
7583
- }))), V && H && /* @__PURE__ */ t.createElement("div", { className: "shrink-0 pt-3 border-t border-border" }, /* @__PURE__ */ t.createElement("p", { className: "text-xs font-medium text-muted-foreground mb-1" }, o.outputFile), /* @__PURE__ */ t.createElement("p", {
7591
+ onClick: () => z(n),
7592
+ onRemove: (e) => B(n, e)
7593
+ }))), U && W && /* @__PURE__ */ t.createElement("div", { className: "shrink-0 pt-3 border-t border-border" }, /* @__PURE__ */ t.createElement("p", { className: "text-xs font-medium text-muted-foreground mb-1" }, o.outputFile), /* @__PURE__ */ t.createElement("p", {
7584
7594
  className: "text-xs text-foreground/70 truncate tabular-nums",
7585
- title: H.fileName
7586
- }, H.fileName ?? gc(b, v))))), /* @__PURE__ */ t.createElement("canvas", {
7595
+ title: W.fileName
7596
+ }, W.fileName ?? gc(b, v))))), /* @__PURE__ */ t.createElement("canvas", {
7587
7597
  ref: s,
7588
7598
  className: "hidden"
7589
7599
  }));
@@ -7990,7 +8000,7 @@ var bc = 120, xc = 88, Sc = (e) => {
7990
8000
  onClick: (t) => {
7991
8001
  t.stopPropagation(), w(e.key);
7992
8002
  },
7993
- className: "flex items-center justify-center w-6 h-6 rounded-full text-muted-foreground hover:bg-red-50 hover:text-red-500 transition-colors ml-auto"
8003
+ className: "flex items-center justify-center w-6 h-6 rounded-full text-muted-foreground hover:bg-red-50 hover:text-red-500 transition-colors ml-auto cursor-pointer"
7994
8004
  }, /* @__PURE__ */ t.createElement(Q, {
7995
8005
  name: "x",
7996
8006
  className: "w-3.5 h-3.5"
@@ -8002,7 +8012,7 @@ var bc = 120, xc = 88, Sc = (e) => {
8002
8012
  }, /* @__PURE__ */ t.createElement("button", {
8003
8013
  type: "button",
8004
8014
  onClick: C,
8005
- className: "flex items-center gap-1.5 text-xs text-muted-foreground hover:text-primary transition-colors"
8015
+ className: "flex items-center gap-1.5 text-xs text-muted-foreground hover:text-primary transition-colors cursor-pointer"
8006
8016
  }, /* @__PURE__ */ t.createElement(Q, {
8007
8017
  name: "upload",
8008
8018
  className: "w-3.5 h-3.5"
@@ -8109,7 +8119,7 @@ var bc = 120, xc = 88, Sc = (e) => {
8109
8119
  })), a && /* @__PURE__ */ t.createElement("button", {
8110
8120
  type: "button",
8111
8121
  onClick: () => j(e),
8112
- className: "flex items-center justify-center w-7 h-7 rounded-full bg-white/20 hover:bg-white/35 text-white transition-colors"
8122
+ className: "flex items-center justify-center w-7 h-7 rounded-full bg-white/20 hover:bg-white/35 text-white transition-colors cursor-pointer"
8113
8123
  }, /* @__PURE__ */ t.createElement(Q, {
8114
8124
  name: "pencil",
8115
8125
  className: "w-4 h-4"
@@ -8118,7 +8128,7 @@ var bc = 120, xc = 88, Sc = (e) => {
8118
8128
  onClick: (t) => {
8119
8129
  t.preventDefault(), t.stopPropagation(), k(e.key);
8120
8130
  },
8121
- className: "flex items-center justify-center w-7 h-7 rounded-full bg-red-500/70 hover:bg-red-500/90 text-white transition-colors"
8131
+ className: "flex items-center justify-center w-7 h-7 rounded-full bg-red-500/70 hover:bg-red-500/90 text-white transition-colors cursor-pointer"
8122
8132
  }, /* @__PURE__ */ t.createElement(Q, {
8123
8133
  name: "x",
8124
8134
  className: "w-4 h-4"
@@ -17492,7 +17502,9 @@ var Hh = (e) => {
17492
17502
  outputFile: "File di output",
17493
17503
  active: "Attivo",
17494
17504
  removeVariant: "Rimuovi variante {scale}",
17495
- fileName: "Nome file"
17505
+ fileName: "Nome file",
17506
+ altText: "Testo alternativo",
17507
+ altTextPlaceholder: "Descrivi questa immagine…"
17496
17508
  },
17497
17509
  imageEditor: {
17498
17510
  title: "Editor immagine",
@@ -17659,7 +17671,9 @@ var Hh = (e) => {
17659
17671
  outputFile: "Ausgabedatei",
17660
17672
  active: "Aktiv",
17661
17673
  removeVariant: "Variante {scale} entfernen",
17662
- fileName: "Dateiname"
17674
+ fileName: "Dateiname",
17675
+ altText: "Alt-Text",
17676
+ altTextPlaceholder: "Beschreiben Sie dieses Bild…"
17663
17677
  },
17664
17678
  imageEditor: {
17665
17679
  title: "Bildeditor",
@@ -17826,7 +17840,9 @@ var Hh = (e) => {
17826
17840
  outputFile: "Выходной файл",
17827
17841
  active: "Активно",
17828
17842
  removeVariant: "Удалить вариант {scale}",
17829
- fileName: "Имя файла"
17843
+ fileName: "Имя файла",
17844
+ altText: "Альтернативный текст",
17845
+ altTextPlaceholder: "Опишите это изображение…"
17830
17846
  },
17831
17847
  imageEditor: {
17832
17848
  title: "Редактор изображений",
@@ -17993,7 +18009,9 @@ var Hh = (e) => {
17993
18009
  outputFile: "输出文件",
17994
18010
  active: "活跃",
17995
18011
  removeVariant: "删除变体{scale}",
17996
- fileName: "文件名"
18012
+ fileName: "文件名",
18013
+ altText: "替代文本",
18014
+ altTextPlaceholder: "描述此图片…"
17997
18015
  },
17998
18016
  imageEditor: {
17999
18017
  title: "图片编辑器",
@@ -18160,7 +18178,9 @@ var Hh = (e) => {
18160
18178
  outputFile: "ملف الإخراج",
18161
18179
  active: "نشط",
18162
18180
  removeVariant: "إزالة المتغير {scale}",
18163
- fileName: "اسم الملف"
18181
+ fileName: "اسم الملف",
18182
+ altText: "النص البديل",
18183
+ altTextPlaceholder: "صف هذه الصورة…"
18164
18184
  },
18165
18185
  imageEditor: {
18166
18186
  title: "محرر الصور",