@open-slot-ui/core 0.12.1 → 0.13.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/index.cjs CHANGED
@@ -1279,6 +1279,7 @@ var BLOCK_KINDS = [
1279
1279
  "steps",
1280
1280
  "table",
1281
1281
  "paytable",
1282
+ "paylines",
1282
1283
  "image",
1283
1284
  "media",
1284
1285
  "cards",
@@ -1440,6 +1441,10 @@ function validateSpec(spec) {
1440
1441
  if (b.kind === "paytable" && (!b.rows || b.rows.length === 0)) {
1441
1442
  add("warn", `${p}.rows`, "empty-paytable", "a paytable block has no rows");
1442
1443
  }
1444
+ if (b.kind === "paylines") {
1445
+ if (!(b.reels > 0) || !(b.rows > 0)) add("error", `${p}.reels`, "paylines-shape", "a paylines block needs reels > 0 and rows > 0");
1446
+ if (!b.lines || b.lines.length === 0) add("warn", `${p}.lines`, "empty-paylines", "a paylines block has no lines");
1447
+ }
1443
1448
  if (b.kind === "image" && (!b.src || !b.src.trim())) {
1444
1449
  add("error", `${p}.src`, "image-src", "an image block needs a src");
1445
1450
  }
@@ -2921,6 +2926,15 @@ function renderBlocksHtml(blocks, tr, facts) {
2921
2926
  case "paytable":
2922
2927
  out.push(`<div class="ohm-grid">${renderPaytable(b.rows, tr)}</div>`);
2923
2928
  break;
2929
+ case "paylines": {
2930
+ const masks = b.lines.map((line, i) => {
2931
+ const cells = [];
2932
+ for (let row = 0; row < b.rows; row++) for (let reel = 0; reel < b.reels; reel++) cells.push(`<i class="${line[reel] === row ? "on" : ""}"></i>`);
2933
+ return `<div class="ohm-line"><div class="ohm-linegrid" style="grid-template-columns:repeat(${b.reels},1fr)">${cells.join("")}</div><span>${i + 1}</span></div>`;
2934
+ }).join("");
2935
+ out.push(`<div class="ohm-lines">${masks}</div>`);
2936
+ break;
2937
+ }
2924
2938
  case "table": {
2925
2939
  const head = b.columns?.length ? `<thead><tr>${b.columns.map((c) => `<th>${esc(tr(c))}</th>`).join("")}</tr></thead>` : "";
2926
2940
  const body = b.rows.map((r) => `<tr>${r.map((c) => `<td>${esc(tr(c))}</td>`).join("")}</tr>`).join("");