blockbench-types 4.6.0 → 4.6.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.
- package/package.json +10 -3
- package/scripts/generate_docs.js +368 -0
- package/tsconfig.json +16 -0
- package/types/action.d.ts +53 -10
- package/types/animation.d.ts +20 -20
- package/types/animation_controller.d.ts +21 -21
- package/types/{index.d.ts → blockbench.d.ts} +177 -27
- package/types/canvas.d.ts +65 -65
- package/types/codec.d.ts +62 -1
- package/types/cube.d.ts +90 -67
- package/types/dialog.d.ts +39 -36
- package/types/display_mode.d.ts +5 -5
- package/types/group.d.ts +74 -0
- package/types/interface.d.ts +2 -2
- package/types/keyframe.d.ts +10 -11
- package/types/menu.d.ts +2 -5
- package/types/mesh.d.ts +65 -64
- package/types/misc.d.ts +5 -5
- package/types/mode.d.ts +5 -5
- package/types/outliner.d.ts +16 -89
- package/types/painter.d.ts +3 -3
- package/types/panel.d.ts +2 -2
- package/types/plugin.d.ts +4 -0
- package/types/screencam.d.ts +5 -0
- package/types/settings.d.ts +10 -10
- package/types/textures.d.ts +2 -2
- package/types/timeline.d.ts +4 -1
- package/types/undo.d.ts +28 -8
- package/types/util.d.ts +1 -3
- package/types/validator.d.ts +2 -2
- package/types/file_system.d.ts +0 -145
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blockbench-types",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"description": "Blockbench typescript types",
|
|
5
5
|
"main": "",
|
|
6
|
-
"types": "types/
|
|
6
|
+
"types": "types/blockbench.d.ts",
|
|
7
7
|
"typeScriptVersion": "3.2",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -17,11 +17,18 @@
|
|
|
17
17
|
"url": "https://github.com/JannisX11/blockbench-types/issues"
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/JannisX11/blockbench-types#readme",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"generate": "node ./scripts/generate_docs.js"
|
|
22
|
+
},
|
|
20
23
|
"dependencies": {
|
|
21
24
|
"@types/jquery": "^3.5.4",
|
|
22
25
|
"@types/tinycolor2": "^1.4.3",
|
|
23
26
|
"three": "^0.129.0",
|
|
27
|
+
"typescript": "^4.9.5",
|
|
24
28
|
"vue": "^2.6.14",
|
|
25
|
-
"wintersky": "^1.2.
|
|
29
|
+
"wintersky": "^1.2.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typedoc": "^0.23.24"
|
|
26
33
|
}
|
|
27
34
|
}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
const TypeDoc = require("typedoc");
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const PathModule = require('path');
|
|
4
|
+
|
|
5
|
+
//const out_path = '../docs/';
|
|
6
|
+
const out_path = '../../blockbench.net/content/api/';
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
const app = new TypeDoc.Application();
|
|
10
|
+
|
|
11
|
+
// If you want TypeDoc to load tsconfig.json / typedoc.json files
|
|
12
|
+
app.options.addReader(new TypeDoc.TSConfigReader());
|
|
13
|
+
app.options.addReader(new TypeDoc.TypeDocReader());
|
|
14
|
+
|
|
15
|
+
app.bootstrap({
|
|
16
|
+
entryPoints: [
|
|
17
|
+
"./types/blockbench.d.ts",
|
|
18
|
+
"./types/textures.d.ts",
|
|
19
|
+
"./types/action.d.ts",
|
|
20
|
+
"./types/animation.d.ts",
|
|
21
|
+
"./types/animation_controller.d.ts",
|
|
22
|
+
"./types/canvas.d.ts",
|
|
23
|
+
"./types/codec.d.ts",
|
|
24
|
+
"./types/format.d.ts",
|
|
25
|
+
"./types/global.d.ts",
|
|
26
|
+
"./types/interface.d.ts",
|
|
27
|
+
"./types/dialog.d.ts",
|
|
28
|
+
"./types/panel.d.ts",
|
|
29
|
+
"./types/keyframe.d.ts",
|
|
30
|
+
"./types/legacy.d.ts",
|
|
31
|
+
"./types/menu.d.ts",
|
|
32
|
+
"./types/outliner.d.ts",
|
|
33
|
+
"./types/group.d.ts",
|
|
34
|
+
"./types/cube.d.ts",
|
|
35
|
+
"./types/mesh.d.ts",
|
|
36
|
+
"./types/plugin.d.ts",
|
|
37
|
+
"./types/preview.d.ts",
|
|
38
|
+
"./types/project.d.ts",
|
|
39
|
+
"./types/mode.d.ts",
|
|
40
|
+
"./types/settings.d.ts",
|
|
41
|
+
"./types/timeline.d.ts",
|
|
42
|
+
"./types/undo.d.ts",
|
|
43
|
+
"./types/painter.d.ts",
|
|
44
|
+
"./types/screencam.d.ts",
|
|
45
|
+
"./types/validator.d.ts",
|
|
46
|
+
"./types/display_mode.d.ts",
|
|
47
|
+
"./types/misc.d.ts",
|
|
48
|
+
"./types/util.d.ts"
|
|
49
|
+
],
|
|
50
|
+
sort: ['source-order'],
|
|
51
|
+
commentStyle: "all"
|
|
52
|
+
//json: "./json/test.json",
|
|
53
|
+
//pretty: true
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
let skip_files = ['global', 'legacy'];
|
|
57
|
+
|
|
58
|
+
console.log('Scanning...');
|
|
59
|
+
|
|
60
|
+
const project = app.convert();
|
|
61
|
+
|
|
62
|
+
if (!project) return; // Failed to parse types
|
|
63
|
+
|
|
64
|
+
console.log('Scanned types');
|
|
65
|
+
|
|
66
|
+
const external = {
|
|
67
|
+
'ConditionResolvable': '[ConditionResolvable](https://github.com/JannisX11/blockbench-types/blob/main/types/util.d.ts#L1)',
|
|
68
|
+
|
|
69
|
+
'Vue.Component': '[Vue.Component](https://v2.vuejs.org/v2/guide/components.html)',
|
|
70
|
+
|
|
71
|
+
'THREE.Vector3': '[THREE.Vector3](https://threejs.org/docs/index.html#api/en/math/Vector3)',
|
|
72
|
+
'THREE.Euler': '[THREE.Euler](https://threejs.org/docs/index.html#api/en/math/Euler)',
|
|
73
|
+
'THREE.Quaternion': '[THREE.Quaternion](https://threejs.org/docs/index.html#api/en/math/Quaternion)',
|
|
74
|
+
'THREE.Object3D': '[THREE.Object3D](https://threejs.org/docs/index.html#api/en/core/Object3D)',
|
|
75
|
+
'THREE.PerspectiveCamera': '[THREE.PerspectiveCamera](https://threejs.org/docs/index.html#api/en/cameras/PerspectiveCamera)',
|
|
76
|
+
'THREE.OrthographicCamera': '[THREE.OrthographicCamera](https://threejs.org/docs/index.html#api/en/cameras/OrthographicCamera)',
|
|
77
|
+
'THREE.WebGLRenderer': '[THREE.WebGLRenderer](https://threejs.org/docs/index.html#api/en/renderers/WebGLRenderer)',
|
|
78
|
+
|
|
79
|
+
'HTMLElement': '[HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement)',
|
|
80
|
+
'HTMLCanvasElement': '[HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement)',
|
|
81
|
+
'HTMLAudioElement': '[HTMLAudioElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement)',
|
|
82
|
+
'CanvasRenderingContext2D': '[CanvasRenderingContext2D](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D)',
|
|
83
|
+
'Date': '[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)',
|
|
84
|
+
'Event': '[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event)',
|
|
85
|
+
'PointerEvent': '[PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent)',
|
|
86
|
+
}
|
|
87
|
+
let top_level_references = {};
|
|
88
|
+
let top_level_hidden_references = {};
|
|
89
|
+
for (let file of project.children) {
|
|
90
|
+
let file_name = file.name.replace(/[^\w]/gi, '');
|
|
91
|
+
for (let concept of file.children) {
|
|
92
|
+
anchor_name = concept.name.replace(/[^\w]/gi, '').replace(/^_/, '').toLowerCase();
|
|
93
|
+
if (anchor_name == file_name) anchor_name += '-1';
|
|
94
|
+
|
|
95
|
+
if (concept.kindString == 'Interface' || concept.kindString == 'Type alias') {
|
|
96
|
+
top_level_hidden_references[concept.name] = `[${concept.name}](${concept.sources?.[0]?.url || ''})`;
|
|
97
|
+
} else {
|
|
98
|
+
top_level_references[concept.name] = file_name + '#' + anchor_name;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function getReferenceLink(reference) {
|
|
104
|
+
if (reference.qualifiedName && (external[reference.qualifiedName] || external[reference.name])) {
|
|
105
|
+
return (external[reference.qualifiedName] || external[reference.name]);
|
|
106
|
+
}
|
|
107
|
+
if (top_level_hidden_references[reference.name]) {
|
|
108
|
+
return top_level_hidden_references[reference.name];
|
|
109
|
+
}
|
|
110
|
+
let link = '#' + reference.name;
|
|
111
|
+
if (top_level_references[reference.name]) {
|
|
112
|
+
link = top_level_references[reference.name];
|
|
113
|
+
}
|
|
114
|
+
return `[${reference.name}](${link})`
|
|
115
|
+
}
|
|
116
|
+
function getType(type) {
|
|
117
|
+
if (!type) return 'Function'
|
|
118
|
+
|
|
119
|
+
switch (type.type) {
|
|
120
|
+
case 'reflection': return `[See types](${type.declaration?.sources?.[0]?.url || ''})`;
|
|
121
|
+
|
|
122
|
+
case 'intrinsic': return '*' + type.name + '*';
|
|
123
|
+
|
|
124
|
+
case 'tuple': return 'Array';
|
|
125
|
+
|
|
126
|
+
case 'literal': return typeof type.value == 'string' ? ('`"' + type.value + '"`') : ('`' + type.value + '`');
|
|
127
|
+
|
|
128
|
+
case 'reference': {
|
|
129
|
+
if (type.name == 'Partial' && type.typeArguments?.[0]) {
|
|
130
|
+
return getType(type.typeArguments?.[0])
|
|
131
|
+
}
|
|
132
|
+
return getReferenceLink(type)
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
case 'array': return 'Array of ' + getType(type.elementType);
|
|
136
|
+
|
|
137
|
+
case 'union': return type.types.map(t => getType(t)).join(' or ');
|
|
138
|
+
|
|
139
|
+
default: return '';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function addComments(object, lines, default_value) {
|
|
143
|
+
if (object.comment?.summary) {
|
|
144
|
+
for (let comment of object.comment.summary) {
|
|
145
|
+
lines.push(comment.text, '');
|
|
146
|
+
}
|
|
147
|
+
} else if (default_value) {
|
|
148
|
+
lines.push(default_value, '');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function addArgumentTree(arguments, lines) {
|
|
152
|
+
if (arguments?.length) lines.push('##### Arguments:');
|
|
153
|
+
function generateArgumentList(list, depth) {
|
|
154
|
+
list.forEach((object) => {
|
|
155
|
+
let line = '';
|
|
156
|
+
let is_nested = (object.type?.type == 'reference' && object.type.reflection && object.type.reflection.children && object.type.reflection.kindString == 'Interface');
|
|
157
|
+
for (let i = 0; i < depth; i++) {
|
|
158
|
+
line += '\t';
|
|
159
|
+
}
|
|
160
|
+
line += '* `' + object.name + '`: ' + (is_nested ? object.type?.name : getType(object.type));
|
|
161
|
+
if (object.flags.isOptional) line += ' (Optional)';
|
|
162
|
+
if (object.comment?.summary) {
|
|
163
|
+
line += ' -';
|
|
164
|
+
for (let comment of object.comment.summary) {
|
|
165
|
+
line += ' ' + comment.text;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
lines.push(line);
|
|
169
|
+
|
|
170
|
+
if (is_nested) {
|
|
171
|
+
generateArgumentList(object.type.reflection.children, depth + 1);
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
generateArgumentList(arguments, 0);
|
|
176
|
+
lines.push('');
|
|
177
|
+
}
|
|
178
|
+
function generateArgumentSuffix(arguments) {
|
|
179
|
+
if (arguments && arguments.length) {
|
|
180
|
+
let args = '';
|
|
181
|
+
let required_args = arguments.filter(p => !p.flags.isOptional).map(p => p.name).join(', ');
|
|
182
|
+
let optional_args = arguments.filter(p => p.flags.isOptional).map(p => p.name).join(', ');
|
|
183
|
+
if (required_args && optional_args) {
|
|
184
|
+
args = required_args + '[, ' + optional_args + ']';
|
|
185
|
+
} else if (required_args) {
|
|
186
|
+
args = required_args
|
|
187
|
+
} else if (optional_args) {
|
|
188
|
+
args = '['+optional_args+']';
|
|
189
|
+
}
|
|
190
|
+
return `( ${args} )`;
|
|
191
|
+
} else {
|
|
192
|
+
return '()';
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function toTitleCase(input) {
|
|
196
|
+
return input.split(/[ _.-]/).map(word => word[0].toUpperCase() + word.substring(1)).join(' ');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
let num_files = 0;
|
|
203
|
+
for (let file of project.children) {
|
|
204
|
+
if (skip_files.includes(file.name)) continue;
|
|
205
|
+
|
|
206
|
+
let file_name = file.name.replace(/[^\w]/gi, '');
|
|
207
|
+
let display_name = toTitleCase(file.name);
|
|
208
|
+
let markdown_lines = [
|
|
209
|
+
'---', `title: ${display_name}`, '---',
|
|
210
|
+
'',
|
|
211
|
+
`# ${display_name}`
|
|
212
|
+
];
|
|
213
|
+
let addLine = (s, empty_after) => {
|
|
214
|
+
markdown_lines.push(s || '');
|
|
215
|
+
if (empty_after && s) markdown_lines.push('');
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
for (let concept of file.children) {
|
|
220
|
+
if (concept.kindString == 'Interface') continue;
|
|
221
|
+
if (concept.kindString == 'Type alias') continue;
|
|
222
|
+
|
|
223
|
+
if (concept.name.startsWith('_')) concept.name = concept.name.substring(1);
|
|
224
|
+
|
|
225
|
+
if (concept.kindString == 'Function') {
|
|
226
|
+
for (let signature of concept.signatures) {
|
|
227
|
+
let suffix = generateArgumentSuffix(signature.parameters);
|
|
228
|
+
addLine(`## ${signature.name.replace(/^_/, '')}${suffix}`);
|
|
229
|
+
addLine(`#### Global Function`, true);
|
|
230
|
+
|
|
231
|
+
addComments(signature, markdown_lines);
|
|
232
|
+
|
|
233
|
+
if (signature.parameters) {
|
|
234
|
+
addArgumentTree(signature.parameters, markdown_lines);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (signature.type && signature.type.name !== 'void') {
|
|
238
|
+
addLine(`Returns: ${getType(signature.type)}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
addLine();
|
|
242
|
+
} else {
|
|
243
|
+
addLine(`## ${concept.name}`);
|
|
244
|
+
}
|
|
245
|
+
if (concept.kindString != 'Class' && concept.kindString != 'Function') {
|
|
246
|
+
let kind = concept.kindString;
|
|
247
|
+
if (kind != 'Interface' && kind != 'Type alias' && kind != 'Namespace') {
|
|
248
|
+
kind = 'Global ' + kind;
|
|
249
|
+
}
|
|
250
|
+
addLine(`#### ${kind}`, true);
|
|
251
|
+
}
|
|
252
|
+
if (concept.kindString == 'Variable') {
|
|
253
|
+
addLine(`Type: ${getType(concept.type)}`, true);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Extend
|
|
257
|
+
if (concept.extendedTypes) {
|
|
258
|
+
let parents = concept.extendedTypes.map(type => {
|
|
259
|
+
return getReferenceLink(type);
|
|
260
|
+
});
|
|
261
|
+
addLine('Extends: ' + parents.join(', '), true);
|
|
262
|
+
}
|
|
263
|
+
if (concept.extendedBy) {
|
|
264
|
+
let parents = concept.extendedBy.map(type => {
|
|
265
|
+
return getReferenceLink(type);
|
|
266
|
+
});
|
|
267
|
+
addLine('Extended by: ' + parents.join(', '), true);
|
|
268
|
+
}
|
|
269
|
+
// Comment
|
|
270
|
+
addComments(concept, markdown_lines);
|
|
271
|
+
|
|
272
|
+
// Children
|
|
273
|
+
if (concept.children) {
|
|
274
|
+
if (concept.children[0]) {}
|
|
275
|
+
|
|
276
|
+
let handled = [];
|
|
277
|
+
// Constructor
|
|
278
|
+
for (let child of concept.children) {
|
|
279
|
+
if (child.kindString != 'Constructor') continue;
|
|
280
|
+
let sig_i = 0;
|
|
281
|
+
for (let signature of child.signatures) {
|
|
282
|
+
let suffix = generateArgumentSuffix(signature.parameters);
|
|
283
|
+
addLine(`### ${signature.name}${suffix}`);
|
|
284
|
+
|
|
285
|
+
if (sig_i) {
|
|
286
|
+
addLine(`*Alternative constructor signature*`, true);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
addComments(signature, markdown_lines, `Creates a new ${concept.name}`);
|
|
290
|
+
|
|
291
|
+
if (signature.parameters) {
|
|
292
|
+
addArgumentTree(signature.parameters, markdown_lines);
|
|
293
|
+
}
|
|
294
|
+
sig_i++;
|
|
295
|
+
//break; // Only use first signature in types for simplicity
|
|
296
|
+
}
|
|
297
|
+
addLine();
|
|
298
|
+
handled.push(child.id);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Properties
|
|
302
|
+
let properties = concept.children.filter(child => (child.kindString == 'Property' || child.kindString == 'Variable') && !child.type?.name?.startsWith('BlockbenchType') && !child.flags.isStatic);
|
|
303
|
+
if (properties.length) {
|
|
304
|
+
addLine('| Property | Type | Description |');
|
|
305
|
+
addLine('| -------- | ---- | ----------- |');
|
|
306
|
+
}
|
|
307
|
+
for (let child of properties) {
|
|
308
|
+
addLine(`| ${child.name} | ${getType(child.type)} | ${child.comment?.summary?.[0]?.text || ''} |`);
|
|
309
|
+
handled.push(child.id);
|
|
310
|
+
}
|
|
311
|
+
if (properties.length) {
|
|
312
|
+
addLine();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Methods
|
|
316
|
+
for (let child of concept.children) {
|
|
317
|
+
if (child.kindString != 'Method' && child.kindString != 'Function') continue;
|
|
318
|
+
for (let signature of child.signatures) {
|
|
319
|
+
let prefix = child.flags.isStatic ? (concept.name + '.') : '';
|
|
320
|
+
let suffix = generateArgumentSuffix(signature.parameters);
|
|
321
|
+
addLine(`### ${prefix}${signature.name.replace(/^_/, '')}${suffix}`);
|
|
322
|
+
addComments(signature, markdown_lines);
|
|
323
|
+
|
|
324
|
+
if (signature.parameters) {
|
|
325
|
+
addArgumentTree(signature.parameters, markdown_lines);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (signature.type && signature.type.name !== 'void') {
|
|
329
|
+
addLine(`Returns: ${getType(signature.type)}`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
addLine();
|
|
333
|
+
handled.push(child.id);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Misc
|
|
337
|
+
for (let child of concept.children) {
|
|
338
|
+
if (handled.includes(child.id)) continue;
|
|
339
|
+
addLine(`### ${child.name}`);
|
|
340
|
+
let kind = child.kindString;
|
|
341
|
+
if (child.flags.isStatic) {
|
|
342
|
+
kind = 'Static ' + kind;
|
|
343
|
+
}
|
|
344
|
+
addLine(kind, true);
|
|
345
|
+
if (child.kindString == 'Property') {
|
|
346
|
+
addLine(`Type: ${getType(child.type)}`, true);
|
|
347
|
+
}
|
|
348
|
+
addComments(child, markdown_lines);
|
|
349
|
+
addLine();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
addLine();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
fs.writeFileSync(PathModule.resolve(__dirname, out_path, `${file_name}.md`), markdown_lines.join('\r\n'), "utf-8");
|
|
360
|
+
num_files++;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
console.log(`Generated ${num_files} api doc files`);
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
main().catch(console.error);
|
package/tsconfig.json
ADDED
package/types/action.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry of all toolbar items, such as actions, tools, etc.
|
|
3
|
+
*/
|
|
1
4
|
declare const BarItems: {
|
|
2
5
|
[id: string]: BarItem
|
|
3
6
|
}
|
|
@@ -12,6 +15,9 @@ declare interface KeybindKeys {
|
|
|
12
15
|
alt?: boolean | null
|
|
13
16
|
meta?: boolean | null
|
|
14
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A customizable keybind
|
|
20
|
+
*/
|
|
15
21
|
declare class Keybind {
|
|
16
22
|
constructor(keys: KeybindKeys)
|
|
17
23
|
}
|
|
@@ -29,22 +35,45 @@ interface BarItemOptions extends KeybindItemOptions {
|
|
|
29
35
|
name?: string
|
|
30
36
|
description?: string
|
|
31
37
|
icon: string
|
|
32
|
-
condition?:
|
|
38
|
+
condition?: ConditionResolvable
|
|
33
39
|
category?: string
|
|
34
40
|
keybind?: Keybind
|
|
35
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Anything that can go into a toolbar, including actions, tools, toggles, widgets etc.
|
|
44
|
+
*/
|
|
36
45
|
declare class BarItem extends KeybindItem {
|
|
37
46
|
constructor(id: string, options: BarItemOptions);
|
|
38
47
|
conditionMet(): boolean;
|
|
39
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Adds a label to the HTML element of the bar item
|
|
50
|
+
* @param in_bar Set to true to generate an in-bar label, as opposed to a regular on-hover label
|
|
51
|
+
* @param action Provide the action to generate the label. This defaults to self and is only needed in special cases
|
|
52
|
+
*/
|
|
53
|
+
addLabel(in_bar?: boolean, action?: any): void;
|
|
54
|
+
/**
|
|
55
|
+
* Gets a copy of the elements HTML node that is not yet in use.
|
|
56
|
+
*/
|
|
40
57
|
getNode(): HTMLElement;
|
|
58
|
+
/**
|
|
59
|
+
* Appends the bar item to a HTML element
|
|
60
|
+
*/
|
|
41
61
|
toElement(destination: HTMLElement): this;
|
|
42
62
|
pushToolbar(bar: any): void;
|
|
43
63
|
}
|
|
44
64
|
|
|
45
65
|
interface ActionOptions extends BarItemOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Function to run when user uses the action successfully
|
|
68
|
+
*/
|
|
46
69
|
click(event: Event): void
|
|
70
|
+
/**
|
|
71
|
+
* Icon color. Can be a CSS color string, or an axis letter to use an axis color.
|
|
72
|
+
*/
|
|
47
73
|
color?: string
|
|
74
|
+
/**
|
|
75
|
+
* ID of a setting that the action is slinked to
|
|
76
|
+
*/
|
|
48
77
|
linked_setting?: string
|
|
49
78
|
children?: object[]
|
|
50
79
|
/**
|
|
@@ -52,6 +81,9 @@ interface ActionOptions extends BarItemOptions {
|
|
|
52
81
|
*/
|
|
53
82
|
label?: boolean
|
|
54
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Actions can be triggered to run something, they can be added to menus, toolbars, assigned a keybinding, or run via Action Control
|
|
86
|
+
*/
|
|
55
87
|
declare class Action extends BarItem {
|
|
56
88
|
constructor(id: string, options: ActionOptions);
|
|
57
89
|
/**
|
|
@@ -78,6 +110,9 @@ interface ToggleOptions extends ActionOptions {
|
|
|
78
110
|
*/
|
|
79
111
|
onChange?(value: boolean): void
|
|
80
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* A toggle is a type of action that can be on or off. The state is not persistent between restarts by default.
|
|
115
|
+
*/
|
|
81
116
|
declare class Toggle extends Action {
|
|
82
117
|
constructor(id: string, options: ToggleOptions);
|
|
83
118
|
/**
|
|
@@ -194,6 +229,9 @@ interface ToolOptions extends ActionOptions {
|
|
|
194
229
|
paintTool?: boolean
|
|
195
230
|
brush?: BrushOptions
|
|
196
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* A tool, such as mvoe tool, vertex snap tool, or paint brush
|
|
234
|
+
*/
|
|
197
235
|
declare class Tool extends Action {
|
|
198
236
|
constructor(id: string, options: ToolOptions);
|
|
199
237
|
select(): this | undefined;
|
|
@@ -206,7 +244,7 @@ declare class NumSlider extends Widget {
|
|
|
206
244
|
constructor(id: string, options: object);
|
|
207
245
|
startInput(event: Event): void;
|
|
208
246
|
setWidth(width: any): this;
|
|
209
|
-
getInterval(event: Event):
|
|
247
|
+
getInterval(event: Event): number;
|
|
210
248
|
slide(clientX: any, event: Event): void;
|
|
211
249
|
input(): void;
|
|
212
250
|
stopInput(): void;
|
|
@@ -214,23 +252,23 @@ declare class NumSlider extends Widget {
|
|
|
214
252
|
trigger(event: Event): boolean;
|
|
215
253
|
setValue(value: number, trim: any): this;
|
|
216
254
|
change(modify: any): void;
|
|
217
|
-
get():
|
|
255
|
+
get(): number;
|
|
218
256
|
update(): void;
|
|
219
257
|
}
|
|
220
258
|
declare class BarSlider extends Widget {
|
|
221
259
|
constructor(id: string, options: object);
|
|
222
260
|
change(event: Event): void;
|
|
223
|
-
set(value:
|
|
224
|
-
get():
|
|
261
|
+
set(value: number): void;
|
|
262
|
+
get(): number;
|
|
225
263
|
}
|
|
226
264
|
declare class BarSelect extends Widget {
|
|
227
265
|
constructor(id: string, options: object);
|
|
228
266
|
open(event: Event): void;
|
|
229
267
|
trigger(event: Event): boolean | undefined;
|
|
230
268
|
change(event: Event): this;
|
|
231
|
-
getNameFor(key:
|
|
232
|
-
set(key:
|
|
233
|
-
get():
|
|
269
|
+
getNameFor(key: string): string;
|
|
270
|
+
set(key: string): this;
|
|
271
|
+
get(): string;
|
|
234
272
|
}
|
|
235
273
|
declare class BarText extends Widget {
|
|
236
274
|
constructor(id: string, options: object);
|
|
@@ -262,7 +300,6 @@ declare namespace BARS {
|
|
|
262
300
|
const stored: {};
|
|
263
301
|
const editing_bar: undefined | Toolbar;
|
|
264
302
|
const action_definers: (() => void)[];
|
|
265
|
-
const condition: any;
|
|
266
303
|
function defineActions(definer: any): void;
|
|
267
304
|
function setupActions(): void;
|
|
268
305
|
function setupToolbars(): void;
|
|
@@ -270,6 +307,9 @@ declare namespace BARS {
|
|
|
270
307
|
function updateConditions(): void;
|
|
271
308
|
function updateToolToolbar(): void;
|
|
272
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* A dialog-based interface to search and trigger actions and other things
|
|
312
|
+
*/
|
|
273
313
|
declare namespace ActionControl {
|
|
274
314
|
const open: boolean;
|
|
275
315
|
const type: string;
|
|
@@ -282,6 +322,9 @@ declare namespace ActionControl {
|
|
|
282
322
|
function click(action: any, event: Event): void;
|
|
283
323
|
function handleKeys(event: Event): boolean;
|
|
284
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Stores and handles keybinds
|
|
327
|
+
*/
|
|
285
328
|
declare namespace Keybinds {
|
|
286
329
|
const actions: BarItem[];
|
|
287
330
|
const stored: {};
|
package/types/animation.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare class AnimationItem {
|
|
|
5
5
|
|
|
6
6
|
interface AnimationOptions {
|
|
7
7
|
name?: string
|
|
8
|
-
loop?:
|
|
8
|
+
loop?: 'once' | 'hold' | 'loop'
|
|
9
9
|
override?: boolean
|
|
10
10
|
anim_time_update?: string
|
|
11
11
|
blend_weight?: string
|
|
@@ -13,10 +13,10 @@ interface AnimationOptions {
|
|
|
13
13
|
snapping?: number
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
declare class
|
|
16
|
+
declare class _Animation extends AnimationItem {
|
|
17
17
|
constructor(data: AnimationOptions);
|
|
18
18
|
extend(data: AnimationOptions): this;
|
|
19
|
-
getUndoCopy(options
|
|
19
|
+
getUndoCopy(options?: {}, save?: any): {
|
|
20
20
|
uuid: any;
|
|
21
21
|
name: any;
|
|
22
22
|
loop: any;
|
|
@@ -35,16 +35,16 @@ declare class Animation extends AnimationItem {
|
|
|
35
35
|
rename(): this;
|
|
36
36
|
togglePlayingState(state: any): any;
|
|
37
37
|
showContextMenu(event: any): this;
|
|
38
|
-
getBoneAnimator(group: any):
|
|
38
|
+
getBoneAnimator(group: any): BoneAnimator;
|
|
39
39
|
add(undo: any): this;
|
|
40
40
|
remove(undo: any, remove_from_file?: boolean): this;
|
|
41
|
-
getMaxLength():
|
|
41
|
+
getMaxLength(): number;
|
|
42
42
|
setLoop(value: any, undo: any): void;
|
|
43
|
-
calculateSnappingFromKeyframes():
|
|
43
|
+
calculateSnappingFromKeyframes(): number;
|
|
44
44
|
propertiesDialog(): void;
|
|
45
45
|
|
|
46
46
|
name: string
|
|
47
|
-
loop:
|
|
47
|
+
loop: 'once' | 'hold' | 'loop'
|
|
48
48
|
override: boolean
|
|
49
49
|
anim_time_update: string
|
|
50
50
|
blend_weight: string
|
|
@@ -118,14 +118,14 @@ declare class BoneAnimator extends GeneralAnimator {
|
|
|
118
118
|
position: Keyframe[]
|
|
119
119
|
scale: Keyframe[]
|
|
120
120
|
getGroup(): Group
|
|
121
|
-
fillValues
|
|
122
|
-
pushKeyframe
|
|
123
|
-
doRender
|
|
124
|
-
displayRotation
|
|
125
|
-
displayPosition
|
|
126
|
-
displayScale
|
|
127
|
-
interpolate
|
|
128
|
-
displayFrame
|
|
121
|
+
fillValues(): void
|
|
122
|
+
pushKeyframe(): void
|
|
123
|
+
doRender(): boolean
|
|
124
|
+
displayRotation(): void
|
|
125
|
+
displayPosition(): void
|
|
126
|
+
displayScale(): void
|
|
127
|
+
interpolate(): void
|
|
128
|
+
displayFrame(): void
|
|
129
129
|
}
|
|
130
130
|
declare class NullObjectAnimator extends GeneralAnimator {
|
|
131
131
|
name: string
|
|
@@ -134,10 +134,10 @@ declare class NullObjectAnimator extends GeneralAnimator {
|
|
|
134
134
|
position: Keyframe[]
|
|
135
135
|
scale: Keyframe[]
|
|
136
136
|
getElement(): NullObject
|
|
137
|
-
doRender
|
|
138
|
-
displayPosition
|
|
139
|
-
displayIK
|
|
140
|
-
displayFrame
|
|
137
|
+
doRender(): void
|
|
138
|
+
displayPosition(): void
|
|
139
|
+
displayIK(): void
|
|
140
|
+
displayFrame(): void
|
|
141
141
|
}
|
|
142
142
|
declare class EffectAnimator extends GeneralAnimator {
|
|
143
143
|
name: string
|
|
@@ -147,7 +147,7 @@ declare class EffectAnimator extends GeneralAnimator {
|
|
|
147
147
|
scale: Keyframe[]
|
|
148
148
|
pushKeyframe(keyframe): this
|
|
149
149
|
displayFrame(in_loop): this
|
|
150
|
-
startPreviousSounds
|
|
150
|
+
startPreviousSounds(): void
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
declare class TimelineMarker {
|