@modlock/modlock 0.1.92 → 0.1.94
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/host.gen.d.ts +7 -0
- package/hud.d.ts +3 -1
- package/index.d.ts +1 -1
- package/index.js +415 -8
- package/package.json +6 -6
- package/ui.d.ts +65 -9
package/host.gen.d.ts
CHANGED
|
@@ -2026,6 +2026,13 @@ export declare function precache(options: PrecacheOptions): boolean;
|
|
|
2026
2026
|
* directories are refused.
|
|
2027
2027
|
*/
|
|
2028
2028
|
export declare function readFile(path: string): string | undefined;
|
|
2029
|
+
/**
|
|
2030
|
+
* readFileBytes reads one of the mod's files from the same places as
|
|
2031
|
+
* ReadFile, as bytes that need not be text, such as a packed table the mod
|
|
2032
|
+
* views in place. A file in neither reads as unset. The host reads the
|
|
2033
|
+
* whole file during the call.
|
|
2034
|
+
*/
|
|
2035
|
+
export declare function readFileBytes(path: string): Uint8Array | undefined;
|
|
2029
2036
|
/**
|
|
2030
2037
|
* writeFile replaces one of the mod's files in the host's copy, which
|
|
2031
2038
|
* outlives a restart and an update of the mod; the files the mod ships stay
|
package/hud.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PipShape, type TextRole, type Tone } from './theme.js';
|
|
2
2
|
import type { Player } from './host.gen.js';
|
|
3
|
-
import type { Child, Style, UiElement } from './ui.js';
|
|
3
|
+
import type { Child, Clock, Style, UiElement } from './ui.js';
|
|
4
4
|
/** TextProps set one label in a type role and tone. */
|
|
5
5
|
export interface TextProps {
|
|
6
6
|
role: TextRole;
|
|
@@ -11,6 +11,8 @@ export interface TextProps {
|
|
|
11
11
|
* plate a shadow only smears the glyphs.
|
|
12
12
|
*/
|
|
13
13
|
plated?: boolean;
|
|
14
|
+
/** clock counts the text's time in the player's game in place of children. */
|
|
15
|
+
clock?: Clock;
|
|
14
16
|
style?: Style;
|
|
15
17
|
children?: Child;
|
|
16
18
|
}
|
package/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export { type CatalogEntry, Dropper, dropperButtons } from './dropper.js';
|
|
|
33
33
|
export { persist, type PersistChange, type PersistChanges, type PersistDone, type PersistOptions, type PersistRead, type PersistRecord, type PersistValue, } from './persist.js';
|
|
34
34
|
export { bindScorePlayer, type BoardPage, type BoardRead, type BoardRow, type BoardWindow, type MatchPlace, readBoard, reportMatch, reportScore, type ScoreDone, type ScoreOptions, type ScorePlayer, } from './scores.js';
|
|
35
35
|
export { decodeSpot, encodeSpot, LoadedSpot, loadSpot, type Placed, type Spot, type SpotObject, triggers, } from './spot.js';
|
|
36
|
-
export { type ButtonProps, type Child, type Component, type Edges, type ElementProps, Fragment, type Gradient, type HeroLookName, type HeroProps, hide, hideHud, hideHudForAll, cursorFree, freeCursor, abilityBarPresses, type AbilityBarHandler, abilityDisplay, type AbilityRow, type ShownAbility, type HudPart, type ImageProps, type JSX, jsx, jsxs, type LabelProps, type LayoutProps, type Length, type Overflow, type PanelProps, route, type Scaling, type Shadow, sheet, show, type Style, toast, type Transition, type UiElement, uiSound, } from './ui.js';
|
|
36
|
+
export { type ButtonProps, type Child, type Clip, type Clock, type Component, type Edges, type ElementProps, Fragment, type Gradient, type HeroLookName, type HeroProps, hide, hideHud, hideHudForAll, cursorFree, freeCursor, abilityBarPresses, type AbilityBarHandler, abilityDisplay, type AbilityRow, type ShownAbility, type HudPart, type ImageProps, type JSX, jsx, jsxs, type LabelProps, type LayoutProps, type Length, type Overflow, type PanelProps, route, type Scaling, type Shadow, sheet, show, type Style, toast, type Transition, type UiElement, uiSound, } from './ui.js';
|
|
37
37
|
/** LogPart is a value log writes as text. */
|
|
38
38
|
export type LogPart = string | number | bigint | boolean | null | undefined;
|
|
39
39
|
/**
|
package/index.js
CHANGED
|
@@ -7599,6 +7599,32 @@ var ReadFileResponse = /* @__PURE__ */ createMessageType(
|
|
|
7599
7599
|
}
|
|
7600
7600
|
}
|
|
7601
7601
|
);
|
|
7602
|
+
var ReadFileBytesResponse = /* @__PURE__ */ createMessageType(
|
|
7603
|
+
"modlock.wasm.ReadFileBytesResponse",
|
|
7604
|
+
() => [[1, "data", 12, 4]],
|
|
7605
|
+
{
|
|
7606
|
+
decode: (r, end, m) => {
|
|
7607
|
+
while (r.pos < end) {
|
|
7608
|
+
const t = r.tag();
|
|
7609
|
+
if ((t & 7) === 4) return m;
|
|
7610
|
+
switch (t >>> 3) {
|
|
7611
|
+
case 1:
|
|
7612
|
+
m.data = r.bytes();
|
|
7613
|
+
break;
|
|
7614
|
+
default:
|
|
7615
|
+
r.skip(t);
|
|
7616
|
+
}
|
|
7617
|
+
}
|
|
7618
|
+
return m;
|
|
7619
|
+
},
|
|
7620
|
+
encode: (m, w) => {
|
|
7621
|
+
{
|
|
7622
|
+
const v = m.data;
|
|
7623
|
+
if (v != null) w.uint32(10).bytes(v);
|
|
7624
|
+
}
|
|
7625
|
+
}
|
|
7626
|
+
}
|
|
7627
|
+
);
|
|
7602
7628
|
var WriteFileRequest = /* @__PURE__ */ createMessageType(
|
|
7603
7629
|
"modlock.wasm.WriteFileRequest",
|
|
7604
7630
|
() => [
|
|
@@ -11565,6 +11591,14 @@ var SetPlayerSettingRequest = /* @__PURE__ */ createMessageType(
|
|
|
11565
11591
|
);
|
|
11566
11592
|
|
|
11567
11593
|
// src/wasm/ui/ui.pb.ts
|
|
11594
|
+
var ClockFormat_Enum = /* @__PURE__ */ createEnumType(
|
|
11595
|
+
"modlock.wasm.ui.ClockFormat",
|
|
11596
|
+
[
|
|
11597
|
+
[0, "CLOCK_FORMAT_MINUTES"],
|
|
11598
|
+
[1, "CLOCK_FORMAT_SECONDS"],
|
|
11599
|
+
[2, "CLOCK_FORMAT_TENTHS"]
|
|
11600
|
+
]
|
|
11601
|
+
);
|
|
11568
11602
|
var Scaling_Enum = /* @__PURE__ */ createEnumType(
|
|
11569
11603
|
"modlock.wasm.ui.Scaling",
|
|
11570
11604
|
[
|
|
@@ -11603,7 +11637,10 @@ var HudPart_Enum = /* @__PURE__ */ createEnumType(
|
|
|
11603
11637
|
[9, "HUD_PART_STATS"],
|
|
11604
11638
|
[10, "HUD_PART_HERO_PICKER"],
|
|
11605
11639
|
[11, "HUD_PART_BROKER_COUNTDOWN"],
|
|
11606
|
-
[12, "HUD_PART_ALL"]
|
|
11640
|
+
[12, "HUD_PART_ALL"],
|
|
11641
|
+
[13, "HUD_PART_MINIMAP_PLAYERS"],
|
|
11642
|
+
[14, "HUD_PART_INVENTORY"],
|
|
11643
|
+
[15, "HUD_PART_CROSSHAIR"]
|
|
11607
11644
|
]
|
|
11608
11645
|
);
|
|
11609
11646
|
var Kind_Enum = /* @__PURE__ */ createEnumType(
|
|
@@ -11746,7 +11783,8 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
11746
11783
|
[35, "ability_player", 13],
|
|
11747
11784
|
[36, "cues", 11, 1, Cue.codec],
|
|
11748
11785
|
[37, "ability_bar_presses", 8],
|
|
11749
|
-
[38, "ability_display", 11, 1, AbilityRow.codec]
|
|
11786
|
+
[38, "ability_display", 11, 1, AbilityRow.codec],
|
|
11787
|
+
[39, "clock", 11, 0, Clock.codec]
|
|
11750
11788
|
],
|
|
11751
11789
|
{
|
|
11752
11790
|
decode: (r, end, m) => {
|
|
@@ -11912,6 +11950,9 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
11912
11950
|
AbilityRow.decode(r, r.delimited(), {})
|
|
11913
11951
|
);
|
|
11914
11952
|
break;
|
|
11953
|
+
case 39:
|
|
11954
|
+
m.clock = Clock.decode(r, r.delimited(), m.clock ?? {});
|
|
11955
|
+
break;
|
|
11915
11956
|
default:
|
|
11916
11957
|
r.skip(t);
|
|
11917
11958
|
}
|
|
@@ -12085,6 +12126,70 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
12085
12126
|
const a = m.abilityDisplay;
|
|
12086
12127
|
if (a != null) for (const e of a) AbilityRow.writeField(w, 38, e);
|
|
12087
12128
|
}
|
|
12129
|
+
{
|
|
12130
|
+
const v = m.clock;
|
|
12131
|
+
if (v != null) Clock.writeField(w, 39, v);
|
|
12132
|
+
}
|
|
12133
|
+
}
|
|
12134
|
+
}
|
|
12135
|
+
);
|
|
12136
|
+
var Clock = /* @__PURE__ */ createMessageType(
|
|
12137
|
+
"modlock.wasm.ui.Clock",
|
|
12138
|
+
() => [
|
|
12139
|
+
[1, "seconds", 1],
|
|
12140
|
+
[2, "up", 8],
|
|
12141
|
+
[3, "paused", 8],
|
|
12142
|
+
[4, "format", 14, 0, ClockFormat_Enum],
|
|
12143
|
+
[5, "run", 13]
|
|
12144
|
+
],
|
|
12145
|
+
{
|
|
12146
|
+
decode: (r, end, m) => {
|
|
12147
|
+
while (r.pos < end) {
|
|
12148
|
+
const t = r.tag();
|
|
12149
|
+
if ((t & 7) === 4) return m;
|
|
12150
|
+
switch (t >>> 3) {
|
|
12151
|
+
case 1:
|
|
12152
|
+
m.seconds = r.double();
|
|
12153
|
+
break;
|
|
12154
|
+
case 2:
|
|
12155
|
+
m.up = r.bool();
|
|
12156
|
+
break;
|
|
12157
|
+
case 3:
|
|
12158
|
+
m.paused = r.bool();
|
|
12159
|
+
break;
|
|
12160
|
+
case 4:
|
|
12161
|
+
m.format = r.int32();
|
|
12162
|
+
break;
|
|
12163
|
+
case 5:
|
|
12164
|
+
m.run = r.uint32();
|
|
12165
|
+
break;
|
|
12166
|
+
default:
|
|
12167
|
+
r.skip(t);
|
|
12168
|
+
}
|
|
12169
|
+
}
|
|
12170
|
+
return m;
|
|
12171
|
+
},
|
|
12172
|
+
encode: (m, w) => {
|
|
12173
|
+
{
|
|
12174
|
+
const v = m.seconds;
|
|
12175
|
+
if (v != null && v !== 0) w.uint32(9).double(v);
|
|
12176
|
+
}
|
|
12177
|
+
{
|
|
12178
|
+
const v = m.up;
|
|
12179
|
+
if (v) w.uint32(16).bool(v);
|
|
12180
|
+
}
|
|
12181
|
+
{
|
|
12182
|
+
const v = m.paused;
|
|
12183
|
+
if (v) w.uint32(24).bool(v);
|
|
12184
|
+
}
|
|
12185
|
+
{
|
|
12186
|
+
const v = m.format;
|
|
12187
|
+
if (v) w.uint32(32).int32(v);
|
|
12188
|
+
}
|
|
12189
|
+
{
|
|
12190
|
+
const v = m.run;
|
|
12191
|
+
if (v) w.uint32(40).uint32(v);
|
|
12192
|
+
}
|
|
12088
12193
|
}
|
|
12089
12194
|
}
|
|
12090
12195
|
);
|
|
@@ -12200,7 +12305,8 @@ var Cue = /* @__PURE__ */ createMessageType(
|
|
|
12200
12305
|
() => [
|
|
12201
12306
|
[1, "number", 13],
|
|
12202
12307
|
[2, "sound", 9],
|
|
12203
|
-
[3, "seconds", 2]
|
|
12308
|
+
[3, "seconds", 2],
|
|
12309
|
+
[4, "delay", 2]
|
|
12204
12310
|
],
|
|
12205
12311
|
{
|
|
12206
12312
|
decode: (r, end, m) => {
|
|
@@ -12217,6 +12323,9 @@ var Cue = /* @__PURE__ */ createMessageType(
|
|
|
12217
12323
|
case 3:
|
|
12218
12324
|
m.seconds = r.float();
|
|
12219
12325
|
break;
|
|
12326
|
+
case 4:
|
|
12327
|
+
m.delay = r.float();
|
|
12328
|
+
break;
|
|
12220
12329
|
default:
|
|
12221
12330
|
r.skip(t);
|
|
12222
12331
|
}
|
|
@@ -12236,6 +12345,10 @@ var Cue = /* @__PURE__ */ createMessageType(
|
|
|
12236
12345
|
const v = m.seconds;
|
|
12237
12346
|
if (v != null && v !== 0) w.uint32(29).float(v);
|
|
12238
12347
|
}
|
|
12348
|
+
{
|
|
12349
|
+
const v = m.delay;
|
|
12350
|
+
if (v != null && v !== 0) w.uint32(37).float(v);
|
|
12351
|
+
}
|
|
12239
12352
|
}
|
|
12240
12353
|
}
|
|
12241
12354
|
);
|
|
@@ -12533,7 +12646,9 @@ var Style = /* @__PURE__ */ createMessageType(
|
|
|
12533
12646
|
[42, "text_overflow", 14, 0, TextOverflow_Enum],
|
|
12534
12647
|
[43, "decoration", 14, 0, Decoration_Enum],
|
|
12535
12648
|
[44, "transform", 11, 0, Transform.codec],
|
|
12536
|
-
[45, "transition", 11, 0, Transition.codec]
|
|
12649
|
+
[45, "transition", 11, 0, Transition.codec],
|
|
12650
|
+
[46, "clip", 11, 0, Clip.codec],
|
|
12651
|
+
[47, "turn", 2]
|
|
12537
12652
|
],
|
|
12538
12653
|
{
|
|
12539
12654
|
decode: (r, end, m) => {
|
|
@@ -12684,6 +12799,12 @@ var Style = /* @__PURE__ */ createMessageType(
|
|
|
12684
12799
|
m.transition ?? {}
|
|
12685
12800
|
);
|
|
12686
12801
|
break;
|
|
12802
|
+
case 46:
|
|
12803
|
+
m.clip = Clip.decode(r, r.delimited(), m.clip ?? {});
|
|
12804
|
+
break;
|
|
12805
|
+
case 47:
|
|
12806
|
+
m.turn = r.float();
|
|
12807
|
+
break;
|
|
12687
12808
|
default:
|
|
12688
12809
|
r.skip(t);
|
|
12689
12810
|
}
|
|
@@ -12871,6 +12992,170 @@ var Style = /* @__PURE__ */ createMessageType(
|
|
|
12871
12992
|
const v = m.transition;
|
|
12872
12993
|
if (v != null) Transition.writeField(w, 45, v);
|
|
12873
12994
|
}
|
|
12995
|
+
{
|
|
12996
|
+
const v = m.clip;
|
|
12997
|
+
if (v != null) Clip.writeField(w, 46, v);
|
|
12998
|
+
}
|
|
12999
|
+
{
|
|
13000
|
+
const v = m.turn;
|
|
13001
|
+
if (v != null && v !== 0) w.uint32(381).float(v);
|
|
13002
|
+
}
|
|
13003
|
+
}
|
|
13004
|
+
}
|
|
13005
|
+
);
|
|
13006
|
+
var Clip = /* @__PURE__ */ createMessageType(
|
|
13007
|
+
"modlock.wasm.ui.Clip",
|
|
13008
|
+
() => [
|
|
13009
|
+
[1, "rect", 11, 0, ClipRect.codec, "shape"],
|
|
13010
|
+
[2, "radial", 11, 0, ClipRadial.codec, "shape"]
|
|
13011
|
+
],
|
|
13012
|
+
{
|
|
13013
|
+
decode: (r, end, m) => {
|
|
13014
|
+
while (r.pos < end) {
|
|
13015
|
+
const t = r.tag();
|
|
13016
|
+
if ((t & 7) === 4) return m;
|
|
13017
|
+
switch (t >>> 3) {
|
|
13018
|
+
case 1:
|
|
13019
|
+
m.shape = {
|
|
13020
|
+
case: "rect",
|
|
13021
|
+
value: ClipRect.decode(
|
|
13022
|
+
r,
|
|
13023
|
+
r.delimited(),
|
|
13024
|
+
m.shape?.case === "rect" ? m.shape.value : {}
|
|
13025
|
+
)
|
|
13026
|
+
};
|
|
13027
|
+
break;
|
|
13028
|
+
case 2:
|
|
13029
|
+
m.shape = {
|
|
13030
|
+
case: "radial",
|
|
13031
|
+
value: ClipRadial.decode(
|
|
13032
|
+
r,
|
|
13033
|
+
r.delimited(),
|
|
13034
|
+
m.shape?.case === "radial" ? m.shape.value : {}
|
|
13035
|
+
)
|
|
13036
|
+
};
|
|
13037
|
+
break;
|
|
13038
|
+
default:
|
|
13039
|
+
r.skip(t);
|
|
13040
|
+
}
|
|
13041
|
+
}
|
|
13042
|
+
return m;
|
|
13043
|
+
},
|
|
13044
|
+
encode: (m, w) => {
|
|
13045
|
+
{
|
|
13046
|
+
const o = m.shape;
|
|
13047
|
+
if (o?.case === "rect" && o.value != null)
|
|
13048
|
+
ClipRect.writeField(w, 1, o.value);
|
|
13049
|
+
}
|
|
13050
|
+
{
|
|
13051
|
+
const o = m.shape;
|
|
13052
|
+
if (o?.case === "radial" && o.value != null)
|
|
13053
|
+
ClipRadial.writeField(w, 2, o.value);
|
|
13054
|
+
}
|
|
13055
|
+
}
|
|
13056
|
+
}
|
|
13057
|
+
);
|
|
13058
|
+
var ClipRect = /* @__PURE__ */ createMessageType(
|
|
13059
|
+
"modlock.wasm.ui.ClipRect",
|
|
13060
|
+
() => [
|
|
13061
|
+
[1, "top", 2],
|
|
13062
|
+
[2, "right", 2],
|
|
13063
|
+
[3, "bottom", 2],
|
|
13064
|
+
[4, "left", 2]
|
|
13065
|
+
],
|
|
13066
|
+
{
|
|
13067
|
+
decode: (r, end, m) => {
|
|
13068
|
+
while (r.pos < end) {
|
|
13069
|
+
const t = r.tag();
|
|
13070
|
+
if ((t & 7) === 4) return m;
|
|
13071
|
+
switch (t >>> 3) {
|
|
13072
|
+
case 1:
|
|
13073
|
+
m.top = r.float();
|
|
13074
|
+
break;
|
|
13075
|
+
case 2:
|
|
13076
|
+
m.right = r.float();
|
|
13077
|
+
break;
|
|
13078
|
+
case 3:
|
|
13079
|
+
m.bottom = r.float();
|
|
13080
|
+
break;
|
|
13081
|
+
case 4:
|
|
13082
|
+
m.left = r.float();
|
|
13083
|
+
break;
|
|
13084
|
+
default:
|
|
13085
|
+
r.skip(t);
|
|
13086
|
+
}
|
|
13087
|
+
}
|
|
13088
|
+
return m;
|
|
13089
|
+
},
|
|
13090
|
+
encode: (m, w) => {
|
|
13091
|
+
{
|
|
13092
|
+
const v = m.top;
|
|
13093
|
+
if (v != null && v !== 0) w.uint32(13).float(v);
|
|
13094
|
+
}
|
|
13095
|
+
{
|
|
13096
|
+
const v = m.right;
|
|
13097
|
+
if (v != null && v !== 0) w.uint32(21).float(v);
|
|
13098
|
+
}
|
|
13099
|
+
{
|
|
13100
|
+
const v = m.bottom;
|
|
13101
|
+
if (v != null && v !== 0) w.uint32(29).float(v);
|
|
13102
|
+
}
|
|
13103
|
+
{
|
|
13104
|
+
const v = m.left;
|
|
13105
|
+
if (v != null && v !== 0) w.uint32(37).float(v);
|
|
13106
|
+
}
|
|
13107
|
+
}
|
|
13108
|
+
}
|
|
13109
|
+
);
|
|
13110
|
+
var ClipRadial = /* @__PURE__ */ createMessageType(
|
|
13111
|
+
"modlock.wasm.ui.ClipRadial",
|
|
13112
|
+
() => [
|
|
13113
|
+
[1, "center_x", 2, 4],
|
|
13114
|
+
[2, "center_y", 2, 4],
|
|
13115
|
+
[3, "start", 2],
|
|
13116
|
+
[4, "sweep", 2]
|
|
13117
|
+
],
|
|
13118
|
+
{
|
|
13119
|
+
decode: (r, end, m) => {
|
|
13120
|
+
while (r.pos < end) {
|
|
13121
|
+
const t = r.tag();
|
|
13122
|
+
if ((t & 7) === 4) return m;
|
|
13123
|
+
switch (t >>> 3) {
|
|
13124
|
+
case 1:
|
|
13125
|
+
m.centerX = r.float();
|
|
13126
|
+
break;
|
|
13127
|
+
case 2:
|
|
13128
|
+
m.centerY = r.float();
|
|
13129
|
+
break;
|
|
13130
|
+
case 3:
|
|
13131
|
+
m.start = r.float();
|
|
13132
|
+
break;
|
|
13133
|
+
case 4:
|
|
13134
|
+
m.sweep = r.float();
|
|
13135
|
+
break;
|
|
13136
|
+
default:
|
|
13137
|
+
r.skip(t);
|
|
13138
|
+
}
|
|
13139
|
+
}
|
|
13140
|
+
return m;
|
|
13141
|
+
},
|
|
13142
|
+
encode: (m, w) => {
|
|
13143
|
+
{
|
|
13144
|
+
const v = m.centerX;
|
|
13145
|
+
if (v != null) w.uint32(13).float(v);
|
|
13146
|
+
}
|
|
13147
|
+
{
|
|
13148
|
+
const v = m.centerY;
|
|
13149
|
+
if (v != null) w.uint32(21).float(v);
|
|
13150
|
+
}
|
|
13151
|
+
{
|
|
13152
|
+
const v = m.start;
|
|
13153
|
+
if (v != null && v !== 0) w.uint32(29).float(v);
|
|
13154
|
+
}
|
|
13155
|
+
{
|
|
13156
|
+
const v = m.sweep;
|
|
13157
|
+
if (v != null && v !== 0) w.uint32(37).float(v);
|
|
13158
|
+
}
|
|
12874
13159
|
}
|
|
12875
13160
|
}
|
|
12876
13161
|
);
|
|
@@ -13096,7 +13381,8 @@ var Transition = /* @__PURE__ */ createMessageType(
|
|
|
13096
13381
|
() => [
|
|
13097
13382
|
[1, "seconds", 2],
|
|
13098
13383
|
[2, "delay", 2],
|
|
13099
|
-
[3, "easing", 14, 0, Easing_Enum]
|
|
13384
|
+
[3, "easing", 14, 0, Easing_Enum],
|
|
13385
|
+
[4, "curve", 11, 0, Curve.codec]
|
|
13100
13386
|
],
|
|
13101
13387
|
{
|
|
13102
13388
|
decode: (r, end, m) => {
|
|
@@ -13113,6 +13399,9 @@ var Transition = /* @__PURE__ */ createMessageType(
|
|
|
13113
13399
|
case 3:
|
|
13114
13400
|
m.easing = r.int32();
|
|
13115
13401
|
break;
|
|
13402
|
+
case 4:
|
|
13403
|
+
m.curve = Curve.decode(r, r.delimited(), m.curve ?? {});
|
|
13404
|
+
break;
|
|
13116
13405
|
default:
|
|
13117
13406
|
r.skip(t);
|
|
13118
13407
|
}
|
|
@@ -13132,6 +13421,62 @@ var Transition = /* @__PURE__ */ createMessageType(
|
|
|
13132
13421
|
const v = m.easing;
|
|
13133
13422
|
if (v) w.uint32(24).int32(v);
|
|
13134
13423
|
}
|
|
13424
|
+
{
|
|
13425
|
+
const v = m.curve;
|
|
13426
|
+
if (v != null) Curve.writeField(w, 4, v);
|
|
13427
|
+
}
|
|
13428
|
+
}
|
|
13429
|
+
}
|
|
13430
|
+
);
|
|
13431
|
+
var Curve = /* @__PURE__ */ createMessageType(
|
|
13432
|
+
"modlock.wasm.ui.Curve",
|
|
13433
|
+
() => [
|
|
13434
|
+
[1, "x1", 2],
|
|
13435
|
+
[2, "y1", 2],
|
|
13436
|
+
[3, "x2", 2],
|
|
13437
|
+
[4, "y2", 2]
|
|
13438
|
+
],
|
|
13439
|
+
{
|
|
13440
|
+
decode: (r, end, m) => {
|
|
13441
|
+
while (r.pos < end) {
|
|
13442
|
+
const t = r.tag();
|
|
13443
|
+
if ((t & 7) === 4) return m;
|
|
13444
|
+
switch (t >>> 3) {
|
|
13445
|
+
case 1:
|
|
13446
|
+
m.x1 = r.float();
|
|
13447
|
+
break;
|
|
13448
|
+
case 2:
|
|
13449
|
+
m.y1 = r.float();
|
|
13450
|
+
break;
|
|
13451
|
+
case 3:
|
|
13452
|
+
m.x2 = r.float();
|
|
13453
|
+
break;
|
|
13454
|
+
case 4:
|
|
13455
|
+
m.y2 = r.float();
|
|
13456
|
+
break;
|
|
13457
|
+
default:
|
|
13458
|
+
r.skip(t);
|
|
13459
|
+
}
|
|
13460
|
+
}
|
|
13461
|
+
return m;
|
|
13462
|
+
},
|
|
13463
|
+
encode: (m, w) => {
|
|
13464
|
+
{
|
|
13465
|
+
const v = m.x1;
|
|
13466
|
+
if (v != null && v !== 0) w.uint32(13).float(v);
|
|
13467
|
+
}
|
|
13468
|
+
{
|
|
13469
|
+
const v = m.y1;
|
|
13470
|
+
if (v != null && v !== 0) w.uint32(21).float(v);
|
|
13471
|
+
}
|
|
13472
|
+
{
|
|
13473
|
+
const v = m.x2;
|
|
13474
|
+
if (v != null && v !== 0) w.uint32(29).float(v);
|
|
13475
|
+
}
|
|
13476
|
+
{
|
|
13477
|
+
const v = m.y2;
|
|
13478
|
+
if (v != null && v !== 0) w.uint32(37).float(v);
|
|
13479
|
+
}
|
|
13135
13480
|
}
|
|
13136
13481
|
}
|
|
13137
13482
|
);
|
|
@@ -15263,6 +15608,12 @@ function readFile(path) {
|
|
|
15263
15608
|
const response = ReadFileResponse.fromBinary(reply2);
|
|
15264
15609
|
return response.text;
|
|
15265
15610
|
}
|
|
15611
|
+
function readFileBytes(path) {
|
|
15612
|
+
const reply2 = call("ReadFileBytes", ReadFileRequest.toBinary({ path }));
|
|
15613
|
+
if (reply2 === void 0) return void 0;
|
|
15614
|
+
const response = ReadFileBytesResponse.fromBinary(reply2);
|
|
15615
|
+
return response.data;
|
|
15616
|
+
}
|
|
15266
15617
|
function writeFile(path, text2) {
|
|
15267
15618
|
return call("WriteFile", WriteFileRequest.toBinary({ path, text: text2 })) !== void 0;
|
|
15268
15619
|
}
|
|
@@ -16430,7 +16781,7 @@ function arriving(component, from) {
|
|
|
16430
16781
|
}
|
|
16431
16782
|
function Text(props) {
|
|
16432
16783
|
const type = types[props.role];
|
|
16433
|
-
|
|
16784
|
+
const text2 = element(
|
|
16434
16785
|
"label",
|
|
16435
16786
|
{
|
|
16436
16787
|
face: type.face,
|
|
@@ -16444,6 +16795,7 @@ function Text(props) {
|
|
|
16444
16795
|
},
|
|
16445
16796
|
props.children
|
|
16446
16797
|
);
|
|
16798
|
+
return props.clock ? { ...text2, props: { ...text2.props, clock: props.clock } } : text2;
|
|
16447
16799
|
}
|
|
16448
16800
|
function Plate(props) {
|
|
16449
16801
|
return element(
|
|
@@ -17200,7 +17552,12 @@ function toast(player, text2, seconds = 4) {
|
|
|
17200
17552
|
}
|
|
17201
17553
|
function uiSound(player, sound, options = {}) {
|
|
17202
17554
|
const current = view(player);
|
|
17203
|
-
const cue = {
|
|
17555
|
+
const cue = {
|
|
17556
|
+
number: nextCue++,
|
|
17557
|
+
sound,
|
|
17558
|
+
seconds: options.seconds ?? 0,
|
|
17559
|
+
delay: options.delay ?? 0
|
|
17560
|
+
};
|
|
17204
17561
|
views.set(player.slot, {
|
|
17205
17562
|
...current,
|
|
17206
17563
|
cues: [...current.cues, cue].slice(-maxCues)
|
|
@@ -17468,6 +17825,7 @@ function place(layout, child, at3) {
|
|
|
17468
17825
|
node.text = text(props.children);
|
|
17469
17826
|
node.token = props.token;
|
|
17470
17827
|
node.variables = variables(props.variables);
|
|
17828
|
+
node.clock = clock2(props.clock);
|
|
17471
17829
|
break;
|
|
17472
17830
|
case "avatar":
|
|
17473
17831
|
node.kind = 8 /* AVATAR */;
|
|
@@ -17564,6 +17922,43 @@ function input(layout, node, kind, props) {
|
|
|
17564
17922
|
};
|
|
17565
17923
|
}
|
|
17566
17924
|
}
|
|
17925
|
+
function clock2(value) {
|
|
17926
|
+
if (!value) {
|
|
17927
|
+
return void 0;
|
|
17928
|
+
}
|
|
17929
|
+
return {
|
|
17930
|
+
seconds: value.seconds,
|
|
17931
|
+
up: value.up,
|
|
17932
|
+
paused: value.paused,
|
|
17933
|
+
format: value.format === void 0 ? void 0 : clockFormats[value.format],
|
|
17934
|
+
run: value.run
|
|
17935
|
+
};
|
|
17936
|
+
}
|
|
17937
|
+
var clockFormats = {
|
|
17938
|
+
minutes: 0 /* MINUTES */,
|
|
17939
|
+
seconds: 1 /* SECONDS */,
|
|
17940
|
+
tenths: 2 /* TENTHS */
|
|
17941
|
+
};
|
|
17942
|
+
function clip2(value) {
|
|
17943
|
+
if (!value) {
|
|
17944
|
+
return void 0;
|
|
17945
|
+
}
|
|
17946
|
+
if (value.rect) {
|
|
17947
|
+
const [top, right, bottom, left3] = value.rect;
|
|
17948
|
+
return { shape: { case: "rect", value: { top, right, bottom, left: left3 } } };
|
|
17949
|
+
}
|
|
17950
|
+
return {
|
|
17951
|
+
shape: {
|
|
17952
|
+
case: "radial",
|
|
17953
|
+
value: {
|
|
17954
|
+
centerX: value.center?.[0],
|
|
17955
|
+
centerY: value.center?.[1],
|
|
17956
|
+
start: value.start,
|
|
17957
|
+
sweep: value.sweep
|
|
17958
|
+
}
|
|
17959
|
+
}
|
|
17960
|
+
};
|
|
17961
|
+
}
|
|
17567
17962
|
function variables(value) {
|
|
17568
17963
|
if (!value) {
|
|
17569
17964
|
return void 0;
|
|
@@ -17636,6 +18031,9 @@ var hudParts = {
|
|
|
17636
18031
|
stats: 9 /* STATS */,
|
|
17637
18032
|
heroPicker: 10 /* HERO_PICKER */,
|
|
17638
18033
|
brokerCountdown: 11 /* BROKER_COUNTDOWN */,
|
|
18034
|
+
minimapPlayers: 13 /* MINIMAP_PLAYERS */,
|
|
18035
|
+
inventory: 14 /* INVENTORY */,
|
|
18036
|
+
crosshair: 15 /* CROSSHAIR */,
|
|
17639
18037
|
all: 12 /* ALL */
|
|
17640
18038
|
};
|
|
17641
18039
|
var faces = {
|
|
@@ -17757,6 +18155,8 @@ function wireStyle(style) {
|
|
|
17757
18155
|
textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
|
|
17758
18156
|
decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
|
|
17759
18157
|
transform: transform(style),
|
|
18158
|
+
turn: style.turn,
|
|
18159
|
+
clip: clip2(style.clip),
|
|
17760
18160
|
transition: transition(style.transition)
|
|
17761
18161
|
};
|
|
17762
18162
|
}
|
|
@@ -17812,7 +18212,13 @@ function transition(value) {
|
|
|
17812
18212
|
return {
|
|
17813
18213
|
seconds: value.seconds,
|
|
17814
18214
|
delay: value.delay,
|
|
17815
|
-
easing: value.easing === void 0 ? void 0 : easings[value.easing]
|
|
18215
|
+
easing: value.easing === void 0 ? void 0 : easings[value.easing],
|
|
18216
|
+
curve: value.curve ? {
|
|
18217
|
+
x1: value.curve[0],
|
|
18218
|
+
y1: value.curve[1],
|
|
18219
|
+
x2: value.curve[2],
|
|
18220
|
+
y2: value.curve[3]
|
|
18221
|
+
} : void 0
|
|
17816
18222
|
};
|
|
17817
18223
|
}
|
|
17818
18224
|
function length(value) {
|
|
@@ -21555,6 +21961,7 @@ export {
|
|
|
21555
21961
|
readField,
|
|
21556
21962
|
readFieldList,
|
|
21557
21963
|
readFile,
|
|
21964
|
+
readFileBytes,
|
|
21558
21965
|
readModifierField,
|
|
21559
21966
|
remapInput,
|
|
21560
21967
|
removeEntities,
|
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.94",
|
|
11
|
+
"@modlock/darwin-x64": "0.1.94",
|
|
12
|
+
"@modlock/linux-arm64": "0.1.94",
|
|
13
|
+
"@modlock/linux-x64": "0.1.94",
|
|
14
|
+
"@modlock/win32-x64": "0.1.94"
|
|
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.94"
|
|
24
24
|
}
|
package/ui.d.ts
CHANGED
|
@@ -42,11 +42,46 @@ export interface Shadow {
|
|
|
42
42
|
/**
|
|
43
43
|
* Transition animates each change of an element's style, and the move to its
|
|
44
44
|
* hover style and back, over seconds after delay. Easing is 'out' unless set.
|
|
45
|
+
* Curve shapes the change in place of easing as a cubic Bezier curve's two
|
|
46
|
+
* control points, [x1, y1, x2, y2], as CSS's cubic-bezier: each x is a share
|
|
47
|
+
* of the time from 0 to 1, and a y outside 0 to 1 overshoots, such as
|
|
48
|
+
* [0.75, 1.5, 0.95, 1.4] for a pop that springs past its end.
|
|
45
49
|
*/
|
|
46
50
|
export interface Transition {
|
|
47
51
|
seconds: number;
|
|
48
52
|
delay?: number;
|
|
49
53
|
easing?: 'out' | 'in' | 'inOut' | 'linear';
|
|
54
|
+
curve?: readonly number[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Clip draws only part of an element and its children. Rect is a box,
|
|
58
|
+
* [top, right, bottom, left], each side a percent of the element's size from
|
|
59
|
+
* its top or left edge, so [0, 50, 100, 0] is its left half. Without rect, the
|
|
60
|
+
* clip is a slice of a circle about center, [x, y] percents of the element's
|
|
61
|
+
* size and its middle unless set, through sweep degrees from start, as the
|
|
62
|
+
* game draws a cooldown ring. A transition does not ease a clip; draw it
|
|
63
|
+
* again to fill a ring over time.
|
|
64
|
+
*/
|
|
65
|
+
export interface Clip {
|
|
66
|
+
rect?: readonly number[];
|
|
67
|
+
center?: readonly number[];
|
|
68
|
+
start?: number;
|
|
69
|
+
sweep?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Clock counts a label's time in the player's game, so the mod draws it once
|
|
73
|
+
* and not every second. It starts at seconds as the player first sees it and
|
|
74
|
+
* counts down to zero, or up when up is set, unless paused. Format writes
|
|
75
|
+
* 'minutes' as "4:05", 'seconds' as "245" or 'tenths' as "9.4". A change to
|
|
76
|
+
* any of its fields starts the count again from seconds; change run to
|
|
77
|
+
* restart the same clock, such as at each round.
|
|
78
|
+
*/
|
|
79
|
+
export interface Clock {
|
|
80
|
+
seconds: number;
|
|
81
|
+
up?: boolean;
|
|
82
|
+
paused?: boolean;
|
|
83
|
+
format?: 'minutes' | 'seconds' | 'tenths';
|
|
84
|
+
run?: number;
|
|
50
85
|
}
|
|
51
86
|
/**
|
|
52
87
|
* Style lays out and paints an element. Colors are '#rrggbb' or '#rrggbbaa'.
|
|
@@ -142,6 +177,14 @@ export interface Style {
|
|
|
142
177
|
scale?: number | readonly number[];
|
|
143
178
|
/** rotate turns the element clockwise, in degrees. */
|
|
144
179
|
rotate?: number;
|
|
180
|
+
/**
|
|
181
|
+
* turn turns the element clockwise, in degrees, before its other
|
|
182
|
+
* transforms. A transition eases the angle itself, so a turn from 0 to 720
|
|
183
|
+
* spins twice, where rotate eases the shortest way round.
|
|
184
|
+
*/
|
|
185
|
+
turn?: number;
|
|
186
|
+
/** clip draws only part of the element and its children. */
|
|
187
|
+
clip?: Clip;
|
|
145
188
|
/**
|
|
146
189
|
* origin is the point the element scales and turns about, as [x, y]
|
|
147
190
|
* percents of its size; unset is its center.
|
|
@@ -164,11 +207,14 @@ export interface Style {
|
|
|
164
207
|
* bar, 'status' the game's mark in the top-left corner, 'stats' the weapon,
|
|
165
208
|
* spirit and vitality stats at the lower left, 'heroPicker' the screen a
|
|
166
209
|
* player without a hero picks one on, 'brokerCountdown' the countdown in the
|
|
167
|
-
* Broker's window,
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
|
|
171
|
-
|
|
210
|
+
* Broker's window, 'minimapPlayers' every player's icon on the minimap, the
|
|
211
|
+
* player's own included, 'inventory' the purchased items beside the stats,
|
|
212
|
+
* 'crosshair' the crosshair with its clip ring, ammo count and stamina pips,
|
|
213
|
+
* and 'all' the whole HUD but the mods' own interfaces, the game's tooltips
|
|
214
|
+
* and its chat, for a screen that takes the player's whole view. Whatever a
|
|
215
|
+
* part does not name stays.
|
|
216
|
+
*/
|
|
217
|
+
export type HudPart = 'levelUp' | 'ownHealth' | 'topBar' | 'ammo' | 'souls' | 'minimap' | 'abilities' | 'status' | 'stats' | 'heroPicker' | 'brokerCountdown' | 'minimapPlayers' | 'inventory' | 'crosshair' | 'all';
|
|
172
218
|
/** Child is anything an element may hold. Text becomes a label. */
|
|
173
219
|
export type Child = UiElement | string | number | boolean | null | undefined | readonly Child[];
|
|
174
220
|
/** Component returns the elements that stand for its props. */
|
|
@@ -219,6 +265,7 @@ export interface Props {
|
|
|
219
265
|
readonly cycle?: Cycle;
|
|
220
266
|
readonly token?: string;
|
|
221
267
|
readonly variables?: Readonly<Record<string, string | number>>;
|
|
268
|
+
readonly clock?: Clock;
|
|
222
269
|
readonly steamId?: bigint;
|
|
223
270
|
readonly value?: string | number;
|
|
224
271
|
readonly placeholder?: string;
|
|
@@ -284,12 +331,14 @@ export interface PanelProps extends ElementProps {
|
|
|
284
331
|
/**
|
|
285
332
|
* LabelProps show text: the label's text children, joined, or the game's text
|
|
286
333
|
* for token in the player's language, with each {s:name} place in it filled
|
|
287
|
-
* from variables.
|
|
334
|
+
* from variables. A clock's time stands in for the text, or fills the token's
|
|
335
|
+
* {s:clock} place.
|
|
288
336
|
*/
|
|
289
337
|
export interface LabelProps extends ElementProps {
|
|
290
338
|
children?: Child;
|
|
291
339
|
token?: string;
|
|
292
340
|
variables?: Readonly<Record<string, string | number>>;
|
|
341
|
+
clock?: Clock;
|
|
293
342
|
}
|
|
294
343
|
/** AvatarProps show the Steam picture of the player with steamId. */
|
|
295
344
|
export interface AvatarProps extends ElementProps {
|
|
@@ -344,7 +393,11 @@ export interface DropdownProps extends InputProps {
|
|
|
344
393
|
* and 'fitHeight' fit one side, and 'none' draws it at its own size.
|
|
345
394
|
*/
|
|
346
395
|
export type Scaling = 'fit' | 'cover' | 'stretch' | 'fitWidth' | 'fitHeight' | 'none';
|
|
347
|
-
/**
|
|
396
|
+
/**
|
|
397
|
+
* ImageProps show an image from the game's content, such as
|
|
398
|
+
* 'file://{images}/hud/icon.png', or from the mod's own content with {addon}
|
|
399
|
+
* in place of its addon's name, such as 'file://{images}/{addon}/mark.png'.
|
|
400
|
+
*/
|
|
348
401
|
export interface ImageProps extends ElementProps {
|
|
349
402
|
src: string;
|
|
350
403
|
scaling?: Scaling;
|
|
@@ -542,11 +595,14 @@ export declare function toast(player: Player, text: string, seconds?: number): b
|
|
|
542
595
|
/**
|
|
543
596
|
* uiSound plays the game's sound event sound, such as 'UI.ItemDraft.Start', in
|
|
544
597
|
* player's game alone, once; seconds cuts it after that long, keeping only its
|
|
545
|
-
* start
|
|
546
|
-
*
|
|
598
|
+
* start, and delay waits that long before it plays, so one draw can time a
|
|
599
|
+
* run of sounds, such as a wheel's ticks. It plays with the next screen the
|
|
600
|
+
* player reads, and not at all if the player reads it only after the mod's
|
|
601
|
+
* next few sounds, or the mod clears its interface before its delay ends.
|
|
547
602
|
*/
|
|
548
603
|
export declare function uiSound(player: Player, sound: string, options?: {
|
|
549
604
|
readonly seconds?: number;
|
|
605
|
+
readonly delay?: number;
|
|
550
606
|
}): boolean;
|
|
551
607
|
/**
|
|
552
608
|
* press runs the handler of the button the player pressed, or, for a press
|