lighteningcards 2.1.9 → 2.2.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.cjs.js +18 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +18 -13
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/LighteningCard.css +3 -3
- package/src/components/LightningCardHTML.js +2 -0
- package/src/utils/generateBaccaratCardHTMLSVG.js +37 -14
package/dist/index.cjs.js
CHANGED
|
@@ -45197,9 +45197,10 @@ const useBaccaratCardStart = () => {
|
|
|
45197
45197
|
* @param {string} rank - The card rank (e.g., "5", "A", "K", "Q", "J", "10", "9", etc.)
|
|
45198
45198
|
* @param {string} suit - The card suit (e.g., "hearts", "diamonds", "clubs", "spades")
|
|
45199
45199
|
* @param {boolean} isMatching - Whether this is a matching card (changes colors)
|
|
45200
|
+
* @param {boolean} isMobile - Whether to use mobile sizing for rank/suit
|
|
45200
45201
|
* @returns {string} SVG code as a string matching the HTML structure
|
|
45201
45202
|
*/
|
|
45202
|
-
const generateBaccaratCardHTMLSVG = (rank, suit, isMatching = false) => {
|
|
45203
|
+
const generateBaccaratCardHTMLSVG = (rank, suit, isMatching = false, isMobile = false) => {
|
|
45203
45204
|
// Format rank for display
|
|
45204
45205
|
const formatRank = r => {
|
|
45205
45206
|
if (!r) return "";
|
|
@@ -45258,10 +45259,14 @@ const generateBaccaratCardHTMLSVG = (rank, suit, isMatching = false) => {
|
|
|
45258
45259
|
const isTen = displayRank === "10";
|
|
45259
45260
|
|
|
45260
45261
|
// Position values based on whether rank is "10" or not
|
|
45261
|
-
const rankXTop = isTen ? "5" : "15";
|
|
45262
|
-
const suitXTop = isTen ? "125" : "100";
|
|
45263
|
-
const rankXBottom = isTen ? "-10" : "10";
|
|
45264
|
-
const suitXBottom = isTen ? "115" : "100";
|
|
45262
|
+
const rankXTop = isTen ? isMobile ? "10" : "5" : isMobile ? "18" : "15";
|
|
45263
|
+
const suitXTop = isTen ? isMobile ? "110" : "125" : isMobile ? "110" : "100";
|
|
45264
|
+
const rankXBottom = isTen ? isMobile ? "0" : "-10" : isMobile ? "12" : "10";
|
|
45265
|
+
const suitXBottom = isTen ? isMobile ? "100" : "115" : isMobile ? "100" : "100";
|
|
45266
|
+
const rankY = isMobile ? "18" : "25";
|
|
45267
|
+
const suitY = isMobile ? "15" : "10";
|
|
45268
|
+
const rankFontSize = isMobile ? "72" : "100";
|
|
45269
|
+
const suitFontSize = isMobile ? "84" : "115";
|
|
45265
45270
|
|
|
45266
45271
|
// Determine colors based on matching status
|
|
45267
45272
|
let bgColor = "#2D2926";
|
|
@@ -45289,9 +45294,9 @@ const generateBaccaratCardHTMLSVG = (rank, suit, isMatching = false) => {
|
|
|
45289
45294
|
// The HTML uses viewBox="0 0 180 250" and uses symbols
|
|
45290
45295
|
// We'll create a complete SVG that matches the visual appearance
|
|
45291
45296
|
return `
|
|
45292
|
-
<svg viewBox="0 0 180 250" class="card--32433 ${suitClass}" ${isMatching ? 'style="z-index: 100; position: relative;"' :
|
|
45297
|
+
<svg viewBox="0 0 180 250" class="card--32433 ${suitClass}" ${isMatching ? 'style="z-index: 100; position: relative;"' : ""} xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
45293
45298
|
<defs>
|
|
45294
|
-
<linearGradient id="card-bg-${isMatching ?
|
|
45299
|
+
<linearGradient id="card-bg-${isMatching ? "white" : "dark"}" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
45295
45300
|
<stop offset="0%" stop-color="${bgColor}" />
|
|
45296
45301
|
<stop offset="100%" stop-color="${bgColorEnd}" />
|
|
45297
45302
|
</linearGradient>
|
|
@@ -45309,13 +45314,13 @@ const generateBaccaratCardHTMLSVG = (rank, suit, isMatching = false) => {
|
|
|
45309
45314
|
</defs>
|
|
45310
45315
|
<g>
|
|
45311
45316
|
<!-- Rank at top left corner -->
|
|
45312
|
-
<text x="${rankXTop}" y="
|
|
45317
|
+
<text x="${rankXTop}" y="${rankY}" font-family="Arial, sans-serif" font-size="${rankFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${displayRank}</text>
|
|
45313
45318
|
<!-- Suit at top left, below rank -->
|
|
45314
|
-
<text x="${suitXTop}" y="
|
|
45319
|
+
<text x="${suitXTop}" y="${suitY}" font-family="Arial, sans-serif" font-size="${suitFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${getSuitSymbol(suitLower)}</text>
|
|
45315
45320
|
<!-- Rank and suit at bottom right (rotated 180 degrees) -->
|
|
45316
45321
|
<g transform="rotate(180, 90, 125)">
|
|
45317
|
-
<text x="${rankXBottom}" y="
|
|
45318
|
-
<text x="${suitXBottom}" y="
|
|
45322
|
+
<text x="${rankXBottom}" y="${rankY}" font-family="Arial, sans-serif" font-size="${rankFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${displayRank}</text>
|
|
45323
|
+
<text x="${suitXBottom}" y="${suitY}" font-family="Arial, sans-serif" font-size="${suitFontSize}" font-weight="750" fill="${fillColor}" text-anchor="start" dominant-baseline="hanging">${getSuitSymbol(suitLower)}</text>
|
|
45319
45324
|
</g>
|
|
45320
45325
|
</g>
|
|
45321
45326
|
</svg>
|
|
@@ -45625,7 +45630,7 @@ const LightningCardHTML = ({
|
|
|
45625
45630
|
var _card$multiplier, _card$suit;
|
|
45626
45631
|
const multiplier = (_card$multiplier = card.multiplier) !== null && _card$multiplier !== void 0 ? _card$multiplier : card.multplier;
|
|
45627
45632
|
const isMatching = isMatchingCard(card);
|
|
45628
|
-
const cardSvg = generateBaccaratCardHTMLSVG(card.rank, card.suit, isMatching);
|
|
45633
|
+
const cardSvg = generateBaccaratCardHTMLSVG(card.rank, card.suit, isMatching, !isDesktop);
|
|
45629
45634
|
const cardId = `${card.rank || ""}${((_card$suit = card.suit) === null || _card$suit === void 0 || (_card$suit = _card$suit[0]) === null || _card$suit === void 0 ? void 0 : _card$suit.toUpperCase()) || ""}`;
|
|
45630
45635
|
return /*#__PURE__*/React.createElement("div", {
|
|
45631
45636
|
key: `card-${cardId}-${index}-${multiplier || 0}`,
|
|
@@ -45719,7 +45724,7 @@ const LightningCardHTML = ({
|
|
|
45719
45724
|
var _card$multiplier2, _card$suit2;
|
|
45720
45725
|
const multiplier = (_card$multiplier2 = card.multiplier) !== null && _card$multiplier2 !== void 0 ? _card$multiplier2 : card.multplier;
|
|
45721
45726
|
const isMatching = isMatchingCard(card);
|
|
45722
|
-
const cardSvg = generateBaccaratCardHTMLSVG(card.rank, card.suit, isMatching);
|
|
45727
|
+
const cardSvg = generateBaccaratCardHTMLSVG(card.rank, card.suit, isMatching, !isDesktop);
|
|
45723
45728
|
const cardId = `${card.rank || ""}${((_card$suit2 = card.suit) === null || _card$suit2 === void 0 || (_card$suit2 = _card$suit2[0]) === null || _card$suit2 === void 0 ? void 0 : _card$suit2.toUpperCase()) || ""}`;
|
|
45724
45729
|
const actualIndex = index + 3; // Continue index from first row
|
|
45725
45730
|
|