@defold-typescript/types 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/api-signatures.json +44 -44
  2. package/api-targets.json +57 -0
  3. package/generated/editor-vm/http.d.ts +56 -0
  4. package/generated/editor-vm/json.d.ts +10 -0
  5. package/generated/editor-vm/localization.d.ts +42 -0
  6. package/generated/editor-vm/tilemap_tiles.d.ts +80 -0
  7. package/generated/editor-vm/zip.d.ts +10 -0
  8. package/generated/editor-vm/zlib.d.ts +24 -0
  9. package/generated/editor.d.ts +1092 -0
  10. package/generated/go.d.ts +22 -22
  11. package/generated/kinds/editor-script.d.ts +13 -0
  12. package/generated/kinds/gui-script.d.ts +1 -0
  13. package/generated/kinds/render-script.d.ts +1 -0
  14. package/generated/kinds/script.d.ts +1 -0
  15. package/generated/versions/defold-1.12.4/go.d.ts +22 -22
  16. package/index.d.ts +6 -0
  17. package/package.json +9 -1
  18. package/scripts/materialize-version.ts +54 -13
  19. package/scripts/regen.ts +425 -42
  20. package/scripts/signature-store-fs.ts +2 -0
  21. package/scripts/sync-api-docs.ts +82 -6
  22. package/src/api-doc.ts +58 -0
  23. package/src/core-types.ts +18 -1
  24. package/src/doc-comment.ts +21 -3
  25. package/src/editor-overloads.d.ts +33 -0
  26. package/src/editor-vm-globals.d.ts +200 -0
  27. package/src/editor-vm-types.ts +44 -0
  28. package/src/editor.ts +117 -16
  29. package/src/emit-dts.ts +292 -79
  30. package/src/engine-globals.d.ts +2 -2
  31. package/src/go-overloads.d.ts +6 -6
  32. package/src/index.ts +12 -0
  33. package/src/library-signature.ts +11 -3
  34. package/src/msg-overloads.d.ts +3 -3
  35. package/src/scene-addresses.d.ts +62 -0
  36. package/src/script-api.ts +12 -2
  37. package/src/url-parameters.ts +174 -0
  38. package/url-parameters.json +285 -0
package/generated/go.d.ts CHANGED
@@ -259,7 +259,7 @@ declare global {
259
259
  * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
260
260
  * ```
261
261
  */
262
- export function animate(url: string | Hash | Url, property: string | Hash, playback: number & { readonly __brand: "go.PLAYBACK_ONCE_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_PINGPONG" } | number & { readonly __brand: "go.PLAYBACK_LOOP_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_PINGPONG" }, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | number & { readonly __brand: "go.EASING_INBACK" } | number & { readonly __brand: "go.EASING_INBOUNCE" } | number & { readonly __brand: "go.EASING_INCIRC" } | number & { readonly __brand: "go.EASING_INCUBIC" } | number & { readonly __brand: "go.EASING_INELASTIC" } | number & { readonly __brand: "go.EASING_INEXPO" } | number & { readonly __brand: "go.EASING_INOUTBACK" } | number & { readonly __brand: "go.EASING_INOUTBOUNCE" } | number & { readonly __brand: "go.EASING_INOUTCIRC" } | number & { readonly __brand: "go.EASING_INOUTCUBIC" } | number & { readonly __brand: "go.EASING_INOUTELASTIC" } | number & { readonly __brand: "go.EASING_INOUTEXPO" } | number & { readonly __brand: "go.EASING_INOUTQUAD" } | number & { readonly __brand: "go.EASING_INOUTQUART" } | number & { readonly __brand: "go.EASING_INOUTQUINT" } | number & { readonly __brand: "go.EASING_INOUTSINE" } | number & { readonly __brand: "go.EASING_INQUAD" } | number & { readonly __brand: "go.EASING_INQUART" } | number & { readonly __brand: "go.EASING_INQUINT" } | number & { readonly __brand: "go.EASING_INSINE" } | number & { readonly __brand: "go.EASING_LINEAR" } | number & { readonly __brand: "go.EASING_OUTBACK" } | number & { readonly __brand: "go.EASING_OUTBOUNCE" } | number & { readonly __brand: "go.EASING_OUTCIRC" } | number & { readonly __brand: "go.EASING_OUTCUBIC" } | number & { readonly __brand: "go.EASING_OUTELASTIC" } | number & { readonly __brand: "go.EASING_OUTEXPO" } | number & { readonly __brand: "go.EASING_OUTINBACK" } | number & { readonly __brand: "go.EASING_OUTINBOUNCE" } | number & { readonly __brand: "go.EASING_OUTINCIRC" } | number & { readonly __brand: "go.EASING_OUTINCUBIC" } | number & { readonly __brand: "go.EASING_OUTINELASTIC" } | number & { readonly __brand: "go.EASING_OUTINEXPO" } | number & { readonly __brand: "go.EASING_OUTINQUAD" } | number & { readonly __brand: "go.EASING_OUTINQUART" } | number & { readonly __brand: "go.EASING_OUTINQUINT" } | number & { readonly __brand: "go.EASING_OUTINSINE" } | number & { readonly __brand: "go.EASING_OUTQUAD" } | number & { readonly __brand: "go.EASING_OUTQUART" } | number & { readonly __brand: "go.EASING_OUTQUINT" } | number & { readonly __brand: "go.EASING_OUTSINE" }, duration: number, delay?: number, complete_function?: (self: unknown, url: unknown, property: unknown) => void): void;
262
+ export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback: number & { readonly __brand: "go.PLAYBACK_ONCE_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_PINGPONG" } | number & { readonly __brand: "go.PLAYBACK_LOOP_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_PINGPONG" }, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | number & { readonly __brand: "go.EASING_INBACK" } | number & { readonly __brand: "go.EASING_INBOUNCE" } | number & { readonly __brand: "go.EASING_INCIRC" } | number & { readonly __brand: "go.EASING_INCUBIC" } | number & { readonly __brand: "go.EASING_INELASTIC" } | number & { readonly __brand: "go.EASING_INEXPO" } | number & { readonly __brand: "go.EASING_INOUTBACK" } | number & { readonly __brand: "go.EASING_INOUTBOUNCE" } | number & { readonly __brand: "go.EASING_INOUTCIRC" } | number & { readonly __brand: "go.EASING_INOUTCUBIC" } | number & { readonly __brand: "go.EASING_INOUTELASTIC" } | number & { readonly __brand: "go.EASING_INOUTEXPO" } | number & { readonly __brand: "go.EASING_INOUTQUAD" } | number & { readonly __brand: "go.EASING_INOUTQUART" } | number & { readonly __brand: "go.EASING_INOUTQUINT" } | number & { readonly __brand: "go.EASING_INOUTSINE" } | number & { readonly __brand: "go.EASING_INQUAD" } | number & { readonly __brand: "go.EASING_INQUART" } | number & { readonly __brand: "go.EASING_INQUINT" } | number & { readonly __brand: "go.EASING_INSINE" } | number & { readonly __brand: "go.EASING_LINEAR" } | number & { readonly __brand: "go.EASING_OUTBACK" } | number & { readonly __brand: "go.EASING_OUTBOUNCE" } | number & { readonly __brand: "go.EASING_OUTCIRC" } | number & { readonly __brand: "go.EASING_OUTCUBIC" } | number & { readonly __brand: "go.EASING_OUTELASTIC" } | number & { readonly __brand: "go.EASING_OUTEXPO" } | number & { readonly __brand: "go.EASING_OUTINBACK" } | number & { readonly __brand: "go.EASING_OUTINBOUNCE" } | number & { readonly __brand: "go.EASING_OUTINCIRC" } | number & { readonly __brand: "go.EASING_OUTINCUBIC" } | number & { readonly __brand: "go.EASING_OUTINELASTIC" } | number & { readonly __brand: "go.EASING_OUTINEXPO" } | number & { readonly __brand: "go.EASING_OUTINQUAD" } | number & { readonly __brand: "go.EASING_OUTINQUART" } | number & { readonly __brand: "go.EASING_OUTINQUINT" } | number & { readonly __brand: "go.EASING_OUTINSINE" } | number & { readonly __brand: "go.EASING_OUTQUAD" } | number & { readonly __brand: "go.EASING_OUTQUART" } | number & { readonly __brand: "go.EASING_OUTQUINT" } | number & { readonly __brand: "go.EASING_OUTSINE" }, duration: number, delay?: number, complete_function?: (self: unknown, url: unknown, property: unknown) => void): void;
263
263
  /**
264
264
  * By calling this function, all or specified stored property animations of the game object or component will be canceled.
265
265
  * See the properties guide for which properties can be animated and the animation guide for how to animate them.
@@ -278,7 +278,7 @@ declare global {
278
278
  * go.cancel_animations("#sprite");
279
279
  * ```
280
280
  */
281
- export function cancel_animations(url: string | Hash | Url, property?: string | Hash): void;
281
+ export function cancel_animations(url: SceneAddress | Hash | Url, property?: string | Hash): void;
282
282
  /**
283
283
  * Delete one or more game objects identified by id. Deletion is asynchronous meaning that
284
284
  * the game object(s) are scheduled for deletion which will happen at the end of the current
@@ -313,7 +313,7 @@ declare global {
313
313
  * go.delete(ids2, true);
314
314
  * ```
315
315
  */
316
- function _delete(id?: string | Hash | Url | (string | Hash | Url)[], recursive?: boolean): void;
316
+ function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[], recursive?: boolean): void;
317
317
  /**
318
318
  * This function can check for game objects in any collection by specifying
319
319
  * the collection name in the URL.
@@ -329,7 +329,7 @@ declare global {
329
329
  * go.exists("other_collection:/my_game_object");
330
330
  * ```
331
331
  */
332
- export function exists(url: string | Hash | Url): boolean;
332
+ export function exists(url: SceneGameObjectAddress | Hash | Url): boolean;
333
333
  /**
334
334
  * This is a callback-function, which is called by the engine when a script component is finalized (destroyed). It can
335
335
  * be used to e.g. take some last action, report the finalization to other game object instances, delete spawned objects
@@ -396,7 +396,7 @@ declare global {
396
396
  * const parent_id2 = go.get_parent("x");
397
397
  * ```
398
398
  */
399
- export function get_parent(id?: string | Hash | Url): Hash | undefined;
399
+ export function get_parent(id?: SceneGameObjectAddress | Hash | Url): Hash | undefined;
400
400
  /**
401
401
  * The position is relative the parent (if any). Use go.get_world_position to retrieve the global world position.
402
402
  *
@@ -411,7 +411,7 @@ declare global {
411
411
  * const pos = go.get_position("my_gameobject");
412
412
  * ```
413
413
  */
414
- export function get_position(id?: string | Hash | Url): Vector3;
414
+ export function get_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
415
415
  /**
416
416
  * The rotation is relative to the parent (if any). Use go.get_world_rotation to retrieve the global world rotation.
417
417
  *
@@ -426,7 +426,7 @@ declare global {
426
426
  * const r2 = go.get_rotation("x");
427
427
  * ```
428
428
  */
429
- export function get_rotation(id?: string | Hash | Url): Quaternion;
429
+ export function get_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
430
430
  /**
431
431
  * The scale is relative the parent (if any). Use go.get_world_scale to retrieve the global world 3D scale factor.
432
432
  *
@@ -441,7 +441,7 @@ declare global {
441
441
  * const s2 = go.get_scale("x");
442
442
  * ```
443
443
  */
444
- export function get_scale(id?: string | Hash | Url): Vector3;
444
+ export function get_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
445
445
  /**
446
446
  * The uniform scale is relative the parent (if any). If the underlying scale vector is non-uniform the min element of the vector is returned as the uniform scale factor.
447
447
  *
@@ -456,7 +456,7 @@ declare global {
456
456
  * const s2 = go.get_scale_uniform("x");
457
457
  * ```
458
458
  */
459
- export function get_scale_uniform(id?: string | Hash | Url): number;
459
+ export function get_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
460
460
  /**
461
461
  * The function will return the world position calculated at the end of the previous frame.
462
462
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -473,7 +473,7 @@ declare global {
473
473
  * const p2 = go.get_world_position("x");
474
474
  * ```
475
475
  */
476
- export function get_world_position(id?: string | Hash | Url): Vector3;
476
+ export function get_world_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
477
477
  /**
478
478
  * The function will return the world rotation calculated at the end of the previous frame.
479
479
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -490,7 +490,7 @@ declare global {
490
490
  * const r2 = go.get_world_rotation("x");
491
491
  * ```
492
492
  */
493
- export function get_world_rotation(id?: string | Hash | Url): Quaternion;
493
+ export function get_world_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
494
494
  /**
495
495
  * The function will return the world 3D scale factor calculated at the end of the previous frame.
496
496
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -509,7 +509,7 @@ declare global {
509
509
  * const s2 = go.get_world_scale("x");
510
510
  * ```
511
511
  */
512
- export function get_world_scale(id?: string | Hash | Url): Vector3;
512
+ export function get_world_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
513
513
  /**
514
514
  * The function will return the world scale factor calculated at the end of the previous frame.
515
515
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -526,7 +526,7 @@ declare global {
526
526
  * const s2 = go.get_world_scale_uniform("x");
527
527
  * ```
528
528
  */
529
- export function get_world_scale_uniform(id?: string | Hash | Url): number;
529
+ export function get_world_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
530
530
  /**
531
531
  * The function will return the world transform matrix calculated at the end of the previous frame.
532
532
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -542,7 +542,7 @@ declare global {
542
542
  * const m2 = go.get_world_transform("x");
543
543
  * ```
544
544
  */
545
- export function get_world_transform(id?: string | Hash | Url): Matrix4;
545
+ export function get_world_transform(id?: SceneGameObjectAddress | Hash | Url): Matrix4;
546
546
  /**
547
547
  * This is a callback-function, which is called by the engine when a script component is initialized. It can be used
548
548
  * to set the initial state of the script.
@@ -879,7 +879,7 @@ declare global {
879
879
  * go.set_parent(go.get_id("my_instance"));
880
880
  * ```
881
881
  */
882
- export function set_parent(id?: string | Hash | Url, parent_id?: string | Hash | Url, keep_world_transform?: boolean): void;
882
+ export function set_parent(id?: SceneGameObjectAddress | Hash | Url, parent_id?: SceneGameObjectAddress | Hash | Url, keep_world_transform?: boolean): void;
883
883
  /**
884
884
  * The position is relative to the parent (if any). The global world position cannot be manually set.
885
885
  *
@@ -897,7 +897,7 @@ declare global {
897
897
  * go.set_position(p, "x");
898
898
  * ```
899
899
  */
900
- export function set_position(position: Vector3, id?: string | Hash | Url): void;
900
+ export function set_position(position: Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
901
901
  /**
902
902
  * The rotation is relative to the parent (if any). The global world rotation cannot be manually set.
903
903
  *
@@ -915,7 +915,7 @@ declare global {
915
915
  * go.set_rotation(r, "x");
916
916
  * ```
917
917
  */
918
- export function set_rotation(rotation: Quaternion, id?: string | Hash | Url): void;
918
+ export function set_rotation(rotation: Quaternion, id?: SceneGameObjectAddress | Hash | Url): void;
919
919
  /**
920
920
  * The scale factor is relative to the parent (if any). The global world scale factor cannot be manually set.
921
921
  * See manual to know how physics affected when setting scale from this function.
@@ -933,7 +933,7 @@ declare global {
933
933
  * go.set_scale(s2, "obj_id");
934
934
  * ```
935
935
  */
936
- export function set_scale(scale: number | Vector3, id?: string | Hash | Url): void;
936
+ export function set_scale(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
937
937
  /**
938
938
  * The scale factor is relative to the parent (if any). The global world scale factor cannot be manually set.
939
939
  * See manual to know how physics affected when setting scale from this function.
@@ -951,7 +951,7 @@ declare global {
951
951
  * go.set_scale_xy(s2, "obj_id"); // z will not be set here, only x and y
952
952
  * ```
953
953
  */
954
- export function set_scale_xy(scale: number | Vector3, id?: string | Hash | Url): void;
954
+ export function set_scale_xy(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
955
955
  /**
956
956
  * This is a callback-function, which is called by the engine every frame to update the state of a script component.
957
957
  * It can be used to perform any kind of game related tasks, e.g. moving the game object instance.
@@ -994,7 +994,7 @@ declare global {
994
994
  * go.update_world_transform("/other");
995
995
  * ```
996
996
  */
997
- export function update_world_transform(id?: string | Hash | Url): void;
997
+ export function update_world_transform(id?: SceneGameObjectAddress | Hash | Url): void;
998
998
  /**
999
999
  * The function uses world transformation calculated at the end of previous frame.
1000
1000
  *
@@ -1009,7 +1009,7 @@ declare global {
1009
1009
  * const new_position = go.world_to_local_position(test_pos, "/child");
1010
1010
  * ```
1011
1011
  */
1012
- export function world_to_local_position(position: Vector3, url: string | Hash | Url): Vector3;
1012
+ export function world_to_local_position(position: Vector3, url: SceneGameObjectAddress | Hash | Url): Vector3;
1013
1013
  /**
1014
1014
  * The function uses world transformation calculated at the end of previous frame.
1015
1015
  *
@@ -1024,7 +1024,7 @@ declare global {
1024
1024
  * const result_transform = go.world_to_local_transform(test_transform, "/child");
1025
1025
  * ```
1026
1026
  */
1027
- export function world_to_local_transform(transformation: Matrix4, url: string | Hash | Url): Matrix4;
1027
+ export function world_to_local_transform(transformation: Matrix4, url: SceneGameObjectAddress | Hash | Url): Matrix4;
1028
1028
  export { _delete as delete };
1029
1029
  export interface properties {
1030
1030
  /**
@@ -0,0 +1,13 @@
1
+ /// <reference types="lua-types/5.1" />
2
+ import "../editor";
3
+ import "../editor-vm/http";
4
+ import "../editor-vm/json";
5
+ import "../editor-vm/localization";
6
+ import "../editor-vm/zip";
7
+ import "../editor-vm/zlib";
8
+ import "../editor-vm/tilemap_tiles";
9
+ import "../../src/editor-overloads";
10
+ import "../../src/editor-vm-globals";
11
+
12
+ export { defineEditorScript, defineEditorCommand } from "../../src/editor";
13
+ export type { EditorCommandQuery, EditorNode } from "../../src/editor";
@@ -48,6 +48,7 @@ import "../../src/engine-globals";
48
48
  import "../../src/go-overloads";
49
49
  import "../../src/message-guard";
50
50
  import "../../src/msg-overloads";
51
+ import "../../src/scene-addresses";
51
52
  import "../../src/vmath-overloads";
52
53
  import "../../src/window-event-guard";
53
54
  import "../builtin-messages";
@@ -48,6 +48,7 @@ import "../../src/engine-globals";
48
48
  import "../../src/go-overloads";
49
49
  import "../../src/message-guard";
50
50
  import "../../src/msg-overloads";
51
+ import "../../src/scene-addresses";
51
52
  import "../../src/vmath-overloads";
52
53
  import "../../src/window-event-guard";
53
54
  import "../builtin-messages";
@@ -48,6 +48,7 @@ import "../../src/engine-globals";
48
48
  import "../../src/go-overloads";
49
49
  import "../../src/message-guard";
50
50
  import "../../src/msg-overloads";
51
+ import "../../src/scene-addresses";
51
52
  import "../../src/vmath-overloads";
52
53
  import "../../src/window-event-guard";
53
54
  import "../builtin-messages";
@@ -261,7 +261,7 @@ declare global {
261
261
  * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
262
262
  * ```
263
263
  */
264
- export function animate(url: string | Hash | Url, property: string | Hash, playback: number & { readonly __brand: "go.PLAYBACK_ONCE_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_PINGPONG" } | number & { readonly __brand: "go.PLAYBACK_LOOP_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_PINGPONG" }, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | number & { readonly __brand: "go.EASING_INBACK" } | number & { readonly __brand: "go.EASING_INBOUNCE" } | number & { readonly __brand: "go.EASING_INCIRC" } | number & { readonly __brand: "go.EASING_INCUBIC" } | number & { readonly __brand: "go.EASING_INELASTIC" } | number & { readonly __brand: "go.EASING_INEXPO" } | number & { readonly __brand: "go.EASING_INOUTBACK" } | number & { readonly __brand: "go.EASING_INOUTBOUNCE" } | number & { readonly __brand: "go.EASING_INOUTCIRC" } | number & { readonly __brand: "go.EASING_INOUTCUBIC" } | number & { readonly __brand: "go.EASING_INOUTELASTIC" } | number & { readonly __brand: "go.EASING_INOUTEXPO" } | number & { readonly __brand: "go.EASING_INOUTQUAD" } | number & { readonly __brand: "go.EASING_INOUTQUART" } | number & { readonly __brand: "go.EASING_INOUTQUINT" } | number & { readonly __brand: "go.EASING_INOUTSINE" } | number & { readonly __brand: "go.EASING_INQUAD" } | number & { readonly __brand: "go.EASING_INQUART" } | number & { readonly __brand: "go.EASING_INQUINT" } | number & { readonly __brand: "go.EASING_INSINE" } | number & { readonly __brand: "go.EASING_LINEAR" } | number & { readonly __brand: "go.EASING_OUTBACK" } | number & { readonly __brand: "go.EASING_OUTBOUNCE" } | number & { readonly __brand: "go.EASING_OUTCIRC" } | number & { readonly __brand: "go.EASING_OUTCUBIC" } | number & { readonly __brand: "go.EASING_OUTELASTIC" } | number & { readonly __brand: "go.EASING_OUTEXPO" } | number & { readonly __brand: "go.EASING_OUTINBACK" } | number & { readonly __brand: "go.EASING_OUTINBOUNCE" } | number & { readonly __brand: "go.EASING_OUTINCIRC" } | number & { readonly __brand: "go.EASING_OUTINCUBIC" } | number & { readonly __brand: "go.EASING_OUTINELASTIC" } | number & { readonly __brand: "go.EASING_OUTINEXPO" } | number & { readonly __brand: "go.EASING_OUTINQUAD" } | number & { readonly __brand: "go.EASING_OUTINQUART" } | number & { readonly __brand: "go.EASING_OUTINQUINT" } | number & { readonly __brand: "go.EASING_OUTINSINE" } | number & { readonly __brand: "go.EASING_OUTQUAD" } | number & { readonly __brand: "go.EASING_OUTQUART" } | number & { readonly __brand: "go.EASING_OUTQUINT" } | number & { readonly __brand: "go.EASING_OUTSINE" }, duration: number, delay?: number, complete_function?: (self: unknown, url: unknown, property: unknown) => void): void;
264
+ export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback: number & { readonly __brand: "go.PLAYBACK_ONCE_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_PINGPONG" } | number & { readonly __brand: "go.PLAYBACK_LOOP_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_PINGPONG" }, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | number & { readonly __brand: "go.EASING_INBACK" } | number & { readonly __brand: "go.EASING_INBOUNCE" } | number & { readonly __brand: "go.EASING_INCIRC" } | number & { readonly __brand: "go.EASING_INCUBIC" } | number & { readonly __brand: "go.EASING_INELASTIC" } | number & { readonly __brand: "go.EASING_INEXPO" } | number & { readonly __brand: "go.EASING_INOUTBACK" } | number & { readonly __brand: "go.EASING_INOUTBOUNCE" } | number & { readonly __brand: "go.EASING_INOUTCIRC" } | number & { readonly __brand: "go.EASING_INOUTCUBIC" } | number & { readonly __brand: "go.EASING_INOUTELASTIC" } | number & { readonly __brand: "go.EASING_INOUTEXPO" } | number & { readonly __brand: "go.EASING_INOUTQUAD" } | number & { readonly __brand: "go.EASING_INOUTQUART" } | number & { readonly __brand: "go.EASING_INOUTQUINT" } | number & { readonly __brand: "go.EASING_INOUTSINE" } | number & { readonly __brand: "go.EASING_INQUAD" } | number & { readonly __brand: "go.EASING_INQUART" } | number & { readonly __brand: "go.EASING_INQUINT" } | number & { readonly __brand: "go.EASING_INSINE" } | number & { readonly __brand: "go.EASING_LINEAR" } | number & { readonly __brand: "go.EASING_OUTBACK" } | number & { readonly __brand: "go.EASING_OUTBOUNCE" } | number & { readonly __brand: "go.EASING_OUTCIRC" } | number & { readonly __brand: "go.EASING_OUTCUBIC" } | number & { readonly __brand: "go.EASING_OUTELASTIC" } | number & { readonly __brand: "go.EASING_OUTEXPO" } | number & { readonly __brand: "go.EASING_OUTINBACK" } | number & { readonly __brand: "go.EASING_OUTINBOUNCE" } | number & { readonly __brand: "go.EASING_OUTINCIRC" } | number & { readonly __brand: "go.EASING_OUTINCUBIC" } | number & { readonly __brand: "go.EASING_OUTINELASTIC" } | number & { readonly __brand: "go.EASING_OUTINEXPO" } | number & { readonly __brand: "go.EASING_OUTINQUAD" } | number & { readonly __brand: "go.EASING_OUTINQUART" } | number & { readonly __brand: "go.EASING_OUTINQUINT" } | number & { readonly __brand: "go.EASING_OUTINSINE" } | number & { readonly __brand: "go.EASING_OUTQUAD" } | number & { readonly __brand: "go.EASING_OUTQUART" } | number & { readonly __brand: "go.EASING_OUTQUINT" } | number & { readonly __brand: "go.EASING_OUTSINE" }, duration: number, delay?: number, complete_function?: (self: unknown, url: unknown, property: unknown) => void): void;
265
265
  /**
266
266
  * By calling this function, all or specified stored property animations of the game object or component will be canceled.
267
267
  * See the properties guide for which properties can be animated and the animation guide for how to animate them.
@@ -280,7 +280,7 @@ declare global {
280
280
  * go.cancel_animations("#sprite");
281
281
  * ```
282
282
  */
283
- export function cancel_animations(url: string | Hash | Url, property?: string | Hash): void;
283
+ export function cancel_animations(url: SceneAddress | Hash | Url, property?: string | Hash): void;
284
284
  /**
285
285
  * Delete one or more game objects identified by id. Deletion is asynchronous meaning that
286
286
  * the game object(s) are scheduled for deletion which will happen at the end of the current
@@ -315,7 +315,7 @@ declare global {
315
315
  * go.delete(ids2, true);
316
316
  * ```
317
317
  */
318
- function _delete(id?: string | Hash | Url | (string | Hash | Url)[], recursive?: boolean): void;
318
+ function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[], recursive?: boolean): void;
319
319
  /**
320
320
  * This function can check for game objects in any collection by specifying
321
321
  * the collection name in the URL.
@@ -331,7 +331,7 @@ declare global {
331
331
  * go.exists("other_collection:/my_game_object");
332
332
  * ```
333
333
  */
334
- export function exists(url: string | Hash | Url): boolean;
334
+ export function exists(url: SceneGameObjectAddress | Hash | Url): boolean;
335
335
  /**
336
336
  * This is a callback-function, which is called by the engine when a script component is finalized (destroyed). It can
337
337
  * be used to e.g. take some last action, report the finalization to other game object instances, delete spawned objects
@@ -398,7 +398,7 @@ declare global {
398
398
  * const parent_id2 = go.get_parent("x");
399
399
  * ```
400
400
  */
401
- export function get_parent(id?: string | Hash | Url): Hash | undefined;
401
+ export function get_parent(id?: SceneGameObjectAddress | Hash | Url): Hash | undefined;
402
402
  /**
403
403
  * The position is relative the parent (if any). Use go.get_world_position to retrieve the global world position.
404
404
  *
@@ -413,7 +413,7 @@ declare global {
413
413
  * const pos = go.get_position("my_gameobject");
414
414
  * ```
415
415
  */
416
- export function get_position(id?: string | Hash | Url): Vector3;
416
+ export function get_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
417
417
  /**
418
418
  * The rotation is relative to the parent (if any). Use go.get_world_rotation to retrieve the global world rotation.
419
419
  *
@@ -428,7 +428,7 @@ declare global {
428
428
  * const r2 = go.get_rotation("x");
429
429
  * ```
430
430
  */
431
- export function get_rotation(id?: string | Hash | Url): Quaternion;
431
+ export function get_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
432
432
  /**
433
433
  * The scale is relative the parent (if any). Use go.get_world_scale to retrieve the global world 3D scale factor.
434
434
  *
@@ -443,7 +443,7 @@ declare global {
443
443
  * const s2 = go.get_scale("x");
444
444
  * ```
445
445
  */
446
- export function get_scale(id?: string | Hash | Url): Vector3;
446
+ export function get_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
447
447
  /**
448
448
  * The uniform scale is relative the parent (if any). If the underlying scale vector is non-uniform the min element of the vector is returned as the uniform scale factor.
449
449
  *
@@ -458,7 +458,7 @@ declare global {
458
458
  * const s2 = go.get_scale_uniform("x");
459
459
  * ```
460
460
  */
461
- export function get_scale_uniform(id?: string | Hash | Url): number;
461
+ export function get_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
462
462
  /**
463
463
  * The function will return the world position calculated at the end of the previous frame.
464
464
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -475,7 +475,7 @@ declare global {
475
475
  * const p2 = go.get_world_position("x");
476
476
  * ```
477
477
  */
478
- export function get_world_position(id?: string | Hash | Url): Vector3;
478
+ export function get_world_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
479
479
  /**
480
480
  * The function will return the world rotation calculated at the end of the previous frame.
481
481
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -492,7 +492,7 @@ declare global {
492
492
  * const r2 = go.get_world_rotation("x");
493
493
  * ```
494
494
  */
495
- export function get_world_rotation(id?: string | Hash | Url): Quaternion;
495
+ export function get_world_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
496
496
  /**
497
497
  * The function will return the world 3D scale factor calculated at the end of the previous frame.
498
498
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -511,7 +511,7 @@ declare global {
511
511
  * const s2 = go.get_world_scale("x");
512
512
  * ```
513
513
  */
514
- export function get_world_scale(id?: string | Hash | Url): Vector3;
514
+ export function get_world_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
515
515
  /**
516
516
  * The function will return the world scale factor calculated at the end of the previous frame.
517
517
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -528,7 +528,7 @@ declare global {
528
528
  * const s2 = go.get_world_scale_uniform("x");
529
529
  * ```
530
530
  */
531
- export function get_world_scale_uniform(id?: string | Hash | Url): number;
531
+ export function get_world_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
532
532
  /**
533
533
  * The function will return the world transform matrix calculated at the end of the previous frame.
534
534
  * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
@@ -544,7 +544,7 @@ declare global {
544
544
  * const m2 = go.get_world_transform("x");
545
545
  * ```
546
546
  */
547
- export function get_world_transform(id?: string | Hash | Url): Matrix4;
547
+ export function get_world_transform(id?: SceneGameObjectAddress | Hash | Url): Matrix4;
548
548
  /**
549
549
  * This is a callback-function, which is called by the engine when a script component is initialized. It can be used
550
550
  * to set the initial state of the script.
@@ -854,7 +854,7 @@ declare global {
854
854
  * go.set_parent(go.get_id("my_instance"));
855
855
  * ```
856
856
  */
857
- export function set_parent(id?: string | Hash | Url, parent_id?: string | Hash | Url, keep_world_transform?: boolean): void;
857
+ export function set_parent(id?: SceneGameObjectAddress | Hash | Url, parent_id?: SceneGameObjectAddress | Hash | Url, keep_world_transform?: boolean): void;
858
858
  /**
859
859
  * The position is relative to the parent (if any). The global world position cannot be manually set.
860
860
  *
@@ -872,7 +872,7 @@ declare global {
872
872
  * go.set_position(p, "x");
873
873
  * ```
874
874
  */
875
- export function set_position(position: Vector3, id?: string | Hash | Url): void;
875
+ export function set_position(position: Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
876
876
  /**
877
877
  * The rotation is relative to the parent (if any). The global world rotation cannot be manually set.
878
878
  *
@@ -890,7 +890,7 @@ declare global {
890
890
  * go.set_rotation(r, "x");
891
891
  * ```
892
892
  */
893
- export function set_rotation(rotation: Quaternion, id?: string | Hash | Url): void;
893
+ export function set_rotation(rotation: Quaternion, id?: SceneGameObjectAddress | Hash | Url): void;
894
894
  /**
895
895
  * The scale factor is relative to the parent (if any). The global world scale factor cannot be manually set.
896
896
  * See manual to know how physics affected when setting scale from this function.
@@ -908,7 +908,7 @@ declare global {
908
908
  * go.set_scale(s2, "obj_id");
909
909
  * ```
910
910
  */
911
- export function set_scale(scale: number | Vector3, id?: string | Hash | Url): void;
911
+ export function set_scale(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
912
912
  /**
913
913
  * The scale factor is relative to the parent (if any). The global world scale factor cannot be manually set.
914
914
  * See manual to know how physics affected when setting scale from this function.
@@ -926,7 +926,7 @@ declare global {
926
926
  * go.set_scale_xy(s2, "obj_id"); // z will not be set here, only x and y
927
927
  * ```
928
928
  */
929
- export function set_scale_xy(scale: number | Vector3, id?: string | Hash | Url): void;
929
+ export function set_scale_xy(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
930
930
  /**
931
931
  * This is a callback-function, which is called by the engine every frame to update the state of a script component.
932
932
  * It can be used to perform any kind of game related tasks, e.g. moving the game object instance.
@@ -969,7 +969,7 @@ declare global {
969
969
  * go.update_world_transform("/other");
970
970
  * ```
971
971
  */
972
- export function update_world_transform(id?: string | Hash | Url): void;
972
+ export function update_world_transform(id?: SceneGameObjectAddress | Hash | Url): void;
973
973
  /**
974
974
  * The function uses world transformation calculated at the end of previous frame.
975
975
  *
@@ -984,7 +984,7 @@ declare global {
984
984
  * const new_position = go.world_to_local_position(test_pos, "/child");
985
985
  * ```
986
986
  */
987
- export function world_to_local_position(position: Vector3, url: string | Hash | Url): Vector3;
987
+ export function world_to_local_position(position: Vector3, url: SceneGameObjectAddress | Hash | Url): Vector3;
988
988
  /**
989
989
  * The function uses world transformation calculated at the end of previous frame.
990
990
  *
@@ -999,7 +999,7 @@ declare global {
999
999
  * const result_transform = go.world_to_local_transform(test_transform, "/child");
1000
1000
  * ```
1001
1001
  */
1002
- export function world_to_local_transform(transformation: Matrix4, url: string | Hash | Url): Matrix4;
1002
+ export function world_to_local_transform(transformation: Matrix4, url: SceneGameObjectAddress | Hash | Url): Matrix4;
1003
1003
  export { _delete as delete };
1004
1004
  export interface properties {
1005
1005
  /**
package/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import "./src/msg-overloads";
5
5
  import "./src/message-guard";
6
6
  import "./src/window-event-guard";
7
7
  import "./src/message-dispatch";
8
+ import "./src/scene-addresses";
8
9
  import "./src/engine-globals";
9
10
  import "./generated/b2d";
10
11
  import "./generated/b2d_body";
@@ -131,3 +132,8 @@ export {
131
132
  type SignatureOverride,
132
133
  type SignatureStore,
133
134
  } from "./src/signature-store";
135
+ export type {
136
+ UrlParameterClass,
137
+ UrlParameterEntry,
138
+ UrlParameterTable,
139
+ } from "./src/url-parameters";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defold-typescript/types",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "TypeScript types for the Defold engine's Lua APIs.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,17 +27,24 @@
27
27
  "./render-script": {
28
28
  "types": "./generated/kinds/render-script.d.ts"
29
29
  },
30
+ "./editor-script": {
31
+ "types": "./generated/kinds/editor-script.d.ts"
32
+ },
30
33
  "./core-types": {
31
34
  "types": "./src/core-types.ts"
32
35
  },
33
36
  "./lifecycle": {
34
37
  "types": "./src/lifecycle.ts"
35
38
  },
39
+ "./editor": {
40
+ "types": "./src/editor.ts"
41
+ },
36
42
  "./timers": {
37
43
  "types": "./src/timers.d.ts"
38
44
  },
39
45
  "./api-availability.json": "./api-availability.json",
40
46
  "./api-signatures.json": "./api-signatures.json",
47
+ "./url-parameters.json": "./url-parameters.json",
41
48
  "./package.json": "./package.json"
42
49
  },
43
50
  "files": [
@@ -48,6 +55,7 @@
48
55
  "api-migrations.json",
49
56
  "api-availability.json",
50
57
  "api-signatures.json",
58
+ "url-parameters.json",
51
59
  "index.d.ts",
52
60
  "!src/**/*.test.ts",
53
61
  "!scripts/**/*.test.ts",
@@ -1,34 +1,61 @@
1
1
  import { mkdirSync, writeFileSync } from "node:fs";
2
- import { resolve } from "node:path";
2
+ import { dirname, resolve } from "node:path";
3
3
  import {
4
4
  type ApiTarget,
5
5
  generateModuleDeclaration,
6
6
  generateVersionIndex,
7
7
  KIND_MODULE_MANIFEST,
8
- LUA_STDLIB_REFERENCES,
8
+ type KindManifestEntry,
9
+ kindStdlibReferences,
10
+ loadTargetEditorModules,
9
11
  type ResolveTargetOptions,
10
12
  resolveTargetModules,
11
13
  } from "./regen";
12
14
 
13
- export { KIND_MODULE_MANIFEST } from "./regen";
15
+ export { RUNTIME_KIND_MANIFEST, targetKindManifest } from "./regen";
14
16
 
15
17
  export interface RenderMaterializedKindIndexOptions {
16
18
  readonly kind: string;
17
19
  readonly universalModules: readonly string[];
18
20
  readonly restrictedModule: string | null;
21
+ // Set for a kind built from the target's own editor documents. It replaces
22
+ // the universal set outright — an editor kind is disjoint from the runtime
23
+ // surface, not a narrowing of it.
24
+ readonly editorModules?: readonly string[];
25
+ }
26
+
27
+ // The installed subpath a materialized kind re-exports its factory from: the
28
+ // surface has no relative `src/<module>` to reach, but the package publishes
29
+ // each factory module under its own name.
30
+ function installedFactoryModule(entry: KindManifestEntry): string {
31
+ const module = (entry.factoryFrom ?? "../../src/lifecycle").split("/").pop();
32
+ return `@defold-typescript/types/${module}`;
19
33
  }
20
34
 
21
35
  // Render one per-kind subpath for the materialized surface, mirroring
22
36
  // `generateKindIndex` but re-exporting the factory from the installed
23
- // `@defold-typescript/types/lifecycle` subpath (the materialized surface has no
24
- // relative `src/lifecycle` to reach). Pure: returns a string, no FS.
37
+ // `@defold-typescript/types/<module>` subpath. Pure: returns a string, no FS.
25
38
  export function renderMaterializedKindIndex(opts: RenderMaterializedKindIndexOptions): string {
26
39
  const entry = KIND_MODULE_MANIFEST.find((e) => e.kind === opts.kind);
27
40
  if (!entry) throw new Error(`unknown script kind: ${opts.kind}`);
28
- const universal = [...new Set(["engine-globals", ...opts.universalModules])].sort();
29
- const lines = universal.map((mod) => `import "../${mod}";`);
30
- if (opts.restrictedModule) lines.push(`import "../${opts.restrictedModule}";`);
31
- return `${LUA_STDLIB_REFERENCES}${lines.join("\n")}\n\nexport { ${entry.factory} } from "@defold-typescript/types/lifecycle";\nexport type { ScriptProperties, ScriptProperty } from "@defold-typescript/types/lifecycle";\n`;
41
+ const modules =
42
+ entry.only === undefined
43
+ ? [...new Set(["engine-globals", ...opts.universalModules])].sort()
44
+ : [...(opts.editorModules ?? [])];
45
+ const lines = modules.map((mod) => `import "../${mod}";`);
46
+ if (entry.only === undefined && opts.restrictedModule) {
47
+ lines.push(`import "../${opts.restrictedModule}";`);
48
+ }
49
+ const from = installedFactoryModule(entry);
50
+ const values = [entry.factory, ...(entry.extraExports ?? [])].join(", ");
51
+ const typeExports = entry.extraTypeExports?.length
52
+ ? `\nexport type { ${entry.extraTypeExports.join(", ")} } from "${from}";`
53
+ : "";
54
+ const properties =
55
+ entry.propertyTypes === false
56
+ ? ""
57
+ : `\nexport type { ScriptProperties, ScriptProperty } from "${from}";`;
58
+ return `${kindStdlibReferences(entry)}${lines.join("\n")}\n\nexport { ${values} } from "${from}";${typeExports}${properties}\n`;
32
59
  }
33
60
 
34
61
  export interface BuildVersionedSurfaceOptions {
@@ -60,15 +87,25 @@ export async function buildVersionedSurfaceFiles(
60
87
  opts: BuildVersionedSurfaceOptions = {},
61
88
  ): Promise<VersionedSurfaceFile[]> {
62
89
  const exclude = new Set(opts.excludeModules ?? []);
63
- const modules = (await resolveTargetModules(target, opts.resolveOpts ?? {})).filter(
64
- (entry) => !exclude.has(entry.outFile.replace(/\.d\.ts$/, "")),
90
+ const kept = (outFile: string): boolean => !exclude.has(outFile.replace(/\.d\.ts$/, ""));
91
+ const modules = (await resolveTargetModules(target, opts.resolveOpts ?? {})).filter((entry) =>
92
+ kept(entry.outFile),
65
93
  );
94
+ // The editor documents a target declares are always committed fixtures — the
95
+ // ref-doc zip carries no editor surface — so they resolve from disk whatever
96
+ // the target's `source` says.
97
+ const editorModules = loadTargetEditorModules(
98
+ target,
99
+ opts.resolveOpts?.packageRoot ?? undefined,
100
+ ).filter((entry) => kept(entry.outFile));
66
101
 
67
- const files: VersionedSurfaceFile[] = modules.map((entry) => ({
102
+ const files: VersionedSurfaceFile[] = [...modules, ...editorModules].map((entry) => ({
68
103
  path: entry.outFile,
69
104
  contents: generateModuleDeclaration(entry).contents,
70
105
  }));
71
106
 
107
+ // The aggregate entrypoint stays the runtime surface: importing the editor VM
108
+ // there would drag it into every program that pins this version.
72
109
  const versioned = modules.map((entry) => ({ ...entry, versionId: target.id }));
73
110
  files.push({ path: "index.d.ts", contents: generateVersionIndex(target.id, versioned) });
74
111
 
@@ -94,6 +131,10 @@ export async function materializeVersionedSurface(
94
131
  const files = await buildVersionedSurfaceFiles(target, opts);
95
132
  mkdirSync(opts.destDir, { recursive: true });
96
133
  for (const file of files) {
97
- writeFileSync(resolve(opts.destDir, file.path), file.contents);
134
+ const out = resolve(opts.destDir, file.path);
135
+ // An editor VM module lands in its own subdirectory, so the sink cannot
136
+ // assume every file is a direct child of the surface root.
137
+ mkdirSync(dirname(out), { recursive: true });
138
+ writeFileSync(out, file.contents);
98
139
  }
99
140
  }