@modlock/modlock 0.1.95 → 0.1.97
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/chat.d.ts +9 -1
- package/index.js +59 -27
- package/package.json +6 -6
- package/ui.d.ts +6 -0
package/chat.d.ts
CHANGED
|
@@ -8,9 +8,17 @@ export interface ChatLinesOptions {
|
|
|
8
8
|
readonly lines?: number;
|
|
9
9
|
/**
|
|
10
10
|
* bottom is the lane's distance from the bottom of the screen, in pixels on
|
|
11
|
-
* a 1080 screen; unless set, it sits
|
|
11
|
+
* a 1080 screen; unless set, it sits a little above the ability bar.
|
|
12
12
|
*/
|
|
13
13
|
readonly bottom?: number;
|
|
14
|
+
/**
|
|
15
|
+
* scale sizes each line, its text, portrait, band and spacing together,
|
|
16
|
+
* against the default of 1: 0.8 draws the text at 13 pixels on a band at
|
|
17
|
+
* most 448 wide. Sizes round to whole pixels.
|
|
18
|
+
*/
|
|
19
|
+
readonly scale?: number;
|
|
20
|
+
/** portraits shows each speaker's portrait before their name; true unless set. */
|
|
21
|
+
readonly portraits?: boolean;
|
|
14
22
|
/**
|
|
15
23
|
* speaker says how viewer sees a line's speaker, for a mode whose sides are
|
|
16
24
|
* not the game's teams or that keeps a hero secret. Unset fields, and an
|
package/index.js
CHANGED
|
@@ -11784,7 +11784,8 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
11784
11784
|
[36, "cues", 11, 1, Cue.codec],
|
|
11785
11785
|
[37, "ability_bar_presses", 8],
|
|
11786
11786
|
[38, "ability_display", 11, 1, AbilityRow.codec],
|
|
11787
|
-
[39, "clock", 11, 0, Clock.codec]
|
|
11787
|
+
[39, "clock", 11, 0, Clock.codec],
|
|
11788
|
+
[40, "hide_in_chat", 8]
|
|
11788
11789
|
],
|
|
11789
11790
|
{
|
|
11790
11791
|
decode: (r, end, m) => {
|
|
@@ -11953,6 +11954,9 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
11953
11954
|
case 39:
|
|
11954
11955
|
m.clock = Clock.decode(r, r.delimited(), m.clock ?? {});
|
|
11955
11956
|
break;
|
|
11957
|
+
case 40:
|
|
11958
|
+
m.hideInChat = r.bool();
|
|
11959
|
+
break;
|
|
11956
11960
|
default:
|
|
11957
11961
|
r.skip(t);
|
|
11958
11962
|
}
|
|
@@ -12130,6 +12134,10 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
12130
12134
|
const v = m.clock;
|
|
12131
12135
|
if (v != null) Clock.writeField(w, 39, v);
|
|
12132
12136
|
}
|
|
12137
|
+
{
|
|
12138
|
+
const v = m.hideInChat;
|
|
12139
|
+
if (v) w.uint32(320).bool(v);
|
|
12140
|
+
}
|
|
12133
12141
|
}
|
|
12134
12142
|
}
|
|
12135
12143
|
);
|
|
@@ -16763,25 +16771,43 @@ function chatLines(viewer) {
|
|
|
16763
16771
|
}
|
|
16764
16772
|
if (readable.length === 0) return void 0;
|
|
16765
16773
|
const kept = readable.slice(-(shown.lines ?? 4));
|
|
16774
|
+
const size = sizesFor(shown.scale ?? 1, shown.portraits ?? true);
|
|
16766
16775
|
return {
|
|
16767
16776
|
type: "panel",
|
|
16768
16777
|
props: {
|
|
16778
|
+
hideInChat: true,
|
|
16769
16779
|
style: {
|
|
16770
16780
|
flow: "down",
|
|
16771
16781
|
horizontalAlign: "center",
|
|
16772
16782
|
verticalAlign: "bottom",
|
|
16773
|
-
margin: [0, 0, shown.bottom ??
|
|
16783
|
+
margin: [0, 0, shown.bottom ?? laneBottom, 0]
|
|
16774
16784
|
},
|
|
16775
16785
|
children: kept.map(
|
|
16776
|
-
(line2, at3) => subtitle(line2, viewer, kept.length - 1 - at3)
|
|
16786
|
+
(line2, at3) => subtitle(line2, viewer, kept.length - 1 - at3, size)
|
|
16777
16787
|
)
|
|
16778
16788
|
}
|
|
16779
16789
|
};
|
|
16780
16790
|
}
|
|
16781
|
-
var
|
|
16782
|
-
|
|
16783
|
-
|
|
16784
|
-
|
|
16791
|
+
var laneBottom = 230;
|
|
16792
|
+
function sizesFor(scale2, portraits3) {
|
|
16793
|
+
const px = (n) => Math.max(1, Math.round(n * scale2));
|
|
16794
|
+
const portrait = portraits3 ? px(20) : 0;
|
|
16795
|
+
const pad = [px(2), px(8), px(3), portraits3 ? px(3) : px(8)];
|
|
16796
|
+
const gap2 = [portraits3 ? px(6) : 0, px(7)];
|
|
16797
|
+
const nameWidth = px(160);
|
|
16798
|
+
return {
|
|
16799
|
+
text: px(16),
|
|
16800
|
+
name: px(14),
|
|
16801
|
+
lineHeight: px(20),
|
|
16802
|
+
portrait,
|
|
16803
|
+
nameWidth,
|
|
16804
|
+
lineWidth: px(560) - pad[1] - pad[3] - portrait - gap2[0] - nameWidth - gap2[1],
|
|
16805
|
+
pad,
|
|
16806
|
+
gap: gap2,
|
|
16807
|
+
space: px(3),
|
|
16808
|
+
radius: px(3)
|
|
16809
|
+
};
|
|
16810
|
+
}
|
|
16785
16811
|
var fades = [1, 0.85, 0.7];
|
|
16786
16812
|
var lifted = {
|
|
16787
16813
|
amber: "#f0a73a",
|
|
@@ -16791,11 +16817,10 @@ var words = {
|
|
|
16791
16817
|
face: "body",
|
|
16792
16818
|
weight: "bold",
|
|
16793
16819
|
verticalAlign: "top",
|
|
16794
|
-
lineHeight: 23,
|
|
16795
16820
|
textAlign: "left"
|
|
16796
16821
|
};
|
|
16797
16822
|
var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
|
|
16798
|
-
function subtitle(line2, viewer, age) {
|
|
16823
|
+
function subtitle(line2, viewer, age, size) {
|
|
16799
16824
|
const pawn = line2.speaker.pawn();
|
|
16800
16825
|
const seen = shown?.speaker?.(line2.speaker, viewer) ?? {};
|
|
16801
16826
|
const tone = teamTones[pawn?.team ?? 0];
|
|
@@ -16807,14 +16832,17 @@ function subtitle(line2, viewer, age) {
|
|
|
16807
16832
|
type: "panel",
|
|
16808
16833
|
props: {
|
|
16809
16834
|
style: {
|
|
16810
|
-
width:
|
|
16811
|
-
height:
|
|
16835
|
+
width: size.portrait,
|
|
16836
|
+
height: size.portrait,
|
|
16812
16837
|
verticalAlign: "top",
|
|
16813
|
-
borderRadius:
|
|
16838
|
+
borderRadius: Math.max(1, size.radius - 1),
|
|
16814
16839
|
background: shades.raised,
|
|
16815
16840
|
saturation: seen.out ? 0 : 1
|
|
16816
16841
|
},
|
|
16817
|
-
|
|
16842
|
+
// A ternary to undefined, not a && to false: the WebAssembly build traps
|
|
16843
|
+
// on `src !== undefined && { ... }` here, as a value not representable
|
|
16844
|
+
// in the child union, where QuickJS draws it.
|
|
16845
|
+
children: src === void 0 ? void 0 : {
|
|
16818
16846
|
type: "image",
|
|
16819
16847
|
props: { src, style: { width: "100%", height: "100%" } }
|
|
16820
16848
|
}
|
|
@@ -16825,10 +16853,11 @@ function subtitle(line2, viewer, age) {
|
|
|
16825
16853
|
props: {
|
|
16826
16854
|
style: {
|
|
16827
16855
|
...words,
|
|
16828
|
-
fontSize:
|
|
16856
|
+
fontSize: size.name,
|
|
16857
|
+
lineHeight: size.lineHeight,
|
|
16829
16858
|
color: color2,
|
|
16830
|
-
margin: [1, 0, 0,
|
|
16831
|
-
maxWidth: nameWidth
|
|
16859
|
+
margin: [1, 0, 0, size.gap[0]],
|
|
16860
|
+
maxWidth: size.nameWidth
|
|
16832
16861
|
},
|
|
16833
16862
|
children: name
|
|
16834
16863
|
}
|
|
@@ -16838,10 +16867,11 @@ function subtitle(line2, viewer, age) {
|
|
|
16838
16867
|
props: {
|
|
16839
16868
|
style: {
|
|
16840
16869
|
...words,
|
|
16841
|
-
fontSize:
|
|
16870
|
+
fontSize: size.text,
|
|
16871
|
+
lineHeight: size.lineHeight,
|
|
16842
16872
|
color: tones.text,
|
|
16843
|
-
margin: [0, 0, 0,
|
|
16844
|
-
maxWidth: lineWidth
|
|
16873
|
+
margin: [0, 0, 0, size.gap[1]],
|
|
16874
|
+
maxWidth: size.lineWidth
|
|
16845
16875
|
},
|
|
16846
16876
|
children: line2.text
|
|
16847
16877
|
}
|
|
@@ -16854,15 +16884,15 @@ function subtitle(line2, viewer, age) {
|
|
|
16854
16884
|
flow: "right",
|
|
16855
16885
|
horizontalAlign: "center",
|
|
16856
16886
|
background: "#10130d9e",
|
|
16857
|
-
borderRadius:
|
|
16858
|
-
padding: [
|
|
16859
|
-
margin: [0, 0,
|
|
16887
|
+
borderRadius: size.radius,
|
|
16888
|
+
padding: [...size.pad],
|
|
16889
|
+
margin: [0, 0, size.space, 0],
|
|
16860
16890
|
opacity: fades[age] ?? fades[fades.length - 1],
|
|
16861
16891
|
transition: { seconds: 0.25, easing: "out" }
|
|
16862
16892
|
},
|
|
16863
16893
|
enter: { opacity: 0, translate: [0, 8] },
|
|
16864
16894
|
exit: { opacity: 0 },
|
|
16865
|
-
children: [portrait, speaker, said]
|
|
16895
|
+
children: size.portrait > 0 ? [portrait, speaker, said] : [speaker, said]
|
|
16866
16896
|
}
|
|
16867
16897
|
};
|
|
16868
16898
|
}
|
|
@@ -17372,7 +17402,8 @@ function compose(player, previous, changed) {
|
|
|
17372
17402
|
abilityBarPresses: current.bar !== void 0,
|
|
17373
17403
|
abilityDisplay: displayRows(player, current.display)
|
|
17374
17404
|
};
|
|
17375
|
-
|
|
17405
|
+
const value = root;
|
|
17406
|
+
screen.root = { node: root, encoded: JSON.stringify(value) };
|
|
17376
17407
|
return screen;
|
|
17377
17408
|
}
|
|
17378
17409
|
function content(layer, current) {
|
|
@@ -17509,7 +17540,8 @@ function place(layout, child, at3) {
|
|
|
17509
17540
|
enter: wireStyle(props.enter),
|
|
17510
17541
|
exit: wireStyle(props.exit),
|
|
17511
17542
|
cycle: cycle(props.cycle),
|
|
17512
|
-
classes: classes(props.class)
|
|
17543
|
+
classes: classes(props.class),
|
|
17544
|
+
hideInChat: props.hideInChat || void 0
|
|
17513
17545
|
};
|
|
17514
17546
|
switch (child.type) {
|
|
17515
17547
|
case "label":
|
|
@@ -19011,7 +19043,7 @@ function rosterGroup(group, index, layout, lines2) {
|
|
|
19011
19043
|
}
|
|
19012
19044
|
function rosterRow(row2, index, density, cell2) {
|
|
19013
19045
|
const right = { horizontalAlign: "right", textAlign: "right" };
|
|
19014
|
-
const
|
|
19046
|
+
const nameWidth = cell2 ? rosterCell - density.portrait - 8 - rosterColumnGap : void 0;
|
|
19015
19047
|
const text2 = element(
|
|
19016
19048
|
"panel",
|
|
19017
19049
|
{ flow: "down", verticalAlign: "center", margin: [0, 8, 0, 0] },
|
|
@@ -19022,7 +19054,7 @@ function rosterRow(row2, index, density, cell2) {
|
|
|
19022
19054
|
style: {
|
|
19023
19055
|
...right,
|
|
19024
19056
|
fontSize: density.nameSize,
|
|
19025
|
-
...
|
|
19057
|
+
...nameWidth === void 0 ? {} : { width: nameWidth, noWrap: true, textOverflow: "ellipsis" }
|
|
19026
19058
|
},
|
|
19027
19059
|
children: clip2(row2.name.toUpperCase(), rosterName)
|
|
19028
19060
|
}),
|
package/package.json
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"name": "@modlock/modlock",
|
|
9
9
|
"optionalDependencies": {
|
|
10
|
-
"@modlock/darwin-arm64": "0.1.
|
|
11
|
-
"@modlock/darwin-x64": "0.1.
|
|
12
|
-
"@modlock/linux-arm64": "0.1.
|
|
13
|
-
"@modlock/linux-x64": "0.1.
|
|
14
|
-
"@modlock/win32-x64": "0.1.
|
|
10
|
+
"@modlock/darwin-arm64": "0.1.97",
|
|
11
|
+
"@modlock/darwin-x64": "0.1.97",
|
|
12
|
+
"@modlock/linux-arm64": "0.1.97",
|
|
13
|
+
"@modlock/linux-x64": "0.1.97",
|
|
14
|
+
"@modlock/win32-x64": "0.1.97"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"type": "module",
|
|
22
22
|
"types": "index.d.ts",
|
|
23
|
-
"version": "0.1.
|
|
23
|
+
"version": "0.1.97"
|
|
24
24
|
}
|
package/ui.d.ts
CHANGED
|
@@ -263,6 +263,7 @@ export interface Props {
|
|
|
263
263
|
readonly enter?: Style;
|
|
264
264
|
readonly exit?: Style;
|
|
265
265
|
readonly cycle?: Cycle;
|
|
266
|
+
readonly hideInChat?: boolean;
|
|
266
267
|
readonly token?: string;
|
|
267
268
|
readonly variables?: Readonly<Record<string, string | number>>;
|
|
268
269
|
readonly clock?: Clock;
|
|
@@ -304,6 +305,11 @@ export interface ElementProps {
|
|
|
304
305
|
exit?: Style;
|
|
305
306
|
/** cycle swings the element to another style and back while it shows. */
|
|
306
307
|
cycle?: Cycle;
|
|
308
|
+
/**
|
|
309
|
+
* hideInChat hides the element while the player has the game's chat box
|
|
310
|
+
* open, which then shows the chat history itself.
|
|
311
|
+
*/
|
|
312
|
+
hideInChat?: boolean;
|
|
307
313
|
}
|
|
308
314
|
/**
|
|
309
315
|
* AbilityTip is the game's own window for an ability, in the player's
|