@defold-typescript/types 0.19.4 → 0.20.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.
Files changed (93) hide show
  1. package/api-availability.json +2755 -0
  2. package/api-migrations.json +31 -0
  3. package/api-signatures.json +2324 -0
  4. package/api-targets.json +493 -45
  5. package/generated/b2d.d.ts +6 -0
  6. package/generated/b2d_body.d.ts +329 -1
  7. package/generated/b2d_chain.d.ts +106 -0
  8. package/generated/b2d_fixture.d.ts +155 -0
  9. package/generated/b2d_joint.d.ts +823 -0
  10. package/generated/b2d_shape.d.ts +215 -0
  11. package/generated/b2d_world.d.ts +314 -0
  12. package/generated/buffer.d.ts +1 -1
  13. package/generated/builtin-messages.d.ts +18 -0
  14. package/generated/camera.d.ts +62 -5
  15. package/generated/compute.d.ts +306 -0
  16. package/generated/crash.d.ts +2 -2
  17. package/generated/go.d.ts +31 -6
  18. package/generated/graphics.d.ts +95 -0
  19. package/generated/gui.d.ts +4 -6
  20. package/generated/image.d.ts +3 -3
  21. package/generated/json.d.ts +2 -2
  22. package/generated/kinds/gui-script.d.ts +7 -0
  23. package/generated/kinds/render-script.d.ts +7 -0
  24. package/generated/kinds/script.d.ts +7 -0
  25. package/generated/label.d.ts +1 -1
  26. package/generated/liveupdate.d.ts +22 -4
  27. package/generated/material.d.ts +444 -0
  28. package/generated/model.d.ts +46 -5
  29. package/generated/physics.d.ts +2 -4
  30. package/generated/profiler.d.ts +2 -3
  31. package/generated/render.d.ts +25 -9
  32. package/generated/resource.d.ts +2 -2
  33. package/generated/socket.d.ts +35 -35
  34. package/generated/sprite.d.ts +15 -1
  35. package/generated/sys.d.ts +1 -1
  36. package/generated/tilemap.d.ts +14 -0
  37. package/generated/timer.d.ts +1 -1
  38. package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
  39. package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
  40. package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
  41. package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
  42. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
  43. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
  44. package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
  45. package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
  46. package/generated/versions/defold-1.12.4/font.d.ts +81 -0
  47. package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
  48. package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
  49. package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
  50. package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
  51. package/generated/versions/defold-1.12.4/http.d.ts +84 -0
  52. package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
  53. package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
  54. package/generated/versions/defold-1.12.4/image.d.ts +139 -0
  55. package/generated/versions/defold-1.12.4/index.d.ts +41 -0
  56. package/generated/versions/defold-1.12.4/json.d.ts +76 -0
  57. package/generated/versions/defold-1.12.4/label.d.ts +94 -0
  58. package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
  59. package/generated/versions/defold-1.12.4/model.d.ts +205 -0
  60. package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
  61. package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
  62. package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
  63. package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
  64. package/generated/versions/defold-1.12.4/push.d.ts +66 -0
  65. package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
  66. package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
  67. package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
  68. package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
  69. package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
  70. package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
  71. package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
  72. package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
  73. package/generated/versions/defold-1.12.4/types.d.ts +61 -0
  74. package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
  75. package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
  76. package/generated/versions/defold-1.12.4/window.d.ts +198 -0
  77. package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
  78. package/index.d.ts +22 -0
  79. package/package.json +8 -1
  80. package/scripts/fidelity-audit.ts +69 -12
  81. package/scripts/fidelity-baseline.json +56 -0
  82. package/scripts/generate-api-availability.ts +139 -0
  83. package/scripts/generate-api-signatures.ts +66 -0
  84. package/scripts/import-defold-release.ts +480 -0
  85. package/scripts/materialize-version.ts +45 -20
  86. package/scripts/regen.ts +53 -6
  87. package/scripts/sync-api-docs.ts +89 -41
  88. package/src/api-availability.ts +0 -0
  89. package/src/core-types.ts +9 -0
  90. package/src/emit-dts.ts +685 -17
  91. package/src/emit-messages.ts +72 -2
  92. package/src/index.ts +26 -1
  93. package/src/lifecycle.ts +43 -2
@@ -0,0 +1,234 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for getting profiling data in runtime.
7
+ * More detailed [profiling](https://www.defold.com/manuals/profiling/) and [debugging](http://www.defold.com/manuals/debugging/) information available in the manuals.
8
+ */
9
+ namespace profiler {
10
+ /**
11
+ * pause on current frame
12
+ */
13
+ const MODE_PAUSE: number & { readonly __brand: "profiler.MODE_PAUSE" };
14
+ /**
15
+ * start recording
16
+ */
17
+ const MODE_RECORD: number & { readonly __brand: "profiler.MODE_RECORD" };
18
+ /**
19
+ * continously show latest frame
20
+ */
21
+ const MODE_RUN: number & { readonly __brand: "profiler.MODE_RUN" };
22
+ /**
23
+ * pause at peak frame
24
+ */
25
+ const MODE_SHOW_PEAK_FRAME: number & { readonly __brand: "profiler.MODE_SHOW_PEAK_FRAME" };
26
+ /**
27
+ * show full profiler ui
28
+ */
29
+ const VIEW_MODE_FULL: number & { readonly __brand: "profiler.VIEW_MODE_FULL" };
30
+ /**
31
+ * show mimimal profiler ui
32
+ */
33
+ const VIEW_MODE_MINIMIZED: number & { readonly __brand: "profiler.VIEW_MODE_MINIMIZED" };
34
+ /**
35
+ * logs the current frame to the console
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * profiler.dump_frame();
40
+ * ```
41
+ */
42
+ function dump_frame(): void;
43
+ /**
44
+ * The profiler is a real-time tool that shows the numbers of milliseconds spent
45
+ * in each scope per frame as well as counters. The profiler is very useful for
46
+ * tracking down performance and resource problems.
47
+ *
48
+ * @param enabled - true to enable, false to disable
49
+ * @example
50
+ * ```ts
51
+ * // Show the profiler UI
52
+ * profiler.enable(true);
53
+ * ```
54
+ */
55
+ function enable(enabled: boolean): void;
56
+ /**
57
+ * Creates and shows or hides and destroys the on-sceen profiler ui
58
+ * The profiler is a real-time tool that shows the numbers of milliseconds spent
59
+ * in each scope per frame as well as counters. The profiler is very useful for
60
+ * tracking down performance and resource problems.
61
+ *
62
+ * @param enabled - true to enable, false to disable
63
+ * @example
64
+ * ```ts
65
+ * // Show the profiler UI
66
+ * profiler.enable_ui(true);
67
+ * ```
68
+ */
69
+ function enable_ui(enabled: boolean): void;
70
+ /**
71
+ * Get the percent of CPU usage by the application, as reported by the OS.
72
+ * This function is not available on HTML5.
73
+ * For some platforms ( Android, Linux and Windows), this information is only available
74
+ * by default in the debug version of the engine. It can be enabled in release version as well
75
+ * by checking `track_cpu` under `profiler` in the `game.project` file.
76
+ * (This means that the engine will sample the CPU usage in intervalls during execution even in release mode.)
77
+ *
78
+ * @returns of CPU used by the application
79
+ */
80
+ function get_cpu_usage(): number;
81
+ /**
82
+ * Get the amount of memory used (resident/working set) by the application in bytes, as reported by the OS.
83
+ * This function is not available on HTML5.
84
+ * The values are gathered from internal OS functions which correspond to the following;
85
+ *
86
+ * OS
87
+ * Value
88
+ *
89
+ * iOS
90
+ * MacOS
91
+ *
92
+ * Android
93
+ * Linux
94
+ * Resident memory
95
+ *
96
+ * Windows
97
+ * Working set
98
+ *
99
+ * HTML5
100
+ * Not available
101
+ *
102
+ * @returns used by the application
103
+ * @example
104
+ * ```ts
105
+ * // Get memory usage before and after loading a collection:
106
+ * print(profiler.get_memory_usage());
107
+ * msg.post("#collectionproxy", "load");
108
+ * // ...
109
+ * print(profiler.get_memory_usage()); // will report a higher number than the initial call
110
+ * ```
111
+ */
112
+ function get_memory_usage(): number;
113
+ /**
114
+ * Send a text to the connected profiler
115
+ *
116
+ * @param text - the string to send to the connected profiler
117
+ * @example
118
+ * ```ts
119
+ * profiler.log_text(`Event: ${name}`);
120
+ * ```
121
+ */
122
+ function log_text(text: string): void;
123
+ /**
124
+ * Get the number of recorded frames in the on-screen profiler ui recording buffer
125
+ *
126
+ * @returns the number of recorded frames, zero if on-screen profiler is disabled
127
+ * @example
128
+ * ```ts
129
+ * // Show the last recorded frame
130
+ * const recorded_frame_count = profiler.recorded_frame_count();
131
+ * profiler.view_recorded_frame(recorded_frame_count);
132
+ * ```
133
+ */
134
+ function recorded_frame_count(): number;
135
+ /**
136
+ * Starts a profile scope.
137
+ *
138
+ * @param name - The name of the scope
139
+ * @example
140
+ * ```ts
141
+ * // Go back one frame
142
+ * profiler.scope_begin("test_function");
143
+ * test_function();
144
+ * profiler.scope_end();
145
+ * ```
146
+ */
147
+ function scope_begin(name: string): void;
148
+ /**
149
+ * End the current profile scope.
150
+ */
151
+ function scope_end(): void;
152
+ /**
153
+ * Set the on-screen profile mode - run, pause, record or show peak frame
154
+ *
155
+ * @param mode - the mode to set the ui profiler in
156
+ *
157
+ * - `profiler.MODE_RUN` This is default mode that continously shows the last frame
158
+ *
159
+ * - `profiler.MODE_PAUSE` Pauses on the currently displayed frame
160
+ *
161
+ * - `profiler.MODE_SHOW_PEAK_FRAME` Pauses on the currently displayed frame but shows a new frame if that frame is slower
162
+ *
163
+ * - `profiler.MODE_RECORD` Records all incoming frames to the recording buffer
164
+ *
165
+ * To stop recording, switch to a different mode such as `MODE_PAUSE` or `MODE_RUN`.
166
+ * You can also use the `view_recorded_frame` function to display a recorded frame. Doing so stops the recording as well.
167
+ * Every time you switch to recording mode the recording buffer is cleared.
168
+ * @example
169
+ * ```ts
170
+ * function start_recording() {
171
+ * profiler.set_ui_mode(profiler.MODE_RECORD);
172
+ * }
173
+ *
174
+ * function stop_recording() {
175
+ * profiler.set_ui_mode(profiler.MODE_PAUSE);
176
+ * }
177
+ * ```
178
+ */
179
+ function set_ui_mode(mode: Opaque<"constant">): void;
180
+ /**
181
+ * Set the on-screen profile view mode - minimized or expanded
182
+ *
183
+ * @param mode - the view mode to set the ui profiler in
184
+ *
185
+ * - `profiler.VIEW_MODE_FULL` The default mode which displays all the ui profiler details
186
+ *
187
+ * - `profiler.VIEW_MODE_MINIMIZED` Minimized mode which only shows the top header (fps counters and ui profiler mode)
188
+ * @example
189
+ * ```ts
190
+ * // Minimize the profiler view
191
+ * profiler.set_ui_view_mode(profiler.VIEW_MODE_MINIMIZED);
192
+ * ```
193
+ */
194
+ function set_ui_view_mode(mode: Opaque<"constant">): void;
195
+ /**
196
+ * Shows or hides the time the engine waits for vsync in the on-screen profiler
197
+ * Each frame the engine waits for vsync and depending on your vsync settings and how much time
198
+ * your game logic takes this time can dwarf the time in the game logic making it hard to
199
+ * see details in the on-screen profiler graph and lists.
200
+ * Also, by hiding this the FPS times in the header show the time spent each time excuding the
201
+ * time spent waiting for vsync. This shows you how long time your game is spending actively
202
+ * working each frame.
203
+ * This setting also effects the display of recorded frames but does not affect the actual
204
+ * recorded frames so it is possible to toggle this on and off when viewing recorded frames.
205
+ * By default the vsync wait times is displayed in the profiler.
206
+ *
207
+ * @param visible - true to include it in the display, false to hide it.
208
+ * @example
209
+ * ```ts
210
+ * // Exclude frame wait time from the profiler ui
211
+ * profiler.set_ui_vsync_wait_visible(false);
212
+ * ```
213
+ */
214
+ function set_ui_vsync_wait_visible(visible: boolean): void;
215
+ /**
216
+ * Pauses and displays a frame from the recording buffer in the on-screen profiler ui
217
+ * The frame to show can either be an absolute frame or a relative frame to the current frame.
218
+ *
219
+ * @param frame_index - a table where you specify one of the following parameters:
220
+ *
221
+ * - `distance` The offset from the currently displayed frame (this is truncated between zero and the number of recorded frames)
222
+ *
223
+ * - `frame` The frame index in the recording buffer (1 is first recorded frame)
224
+ * @example
225
+ * ```ts
226
+ * // Go back one frame
227
+ * profiler.view_recorded_frame({ distance: -1 });
228
+ * ```
229
+ */
230
+ function view_recorded_frame(frame_index: { distance?: number; frame?: number }): void;
231
+ }
232
+ }
233
+
234
+ export {};
@@ -0,0 +1,66 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Functions and constants for interacting with local, as well as Apple''s and Google''s push notification services. These API's only exist on mobile platforms. [icon:ios] [icon:android]
5
+ */
6
+ namespace push {
7
+ /**
8
+ * Use this function to cancel a previously scheduled local push notification.
9
+ * The notification is identified by a numeric id as returned by `push.schedule()`.
10
+ *
11
+ * @param id - The numeric id of the local push notification
12
+ */
13
+ function cancel(id: number): void;
14
+ /**
15
+ * Use this function to cancel a previously issued local push notifications.
16
+ */
17
+ function cancel_all_issued(): void;
18
+ /**
19
+ * Returns a table with all data associated with all scheduled local push notifications.
20
+ * The table contains key, value pairs where the key is the push notification id and the value is a table with the notification data, corresponding to the data given by `push.get_scheduled(id)`.
21
+ *
22
+ * @returns Table with all data associated with all scheduled notifications.
23
+ */
24
+ function get_all_scheduled(): Record<string | number, unknown>;
25
+ /**
26
+ * Returns a table with all data associated with a specified local push notification.
27
+ * The notification is identified by a numeric id as returned by `push.schedule()`.
28
+ *
29
+ * @param id - The numeric id of the local push notification.
30
+ * @returns Table with all data associated with the notification.
31
+ */
32
+ function get_scheduled(id: number): Record<string | number, unknown>;
33
+ /**
34
+ * Send a request for push notifications. Note that the notifications table parameter is iOS only and will be ignored on Android.
35
+ *
36
+ * @param notifications - The types of notifications to listen to. [icon:ios]
37
+ * @param callback - Register callback function.
38
+ */
39
+ function register(notifications: number[], callback: (...args: unknown[]) => unknown): void;
40
+ /**
41
+ * Local push notifications are scheduled with this function.
42
+ * The returned `id` value is uniquely identifying the scheduled notification and can be stored for later reference.
43
+ *
44
+ * @param time - Number of seconds into the future until the notification should be triggered.
45
+ * @param title - Localized title to be displayed to the user if the application is not running.
46
+ * @param alert - Localized body message of the notification to be displayed to the user if the application is not running.
47
+ * @param payload - JSON string to be passed to the registered listener function.
48
+ * @param notification_settings - Table with notification and platform specific fields
49
+ */
50
+ function schedule(time: number, title: string, alert: string, payload: string, notification_settings: { action?: string; badge_count?: number; priority?: number }): LuaMultiReturn<[number, string]>;
51
+ /**
52
+ * Set the badge count for application icon. This function is only available on iOS. [icon:ios]
53
+ *
54
+ * @param count - Badge count
55
+ */
56
+ function set_badge_count(count: number): void;
57
+ /**
58
+ * Sets a listener function to listen to push notifications.
59
+ *
60
+ * @param listener - Listener callback function.
61
+ */
62
+ function set_listener(listener: (...args: unknown[]) => unknown): void;
63
+ }
64
+ }
65
+
66
+ export {};