blockbench-types 4.9.0 → 4.10.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.
- package/.prettierignore +1 -0
- package/.prettierrc.json +9 -0
- package/README.md +1 -0
- package/package.json +43 -33
- package/scripts/generate_docs.js +243 -196
- package/tsconfig.json +13 -14
- package/types/action.d.ts +358 -279
- package/types/animation.d.ts +181 -147
- package/types/animation_controller.d.ts +105 -99
- package/types/blockbench.d.ts +136 -76
- package/types/canvas.d.ts +239 -228
- package/types/canvas_frame.d.ts +2 -2
- package/types/codec.d.ts +36 -32
- package/types/cube.d.ts +32 -11
- package/types/desktop.d.ts +14 -0
- package/types/dialog.d.ts +143 -38
- package/types/display_mode.d.ts +9 -6
- package/types/file_system.d.ts +159 -0
- package/types/format.d.ts +46 -12
- package/types/global.d.ts +49 -3
- package/types/group.d.ts +16 -5
- package/types/index.d.ts +1 -0
- package/types/interface.d.ts +21 -12
- package/types/io.d.ts +2 -2
- package/types/keyframe.d.ts +72 -58
- package/types/legacy.d.ts +2 -1
- package/types/math_util.d.ts +1 -1
- package/types/menu.d.ts +93 -78
- package/types/mesh.d.ts +89 -64
- package/types/misc.d.ts +114 -47
- package/types/mode.d.ts +14 -1
- package/types/molang.d.ts +17 -0
- package/types/outliner.d.ts +42 -23
- package/types/painter.d.ts +49 -11
- package/types/panel.d.ts +49 -21
- package/types/plugin.d.ts +28 -0
- package/types/preview.d.ts +71 -69
- package/types/preview_scene.d.ts +11 -12
- package/types/project.d.ts +54 -37
- package/types/screencam.d.ts +11 -6
- package/types/settings.d.ts +87 -85
- package/types/shared_actions.d.ts +25 -9
- package/types/texture_layers.d.ts +104 -105
- package/types/textures.d.ts +322 -313
- package/types/timeline.d.ts +60 -60
- package/types/undo.d.ts +107 -103
- package/types/util.d.ts +152 -37
- package/types/uveditor.d.ts +3 -0
- package/types/validator.d.ts +3 -2
- package/types/vue.d.ts +7 -0
package/types/menu.d.ts
CHANGED
|
@@ -1,96 +1,111 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
interface CustomMenuItem {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
name: string
|
|
4
|
+
id: string
|
|
5
|
+
icon: IconString
|
|
6
|
+
color?: string
|
|
7
|
+
description?: string
|
|
8
|
+
/**
|
|
9
|
+
* Keybind or string to display in the menu, won't work as an actual keybinding by default
|
|
10
|
+
*/
|
|
11
|
+
keybind?: Keybind | string
|
|
12
|
+
/**
|
|
13
|
+
* Adds a search bar to the menu or submenu
|
|
14
|
+
*/
|
|
15
|
+
searchable?: boolean
|
|
16
|
+
children?: MenuItem[] | (() => MenuItem[])
|
|
17
|
+
click?(context?: any, event?: Event): void
|
|
17
18
|
}
|
|
18
|
-
type MenuItem = CustomMenuItem | Action | BarSelect | string
|
|
19
|
+
type MenuItem = CustomMenuItem | Action | BarSelect | MenuSeparator | string
|
|
19
20
|
interface MenuOptions {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
onOpen?(position: MouseEvent | HTMLElement, context?: any): void
|
|
22
|
+
onClose?(): void
|
|
23
|
+
keep_open?: boolean
|
|
24
|
+
searchable?: boolean
|
|
25
|
+
class?: string
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Use the Menu class to create a context menu. Menus can contain custom entries and hierarchy, or existing actions and tools.
|
|
27
29
|
*/
|
|
28
30
|
declare class Menu extends Deletable {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new context menu
|
|
33
|
+
*/
|
|
34
|
+
constructor(
|
|
35
|
+
id: string,
|
|
36
|
+
template: MenuItem[] | ((context?: any) => MenuItem[]),
|
|
37
|
+
options?: MenuOptions
|
|
38
|
+
)
|
|
39
|
+
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Opens the menu somewhere
|
|
43
|
+
* @param position Position where to open the menu. Can be a mouse event, or a node that the menu is spawned below.
|
|
44
|
+
* @param context Context for the click events inside the menu
|
|
45
|
+
*/
|
|
46
|
+
open(position: MouseEvent | HTMLElement, context?: any): this
|
|
47
|
+
/**
|
|
48
|
+
* Closes the menu if it's open
|
|
49
|
+
*/
|
|
50
|
+
hide(): this
|
|
51
|
+
/**
|
|
52
|
+
* Adds an action to the menu structure
|
|
53
|
+
* @param action Action to add
|
|
54
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, separated by a point. For example, `export.0` places the action at the top position of the Export submenu.
|
|
55
|
+
*/
|
|
56
|
+
addAction(action: Action, path?: string | number): void
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, or item ID, separated by a point. For example, `export.export_special_format` removes the action "Export Special Format" from the Export submenu.
|
|
60
|
+
*/
|
|
61
|
+
removeAction(path: string): void
|
|
62
|
+
structure: MenuItem[]
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
/**
|
|
56
66
|
* Creates a new menu in the menu bar
|
|
57
67
|
*/
|
|
58
68
|
declare class BarMenu extends Menu {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
constructor(id: string, structure: MenuItem[], condition?: ConditionResolvable)
|
|
70
|
+
type: 'bar_menu'
|
|
71
|
+
id: string
|
|
72
|
+
condition?: ConditionResolvable
|
|
73
|
+
name: string
|
|
74
|
+
structure: MenuItem[]
|
|
75
|
+
/**
|
|
76
|
+
* Visually highlights an action within the menu, until the user opens the menu
|
|
77
|
+
*/
|
|
78
|
+
highlight(action: Action): void
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
declare namespace MenuBar {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
82
|
+
const menus: {
|
|
83
|
+
file: Menu
|
|
84
|
+
edit: Menu
|
|
85
|
+
transform: Menu
|
|
86
|
+
uv: Menu
|
|
87
|
+
texture: Menu
|
|
88
|
+
animation: Menu
|
|
89
|
+
keyframe: Menu
|
|
90
|
+
display: Menu
|
|
91
|
+
tools: Menu
|
|
92
|
+
view: Menu
|
|
93
|
+
help: Menu
|
|
94
|
+
[id: string]: Menu
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Adds an action to the menu structure
|
|
98
|
+
* @param action Action to add
|
|
99
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index or group within a level, separated by a point. For example, `file.export.0` places the action at the top position of the Export submenu in the File menu.
|
|
100
|
+
*/
|
|
101
|
+
function addAction(action: Action, path?: string): void
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index or group within a level, or item ID, separated by a point. For example, `export.export_special_format` removes the action "Export Special Format" from the Export submenu.
|
|
105
|
+
*/
|
|
106
|
+
function removeAction(path: string): void
|
|
107
|
+
/**
|
|
108
|
+
* Update the menu bar
|
|
109
|
+
*/
|
|
110
|
+
function update(): void
|
|
111
|
+
}
|
package/types/mesh.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
type OccupationMatrix = {
|
|
2
3
|
[x: number]: {
|
|
3
4
|
[y: number]: boolean
|
|
@@ -16,70 +17,10 @@ interface MeshOptions {
|
|
|
16
17
|
[vkey: string]: ArrayVector3
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
declare class Mesh extends OutlinerElement {
|
|
20
|
-
constructor (options: Partial<MeshOptions>, uuid?: string)
|
|
21
|
-
|
|
22
|
-
visibility: boolean
|
|
23
|
-
color: number
|
|
24
|
-
|
|
25
|
-
vertices: {
|
|
26
|
-
[vkey: string]: ArrayVector3
|
|
27
|
-
}
|
|
28
|
-
faces: {
|
|
29
|
-
[fkey: string]: MeshFace
|
|
30
|
-
}
|
|
31
|
-
seams: {
|
|
32
|
-
[vkey: string]: MeshSeamValue
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
extend(options: Partial<MeshOptions>): this
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Get selected vertices as vertex keys
|
|
39
|
-
* @param can_write If true, the array can safely be modified to update the selection
|
|
40
|
-
*/
|
|
41
|
-
getSelectedVertices(can_write: boolean): string[]
|
|
42
|
-
/**
|
|
43
|
-
* Get selected edges as vertex key pairs
|
|
44
|
-
* @param can_write If true, the array can safely be modified to update the selection
|
|
45
|
-
*/
|
|
46
|
-
getSelectedEdges(can_write: boolean): ([string, string])[]
|
|
47
|
-
/**
|
|
48
|
-
* Get selected faces as face keys
|
|
49
|
-
* @param can_write If true, the array can safely be modified to update the selection
|
|
50
|
-
*/
|
|
51
|
-
getSelectedVertices(can_write: boolean): string[]
|
|
52
|
-
|
|
53
|
-
setSeam(edge: MeshEdge, value)
|
|
54
|
-
getSeam(edge: MeshEdge): MeshSeamValue
|
|
55
|
-
getWorldCenter(ignore_mesh_selection?: boolean): THREE.Vector3
|
|
56
|
-
addVertices(...ArrayVector3): string[]
|
|
57
|
-
addFaces(...MeshFace): string[]
|
|
58
|
-
extend(data: MeshOptions): void
|
|
59
|
-
getUndoCopy(aspects?: object): object
|
|
60
|
-
getSaveCopy(project?: boolean): object
|
|
61
|
-
getSelectionRotation(): THREE.Euler
|
|
62
|
-
getCenter(global: boolean): THREE.Vector3
|
|
63
|
-
forAllFaces(callback: (face: MeshFace, key: string) => void): void
|
|
64
|
-
transferOrigin(origin: ArrayVector3, update?: boolean): void
|
|
65
|
-
setColor(color: number): void
|
|
66
|
-
roll(axis: number, steps: number, origin?: ArrayVector3): void
|
|
67
|
-
flip(axis: number): void
|
|
68
|
-
moveVector(offset: ArrayVector3, axis: number, update?: boolean): void
|
|
69
|
-
resize(val: number, axis: number, negative: boolean, allow_negative: boolean, bidirectional?: boolean): void
|
|
70
|
-
applyTexture(texture: Texture, faces?: true | undefined | string[]): void
|
|
71
|
-
|
|
72
|
-
static all: Mesh[]
|
|
73
|
-
static selected: Mesh[]
|
|
74
|
-
/**Check if any elements of the type are in the project */
|
|
75
|
-
static hasAny: () => boolean
|
|
76
|
-
/**Check if any elements of the type are currently selected */
|
|
77
|
-
static hasSelected: () => boolean
|
|
78
|
-
}
|
|
79
20
|
|
|
80
21
|
interface MeshFaceOptions extends FaceOptions {
|
|
81
22
|
vertices: string[]
|
|
82
|
-
uv: {[vkey: string]: ArrayVector2}
|
|
23
|
+
uv: { [vkey: string]: ArrayVector2 }
|
|
83
24
|
}
|
|
84
25
|
declare class MeshFace extends Face {
|
|
85
26
|
constructor(mesh: Mesh, data: MeshFaceOptions)
|
|
@@ -95,11 +36,15 @@ declare class MeshFace extends Face {
|
|
|
95
36
|
/**
|
|
96
37
|
* Returns the face normal in mesh space as calculated from the vertex positions
|
|
97
38
|
*/
|
|
98
|
-
getNormal(normalize): ArrayVector3
|
|
39
|
+
getNormal(normalize: boolean): ArrayVector3
|
|
99
40
|
/**
|
|
100
41
|
* Calculates which pixels the UV face occupies, and returns them as a map
|
|
101
42
|
*/
|
|
102
|
-
getOccupationMatrix(
|
|
43
|
+
getOccupationMatrix(
|
|
44
|
+
texture_space?: boolean,
|
|
45
|
+
start_offset?: ArrayVector2,
|
|
46
|
+
matrix?: OccupationMatrix
|
|
47
|
+
): OccupationMatrix
|
|
103
48
|
/**
|
|
104
49
|
* Get the keys of this face and all faces that are connected with it on the UV map
|
|
105
50
|
*/
|
|
@@ -123,7 +68,9 @@ declare class MeshFace extends Face {
|
|
|
123
68
|
/**
|
|
124
69
|
* Get the adjacent face in the specified side
|
|
125
70
|
*/
|
|
126
|
-
getAdjacentFace(
|
|
71
|
+
getAdjacentFace(
|
|
72
|
+
side_index: number
|
|
73
|
+
): { face: MeshFace; key: string; edge: MeshEdge; index: number } | null
|
|
127
74
|
/**
|
|
128
75
|
* Returns the face key
|
|
129
76
|
*/
|
|
@@ -141,3 +88,81 @@ declare class MeshFace extends Face {
|
|
|
141
88
|
*/
|
|
142
89
|
getCenter(): ArrayVector3
|
|
143
90
|
}
|
|
91
|
+
|
|
92
|
+
interface MeshOptions {
|
|
93
|
+
name?: string
|
|
94
|
+
color?: number
|
|
95
|
+
visibility?: boolean
|
|
96
|
+
rotation?: ArrayVector3
|
|
97
|
+
origin?: ArrayVector3
|
|
98
|
+
vertices?: {
|
|
99
|
+
[vkey: string]: ArrayVector3
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
declare class Mesh extends OutlinerElement {
|
|
103
|
+
constructor(options: Partial<MeshOptions>, uuid?: string)
|
|
104
|
+
|
|
105
|
+
visibility: boolean
|
|
106
|
+
color: number
|
|
107
|
+
|
|
108
|
+
vertices: {
|
|
109
|
+
[vkey: string]: ArrayVector3
|
|
110
|
+
}
|
|
111
|
+
faces: {
|
|
112
|
+
[fkey: string]: MeshFace
|
|
113
|
+
}
|
|
114
|
+
seams: {
|
|
115
|
+
[vkey: string]: MeshSeamValue
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
extend(options: Partial<MeshOptions>): this
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get selected vertices as vertex keys
|
|
122
|
+
* @param can_write If true, the array can safely be modified to update the selection
|
|
123
|
+
*/
|
|
124
|
+
getSelectedVertices(can_write: boolean): string[]
|
|
125
|
+
/**
|
|
126
|
+
* Get selected edges as vertex key pairs
|
|
127
|
+
* @param can_write If true, the array can safely be modified to update the selection
|
|
128
|
+
*/
|
|
129
|
+
getSelectedEdges(can_write: boolean): [string, string][]
|
|
130
|
+
/**
|
|
131
|
+
* Get selected faces as face keys
|
|
132
|
+
* @param can_write If true, the array can safely be modified to update the selection
|
|
133
|
+
*/
|
|
134
|
+
getSelectedVertices(can_write: boolean): string[]
|
|
135
|
+
|
|
136
|
+
setSeam(edge: MeshEdge, value: any): void
|
|
137
|
+
getSeam(edge: MeshEdge): MeshSeamValue
|
|
138
|
+
getWorldCenter(ignore_mesh_selection?: boolean): THREE.Vector3
|
|
139
|
+
addVertices(...ArrayVector3: ArrayVector3[]): string[]
|
|
140
|
+
addFaces(...MeshFace: MeshFace[]): string[]
|
|
141
|
+
extend(data: MeshOptions): void
|
|
142
|
+
getUndoCopy(aspects?: any): any
|
|
143
|
+
getSelectionRotation(): THREE.Euler
|
|
144
|
+
getCenter(global: boolean): THREE.Vector3
|
|
145
|
+
forAllFaces(callback: (face: MeshFace, key: string) => void): void
|
|
146
|
+
transferOrigin(origin: ArrayVector3, update?: boolean): void
|
|
147
|
+
setColor(color: number): void
|
|
148
|
+
roll(axis: number, steps: number, origin?: ArrayVector3): void
|
|
149
|
+
flip(axis: number): void
|
|
150
|
+
moveVector(offset: ArrayVector3, axis: number, update?: boolean): void
|
|
151
|
+
resize(
|
|
152
|
+
val: number,
|
|
153
|
+
axis: number,
|
|
154
|
+
negative: boolean,
|
|
155
|
+
allow_negative: boolean,
|
|
156
|
+
bidirectional?: boolean
|
|
157
|
+
): void
|
|
158
|
+
applyTexture(texture: Texture, faces?: true | undefined | string[]): void
|
|
159
|
+
|
|
160
|
+
static all: Mesh[]
|
|
161
|
+
static selected: Mesh[]
|
|
162
|
+
/**Check if any elements of the type are in the project */
|
|
163
|
+
static hasAny: () => boolean
|
|
164
|
+
/**Check if any elements of the type are currently selected */
|
|
165
|
+
static hasSelected: () => boolean
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
interface MeshFaceOptions extends FaceOptions {}
|
package/types/misc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
2
2
|
|
|
3
3
|
declare class Deletable {
|
|
4
4
|
delete(): void
|
|
@@ -10,7 +10,8 @@ type UUID = string
|
|
|
10
10
|
*/
|
|
11
11
|
declare const isApp: boolean
|
|
12
12
|
|
|
13
|
-
type EventName =
|
|
13
|
+
type EventName =
|
|
14
|
+
| 'remove_animation'
|
|
14
15
|
| 'display_animation_frame'
|
|
15
16
|
| 'before_closing'
|
|
16
17
|
| 'create_session'
|
|
@@ -47,11 +48,14 @@ type EventName = 'remove_animation'
|
|
|
47
48
|
| 'canvas_click'
|
|
48
49
|
| 'change_texture_path'
|
|
49
50
|
| 'add_texture'
|
|
51
|
+
| 'update_texture_selection'
|
|
52
|
+
| 'init_edit'
|
|
50
53
|
| 'finish_edit'
|
|
51
54
|
| 'finished_edit'
|
|
52
55
|
| 'undo'
|
|
53
56
|
| 'redo'
|
|
54
57
|
| 'load_undo_save'
|
|
58
|
+
| 'create_undo_save'
|
|
55
59
|
| 'change_color'
|
|
56
60
|
| 'select_mode'
|
|
57
61
|
| 'unselect_mode'
|
|
@@ -78,44 +82,74 @@ type EventName = 'remove_animation'
|
|
|
78
82
|
| 'edit_animation_properties'
|
|
79
83
|
| 'select_preview_scene'
|
|
80
84
|
| 'unselect_preview_scene'
|
|
85
|
+
| 'compile_bedrock_animation_controller_state'
|
|
86
|
+
| 'select_animation_controller_state'
|
|
87
|
+
| 'add_animation_controller_animation'
|
|
88
|
+
| 'add_animation_controller_transition'
|
|
89
|
+
| 'add_animation_controller_particle'
|
|
90
|
+
| 'add_animation_controller_sound'
|
|
91
|
+
| 'compile_bedrock_animation_controller'
|
|
92
|
+
| 'add_animation_controller'
|
|
93
|
+
| 'edit_animation_controller_properties'
|
|
94
|
+
| 'timeline_play'
|
|
95
|
+
| 'timeline_pause'
|
|
96
|
+
| 'unselect_interface'
|
|
97
|
+
| 'reset_layout'
|
|
98
|
+
| 'update_pressed_modifier_keys'
|
|
99
|
+
| 'open_bar_menu'
|
|
100
|
+
| 'unselect_all'
|
|
101
|
+
| 'quick_save_model'
|
|
102
|
+
| 'save_editor_state'
|
|
103
|
+
| 'load_editor_state'
|
|
104
|
+
| 'select_no_project'
|
|
105
|
+
| 'flip_node_name'
|
|
106
|
+
| 'update_scene_shading'
|
|
107
|
+
| 'edit_layer_properties'
|
|
108
|
+
| 'select_texture'
|
|
109
|
+
| 'compile_texture_mcmeta'
|
|
81
110
|
|
|
82
|
-
type IconString = string
|
|
111
|
+
type IconString = string
|
|
83
112
|
|
|
84
113
|
interface MessageBoxOptions {
|
|
85
114
|
/**
|
|
86
115
|
* Index of the confirm button within the buttons array
|
|
87
116
|
*/
|
|
88
|
-
confirm
|
|
117
|
+
confirm?: number
|
|
89
118
|
/**
|
|
90
119
|
* Index of the cancel button within the buttons array
|
|
91
120
|
*/
|
|
92
|
-
cancel
|
|
93
|
-
buttons
|
|
121
|
+
cancel?: number
|
|
122
|
+
buttons?: string[]
|
|
94
123
|
translateKey?: string
|
|
95
124
|
title?: string
|
|
96
125
|
message?: string
|
|
97
126
|
icon?: string
|
|
98
|
-
width
|
|
127
|
+
width?: number
|
|
99
128
|
/**
|
|
100
129
|
* Display a list of actions to do in the dialog. When clicked, the message box closes with the string ID of the command as first argument.
|
|
101
130
|
*/
|
|
102
131
|
commands?: {
|
|
103
|
-
[id: string]: string | {
|
|
132
|
+
[id: string]: string | {
|
|
133
|
+
text: string
|
|
134
|
+
icon?: IconString
|
|
135
|
+
condition?: ConditionResolvable
|
|
136
|
+
description?: string
|
|
137
|
+
}
|
|
104
138
|
}
|
|
105
139
|
/**
|
|
106
140
|
* Adds checkboxes to the bottom of the message box
|
|
107
141
|
*/
|
|
108
|
-
checkboxes
|
|
109
|
-
[id: string]:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
checkboxes?: {
|
|
143
|
+
[id: string]:
|
|
144
|
+
| string
|
|
145
|
+
| {
|
|
146
|
+
value?: boolean
|
|
147
|
+
condition: ConditionResolvable
|
|
148
|
+
text: string
|
|
149
|
+
}
|
|
114
150
|
}
|
|
115
151
|
}
|
|
116
152
|
|
|
117
|
-
|
|
118
|
-
type PropertyType = 'string' | 'number' | 'enum' | 'molang' | 'boolean' | 'array' | 'instance' | 'vector' | 'vector2'
|
|
119
153
|
interface PropertyOptions {
|
|
120
154
|
default?: any
|
|
121
155
|
condition?: ConditionResolvable
|
|
@@ -124,44 +158,58 @@ interface PropertyOptions {
|
|
|
124
158
|
/**
|
|
125
159
|
* Options used for select types
|
|
126
160
|
*/
|
|
127
|
-
options?:
|
|
161
|
+
options?: any
|
|
128
162
|
/**
|
|
129
163
|
* Enum possible values
|
|
130
164
|
*/
|
|
131
|
-
values
|
|
132
|
-
merge
|
|
133
|
-
reset
|
|
134
|
-
merge_validation
|
|
165
|
+
values?: string[]
|
|
166
|
+
merge?(instance: any, data: any): void
|
|
167
|
+
reset?(instance: any): void
|
|
168
|
+
merge_validation?(value: any): boolean
|
|
135
169
|
}
|
|
170
|
+
|
|
171
|
+
interface IPropertyType {
|
|
172
|
+
string: string
|
|
173
|
+
molang: string
|
|
174
|
+
number: number
|
|
175
|
+
boolean: boolean
|
|
176
|
+
array: any[]
|
|
177
|
+
object: any
|
|
178
|
+
instance: any
|
|
179
|
+
vector: ArrayVector3
|
|
180
|
+
vector2: ArrayVector2
|
|
181
|
+
}
|
|
182
|
+
|
|
136
183
|
/**
|
|
137
184
|
* Creates a new property on the specified target class
|
|
138
185
|
*/
|
|
139
|
-
declare class Property extends Deletable {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
default:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
186
|
+
declare class Property<T extends keyof IPropertyType> extends Deletable {
|
|
187
|
+
constructor(target_class: any, type: T, name: string, options?: PropertyOptions)
|
|
188
|
+
class: any
|
|
189
|
+
name: string
|
|
190
|
+
type: T
|
|
191
|
+
default: IPropertyType[T]
|
|
192
|
+
export?: boolean
|
|
193
|
+
|
|
194
|
+
isString: boolean
|
|
195
|
+
isEnum: boolean
|
|
196
|
+
isMolang: boolean
|
|
197
|
+
isNumber: boolean
|
|
198
|
+
isBoolean: boolean
|
|
199
|
+
isArray: boolean
|
|
200
|
+
isVector: boolean
|
|
201
|
+
isVector2: boolean
|
|
202
|
+
isInstance: boolean
|
|
203
|
+
|
|
156
204
|
enum_values?: string[]
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
merge(instance:
|
|
162
|
-
reset(instance:
|
|
163
|
-
|
|
164
|
-
|
|
205
|
+
merge_validation: undefined | ((value: IPropertyType[T]) => boolean)
|
|
206
|
+
condition: ConditionResolvable
|
|
207
|
+
exposed: boolean
|
|
208
|
+
label: any
|
|
209
|
+
merge(instance: IPropertyType[T], data: IPropertyType[T]): void
|
|
210
|
+
reset(instance: IPropertyType[T]): void
|
|
211
|
+
getDefault(instance: IPropertyType[T]): IPropertyType[T]
|
|
212
|
+
copy(instance: IPropertyType[T], target: IPropertyType[T]): void
|
|
165
213
|
}
|
|
166
214
|
|
|
167
215
|
declare function updateSelection(): void
|
|
@@ -189,5 +237,24 @@ declare namespace Language {
|
|
|
189
237
|
* @param language Two letter language code, e. G. 'en'
|
|
190
238
|
* @param strings Object listing the translation keys and values
|
|
191
239
|
*/
|
|
192
|
-
function addTranslations(language: string, strings: {[key: string]: string})
|
|
240
|
+
function addTranslations(language: string, strings: { [key: string]: string }): void
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
interface Object {
|
|
244
|
+
boneConfig: Record<string, Property<any> | undefined>
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare var LZUTF8: any
|
|
248
|
+
|
|
249
|
+
interface ToastNotificationOptions {
|
|
250
|
+
text: string
|
|
251
|
+
icon?: string
|
|
252
|
+
expire?: number
|
|
253
|
+
color?: string
|
|
254
|
+
click?: () => boolean
|
|
193
255
|
}
|
|
256
|
+
declare namespace Blockbench {
|
|
257
|
+
function showToastNotification(options: ToastNotificationOptions): Deletable
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
declare function unselectAllElements(): void
|
package/types/mode.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
2
|
+
|
|
1
3
|
interface ModeOptions {
|
|
2
4
|
name: string
|
|
3
5
|
default_tool?: string
|
|
@@ -16,6 +18,8 @@ interface ModeOptions {
|
|
|
16
18
|
}
|
|
17
19
|
declare class Mode extends KeybindItem {
|
|
18
20
|
constructor(id: string, options: ModeOptions)
|
|
21
|
+
id: string
|
|
22
|
+
name: string
|
|
19
23
|
|
|
20
24
|
/**Selects the mode */
|
|
21
25
|
select(): void
|
|
@@ -24,12 +28,21 @@ declare class Mode extends KeybindItem {
|
|
|
24
28
|
/**Activates the mode */
|
|
25
29
|
trigger(): void
|
|
26
30
|
|
|
31
|
+
onSelect?(): void
|
|
32
|
+
|
|
33
|
+
onUnselect?(): void
|
|
34
|
+
|
|
27
35
|
static selected: Mode
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
declare namespace Modes {
|
|
31
39
|
const options: {
|
|
32
40
|
[id: string]: Mode
|
|
41
|
+
animate: Mode
|
|
42
|
+
display: Mode
|
|
43
|
+
edit: Mode
|
|
44
|
+
paint: Mode
|
|
45
|
+
pose: Mode
|
|
33
46
|
}
|
|
34
|
-
|
|
47
|
+
let selected: Mode | false | undefined
|
|
35
48
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare class Molang {
|
|
2
|
+
parse(expression: string | number, variables?: Record<string, number>): number
|
|
3
|
+
global_variables: Record<string, string | number | ((...args: number[]) => number)>
|
|
4
|
+
variableHandler: (variable: string, variables?: Record<string, number>) => number
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare interface MolangExpression {
|
|
8
|
+
animation: _Animation
|
|
9
|
+
animator: BoneAnimator
|
|
10
|
+
channel: string
|
|
11
|
+
key: string
|
|
12
|
+
kf: _Keyframe
|
|
13
|
+
type: string
|
|
14
|
+
value: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare function getAllMolangExpressions(): MolangExpression[]
|