jaml-ui 2.0.0 → 2.1.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.
@@ -1,4 +1,4 @@
1
- import { b as e, n as t, p as n, r, t as i } from "./spriteMapper-C2mqQHLj.js";
1
+ import { m as e, n as t, r as n, t as r, x as i } from "./spriteMapper-C8uYedXB.js";
2
2
  import a, { createContext as o, createElement as s, forwardRef as c, memo as l, useCallback as u, useContext as d, useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
3
3
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
4
4
  import { FiCheck as b, FiCopy as x } from "react-icons/fi";
@@ -239,7 +239,7 @@ function M({ mode: e = "snap", placement: t = "auto", delay: n = 80, disabled: r
239
239
  }, [e])
240
240
  };
241
241
  }
242
- function ee({ layers: e, invert: t = !1, hoverTilt: r = !1 }) {
242
+ function ee({ layers: t, invert: n = !1, hoverTilt: r = !1 }) {
243
243
  let i = h(null), a = h(null), o = h(/* @__PURE__ */ new Map()), [s, c] = g(3 / 4), [, l] = g(0), d = h(null), p = h({
244
244
  rx: 0,
245
245
  ry: 0,
@@ -248,40 +248,40 @@ function ee({ layers: e, invert: t = !1, hoverTilt: r = !1 }) {
248
248
  rx: 0,
249
249
  ry: 0,
250
250
  rz: 0
251
- }), _ = e?.some((e) => e.animated);
251
+ }), _ = t?.some((e) => e.animated);
252
252
  f(() => {
253
- let e = !1, t = o.current;
253
+ let t = !1, n = o.current;
254
254
  return (async () => {
255
- let r = Array.from(new Set(Object.values(n).map((e) => e.src))), i = await Promise.all(r.map((e) => E(e)));
256
- e || (i.forEach((e, n) => {
257
- e && t.set(r[n], e);
255
+ let r = Array.from(new Set(Object.values(e).map((e) => e.src))), i = await Promise.all(r.map((e) => E(e)));
256
+ t || (i.forEach((e, t) => {
257
+ e && n.set(r[t], e);
258
258
  }), l((e) => e + 1));
259
259
  })().catch((e) => console.error("[JamlCardRenderer]", e)), () => {
260
- e = !0, t.clear();
260
+ t = !0, n.clear();
261
261
  };
262
262
  }, []), f(() => {
263
- let n = i.current;
264
- if (!n || !e || e.length === 0) return;
265
- let r = n.getContext("2d");
263
+ let e = i.current;
264
+ if (!e || !t || t.length === 0) return;
265
+ let r = e.getContext("2d");
266
266
  if (!r) return;
267
267
  let a = !1, s = null, u, d = (i) => {
268
- r.clearRect(0, 0, n.width, n.height), [...e].sort((e, t) => e.order - t.order).forEach((e) => {
269
- let t = o.current.get(e.source);
270
- if (t) {
271
- let a = D(n, r, t, e, _ ? i : void 0);
272
- e.order === 0 && c(a);
268
+ r.clearRect(0, 0, e.width, e.height), [...t].sort((e, t) => e.order - t.order).forEach((t) => {
269
+ let n = o.current.get(t.source);
270
+ if (n) {
271
+ let a = D(e, r, n, t, _ ? i : void 0);
272
+ t.order === 0 && c(a);
273
273
  return;
274
274
  }
275
- E(e.source).then((t) => {
276
- if (!(a || !t)) {
277
- if (o.current.set(e.source, t), !_) {
278
- let i = D(n, r, t, e);
279
- e.order === 0 && c(i);
275
+ E(t.source).then((n) => {
276
+ if (!(a || !n)) {
277
+ if (o.current.set(t.source, n), !_) {
278
+ let i = D(e, r, n, t);
279
+ t.order === 0 && c(i);
280
280
  }
281
281
  l((e) => e + 1);
282
282
  }
283
283
  });
284
- }), n.style.filter = t ? "invert(0.94)" : "none";
284
+ }), e.style.filter = n ? "invert(0.94)" : "none";
285
285
  };
286
286
  if (_) {
287
287
  let e = (t) => {
@@ -293,8 +293,8 @@ function ee({ layers: e, invert: t = !1, hoverTilt: r = !1 }) {
293
293
  a = !0, s !== null && cancelAnimationFrame(s);
294
294
  };
295
295
  }, [
296
- e,
297
296
  t,
297
+ n,
298
298
  _
299
299
  ]);
300
300
  let v = u(() => {
@@ -417,8 +417,8 @@ function te(e, t, n) {
417
417
  }
418
418
  //#endregion
419
419
  //#region src/ui/sprites.tsx
420
- function ne({ name: n, sheet: a, width: o = 40, height: s, style: c, className: l }) {
421
- let u = r(n), d = a ?? u?.type ?? "Jokers", f = i[d], p = t(d), m = u?.pos ?? p.pos, h = o;
420
+ function ne({ name: e, sheet: a, width: o = 40, height: s, style: c, className: l }) {
421
+ let u = n(e), d = a ?? u?.type ?? "Jokers", f = r[d], p = t(d), m = u?.pos ?? p.pos, h = o;
422
422
  [
423
423
  "Jokers",
424
424
  "Tarots",
@@ -437,7 +437,7 @@ function ne({ name: n, sheet: a, width: o = 40, height: s, style: c, className:
437
437
  width: o,
438
438
  height: g,
439
439
  flexShrink: 0,
440
- backgroundImage: `url(${e(f.assetKey)})`,
440
+ backgroundImage: `url(${i(f.assetKey)})`,
441
441
  backgroundSize: `${_}px ${y}px`,
442
442
  backgroundPosition: `${b}px ${x}px`,
443
443
  backgroundRepeat: "no-repeat",
@@ -456,18 +456,18 @@ var re = [
456
456
  "Orange",
457
457
  "Gold"
458
458
  ];
459
- function ie({ stake: t, width: n = 29, height: r, style: i }) {
460
- let a = re.indexOf(t.replace(" Stake", "")), o = a >= 0 ? a : 0, s = o % 5, c = Math.floor(o / 5), l = r ?? n, u = n * 5, d = l * 2;
459
+ function ie({ stake: e, width: t = 29, height: n, style: r }) {
460
+ let a = re.indexOf(e.replace(" Stake", "")), o = a >= 0 ? a : 0, s = o % 5, c = Math.floor(o / 5), l = n ?? t, u = t * 5, d = l * 2;
461
461
  return /* @__PURE__ */ v("div", { style: {
462
- width: n,
462
+ width: t,
463
463
  height: l,
464
464
  flexShrink: 0,
465
- backgroundImage: `url(${e("stakes")})`,
465
+ backgroundImage: `url(${i("stakes")})`,
466
466
  backgroundSize: `${u}px ${d}px`,
467
- backgroundPosition: `-${s * n}px -${c * l}px`,
467
+ backgroundPosition: `-${s * t}px -${c * l}px`,
468
468
  backgroundRepeat: "no-repeat",
469
469
  imageRendering: "pixelated",
470
- ...i
470
+ ...r
471
471
  } });
472
472
  }
473
473
  var ae = {
@@ -496,15 +496,15 @@ var ae = {
496
496
  y: 2
497
497
  }
498
498
  };
499
- function oe({ deck: t, width: r = 71, height: i, style: a }) {
500
- let o = ae[t.replace(" Deck", "")] ?? ae.Red, s = i ?? r * 95 / 71, c = n.enhancers;
499
+ function oe({ deck: t, width: n = 71, height: r, style: a }) {
500
+ let o = ae[t.replace(" Deck", "")] ?? ae.Red, s = r ?? n * 95 / 71, c = e.enhancers;
501
501
  return /* @__PURE__ */ v("div", { style: {
502
- width: r,
502
+ width: n,
503
503
  height: s,
504
504
  flexShrink: 0,
505
- backgroundImage: `url(${e(c.asset)})`,
506
- backgroundSize: `${r * c.columns}px ${s * c.rows}px`,
507
- backgroundPosition: `${-o.x * r}px ${-o.y * s}px`,
505
+ backgroundImage: `url(${i(c.asset)})`,
506
+ backgroundSize: `${n * c.columns}px ${s * c.rows}px`,
507
+ backgroundPosition: `${-o.x * n}px ${-o.y * s}px`,
508
508
  backgroundRepeat: "no-repeat",
509
509
  imageRendering: "pixelated",
510
510
  ...a
@@ -3385,4 +3385,4 @@ function da({ left: e, right: t, className: n = "" }) {
3385
3385
  //#endregion
3386
3386
  export { le as $, Le as A, be as B, qe as C, He as D, Ue as E, De as F, ge as G, P as H, Ee as I, ue as J, ce as K, Te as L, Pe as M, je as N, ze as O, Oe as P, fe as Q, we as R, Ge as S, We as T, _e as U, ve as V, ye as W, de as X, he as Y, pe as Z, Ze as _, sa as a, ee as at, Ye as b, ra as c, C as ct, it as d, se as et, rt as f, et as g, Xe as h, ca as i, ie as it, Ie as j, Re as k, st as l, w as lt, tt as m, ua as n, oe as nt, oa as o, te as ot, nt as p, me as q, la as r, ne as rt, aa as s, T as st, da as t, N as tt, at as u, $e as v, Ke as w, Je as x, Qe as y, xe as z };
3387
3387
 
3388
- //# sourceMappingURL=ui-CyhuNM51.js.map
3388
+ //# sourceMappingURL=ui-BXbEyxHZ.js.map