@open-slot-ui/pixi 0.2.0 → 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
@@ -2782,6 +2782,14 @@ function paytableCell(r, ui, cellW, lineH) {
2782
2782
  var MARGIN = 16;
2783
2783
  var HEADER_H = 60;
2784
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
+ };
2785
2793
  var MenuView = class extends ControlView {
2786
2794
  constructor(panel, controls, blocks, ui, ticker, opts = {}) {
2787
2795
  super(panel, ui);
@@ -2793,9 +2801,11 @@ var MenuView = class extends ControlView {
2793
2801
  this.zIndex = 120;
2794
2802
  this.titleKey = opts.title ?? "Menu";
2795
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) });
2796
2806
  this.backdrop.eventMode = "static";
2797
2807
  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 } });
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 } });
2799
2809
  this.title.anchor.set(0, 0.5);
2800
2810
  this.buildClose();
2801
2811
  this.viewport.addChild(this.catcher, this.content);
@@ -2836,6 +2846,8 @@ var MenuView = class extends ControlView {
2836
2846
  childViews = [];
2837
2847
  titleKey;
2838
2848
  maxWidth;
2849
+ /** `ui` proxy with a light theme — feeds the shared block renderer dark-on-white. */
2850
+ lightUi;
2839
2851
  vpW = 0;
2840
2852
  vpH = 0;
2841
2853
  scrollY = 0;
@@ -2844,10 +2856,9 @@ var MenuView = class extends ControlView {
2844
2856
  lastY = 0;
2845
2857
  wheelHandler;
2846
2858
  buildClose() {
2847
- const t = this.ui.theme;
2848
2859
  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 });
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" });
2851
2862
  this.closeBtn.addChild(bg, x);
2852
2863
  this.closeBtn.eventMode = "static";
2853
2864
  this.closeBtn.cursor = "pointer";
@@ -2859,7 +2870,7 @@ var MenuView = class extends ControlView {
2859
2870
  this.childViews.length = 0;
2860
2871
  for (const child of this.content.removeChildren()) child.destroy();
2861
2872
  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 });
2873
+ const col = buildBlockColumn(this.blocks, this.controls, this.lightUi, this.ticker, bodyW, { controlSkins: this.opts.controlSkins, dropdownLayer: this.dropdownLayer });
2863
2874
  this.childViews = col.views;
2864
2875
  this.content.addChild(...col.content.removeChildren());
2865
2876
  this.content.x = bodyW / 2;
@@ -2871,16 +2882,15 @@ var MenuView = class extends ControlView {
2871
2882
  const H = screen.height;
2872
2883
  this.position.set(0, 0);
2873
2884
  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 });
2885
+ this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
2876
2886
  this.backdrop.hitArea = new pixi_js.Rectangle(0, 0, W, H);
2877
2887
  const marginX = Math.max(MARGIN, Math.round(W * 0.05));
2878
2888
  const cardW = Math.min(W - marginX * 2, this.maxWidth);
2879
2889
  const cardH = H - MARGIN * 2;
2880
2890
  const cx = (W - cardW) / 2;
2881
2891
  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 });
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 });
2884
2894
  this.title.position.set(cx + INSET, cy + HEADER_H / 2);
2885
2895
  this.closeBtn.position.set(cx + cardW - INSET - 8, cy + HEADER_H / 2);
2886
2896
  const vpX = cx + INSET;
@@ -3056,7 +3066,7 @@ var INSET2 = 24;
3056
3066
  var BTN_H = 52;
3057
3067
  var BTN_GAP = 14;
3058
3068
  var ROW_GAP = 16;
3059
- var LIGHT = {
3069
+ var LIGHT2 = {
3060
3070
  surface: "#ffffff",
3061
3071
  surfaceAlt: "#eef1f6",
3062
3072
  text: "#181b20",
@@ -3075,7 +3085,7 @@ var DialogView = class extends ControlView {
3075
3085
  this.opts = opts;
3076
3086
  this.zIndex = 130;
3077
3087
  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 } };
3088
+ const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT2.surface, surfaceAlt: LIGHT2.surfaceAlt, text: LIGHT2.text, textDim: LIGHT2.textDim } };
3079
3089
  this.lightUi = new Proxy(ui, { get: (t, p) => p === "theme" ? lightTheme : Reflect.get(t, p) });
3080
3090
  this.backdrop.eventMode = "static";
3081
3091
  this.backdrop.on("pointertap", () => {
@@ -3121,7 +3131,7 @@ var DialogView = class extends ControlView {
3121
3131
  lightUi;
3122
3132
  buildClose() {
3123
3133
  const r = 22;
3124
- 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 });
3125
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" });
3126
3136
  this.closeBtn.addChild(bg, x);
3127
3137
  this.closeBtn.eventMode = "static";
@@ -3158,7 +3168,7 @@ var DialogView = class extends ControlView {
3158
3168
  const cy = (H - cardH) / 2;
3159
3169
  this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
3160
3170
  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 });
3171
+ this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT2.surface }).stroke({ width: 2.5, color: LIGHT2.border });
3162
3172
  const bodyH = cardH - (buttonsH ? ROW_GAP + buttonsH + INSET2 : INSET2);
3163
3173
  this.content.x = cx + cardW / 2;
3164
3174
  this.content.y = cy;
@@ -3197,7 +3207,7 @@ var DialogView = class extends ControlView {
3197
3207
  const bg = new pixi_js.Graphics();
3198
3208
  const label = new pixi_js.Text({
3199
3209
  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 }
3210
+ style: { fontFamily: t.type.family, fontSize: 18, fontWeight: "800", fill: variant === "primary" ? LIGHT2.primaryText : LIGHT2.text, letterSpacing: 0.5 }
3201
3211
  });
3202
3212
  label.anchor.set(0.5);
3203
3213
  node.addChild(bg, label);
@@ -3216,9 +3226,9 @@ var DialogView = class extends ControlView {
3216
3226
  drawButton(bg, variant, width) {
3217
3227
  bg.clear();
3218
3228
  if (variant === "primary") {
3219
- 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 });
3220
3230
  } 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 });
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 });
3222
3232
  }
3223
3233
  }
3224
3234
  applyOpen(open) {