@modlock/modlock 0.1.92 → 0.1.93

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/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
@@ -11565,6 +11565,14 @@ var SetPlayerSettingRequest = /* @__PURE__ */ createMessageType(
11565
11565
  );
11566
11566
 
11567
11567
  // src/wasm/ui/ui.pb.ts
11568
+ var ClockFormat_Enum = /* @__PURE__ */ createEnumType(
11569
+ "modlock.wasm.ui.ClockFormat",
11570
+ [
11571
+ [0, "CLOCK_FORMAT_MINUTES"],
11572
+ [1, "CLOCK_FORMAT_SECONDS"],
11573
+ [2, "CLOCK_FORMAT_TENTHS"]
11574
+ ]
11575
+ );
11568
11576
  var Scaling_Enum = /* @__PURE__ */ createEnumType(
11569
11577
  "modlock.wasm.ui.Scaling",
11570
11578
  [
@@ -11603,7 +11611,10 @@ var HudPart_Enum = /* @__PURE__ */ createEnumType(
11603
11611
  [9, "HUD_PART_STATS"],
11604
11612
  [10, "HUD_PART_HERO_PICKER"],
11605
11613
  [11, "HUD_PART_BROKER_COUNTDOWN"],
11606
- [12, "HUD_PART_ALL"]
11614
+ [12, "HUD_PART_ALL"],
11615
+ [13, "HUD_PART_MINIMAP_PLAYERS"],
11616
+ [14, "HUD_PART_INVENTORY"],
11617
+ [15, "HUD_PART_CROSSHAIR"]
11607
11618
  ]
11608
11619
  );
11609
11620
  var Kind_Enum = /* @__PURE__ */ createEnumType(
@@ -11746,7 +11757,8 @@ var Node = /* @__PURE__ */ createMessageType(
11746
11757
  [35, "ability_player", 13],
11747
11758
  [36, "cues", 11, 1, Cue.codec],
11748
11759
  [37, "ability_bar_presses", 8],
11749
- [38, "ability_display", 11, 1, AbilityRow.codec]
11760
+ [38, "ability_display", 11, 1, AbilityRow.codec],
11761
+ [39, "clock", 11, 0, Clock.codec]
11750
11762
  ],
11751
11763
  {
11752
11764
  decode: (r, end, m) => {
@@ -11912,6 +11924,9 @@ var Node = /* @__PURE__ */ createMessageType(
11912
11924
  AbilityRow.decode(r, r.delimited(), {})
11913
11925
  );
11914
11926
  break;
11927
+ case 39:
11928
+ m.clock = Clock.decode(r, r.delimited(), m.clock ?? {});
11929
+ break;
11915
11930
  default:
11916
11931
  r.skip(t);
11917
11932
  }
@@ -12085,6 +12100,70 @@ var Node = /* @__PURE__ */ createMessageType(
12085
12100
  const a = m.abilityDisplay;
12086
12101
  if (a != null) for (const e of a) AbilityRow.writeField(w, 38, e);
12087
12102
  }
12103
+ {
12104
+ const v = m.clock;
12105
+ if (v != null) Clock.writeField(w, 39, v);
12106
+ }
12107
+ }
12108
+ }
12109
+ );
12110
+ var Clock = /* @__PURE__ */ createMessageType(
12111
+ "modlock.wasm.ui.Clock",
12112
+ () => [
12113
+ [1, "seconds", 1],
12114
+ [2, "up", 8],
12115
+ [3, "paused", 8],
12116
+ [4, "format", 14, 0, ClockFormat_Enum],
12117
+ [5, "run", 13]
12118
+ ],
12119
+ {
12120
+ decode: (r, end, m) => {
12121
+ while (r.pos < end) {
12122
+ const t = r.tag();
12123
+ if ((t & 7) === 4) return m;
12124
+ switch (t >>> 3) {
12125
+ case 1:
12126
+ m.seconds = r.double();
12127
+ break;
12128
+ case 2:
12129
+ m.up = r.bool();
12130
+ break;
12131
+ case 3:
12132
+ m.paused = r.bool();
12133
+ break;
12134
+ case 4:
12135
+ m.format = r.int32();
12136
+ break;
12137
+ case 5:
12138
+ m.run = r.uint32();
12139
+ break;
12140
+ default:
12141
+ r.skip(t);
12142
+ }
12143
+ }
12144
+ return m;
12145
+ },
12146
+ encode: (m, w) => {
12147
+ {
12148
+ const v = m.seconds;
12149
+ if (v != null && v !== 0) w.uint32(9).double(v);
12150
+ }
12151
+ {
12152
+ const v = m.up;
12153
+ if (v) w.uint32(16).bool(v);
12154
+ }
12155
+ {
12156
+ const v = m.paused;
12157
+ if (v) w.uint32(24).bool(v);
12158
+ }
12159
+ {
12160
+ const v = m.format;
12161
+ if (v) w.uint32(32).int32(v);
12162
+ }
12163
+ {
12164
+ const v = m.run;
12165
+ if (v) w.uint32(40).uint32(v);
12166
+ }
12088
12167
  }
12089
12168
  }
12090
12169
  );
@@ -12200,7 +12279,8 @@ var Cue = /* @__PURE__ */ createMessageType(
12200
12279
  () => [
12201
12280
  [1, "number", 13],
12202
12281
  [2, "sound", 9],
12203
- [3, "seconds", 2]
12282
+ [3, "seconds", 2],
12283
+ [4, "delay", 2]
12204
12284
  ],
12205
12285
  {
12206
12286
  decode: (r, end, m) => {
@@ -12217,6 +12297,9 @@ var Cue = /* @__PURE__ */ createMessageType(
12217
12297
  case 3:
12218
12298
  m.seconds = r.float();
12219
12299
  break;
12300
+ case 4:
12301
+ m.delay = r.float();
12302
+ break;
12220
12303
  default:
12221
12304
  r.skip(t);
12222
12305
  }
@@ -12236,6 +12319,10 @@ var Cue = /* @__PURE__ */ createMessageType(
12236
12319
  const v = m.seconds;
12237
12320
  if (v != null && v !== 0) w.uint32(29).float(v);
12238
12321
  }
12322
+ {
12323
+ const v = m.delay;
12324
+ if (v != null && v !== 0) w.uint32(37).float(v);
12325
+ }
12239
12326
  }
12240
12327
  }
12241
12328
  );
@@ -12533,7 +12620,9 @@ var Style = /* @__PURE__ */ createMessageType(
12533
12620
  [42, "text_overflow", 14, 0, TextOverflow_Enum],
12534
12621
  [43, "decoration", 14, 0, Decoration_Enum],
12535
12622
  [44, "transform", 11, 0, Transform.codec],
12536
- [45, "transition", 11, 0, Transition.codec]
12623
+ [45, "transition", 11, 0, Transition.codec],
12624
+ [46, "clip", 11, 0, Clip.codec],
12625
+ [47, "turn", 2]
12537
12626
  ],
12538
12627
  {
12539
12628
  decode: (r, end, m) => {
@@ -12684,6 +12773,12 @@ var Style = /* @__PURE__ */ createMessageType(
12684
12773
  m.transition ?? {}
12685
12774
  );
12686
12775
  break;
12776
+ case 46:
12777
+ m.clip = Clip.decode(r, r.delimited(), m.clip ?? {});
12778
+ break;
12779
+ case 47:
12780
+ m.turn = r.float();
12781
+ break;
12687
12782
  default:
12688
12783
  r.skip(t);
12689
12784
  }
@@ -12871,6 +12966,170 @@ var Style = /* @__PURE__ */ createMessageType(
12871
12966
  const v = m.transition;
12872
12967
  if (v != null) Transition.writeField(w, 45, v);
12873
12968
  }
12969
+ {
12970
+ const v = m.clip;
12971
+ if (v != null) Clip.writeField(w, 46, v);
12972
+ }
12973
+ {
12974
+ const v = m.turn;
12975
+ if (v != null && v !== 0) w.uint32(381).float(v);
12976
+ }
12977
+ }
12978
+ }
12979
+ );
12980
+ var Clip = /* @__PURE__ */ createMessageType(
12981
+ "modlock.wasm.ui.Clip",
12982
+ () => [
12983
+ [1, "rect", 11, 0, ClipRect.codec, "shape"],
12984
+ [2, "radial", 11, 0, ClipRadial.codec, "shape"]
12985
+ ],
12986
+ {
12987
+ decode: (r, end, m) => {
12988
+ while (r.pos < end) {
12989
+ const t = r.tag();
12990
+ if ((t & 7) === 4) return m;
12991
+ switch (t >>> 3) {
12992
+ case 1:
12993
+ m.shape = {
12994
+ case: "rect",
12995
+ value: ClipRect.decode(
12996
+ r,
12997
+ r.delimited(),
12998
+ m.shape?.case === "rect" ? m.shape.value : {}
12999
+ )
13000
+ };
13001
+ break;
13002
+ case 2:
13003
+ m.shape = {
13004
+ case: "radial",
13005
+ value: ClipRadial.decode(
13006
+ r,
13007
+ r.delimited(),
13008
+ m.shape?.case === "radial" ? m.shape.value : {}
13009
+ )
13010
+ };
13011
+ break;
13012
+ default:
13013
+ r.skip(t);
13014
+ }
13015
+ }
13016
+ return m;
13017
+ },
13018
+ encode: (m, w) => {
13019
+ {
13020
+ const o = m.shape;
13021
+ if (o?.case === "rect" && o.value != null)
13022
+ ClipRect.writeField(w, 1, o.value);
13023
+ }
13024
+ {
13025
+ const o = m.shape;
13026
+ if (o?.case === "radial" && o.value != null)
13027
+ ClipRadial.writeField(w, 2, o.value);
13028
+ }
13029
+ }
13030
+ }
13031
+ );
13032
+ var ClipRect = /* @__PURE__ */ createMessageType(
13033
+ "modlock.wasm.ui.ClipRect",
13034
+ () => [
13035
+ [1, "top", 2],
13036
+ [2, "right", 2],
13037
+ [3, "bottom", 2],
13038
+ [4, "left", 2]
13039
+ ],
13040
+ {
13041
+ decode: (r, end, m) => {
13042
+ while (r.pos < end) {
13043
+ const t = r.tag();
13044
+ if ((t & 7) === 4) return m;
13045
+ switch (t >>> 3) {
13046
+ case 1:
13047
+ m.top = r.float();
13048
+ break;
13049
+ case 2:
13050
+ m.right = r.float();
13051
+ break;
13052
+ case 3:
13053
+ m.bottom = r.float();
13054
+ break;
13055
+ case 4:
13056
+ m.left = r.float();
13057
+ break;
13058
+ default:
13059
+ r.skip(t);
13060
+ }
13061
+ }
13062
+ return m;
13063
+ },
13064
+ encode: (m, w) => {
13065
+ {
13066
+ const v = m.top;
13067
+ if (v != null && v !== 0) w.uint32(13).float(v);
13068
+ }
13069
+ {
13070
+ const v = m.right;
13071
+ if (v != null && v !== 0) w.uint32(21).float(v);
13072
+ }
13073
+ {
13074
+ const v = m.bottom;
13075
+ if (v != null && v !== 0) w.uint32(29).float(v);
13076
+ }
13077
+ {
13078
+ const v = m.left;
13079
+ if (v != null && v !== 0) w.uint32(37).float(v);
13080
+ }
13081
+ }
13082
+ }
13083
+ );
13084
+ var ClipRadial = /* @__PURE__ */ createMessageType(
13085
+ "modlock.wasm.ui.ClipRadial",
13086
+ () => [
13087
+ [1, "center_x", 2, 4],
13088
+ [2, "center_y", 2, 4],
13089
+ [3, "start", 2],
13090
+ [4, "sweep", 2]
13091
+ ],
13092
+ {
13093
+ decode: (r, end, m) => {
13094
+ while (r.pos < end) {
13095
+ const t = r.tag();
13096
+ if ((t & 7) === 4) return m;
13097
+ switch (t >>> 3) {
13098
+ case 1:
13099
+ m.centerX = r.float();
13100
+ break;
13101
+ case 2:
13102
+ m.centerY = r.float();
13103
+ break;
13104
+ case 3:
13105
+ m.start = r.float();
13106
+ break;
13107
+ case 4:
13108
+ m.sweep = r.float();
13109
+ break;
13110
+ default:
13111
+ r.skip(t);
13112
+ }
13113
+ }
13114
+ return m;
13115
+ },
13116
+ encode: (m, w) => {
13117
+ {
13118
+ const v = m.centerX;
13119
+ if (v != null) w.uint32(13).float(v);
13120
+ }
13121
+ {
13122
+ const v = m.centerY;
13123
+ if (v != null) w.uint32(21).float(v);
13124
+ }
13125
+ {
13126
+ const v = m.start;
13127
+ if (v != null && v !== 0) w.uint32(29).float(v);
13128
+ }
13129
+ {
13130
+ const v = m.sweep;
13131
+ if (v != null && v !== 0) w.uint32(37).float(v);
13132
+ }
12874
13133
  }
12875
13134
  }
12876
13135
  );
@@ -13096,7 +13355,8 @@ var Transition = /* @__PURE__ */ createMessageType(
13096
13355
  () => [
13097
13356
  [1, "seconds", 2],
13098
13357
  [2, "delay", 2],
13099
- [3, "easing", 14, 0, Easing_Enum]
13358
+ [3, "easing", 14, 0, Easing_Enum],
13359
+ [4, "curve", 11, 0, Curve.codec]
13100
13360
  ],
13101
13361
  {
13102
13362
  decode: (r, end, m) => {
@@ -13113,6 +13373,9 @@ var Transition = /* @__PURE__ */ createMessageType(
13113
13373
  case 3:
13114
13374
  m.easing = r.int32();
13115
13375
  break;
13376
+ case 4:
13377
+ m.curve = Curve.decode(r, r.delimited(), m.curve ?? {});
13378
+ break;
13116
13379
  default:
13117
13380
  r.skip(t);
13118
13381
  }
@@ -13132,6 +13395,62 @@ var Transition = /* @__PURE__ */ createMessageType(
13132
13395
  const v = m.easing;
13133
13396
  if (v) w.uint32(24).int32(v);
13134
13397
  }
13398
+ {
13399
+ const v = m.curve;
13400
+ if (v != null) Curve.writeField(w, 4, v);
13401
+ }
13402
+ }
13403
+ }
13404
+ );
13405
+ var Curve = /* @__PURE__ */ createMessageType(
13406
+ "modlock.wasm.ui.Curve",
13407
+ () => [
13408
+ [1, "x1", 2],
13409
+ [2, "y1", 2],
13410
+ [3, "x2", 2],
13411
+ [4, "y2", 2]
13412
+ ],
13413
+ {
13414
+ decode: (r, end, m) => {
13415
+ while (r.pos < end) {
13416
+ const t = r.tag();
13417
+ if ((t & 7) === 4) return m;
13418
+ switch (t >>> 3) {
13419
+ case 1:
13420
+ m.x1 = r.float();
13421
+ break;
13422
+ case 2:
13423
+ m.y1 = r.float();
13424
+ break;
13425
+ case 3:
13426
+ m.x2 = r.float();
13427
+ break;
13428
+ case 4:
13429
+ m.y2 = r.float();
13430
+ break;
13431
+ default:
13432
+ r.skip(t);
13433
+ }
13434
+ }
13435
+ return m;
13436
+ },
13437
+ encode: (m, w) => {
13438
+ {
13439
+ const v = m.x1;
13440
+ if (v != null && v !== 0) w.uint32(13).float(v);
13441
+ }
13442
+ {
13443
+ const v = m.y1;
13444
+ if (v != null && v !== 0) w.uint32(21).float(v);
13445
+ }
13446
+ {
13447
+ const v = m.x2;
13448
+ if (v != null && v !== 0) w.uint32(29).float(v);
13449
+ }
13450
+ {
13451
+ const v = m.y2;
13452
+ if (v != null && v !== 0) w.uint32(37).float(v);
13453
+ }
13135
13454
  }
13136
13455
  }
13137
13456
  );
@@ -16430,7 +16749,7 @@ function arriving(component, from) {
16430
16749
  }
16431
16750
  function Text(props) {
16432
16751
  const type = types[props.role];
16433
- return element(
16752
+ const text2 = element(
16434
16753
  "label",
16435
16754
  {
16436
16755
  face: type.face,
@@ -16444,6 +16763,7 @@ function Text(props) {
16444
16763
  },
16445
16764
  props.children
16446
16765
  );
16766
+ return props.clock ? { ...text2, props: { ...text2.props, clock: props.clock } } : text2;
16447
16767
  }
16448
16768
  function Plate(props) {
16449
16769
  return element(
@@ -17200,7 +17520,12 @@ function toast(player, text2, seconds = 4) {
17200
17520
  }
17201
17521
  function uiSound(player, sound, options = {}) {
17202
17522
  const current = view(player);
17203
- const cue = { number: nextCue++, sound, seconds: options.seconds ?? 0 };
17523
+ const cue = {
17524
+ number: nextCue++,
17525
+ sound,
17526
+ seconds: options.seconds ?? 0,
17527
+ delay: options.delay ?? 0
17528
+ };
17204
17529
  views.set(player.slot, {
17205
17530
  ...current,
17206
17531
  cues: [...current.cues, cue].slice(-maxCues)
@@ -17468,6 +17793,7 @@ function place(layout, child, at3) {
17468
17793
  node.text = text(props.children);
17469
17794
  node.token = props.token;
17470
17795
  node.variables = variables(props.variables);
17796
+ node.clock = clock2(props.clock);
17471
17797
  break;
17472
17798
  case "avatar":
17473
17799
  node.kind = 8 /* AVATAR */;
@@ -17564,6 +17890,43 @@ function input(layout, node, kind, props) {
17564
17890
  };
17565
17891
  }
17566
17892
  }
17893
+ function clock2(value) {
17894
+ if (!value) {
17895
+ return void 0;
17896
+ }
17897
+ return {
17898
+ seconds: value.seconds,
17899
+ up: value.up,
17900
+ paused: value.paused,
17901
+ format: value.format === void 0 ? void 0 : clockFormats[value.format],
17902
+ run: value.run
17903
+ };
17904
+ }
17905
+ var clockFormats = {
17906
+ minutes: 0 /* MINUTES */,
17907
+ seconds: 1 /* SECONDS */,
17908
+ tenths: 2 /* TENTHS */
17909
+ };
17910
+ function clip2(value) {
17911
+ if (!value) {
17912
+ return void 0;
17913
+ }
17914
+ if (value.rect) {
17915
+ const [top, right, bottom, left3] = value.rect;
17916
+ return { shape: { case: "rect", value: { top, right, bottom, left: left3 } } };
17917
+ }
17918
+ return {
17919
+ shape: {
17920
+ case: "radial",
17921
+ value: {
17922
+ centerX: value.center?.[0],
17923
+ centerY: value.center?.[1],
17924
+ start: value.start,
17925
+ sweep: value.sweep
17926
+ }
17927
+ }
17928
+ };
17929
+ }
17567
17930
  function variables(value) {
17568
17931
  if (!value) {
17569
17932
  return void 0;
@@ -17636,6 +17999,9 @@ var hudParts = {
17636
17999
  stats: 9 /* STATS */,
17637
18000
  heroPicker: 10 /* HERO_PICKER */,
17638
18001
  brokerCountdown: 11 /* BROKER_COUNTDOWN */,
18002
+ minimapPlayers: 13 /* MINIMAP_PLAYERS */,
18003
+ inventory: 14 /* INVENTORY */,
18004
+ crosshair: 15 /* CROSSHAIR */,
17639
18005
  all: 12 /* ALL */
17640
18006
  };
17641
18007
  var faces = {
@@ -17757,6 +18123,8 @@ function wireStyle(style) {
17757
18123
  textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
17758
18124
  decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
17759
18125
  transform: transform(style),
18126
+ turn: style.turn,
18127
+ clip: clip2(style.clip),
17760
18128
  transition: transition(style.transition)
17761
18129
  };
17762
18130
  }
@@ -17812,7 +18180,13 @@ function transition(value) {
17812
18180
  return {
17813
18181
  seconds: value.seconds,
17814
18182
  delay: value.delay,
17815
- easing: value.easing === void 0 ? void 0 : easings[value.easing]
18183
+ easing: value.easing === void 0 ? void 0 : easings[value.easing],
18184
+ curve: value.curve ? {
18185
+ x1: value.curve[0],
18186
+ y1: value.curve[1],
18187
+ x2: value.curve[2],
18188
+ y2: value.curve[3]
18189
+ } : void 0
17816
18190
  };
17817
18191
  }
17818
18192
  function length(value) {
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.92",
11
- "@modlock/darwin-x64": "0.1.92",
12
- "@modlock/linux-arm64": "0.1.92",
13
- "@modlock/linux-x64": "0.1.92",
14
- "@modlock/win32-x64": "0.1.92"
10
+ "@modlock/darwin-arm64": "0.1.93",
11
+ "@modlock/darwin-x64": "0.1.93",
12
+ "@modlock/linux-arm64": "0.1.93",
13
+ "@modlock/linux-x64": "0.1.93",
14
+ "@modlock/win32-x64": "0.1.93"
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.92"
23
+ "version": "0.1.93"
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, and 'all' the whole HUD but the mods' own interfaces and
168
- * the game's tooltips, for a screen that takes the player's whole view.
169
- * Whatever a part does not name stays, such as the crosshair and chat.
170
- */
171
- export type HudPart = 'levelUp' | 'ownHealth' | 'topBar' | 'ammo' | 'souls' | 'minimap' | 'abilities' | 'status' | 'stats' | 'heroPicker' | 'brokerCountdown' | 'all';
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
- /** ImageProps show an image from the game's content, such as 'file://{images}/hud/icon.png'. */
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. It plays with the next screen the player reads, and not at all if
546
- * the player reads it only after the mod's next few sounds.
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