@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.
- package/dist/components/board/board-display.d.ts +66 -3
- package/dist/components/board/board-display.js +296 -246
- package/dist/components/board/board-display.js.map +1 -1
- package/dist/components/board/board-surfaces.d.ts +66 -0
- package/dist/components/board/board-surfaces.js +18 -0
- package/dist/components/board/board-surfaces.js.map +1 -0
- package/dist/components/board/board-teaser.js +59 -52
- package/dist/components/board/board-teaser.js.map +1 -1
- package/dist/components/board/reduced-motion.d.ts +2 -0
- package/dist/components/board/reduced-motion.js +16 -0
- package/dist/components/board/reduced-motion.js.map +1 -0
- package/dist/components/board/static-board-display.js +71 -64
- package/dist/components/board/static-board-display.js.map +1 -1
- package/dist/index.js +10 -10
- package/dist/lib/board-metrics.d.ts +116 -13
- package/dist/lib/board-metrics.js +97 -14
- package/dist/lib/board-metrics.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
|
|
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
|
-
},
|
|
14
|
+
}, A = {
|
|
13
15
|
black: {
|
|
14
16
|
backgroundColor: "var(--color-board-surface-dark)",
|
|
15
|
-
boxShadow:
|
|
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:
|
|
22
|
+
boxShadow: k.white,
|
|
21
23
|
contain: "layout style paint"
|
|
22
24
|
}
|
|
23
|
-
},
|
|
25
|
+
}, j = {
|
|
24
26
|
black: {
|
|
25
|
-
...
|
|
27
|
+
...A.black,
|
|
26
28
|
perspective: "800px",
|
|
27
29
|
isolation: "isolate"
|
|
28
30
|
},
|
|
29
31
|
white: {
|
|
30
|
-
...
|
|
32
|
+
...A.white,
|
|
31
33
|
perspective: "800px",
|
|
32
34
|
isolation: "isolate"
|
|
33
35
|
}
|
|
34
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
103
|
-
white:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
},
|
|
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 =
|
|
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__ */
|
|
135
|
-
className: `${u} relative
|
|
172
|
+
return /* @__PURE__ */ D("div", {
|
|
173
|
+
className: `${u} relative ${v} overflow-hidden`,
|
|
136
174
|
style: { backgroundColor: c },
|
|
137
|
-
children: [/* @__PURE__ */
|
|
138
|
-
className:
|
|
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
|
-
}),
|
|
182
|
+
}), y]
|
|
144
183
|
});
|
|
145
184
|
}
|
|
146
|
-
let
|
|
147
|
-
return /* @__PURE__ */
|
|
148
|
-
className: `${u} relative
|
|
149
|
-
style: {
|
|
150
|
-
|
|
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:
|
|
154
|
-
}),
|
|
195
|
+
children: b
|
|
196
|
+
}), y]
|
|
155
197
|
});
|
|
156
|
-
}),
|
|
157
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
-
}),
|
|
182
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
226
|
+
...l ? { "data-note-row-seam": "true" } : {},
|
|
185
227
|
className: `flex ${r} justify-center`,
|
|
186
|
-
style:
|
|
228
|
+
style: l ? { marginTop: u } : void 0,
|
|
187
229
|
children: e.map((e, r) => {
|
|
188
|
-
let
|
|
189
|
-
return /* @__PURE__ */
|
|
230
|
+
let l = c && r > 0 && r % 15 == 0;
|
|
231
|
+
return /* @__PURE__ */ E("div", {
|
|
190
232
|
"data-note-tile": "",
|
|
191
|
-
...
|
|
233
|
+
...d ? {
|
|
192
234
|
"data-row": t,
|
|
193
235
|
"data-col": r
|
|
194
236
|
} : {},
|
|
195
|
-
...
|
|
196
|
-
style:
|
|
197
|
-
children: /* @__PURE__ */
|
|
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
|
-
}),
|
|
214
|
-
function
|
|
215
|
-
|
|
216
|
-
for (let e of [...
|
|
217
|
-
},
|
|
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
|
|
220
|
-
|
|
262
|
+
function Z(e) {
|
|
263
|
+
e.intervalId !== null && (clearInterval(e.intervalId), e.intervalId = null);
|
|
221
264
|
}
|
|
222
|
-
|
|
223
|
-
|
|
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
|
|
226
|
-
|
|
227
|
-
|
|
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
|
|
231
|
-
let
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}, [
|
|
235
|
-
let e =
|
|
236
|
-
if (
|
|
237
|
-
|
|
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 (
|
|
241
|
-
|
|
242
|
-
let n =
|
|
243
|
-
|
|
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
|
-
|
|
251
|
-
let e =
|
|
252
|
-
if (
|
|
253
|
-
|
|
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
|
-
|
|
306
|
+
J.current = n, L((e) => e === n ? e : n), U(!1), Y.current = !1;
|
|
258
307
|
return;
|
|
259
308
|
}
|
|
260
|
-
|
|
309
|
+
U(!0);
|
|
261
310
|
let i = () => {
|
|
262
|
-
|
|
263
|
-
let n =
|
|
264
|
-
if (e === n) return
|
|
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 ? (
|
|
315
|
+
return r === n ? (U(!1), Y.current = !1, G.current &&= (clearInterval(G.current), null), r) : r;
|
|
267
316
|
});
|
|
268
317
|
};
|
|
269
|
-
return i(),
|
|
270
|
-
|
|
318
|
+
return i(), G.current = setInterval(i, P), () => {
|
|
319
|
+
G.current &&= (clearInterval(G.current), null), Y.current = !1;
|
|
271
320
|
};
|
|
272
321
|
}
|
|
273
|
-
|
|
322
|
+
G.current &&= (clearInterval(G.current), null), U(!1), L((e) => e === N ? e : N);
|
|
274
323
|
}, [
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
324
|
+
y,
|
|
325
|
+
N,
|
|
326
|
+
P,
|
|
278
327
|
u
|
|
279
|
-
]),
|
|
328
|
+
]), x(() => {
|
|
280
329
|
if (!u) {
|
|
281
|
-
|
|
330
|
+
K.current = N, G.current &&= (clearInterval(G.current), null), U(!1), L(N);
|
|
282
331
|
return;
|
|
283
332
|
}
|
|
284
|
-
if (
|
|
285
|
-
|
|
333
|
+
if (Y.current) {
|
|
334
|
+
K.current = N;
|
|
286
335
|
return;
|
|
287
336
|
}
|
|
288
|
-
if (
|
|
289
|
-
|
|
337
|
+
if (y || H) {
|
|
338
|
+
K.current = N;
|
|
290
339
|
return;
|
|
291
340
|
}
|
|
292
|
-
let e =
|
|
341
|
+
let e = K.current, n = N;
|
|
293
342
|
if (e !== n) {
|
|
294
|
-
if (
|
|
295
|
-
|
|
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
|
-
|
|
347
|
+
U(!0), G.current &&= (clearInterval(G.current), null);
|
|
299
348
|
let e = () => {
|
|
300
|
-
|
|
301
|
-
let n =
|
|
302
|
-
if (e === n) return
|
|
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 ? (
|
|
353
|
+
return r === n ? (U(!1), G.current &&= (clearInterval(G.current), null), r) : r;
|
|
305
354
|
});
|
|
306
355
|
};
|
|
307
|
-
return e(),
|
|
308
|
-
|
|
356
|
+
return e(), G.current = setInterval(e, P), () => {
|
|
357
|
+
G.current &&= (clearInterval(G.current), null);
|
|
309
358
|
};
|
|
310
359
|
}
|
|
311
|
-
|
|
360
|
+
J.current !== n && L(n), U(!1), G.current &&= (clearInterval(G.current), null);
|
|
312
361
|
}, [
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
362
|
+
N,
|
|
363
|
+
y,
|
|
364
|
+
H,
|
|
365
|
+
P,
|
|
317
366
|
u
|
|
318
367
|
]);
|
|
319
|
-
let
|
|
320
|
-
return /* @__PURE__ */
|
|
321
|
-
className: `relative ${
|
|
322
|
-
"data-testid": `char-tile-${
|
|
323
|
-
"data-current-char":
|
|
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":
|
|
326
|
-
"data-is-transitioning":
|
|
327
|
-
style:
|
|
374
|
+
"data-is-animating": y,
|
|
375
|
+
"data-is-transitioning": H,
|
|
376
|
+
style: y || H ? j[c] : A[c],
|
|
328
377
|
children: [
|
|
329
|
-
!
|
|
378
|
+
!y && !H && (() => {
|
|
330
379
|
if (o.type === "color") {
|
|
331
|
-
let t = e(o.code,
|
|
332
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
336
|
-
className:
|
|
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:
|
|
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),
|
|
352
|
-
return /* @__PURE__ */
|
|
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:
|
|
357
|
-
marginLeft:
|
|
358
|
-
marginRight:
|
|
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
|
-
!
|
|
362
|
-
className: `${
|
|
363
|
-
style: { color:
|
|
364
|
-
children:
|
|
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
|
-
!
|
|
367
|
-
className: `${
|
|
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
|
-
|
|
376
|
-
className:
|
|
424
|
+
u && /* @__PURE__ */ E("div", {
|
|
425
|
+
className: `absolute inset-0 ${f[s]}`,
|
|
377
426
|
style: {
|
|
378
|
-
backgroundColor:
|
|
379
|
-
boxShadow:
|
|
427
|
+
backgroundColor: d,
|
|
428
|
+
boxShadow: M
|
|
380
429
|
}
|
|
381
430
|
})
|
|
382
431
|
]
|
|
383
|
-
}, `static-char-${
|
|
432
|
+
}, `static-char-${N}`);
|
|
384
433
|
})(),
|
|
385
|
-
(
|
|
386
|
-
let t =
|
|
387
|
-
let r = a(t), i = r ? e(t,
|
|
388
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
401
|
-
className: `${
|
|
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__ */
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
style:
|
|
456
|
+
return /* @__PURE__ */ D(T, { children: [
|
|
457
|
+
/* @__PURE__ */ E("div", {
|
|
458
|
+
style: R,
|
|
410
459
|
children: n(t, !0)
|
|
411
460
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
style:
|
|
414
|
-
children: n(
|
|
461
|
+
/* @__PURE__ */ E("div", {
|
|
462
|
+
style: z,
|
|
463
|
+
children: n($, !1)
|
|
415
464
|
}),
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
style:
|
|
418
|
-
children: [n(
|
|
419
|
-
}, `ft-${
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
style: F,
|
|
422
|
-
children: [n(t, !1), /* @__PURE__ */
|
|
423
|
-
}, `fb-${
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
className:
|
|
427
|
-
style:
|
|
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
|
-
!
|
|
432
|
-
className:
|
|
433
|
-
style:
|
|
434
|
-
}), /* @__PURE__ */
|
|
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:
|
|
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),
|
|
444
|
-
let C = l(a, f, p),
|
|
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
|
-
|
|
447
|
-
|
|
495
|
+
T.rows,
|
|
496
|
+
T.cols,
|
|
448
497
|
a
|
|
449
|
-
]),
|
|
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
|
-
|
|
503
|
+
b
|
|
455
504
|
]);
|
|
456
|
-
return /* @__PURE__ */
|
|
505
|
+
return /* @__PURE__ */ D("div", {
|
|
457
506
|
className: "w-full flex justify-center",
|
|
458
|
-
children: [!s && /* @__PURE__ */
|
|
507
|
+
children: [!s && /* @__PURE__ */ E("style", {
|
|
459
508
|
href: "board-flap-keyframes",
|
|
460
509
|
precedence: "default",
|
|
461
|
-
children:
|
|
462
|
-
}), /* @__PURE__ */
|
|
510
|
+
children: O
|
|
511
|
+
}), /* @__PURE__ */ E("div", {
|
|
463
512
|
role: "img",
|
|
464
|
-
"aria-label":
|
|
513
|
+
"aria-label": R,
|
|
465
514
|
"data-slot": "board-display",
|
|
466
515
|
"data-board-preview": "",
|
|
467
|
-
className: `${
|
|
516
|
+
className: `${L} ${r} max-w-full`,
|
|
468
517
|
style: {
|
|
469
|
-
backgroundColor:
|
|
470
|
-
borderColor:
|
|
471
|
-
boxShadow:
|
|
518
|
+
backgroundColor: N,
|
|
519
|
+
borderColor: P,
|
|
520
|
+
boxShadow: F,
|
|
472
521
|
width: "fit-content"
|
|
473
522
|
},
|
|
474
|
-
children: /* @__PURE__ */
|
|
523
|
+
children: /* @__PURE__ */ E("div", {
|
|
475
524
|
className: `${d[n]} relative`,
|
|
476
525
|
"aria-hidden": "true",
|
|
477
|
-
style: { background:
|
|
478
|
-
children: /* @__PURE__ */
|
|
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:
|
|
481
|
-
let a =
|
|
482
|
-
return s ? /* @__PURE__ */
|
|
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:
|
|
537
|
+
showSeams: k,
|
|
489
538
|
isRowSeam: a,
|
|
490
|
-
seamGap:
|
|
539
|
+
seamGap: A,
|
|
491
540
|
emitCellMetadata: m
|
|
492
|
-
}, `row-${r}`) : /* @__PURE__ */
|
|
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:
|
|
500
|
-
|
|
548
|
+
animationsEnabled: C,
|
|
549
|
+
flapStepMs: w,
|
|
550
|
+
showSeams: k,
|
|
501
551
|
isRowSeam: a,
|
|
502
|
-
seamGap:
|
|
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 {
|
|
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
|