@defold-typescript/types 0.19.3 → 0.20.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 (86) hide show
  1. package/api-availability.json +2755 -0
  2. package/api-migrations.json +31 -0
  3. package/api-signatures.json +2324 -0
  4. package/api-targets.json +493 -45
  5. package/generated/b2d.d.ts +6 -0
  6. package/generated/b2d_body.d.ts +329 -1
  7. package/generated/b2d_chain.d.ts +106 -0
  8. package/generated/b2d_fixture.d.ts +155 -0
  9. package/generated/b2d_joint.d.ts +823 -0
  10. package/generated/b2d_shape.d.ts +215 -0
  11. package/generated/b2d_world.d.ts +314 -0
  12. package/generated/builtin-messages.d.ts +18 -0
  13. package/generated/camera.d.ts +62 -5
  14. package/generated/compute.d.ts +306 -0
  15. package/generated/go.d.ts +29 -4
  16. package/generated/graphics.d.ts +95 -0
  17. package/generated/gui.d.ts +1 -3
  18. package/generated/json.d.ts +2 -2
  19. package/generated/kinds/gui-script.d.ts +7 -0
  20. package/generated/kinds/render-script.d.ts +7 -0
  21. package/generated/kinds/script.d.ts +7 -0
  22. package/generated/label.d.ts +1 -1
  23. package/generated/liveupdate.d.ts +22 -4
  24. package/generated/material.d.ts +444 -0
  25. package/generated/model.d.ts +46 -5
  26. package/generated/physics.d.ts +1 -3
  27. package/generated/profiler.d.ts +2 -3
  28. package/generated/render.d.ts +25 -9
  29. package/generated/resource.d.ts +2 -2
  30. package/generated/sprite.d.ts +15 -1
  31. package/generated/tilemap.d.ts +14 -0
  32. package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
  33. package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
  34. package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
  35. package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
  36. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
  37. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
  38. package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
  39. package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
  40. package/generated/versions/defold-1.12.4/font.d.ts +81 -0
  41. package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
  42. package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
  43. package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
  44. package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
  45. package/generated/versions/defold-1.12.4/http.d.ts +84 -0
  46. package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
  47. package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
  48. package/generated/versions/defold-1.12.4/image.d.ts +139 -0
  49. package/generated/versions/defold-1.12.4/index.d.ts +41 -0
  50. package/generated/versions/defold-1.12.4/json.d.ts +76 -0
  51. package/generated/versions/defold-1.12.4/label.d.ts +94 -0
  52. package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
  53. package/generated/versions/defold-1.12.4/model.d.ts +205 -0
  54. package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
  56. package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
  57. package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
  58. package/generated/versions/defold-1.12.4/push.d.ts +66 -0
  59. package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
  60. package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
  61. package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
  62. package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
  63. package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
  64. package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
  65. package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
  66. package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
  67. package/generated/versions/defold-1.12.4/types.d.ts +61 -0
  68. package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
  69. package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
  70. package/generated/versions/defold-1.12.4/window.d.ts +198 -0
  71. package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
  72. package/index.d.ts +22 -0
  73. package/package.json +8 -1
  74. package/scripts/fidelity-audit.ts +69 -12
  75. package/scripts/fidelity-baseline.json +56 -0
  76. package/scripts/generate-api-availability.ts +139 -0
  77. package/scripts/generate-api-signatures.ts +66 -0
  78. package/scripts/import-defold-release.ts +480 -0
  79. package/scripts/regen.ts +53 -6
  80. package/scripts/sync-api-docs.ts +89 -41
  81. package/src/api-availability.ts +0 -0
  82. package/src/core-types.ts +9 -0
  83. package/src/emit-dts.ts +674 -17
  84. package/src/emit-messages.ts +72 -2
  85. package/src/index.ts +26 -1
  86. package/src/lifecycle.ts +43 -2
@@ -0,0 +1,123 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Opaque, Quaternion, Url, Vector3 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for controlling factory components which are used to
7
+ * dynamically spawn game objects into the runtime.
8
+ */
9
+ namespace factory {
10
+ /**
11
+ * loaded
12
+ */
13
+ const STATUS_LOADED: number & { readonly __brand: "factory.STATUS_LOADED" };
14
+ /**
15
+ * loading
16
+ */
17
+ const STATUS_LOADING: number & { readonly __brand: "factory.STATUS_LOADING" };
18
+ /**
19
+ * unloaded
20
+ */
21
+ const STATUS_UNLOADED: number & { readonly __brand: "factory.STATUS_UNLOADED" };
22
+ /**
23
+ * The URL identifies which factory should create the game object.
24
+ * If the game object is created inside of the frame (e.g. from an update callback), the game object will be created instantly, but none of its component will be updated in the same frame.
25
+ * Properties defined in scripts in the created game object can be overridden through the properties-parameter below.
26
+ * See go.property for more information on script properties.
27
+ * Calling factory.create on a factory that is marked as dynamic without having loaded resources
28
+ * using factory.load will synchronously load and create resources which may affect application performance.
29
+ *
30
+ * @param url - the factory that should create a game object.
31
+ * @param position - the position of the new game object, the position of the game object calling `factory.create()` is used by default, or if the value is `nil`.
32
+ * @param rotation - the rotation of the new game object, the rotation of the game object calling `factory.create()` is used by default, or if the value is `nil`.
33
+ * @param properties - the properties defined in a script attached to the new game object.
34
+ * @param scale - the scale of the new game object (must be greater than 0), the scale of the game object containing the factory is used by default, or if the value is `nil`
35
+ * @returns the global id of the spawned game object
36
+ * @example
37
+ * ```ts
38
+ * // How to create a new game object:
39
+ * export default defineScript({
40
+ * init(self) {
41
+ * // create a new game object and provide property values
42
+ * self.my_created_object = factory.create("#factory", undefined, undefined, { my_value: 1 });
43
+ * // communicate with the object
44
+ * msg.post(self.my_created_object, "hello");
45
+ * },
46
+ * });
47
+ *
48
+ * // And then let the new game object have a script attached:
49
+ * go.property("my_value", 0);
50
+ *
51
+ * export default defineScript({
52
+ * init(self) {
53
+ * // do something with self.my_value which is now one
54
+ * },
55
+ * });
56
+ * ```
57
+ */
58
+ function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: Record<string | number, unknown>, scale?: number | Vector3): Hash;
59
+ /**
60
+ * This returns status of the factory.
61
+ * Calling this function when the factory is not marked as dynamic loading always returns
62
+ * factory.STATUS_LOADED.
63
+ *
64
+ * @param url - the factory component to get status from
65
+ * @returns status of the factory component
66
+ *
67
+ * - `factory.STATUS_UNLOADED`
68
+ *
69
+ * - `factory.STATUS_LOADING`
70
+ *
71
+ * - `factory.STATUS_LOADED`
72
+ */
73
+ function get_status(url?: string | Hash | Url): Opaque<"constant">;
74
+ /**
75
+ * Resources are referenced by the factory component until the existing (parent) collection is destroyed or factory.unload is called.
76
+ * Calling this function when the factory is not marked as dynamic loading does nothing.
77
+ *
78
+ * @param url - the factory component to load
79
+ * @param complete_function - function to call when resources are loaded.
80
+ *
81
+ * `self`
82
+ * object The current object.
83
+ * `url`
84
+ * url url of the factory component
85
+ * `result`
86
+ * boolean True if resources were loaded successfully
87
+ * @example
88
+ * ```ts
89
+ * // How to load resources of a factory prototype.
90
+ * factory.load("#factory", (self, url, result) => {});
91
+ * ```
92
+ */
93
+ function load(url?: string | Hash | Url, complete_function?: (self: unknown, url: unknown, result: unknown) => void): void;
94
+ /**
95
+ * Changes the prototype for the factory.
96
+ *
97
+ * @param url - the factory component
98
+ * @param prototype - the path to the new prototype, or `nil`
99
+ * @example
100
+ * ```ts
101
+ * // How to unload the previous prototype's resources, and then spawn a new game object:
102
+ * factory.unload("#factory"); // unload the previous resources
103
+ * factory.set_prototype("#factory", "/main/levels/enemyA.goc");
104
+ * const id = factory.create("#factory", go.get_world_position(), vmath.quat());
105
+ * ```
106
+ */
107
+ function set_prototype(url?: string | Hash | Url, prototype?: string): void;
108
+ /**
109
+ * This decreases the reference count for each resource loaded with factory.load. If reference is zero, the resource is destroyed.
110
+ * Calling this function when the factory is not marked as dynamic loading does nothing.
111
+ *
112
+ * @param url - the factory component to unload
113
+ * @example
114
+ * ```ts
115
+ * // How to unload resources of a factory prototype loaded with factory.load:
116
+ * factory.unload("#factory");
117
+ * ```
118
+ */
119
+ function unload(url?: string | Hash | Url): void;
120
+ }
121
+ }
122
+
123
+ export {};
@@ -0,0 +1,81 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions, messages and properties used to manipulate font resources.
7
+ */
8
+ namespace font {
9
+ /**
10
+ * associates a ttf resource to a .fontc file.
11
+ *
12
+ * @param fontc - The path to the .fontc resource
13
+ * @param ttf - The path to the .ttf resource
14
+ * @example
15
+ * ```ts
16
+ * const font_hash = hash("/assets/fonts/roboto.fontc");
17
+ * const ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf");
18
+ * font.add_font(font_hash, ttf_hash);
19
+ * ```
20
+ */
21
+ function add_font(fontc: string | Hash, ttf: string | Hash): void;
22
+ /**
23
+ * Gets information about a font, such as the associated font files
24
+ *
25
+ * @param fontc - The path to the .fontc resource
26
+ * @returns the information table contains these fields:
27
+ *
28
+ * `path`
29
+ * hash The path hash of the current file.
30
+ * `fonts`
31
+ *
32
+ * table An array of associated font (e.g. .ttf) files. Each item is a table that contains:
33
+ *
34
+ * `path`
35
+ * string The path of the font file
36
+ * `path_hash`
37
+ * hash The path of the font file
38
+ */
39
+ function get_info(fontc: string | Hash): { path: Hash; fonts: { path: string; path_hash: Hash }[] };
40
+ /**
41
+ * prepopulates the font glyph cache with rasterised glyphs
42
+ *
43
+ * @param fontc - The path to the .fontc resource
44
+ * @param text - The text to layout
45
+ * @param callback - (optional) A callback function that is called after the request is finished
46
+ *
47
+ * `self`
48
+ * object The current object.
49
+ * `request_id`
50
+ * number The request id
51
+ * `result`
52
+ * boolean True if request was succesful
53
+ * `errstring`
54
+ * string `nil` if the request was successful
55
+ * @returns Returns the asynchronous request id
56
+ * @example
57
+ * ```ts
58
+ * const font_hash = hash("/assets/fonts/roboto.fontc");
59
+ * font.prewarm_text(font_hash, "Some text", (self, request_id, result, errstring) => {
60
+ * // cache is warm, show the text!
61
+ * });
62
+ * ```
63
+ */
64
+ function prewarm_text(fontc: string | Hash, text: string, callback?: (self: unknown, request_id: unknown, result: unknown, errstring: unknown) => void): number;
65
+ /**
66
+ * associates a ttf resource to a .fontc file
67
+ *
68
+ * @param fontc - The path to the .fontc resource
69
+ * @param ttf - The path to the .ttf resource
70
+ * @example
71
+ * ```ts
72
+ * const font_hash = hash("/assets/fonts/roboto.fontc");
73
+ * const ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf");
74
+ * font.remove_font(font_hash, ttf_hash);
75
+ * ```
76
+ */
77
+ function remove_font(fontc: string | Hash, ttf: string | Hash): void;
78
+ }
79
+ }
80
+
81
+ export {};