@defold-typescript/types 0.25.0 → 0.27.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.
- package/api-availability.json +333 -306
- package/api-signatures.json +1312 -0
- package/api-targets.json +351 -2
- package/examples/translations.json +1984 -0
- package/fixtures/messages_doc.json +880 -0
- package/generated/collectionproxy.d.ts +22 -0
- package/generated/editor-vm/http.d.ts +2 -2
- package/generated/editor-vm/image.d.ts +48 -0
- package/generated/editor.d.ts +27 -8
- package/generated/gui.d.ts +35 -6
- package/generated/kinds/editor-script.d.ts +1 -0
- package/generated/material.d.ts +4 -0
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +22 -22
- package/generated/versions/defold-1.12.4/physics.d.ts +78 -75
- package/generated/versions/defold-1.12.4/render.d.ts +75 -55
- package/generated/versions/defold-1.12.4/resource.d.ts +187 -175
- package/generated/versions/defold-1.13.0/b2d.d.ts +33 -0
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +676 -0
- package/generated/versions/defold-1.13.0/b2d_chain.d.ts +106 -0
- package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +155 -0
- package/generated/versions/defold-1.13.0/b2d_joint.d.ts +823 -0
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +215 -0
- package/generated/versions/defold-1.13.0/b2d_world.d.ts +314 -0
- package/generated/versions/defold-1.13.0/buffer.d.ts +176 -0
- package/generated/versions/defold-1.13.0/camera.d.ts +302 -0
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +146 -0
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +71 -0
- package/generated/versions/defold-1.13.0/compute.d.ts +306 -0
- package/generated/versions/defold-1.13.0/crash.d.ts +143 -0
- package/generated/versions/defold-1.13.0/editor-vm/http.d.ts +56 -0
- package/generated/versions/defold-1.13.0/editor-vm/json.d.ts +10 -0
- package/generated/versions/defold-1.13.0/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +80 -0
- package/generated/versions/defold-1.13.0/editor-vm/zip.d.ts +10 -0
- package/generated/versions/defold-1.13.0/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.0/editor.d.ts +1092 -0
- package/generated/versions/defold-1.13.0/factory.d.ts +123 -0
- package/generated/versions/defold-1.13.0/font.d.ts +81 -0
- package/generated/versions/defold-1.13.0/go.d.ts +1054 -0
- package/generated/versions/defold-1.13.0/graphics.d.ts +321 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +2370 -0
- package/generated/versions/defold-1.13.0/html5.d.ts +53 -0
- package/generated/versions/defold-1.13.0/http.d.ts +84 -0
- package/generated/versions/defold-1.13.0/iac.d.ts +18 -0
- package/generated/versions/defold-1.13.0/iap.d.ts +60 -0
- package/generated/versions/defold-1.13.0/image.d.ts +139 -0
- package/generated/versions/defold-1.13.0/index.d.ts +48 -0
- package/generated/versions/defold-1.13.0/json.d.ts +76 -0
- package/generated/versions/defold-1.13.0/kinds/editor-script.d.ts +13 -0
- package/generated/versions/defold-1.13.0/label.d.ts +94 -0
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +140 -0
- package/generated/versions/defold-1.13.0/material.d.ts +444 -0
- package/generated/versions/defold-1.13.0/model.d.ts +246 -0
- package/generated/versions/defold-1.13.0/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.0/particlefx.d.ts +166 -0
- package/generated/versions/defold-1.13.0/physics.d.ts +548 -0
- package/generated/versions/defold-1.13.0/profiler.d.ts +233 -0
- package/generated/versions/defold-1.13.0/push.d.ts +66 -0
- package/generated/versions/defold-1.13.0/render.d.ts +1185 -0
- package/generated/versions/defold-1.13.0/resource.d.ts +1530 -0
- package/generated/versions/defold-1.13.0/socket.d.ts +795 -0
- package/generated/versions/defold-1.13.0/sound.d.ts +291 -0
- package/generated/versions/defold-1.13.0/sprite.d.ts +157 -0
- package/generated/versions/defold-1.13.0/sys.d.ts +695 -0
- package/generated/versions/defold-1.13.0/tilemap.d.ts +195 -0
- package/generated/versions/defold-1.13.0/timer.d.ts +114 -0
- package/generated/versions/defold-1.13.0/types.d.ts +61 -0
- package/generated/versions/defold-1.13.0/vmath.d.ts +806 -0
- package/generated/versions/defold-1.13.0/webview.d.ts +68 -0
- package/generated/versions/defold-1.13.0/window.d.ts +198 -0
- package/generated/versions/defold-1.13.0/zlib.d.ts +40 -0
- package/index.d.ts +4 -81
- package/package.json +11 -3
- package/scripts/import-defold-release.ts +28 -1
- package/scripts/sync-api-docs.ts +4 -3
- package/src/api-availability.ts +0 -0
- package/src/emit-dts.ts +6 -0
- package/src/example-store.ts +5 -0
- package/src/index.ts +3 -0
- package/scripts/lua-types-signature-index.ts +0 -151
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
declare global {
|
|
3
|
+
/**
|
|
4
|
+
* Functions and constants for interacting with webview APIs
|
|
5
|
+
*/
|
|
6
|
+
namespace webview {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a webview instance. It can show HTML pages as well as evaluate Javascript. The view remains hidden until the first call. There can exist a maximum of 4 webviews at the same time.
|
|
9
|
+
* On iOS, the callback will never get a `webview.CALLBACK_RESULT_EVAL_ERROR`, due to the iOS SDK implementation."
|
|
10
|
+
*
|
|
11
|
+
* @param callback - A callback which receives info about finished requests taking the following parameters:
|
|
12
|
+
*/
|
|
13
|
+
function create(callback: (...args: unknown[]) => unknown): void;
|
|
14
|
+
/**
|
|
15
|
+
* Destroys an instance of a webview.
|
|
16
|
+
*
|
|
17
|
+
* @param webview_id - The webview id (returned by the `webview.create()` call)
|
|
18
|
+
*/
|
|
19
|
+
function destroy(webview_id: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Evaluates JavaScript within the context of the currently loaded page (if any). Once the request is done, the callback (registered in `webview.create()`) is invoked. The callback will get the result in the `data["result"]` field.
|
|
22
|
+
*
|
|
23
|
+
* @param webview_id - The webview id
|
|
24
|
+
* @param code - The JavaScript code to evaluate
|
|
25
|
+
*/
|
|
26
|
+
function eval(webview_id: number, code: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the visibility state of the webview.
|
|
29
|
+
*
|
|
30
|
+
* @param webview_id - The webview id
|
|
31
|
+
*/
|
|
32
|
+
function is_visible(webview_id: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Opens a web page in the webview, using HTML data. Once the request is done, the callback (registered in `webview.create()`) is invoked.
|
|
35
|
+
*
|
|
36
|
+
* @param webview_id - The webview id
|
|
37
|
+
* @param html - The HTML data to display
|
|
38
|
+
* @param options - A table of options for the request. See `webview.open()`
|
|
39
|
+
*/
|
|
40
|
+
function open_raw(webview_id: number, html: string, options: Record<string | number, unknown>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the position and size of the webview
|
|
43
|
+
*
|
|
44
|
+
* @param webview_id - The webview id
|
|
45
|
+
* @param x - The x position of the webview
|
|
46
|
+
* @param y - The y position of the webview
|
|
47
|
+
* @param width - The width of the webview (-1 to match screen width)
|
|
48
|
+
* @param height - The height of the webview (-1 to match screen height)
|
|
49
|
+
*/
|
|
50
|
+
function set_position(webview_id: number, x: number, y: number, width: number, height: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Set transparency of webview background
|
|
53
|
+
*
|
|
54
|
+
* @param webview_id - The webview id
|
|
55
|
+
* @param transparent - If `true`, the webview background becomes transparent, otherwise opaque.
|
|
56
|
+
*/
|
|
57
|
+
function set_transparent(webview_id: number, transparent: boolean): void;
|
|
58
|
+
/**
|
|
59
|
+
* Shows or hides a webview
|
|
60
|
+
*
|
|
61
|
+
* @param webview_id - The webview id
|
|
62
|
+
* @param visible - If `0`, hides the webview. If non zero, shows the view
|
|
63
|
+
*/
|
|
64
|
+
function set_visible(webview_id: number, visible: number): void;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Opaque } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions and constants to access the window, window event listeners
|
|
7
|
+
* and screen dimming.
|
|
8
|
+
*/
|
|
9
|
+
namespace window {
|
|
10
|
+
/**
|
|
11
|
+
* Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
|
|
12
|
+
*/
|
|
13
|
+
const DIMMING_OFF: number & { readonly __brand: "window.DIMMING_OFF" };
|
|
14
|
+
/**
|
|
15
|
+
* Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
|
|
16
|
+
*/
|
|
17
|
+
const DIMMING_ON: number & { readonly __brand: "window.DIMMING_ON" };
|
|
18
|
+
/**
|
|
19
|
+
* Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
|
|
20
|
+
* This mode indicates that the dim mode can't be determined, or that the platform doesn't support dimming.
|
|
21
|
+
*/
|
|
22
|
+
const DIMMING_UNKNOWN: number & { readonly __brand: "window.DIMMING_UNKNOWN" };
|
|
23
|
+
/**
|
|
24
|
+
* This event is sent to a window event listener when the game window or app screen is
|
|
25
|
+
* restored after being iconified.
|
|
26
|
+
*/
|
|
27
|
+
const WINDOW_EVENT_DEICONIFIED: number & { readonly __brand: "window.WINDOW_EVENT_DEICONIFIED" };
|
|
28
|
+
/**
|
|
29
|
+
* This event is sent to a window event listener when the game window or app screen has
|
|
30
|
+
* gained focus.
|
|
31
|
+
* This event is also sent at game startup and the engine gives focus to the game.
|
|
32
|
+
*/
|
|
33
|
+
const WINDOW_EVENT_FOCUS_GAINED: number & { readonly __brand: "window.WINDOW_EVENT_FOCUS_GAINED" };
|
|
34
|
+
/**
|
|
35
|
+
* This event is sent to a window event listener when the game window or app screen has lost focus.
|
|
36
|
+
*/
|
|
37
|
+
const WINDOW_EVENT_FOCUS_LOST: number & { readonly __brand: "window.WINDOW_EVENT_FOCUS_LOST" };
|
|
38
|
+
/**
|
|
39
|
+
* This event is sent to a window event listener when the game window or app screen is
|
|
40
|
+
* iconified (reduced to an application icon in a toolbar, application tray or similar).
|
|
41
|
+
*/
|
|
42
|
+
const WINDOW_EVENT_ICONFIED: number & { readonly __brand: "window.WINDOW_EVENT_ICONFIED" };
|
|
43
|
+
/**
|
|
44
|
+
* This event is sent to a window event listener when the game window or app screen is resized.
|
|
45
|
+
* The new size is passed along in the data field to the event listener.
|
|
46
|
+
*/
|
|
47
|
+
const WINDOW_EVENT_RESIZED: number & { readonly __brand: "window.WINDOW_EVENT_RESIZED" };
|
|
48
|
+
/**
|
|
49
|
+
* Returns the current dimming mode set on a mobile device.
|
|
50
|
+
* The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction.
|
|
51
|
+
* On platforms that does not support dimming, `window.DIMMING_UNKNOWN` is always returned.
|
|
52
|
+
*
|
|
53
|
+
* @returns The mode for screen dimming
|
|
54
|
+
*
|
|
55
|
+
* - `window.DIMMING_UNKNOWN`
|
|
56
|
+
*
|
|
57
|
+
* - `window.DIMMING_ON`
|
|
58
|
+
*
|
|
59
|
+
* - `window.DIMMING_OFF`
|
|
60
|
+
*/
|
|
61
|
+
function get_dim_mode(): Opaque<"constant">;
|
|
62
|
+
/**
|
|
63
|
+
* This returns the content scale of the current display.
|
|
64
|
+
*
|
|
65
|
+
* @returns The display scale
|
|
66
|
+
*/
|
|
67
|
+
function get_display_scale(): number;
|
|
68
|
+
/**
|
|
69
|
+
* This returns the current lock state of the mouse cursor
|
|
70
|
+
*
|
|
71
|
+
* @returns The lock state
|
|
72
|
+
*/
|
|
73
|
+
function get_mouse_lock(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* This returns the safe area rectangle (x, y, width, height) and the inset
|
|
76
|
+
* values relative to the window edges. On platforms without a safe area,
|
|
77
|
+
* this returns the full window size and zero insets.
|
|
78
|
+
*
|
|
79
|
+
* @returns safe area data
|
|
80
|
+
*
|
|
81
|
+
* `safe_area`
|
|
82
|
+
* table table containing these keys:
|
|
83
|
+
*
|
|
84
|
+
* - number `x`
|
|
85
|
+
*
|
|
86
|
+
* - number `y`
|
|
87
|
+
*
|
|
88
|
+
* - number `width`
|
|
89
|
+
*
|
|
90
|
+
* - number `height`
|
|
91
|
+
*
|
|
92
|
+
* - number `inset_left`
|
|
93
|
+
*
|
|
94
|
+
* - number `inset_top`
|
|
95
|
+
*
|
|
96
|
+
* - number `inset_right`
|
|
97
|
+
*
|
|
98
|
+
* - number `inset_bottom`
|
|
99
|
+
*/
|
|
100
|
+
function get_safe_area(): { safe_area: { x: number; y: number; width: number; height: number; inset_left: number; inset_top: number; inset_right: number; inset_bottom: number } };
|
|
101
|
+
/**
|
|
102
|
+
* This returns the current window size (width and height).
|
|
103
|
+
*/
|
|
104
|
+
function get_size(): LuaMultiReturn<[number, number]>;
|
|
105
|
+
/**
|
|
106
|
+
* Sets the dimming mode on a mobile device.
|
|
107
|
+
* The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction. The dimming mode will only affect the mobile device while the game is in focus on the device, but not when the game is running in the background.
|
|
108
|
+
* This function has no effect on platforms that does not support dimming.
|
|
109
|
+
*
|
|
110
|
+
* @param mode - The mode for screen dimming
|
|
111
|
+
*
|
|
112
|
+
* - `window.DIMMING_ON`
|
|
113
|
+
*
|
|
114
|
+
* - `window.DIMMING_OFF`
|
|
115
|
+
*/
|
|
116
|
+
function set_dim_mode(mode: Opaque<"constant">): void;
|
|
117
|
+
/**
|
|
118
|
+
* Sets a window event listener. Only one window event listener can be set at a time.
|
|
119
|
+
*
|
|
120
|
+
* @param callback - A callback which receives info about window events. Pass an empty function or `nil` if you no longer wish to receive callbacks.
|
|
121
|
+
*
|
|
122
|
+
* `self`
|
|
123
|
+
* object The calling script
|
|
124
|
+
* `event`
|
|
125
|
+
* constant The type of event. Can be one of these:
|
|
126
|
+
*
|
|
127
|
+
* - `window.WINDOW_EVENT_FOCUS_LOST`
|
|
128
|
+
*
|
|
129
|
+
* - `window.WINDOW_EVENT_FOCUS_GAINED`
|
|
130
|
+
*
|
|
131
|
+
* - `window.WINDOW_EVENT_RESIZED`
|
|
132
|
+
*
|
|
133
|
+
* - `window.WINDOW_EVENT_ICONIFIED`
|
|
134
|
+
*
|
|
135
|
+
* - `window.WINDOW_EVENT_DEICONIFIED`
|
|
136
|
+
*
|
|
137
|
+
* `data`
|
|
138
|
+
* table The callback value `data` is a table which currently holds these values
|
|
139
|
+
*
|
|
140
|
+
* - number `width`: The width of a resize event. nil otherwise.
|
|
141
|
+
*
|
|
142
|
+
* - number `height`: The height of a resize event. nil otherwise.
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* function window_callback(self, event, data) {
|
|
146
|
+
* if (event === window.WINDOW_EVENT_FOCUS_LOST) {
|
|
147
|
+
* print("window.WINDOW_EVENT_FOCUS_LOST");
|
|
148
|
+
* } else if (event === window.WINDOW_EVENT_FOCUS_GAINED) {
|
|
149
|
+
* print("window.WINDOW_EVENT_FOCUS_GAINED");
|
|
150
|
+
* } else if (event === window.WINDOW_EVENT_ICONFIED) {
|
|
151
|
+
* print("window.WINDOW_EVENT_ICONFIED");
|
|
152
|
+
* } else if (event === window.WINDOW_EVENT_DEICONIFIED) {
|
|
153
|
+
* print("window.WINDOW_EVENT_DEICONIFIED");
|
|
154
|
+
* } else if (event === window.WINDOW_EVENT_RESIZED) {
|
|
155
|
+
* print("Window resized: ", data.width, data.height);
|
|
156
|
+
* }
|
|
157
|
+
* }
|
|
158
|
+
*
|
|
159
|
+
* export default defineScript({
|
|
160
|
+
* init() {
|
|
161
|
+
* window.set_listener(window_callback);
|
|
162
|
+
* },
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
function set_listener(callback?: (self: unknown, event: typeof WINDOW_EVENT_FOCUS_LOST | typeof WINDOW_EVENT_FOCUS_GAINED | typeof WINDOW_EVENT_RESIZED | typeof WINDOW_EVENT_ICONFIED | typeof WINDOW_EVENT_DEICONIFIED, data: Record<string | number, unknown>) => void): void;
|
|
167
|
+
/**
|
|
168
|
+
* Set the locking state for current mouse cursor on a PC platform.
|
|
169
|
+
* This function locks or unlocks the mouse cursor to the center point of the window. While the cursor is locked,
|
|
170
|
+
* mouse position updates will still be sent to the scripts as usual.
|
|
171
|
+
*
|
|
172
|
+
* @param flag - The lock state for the mouse cursor
|
|
173
|
+
*/
|
|
174
|
+
function set_mouse_lock(flag: boolean): void;
|
|
175
|
+
/**
|
|
176
|
+
* Sets the window position.
|
|
177
|
+
*
|
|
178
|
+
* @param x - Horizontal position of window
|
|
179
|
+
* @param y - Vertical position of window
|
|
180
|
+
*/
|
|
181
|
+
function set_position(x: number, y: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* Sets the window size. Works on desktop platforms only.
|
|
184
|
+
*
|
|
185
|
+
* @param width - Width of window
|
|
186
|
+
* @param height - Height of window
|
|
187
|
+
*/
|
|
188
|
+
function set_size(width: number, height: number): void;
|
|
189
|
+
/**
|
|
190
|
+
* Sets the window title. Works on desktop platforms.
|
|
191
|
+
*
|
|
192
|
+
* @param title - The title, encoded as UTF-8
|
|
193
|
+
*/
|
|
194
|
+
function set_title(title: string): void;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
declare global {
|
|
3
|
+
/**
|
|
4
|
+
* Functions for compression and decompression of string buffers.
|
|
5
|
+
*/
|
|
6
|
+
namespace zlib {
|
|
7
|
+
/**
|
|
8
|
+
* A lua error is raised is on error
|
|
9
|
+
*
|
|
10
|
+
* @param buf - buffer to deflate
|
|
11
|
+
* @returns deflated buffer
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const data = "This is a string with uncompressed data.";
|
|
15
|
+
* const compressed_data = zlib.deflate(data);
|
|
16
|
+
* let s = "";
|
|
17
|
+
* for (const c of compressed_data) {
|
|
18
|
+
* s = s + "\\" + c.charCodeAt(0);
|
|
19
|
+
* }
|
|
20
|
+
* print(s); //> \120\94\11\201\200\44\86\0\162\68\133\226\146\162 ...
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function deflate(buf: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* A lua error is raised is on error
|
|
26
|
+
*
|
|
27
|
+
* @param buf - buffer to inflate
|
|
28
|
+
* @returns inflated buffer
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const data = "\120\94\11\201\200\44\86\0\162\68\133\226\146\162\204\188\116\133\242\204\146\12\133\210\188\228\252\220\130\162\212\226\226\212\20\133\148\196\146\68\61\0\44\67\14\201";
|
|
32
|
+
* const uncompressed_data = zlib.inflate(data);
|
|
33
|
+
* print(uncompressed_data); //> This is a string with uncompressed data.
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
function inflate(buf: string): string;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -56,84 +56,7 @@ import "./generated/webview";
|
|
|
56
56
|
import "./generated/window";
|
|
57
57
|
import "./generated/zlib";
|
|
58
58
|
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
type AvailabilityLabelKind,
|
|
64
|
-
availabilityLabel,
|
|
65
|
-
deriveAvailabilityMatrix,
|
|
66
|
-
groupByLogicalName,
|
|
67
|
-
isSignatureTransition,
|
|
68
|
-
type LogicalNameGroup,
|
|
69
|
-
normalizedFunctionSignature,
|
|
70
|
-
symbolIdentityKey,
|
|
71
|
-
type VersionSurface,
|
|
72
|
-
} from "./src/api-availability";
|
|
73
|
-
export type { ApiFunction, ApiModule, ApiParameter, ApiVariable } from "./src/api-doc";
|
|
74
|
-
export { parseDefoldApiDoc } from "./src/api-doc";
|
|
75
|
-
export {
|
|
76
|
-
DEFOLD_TYPE_MAP,
|
|
77
|
-
type Hash,
|
|
78
|
-
type Matrix4,
|
|
79
|
-
type Quaternion,
|
|
80
|
-
type Url,
|
|
81
|
-
type Vector,
|
|
82
|
-
type Vector3,
|
|
83
|
-
type Vector4,
|
|
84
|
-
} from "./src/core-types";
|
|
85
|
-
export {
|
|
86
|
-
examplesHtmlToMarkdown,
|
|
87
|
-
htmlToCodeText,
|
|
88
|
-
htmlToDocText,
|
|
89
|
-
renderDocComment,
|
|
90
|
-
} from "./src/doc-comment";
|
|
91
|
-
export {
|
|
92
|
-
defineEditorScript,
|
|
93
|
-
type EditorCommand,
|
|
94
|
-
type EditorScriptModule,
|
|
95
|
-
} from "./src/editor";
|
|
96
|
-
export {
|
|
97
|
-
type EmitOptions,
|
|
98
|
-
emitDeclarations,
|
|
99
|
-
TS_IDENTIFIER,
|
|
100
|
-
TS_RESERVED_NAMES,
|
|
101
|
-
} from "./src/emit-dts";
|
|
102
|
-
export {
|
|
103
|
-
hashExampleSource,
|
|
104
|
-
lookupTranslation,
|
|
105
|
-
type Translation,
|
|
106
|
-
type TranslationStore,
|
|
107
|
-
} from "./src/example-store";
|
|
108
|
-
export {
|
|
109
|
-
hasTopLevelUnion,
|
|
110
|
-
luaMultiReturn,
|
|
111
|
-
needsArrayParens,
|
|
112
|
-
varargElementType,
|
|
113
|
-
} from "./src/library-signature";
|
|
114
|
-
export {
|
|
115
|
-
defineGuiScript,
|
|
116
|
-
defineRenderScript,
|
|
117
|
-
defineScript,
|
|
118
|
-
type GuiScriptHooks,
|
|
119
|
-
type InputAction,
|
|
120
|
-
type InputTouch,
|
|
121
|
-
type RenderScriptHooks,
|
|
122
|
-
SCRIPT_HOOK_NAMES,
|
|
123
|
-
type ScriptHookName,
|
|
124
|
-
type ScriptHooks,
|
|
125
|
-
type ScriptProperties,
|
|
126
|
-
type ScriptPropertiesOf,
|
|
127
|
-
type ScriptProperty,
|
|
128
|
-
} from "./src/lifecycle";
|
|
129
|
-
export { type WrapOptions, wrapAsAmbientGlobal } from "./src/publish-dts";
|
|
130
|
-
export {
|
|
131
|
-
lookupSignature,
|
|
132
|
-
type SignatureOverride,
|
|
133
|
-
type SignatureStore,
|
|
134
|
-
} from "./src/signature-store";
|
|
135
|
-
export type {
|
|
136
|
-
UrlParameterClass,
|
|
137
|
-
UrlParameterEntry,
|
|
138
|
-
UrlParameterTable,
|
|
139
|
-
} from "./src/url-parameters";
|
|
59
|
+
// The root export set lives in `src/index.ts`, the runtime `default` condition.
|
|
60
|
+
// Re-exporting it keeps the `types` condition from drifting into a subset, and
|
|
61
|
+
// is what `@defold-typescript/types/api` publishes for a pinned entrypoint.
|
|
62
|
+
export * from "./src/index";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defold-typescript/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "TypeScript types for the Defold engine's Lua APIs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"./editor-script": {
|
|
31
31
|
"types": "./generated/kinds/editor-script.d.ts"
|
|
32
32
|
},
|
|
33
|
+
"./api": {
|
|
34
|
+
"types": "./src/index.ts"
|
|
35
|
+
},
|
|
33
36
|
"./core-types": {
|
|
34
37
|
"types": "./src/core-types.ts"
|
|
35
38
|
},
|
|
@@ -57,9 +60,13 @@
|
|
|
57
60
|
"api-signatures.json",
|
|
58
61
|
"url-parameters.json",
|
|
59
62
|
"index.d.ts",
|
|
63
|
+
"fixtures/messages_doc.json",
|
|
64
|
+
"fixtures/defold-*",
|
|
65
|
+
"examples/translations.json",
|
|
60
66
|
"!src/**/*.test.ts",
|
|
61
67
|
"!scripts/**/*.test.ts",
|
|
62
|
-
"!src/**/__snapshots__"
|
|
68
|
+
"!src/**/__snapshots__",
|
|
69
|
+
"!scripts/lua-types-signature-index.ts"
|
|
63
70
|
],
|
|
64
71
|
"publishConfig": {
|
|
65
72
|
"access": "public"
|
|
@@ -75,7 +82,8 @@
|
|
|
75
82
|
"ref-doc-delta": "bun scripts/ref-doc-delta.ts --target defold-1.9.8 --namespace label --present label.get_text --absent label.set_text"
|
|
76
83
|
},
|
|
77
84
|
"dependencies": {
|
|
78
|
-
"lua-types": "^2.13.1"
|
|
85
|
+
"lua-types": "^2.13.1",
|
|
86
|
+
"yaml": "^2.9.0"
|
|
79
87
|
},
|
|
80
88
|
"devDependencies": {
|
|
81
89
|
"@typescript-to-lua/language-extensions": "1.19.0",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { isKnownDefoldTypeToken } from "../src/emit-dts";
|
|
4
4
|
import { refDocCacheDir, resolveRefDoc } from "./doc-source";
|
|
5
5
|
import {
|
|
6
6
|
apiElementIdentity,
|
|
7
|
+
EDITOR_MANIFEST,
|
|
7
8
|
IGNORED_UPSTREAM,
|
|
8
9
|
mergeApiDocs,
|
|
9
10
|
readZip,
|
|
@@ -15,6 +16,14 @@ const EXACT_VERSION = /^\d+\.\d+\.\d+$/;
|
|
|
15
16
|
const LUA_NAMESPACE = /^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*$/;
|
|
16
17
|
const PACKAGE_ROOT = resolve(import.meta.dir, "..");
|
|
17
18
|
|
|
19
|
+
// Editor-scripting namespaces are mapped, but not by `api-targets.json`: they
|
|
20
|
+
// emit through `EDITOR_MODULE_MANIFEST` rather than the runtime module set the
|
|
21
|
+
// baseline is built from, so the baseline can never vouch for them. Only
|
|
22
|
+
// `EDITOR_MANIFEST` is consulted — `EDITOR_VM_MANIFEST` entries are split out of
|
|
23
|
+
// the editor document and never surface as an upstream `info.namespace`, so
|
|
24
|
+
// excusing their bare names would suppress a real runtime namespace instead.
|
|
25
|
+
const EDITOR_MAPPED_NAMESPACES = new Set(EDITOR_MANIFEST.map((source) => source.namespace));
|
|
26
|
+
|
|
18
27
|
// The set of namespaces promoted into the generated surface at Defold 1.13.0.
|
|
19
28
|
// Held here rather than derived from the root release model because the
|
|
20
29
|
// per-package `rootDir` boundary forbids importing outside this package tree;
|
|
@@ -325,6 +334,7 @@ export function buildReleaseImportPlan(input: {
|
|
|
325
334
|
(source) =>
|
|
326
335
|
source.functionCount > 0 &&
|
|
327
336
|
!baselineByNamespace.has(source.namespace) &&
|
|
337
|
+
!EDITOR_MAPPED_NAMESPACES.has(source.namespace) &&
|
|
328
338
|
!IGNORED_UPSTREAM.has(source.namespace),
|
|
329
339
|
)
|
|
330
340
|
.map((source) => ({
|
|
@@ -377,6 +387,23 @@ export function applyReleaseImport(plan: ReleaseImportPlan, packageRoot = PACKAG
|
|
|
377
387
|
writeFileSync(path, `${JSON.stringify(snapshot.doc, null, 2)}\n`);
|
|
378
388
|
written.push(relative);
|
|
379
389
|
}
|
|
390
|
+
// The prefixless builtins (`hash`, `pprint`, ...) are hand-vendored rather than
|
|
391
|
+
// generated, so no upstream snapshot carries them. Seeding the canonical copy
|
|
392
|
+
// here is what keeps a newly imported target from being born without a globals
|
|
393
|
+
// document — which the availability projection would read as a removal. The
|
|
394
|
+
// source is always the real package's canonical file, never `packageRoot`,
|
|
395
|
+
// which for a writer test is an empty temp tree.
|
|
396
|
+
const canonicalGlobals = resolve(PACKAGE_ROOT, "fixtures/globals_doc.json");
|
|
397
|
+
if (!existsSync(canonicalGlobals))
|
|
398
|
+
throw new Error(`missing canonical globals document at ${canonicalGlobals}`);
|
|
399
|
+
const globals = JSON.parse(readFileSync(canonicalGlobals, "utf8")) as {
|
|
400
|
+
info: Record<string, unknown>;
|
|
401
|
+
};
|
|
402
|
+
globals.info = { ...globals.info, version: plan.version };
|
|
403
|
+
const globalsPath = `${relativeRoot}/globals_doc.json`;
|
|
404
|
+
writeFileSync(resolve(packageRoot, globalsPath), `${JSON.stringify(globals, null, 2)}\n`);
|
|
405
|
+
written.push(globalsPath);
|
|
406
|
+
|
|
380
407
|
const manifestPath = `${relativeRoot}/import-manifest.json`;
|
|
381
408
|
writeFileSync(resolve(packageRoot, manifestPath), releaseImportReportJson(plan));
|
|
382
409
|
written.push(manifestPath);
|
package/scripts/sync-api-docs.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { MODULE_MANIFEST } from "./regen";
|
|
|
11
11
|
// model because the per-package `rootDir` boundary forbids a types-package
|
|
12
12
|
// module importing outside its own tree; `scripts/release-model.test.ts`
|
|
13
13
|
// correspondence-guards these against the model so drift fails CI.
|
|
14
|
-
export const DEFOLD_VERSION = "1.13.
|
|
14
|
+
export const DEFOLD_VERSION = "1.13.1";
|
|
15
15
|
export const refDocUrl = (version = DEFOLD_VERSION): string =>
|
|
16
16
|
`https://github.com/defold/defold/releases/download/${version}/ref-doc.zip`;
|
|
17
17
|
|
|
@@ -184,6 +184,7 @@ export const EDITOR_MANIFEST: readonly SyncManifestEntry[] = [
|
|
|
184
184
|
// `http_doc.json` / `json_doc.json` / `zlib_doc.json`.
|
|
185
185
|
export const EDITOR_VM_MANIFEST: readonly SyncManifestEntry[] = [
|
|
186
186
|
editorVm("http"),
|
|
187
|
+
editorVm("image"),
|
|
187
188
|
editorVm("json"),
|
|
188
189
|
editorVm("localization"),
|
|
189
190
|
editorVm("zip"),
|
|
@@ -204,7 +205,7 @@ function editorVm(namespace: string): SyncManifestEntry {
|
|
|
204
205
|
function entry(
|
|
205
206
|
namespace: string,
|
|
206
207
|
zipEntry: string,
|
|
207
|
-
fixture: string = `fixtures/defold-1.13.
|
|
208
|
+
fixture: string = `fixtures/defold-1.13.1/${namespace.replace(/\./g, "_")}_doc.json`,
|
|
208
209
|
mergeEntries?: readonly string[],
|
|
209
210
|
): SyncManifestEntry {
|
|
210
211
|
return { namespace, zipEntry, fixture, ...(mergeEntries ? { mergeEntries } : {}) };
|
|
@@ -235,7 +236,7 @@ function ext(namespace: string, repo: string, tag: string, path: string): Extens
|
|
|
235
236
|
repo,
|
|
236
237
|
tag,
|
|
237
238
|
path,
|
|
238
|
-
fixture: `fixtures/defold-1.13.
|
|
239
|
+
fixture: `fixtures/defold-1.13.1/${namespace}_doc.json`,
|
|
239
240
|
};
|
|
240
241
|
}
|
|
241
242
|
|
package/src/api-availability.ts
CHANGED
|
Binary file
|
package/src/emit-dts.ts
CHANGED
|
@@ -157,6 +157,12 @@ export const ARBITRARY_TABLE_SLOTS = new Set([
|
|
|
157
157
|
// is opaque to the field-list parser and the whole-slot `Record` is faithful.
|
|
158
158
|
"render.render_target",
|
|
159
159
|
"render.set_render_target",
|
|
160
|
+
// reserved-but-undocumented options bag: `collectionproxy.load`'s `options`
|
|
161
|
+
// slot is documented verbatim as "options table, currently unused" and accepts
|
|
162
|
+
// `nil`, so upstream defines no field list to emit. The whole-slot `Record` is
|
|
163
|
+
// faithful to what is documented today. If a later release fills the bag in,
|
|
164
|
+
// drop this entry so the missing fields resurface under `recordTables`.
|
|
165
|
+
"collectionproxy.load",
|
|
160
166
|
]);
|
|
161
167
|
|
|
162
168
|
// Per-slot companion to ARBITRARY_TABLE_SLOTS (`element:kind:name`), for a
|
package/src/example-store.ts
CHANGED
|
@@ -10,6 +10,11 @@ export interface Translation {
|
|
|
10
10
|
// An FQN maps to one translation per distinct example body it carries: an
|
|
11
11
|
// overloaded element (same name, differing `@example` source) contributes one
|
|
12
12
|
// array entry per body, each pinned by its own `sourceHash`.
|
|
13
|
+
//
|
|
14
|
+
// add-don't-swap: a ref-doc re-pin that rewrites an element's example must
|
|
15
|
+
// *append* the translation for the new source hash, never overwrite the entry
|
|
16
|
+
// for the old one. Older API targets keep shipping the previous body, so
|
|
17
|
+
// replacing the entry silently regresses every demoted surface to raw Lua.
|
|
13
18
|
export type TranslationStore = Record<string, Translation[]>;
|
|
14
19
|
|
|
15
20
|
const FNV_OFFSET_BASIS = 0xcbf29ce484222325n;
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
type ApiSymbolIdentity,
|
|
6
6
|
type AvailabilityLabel,
|
|
7
7
|
type AvailabilityLabelKind,
|
|
8
|
+
type AvailabilityLabelOptions,
|
|
8
9
|
applyMigrationOverlay,
|
|
9
10
|
availabilityLabel,
|
|
10
11
|
type Box2dBackend,
|
|
@@ -14,7 +15,9 @@ export {
|
|
|
14
15
|
isSignatureTransition,
|
|
15
16
|
type LogicalNameGroup,
|
|
16
17
|
normalizedFunctionSignature,
|
|
18
|
+
signatureTransitionNames,
|
|
17
19
|
symbolIdentityKey,
|
|
20
|
+
symbolNameKey,
|
|
18
21
|
type VersionSurface,
|
|
19
22
|
validateAvailability,
|
|
20
23
|
} from "./api-availability";
|