@modlock/modlock 0.1.96 → 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 +8 -0
- package/index.js +39 -22
- package/package.json +6 -6
package/chat.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export interface ChatLinesOptions {
|
|
|
11
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
|
@@ -16771,6 +16771,7 @@ function chatLines(viewer) {
|
|
|
16771
16771
|
}
|
|
16772
16772
|
if (readable.length === 0) return void 0;
|
|
16773
16773
|
const kept = readable.slice(-(shown.lines ?? 4));
|
|
16774
|
+
const size = sizesFor(shown.scale ?? 1, shown.portraits ?? true);
|
|
16774
16775
|
return {
|
|
16775
16776
|
type: "panel",
|
|
16776
16777
|
props: {
|
|
@@ -16782,16 +16783,31 @@ function chatLines(viewer) {
|
|
|
16782
16783
|
margin: [0, 0, shown.bottom ?? laneBottom, 0]
|
|
16783
16784
|
},
|
|
16784
16785
|
children: kept.map(
|
|
16785
|
-
(line2, at3) => subtitle(line2, viewer, kept.length - 1 - at3)
|
|
16786
|
+
(line2, at3) => subtitle(line2, viewer, kept.length - 1 - at3, size)
|
|
16786
16787
|
)
|
|
16787
16788
|
}
|
|
16788
16789
|
};
|
|
16789
16790
|
}
|
|
16790
16791
|
var laneBottom = 230;
|
|
16791
|
-
|
|
16792
|
-
|
|
16793
|
-
|
|
16794
|
-
|
|
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
|
+
}
|
|
16795
16811
|
var fades = [1, 0.85, 0.7];
|
|
16796
16812
|
var lifted = {
|
|
16797
16813
|
amber: "#f0a73a",
|
|
@@ -16801,11 +16817,10 @@ var words = {
|
|
|
16801
16817
|
face: "body",
|
|
16802
16818
|
weight: "bold",
|
|
16803
16819
|
verticalAlign: "top",
|
|
16804
|
-
lineHeight: 20,
|
|
16805
16820
|
textAlign: "left"
|
|
16806
16821
|
};
|
|
16807
16822
|
var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
|
|
16808
|
-
function subtitle(line2, viewer, age) {
|
|
16823
|
+
function subtitle(line2, viewer, age, size) {
|
|
16809
16824
|
const pawn = line2.speaker.pawn();
|
|
16810
16825
|
const seen = shown?.speaker?.(line2.speaker, viewer) ?? {};
|
|
16811
16826
|
const tone = teamTones[pawn?.team ?? 0];
|
|
@@ -16817,10 +16832,10 @@ function subtitle(line2, viewer, age) {
|
|
|
16817
16832
|
type: "panel",
|
|
16818
16833
|
props: {
|
|
16819
16834
|
style: {
|
|
16820
|
-
width:
|
|
16821
|
-
height:
|
|
16835
|
+
width: size.portrait,
|
|
16836
|
+
height: size.portrait,
|
|
16822
16837
|
verticalAlign: "top",
|
|
16823
|
-
borderRadius:
|
|
16838
|
+
borderRadius: Math.max(1, size.radius - 1),
|
|
16824
16839
|
background: shades.raised,
|
|
16825
16840
|
saturation: seen.out ? 0 : 1
|
|
16826
16841
|
},
|
|
@@ -16838,10 +16853,11 @@ function subtitle(line2, viewer, age) {
|
|
|
16838
16853
|
props: {
|
|
16839
16854
|
style: {
|
|
16840
16855
|
...words,
|
|
16841
|
-
fontSize:
|
|
16856
|
+
fontSize: size.name,
|
|
16857
|
+
lineHeight: size.lineHeight,
|
|
16842
16858
|
color: color2,
|
|
16843
|
-
margin: [1, 0, 0,
|
|
16844
|
-
maxWidth: nameWidth
|
|
16859
|
+
margin: [1, 0, 0, size.gap[0]],
|
|
16860
|
+
maxWidth: size.nameWidth
|
|
16845
16861
|
},
|
|
16846
16862
|
children: name
|
|
16847
16863
|
}
|
|
@@ -16851,10 +16867,11 @@ function subtitle(line2, viewer, age) {
|
|
|
16851
16867
|
props: {
|
|
16852
16868
|
style: {
|
|
16853
16869
|
...words,
|
|
16854
|
-
fontSize:
|
|
16870
|
+
fontSize: size.text,
|
|
16871
|
+
lineHeight: size.lineHeight,
|
|
16855
16872
|
color: tones.text,
|
|
16856
|
-
margin: [0, 0, 0,
|
|
16857
|
-
maxWidth: lineWidth
|
|
16873
|
+
margin: [0, 0, 0, size.gap[1]],
|
|
16874
|
+
maxWidth: size.lineWidth
|
|
16858
16875
|
},
|
|
16859
16876
|
children: line2.text
|
|
16860
16877
|
}
|
|
@@ -16867,15 +16884,15 @@ function subtitle(line2, viewer, age) {
|
|
|
16867
16884
|
flow: "right",
|
|
16868
16885
|
horizontalAlign: "center",
|
|
16869
16886
|
background: "#10130d9e",
|
|
16870
|
-
borderRadius:
|
|
16871
|
-
padding: [
|
|
16872
|
-
margin: [0, 0,
|
|
16887
|
+
borderRadius: size.radius,
|
|
16888
|
+
padding: [...size.pad],
|
|
16889
|
+
margin: [0, 0, size.space, 0],
|
|
16873
16890
|
opacity: fades[age] ?? fades[fades.length - 1],
|
|
16874
16891
|
transition: { seconds: 0.25, easing: "out" }
|
|
16875
16892
|
},
|
|
16876
16893
|
enter: { opacity: 0, translate: [0, 8] },
|
|
16877
16894
|
exit: { opacity: 0 },
|
|
16878
|
-
children: [portrait, speaker, said]
|
|
16895
|
+
children: size.portrait > 0 ? [portrait, speaker, said] : [speaker, said]
|
|
16879
16896
|
}
|
|
16880
16897
|
};
|
|
16881
16898
|
}
|
|
@@ -19026,7 +19043,7 @@ function rosterGroup(group, index, layout, lines2) {
|
|
|
19026
19043
|
}
|
|
19027
19044
|
function rosterRow(row2, index, density, cell2) {
|
|
19028
19045
|
const right = { horizontalAlign: "right", textAlign: "right" };
|
|
19029
|
-
const
|
|
19046
|
+
const nameWidth = cell2 ? rosterCell - density.portrait - 8 - rosterColumnGap : void 0;
|
|
19030
19047
|
const text2 = element(
|
|
19031
19048
|
"panel",
|
|
19032
19049
|
{ flow: "down", verticalAlign: "center", margin: [0, 8, 0, 0] },
|
|
@@ -19037,7 +19054,7 @@ function rosterRow(row2, index, density, cell2) {
|
|
|
19037
19054
|
style: {
|
|
19038
19055
|
...right,
|
|
19039
19056
|
fontSize: density.nameSize,
|
|
19040
|
-
...
|
|
19057
|
+
...nameWidth === void 0 ? {} : { width: nameWidth, noWrap: true, textOverflow: "ellipsis" }
|
|
19041
19058
|
},
|
|
19042
19059
|
children: clip2(row2.name.toUpperCase(), rosterName)
|
|
19043
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
|
}
|