@ts-defold/types 1.2.50 → 1.2.52

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 (2) hide show
  1. package/index.d.ts +126 -11
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="lua-types/5.1" />
3
3
  /// <reference types="@typescript-to-lua/language-extensions" />
4
4
 
5
- // DEFOLD. stable version 1.9.2 (3251ca82359cf238a1074e383281e3126547d50b)
5
+ // DEFOLD. stable version 1.9.4 (512763fd375633fd67197225e61fe90a5929166b)
6
6
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
7
7
 
8
8
 
@@ -10,6 +10,9 @@ declare type hash = {
10
10
  }
11
11
 
12
12
  declare type url = {
13
+ socket: hash,
14
+ path: hash,
15
+ fragment: hash,
13
16
  }
14
17
 
15
18
  declare type node = {
@@ -3918,7 +3921,7 @@ Set to `true` to return all ray cast hits. If `false`, it will only return the c
3918
3921
  * @param from the world position of the start of the ray
3919
3922
  * @param to the world position of the end of the ray
3920
3923
  * @param groups a lua table containing the hashed groups for which to test collisions against
3921
- * @param request_id a number between [0,-255]. It will be sent back in the response for identification, 0 by default
3924
+ * @param request_id a number in range [0,255]. It will be sent back in the response for identification, 0 by default
3922
3925
  */
3923
3926
  export function raycast_async(from: vmath.vector3, to: vmath.vector3, groups: any, request_id?: number): void
3924
3927
 
@@ -6140,6 +6143,61 @@ The stack traceback.
6140
6143
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
6141
6144
 
6142
6145
 
6146
+ declare namespace types {
6147
+
6148
+ /**
6149
+ * Check if passed type is hash.
6150
+ * @param v Variable to check type
6151
+ * @return result True if passed type is hash
6152
+ */
6153
+ export function is_hash(v: any): boolean
6154
+
6155
+ /**
6156
+ * Check if passed type is matrix4.
6157
+ * @param v Variable to check type
6158
+ * @return result True if passed type is matrix4
6159
+ */
6160
+ export function is_matrix4(v: any): boolean
6161
+
6162
+ /**
6163
+ * Check if passed type is quaternion.
6164
+ * @param v Variable to check type
6165
+ * @return result True if passed type is quaternion
6166
+ */
6167
+ export function is_quat(v: any): boolean
6168
+
6169
+ /**
6170
+ * Check if passed type is URL.
6171
+ * @param v Variable to check type
6172
+ * @return result True if passed type is URL
6173
+ */
6174
+ export function is_url(v: any): boolean
6175
+
6176
+ /**
6177
+ * Check if passed type is vector.
6178
+ * @param v Variable to check type
6179
+ * @return result True if passed type is vector
6180
+ */
6181
+ export function is_vector(v: any): boolean
6182
+
6183
+ /**
6184
+ * Check if passed type is vector3.
6185
+ * @param v Variable to check type
6186
+ * @return result True if passed type is vector3
6187
+ */
6188
+ export function is_vector3(v: any): boolean
6189
+
6190
+ /**
6191
+ * Check if passed type is vector4.
6192
+ * @param v Variable to check type
6193
+ * @return result True if passed type is vector4
6194
+ */
6195
+ export function is_vector4(v: any): boolean
6196
+
6197
+ }
6198
+ // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
6199
+
6200
+
6143
6201
  declare namespace window {
6144
6202
 
6145
6203
  /**
@@ -6436,6 +6494,8 @@ The response data. Contains the fields:
6436
6494
  `headers`: all the returned headers
6437
6495
  `path`: the stored path (if saved to disc)
6438
6496
  `error`: if any unforeseen errors occurred (e.g. file I/O)
6497
+ `bytes_received`: the amount of bytes received/sent for a request, only if option `report_progress` is true
6498
+ `bytes_total`: the total amount of bytes for a request, only if option `report_progress` is true
6439
6499
 
6440
6500
  * @param headers optional table with custom headers
6441
6501
  * @param post_data optional data to send
@@ -6445,6 +6505,7 @@ The response data. Contains the fields:
6445
6505
  Path should be absolute
6446
6506
  Not available in HTML5 build
6447
6507
  Not available in HTML5 build
6508
+ `report_progress`: when it is true, the amount of bytes sent and/or received for a request will be passed into the callback function
6448
6509
 
6449
6510
  */
6450
6511
  export function request(url: string, method: string, callback: any, headers?: any, post_data?: string, options?: any): void
@@ -6636,7 +6697,7 @@ declare namespace timer {
6636
6697
  * @param handle the timer handle returned by timer.delay()
6637
6698
  * @return true if the timer was active, false if the timer is already cancelled / complete
6638
6699
  */
6639
- export function cancel(handle: hash): boolean
6700
+ export function cancel(handle: any): boolean
6640
6701
 
6641
6702
  /**
6642
6703
  * Adds a timer and returns a unique handle.
@@ -6646,7 +6707,7 @@ declare namespace timer {
6646
6707
  * If you want a timer that triggers on each frame, set delay to 0.0f and repeat to true.
6647
6708
  * Timers created within a script will automatically die when the script is deleted.
6648
6709
  * @param delay time interval in seconds
6649
- * @param repeat true = repeat timer until cancel, false = one-shot timer
6710
+ * @param repeating true = repeat timer until cancel, false = one-shot timer
6650
6711
  * @param callback timer callback function
6651
6712
 
6652
6713
  `self`
@@ -6658,7 +6719,7 @@ The elapsed time - on first trigger it is time since timer.delay call, otherwise
6658
6719
 
6659
6720
  * @return handle identifier for the create timer, returns timer.INVALID_TIMER_HANDLE if the timer can not be created
6660
6721
  */
6661
- export function delay(delay: number, repeat: boolean, callback: any): hash
6722
+ export function delay(delay: number, repeating: boolean, callback: any): any
6662
6723
 
6663
6724
  /**
6664
6725
  * Get information about timer.
@@ -6673,14 +6734,14 @@ Time interval.
6673
6734
  true = repeat timer until cancel, false = one-shot timer.
6674
6735
 
6675
6736
  */
6676
- export function get_info(handle: hash): LuaMultiReturn<[any, any]>
6737
+ export function get_info(handle: any): LuaMultiReturn<[any, any]>
6677
6738
 
6678
6739
  /**
6679
6740
  * Manual triggering a callback for a timer.
6680
6741
  * @param handle the timer handle returned by timer.delay()
6681
6742
  * @return true if the timer was active, false if the timer is already cancelled / complete
6682
6743
  */
6683
- export function trigger(handle: hash): boolean
6744
+ export function trigger(handle: any): boolean
6684
6745
 
6685
6746
  }
6686
6747
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
@@ -6688,6 +6749,19 @@ true = repeat timer until cancel, false = one-shot timer.
6688
6749
 
6689
6750
  declare namespace vmath {
6690
6751
 
6752
+ /**
6753
+ * Clamp input value to be in range of [min, max]. In case if input value has vector3|vector4 type
6754
+ * return new vector3|vector4 with clamped value at every vector's element.
6755
+ * Min/max arguments can be vector3|vector4. In that case clamp excuted per every vector's element
6756
+ * @param value Input value or vector of values
6757
+ * @param min Min value(s) border
6758
+ * @param max Max value(s) border
6759
+ * @return clamped_value Clamped value or vector
6760
+ */
6761
+ export function clamp(value: number, min: number, max: number): number
6762
+ export function clamp(value: vmath.vector3, min: vmath.vector3, max: vmath.vector3): vmath.vector3
6763
+ export function clamp(value: vmath.vector4, min: vmath.vector4, max: vmath.vector4): vmath.vector4
6764
+
6691
6765
  /**
6692
6766
  * Calculates the conjugate of a quaternion. The result is a
6693
6767
  * quaternion with the same magnitudes but with the sign of
@@ -6817,11 +6891,14 @@ declare namespace vmath {
6817
6891
  export function matrix4_axis_angle(v: vmath.vector3, angle: number): vmath.matrix4
6818
6892
 
6819
6893
  /**
6820
- * The resulting matrix describes the same rotation as the quaternion, but does not have any translation (also like the quaternion).
6821
- * @param q quaternion to create matrix from
6822
- * @return m matrix represented by quaternion
6894
+ * Creates a new matrix constructed from separate
6895
+ * translation vector, roation quaternion and scale vector
6896
+ * @param translation translation
6897
+ * @param rotation rotation
6898
+ * @param scale scale
6899
+ * @return matrix new matrix4
6823
6900
  */
6824
- export function matrix4_from_quat(q: vmath.quaternion): vmath.matrix4
6901
+ export function matrix4_compose(translation: any, rotation: vmath.quaternion, scale: vmath.vector3): vmath.matrix4
6825
6902
 
6826
6903
  /**
6827
6904
  * Constructs a frustum matrix from the given values. The left, right,
@@ -6873,6 +6950,13 @@ declare namespace vmath {
6873
6950
  */
6874
6951
  export function matrix4_perspective(fov: number, aspect: number, near: number, far: number): vmath.matrix4
6875
6952
 
6953
+ /**
6954
+ * The resulting matrix describes the same rotation as the quaternion, but does not have any translation (also like the quaternion).
6955
+ * @param q quaternion to create matrix from
6956
+ * @return m matrix represented by quaternion
6957
+ */
6958
+ export function matrix4_quat(q: vmath.quaternion): vmath.matrix4
6959
+
6876
6960
  /**
6877
6961
  * The resulting matrix describes a rotation around the x-axis
6878
6962
  * by the specified angle.
@@ -6897,6 +6981,29 @@ declare namespace vmath {
6897
6981
  */
6898
6982
  export function matrix4_rotation_z(angle: number): vmath.matrix4
6899
6983
 
6984
+ /**
6985
+ * Creates a new matrix constructed from scale vector
6986
+ * @param scale scale
6987
+ * @return matrix new matrix4
6988
+ */
6989
+ export function matrix4_scale(scale: vmath.vector3): vmath.matrix4
6990
+
6991
+ /**
6992
+ * creates a new matrix4 from uniform scale
6993
+ * @param scale scale
6994
+ * @return matrix new matrix4
6995
+ */
6996
+ export function matrix4_scale(scale: number): vmath.matrix4
6997
+
6998
+ /**
6999
+ * Creates a new matrix4 from three scale components
7000
+ * @param scale_x scale along X axis
7001
+ * @param scale_y sclae along Y axis
7002
+ * @param scale_z scale along Z asis
7003
+ * @return matrix new matrix4
7004
+ */
7005
+ export function matrix4_scale(scale_x: number, scale_y: number, scale_z: number): vmath.matrix4
7006
+
6900
7007
  /**
6901
7008
  * The resulting matrix describes a translation of a point
6902
7009
  * in euclidean space.
@@ -7010,6 +7117,14 @@ declare namespace vmath {
7010
7117
  */
7011
7118
  export function quat_from_to(v1: vmath.vector3, v2: vmath.vector3): vmath.quaternion
7012
7119
 
7120
+ /**
7121
+ * Creates a new quaternion with the components set
7122
+ * according to the supplied parameter values.
7123
+ * @param matrix source matrix4
7124
+ * @return q new quaternion
7125
+ */
7126
+ export function quat_matrix4(matrix: vmath.matrix4): vmath.quaternion
7127
+
7013
7128
  /**
7014
7129
  * The resulting quaternion describes a rotation of `angle`
7015
7130
  * radians around the x-axis.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-defold/types",
3
- "version": "1.2.50",
3
+ "version": "1.2.52",
4
4
  "description": "TypeScript definitions for Defold",
5
5
  "repository": "github:ts-defold/types",
6
6
  "keywords": [
@@ -27,7 +27,7 @@
27
27
  "lua-types": "^2.10.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@ts-defold/type-gen": "^0.5.3",
30
+ "@ts-defold/type-gen": "^0.5.6",
31
31
  "typescript": "~5.1.0",
32
32
  "typescript-to-lua": "~1.16.0"
33
33
  },