@open-slot-ui/core 0.10.0 → 0.11.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 +201 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +196 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2862,6 +2862,201 @@ function auditRulesDoc(doc, opts = {}) {
|
|
|
2862
2862
|
return auditRules(facts, doc.blocks, { resolve });
|
|
2863
2863
|
}
|
|
2864
2864
|
|
|
2865
|
+
// src/spec/rulesHtml.ts
|
|
2866
|
+
var escapeHtml = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2867
|
+
var richHtml = (s) => escapeHtml(s).replace(/\*\*(.+?)\*\*/g, "<b>$1</b>");
|
|
2868
|
+
var esc = escapeHtml;
|
|
2869
|
+
var rich = richHtml;
|
|
2870
|
+
function statGridHtml(items, tr) {
|
|
2871
|
+
const rows = items.map((it) => `<div><dt>${esc(tr(it.label))}</dt><dd>${esc(tr(it.value))}</dd></div>`).join("");
|
|
2872
|
+
return `<dl class="ohm-stats">${rows}</dl>`;
|
|
2873
|
+
}
|
|
2874
|
+
function renderPaytable(rows, tr) {
|
|
2875
|
+
return rows.map((r) => {
|
|
2876
|
+
const icon = r.icon ? `<img class="ohm-symimg" src="${r.icon}" alt="" loading="lazy">` : `<span class="ohm-emoji">${esc(tr(r.symbol ?? ""))}</span>`;
|
|
2877
|
+
const lines = r.payouts.split("\n").map((line) => {
|
|
2878
|
+
const i = line.indexOf(":");
|
|
2879
|
+
return i >= 0 ? `<div><b>${esc(line.slice(0, i))}</b><span>${esc(line.slice(i + 1))}</span></div>` : `<div><span>${esc(line)}</span></div>`;
|
|
2880
|
+
}).join("");
|
|
2881
|
+
return `<div class="ohm-sym">${icon}<div class="ohm-pay">${lines}</div></div>`;
|
|
2882
|
+
}).join("");
|
|
2883
|
+
}
|
|
2884
|
+
function renderBlocksHtml(blocks, tr, facts) {
|
|
2885
|
+
const out = [];
|
|
2886
|
+
for (const b of blocks) {
|
|
2887
|
+
switch (b.kind) {
|
|
2888
|
+
case "text":
|
|
2889
|
+
out.push(`<p>${rich(tr(b.text))}</p>`);
|
|
2890
|
+
break;
|
|
2891
|
+
case "heading":
|
|
2892
|
+
out.push(`<div class="ohm-sec"><span>${esc(tr(b.text))}</span></div>`);
|
|
2893
|
+
break;
|
|
2894
|
+
case "subheading":
|
|
2895
|
+
out.push(`<h4 class="ohm-subh">${esc(tr(b.text))}</h4>`);
|
|
2896
|
+
break;
|
|
2897
|
+
case "legal":
|
|
2898
|
+
out.push(`<p class="ohm-legal">${rich(tr(b.text))}</p>`);
|
|
2899
|
+
break;
|
|
2900
|
+
case "divider":
|
|
2901
|
+
out.push('<hr class="ohm-hr">');
|
|
2902
|
+
break;
|
|
2903
|
+
case "image":
|
|
2904
|
+
out.push(`<img class="ohm-feature" alt="${esc(tr(b.alt ?? ""))}" src="${b.src}" loading="lazy">`);
|
|
2905
|
+
break;
|
|
2906
|
+
case "media": {
|
|
2907
|
+
const img = `<img alt="${esc(tr(b.alt ?? ""))}" src="${b.src}" loading="lazy">`;
|
|
2908
|
+
const body = `<div class="ohm-media-body">${b.title ? `<h4>${esc(tr(b.title))}</h4>` : ""}<p>${rich(tr(b.text))}</p></div>`;
|
|
2909
|
+
out.push(`<div class="ohm-media ohm-media--${b.side ?? "left"}">${img}${body}</div>`);
|
|
2910
|
+
break;
|
|
2911
|
+
}
|
|
2912
|
+
case "cards": {
|
|
2913
|
+
const cards = b.items.map((it) => `<div class="ohm-fcard">${it.icon ? `<img src="${it.icon}" alt="" loading="lazy">` : ""}<h5>${esc(tr(it.title))}</h5>${it.text ? `<p>${rich(tr(it.text))}</p>` : ""}</div>`).join("");
|
|
2914
|
+
out.push(`<div class="ohm-cards">${cards}</div>`);
|
|
2915
|
+
break;
|
|
2916
|
+
}
|
|
2917
|
+
case "paytable":
|
|
2918
|
+
out.push(`<div class="ohm-grid">${renderPaytable(b.rows, tr)}</div>`);
|
|
2919
|
+
break;
|
|
2920
|
+
case "table": {
|
|
2921
|
+
const head = b.columns?.length ? `<thead><tr>${b.columns.map((c) => `<th>${esc(tr(c))}</th>`).join("")}</tr></thead>` : "";
|
|
2922
|
+
const body = b.rows.map((r) => `<tr>${r.map((c) => `<td>${esc(tr(c))}</td>`).join("")}</tr>`).join("");
|
|
2923
|
+
out.push(`<table class="ohm-table">${head}<tbody>${body}</tbody></table>`);
|
|
2924
|
+
break;
|
|
2925
|
+
}
|
|
2926
|
+
case "stat-grid":
|
|
2927
|
+
out.push(statGridHtml(b.items, tr));
|
|
2928
|
+
break;
|
|
2929
|
+
// The AUTO per-mode RTP / Max-win grid — rendered straight from the declared
|
|
2930
|
+
// game facts (+ any host extras), so the table can never drift from the config.
|
|
2931
|
+
// `modeStatsItems` localizes the label PARTS itself ("Max win" · the mode name),
|
|
2932
|
+
// so the grid renderer gets identity-tr — no double translation.
|
|
2933
|
+
case "mode-stats": {
|
|
2934
|
+
const extras = (b.extras ?? []).map((e) => ({ label: tr(e.label), value: tr(e.value) }));
|
|
2935
|
+
out.push(statGridHtml([...modeStatsItems(facts, tr), ...extras], (s) => s));
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2938
|
+
case "steps": {
|
|
2939
|
+
const items = b.items.map((s) => `<li>${rich(tr(s))}</li>`).join("");
|
|
2940
|
+
out.push(b.ordered ? `<ol class="ohm-steps">${items}</ol>` : `<ul class="ohm-steps">${items}</ul>`);
|
|
2941
|
+
break;
|
|
2942
|
+
}
|
|
2943
|
+
case "callout":
|
|
2944
|
+
out.push(`<div class="ohm-callout ohm-callout--${b.tone ?? "info"}">${b.title ? `<b>${esc(tr(b.title))}</b>` : ""}<p>${rich(tr(b.text))}</p></div>`);
|
|
2945
|
+
break;
|
|
2946
|
+
case "group":
|
|
2947
|
+
out.push(`<div class="ohm-group">${b.title ? `<h4 class="ohm-subh">${esc(tr(b.title))}</h4>` : ""}${renderBlocksHtml(b.children, tr, facts)}</div>`);
|
|
2948
|
+
break;
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
return out.join("\n");
|
|
2952
|
+
}
|
|
2953
|
+
function renderRulesAuditHtml(issues, tr) {
|
|
2954
|
+
if (!issues.length) return "";
|
|
2955
|
+
const req = issues.filter((i) => i.level === "required");
|
|
2956
|
+
const rec = issues.filter((i) => i.level === "recommended");
|
|
2957
|
+
const list = (items) => `<ul>${items.map((i) => `<li>${esc(tr(i.message))}</li>`).join("")}</ul>`;
|
|
2958
|
+
return `<div class="ohm-audit" role="alert">
|
|
2959
|
+
<div class="ohm-audit-title">\u26A0 ${esc(tr("openui.rulesAudit.title"))}</div>
|
|
2960
|
+
${req.length ? `<div class="ohm-audit-sub">${esc(tr("openui.rulesAudit.required"))}</div>${list(req)}` : ""}
|
|
2961
|
+
${rec.length ? `<div class="ohm-audit-sub ohm-audit-sub--rec">${esc(tr("openui.rulesAudit.recommended"))}</div><div class="ohm-audit-rec">${list(rec)}</div>` : ""}
|
|
2962
|
+
</div>`;
|
|
2963
|
+
}
|
|
2964
|
+
var INFO_MENU_VARS = Object.freeze({
|
|
2965
|
+
"--accent": "#d99000",
|
|
2966
|
+
"--accent-text": "#1a1200",
|
|
2967
|
+
"--surface": "#ffffff",
|
|
2968
|
+
"--surface-alt": "#eef1f6",
|
|
2969
|
+
"--text": "#181b20",
|
|
2970
|
+
"--text-dim": "#5b6472",
|
|
2971
|
+
"--card-radius": "8px",
|
|
2972
|
+
"--font": "system-ui, sans-serif"
|
|
2973
|
+
});
|
|
2974
|
+
var INFO_MENU_CSS = `
|
|
2975
|
+
.ohm-root { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; font-family: var(--font); opacity: 0; pointer-events: none; transition: opacity .18s ease; }
|
|
2976
|
+
.ohm-root.open { opacity: 1; pointer-events: auto; }
|
|
2977
|
+
.ohm-backdrop { position: absolute; inset: 0; background: rgba(8,6,4,0); backdrop-filter: blur(0px) saturate(1); -webkit-backdrop-filter: blur(0px) saturate(1); transition: background .4s ease, backdrop-filter .4s ease, -webkit-backdrop-filter .4s ease; }
|
|
2978
|
+
.ohm-root.open .ohm-backdrop { background: rgba(8,6,4,.34); backdrop-filter: blur(6px) saturate(1.1); -webkit-backdrop-filter: blur(6px) saturate(1.1); }
|
|
2979
|
+
.ohm-card { position: relative; width: min(92%, 1100px); max-height: 86vh; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1.5px solid #000; border-radius: var(--card-radius); box-shadow: 0 30px 80px rgba(0,0,0,.5); overflow: hidden; transform: translateY(8px) scale(.99); transition: transform .18s ease; }
|
|
2980
|
+
.ohm-root.open .ohm-card { transform: none; }
|
|
2981
|
+
.ohm-x { position: absolute; top: 18px; right: 22px; width: 46px; height: 46px; border-radius: 999px; border: 0; background: rgba(18,14,10,.82); color: #fff; font-size: 18px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.45); z-index: 2; transition: transform .12s, background .12s; }
|
|
2982
|
+
.ohm-x:hover { transform: scale(1.08); background: rgba(18,14,10,.95); }
|
|
2983
|
+
.ohm-body { padding: 24px 26px 26px; overflow-y: scroll; }
|
|
2984
|
+
.ohm-body::-webkit-scrollbar { width: 18px; }
|
|
2985
|
+
.ohm-body::-webkit-scrollbar-track { background: transparent; margin: 12px 0; }
|
|
2986
|
+
.ohm-body::-webkit-scrollbar-thumb { background-color: #111; border: 6px solid transparent; background-clip: padding-box; border-radius: 999px; min-height: 44px; }
|
|
2987
|
+
.ohm-body::-webkit-scrollbar-thumb:hover { background-color: #000; }
|
|
2988
|
+
.ohm-logo { display: block; margin: 6px auto 18px; max-width: 64%; height: auto; }
|
|
2989
|
+
.ohm-logo-text { margin: 6px 0 18px; text-align: center; font-size: 30px; font-weight: 900; letter-spacing: 1px; color: var(--text); }
|
|
2990
|
+
.ohm-sec { display: flex; align-items: center; gap: 14px; margin: 26px 0 14px; color: var(--text); font-weight: 800; letter-spacing: 1px; }
|
|
2991
|
+
.ohm-sec::before, .ohm-sec::after { content: ""; flex: 1; height: 2px; background: color-mix(in srgb, var(--text) 80%, transparent); border-radius: 2px; }
|
|
2992
|
+
.ohm-root *, .ohm-root *::before, .ohm-root *::after { box-sizing: border-box; }
|
|
2993
|
+
.ohm-row { display: flex; align-items: center; gap: 16px; margin: 14px 0; font-weight: 700; }
|
|
2994
|
+
.ohm-setting { margin: 14px 0; }
|
|
2995
|
+
.ohm-setting .ohm-row { margin: 0; }
|
|
2996
|
+
.ohm-hint { margin: 3px 0 0; font-size: 12.5px; font-weight: 500; color: var(--text-dim); }
|
|
2997
|
+
.ohm-row > span:first-child { flex: none; min-width: 110px; }
|
|
2998
|
+
.ohm-row input[type=range] { flex: 1; min-width: 0; max-width: min(440px, 60dvw); accent-color: var(--accent); height: 6px; }
|
|
2999
|
+
.ohm-row select { flex: 1; min-width: 0; max-width: min(440px, 60dvw); padding: 11px 14px; border-radius: 4px; border: 2px solid var(--accent); background: var(--surface-alt); color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer; }
|
|
3000
|
+
.ohm-row select option { background: var(--surface); color: var(--text); font-weight: 600; }
|
|
3001
|
+
.ohm-row select option:checked { background: var(--accent); color: var(--accent-text); }
|
|
3002
|
+
.ohm-ctl { flex: 1; min-width: 0; max-width: min(440px, 60dvw); display: flex; align-items: center; justify-content: flex-end; }
|
|
3003
|
+
.ohm-check input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 50px; height: 28px; border-radius: 999px; background: color-mix(in srgb, var(--text-dim) 38%, transparent); position: relative; cursor: pointer; transition: background .15s; flex: none; }
|
|
3004
|
+
.ohm-check input[type=checkbox]:checked { background: var(--accent); }
|
|
3005
|
+
.ohm-check input[type=checkbox]::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
|
|
3006
|
+
.ohm-check input[type=checkbox]:checked::before { left: 25px; }
|
|
3007
|
+
.ohm-segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-alt); border-radius: 999px; border: 1px solid color-mix(in srgb, var(--text-dim) 30%, transparent); }
|
|
3008
|
+
.ohm-seg { border: 0; background: transparent; color: var(--text-dim); font-weight: 700; font-size: 14px; padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: background .12s, color .12s; }
|
|
3009
|
+
.ohm-seg.active { background: var(--accent); color: var(--accent-text); }
|
|
3010
|
+
.ohm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
|
|
3011
|
+
.ohm-sym { display: flex; align-items: center; gap: 16px; padding: 6px 4px; }
|
|
3012
|
+
.ohm-emoji { font-size: 48px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
|
|
3013
|
+
.ohm-symimg { width: 56px; height: 56px; object-fit: contain; flex: none; }
|
|
3014
|
+
.ohm-pay { font-size: 13px; line-height: 1.6; }
|
|
3015
|
+
.ohm-pay div { display: flex; gap: 6px; }
|
|
3016
|
+
.ohm-pay b { min-width: 42px; }
|
|
3017
|
+
.ohm-pay span { color: var(--accent); font-weight: 700; }
|
|
3018
|
+
.ohm-body p { color: var(--text-dim); line-height: 1.6; }
|
|
3019
|
+
.ohm-body p b { color: var(--text); }
|
|
3020
|
+
.ohm-feature { display: block; width: 100%; height: auto; margin: 10px 0; }
|
|
3021
|
+
.ohm-stats { margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
|
|
3022
|
+
.ohm-stats > div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--text-dim) 20%, transparent); }
|
|
3023
|
+
.ohm-stats dt { color: var(--text-dim); margin: 0; } .ohm-stats dd { margin: 0; font-weight: 700; }
|
|
3024
|
+
.ohm-audit { margin: 12px 0 18px; padding: 14px 16px; border-radius: 12px; border: 2px solid #d03131; background: color-mix(in srgb, #d03131 8%, transparent); }
|
|
3025
|
+
.ohm-audit-title { font-weight: 900; letter-spacing: .5px; color: #b31d1d; }
|
|
3026
|
+
.ohm-audit-sub { margin-top: 8px; font-size: 13px; font-weight: 800; color: #b31d1d; }
|
|
3027
|
+
.ohm-audit-sub--rec { color: #b07d09; }
|
|
3028
|
+
.ohm-audit ul { margin: 6px 0 0; padding-left: 20px; color: var(--text); font-size: 13.5px; line-height: 1.55; }
|
|
3029
|
+
.ohm-audit li { margin: 3px 0; }
|
|
3030
|
+
.ohm-audit-rec ul { color: var(--text-dim); }
|
|
3031
|
+
.ohm-callout { margin: 16px 0 4px; padding: 14px 16px; border-radius: 12px; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
|
|
3032
|
+
.ohm-callout b { color: var(--accent); } .ohm-callout p { margin: 4px 0 0; color: var(--text); }
|
|
3033
|
+
.ohm-callout--warning { border-left-color: #e0a106; background: color-mix(in srgb, #e0a106 10%, transparent); }
|
|
3034
|
+
.ohm-callout--warning b { color: #b07d09; }
|
|
3035
|
+
.ohm-subh { margin: 22px 0 8px; font-size: 15px; font-weight: 800; letter-spacing: .5px; color: var(--text); }
|
|
3036
|
+
.ohm-legal { font-size: 12px; line-height: 1.6; color: var(--text-dim); opacity: .85; }
|
|
3037
|
+
.ohm-hr { border: 0; border-top: 1px solid color-mix(in srgb, var(--text-dim) 30%, transparent); margin: 18px 0; }
|
|
3038
|
+
.ohm-media { display: flex; align-items: center; gap: 18px; margin: 14px 0; }
|
|
3039
|
+
.ohm-media--right { flex-direction: row-reverse; }
|
|
3040
|
+
.ohm-media > img { width: 40%; max-width: 320px; height: auto; flex: none; }
|
|
3041
|
+
.ohm-media-body { flex: 1; }
|
|
3042
|
+
.ohm-media-body h4 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
|
|
3043
|
+
.ohm-media-body p { margin: 0; }
|
|
3044
|
+
.ohm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
|
|
3045
|
+
.ohm-fcard { padding: 8px 6px; text-align: center; }
|
|
3046
|
+
.ohm-fcard img { display: block; width: 48px; height: 48px; margin: 0 auto 8px; }
|
|
3047
|
+
.ohm-fcard h5 { margin: 0 0 4px; font-size: 14px; color: var(--text); }
|
|
3048
|
+
.ohm-fcard p { margin: 0; font-size: 12px; line-height: 1.5; }
|
|
3049
|
+
.ohm-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
|
|
3050
|
+
.ohm-table th { text-align: left; padding: 8px 10px; font-weight: 800; color: var(--text); border-bottom: 2px solid color-mix(in srgb, var(--text-dim) 35%, transparent); }
|
|
3051
|
+
.ohm-table td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--text-dim) 18%, transparent); }
|
|
3052
|
+
.ohm-table td:first-child { color: var(--text); font-weight: 700; }
|
|
3053
|
+
.ohm-table td:not(:first-child) { color: var(--accent); font-weight: 700; }
|
|
3054
|
+
.ohm-steps { margin: 12px 0; padding-left: 22px; color: var(--text-dim); line-height: 1.7; }
|
|
3055
|
+
.ohm-steps li { margin: 5px 0; }
|
|
3056
|
+
.ohm-steps b { color: var(--text); }
|
|
3057
|
+
.ohm-group { margin: 8px 0; }
|
|
3058
|
+
`;
|
|
3059
|
+
|
|
2865
3060
|
// src/spec/defaultHudSpec.ts
|
|
2866
3061
|
var defaultHudSpec = Object.freeze({
|
|
2867
3062
|
meta: { id: "open-ui-reference-hud", version: 1 },
|
|
@@ -2980,6 +3175,8 @@ exports.DictionaryTranslator = DictionaryTranslator;
|
|
|
2980
3175
|
exports.EventBus = EventBus;
|
|
2981
3176
|
exports.EventLog = EventLog;
|
|
2982
3177
|
exports.Fade = Fade;
|
|
3178
|
+
exports.INFO_MENU_CSS = INFO_MENU_CSS;
|
|
3179
|
+
exports.INFO_MENU_VARS = INFO_MENU_VARS;
|
|
2983
3180
|
exports.LOCALE_LABELS = LOCALE_LABELS;
|
|
2984
3181
|
exports.OpenUI = OpenUI;
|
|
2985
3182
|
exports.PanelControl = PanelControl;
|
|
@@ -3025,6 +3222,7 @@ exports.dictionary = dictionary;
|
|
|
3025
3222
|
exports.displayDigits = displayDigits;
|
|
3026
3223
|
exports.effect = effect;
|
|
3027
3224
|
exports.errorBlocks = errorBlocks;
|
|
3225
|
+
exports.escapeHtml = escapeHtml;
|
|
3028
3226
|
exports.extendTheme = extendTheme;
|
|
3029
3227
|
exports.factsVars = factsVars;
|
|
3030
3228
|
exports.findForbiddenPhrases = findForbiddenPhrases;
|
|
@@ -3044,11 +3242,14 @@ exports.neededDecimals = neededDecimals;
|
|
|
3044
3242
|
exports.openuiDefaults = openuiDefaults;
|
|
3045
3243
|
exports.openuiSocialDefaults = openuiSocialDefaults;
|
|
3046
3244
|
exports.portraitDefaultLayouts = portraitDefaultLayouts;
|
|
3245
|
+
exports.renderBlocksHtml = renderBlocksHtml;
|
|
3246
|
+
exports.renderRulesAuditHtml = renderRulesAuditHtml;
|
|
3047
3247
|
exports.resolveBetLadder = resolveBetLadder;
|
|
3048
3248
|
exports.resolveCurrency = resolveCurrency;
|
|
3049
3249
|
exports.resolvePlacement = resolvePlacement;
|
|
3050
3250
|
exports.resolveTheme = resolveTheme;
|
|
3051
3251
|
exports.resolveTurboModes = resolveTurboModes;
|
|
3252
|
+
exports.richHtml = richHtml;
|
|
3052
3253
|
exports.safeAmount = safeAmount;
|
|
3053
3254
|
exports.sanitizeThemeOverrides = sanitizeThemeOverrides;
|
|
3054
3255
|
exports.themePresets = themePresets;
|