@wayward/types 2.14.0-beta.dev.20240901.1 → 2.14.0-beta.dev.20240902.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.
@@ -35,6 +35,9 @@ export declare enum InfoClass {
35
35
  Description = "info-provider-description",
36
36
  List = "info-provider-list",
37
37
  ListItem = "info-provider-list-item",
38
- MultiTextParagraph = "info-provider-multi-text-paragraph"
38
+ MultiTextParagraph = "info-provider-multi-text-paragraph",
39
+ DisplayRoot = "display-root",
40
+ DisplayLevelExtra = "display-level-extra",
41
+ DisplayLevelVerbose = "display-level-verbose"
39
42
  }
40
43
  export {};
@@ -38,7 +38,7 @@ export interface ISerializedTranslation {
38
38
  reformatters?: Reformatter[];
39
39
  reference?: Reference;
40
40
  referenceContext?: InfoProviderContext;
41
- referenceForced?: true;
41
+ forceInclude?: true;
42
42
  tooltip?: ISerializedTranslation | IStringSection[];
43
43
  tooltipWide?: true;
44
44
  interpolator?: ISerializedInterpolator;
@@ -67,7 +67,7 @@ export default class TranslationImpl implements Omit<ISerializable, "deserialize
67
67
  private tooltipWide?;
68
68
  private reference?;
69
69
  private referenceContext?;
70
- private referenceForced?;
70
+ private forceInclude?;
71
71
  private classes?;
72
72
  constructor(dictionary: Dictionary | string, entry: number | string, index?: "random" | number);
73
73
  constructor(translationId: string);
@@ -132,7 +132,7 @@ export default class TranslationImpl implements Omit<ISerializable, "deserialize
132
132
  private getCustomInterpolatorSegments;
133
133
  serializeObject(): ISerializedTranslation;
134
134
  serialize(depth?: number): ISerializedTranslation;
135
- static serializeTranslationArg(arg: any, depth?: number, maxSerializationDepth?: number): ISerializedTranslation | undefined;
135
+ static serializeTranslationArg(arg: any, depth?: number, maxSerializationDepth?: number): TranslationArg | undefined;
136
136
  private canCache;
137
137
  private getCachedTranslation;
138
138
  /**
@@ -43,6 +43,7 @@ export interface IOptions {
43
43
  disableHealthVignette: boolean;
44
44
  disableMovementAnimations: boolean;
45
45
  disableOverlaySupport: boolean;
46
+ disableQuitConfirmation: boolean;
46
47
  disableSpritePack: boolean;
47
48
  disableUIEffects: boolean;
48
49
  disableUIOpacity: boolean;
@@ -91,7 +92,6 @@ export interface IOptions {
91
92
  windowMode: boolean;
92
93
  zoomLevel: number;
93
94
  zoomSmoothing: boolean;
94
- disableQuitConfirmation: boolean;
95
95
  }
96
96
  export declare enum DropLocation {
97
97
  Facing = 0,
@@ -67,5 +67,8 @@ export declare enum UiClasses {
67
67
  }
68
68
  export declare namespace UiClasses {
69
69
  function createDynamic<CLASS extends string, ENUM>(baseClass: CLASS, enm: ENUM): (enumValue: ENUM[keyof ENUM]) => `${CLASS}-${Lowercase<keyof ENUM & string>}`;
70
+ /**
71
+ * For raw classes use `InfoClass`
72
+ */
70
73
  function displayLevel(displayLevel: InfoDisplayLevel): string[];
71
74
  }
@@ -97,6 +97,7 @@ export declare class Ui extends EventEmitter.Host<IUiEvents> {
97
97
  * @param save Whether or not to save the new scale into options. Defaults to true.
98
98
  */
99
99
  setDialogOpacity(opacity?: number, save?: boolean): void;
100
+ private stylesheetIndex;
100
101
  addStylesheet(path: string): void;
101
102
  removeStylesheet(path: string): void;
102
103
  private getStylesheet;
@@ -97,6 +97,7 @@ export default class Component<E extends HTMLElement = HTMLElement> extends Even
97
97
  * Alias of `.element.addEventListener`, except it returns `this` instead and prevents memory leaks
98
98
  */
99
99
  addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): this;
100
+ addEventListener(type: string, listener: (this: HTMLElement, ev: Event) => any, options?: boolean | AddEventListenerOptions): this;
100
101
  removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any): this;
101
102
  getAs<C extends Component>(cls: AnyClass<C>): C | undefined;
102
103
  matches(selector: string): boolean;
@@ -161,6 +162,7 @@ export default class Component<E extends HTMLElement = HTMLElement> extends Even
161
162
  * @param visible The new visiblity of this element.
162
163
  */
163
164
  toggle(visible?: boolean, trustInternalState?: boolean): this;
165
+ setInert(inert?: boolean): this;
164
166
  /**
165
167
  * Returns this component's parent component, if it exists.
166
168
  */
@@ -22,6 +22,7 @@ import { GlobalMouseInfo } from "@wayward/game/ui/input/InputManager";
22
22
  import type { IContainerSortInfo } from "@wayward/game/ui/old/IOldUi";
23
23
  import { CraftingSort, OldUiDialogId } from "@wayward/game/ui/old/IOldUi";
24
24
  import BaseScreen from "@wayward/game/ui/old/screens/BaseScreen";
25
+ import type ScreenManager from "@wayward/game/ui/screen/ScreenManager";
25
26
  export type DialogIndexStrings = "inventory" | "crafting-tabs";
26
27
  export type DialogIndex = DialogIndexStrings | Reference<ReferenceType.Item | ReferenceType.Doodad | ReferenceType.NPC>;
27
28
  export type DereferencedDialogIndex = DialogIndexStrings | number;
@@ -79,6 +80,7 @@ export default class InGameScreen extends BaseScreen {
79
80
  private derefenceDialogIndex;
80
81
  setupDialog(dialogId: OldUiDialogId, containerReference?: ContainerReference): JQueryUI.DialogOptions;
81
82
  blurInputs(): void;
83
+ protected onScreenStateChange(screens: ScreenManager): void;
82
84
  toggleDialog(dialog: JQuery): boolean;
83
85
  openDialog(dialog: JQuery): boolean;
84
86
  onOpenDialog(dialog: JQuery): void;
@@ -25,6 +25,10 @@ interface IScreenEvents extends Events<Component> {
25
25
  showDialog(dialog: Dialog): any;
26
26
  showContextMenu(contextMenu: ContextMenu): any;
27
27
  hideContextMenu(contextMenu: ContextMenu): any;
28
+ /** Emitted when this screen is obscured by another */
29
+ obscure(): any;
30
+ /** Emitted when this screen is no longer obscured */
31
+ reveal(): any;
28
32
  }
29
33
  export default abstract class Screen extends Component {
30
34
  readonly type: ScreenId;
@@ -38,6 +42,7 @@ export default abstract class Screen extends Component {
38
42
  dialogs: DialogManager;
39
43
  visibleDialogs: IDialogStates;
40
44
  constructor(type: ScreenId);
45
+ get isObscured(): boolean;
41
46
  remove(): this;
42
47
  getBackground(): Background;
43
48
  setBackground(background: Background): this;
@@ -14,6 +14,11 @@ import Screen from "@wayward/game/ui/screen/Screen";
14
14
  import type { ScreenById } from "@wayward/game/ui/screen/ScreenMap";
15
15
  import Stream from "@wayward/goodstream/Stream";
16
16
  import EventEmitter from "@wayward/utilities/event/EventEmitter";
17
+ export declare enum ScreenClasses {
18
+ Main = "screen",
19
+ _Top = "screen--top",
20
+ _Obscured = "screen--obscured"
21
+ }
17
22
  export interface IScreenManagerEvents {
18
23
  init(screen: Screen): any;
19
24
  show(screen: Screen): any;
@@ -68,6 +73,7 @@ export default class ScreenManager extends EventEmitter.Host<IScreenManagerEvent
68
73
  * Returns if the given screen id is a currently visible screen (either the main screen or the overlay screen).
69
74
  */
70
75
  isVisible(screenId: ScreenId): boolean;
76
+ hasOverlay(): boolean;
71
77
  /**
72
78
  * Shows a screen
73
79
  * @param screenId The id of the screen to show
@@ -44,6 +44,13 @@ import InteractionManager from "@wayward/game/ui/screen/screens/game/util/moveme
44
44
  import type { Direction } from "@wayward/game/utilities/math/Direction";
45
45
  import type Stream from "@wayward/goodstream";
46
46
  import type { Events, IEventEmitter } from "@wayward/utilities/event/EventEmitter";
47
+ export declare enum GameScreenClasses {
48
+ PauseIcon = "pause-icon",
49
+ PauseIcon_Paused = "pause-icon--paused",
50
+ PauseIcon_Unpausable = "pause-icon--unpausable",
51
+ PauseIcon_Visible = "pause-icon--visible",
52
+ PauseIcon_Overlay = "pause-icon--overlay"
53
+ }
47
54
  export type IDialogStates = {
48
55
  [key in `${DialogId}` | `${DialogId},${string}`]: boolean;
49
56
  };
@@ -75,6 +82,7 @@ export default class GameScreen extends Screen {
75
82
  private readonly pausedPopupOverlay;
76
83
  private readonly nightPopupOverlay;
77
84
  private readonly buttonRespawn;
85
+ private readonly buttonPause;
78
86
  constructor();
79
87
  get isTwoColumn(): boolean;
80
88
  private get gameCanvasComponent();
@@ -183,6 +191,9 @@ export default class GameScreen extends Screen {
183
191
  * Returns the first unused `Quadrant`, or `Quadrant.None` if there are none.
184
192
  */
185
193
  private getUnusedQuadrant;
194
+ protected onObscureOrReveal(): void;
186
195
  private updatePauseIcon;
187
- private get canUnpause();
196
+ private get canSelfUnpause();
197
+ private get isRelevantlyPaused();
198
+ private get couldBeRelevantlyPaused();
188
199
  }
@@ -81,6 +81,7 @@ export default class ContainerBucket extends Component {
81
81
  protected makeTopDialog(dialog: Dialog, order: number): void;
82
82
  protected onDialogMoveOrResize(dialog: Dialog): void;
83
83
  protected onContainerUpdateOrder(manager: ItemManager, container: IContainer): void;
84
+ protected onRooted(): void;
84
85
  protected onMouseEnter(): void;
85
86
  protected onMouseLeave(): void;
86
87
  private updateDialogActive;
@@ -50,8 +50,9 @@ export default class ApplicationInteractions {
50
50
  clickJoinServer(): Promise<void>;
51
51
  clickDailyChallenge(): Promise<void>;
52
52
  clickBack(timeout?: number): Promise<void>;
53
- clickButton(name: string, options?: Partial<{
53
+ clickButton(buttonText: string, options?: Partial<{
54
54
  force: boolean;
55
+ selector: string;
55
56
  clickOnce: boolean;
56
57
  timeout: number;
57
58
  }>): Promise<void>;
@@ -67,6 +67,8 @@ declare global {
67
67
  * @returns The new array length
68
68
  */
69
69
  insertSorted(value: T, ...sorters: SortingFunction.List<T>): number;
70
+ indexOfOrElse(value: T): number | undefined;
71
+ findIndexOrElse(predicate: (value: T) => any): number | undefined;
70
72
  }
71
73
  }
72
74
  export default function (): void;
@@ -0,0 +1,22 @@
1
+ declare namespace XPath {
2
+ /**
3
+ * Given a custom-formatted XPath selector, produces an XPath compatible version.
4
+ * Custom syntax:
5
+ * - No need to start the selector with `.//` to select from descendants
6
+ * - No need to have a `*` before an element filter, as it is implied if there's no tagname
7
+ * - `#id` — filters an element list down to only elements with this id (must be specified before .class)
8
+ * - `.class` — filters an element list down to only elements with this class
9
+ * - `[not(#id)]` — filters an element list down to only elements without this id
10
+ * - `[not(.class)]` — filters an element list down to only elements without this class
11
+ * - `text()*="text"` — filters down an element list to only elements with text containing "text"
12
+ * - `text()~="text"` — filters down an element list to only elements with text containing the word(s) "text"
13
+ * - `text()^="text"` — filters down an element list to only elements with text starting with "text"
14
+ * - `text()$="text"` — filters down an element list to only elements with text ending with "text"
15
+ * - `@attribute*="text"` — filters down an element list to only elements with the given attribute containing "text"
16
+ * - `@attribute~="text"` — filters down an element list to only elements with the given attribute containing the word(s) "text"
17
+ * - `@attribute^="text"` — filters down an element list to only elements with the given attribute starting with "text"
18
+ * - `@attribute$="text"` — filters down an element list to only elements with the given attribute ending with "text"
19
+ */
20
+ function selector(selector: string): string;
21
+ }
22
+ export default XPath;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wayward/types",
3
3
  "description": "TypeScript declarations for Wayward, used for modding.",
4
- "version": "2.14.0-beta.dev.20240901.1",
4
+ "version": "2.14.0-beta.dev.20240902.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",