blockbench-types 5.1.0 → 5.2.0-beta.0-next.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 (72) hide show
  1. package/README.md +30 -30
  2. package/custom/animation.d.ts +256 -256
  3. package/custom/animation_controller.d.ts +124 -124
  4. package/custom/blockbench.d.ts +71 -73
  5. package/custom/canvas.d.ts +307 -307
  6. package/custom/codec.d.ts +182 -182
  7. package/custom/copy_paste.d.ts +43 -42
  8. package/custom/cube.d.ts +151 -151
  9. package/custom/desktop.d.ts +61 -73
  10. package/custom/display_mode.d.ts +137 -137
  11. package/custom/edit_session.d.ts +38 -37
  12. package/custom/global.d.ts +182 -168
  13. package/custom/group.d.ts +113 -113
  14. package/custom/interface.d.ts +83 -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/menu.d.ts +137 -136
  19. package/custom/mesh.d.ts +196 -196
  20. package/custom/misc.d.ts +188 -199
  21. package/custom/molang.d.ts +159 -159
  22. package/custom/outliner.d.ts +158 -158
  23. package/custom/painter.d.ts +70 -69
  24. package/custom/preview.d.ts +147 -137
  25. package/custom/preview_scene.d.ts +120 -120
  26. package/custom/screencam.d.ts +71 -71
  27. package/custom/spline_mesh.d.ts +189 -189
  28. package/custom/texture_group.d.ts +68 -68
  29. package/custom/textures.d.ts +524 -515
  30. package/custom/timeline.d.ts +66 -66
  31. package/custom/toolbars.d.ts +222 -221
  32. package/custom/undo.d.ts +209 -208
  33. package/custom/util/version_util.d.ts +32 -32
  34. package/custom/util.d.ts +235 -235
  35. package/custom/uveditor.d.ts +3 -3
  36. package/custom/validator.d.ts +99 -99
  37. package/documentation.md +12 -12
  38. package/generated/animations/mirror_animating.d.ts +7 -0
  39. package/generated/api.d.ts +6 -0
  40. package/generated/file_system.d.ts +1 -1
  41. package/generated/formats/standards/obj.d.ts +9 -11
  42. package/generated/interface/actions.d.ts +6 -3
  43. package/generated/interface/form.d.ts +2 -1
  44. package/generated/interface/resize_lines.d.ts +2 -0
  45. package/generated/interface/settings.d.ts +6 -2
  46. package/generated/interface/start_screen.d.ts +62 -42
  47. package/generated/io/project.d.ts +9 -1
  48. package/generated/lib/CanvasFrame.d.ts +1 -0
  49. package/generated/main.d.ts +1 -1
  50. package/generated/modeling/mesh/proportional_edit.d.ts +15 -13
  51. package/generated/modeling/mirror_modeling.d.ts +4 -0
  52. package/generated/modeling/weight_paint.d.ts +11 -0
  53. package/generated/texturing/layers.d.ts +140 -0
  54. package/generated/util/state_memory.d.ts +1 -1
  55. package/index.d.ts +2 -2
  56. package/package.json +39 -39
  57. package/tsconfig.json +19 -19
  58. package/type_config.json +45 -46
  59. package/custom/start_screen.d.ts +0 -15
  60. package/custom/texture_layers.d.ts +0 -117
  61. package/generated/global_types.d.ts +0 -47
  62. package/generated/io/formats/bedrock.d.ts +0 -4
  63. package/generated/io/formats/bedrock_old.d.ts +0 -4
  64. package/generated/io/formats/collada.d.ts +0 -4
  65. package/generated/io/formats/fbx.d.ts +0 -17
  66. package/generated/io/formats/gltf.d.ts +0 -6
  67. package/generated/io/formats/java_block.d.ts +0 -4
  68. package/generated/io/formats/modded_entity.d.ts +0 -139
  69. package/generated/io/formats/obj.d.ts +0 -12
  70. package/generated/io/formats/optifine_jem.d.ts +0 -3
  71. package/generated/io/formats/optifine_jpm.d.ts +0 -3
  72. package/generated/io/formats/skin.d.ts +0 -22
package/custom/util.d.ts CHANGED
@@ -1,235 +1,235 @@
1
- /// <reference types="./blockbench"/>
2
-
3
- type ConditionResolvable<Context extends any = any> =
4
- | undefined
5
- | boolean
6
- | ((context: Context) => boolean)
7
- | Partial<{
8
- modes: string[]
9
- formats: string[]
10
- tools: string[]
11
- features: (string | keyof FormatFeatures)[]
12
- selected: {
13
- animation?: boolean
14
- animation_controller?: boolean
15
- animation_controller_state?: boolean
16
- keyframe?: boolean
17
- group?: boolean
18
- texture?: boolean
19
- element?: boolean
20
- cube?: boolean
21
- mesh?: boolean
22
- locator?: boolean
23
- null_any?: boolean
24
- texture_mesh?: boolean
25
- outliner?: boolean
26
- spline?: boolean
27
- }
28
- project: boolean
29
- method(context: Context): boolean
30
- }>
31
-
32
- /**
33
- * Tests if a condition is truthy or falsy. Returns true if the condition is unspecified
34
- * @param condition Boolean, function, any or anything else
35
- */
36
- declare function Condition<Context extends any = any>(condition: ConditionResolvable<Context>, context?: Context): boolean
37
-
38
-
39
- /**
40
- * If the input event is a touch event, convert touch event to a compatible mouse event
41
- */
42
- declare function convertTouchEvent(event: MouseEvent): MouseEvent
43
-
44
- /**
45
- * Adds an event listener to an element, except that is supports multiple event types simultaneously
46
- * @param element Target Element
47
- * @param events Event types, separated by space characters
48
- * @param func Function
49
- * @param option Option
50
- */
51
- declare function addEventListeners(
52
- element: HTMLElement | Document,
53
- events: string,
54
- func: (event: Event) => void,
55
- option?: any
56
- ): void
57
- declare function removeEventListeners(
58
- el: HTMLElement | Document,
59
- events: string,
60
- func: (event: Event) => void,
61
- option?: any
62
- ): void
63
-
64
- /**
65
- * @deprecated Use {@link VersionUtil.compare} instead.
66
- */
67
- declare function compareVersions(versionA: any, versionB: any): boolean
68
- /**
69
- * Sets properties such as clientX on a TouchEvent based on touches. The use of the PointerEvent API is recommended instead.
70
- * @param event
71
- */
72
- declare function convertTouchEvent(event: TouchEvent | MouseEvent): MouseEvent
73
- /**
74
- * Generate a new random UUID
75
- */
76
- declare function guid(): string
77
- /**
78
- * Returns true if the passed input is a UUID
79
- */
80
- declare function isUUID(s: string): boolean
81
- declare function bbuid(length: number): string
82
- declare function trimFloatNumber(value: number, decimal_places: number = 4): string
83
- declare function getAxisLetter(axisNumber: number): string
84
- declare function getAxisNumber(axisLetter: string): number
85
- declare function limitNumber(number: any, min: any, max: any): any
86
- declare function highestInObject(obj: any, inverse: any): string
87
- declare function getRectangle(
88
- a: any,
89
- b: any,
90
- c: any,
91
- d: any
92
- ): {
93
- ax: any
94
- ay: any
95
- bx: any
96
- by: any
97
- x: number
98
- w: number
99
- y: number
100
- h: number
101
- }
102
- declare function doRectanglesOverlap(rect1: any, rect2: any): boolean
103
- declare function omitKeys(obj: any, keys: any, dual_level?: boolean): {}
104
- declare function get(options: any, name: any, defaultValue: any): any
105
- declare function getKeyByValue(any: any, value: any): any
106
- declare function onVueSetup(func: any): void
107
- declare function capitalizeFirstLetter(string: any): any
108
- declare function pluralS(arr: any): '' | 's'
109
- declare function pathToName(path: string, extension: boolean = false): string | ''
110
- declare function pathToExtension(path: string): string | ''
111
- declare function intToRGBA(int: any): {
112
- r: number
113
- g: number
114
- b: number
115
- a: number
116
- }
117
- declare function getAverageRGB(
118
- imgEl: any,
119
- blockSize: any
120
- ): {
121
- r: number
122
- g: number
123
- b: number
124
- }
125
- declare function stringifyLargeInt(int: any): any
126
- declare function intersectLines(p1: any, p2: any, p3: any, p4: any): boolean
127
- declare function pointInRectangle(point: any, rect_start: any, rect_end: any): boolean
128
- declare function lineIntersectsRectangle(p1: any, p2: any, rect_start: any, rect_end: any): boolean
129
- declare function cameraTargetToRotation(position: any, target: any): any[]
130
- declare function cameraRotationToTarget(position: any, rotation: any): any
131
-
132
- /**
133
- *
134
- * @param condition Input condition. Can be undefined, a boolean, a function or a condition any
135
- * @param context
136
- * Reusable data types that can be used by anything, but should not be used to store data between function calls. Can be used to save memory on frequent function calls.
137
- */
138
- declare function Condition(condition: (() => boolean) | undefined | boolean, context: any): boolean
139
- declare namespace Condition {
140
- function mutuallyExclusive(a: any, b: any): boolean
141
- }
142
- declare function asyncLoop(o: any): void
143
- declare namespace Objector {
144
- function equalKeys(obj: any, ref: any): boolean
145
- function keyLength(obj: any): number
146
- }
147
- declare namespace Merge {
148
- export function number(obj: any, source: any, index?: any): void
149
- export function string(obj: any, source: any, index?: any, validate?: boolean): void
150
- export function molang(obj: any, source: any, index?: any): void
151
- export function boolean(obj: any, source: any, index?: any, validate?: boolean): void
152
- export function _function(obj: any, source: any, index?: any, validate?: boolean): void
153
- export { _function as function }
154
- export function arrayVector(obj: any, source: any, index?: any, validate?: boolean): void
155
- export function arrayVector2(obj: any, source: any, index?: any, validate?: boolean): void
156
- }
157
-
158
- /**
159
- * Reusable data types that can be used by anything, but should not be used to store data between function calls. Can be used to save memory on frequent function calls.
160
- */
161
- declare namespace Reusable {
162
- const vec1: THREE.Vector3
163
- const vec2: THREE.Vector3
164
- const vec3: THREE.Vector3
165
- const vec4: THREE.Vector3
166
- const vec5: THREE.Vector3
167
- const vec6: THREE.Vector3
168
- const vec7: THREE.Vector3
169
- const vec8: THREE.Vector3
170
- const quat1: THREE.Quaternion
171
- const quat2: THREE.Quaternion
172
- const euler1: THREE.Euler
173
- const euler2: THREE.Euler
174
- }
175
-
176
- declare function getCurrentGroup(): Group
177
-
178
- /**
179
- * Merge the value under a certain key from one object into another
180
- */
181
- declare namespace Merge {
182
- function number(target: object, source: object, key: string | number): void
183
- function string(
184
- target: object,
185
- source: object,
186
- key: string | number,
187
- validate?: (value: string) => boolean
188
- ): void
189
- function molang(target: object, source: object, key: string | number): void
190
- function boolean(
191
- target: object,
192
- source: object,
193
- key: string | number,
194
- validate?: (value: boolean) => boolean
195
- ): void
196
- function arrayVector(
197
- target: object,
198
- source: object,
199
- key: string | number,
200
- validate?: (value: number[]) => boolean
201
- ): void
202
- function arrayVector2(
203
- target: object,
204
- source: object,
205
- key: string | number,
206
- validate?: (value: ArrayVector2) => boolean
207
- ): void
208
- }
209
-
210
- declare class Rectangle {
211
- constructor(start_x: number, start_y: number, width: number, height: number)
212
- start_x: number
213
- start_y: number
214
- width: number
215
- height: number
216
- readonly start: ArrayVector2
217
- readonly w: number
218
- readonly h: number
219
- end_x: number
220
- end_y: number
221
- readonly area: number
222
- fromCoords(x1: number, y1: number, x2: number, y2: number): void
223
- fromUnorderedCoords(x1: number, y1: number, x2: number, y2: number): void
224
- expandTo(x: number, y: number): void
225
- }
226
-
227
- /**
228
- * TGA / Targa library
229
- */
230
- declare class Targa {
231
- constructor()
232
- load(data: Uint8Array)
233
- getDataURL(): string
234
- open(file: any, callback: () => void)
235
- }
1
+ /// <reference types="./blockbench"/>
2
+
3
+ type ConditionResolvable<Context extends any = any> =
4
+ | undefined
5
+ | boolean
6
+ | ((context: Context) => boolean)
7
+ | Partial<{
8
+ modes: string[]
9
+ formats: string[]
10
+ tools: string[]
11
+ features: (string | keyof FormatFeatures)[]
12
+ selected: {
13
+ animation?: boolean
14
+ animation_controller?: boolean
15
+ animation_controller_state?: boolean
16
+ keyframe?: boolean
17
+ group?: boolean
18
+ texture?: boolean
19
+ element?: boolean
20
+ cube?: boolean
21
+ mesh?: boolean
22
+ locator?: boolean
23
+ null_any?: boolean
24
+ texture_mesh?: boolean
25
+ outliner?: boolean
26
+ spline?: boolean
27
+ }
28
+ project: boolean
29
+ method(context: Context): boolean
30
+ }>
31
+
32
+ /**
33
+ * Tests if a condition is truthy or falsy. Returns true if the condition is unspecified
34
+ * @param condition Boolean, function, any or anything else
35
+ */
36
+ declare function Condition<Context extends any = any>(condition: ConditionResolvable<Context>, context?: Context): boolean
37
+
38
+
39
+ /**
40
+ * If the input event is a touch event, convert touch event to a compatible mouse event
41
+ */
42
+ declare function convertTouchEvent(event: MouseEvent): MouseEvent
43
+
44
+ /**
45
+ * Adds an event listener to an element, except that is supports multiple event types simultaneously
46
+ * @param element Target Element
47
+ * @param events Event types, separated by space characters
48
+ * @param func Function
49
+ * @param option Option
50
+ */
51
+ declare function addEventListeners(
52
+ element: HTMLElement | Document,
53
+ events: string,
54
+ func: (event: Event) => void,
55
+ option?: any
56
+ ): void
57
+ declare function removeEventListeners(
58
+ el: HTMLElement | Document,
59
+ events: string,
60
+ func: (event: Event) => void,
61
+ option?: any
62
+ ): void
63
+
64
+ /**
65
+ * @deprecated Use {@link VersionUtil.compare} instead.
66
+ */
67
+ declare function compareVersions(versionA: any, versionB: any): boolean
68
+ /**
69
+ * Sets properties such as clientX on a TouchEvent based on touches. The use of the PointerEvent API is recommended instead.
70
+ * @param event
71
+ */
72
+ declare function convertTouchEvent(event: TouchEvent | MouseEvent): MouseEvent
73
+ /**
74
+ * Generate a new random UUID
75
+ */
76
+ declare function guid(): string
77
+ /**
78
+ * Returns true if the passed input is a UUID
79
+ */
80
+ declare function isUUID(s: string): boolean
81
+ declare function bbuid(length: number): string
82
+ declare function trimFloatNumber(value: number, decimal_places: number = 4): string
83
+ declare function getAxisLetter(axisNumber: number): string
84
+ declare function getAxisNumber(axisLetter: string): number
85
+ declare function limitNumber(number: any, min: any, max: any): any
86
+ declare function highestInObject(obj: any, inverse: any): string
87
+ declare function getRectangle(
88
+ a: any,
89
+ b: any,
90
+ c: any,
91
+ d: any
92
+ ): {
93
+ ax: any
94
+ ay: any
95
+ bx: any
96
+ by: any
97
+ x: number
98
+ w: number
99
+ y: number
100
+ h: number
101
+ }
102
+ declare function doRectanglesOverlap(rect1: any, rect2: any): boolean
103
+ declare function omitKeys(obj: any, keys: any, dual_level?: boolean): {}
104
+ declare function get(options: any, name: any, defaultValue: any): any
105
+ declare function getKeyByValue(any: any, value: any): any
106
+ declare function onVueSetup(func: any): void
107
+ declare function capitalizeFirstLetter(string: any): any
108
+ declare function pluralS(arr: any): '' | 's'
109
+ declare function pathToName(path: string, extension: boolean = false): string | ''
110
+ declare function pathToExtension(path: string): string | ''
111
+ declare function intToRGBA(int: any): {
112
+ r: number
113
+ g: number
114
+ b: number
115
+ a: number
116
+ }
117
+ declare function getAverageRGB(
118
+ imgEl: any,
119
+ blockSize: any
120
+ ): {
121
+ r: number
122
+ g: number
123
+ b: number
124
+ }
125
+ declare function stringifyLargeInt(int: any): any
126
+ declare function intersectLines(p1: any, p2: any, p3: any, p4: any): boolean
127
+ declare function pointInRectangle(point: any, rect_start: any, rect_end: any): boolean
128
+ declare function lineIntersectsRectangle(p1: any, p2: any, rect_start: any, rect_end: any): boolean
129
+ declare function cameraTargetToRotation(position: any, target: any): any[]
130
+ declare function cameraRotationToTarget(position: any, rotation: any): any
131
+
132
+ /**
133
+ *
134
+ * @param condition Input condition. Can be undefined, a boolean, a function or a condition any
135
+ * @param context
136
+ * Reusable data types that can be used by anything, but should not be used to store data between function calls. Can be used to save memory on frequent function calls.
137
+ */
138
+ declare function Condition(condition: (() => boolean) | undefined | boolean, context: any): boolean
139
+ declare namespace Condition {
140
+ function mutuallyExclusive(a: any, b: any): boolean
141
+ }
142
+ declare function asyncLoop(o: any): void
143
+ declare namespace Objector {
144
+ function equalKeys(obj: any, ref: any): boolean
145
+ function keyLength(obj: any): number
146
+ }
147
+ declare namespace Merge {
148
+ export function number(obj: any, source: any, index?: any): void
149
+ export function string(obj: any, source: any, index?: any, validate?: boolean): void
150
+ export function molang(obj: any, source: any, index?: any): void
151
+ export function boolean(obj: any, source: any, index?: any, validate?: boolean): void
152
+ export function _function(obj: any, source: any, index?: any, validate?: boolean): void
153
+ export { _function as function }
154
+ export function arrayVector(obj: any, source: any, index?: any, validate?: boolean): void
155
+ export function arrayVector2(obj: any, source: any, index?: any, validate?: boolean): void
156
+ }
157
+
158
+ /**
159
+ * Reusable data types that can be used by anything, but should not be used to store data between function calls. Can be used to save memory on frequent function calls.
160
+ */
161
+ declare namespace Reusable {
162
+ const vec1: THREE.Vector3
163
+ const vec2: THREE.Vector3
164
+ const vec3: THREE.Vector3
165
+ const vec4: THREE.Vector3
166
+ const vec5: THREE.Vector3
167
+ const vec6: THREE.Vector3
168
+ const vec7: THREE.Vector3
169
+ const vec8: THREE.Vector3
170
+ const quat1: THREE.Quaternion
171
+ const quat2: THREE.Quaternion
172
+ const euler1: THREE.Euler
173
+ const euler2: THREE.Euler
174
+ }
175
+
176
+ declare function getCurrentGroup(): Group
177
+
178
+ /**
179
+ * Merge the value under a certain key from one object into another
180
+ */
181
+ declare namespace Merge {
182
+ function number(target: object, source: object, key: string | number): void
183
+ function string(
184
+ target: object,
185
+ source: object,
186
+ key: string | number,
187
+ validate?: (value: string) => boolean
188
+ ): void
189
+ function molang(target: object, source: object, key: string | number): void
190
+ function boolean(
191
+ target: object,
192
+ source: object,
193
+ key: string | number,
194
+ validate?: (value: boolean) => boolean
195
+ ): void
196
+ function arrayVector(
197
+ target: object,
198
+ source: object,
199
+ key: string | number,
200
+ validate?: (value: number[]) => boolean
201
+ ): void
202
+ function arrayVector2(
203
+ target: object,
204
+ source: object,
205
+ key: string | number,
206
+ validate?: (value: ArrayVector2) => boolean
207
+ ): void
208
+ }
209
+
210
+ declare class Rectangle {
211
+ constructor(start_x: number, start_y: number, width: number, height: number)
212
+ start_x: number
213
+ start_y: number
214
+ width: number
215
+ height: number
216
+ readonly start: ArrayVector2
217
+ readonly w: number
218
+ readonly h: number
219
+ end_x: number
220
+ end_y: number
221
+ readonly area: number
222
+ fromCoords(x1: number, y1: number, x2: number, y2: number): void
223
+ fromUnorderedCoords(x1: number, y1: number, x2: number, y2: number): void
224
+ expandTo(x: number, y: number): void
225
+ }
226
+
227
+ /**
228
+ * TGA / Targa library
229
+ */
230
+ declare class Targa {
231
+ constructor()
232
+ load(data: Uint8Array)
233
+ getDataURL(): string
234
+ open(file: any, callback: () => void)
235
+ }
@@ -1,3 +1,3 @@
1
- // FIXME - this is a hack to get around the fact that the UVEditor class is not documented.
2
- // I just wanted to remove the red squiggles in my editor.
3
- declare const UVEditor: any
1
+ // FIXME - this is a hack to get around the fact that the UVEditor class is not documented.
2
+ // I just wanted to remove the red squiggles in my editor.
3
+ declare const UVEditor: any
@@ -1,99 +1,99 @@
1
- /// <reference types="./blockbench"/>
2
- /**
3
- * The validator in Blockbench provides feedback about the model and can detect issues in real time, based on a list of checks that can be added. This is a good way to ensure model files are valid, and to teach users about best practices.
4
- */
5
- declare namespace Validator {
6
- const checks: ValidatorCheck[]
7
-
8
- const warnings: WarningOrError[]
9
- const errors: WarningOrError[]
10
- /**
11
- * Run the validator
12
- * @param trigger ID of the Blockbench event that triggered the call
13
- */
14
- function validate<T extends BlockbenchEventName>(trigger?: T): void
15
- /**
16
- * Opens the Validator dialog
17
- */
18
- function openDialog(): void
19
-
20
- /**
21
- * Cached trigger IDs
22
- */
23
- const triggers: BlockbenchEventName[]
24
- /**
25
- * Update the cached triggers list
26
- */
27
- function updateCashedTriggers(): void
28
- }
29
-
30
- interface ValidatorCheckOptions {
31
- /**
32
- * Function that runs when the validator check runs
33
- */
34
- run(): void
35
- /**
36
- * Names of events that automatically trigger this check
37
- */
38
- update_triggers?: BlockbenchEventName[]
39
- condition?: ConditionResolvable
40
- }
41
- interface WarningOrError {
42
- message: string
43
- buttons?: {
44
- name: string
45
- icon: IconString
46
- click(): void
47
- }[]
48
- }
49
-
50
- /**
51
- * A check for the validator. A check can be triggered by certain things, and updates the list of warnings and errors that can be displayed in the status bar.
52
-
53
-
54
- ### Example:
55
-
56
- ```javascript
57
- new ValidatorCheck('special_cube_name_rule', {
58
- update_triggers: ['update_selection'],
59
- run() {
60
- Cube.all.forEach(cube => {
61
- if (cube.name == 'sphere') {
62
- this.warn({
63
- message: `The cube "${cube.name}" has an invalid names. Cubes may not be called "sphere".`,
64
- buttons: [
65
- {
66
- name: 'Select Cube',
67
- icon: 'fa-cube',
68
- click() {
69
- Validator.dialog.hide();
70
- cube.select();
71
- }
72
- }
73
- ]
74
- })
75
- }
76
- })
77
- }
78
- })
79
- ```
80
- */
81
- declare class ValidatorCheck extends Deletable {
82
- id: string
83
- name: string
84
- plugin?: string
85
- constructor(id: string, options: ValidatorCheckOptions)
86
-
87
- /**
88
- * Manually run this check
89
- */
90
- update(): void
91
- /**
92
- * Throw a warning. This is intended to be used inside the run() method
93
- */
94
- warn(...warnings: WarningOrError[]): void
95
- /**
96
- * Throw an error. This is intended to be used inside the run() method
97
- */
98
- fail(...warnings: WarningOrError[]): void
99
- }
1
+ /// <reference types="./blockbench"/>
2
+ /**
3
+ * The validator in Blockbench provides feedback about the model and can detect issues in real time, based on a list of checks that can be added. This is a good way to ensure model files are valid, and to teach users about best practices.
4
+ */
5
+ declare namespace Validator {
6
+ const checks: ValidatorCheck[]
7
+
8
+ const warnings: WarningOrError[]
9
+ const errors: WarningOrError[]
10
+ /**
11
+ * Run the validator
12
+ * @param trigger ID of the Blockbench event that triggered the call
13
+ */
14
+ function validate<T extends BlockbenchEventName>(trigger?: T): void
15
+ /**
16
+ * Opens the Validator dialog
17
+ */
18
+ function openDialog(): void
19
+
20
+ /**
21
+ * Cached trigger IDs
22
+ */
23
+ const triggers: BlockbenchEventName[]
24
+ /**
25
+ * Update the cached triggers list
26
+ */
27
+ function updateCashedTriggers(): void
28
+ }
29
+
30
+ interface ValidatorCheckOptions {
31
+ /**
32
+ * Function that runs when the validator check runs
33
+ */
34
+ run(): void
35
+ /**
36
+ * Names of events that automatically trigger this check
37
+ */
38
+ update_triggers?: BlockbenchEventName[]
39
+ condition?: ConditionResolvable
40
+ }
41
+ interface WarningOrError {
42
+ message: string
43
+ buttons?: {
44
+ name: string
45
+ icon: IconString
46
+ click(): void
47
+ }[]
48
+ }
49
+
50
+ /**
51
+ * A check for the validator. A check can be triggered by certain things, and updates the list of warnings and errors that can be displayed in the status bar.
52
+
53
+
54
+ ### Example:
55
+
56
+ ```javascript
57
+ new ValidatorCheck('special_cube_name_rule', {
58
+ update_triggers: ['update_selection'],
59
+ run() {
60
+ Cube.all.forEach(cube => {
61
+ if (cube.name == 'sphere') {
62
+ this.warn({
63
+ message: `The cube "${cube.name}" has an invalid names. Cubes may not be called "sphere".`,
64
+ buttons: [
65
+ {
66
+ name: 'Select Cube',
67
+ icon: 'fa-cube',
68
+ click() {
69
+ Validator.dialog.hide();
70
+ cube.select();
71
+ }
72
+ }
73
+ ]
74
+ })
75
+ }
76
+ })
77
+ }
78
+ })
79
+ ```
80
+ */
81
+ declare class ValidatorCheck extends Deletable {
82
+ id: string
83
+ name: string
84
+ plugin?: string
85
+ constructor(id: string, options: ValidatorCheckOptions)
86
+
87
+ /**
88
+ * Manually run this check
89
+ */
90
+ update(): void
91
+ /**
92
+ * Throw a warning. This is intended to be used inside the run() method
93
+ */
94
+ warn(...warnings: WarningOrError[]): void
95
+ /**
96
+ * Throw an error. This is intended to be used inside the run() method
97
+ */
98
+ fail(...warnings: WarningOrError[]): void
99
+ }