blockbench-types 5.1.0-beta.0-next.6 → 5.1.0-beta.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.
Files changed (61) hide show
  1. package/README.md +30 -30
  2. package/custom/animation.d.ts +254 -253
  3. package/custom/animation_controller.d.ts +124 -124
  4. package/custom/blockbench.d.ts +73 -73
  5. package/custom/canvas.d.ts +307 -307
  6. package/custom/codec.d.ts +180 -180
  7. package/custom/copy_paste.d.ts +42 -42
  8. package/custom/cube.d.ts +151 -151
  9. package/custom/desktop.d.ts +73 -73
  10. package/custom/display_mode.d.ts +137 -137
  11. package/custom/edit_session.d.ts +37 -37
  12. package/custom/global.d.ts +168 -168
  13. package/custom/group.d.ts +113 -113
  14. package/custom/interface.d.ts +78 -78
  15. package/custom/io.d.ts +12 -12
  16. package/custom/keyframe.d.ts +94 -94
  17. package/custom/libs.d.ts +13 -13
  18. package/custom/math_util.d.ts +1 -1
  19. package/custom/menu.d.ts +136 -136
  20. package/custom/mesh.d.ts +196 -196
  21. package/custom/misc.d.ts +198 -187
  22. package/custom/molang.d.ts +159 -159
  23. package/custom/outliner.d.ts +157 -158
  24. package/custom/painter.d.ts +69 -69
  25. package/custom/preview.d.ts +133 -133
  26. package/custom/preview_scene.d.ts +120 -120
  27. package/custom/screencam.d.ts +71 -71
  28. package/custom/spline_mesh.d.ts +189 -189
  29. package/custom/start_screen.d.ts +14 -14
  30. package/custom/texture_group.d.ts +68 -68
  31. package/custom/texture_layers.d.ts +117 -117
  32. package/custom/textures.d.ts +513 -513
  33. package/custom/timeline.d.ts +66 -66
  34. package/custom/toolbars.d.ts +221 -221
  35. package/custom/undo.d.ts +208 -208
  36. package/custom/util/version_util.d.ts +32 -32
  37. package/custom/util.d.ts +225 -225
  38. package/custom/uveditor.d.ts +3 -3
  39. package/custom/validator.d.ts +99 -99
  40. package/documentation.md +12 -12
  41. package/generated/api.d.ts +15 -10
  42. package/generated/global_types.d.ts +47 -0
  43. package/generated/interface/keyboard.d.ts +1 -0
  44. package/generated/io/formats/bedrock.d.ts +4 -0
  45. package/generated/io/formats/bedrock_old.d.ts +4 -0
  46. package/generated/io/formats/collada.d.ts +4 -0
  47. package/generated/io/formats/fbx.d.ts +17 -0
  48. package/generated/io/formats/gltf.d.ts +6 -0
  49. package/generated/io/formats/java_block.d.ts +4 -0
  50. package/generated/io/formats/modded_entity.d.ts +139 -0
  51. package/generated/io/formats/obj.d.ts +12 -0
  52. package/generated/io/formats/optifine_jem.d.ts +3 -0
  53. package/generated/io/formats/optifine_jpm.d.ts +3 -0
  54. package/generated/io/formats/skin.d.ts +22 -0
  55. package/generated/marker_colors.d.ts +14 -0
  56. package/generated/modeling/mesh/knife_tool.d.ts +2 -2
  57. package/generated/preview/reference_images.d.ts +1 -0
  58. package/index.d.ts +2 -2
  59. package/package.json +39 -39
  60. package/tsconfig.json +19 -19
  61. package/type_config.json +46 -46
package/README.md CHANGED
@@ -1,30 +1,30 @@
1
- # Blockbench Typescript Types!
2
-
3
- ## Generated types
4
- All type definitions in the folder /generated/ are auto-generated from the Blockbench source.
5
- All exports are converted to global declarations.
6
- To exclude source files from generating types, add them to the "exclude" list in type_config.json.
7
- To exclude individual exports, use the typescript @private flag.
8
-
9
- ## Custom types
10
- All type definitions in the /custom/ folder are manually written and are intended to provide types for old files that are still in Javascript.
11
-
12
-
13
- ## Generating types
14
- Run `npm run generate-types` from the main repo. Ensure typescript throws no errors, otherwise files won't export correctly.
15
-
16
- ## Locally testing and using types
17
- To use these types in other projects on your local PC before they are published, run this command in your other project:
18
-
19
- `npm install "C:/path/to/blockbench/types"`
20
-
21
- Where the path leads to this /types/ folder in the Blockbench repository.
22
-
23
- ## Publishing types
24
-
25
- `npm run publish-types --dry-run`
26
-
27
- `npm run publish-types --tag beta`
28
-
29
- `npm run publish-types`
30
-
1
+ # Blockbench Typescript Types!
2
+
3
+ ## Generated types
4
+ All type definitions in the folder /generated/ are auto-generated from the Blockbench source.
5
+ All exports are converted to global declarations.
6
+ To exclude source files from generating types, add them to the "exclude" list in type_config.json.
7
+ To exclude individual exports, use the typescript @private flag.
8
+
9
+ ## Custom types
10
+ All type definitions in the /custom/ folder are manually written and are intended to provide types for old files that are still in Javascript.
11
+
12
+
13
+ ## Generating types
14
+ Run `npm run generate-types` from the main repo. Ensure typescript throws no errors, otherwise files won't export correctly.
15
+
16
+ ## Locally testing and using types
17
+ To use these types in other projects on your local PC before they are published, run this command in your other project:
18
+
19
+ `npm install "C:/path/to/blockbench/types"`
20
+
21
+ Where the path leads to this /types/ folder in the Blockbench repository.
22
+
23
+ ## Publishing types
24
+
25
+ `npm run publish-types --dry-run`
26
+
27
+ `npm run publish-types --tag beta`
28
+
29
+ `npm run publish-types`
30
+
@@ -1,253 +1,254 @@
1
- /// <reference types="./blockbench"/>
2
-
3
- declare class AnimationItem {
4
- static all: _Animation[]
5
- static selected: _Animation | null
6
- getUndoCopy?(options?: any, save?: any): AnimationOptions
7
- }
8
-
9
- interface AnimationOptions {
10
- name?: string
11
- uuid?: string
12
- path?: string
13
- loop?: 'once' | 'hold' | 'loop'
14
- override?: boolean
15
- anim_time_update?: string
16
- blend_weight?: string
17
- length?: number
18
- snapping?: number
19
- animators?: any
20
- }
21
-
22
- interface AnimationUndoCopy {
23
- uuid: any
24
- name: any
25
- loop: any
26
- override: any
27
- anim_time_update: any
28
- blend_weight: any
29
- length: any
30
- snapping: any
31
- selected: any
32
- }
33
-
34
- /**
35
- *
36
- * ⚠️ This will not provide correct type information! ⚠️
37
- *
38
- * Use {@link Blockbench.Animation} instead for TypeScript support.
39
- *
40
- * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
41
- * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
42
- */
43
- interface Animation {}
44
-
45
- /**
46
- * ⚠️ THIS IS TYPE ONLY ⚠️
47
- *
48
- * **It does not exist** in Blockbench at Run-time. Use {@link Blockbench.Animation} instead.
49
- *
50
- * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
51
- * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
52
- *
53
- * @deprecated
54
- */
55
- declare class _Animation extends AnimationItem {
56
- constructor(data?: AnimationOptions)
57
- extend(data?: AnimationOptions): this
58
- getUndoCopy(options?: {}, save?: any): AnimationUndoCopy
59
- /**
60
- * Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
61
- * @deprecated
62
- */
63
- compileBedrockAnimation(): any
64
- save(): this | undefined
65
- select(): this | undefined
66
- setLength(length?: number): void
67
- createUniqueName(references: _Animation[]): any
68
- rename(): this
69
- togglePlayingState(state: any): any
70
- showContextMenu(event: any): this
71
- /**
72
- * Returns (if necessary creates) the animator of a specific outliner node of this animation
73
- */
74
- getBoneAnimator(node?: OutlinerNode): BoneAnimator
75
- removeAnimator(id: string): void
76
- /**
77
- * Adds the animation to the current project and to the interface
78
- * @param undo If true, the addition of the animation will be registered as an edit
79
- */
80
- add(undo?: boolean): this
81
- remove(undo: boolean, remove_from_file?: boolean): this
82
- getMaxLength(): number
83
- setLoop(value: any, undo: any): void
84
- /**
85
- * Calculate the snapping value that the animation should use, based on the time codes of the keyframes that it holds. Directly updates the value, but also returns it as a number (snaps per second)
86
- */
87
- calculateSnappingFromKeyframes(): number
88
- /**
89
- * Opens the properties dialog
90
- */
91
- propertiesDialog(): void
92
-
93
- name: string
94
- uuid: string
95
- loop: 'once' | 'hold' | 'loop'
96
- override: boolean
97
- anim_time_update: string
98
- blend_weight: string
99
- length: number
100
- snapping: number
101
- loop_delay: string
102
- start_delay: string
103
- path: string
104
- playing: boolean
105
- saved: boolean
106
- time: number
107
-
108
- effects?: EffectAnimator
109
-
110
- markers: TimelineMarker[]
111
- animators: {
112
- [id: string]: GeneralAnimator
113
- }
114
- saved_name?: string
115
- selected: boolean
116
- type: string
117
- menu: Menu
118
- file_menu: Menu
119
- }
120
-
121
- interface MolangAutoCompletionItem {
122
- text: string
123
- label: string | undefined
124
- overlap: number
125
- }
126
-
127
- declare namespace Animator {
128
- const open: boolean
129
- const MolangParser: Molang
130
- const possible_channels: unknown[]
131
- const motion_trail: THREE.Object3D
132
- const motion_trail_lock: boolean
133
- const particle_effects: any
134
- const animations: _Animation[]
135
- const selected: _Animation | undefined
136
- function join(): void
137
- function leave(): void
138
- function showDefaultPose(no_matrix_update?: boolean): void
139
- function resetParticles(): void
140
- function showMotionTrail(target?: Group): void
141
- /**
142
- * Updates the preview based on the current time
143
- */
144
- function preview(in_loop?: boolean): void
145
- function loadParticleEmitter(path: string, content: string): void
146
- /**
147
- * Import a Bedrock animation file
148
- * @param file File any
149
- * @param animation_filter List of names of animations to import
150
- * @deprecated AnimationCodec should be used instead
151
- */
152
- function loadFile(file: any, animation_filter?: string[]): void
153
- /**
154
- * @deprecated AnimationCodec should be used instead
155
- */
156
- function exportAnimationFile(path: string, save_as?: boolean): void
157
- /**
158
- * @deprecated AnimationCodec should be used instead
159
- */
160
- function exportAnimationControllerFile(path: string, save_as?: boolean): void
161
- /**
162
- * @deprecated AnimationCodec should be used instead
163
- */
164
- function resetLastValues(): void
165
- function autocompleteMolang(
166
- text: string,
167
- position: number,
168
- type: string
169
- ): MolangAutoCompletionItem[]
170
- }
171
-
172
- interface AddChannelOptions {
173
- name?: string
174
- transform?: boolean
175
- mutable?: boolean
176
- max_data_points?: number
177
- condition?: ConditionResolvable
178
- displayFrame?: (animator: GeneralAnimator, multiplier: number) => void
179
- }
180
- interface Channel {
181
- name: string
182
- transform: boolean
183
- mutable: boolean
184
- max_data_points: number
185
- }
186
- declare class GeneralAnimator {
187
- constructor(uuid: string | null, animation: _Animation, name: string)
188
- uuid: string
189
- keyframes: _Keyframe[]
190
- animation: _Animation
191
- expanded: boolean
192
- selected: boolean
193
- select(): this
194
- addToTimeline(): this
195
- addKeyframe(data: KeyframeOptions, uuid?: string): _Keyframe
196
- createKeyframe(): _Keyframe
197
- getOrMakeKeyframe(): { before: _Keyframe; result: _Keyframe }
198
- toggleMuted(channel: string): this
199
- scrollTo(): this
200
-
201
- static addChannel(channel: string, options: AddChannelOptions): void
202
- channels: {
203
- [channel: string]: Channel
204
- }
205
- muted: {
206
- [channel: string]: boolean | undefined
207
- };
208
- [channel: string]: any
209
- }
210
-
211
- declare class BoneAnimator extends GeneralAnimator {
212
- name: string
213
- uuid: string
214
- rotations: _Keyframe[]
215
- position: _Keyframe[]
216
- scale: _Keyframe[]
217
- getGroup(): Group
218
- fillValues(): void
219
- pushKeyframe(): void
220
- doRender(): boolean
221
- displayRotation(arr?: ArrayVector3 | ArrayVector4, multiplier?: number): void
222
- displayPosition(arr?: ArrayVector3, multiplier?: number): this
223
- displayScale(arr?: ArrayVector3, multiplier?: number): void
224
- interpolate(channel: string, allow_expression?: boolean, axis?: string): ArrayVector3 | false
225
- displayFrame(multiplier?: number): void
226
- }
227
- declare class NullObjectAnimator extends GeneralAnimator {
228
- name: string
229
- uuid: string
230
- rotations: _Keyframe[]
231
- position: _Keyframe[]
232
- scale: _Keyframe[]
233
- getElement(): NullObject
234
- doRender(): void
235
- displayIK(): void
236
- displayFrame(): void
237
- }
238
- declare class EffectAnimator extends GeneralAnimator {
239
- constructor(animation: _Animation)
240
- name: string
241
- uuid: string
242
- rotations: _Keyframe[]
243
- position: _Keyframe[]
244
- scale: _Keyframe[]
245
- pushKeyframe(keyframe: _Keyframe): this
246
- displayFrame(in_loop?: boolean): void
247
- startPreviousSounds(): void
248
- }
249
-
250
- declare class TimelineMarker {
251
- color: number
252
- time: number
253
- }
1
+ /// <reference types="./blockbench"/>
2
+
3
+ declare class AnimationItem {
4
+ static all: _Animation[]
5
+ static selected: _Animation | null
6
+ getUndoCopy?(options?: any, save?: any): AnimationOptions
7
+ }
8
+
9
+ interface AnimationOptions {
10
+ name?: string
11
+ uuid?: string
12
+ path?: string
13
+ loop?: 'once' | 'hold' | 'loop'
14
+ override?: boolean
15
+ anim_time_update?: string
16
+ blend_weight?: string
17
+ length?: number
18
+ snapping?: number
19
+ animators?: any
20
+ }
21
+
22
+ interface AnimationUndoCopy {
23
+ uuid: any
24
+ name: any
25
+ loop: any
26
+ override: any
27
+ anim_time_update: any
28
+ blend_weight: any
29
+ length: any
30
+ snapping: any
31
+ selected: any
32
+ }
33
+
34
+ /**
35
+ *
36
+ * ⚠️ This will not provide correct type information! ⚠️
37
+ *
38
+ * Use {@link Blockbench.Animation} instead for TypeScript support.
39
+ *
40
+ * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
41
+ * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
42
+ */
43
+ interface Animation {}
44
+
45
+ /**
46
+ * ⚠️ THIS IS TYPE ONLY ⚠️
47
+ *
48
+ * **It does not exist** in Blockbench at Run-time. Use {@link Blockbench.Animation} instead.
49
+ *
50
+ * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
51
+ * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
52
+ *
53
+ * @deprecated
54
+ */
55
+ declare class _Animation extends AnimationItem {
56
+ constructor(data?: AnimationOptions)
57
+ extend(data?: AnimationOptions): this
58
+ getUndoCopy(options?: {}, save?: any): AnimationUndoCopy
59
+ /**
60
+ * Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
61
+ * @deprecated
62
+ */
63
+ compileBedrockAnimation(): any
64
+ save(): this | undefined
65
+ select(): this | undefined
66
+ setLength(length?: number): void
67
+ createUniqueName(references: _Animation[]): any
68
+ rename(): this
69
+ togglePlayingState(state: any): any
70
+ showContextMenu(event: any): this
71
+ /**
72
+ * Returns (if necessary creates) the animator of a specific outliner node of this animation
73
+ */
74
+ getBoneAnimator(node?: OutlinerNode): BoneAnimator
75
+ removeAnimator(id: string): void
76
+ /**
77
+ * Adds the animation to the current project and to the interface
78
+ * @param undo If true, the addition of the animation will be registered as an edit
79
+ */
80
+ add(undo?: boolean): this
81
+ remove(undo: boolean, remove_from_file?: boolean): this
82
+ getMaxLength(): number
83
+ setLoop(value: any, undo: any): void
84
+ /**
85
+ * Calculate the snapping value that the animation should use, based on the time codes of the keyframes that it holds. Directly updates the value, but also returns it as a number (snaps per second)
86
+ */
87
+ calculateSnappingFromKeyframes(): number
88
+ /**
89
+ * Opens the properties dialog
90
+ */
91
+ propertiesDialog(): void
92
+
93
+ name: string
94
+ uuid: string
95
+ loop: 'once' | 'hold' | 'loop'
96
+ override: boolean
97
+ anim_time_update: string
98
+ blend_weight: string
99
+ length: number
100
+ snapping: number
101
+ loop_delay: string
102
+ start_delay: string
103
+ path: string
104
+ playing: boolean
105
+ saved: boolean
106
+ time: number
107
+
108
+ effects?: EffectAnimator
109
+
110
+ markers: TimelineMarker[]
111
+ animators: {
112
+ [id: string]: GeneralAnimator
113
+ }
114
+ saved_name?: string
115
+ selected: boolean
116
+ type: string
117
+ menu: Menu
118
+ file_menu: Menu
119
+ }
120
+
121
+ interface MolangAutoCompletionItem {
122
+ text: string
123
+ label: string | undefined
124
+ overlap: number
125
+ }
126
+
127
+ declare namespace Animator {
128
+ const open: boolean
129
+ const MolangParser: Molang
130
+ const possible_channels: unknown[]
131
+ const motion_trail: THREE.Object3D
132
+ const motion_trail_lock: boolean
133
+ const particle_effects: any
134
+ const animations: _Animation[]
135
+ const selected: _Animation | undefined
136
+ function join(): void
137
+ function leave(): void
138
+ function showDefaultPose(no_matrix_update?: boolean): void
139
+ function resetParticles(): void
140
+ function showMotionTrail(target?: Group): void
141
+ /**
142
+ * Updates the preview based on the current time
143
+ */
144
+ function preview(in_loop?: boolean): void
145
+ function loadParticleEmitter(path: string, content: string): void
146
+ /**
147
+ * Import a Bedrock animation file
148
+ * @param file File any
149
+ * @param animation_filter List of names of animations to import
150
+ * @deprecated AnimationCodec should be used instead
151
+ */
152
+ function loadFile(file: any, animation_filter?: string[]): void
153
+ /**
154
+ * @deprecated AnimationCodec should be used instead
155
+ */
156
+ function exportAnimationFile(path: string, save_as?: boolean): void
157
+ /**
158
+ * @deprecated AnimationCodec should be used instead
159
+ */
160
+ function exportAnimationControllerFile(path: string, save_as?: boolean): void
161
+ /**
162
+ * @deprecated AnimationCodec should be used instead
163
+ */
164
+ function resetLastValues(): void
165
+ function autocompleteMolang(
166
+ text: string,
167
+ position: number,
168
+ type: string
169
+ ): MolangAutoCompletionItem[]
170
+ }
171
+
172
+ interface AddChannelOptions {
173
+ name?: string
174
+ transform?: boolean
175
+ mutable?: boolean
176
+ max_data_points?: number
177
+ condition?: ConditionResolvable<GeneralAnimator>
178
+ displayFrame?: (animator: GeneralAnimator, multiplier: number) => void
179
+ }
180
+ interface Channel {
181
+ name: string
182
+ transform: boolean
183
+ mutable: boolean
184
+ max_data_points: number
185
+ condition?: ConditionResolvable<GeneralAnimator>
186
+ }
187
+ declare class GeneralAnimator {
188
+ constructor(uuid: string | null, animation: _Animation, name: string)
189
+ uuid: string
190
+ keyframes: _Keyframe[]
191
+ animation: _Animation
192
+ expanded: boolean
193
+ selected: boolean
194
+ select(): this
195
+ addToTimeline(): this
196
+ addKeyframe(data: KeyframeOptions, uuid?: string): _Keyframe
197
+ createKeyframe(): _Keyframe
198
+ getOrMakeKeyframe(): { before: _Keyframe; result: _Keyframe }
199
+ toggleMuted(channel: string): this
200
+ scrollTo(): this
201
+
202
+ static addChannel(channel: string, options: AddChannelOptions): void
203
+ channels: {
204
+ [channel: string]: Channel
205
+ }
206
+ muted: {
207
+ [channel: string]: boolean | undefined
208
+ };
209
+ [channel: string]: any
210
+ }
211
+
212
+ declare class BoneAnimator extends GeneralAnimator {
213
+ name: string
214
+ uuid: string
215
+ rotations: _Keyframe[]
216
+ position: _Keyframe[]
217
+ scale: _Keyframe[]
218
+ getGroup(): Group
219
+ fillValues(): void
220
+ pushKeyframe(): void
221
+ doRender(): boolean
222
+ displayRotation(arr?: ArrayVector3 | ArrayVector4, multiplier?: number): void
223
+ displayPosition(arr?: ArrayVector3, multiplier?: number): this
224
+ displayScale(arr?: ArrayVector3, multiplier?: number): void
225
+ interpolate(channel: string, allow_expression?: boolean, axis?: string): ArrayVector3 | false
226
+ displayFrame(multiplier?: number): void
227
+ }
228
+ declare class NullObjectAnimator extends GeneralAnimator {
229
+ name: string
230
+ uuid: string
231
+ rotations: _Keyframe[]
232
+ position: _Keyframe[]
233
+ scale: _Keyframe[]
234
+ getElement(): NullObject
235
+ doRender(): void
236
+ displayIK(): void
237
+ displayFrame(): void
238
+ }
239
+ declare class EffectAnimator extends GeneralAnimator {
240
+ constructor(animation: _Animation)
241
+ name: string
242
+ uuid: string
243
+ rotations: _Keyframe[]
244
+ position: _Keyframe[]
245
+ scale: _Keyframe[]
246
+ pushKeyframe(keyframe: _Keyframe): this
247
+ displayFrame(in_loop?: boolean): void
248
+ startPreviousSounds(): void
249
+ }
250
+
251
+ declare class TimelineMarker {
252
+ color: number
253
+ time: number
254
+ }