@defold-typescript/library-types 0.22.0 → 0.24.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-doc/boom.json +3870 -0
- package/api-doc/{bridge.bridge.json → bridge.json} +754 -844
- package/api-doc/bzAnim.json +338 -0
- package/api-doc/decore.json +23 -23
- package/api-doc/defcon.json +150 -0
- package/api-doc/{defmath.defmath.json → defmath.json} +6 -46
- package/api-doc/defsave.json +518 -0
- package/api-doc/deftest.json +741 -0
- package/api-doc/{dicebag.dicebag.json → dicebag.json} +19 -1
- package/api-doc/druid.json +249 -1846
- package/api-doc/event.json +1074 -0
- package/api-doc/gooey.json +2050 -0
- package/api-doc/immutable.json +65 -0
- package/api-doc/in.accelerometer.json +75 -1
- package/api-doc/in.button.json +17 -10
- package/api-doc/in.cursor.json +26 -0
- package/api-doc/in.gesture.json +401 -6
- package/api-doc/in.keyboard.json +2 -0
- package/api-doc/in.mapper.json +12 -8
- package/api-doc/in.onscreen.json +61 -5
- package/api-doc/in.state.json +61 -13
- package/api-doc/in.textbox.json +23 -12
- package/api-doc/in.triggers.json +336 -0
- package/api-doc/lang.json +528 -0
- package/api-doc/{event.event.json → log.json} +96 -101
- package/api-doc/metrics.fps.json +61 -2
- package/api-doc/metrics.mem.json +61 -2
- package/api-doc/monarch.monarch.json +249 -7
- package/api-doc/monarch.transitions.easings.json +19 -26
- package/api-doc/monarch.transitions.gui.json +782 -79
- package/api-doc/nakama.engine.defold.json +31 -18
- package/api-doc/{nakama.nakama.json → nakama.json} +4752 -2554
- package/api-doc/nakama.util.log.json +32 -4
- package/api-doc/narrator.json +647 -0
- package/api-doc/openapi/nakama.nakama.json +7680 -0
- package/api-doc/orthographic.camera.json +96 -98
- package/api-doc/orthographic.json +602 -0
- package/api-doc/panthera.json +1183 -0
- package/api-doc/{persist.persist.json → persist.json} +26 -1
- package/api-doc/{platypus.platypus.json → platypus.json} +68 -14
- package/api-doc/proto.json +995 -0
- package/api-doc/{rendy.rendy.json → rendy.json} +46 -99
- package/api-doc/richtext.color.json +77 -0
- package/api-doc/richtext.richtext.json +375 -5
- package/api-doc/saver.saver.json +714 -263
- package/api-doc/saver.storage.json +283 -52
- package/api-doc/squid.json +846 -0
- package/api-doc/{starly.starly.json → starly.json} +1 -1
- package/api-doc/tweener.json +277 -0
- package/api-doc/{yagames.yagames.json → yagames.json} +784 -189
- package/api-doc/{zzfx.api.json → zzfx.json} +9 -9
- package/authored-targets.json +403 -0
- package/generated/{boom.boom.d.ts → boom.d.ts} +14 -0
- package/generated/bridge.d.ts +468 -0
- package/generated/{bzAnim.bzLibrary.d.ts → bzAnim.d.ts} +6 -0
- package/generated/decore.d.ts +37 -37
- package/generated/defcon.d.ts +43 -0
- package/generated/{defmath.defmath.d.ts → defmath.d.ts} +3 -2
- package/generated/defsave.d.ts +144 -0
- package/generated/{dicebag.dicebag.d.ts → dicebag.d.ts} +25 -0
- package/generated/druid.d.ts +198 -502
- package/generated/event.d.ts +318 -0
- package/generated/{gooey.gooey.d.ts → gooey.d.ts} +61 -6
- package/generated/immutable.d.ts +13 -0
- package/generated/in.onscreen.d.ts +5 -0
- package/generated/in.textbox.d.ts +4 -0
- package/generated/lang.d.ts +101 -0
- package/generated/log.d.ts +36 -0
- package/generated/metrics.fps.d.ts +19 -1
- package/generated/metrics.mem.d.ts +19 -1
- package/generated/monarch.monarch.d.ts +44 -1
- package/generated/monarch.transitions.easings.d.ts +0 -1
- package/generated/monarch.transitions.gui.d.ts +96 -12
- package/generated/nakama.d.ts +1158 -0
- package/generated/nakama.engine.defold.d.ts +3 -1
- package/generated/nakama.util.log.d.ts +6 -0
- package/generated/narrator.d.ts +121 -0
- package/generated/openapi/nakama.nakama.d.ts +884 -0
- package/generated/orthographic.camera.d.ts +24 -38
- package/generated/orthographic.d.ts +155 -0
- package/generated/panthera.d.ts +170 -0
- package/generated/{persist.persist.d.ts → persist.d.ts} +3 -0
- package/generated/{platypus.platypus.d.ts → platypus.d.ts} +9 -0
- package/generated/proto.d.ts +146 -0
- package/generated/{rendy.rendy.d.ts → rendy.d.ts} +33 -80
- package/generated/richtext.color.d.ts +15 -0
- package/generated/saver.saver.d.ts +289 -42
- package/generated/saver.storage.d.ts +79 -14
- package/generated/squid.d.ts +127 -0
- package/generated/tweener.d.ts +42 -0
- package/generated/{yagames.yagames.d.ts → yagames.d.ts} +151 -29
- package/generated/{zzfx.api.d.ts → zzfx.d.ts} +7 -0
- package/library-classification.json +0 -227
- package/library-targets.json +1 -284
- package/luals-targets.json +168 -1
- package/openapi-targets.json +17 -0
- package/package.json +9 -88
- package/script-api-targets.json +15 -0
- package/scripts/__snapshots__/parse-luals.test.ts.snap +504 -85
- package/scripts/apply-luals-overrides.ts +95 -0
- package/scripts/authored-parity.ts +718 -0
- package/scripts/emit-library-dts.ts +177 -19
- package/scripts/extract-api-doc.ts +189 -38
- package/scripts/fidelity-floor.ts +178 -0
- package/scripts/import-upstream-docs.ts +125 -0
- package/scripts/lower-api-doc.ts +69 -19
- package/scripts/luals-fidelity.ts +22 -10
- package/scripts/map-luals-types.ts +86 -22
- package/scripts/parse-lua-surface.ts +187 -0
- package/scripts/parse-luals.ts +473 -22
- package/scripts/parse-markdown-api.ts +247 -0
- package/scripts/parse-openapi-api.ts +313 -0
- package/scripts/sync-authored-types.ts +249 -0
- package/scripts/sync-library-types.ts +99 -3
- package/scripts/sync-luals-types.ts +29 -2
- package/scripts/sync-markdown-types.ts +761 -0
- package/scripts/sync-openapi-types.ts +308 -0
- package/scripts/sync-script-api-types.ts +367 -0
- package/api-doc/boom.boom.json +0 -26
- package/api-doc/bzAnim.bzLibrary.json +0 -156
- package/api-doc/defcon.console.json +0 -109
- package/api-doc/defsave.defsave.json +0 -175
- package/api-doc/deftest.deftest.json +0 -71
- package/api-doc/gooey.gooey.json +0 -963
- package/api-doc/immutable.immutable.json +0 -63
- package/api-doc/lang.lang.json +0 -411
- package/api-doc/log.log.json +0 -50
- package/api-doc/narrator.narrator.json +0 -150
- package/api-doc/proto.proto.json +0 -355
- package/api-doc/squid.squid.json +0 -660
- package/api-doc/tweener.tweener.json +0 -419
- package/generated/bridge.bridge.d.ts +0 -533
- package/generated/defcon.console.d.ts +0 -24
- package/generated/defsave.defsave.d.ts +0 -31
- package/generated/event.event.d.ts +0 -54
- package/generated/immutable.immutable.d.ts +0 -13
- package/generated/lang.lang.d.ts +0 -33
- package/generated/log.log.d.ts +0 -40
- package/generated/nakama.nakama.d.ts +0 -594
- package/generated/narrator.narrator.d.ts +0 -66
- package/generated/proto.proto.d.ts +0 -36
- package/generated/squid.squid.d.ts +0 -106
- package/generated/tweener.tweener.d.ts +0 -151
- /package/generated/{deftest.deftest.d.ts → deftest.d.ts} +0 -0
- /package/generated/{starly.starly.d.ts → starly.d.ts} +0 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/** @noResolution */
|
|
2
|
+
declare module 'event.event' {
|
|
3
|
+
type promise_state = "pending" | "resolved" | "rejected";
|
|
4
|
+
/**
|
|
5
|
+
* Array of next items:
|
|
6
|
+
* [1] callback,
|
|
7
|
+
* [2] callback_context,
|
|
8
|
+
* [3] script_context
|
|
9
|
+
* [4] remaining: nil=infinite, number=fires left, 0=pending delete.
|
|
10
|
+
* [5] subscribed_event: event when callback is event with context.
|
|
11
|
+
*/
|
|
12
|
+
interface event_callback_data {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A logger object for event module should match the following interface
|
|
16
|
+
*/
|
|
17
|
+
interface event_logger {
|
|
18
|
+
trace: (logger: event_logger, message: string, data: unknown | undefined) => void;
|
|
19
|
+
debug: (logger: event_logger, message: string, data: unknown | undefined) => void;
|
|
20
|
+
info: (logger: event_logger, message: string, data: unknown | undefined) => void;
|
|
21
|
+
warn: (logger: event_logger, message: string, data: unknown | undefined) => void;
|
|
22
|
+
error: (logger: event_logger, message: string, data: unknown | undefined) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The Event module, used to create and manage events. Allows to subscribe to events and trigger them.
|
|
26
|
+
*/
|
|
27
|
+
interface event {
|
|
28
|
+
/**
|
|
29
|
+
* Subscribe a callback to the event or other event. The callback will be invoked whenever the event is triggered.
|
|
30
|
+
* The callback_context parameter is optional and will be passed as the first parameter to the callback function.
|
|
31
|
+
* If the callback with context is already subscribed, the warning will be logged.
|
|
32
|
+
* local function callback(self)
|
|
33
|
+
* print("clicked!")
|
|
34
|
+
* end
|
|
35
|
+
* on_click_event:subscribe(callback, self)
|
|
36
|
+
*
|
|
37
|
+
* -- Subscribe an event to another event
|
|
38
|
+
* event_1 = event.create(callback)
|
|
39
|
+
* event_2 = event.create()
|
|
40
|
+
* event_2:subscribe(event_1) -- Now event2 will trigger event1
|
|
41
|
+
*/
|
|
42
|
+
subscribe(callback: ((...args: any[]) => unknown) | event, callback_context?: unknown | undefined): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Subscribe a callback for a single trigger. After the first trigger the callback is automatically unsubscribed.
|
|
45
|
+
* on_click_event:subscribe_once(function(self) print("one-time click!") end, self)
|
|
46
|
+
*/
|
|
47
|
+
subscribe_once(callback: ((...args: any[]) => unknown) | event, callback_context?: unknown | undefined): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Remove a previously subscribed callback from the event.
|
|
50
|
+
* The callback_context should be the same as the one used when subscribing the callback.
|
|
51
|
+
* If there is no callback_context provided, all callbacks with the same function will be unsubscribed.
|
|
52
|
+
* on_click_event:unsubscribe(callback, self)
|
|
53
|
+
*/
|
|
54
|
+
unsubscribe(callback: ((...args: any[]) => unknown) | event, callback_context?: unknown | undefined): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Determine if a specific callback is currently subscribed to the event.
|
|
57
|
+
* The callback_context should be the same as the one used when subscribing the callback.
|
|
58
|
+
* local is_subscribed = on_click_event:is_subscribed(callback, self)
|
|
59
|
+
*/
|
|
60
|
+
is_subscribed(callback: ((...args: any[]) => unknown) | event, callback_context?: unknown | undefined): LuaMultiReturn<[boolean, number | undefined]>;
|
|
61
|
+
/**
|
|
62
|
+
* Trigger the event, causing all subscribed callbacks to be executed.
|
|
63
|
+
* Any parameters passed to trigger will be forwarded to the callbacks.
|
|
64
|
+
* The return value of the last executed callback is returned.
|
|
65
|
+
* The event:trigger(...) can be called as event(...).
|
|
66
|
+
* on_click_event:trigger("arg1", "arg2")
|
|
67
|
+
*
|
|
68
|
+
* -- The event can be triggered as a function
|
|
69
|
+
* on_click_event("arg1", "arg2")
|
|
70
|
+
*/
|
|
71
|
+
trigger(...args: unknown[]): unknown;
|
|
72
|
+
/**
|
|
73
|
+
* Check if the event has no subscribed callbacks.
|
|
74
|
+
* local is_empty = on_click_event:is_empty()
|
|
75
|
+
*/
|
|
76
|
+
is_empty(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Remove all callbacks subscribed to the event, effectively resetting it.
|
|
79
|
+
* on_click_event:clear()
|
|
80
|
+
*/
|
|
81
|
+
clear(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Trigger the event. All subscribed callbacks will be called in the order they were subscribed.
|
|
84
|
+
*/
|
|
85
|
+
(vararg: unknown): unknown | undefined;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Global events module that allows creation and management of global events that can be triggered from anywhere in your game.
|
|
89
|
+
* This is particularly useful for events that need to be handled by multiple scripts or systems.
|
|
90
|
+
*/
|
|
91
|
+
interface events {
|
|
92
|
+
}
|
|
93
|
+
interface promise_cancelled_context {
|
|
94
|
+
is_cancelled: boolean;
|
|
95
|
+
on_cancel: event;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The Promise module, used to create and manage promises.
|
|
99
|
+
* A promise represents a single asynchronous operation that will either resolve with a value or reject with a reason.
|
|
100
|
+
*/
|
|
101
|
+
interface promise {
|
|
102
|
+
state: promise_state;
|
|
103
|
+
value: unknown;
|
|
104
|
+
cancellation: promise_cancelled_context;
|
|
105
|
+
/**
|
|
106
|
+
* Attach resolve and reject handlers to the promise.
|
|
107
|
+
* Returns a new promise that will be resolved or rejected based on the handlers' return values.
|
|
108
|
+
* load_data():next(function(data) return process(data) end):next(display):catch(show_error)
|
|
109
|
+
*/
|
|
110
|
+
next(on_resolved?: ((...args: any[]) => unknown) | promise | event | undefined, on_rejected?: ((...args: any[]) => unknown) | promise | event | undefined, context?: unknown | undefined): promise;
|
|
111
|
+
/**
|
|
112
|
+
* Attach a rejection handler to the promise. Equivalent to next(nil, on_rejected).
|
|
113
|
+
* load_data():catch(function(err) print("Failed:", err) end)
|
|
114
|
+
*/
|
|
115
|
+
"catch"(on_rejected: ((...args: any[]) => unknown) | event, context?: unknown | undefined): promise;
|
|
116
|
+
/**
|
|
117
|
+
* Attach a handler that is called regardless of whether the promise is resolved or rejected.
|
|
118
|
+
* The handler is called with the resolved value or rejection reason.
|
|
119
|
+
* When context is provided, it is passed as the first argument.
|
|
120
|
+
* The handler return value is ignored.
|
|
121
|
+
* load_data():finally(function() hide_loading_spinner() end)
|
|
122
|
+
*/
|
|
123
|
+
"finally"(on_finally: ((...args: any[]) => unknown) | event, context?: unknown | undefined): promise;
|
|
124
|
+
/**
|
|
125
|
+
* Check if the promise is in pending state.
|
|
126
|
+
*/
|
|
127
|
+
is_pending(): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Check if the promise is in resolved state.
|
|
130
|
+
*/
|
|
131
|
+
is_resolved(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Check if the promise is in rejected state.
|
|
134
|
+
*/
|
|
135
|
+
is_rejected(): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Check if the promise is finished (either resolved or rejected).
|
|
138
|
+
*/
|
|
139
|
+
is_finished(): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Check if the shared cancel_context was cancelled.
|
|
142
|
+
*/
|
|
143
|
+
is_cancelled(): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Resolve the promise.
|
|
146
|
+
* my_promise:resolve(result)
|
|
147
|
+
*/
|
|
148
|
+
resolve(value: unknown): void;
|
|
149
|
+
/**
|
|
150
|
+
* Reject the promise.
|
|
151
|
+
* my_promise:reject("failed")
|
|
152
|
+
*/
|
|
153
|
+
reject(reason: unknown): void;
|
|
154
|
+
/**
|
|
155
|
+
* Cancel the promise chain. Triggers cleanup and rejects if still pending.
|
|
156
|
+
* my_promise:cancel()
|
|
157
|
+
*/
|
|
158
|
+
cancel(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Append a task to this promise's internal sequence without reassigning.
|
|
161
|
+
* The task may return a value or a promise. If `task` is a promise, the pipeline waits for it
|
|
162
|
+
* to finish and adopts its result. The incoming value is not forwarded into `task`
|
|
163
|
+
* (same as `append(function() return task end)`).
|
|
164
|
+
* Returns self for chaining.
|
|
165
|
+
* Almost similar to `promise = promise:next(task)`, but without reassigning the promise.
|
|
166
|
+
* pipeline:append(step1)
|
|
167
|
+
* pipeline:append(step2)
|
|
168
|
+
* pipeline:append(step3)
|
|
169
|
+
* local last = pipeline:tail()
|
|
170
|
+
* print("Is going to check status of", last:is_pending())
|
|
171
|
+
*/
|
|
172
|
+
append(task: ((value: unknown) => unknown) | promise): promise;
|
|
173
|
+
/**
|
|
174
|
+
* Get the current tail promise representing all appended work.
|
|
175
|
+
* local last = pipeline:tail()
|
|
176
|
+
* last:next(on_complete)
|
|
177
|
+
*/
|
|
178
|
+
tail(): promise;
|
|
179
|
+
/**
|
|
180
|
+
* Reset the internal sequence to an already resolved promise.
|
|
181
|
+
* pipeline:reset()
|
|
182
|
+
* pipeline:append(new_step)
|
|
183
|
+
*/
|
|
184
|
+
reset(): promise;
|
|
185
|
+
/**
|
|
186
|
+
* Reject pending child promises when a settled promise is cancelled.
|
|
187
|
+
*/
|
|
188
|
+
_reject_cancel_children(): void;
|
|
189
|
+
/**
|
|
190
|
+
* Call the promise to resolve it with value
|
|
191
|
+
*/
|
|
192
|
+
(value: unknown): undefined;
|
|
193
|
+
}
|
|
194
|
+
interface queue_event_data {
|
|
195
|
+
data: unknown;
|
|
196
|
+
on_handle: event;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The Queue module, used to create and manage FIFO event queues. Allows to push events to a queue and subscribe handlers to process them.
|
|
200
|
+
* Events are stored in the queue until they are handled by subscribers, following first-in-first-out (FIFO) order.
|
|
201
|
+
*/
|
|
202
|
+
interface queue {
|
|
203
|
+
/**
|
|
204
|
+
* Push a new event to the queue. The event will exist until it's handled by a subscriber.
|
|
205
|
+
* If there are already subscribers for this queue instance, they will be called immediately.
|
|
206
|
+
* If multiple subscribers handle the event, all subscribers will still be called. The on_handle callback
|
|
207
|
+
* will be called for each subscriber that handles the event.
|
|
208
|
+
* my_queue:push(save_data)
|
|
209
|
+
* my_queue:push(save_data, function() print("saved!") end)
|
|
210
|
+
*/
|
|
211
|
+
push(data: unknown, on_handle?: ((...args: any[]) => unknown) | event | undefined, context?: unknown | undefined): void;
|
|
212
|
+
/**
|
|
213
|
+
* Subscribe a handler to this queue instance. When an event is pushed to this queue,
|
|
214
|
+
* the handler will be called. If there are already events in the queue, they will be processed immediately.
|
|
215
|
+
* Return a non-nil value from the handler to mark the event as handled and remove it from the queue.
|
|
216
|
+
* local function on_save(self, data)
|
|
217
|
+
* do_save(data)
|
|
218
|
+
* return true
|
|
219
|
+
* end
|
|
220
|
+
* my_queue:subscribe(on_save, self)
|
|
221
|
+
*/
|
|
222
|
+
subscribe(handler: ((...args: any[]) => unknown) | event, context?: unknown | undefined): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Subscribe a handler until it handles one event. The handler is invoked for each event in the queue until it returns non-nil (handles an event)
|
|
225
|
+
* then it is automatically unsubscribed and will not be invoked again, even if more events remain in the queue.
|
|
226
|
+
* my_queue:subscribe_once(function(self, data) return process(data) end, self)
|
|
227
|
+
*/
|
|
228
|
+
subscribe_once(handler: ((...args: any[]) => unknown) | event, context?: unknown | undefined): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Unsubscribe a handler from this queue instance.
|
|
231
|
+
* my_queue:unsubscribe(on_save, self)
|
|
232
|
+
*/
|
|
233
|
+
unsubscribe(handler: ((...args: any[]) => unknown) | event, context?: unknown | undefined): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Check if a handler is subscribed to this queue instance.
|
|
236
|
+
* local ok = my_queue:is_subscribed(on_save, self)
|
|
237
|
+
*/
|
|
238
|
+
is_subscribed(handler: ((...args: any[]) => unknown) | event, context?: unknown | undefined): LuaMultiReturn<[boolean, number | undefined]>;
|
|
239
|
+
/**
|
|
240
|
+
* Process all events in this queue immediately. Subscribers will not be called in this function.
|
|
241
|
+
* Events can be handled and removed in event handler callback. If event is handled, it will be removed from the queue.
|
|
242
|
+
* my_queue:process(function(self, data) return handle(data) end, self)
|
|
243
|
+
*/
|
|
244
|
+
process(event_handler: ((...args: any[]) => unknown) | event, context?: unknown | undefined): void;
|
|
245
|
+
/**
|
|
246
|
+
* Process exactly one queued event with a specific handler (subscribers will NOT be called).
|
|
247
|
+
* If the handler returns non-nil the event will be removed from the queue.
|
|
248
|
+
* local handled = my_queue:process_next(function(data) return handle(data) end)
|
|
249
|
+
*/
|
|
250
|
+
process_next(event_handler?: ((...args: any[]) => unknown) | event | undefined, context?: unknown | undefined): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Get all pending events in this queue.
|
|
253
|
+
* for _, event_data in ipairs(my_queue:get_events()) do
|
|
254
|
+
* print(event_data.data)
|
|
255
|
+
* end
|
|
256
|
+
*/
|
|
257
|
+
get_events(): queue_event_data[];
|
|
258
|
+
/**
|
|
259
|
+
* Clear all pending events in this queue.
|
|
260
|
+
* my_queue:clear_events()
|
|
261
|
+
*/
|
|
262
|
+
clear_events(): void;
|
|
263
|
+
/**
|
|
264
|
+
* Clear all subscribers from this queue instance.
|
|
265
|
+
* my_queue:clear_subscribers()
|
|
266
|
+
*/
|
|
267
|
+
clear_subscribers(): void;
|
|
268
|
+
/**
|
|
269
|
+
* Check if this queue has no pending events.
|
|
270
|
+
* if my_queue:is_empty() then
|
|
271
|
+
* return
|
|
272
|
+
* end
|
|
273
|
+
*/
|
|
274
|
+
is_empty(): boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Check if this queue instance has no subscribed handlers.
|
|
277
|
+
* if my_queue:has_subscribers() then
|
|
278
|
+
* my_queue:push(data)
|
|
279
|
+
* end
|
|
280
|
+
*/
|
|
281
|
+
has_subscribers(): boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Remove all events and handlers from this queue instance, effectively resetting it.
|
|
284
|
+
* my_queue:clear()
|
|
285
|
+
*/
|
|
286
|
+
clear(): void;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Global queues module that allows creation and management of global FIFO event queues that can be accessed from anywhere in your game.
|
|
290
|
+
* This is particularly useful for events that need to be handled by multiple scripts or systems using a queue-based approach.
|
|
291
|
+
*/
|
|
292
|
+
interface queues {
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Generate a new event instance. This instance can then be used to subscribe to and trigger events.
|
|
296
|
+
* The callback function will be called when the event is triggered. The callback_context parameter is optional
|
|
297
|
+
* and will be passed as the first parameter to the callback function. Usually, it is used to pass the self instance.
|
|
298
|
+
* local e = event.create()
|
|
299
|
+
* local e = event.create(function(self) print("ok") end, self)
|
|
300
|
+
*/
|
|
301
|
+
export function create(this: void, callback?: ((...args: any[]) => unknown) | event | undefined, callback_context?: unknown | undefined): event;
|
|
302
|
+
/**
|
|
303
|
+
* Check if the table is an event instance.
|
|
304
|
+
* if event.is_event(my_value) then
|
|
305
|
+
* my_value:trigger()
|
|
306
|
+
* end
|
|
307
|
+
*/
|
|
308
|
+
export function is_event(this: void, value: unknown): boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Customize the logging mechanism used by Event module. You can use **Defold Log** library or provide a custom logger.
|
|
311
|
+
* By default, the module uses the `pprint` logger for errors.
|
|
312
|
+
*/
|
|
313
|
+
export function set_logger(this: void, logger_instance?: event_logger | LuaTable | undefined): void;
|
|
314
|
+
/**
|
|
315
|
+
* Set the mode of the event module.
|
|
316
|
+
*/
|
|
317
|
+
export function set_mode(this: void, mode: "pcall"): void;
|
|
318
|
+
}
|
|
@@ -135,6 +135,38 @@ declare module 'gooey.gooey' {
|
|
|
135
135
|
total_width: number;
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
/** What `create_theme` hands back: the helpers it installs, over any component
|
|
139
|
+
* carrying a node. `is_enabled` and `set_enabled` return nothing when it does not. */
|
|
140
|
+
type Theme = {
|
|
141
|
+
is_enabled: (component: { node?: Opaque<"node"> }) => boolean | undefined;
|
|
142
|
+
set_enabled: (component: { node?: Opaque<"node"> }, enabled: boolean) => void;
|
|
143
|
+
acquire_input: () => void;
|
|
144
|
+
release_input: () => void;
|
|
145
|
+
group: (
|
|
146
|
+
group_id: Hash | string,
|
|
147
|
+
action_id: Hash,
|
|
148
|
+
action: table,
|
|
149
|
+
group_fn: () => void,
|
|
150
|
+
) => table;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Check if a node is enabled. This is done by not only looking at the state of the
|
|
155
|
+
* node itself but also it's ancestors all the way up the hierarchy.
|
|
156
|
+
*/
|
|
157
|
+
export function is_enabled(node: Opaque<"node">): boolean;
|
|
158
|
+
|
|
159
|
+
/** Convenience function to acquire input focus */
|
|
160
|
+
export function acquire_input(): void;
|
|
161
|
+
|
|
162
|
+
/** Convenience function to release input focus */
|
|
163
|
+
export function release_input(): void;
|
|
164
|
+
|
|
165
|
+
export function create_theme(): Theme;
|
|
166
|
+
|
|
167
|
+
/** Mask text by replacing every character with a mask character */
|
|
168
|
+
export function mask_text(text: string, mask: string): string;
|
|
169
|
+
|
|
138
170
|
export function button(
|
|
139
171
|
node_id: Hash | string,
|
|
140
172
|
action_id: Hash,
|
|
@@ -151,6 +183,15 @@ declare module 'gooey.gooey' {
|
|
|
151
183
|
refresh_fn?: (checkbox: CheckboxState) => void,
|
|
152
184
|
): CheckboxState;
|
|
153
185
|
|
|
186
|
+
/** Wraps the `gooey.radio` calls of one group; `fn` receives the group's id and the
|
|
187
|
+
* input it was called with, not a radio state (`README.md:265`). */
|
|
188
|
+
export function radiogroup(
|
|
189
|
+
group_id: Hash | string,
|
|
190
|
+
action_id: Hash,
|
|
191
|
+
action: table,
|
|
192
|
+
fn: (group_id: Hash | string, action_id: Hash, action: table) => void,
|
|
193
|
+
): table;
|
|
194
|
+
|
|
154
195
|
export function radio(
|
|
155
196
|
node_id: Hash | string,
|
|
156
197
|
group: string,
|
|
@@ -169,12 +210,10 @@ declare module 'gooey.gooey' {
|
|
|
169
210
|
config: { horizontal?: boolean } | undefined,
|
|
170
211
|
fn: (list: ListState) => void,
|
|
171
212
|
refresh_fn?: (list: ListState) => void,
|
|
172
|
-
is_horizontal?: boolean,
|
|
173
213
|
): ListState;
|
|
174
214
|
|
|
175
215
|
export function dynamic_list(
|
|
176
216
|
list_id: string,
|
|
177
|
-
root_id: string,
|
|
178
217
|
stencil_id: Hash | string,
|
|
179
218
|
item_id: Hash | string,
|
|
180
219
|
data: table,
|
|
@@ -183,12 +222,10 @@ declare module 'gooey.gooey' {
|
|
|
183
222
|
config: { horizontal?: boolean; carousel?: boolean } | undefined,
|
|
184
223
|
fn: (list: ListState) => void,
|
|
185
224
|
refresh_fn?: (list: ListState) => void,
|
|
186
|
-
is_horizontal?: boolean,
|
|
187
225
|
): ListState;
|
|
188
226
|
|
|
189
227
|
export function horizontal_dynamic_list(
|
|
190
228
|
list_id: string,
|
|
191
|
-
root_id: string,
|
|
192
229
|
stencil_id: Hash | string,
|
|
193
230
|
item_id: Hash | string,
|
|
194
231
|
data: table,
|
|
@@ -201,7 +238,6 @@ declare module 'gooey.gooey' {
|
|
|
201
238
|
|
|
202
239
|
export function vertical_dynamic_list(
|
|
203
240
|
list_id: string,
|
|
204
|
-
root_id: string,
|
|
205
241
|
stencil_id: Hash | string,
|
|
206
242
|
item_id: Hash | string,
|
|
207
243
|
data: table,
|
|
@@ -239,6 +275,17 @@ declare module 'gooey.gooey' {
|
|
|
239
275
|
bounds_id: Hash | string,
|
|
240
276
|
action_id: Hash,
|
|
241
277
|
action: table,
|
|
278
|
+
config: table | undefined,
|
|
279
|
+
fn: (scrollbar: ScrollbarState) => void,
|
|
280
|
+
refresh_fn?: (scrollbar: ScrollbarState) => void,
|
|
281
|
+
): ScrollbarState;
|
|
282
|
+
|
|
283
|
+
export function horizontal_scrollbar(
|
|
284
|
+
handle_id: Hash | string,
|
|
285
|
+
bounds_id: Hash | string,
|
|
286
|
+
action_id: Hash,
|
|
287
|
+
action: table,
|
|
288
|
+
config: table | undefined,
|
|
242
289
|
fn: (scrollbar: ScrollbarState) => void,
|
|
243
290
|
refresh_fn?: (scrollbar: ScrollbarState) => void,
|
|
244
291
|
): ScrollbarState;
|
|
@@ -257,5 +304,13 @@ declare module 'gooey.gooey' {
|
|
|
257
304
|
refresh_fn?: (input: InputState) => void,
|
|
258
305
|
): InputState;
|
|
259
306
|
|
|
260
|
-
export function group(
|
|
307
|
+
export function group(
|
|
308
|
+
group_id: Hash | string,
|
|
309
|
+
action_id: Hash,
|
|
310
|
+
action: table,
|
|
311
|
+
group_fn: () => void,
|
|
312
|
+
): table;
|
|
313
|
+
|
|
314
|
+
/** Move a group's focus to the component at `index`, refreshing it. */
|
|
315
|
+
export function set_focus(group: table, index: number): void;
|
|
261
316
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @noResolution */
|
|
2
|
+
declare module 'immutable.immutable' {
|
|
3
|
+
interface Immutable {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a given table `table_to_check` is immutable
|
|
7
|
+
*/
|
|
8
|
+
export function is_immutable(this: void, table_to_check: LuaTable | Immutable): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Makes a given table immutable, including nested tables
|
|
11
|
+
*/
|
|
12
|
+
export function make(this: void, original_table: LuaTable | Immutable): Immutable;
|
|
13
|
+
}
|
|
@@ -32,6 +32,11 @@ declare module 'in.onscreen' {
|
|
|
32
32
|
on_input: (action_id: Hash, action: {}) => boolean;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Create an instance of the onscreen controls.
|
|
37
|
+
* @param config Optional settings. `touch` is the action id bound to single touch.
|
|
38
|
+
* @returns The instance the register and input functions operate on.
|
|
39
|
+
*/
|
|
35
40
|
function create(config?: { touch: Hash }): OnscreenInstance;
|
|
36
41
|
|
|
37
42
|
export function reset(instance?: OnscreenInstance): void;
|
|
@@ -18,6 +18,10 @@ declare module 'in.textbox' {
|
|
|
18
18
|
): Opaque<"node">;
|
|
19
19
|
export function unregister(node_or_string?: Opaque<"node"> | string): void;
|
|
20
20
|
export function effect(node: Opaque<"node">, scale: { x: number; y: number }): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get a registered textbox's text, or set it first when `text` is given.
|
|
23
|
+
* Returns the text the box holds after the call.
|
|
24
|
+
*/
|
|
21
25
|
export function text(
|
|
22
26
|
node_or_string: Opaque<"node"> | string,
|
|
23
27
|
text?: string,
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** @noResolution */
|
|
2
|
+
declare module 'lang.lang' {
|
|
3
|
+
interface lang_logger {
|
|
4
|
+
trace: (_: unknown, msg: string, data: unknown) => void;
|
|
5
|
+
debug: (_: unknown, msg: string, data: unknown) => void;
|
|
6
|
+
info: (_: unknown, msg: string, data: unknown) => void;
|
|
7
|
+
warn: (_: unknown, msg: string, data: unknown) => void;
|
|
8
|
+
error: (_: unknown, msg: string, data: unknown) => void;
|
|
9
|
+
}
|
|
10
|
+
interface lang_registry {
|
|
11
|
+
}
|
|
12
|
+
interface lang {
|
|
13
|
+
state: lang_state;
|
|
14
|
+
on_lang_changed: (...args: any[]) => unknown;
|
|
15
|
+
}
|
|
16
|
+
interface lang_state {
|
|
17
|
+
lang: string;
|
|
18
|
+
}
|
|
19
|
+
interface lang_data {
|
|
20
|
+
path?: string | LuaTable | undefined;
|
|
21
|
+
id: string;
|
|
22
|
+
loader?: ((...args: any[]) => unknown) | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Global callback after language is loaded and translations are ready.
|
|
26
|
+
* Called by `set_lang`, `set_next_lang`, and `load_langs`. Set once at startup to refresh UI.
|
|
27
|
+
*/
|
|
28
|
+
export function on_lang_changed(this: void): void;
|
|
29
|
+
/**
|
|
30
|
+
* Call this to initialize lang module
|
|
31
|
+
*/
|
|
32
|
+
export function init(this: void, available_langs: lang_data[], lang_on_start?: string | undefined): void;
|
|
33
|
+
/**
|
|
34
|
+
* Load additional locale pack and refresh current language
|
|
35
|
+
*/
|
|
36
|
+
export function load_langs(this: void, pack_id: string, langs: lang_data[], on_lang_changed?: ((...args: any[]) => unknown) | undefined): void;
|
|
37
|
+
/**
|
|
38
|
+
* Set current language
|
|
39
|
+
*/
|
|
40
|
+
export function set_lang(this: void, lang_id: string, on_lang_changed?: ((...args: any[]) => unknown) | undefined): void;
|
|
41
|
+
/**
|
|
42
|
+
* Set next language from lang list and return it's code
|
|
43
|
+
*/
|
|
44
|
+
export function set_next_lang(this: void, on_lang_changed?: ((...args: any[]) => unknown) | undefined): string;
|
|
45
|
+
/**
|
|
46
|
+
* Get next language from lang list and return it's code
|
|
47
|
+
*/
|
|
48
|
+
export function get_next_lang(this: void): string;
|
|
49
|
+
/**
|
|
50
|
+
* Get current language
|
|
51
|
+
*/
|
|
52
|
+
export function get_lang(this: void): string;
|
|
53
|
+
/**
|
|
54
|
+
* Return list of available languages
|
|
55
|
+
*/
|
|
56
|
+
export function get_langs(this: void): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Get translation for text id
|
|
59
|
+
*/
|
|
60
|
+
export function txt(this: void, text_id: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Get translation for text id with params
|
|
63
|
+
*/
|
|
64
|
+
export function txp(this: void, text_id: string, ...args: (string | number)[]): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get random translation for text id, split by \n symbol
|
|
67
|
+
*/
|
|
68
|
+
export function txr(this: void, text_id: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Check is translation with text_id exist
|
|
71
|
+
*/
|
|
72
|
+
export function is_exist(this: void, text_id: string): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Set logger for lang module. Pass nil to use empty logger
|
|
75
|
+
*/
|
|
76
|
+
export function set_logger(this: void, logger_instance?: lang_logger | LuaTable | undefined): void;
|
|
77
|
+
/**
|
|
78
|
+
* Reset module lang state
|
|
79
|
+
*/
|
|
80
|
+
export function reset_state(this: void): void;
|
|
81
|
+
/**
|
|
82
|
+
* Get lang module state
|
|
83
|
+
*/
|
|
84
|
+
export function get_state(this: void): lang_state;
|
|
85
|
+
/**
|
|
86
|
+
* Set lang module state
|
|
87
|
+
*/
|
|
88
|
+
export function set_state(this: void, state: lang_state): void;
|
|
89
|
+
/**
|
|
90
|
+
* Get default language
|
|
91
|
+
*/
|
|
92
|
+
export function get_default_lang(this: void): string;
|
|
93
|
+
/**
|
|
94
|
+
* Get current lang table { key = "value" }
|
|
95
|
+
*/
|
|
96
|
+
export function get_lang_table(this: void): LuaTable<string, string>;
|
|
97
|
+
/**
|
|
98
|
+
* Check if language is available
|
|
99
|
+
*/
|
|
100
|
+
export function is_lang_available(this: void, lang_id: string): boolean;
|
|
101
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @noResolution */
|
|
2
|
+
declare module 'log.log' {
|
|
3
|
+
type logger = log;
|
|
4
|
+
interface log {
|
|
5
|
+
name: string;
|
|
6
|
+
level: string;
|
|
7
|
+
/**
|
|
8
|
+
* Log message with TRACE level
|
|
9
|
+
*/
|
|
10
|
+
trace(message: string, data: unknown): void;
|
|
11
|
+
/**
|
|
12
|
+
* Log message with DEBUG level
|
|
13
|
+
*/
|
|
14
|
+
debug(message: string, data: unknown): void;
|
|
15
|
+
/**
|
|
16
|
+
* Log message with INFO level
|
|
17
|
+
*/
|
|
18
|
+
info(message: string, data: unknown): void;
|
|
19
|
+
/**
|
|
20
|
+
* Log message with WARN level
|
|
21
|
+
*/
|
|
22
|
+
warn(message: string, data: unknown): void;
|
|
23
|
+
/**
|
|
24
|
+
* Log message with ERROR level
|
|
25
|
+
*/
|
|
26
|
+
error(message: string, data: unknown): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Return the new logger instance
|
|
30
|
+
*/
|
|
31
|
+
export function get_logger(this: void, logger_name?: string | undefined, force_logger_level_in_debug?: string | undefined): logger;
|
|
32
|
+
/**
|
|
33
|
+
* Return the basename of the current file
|
|
34
|
+
*/
|
|
35
|
+
export function get_default_logger_name(this: void, debuginfo: debug.FunctionInfo): string;
|
|
36
|
+
}
|
|
@@ -12,5 +12,23 @@ declare module 'metrics.fps' {
|
|
|
12
12
|
draw: () => void;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/** Where `draw()` places the text, and the default `create()` uses when given no position. */
|
|
16
|
+
export const POSITION: Vector3;
|
|
17
|
+
|
|
18
|
+
/** The `string.format` pattern the FPS reading is rendered through. */
|
|
19
|
+
export const FORMAT: string;
|
|
20
|
+
|
|
21
|
+
/** The colour `draw()` renders the text in, and the default `create()` uses when given no colour. */
|
|
22
|
+
export const COLOR: Vector4;
|
|
23
|
+
|
|
24
|
+
export function create(samples?: number, format?: string, position?: Vector3, color?: Vector4): Metrics;
|
|
25
|
+
|
|
26
|
+
/** Call this once per frame. Once enough samples have been collected it is possible to call fps() to get the current FPS. */
|
|
27
|
+
export function update(): void;
|
|
28
|
+
|
|
29
|
+
/** Get the current FPS, based on collected samples. */
|
|
30
|
+
export function fps(): number;
|
|
31
|
+
|
|
32
|
+
/** Draw fps count text using `draw_debug_text`. */
|
|
33
|
+
export function draw(): void;
|
|
16
34
|
}
|
|
@@ -12,5 +12,23 @@ declare module 'metrics.mem' {
|
|
|
12
12
|
draw: () => void;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/** Where `draw()` places the text, and the default `create()` uses when given no position. */
|
|
16
|
+
export const POSITION: Vector3;
|
|
17
|
+
|
|
18
|
+
/** The `string.format` pattern the memory reading is rendered through. */
|
|
19
|
+
export const FORMAT: string;
|
|
20
|
+
|
|
21
|
+
/** The colour `draw()` renders the text in, and the default `create()` uses when given no colour. */
|
|
22
|
+
export const COLOR: Vector4;
|
|
23
|
+
|
|
24
|
+
export function create(format?: string, position?: Vector3, color?: Vector4): Metrics;
|
|
25
|
+
|
|
26
|
+
/** Call this to get a new memory usage reading. */
|
|
27
|
+
export function update(): void;
|
|
28
|
+
|
|
29
|
+
/** Get the current memory usage, in kilobytes. */
|
|
30
|
+
export function mem(): number;
|
|
31
|
+
|
|
32
|
+
/** Draw memory usage text using `draw_debug_text`. */
|
|
33
|
+
export function draw(): void;
|
|
16
34
|
}
|