blockbench-types 5.2.0-beta.0-next.1 → 5.2.0-beta.0-next.3
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/custom/animation.d.ts +4 -2
- package/custom/blockbench.d.ts +5 -4
- package/custom/canvas.d.ts +20 -3
- package/custom/codec.d.ts +2 -2
- package/custom/cube.d.ts +1 -1
- package/custom/desktop.d.ts +15 -4
- package/custom/display_mode.d.ts +6 -1
- package/custom/global.d.ts +1 -2
- package/custom/group.d.ts +1 -1
- package/custom/interface.d.ts +5 -0
- package/custom/{toolbars.d.ts → keybind.d.ts} +4 -76
- package/custom/keyframe.d.ts +2 -0
- package/custom/menu_bar.d.ts +66 -0
- package/custom/misc.d.ts +73 -66
- package/custom/painter.d.ts +35 -1
- package/custom/screencam.d.ts +1 -1
- package/custom/spline_mesh.d.ts +5 -4
- package/custom/textures.d.ts +2 -0
- package/generated/animations/timeline_animators.d.ts +1 -1
- package/generated/api.d.ts +5 -26
- package/generated/desktop.d.ts +48 -0
- package/generated/file_system.d.ts +1 -0
- package/generated/find_replace.d.ts +6 -0
- package/generated/interface/actions.d.ts +14 -9
- package/generated/interface/dialog.d.ts +2 -2
- package/generated/interface/main_tools.d.ts +23 -0
- package/generated/interface/menu.d.ts +144 -0
- package/generated/interface/menu_bar.d.ts +2 -3
- package/generated/interface/shared_actions.d.ts +13 -0
- package/generated/interface/toast_notification.d.ts +45 -0
- package/generated/interface/toolbars.d.ts +146 -46
- package/generated/io/format.d.ts +1 -0
- package/generated/io/project.d.ts +1 -1
- package/generated/lib/CSS3DRenderer.d.ts +129 -0
- package/generated/main.d.ts +3 -0
- package/generated/modeling/mesh/add_mesh.d.ts +6 -0
- package/generated/modeling/mesh/knife_tool.d.ts +1 -1
- package/generated/modeling/mesh/loop_cut.d.ts +2 -0
- package/generated/modeling/mesh/util.d.ts +8 -2
- package/generated/modeling/mirror_modeling.d.ts +1 -1
- package/generated/modeling/transform/transform_modules.d.ts +6 -6
- package/generated/modeling/transform.d.ts +1 -1
- package/generated/modeling/weight_paint.d.ts +0 -1
- package/generated/modes.d.ts +2 -2
- package/generated/native_apis.d.ts +3 -0
- package/generated/outliner/abstract/outliner_element.d.ts +1 -0
- package/generated/outliner/abstract/outliner_node.d.ts +1 -0
- package/generated/outliner/types/armature.d.ts +1 -1
- package/generated/outliner/types/armature_bone.d.ts +1 -1
- package/generated/outliner/types/billboard.d.ts +1 -1
- package/generated/outliner/types/bounding_box.d.ts +1 -1
- package/generated/outliner/types/cube.d.ts +1 -1
- package/generated/outliner/types/group.d.ts +1 -1
- package/generated/outliner/types/locator.d.ts +1 -1
- package/generated/outliner/types/mesh.d.ts +3 -3
- package/generated/outliner/types/null_object.d.ts +1 -1
- package/generated/outliner/types/spline_mesh.d.ts +1 -2
- package/generated/outliner/types/texture_mesh.d.ts +1 -1
- package/generated/plugin_loader.d.ts +6 -4
- package/generated/preview/preview.d.ts +286 -0
- package/generated/preview/preview_scenes.d.ts +197 -0
- package/generated/preview/reference_images.d.ts +141 -89
- package/generated/texturing/layers.d.ts +0 -1
- package/generated/util/gif.d.ts +12 -3
- package/generated/util/state_memory.d.ts +2 -10
- package/generated/uv/uv_size.d.ts +19 -7
- package/package.json +1 -1
- package/type_config.json +0 -4
- package/custom/menu.d.ts +0 -137
- package/custom/preview.d.ts +0 -147
- package/custom/preview_scene.d.ts +0 -120
package/custom/painter.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ declare namespace Painter {
|
|
|
11
11
|
const lock_alpha: boolean
|
|
12
12
|
const erase_mode: boolean
|
|
13
13
|
const default_brush_presets: any[]
|
|
14
|
+
let screen_space_brush_cursor: HTMLElement
|
|
14
15
|
|
|
15
16
|
function edit(
|
|
16
17
|
texture: Texture,
|
|
@@ -30,6 +31,8 @@ declare namespace Painter {
|
|
|
30
31
|
function getMirrorElement(element: OutlinerElement, symmetry_axes: number[]): void
|
|
31
32
|
function updateNslideValues(): void
|
|
32
33
|
function getBlendModeCompositeOperation(blend_mode?: string): string
|
|
34
|
+
function getBrushDimensions(size?: number): ArrayVector2
|
|
35
|
+
function getCanvasToolPixelCoords(uv_point: {x: number, y: number}, texture: Texture): ArrayVector2
|
|
33
36
|
function getCanvas(texture: Texture): HTMLCanvasElement
|
|
34
37
|
function copyCanvas(original_canvas: HTMLCanvasElement): HTMLCanvasElement
|
|
35
38
|
function scanCanvas(
|
|
@@ -40,7 +43,7 @@ declare namespace Painter {
|
|
|
40
43
|
h: number,
|
|
41
44
|
cb: ((px: number, py: number, color: [r: number, g: number, b: number, a: number]) => [number, number, number, number] | void)
|
|
42
45
|
): void
|
|
43
|
-
function getPixelColor(ctx: CanvasRenderingContext2D, x: number, y: number):
|
|
46
|
+
function getPixelColor(ctx: CanvasRenderingContext2D, x: number, y: number): tinycolor
|
|
44
47
|
function modifyCanvasSection(
|
|
45
48
|
ctx: CanvasRenderingContext2D,
|
|
46
49
|
x: number,
|
|
@@ -68,3 +71,34 @@ declare namespace Painter {
|
|
|
68
71
|
function openBrushOptions(): void
|
|
69
72
|
function loadBrushPreset(preset: any): void
|
|
70
73
|
}
|
|
74
|
+
|
|
75
|
+
declare interface BarItemRegistry {
|
|
76
|
+
paint_secondary_color: KeybindItem
|
|
77
|
+
pan_tool: Tool
|
|
78
|
+
brush_tool: Tool
|
|
79
|
+
copy_brush: Tool
|
|
80
|
+
fill_tool: Tool
|
|
81
|
+
eraser: Tool
|
|
82
|
+
color_picker: Tool
|
|
83
|
+
draw_shape_tool: Tool
|
|
84
|
+
gradient_tool: Tool
|
|
85
|
+
move_layer_tool: Tool
|
|
86
|
+
brush_shape: BarSelect
|
|
87
|
+
draw_shape_type: BarSelect
|
|
88
|
+
blend_mode: BarSelect
|
|
89
|
+
fill_mode: BarSelect
|
|
90
|
+
copy_brush_mode: BarSelect
|
|
91
|
+
selection_tool_operation_mode: BarSelect
|
|
92
|
+
expand_texture_selection: Action
|
|
93
|
+
mirror_painting: Toggle
|
|
94
|
+
color_erase_mode: Toggle
|
|
95
|
+
lock_alpha: Toggle
|
|
96
|
+
painting_grid: Toggle
|
|
97
|
+
image_tiled_view: Toggle
|
|
98
|
+
image_onion_skin_view: Toggle
|
|
99
|
+
slider_brush_size: NumSlider
|
|
100
|
+
slider_brush_softness: NumSlider
|
|
101
|
+
slider_brush_opacity: NumSlider
|
|
102
|
+
pixel_perfect_drawing: Toggle
|
|
103
|
+
slider_color_select_threshold: NumSlider
|
|
104
|
+
}
|
package/custom/screencam.d.ts
CHANGED
package/custom/spline_mesh.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="./blockbench"/>
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
declare class SplineTubeFace extends MeshFace {
|
|
5
5
|
constructor(mesh: any, spline: any, data: any);
|
|
6
6
|
get element(): SplineMesh;
|
|
7
7
|
getTexture(): Texture;
|
|
@@ -14,7 +14,7 @@ interface SplineCurveOptions {
|
|
|
14
14
|
start_ctrl: any
|
|
15
15
|
end_ctrl: any
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
declare class SplineCurve {
|
|
18
18
|
constructor(spline: SplineMesh, data: SplineCurveOptions);
|
|
19
19
|
get element(): SplineMesh;
|
|
20
20
|
extend(data: SplineCurveOptions): this;
|
|
@@ -49,7 +49,7 @@ export declare class SplineCurve {
|
|
|
49
49
|
interface SplineHandle {
|
|
50
50
|
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
declare class SplineHandle {
|
|
53
53
|
constructor(spline: SplineMesh, data: SplineHandle);
|
|
54
54
|
get element(): SplineMesh;
|
|
55
55
|
extend(data: SplineHandle): this;
|
|
@@ -67,7 +67,7 @@ export declare class SplineHandle {
|
|
|
67
67
|
interface SplineMeshOptions {
|
|
68
68
|
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
declare class SplineMesh extends OutlinerElement {
|
|
71
71
|
constructor(data: any, uuid: any);
|
|
72
72
|
get vertices(): Record<string, ArrayVector3>;
|
|
73
73
|
get handles(): Record<string, SplineHandle>;
|
|
@@ -77,6 +77,7 @@ export declare class SplineMesh extends OutlinerElement {
|
|
|
77
77
|
set curves(v: Record<string, SplineCurve>);
|
|
78
78
|
get position(): ArrayVector3;
|
|
79
79
|
get vertice_list(): any[];
|
|
80
|
+
faces: Record<string, SplineTubeFace>
|
|
80
81
|
cyclic: boolean
|
|
81
82
|
export: boolean
|
|
82
83
|
display_space: boolean
|
package/custom/textures.d.ts
CHANGED
|
@@ -395,6 +395,7 @@ declare global {
|
|
|
395
395
|
static properties: Record<string, Property<any>>
|
|
396
396
|
|
|
397
397
|
static file_formats: Record<string, FileFormatOptions>
|
|
398
|
+
static getAllExtensions(): string[]
|
|
398
399
|
}
|
|
399
400
|
/**
|
|
400
401
|
* Saves all textures
|
|
@@ -520,5 +521,6 @@ declare global {
|
|
|
520
521
|
function nextFrame(): void
|
|
521
522
|
function reset(): void
|
|
522
523
|
function updateButton(): void
|
|
524
|
+
function playAnimationFrame(anim_time?: number): void
|
|
523
525
|
}
|
|
524
526
|
}
|
package/generated/api.d.ts
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
import { ModelFormat } from "./io/format";
|
|
2
2
|
import { Filesystem } from "./file_system";
|
|
3
3
|
import { MessageBoxOptions } from "./interface/dialog";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Text message
|
|
7
|
-
*/
|
|
8
|
-
text: string;
|
|
9
|
-
/**
|
|
10
|
-
* Blockbench icon string
|
|
11
|
-
*/
|
|
12
|
-
icon?: IconString;
|
|
13
|
-
/**
|
|
14
|
-
* Expire time in miliseconds
|
|
15
|
-
*/
|
|
16
|
-
expire?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Background color, accepts any CSS color string
|
|
19
|
-
*/
|
|
20
|
-
color?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Method to run on click.
|
|
23
|
-
* @returns Return `true` to close toast
|
|
24
|
-
*/
|
|
25
|
-
click?: (event: Event) => boolean;
|
|
26
|
-
}
|
|
4
|
+
import { ToastNotification, ToastNotificationOptions } from "./interface/toast_notification";
|
|
27
5
|
export declare const LastVersion: string;
|
|
28
6
|
export declare const Blockbench: {
|
|
29
7
|
isWeb: boolean;
|
|
@@ -53,7 +31,7 @@ export declare const Blockbench: {
|
|
|
53
31
|
registerEdit(): void;
|
|
54
32
|
getIconNode(icon: IconString | boolean | HTMLElement | (() => (IconString | boolean | HTMLElement)), color?: string): HTMLElement;
|
|
55
33
|
showQuickMessage(message: any, time?: number): void;
|
|
56
|
-
showToastNotification(options: ToastNotificationOptions):
|
|
34
|
+
showToastNotification(options: ToastNotificationOptions): ToastNotification;
|
|
57
35
|
setCursorTooltip(text?: string): void;
|
|
58
36
|
setProgress(progress: number, time?: number, bar?: string): void;
|
|
59
37
|
showStatusMessage(message: string, time?: number): void;
|
|
@@ -105,8 +83,9 @@ export declare const Blockbench: {
|
|
|
105
83
|
removeDragHandler: typeof Filesystem.removeDragHandler;
|
|
106
84
|
};
|
|
107
85
|
declare global {
|
|
108
|
-
interface
|
|
86
|
+
interface Window {
|
|
109
87
|
Blockbench: typeof Blockbench;
|
|
88
|
+
osfs: '/' | '\\';
|
|
110
89
|
}
|
|
111
90
|
}
|
|
112
91
|
declare const global: {
|
|
@@ -139,7 +118,7 @@ declare const global: {
|
|
|
139
118
|
registerEdit(): void;
|
|
140
119
|
getIconNode(icon: IconString | boolean | HTMLElement | (() => (IconString | boolean | HTMLElement)), color?: string): HTMLElement;
|
|
141
120
|
showQuickMessage(message: any, time?: number): void;
|
|
142
|
-
showToastNotification(options: ToastNotificationOptions):
|
|
121
|
+
showToastNotification(options: ToastNotificationOptions): ToastNotification;
|
|
143
122
|
setCursorTooltip(text?: string): void;
|
|
144
123
|
setProgress(progress: number, time?: number, bar?: string): void;
|
|
145
124
|
showStatusMessage(message: string, time?: number): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const recent_projects: RecentProjectData[];
|
|
2
|
+
export declare function initializeDesktopApp(): void;
|
|
3
|
+
export declare function loadOpenWithBlockbenchFile(): void;
|
|
4
|
+
export type RecentProjectData = {
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
day: number;
|
|
9
|
+
favorite: boolean;
|
|
10
|
+
textures?: string[];
|
|
11
|
+
animation_files?: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare function updateRecentProjects(): void;
|
|
14
|
+
export declare function addRecentProject(data: Partial<RecentProjectData>): void;
|
|
15
|
+
export declare function updateRecentProjectData(): void;
|
|
16
|
+
export declare function updateRecentProjectThumbnail(): Promise<void>;
|
|
17
|
+
export declare function loadDataFromModelMemory(): void;
|
|
18
|
+
export declare function isImageEditorValid(path: string): boolean;
|
|
19
|
+
export declare function changeImageEditor(texture?: Texture, not_found?: boolean): void;
|
|
20
|
+
export declare function openDefaultTexturePath(): void;
|
|
21
|
+
export declare function findExistingFile(paths: string[]): string;
|
|
22
|
+
export declare function createBackup(init: boolean): void;
|
|
23
|
+
declare const global: {
|
|
24
|
+
PathModule: import("path").PlatformPath;
|
|
25
|
+
recent_projects: import("./desktop").RecentProjectData[];
|
|
26
|
+
nativeImage: typeof Electron.NativeImage;
|
|
27
|
+
updateRecentProjects: typeof import("./desktop").updateRecentProjects;
|
|
28
|
+
addRecentProject: typeof import("./desktop").addRecentProject;
|
|
29
|
+
updateRecentProjectData: typeof import("./desktop").updateRecentProjectData;
|
|
30
|
+
loadDataFromModelMemory: typeof import("./desktop").loadDataFromModelMemory;
|
|
31
|
+
changeImageEditor: typeof import("./desktop").changeImageEditor;
|
|
32
|
+
openDefaultTexturePath: typeof import("./desktop").openDefaultTexturePath;
|
|
33
|
+
updateRecentProjectThumbnail: typeof import("./desktop").updateRecentProjectThumbnail;
|
|
34
|
+
createBackup: typeof import("./desktop").createBackup;
|
|
35
|
+
};
|
|
36
|
+
declare global {
|
|
37
|
+
const recent_projects: RecentProjectData[];
|
|
38
|
+
type RecentProjectData = import('./desktop').RecentProjectData;
|
|
39
|
+
const updateRecentProjects: typeof global.updateRecentProjects;
|
|
40
|
+
const addRecentProject: typeof global.addRecentProject;
|
|
41
|
+
const updateRecentProjectData: typeof global.updateRecentProjectData;
|
|
42
|
+
const updateRecentProjectThumbnail: typeof global.updateRecentProjectThumbnail;
|
|
43
|
+
const loadDataFromModelMemory: typeof global.loadDataFromModelMemory;
|
|
44
|
+
const changeImageEditor: typeof global.changeImageEditor;
|
|
45
|
+
const openDefaultTexturePath: typeof global.openDefaultTexturePath;
|
|
46
|
+
const createBackup: typeof global.createBackup;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import MolangParser from "molangjs";
|
|
2
2
|
import tinycolor from "tinycolor2";
|
|
3
|
+
import { RaycastResult } from "../preview/preview";
|
|
4
|
+
import { MenuItem } from "./menu";
|
|
3
5
|
export declare const BarItems: any;
|
|
4
6
|
type SubKeybind = {
|
|
5
7
|
name: string;
|
|
@@ -8,6 +10,7 @@ type SubKeybind = {
|
|
|
8
10
|
trigger: (event: Event) => void;
|
|
9
11
|
};
|
|
10
12
|
export interface KeybindItemOptions {
|
|
13
|
+
id?: string;
|
|
11
14
|
name?: string;
|
|
12
15
|
description?: string;
|
|
13
16
|
category?: string;
|
|
@@ -52,7 +55,7 @@ export declare abstract class BarItem extends EventSystem {
|
|
|
52
55
|
id: string;
|
|
53
56
|
name: string;
|
|
54
57
|
description: string;
|
|
55
|
-
icon?: IconString | (() => IconString);
|
|
58
|
+
icon?: IconString | ((context?: any) => IconString);
|
|
56
59
|
category?: string;
|
|
57
60
|
color?: string;
|
|
58
61
|
condition: ConditionResolvable;
|
|
@@ -112,9 +115,7 @@ export declare class KeybindItem {
|
|
|
112
115
|
description?: string;
|
|
113
116
|
};
|
|
114
117
|
};
|
|
115
|
-
constructor(id: string, data: KeybindItemOptions
|
|
116
|
-
id: string;
|
|
117
|
-
});
|
|
118
|
+
constructor(id: string, data: KeybindItemOptions);
|
|
118
119
|
delete(): void;
|
|
119
120
|
}
|
|
120
121
|
export interface ActionOptions extends BarItemOptions {
|
|
@@ -243,6 +244,10 @@ export interface BrushOptions {
|
|
|
243
244
|
* Enable the input for opacity when this tool is selected
|
|
244
245
|
*/
|
|
245
246
|
opacity: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Enable the toggle for screen space when this tool is selected
|
|
249
|
+
*/
|
|
250
|
+
screen_space: boolean;
|
|
246
251
|
/**
|
|
247
252
|
* When the brush size is an even number, offset the snapping by half a pixel so that even size brush strokes can be correctly centered
|
|
248
253
|
*/
|
|
@@ -312,7 +317,7 @@ export interface BrushOptions {
|
|
|
312
317
|
interface ToolSpecificOptions {
|
|
313
318
|
selectFace?: boolean;
|
|
314
319
|
selectElements?: boolean;
|
|
315
|
-
transformerMode?: 'translate' | 'hidden' | '';
|
|
320
|
+
transformerMode?: 'translate' | 'scale' | 'rotate' | 'stretch' | 'hidden' | '';
|
|
316
321
|
cursor?: string;
|
|
317
322
|
animation_channel?: string;
|
|
318
323
|
toolbar?: string;
|
|
@@ -329,7 +334,7 @@ interface ToolSpecificOptions {
|
|
|
329
334
|
onCanvasClick?(raycast_data: RaycastResult): void;
|
|
330
335
|
onSelect?(): void;
|
|
331
336
|
onUnselect?(): void;
|
|
332
|
-
onCanvasMouseMove?(raycast_data: RaycastResult): any;
|
|
337
|
+
onCanvasMouseMove?(raycast_data: RaycastResult | false): any;
|
|
333
338
|
onCanvasRightClick?(raycast_data: RaycastResult): any;
|
|
334
339
|
onTextureEditorClick?(raycast_data: RaycastResult): any;
|
|
335
340
|
}
|
|
@@ -393,13 +398,13 @@ interface WidgetOptions extends BarItemOptions {
|
|
|
393
398
|
export declare abstract class Widget extends BarItem {
|
|
394
399
|
constructor(id: string, data: WidgetOptions);
|
|
395
400
|
}
|
|
396
|
-
type NumSliderOptions = WidgetOptions & {
|
|
401
|
+
export type NumSliderOptions = WidgetOptions & {
|
|
397
402
|
private?: boolean;
|
|
398
403
|
settings?: {
|
|
399
404
|
default?: number;
|
|
400
405
|
min?: number;
|
|
401
406
|
max?: number;
|
|
402
|
-
interval?: number;
|
|
407
|
+
interval?: number | (() => number);
|
|
403
408
|
step?: number;
|
|
404
409
|
show_bar?: boolean;
|
|
405
410
|
limit?: boolean;
|
|
@@ -502,7 +507,7 @@ export declare class BarSlider extends Widget {
|
|
|
502
507
|
type BarSelectPropertyFormat = string | boolean | {
|
|
503
508
|
name: string | true;
|
|
504
509
|
condition?: ConditionResolvable;
|
|
505
|
-
icon?:
|
|
510
|
+
icon?: IconString;
|
|
506
511
|
};
|
|
507
512
|
interface BarSelectOptions extends WidgetOptions {
|
|
508
513
|
value?: string;
|
|
@@ -314,7 +314,7 @@ type MessageBoxCommandOptions = string | {
|
|
|
314
314
|
};
|
|
315
315
|
type MessageBoxCheckbox = string | {
|
|
316
316
|
value?: boolean;
|
|
317
|
-
condition
|
|
317
|
+
condition?: ConditionResolvable;
|
|
318
318
|
text: string;
|
|
319
319
|
};
|
|
320
320
|
export interface MessageBoxOptions {
|
|
@@ -359,7 +359,7 @@ interface ConfigDialogOptions extends DialogOptions {
|
|
|
359
359
|
}
|
|
360
360
|
export declare class ConfigDialog extends Dialog {
|
|
361
361
|
constructor(id: string, options: ConfigDialogOptions);
|
|
362
|
-
show(anchor
|
|
362
|
+
show(anchor?: HTMLElement): this;
|
|
363
363
|
build(): this;
|
|
364
364
|
delete(): void;
|
|
365
365
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface BarItemRegistry {
|
|
3
|
+
move_tool: Tool;
|
|
4
|
+
resize_tool: Tool;
|
|
5
|
+
rotate_tool: Tool;
|
|
6
|
+
pivot_tool: Tool;
|
|
7
|
+
vertex_snap_tool: Tool;
|
|
8
|
+
stretch_tool: Tool;
|
|
9
|
+
swap_tools: Action;
|
|
10
|
+
set_element_marker_color: Action;
|
|
11
|
+
randomize_marker_colors: Action;
|
|
12
|
+
new_window: Action;
|
|
13
|
+
open_model_folder: Action;
|
|
14
|
+
reload: Action;
|
|
15
|
+
open_dev_tools: Action;
|
|
16
|
+
fullscreen: Action;
|
|
17
|
+
zoom_in: Action;
|
|
18
|
+
zoom_out: Action;
|
|
19
|
+
zoom_reset: Action;
|
|
20
|
+
toggle_sidebars: Action;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The menu class lets you create content menus. Context menus can contain custom menu items, and a number of existing UI elements, including Actions, Tools, etc.
|
|
3
|
+
*
|
|
4
|
+
* ## Example
|
|
5
|
+
* ```
|
|
6
|
+
* document.addEventListener('contextmenu', event => {
|
|
7
|
+
* let items = [
|
|
8
|
+
* 'open_model',
|
|
9
|
+
* {
|
|
10
|
+
* name: 'Example',
|
|
11
|
+
* icon: 'house',
|
|
12
|
+
* click() {
|
|
13
|
+
* console.log('Hello World')
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* ];
|
|
17
|
+
* new Menu(items).open(event);
|
|
18
|
+
* })
|
|
19
|
+
* ```
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
export interface CustomMenuItem {
|
|
23
|
+
name: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
icon: IconString | boolean | ((context: any) => (IconString | boolean));
|
|
26
|
+
color?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
condition?: ConditionResolvable;
|
|
29
|
+
/**
|
|
30
|
+
* Keybind or string to display in the menu, won't work as an actual keybinding by default
|
|
31
|
+
*/
|
|
32
|
+
keybind?: Keybind | string;
|
|
33
|
+
/**
|
|
34
|
+
* If true, mark the menu item as the selected one (underlined text in default theme)
|
|
35
|
+
*/
|
|
36
|
+
marked?: boolean | ((context: any) => boolean);
|
|
37
|
+
/**
|
|
38
|
+
* Adds a search bar to the menu or submenu
|
|
39
|
+
*/
|
|
40
|
+
searchable?: boolean;
|
|
41
|
+
children?: MenuItem[] | ((context: any) => MenuItem[]);
|
|
42
|
+
click?(context?: any, event?: Event): void;
|
|
43
|
+
}
|
|
44
|
+
export type MenuItem = CustomMenuItem | Action | BarSelect | MenuSeparator | string | ((context: any) => MenuItem);
|
|
45
|
+
export type MenuOpenPositionAnchor = MouseEvent | HTMLElement | {
|
|
46
|
+
clientX: number;
|
|
47
|
+
clientY: number;
|
|
48
|
+
} | 'mouse';
|
|
49
|
+
export interface MenuOptions {
|
|
50
|
+
onOpen?(position: MenuOpenPositionAnchor, context?: any): void;
|
|
51
|
+
onClose?(): void;
|
|
52
|
+
keep_open?: boolean;
|
|
53
|
+
searchable?: boolean;
|
|
54
|
+
class?: string | string[];
|
|
55
|
+
}
|
|
56
|
+
export declare class MenuSeparator {
|
|
57
|
+
id: string;
|
|
58
|
+
label?: string;
|
|
59
|
+
menu_node: HTMLLIElement;
|
|
60
|
+
constructor(id?: string, label?: string);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Use the Menu class to create a context menu. Menus can contain custom entries and hierarchy, or existing actions and tools.
|
|
64
|
+
*/
|
|
65
|
+
export declare class Menu implements Deletable {
|
|
66
|
+
id: string;
|
|
67
|
+
children: [];
|
|
68
|
+
structure: MenuItem[] | ((context: any) => MenuItem[]);
|
|
69
|
+
options?: MenuOptions;
|
|
70
|
+
condition?: ConditionResolvable;
|
|
71
|
+
onOpen?(position: MenuOpenPositionAnchor, context?: any): void;
|
|
72
|
+
onClose?(): void;
|
|
73
|
+
node: HTMLUListElement;
|
|
74
|
+
highlight_action?: MenuItem;
|
|
75
|
+
type: string;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a new context menu
|
|
78
|
+
*/
|
|
79
|
+
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions);
|
|
80
|
+
constructor(id: string, template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions);
|
|
81
|
+
hover(node: HTMLElement, event?: Event, expand?: boolean): void;
|
|
82
|
+
/**
|
|
83
|
+
* Trigger keyboard navigation
|
|
84
|
+
* @param e Event
|
|
85
|
+
* @returns True if the input was used for navigation
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
keyNavigate(e: KeyboardEvent): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Opens the menu somewhere
|
|
91
|
+
* @param position Position where to open the menu. Can be a mouse event, or a node that the menu is spawned below.
|
|
92
|
+
* @param context Context for the click events inside the menu
|
|
93
|
+
*/
|
|
94
|
+
open(position?: MenuOpenPositionAnchor, context?: any): this;
|
|
95
|
+
/**
|
|
96
|
+
* Alias for .open()
|
|
97
|
+
*/
|
|
98
|
+
show(position?: MenuOpenPositionAnchor, context?: any): this;
|
|
99
|
+
/**
|
|
100
|
+
* Closes the menu if it's open
|
|
101
|
+
*/
|
|
102
|
+
hide(): this;
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated
|
|
105
|
+
*/
|
|
106
|
+
conditionMet(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Adds an action to the menu structure
|
|
109
|
+
* @param action Action to add
|
|
110
|
+
* @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.
|
|
111
|
+
*/
|
|
112
|
+
addAction(action: Action | CustomMenuItem | '_', path?: string | number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Remove an action or menu item from the menu
|
|
115
|
+
* @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.
|
|
116
|
+
*/
|
|
117
|
+
removeAction(path: string | Action): void;
|
|
118
|
+
/**
|
|
119
|
+
* @deprecated Use removeAction instead
|
|
120
|
+
*/
|
|
121
|
+
deleteItem(rm_item: Action): void;
|
|
122
|
+
delete(): void;
|
|
123
|
+
static open: Menu | null;
|
|
124
|
+
static closed_in_this_click?: string;
|
|
125
|
+
}
|
|
126
|
+
export declare function preventContextMenu(): void;
|
|
127
|
+
declare const global: {
|
|
128
|
+
MenuSeparator: typeof import("./menu").MenuSeparator;
|
|
129
|
+
Menu: typeof import("./menu").Menu;
|
|
130
|
+
preventContextMenu: typeof import("./menu").preventContextMenu;
|
|
131
|
+
open_menu: any;
|
|
132
|
+
};
|
|
133
|
+
declare global {
|
|
134
|
+
type Menu = import('./menu').Menu;
|
|
135
|
+
const Menu: typeof global.Menu;
|
|
136
|
+
type MenuSeparator = import('./menu').MenuSeparator;
|
|
137
|
+
const MenuSeparator: typeof global.MenuSeparator;
|
|
138
|
+
function preventContextMenu(): void;
|
|
139
|
+
let open_menu: Menu | null;
|
|
140
|
+
interface Window {
|
|
141
|
+
open_menu: Menu | null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
class BarMenu extends Menu {
|
|
3
3
|
constructor(id: any, structure: any, options?: {});
|
|
4
|
-
type: string;
|
|
5
4
|
id: any;
|
|
6
5
|
children: any[];
|
|
7
6
|
condition: any;
|
|
@@ -9,7 +8,7 @@ declare global {
|
|
|
9
8
|
name: string;
|
|
10
9
|
label: HTMLElement;
|
|
11
10
|
structure: any;
|
|
12
|
-
highlight_action:
|
|
11
|
+
highlight_action: import("./menu").MenuItem;
|
|
13
12
|
open(...args: any[]): void;
|
|
14
13
|
hide(): this;
|
|
15
14
|
highlight(action: any): void;
|
|
@@ -27,5 +26,5 @@ declare global {
|
|
|
27
26
|
function removeAction(path: any): void;
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
|
|
29
|
+
import { Menu } from "./menu";
|
|
31
30
|
export {};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Handlers can be added for existing actions like this:
|
|
7
7
|
|
|
8
8
|
### Example:
|
|
9
|
+
* @example
|
|
9
10
|
```javascript
|
|
10
11
|
// Duplicate layers when using "Duplicate" in the layers panel
|
|
11
12
|
SharedActions.add('duplicate', {
|
|
@@ -23,6 +24,10 @@
|
|
|
23
24
|
}
|
|
24
25
|
})
|
|
25
26
|
```
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Global Shared Actions namespace to access any functionality related to Shared Actions
|
|
26
31
|
*/
|
|
27
32
|
export declare const SharedActions: {
|
|
28
33
|
/**
|
|
@@ -121,5 +126,13 @@ declare const global: {
|
|
|
121
126
|
};
|
|
122
127
|
declare global {
|
|
123
128
|
const SharedActions: typeof global.SharedActions;
|
|
129
|
+
interface BarItemRegistry {
|
|
130
|
+
rename: Action;
|
|
131
|
+
delete: Action;
|
|
132
|
+
duplicate: Action;
|
|
133
|
+
select_all: Action;
|
|
134
|
+
unselect_all: Action;
|
|
135
|
+
invert_selection: Action;
|
|
136
|
+
}
|
|
124
137
|
}
|
|
125
138
|
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface ToastNotificationOptions {
|
|
2
|
+
id?: string;
|
|
3
|
+
/**
|
|
4
|
+
* Text message
|
|
5
|
+
*/
|
|
6
|
+
text: string;
|
|
7
|
+
/**
|
|
8
|
+
* Blockbench icon string
|
|
9
|
+
*/
|
|
10
|
+
icon?: IconString;
|
|
11
|
+
/**
|
|
12
|
+
* Expire time in miliseconds
|
|
13
|
+
*/
|
|
14
|
+
expire?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Background color, accepts any CSS color string
|
|
17
|
+
*/
|
|
18
|
+
color?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Method to run on click.
|
|
21
|
+
* @returns Return `true` to close toast
|
|
22
|
+
*/
|
|
23
|
+
click?: (event: Event) => boolean | void;
|
|
24
|
+
/**
|
|
25
|
+
* Method to run on close via the close button.
|
|
26
|
+
* @returns Return `falce` to cancel the close
|
|
27
|
+
*/
|
|
28
|
+
onClose?: (event: Event) => boolean | void;
|
|
29
|
+
}
|
|
30
|
+
export declare class ToastNotification {
|
|
31
|
+
node: HTMLLIElement;
|
|
32
|
+
id: string;
|
|
33
|
+
options: ToastNotificationOptions;
|
|
34
|
+
constructor(id: string, options: ToastNotificationOptions);
|
|
35
|
+
delete(): void;
|
|
36
|
+
static notifications: Record<string, ToastNotification>;
|
|
37
|
+
}
|
|
38
|
+
declare const global: {
|
|
39
|
+
ToastNotification: typeof import("./toast_notification").ToastNotification;
|
|
40
|
+
};
|
|
41
|
+
declare global {
|
|
42
|
+
type ToastNotification = import('./toast_notification').ToastNotification;
|
|
43
|
+
const ToastNotification: typeof global.ToastNotification;
|
|
44
|
+
}
|
|
45
|
+
export {};
|