@defold-typescript/types 0.49.0 → 0.50.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.
- package/api-availability.json +696 -624
- package/api-signatures.json +6799 -160
- package/api-targets.json +393 -2
- package/examples/translations.json +12 -0
- package/generated/b2d.d.ts +15 -0
- package/generated/bullet3d.d.ts +16 -0
- package/generated/font.d.ts +7 -3
- package/generated/graphics.d.ts +7 -0
- package/generated/gui.d.ts +5 -4
- package/generated/label.d.ts +3 -3
- package/generated/render.d.ts +16 -1
- package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
- package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
- package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
- package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
- package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
- package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
- package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
- package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
- package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
- package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
- package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
- package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
- package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
- package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
- package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
- package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
- package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
- package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
- package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
- package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
- package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
- package/generated/versions/defold-1.13.2/font.d.ts +123 -0
- package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
- package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
- package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
- package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.2/http.d.ts +83 -0
- package/generated/versions/defold-1.13.2/image.d.ts +181 -0
- package/generated/versions/defold-1.13.2/index.d.ts +63 -0
- package/generated/versions/defold-1.13.2/json.d.ts +94 -0
- package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.2/label.d.ts +164 -0
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
- package/generated/versions/defold-1.13.2/material.d.ts +490 -0
- package/generated/versions/defold-1.13.2/model.d.ts +287 -0
- package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
- package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
- package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
- package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
- package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
- package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
- package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
- package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
- package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
- package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
- package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
- package/generated/versions/defold-1.13.2/types.d.ts +61 -0
- package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
- package/generated/versions/defold-1.13.2/window.d.ts +196 -0
- package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
- package/identity-vocabulary.json +1 -0
- package/package.json +2 -2
- package/scripts/import-defold-release.ts +3 -31
- package/scripts/materialize-version.ts +13 -7
- package/scripts/regen.ts +63 -29
- package/scripts/sync-api-docs.ts +31 -2
- package/src/emit-dts.ts +25 -3
|
@@ -0,0 +1,2177 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Opaque } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Editor scripting documentation
|
|
7
|
+
*/
|
|
8
|
+
namespace editor {
|
|
9
|
+
type command = Opaque<"command">;
|
|
10
|
+
type component = Opaque<"component">;
|
|
11
|
+
type image = Opaque<"editor.image">;
|
|
12
|
+
type message = Opaque<"message">;
|
|
13
|
+
type schema = Opaque<"editor.schema">;
|
|
14
|
+
type tiles = Opaque<"editor.tiles">;
|
|
15
|
+
type transaction_step = Opaque<"transaction_step">;
|
|
16
|
+
/**
|
|
17
|
+
* A string, SHA1 of Defold editor
|
|
18
|
+
*/
|
|
19
|
+
const editor_sha1: unknown;
|
|
20
|
+
/**
|
|
21
|
+
* A string, SHA1 of Defold engine
|
|
22
|
+
*/
|
|
23
|
+
const engine_sha1: unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Editor platform id.
|
|
26
|
+
* A `string`, either:
|
|
27
|
+
* - `"x86_64-win32"`
|
|
28
|
+
* - `"x86_64-macos"`
|
|
29
|
+
* - `"arm64-macos"`
|
|
30
|
+
* - `"x86_64-linux"`
|
|
31
|
+
*/
|
|
32
|
+
const platform: "x86_64-win32" | "x86_64-macos" | "arm64-macos" | "x86_64-linux";
|
|
33
|
+
/**
|
|
34
|
+
* A string, version name of Defold
|
|
35
|
+
*/
|
|
36
|
+
const version: unknown;
|
|
37
|
+
/**
|
|
38
|
+
* Run bob the builder program
|
|
39
|
+
* For the full documentation of the available commands and options, see the bob manual.
|
|
40
|
+
*
|
|
41
|
+
* @param options - table of command line options for bob, without the leading dashes (`--`). You can use snake_case instead of kebab-case for option keys. Only long option names are supported (i.e. `output`, not `o`). Supported value types are strings, integers and booleans. If an option takes no arguments, use a boolean (i.e. `true`). If an option may be repeated, you can use an array of values.
|
|
42
|
+
* @param args - bob commands, e.g. `"resolve"` or `"build"`
|
|
43
|
+
* @example
|
|
44
|
+
* Print help in the console:
|
|
45
|
+
* ```ts
|
|
46
|
+
* editor.bob({ help: true });
|
|
47
|
+
* ```
|
|
48
|
+
* @example
|
|
49
|
+
* Bundle the game for the host platform:
|
|
50
|
+
* ```ts
|
|
51
|
+
* const opts = { archive: true, platform: editor.platform };
|
|
52
|
+
* editor.bob(opts, "distclean", "resolve", "build", "bundle");
|
|
53
|
+
* ```
|
|
54
|
+
* @example
|
|
55
|
+
* Using snake_cased and repeated options:
|
|
56
|
+
* ```ts
|
|
57
|
+
* const opts = {
|
|
58
|
+
* archive: true,
|
|
59
|
+
* platform: editor.platform,
|
|
60
|
+
* build_server: "https://build.my-company.com",
|
|
61
|
+
* settings: ["test.ini", "headless.ini"],
|
|
62
|
+
* };
|
|
63
|
+
* editor.bob(opts, "distclean", "resolve", "build");
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
function bob(options?: LuaMap<string, string | number | boolean | (string | number | boolean)[]> | Record<string, string | number | boolean | (string | number | boolean)[]>, ...args: string[]): void;
|
|
67
|
+
/**
|
|
68
|
+
* Open a URL in the default browser or a registered application
|
|
69
|
+
*
|
|
70
|
+
* @param url - http(s) or file URL
|
|
71
|
+
*/
|
|
72
|
+
function browse(url: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Check whether this list property supports add, clear, and remove operations on the supplied node.
|
|
75
|
+
*
|
|
76
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
77
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
78
|
+
*/
|
|
79
|
+
function can_add(node: string | Opaque<"userdata">, property: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Check whether this property is exposed for reading on the supplied node or resource.
|
|
82
|
+
*
|
|
83
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
84
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
85
|
+
*/
|
|
86
|
+
function can_get(node: string | Opaque<"userdata">, property: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Check whether this list property supports reordering on the supplied node.
|
|
89
|
+
*
|
|
90
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
91
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
92
|
+
*/
|
|
93
|
+
function can_reorder(node: string | Opaque<"userdata">, property: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Check whether this property supports reset on the supplied node.
|
|
96
|
+
*
|
|
97
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
98
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
99
|
+
*/
|
|
100
|
+
function can_reset(node: string | Opaque<"userdata">, property: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Check whether this property is exposed for setting on the supplied node.
|
|
103
|
+
*
|
|
104
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
105
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
106
|
+
*/
|
|
107
|
+
function can_set(node: string | Opaque<"userdata">, property: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Create a directory if it does not exist, and all non-existent parent directories.
|
|
110
|
+
* Throws an error if the directory can't be created.
|
|
111
|
+
*
|
|
112
|
+
* @param resource_path - Resource path (starting with `/`)
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* editor.create_directory("/assets/gen");
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
function create_directory(resource_path: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Create resources (including non-existent parent directories).
|
|
121
|
+
* Throws an error if any of the provided resource paths already exist
|
|
122
|
+
*
|
|
123
|
+
* @param resources - resource paths (strings starting with `/`) or pairs containing a resource path and optional content
|
|
124
|
+
* @example
|
|
125
|
+
* Create a single resource from template:
|
|
126
|
+
* ```ts
|
|
127
|
+
* editor.create_resources(["/npc.go"]);
|
|
128
|
+
* ```
|
|
129
|
+
* @example
|
|
130
|
+
* Create multiple resources:
|
|
131
|
+
* ```ts
|
|
132
|
+
* editor.create_resources(["/npc.go", "/levels/1.collection", "/levels/2.collection"]);
|
|
133
|
+
* ```
|
|
134
|
+
* @example
|
|
135
|
+
* Create a resource with custom content:
|
|
136
|
+
* ```ts
|
|
137
|
+
* editor.create_resources([{ 1: "/npc.script", 2: "go.property('hp', 100)" }]);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
function create_resources(resources: (string | editor.create_resources.resource)[]): void;
|
|
141
|
+
/**
|
|
142
|
+
* Delete a directory if it exists, and all existent child directories and files.
|
|
143
|
+
* Throws an error if the directory can't be deleted.
|
|
144
|
+
*
|
|
145
|
+
* @param resource_path - Resource path (starting with `/`)
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* editor.delete_directory("/assets/gen");
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
function delete_directory(resource_path: string): void;
|
|
152
|
+
/**
|
|
153
|
+
* Execute a shell command.
|
|
154
|
+
* Any shell command arguments should be provided as separate argument strings to this function. If the exit code of the process is not zero, this function throws error. By default, the function returns `nil`, but it can be configured to capture the output of the shell command as string and return it — set `out` option to `"capture"` to do it.
|
|
155
|
+
* By default, after this shell command is executed, the editor will reload resources from disk.
|
|
156
|
+
*
|
|
157
|
+
* @param command - Shell command name to execute
|
|
158
|
+
* @param args - Optional shell command arguments
|
|
159
|
+
* @param options - execution options
|
|
160
|
+
* @returns If `out` option is set to `"capture"`, returns the output as string with trimmed trailing newlines. Otherwise, returns `nil`.
|
|
161
|
+
* @example
|
|
162
|
+
* Make a directory with spaces in it:
|
|
163
|
+
* ```ts
|
|
164
|
+
* editor.execute("mkdir", "new dir");
|
|
165
|
+
* ```
|
|
166
|
+
* @example
|
|
167
|
+
* Read the git status:
|
|
168
|
+
* ```ts
|
|
169
|
+
* const status = editor.execute("git", "status", "--porcelain", {
|
|
170
|
+
* reload_resources: false,
|
|
171
|
+
* out: "capture",
|
|
172
|
+
* });
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
function execute(command: string, ...args: (string | editor.execute.options)[]): undefined | string;
|
|
176
|
+
/**
|
|
177
|
+
* Query information about file system path
|
|
178
|
+
*
|
|
179
|
+
* @param path - External file path, resolved against project root if relative
|
|
180
|
+
* @returns external file attributes
|
|
181
|
+
*/
|
|
182
|
+
function external_file_attributes(path: string): editor.external_file_attributes.result;
|
|
183
|
+
/**
|
|
184
|
+
* Download the latest version of the project library dependencies and reload library-provided editor scripts.
|
|
185
|
+
* This function may replace library-provided editor commands, hooks, routes, and UI contributed by editor scripts, so it should typically be the last operation performed by a command.
|
|
186
|
+
*/
|
|
187
|
+
function fetch_libraries(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Get a value of a node property inside the editor.
|
|
190
|
+
* Some properties might be read-only, and some might be unavailable in different contexts, so you should use `editor.can_get()` before reading them and `editor.can_set()` before making the editor set them.
|
|
191
|
+
*
|
|
192
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
193
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
194
|
+
* @returns property value
|
|
195
|
+
*/
|
|
196
|
+
function get(node: string | Opaque<"userdata">, property: string): unknown;
|
|
197
|
+
/**
|
|
198
|
+
* Open a file in a registered application
|
|
199
|
+
*
|
|
200
|
+
* @param path - file path
|
|
201
|
+
*/
|
|
202
|
+
function open_external_file(path: string): void;
|
|
203
|
+
/**
|
|
204
|
+
* List property names for a node.
|
|
205
|
+
* The result is context-sensitive and can vary by node/resource type and editor state. Returned names are readable with `editor.get(node, property)`. Mutating capabilities are per-property; use `editor.can_set()`, `editor.can_reset()`, `editor.can_add()`, and `editor.can_reorder()` to check which operations are supported.
|
|
206
|
+
*
|
|
207
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
208
|
+
* @returns sorted unique editor property names available in the current context
|
|
209
|
+
*/
|
|
210
|
+
function properties(node: string | Opaque<"userdata">): string[];
|
|
211
|
+
/**
|
|
212
|
+
* Query information about a project resource
|
|
213
|
+
*
|
|
214
|
+
* @param resource_path - Resource path (starting with `/`)
|
|
215
|
+
* @returns resource attributes
|
|
216
|
+
*/
|
|
217
|
+
function resource_attributes(resource_path: string): editor.resource_attributes.result;
|
|
218
|
+
/**
|
|
219
|
+
* Persist any unsaved changes to disk
|
|
220
|
+
*/
|
|
221
|
+
function save(): void;
|
|
222
|
+
/**
|
|
223
|
+
* Change the editor state in a single, undoable transaction
|
|
224
|
+
*
|
|
225
|
+
* @param txs - An array of transaction steps created using `editor.tx.*` functions
|
|
226
|
+
*/
|
|
227
|
+
function transact(txs: Opaque<"transaction_step">[]): void;
|
|
228
|
+
namespace command {
|
|
229
|
+
/**
|
|
230
|
+
* Context provided to editor command handler functions
|
|
231
|
+
*/
|
|
232
|
+
interface context {
|
|
233
|
+
/**
|
|
234
|
+
* current selection, populated when requested by the command query
|
|
235
|
+
*/
|
|
236
|
+
selection?: string | Opaque<"userdata"> | (string | Opaque<"userdata">)[];
|
|
237
|
+
/**
|
|
238
|
+
* current active editor view, populated when requested by the command query
|
|
239
|
+
*/
|
|
240
|
+
active_view?: Opaque<"userdata">;
|
|
241
|
+
/**
|
|
242
|
+
* command argument, populated when requested by the command query
|
|
243
|
+
*/
|
|
244
|
+
argument?: unknown;
|
|
245
|
+
}
|
|
246
|
+
type location = "Assets" | "Bundle" | "Code" | "Debug" | "Edit" | "Help" | "Outline" | "Project" | "Scene" | "View";
|
|
247
|
+
/**
|
|
248
|
+
* Options used to create an editor command
|
|
249
|
+
*/
|
|
250
|
+
interface options {
|
|
251
|
+
/**
|
|
252
|
+
* user-visible command name, either a string or a localization message
|
|
253
|
+
*/
|
|
254
|
+
label: string | Opaque<"message">;
|
|
255
|
+
/**
|
|
256
|
+
* non-empty list of locations where the command is displayed
|
|
257
|
+
*/
|
|
258
|
+
locations: editor.command.location[];
|
|
259
|
+
/**
|
|
260
|
+
* query that controls command availability and provides context to its handler functions
|
|
261
|
+
*/
|
|
262
|
+
query?: editor.command.query;
|
|
263
|
+
/**
|
|
264
|
+
* keyword identifier that may be used for assigning a shortcut to a command; should be a dot-separated identifier string, e.g. `"my-extension.do-stuff"`
|
|
265
|
+
*/
|
|
266
|
+
id?: string;
|
|
267
|
+
/**
|
|
268
|
+
* function that additionally checks if a command is active in the current context; should be fast to execute since the editor might invoke it in response to UI interactions
|
|
269
|
+
*/
|
|
270
|
+
active?: (opts: editor.command.context) => boolean;
|
|
271
|
+
/**
|
|
272
|
+
* function that is invoked when the user decides to execute the command
|
|
273
|
+
*/
|
|
274
|
+
run?: (opts: editor.command.context) => unknown;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* A query that controls command availability and provides context to its handler functions
|
|
278
|
+
*/
|
|
279
|
+
interface query {
|
|
280
|
+
/**
|
|
281
|
+
* current selection request
|
|
282
|
+
*/
|
|
283
|
+
selection?: editor.command.query.selection;
|
|
284
|
+
/**
|
|
285
|
+
* current active editor view request
|
|
286
|
+
*/
|
|
287
|
+
active_view?: editor.command.query.active_view;
|
|
288
|
+
/**
|
|
289
|
+
* set to true to provide the command argument to the handler functions
|
|
290
|
+
*/
|
|
291
|
+
argument?: true;
|
|
292
|
+
}
|
|
293
|
+
namespace query {
|
|
294
|
+
/**
|
|
295
|
+
* Active editor view requested by an editor command
|
|
296
|
+
*/
|
|
297
|
+
interface active_view {
|
|
298
|
+
/**
|
|
299
|
+
* active editor view type
|
|
300
|
+
*/
|
|
301
|
+
type: "code" | "scene" | "html" | "form";
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Selection requested by an editor command
|
|
305
|
+
*/
|
|
306
|
+
interface selection {
|
|
307
|
+
/**
|
|
308
|
+
* selection type
|
|
309
|
+
*/
|
|
310
|
+
type: "resource" | "outline" | "scene";
|
|
311
|
+
/**
|
|
312
|
+
* either the first selected item or all selected items
|
|
313
|
+
*/
|
|
314
|
+
cardinality: "one" | "many";
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
namespace create_resources {
|
|
319
|
+
type resource = { 1: string; 2?: string };
|
|
320
|
+
}
|
|
321
|
+
namespace execute {
|
|
322
|
+
/**
|
|
323
|
+
* Options for editor.execute
|
|
324
|
+
*/
|
|
325
|
+
interface options {
|
|
326
|
+
/**
|
|
327
|
+
* whether the editor reloads resources from disk after the command is executed; defaults to true
|
|
328
|
+
*/
|
|
329
|
+
reload_resources?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* standard output mode; defaults to `"pipe"`
|
|
332
|
+
*/
|
|
333
|
+
out?: "pipe" | "capture" | "discard";
|
|
334
|
+
/**
|
|
335
|
+
* standard error output mode; defaults to `"pipe"`
|
|
336
|
+
*/
|
|
337
|
+
err?: "pipe" | "stdout" | "discard";
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
namespace external_file_attributes {
|
|
341
|
+
/**
|
|
342
|
+
* External file attributes
|
|
343
|
+
*/
|
|
344
|
+
interface result {
|
|
345
|
+
/**
|
|
346
|
+
* resolved file path
|
|
347
|
+
*/
|
|
348
|
+
path: string;
|
|
349
|
+
/**
|
|
350
|
+
* whether there is a file system entry at the path
|
|
351
|
+
*/
|
|
352
|
+
exists: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* whether the path corresponds to a file
|
|
355
|
+
*/
|
|
356
|
+
is_file: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* whether the path corresponds to a directory
|
|
359
|
+
*/
|
|
360
|
+
is_directory: boolean;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
namespace prefs {
|
|
364
|
+
type SCOPE = typeof editor.prefs.SCOPE.GLOBAL | typeof editor.prefs.SCOPE.PROJECT;
|
|
365
|
+
/**
|
|
366
|
+
* Get preference value
|
|
367
|
+
* The schema for the preference value should be defined beforehand.
|
|
368
|
+
*
|
|
369
|
+
* @param key - dot-separated preference key path
|
|
370
|
+
* @returns current pref value or default if a schema for the key path exists, nil otherwise
|
|
371
|
+
*/
|
|
372
|
+
function get(key: string): unknown;
|
|
373
|
+
/**
|
|
374
|
+
* Check if preference value is explicitly set
|
|
375
|
+
* The schema for the preference value should be defined beforehand.
|
|
376
|
+
*
|
|
377
|
+
* @param key - dot-separated preference key path
|
|
378
|
+
* @returns flag indicating if the value is explicitly set
|
|
379
|
+
*/
|
|
380
|
+
function is_set(key: string): boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Set preference value
|
|
383
|
+
* The schema for the preference value should be defined beforehand.
|
|
384
|
+
*
|
|
385
|
+
* @param key - dot-separated preference key path
|
|
386
|
+
* @param value - new pref value to set
|
|
387
|
+
*/
|
|
388
|
+
function set(key: string, value: unknown): void;
|
|
389
|
+
namespace schema {
|
|
390
|
+
/**
|
|
391
|
+
* array schema
|
|
392
|
+
*
|
|
393
|
+
* @param opts - schema options
|
|
394
|
+
* @returns Prefs schema
|
|
395
|
+
*/
|
|
396
|
+
export function array(opts: editor.prefs.schema.array.options): editor.schema;
|
|
397
|
+
/**
|
|
398
|
+
* boolean schema
|
|
399
|
+
*
|
|
400
|
+
* @param opts - schema options
|
|
401
|
+
* @returns Prefs schema
|
|
402
|
+
*/
|
|
403
|
+
export function boolean(opts?: editor.prefs.schema.boolean.options): editor.schema;
|
|
404
|
+
/**
|
|
405
|
+
* enum value schema
|
|
406
|
+
*
|
|
407
|
+
* @param opts - schema options
|
|
408
|
+
* @returns Prefs schema
|
|
409
|
+
*/
|
|
410
|
+
function _enum(opts: editor.prefs.schema.enum.options): editor.schema;
|
|
411
|
+
/**
|
|
412
|
+
* integer schema
|
|
413
|
+
*
|
|
414
|
+
* @param opts - schema options
|
|
415
|
+
* @returns Prefs schema
|
|
416
|
+
*/
|
|
417
|
+
export function integer(opts?: editor.prefs.schema.integer.options): editor.schema;
|
|
418
|
+
/**
|
|
419
|
+
* keyword schema
|
|
420
|
+
* A keyword is a short string that is interned within the editor runtime, useful e.g. for identifiers
|
|
421
|
+
*
|
|
422
|
+
* @param opts - schema options
|
|
423
|
+
* @returns Prefs schema
|
|
424
|
+
*/
|
|
425
|
+
export function keyword(opts?: editor.prefs.schema.keyword.options): editor.schema;
|
|
426
|
+
/**
|
|
427
|
+
* floating-point number schema
|
|
428
|
+
*
|
|
429
|
+
* @param opts - schema options
|
|
430
|
+
* @returns Prefs schema
|
|
431
|
+
*/
|
|
432
|
+
export function number(opts?: editor.prefs.schema.number.options): editor.schema;
|
|
433
|
+
/**
|
|
434
|
+
* heterogeneous object schema
|
|
435
|
+
*
|
|
436
|
+
* @param opts - schema options
|
|
437
|
+
* @returns Prefs schema
|
|
438
|
+
*/
|
|
439
|
+
export function object(opts: editor.prefs.schema.object.options): editor.schema;
|
|
440
|
+
/**
|
|
441
|
+
* homogeneous object schema
|
|
442
|
+
*
|
|
443
|
+
* @param opts - schema options
|
|
444
|
+
* @returns Prefs schema
|
|
445
|
+
*/
|
|
446
|
+
export function object_of(opts: editor.prefs.schema.object_of.options): editor.schema;
|
|
447
|
+
/**
|
|
448
|
+
* one of schema
|
|
449
|
+
*
|
|
450
|
+
* @param opts - schema options
|
|
451
|
+
* @returns Prefs schema
|
|
452
|
+
*/
|
|
453
|
+
export function one_of(opts: editor.prefs.schema.one_of.options): editor.schema;
|
|
454
|
+
/**
|
|
455
|
+
* password schema
|
|
456
|
+
* A password is a string that is encrypted when stored in a preference file
|
|
457
|
+
*
|
|
458
|
+
* @param opts - schema options
|
|
459
|
+
* @returns Prefs schema
|
|
460
|
+
*/
|
|
461
|
+
export function password(opts?: editor.prefs.schema.password.options): editor.schema;
|
|
462
|
+
/**
|
|
463
|
+
* set schema
|
|
464
|
+
* Set is represented as a lua table with `true` values
|
|
465
|
+
*
|
|
466
|
+
* @param opts - schema options
|
|
467
|
+
* @returns Prefs schema
|
|
468
|
+
*/
|
|
469
|
+
export function set(opts: editor.prefs.schema.set.options): editor.schema;
|
|
470
|
+
/**
|
|
471
|
+
* string schema
|
|
472
|
+
*
|
|
473
|
+
* @param opts - schema options
|
|
474
|
+
* @returns Prefs schema
|
|
475
|
+
*/
|
|
476
|
+
export function string(opts?: editor.prefs.schema.string.options): editor.schema;
|
|
477
|
+
/**
|
|
478
|
+
* tuple schema
|
|
479
|
+
* A tuple is a fixed-length array where each item has its own defined type
|
|
480
|
+
*
|
|
481
|
+
* @param opts - schema options
|
|
482
|
+
* @returns Prefs schema
|
|
483
|
+
*/
|
|
484
|
+
export function tuple(opts: editor.prefs.schema.tuple.options): editor.schema;
|
|
485
|
+
export { _enum as enum };
|
|
486
|
+
export namespace array {
|
|
487
|
+
/**
|
|
488
|
+
* Options for editor.prefs.schema.array
|
|
489
|
+
*/
|
|
490
|
+
interface options {
|
|
491
|
+
/**
|
|
492
|
+
* array item schema
|
|
493
|
+
*/
|
|
494
|
+
item: editor.schema;
|
|
495
|
+
/**
|
|
496
|
+
* default value
|
|
497
|
+
*/
|
|
498
|
+
default?: unknown[];
|
|
499
|
+
/**
|
|
500
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
501
|
+
*/
|
|
502
|
+
scope?: editor.prefs.SCOPE;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
export namespace boolean {
|
|
506
|
+
/**
|
|
507
|
+
* Options for editor.prefs.schema.boolean
|
|
508
|
+
*/
|
|
509
|
+
interface options {
|
|
510
|
+
/**
|
|
511
|
+
* default value
|
|
512
|
+
*/
|
|
513
|
+
default?: boolean;
|
|
514
|
+
/**
|
|
515
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
516
|
+
*/
|
|
517
|
+
scope?: editor.prefs.SCOPE;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
namespace _enum {
|
|
521
|
+
/**
|
|
522
|
+
* Options for editor.prefs.schema.enum
|
|
523
|
+
*/
|
|
524
|
+
interface options {
|
|
525
|
+
/**
|
|
526
|
+
* allowed values, must be scalar (nil, boolean, number or string)
|
|
527
|
+
*/
|
|
528
|
+
values: (undefined | boolean | number | string)[];
|
|
529
|
+
/**
|
|
530
|
+
* default value
|
|
531
|
+
*/
|
|
532
|
+
default?: unknown;
|
|
533
|
+
/**
|
|
534
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
535
|
+
*/
|
|
536
|
+
scope?: editor.prefs.SCOPE;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
export namespace integer {
|
|
540
|
+
/**
|
|
541
|
+
* Options for editor.prefs.schema.integer
|
|
542
|
+
*/
|
|
543
|
+
interface options {
|
|
544
|
+
/**
|
|
545
|
+
* default value
|
|
546
|
+
*/
|
|
547
|
+
default?: number;
|
|
548
|
+
/**
|
|
549
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
550
|
+
*/
|
|
551
|
+
scope?: editor.prefs.SCOPE;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
export namespace keyword {
|
|
555
|
+
/**
|
|
556
|
+
* Options for editor.prefs.schema.keyword
|
|
557
|
+
*/
|
|
558
|
+
interface options {
|
|
559
|
+
/**
|
|
560
|
+
* default value
|
|
561
|
+
*/
|
|
562
|
+
default?: string;
|
|
563
|
+
/**
|
|
564
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
565
|
+
*/
|
|
566
|
+
scope?: editor.prefs.SCOPE;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
export namespace number {
|
|
570
|
+
/**
|
|
571
|
+
* Options for editor.prefs.schema.number
|
|
572
|
+
*/
|
|
573
|
+
interface options {
|
|
574
|
+
/**
|
|
575
|
+
* default value
|
|
576
|
+
*/
|
|
577
|
+
default?: number;
|
|
578
|
+
/**
|
|
579
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
580
|
+
*/
|
|
581
|
+
scope?: editor.prefs.SCOPE;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
export namespace object {
|
|
585
|
+
/**
|
|
586
|
+
* Options for editor.prefs.schema.object
|
|
587
|
+
*/
|
|
588
|
+
interface options {
|
|
589
|
+
/**
|
|
590
|
+
* a table from property key (string) to value schema
|
|
591
|
+
*/
|
|
592
|
+
properties: LuaTable<string, editor.schema>;
|
|
593
|
+
/**
|
|
594
|
+
* default value
|
|
595
|
+
*/
|
|
596
|
+
default?: LuaTable<string, unknown>;
|
|
597
|
+
/**
|
|
598
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
599
|
+
*/
|
|
600
|
+
scope?: editor.prefs.SCOPE;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
export namespace object_of {
|
|
604
|
+
/**
|
|
605
|
+
* Options for editor.prefs.schema.object_of
|
|
606
|
+
*/
|
|
607
|
+
interface options {
|
|
608
|
+
/**
|
|
609
|
+
* table key schema
|
|
610
|
+
*/
|
|
611
|
+
key: editor.schema;
|
|
612
|
+
/**
|
|
613
|
+
* table value schema
|
|
614
|
+
*/
|
|
615
|
+
val: editor.schema;
|
|
616
|
+
/**
|
|
617
|
+
* default value
|
|
618
|
+
*/
|
|
619
|
+
default?: LuaTable<AnyNotNil, unknown>;
|
|
620
|
+
/**
|
|
621
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
622
|
+
*/
|
|
623
|
+
scope?: editor.prefs.SCOPE;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
export namespace one_of {
|
|
627
|
+
/**
|
|
628
|
+
* Options for editor.prefs.schema.one_of
|
|
629
|
+
*/
|
|
630
|
+
interface options {
|
|
631
|
+
/**
|
|
632
|
+
* alternative schemas
|
|
633
|
+
*/
|
|
634
|
+
schemas: editor.schema[];
|
|
635
|
+
/**
|
|
636
|
+
* default value
|
|
637
|
+
*/
|
|
638
|
+
default?: unknown;
|
|
639
|
+
/**
|
|
640
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
641
|
+
*/
|
|
642
|
+
scope?: editor.prefs.SCOPE;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
export namespace password {
|
|
646
|
+
/**
|
|
647
|
+
* Options for editor.prefs.schema.password
|
|
648
|
+
*/
|
|
649
|
+
interface options {
|
|
650
|
+
/**
|
|
651
|
+
* default value
|
|
652
|
+
*/
|
|
653
|
+
default?: string;
|
|
654
|
+
/**
|
|
655
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
656
|
+
*/
|
|
657
|
+
scope?: editor.prefs.SCOPE;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
export namespace set {
|
|
661
|
+
/**
|
|
662
|
+
* Options for editor.prefs.schema.set
|
|
663
|
+
*/
|
|
664
|
+
interface options {
|
|
665
|
+
/**
|
|
666
|
+
* set item schema
|
|
667
|
+
*/
|
|
668
|
+
item: editor.schema;
|
|
669
|
+
/**
|
|
670
|
+
* default value
|
|
671
|
+
*/
|
|
672
|
+
default?: LuaTable<AnyNotNil, true>;
|
|
673
|
+
/**
|
|
674
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
675
|
+
*/
|
|
676
|
+
scope?: editor.prefs.SCOPE;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
export namespace string {
|
|
680
|
+
/**
|
|
681
|
+
* Options for editor.prefs.schema.string
|
|
682
|
+
*/
|
|
683
|
+
interface options {
|
|
684
|
+
/**
|
|
685
|
+
* default value
|
|
686
|
+
*/
|
|
687
|
+
default?: string;
|
|
688
|
+
/**
|
|
689
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
690
|
+
*/
|
|
691
|
+
scope?: editor.prefs.SCOPE;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
export namespace tuple {
|
|
695
|
+
/**
|
|
696
|
+
* Options for editor.prefs.schema.tuple
|
|
697
|
+
*/
|
|
698
|
+
interface options {
|
|
699
|
+
/**
|
|
700
|
+
* schemas for the items
|
|
701
|
+
*/
|
|
702
|
+
items: editor.schema[];
|
|
703
|
+
/**
|
|
704
|
+
* default value
|
|
705
|
+
*/
|
|
706
|
+
default?: unknown[];
|
|
707
|
+
/**
|
|
708
|
+
* preference scope; global values are shared by every project on this computer, while project values are stored separately per project
|
|
709
|
+
*/
|
|
710
|
+
scope?: editor.prefs.SCOPE;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
namespace SCOPE {
|
|
715
|
+
/**
|
|
716
|
+
* `"global"`
|
|
717
|
+
*/
|
|
718
|
+
const GLOBAL: string & { readonly __brand: "editor.prefs.SCOPE.GLOBAL" };
|
|
719
|
+
/**
|
|
720
|
+
* `"project"`
|
|
721
|
+
*/
|
|
722
|
+
const PROJECT: string & { readonly __brand: "editor.prefs.SCOPE.PROJECT" };
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
namespace resource_attributes {
|
|
726
|
+
/**
|
|
727
|
+
* Project resource attributes
|
|
728
|
+
*/
|
|
729
|
+
interface result {
|
|
730
|
+
/**
|
|
731
|
+
* whether a resource identified by the path exists in the project
|
|
732
|
+
*/
|
|
733
|
+
exists: boolean;
|
|
734
|
+
/**
|
|
735
|
+
* whether the resource represents a file with some content
|
|
736
|
+
*/
|
|
737
|
+
is_file: boolean;
|
|
738
|
+
/**
|
|
739
|
+
* whether the resource represents a directory
|
|
740
|
+
*/
|
|
741
|
+
is_directory: boolean;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
namespace tx {
|
|
745
|
+
/**
|
|
746
|
+
* Create a transaction step that will add a child item to a node's list property when transacted with `editor.transact()`.
|
|
747
|
+
*
|
|
748
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
749
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
750
|
+
* @param value - Added item for the property, a table from property key to either a valid `editor.tx.set()`-able value, or an array of valid `editor.tx.add()`-able values
|
|
751
|
+
* @returns A transaction step
|
|
752
|
+
*/
|
|
753
|
+
function add(node: string | Opaque<"userdata">, property: string, value: LuaMap<string, unknown> | Record<string, unknown>): Opaque<"transaction_step">;
|
|
754
|
+
/**
|
|
755
|
+
* Create a transaction step that will remove all items from node's list property when transacted with `editor.transact()`.
|
|
756
|
+
*
|
|
757
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
758
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
759
|
+
* @returns A transaction step
|
|
760
|
+
*/
|
|
761
|
+
function clear(node: string | Opaque<"userdata">, property: string): Opaque<"transaction_step">;
|
|
762
|
+
/**
|
|
763
|
+
* Create a transaction step that will remove a child node from the node's list property when transacted with `editor.transact()`.
|
|
764
|
+
*
|
|
765
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
766
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
767
|
+
* @param child_node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
768
|
+
* @returns A transaction step
|
|
769
|
+
*/
|
|
770
|
+
function remove(node: string | Opaque<"userdata">, property: string, child_node: string | Opaque<"userdata">): Opaque<"transaction_step">;
|
|
771
|
+
/**
|
|
772
|
+
* Create a transaction step that reorders child nodes in a node list defined by the property if supported (see `editor.can_reorder()`)
|
|
773
|
+
*
|
|
774
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
775
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
776
|
+
* @param child_nodes - array of child nodes (the same as returned by `editor.get(node, property)`) in new order
|
|
777
|
+
* @returns A transaction step
|
|
778
|
+
*/
|
|
779
|
+
function reorder(node: string | Opaque<"userdata">, property: string, child_nodes: unknown[]): Opaque<"transaction_step">;
|
|
780
|
+
/**
|
|
781
|
+
* Create a transaction step that will reset an overridden property to its default value when transacted with `editor.transact()`.
|
|
782
|
+
*
|
|
783
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
784
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
785
|
+
* @returns A transaction step
|
|
786
|
+
*/
|
|
787
|
+
function reset(node: string | Opaque<"userdata">, property: string): Opaque<"transaction_step">;
|
|
788
|
+
/**
|
|
789
|
+
* Create transaction step that will set the node's property to a supplied value when transacted with `editor.transact()`.
|
|
790
|
+
*
|
|
791
|
+
* @param node - Either resource path (e.g. `"/main/game.script"`), or internal node id passed to the script by the editor
|
|
792
|
+
* @param property - Either `"path"`, `"text"`, or a property from the Outline view (hover the label to see its editor script name)
|
|
793
|
+
* @param value - A new value for the property
|
|
794
|
+
* @returns A transaction step
|
|
795
|
+
*/
|
|
796
|
+
function set(node: string | Opaque<"userdata">, property: string, value: unknown): Opaque<"transaction_step">;
|
|
797
|
+
}
|
|
798
|
+
namespace ui {
|
|
799
|
+
/**
|
|
800
|
+
* External file dialog filter
|
|
801
|
+
*/
|
|
802
|
+
interface external_file_filter {
|
|
803
|
+
/**
|
|
804
|
+
* text explaining the filter, either a literal string like `"Text files (*.txt)"` or a localization message
|
|
805
|
+
*/
|
|
806
|
+
description: string | Opaque<"message">;
|
|
807
|
+
/**
|
|
808
|
+
* file extension patterns, e.g. `"*.txt"`, `"*.*"`, or `"game.project"`
|
|
809
|
+
*/
|
|
810
|
+
extensions: string[];
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Issue associated with an input component
|
|
814
|
+
*/
|
|
815
|
+
interface issue {
|
|
816
|
+
/**
|
|
817
|
+
* issue severity
|
|
818
|
+
*/
|
|
819
|
+
severity: editor.ui.ISSUE_SEVERITY;
|
|
820
|
+
/**
|
|
821
|
+
* issue message shown in a tooltip, either a string or a localization message
|
|
822
|
+
*/
|
|
823
|
+
message: string | Opaque<"message">;
|
|
824
|
+
}
|
|
825
|
+
type ALIGNMENT = typeof editor.ui.ALIGNMENT.TOP_LEFT | typeof editor.ui.ALIGNMENT.TOP | typeof editor.ui.ALIGNMENT.TOP_RIGHT | typeof editor.ui.ALIGNMENT.LEFT | typeof editor.ui.ALIGNMENT.CENTER | typeof editor.ui.ALIGNMENT.RIGHT | typeof editor.ui.ALIGNMENT.BOTTOM_LEFT | typeof editor.ui.ALIGNMENT.BOTTOM | typeof editor.ui.ALIGNMENT.BOTTOM_RIGHT;
|
|
826
|
+
type COLOR = typeof editor.ui.COLOR.TEXT | typeof editor.ui.COLOR.HINT | typeof editor.ui.COLOR.OVERRIDE | typeof editor.ui.COLOR.WARNING | typeof editor.ui.COLOR.ERROR;
|
|
827
|
+
type HEADING_STYLE = typeof editor.ui.HEADING_STYLE.H1 | typeof editor.ui.HEADING_STYLE.H2 | typeof editor.ui.HEADING_STYLE.H3 | typeof editor.ui.HEADING_STYLE.H4 | typeof editor.ui.HEADING_STYLE.H5 | typeof editor.ui.HEADING_STYLE.H6 | typeof editor.ui.HEADING_STYLE.DIALOG | typeof editor.ui.HEADING_STYLE.FORM;
|
|
828
|
+
type ICON = typeof editor.ui.ICON.OPEN_RESOURCE | typeof editor.ui.ICON.PLUS | typeof editor.ui.ICON.MINUS | typeof editor.ui.ICON.CLEAR;
|
|
829
|
+
type ISSUE_SEVERITY = typeof editor.ui.ISSUE_SEVERITY.WARNING | typeof editor.ui.ISSUE_SEVERITY.ERROR;
|
|
830
|
+
type ORIENTATION = typeof editor.ui.ORIENTATION.VERTICAL | typeof editor.ui.ORIENTATION.HORIZONTAL;
|
|
831
|
+
type PADDING = typeof editor.ui.PADDING.NONE | typeof editor.ui.PADDING.SMALL | typeof editor.ui.PADDING.MEDIUM | typeof editor.ui.PADDING.LARGE;
|
|
832
|
+
type SPACING = typeof editor.ui.SPACING.NONE | typeof editor.ui.SPACING.SMALL | typeof editor.ui.SPACING.MEDIUM | typeof editor.ui.SPACING.LARGE;
|
|
833
|
+
type TEXT_ALIGNMENT = typeof editor.ui.TEXT_ALIGNMENT.LEFT | typeof editor.ui.TEXT_ALIGNMENT.CENTER | typeof editor.ui.TEXT_ALIGNMENT.RIGHT | typeof editor.ui.TEXT_ALIGNMENT.JUSTIFY;
|
|
834
|
+
/**
|
|
835
|
+
* Button with a label and/or an icon
|
|
836
|
+
*
|
|
837
|
+
* @param props - component properties
|
|
838
|
+
* @returns UI component
|
|
839
|
+
*/
|
|
840
|
+
function button(props: editor.ui.button.props): Opaque<"component">;
|
|
841
|
+
/**
|
|
842
|
+
* Check box with a label
|
|
843
|
+
*
|
|
844
|
+
* @param props - component properties
|
|
845
|
+
* @returns UI component
|
|
846
|
+
*/
|
|
847
|
+
function check_box(props: editor.ui.check_box.props): Opaque<"component">;
|
|
848
|
+
/**
|
|
849
|
+
* Convert a function to a UI component.
|
|
850
|
+
* The wrapped function may call any hooks functions (`editor.ui.use_*`), but on any function invocation, the hooks calls must be the same, and in the same order. This means that hooks should not be used inside loops and conditions or after a conditional return statement.
|
|
851
|
+
* The `grow`, `row_span`, and `column_span` props are supported automatically.
|
|
852
|
+
*
|
|
853
|
+
* @param fn - function, will receive a single table of props when called
|
|
854
|
+
* @returns decorated component function that may be invoked with a props table to create a component
|
|
855
|
+
*/
|
|
856
|
+
function component(fn: (props: unknown) => Opaque<"component">): (props: unknown) => Opaque<"component">;
|
|
857
|
+
/**
|
|
858
|
+
* Dialog component, a top-level window component that can't be used as a child of other components
|
|
859
|
+
*
|
|
860
|
+
* @param props - component properties
|
|
861
|
+
* @returns UI component
|
|
862
|
+
*/
|
|
863
|
+
function dialog(props: editor.ui.dialog.props): Opaque<"component">;
|
|
864
|
+
/**
|
|
865
|
+
* Dialog button shown in the footer of a dialog
|
|
866
|
+
*
|
|
867
|
+
* @param props - component properties
|
|
868
|
+
* @returns UI component
|
|
869
|
+
*/
|
|
870
|
+
function dialog_button(props: editor.ui.dialog_button.props): Opaque<"component">;
|
|
871
|
+
/**
|
|
872
|
+
* Input component for selecting files from the file system
|
|
873
|
+
*
|
|
874
|
+
* @param props - component properties
|
|
875
|
+
* @returns UI component
|
|
876
|
+
*/
|
|
877
|
+
function external_file_field(props: editor.ui.external_file_field.props): Opaque<"component">;
|
|
878
|
+
/**
|
|
879
|
+
* Layout container that places its children in a 2D grid
|
|
880
|
+
*
|
|
881
|
+
* @param props - component properties
|
|
882
|
+
* @returns UI component
|
|
883
|
+
*/
|
|
884
|
+
function grid(props: editor.ui.grid.props): Opaque<"component">;
|
|
885
|
+
/**
|
|
886
|
+
* A text heading
|
|
887
|
+
*
|
|
888
|
+
* @param props - component properties
|
|
889
|
+
* @returns UI component
|
|
890
|
+
*/
|
|
891
|
+
function heading(props: editor.ui.heading.props): Opaque<"component">;
|
|
892
|
+
/**
|
|
893
|
+
* Layout container that places its children in a horizontal row one after another
|
|
894
|
+
*
|
|
895
|
+
* @param props - component properties
|
|
896
|
+
* @returns UI component
|
|
897
|
+
*/
|
|
898
|
+
function horizontal(props: editor.ui.horizontal.props): Opaque<"component">;
|
|
899
|
+
/**
|
|
900
|
+
* An icon from a predefined set
|
|
901
|
+
*
|
|
902
|
+
* @param props - component properties
|
|
903
|
+
* @returns UI component
|
|
904
|
+
*/
|
|
905
|
+
function icon(props: editor.ui.icon.props): Opaque<"component">;
|
|
906
|
+
/**
|
|
907
|
+
* An image
|
|
908
|
+
*
|
|
909
|
+
* @param props - component properties
|
|
910
|
+
* @returns UI component
|
|
911
|
+
*/
|
|
912
|
+
function image(props: editor.ui.image.props): Opaque<"component">;
|
|
913
|
+
/**
|
|
914
|
+
* Integer input component based on a text field, reports changes on commit (`Enter` or focus loss)
|
|
915
|
+
*
|
|
916
|
+
* @param props - component properties
|
|
917
|
+
* @returns UI component
|
|
918
|
+
*/
|
|
919
|
+
function integer_field(props: editor.ui.integer_field.props): Opaque<"component">;
|
|
920
|
+
/**
|
|
921
|
+
* Label intended for use with input components
|
|
922
|
+
*
|
|
923
|
+
* @param props - component properties
|
|
924
|
+
* @returns UI component
|
|
925
|
+
*/
|
|
926
|
+
function label(props: editor.ui.label.props): Opaque<"component">;
|
|
927
|
+
/**
|
|
928
|
+
* Number input component based on a text field, reports changes on commit (`Enter` or focus loss)
|
|
929
|
+
*
|
|
930
|
+
* @param props - component properties
|
|
931
|
+
* @returns UI component
|
|
932
|
+
*/
|
|
933
|
+
function number_field(props: editor.ui.number_field.props): Opaque<"component">;
|
|
934
|
+
/**
|
|
935
|
+
* Open a resource using its primary or selected view, either in the editor or in a third-party app. Code and Text views accept a one-based cursor or range in `args`: `{line = 42}`, `{line = 42, column = 12}`, or `{from = {line = 42, column = 12}, to = {line = 43, column = 4}}`
|
|
936
|
+
*
|
|
937
|
+
* @param resource_path - Resource path (starting with `/`)
|
|
938
|
+
* @param view - View to open: `"code"`, `"text"`, `"scene"`, `"html"`, or `"form"`
|
|
939
|
+
* @param args - View-specific open arguments; requires `view`. Currently supported by Code and Text views. **⚠️ 1-based; passed to Defold unchanged.**
|
|
940
|
+
*/
|
|
941
|
+
function open_resource(resource_path: string, view?: string, args?: unknown): void;
|
|
942
|
+
/**
|
|
943
|
+
* A paragraph of text
|
|
944
|
+
*
|
|
945
|
+
* @param props - component properties
|
|
946
|
+
* @returns UI component
|
|
947
|
+
*/
|
|
948
|
+
function paragraph(props: editor.ui.paragraph.props): Opaque<"component">;
|
|
949
|
+
/**
|
|
950
|
+
* Input component for selecting project resources
|
|
951
|
+
*
|
|
952
|
+
* @param props - component properties
|
|
953
|
+
* @returns UI component
|
|
954
|
+
*/
|
|
955
|
+
function resource_field(props: editor.ui.resource_field.props): Opaque<"component">;
|
|
956
|
+
/**
|
|
957
|
+
* Layout container that optionally shows scroll bars if child contents overflow the assigned bounds
|
|
958
|
+
*
|
|
959
|
+
* @param props - component properties
|
|
960
|
+
* @returns UI component
|
|
961
|
+
*/
|
|
962
|
+
function scroll(props: editor.ui.scroll.props): Opaque<"component">;
|
|
963
|
+
/**
|
|
964
|
+
* Dropdown select box with an array of options
|
|
965
|
+
*
|
|
966
|
+
* @param props - component properties
|
|
967
|
+
* @returns UI component
|
|
968
|
+
*/
|
|
969
|
+
function select_box(props: editor.ui.select_box.props): Opaque<"component">;
|
|
970
|
+
/**
|
|
971
|
+
* Thin line for visual content separation, by default horizontal and aligned to center
|
|
972
|
+
*
|
|
973
|
+
* @param props - component properties
|
|
974
|
+
* @returns UI component
|
|
975
|
+
*/
|
|
976
|
+
function separator(props: editor.ui.separator.props): Opaque<"component">;
|
|
977
|
+
/**
|
|
978
|
+
* Show a dialog and await a result
|
|
979
|
+
*
|
|
980
|
+
* @param dialog - a component that resolves to `editor.ui.dialog(...)`
|
|
981
|
+
* @returns dialog result, the value used as a `result` prop in a `editor.ui.dialog_button({...})` selected by the user, or `nil` if the dialog was closed and there was no `cancel = true` dialog button with `result` prop set
|
|
982
|
+
*/
|
|
983
|
+
function show_dialog(dialog: Opaque<"component">): unknown;
|
|
984
|
+
/**
|
|
985
|
+
* Show a modal OS directory selection dialog and await a result
|
|
986
|
+
*
|
|
987
|
+
* @param opts - dialog options
|
|
988
|
+
* @returns either absolute directory path or nil if user canceled directory selection
|
|
989
|
+
*/
|
|
990
|
+
function show_external_directory_dialog(opts?: editor.ui.show_external_directory_dialog.options): string | undefined;
|
|
991
|
+
/**
|
|
992
|
+
* Show a modal OS file selection dialog and await a result
|
|
993
|
+
*
|
|
994
|
+
* @param opts - dialog options
|
|
995
|
+
* @returns either absolute file path or nil if user canceled file selection
|
|
996
|
+
*/
|
|
997
|
+
function show_external_file_dialog(opts?: editor.ui.show_external_file_dialog.options): string | undefined;
|
|
998
|
+
/**
|
|
999
|
+
* Show a modal resource selection dialog and await a result
|
|
1000
|
+
*
|
|
1001
|
+
* @param opts - dialog options
|
|
1002
|
+
* @returns if user made no selection, returns `nil`. Otherwise, if selection mode is `"single"`, returns selected resource path; otherwise returns a non-empty array of selected resource paths.
|
|
1003
|
+
*/
|
|
1004
|
+
function show_resource_dialog(opts?: editor.ui.show_resource_dialog.options): string | string[] | undefined;
|
|
1005
|
+
/**
|
|
1006
|
+
* String input component based on a text field, reports changes on commit (`Enter` or focus loss)
|
|
1007
|
+
*
|
|
1008
|
+
* @param props - component properties
|
|
1009
|
+
* @returns UI component
|
|
1010
|
+
*/
|
|
1011
|
+
function string_field(props: editor.ui.string_field.props): Opaque<"component">;
|
|
1012
|
+
/**
|
|
1013
|
+
* Tab used in the `tabs` prop of `editor.ui.tabs(...)`
|
|
1014
|
+
*
|
|
1015
|
+
* @param props - component properties
|
|
1016
|
+
* @returns UI component
|
|
1017
|
+
*/
|
|
1018
|
+
function tab(props: editor.ui.tab.props): Opaque<"component">;
|
|
1019
|
+
/**
|
|
1020
|
+
* Layout container that shows one selected tab content at a time
|
|
1021
|
+
*
|
|
1022
|
+
* @param props - component properties
|
|
1023
|
+
* @returns UI component
|
|
1024
|
+
*/
|
|
1025
|
+
function tabs(props: editor.ui.tabs.props): Opaque<"component">;
|
|
1026
|
+
/**
|
|
1027
|
+
* A hook that caches the result of a computation between re-renders.
|
|
1028
|
+
* See `editor.ui.component` for hooks caveats and rules. If any of the arguments to `use_memo` change during a component refresh (checked with `==`), the value will be recomputed.
|
|
1029
|
+
*
|
|
1030
|
+
* @param compute - function that will be used to compute the cached value
|
|
1031
|
+
* @param args - args to the computation function
|
|
1032
|
+
* @returns all returned values of the compute function
|
|
1033
|
+
* @example
|
|
1034
|
+
* ```ts
|
|
1035
|
+
* function increment(n: unknown): number {
|
|
1036
|
+
* return (n as number) + 1;
|
|
1037
|
+
* }
|
|
1038
|
+
*
|
|
1039
|
+
* function makeListener(setCount: unknown) {
|
|
1040
|
+
* return () => {
|
|
1041
|
+
* (setCount as (update: unknown) => unknown)(increment);
|
|
1042
|
+
* };
|
|
1043
|
+
* }
|
|
1044
|
+
*
|
|
1045
|
+
* const counterButton = editor.ui.component((props) => {
|
|
1046
|
+
* const [count, setCount] = editor.ui.use_state((props as { count: unknown }).count);
|
|
1047
|
+
* const onPressed = editor.ui.use_memo(makeListener, setCount) as () => void;
|
|
1048
|
+
* return editor.ui.button({
|
|
1049
|
+
* text: tostring(count),
|
|
1050
|
+
* on_pressed: onPressed,
|
|
1051
|
+
* });
|
|
1052
|
+
* });
|
|
1053
|
+
* ```
|
|
1054
|
+
*/
|
|
1055
|
+
function use_memo(compute: (...args: unknown[]) => unknown, ...args: unknown[]): unknown;
|
|
1056
|
+
/**
|
|
1057
|
+
* A hook that adds local state to the component.
|
|
1058
|
+
* See `editor.ui.component` for hooks caveats and rules. If any of the arguments to `use_state` change during a component refresh (checked with `==`), the current state will be reset to the initial one.
|
|
1059
|
+
*
|
|
1060
|
+
* @param init - local state initializer, either initial data structure or function that produces the data structure
|
|
1061
|
+
* @param args - used when `init` is a function, the args are passed to the initializer function
|
|
1062
|
+
* @example
|
|
1063
|
+
* ```ts
|
|
1064
|
+
* function increment(n: unknown): number {
|
|
1065
|
+
* return (n as number) + 1;
|
|
1066
|
+
* }
|
|
1067
|
+
*
|
|
1068
|
+
* const counterButton = editor.ui.component((props) => {
|
|
1069
|
+
* const [count, setCount] = editor.ui.use_state((props as { count: unknown }).count);
|
|
1070
|
+
* return editor.ui.button({
|
|
1071
|
+
* text: tostring(count),
|
|
1072
|
+
* on_pressed: () => {
|
|
1073
|
+
* setCount(increment);
|
|
1074
|
+
* },
|
|
1075
|
+
* });
|
|
1076
|
+
* });
|
|
1077
|
+
* ```
|
|
1078
|
+
*/
|
|
1079
|
+
function use_state(init: unknown, ...args: unknown[]): LuaMultiReturn<[unknown, (...args: unknown[]) => unknown]>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Layout container that places its children in a vertical column one after another
|
|
1082
|
+
*
|
|
1083
|
+
* @param props - component properties
|
|
1084
|
+
* @returns UI component
|
|
1085
|
+
*/
|
|
1086
|
+
function vertical(props: editor.ui.vertical.props): Opaque<"component">;
|
|
1087
|
+
namespace ALIGNMENT {
|
|
1088
|
+
/**
|
|
1089
|
+
* `"bottom"`
|
|
1090
|
+
*/
|
|
1091
|
+
const BOTTOM: string & { readonly __brand: "editor.ui.ALIGNMENT.BOTTOM" };
|
|
1092
|
+
/**
|
|
1093
|
+
* `"bottom-left"`
|
|
1094
|
+
*/
|
|
1095
|
+
const BOTTOM_LEFT: string & { readonly __brand: "editor.ui.ALIGNMENT.BOTTOM_LEFT" };
|
|
1096
|
+
/**
|
|
1097
|
+
* `"bottom-right"`
|
|
1098
|
+
*/
|
|
1099
|
+
const BOTTOM_RIGHT: string & { readonly __brand: "editor.ui.ALIGNMENT.BOTTOM_RIGHT" };
|
|
1100
|
+
/**
|
|
1101
|
+
* `"center"`
|
|
1102
|
+
*/
|
|
1103
|
+
const CENTER: string & { readonly __brand: "editor.ui.ALIGNMENT.CENTER" };
|
|
1104
|
+
/**
|
|
1105
|
+
* `"left"`
|
|
1106
|
+
*/
|
|
1107
|
+
const LEFT: string & { readonly __brand: "editor.ui.ALIGNMENT.LEFT" };
|
|
1108
|
+
/**
|
|
1109
|
+
* `"right"`
|
|
1110
|
+
*/
|
|
1111
|
+
const RIGHT: string & { readonly __brand: "editor.ui.ALIGNMENT.RIGHT" };
|
|
1112
|
+
/**
|
|
1113
|
+
* `"top"`
|
|
1114
|
+
*/
|
|
1115
|
+
const TOP: string & { readonly __brand: "editor.ui.ALIGNMENT.TOP" };
|
|
1116
|
+
/**
|
|
1117
|
+
* `"top-left"`
|
|
1118
|
+
*/
|
|
1119
|
+
const TOP_LEFT: string & { readonly __brand: "editor.ui.ALIGNMENT.TOP_LEFT" };
|
|
1120
|
+
/**
|
|
1121
|
+
* `"top-right"`
|
|
1122
|
+
*/
|
|
1123
|
+
const TOP_RIGHT: string & { readonly __brand: "editor.ui.ALIGNMENT.TOP_RIGHT" };
|
|
1124
|
+
}
|
|
1125
|
+
namespace button {
|
|
1126
|
+
/**
|
|
1127
|
+
* Properties for editor.ui.button
|
|
1128
|
+
*/
|
|
1129
|
+
interface props {
|
|
1130
|
+
/**
|
|
1131
|
+
* button press callback, will be invoked without arguments when the user presses the button
|
|
1132
|
+
*/
|
|
1133
|
+
on_pressed?: (...args: unknown[]) => unknown;
|
|
1134
|
+
/**
|
|
1135
|
+
* the text, either a string or a localization message
|
|
1136
|
+
*/
|
|
1137
|
+
text?: string | Opaque<"message">;
|
|
1138
|
+
/**
|
|
1139
|
+
* text alignment within paragraph bounds
|
|
1140
|
+
*/
|
|
1141
|
+
text_alignment?: editor.ui.TEXT_ALIGNMENT;
|
|
1142
|
+
/**
|
|
1143
|
+
* predefined icon name
|
|
1144
|
+
*/
|
|
1145
|
+
icon?: editor.ui.ICON;
|
|
1146
|
+
/**
|
|
1147
|
+
* determines if the input component can be interacted with
|
|
1148
|
+
*/
|
|
1149
|
+
enabled?: boolean;
|
|
1150
|
+
/**
|
|
1151
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1152
|
+
*/
|
|
1153
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1154
|
+
/**
|
|
1155
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1156
|
+
*/
|
|
1157
|
+
grow?: boolean;
|
|
1158
|
+
/**
|
|
1159
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1160
|
+
*/
|
|
1161
|
+
row_span?: number;
|
|
1162
|
+
/**
|
|
1163
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1164
|
+
*/
|
|
1165
|
+
column_span?: number;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
namespace check_box {
|
|
1169
|
+
/**
|
|
1170
|
+
* Properties for editor.ui.check_box
|
|
1171
|
+
*/
|
|
1172
|
+
interface props {
|
|
1173
|
+
/**
|
|
1174
|
+
* determines if the checkbox should appear checked
|
|
1175
|
+
*/
|
|
1176
|
+
value?: boolean;
|
|
1177
|
+
/**
|
|
1178
|
+
* change callback, will receive the new value
|
|
1179
|
+
*/
|
|
1180
|
+
on_value_changed?: (...args: unknown[]) => unknown;
|
|
1181
|
+
/**
|
|
1182
|
+
* determines if the checkbox should appear in the mixed state
|
|
1183
|
+
*/
|
|
1184
|
+
indeterminate?: boolean;
|
|
1185
|
+
/**
|
|
1186
|
+
* the text, either a string or a localization message
|
|
1187
|
+
*/
|
|
1188
|
+
text?: string | Opaque<"message">;
|
|
1189
|
+
/**
|
|
1190
|
+
* text alignment within paragraph bounds
|
|
1191
|
+
*/
|
|
1192
|
+
text_alignment?: editor.ui.TEXT_ALIGNMENT;
|
|
1193
|
+
/**
|
|
1194
|
+
* issue related to the input, or false if there is no issue
|
|
1195
|
+
*/
|
|
1196
|
+
issue?: editor.ui.issue | false;
|
|
1197
|
+
/**
|
|
1198
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
1199
|
+
*/
|
|
1200
|
+
tooltip?: string | Opaque<"message">;
|
|
1201
|
+
/**
|
|
1202
|
+
* determines if the input component can be interacted with
|
|
1203
|
+
*/
|
|
1204
|
+
enabled?: boolean;
|
|
1205
|
+
/**
|
|
1206
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1207
|
+
*/
|
|
1208
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1209
|
+
/**
|
|
1210
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1211
|
+
*/
|
|
1212
|
+
grow?: boolean;
|
|
1213
|
+
/**
|
|
1214
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1215
|
+
*/
|
|
1216
|
+
row_span?: number;
|
|
1217
|
+
/**
|
|
1218
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1219
|
+
*/
|
|
1220
|
+
column_span?: number;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
namespace COLOR {
|
|
1224
|
+
/**
|
|
1225
|
+
* `"error"`
|
|
1226
|
+
*/
|
|
1227
|
+
const ERROR: string & { readonly __brand: "editor.ui.COLOR.ERROR" };
|
|
1228
|
+
/**
|
|
1229
|
+
* `"hint"`
|
|
1230
|
+
*/
|
|
1231
|
+
const HINT: string & { readonly __brand: "editor.ui.COLOR.HINT" };
|
|
1232
|
+
/**
|
|
1233
|
+
* `"override"`
|
|
1234
|
+
*/
|
|
1235
|
+
const OVERRIDE: string & { readonly __brand: "editor.ui.COLOR.OVERRIDE" };
|
|
1236
|
+
/**
|
|
1237
|
+
* `"text"`
|
|
1238
|
+
*/
|
|
1239
|
+
const TEXT: string & { readonly __brand: "editor.ui.COLOR.TEXT" };
|
|
1240
|
+
/**
|
|
1241
|
+
* `"warning"`
|
|
1242
|
+
*/
|
|
1243
|
+
const WARNING: string & { readonly __brand: "editor.ui.COLOR.WARNING" };
|
|
1244
|
+
}
|
|
1245
|
+
namespace dialog {
|
|
1246
|
+
/**
|
|
1247
|
+
* Properties for editor.ui.dialog
|
|
1248
|
+
*/
|
|
1249
|
+
interface props {
|
|
1250
|
+
/**
|
|
1251
|
+
* OS dialog window title, either a string or a localization message
|
|
1252
|
+
*/
|
|
1253
|
+
title: string | Opaque<"message">;
|
|
1254
|
+
/**
|
|
1255
|
+
* top part of the dialog, defaults to `editor.ui.heading({text = props.title})`
|
|
1256
|
+
*/
|
|
1257
|
+
header?: Opaque<"component"> | false;
|
|
1258
|
+
/**
|
|
1259
|
+
* content of the dialog
|
|
1260
|
+
*/
|
|
1261
|
+
content?: Opaque<"component"> | false;
|
|
1262
|
+
/**
|
|
1263
|
+
* initial width of the dialog window in pixels
|
|
1264
|
+
*/
|
|
1265
|
+
width?: number;
|
|
1266
|
+
/**
|
|
1267
|
+
* initial height of the dialog window in pixels
|
|
1268
|
+
*/
|
|
1269
|
+
height?: number;
|
|
1270
|
+
/**
|
|
1271
|
+
* determines if the dialog window can be resized by the user
|
|
1272
|
+
*/
|
|
1273
|
+
resizable?: boolean;
|
|
1274
|
+
/**
|
|
1275
|
+
* array of `editor.ui.dialog_button(...)` components, footer of the dialog. Defaults to a single Close button
|
|
1276
|
+
*/
|
|
1277
|
+
buttons?: (Opaque<"component"> | false)[];
|
|
1278
|
+
/**
|
|
1279
|
+
* if set to `false`, the dialog window stays on top but does not block interaction with the editor
|
|
1280
|
+
*/
|
|
1281
|
+
modal?: boolean;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
namespace dialog_button {
|
|
1285
|
+
/**
|
|
1286
|
+
* Properties for editor.ui.dialog_button
|
|
1287
|
+
*/
|
|
1288
|
+
interface props {
|
|
1289
|
+
/**
|
|
1290
|
+
* button text, either a string or a localization message
|
|
1291
|
+
*/
|
|
1292
|
+
text: string | Opaque<"message">;
|
|
1293
|
+
/**
|
|
1294
|
+
* value returned by `editor.ui.show_dialog(...)` if this button is pressed
|
|
1295
|
+
*/
|
|
1296
|
+
result?: unknown;
|
|
1297
|
+
/**
|
|
1298
|
+
* if set, pressing `Enter` in the dialog will trigger this button
|
|
1299
|
+
*/
|
|
1300
|
+
default?: boolean;
|
|
1301
|
+
/**
|
|
1302
|
+
* if set, pressing `Escape` in the dialog will trigger this button
|
|
1303
|
+
*/
|
|
1304
|
+
cancel?: boolean;
|
|
1305
|
+
/**
|
|
1306
|
+
* determines if the button can be interacted with
|
|
1307
|
+
*/
|
|
1308
|
+
enabled?: boolean;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
namespace external_file_field {
|
|
1312
|
+
/**
|
|
1313
|
+
* Properties for editor.ui.external_file_field
|
|
1314
|
+
*/
|
|
1315
|
+
interface props {
|
|
1316
|
+
/**
|
|
1317
|
+
* file or directory path; resolved against project root if relative
|
|
1318
|
+
*/
|
|
1319
|
+
value?: string;
|
|
1320
|
+
/**
|
|
1321
|
+
* value change callback, will receive the absolute path of a selected file/folder or nil if the field was cleared; even though the selector dialog allows selecting only files, it's possible to receive directories and non-existent file system entries using text field input
|
|
1322
|
+
*/
|
|
1323
|
+
on_value_changed?: (...args: unknown[]) => unknown;
|
|
1324
|
+
/**
|
|
1325
|
+
* OS window title, either a string or a localization message
|
|
1326
|
+
*/
|
|
1327
|
+
title?: string | Opaque<"message">;
|
|
1328
|
+
/**
|
|
1329
|
+
* File filters
|
|
1330
|
+
*/
|
|
1331
|
+
filters?: editor.ui.external_file_filter[];
|
|
1332
|
+
/**
|
|
1333
|
+
* issue related to the input, or false if there is no issue
|
|
1334
|
+
*/
|
|
1335
|
+
issue?: editor.ui.issue | false;
|
|
1336
|
+
/**
|
|
1337
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
1338
|
+
*/
|
|
1339
|
+
tooltip?: string | Opaque<"message">;
|
|
1340
|
+
/**
|
|
1341
|
+
* determines if the input component can be interacted with
|
|
1342
|
+
*/
|
|
1343
|
+
enabled?: boolean;
|
|
1344
|
+
/**
|
|
1345
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1346
|
+
*/
|
|
1347
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1348
|
+
/**
|
|
1349
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1350
|
+
*/
|
|
1351
|
+
grow?: boolean;
|
|
1352
|
+
/**
|
|
1353
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1354
|
+
*/
|
|
1355
|
+
row_span?: number;
|
|
1356
|
+
/**
|
|
1357
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1358
|
+
*/
|
|
1359
|
+
column_span?: number;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
namespace grid {
|
|
1363
|
+
/**
|
|
1364
|
+
* Grid row or column constraint
|
|
1365
|
+
*/
|
|
1366
|
+
interface constraint {
|
|
1367
|
+
/**
|
|
1368
|
+
* whether the row or column should grow to fill available space
|
|
1369
|
+
*/
|
|
1370
|
+
grow?: boolean;
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Properties for editor.ui.grid
|
|
1374
|
+
*/
|
|
1375
|
+
interface props {
|
|
1376
|
+
/**
|
|
1377
|
+
* array of arrays of child components
|
|
1378
|
+
*/
|
|
1379
|
+
children?: ((Opaque<"component"> | false)[] | false)[];
|
|
1380
|
+
/**
|
|
1381
|
+
* separate configuration for each row
|
|
1382
|
+
*/
|
|
1383
|
+
rows?: (editor.ui.grid.constraint | false)[];
|
|
1384
|
+
/**
|
|
1385
|
+
* separate configuration for each column
|
|
1386
|
+
*/
|
|
1387
|
+
columns?: (editor.ui.grid.constraint | false)[];
|
|
1388
|
+
/**
|
|
1389
|
+
* empty space from the edges of the container to its children, either a predefined padding value or a non-negative number of pixels
|
|
1390
|
+
*/
|
|
1391
|
+
padding?: editor.ui.PADDING | number;
|
|
1392
|
+
/**
|
|
1393
|
+
* empty space between child components, either a predefined spacing value or a non-negative number of pixels; defaults to `editor.ui.SPACING.MEDIUM`
|
|
1394
|
+
*/
|
|
1395
|
+
spacing?: editor.ui.SPACING | number;
|
|
1396
|
+
/**
|
|
1397
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1398
|
+
*/
|
|
1399
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1400
|
+
/**
|
|
1401
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1402
|
+
*/
|
|
1403
|
+
grow?: boolean;
|
|
1404
|
+
/**
|
|
1405
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1406
|
+
*/
|
|
1407
|
+
row_span?: number;
|
|
1408
|
+
/**
|
|
1409
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1410
|
+
*/
|
|
1411
|
+
column_span?: number;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
namespace heading {
|
|
1415
|
+
/**
|
|
1416
|
+
* Properties for editor.ui.heading
|
|
1417
|
+
*/
|
|
1418
|
+
interface props {
|
|
1419
|
+
/**
|
|
1420
|
+
* the text, either a string or a localization message
|
|
1421
|
+
*/
|
|
1422
|
+
text?: string | Opaque<"message">;
|
|
1423
|
+
/**
|
|
1424
|
+
* text alignment within paragraph bounds
|
|
1425
|
+
*/
|
|
1426
|
+
text_alignment?: editor.ui.TEXT_ALIGNMENT;
|
|
1427
|
+
/**
|
|
1428
|
+
* semantic color, defaults to `editor.ui.COLOR.TEXT`
|
|
1429
|
+
*/
|
|
1430
|
+
color?: editor.ui.COLOR;
|
|
1431
|
+
/**
|
|
1432
|
+
* determines if the lines of text are word-wrapped when they don't fit in the assigned bounds, defaults to true
|
|
1433
|
+
*/
|
|
1434
|
+
word_wrap?: boolean;
|
|
1435
|
+
/**
|
|
1436
|
+
* heading style, defaults to `editor.ui.HEADING_STYLE.H3`
|
|
1437
|
+
*/
|
|
1438
|
+
style?: editor.ui.HEADING_STYLE;
|
|
1439
|
+
/**
|
|
1440
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1441
|
+
*/
|
|
1442
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1443
|
+
/**
|
|
1444
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1445
|
+
*/
|
|
1446
|
+
grow?: boolean;
|
|
1447
|
+
/**
|
|
1448
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1449
|
+
*/
|
|
1450
|
+
row_span?: number;
|
|
1451
|
+
/**
|
|
1452
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1453
|
+
*/
|
|
1454
|
+
column_span?: number;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
namespace HEADING_STYLE {
|
|
1458
|
+
/**
|
|
1459
|
+
* `"dialog"`
|
|
1460
|
+
*/
|
|
1461
|
+
const DIALOG: string & { readonly __brand: "editor.ui.HEADING_STYLE.DIALOG" };
|
|
1462
|
+
/**
|
|
1463
|
+
* `"form"`
|
|
1464
|
+
*/
|
|
1465
|
+
const FORM: string & { readonly __brand: "editor.ui.HEADING_STYLE.FORM" };
|
|
1466
|
+
/**
|
|
1467
|
+
* `"h1"`
|
|
1468
|
+
*/
|
|
1469
|
+
const H1: string & { readonly __brand: "editor.ui.HEADING_STYLE.H1" };
|
|
1470
|
+
/**
|
|
1471
|
+
* `"h2"`
|
|
1472
|
+
*/
|
|
1473
|
+
const H2: string & { readonly __brand: "editor.ui.HEADING_STYLE.H2" };
|
|
1474
|
+
/**
|
|
1475
|
+
* `"h3"`
|
|
1476
|
+
*/
|
|
1477
|
+
const H3: string & { readonly __brand: "editor.ui.HEADING_STYLE.H3" };
|
|
1478
|
+
/**
|
|
1479
|
+
* `"h4"`
|
|
1480
|
+
*/
|
|
1481
|
+
const H4: string & { readonly __brand: "editor.ui.HEADING_STYLE.H4" };
|
|
1482
|
+
/**
|
|
1483
|
+
* `"h5"`
|
|
1484
|
+
*/
|
|
1485
|
+
const H5: string & { readonly __brand: "editor.ui.HEADING_STYLE.H5" };
|
|
1486
|
+
/**
|
|
1487
|
+
* `"h6"`
|
|
1488
|
+
*/
|
|
1489
|
+
const H6: string & { readonly __brand: "editor.ui.HEADING_STYLE.H6" };
|
|
1490
|
+
}
|
|
1491
|
+
namespace horizontal {
|
|
1492
|
+
/**
|
|
1493
|
+
* Properties for editor.ui.horizontal
|
|
1494
|
+
*/
|
|
1495
|
+
interface props {
|
|
1496
|
+
/**
|
|
1497
|
+
* array of child components
|
|
1498
|
+
*/
|
|
1499
|
+
children?: (Opaque<"component"> | false)[];
|
|
1500
|
+
/**
|
|
1501
|
+
* empty space from the edges of the container to its children, either a predefined padding value or a non-negative number of pixels
|
|
1502
|
+
*/
|
|
1503
|
+
padding?: editor.ui.PADDING | number;
|
|
1504
|
+
/**
|
|
1505
|
+
* empty space between child components, either a predefined spacing value or a non-negative number of pixels; defaults to `editor.ui.SPACING.MEDIUM`
|
|
1506
|
+
*/
|
|
1507
|
+
spacing?: editor.ui.SPACING | number;
|
|
1508
|
+
/**
|
|
1509
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1510
|
+
*/
|
|
1511
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1512
|
+
/**
|
|
1513
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1514
|
+
*/
|
|
1515
|
+
grow?: boolean;
|
|
1516
|
+
/**
|
|
1517
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1518
|
+
*/
|
|
1519
|
+
row_span?: number;
|
|
1520
|
+
/**
|
|
1521
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1522
|
+
*/
|
|
1523
|
+
column_span?: number;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
namespace icon {
|
|
1527
|
+
/**
|
|
1528
|
+
* Properties for editor.ui.icon
|
|
1529
|
+
*/
|
|
1530
|
+
interface props {
|
|
1531
|
+
/**
|
|
1532
|
+
* predefined icon name
|
|
1533
|
+
*/
|
|
1534
|
+
icon: editor.ui.ICON;
|
|
1535
|
+
/**
|
|
1536
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1537
|
+
*/
|
|
1538
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1539
|
+
/**
|
|
1540
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1541
|
+
*/
|
|
1542
|
+
grow?: boolean;
|
|
1543
|
+
/**
|
|
1544
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1545
|
+
*/
|
|
1546
|
+
row_span?: number;
|
|
1547
|
+
/**
|
|
1548
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1549
|
+
*/
|
|
1550
|
+
column_span?: number;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
namespace ICON {
|
|
1554
|
+
/**
|
|
1555
|
+
* `"clear"`
|
|
1556
|
+
*/
|
|
1557
|
+
const CLEAR: string & { readonly __brand: "editor.ui.ICON.CLEAR" };
|
|
1558
|
+
/**
|
|
1559
|
+
* `"minus"`
|
|
1560
|
+
*/
|
|
1561
|
+
const MINUS: string & { readonly __brand: "editor.ui.ICON.MINUS" };
|
|
1562
|
+
/**
|
|
1563
|
+
* `"open-resource"`
|
|
1564
|
+
*/
|
|
1565
|
+
const OPEN_RESOURCE: string & { readonly __brand: "editor.ui.ICON.OPEN_RESOURCE" };
|
|
1566
|
+
/**
|
|
1567
|
+
* `"plus"`
|
|
1568
|
+
*/
|
|
1569
|
+
const PLUS: string & { readonly __brand: "editor.ui.ICON.PLUS" };
|
|
1570
|
+
}
|
|
1571
|
+
namespace image {
|
|
1572
|
+
/**
|
|
1573
|
+
* Properties for editor.ui.image
|
|
1574
|
+
*/
|
|
1575
|
+
interface props {
|
|
1576
|
+
/**
|
|
1577
|
+
* either a resource path (starts with `/`), or an URL
|
|
1578
|
+
*/
|
|
1579
|
+
image: string;
|
|
1580
|
+
/**
|
|
1581
|
+
* width of the image view, the image will be fit inside it while preserving its aspect ratio
|
|
1582
|
+
*/
|
|
1583
|
+
width?: number;
|
|
1584
|
+
/**
|
|
1585
|
+
* height of the image view, the image will be fit inside it while preserving its aspect ratio
|
|
1586
|
+
*/
|
|
1587
|
+
height?: number;
|
|
1588
|
+
/**
|
|
1589
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1590
|
+
*/
|
|
1591
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1592
|
+
/**
|
|
1593
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1594
|
+
*/
|
|
1595
|
+
grow?: boolean;
|
|
1596
|
+
/**
|
|
1597
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1598
|
+
*/
|
|
1599
|
+
row_span?: number;
|
|
1600
|
+
/**
|
|
1601
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1602
|
+
*/
|
|
1603
|
+
column_span?: number;
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
namespace integer_field {
|
|
1607
|
+
/**
|
|
1608
|
+
* Properties for editor.ui.integer_field
|
|
1609
|
+
*/
|
|
1610
|
+
interface props {
|
|
1611
|
+
/**
|
|
1612
|
+
* value
|
|
1613
|
+
*/
|
|
1614
|
+
value?: unknown;
|
|
1615
|
+
/**
|
|
1616
|
+
* value change callback, will receive the new value
|
|
1617
|
+
*/
|
|
1618
|
+
on_value_changed?: (...args: unknown[]) => unknown;
|
|
1619
|
+
/**
|
|
1620
|
+
* issue related to the input, or false if there is no issue
|
|
1621
|
+
*/
|
|
1622
|
+
issue?: editor.ui.issue | false;
|
|
1623
|
+
/**
|
|
1624
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
1625
|
+
*/
|
|
1626
|
+
tooltip?: string | Opaque<"message">;
|
|
1627
|
+
/**
|
|
1628
|
+
* determines if the input component can be interacted with
|
|
1629
|
+
*/
|
|
1630
|
+
enabled?: boolean;
|
|
1631
|
+
/**
|
|
1632
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1633
|
+
*/
|
|
1634
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1635
|
+
/**
|
|
1636
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1637
|
+
*/
|
|
1638
|
+
grow?: boolean;
|
|
1639
|
+
/**
|
|
1640
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1641
|
+
*/
|
|
1642
|
+
row_span?: number;
|
|
1643
|
+
/**
|
|
1644
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1645
|
+
*/
|
|
1646
|
+
column_span?: number;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
namespace ISSUE_SEVERITY {
|
|
1650
|
+
/**
|
|
1651
|
+
* `"error"`
|
|
1652
|
+
*/
|
|
1653
|
+
const ERROR: string & { readonly __brand: "editor.ui.ISSUE_SEVERITY.ERROR" };
|
|
1654
|
+
/**
|
|
1655
|
+
* `"warning"`
|
|
1656
|
+
*/
|
|
1657
|
+
const WARNING: string & { readonly __brand: "editor.ui.ISSUE_SEVERITY.WARNING" };
|
|
1658
|
+
}
|
|
1659
|
+
namespace label {
|
|
1660
|
+
/**
|
|
1661
|
+
* Properties for editor.ui.label
|
|
1662
|
+
*/
|
|
1663
|
+
interface props {
|
|
1664
|
+
/**
|
|
1665
|
+
* the text, either a string or a localization message
|
|
1666
|
+
*/
|
|
1667
|
+
text?: string | Opaque<"message">;
|
|
1668
|
+
/**
|
|
1669
|
+
* text alignment within paragraph bounds
|
|
1670
|
+
*/
|
|
1671
|
+
text_alignment?: editor.ui.TEXT_ALIGNMENT;
|
|
1672
|
+
/**
|
|
1673
|
+
* semantic color, defaults to `editor.ui.COLOR.TEXT`
|
|
1674
|
+
*/
|
|
1675
|
+
color?: editor.ui.COLOR;
|
|
1676
|
+
/**
|
|
1677
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
1678
|
+
*/
|
|
1679
|
+
tooltip?: string | Opaque<"message">;
|
|
1680
|
+
/**
|
|
1681
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1682
|
+
*/
|
|
1683
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1684
|
+
/**
|
|
1685
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1686
|
+
*/
|
|
1687
|
+
grow?: boolean;
|
|
1688
|
+
/**
|
|
1689
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1690
|
+
*/
|
|
1691
|
+
row_span?: number;
|
|
1692
|
+
/**
|
|
1693
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1694
|
+
*/
|
|
1695
|
+
column_span?: number;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
namespace number_field {
|
|
1699
|
+
/**
|
|
1700
|
+
* Properties for editor.ui.number_field
|
|
1701
|
+
*/
|
|
1702
|
+
interface props {
|
|
1703
|
+
/**
|
|
1704
|
+
* value
|
|
1705
|
+
*/
|
|
1706
|
+
value?: unknown;
|
|
1707
|
+
/**
|
|
1708
|
+
* value change callback, will receive the new value
|
|
1709
|
+
*/
|
|
1710
|
+
on_value_changed?: (...args: unknown[]) => unknown;
|
|
1711
|
+
/**
|
|
1712
|
+
* issue related to the input, or false if there is no issue
|
|
1713
|
+
*/
|
|
1714
|
+
issue?: editor.ui.issue | false;
|
|
1715
|
+
/**
|
|
1716
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
1717
|
+
*/
|
|
1718
|
+
tooltip?: string | Opaque<"message">;
|
|
1719
|
+
/**
|
|
1720
|
+
* determines if the input component can be interacted with
|
|
1721
|
+
*/
|
|
1722
|
+
enabled?: boolean;
|
|
1723
|
+
/**
|
|
1724
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1725
|
+
*/
|
|
1726
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1727
|
+
/**
|
|
1728
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1729
|
+
*/
|
|
1730
|
+
grow?: boolean;
|
|
1731
|
+
/**
|
|
1732
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1733
|
+
*/
|
|
1734
|
+
row_span?: number;
|
|
1735
|
+
/**
|
|
1736
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1737
|
+
*/
|
|
1738
|
+
column_span?: number;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
namespace ORIENTATION {
|
|
1742
|
+
/**
|
|
1743
|
+
* `"horizontal"`
|
|
1744
|
+
*/
|
|
1745
|
+
const HORIZONTAL: string & { readonly __brand: "editor.ui.ORIENTATION.HORIZONTAL" };
|
|
1746
|
+
/**
|
|
1747
|
+
* `"vertical"`
|
|
1748
|
+
*/
|
|
1749
|
+
const VERTICAL: string & { readonly __brand: "editor.ui.ORIENTATION.VERTICAL" };
|
|
1750
|
+
}
|
|
1751
|
+
namespace PADDING {
|
|
1752
|
+
/**
|
|
1753
|
+
* `"large"`
|
|
1754
|
+
*/
|
|
1755
|
+
const LARGE: string & { readonly __brand: "editor.ui.PADDING.LARGE" };
|
|
1756
|
+
/**
|
|
1757
|
+
* `"medium"`
|
|
1758
|
+
*/
|
|
1759
|
+
const MEDIUM: string & { readonly __brand: "editor.ui.PADDING.MEDIUM" };
|
|
1760
|
+
/**
|
|
1761
|
+
* `"none"`
|
|
1762
|
+
*/
|
|
1763
|
+
const NONE: string & { readonly __brand: "editor.ui.PADDING.NONE" };
|
|
1764
|
+
/**
|
|
1765
|
+
* `"small"`
|
|
1766
|
+
*/
|
|
1767
|
+
const SMALL: string & { readonly __brand: "editor.ui.PADDING.SMALL" };
|
|
1768
|
+
}
|
|
1769
|
+
namespace paragraph {
|
|
1770
|
+
/**
|
|
1771
|
+
* Properties for editor.ui.paragraph
|
|
1772
|
+
*/
|
|
1773
|
+
interface props {
|
|
1774
|
+
/**
|
|
1775
|
+
* the text, either a string or a localization message
|
|
1776
|
+
*/
|
|
1777
|
+
text?: string | Opaque<"message">;
|
|
1778
|
+
/**
|
|
1779
|
+
* text alignment within paragraph bounds
|
|
1780
|
+
*/
|
|
1781
|
+
text_alignment?: editor.ui.TEXT_ALIGNMENT;
|
|
1782
|
+
/**
|
|
1783
|
+
* semantic color, defaults to `editor.ui.COLOR.TEXT`
|
|
1784
|
+
*/
|
|
1785
|
+
color?: editor.ui.COLOR;
|
|
1786
|
+
/**
|
|
1787
|
+
* determines if the lines of text are word-wrapped when they don't fit in the assigned bounds, defaults to true
|
|
1788
|
+
*/
|
|
1789
|
+
word_wrap?: boolean;
|
|
1790
|
+
/**
|
|
1791
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1792
|
+
*/
|
|
1793
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1794
|
+
/**
|
|
1795
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1796
|
+
*/
|
|
1797
|
+
grow?: boolean;
|
|
1798
|
+
/**
|
|
1799
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1800
|
+
*/
|
|
1801
|
+
row_span?: number;
|
|
1802
|
+
/**
|
|
1803
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1804
|
+
*/
|
|
1805
|
+
column_span?: number;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
namespace resource_field {
|
|
1809
|
+
/**
|
|
1810
|
+
* Properties for editor.ui.resource_field
|
|
1811
|
+
*/
|
|
1812
|
+
interface props {
|
|
1813
|
+
/**
|
|
1814
|
+
* resource path (must start with `/`)
|
|
1815
|
+
*/
|
|
1816
|
+
value?: string;
|
|
1817
|
+
/**
|
|
1818
|
+
* value change callback, will receive either resource path of a selected resource or nil when the field is cleared; even though the resource selector dialog allows filtering on resource extensions, it's possible to receive resources with other extensions and non-existent resources using text field input
|
|
1819
|
+
*/
|
|
1820
|
+
on_value_changed?: (...args: unknown[]) => unknown;
|
|
1821
|
+
/**
|
|
1822
|
+
* dialog title, either a string or a localization message, defaults to `localization.message("dialog.select-resource.title")`
|
|
1823
|
+
*/
|
|
1824
|
+
title?: string | Opaque<"message">;
|
|
1825
|
+
/**
|
|
1826
|
+
* if specified, restricts selectable resources in the dialog to specified file extensions; e.g. `{"collection", "go"}`
|
|
1827
|
+
*/
|
|
1828
|
+
extensions?: string[];
|
|
1829
|
+
/**
|
|
1830
|
+
* issue related to the input, or false if there is no issue
|
|
1831
|
+
*/
|
|
1832
|
+
issue?: editor.ui.issue | false;
|
|
1833
|
+
/**
|
|
1834
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
1835
|
+
*/
|
|
1836
|
+
tooltip?: string | Opaque<"message">;
|
|
1837
|
+
/**
|
|
1838
|
+
* determines if the input component can be interacted with
|
|
1839
|
+
*/
|
|
1840
|
+
enabled?: boolean;
|
|
1841
|
+
/**
|
|
1842
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1843
|
+
*/
|
|
1844
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1845
|
+
/**
|
|
1846
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1847
|
+
*/
|
|
1848
|
+
grow?: boolean;
|
|
1849
|
+
/**
|
|
1850
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1851
|
+
*/
|
|
1852
|
+
row_span?: number;
|
|
1853
|
+
/**
|
|
1854
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1855
|
+
*/
|
|
1856
|
+
column_span?: number;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
namespace scroll {
|
|
1860
|
+
/**
|
|
1861
|
+
* Properties for editor.ui.scroll
|
|
1862
|
+
*/
|
|
1863
|
+
interface props {
|
|
1864
|
+
/**
|
|
1865
|
+
* content component
|
|
1866
|
+
*/
|
|
1867
|
+
content: Opaque<"component">;
|
|
1868
|
+
/**
|
|
1869
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1870
|
+
*/
|
|
1871
|
+
grow?: boolean;
|
|
1872
|
+
/**
|
|
1873
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1874
|
+
*/
|
|
1875
|
+
row_span?: number;
|
|
1876
|
+
/**
|
|
1877
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1878
|
+
*/
|
|
1879
|
+
column_span?: number;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
namespace select_box {
|
|
1883
|
+
/**
|
|
1884
|
+
* Properties for editor.ui.select_box
|
|
1885
|
+
*/
|
|
1886
|
+
interface props {
|
|
1887
|
+
/**
|
|
1888
|
+
* selected value
|
|
1889
|
+
*/
|
|
1890
|
+
value?: unknown;
|
|
1891
|
+
/**
|
|
1892
|
+
* change callback, will receive the selected value
|
|
1893
|
+
*/
|
|
1894
|
+
on_value_changed?: (...args: unknown[]) => unknown;
|
|
1895
|
+
/**
|
|
1896
|
+
* array of selectable options
|
|
1897
|
+
*/
|
|
1898
|
+
options?: unknown[];
|
|
1899
|
+
/**
|
|
1900
|
+
* function that converts an item to a string (or a localization message); defaults to `tostring`
|
|
1901
|
+
*/
|
|
1902
|
+
to_string?: (...args: unknown[]) => unknown;
|
|
1903
|
+
/**
|
|
1904
|
+
* issue related to the input, or false if there is no issue
|
|
1905
|
+
*/
|
|
1906
|
+
issue?: editor.ui.issue | false;
|
|
1907
|
+
/**
|
|
1908
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
1909
|
+
*/
|
|
1910
|
+
tooltip?: string | Opaque<"message">;
|
|
1911
|
+
/**
|
|
1912
|
+
* determines if the input component can be interacted with
|
|
1913
|
+
*/
|
|
1914
|
+
enabled?: boolean;
|
|
1915
|
+
/**
|
|
1916
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1917
|
+
*/
|
|
1918
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1919
|
+
/**
|
|
1920
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1921
|
+
*/
|
|
1922
|
+
grow?: boolean;
|
|
1923
|
+
/**
|
|
1924
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1925
|
+
*/
|
|
1926
|
+
row_span?: number;
|
|
1927
|
+
/**
|
|
1928
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1929
|
+
*/
|
|
1930
|
+
column_span?: number;
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
namespace separator {
|
|
1934
|
+
/**
|
|
1935
|
+
* Properties for editor.ui.separator
|
|
1936
|
+
*/
|
|
1937
|
+
interface props {
|
|
1938
|
+
/**
|
|
1939
|
+
* separator line orientation, `editor.ui.ORIENTATION.VERTICAL` or `editor.ui.ORIENTATION.HORIZONTAL`
|
|
1940
|
+
*/
|
|
1941
|
+
orientation?: editor.ui.ORIENTATION;
|
|
1942
|
+
/**
|
|
1943
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
1944
|
+
*/
|
|
1945
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
1946
|
+
/**
|
|
1947
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
1948
|
+
*/
|
|
1949
|
+
grow?: boolean;
|
|
1950
|
+
/**
|
|
1951
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1952
|
+
*/
|
|
1953
|
+
row_span?: number;
|
|
1954
|
+
/**
|
|
1955
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
1956
|
+
*/
|
|
1957
|
+
column_span?: number;
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
namespace show_external_directory_dialog {
|
|
1961
|
+
/**
|
|
1962
|
+
* Options for editor.ui.show_external_directory_dialog
|
|
1963
|
+
*/
|
|
1964
|
+
interface options {
|
|
1965
|
+
/**
|
|
1966
|
+
* initial file or directory path; resolved against project root if relative
|
|
1967
|
+
*/
|
|
1968
|
+
path?: string;
|
|
1969
|
+
/**
|
|
1970
|
+
* OS window title, either a string or a localization message
|
|
1971
|
+
*/
|
|
1972
|
+
title?: string | Opaque<"message">;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
namespace show_external_file_dialog {
|
|
1976
|
+
/**
|
|
1977
|
+
* Options for editor.ui.show_external_file_dialog
|
|
1978
|
+
*/
|
|
1979
|
+
interface options {
|
|
1980
|
+
/**
|
|
1981
|
+
* initial file or directory path; resolved against project root if relative
|
|
1982
|
+
*/
|
|
1983
|
+
path?: string;
|
|
1984
|
+
/**
|
|
1985
|
+
* OS window title, either a string or a localization message
|
|
1986
|
+
*/
|
|
1987
|
+
title?: string | Opaque<"message">;
|
|
1988
|
+
/**
|
|
1989
|
+
* File filters
|
|
1990
|
+
*/
|
|
1991
|
+
filters?: editor.ui.external_file_filter[];
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
namespace show_resource_dialog {
|
|
1995
|
+
/**
|
|
1996
|
+
* Options for editor.ui.show_resource_dialog
|
|
1997
|
+
*/
|
|
1998
|
+
interface options {
|
|
1999
|
+
/**
|
|
2000
|
+
* if specified, restricts selectable resources in the dialog to specified file extensions; e.g. `{"collection", "go"}`
|
|
2001
|
+
*/
|
|
2002
|
+
extensions?: string[];
|
|
2003
|
+
/**
|
|
2004
|
+
* selection mode, defaults to `"single"`
|
|
2005
|
+
*/
|
|
2006
|
+
selection?: "single" | "multiple";
|
|
2007
|
+
/**
|
|
2008
|
+
* dialog title, either a string or a localization message, defaults to `localization.message("dialog.select-resource.title")`
|
|
2009
|
+
*/
|
|
2010
|
+
title?: string | Opaque<"message">;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
namespace SPACING {
|
|
2014
|
+
/**
|
|
2015
|
+
* `"large"`
|
|
2016
|
+
*/
|
|
2017
|
+
const LARGE: string & { readonly __brand: "editor.ui.SPACING.LARGE" };
|
|
2018
|
+
/**
|
|
2019
|
+
* `"medium"`
|
|
2020
|
+
*/
|
|
2021
|
+
const MEDIUM: string & { readonly __brand: "editor.ui.SPACING.MEDIUM" };
|
|
2022
|
+
/**
|
|
2023
|
+
* `"none"`
|
|
2024
|
+
*/
|
|
2025
|
+
const NONE: string & { readonly __brand: "editor.ui.SPACING.NONE" };
|
|
2026
|
+
/**
|
|
2027
|
+
* `"small"`
|
|
2028
|
+
*/
|
|
2029
|
+
const SMALL: string & { readonly __brand: "editor.ui.SPACING.SMALL" };
|
|
2030
|
+
}
|
|
2031
|
+
namespace string_field {
|
|
2032
|
+
/**
|
|
2033
|
+
* Properties for editor.ui.string_field
|
|
2034
|
+
*/
|
|
2035
|
+
interface props {
|
|
2036
|
+
/**
|
|
2037
|
+
* value
|
|
2038
|
+
*/
|
|
2039
|
+
value?: unknown;
|
|
2040
|
+
/**
|
|
2041
|
+
* value change callback, will receive the new value
|
|
2042
|
+
*/
|
|
2043
|
+
on_value_changed?: (...args: unknown[]) => unknown;
|
|
2044
|
+
/**
|
|
2045
|
+
* issue related to the input, or false if there is no issue
|
|
2046
|
+
*/
|
|
2047
|
+
issue?: editor.ui.issue | false;
|
|
2048
|
+
/**
|
|
2049
|
+
* tooltip message shown on hover; either a string or a localization message
|
|
2050
|
+
*/
|
|
2051
|
+
tooltip?: string | Opaque<"message">;
|
|
2052
|
+
/**
|
|
2053
|
+
* determines if the input component can be interacted with
|
|
2054
|
+
*/
|
|
2055
|
+
enabled?: boolean;
|
|
2056
|
+
/**
|
|
2057
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
2058
|
+
*/
|
|
2059
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
2060
|
+
/**
|
|
2061
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
2062
|
+
*/
|
|
2063
|
+
grow?: boolean;
|
|
2064
|
+
/**
|
|
2065
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
2066
|
+
*/
|
|
2067
|
+
row_span?: number;
|
|
2068
|
+
/**
|
|
2069
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
2070
|
+
*/
|
|
2071
|
+
column_span?: number;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
namespace tab {
|
|
2075
|
+
/**
|
|
2076
|
+
* Properties for editor.ui.tab
|
|
2077
|
+
*/
|
|
2078
|
+
interface props {
|
|
2079
|
+
/**
|
|
2080
|
+
* tab header text, either a string or a localization message
|
|
2081
|
+
*/
|
|
2082
|
+
text: string | Opaque<"message">;
|
|
2083
|
+
/**
|
|
2084
|
+
* tab content component
|
|
2085
|
+
*/
|
|
2086
|
+
content?: Opaque<"component">;
|
|
2087
|
+
/**
|
|
2088
|
+
* tab header icon component
|
|
2089
|
+
*/
|
|
2090
|
+
icon?: Opaque<"component">;
|
|
2091
|
+
/**
|
|
2092
|
+
* determines if the tab can be selected
|
|
2093
|
+
*/
|
|
2094
|
+
enabled?: boolean;
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
namespace tabs {
|
|
2098
|
+
/**
|
|
2099
|
+
* Properties for editor.ui.tabs
|
|
2100
|
+
*/
|
|
2101
|
+
interface props {
|
|
2102
|
+
/**
|
|
2103
|
+
* array of `editor.ui.tab(...)` components
|
|
2104
|
+
*/
|
|
2105
|
+
tabs?: (Opaque<"component"> | false)[];
|
|
2106
|
+
/**
|
|
2107
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
2108
|
+
*/
|
|
2109
|
+
grow?: boolean;
|
|
2110
|
+
/**
|
|
2111
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
2112
|
+
*/
|
|
2113
|
+
row_span?: number;
|
|
2114
|
+
/**
|
|
2115
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
2116
|
+
*/
|
|
2117
|
+
column_span?: number;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
namespace TEXT_ALIGNMENT {
|
|
2121
|
+
/**
|
|
2122
|
+
* `"center"`
|
|
2123
|
+
*/
|
|
2124
|
+
const CENTER: string & { readonly __brand: "editor.ui.TEXT_ALIGNMENT.CENTER" };
|
|
2125
|
+
/**
|
|
2126
|
+
* `"justify"`
|
|
2127
|
+
*/
|
|
2128
|
+
const JUSTIFY: string & { readonly __brand: "editor.ui.TEXT_ALIGNMENT.JUSTIFY" };
|
|
2129
|
+
/**
|
|
2130
|
+
* `"left"`
|
|
2131
|
+
*/
|
|
2132
|
+
const LEFT: string & { readonly __brand: "editor.ui.TEXT_ALIGNMENT.LEFT" };
|
|
2133
|
+
/**
|
|
2134
|
+
* `"right"`
|
|
2135
|
+
*/
|
|
2136
|
+
const RIGHT: string & { readonly __brand: "editor.ui.TEXT_ALIGNMENT.RIGHT" };
|
|
2137
|
+
}
|
|
2138
|
+
namespace vertical {
|
|
2139
|
+
/**
|
|
2140
|
+
* Properties for editor.ui.vertical
|
|
2141
|
+
*/
|
|
2142
|
+
interface props {
|
|
2143
|
+
/**
|
|
2144
|
+
* array of child components
|
|
2145
|
+
*/
|
|
2146
|
+
children?: (Opaque<"component"> | false)[];
|
|
2147
|
+
/**
|
|
2148
|
+
* empty space from the edges of the container to its children, either a predefined padding value or a non-negative number of pixels
|
|
2149
|
+
*/
|
|
2150
|
+
padding?: editor.ui.PADDING | number;
|
|
2151
|
+
/**
|
|
2152
|
+
* empty space between child components, either a predefined spacing value or a non-negative number of pixels; defaults to `editor.ui.SPACING.MEDIUM`
|
|
2153
|
+
*/
|
|
2154
|
+
spacing?: editor.ui.SPACING | number;
|
|
2155
|
+
/**
|
|
2156
|
+
* alignment of the component content within its assigned bounds, defaults to `editor.ui.ALIGNMENT.TOP_LEFT`
|
|
2157
|
+
*/
|
|
2158
|
+
alignment?: editor.ui.ALIGNMENT;
|
|
2159
|
+
/**
|
|
2160
|
+
* determines if the component should grow to fill available space in a `horizontal` or `vertical` layout container
|
|
2161
|
+
*/
|
|
2162
|
+
grow?: boolean;
|
|
2163
|
+
/**
|
|
2164
|
+
* how many rows the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
2165
|
+
*/
|
|
2166
|
+
row_span?: number;
|
|
2167
|
+
/**
|
|
2168
|
+
* how many columns the component spans inside a grid container, must be positive. This prop is only useful for components inside a `grid` container.
|
|
2169
|
+
*/
|
|
2170
|
+
column_span?: number;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
export {};
|