@open-slot-ui/core 0.12.1 → 0.13.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.d.cts CHANGED
@@ -1756,6 +1756,12 @@ type BlockSpec = {
1756
1756
  payouts: string;
1757
1757
  icon?: string;
1758
1758
  }>;
1759
+ } | {
1760
+ kind: 'paylines';
1761
+ id: string;
1762
+ reels: number;
1763
+ rows: number;
1764
+ lines: number[][];
1759
1765
  } | {
1760
1766
  kind: 'image';
1761
1767
  id: string;
@@ -1795,7 +1801,7 @@ type BlockSpec = {
1795
1801
  children: BlockSpec[];
1796
1802
  });
1797
1803
  /** All block kinds, for runtime validation of untyped host data. */
1798
- declare const BLOCK_KINDS: readonly ["slider", "toggle", "button", "select", "stepper", "value", "text", "heading", "subheading", "callout", "stat-grid", "mode-stats", "steps", "table", "paytable", "image", "media", "cards", "legal", "divider", "group"];
1804
+ declare const BLOCK_KINDS: readonly ["slider", "toggle", "button", "select", "stepper", "value", "text", "heading", "subheading", "callout", "stat-grid", "mode-stats", "steps", "table", "paytable", "paylines", "image", "media", "cards", "legal", "divider", "group"];
1799
1805
  interface PanelSpec {
1800
1806
  id: string;
1801
1807
  variant: PanelVariant;
package/dist/index.d.ts CHANGED
@@ -1756,6 +1756,12 @@ type BlockSpec = {
1756
1756
  payouts: string;
1757
1757
  icon?: string;
1758
1758
  }>;
1759
+ } | {
1760
+ kind: 'paylines';
1761
+ id: string;
1762
+ reels: number;
1763
+ rows: number;
1764
+ lines: number[][];
1759
1765
  } | {
1760
1766
  kind: 'image';
1761
1767
  id: string;
@@ -1795,7 +1801,7 @@ type BlockSpec = {
1795
1801
  children: BlockSpec[];
1796
1802
  });
1797
1803
  /** All block kinds, for runtime validation of untyped host data. */
1798
- declare const BLOCK_KINDS: readonly ["slider", "toggle", "button", "select", "stepper", "value", "text", "heading", "subheading", "callout", "stat-grid", "mode-stats", "steps", "table", "paytable", "image", "media", "cards", "legal", "divider", "group"];
1804
+ declare const BLOCK_KINDS: readonly ["slider", "toggle", "button", "select", "stepper", "value", "text", "heading", "subheading", "callout", "stat-grid", "mode-stats", "steps", "table", "paytable", "paylines", "image", "media", "cards", "legal", "divider", "group"];
1799
1805
  interface PanelSpec {
1800
1806
  id: string;
1801
1807
  variant: PanelVariant;
package/dist/index.js CHANGED
@@ -1277,6 +1277,7 @@ var BLOCK_KINDS = [
1277
1277
  "steps",
1278
1278
  "table",
1279
1279
  "paytable",
1280
+ "paylines",
1280
1281
  "image",
1281
1282
  "media",
1282
1283
  "cards",
@@ -1438,6 +1439,10 @@ function validateSpec(spec) {
1438
1439
  if (b.kind === "paytable" && (!b.rows || b.rows.length === 0)) {
1439
1440
  add("warn", `${p}.rows`, "empty-paytable", "a paytable block has no rows");
1440
1441
  }
1442
+ if (b.kind === "paylines") {
1443
+ if (!(b.reels > 0) || !(b.rows > 0)) add("error", `${p}.reels`, "paylines-shape", "a paylines block needs reels > 0 and rows > 0");
1444
+ if (!b.lines || b.lines.length === 0) add("warn", `${p}.lines`, "empty-paylines", "a paylines block has no lines");
1445
+ }
1441
1446
  if (b.kind === "image" && (!b.src || !b.src.trim())) {
1442
1447
  add("error", `${p}.src`, "image-src", "an image block needs a src");
1443
1448
  }
@@ -2919,6 +2924,15 @@ function renderBlocksHtml(blocks, tr, facts) {
2919
2924
  case "paytable":
2920
2925
  out.push(`<div class="ohm-grid">${renderPaytable(b.rows, tr)}</div>`);
2921
2926
  break;
2927
+ case "paylines": {
2928
+ const masks = b.lines.map((line, i) => {
2929
+ const cells = [];
2930
+ 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>`);
2931
+ 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>`;
2932
+ }).join("");
2933
+ out.push(`<div class="ohm-lines">${masks}</div>`);
2934
+ break;
2935
+ }
2922
2936
  case "table": {
2923
2937
  const head = b.columns?.length ? `<thead><tr>${b.columns.map((c) => `<th>${esc(tr(c))}</th>`).join("")}</tr></thead>` : "";
2924
2938
  const body = b.rows.map((r) => `<tr>${r.map((c) => `<td>${esc(tr(c))}</td>`).join("")}</tr>`).join("");