@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 +26 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +26 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -685,6 +685,8 @@ declare class MenuView extends ControlView {
|
|
|
685
685
|
private childViews;
|
|
686
686
|
private readonly titleKey;
|
|
687
687
|
private readonly maxWidth;
|
|
688
|
+
/** `ui` proxy with a light theme — feeds the shared block renderer dark-on-white. */
|
|
689
|
+
private readonly lightUi;
|
|
688
690
|
private vpW;
|
|
689
691
|
private vpH;
|
|
690
692
|
private scrollY;
|
package/dist/index.d.ts
CHANGED
|
@@ -685,6 +685,8 @@ declare class MenuView extends ControlView {
|
|
|
685
685
|
private childViews;
|
|
686
686
|
private readonly titleKey;
|
|
687
687
|
private readonly maxWidth;
|
|
688
|
+
/** `ui` proxy with a light theme — feeds the shared block renderer dark-on-white. */
|
|
689
|
+
private readonly lightUi;
|
|
688
690
|
private vpW;
|
|
689
691
|
private vpH;
|
|
690
692
|
private scrollY;
|
package/dist/index.js
CHANGED
|
@@ -2780,6 +2780,14 @@ function paytableCell(r, ui, cellW, lineH) {
|
|
|
2780
2780
|
var MARGIN = 16;
|
|
2781
2781
|
var HEADER_H = 60;
|
|
2782
2782
|
var INSET = 22;
|
|
2783
|
+
var LIGHT = {
|
|
2784
|
+
surface: "#ffffff",
|
|
2785
|
+
surfaceAlt: "#eef1f6",
|
|
2786
|
+
text: "#181b20",
|
|
2787
|
+
textDim: "#5b6472",
|
|
2788
|
+
border: "#000000",
|
|
2789
|
+
accent: "#d99000"
|
|
2790
|
+
};
|
|
2783
2791
|
var MenuView = class extends ControlView {
|
|
2784
2792
|
constructor(panel, controls, blocks, ui, ticker, opts = {}) {
|
|
2785
2793
|
super(panel, ui);
|
|
@@ -2791,9 +2799,11 @@ var MenuView = class extends ControlView {
|
|
|
2791
2799
|
this.zIndex = 120;
|
|
2792
2800
|
this.titleKey = opts.title ?? "Menu";
|
|
2793
2801
|
this.maxWidth = opts.maxWidth ?? 1600;
|
|
2802
|
+
const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT.surface, surfaceAlt: LIGHT.surfaceAlt, text: LIGHT.text, textDim: LIGHT.textDim, accent: LIGHT.accent } };
|
|
2803
|
+
this.lightUi = new Proxy(ui, { get: (t, p) => p === "theme" ? lightTheme : Reflect.get(t, p) });
|
|
2794
2804
|
this.backdrop.eventMode = "static";
|
|
2795
2805
|
this.backdrop.on("pointertap", () => this.panel.closePanel());
|
|
2796
|
-
this.title = new Text({ text: ui.t(this.titleKey), style: { fontFamily: ui.theme.type.family, fontSize: 24, fill:
|
|
2806
|
+
this.title = new Text({ text: ui.t(this.titleKey), style: { fontFamily: ui.theme.type.family, fontSize: 24, fill: LIGHT.text, fontWeight: "800", letterSpacing: 1 } });
|
|
2797
2807
|
this.title.anchor.set(0, 0.5);
|
|
2798
2808
|
this.buildClose();
|
|
2799
2809
|
this.viewport.addChild(this.catcher, this.content);
|
|
@@ -2834,6 +2844,8 @@ var MenuView = class extends ControlView {
|
|
|
2834
2844
|
childViews = [];
|
|
2835
2845
|
titleKey;
|
|
2836
2846
|
maxWidth;
|
|
2847
|
+
/** `ui` proxy with a light theme — feeds the shared block renderer dark-on-white. */
|
|
2848
|
+
lightUi;
|
|
2837
2849
|
vpW = 0;
|
|
2838
2850
|
vpH = 0;
|
|
2839
2851
|
scrollY = 0;
|
|
@@ -2842,10 +2854,9 @@ var MenuView = class extends ControlView {
|
|
|
2842
2854
|
lastY = 0;
|
|
2843
2855
|
wheelHandler;
|
|
2844
2856
|
buildClose() {
|
|
2845
|
-
const t = this.ui.theme;
|
|
2846
2857
|
const r = 22;
|
|
2847
|
-
const bg = new Graphics().circle(0, 0, r).fill({ color:
|
|
2848
|
-
const x = new Graphics().moveTo(-7, -7).lineTo(7, 7).moveTo(7, -7).lineTo(-7, 7).stroke({ width: 3, color:
|
|
2858
|
+
const bg = new Graphics().circle(0, 0, r).fill({ color: LIGHT.border });
|
|
2859
|
+
const x = new Graphics().moveTo(-7, -7).lineTo(7, 7).moveTo(7, -7).lineTo(-7, 7).stroke({ width: 3, color: "#ffffff", cap: "round" });
|
|
2849
2860
|
this.closeBtn.addChild(bg, x);
|
|
2850
2861
|
this.closeBtn.eventMode = "static";
|
|
2851
2862
|
this.closeBtn.cursor = "pointer";
|
|
@@ -2857,7 +2868,7 @@ var MenuView = class extends ControlView {
|
|
|
2857
2868
|
this.childViews.length = 0;
|
|
2858
2869
|
for (const child of this.content.removeChildren()) child.destroy();
|
|
2859
2870
|
const bodyW = this.vpW > 0 ? this.vpW : Math.min(this.maxWidth - INSET * 2, 520);
|
|
2860
|
-
const col = buildBlockColumn(this.blocks, this.controls, this.
|
|
2871
|
+
const col = buildBlockColumn(this.blocks, this.controls, this.lightUi, this.ticker, bodyW, { controlSkins: this.opts.controlSkins, dropdownLayer: this.dropdownLayer });
|
|
2861
2872
|
this.childViews = col.views;
|
|
2862
2873
|
this.content.addChild(...col.content.removeChildren());
|
|
2863
2874
|
this.content.x = bodyW / 2;
|
|
@@ -2869,16 +2880,15 @@ var MenuView = class extends ControlView {
|
|
|
2869
2880
|
const H = screen.height;
|
|
2870
2881
|
this.position.set(0, 0);
|
|
2871
2882
|
this.scale.set(1);
|
|
2872
|
-
|
|
2873
|
-
this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.62 });
|
|
2883
|
+
this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
|
|
2874
2884
|
this.backdrop.hitArea = new Rectangle(0, 0, W, H);
|
|
2875
2885
|
const marginX = Math.max(MARGIN, Math.round(W * 0.05));
|
|
2876
2886
|
const cardW = Math.min(W - marginX * 2, this.maxWidth);
|
|
2877
2887
|
const cardH = H - MARGIN * 2;
|
|
2878
2888
|
const cx = (W - cardW) / 2;
|
|
2879
2889
|
const cy = MARGIN;
|
|
2880
|
-
this.card.clear().roundRect(cx, cy, cardW, cardH,
|
|
2881
|
-
this.headerBar.clear().roundRect(cx, cy, cardW, HEADER_H,
|
|
2890
|
+
this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT.surface }).stroke({ width: 2.5, color: LIGHT.border });
|
|
2891
|
+
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 });
|
|
2882
2892
|
this.title.position.set(cx + INSET, cy + HEADER_H / 2);
|
|
2883
2893
|
this.closeBtn.position.set(cx + cardW - INSET - 8, cy + HEADER_H / 2);
|
|
2884
2894
|
const vpX = cx + INSET;
|
|
@@ -3054,7 +3064,7 @@ var INSET2 = 24;
|
|
|
3054
3064
|
var BTN_H = 52;
|
|
3055
3065
|
var BTN_GAP = 14;
|
|
3056
3066
|
var ROW_GAP = 16;
|
|
3057
|
-
var
|
|
3067
|
+
var LIGHT2 = {
|
|
3058
3068
|
surface: "#ffffff",
|
|
3059
3069
|
surfaceAlt: "#eef1f6",
|
|
3060
3070
|
text: "#181b20",
|
|
@@ -3073,7 +3083,7 @@ var DialogView = class extends ControlView {
|
|
|
3073
3083
|
this.opts = opts;
|
|
3074
3084
|
this.zIndex = 130;
|
|
3075
3085
|
this.maxWidth = opts.maxWidth ?? 520;
|
|
3076
|
-
const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface:
|
|
3086
|
+
const lightTheme = { ...ui.theme, color: { ...ui.theme.color, surface: LIGHT2.surface, surfaceAlt: LIGHT2.surfaceAlt, text: LIGHT2.text, textDim: LIGHT2.textDim } };
|
|
3077
3087
|
this.lightUi = new Proxy(ui, { get: (t, p) => p === "theme" ? lightTheme : Reflect.get(t, p) });
|
|
3078
3088
|
this.backdrop.eventMode = "static";
|
|
3079
3089
|
this.backdrop.on("pointertap", () => {
|
|
@@ -3119,7 +3129,7 @@ var DialogView = class extends ControlView {
|
|
|
3119
3129
|
lightUi;
|
|
3120
3130
|
buildClose() {
|
|
3121
3131
|
const r = 22;
|
|
3122
|
-
const bg = new Graphics().circle(0, 0, r).fill({ color:
|
|
3132
|
+
const bg = new Graphics().circle(0, 0, r).fill({ color: LIGHT2.primary });
|
|
3123
3133
|
const x = new Graphics().moveTo(-7, -7).lineTo(7, 7).moveTo(7, -7).lineTo(-7, 7).stroke({ width: 3, color: "#ffffff", cap: "round" });
|
|
3124
3134
|
this.closeBtn.addChild(bg, x);
|
|
3125
3135
|
this.closeBtn.eventMode = "static";
|
|
@@ -3156,7 +3166,7 @@ var DialogView = class extends ControlView {
|
|
|
3156
3166
|
const cy = (H - cardH) / 2;
|
|
3157
3167
|
this.backdrop.clear().rect(0, 0, W, H).fill({ color: 0, alpha: 0.5 });
|
|
3158
3168
|
this.backdrop.hitArea = new Rectangle(0, 0, W, H);
|
|
3159
|
-
this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color:
|
|
3169
|
+
this.card.clear().roundRect(cx, cy, cardW, cardH, 14).fill({ color: LIGHT2.surface }).stroke({ width: 2.5, color: LIGHT2.border });
|
|
3160
3170
|
const bodyH = cardH - (buttonsH ? ROW_GAP + buttonsH + INSET2 : INSET2);
|
|
3161
3171
|
this.content.x = cx + cardW / 2;
|
|
3162
3172
|
this.content.y = cy;
|
|
@@ -3195,7 +3205,7 @@ var DialogView = class extends ControlView {
|
|
|
3195
3205
|
const bg = new Graphics();
|
|
3196
3206
|
const label = new Text({
|
|
3197
3207
|
text: this.ui.t(action.label),
|
|
3198
|
-
style: { fontFamily: t.type.family, fontSize: 18, fontWeight: "800", fill: variant === "primary" ?
|
|
3208
|
+
style: { fontFamily: t.type.family, fontSize: 18, fontWeight: "800", fill: variant === "primary" ? LIGHT2.primaryText : LIGHT2.text, letterSpacing: 0.5 }
|
|
3199
3209
|
});
|
|
3200
3210
|
label.anchor.set(0.5);
|
|
3201
3211
|
node.addChild(bg, label);
|
|
@@ -3214,9 +3224,9 @@ var DialogView = class extends ControlView {
|
|
|
3214
3224
|
drawButton(bg, variant, width) {
|
|
3215
3225
|
bg.clear();
|
|
3216
3226
|
if (variant === "primary") {
|
|
3217
|
-
bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color:
|
|
3227
|
+
bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT2.primary });
|
|
3218
3228
|
} else {
|
|
3219
|
-
bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color:
|
|
3229
|
+
bg.roundRect(-width / 2, -BTN_H / 2, width, BTN_H, BTN_H / 2).fill({ color: LIGHT2.surface }).stroke({ width: 2.5, color: LIGHT2.border });
|
|
3220
3230
|
}
|
|
3221
3231
|
}
|
|
3222
3232
|
applyOpen(open) {
|