@fiestaboard/ui 2.1.0 → 2.1.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.
@@ -2,36 +2,57 @@
2
2
  import { resolveColorCode as e } from "../../lib/board-colors.js";
3
3
  import { BOARD_CHARS as t, EXTRA_CHARS as n, getCharFromToken as r, getCharIndex as i, isColorTile as a, messageToGrid as o, tokensEqual as s } from "../../lib/board-characters.js";
4
4
  import { isNoteArray as c, resolveDimensions as l } from "../../lib/board-dimensions.js";
5
- import { gapClasses as u, paddingClasses as d, sizeClasses as f, textSizeClasses as p } from "../../lib/board-metrics.js";
6
- import { memo as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
7
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
5
+ import { gapClasses as u, paddingClasses as d, radiusClasses as f, sizeClasses as p, textSizeClasses as m } from "../../lib/board-metrics.js";
6
+ import { SEAM_CLASS as h, charLeafBoxShadow as g, seamStyle as _ } from "./board-surfaces.js";
7
+ import { reducedMotionQuery as v, useReducedMotion as y } from "./reduced-motion.js";
8
+ import { memo as b, useEffect as x, useMemo as S, useRef as C, useState as w } from "react";
9
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
8
10
  //#region src/components/board/board-display.tsx
9
- var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { transform: rotateX(-90deg); } }\n @keyframes flapUp { from { transform: rotateX(90deg); } to { transform: rotateX(0deg); } }\n @keyframes flapShadow { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }\n ", C = {
11
+ var O = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { transform: rotateX(-90deg); } }\n @keyframes flapUp { from { transform: rotateX(90deg); } to { transform: rotateX(0deg); } }\n @keyframes flapShadow { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }\n ", k = {
10
12
  white: "\n 0 2px 4px rgba(0,0,0,0.2),\n inset 0 1px 2px rgba(0,0,0,0.1),\n inset 0 -1px 2px rgba(255,255,255,0.5),\n inset 1px 0 1px rgba(0,0,0,0.08),\n inset -1px 0 1px rgba(255,255,255,0.4)\n ",
11
13
  black: "\n 0 2px 4px rgba(0,0,0,0.5),\n inset 0 1px 2px rgba(0,0,0,0.8),\n inset 0 -1px 1px rgba(255,255,255,0.08),\n inset 1px 0 1px rgba(0,0,0,0.5),\n inset -1px 0 1px rgba(255,255,255,0.05)\n "
12
- }, w = {
14
+ }, A = {
13
15
  black: {
14
16
  backgroundColor: "var(--color-board-surface-dark)",
15
- boxShadow: C.black,
17
+ boxShadow: k.black,
16
18
  contain: "layout style paint"
17
19
  },
18
20
  white: {
19
21
  backgroundColor: "var(--color-board-surface-light)",
20
- boxShadow: C.white,
22
+ boxShadow: k.white,
21
23
  contain: "layout style paint"
22
24
  }
23
- }, T = {
25
+ }, j = {
24
26
  black: {
25
- ...w.black,
27
+ ...A.black,
26
28
  perspective: "800px",
27
29
  isolation: "isolate"
28
30
  },
29
31
  white: {
30
- ...w.white,
32
+ ...A.white,
31
33
  perspective: "800px",
32
34
  isolation: "isolate"
33
35
  }
34
- }, E = "\n 0 2px 4px rgba(0,0,0,0.3),\n inset 0 1px 1px rgba(255,255,255,0.15),\n inset 0 -1px 1px rgba(0,0,0,0.25),\n inset 1px 0 1px rgba(255,255,255,0.1),\n inset -1px 0 1px rgba(0,0,0,0.2)\n ", D = 80, O = Math.round(D * .55), k = Math.round(D * .35), A = Math.round(D * .55), j = {
36
+ }, M = "\n 0 2px 4px rgba(0,0,0,0.3),\n inset 0 1px 1px rgba(255,255,255,0.15),\n inset 0 -1px 1px rgba(0,0,0,0.25),\n inset 1px 0 1px rgba(255,255,255,0.1),\n inset -1px 0 1px rgba(0,0,0,0.2)\n ", N = {
37
+ hardware: 16,
38
+ quick: 48,
39
+ standard: 80,
40
+ relaxed: 130
41
+ }, P = 8, F = 2e3;
42
+ function I(e) {
43
+ let t = typeof e == "string" ? N[e] : e.durationMs;
44
+ return Number.isFinite(t) ? Math.min(F, Math.max(P, Math.round(t))) : N.standard;
45
+ }
46
+ function L(e) {
47
+ let t = Math.round(e / 2);
48
+ return {
49
+ stepMs: e,
50
+ topMs: t,
51
+ bottomMs: e - t,
52
+ bottomDelayMs: t
53
+ };
54
+ }
55
+ var R = {
35
56
  position: "absolute",
36
57
  top: 0,
37
58
  left: 0,
@@ -39,7 +60,7 @@ var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { tra
39
60
  height: "50%",
40
61
  overflow: "hidden",
41
62
  zIndex: 1
42
- }, M = {
63
+ }, z = {
43
64
  position: "absolute",
44
65
  top: "50%",
45
66
  left: 0,
@@ -47,19 +68,7 @@ var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { tra
47
68
  height: "50%",
48
69
  overflow: "hidden",
49
70
  zIndex: 1
50
- }, N = {
51
- position: "absolute",
52
- top: 0,
53
- left: 0,
54
- right: 0,
55
- height: "50%",
56
- overflow: "hidden",
57
- zIndex: 3,
58
- transformOrigin: "bottom center",
59
- backfaceVisibility: "hidden",
60
- willChange: "transform",
61
- animation: `flapDown ${O}ms ease-in forwards`
62
- }, P = {
71
+ }, B = {
63
72
  position: "absolute",
64
73
  bottom: 0,
65
74
  left: 0,
@@ -67,20 +76,7 @@ var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { tra
67
76
  height: "30%",
68
77
  background: "linear-gradient(to bottom, transparent, rgba(0,0,0,0.12))",
69
78
  pointerEvents: "none"
70
- }, F = {
71
- position: "absolute",
72
- top: "50%",
73
- left: 0,
74
- right: 0,
75
- height: "50%",
76
- overflow: "hidden",
77
- zIndex: 2,
78
- transformOrigin: "top center",
79
- backfaceVisibility: "hidden",
80
- willChange: "transform",
81
- transform: "rotateX(90deg)",
82
- animation: `flapUp ${A}ms cubic-bezier(0.33, 0, 0.15, 1) ${k}ms forwards`
83
- }, I = {
79
+ }, V = {
84
80
  white: {
85
81
  position: "absolute",
86
82
  top: 0,
@@ -99,69 +95,115 @@ var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { tra
99
95
  background: "linear-gradient(to bottom, rgba(0,0,0,0.15), transparent)",
100
96
  pointerEvents: "none"
101
97
  }
102
- }, L = {
103
- white: {
104
- position: "absolute",
105
- top: "50%",
106
- left: 0,
107
- right: 0,
108
- height: "50%",
109
- background: "linear-gradient(to bottom, rgba(0,0,0,0.06), transparent)",
110
- zIndex: 4,
111
- pointerEvents: "none",
112
- opacity: 0,
113
- animation: `flapShadow ${D}ms ease-in-out forwards`
114
- },
115
- black: {
116
- position: "absolute",
117
- top: "50%",
118
- left: 0,
119
- right: 0,
120
- height: "50%",
121
- background: "linear-gradient(to bottom, rgba(0,0,0,0.3), transparent)",
122
- zIndex: 4,
123
- pointerEvents: "none",
124
- opacity: 0,
125
- animation: `flapShadow ${D}ms ease-in-out forwards`
126
- }
127
- }, R = {
98
+ }, H = {
99
+ white: "linear-gradient(to bottom, rgba(0,0,0,0.06), transparent)",
100
+ black: "linear-gradient(to bottom, rgba(0,0,0,0.3), transparent)"
101
+ }, U = /* @__PURE__ */ new Map();
102
+ function W(e) {
103
+ let t = U.get(e);
104
+ if (t) return t;
105
+ let n = L(e), r = {
106
+ topFlap: {
107
+ position: "absolute",
108
+ top: 0,
109
+ left: 0,
110
+ right: 0,
111
+ height: "50%",
112
+ overflow: "hidden",
113
+ zIndex: 3,
114
+ transformOrigin: "bottom center",
115
+ backfaceVisibility: "hidden",
116
+ willChange: "transform",
117
+ animation: `flapDown ${n.topMs}ms ease-in forwards`
118
+ },
119
+ bottomFlap: {
120
+ position: "absolute",
121
+ top: "50%",
122
+ left: 0,
123
+ right: 0,
124
+ height: "50%",
125
+ overflow: "hidden",
126
+ zIndex: 2,
127
+ transformOrigin: "top center",
128
+ backfaceVisibility: "hidden",
129
+ willChange: "transform",
130
+ transform: "rotateX(90deg)",
131
+ animation: `flapUp ${n.bottomMs}ms cubic-bezier(0.33, 0, 0.15, 1) ${n.bottomDelayMs}ms forwards`
132
+ },
133
+ castShadow: {
134
+ white: {
135
+ position: "absolute",
136
+ top: "50%",
137
+ left: 0,
138
+ right: 0,
139
+ height: "50%",
140
+ background: H.white,
141
+ zIndex: 4,
142
+ pointerEvents: "none",
143
+ opacity: 0,
144
+ animation: `flapShadow ${n.stepMs}ms ease-in-out forwards`
145
+ },
146
+ black: {
147
+ position: "absolute",
148
+ top: "50%",
149
+ left: 0,
150
+ right: 0,
151
+ height: "50%",
152
+ background: H.black,
153
+ zIndex: 4,
154
+ pointerEvents: "none",
155
+ opacity: 0,
156
+ animation: `flapShadow ${n.stepMs}ms ease-in-out forwards`
157
+ }
158
+ }
159
+ };
160
+ return U.set(e, r), r;
161
+ }
162
+ var G = {
128
163
  white: "\n 0 8px 32px rgba(0,0,0,0.12),\n 0 4px 16px rgba(0,0,0,0.08),\n inset 0 1px 2px rgba(255,255,255,0.9),\n inset 0 0 0 1px rgba(255,255,255,0.5)\n ",
129
164
  black: "\n 0 8px 32px rgba(0,0,0,0.6),\n 0 4px 16px rgba(0,0,0,0.4),\n inset 0 1px 1px rgba(255,255,255,0.08),\n inset 0 0 0 1px rgba(255,255,255,0.03)\n "
130
- }, z = m(function({ token: r, size: a, boardType: o }) {
131
- let s = o === "white", c = s ? "var(--color-board-surface-light)" : "var(--color-board-surface-dark)", l = s ? "var(--color-board-text-on-light)" : "var(--color-board-text-on-dark)", u = a === "sm" ? "w-[14px] h-[18px]" : a === "md" ? "w-[14px] h-[20px] sm:w-[20px] sm:h-[28px] md:w-[24px] md:h-[34px] lg:w-[28px] lg:h-[40px]" : "w-[18px] h-[26px] sm:w-[24px] sm:h-[34px] md:w-[28px] md:h-[40px] lg:w-[32px] lg:h-[46px]", d = a === "sm" ? "text-[7px]" : a === "md" ? "text-[7px] sm:text-[10px] md:text-[13px] lg:text-[16px]" : "text-[10px] sm:text-[13px] md:text-[16px] lg:text-[20px]", f = /* @__PURE__ */ b("div", { className: `absolute top-1/2 left-0 right-0 h-[1px] ${s ? "bg-black/10" : "bg-black/30"}` });
165
+ }, K = b(function({ token: r, size: a, boardType: o }) {
166
+ let s = o === "white", c = s ? "var(--color-board-surface-light)" : "var(--color-board-surface-dark)", l = s ? "var(--color-board-text-on-light)" : "var(--color-board-text-on-dark)", u = p[a], d = m[a], v = f[a], y = /* @__PURE__ */ E("div", {
167
+ className: h,
168
+ style: _[o]
169
+ });
132
170
  if (r.type === "color") {
133
171
  let t = e(r.code, s), n = a === "sm" ? "3px 1px 4px" : a === "md" ? "4px 2px 5px" : "5px 2px 6px";
134
- return /* @__PURE__ */ x("div", {
135
- className: `${u} relative rounded-[3px] overflow-hidden`,
172
+ return /* @__PURE__ */ D("div", {
173
+ className: `${u} relative ${v} overflow-hidden`,
136
174
  style: { backgroundColor: c },
137
- children: [/* @__PURE__ */ b("div", {
138
- className: "absolute rounded-[2px]",
175
+ children: [/* @__PURE__ */ E("div", {
176
+ className: `absolute ${v}`,
139
177
  style: {
140
178
  inset: n,
141
- backgroundColor: t
179
+ backgroundColor: t,
180
+ boxShadow: M
142
181
  }
143
- }), f]
182
+ }), y]
144
183
  });
145
184
  }
146
- let p = n[r.value] ? r.value : t[i(r.value)], m = p === " ";
147
- return /* @__PURE__ */ x("div", {
148
- className: `${u} relative rounded-[3px] overflow-hidden flex items-center justify-center`,
149
- style: { backgroundColor: c },
150
- children: [!m && /* @__PURE__ */ b("span", {
185
+ let b = n[r.value] ? r.value : t[i(r.value)], x = b === " ";
186
+ return /* @__PURE__ */ D("div", {
187
+ className: `${u} relative ${v} overflow-hidden flex items-center justify-center`,
188
+ style: {
189
+ backgroundColor: c,
190
+ boxShadow: g[o]
191
+ },
192
+ children: [!x && /* @__PURE__ */ E("span", {
151
193
  className: `${d} font-mono font-semibold select-none leading-none`,
152
194
  style: { color: r.value === "♥" ? "#eb4034" : l },
153
- children: p
154
- }), f]
195
+ children: b
196
+ }), y]
155
197
  });
156
- }), B = m(function({ row: e, rowIdx: t, size: n, gapClass: i, boardType: a, showSeams: o = !1, isRowSeam: s = !1, seamGap: c = "6px", emitCellMetadata: l = !1 }) {
157
- return /* @__PURE__ */ b("div", {
198
+ }), q = b(function({ row: e, rowIdx: t, size: n, gapClass: i, boardType: a, showSeams: o = !1, isRowSeam: s = !1, seamGap: c = "6px", emitCellMetadata: l = !1 }) {
199
+ return /* @__PURE__ */ E("div", {
158
200
  "data-note-row": "",
159
201
  ...s ? { "data-note-row-seam": "true" } : {},
160
202
  className: `flex ${i} justify-center`,
161
203
  style: s ? { marginTop: c } : void 0,
162
204
  children: e.map((e, i) => {
163
205
  let s = o && i > 0 && i % 15 == 0;
164
- return /* @__PURE__ */ b("div", {
206
+ return /* @__PURE__ */ E("div", {
165
207
  "data-note-tile": "",
166
208
  ...l ? {
167
209
  "data-row": t,
@@ -170,7 +212,7 @@ var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { tra
170
212
  } : {},
171
213
  ...s ? { "data-note-col-seam": "true" } : {},
172
214
  style: s ? { marginLeft: c } : void 0,
173
- children: /* @__PURE__ */ b(z, {
215
+ children: /* @__PURE__ */ E(K, {
174
216
  token: e,
175
217
  size: n,
176
218
  boardType: a
@@ -178,28 +220,29 @@ var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { tra
178
220
  }, `col-${t}-${i}`);
179
221
  })
180
222
  });
181
- }), V = m(function({ row: e, rowIdx: t, size: n, gapClass: r, boardType: i = "black", isAnimating: a = !1, animationsEnabled: o = !0, showSeams: s = !1, isRowSeam: c = !1, seamGap: l = "6px", emitCellMetadata: u = !1 }) {
182
- return /* @__PURE__ */ b("div", {
223
+ }), J = b(function({ row: e, rowIdx: t, size: n, gapClass: r, boardType: i = "black", isAnimating: a = !1, animationsEnabled: o = !0, flapStepMs: s, showSeams: c = !1, isRowSeam: l = !1, seamGap: u = "6px", emitCellMetadata: d = !1 }) {
224
+ return /* @__PURE__ */ E("div", {
183
225
  "data-note-row": "",
184
- ...c ? { "data-note-row-seam": "true" } : {},
226
+ ...l ? { "data-note-row-seam": "true" } : {},
185
227
  className: `flex ${r} justify-center`,
186
- style: c ? { marginTop: l } : void 0,
228
+ style: l ? { marginTop: u } : void 0,
187
229
  children: e.map((e, r) => {
188
- let c = s && r > 0 && r % 15 == 0;
189
- return /* @__PURE__ */ b("div", {
230
+ let l = c && r > 0 && r % 15 == 0;
231
+ return /* @__PURE__ */ E("div", {
190
232
  "data-note-tile": "",
191
- ...u ? {
233
+ ...d ? {
192
234
  "data-row": t,
193
235
  "data-col": r
194
236
  } : {},
195
- ...c ? { "data-note-col-seam": "true" } : {},
196
- style: c ? { marginLeft: l } : void 0,
197
- children: /* @__PURE__ */ b(Y, {
237
+ ...l ? { "data-note-col-seam": "true" } : {},
238
+ style: l ? { marginLeft: u } : void 0,
239
+ children: /* @__PURE__ */ E($, {
198
240
  token: e,
199
241
  size: n,
200
242
  boardType: i,
201
243
  isAnimating: a,
202
244
  animationsEnabled: o,
245
+ flapStepMs: s,
203
246
  rowIdx: t,
204
247
  colIdx: r
205
248
  })
@@ -207,133 +250,139 @@ var S = "\n @keyframes flapDown { from { transform: rotateX(0deg); } to { tra
207
250
  })
208
251
  });
209
252
  }, (e, t) => {
210
- if (e.row.length !== t.row.length || e.size !== t.size || e.gapClass !== t.gapClass || e.boardType !== t.boardType || e.isAnimating !== t.isAnimating || e.animationsEnabled !== t.animationsEnabled || e.showSeams !== t.showSeams || e.isRowSeam !== t.isRowSeam || e.seamGap !== t.seamGap || e.emitCellMetadata !== t.emitCellMetadata) return !1;
253
+ if (e.row.length !== t.row.length || e.size !== t.size || e.gapClass !== t.gapClass || e.boardType !== t.boardType || e.isAnimating !== t.isAnimating || e.animationsEnabled !== t.animationsEnabled || e.flapStepMs !== t.flapStepMs || e.showSeams !== t.showSeams || e.isRowSeam !== t.isRowSeam || e.seamGap !== t.seamGap || e.emitCellMetadata !== t.emitCellMetadata) return !1;
211
254
  for (let n = 0; n < e.row.length; n++) if (!s(e.row[n], t.row[n])) return !1;
212
255
  return !0;
213
- }), H = 80, U = /* @__PURE__ */ new Set(), W = null, G = typeof window > "u" ? null : window.matchMedia("(prefers-reduced-motion: reduce)");
214
- function K() {
215
- W === null && (W = setInterval(() => {
216
- for (let e of [...U]) e();
217
- }, H));
256
+ }), Y = /* @__PURE__ */ new Map();
257
+ function X(e, t) {
258
+ t.intervalId === null && (t.intervalId = setInterval(() => {
259
+ for (let e of [...t.subscribers]) e();
260
+ }, e));
218
261
  }
219
- function q() {
220
- W !== null && (clearInterval(W), W = null);
262
+ function Z(e) {
263
+ e.intervalId !== null && (clearInterval(e.intervalId), e.intervalId = null);
221
264
  }
222
- G?.addEventListener("change", () => {
223
- G.matches ? q() : U.size > 0 && K();
265
+ v?.addEventListener("change", (e) => {
266
+ for (let [t, n] of Y) e.matches ? Z(n) : n.subscribers.size > 0 && X(t, n);
224
267
  });
225
- function J(e) {
226
- return U.add(e), G?.matches || K(), () => {
227
- U.delete(e), U.size === 0 && q();
268
+ function Q(e, t) {
269
+ let n = Y.get(e);
270
+ n || (n = {
271
+ subscribers: /* @__PURE__ */ new Set(),
272
+ intervalId: null
273
+ }, Y.set(e, n));
274
+ let r = n;
275
+ return r.subscribers.add(t), v?.matches || X(e, r), () => {
276
+ r.subscribers.delete(t), r.subscribers.size === 0 && (Z(r), Y.delete(e));
228
277
  };
229
278
  }
230
- var Y = m(function({ token: o, size: s = "md", boardType: c = "black", isAnimating: l = !1, animationsEnabled: u = !0, rowIdx: d = 0, colIdx: m = 0 }) {
231
- let g = u && l, S = c === "white", C = S ? "var(--color-board-surface-light)" : "var(--color-board-surface-dark)", O = S ? "var(--color-board-text-on-light)" : "var(--color-board-text-on-dark)", k = r(o), A = i(k), R = D, [z, B] = v(() => A), [V, H] = v(!1), U = _(null), W = _(A), G = _(g), K = _(z), q = _(!1);
232
- h(() => {
233
- K.current = z;
234
- }, [z]), h(() => {
235
- let e = G.current;
236
- if (G.current = g, !u) {
237
- U.current &&= (clearInterval(U.current), null), H(!1), B(A), W.current = A, q.current = !1;
279
+ var $ = b(function({ token: o, size: s = "md", boardType: c = "black", isAnimating: l = !1, animationsEnabled: u = !0, flapStepMs: d, rowIdx: h = 0, colIdx: v = 0 }) {
280
+ let y = u && l, b = c === "white", S = b ? "var(--color-board-surface-light)" : "var(--color-board-surface-dark)", O = b ? "var(--color-board-text-on-light)" : "var(--color-board-text-on-dark)", k = r(o), N = i(k), P = d, F = W(P), [I, L] = w(() => N), [H, U] = w(!1), G = C(null), K = C(N), q = C(y), J = C(I), Y = C(!1);
281
+ x(() => {
282
+ J.current = I;
283
+ }, [I]), x(() => {
284
+ let e = q.current;
285
+ if (q.current = y, !u) {
286
+ G.current &&= (clearInterval(G.current), null), U(!1), L(N), K.current = N, Y.current = !1;
238
287
  return;
239
288
  }
240
- if (g) {
241
- H(!1), U.current &&= (clearInterval(U.current), null), e || B(A);
242
- let n = J(() => {
243
- B((e) => (e + 1) % t.length);
289
+ if (y) {
290
+ U(!1), G.current &&= (clearInterval(G.current), null), e || L(N);
291
+ let n = Q(P, () => {
292
+ L((e) => (e + 1) % t.length);
244
293
  });
245
294
  return () => {
246
295
  n();
247
296
  };
248
297
  }
249
298
  if (e) {
250
- q.current = !0, U.current &&= (clearInterval(U.current), null);
251
- let e = W.current, n = A, r = e !== n;
252
- if (W.current = n, K.current === n) {
253
- K.current = n, H(!1), B((e) => e === n ? e : n), q.current = !1;
299
+ Y.current = !0, G.current &&= (clearInterval(G.current), null);
300
+ let e = K.current, n = N, r = e !== n;
301
+ if (K.current = n, J.current === n) {
302
+ J.current = n, U(!1), L((e) => e === n ? e : n), Y.current = !1;
254
303
  return;
255
304
  }
256
305
  if (!r) {
257
- K.current = n, B((e) => e === n ? e : n), H(!1), q.current = !1;
306
+ J.current = n, L((e) => e === n ? e : n), U(!1), Y.current = !1;
258
307
  return;
259
308
  }
260
- H(!0);
309
+ U(!0);
261
310
  let i = () => {
262
- B((e) => {
263
- let n = W.current;
264
- if (e === n) return H(!1), q.current = !1, U.current &&= (clearInterval(U.current), null), e;
311
+ L((e) => {
312
+ let n = K.current;
313
+ if (e === n) return U(!1), Y.current = !1, G.current &&= (clearInterval(G.current), null), e;
265
314
  let r = (e + 1) % t.length;
266
- return r === n ? (H(!1), q.current = !1, U.current &&= (clearInterval(U.current), null), r) : r;
315
+ return r === n ? (U(!1), Y.current = !1, G.current &&= (clearInterval(G.current), null), r) : r;
267
316
  });
268
317
  };
269
- return i(), U.current = setInterval(i, R), () => {
270
- U.current &&= (clearInterval(U.current), null), q.current = !1;
318
+ return i(), G.current = setInterval(i, P), () => {
319
+ G.current &&= (clearInterval(G.current), null), Y.current = !1;
271
320
  };
272
321
  }
273
- U.current &&= (clearInterval(U.current), null), H(!1), B((e) => e === A ? e : A);
322
+ G.current &&= (clearInterval(G.current), null), U(!1), L((e) => e === N ? e : N);
274
323
  }, [
275
- g,
276
- A,
277
- R,
324
+ y,
325
+ N,
326
+ P,
278
327
  u
279
- ]), h(() => {
328
+ ]), x(() => {
280
329
  if (!u) {
281
- W.current = A, U.current &&= (clearInterval(U.current), null), H(!1), B(A);
330
+ K.current = N, G.current &&= (clearInterval(G.current), null), U(!1), L(N);
282
331
  return;
283
332
  }
284
- if (q.current) {
285
- W.current = A;
333
+ if (Y.current) {
334
+ K.current = N;
286
335
  return;
287
336
  }
288
- if (g || V) {
289
- W.current = A;
337
+ if (y || H) {
338
+ K.current = N;
290
339
  return;
291
340
  }
292
- let e = W.current, n = A;
341
+ let e = K.current, n = N;
293
342
  if (e !== n) {
294
- if (W.current = n, K.current === n) {
295
- H(!1), U.current &&= (clearInterval(U.current), null), B(n);
343
+ if (K.current = n, J.current === n) {
344
+ U(!1), G.current &&= (clearInterval(G.current), null), L(n);
296
345
  return;
297
346
  }
298
- H(!0), U.current &&= (clearInterval(U.current), null);
347
+ U(!0), G.current &&= (clearInterval(G.current), null);
299
348
  let e = () => {
300
- B((e) => {
301
- let n = W.current;
302
- if (e === n) return H(!1), U.current &&= (clearInterval(U.current), null), e;
349
+ L((e) => {
350
+ let n = K.current;
351
+ if (e === n) return U(!1), G.current &&= (clearInterval(G.current), null), e;
303
352
  let r = (e + 1) % t.length;
304
- return r === n ? (H(!1), U.current &&= (clearInterval(U.current), null), r) : r;
353
+ return r === n ? (U(!1), G.current &&= (clearInterval(G.current), null), r) : r;
305
354
  });
306
355
  };
307
- return e(), U.current = setInterval(e, R), () => {
308
- U.current &&= (clearInterval(U.current), null);
356
+ return e(), G.current = setInterval(e, P), () => {
357
+ G.current &&= (clearInterval(G.current), null);
309
358
  };
310
359
  }
311
- K.current !== n && B(n), H(!1), U.current &&= (clearInterval(U.current), null);
360
+ J.current !== n && L(n), U(!1), G.current &&= (clearInterval(G.current), null);
312
361
  }, [
313
- A,
314
- g,
315
- V,
316
- R,
362
+ N,
363
+ y,
364
+ H,
365
+ P,
317
366
  u
318
367
  ]);
319
- let Y = t[z], X = (z - 1 + t.length) % t.length, Z = t[X];
320
- return /* @__PURE__ */ b(y, { children: /* @__PURE__ */ x("div", {
321
- className: `relative ${f[s]} rounded-[3px] overflow-hidden`,
322
- "data-testid": `char-tile-${d}-${m}`,
323
- "data-current-char": Y,
368
+ let X = t[I], Z = (I - 1 + t.length) % t.length, $ = t[Z];
369
+ return /* @__PURE__ */ E(T, { children: /* @__PURE__ */ D("div", {
370
+ className: `relative ${p[s]} ${f[s]} overflow-hidden`,
371
+ "data-testid": `char-tile-${h}-${v}`,
372
+ "data-current-char": X,
324
373
  "data-target-char": k,
325
- "data-is-animating": g,
326
- "data-is-transitioning": V,
327
- style: g || V ? T[c] : w[c],
374
+ "data-is-animating": y,
375
+ "data-is-transitioning": H,
376
+ style: y || H ? j[c] : A[c],
328
377
  children: [
329
- !g && !V && (() => {
378
+ !y && !H && (() => {
330
379
  if (o.type === "color") {
331
- let t = e(o.code, S);
332
- return /* @__PURE__ */ b("div", {
380
+ let t = e(o.code, b);
381
+ return /* @__PURE__ */ E("div", {
333
382
  className: `absolute inset-0 ${s === "sm" ? "[--color-margin-top:3px] [--color-margin-bottom:4px] [--color-margin-h:1px]" : s === "md" ? "[--color-margin-top:3px] sm:[--color-margin-top:4px] md:[--color-margin-top:5px] lg:[--color-margin-top:6px] [--color-margin-bottom:4px] sm:[--color-margin-bottom:6px] md:[--color-margin-bottom:7px] lg:[--color-margin-bottom:8px] [--color-margin-h:1px] sm:[--color-margin-h:2px]" : "[--color-margin-top:4px] sm:[--color-margin-top:5px] md:[--color-margin-top:6px] lg:[--color-margin-top:8px] [--color-margin-bottom:5px] sm:[--color-margin-bottom:7px] md:[--color-margin-bottom:8px] lg:[--color-margin-bottom:10px] [--color-margin-h:2px] md:[--color-margin-h:3px]"} flex items-center justify-center`,
334
383
  style: { zIndex: 2 },
335
- children: /* @__PURE__ */ b("div", {
336
- className: "relative rounded-[3px] overflow-hidden",
384
+ children: /* @__PURE__ */ E("div", {
385
+ className: `relative ${f[s]} overflow-hidden`,
337
386
  style: {
338
387
  marginTop: "var(--color-margin-top)",
339
388
  marginBottom: "var(--color-margin-bottom)",
@@ -342,29 +391,29 @@ var Y = m(function({ token: o, size: s = "md", boardType: c = "black", isAnimati
342
391
  width: "calc(100% - (var(--color-margin-h) * 2))",
343
392
  height: "calc(100% - (var(--color-margin-top) + var(--color-margin-bottom)))",
344
393
  backgroundColor: t,
345
- boxShadow: E
346
- },
347
- children: /* @__PURE__ */ b("div", { className: "absolute top-1/2 left-0 right-0 h-[1px] bg-black/10" })
394
+ boxShadow: M
395
+ }
348
396
  })
349
397
  }, `static-color-${o.code}`);
350
398
  }
351
- let i = r(o), c = n[i] ? i : t[A], l = a(c), u = l ? e(c, S) : C, d = c === "♥" ? "#eb4034" : O;
352
- return /* @__PURE__ */ x("div", {
399
+ let i = r(o), l = n[i] ? i : t[N], u = a(l), d = u ? e(l, b) : S, p = l === "♥" ? "#eb4034" : O;
400
+ return /* @__PURE__ */ D("div", {
353
401
  className: "absolute inset-0 flex items-center justify-center overflow-hidden",
354
402
  style: {
355
403
  zIndex: 2,
356
- backgroundColor: u,
357
- marginLeft: l ? "-4px" : 0,
358
- marginRight: l ? "-4px" : 0
404
+ backgroundColor: d,
405
+ marginLeft: u ? "-4px" : 0,
406
+ marginRight: u ? "-4px" : 0,
407
+ boxShadow: u ? void 0 : g[c]
359
408
  },
360
409
  children: [
361
- !l && c !== " " && /* @__PURE__ */ b("span", {
362
- className: `${p[s]} font-mono font-semibold select-none leading-none relative z-10`,
363
- style: { color: d },
364
- children: c
410
+ !u && l !== " " && /* @__PURE__ */ E("span", {
411
+ className: `${m[s]} font-mono font-semibold select-none leading-none relative z-10`,
412
+ style: { color: p },
413
+ children: l
365
414
  }),
366
- !l && c === " " && /* @__PURE__ */ b("span", {
367
- className: `${p[s]} font-mono font-semibold select-none leading-none relative z-10`,
415
+ !u && l === " " && /* @__PURE__ */ E("span", {
416
+ className: `${m[s]} font-mono font-semibold select-none leading-none relative z-10`,
368
417
  style: {
369
418
  color: O,
370
419
  visibility: "hidden"
@@ -372,20 +421,20 @@ var Y = m(function({ token: o, size: s = "md", boardType: c = "black", isAnimati
372
421
  "aria-hidden": "true",
373
422
  children: " "
374
423
  }),
375
- l && /* @__PURE__ */ b("div", {
376
- className: "absolute inset-0 rounded-[3px]",
424
+ u && /* @__PURE__ */ E("div", {
425
+ className: `absolute inset-0 ${f[s]}`,
377
426
  style: {
378
- backgroundColor: u,
379
- boxShadow: E
427
+ backgroundColor: d,
428
+ boxShadow: M
380
429
  }
381
430
  })
382
431
  ]
383
- }, `static-char-${A}`);
432
+ }, `static-char-${N}`);
384
433
  })(),
385
- (g || V) && (() => {
386
- let t = Y, n = (t, n) => {
387
- let r = a(t), i = r ? e(t, S) : C, o = t === "♥";
388
- return /* @__PURE__ */ b("div", {
434
+ (y || H) && (() => {
435
+ let t = X, n = (t, n) => {
436
+ let r = a(t), i = r ? e(t, b) : S, o = t === "♥";
437
+ return /* @__PURE__ */ E("div", {
389
438
  style: {
390
439
  position: "absolute",
391
440
  ...n ? { top: 0 } : { bottom: 0 },
@@ -397,109 +446,110 @@ var Y = m(function({ token: o, size: s = "md", boardType: c = "black", isAnimati
397
446
  justifyContent: "center",
398
447
  backgroundColor: i
399
448
  },
400
- children: !r && t !== " " && /* @__PURE__ */ b("span", {
401
- className: `${p[s]} font-mono font-semibold select-none leading-none`,
449
+ children: !r && t !== " " && /* @__PURE__ */ E("span", {
450
+ className: `${m[s]} font-mono font-semibold select-none leading-none`,
402
451
  style: { color: o ? "#eb4034" : O },
403
452
  children: t
404
453
  })
405
454
  });
406
455
  };
407
- return /* @__PURE__ */ x(y, { children: [
408
- /* @__PURE__ */ b("div", {
409
- style: j,
456
+ return /* @__PURE__ */ D(T, { children: [
457
+ /* @__PURE__ */ E("div", {
458
+ style: R,
410
459
  children: n(t, !0)
411
460
  }),
412
- /* @__PURE__ */ b("div", {
413
- style: M,
414
- children: n(Z, !1)
461
+ /* @__PURE__ */ E("div", {
462
+ style: z,
463
+ children: n($, !1)
415
464
  }),
416
- /* @__PURE__ */ x("div", {
417
- style: N,
418
- children: [n(Z, !0), /* @__PURE__ */ b("div", { style: P })]
419
- }, `ft-${z}`),
420
- /* @__PURE__ */ x("div", {
421
- style: F,
422
- children: [n(t, !1), /* @__PURE__ */ b("div", { style: I[c] })]
423
- }, `fb-${z}`),
424
- /* @__PURE__ */ b("div", { style: L[c] }, `fs-${z}`),
425
- /* @__PURE__ */ b("div", {
426
- className: `absolute top-1/2 left-0 right-0 h-[1px] ${S ? "bg-black/10" : "bg-black/30"}`,
427
- style: { zIndex: 5 }
465
+ /* @__PURE__ */ D("div", {
466
+ style: F.topFlap,
467
+ children: [n($, !0), /* @__PURE__ */ E("div", { style: B })]
468
+ }, `ft-${I}`),
469
+ /* @__PURE__ */ D("div", {
470
+ style: F.bottomFlap,
471
+ children: [n(t, !1), /* @__PURE__ */ E("div", { style: V[c] })]
472
+ }, `fb-${I}`),
473
+ /* @__PURE__ */ E("div", { style: F.castShadow[c] }, `fs-${I}`),
474
+ /* @__PURE__ */ E("div", {
475
+ className: "absolute top-1/2 left-0 right-0 h-[2px] pointer-events-none",
476
+ style: _[c]
428
477
  })
429
478
  ] });
430
479
  })(),
431
- !g && !V && z === A && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", {
432
- className: `absolute top-1/2 left-0 right-0 h-[1px] ${S ? "bg-black/10" : "bg-black/30"}`,
433
- style: { zIndex: 3 }
434
- }), /* @__PURE__ */ b("div", {
480
+ !y && !H && I === N && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("div", {
481
+ className: "absolute top-1/2 left-0 right-0 h-[2px] pointer-events-none",
482
+ style: _[c]
483
+ }), /* @__PURE__ */ E("div", {
435
484
  className: "absolute inset-0 pointer-events-none",
436
485
  style: {
437
486
  zIndex: 1,
438
- background: S ? "linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 50%, rgba(0,0,0,0.05) 100%)" : "linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 50%, rgba(0,0,0,0.2) 100%)"
487
+ background: b ? "linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 50%, rgba(0,0,0,0.05) 100%)" : "linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 50%, rgba(0,0,0,0.2) 100%)"
439
488
  }
440
489
  })] })
441
490
  ]
442
491
  }) });
443
- }, (e, t) => s(e.token, t.token) && e.size === t.size && e.boardType === t.boardType && e.isAnimating === t.isAnimating && e.animationsEnabled === t.animationsEnabled), X = (e) => `Board display: ${e}`, Z = m(function({ message: e, isLoading: t = !1, size: n = "md", className: r = "", boardType: i = "black", deviceType: a = "flagship", isStatic: s = !1, notesWide: f = 1, notesTall: p = 1, emitCellMetadata: m = !1, animationsEnabled: h = !0, loadingLabel: _ = "Loading board display", emptyLabel: v = "Empty board display", messageLabel: y = X }) {
444
- let C = l(a, f, p), w = c(a), T = n === "sm" ? "6px" : n === "md" ? "8px" : "10px", E = g(() => o(e ?? "", C.rows, C.cols, a), [
492
+ }, (e, t) => s(e.token, t.token) && e.size === t.size && e.boardType === t.boardType && e.isAnimating === t.isAnimating && e.animationsEnabled === t.animationsEnabled && e.flapStepMs === t.flapStepMs), ee = (e) => `Board display: ${e}`, te = b(function({ message: e, isLoading: t = !1, size: n = "md", className: r = "", boardType: i = "black", deviceType: a = "flagship", isStatic: s = !1, notesWide: f = 1, notesTall: p = 1, emitCellMetadata: m = !1, animationsEnabled: h = !0, flapSpeed: g = "standard", loadingLabel: _ = "Loading board display", emptyLabel: v = "Empty board display", messageLabel: b = ee }) {
493
+ let x = y(), C = h && !x, w = I(g), T = l(a, f, p), k = c(a), A = n === "sm" ? "6px" : n === "md" ? "8px" : "10px", j = S(() => o(e ?? "", T.rows, T.cols, a), [
445
494
  e,
446
- C.rows,
447
- C.cols,
495
+ T.rows,
496
+ T.cols,
448
497
  a
449
- ]), D = i === "white", O = D ? "var(--color-board-bezel-light)" : "var(--color-board-bezel-dark)", k = D ? "var(--color-board-bezel-border-light)" : "var(--color-board-bezel-border-dark)", A = R[i], j = n === "sm" ? "rounded-lg border-[3px]" : "rounded-lg sm:rounded-xl border-[3px] sm:border-[4px] lg:border-[5px]", M = g(() => t ? _ : e ? y(e.replace(/\{[^}]*\}/g, "").replace(/\n/g, " ").trim()) : v, [
498
+ ]), M = i === "white", N = M ? "var(--color-board-bezel-light)" : "var(--color-board-bezel-dark)", P = M ? "var(--color-board-bezel-border-light)" : "var(--color-board-bezel-border-dark)", F = G[i], L = n === "sm" ? "rounded-lg border-[3px]" : "rounded-lg sm:rounded-xl border-[3px] sm:border-[4px] lg:border-[5px]", R = S(() => t ? _ : e ? b(e.replace(/\{[^}]*\}/g, "").replace(/\n/g, " ").trim()) : v, [
450
499
  e,
451
500
  t,
452
501
  _,
453
502
  v,
454
- y
503
+ b
455
504
  ]);
456
- return /* @__PURE__ */ x("div", {
505
+ return /* @__PURE__ */ D("div", {
457
506
  className: "w-full flex justify-center",
458
- children: [!s && /* @__PURE__ */ b("style", {
507
+ children: [!s && /* @__PURE__ */ E("style", {
459
508
  href: "board-flap-keyframes",
460
509
  precedence: "default",
461
- children: S
462
- }), /* @__PURE__ */ b("div", {
510
+ children: O
511
+ }), /* @__PURE__ */ E("div", {
463
512
  role: "img",
464
- "aria-label": M,
513
+ "aria-label": R,
465
514
  "data-slot": "board-display",
466
515
  "data-board-preview": "",
467
- className: `${j} ${r} max-w-full`,
516
+ className: `${L} ${r} max-w-full`,
468
517
  style: {
469
- backgroundColor: O,
470
- borderColor: k,
471
- boxShadow: A,
518
+ backgroundColor: N,
519
+ borderColor: P,
520
+ boxShadow: F,
472
521
  width: "fit-content"
473
522
  },
474
- children: /* @__PURE__ */ b("div", {
523
+ children: /* @__PURE__ */ E("div", {
475
524
  className: `${d[n]} relative`,
476
525
  "aria-hidden": "true",
477
- style: { background: D ? "linear-gradient(135deg, var(--color-board-surface-light) 0%, var(--color-board-bezel-border-light) 100%)" : "linear-gradient(135deg, var(--color-board-surface-dark) 0%, var(--color-board-black) 100%)" },
478
- children: /* @__PURE__ */ b("div", {
526
+ style: { background: M ? "linear-gradient(135deg, var(--color-board-surface-light) 0%, var(--color-board-bezel-border-light) 100%)" : "linear-gradient(135deg, var(--color-board-surface-dark) 0%, var(--color-board-black) 100%)" },
527
+ children: /* @__PURE__ */ E("div", {
479
528
  className: `flex flex-col ${u[n]}`,
480
- children: E.map((e, r) => {
481
- let a = w && r > 0 && r % 3 == 0;
482
- return s ? /* @__PURE__ */ b(B, {
529
+ children: j.map((e, r) => {
530
+ let a = k && r > 0 && r % 3 == 0;
531
+ return s ? /* @__PURE__ */ E(q, {
483
532
  row: e,
484
533
  rowIdx: r,
485
534
  size: n,
486
535
  gapClass: u[n],
487
536
  boardType: i,
488
- showSeams: w,
537
+ showSeams: k,
489
538
  isRowSeam: a,
490
- seamGap: T,
539
+ seamGap: A,
491
540
  emitCellMetadata: m
492
- }, `row-${r}`) : /* @__PURE__ */ b(V, {
541
+ }, `row-${r}`) : /* @__PURE__ */ E(J, {
493
542
  row: e,
494
543
  rowIdx: r,
495
544
  size: n,
496
545
  gapClass: u[n],
497
546
  boardType: i,
498
547
  isAnimating: t,
499
- animationsEnabled: h,
500
- showSeams: w,
548
+ animationsEnabled: C,
549
+ flapStepMs: w,
550
+ showSeams: k,
501
551
  isRowSeam: a,
502
- seamGap: T,
552
+ seamGap: A,
503
553
  emitCellMetadata: m
504
554
  }, `row-${r}`);
505
555
  })
@@ -507,8 +557,8 @@ var Y = m(function({ token: o, size: s = "md", boardType: c = "black", isAnimati
507
557
  })
508
558
  })]
509
559
  });
510
- }, (e, t) => e.message === t.message && e.isLoading === t.isLoading && e.size === t.size && e.className === t.className && e.boardType === t.boardType && e.deviceType === t.deviceType && e.notesWide === t.notesWide && e.notesTall === t.notesTall && e.isStatic === t.isStatic && e.emitCellMetadata === t.emitCellMetadata && e.animationsEnabled === t.animationsEnabled && e.loadingLabel === t.loadingLabel && e.emptyLabel === t.emptyLabel && e.messageLabel === t.messageLabel);
560
+ }, (e, t) => e.message === t.message && e.isLoading === t.isLoading && e.size === t.size && e.className === t.className && e.boardType === t.boardType && e.deviceType === t.deviceType && e.notesWide === t.notesWide && e.notesTall === t.notesTall && e.isStatic === t.isStatic && e.emitCellMetadata === t.emitCellMetadata && e.animationsEnabled === t.animationsEnabled && I(e.flapSpeed ?? "standard") === I(t.flapSpeed ?? "standard") && e.loadingLabel === t.loadingLabel && e.emptyLabel === t.emptyLabel && e.messageLabel === t.messageLabel);
511
561
  //#endregion
512
- export { Z as BoardDisplay };
562
+ export { te as BoardDisplay, N as FLAP_SPEED_PRESETS, L as deriveFlapTiming, I as resolveFlapSpeed };
513
563
 
514
564
  //# sourceMappingURL=board-display.js.map