@open-slot-ui/pixi 0.2.0 → 0.2.2

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
@@ -1708,16 +1708,17 @@ var AutoplayView = class extends ControlView {
1708
1708
  const st = this.auto.current;
1709
1709
  this.countText.visible = false;
1710
1710
  const th = this.ui.theme;
1711
- const r = this.sprite ? this.target / 2 : this.radius;
1712
1711
  const active = st === "active";
1713
1712
  this.eventMode = active ? "none" : "static";
1714
1713
  this.cursor = active ? "default" : "pointer";
1715
1714
  if (active) {
1716
- this.bg.clear().circle(0, 0, r).fill({ color: th.color.accent }).stroke({ width: 4, color: th.color.accentText });
1715
+ this.bg.clear();
1717
1716
  if (this.sprite) {
1718
1717
  this.sprite.visible = true;
1719
- this.sprite.tint = th.color.accentText;
1720
- this.sprite.alpha = 0.55;
1718
+ this.sprite.tint = th.color.accent;
1719
+ this.sprite.alpha = 0.9;
1720
+ } else {
1721
+ this.bg.circle(0, 0, this.radius).fill({ color: th.color.accent }).stroke({ width: 4, color: th.color.accentText });
1721
1722
  }
1722
1723
  return;
1723
1724
  }
@@ -2782,6 +2783,14 @@ function paytableCell(r, ui, cellW, lineH) {
2782
2783
  var MARGIN = 16;
2783
2784
  var HEADER_H = 60;
2784
2785
  var INSET = 22;
2786
+ var LIGHT = {
2787
+ surface: "#ffffff",
2788
+ surfaceAlt: "#eef1f6",
2789
+ text: "#181b20",
2790
+ textDim: "#5b6472",
2791
+ border: "#000000",
2792
+ accent: "#d99000"
2793
+ };
2785
2794
  var MenuView = class extends ControlView {
2786
2795
  constructor(panel, controls, blocks, ui, ticker, opts = {}) {
2787
2796
  super(panel, ui);
@@ -2793,9 +2802,11 @@ var MenuView = class extends ControlView {
2793
2802
  this.zIndex = 120;
2794
2803
  this.titleKey = opts.title ?? "Menu";
2795
2804
  this.maxWidth = opts.maxWidth ?? 1600;
2805
+ const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT.surface, surfaceAlt: LIGHT.surfaceAlt, text: LIGHT.text, textDim: LIGHT.textDim, accent: LIGHT.accent } };
2806
+ this.lightUi = new Proxy(ui, { get: (t, p) => p === "theme" ? lightTheme : Reflect.get(t, p) });
2796
2807
  this.backdrop.eventMode = "static";
2797
2808
  this.backdrop.on("pointertap", () => this.panel.closePanel());
2798
- 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 } });
2809
+ 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 } });
2799
2810
  this.title.anchor.set(0, 0.5);
2800
2811
  this.buildClose();
2801
2812
  this.viewport.addChild(this.catcher, this.content);
@@ -2836,6 +2847,8 @@ var MenuView = class extends ControlView {
2836
2847
  childViews = [];
2837
2848
  titleKey;
2838
2849
  maxWidth;
2850
+ /** `ui` proxy with a light theme — feeds the shared block renderer dark-on-white. */
2851
+ lightUi;
2839
2852
  vpW = 0;
2840
2853
  vpH = 0;
2841
2854
  scrollY = 0;
@@ -2844,10 +2857,9 @@ var MenuView = class extends ControlView {
2844
2857
  lastY = 0;
2845
2858
  wheelHandler;
2846
2859
  buildClose() {
2847
- const t = this.ui.theme;
2848
2860
  const r = 22;
2849
- const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: t.color.surfaceAlt }).stroke({ width: 2, color: t.color.textDim });
2850
- 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 });
2861
+ const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: LIGHT.border });
2862
+ 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" });
2851
2863
  this.closeBtn.addChild(bg, x);
2852
2864
  this.closeBtn.eventMode = "static";
2853
2865
  this.closeBtn.cursor = "pointer";
@@ -2859,7 +2871,7 @@ var MenuView = class extends ControlView {
2859
2871
  this.childViews.length = 0;
2860
2872
  for (const child of this.content.removeChildren()) child.destroy();
2861
2873
  const bodyW = this.vpW > 0 ? this.vpW : Math.min(this.maxWidth - INSET * 2, 520);
2862
- const col = buildBlockColumn(this.blocks, this.controls, this.ui, this.ticker, bodyW, { controlSkins: this.opts.controlSkins, dropdownLayer: this.dropdownLayer });
2874
+ const col = buildBlockColumn(this.blocks, this.controls, this.lightUi, this.ticker, bodyW, { controlSkins: this.opts.controlSkins, dropdownLayer: this.dropdownLayer });
2863
2875
  this.childViews = col.views;
2864
2876
  this.content.addChild(...col.content.removeChildren());
2865
2877
  this.content.x = bodyW / 2;
@@ -2871,16 +2883,15 @@ var MenuView = class extends ControlView {
2871
2883
  const H = screen.height;
2872
2884
  this.position.set(0, 0);
2873
2885
  this.scale.set(1);
2874
- const t = this.ui.theme;
2875
- this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.62 });
2886
+ this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
2876
2887
  this.backdrop.hitArea = new pixi_js.Rectangle(0, 0, W, H);
2877
2888
  const marginX = Math.max(MARGIN, Math.round(W * 0.05));
2878
2889
  const cardW = Math.min(W - marginX * 2, this.maxWidth);
2879
2890
  const cardH = H - MARGIN * 2;
2880
2891
  const cx = (W - cardW) / 2;
2881
2892
  const cy = MARGIN;
2882
- this.card.clear().roundRect(cx, cy, cardW, cardH, t.radius.card).fill({ color: t.color.surface }).stroke({ width: 2, color: t.color.accent });
2883
- 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 });
2893
+ this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT.surface }).stroke({ width: 2.5, color: LIGHT.border });
2894
+ 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 });
2884
2895
  this.title.position.set(cx + INSET, cy + HEADER_H / 2);
2885
2896
  this.closeBtn.position.set(cx + cardW - INSET - 8, cy + HEADER_H / 2);
2886
2897
  const vpX = cx + INSET;
@@ -3056,7 +3067,7 @@ var INSET2 = 24;
3056
3067
  var BTN_H = 52;
3057
3068
  var BTN_GAP = 14;
3058
3069
  var ROW_GAP = 16;
3059
- var LIGHT = {
3070
+ var LIGHT2 = {
3060
3071
  surface: "#ffffff",
3061
3072
  surfaceAlt: "#eef1f6",
3062
3073
  text: "#181b20",
@@ -3075,7 +3086,7 @@ var DialogView = class extends ControlView {
3075
3086
  this.opts = opts;
3076
3087
  this.zIndex = 130;
3077
3088
  this.maxWidth = opts.maxWidth ?? 520;
3078
- const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT.surface, surfaceAlt: LIGHT.surfaceAlt, text: LIGHT.text, textDim: LIGHT.textDim } };
3089
+ const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT2.surface, surfaceAlt: LIGHT2.surfaceAlt, text: LIGHT2.text, textDim: LIGHT2.textDim } };
3079
3090
  this.lightUi = new Proxy(ui, { get: (t, p) => p === "theme" ? lightTheme : Reflect.get(t, p) });
3080
3091
  this.backdrop.eventMode = "static";
3081
3092
  this.backdrop.on("pointertap", () => {
@@ -3121,7 +3132,7 @@ var DialogView = class extends ControlView {
3121
3132
  lightUi;
3122
3133
  buildClose() {
3123
3134
  const r = 22;
3124
- const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: LIGHT.primary });
3135
+ const bg = new pixi_js.Graphics().circle(0, 0, r).fill({ color: LIGHT2.primary });
3125
3136
  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" });
3126
3137
  this.closeBtn.addChild(bg, x);
3127
3138
  this.closeBtn.eventMode = "static";
@@ -3158,7 +3169,7 @@ var DialogView = class extends ControlView {
3158
3169
  const cy = (H - cardH) / 2;
3159
3170
  this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
3160
3171
  this.backdrop.hitArea = new pixi_js.Rectangle(0, 0, W, H);
3161
- this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT.surface }).stroke({ width: 2.5, color: LIGHT.border });
3172
+ this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT2.surface }).stroke({ width: 2.5, color: LIGHT2.border });
3162
3173
  const bodyH = cardH - (buttonsH ? ROW_GAP + buttonsH + INSET2 : INSET2);
3163
3174
  this.content.x = cx + cardW / 2;
3164
3175
  this.content.y = cy;
@@ -3197,7 +3208,7 @@ var DialogView = class extends ControlView {
3197
3208
  const bg = new pixi_js.Graphics();
3198
3209
  const label = new pixi_js.Text({
3199
3210
  text: this.ui.t(action.label),
3200
- style: { fontFamily: t.type.family, fontSize: 18, fontWeight: "800", fill: variant === "primary" ? LIGHT.primaryText : LIGHT.text, letterSpacing: 0.5 }
3211
+ style: { fontFamily: t.type.family, fontSize: 18, fontWeight: "800", fill: variant === "primary" ? LIGHT2.primaryText : LIGHT2.text, letterSpacing: 0.5 }
3201
3212
  });
3202
3213
  label.anchor.set(0.5);
3203
3214
  node.addChild(bg, label);
@@ -3216,9 +3227,9 @@ var DialogView = class extends ControlView {
3216
3227
  drawButton(bg, variant, width) {
3217
3228
  bg.clear();
3218
3229
  if (variant === "primary") {
3219
- bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT.primary });
3230
+ bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT2.primary });
3220
3231
  } else {
3221
- bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT.surface }).stroke({ width: 2.5, color: LIGHT.border });
3232
+ bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT2.surface }).stroke({ width: 2.5, color: LIGHT2.border });
3222
3233
  }
3223
3234
  }
3224
3235
  applyOpen(open) {