@agot/card-preview 1.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,740 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/components/cardComponents.tsx
38
+ var import_classnames2 = __toESM(require("classnames"));
39
+
40
+ // ../common/models/cards.ts
41
+ var challengeIcons = ["military", "intrigue", "power"];
42
+ var DefaultDeckLimit = /* @__PURE__ */ ((DefaultDeckLimit2) => {
43
+ DefaultDeckLimit2[DefaultDeckLimit2["character"] = 3] = "character";
44
+ DefaultDeckLimit2[DefaultDeckLimit2["attachment"] = 3] = "attachment";
45
+ DefaultDeckLimit2[DefaultDeckLimit2["location"] = 3] = "location";
46
+ DefaultDeckLimit2[DefaultDeckLimit2["event"] = 3] = "event";
47
+ DefaultDeckLimit2[DefaultDeckLimit2["plot"] = 2] = "plot";
48
+ DefaultDeckLimit2[DefaultDeckLimit2["agenda"] = 1] = "agenda";
49
+ return DefaultDeckLimit2;
50
+ })(DefaultDeckLimit || {});
51
+
52
+ // src/components/autoSize.tsx
53
+ var import_react = require("react");
54
+
55
+ // src/utils.ts
56
+ var px = (value) => `${value}px`;
57
+ var em = (value) => `${value}em`;
58
+
59
+ // src/components/autoSize.tsx
60
+ var import_jsx_runtime = require("react/jsx-runtime");
61
+ var AutoSize = ({ children, className, style, height, rate = 0.01, minimum = 0.4 }) => {
62
+ const contentRef = (0, import_react.useRef)(null);
63
+ const dependencies = Array.isArray(children) ? children : [children];
64
+ const elements = (0, import_react.useRef)(/* @__PURE__ */ new Map());
65
+ (0, import_react.useEffect)(() => {
66
+ const content = contentRef.current;
67
+ if (!content) {
68
+ return;
69
+ }
70
+ let multiplier = 1;
71
+ const baseSizes = elements.current;
72
+ for (const [element, baseSize] of [...baseSizes.entries()]) {
73
+ element.style.fontSize = px(baseSize);
74
+ baseSizes.delete(element);
75
+ }
76
+ const shrink = (el) => {
77
+ if (el.style.fontSize) {
78
+ if (!baseSizes.has(el)) {
79
+ const currentSize = parseFloat(el.style.fontSize);
80
+ baseSizes.set(el, currentSize);
81
+ }
82
+ const baseSize = baseSizes.get(el);
83
+ el.style.fontSize = px(baseSize * multiplier);
84
+ }
85
+ for (const child of el.children) {
86
+ if (child.nodeType === Node.ELEMENT_NODE) {
87
+ shrink(child);
88
+ }
89
+ }
90
+ };
91
+ const isOverflowing = () => content.scrollWidth > content.clientWidth || content.scrollHeight > content.clientHeight;
92
+ while (multiplier > minimum && isOverflowing()) {
93
+ content.style.fontSize = content.style.fontSize || window.getComputedStyle(content).fontSize;
94
+ multiplier -= rate;
95
+ shrink(content);
96
+ }
97
+ }, [...dependencies, minimum, rate]);
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: contentRef, className, style: { ...style, height: px(height) }, children });
99
+ };
100
+ var autoSize_default = AutoSize;
101
+
102
+ // src/components/cardComponents.tsx
103
+ var import_react2 = require("react");
104
+
105
+ // ../client/src/components/thronesIcon.tsx
106
+ var import_classnames = __toESM(require("classnames"), 1);
107
+
108
+ // ../common/utils.ts
109
+ var thronesColors = {
110
+ "baratheon": "#e3d852",
111
+ "greyjoy": "#1d7a99",
112
+ "lannister": "#c00106",
113
+ "martell": "#e89521",
114
+ "thenightswatch": "#7a7a7a",
115
+ "stark": "#cfcfcf",
116
+ "targaryen": "#1c1c1c",
117
+ "tyrell": "#509f16",
118
+ "neutral": "#a99560",
119
+ "income": "#ffd240",
120
+ "initiative": "#bb9570",
121
+ "claim": "#afafaf",
122
+ "reserve": "#f0623f"
123
+ };
124
+ var abilityIcons = {
125
+ military: "\uE605",
126
+ intrigue: "\uE602",
127
+ power: "\uE607",
128
+ baratheon: "\uE600",
129
+ greyjoy: "\uE601",
130
+ lannister: "\uE603",
131
+ martell: "\uE604",
132
+ thenightswatch: "\uE606",
133
+ stark: "\uE608",
134
+ targaryen: "\uE609",
135
+ tyrell: "\uE60A"
136
+ };
137
+ var thronesIcons = {
138
+ ...abilityIcons,
139
+ neutral: "\uE612",
140
+ unique: "\uE60B",
141
+ character: "\uE60F",
142
+ location: "\uE60E",
143
+ attachment: "\uE60D",
144
+ event: "\uE610",
145
+ plot: "\uE60C",
146
+ agenda: "\uE611"
147
+ };
148
+
149
+ // ../client/src/components/thronesIcon.tsx
150
+ var import_jsx_runtime2 = require("react/jsx-runtime");
151
+ var ThronesIcon = ({ name, className, style, visible = true }) => {
152
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: (0, import_classnames.default)("font-thronesdb leading-none", { invisible: !visible, "leading-relaxed": name === "unique" }, className), style, children: thronesIcons[name] });
153
+ };
154
+ var thronesIcon_default = ThronesIcon;
155
+
156
+ // src/components/cardComponents.tsx
157
+ var import_jsx_runtime3 = require("react/jsx-runtime");
158
+ var defaultOrientation = (type) => type === "plot" ? "horizontal" : "vertical";
159
+ var Card = (0, import_react2.memo)(({ children, card, orientation = defaultOrientation(card.type), scale = 1, rounded = true, className, classNames: classGroups, style, styles: styleGroups, ...props }) => {
160
+ const width = 240;
161
+ const height = 333;
162
+ const wrapperWidth = orientation === "horizontal" ? height : width;
163
+ const wrapperHeight = orientation === "horizontal" ? width : height;
164
+ const innerWidth = card.type === "plot" ? height : width;
165
+ const innerHeight = card.type === "plot" ? width : height;
166
+ const rotate = orientation !== defaultOrientation(card.type);
167
+ const innerStyle = (0, import_react2.useMemo)(() => {
168
+ const style2 = {
169
+ borderColor: card.faction ? thronesColors[card.faction] : "white",
170
+ background: "white",
171
+ color: "black",
172
+ fontFamily: "Open Sans, sans-serif",
173
+ ...scale !== 1 && { scale },
174
+ ...(scale !== 1 || rotate) && { transformOrigin: "top left" },
175
+ ...rotate && { position: "relative", rotate: "270deg", top: "100%" },
176
+ ...styleGroups?.inner
177
+ };
178
+ return style2;
179
+ }, [card.faction, rotate, scale, styleGroups?.inner]);
180
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
181
+ "div",
182
+ {
183
+ className: (0, import_classnames2.default)(className, classGroups?.wrapper),
184
+ style: {
185
+ overflow: "hidden",
186
+ width: px(wrapperWidth * scale),
187
+ height: px(wrapperHeight * scale),
188
+ ...rounded && { borderRadius: px(12) },
189
+ ...style,
190
+ ...styleGroups?.wrapper
191
+ },
192
+ ...props,
193
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
194
+ "div",
195
+ {
196
+ className: classGroups?.inner,
197
+ style: {
198
+ width: px(innerWidth),
199
+ height: px(innerHeight),
200
+ borderWidth: px(12),
201
+ ...innerStyle
202
+ },
203
+ children
204
+ }
205
+ )
206
+ }
207
+ );
208
+ });
209
+ var Type = (0, import_react2.memo)(({ children: type, className, style }) => {
210
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, style: { position: "relative", top: px(-5), left: px(2), fontSize: px(8), ...style }, children: type });
211
+ });
212
+ var Cost = (0, import_react2.memo)(({ children, className, style }) => {
213
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
214
+ autoSize_default,
215
+ {
216
+ height: 35,
217
+ className,
218
+ style: {
219
+ top: px(-7.5),
220
+ left: px(-7.5),
221
+ width: px(35),
222
+ lineHeight: px(30),
223
+ fontSize: px(24),
224
+ borderWidth: px(2),
225
+ position: "relative",
226
+ borderRadius: "100%",
227
+ borderColor: "black",
228
+ borderStyle: "solid",
229
+ background: "white",
230
+ textAlign: "center",
231
+ ...style
232
+ },
233
+ children
234
+ }
235
+ );
236
+ });
237
+ var ChallengeIcons = (0, import_react2.memo)(({ children: icons = [], className, style }) => {
238
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, style: {
239
+ display: "flex",
240
+ flexDirection: "column",
241
+ flexGrow: 1,
242
+ ...style
243
+ }, children: challengeIcons.map(
244
+ (icon) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: {
245
+ display: "flex",
246
+ flexDirection: "column",
247
+ flexGrow: 1,
248
+ justifyContent: "center",
249
+ alignItems: "center"
250
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
251
+ thronesIcon_default,
252
+ {
253
+ name: icon,
254
+ style: {
255
+ height: "calc(1/3 * 100%)",
256
+ display: "flex",
257
+ justifyContent: "center",
258
+ alignItems: "center",
259
+ fontSize: px(20)
260
+ },
261
+ visible: icons.includes(icon)
262
+ }
263
+ ) }, icon)
264
+ ) });
265
+ });
266
+ var Loyalty = (0, import_react2.memo)(({ children: loyal, className, style }) => {
267
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
268
+ "div",
269
+ {
270
+ className,
271
+ style: {
272
+ display: "flex",
273
+ alignItems: "center",
274
+ justifyContent: "center",
275
+ width: px(35),
276
+ height: px(15),
277
+ fontSize: px(10),
278
+ ...style
279
+ },
280
+ children: loyal && "Loyal"
281
+ }
282
+ );
283
+ });
284
+ var Strength = (0, import_react2.memo)(({ children: strength, className, style }) => {
285
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
286
+ autoSize_default,
287
+ {
288
+ height: 35,
289
+ className,
290
+ style: {
291
+ display: "flex",
292
+ justifyContent: "center",
293
+ alignItems: "cneter",
294
+ boxSizing: "border-box",
295
+ backgroundColor: "#e5e7eb",
296
+ borderColor: "black",
297
+ borderWidth: px(2),
298
+ width: px(35),
299
+ fontSize: px(22),
300
+ ...style
301
+ },
302
+ children: strength
303
+ }
304
+ );
305
+ });
306
+ var Name = (0, import_react2.memo)(({ unique, height, children: name, className, style }) => {
307
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
308
+ autoSize_default,
309
+ {
310
+ height: height ?? 35,
311
+ className,
312
+ style: {
313
+ display: "flex",
314
+ justifyContent: "center",
315
+ alignItems: "center",
316
+ textAlign: "center",
317
+ fontSize: px(14),
318
+ paddingLeft: px(2),
319
+ paddingRight: px(2),
320
+ gap: px(2),
321
+ ...style
322
+ },
323
+ children: [
324
+ unique && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(thronesIcon_default, { name: "unique" }),
325
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: name })
326
+ ]
327
+ }
328
+ );
329
+ });
330
+ var Faction = (0, import_react2.memo)(({ children: faction, className, style }) => {
331
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
332
+ "div",
333
+ {
334
+ className,
335
+ style: {
336
+ display: "flex",
337
+ alignItems: "center",
338
+ justifyContent: "center",
339
+ boxSizing: "border-box",
340
+ borderColor: "black",
341
+ width: px(35),
342
+ height: px(35),
343
+ fontSize: px(22),
344
+ borderWidth: px(2),
345
+ ...style
346
+ },
347
+ children: faction && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(thronesIcon_default, { name: faction })
348
+ }
349
+ );
350
+ });
351
+ var Traits = (0, import_react2.memo)(({ children: traits = [], className, style }) => {
352
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
353
+ "div",
354
+ {
355
+ className,
356
+ style: {
357
+ fontStyle: "italic",
358
+ fontWeight: "700",
359
+ textAlign: "center",
360
+ height: px(16),
361
+ fontSize: px(12),
362
+ ...style
363
+ },
364
+ children: traits.map((trait) => `${trait}.`).join(" ")
365
+ }
366
+ );
367
+ });
368
+ var TextBox = (0, import_react2.memo)(({ children, className, style }) => {
369
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, style: {
370
+ display: "flex",
371
+ flexDirection: "column",
372
+ fontFamily: "Crimson Text, serif",
373
+ fontSize: px(12),
374
+ lineHeight: 1.1,
375
+ padding: `${px(5)} ${px(10)}`,
376
+ ...style
377
+ }, children });
378
+ });
379
+ var Ability = (0, import_react2.memo)(({ children: text, className, style }) => {
380
+ const convertToHtml = (htmlString) => {
381
+ const raw = htmlString.replace(/(?<=\n?)([^\n]+)(?=\n?)/g, "<p>$1</p>").replace(/\[([^\]]+)\]/g, '<icon name="$1"></icon>').replace(/<p>((?:\s*[+-]\d+ (?:Income|Initiative|Claim|Reserve)\.?\s*)+)<\/p>/gi, "<plotModifiers>$1</plotModifiers>").replace(/\s*([+-])(\d+) (Income|Initiative|Claim|Reserve)\.?\s*/gi, (_, modifier, value, plotStat) => `<plotModifier name="${plotStat.toLowerCase()}" modifier="${modifier}">${value}</plotModifier>`).replace(/((?:<p>-.*<\/p>\s*)+)/g, "<ul>$1</ul>").replace(/<p>-\s*(.*?)<\/p>/g, "<li>$1</li>").replace(/\n/g, "");
382
+ const parser = new DOMParser();
383
+ const body = parser.parseFromString(raw, "text/html").body;
384
+ const transformNode = (node, key) => {
385
+ if (node.nodeType === Node.TEXT_NODE) {
386
+ return node.textContent;
387
+ }
388
+ if (node.nodeType === Node.ELEMENT_NODE) {
389
+ const el = node;
390
+ const children = Array.from(el.childNodes).map((child, i) => transformNode(child, i));
391
+ switch (el.tagName.toLowerCase()) {
392
+ case "p":
393
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children }, key);
394
+ case "b":
395
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { style: { fontWeight: "700" }, children }, key);
396
+ case "i":
397
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("i", { style: { fontStyle: "italic", fontWeight: "700" }, children }, key);
398
+ case "ul":
399
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { style: { listStyleType: "disc", marginBlockStart: em(0.25), marginBlockEnd: em(0.25), paddingInlineStart: em(2) }, children }, key);
400
+ case "li":
401
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { style: { paddingTop: em(0.1), paddingBottom: em(0.1) }, children }, key);
402
+ case "icon":
403
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(thronesIcon_default, { name: el.getAttribute("name") }, key);
404
+ case "plotmodifiers":
405
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "flex", flexGrow: 1, justifyContent: "center", alignItems: "center", gap: em(0.25) }, children }, key);
406
+ case "plotmodifier":
407
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PlotModifier, { type: el.getAttribute("name"), modifier: el.getAttribute("modifier"), inline: true, children: parseInt(children[0]) }, key);
408
+ default:
409
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children }, key);
410
+ }
411
+ }
412
+ return null;
413
+ };
414
+ return body ? Array.from(body.childNodes).map((node, i) => transformNode(node, i)) : [];
415
+ };
416
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, style: { display: "flex", flexDirection: "column", flexGrow: 1, gap: em(0.25), ...style }, children: text && convertToHtml(text) });
417
+ });
418
+ var Designer = (0, import_react2.memo)(({ children: designer, className, style }) => {
419
+ return designer && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, style: { flexGrow: 1, fontWeight: "700", fontSize: px(11), paddingTop: em(0.5), ...style }, children: designer });
420
+ });
421
+ var PlotModifier = (0, import_react2.memo)(({ className, style, type, modifier, children: value }) => {
422
+ const actualValue = `${modifier}${value}`;
423
+ return value && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PlotStat, { className, style, type, children: actualValue });
424
+ });
425
+ var PlotStat = (0, import_react2.memo)(({ className, style, type, children: value }) => {
426
+ const getClipPath = () => {
427
+ switch (type) {
428
+ case "income":
429
+ return "circle(50%)";
430
+ case "initiative":
431
+ return "polygon(50% 0, 100% 50%, 50% 100%, 0 50%)";
432
+ case "claim":
433
+ return "polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)";
434
+ case "reserve":
435
+ return "polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%)";
436
+ }
437
+ };
438
+ const clipPath = getClipPath();
439
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
440
+ autoSize_default,
441
+ {
442
+ height: 30,
443
+ className,
444
+ style: {
445
+ backgroundColor: thronesColors[type],
446
+ position: "relative",
447
+ textAlign: "center",
448
+ fontFamily: "Open sans, sans-serif",
449
+ width: px(30),
450
+ lineHeight: 1.35,
451
+ padding: em(0.15),
452
+ fontSize: px(18),
453
+ clipPath,
454
+ ...style
455
+ },
456
+ children: value
457
+ }
458
+ );
459
+ });
460
+ var DeckLimit = (0, import_react2.memo)(({ type, alignment = "left", children: limit, className, style }) => {
461
+ if (!type || limit === DefaultDeckLimit[type]) {
462
+ return null;
463
+ }
464
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
465
+ "div",
466
+ {
467
+ className,
468
+ style: {
469
+ textAlign: "center",
470
+ ...alignment === "left" && { rotate: "180deg" },
471
+ fontSize: px(8),
472
+ padding: px(5),
473
+ writingMode: "vertical-rl",
474
+ ...style
475
+ },
476
+ children: limit && `Deck Limit: ${limit}`
477
+ }
478
+ );
479
+ });
480
+ var Watermark = (0, import_react2.memo)(({ children: watermark, className, style }) => {
481
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
482
+ "div",
483
+ {
484
+ className,
485
+ style: {
486
+ display: "flex",
487
+ flexDirection: "column",
488
+ flexGrow: 1,
489
+ justifyContent: "center",
490
+ alignItems: "center",
491
+ textAlign: "center",
492
+ color: "#e5e7eb",
493
+ fontWeight: "700",
494
+ fontSize: px(14),
495
+ ...style
496
+ },
497
+ children: [
498
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: watermark?.top }),
499
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: px(36), lineHeight: 1 }, children: watermark?.middle }),
500
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: watermark?.bottom })
501
+ ]
502
+ }
503
+ );
504
+ });
505
+
506
+ // src/cardtypes/character.tsx
507
+ var import_jsx_runtime4 = require("react/jsx-runtime");
508
+ var Character = ({ card, scale, orientation, rounded, className, style, ...props }) => {
509
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Card, { scale, card, orientation, rounded, className, styles: { inner: { display: "flex", flexDirection: "column" } }, style, ...props, children: [
510
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexGrow: 1 }, children: [
511
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", position: "relative", flexDirection: "column", width: px(35) }, children: [
512
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Cost, { children: card.cost }),
513
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Type, { children: "Character" }),
514
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChallengeIcons, { children: Object.entries(card.icons || {}).filter(([, value]) => value).map(([icon]) => icon) })
515
+ ] }),
516
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Watermark, { children: card.watermark }),
517
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", justifyContent: "flex-end" }, children: [
518
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DeckLimit, { type: card.type, style: { flexGrow: 1 }, alignment: "right", children: card.deckLimit }),
519
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loyalty, { children: card.loyal })
520
+ ] })
521
+ ] }),
522
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex" }, children: [
523
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Strength, { children: card.strength }),
524
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Name, { unique: card.unique, style: {
525
+ alignSelf: "flex-end",
526
+ flexGrow: 1,
527
+ borderColor: "black",
528
+ fontSize: px(14),
529
+ lineHeight: "1.4",
530
+ display: "flex",
531
+ alignItems: "center",
532
+ justifyContent: "center",
533
+ height: px(30),
534
+ borderTopWidth: px(2),
535
+ borderBottomWidth: px(2)
536
+ }, children: card.name }),
537
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Faction, { children: card.faction })
538
+ ] }),
539
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(TextBox, { children: [
540
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Traits, { children: card.traits }),
541
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(autoSize_default, { height: 95, style: { display: "flex", flexDirection: "column" }, children: [
542
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Ability, { children: card.text }),
543
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Designer, { children: card.designer })
544
+ ] })
545
+ ] })
546
+ ] });
547
+ };
548
+ var character_default = Character;
549
+
550
+ // src/cardtypes/location.tsx
551
+ var import_jsx_runtime5 = require("react/jsx-runtime");
552
+ var Location = ({ card, scale, orientation, rounded, className, style, ...props }) => {
553
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Card, { scale, card, orientation, rounded, className, styles: { inner: { display: "flex", flexDirection: "row" } }, style, ...props, children: [
554
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { position: "relative", display: "flex", flexDirection: "column", width: px(35) }, children: [
555
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Cost, { children: card.cost }),
556
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Type, { children: "Location" }),
557
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Name, { unique: card.unique, height: 150, style: {
558
+ width: px(35),
559
+ borderBottomWidth: px(2),
560
+ borderLeftWidth: px(2),
561
+ borderRightWidth: px(2),
562
+ borderStyle: "solid",
563
+ borderColor: "black",
564
+ rotate: "180deg",
565
+ paddingTop: px(5),
566
+ paddingBottom: px(5),
567
+ writingMode: "vertical-lr"
568
+ }, children: card.name }),
569
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Faction, { children: card.faction }),
570
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loyalty, { children: card.loyal })
571
+ ] }),
572
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", flexDirection: "column", flexGrow: 1, justifyContent: "space-between" }, children: [
573
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { position: "relative", display: "flex", flexDirection: "column", flexGrow: 1 }, children: [
574
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DeckLimit, { type: card.type, style: { position: "absolute", alignSelf: "self-end", height: "100%" }, alignment: "right", children: card.deckLimit }),
575
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Watermark, { children: card.watermark })
576
+ ] }),
577
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(TextBox, { children: [
578
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Traits, { children: card.traits }),
579
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(autoSize_default, { height: 130, style: { display: "flex", flexDirection: "column" }, children: [
580
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Ability, { children: card.text }),
581
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Designer, { children: card.designer })
582
+ ] })
583
+ ] })
584
+ ] })
585
+ ] });
586
+ };
587
+ var location_default = Location;
588
+
589
+ // src/cardtypes/attachment.tsx
590
+ var import_jsx_runtime6 = require("react/jsx-runtime");
591
+ var Attachment = ({ card, scale, orientation, rounded, className, style, ...props }) => {
592
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Card, { scale, card, orientation, rounded, className, styles: { inner: { display: "flex", flexDirection: "column" } }, style, ...props, children: [
593
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexGrow: 1 }, children: [
594
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexDirection: "column", width: px(35) }, children: [
595
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Cost, { children: card.cost }),
596
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Type, { children: "Attachment" }),
597
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DeckLimit, { type: card.type, style: { flexGrow: 1 }, children: card.deckLimit })
598
+ ] }),
599
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Watermark, { style: { marginRight: px(35) }, children: card.watermark })
600
+ ] }),
601
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { position: "relative", display: "flex", flexDirection: "column", alignItems: "flex-end" }, children: [
602
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(TextBox, { style: { width: "100%", paddingBottom: px(10) }, children: [
603
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Traits, { children: card.traits }),
604
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(autoSize_default, { height: 90, style: { display: "flex", flexDirection: "column" }, children: [
605
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Ability, { children: card.text }),
606
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Designer, { children: card.designer })
607
+ ] })
608
+ ] }),
609
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Loyalty, { style: { position: "absolute", bottom: px(0) }, children: card.loyal })
610
+ ] }),
611
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex" }, children: [
612
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Name, { unique: card.unique, style: {
613
+ flexGrow: 1,
614
+ borderTopWidth: px(2),
615
+ borderBottomWidth: px(2),
616
+ borderLeftWidth: px(2)
617
+ }, children: card.name }),
618
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Faction, { children: card.faction })
619
+ ] })
620
+ ] });
621
+ };
622
+ var attachment_default = Attachment;
623
+
624
+ // src/cardtypes/event.tsx
625
+ var import_jsx_runtime7 = require("react/jsx-runtime");
626
+ var Event = ({ card, scale, orientation, rounded, className, style, ...props }) => {
627
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Card, { scale, card, orientation, rounded, className, styles: { inner: { display: "flex", flexDirection: "column" } }, style, ...props, children: [
628
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "flex", flexGrow: 1 }, children: [
629
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "flex", flexDirection: "column", width: px(35) }, children: [
630
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Cost, { children: card.cost }),
631
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Type, { children: "Event" }),
632
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DeckLimit, { type: card.type, style: { flexGrow: 1 }, children: card.deckLimit })
633
+ ] }),
634
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "flex", flexDirection: "column", flexGrow: 1 }, children: [
635
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Name, { style: {
636
+ borderTopWidth: px(2),
637
+ borderBottomWidth: px(2),
638
+ borderLeftWidth: px(2)
639
+ }, children: card.name }),
640
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Watermark, { style: { flexGrow: 1 }, children: card.watermark })
641
+ ] }),
642
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "flex", flexDirection: "column", width: px(35) }, children: [
643
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Faction, { children: card.faction }),
644
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loyalty, { children: card.loyal })
645
+ ] })
646
+ ] }),
647
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(TextBox, { children: [
648
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Traits, { children: card.traits }),
649
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(autoSize_default, { height: 130, style: { display: "flex", flexDirection: "column" }, children: [
650
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Ability, { children: card.text }),
651
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Designer, { children: card.designer })
652
+ ] })
653
+ ] })
654
+ ] });
655
+ };
656
+ var event_default = Event;
657
+
658
+ // src/cardtypes/plot.tsx
659
+ var import_jsx_runtime8 = require("react/jsx-runtime");
660
+ var Plot = ({ card, scale, orientation, rounded, className, style, ...props }) => {
661
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Card, { scale, card, orientation, rounded, className, style, ...props, children: [
662
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", height: px(40) }, children: [
663
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: px(4), width: px(110) }, children: [
664
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PlotStat, { type: "income", children: card.plotStats?.income }),
665
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PlotStat, { type: "initiative", children: card.plotStats?.initiative }),
666
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PlotStat, { type: "claim", children: card.plotStats?.claim })
667
+ ] }),
668
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Name, { style: { display: "flex", flexGrow: 1, fontSize: px(18) }, children: card.name })
669
+ ] }),
670
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexGrow: 1 }, children: [
671
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "column", width: px(35) }, children: [
672
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Type, { children: "Plot" }),
673
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DeckLimit, { type: card.type, style: { flexGrow: 1 }, children: card.deckLimit })
674
+ ] }),
675
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Watermark, { children: card.watermark }),
676
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: px(35), paddingRight: px(5) }, children: [
677
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Faction, { style: { borderColor: "transparent" }, children: card.faction }),
678
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Loyalty, { children: card.loyal }),
679
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PlotStat, { type: "reserve", children: card.plotStats?.reserve })
680
+ ] })
681
+ ] }),
682
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(TextBox, { style: { paddingBottom: px(0) }, children: [
683
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Traits, { children: card.traits }),
684
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(autoSize_default, { height: 60, style: { display: "flex", flexDirection: "column" }, children: [
685
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Ability, { children: card.text }),
686
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Designer, { children: card.designer })
687
+ ] })
688
+ ] })
689
+ ] });
690
+ };
691
+ var plot_default = Plot;
692
+
693
+ // src/cardtypes/agenda.tsx
694
+ var import_jsx_runtime9 = require("react/jsx-runtime");
695
+ var Agenda = ({ card, scale, orientation, rounded, className, style, ...props }) => {
696
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Card, { scale, card, orientation, rounded, className, styles: { inner: { display: "flex", flexDirection: "column" } }, style, ...props, children: [
697
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
698
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Name, { children: card.name }),
699
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Type, { style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: "Agenda" })
700
+ ] }),
701
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { flexGrow: 1, position: "relative", display: "flex" }, children: [
702
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DeckLimit, { type: card.type, style: { position: "absolute", height: "100%" }, children: card.deckLimit }),
703
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Watermark, { children: card.watermark })
704
+ ] }),
705
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(TextBox, { children: [
706
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Traits, { children: card.traits }),
707
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(autoSize_default, { height: 130, style: { display: "flex", flexDirection: "column" }, children: [
708
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Ability, { children: card.text }),
709
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Designer, { children: card.designer })
710
+ ] })
711
+ ] })
712
+ ] });
713
+ };
714
+ var agenda_default = Agenda;
715
+
716
+ // src/index.tsx
717
+ var import_react3 = require("react");
718
+ var import_jsx_runtime10 = require("react/jsx-runtime");
719
+ var CardPreview = ({ card, scale, orientation, rounded, className, style, ...props }) => {
720
+ const CardComponent = (0, import_react3.useMemo)(() => {
721
+ switch (card.type) {
722
+ case "character":
723
+ return character_default;
724
+ case "location":
725
+ return location_default;
726
+ case "attachment":
727
+ return attachment_default;
728
+ case "event":
729
+ return event_default;
730
+ case "plot":
731
+ return plot_default;
732
+ case "agenda":
733
+ return agenda_default;
734
+ default:
735
+ return Card;
736
+ }
737
+ }, [card.type]);
738
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CardComponent, { card, scale, orientation, rounded, className, style, ...props });
739
+ };
740
+ var index_default = CardPreview;