blockbench-types 5.1.0-beta.3-next.2 → 5.1.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/README.md +30 -30
- package/custom/animation.d.ts +256 -256
- package/custom/animation_controller.d.ts +124 -124
- package/custom/blockbench.d.ts +73 -73
- package/custom/canvas.d.ts +307 -307
- package/custom/codec.d.ts +182 -182
- package/custom/copy_paste.d.ts +42 -42
- package/custom/cube.d.ts +151 -151
- package/custom/desktop.d.ts +73 -73
- package/custom/display_mode.d.ts +137 -137
- package/custom/edit_session.d.ts +37 -37
- package/custom/global.d.ts +168 -168
- package/custom/group.d.ts +113 -113
- package/custom/interface.d.ts +78 -78
- package/custom/io.d.ts +12 -12
- package/custom/keyframe.d.ts +94 -94
- package/custom/libs.d.ts +13 -13
- package/custom/menu.d.ts +136 -136
- package/custom/mesh.d.ts +196 -196
- package/custom/misc.d.ts +199 -199
- package/custom/molang.d.ts +159 -159
- package/custom/outliner.d.ts +158 -158
- package/custom/painter.d.ts +69 -69
- package/custom/preview.d.ts +137 -137
- package/custom/preview_scene.d.ts +120 -120
- package/custom/screencam.d.ts +71 -71
- package/custom/spline_mesh.d.ts +189 -189
- package/custom/start_screen.d.ts +14 -14
- package/custom/texture_group.d.ts +68 -68
- package/custom/texture_layers.d.ts +117 -117
- package/custom/textures.d.ts +515 -515
- package/custom/timeline.d.ts +66 -66
- package/custom/toolbars.d.ts +221 -221
- package/custom/undo.d.ts +208 -208
- package/custom/util/version_util.d.ts +32 -32
- package/custom/util.d.ts +235 -235
- package/custom/uveditor.d.ts +3 -3
- package/custom/validator.d.ts +99 -99
- package/documentation.md +12 -12
- package/generated/global_types.d.ts +47 -0
- package/generated/io/formats/bedrock.d.ts +4 -0
- package/generated/io/formats/bedrock_old.d.ts +4 -0
- package/generated/io/formats/collada.d.ts +4 -0
- package/generated/io/formats/fbx.d.ts +17 -0
- package/generated/io/formats/gltf.d.ts +6 -0
- package/generated/io/formats/java_block.d.ts +4 -0
- package/generated/io/formats/modded_entity.d.ts +139 -0
- package/generated/io/formats/obj.d.ts +12 -0
- package/generated/io/formats/optifine_jem.d.ts +3 -0
- package/generated/io/formats/optifine_jpm.d.ts +3 -0
- package/generated/io/formats/skin.d.ts +22 -0
- package/index.d.ts +2 -2
- package/package.json +39 -39
- package/tsconfig.json +19 -19
- package/type_config.json +46 -46
package/custom/interface.d.ts
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare namespace Interface {
|
|
5
|
-
function createElement(
|
|
6
|
-
type: keyof HTMLElementTagNameMap,
|
|
7
|
-
attributes?: {},
|
|
8
|
-
content?: string | HTMLElement | HTMLElement[]
|
|
9
|
-
): HTMLElement
|
|
10
|
-
|
|
11
|
-
const data: {
|
|
12
|
-
left_bar_width: number
|
|
13
|
-
right_bar_width: number
|
|
14
|
-
quad_view_x: number
|
|
15
|
-
quad_view_y: number
|
|
16
|
-
timeline_head: number
|
|
17
|
-
left_bar: string[]
|
|
18
|
-
right_bar: string[]
|
|
19
|
-
}
|
|
20
|
-
let left_bar_width: number
|
|
21
|
-
let right_bar_width: number
|
|
22
|
-
let top_panel_height: number
|
|
23
|
-
let bottom_panel_height: number
|
|
24
|
-
let default_data: any
|
|
25
|
-
function getTopPanel(): Panel
|
|
26
|
-
function getBottomPanel(): Panel
|
|
27
|
-
function getLeftPanels(in_order: boolean = true): Panel[]
|
|
28
|
-
function getRightPanels(in_order: boolean = true): Panel[]
|
|
29
|
-
function getModeData(): any
|
|
30
|
-
const Resizers: {
|
|
31
|
-
left: ResizeLine
|
|
32
|
-
right: ResizeLine
|
|
33
|
-
quad_view_x: ResizeLine
|
|
34
|
-
quad_view_y: ResizeLine
|
|
35
|
-
top: ResizeLine
|
|
36
|
-
bottom: ResizeLine
|
|
37
|
-
timeline_head: ResizeLine
|
|
38
|
-
}
|
|
39
|
-
const status_bar: {
|
|
40
|
-
menu: Menu
|
|
41
|
-
vue: Vue.Component
|
|
42
|
-
}
|
|
43
|
-
let tab_bar: Vue
|
|
44
|
-
const Panels: {
|
|
45
|
-
[key: string]: Panel
|
|
46
|
-
}
|
|
47
|
-
function toggleSidebar(side: any, status: any): void
|
|
48
|
-
|
|
49
|
-
const text_edit_menu: Menu
|
|
50
|
-
|
|
51
|
-
function addSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
|
|
52
|
-
function removeSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
|
|
53
|
-
|
|
54
|
-
const center_screen: HTMLElement
|
|
55
|
-
const page_wrapper: HTMLElement
|
|
56
|
-
const preview: HTMLElement
|
|
57
|
-
const work_screen: HTMLElement
|
|
58
|
-
const right_bar: HTMLElement
|
|
59
|
-
const left_bar: HTMLElement
|
|
60
|
-
|
|
61
|
-
namespace CustomElements {
|
|
62
|
-
class SelectInput<T extends Record<string, string>> {
|
|
63
|
-
node: HTMLElement
|
|
64
|
-
constructor(
|
|
65
|
-
id: string,
|
|
66
|
-
options: {
|
|
67
|
-
value?: T[keyof T]
|
|
68
|
-
default?: T[keyof T]
|
|
69
|
-
options: T
|
|
70
|
-
onChange?(value: T[keyof T]): void
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
set(value: T[keyof T]): void
|
|
74
|
-
}
|
|
75
|
-
const ResizeLine: any
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
declare function updateInterface(): void
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
declare namespace Interface {
|
|
5
|
+
function createElement(
|
|
6
|
+
type: keyof HTMLElementTagNameMap,
|
|
7
|
+
attributes?: {},
|
|
8
|
+
content?: string | HTMLElement | HTMLElement[]
|
|
9
|
+
): HTMLElement
|
|
10
|
+
|
|
11
|
+
const data: {
|
|
12
|
+
left_bar_width: number
|
|
13
|
+
right_bar_width: number
|
|
14
|
+
quad_view_x: number
|
|
15
|
+
quad_view_y: number
|
|
16
|
+
timeline_head: number
|
|
17
|
+
left_bar: string[]
|
|
18
|
+
right_bar: string[]
|
|
19
|
+
}
|
|
20
|
+
let left_bar_width: number
|
|
21
|
+
let right_bar_width: number
|
|
22
|
+
let top_panel_height: number
|
|
23
|
+
let bottom_panel_height: number
|
|
24
|
+
let default_data: any
|
|
25
|
+
function getTopPanel(): Panel
|
|
26
|
+
function getBottomPanel(): Panel
|
|
27
|
+
function getLeftPanels(in_order: boolean = true): Panel[]
|
|
28
|
+
function getRightPanels(in_order: boolean = true): Panel[]
|
|
29
|
+
function getModeData(): any
|
|
30
|
+
const Resizers: {
|
|
31
|
+
left: ResizeLine
|
|
32
|
+
right: ResizeLine
|
|
33
|
+
quad_view_x: ResizeLine
|
|
34
|
+
quad_view_y: ResizeLine
|
|
35
|
+
top: ResizeLine
|
|
36
|
+
bottom: ResizeLine
|
|
37
|
+
timeline_head: ResizeLine
|
|
38
|
+
}
|
|
39
|
+
const status_bar: {
|
|
40
|
+
menu: Menu
|
|
41
|
+
vue: Vue.Component
|
|
42
|
+
}
|
|
43
|
+
let tab_bar: Vue
|
|
44
|
+
const Panels: {
|
|
45
|
+
[key: string]: Panel
|
|
46
|
+
}
|
|
47
|
+
function toggleSidebar(side: any, status: any): void
|
|
48
|
+
|
|
49
|
+
const text_edit_menu: Menu
|
|
50
|
+
|
|
51
|
+
function addSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
|
|
52
|
+
function removeSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
|
|
53
|
+
|
|
54
|
+
const center_screen: HTMLElement
|
|
55
|
+
const page_wrapper: HTMLElement
|
|
56
|
+
const preview: HTMLElement
|
|
57
|
+
const work_screen: HTMLElement
|
|
58
|
+
const right_bar: HTMLElement
|
|
59
|
+
const left_bar: HTMLElement
|
|
60
|
+
|
|
61
|
+
namespace CustomElements {
|
|
62
|
+
class SelectInput<T extends Record<string, string>> {
|
|
63
|
+
node: HTMLElement
|
|
64
|
+
constructor(
|
|
65
|
+
id: string,
|
|
66
|
+
options: {
|
|
67
|
+
value?: T[keyof T]
|
|
68
|
+
default?: T[keyof T]
|
|
69
|
+
options: T
|
|
70
|
+
onChange?(value: T[keyof T]): void
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
set(value: T[keyof T]): void
|
|
74
|
+
}
|
|
75
|
+
const ResizeLine: any
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
declare function updateInterface(): void
|
package/custom/io.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
function setupDragHandlers(): void;
|
|
3
|
-
function loadModelFile(file: any, args: any): void;
|
|
4
|
-
function loadImages(files: any, event: any): Promise<void>;
|
|
5
|
-
function unsupportedFileFormatMessage(file_name: string): void;
|
|
6
|
-
namespace Extruder {
|
|
7
|
-
function drawImage(file: any): void;
|
|
8
|
-
function startConversion(formResult: any): void;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {};
|
|
1
|
+
declare global {
|
|
2
|
+
function setupDragHandlers(): void;
|
|
3
|
+
function loadModelFile(file: any, args: any): void;
|
|
4
|
+
function loadImages(files: any, event: any): Promise<void>;
|
|
5
|
+
function unsupportedFileFormatMessage(file_name: string): void;
|
|
6
|
+
namespace Extruder {
|
|
7
|
+
function drawImage(file: any): void;
|
|
8
|
+
function startConversion(formResult: any): void;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {};
|
package/custom/keyframe.d.ts
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Keyframes are used in animations to specify transformation or other data at specific points in the timeline
|
|
5
|
-
* @module
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
interface KeyframeDataPointData {
|
|
9
|
-
[key: string]: any
|
|
10
|
-
}
|
|
11
|
-
declare class KeyframeDataPoint extends Object {
|
|
12
|
-
static properties: Record<string, Property<any>>
|
|
13
|
-
constructor(keyframe: _Keyframe)
|
|
14
|
-
readonly keyframe: Keyframe
|
|
15
|
-
extend(data: KeyframeDataPointData): void
|
|
16
|
-
getUndoCopy(): {
|
|
17
|
-
[key: string]: any
|
|
18
|
-
}
|
|
19
|
-
[key: string]: any
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface KeyframeOptions {
|
|
23
|
-
channel?: string
|
|
24
|
-
data_points: {}[]
|
|
25
|
-
time: number
|
|
26
|
-
color?: number
|
|
27
|
-
uniform?: boolean
|
|
28
|
-
interpolation?: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
|
|
29
|
-
bezier_linked?: boolean
|
|
30
|
-
bezier_left_time?: ArrayVector3
|
|
31
|
-
bezier_left_value?: ArrayVector3
|
|
32
|
-
bezier_right_time?: ArrayVector3
|
|
33
|
-
bezier_right_value?: ArrayVector3
|
|
34
|
-
}
|
|
35
|
-
type axisLetter = 'x' | 'y' | 'z'
|
|
36
|
-
type axisNumber = 0 | 1 | 2
|
|
37
|
-
|
|
38
|
-
declare class _Keyframe {
|
|
39
|
-
constructor(options: KeyframeOptions, uuid: any)
|
|
40
|
-
static selected: _Keyframe[]
|
|
41
|
-
data_points: KeyframeDataPoint[]
|
|
42
|
-
animator: GeneralAnimator
|
|
43
|
-
channel: string
|
|
44
|
-
time: number
|
|
45
|
-
uuid: string
|
|
46
|
-
color: number
|
|
47
|
-
uniform: boolean
|
|
48
|
-
interpolation: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
|
|
49
|
-
cooldown?: boolean
|
|
50
|
-
bezier_linked: boolean
|
|
51
|
-
bezier_left_time: ArrayVector3
|
|
52
|
-
bezier_right_time: ArrayVector3
|
|
53
|
-
bezier_left_value: ArrayVector3
|
|
54
|
-
bezier_right_value: ArrayVector3
|
|
55
|
-
selected: boolean
|
|
56
|
-
transform: boolean
|
|
57
|
-
has_expressions: boolean
|
|
58
|
-
|
|
59
|
-
extend(data: KeyframeOptions): this
|
|
60
|
-
get(axis: axisLetter, data_point?: number): number | string
|
|
61
|
-
calc(axis: axisLetter, data_point?: number): number
|
|
62
|
-
set(axis: axisLetter, value: any, data_point?: number): this
|
|
63
|
-
offset(axis: axisLetter, amount: any, data_point?: number): void
|
|
64
|
-
flip(axis: axisLetter): this
|
|
65
|
-
getLerp(other: _Keyframe, axis: axisLetter, amount: number, allow_expression?: boolean): number
|
|
66
|
-
getCatmullromLerp(
|
|
67
|
-
before_plus: _Keyframe,
|
|
68
|
-
before: _Keyframe,
|
|
69
|
-
after: _Keyframe,
|
|
70
|
-
after_plus: _Keyframe,
|
|
71
|
-
axis: axisLetter,
|
|
72
|
-
alpha: number
|
|
73
|
-
): number
|
|
74
|
-
getArray(data_point?: number): (number | string)[]
|
|
75
|
-
getFixed(
|
|
76
|
-
data_point?: number,
|
|
77
|
-
get_quaternion?: boolean
|
|
78
|
-
): THREE.Vector3 | THREE.Euler | THREE.Quaternion
|
|
79
|
-
getTimecodeString(): string
|
|
80
|
-
compileBedrockKeyframe(): any
|
|
81
|
-
replaceOthers(save: any): void
|
|
82
|
-
select(event?: any): this
|
|
83
|
-
callPlayhead(): this
|
|
84
|
-
showContextMenu(event: Event): this
|
|
85
|
-
remove(): void
|
|
86
|
-
forSelected(callback: (keyframe: _Keyframe) => void, undo_tag: any): this[]
|
|
87
|
-
getUndoCopy(save: any): {
|
|
88
|
-
animator: any
|
|
89
|
-
channel?: string | null
|
|
90
|
-
data_points: KeyframeDataPoint[]
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
declare function updateKeyframeSelection(): void
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Keyframes are used in animations to specify transformation or other data at specific points in the timeline
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface KeyframeDataPointData {
|
|
9
|
+
[key: string]: any
|
|
10
|
+
}
|
|
11
|
+
declare class KeyframeDataPoint extends Object {
|
|
12
|
+
static properties: Record<string, Property<any>>
|
|
13
|
+
constructor(keyframe: _Keyframe)
|
|
14
|
+
readonly keyframe: Keyframe
|
|
15
|
+
extend(data: KeyframeDataPointData): void
|
|
16
|
+
getUndoCopy(): {
|
|
17
|
+
[key: string]: any
|
|
18
|
+
}
|
|
19
|
+
[key: string]: any
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface KeyframeOptions {
|
|
23
|
+
channel?: string
|
|
24
|
+
data_points: {}[]
|
|
25
|
+
time: number
|
|
26
|
+
color?: number
|
|
27
|
+
uniform?: boolean
|
|
28
|
+
interpolation?: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
|
|
29
|
+
bezier_linked?: boolean
|
|
30
|
+
bezier_left_time?: ArrayVector3
|
|
31
|
+
bezier_left_value?: ArrayVector3
|
|
32
|
+
bezier_right_time?: ArrayVector3
|
|
33
|
+
bezier_right_value?: ArrayVector3
|
|
34
|
+
}
|
|
35
|
+
type axisLetter = 'x' | 'y' | 'z'
|
|
36
|
+
type axisNumber = 0 | 1 | 2
|
|
37
|
+
|
|
38
|
+
declare class _Keyframe {
|
|
39
|
+
constructor(options: KeyframeOptions, uuid: any)
|
|
40
|
+
static selected: _Keyframe[]
|
|
41
|
+
data_points: KeyframeDataPoint[]
|
|
42
|
+
animator: GeneralAnimator
|
|
43
|
+
channel: string
|
|
44
|
+
time: number
|
|
45
|
+
uuid: string
|
|
46
|
+
color: number
|
|
47
|
+
uniform: boolean
|
|
48
|
+
interpolation: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
|
|
49
|
+
cooldown?: boolean
|
|
50
|
+
bezier_linked: boolean
|
|
51
|
+
bezier_left_time: ArrayVector3
|
|
52
|
+
bezier_right_time: ArrayVector3
|
|
53
|
+
bezier_left_value: ArrayVector3
|
|
54
|
+
bezier_right_value: ArrayVector3
|
|
55
|
+
selected: boolean
|
|
56
|
+
transform: boolean
|
|
57
|
+
has_expressions: boolean
|
|
58
|
+
|
|
59
|
+
extend(data: KeyframeOptions): this
|
|
60
|
+
get(axis: axisLetter, data_point?: number): number | string
|
|
61
|
+
calc(axis: axisLetter, data_point?: number): number
|
|
62
|
+
set(axis: axisLetter, value: any, data_point?: number): this
|
|
63
|
+
offset(axis: axisLetter, amount: any, data_point?: number): void
|
|
64
|
+
flip(axis: axisLetter): this
|
|
65
|
+
getLerp(other: _Keyframe, axis: axisLetter, amount: number, allow_expression?: boolean): number
|
|
66
|
+
getCatmullromLerp(
|
|
67
|
+
before_plus: _Keyframe,
|
|
68
|
+
before: _Keyframe,
|
|
69
|
+
after: _Keyframe,
|
|
70
|
+
after_plus: _Keyframe,
|
|
71
|
+
axis: axisLetter,
|
|
72
|
+
alpha: number
|
|
73
|
+
): number
|
|
74
|
+
getArray(data_point?: number): (number | string)[]
|
|
75
|
+
getFixed(
|
|
76
|
+
data_point?: number,
|
|
77
|
+
get_quaternion?: boolean
|
|
78
|
+
): THREE.Vector3 | THREE.Euler | THREE.Quaternion
|
|
79
|
+
getTimecodeString(): string
|
|
80
|
+
compileBedrockKeyframe(): any
|
|
81
|
+
replaceOthers(save: any): void
|
|
82
|
+
select(event?: any): this
|
|
83
|
+
callPlayhead(): this
|
|
84
|
+
showContextMenu(event: Event): this
|
|
85
|
+
remove(): void
|
|
86
|
+
forSelected(callback: (keyframe: _Keyframe) => void, undo_tag: any): this[]
|
|
87
|
+
getUndoCopy(save: any): {
|
|
88
|
+
animator: any
|
|
89
|
+
channel?: string | null
|
|
90
|
+
data_points: KeyframeDataPoint[]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare function updateKeyframeSelection(): void
|
package/custom/libs.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import three from 'three'
|
|
2
|
-
|
|
3
|
-
declare module 'three' {
|
|
4
|
-
interface Object3D {
|
|
5
|
-
/**The outline mesh of the mesh */
|
|
6
|
-
outline?: three.Object3D | three.Mesh
|
|
7
|
-
fix_rotation?: three.Euler
|
|
8
|
-
fix_position?: three.Vector3
|
|
9
|
-
no_export?: boolean
|
|
10
|
-
isElement?: boolean
|
|
11
|
-
isGroup?: boolean
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import three from 'three'
|
|
2
|
+
|
|
3
|
+
declare module 'three' {
|
|
4
|
+
interface Object3D {
|
|
5
|
+
/**The outline mesh of the mesh */
|
|
6
|
+
outline?: three.Object3D | three.Mesh
|
|
7
|
+
fix_rotation?: three.Euler
|
|
8
|
+
fix_position?: three.Vector3
|
|
9
|
+
no_export?: boolean
|
|
10
|
+
isElement?: boolean
|
|
11
|
+
isGroup?: boolean
|
|
12
|
+
}
|
|
13
|
+
}
|
package/custom/menu.d.ts
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
interface CustomMenuItem {
|
|
3
|
-
name: string
|
|
4
|
-
id?: string
|
|
5
|
-
icon: IconString | boolean | ((context: any) => (IconString|boolean))
|
|
6
|
-
color?: string
|
|
7
|
-
description?: string
|
|
8
|
-
condition?: ConditionResolvable
|
|
9
|
-
/**
|
|
10
|
-
* Keybind or string to display in the menu, won't work as an actual keybinding by default
|
|
11
|
-
*/
|
|
12
|
-
keybind?: Keybind | string
|
|
13
|
-
/**
|
|
14
|
-
* Adds a search bar to the menu or submenu
|
|
15
|
-
*/
|
|
16
|
-
searchable?: boolean
|
|
17
|
-
children?: MenuItem[] | ((context: any) => MenuItem[])
|
|
18
|
-
click?(context?: any, event?: Event): void
|
|
19
|
-
}
|
|
20
|
-
type MenuItem = CustomMenuItem | Action | BarSelect<string> | MenuSeparator | string
|
|
21
|
-
interface MenuOptions {
|
|
22
|
-
onOpen?(position: MouseEvent | HTMLElement, context?: any): void
|
|
23
|
-
onClose?(): void
|
|
24
|
-
keep_open?: boolean
|
|
25
|
-
searchable?: boolean
|
|
26
|
-
class?: string
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Use the Menu class to create a context menu. Menus can contain custom entries and hierarchy, or existing actions and tools.
|
|
30
|
-
*/
|
|
31
|
-
declare class Menu extends Deletable {
|
|
32
|
-
/**
|
|
33
|
-
* Creates a new context menu
|
|
34
|
-
*/
|
|
35
|
-
constructor(
|
|
36
|
-
id: string,
|
|
37
|
-
template: MenuItem[] | ((context?: any) => MenuItem[]),
|
|
38
|
-
options?: MenuOptions
|
|
39
|
-
)
|
|
40
|
-
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Opens the menu somewhere
|
|
44
|
-
* @param position Position where to open the menu. Can be a mouse event, or a node that the menu is spawned below.
|
|
45
|
-
* @param context Context for the click events inside the menu
|
|
46
|
-
*/
|
|
47
|
-
open(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
48
|
-
/**
|
|
49
|
-
* Alias for .open()
|
|
50
|
-
*/
|
|
51
|
-
show(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
52
|
-
/**
|
|
53
|
-
* Closes the menu if it's open
|
|
54
|
-
*/
|
|
55
|
-
hide(): this
|
|
56
|
-
/**
|
|
57
|
-
* Adds an action to the menu structure
|
|
58
|
-
* @param action Action to add
|
|
59
|
-
* @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.
|
|
60
|
-
*/
|
|
61
|
-
addAction(action: Action | CustomMenuItem, path?: string | number): void
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @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.
|
|
65
|
-
*/
|
|
66
|
-
removeAction(path: string | Action): void
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated
|
|
69
|
-
*/
|
|
70
|
-
deleteItem(rm_item: Action): void
|
|
71
|
-
hover(node: HTMLElement, event: Event, expand?: boolean): void
|
|
72
|
-
structure: MenuItem[]
|
|
73
|
-
node: HTMLUListElement
|
|
74
|
-
static open: Menu | null
|
|
75
|
-
static closed_in_this_click?: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare interface BarMenuOptions {
|
|
79
|
-
name?: string
|
|
80
|
-
icon?: IconString
|
|
81
|
-
condition?: ConditionResolvable
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Creates a new menu in the menu bar
|
|
86
|
-
*/
|
|
87
|
-
declare class BarMenu extends Menu {
|
|
88
|
-
constructor(id: string, structure: MenuItem[], options?: BarMenuOptions)
|
|
89
|
-
type: 'bar_menu'
|
|
90
|
-
id: string
|
|
91
|
-
condition?: ConditionResolvable
|
|
92
|
-
name: string
|
|
93
|
-
structure: MenuItem[]
|
|
94
|
-
/**
|
|
95
|
-
* Visually highlights an action within the menu, until the user opens the menu
|
|
96
|
-
*/
|
|
97
|
-
highlight(action: Action): void
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
declare namespace MenuBar {
|
|
101
|
-
const menus: {
|
|
102
|
-
file: Menu
|
|
103
|
-
edit: Menu
|
|
104
|
-
transform: Menu
|
|
105
|
-
uv: Menu
|
|
106
|
-
texture: Menu
|
|
107
|
-
animation: Menu
|
|
108
|
-
keyframe: Menu
|
|
109
|
-
display: Menu
|
|
110
|
-
tools: Menu
|
|
111
|
-
view: Menu
|
|
112
|
-
help: Menu
|
|
113
|
-
[id: string]: Menu
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Add a new menu to the menu bar
|
|
117
|
-
* @param menu The BarMenu to add
|
|
118
|
-
* @param position Specify the position in the menu list where to add insert the menu. Can either be an index in the list of all menus, or the ID of the menu to insert right from.
|
|
119
|
-
*/
|
|
120
|
-
function addMenu(menu: BarMenu, position?: number | string): void
|
|
121
|
-
/**
|
|
122
|
-
* Adds an action to the menu structure
|
|
123
|
-
* @param action Action to add
|
|
124
|
-
* @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.
|
|
125
|
-
*/
|
|
126
|
-
function addAction(action: Action, path?: string): void
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
* @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.
|
|
130
|
-
*/
|
|
131
|
-
function removeAction(path: string): void
|
|
132
|
-
/**
|
|
133
|
-
* Update the menu bar
|
|
134
|
-
*/
|
|
135
|
-
function update(): void
|
|
136
|
-
}
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
interface CustomMenuItem {
|
|
3
|
+
name: string
|
|
4
|
+
id?: string
|
|
5
|
+
icon: IconString | boolean | ((context: any) => (IconString|boolean))
|
|
6
|
+
color?: string
|
|
7
|
+
description?: string
|
|
8
|
+
condition?: ConditionResolvable
|
|
9
|
+
/**
|
|
10
|
+
* Keybind or string to display in the menu, won't work as an actual keybinding by default
|
|
11
|
+
*/
|
|
12
|
+
keybind?: Keybind | string
|
|
13
|
+
/**
|
|
14
|
+
* Adds a search bar to the menu or submenu
|
|
15
|
+
*/
|
|
16
|
+
searchable?: boolean
|
|
17
|
+
children?: MenuItem[] | ((context: any) => MenuItem[])
|
|
18
|
+
click?(context?: any, event?: Event): void
|
|
19
|
+
}
|
|
20
|
+
type MenuItem = CustomMenuItem | Action | BarSelect<string> | MenuSeparator | string
|
|
21
|
+
interface MenuOptions {
|
|
22
|
+
onOpen?(position: MouseEvent | HTMLElement, context?: any): void
|
|
23
|
+
onClose?(): void
|
|
24
|
+
keep_open?: boolean
|
|
25
|
+
searchable?: boolean
|
|
26
|
+
class?: string
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Use the Menu class to create a context menu. Menus can contain custom entries and hierarchy, or existing actions and tools.
|
|
30
|
+
*/
|
|
31
|
+
declare class Menu extends Deletable {
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new context menu
|
|
34
|
+
*/
|
|
35
|
+
constructor(
|
|
36
|
+
id: string,
|
|
37
|
+
template: MenuItem[] | ((context?: any) => MenuItem[]),
|
|
38
|
+
options?: MenuOptions
|
|
39
|
+
)
|
|
40
|
+
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Opens the menu somewhere
|
|
44
|
+
* @param position Position where to open the menu. Can be a mouse event, or a node that the menu is spawned below.
|
|
45
|
+
* @param context Context for the click events inside the menu
|
|
46
|
+
*/
|
|
47
|
+
open(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
48
|
+
/**
|
|
49
|
+
* Alias for .open()
|
|
50
|
+
*/
|
|
51
|
+
show(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
52
|
+
/**
|
|
53
|
+
* Closes the menu if it's open
|
|
54
|
+
*/
|
|
55
|
+
hide(): this
|
|
56
|
+
/**
|
|
57
|
+
* Adds an action to the menu structure
|
|
58
|
+
* @param action Action to add
|
|
59
|
+
* @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.
|
|
60
|
+
*/
|
|
61
|
+
addAction(action: Action | CustomMenuItem, path?: string | number): void
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @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.
|
|
65
|
+
*/
|
|
66
|
+
removeAction(path: string | Action): void
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated
|
|
69
|
+
*/
|
|
70
|
+
deleteItem(rm_item: Action): void
|
|
71
|
+
hover(node: HTMLElement, event: Event, expand?: boolean): void
|
|
72
|
+
structure: MenuItem[]
|
|
73
|
+
node: HTMLUListElement
|
|
74
|
+
static open: Menu | null
|
|
75
|
+
static closed_in_this_click?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare interface BarMenuOptions {
|
|
79
|
+
name?: string
|
|
80
|
+
icon?: IconString
|
|
81
|
+
condition?: ConditionResolvable
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new menu in the menu bar
|
|
86
|
+
*/
|
|
87
|
+
declare class BarMenu extends Menu {
|
|
88
|
+
constructor(id: string, structure: MenuItem[], options?: BarMenuOptions)
|
|
89
|
+
type: 'bar_menu'
|
|
90
|
+
id: string
|
|
91
|
+
condition?: ConditionResolvable
|
|
92
|
+
name: string
|
|
93
|
+
structure: MenuItem[]
|
|
94
|
+
/**
|
|
95
|
+
* Visually highlights an action within the menu, until the user opens the menu
|
|
96
|
+
*/
|
|
97
|
+
highlight(action: Action): void
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare namespace MenuBar {
|
|
101
|
+
const menus: {
|
|
102
|
+
file: Menu
|
|
103
|
+
edit: Menu
|
|
104
|
+
transform: Menu
|
|
105
|
+
uv: Menu
|
|
106
|
+
texture: Menu
|
|
107
|
+
animation: Menu
|
|
108
|
+
keyframe: Menu
|
|
109
|
+
display: Menu
|
|
110
|
+
tools: Menu
|
|
111
|
+
view: Menu
|
|
112
|
+
help: Menu
|
|
113
|
+
[id: string]: Menu
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Add a new menu to the menu bar
|
|
117
|
+
* @param menu The BarMenu to add
|
|
118
|
+
* @param position Specify the position in the menu list where to add insert the menu. Can either be an index in the list of all menus, or the ID of the menu to insert right from.
|
|
119
|
+
*/
|
|
120
|
+
function addMenu(menu: BarMenu, position?: number | string): void
|
|
121
|
+
/**
|
|
122
|
+
* Adds an action to the menu structure
|
|
123
|
+
* @param action Action to add
|
|
124
|
+
* @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.
|
|
125
|
+
*/
|
|
126
|
+
function addAction(action: Action, path?: string): void
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @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.
|
|
130
|
+
*/
|
|
131
|
+
function removeAction(path: string): void
|
|
132
|
+
/**
|
|
133
|
+
* Update the menu bar
|
|
134
|
+
*/
|
|
135
|
+
function update(): void
|
|
136
|
+
}
|