@open-slot-ui/pixi 0.1.1 → 0.2.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
@@ -1513,7 +1513,7 @@ var TurboView = class extends ControlView {
1513
1513
  } else {
1514
1514
  this.art.addChild(this.bg);
1515
1515
  }
1516
- this.addChild(this.art, this.pips);
1516
+ this.addChild(this.art);
1517
1517
  this.eventMode = "static";
1518
1518
  this.cursor = "pointer";
1519
1519
  this.hitArea = new pixi_js.Circle(0, 0, (this.sprite ? this.target / 2 : this.radius) + 8);
@@ -1528,7 +1528,6 @@ var TurboView = class extends ControlView {
1528
1528
  turbo;
1529
1529
  art = new pixi_js.Container();
1530
1530
  bg = new pixi_js.Graphics();
1531
- pips = new pixi_js.Graphics();
1532
1531
  sprite;
1533
1532
  tween;
1534
1533
  modeTex;
@@ -1565,19 +1564,6 @@ var TurboView = class extends ControlView {
1565
1564
  this.bg.circle(0, 0, r).fill({ color: lit ? th.color.accent : th.color.surface, alpha: lit ? Math.min(1, 0.55 + i * 0.25) : 1 }).stroke({ width: 4, color: th.color.accent });
1566
1565
  this.bg.poly([-6, -r * 0.42, 8, -4, 0, -4, 7, r * 0.42, -9, 2, 0, 2]).fill({ color: lit ? th.color.accentText : th.color.accent, alpha: disabled ? 0.5 : 1 });
1567
1566
  }
1568
- this.pips.clear();
1569
- const steps = this.turbo.modeCount - 1;
1570
- if (steps >= 2) {
1571
- const baseR = this.sprite ? this.target / 2 : this.radius;
1572
- const gap = 16;
1573
- const total = (steps - 1) * gap;
1574
- const y = baseR + 14;
1575
- for (let s = 0; s < steps; s++) {
1576
- const x = -total / 2 + s * gap;
1577
- const on = s < i;
1578
- this.pips.circle(x, y, 5).fill({ color: on ? th.color.accent : th.color.surface, alpha: disabled ? 0.5 : 1 }).stroke({ width: 2, color: th.color.accent, alpha: disabled ? 0.5 : 1 });
1579
- }
1580
- }
1581
1567
  }
1582
1568
  play(t) {
1583
1569
  this.animating = true;
@@ -2796,6 +2782,14 @@ function paytableCell(r, ui, cellW, lineH) {
2796
2782
  var MARGIN = 16;
2797
2783
  var HEADER_H = 60;
2798
2784
  var INSET = 22;
2785
+ var LIGHT = {
2786
+ surface: "#ffffff",
2787
+ surfaceAlt: "#eef1f6",
2788
+ text: "#181b20",
2789
+ textDim: "#5b6472",
2790
+ border: "#000000",
2791
+ accent: "#d99000"
2792
+ };
2799
2793
  var MenuView = class extends ControlView {
2800
2794
  constructor(panel, controls, blocks, ui, ticker, opts = {}) {
2801
2795
  super(panel, ui);
@@ -2807,9 +2801,11 @@ var MenuView = class extends ControlView {
2807
2801
  this.zIndex = 120;
2808
2802
  this.titleKey = opts.title ?? "Menu";
2809
2803
  this.maxWidth = opts.maxWidth ?? 1600;
2804
+ const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT.surface, surfaceAlt: LIGHT.surfaceAlt, text: LIGHT.text, textDim: LIGHT.textDim, accent: LIGHT.accent } };
2805
+ this.lightUi = new Proxy(ui, { get: (t, p) => p === "theme" ? lightTheme : Reflect.get(t, p) });
2810
2806
  this.backdrop.eventMode = "static";
2811
2807
  this.backdrop.on("pointertap", () => this.panel.closePanel());
2812
- this.title = new pixi_js.Text({ text: ui.t(this.titleKey), style: { fontFamily: ui.theme.type.family, fontSize: 24, fill: ui.theme.color.text, fontWeight: "800", letterSpacing: 1 } });
2808
+ this.title = new pixi_js.Text({ text: ui.t(this.titleKey), style: { fontFamily: ui.theme.type.family, fontSize: 24, fill: LIGHT.text, fontWeight: "800", letterSpacing: 1 } });
2813
2809
  this.title.anchor.set(0, 0.5);
2814
2810
  this.buildClose();
2815
2811
  this.viewport.addChild(this.catcher, this.content);
@@ -2850,6 +2846,8 @@ var MenuView = class extends ControlView {
2850
2846
  childViews = [];
2851
2847
  titleKey;
2852
2848
  maxWidth;
2849
+ /** `ui` proxy with a light theme — feeds the shared block renderer dark-on-white. */
2850
+ lightUi;
2853
2851
  vpW = 0;
2854
2852
  vpH = 0;
2855
2853
  scrollY = 0;
@@ -2858,10 +2856,9 @@ var MenuView = class extends ControlView {
2858
2856
  lastY = 0;
2859
2857
  wheelHandler;
2860
2858
  buildClose() {
2861
- const t = this.ui.theme;
2862
2859
  const r = 22;
2863
- const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: t.color.surfaceAlt }).stroke({ width: 2, color: t.color.textDim });
2864
- const x = new pixi_js.Graphics().moveTo(-7, -7).lineTo(7, 7).moveTo(7, -7).lineTo(-7, 7).stroke({ width: 3, color: t.color.text });
2860
+ const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: LIGHT.border });
2861
+ const x = new pixi_js.Graphics().moveTo(-7, -7).lineTo(7, 7).moveTo(7, -7).lineTo(-7, 7).stroke({ width: 3, color: "#ffffff", cap: "round" });
2865
2862
  this.closeBtn.addChild(bg, x);
2866
2863
  this.closeBtn.eventMode = "static";
2867
2864
  this.closeBtn.cursor = "pointer";
@@ -2873,7 +2870,7 @@ var MenuView = class extends ControlView {
2873
2870
  this.childViews.length = 0;
2874
2871
  for (const child of this.content.removeChildren()) child.destroy();
2875
2872
  const bodyW = this.vpW > 0 ? this.vpW : Math.min(this.maxWidth - INSET * 2, 520);
2876
- const col = buildBlockColumn(this.blocks, this.controls, this.ui, this.ticker, bodyW, { controlSkins: this.opts.controlSkins, dropdownLayer: this.dropdownLayer });
2873
+ const col = buildBlockColumn(this.blocks, this.controls, this.lightUi, this.ticker, bodyW, { controlSkins: this.opts.controlSkins, dropdownLayer: this.dropdownLayer });
2877
2874
  this.childViews = col.views;
2878
2875
  this.content.addChild(...col.content.removeChildren());
2879
2876
  this.content.x = bodyW / 2;
@@ -2885,16 +2882,15 @@ var MenuView = class extends ControlView {
2885
2882
  const H = screen.height;
2886
2883
  this.position.set(0, 0);
2887
2884
  this.scale.set(1);
2888
- const t = this.ui.theme;
2889
- this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.62 });
2885
+ this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
2890
2886
  this.backdrop.hitArea = new pixi_js.Rectangle(0, 0, W, H);
2891
2887
  const marginX = Math.max(MARGIN, Math.round(W * 0.05));
2892
2888
  const cardW = Math.min(W - marginX * 2, this.maxWidth);
2893
2889
  const cardH = H - MARGIN * 2;
2894
2890
  const cx = (W - cardW) / 2;
2895
2891
  const cy = MARGIN;
2896
- this.card.clear().roundRect(cx, cy, cardW, cardH, t.radius.card).fill({ color: t.color.surface }).stroke({ width: 2, color: t.color.accent });
2897
- this.headerBar.clear().roundRect(cx, cy, cardW, HEADER_H, t.radius.card).fill({ color: t.color.surfaceAlt }).moveTo(cx + INSET, cy + HEADER_H).lineTo(cx + cardW - INSET, cy + HEADER_H).stroke({ width: 1, color: t.color.textDim, alpha: 0.3 });
2892
+ this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT.surface }).stroke({ width: 2.5, color: LIGHT.border });
2893
+ this.headerBar.clear().roundRect(cx, cy, cardW, HEADER_H, 14).fill({ color: LIGHT.surfaceAlt }).moveTo(cx + INSET, cy + HEADER_H).lineTo(cx + cardW - INSET, cy + HEADER_H).stroke({ width: 1, color: LIGHT.textDim, alpha: 0.4 });
2898
2894
  this.title.position.set(cx + INSET, cy + HEADER_H / 2);
2899
2895
  this.closeBtn.position.set(cx + cardW - INSET - 8, cy + HEADER_H / 2);
2900
2896
  const vpX = cx + INSET;
@@ -3070,7 +3066,7 @@ var INSET2 = 24;
3070
3066
  var BTN_H = 52;
3071
3067
  var BTN_GAP = 14;
3072
3068
  var ROW_GAP = 16;
3073
- var LIGHT = {
3069
+ var LIGHT2 = {
3074
3070
  surface: "#ffffff",
3075
3071
  surfaceAlt: "#eef1f6",
3076
3072
  text: "#181b20",
@@ -3089,7 +3085,7 @@ var DialogView = class extends ControlView {
3089
3085
  this.opts = opts;
3090
3086
  this.zIndex = 130;
3091
3087
  this.maxWidth = opts.maxWidth ?? 520;
3092
- const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT.surface, surfaceAlt: LIGHT.surfaceAlt, text: LIGHT.text, textDim: LIGHT.textDim } };
3088
+ const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT2.surface, surfaceAlt: LIGHT2.surfaceAlt, text: LIGHT2.text, textDim: LIGHT2.textDim } };
3093
3089
  this.lightUi = new Proxy(ui, { get: (t, p) => p === "theme" ? lightTheme : Reflect.get(t, p) });
3094
3090
  this.backdrop.eventMode = "static";
3095
3091
  this.backdrop.on("pointertap", () => {
@@ -3135,7 +3131,7 @@ var DialogView = class extends ControlView {
3135
3131
  lightUi;
3136
3132
  buildClose() {
3137
3133
  const r = 22;
3138
- const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: LIGHT.primary });
3134
+ const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: LIGHT2.primary });
3139
3135
  const x = new pixi_js.Graphics().moveTo(-7, -7).lineTo(7, 7).moveTo(7, -7).lineTo(-7, 7).stroke({ width: 3, color: "#ffffff", cap: "round" });
3140
3136
  this.closeBtn.addChild(bg, x);
3141
3137
  this.closeBtn.eventMode = "static";
@@ -3172,7 +3168,7 @@ var DialogView = class extends ControlView {
3172
3168
  const cy = (H - cardH) / 2;
3173
3169
  this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
3174
3170
  this.backdrop.hitArea = new pixi_js.Rectangle(0, 0, W, H);
3175
- this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT.surface }).stroke({ width: 2.5, color: LIGHT.border });
3171
+ this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT2.surface }).stroke({ width: 2.5, color: LIGHT2.border });
3176
3172
  const bodyH = cardH - (buttonsH ? ROW_GAP + buttonsH + INSET2 : INSET2);
3177
3173
  this.content.x = cx + cardW / 2;
3178
3174
  this.content.y = cy;
@@ -3211,7 +3207,7 @@ var DialogView = class extends ControlView {
3211
3207
  const bg = new pixi_js.Graphics();
3212
3208
  const label = new pixi_js.Text({
3213
3209
  text: this.ui.t(action.label),
3214
- style: { fontFamily: t.type.family, fontSize: 18, fontWeight: "800", fill: variant === "primary" ? LIGHT.primaryText : LIGHT.text, letterSpacing: 0.5 }
3210
+ style: { fontFamily: t.type.family, fontSize: 18, fontWeight: "800", fill: variant === "primary" ? LIGHT2.primaryText : LIGHT2.text, letterSpacing: 0.5 }
3215
3211
  });
3216
3212
  label.anchor.set(0.5);
3217
3213
  node.addChild(bg, label);
@@ -3230,9 +3226,9 @@ var DialogView = class extends ControlView {
3230
3226
  drawButton(bg, variant, width) {
3231
3227
  bg.clear();
3232
3228
  if (variant === "primary") {
3233
- bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT.primary });
3229
+ bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT2.primary });
3234
3230
  } else {
3235
- bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT.surface }).stroke({ width: 2.5, color: LIGHT.border });
3231
+ bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT2.surface }).stroke({ width: 2.5, color: LIGHT2.border });
3236
3232
  }
3237
3233
  }
3238
3234
  applyOpen(open) {
@@ -3929,7 +3925,7 @@ function mountHud(app, spec = {}, opts = {}) {
3929
3925
  ui.showNotice(
3930
3926
  [
3931
3927
  { kind: "heading", id: "buy-title", text: o.title ?? "openui.buyFeature.title" },
3932
- { kind: "callout", id: "buy-body", tone: "bonus", text: o.message ?? "openui.buyFeature.message" }
3928
+ { kind: "text", id: "buy-body", text: o.message ?? "openui.buyFeature.message" }
3933
3929
  ],
3934
3930
  [
3935
3931
  { label: o.cancelLabel ?? "openui.cancel", variant: "secondary" },