@sandustry-modding/types 0.3.1 → 0.4.0

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +40 -11
  2. package/README.md +3 -0
  3. package/package.json +12 -2
  4. package/src/configs/index.d.ts +38 -0
  5. package/src/configs/modinfo.d.ts +751 -0
  6. package/src/configs/patches.d.ts +195 -0
  7. package/src/sandkit/api/action.d.ts +5 -0
  8. package/src/sandkit/api/blueprints.d.ts +5 -3
  9. package/src/sandkit/api/camera.d.ts +5 -0
  10. package/src/sandkit/api/effects.d.ts +28 -7
  11. package/src/sandkit/api/elements.d.ts +124 -39
  12. package/src/sandkit/api/energy.d.ts +8 -0
  13. package/src/sandkit/api/entities.d.ts +15 -8
  14. package/src/sandkit/api/events.d.ts +139 -2
  15. package/src/sandkit/api/excavation.d.ts +33 -3
  16. package/src/sandkit/api/factory.d.ts +6 -4
  17. package/src/sandkit/api/fire.d.ts +7 -4
  18. package/src/sandkit/api/game.d.ts +8 -2
  19. package/src/sandkit/api/grid.d.ts +72 -23
  20. package/src/sandkit/api/hooks.d.ts +362 -2
  21. package/src/sandkit/api/i18n.d.ts +65 -20
  22. package/src/sandkit/api/input.d.ts +15 -0
  23. package/src/sandkit/api/items.d.ts +7 -0
  24. package/src/sandkit/api/lights.d.ts +55 -8
  25. package/src/sandkit/api/maps.d.ts +10 -1
  26. package/src/sandkit/api/patterns.d.ts +22 -0
  27. package/src/sandkit/api/pickups.d.ts +14 -8
  28. package/src/sandkit/api/pipes.d.ts +9 -5
  29. package/src/sandkit/api/player.d.ts +29 -15
  30. package/src/sandkit/api/progression.d.ts +8 -0
  31. package/src/sandkit/api/reactions.d.ts +11 -0
  32. package/src/sandkit/api/rendering.d.ts +25 -2
  33. package/src/sandkit/api/resources.d.ts +5 -0
  34. package/src/sandkit/api/schedule.d.ts +7 -0
  35. package/src/sandkit/api/settings.d.ts +7 -0
  36. package/src/sandkit/api/shared.d.ts +13 -3
  37. package/src/sandkit/api/signals.d.ts +29 -0
  38. package/src/sandkit/api/sound.d.ts +14 -8
  39. package/src/sandkit/api/structureBehaviors.d.ts +8 -0
  40. package/src/sandkit/api/structures.d.ts +353 -43
  41. package/src/sandkit/api/tech.d.ts +73 -9
  42. package/src/sandkit/api/terrains.d.ts +25 -13
  43. package/src/sandkit/api/triggers.d.ts +10 -0
  44. package/src/sandkit/api/ui.d.ts +146 -1
  45. package/src/sandkit/api/upgrades.d.ts +2 -1
  46. package/src/sandkit/api/utils.d.ts +10 -5
  47. package/src/sandkit/api/world.d.ts +30 -25
  48. package/src/sandkit/index.d.ts +12 -1
  49. package/src/shared/api/elements.d.ts +36 -22
  50. package/src/shared/api/grid.d.ts +11 -6
  51. package/src/shared/api/player.d.ts +8 -4
  52. package/src/shared/api/shared.d.ts +2 -1
  53. package/src/shared/api/structures.d.ts +55 -17
  54. package/src/shared/api/terrains.d.ts +39 -23
  55. package/src/shared/api/ui.d.ts +5 -0
  56. package/src/shared/api/world.d.ts +9 -9
  57. package/src/worker/api/effects.d.ts +11 -3
  58. package/src/worker/api/elements.d.ts +54 -19
  59. package/src/worker/api/events.d.ts +31 -2
  60. package/src/worker/api/fire.d.ts +4 -2
  61. package/src/worker/api/grid.d.ts +10 -2
  62. package/src/worker/api/hooks.d.ts +68 -2
  63. package/src/worker/api/lights.d.ts +13 -3
  64. package/src/worker/api/shared.d.ts +12 -2
  65. package/src/worker/sandkit-api.d.ts +2 -1
@@ -13,7 +13,8 @@ export namespace tech {
13
13
  * Return a tech definition by string id.
14
14
  *
15
15
  * @param techId - Tech entry identifier.
16
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.getDefinitionById`
16
+ *
17
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
17
18
  */
18
19
  export function getDefinitionById(techId: TechGridId): TechDefinition | undefined;
19
20
 
@@ -22,7 +23,15 @@ export namespace tech {
22
23
  *
23
24
  * @param techId - Tech entry identifier.
24
25
  * @param updates - Fields to merge into the definition.
25
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.updateDefinition`
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * api.tech.updateDefinition("exampleTech", {
30
+ * cost: 200,
31
+ * });
32
+ * ```
33
+ *
34
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
26
35
  */
27
36
  export function updateDefinition(techId: TechGridId, updates: Partial<TechDefinition>): void;
28
37
 
@@ -31,13 +40,26 @@ export namespace tech {
31
40
  *
32
41
  * @param techId - Tech entry identifier.
33
42
  * @param definition - Full tech definition to register.
34
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.registerDefinition`
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * api.tech.registerDefinition("exampleTech", {
47
+ * name: "Example research",
48
+ * nameKey: "mods|example|techName",
49
+ * description: "Unlocks the example machine.",
50
+ * descriptionKey: "mods|example|techDescription",
51
+ * cost: 100,
52
+ * });
53
+ * ```
54
+ *
55
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
35
56
  */
36
57
  export function registerDefinition(techId: TechGridId, definition: TechDefinition): void;
37
58
 
38
59
  /**
39
60
  * @deprecated Use {@link registerDefinition} instead.
40
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.tech.registerDefinition`
61
+ *
62
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
41
63
  */
42
64
  export function addDefinition(techId: TechGridId, definition: TechDefinition): void;
43
65
 
@@ -47,7 +69,17 @@ export namespace tech {
47
69
  * @param techId - Tech grid node id.
48
70
  * @param definition - Tech definition for the node.
49
71
  * @param options - Parent node id and optional preferred grid position.
50
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.registerNode`
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const position = api.tech.registerNode(
76
+ * "exampleTech",
77
+ * techDefinition,
78
+ * { parentId: parentTechId },
79
+ * );
80
+ * ```
81
+ *
82
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
51
83
  */
52
84
  export function registerNode(techId: TechGridId, definition: TechDefinition, options: { parentId: TechGridId; preferredPosition?: TechGridPosition; }): TechGridPosition;
53
85
 
@@ -55,7 +87,8 @@ export namespace tech {
55
87
  * Return true when a tech entry is locked.
56
88
  *
57
89
  * @param techId - Tech entry id (string or numeric enum).
58
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.isLockedById`
90
+ *
91
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
59
92
  */
60
93
  export function isLockedById(techId: TechGridId): boolean;
61
94
 
@@ -64,7 +97,8 @@ export namespace tech {
64
97
  *
65
98
  * @param techId - Tech entry id (string or numeric enum).
66
99
  * @param locked - When true, the tech cannot be purchased.
67
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.setLockedById`
100
+ *
101
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
68
102
  */
69
103
  export function setLockedById(techId: TechGridId, locked: boolean): void;
70
104
 
@@ -72,7 +106,8 @@ export namespace tech {
72
106
  * Return true when a tech entry has been researched.
73
107
  *
74
108
  * @param techId - Tech entry id (string or numeric enum).
75
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.isResearchedById`
109
+ *
110
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
76
111
  */
77
112
  export function isResearchedById(techId: TechGridId): boolean;
78
113
 
@@ -83,7 +118,15 @@ export namespace tech {
83
118
  *
84
119
  * @param techId - Built-in or custom tech id.
85
120
  * @param unlocks - Optional structure and item ids to unlock.
86
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.conservatory.appendUnlock`
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * api.tech.conservatory.appendUnlock(sandkit.enums.Tech.SignalDevices, {
125
+ * structures: ["exampleSensor"],
126
+ * });
127
+ * ```
128
+ *
129
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
87
130
  */
88
131
  export function appendUnlock(techId: TechGridId, unlocks: ConservatoryUnlocks): void;
89
132
  }
@@ -96,10 +139,31 @@ export namespace tech {
96
139
 
97
140
  /** Tech definition shape. */
98
141
  export interface TechDefinition {
142
+ /** Plain display name (when not using {@link nameKey}). */
143
+ name?: string;
99
144
  /** Display name translation key. */
100
145
  nameKey?: string;
146
+ /** Plain description (when not using {@link descriptionKey}). */
147
+ description?: string;
101
148
  /** Description translation key. */
102
149
  descriptionKey?: string;
150
+ /**
151
+ * Research cost.
152
+ *
153
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
154
+ */
155
+ cost?: number;
156
+ /** Currency used for {@link cost} (for example `"gold"`). */
157
+ currencyType?: string;
158
+ /** Tech tree branch id (often copied from the parent node). */
159
+ branch?: string;
160
+ /** Content unlocked when this tech is researched. */
161
+ unlocks?: {
162
+ structures?: readonly string[];
163
+ items?: readonly string[];
164
+ };
165
+ /** Prerequisite tech ids. */
166
+ requires?: readonly string[];
103
167
  [key: string]: unknown;
104
168
  }
105
169
 
@@ -17,7 +17,8 @@ export namespace terrains {
17
17
  export import getTypeById = shared.api.terrains.getTypeById;
18
18
  /**
19
19
  * @deprecated Use {@link getTypeById} instead.
20
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.getTypeById`
20
+ *
21
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
21
22
  */
22
23
  export import getTypeFromId = shared.api.terrains.getTypeFromId;
23
24
  /** Look up the definition for a terrain type. */
@@ -48,7 +49,7 @@ export namespace terrains {
48
49
  /**
49
50
  * Terrain definition shape with typed element interactions.
50
51
  *
51
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.register`
52
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
52
53
  */
53
54
  export interface TerrainDefinition extends Omit<shared.api.terrains.TerrainDefinition, "interactions"> {
54
55
  /** Tooltip interactions shown for this terrain. */
@@ -60,7 +61,8 @@ export namespace terrains {
60
61
  *
61
62
  * @param definition - Terrain definition to register.
62
63
  * @returns Object with the assigned `cellType`.
63
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.register`
64
+ *
65
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
64
66
  */
65
67
  export function register(definition: TerrainDefinition): { cellType: TerrainType; };
66
68
 
@@ -69,7 +71,8 @@ export namespace terrains {
69
71
  *
70
72
  * @param cellTypeOrId - Numeric cell type or terrain string id.
71
73
  * @param partial - Fields to merge onto the definition.
72
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.updateDefinition`
74
+ *
75
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
73
76
  */
74
77
  export function updateDefinition(cellTypeOrId: TerrainRef, partial: Partial<TerrainDefinition>): void;
75
78
 
@@ -80,13 +83,15 @@ export namespace terrains {
80
83
  * @param cellY - Grid row of the target cell.
81
84
  * @param terrainTypeOrId - Numeric cell type or terrain string id.
82
85
  * @param options - Optional mutation flags.
83
- * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.createAtCell`
86
+ *
87
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
84
88
  */
85
89
  export function createAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
86
90
 
87
91
  /**
88
92
  * @deprecated Use {@link createAtCell} instead.
89
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.createAtCell`
93
+ *
94
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
90
95
  */
91
96
  export function createAtCellWhenIdle(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
92
97
 
@@ -97,13 +102,15 @@ export namespace terrains {
97
102
  * @param cellY - Grid row of the target cell.
98
103
  * @param terrainTypeOrId - Numeric cell type or terrain string id.
99
104
  * @param options - Optional mutation flags.
100
- * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.replaceAtCell`
105
+ *
106
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
101
107
  */
102
108
  export function replaceAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
103
109
 
104
110
  /**
105
111
  * @deprecated Use {@link replaceAtCell} instead.
106
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.replaceAtCell`
112
+ *
113
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
107
114
  */
108
115
  export function replaceAtCellWhenIdle(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
109
116
 
@@ -113,13 +120,15 @@ export namespace terrains {
113
120
  * @param cellX - Grid column of the target cell.
114
121
  * @param cellY - Grid row of the target cell.
115
122
  * @param options - Optional mutation flags.
116
- * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.removeAtCell`
123
+ *
124
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
117
125
  */
118
126
  export function removeAtCell(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
119
127
 
120
128
  /**
121
129
  * @deprecated Use {@link removeAtCell} instead.
122
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.removeAtCell`
130
+ *
131
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
123
132
  */
124
133
  export function removeAtCellWhenIdle(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
125
134
 
@@ -129,19 +138,22 @@ export namespace terrains {
129
138
  * @param cellX - Grid column of the target cell.
130
139
  * @param cellY - Grid row of the target cell.
131
140
  * @param hitPoints - New hit point value.
132
- * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.setHitPointsAtCell`
141
+ *
142
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
133
143
  */
134
144
  export function setHitPointsAtCell(...args: [...CellCoordinates, hitPoints: number]): void;
135
145
 
136
146
  /**
137
147
  * @deprecated Use {@link setHitPointsAtCell} instead.
138
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.setHitPointsAtCell`
148
+ *
149
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
139
150
  */
140
151
  export function setHpAtCell(...args: [...CellCoordinates, hitPoints: number]): boolean;
141
152
 
142
153
  /**
143
154
  * @deprecated Use {@link setHitPointsAtCell} instead.
144
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.setHitPointsAtCell`
155
+ *
156
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
145
157
  */
146
158
  export function setHpAtCellWhenIdle(...args: [...CellCoordinates, hitPoints: number]): void;
147
159
  }
@@ -10,6 +10,16 @@ export namespace triggers {
10
10
  * Register a repeating trigger with interval and callback.
11
11
  * @param triggerId - Unique trigger identifier.
12
12
  * @param definition - Interval in ticks and callback to invoke.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * api.triggers.register("example:update", {
17
+ * intervalMs: 250,
18
+ * callback: (trigger, deltaTimeMs) => {
19
+ * updateExample(trigger, deltaTimeMs);
20
+ * },
21
+ * });
22
+ * ```
13
23
  */
14
24
  export function register(triggerId: string, definition: MainTriggerDefinition): void;
15
25
 
@@ -10,8 +10,112 @@ import type { ComponentId as ComponentIdEnum } from "../enums/index";
10
10
  import { shared } from "../../shared";
11
11
  import type { LooseString } from "../../shared/nominal";
12
12
 
13
+ /**
14
+ * @example api.ui.components.ActionSlot
15
+ * ```ts
16
+ * const slot = sandkit.react.createElement(
17
+ * api.ui.components.ActionSlot,
18
+ * { source, slotIndex: 0, keyLabel: "1" },
19
+ * );
20
+ * ```
21
+ *
22
+ * @example api.ui.components.Button
23
+ * ```ts
24
+ * const button = sandkit.react.createElement(
25
+ * api.ui.components.Button,
26
+ * { onClick: openPanel },
27
+ * "Open",
28
+ * );
29
+ * ```
30
+ *
31
+ * @example api.ui.components.Panel
32
+ * ```ts
33
+ * const panel = sandkit.react.createElement(
34
+ * api.ui.components.Panel,
35
+ * { title: "Options" },
36
+ * "Panel content",
37
+ * );
38
+ * ```
39
+ *
40
+ * @example api.ui.hotbar.createBankSource
41
+ * ```ts
42
+ * const source = api.ui.hotbar.createBankSource({
43
+ * bankOffset: 1,
44
+ * minimumBankCount: 2,
45
+ * });
46
+ * ```
47
+ *
48
+ * @example api.ui.hotbar.useHotbar
49
+ * ```ts
50
+ * const hotbar = api.ui.hotbar.useHotbar();
51
+ * console.log(
52
+ * hotbar.bankCount,
53
+ * hotbar.activeBankIndex,
54
+ * hotbar.activeSlotIndex,
55
+ * );
56
+ * ```
57
+ *
58
+ * @example api.ui.overrides.register
59
+ * ```ts
60
+ * const overrideHandle = api.ui.overrides.register(
61
+ * "resources",
62
+ * (Original) => sandkit.react.createElement(
63
+ * sandkit.react.Fragment,
64
+ * null,
65
+ * sandkit.react.createElement(Original),
66
+ * sandkit.react.createElement(ResourceAddon),
67
+ * ),
68
+ * );
69
+ * ```
70
+ *
71
+ * @example api.ui.regions.mount
72
+ * ```ts
73
+ * const mountHandle = api.ui.regions.mount(
74
+ * "hotbar",
75
+ * "extra-actions",
76
+ * {
77
+ * placement: "docked",
78
+ * order: 0,
79
+ * render: () => sandkit.react.createElement(ExtraActions),
80
+ * },
81
+ * );
82
+ * ```
83
+ *
84
+ * @example api.ui.regions.mountHandle.update
85
+ * ```ts
86
+ * mountHandle.update({
87
+ * order: 10,
88
+ * render: () => sandkit.react.createElement(UpdatedActions),
89
+ * });
90
+ * ```
91
+ *
92
+ * @example api.ui.select
93
+ * ```ts
94
+ * const selected = await api.ui.select(
95
+ * [
96
+ * { label: "Sand", value: "sand" },
97
+ * { label: "Fluxite", value: "fluxite" },
98
+ * ],
99
+ * { title: "Select element", defaultValue: "sand", buttonLabel: "Choose" },
100
+ * );
101
+ * ```
102
+ *
103
+ * @example api.ui.useGameEvent
104
+ * ```ts
105
+ * api.ui.useGameEvent("resource:collected", (payload) => {
106
+ * console.log(payload.resourceId, payload.amount);
107
+ * });
108
+ * ```
109
+ */
13
110
  export namespace ui {
14
- /** Show a toast message. */
111
+ /**
112
+ * Show a toast message.
113
+ *
114
+ * @example Main entry
115
+ * ```ts
116
+ * api.ui.toast({ key: "mods|example|saved" });
117
+ * ```
118
+ */
15
119
  export import toast = shared.api.ui.toast;
16
120
  /** Localized text value for UI strings. */
17
121
  export import LocalizedText = shared.api.ui.LocalizedText;
@@ -39,6 +143,14 @@ export namespace ui {
39
143
  * @param message - Dialog body text.
40
144
  * @param title - Optional dialog title.
41
145
  * @returns Promise that resolves when the user dismisses the dialog.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * await api.ui.alert(
150
+ * { key: "mods|example|details" },
151
+ * { key: "mods|example|title" },
152
+ * );
153
+ * ```
42
154
  */
43
155
  export function alert(message: LocalizedText, title?: LocalizedText): Promise<void>;
44
156
 
@@ -47,6 +159,13 @@ export namespace ui {
47
159
  * @param message - Dialog body text.
48
160
  * @param title - Optional dialog title.
49
161
  * @returns Promise that resolves with true when confirmed, or false when cancelled.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * const confirmed = await api.ui.confirm(
166
+ * { key: "mods|example|confirm" },
167
+ * );
168
+ * ```
50
169
  */
51
170
  export function confirm(message: LocalizedText, title?: LocalizedText): Promise<boolean>;
52
171
 
@@ -58,6 +177,14 @@ export namespace ui {
58
177
  * @param title - Optional dialog title.
59
178
  * @param allowCopy - When true, allow copying the result from the dialog.
60
179
  * @returns Promise that resolves with entered text, or null when cancelled.
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * const value = await api.ui.prompt(
184
+ * { key: "mods|example|enterValue" },
185
+ * "",
186
+ * );
187
+ * ```
61
188
  */
62
189
  export function prompt(message: LocalizedText, defaultValue?: string, placeholder?: LocalizedText, title?: LocalizedText, allowCopy?: boolean): Promise<string | null>;
63
190
 
@@ -99,12 +226,30 @@ export namespace ui {
99
226
  * React hook for a focusable UI element in a scope.
100
227
  * @param options - Focus registration and neighbor wiring.
101
228
  * @returns Ref, focus state, and a focus helper.
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * const focusable = api.ui.navigation.useFocusable({
233
+ * id: "example-button",
234
+ * scope: "example-scope",
235
+ * onActivate: openExample,
236
+ * });
237
+ * ```
102
238
  */
103
239
  export function useFocusable<T extends HTMLElement = HTMLDivElement>(options: FocusOptions): Focusable<T>;
104
240
 
105
241
  /**
106
242
  * React hook to register a focus scope with back handling.
107
243
  * @param options - Scope id, priority, default focus, and back handler.
244
+ *
245
+ * @example
246
+ * ```ts
247
+ * api.ui.navigation.useFocusScope({
248
+ * id: "example-scope",
249
+ * active: true,
250
+ * priority: 10,
251
+ * });
252
+ * ```
108
253
  */
109
254
  export function useFocusScope(options: { readonly id: string; readonly active: boolean; readonly priority?: number; readonly defaultId?: string; readonly onBack?: (() => boolean | void); }): void;
110
255
 
@@ -41,7 +41,8 @@ export namespace upgrades {
41
41
  * @param itemId - Parent item id.
42
42
  * @param upgradeId - Upgrade id within the item.
43
43
  * @param level - Level to set.
44
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.upgrades.setLevelById`
44
+ *
45
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
45
46
  */
46
47
  export function setLevelById(itemId: string, upgradeId: string, level: number): void;
47
48
 
@@ -13,7 +13,8 @@ export namespace utils {
13
13
  *
14
14
  * @param pointA - First point.
15
15
  * @param pointB - Second point.
16
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getDistance`
16
+ *
17
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
17
18
  */
18
19
  export function getDistance(pointA: Vector2, pointB: Vector2): number;
19
20
 
@@ -22,7 +23,8 @@ export namespace utils {
22
23
  *
23
24
  * @param pointA - Origin point.
24
25
  * @param pointB - Target point.
25
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getDirection`
26
+ *
27
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
26
28
  */
27
29
  export function getDirection(pointA: Vector2, pointB: Vector2): Vector2;
28
30
 
@@ -31,7 +33,8 @@ export namespace utils {
31
33
  *
32
34
  * @param pointA - Origin point.
33
35
  * @param pointB - Target point.
34
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getAngle`
36
+ *
37
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
35
38
  */
36
39
  export function getAngle(pointA: Vector2, pointB: Vector2): number;
37
40
 
@@ -40,13 +43,15 @@ export namespace utils {
40
43
  *
41
44
  * @param pointA - Line start in cell coordinates.
42
45
  * @param pointB - Line end in cell coordinates.
43
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getCoordinatesBetweenCells`
46
+ *
47
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
44
48
  */
45
49
  export function getCoordinatesBetweenCells(pointA: Vector2, pointB: Vector2): Vector2[];
46
50
 
47
51
  /**
48
52
  * @deprecated Use {@link getCoordinatesBetweenCells} instead.
49
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.utils.getCoordinatesBetweenCells`
53
+ *
54
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
50
55
  */
51
56
  export function getCoordinatesBetweenPoints(pointA: Vector2, pointB: Vector2): Vector2[];
52
57
  }
@@ -13,38 +13,39 @@ import { pickups as pickupsNs } from "./pickups";
13
13
 
14
14
  /**
15
15
  * @deprecated Use {@link grid} instead.
16
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid`
16
+ *
17
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
17
18
  */
18
19
  export namespace world {
19
20
  /**
20
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.getCellIdAtCell`
21
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
21
22
  */
22
23
  export import getCellIdAtCell = grid.getCellIdAtCell;
23
24
  /**
24
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.isCellEmptyAtCell`
25
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
25
26
  */
26
27
  export import isCellEmptyAtCell = grid.isCellEmptyAtCell;
27
28
  /**
28
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.isTerrainAtCell`
29
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
29
30
  */
30
31
  export import isTerrainAtCell = grid.isTerrainAtCell;
31
32
  /**
32
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.reportActivityAtCell`
33
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
33
34
  */
34
35
  export import reportActivityAtCell = grid.reportActivityAtCell;
35
36
  /**
36
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.excavateAtCell`
37
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
37
38
  */
38
39
  export import excavateAtCell = grid.excavateAtCell;
39
40
  /**
40
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.getDimensions`
41
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
41
42
  */
42
43
  export import getDimensions = grid.getDimensions;
43
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.ExcavateOptions` */
44
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
44
45
  export import ExcavateOptions = grid.ExcavateOptions;
45
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.CellId` */
46
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
46
47
  export import CellId = grid.CellId;
47
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.GridDimensions` */
48
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
48
49
  export import GridDimensions = grid.GridDimensions;
49
50
 
50
51
  /**
@@ -52,54 +53,58 @@ export namespace world {
52
53
  *
53
54
  * @param cellX - Grid column of the target cell.
54
55
  * @param cellY - Grid row of the target cell.
55
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.revealFogAtCell`
56
+ *
57
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
56
58
  */
57
59
  export import revealFogAtCell = grid.revealFogAtCell;
58
60
 
59
61
  /**
60
62
  * @deprecated Use {@link grid.mutate} instead.
61
- * @see https://sandustry.com/sandkit.html#mutations-heading
62
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.mutate`
63
+ *
64
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
63
65
  */
64
66
  export function runWhenSimulationIdle(callback: () => void): void;
65
67
 
66
68
  /**
67
69
  * @deprecated Use {@link grid.redrawAroundCell} instead.
68
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.redrawAroundCell`
70
+ *
71
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
69
72
  */
70
73
  export function redrawAroundCellWhenIdle(...args: [...CellCoordinates, range: number]): void;
71
74
 
72
75
  /**
73
76
  * @deprecated Use {@link pickups} instead.
74
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups`
77
+ *
78
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
75
79
  */
76
80
  export namespace pickups {
77
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.spawnAtWorld` */
81
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
78
82
  export import spawnAtWorld = pickupsNs.spawnAtWorld;
79
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.remove` */
83
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
80
84
  export import destroy = pickupsNs.destroy;
81
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.pickUp` */
85
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
82
86
  export import pickUp = pickupsNs.pickUp;
83
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.getAll` */
87
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
84
88
  export import getAll = pickupsNs.getAll;
85
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.getById` */
89
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
86
90
  export import getById = pickupsNs.getById;
87
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.remove` */
91
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
88
92
  export import remove = pickupsNs.remove;
89
93
  }
90
94
 
91
95
  /**
92
96
  * @deprecated Use {@link pickups.PickupType} instead.
93
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.PickupType`
97
+ *
98
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
94
99
  */
95
100
  export import WorldItemType = pickupsNs.WorldItemType;
96
101
 
97
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.PickupType` */
102
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
98
103
  export import PickupType = pickupsNs.PickupType;
99
104
 
100
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.WorldItemLight` */
105
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
101
106
  export import WorldItemLight = pickupsNs.WorldItemLight;
102
107
 
103
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.WorldItem` */
108
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
104
109
  export import WorldItem = pickupsNs.WorldItem;
105
110
  }
@@ -18,7 +18,18 @@ import type { SandkitEnums } from "./enums";
18
18
  import type { SandkitReact } from "./react";
19
19
  import type { SandkitState } from "./engine/state";
20
20
 
21
- /** Shape of the host-injected `sandkit` free variable in mod `main.js`. */
21
+ /**
22
+ * Shape of the host-injected `sandkit` free variable in mod `main.js`.
23
+ *
24
+ * @example Accessing the API
25
+ * ```ts
26
+ * const api = sandkit.api; // Stable API
27
+ *
28
+ * // Unstable engine escape hatch
29
+ * const engineApi = sandkit.engine.api;
30
+ * const engineState = sandkit.engine.state;
31
+ * ```
32
+ */
22
33
  export type Sandkit = {
23
34
  /** Public mod API. See {@link sandkit.api}. */
24
35
  api: SandkitApi;