asajs 4.0.0-indev-1 → 4.0.0-indev-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/config.d.ts +26 -0
- package/dist/js/compilers/Configuration.js +20 -1
- package/dist/js/compilers/Memory.js +1 -3
- package/dist/js/compilers/bindings/Checker.js +9 -0
- package/dist/js/compilers/bindings/Function.js +71 -0
- package/dist/js/compilers/bindings/Funtion.js +30 -6
- package/dist/js/compilers/bindings/Lexer.js +49 -6
- package/dist/js/compilers/bindings/Parser.js +152 -12
- package/dist/js/compilers/ui/buildcache.js +53 -0
- package/dist/js/compilers/ui/builddata.js +4 -0
- package/dist/js/compilers/ui/builder.js +30 -9
- package/dist/js/compilers/ui/installer.js +15 -1
- package/dist/js/compilers/ui/linker.js +43 -1
- package/dist/js/compilers/ui/manifest.js +25 -1
- package/dist/js/compilers/ui/prevdata.js +8 -0
- package/dist/js/components/AnimationKeyframe.js +1 -1
- package/dist/js/components/UI.js +25 -13
- package/dist/js/components/Utils.js +100 -23
- package/dist/js/config..js +1 -0
- package/dist/js/config.js +1 -0
- package/dist/js/index.js +4 -0
- package/dist/js/types/config.js +1 -0
- package/dist/types/compilers/Configuration.d.ts +5 -1
- package/dist/types/compilers/bindings/Checker.d.ts +3 -0
- package/dist/types/compilers/bindings/Function.d.ts +7 -0
- package/dist/types/compilers/bindings/Funtion.d.ts +1 -1
- package/dist/types/compilers/bindings/Parser.d.ts +12 -3
- package/dist/types/compilers/ui/buildcache.d.ts +8 -0
- package/dist/types/compilers/ui/builddata.d.ts +1 -0
- package/dist/types/compilers/ui/installer.d.ts +1 -1
- package/dist/types/compilers/ui/linker.d.ts +4 -0
- package/dist/types/compilers/ui/manifest.d.ts +1 -1
- package/dist/types/compilers/ui/prevdata.d.ts +3 -0
- package/dist/types/components/AnimationKeyframe.d.ts +4 -4
- package/dist/types/components/UI.d.ts +9 -2
- package/dist/types/components/Utils.d.ts +17 -16
- package/dist/types/config..d.ts +2 -0
- package/dist/types/config.d.ts +13 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/types/config.d.ts +13 -0
- package/dist/types/types/enums/index.d.ts +0 -1
- package/package.json +1 -1
- package/resources/asajs.config.cjs +14 -0
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import fs from "fs/promises";
|
|
2
|
+
import { BuildCache } from "./buildcache.js";
|
|
3
|
+
import { RandomString } from "../../components/Utils.js";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { getGamedataPath } from "./installer.js";
|
|
6
|
+
const HEX = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
7
|
+
function genUUID() {
|
|
8
|
+
const b = Array.from({ length: 16 }, () => Math.floor(Math.random() * 256));
|
|
9
|
+
// version 4
|
|
10
|
+
b[6] = (b[6] & 0x0f) | 0x40;
|
|
11
|
+
// variant 10xx
|
|
12
|
+
b[8] = (b[8] & 0x3f) | 0x80;
|
|
13
|
+
return (`${HEX[b[0]]}${HEX[b[1]]}${HEX[b[2]]}${HEX[b[3]]}-` +
|
|
14
|
+
`${HEX[b[4]]}${HEX[b[5]]}-` +
|
|
15
|
+
`${HEX[b[6]]}${HEX[b[7]]}-` +
|
|
16
|
+
`${HEX[b[8]]}${HEX[b[9]]}-` +
|
|
17
|
+
`${HEX[b[10]]}${HEX[b[11]]}${HEX[b[12]]}${HEX[b[13]]}${HEX[b[14]]}${HEX[b[15]]}`);
|
|
18
|
+
}
|
|
2
19
|
export async function clearBuild() {
|
|
3
|
-
await
|
|
20
|
+
const files = (await BuildCache.get("build-files")) || [];
|
|
21
|
+
await Promise.all(files.map(file => fs.rm(`build/${file}`).catch(() => null)));
|
|
4
22
|
}
|
|
5
23
|
export async function createBuildFolder() {
|
|
6
24
|
return fs
|
|
@@ -8,3 +26,27 @@ export async function createBuildFolder() {
|
|
|
8
26
|
.catch(() => fs.mkdir("build"))
|
|
9
27
|
.then(() => clearBuild());
|
|
10
28
|
}
|
|
29
|
+
export async function getBuildFolderName() {
|
|
30
|
+
return await BuildCache.getWithSetDefault("build-key", () => RandomString(16));
|
|
31
|
+
}
|
|
32
|
+
export async function linkToGame() {
|
|
33
|
+
const sourcePath = path.resolve("build");
|
|
34
|
+
const targetPath = path.resolve(getGamedataPath(), "development_resource_packs", await getBuildFolderName());
|
|
35
|
+
await fs.stat(targetPath).catch(async () => {
|
|
36
|
+
await fs.symlink(sourcePath, targetPath, "junction");
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export async function unlink() {
|
|
40
|
+
const targetPath = path.resolve(getGamedataPath(), "development_resource_packs", await getBuildFolderName());
|
|
41
|
+
try {
|
|
42
|
+
await fs.unlink(targetPath);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export async function getUUID() {
|
|
49
|
+
return await BuildCache.getWithSetDefault("uuid", () => {
|
|
50
|
+
return [genUUID(), genUUID()];
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { config } from "../Configuration.js";
|
|
2
|
+
import { getUUID } from "./linker.js";
|
|
3
|
+
export async function genManifest() {
|
|
4
|
+
const [uuid1, uuid2] = await getUUID();
|
|
5
|
+
return JSON.stringify({
|
|
6
|
+
format_version: 2,
|
|
7
|
+
header: {
|
|
8
|
+
name: config.packinfo?.name || "AsaJS",
|
|
9
|
+
description: config.packinfo?.description || "Create your Minecraft JSON-UI resource packs using JavaScript.",
|
|
10
|
+
uuid: uuid1,
|
|
11
|
+
version: config.packinfo?.version || [4, 0, 0],
|
|
12
|
+
min_engine_version: [1, 21, 80],
|
|
13
|
+
},
|
|
14
|
+
modules: [
|
|
15
|
+
{
|
|
16
|
+
description: "This resource pack generate by AsaJS.",
|
|
17
|
+
type: "resources",
|
|
18
|
+
uuid: uuid2,
|
|
19
|
+
version: [4, 0, 0],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
subpacks: config.packinfo?.subpacks,
|
|
23
|
+
metadata: config.packinfo?.metadata,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -25,7 +25,7 @@ export class AnimationKeyframe extends Class {
|
|
|
25
25
|
}
|
|
26
26
|
this.name = name || RandomString(16);
|
|
27
27
|
this.namespace = namespace || RandomNamespace();
|
|
28
|
-
this.path = path ||
|
|
28
|
+
this.path = path || `asajs/${this.namespace}.json`;
|
|
29
29
|
Memory.add(this);
|
|
30
30
|
}
|
|
31
31
|
setNext(keyframe) {
|
package/dist/js/components/UI.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Memory } from "../compilers/Memory.js";
|
|
|
3
3
|
import { ArrayName } from "../types/enums/ArrayName.js";
|
|
4
4
|
import { Operation } from "../types/enums/Operation.js";
|
|
5
5
|
import { Class } from "./Class.js";
|
|
6
|
-
import {
|
|
6
|
+
import { RandomString, ResolveBinding } from "./Utils.js";
|
|
7
7
|
import { RandomNamespace } from "../compilers/Random.js";
|
|
8
8
|
import util from "node:util";
|
|
9
9
|
export class UI extends Class {
|
|
@@ -20,6 +20,7 @@ export class UI extends Class {
|
|
|
20
20
|
anims = [];
|
|
21
21
|
extendType;
|
|
22
22
|
properties = {};
|
|
23
|
+
bindCache = new Map();
|
|
23
24
|
constructor(type, name, namespace, path) {
|
|
24
25
|
super();
|
|
25
26
|
this.type = type;
|
|
@@ -34,7 +35,7 @@ export class UI extends Class {
|
|
|
34
35
|
this.name = name?.match(/^(\w|\/)+/)?.[0] || RandomString(16);
|
|
35
36
|
this.namespace = namespace || RandomNamespace();
|
|
36
37
|
if (!path)
|
|
37
|
-
this.path =
|
|
38
|
+
this.path = `asajs/${this.namespace}.json`;
|
|
38
39
|
else
|
|
39
40
|
this.path = path;
|
|
40
41
|
this.extendable = this.name.search("/") === -1;
|
|
@@ -55,7 +56,7 @@ export class UI extends Class {
|
|
|
55
56
|
* @returns
|
|
56
57
|
*/
|
|
57
58
|
addBindings(...bindings) {
|
|
58
|
-
this.bindings.push(...ResolveBinding(...bindings));
|
|
59
|
+
this.bindings.push(...ResolveBinding(this.bindCache, ...bindings));
|
|
59
60
|
return this;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
@@ -105,8 +106,17 @@ export class UI extends Class {
|
|
|
105
106
|
* @param namespace
|
|
106
107
|
* @returns
|
|
107
108
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
createExtends(properties, name, namespace) {
|
|
110
|
+
if (!this.extendable)
|
|
111
|
+
throw new Error("This element is not extendable");
|
|
112
|
+
const ui = new UI(undefined, name, namespace);
|
|
113
|
+
if (properties)
|
|
114
|
+
ui.setProperties(properties);
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
ui.extend = this;
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
ui.extendType = this.type || this.extendType;
|
|
119
|
+
return ui;
|
|
110
120
|
}
|
|
111
121
|
toString() {
|
|
112
122
|
return `@${this.namespace}.${this.name}`;
|
|
@@ -199,9 +209,11 @@ export class ModifyUI extends UI {
|
|
|
199
209
|
return this.addModifications({
|
|
200
210
|
array_name: ArrayName.CONTROLS,
|
|
201
211
|
operation: Operation.INSERT_FRONT,
|
|
202
|
-
value:
|
|
203
|
-
|
|
204
|
-
|
|
212
|
+
value: [
|
|
213
|
+
{
|
|
214
|
+
[`${name}${child}`]: properties || {},
|
|
215
|
+
},
|
|
216
|
+
],
|
|
205
217
|
});
|
|
206
218
|
}
|
|
207
219
|
insertAfterChild(where, child, properties, name) {
|
|
@@ -233,7 +245,7 @@ export class ModifyUI extends UI {
|
|
|
233
245
|
});
|
|
234
246
|
}
|
|
235
247
|
insertChild(child, properties) {
|
|
236
|
-
return this.
|
|
248
|
+
return this.insertFrontChild(child, properties);
|
|
237
249
|
}
|
|
238
250
|
replaceChild(where, child, properties) {
|
|
239
251
|
return this.addModifications({
|
|
@@ -259,18 +271,18 @@ export class ModifyUI extends UI {
|
|
|
259
271
|
return this.addModifications({
|
|
260
272
|
array_name: ArrayName.BINDINGS,
|
|
261
273
|
operation: Operation.INSERT_BACK,
|
|
262
|
-
value: ResolveBinding(...bindings),
|
|
274
|
+
value: ResolveBinding(this.bindCache, ...bindings),
|
|
263
275
|
});
|
|
264
276
|
}
|
|
265
277
|
insertFrontBindings(...bindings) {
|
|
266
278
|
return this.addModifications({
|
|
267
279
|
array_name: ArrayName.BINDINGS,
|
|
268
280
|
operation: Operation.INSERT_FRONT,
|
|
269
|
-
value: ResolveBinding(...bindings),
|
|
281
|
+
value: ResolveBinding(this.bindCache, ...bindings),
|
|
270
282
|
});
|
|
271
283
|
}
|
|
272
284
|
insertBindings(...bindings) {
|
|
273
|
-
return this.
|
|
285
|
+
return this.insertFrontBindings(...bindings);
|
|
274
286
|
}
|
|
275
287
|
/**
|
|
276
288
|
* Remove a binding of this element
|
|
@@ -298,7 +310,7 @@ export class ModifyUI extends UI {
|
|
|
298
310
|
});
|
|
299
311
|
}
|
|
300
312
|
insertButtonMappings(...buttonMappings) {
|
|
301
|
-
return this.
|
|
313
|
+
return this.insertFrontButtonMappings(...buttonMappings);
|
|
302
314
|
}
|
|
303
315
|
/**
|
|
304
316
|
* Remove a button mapping of this element
|
|
@@ -9,6 +9,8 @@ import { AnimType } from "../types/enums/AnimType.js";
|
|
|
9
9
|
import { AnimationKeyframe } from "./AnimationKeyframe.js";
|
|
10
10
|
import { Animation } from "./Animation.js";
|
|
11
11
|
import { MemoryModify } from "../compilers/Memory.js";
|
|
12
|
+
import { Lexer } from "../compilers/bindings/Lexer.js";
|
|
13
|
+
import { TokenKind, TSTokenKind } from "../compilers/bindings/types.js";
|
|
12
14
|
export function Color(hex) {
|
|
13
15
|
if (typeof hex === "number") {
|
|
14
16
|
return [((hex >> 16) & 0xff) / 0xff, ((hex >> 8) & 0xff) / 0xff, (hex & 0xff) / 0xff];
|
|
@@ -36,15 +38,69 @@ export function Color(hex) {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
export function ResolveBinding(...bindings) {
|
|
41
|
+
export function ResolveBinding(cache, ...bindings) {
|
|
40
42
|
const result = [];
|
|
41
43
|
for (const binding of bindings) {
|
|
42
44
|
if (binding.source_property_name) {
|
|
43
45
|
if (isCompileBinding(binding.source_property_name)) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const inputBindings = binding.source_property_name.slice(1, -1);
|
|
47
|
+
if (binding.source_control_name) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
const tokensMapping = (token) => {
|
|
50
|
+
if (token.kind === TokenKind.VARIABLE) {
|
|
51
|
+
const mapkey = `mapping:${binding.source_control_name}:${token.value}`;
|
|
52
|
+
if (cache.has(mapkey)) {
|
|
53
|
+
return {
|
|
54
|
+
...token,
|
|
55
|
+
value: cache.get(mapkey),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const ret = RandomBindingString(16);
|
|
60
|
+
cache.set(mapkey, ret);
|
|
61
|
+
result.push({
|
|
62
|
+
source_property_name: token.value,
|
|
63
|
+
source_control_name: binding.source_control_name,
|
|
64
|
+
target_property_name: ret,
|
|
65
|
+
binding_type: BindingType.VIEW,
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
...token,
|
|
69
|
+
value: ret,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (token.kind === TokenKind.TEMPLATE_STRING) {
|
|
74
|
+
return {
|
|
75
|
+
...token,
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
value: token.value.map((tstoken) => {
|
|
78
|
+
if (tstoken.kind === TSTokenKind.STRING)
|
|
79
|
+
return tstoken;
|
|
80
|
+
else {
|
|
81
|
+
return {
|
|
82
|
+
...tstoken,
|
|
83
|
+
tokens: tstoken.tokens.map(tokensMapping),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
return token;
|
|
91
|
+
};
|
|
92
|
+
const { gen, out } = new Parser(inputBindings, cache, Lexer(inputBindings).map(tokensMapping)).out();
|
|
93
|
+
delete binding.source_control_name;
|
|
94
|
+
if (gen)
|
|
95
|
+
result.push(...gen);
|
|
96
|
+
binding.source_property_name = out;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const { gen, out } = new Parser(inputBindings, cache).out();
|
|
100
|
+
if (gen)
|
|
101
|
+
result.push(...gen);
|
|
102
|
+
binding.source_property_name = out;
|
|
103
|
+
}
|
|
48
104
|
}
|
|
49
105
|
binding.binding_type = BindingType.VIEW;
|
|
50
106
|
if (!binding.target_property_name)
|
|
@@ -107,6 +163,13 @@ export function Modify(namespace, name) {
|
|
|
107
163
|
// @ts-ignore
|
|
108
164
|
if (memoryUI)
|
|
109
165
|
return memoryUI;
|
|
166
|
+
if (!paths[namespace]) {
|
|
167
|
+
throw new Error(`Namespace '${namespace}' does not exist`);
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
}
|
|
170
|
+
else if (!paths[namespace][name]) {
|
|
171
|
+
throw new Error(`Element '${name}' does not exist in namespace '${namespace}'`);
|
|
172
|
+
}
|
|
110
173
|
// @ts-ignore
|
|
111
174
|
const modifyUI = new ModifyUI(namespace, name,
|
|
112
175
|
// @ts-ignore
|
|
@@ -178,9 +241,8 @@ export function SliderBox(properties, namespace, name) {
|
|
|
178
241
|
return new UI(Type.SLIDER_BOX, name, namespace).setProperties(properties || {});
|
|
179
242
|
}
|
|
180
243
|
export function ExtendsOf(element, properties, namespace, name) {
|
|
181
|
-
if (!element.extendable)
|
|
244
|
+
if (!element.extendable)
|
|
182
245
|
throw new Error("Cannot extend a UI that cannot be extended");
|
|
183
|
-
}
|
|
184
246
|
const ui = new UI(undefined, name, namespace);
|
|
185
247
|
if (properties)
|
|
186
248
|
ui.setProperties(properties);
|
|
@@ -190,53 +252,68 @@ export function ExtendsOf(element, properties, namespace, name) {
|
|
|
190
252
|
ui.extendType = element.type || element.extendType;
|
|
191
253
|
return ui;
|
|
192
254
|
}
|
|
255
|
+
export function VanillaExtendsOf(originNamespace, originName,
|
|
256
|
+
// @ts-ignore
|
|
257
|
+
properties, namespace, name) {
|
|
258
|
+
// @ts-ignore
|
|
259
|
+
const ui = new UI(undefined, name, namespace);
|
|
260
|
+
if (properties)
|
|
261
|
+
ui.setProperties(properties);
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
ui.extend = {
|
|
264
|
+
name: originName,
|
|
265
|
+
namespace: originNamespace,
|
|
266
|
+
toString: () => `@${originNamespace}.${originName}`,
|
|
267
|
+
};
|
|
268
|
+
return ui;
|
|
269
|
+
}
|
|
193
270
|
// Quick Keyframe
|
|
194
|
-
export function
|
|
271
|
+
export function OffsetKeyframe(properties, namespace, name) {
|
|
195
272
|
return new AnimationKeyframe(AnimType.OFFSET, properties || {}, name, namespace);
|
|
196
273
|
}
|
|
197
|
-
export function
|
|
274
|
+
export function SizeKeyframe(properties, namespace, name) {
|
|
198
275
|
return new AnimationKeyframe(AnimType.SIZE, properties || {}, name, namespace);
|
|
199
276
|
}
|
|
200
|
-
export function
|
|
277
|
+
export function UVKeyframe(properties, namespace, name) {
|
|
201
278
|
return new AnimationKeyframe(AnimType.UV, properties || {}, name, namespace);
|
|
202
279
|
}
|
|
203
|
-
export function
|
|
280
|
+
export function ClipKeyframe(properties, namespace, name) {
|
|
204
281
|
return new AnimationKeyframe(AnimType.CLIP, properties || {}, name, namespace);
|
|
205
282
|
}
|
|
206
|
-
export function
|
|
283
|
+
export function ColorKeyframe(properties, namespace, name) {
|
|
207
284
|
return new AnimationKeyframe(AnimType.COLOR, properties || {}, name, namespace);
|
|
208
285
|
}
|
|
209
|
-
export function
|
|
286
|
+
export function AlphaKeyframe(properties, namespace, name) {
|
|
210
287
|
return new AnimationKeyframe(AnimType.ALPHA, properties || {}, name, namespace);
|
|
211
288
|
}
|
|
212
|
-
export function
|
|
289
|
+
export function WaitKeyframe(properties, namespace, name) {
|
|
213
290
|
return new AnimationKeyframe(AnimType.WAIT, properties || {}, name, namespace);
|
|
214
291
|
}
|
|
215
|
-
export function
|
|
292
|
+
export function FlipBookKeyframe(properties, namespace, name) {
|
|
216
293
|
return new AnimationKeyframe(AnimType.FLIP_BOOK, properties || {}, name, namespace);
|
|
217
294
|
}
|
|
218
|
-
export function
|
|
295
|
+
export function AsepriteFlipBookKeyframe(properties, namespace, name) {
|
|
219
296
|
return new AnimationKeyframe(AnimType.ASEPRITE_FLIP_BOOK, properties || {}, name, namespace);
|
|
220
297
|
}
|
|
221
|
-
export function
|
|
298
|
+
export function OffsetAnimation(...keyframes) {
|
|
222
299
|
return new Animation(AnimType.OFFSET, ...keyframes);
|
|
223
300
|
}
|
|
224
|
-
export function
|
|
301
|
+
export function SizeAnimation(...keyframes) {
|
|
225
302
|
return new Animation(AnimType.SIZE, ...keyframes);
|
|
226
303
|
}
|
|
227
|
-
export function
|
|
304
|
+
export function UVAnimation(...keyframes) {
|
|
228
305
|
return new Animation(AnimType.UV, ...keyframes);
|
|
229
306
|
}
|
|
230
|
-
export function
|
|
307
|
+
export function ClipAnimation(...keyframes) {
|
|
231
308
|
return new Animation(AnimType.CLIP, ...keyframes);
|
|
232
309
|
}
|
|
233
|
-
export function
|
|
310
|
+
export function ColorAnimation(...keyframes) {
|
|
234
311
|
return new Animation(AnimType.COLOR, ...keyframes);
|
|
235
312
|
}
|
|
236
|
-
export function
|
|
313
|
+
export function AlphaAnimation(...keyframes) {
|
|
237
314
|
return new Animation(AnimType.ALPHA, ...keyframes);
|
|
238
315
|
}
|
|
239
|
-
// Animation
|
|
316
|
+
// Animation ExtendsOf
|
|
240
317
|
export function AnimationExtendsOf(animation, properties) {
|
|
241
318
|
const anim = new AnimationKeyframe(animation.type, properties || {});
|
|
242
319
|
// @ts-ignore
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/js/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import "./compilers/Configuration.js";
|
|
1
2
|
import "./compilers/PreCompile.js";
|
|
2
3
|
import "./compilers/ui/builder.js";
|
|
4
|
+
import "./compilers/ui/installer.js";
|
|
3
5
|
export { Animation } from "./components/Animation.js";
|
|
4
6
|
export { AnimationKeyframe } from "./components/AnimationKeyframe.js";
|
|
5
7
|
export { ModifyUI, UI } from "./components/UI.js";
|
|
@@ -7,3 +9,5 @@ export * from "./components/Utils.js";
|
|
|
7
9
|
export * from "./types/enums/index.js";
|
|
8
10
|
export * as Properties from "./types/properties/index.js";
|
|
9
11
|
export { ItemAuxID } from "./types/enums/Items.js";
|
|
12
|
+
export { ArrayName, Operation } from "./types/properties/index.js";
|
|
13
|
+
export { Lexer } from "./compilers/bindings/Lexer.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare function isBlankChar(char: string): boolean;
|
|
2
2
|
export declare function isWordChar(char: string): boolean | "";
|
|
3
3
|
export declare function isNumberChar(char: string): boolean;
|
|
4
|
+
export declare function isHexChar(char: string): boolean;
|
|
5
|
+
export declare function isBinaryChar(char: string): boolean;
|
|
6
|
+
export declare function isOctalChar(char: string): boolean;
|
|
4
7
|
export declare function isCompileBinding(input: string): boolean;
|
|
@@ -2,11 +2,17 @@ import { Expression, GenBinding, Token } from "./types.js";
|
|
|
2
2
|
import { BindingItem } from "../../types/properties/value.js";
|
|
3
3
|
export declare class Parser {
|
|
4
4
|
private input;
|
|
5
|
+
private cache;
|
|
5
6
|
position: number;
|
|
6
|
-
tokens: Token[];
|
|
7
7
|
genBindings: GenBinding[];
|
|
8
8
|
output: Expression;
|
|
9
|
-
|
|
9
|
+
tokens: Token[];
|
|
10
|
+
constructor(input: string, cache?: Map<string, unknown>, tokens?: Token[]);
|
|
11
|
+
static intToBin(input: string): {
|
|
12
|
+
ret: `#${string}`;
|
|
13
|
+
bindings: GenBinding[];
|
|
14
|
+
};
|
|
15
|
+
intToBin(input: string): string;
|
|
10
16
|
at(): Token;
|
|
11
17
|
eat(): Token;
|
|
12
18
|
last(): Token;
|
|
@@ -16,14 +22,17 @@ export declare class Parser {
|
|
|
16
22
|
private parseComparisonExpression;
|
|
17
23
|
private parseAdditiveExpression;
|
|
18
24
|
private parseMultiplicativeExpression;
|
|
25
|
+
private parseBitwiseLogicExpression;
|
|
26
|
+
private parseBitwiseShiftExpression;
|
|
19
27
|
private parsePrimaryExpression;
|
|
20
28
|
private parseCallableOrLiteral;
|
|
21
|
-
private
|
|
29
|
+
private functionCall;
|
|
22
30
|
private expect;
|
|
23
31
|
private warn;
|
|
24
32
|
private getPointer;
|
|
25
33
|
out(): {
|
|
26
34
|
gen?: BindingItem[];
|
|
27
35
|
out: Expression;
|
|
36
|
+
cache: Map<string, unknown>;
|
|
28
37
|
};
|
|
29
38
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class BuildCache {
|
|
2
|
+
private static queue;
|
|
3
|
+
private static enqueue;
|
|
4
|
+
static get<T = unknown>(key: string): Promise<T | null>;
|
|
5
|
+
static getWithDefault<T = unknown>(key: string, defaultValue: (() => T) | T): Promise<T>;
|
|
6
|
+
static getWithSetDefault<T>(key: string, defaultValue: (() => T) | T): Promise<T>;
|
|
7
|
+
static set(key: string, value: unknown): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function getGamedataPath(): string;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export declare function clearBuild(): Promise<void>;
|
|
2
2
|
export declare function createBuildFolder(): Promise<void>;
|
|
3
|
+
export declare function getBuildFolderName(): Promise<string>;
|
|
4
|
+
export declare function linkToGame(): Promise<void>;
|
|
5
|
+
export declare function unlink(): Promise<void>;
|
|
6
|
+
export declare function getUUID(): Promise<[string, string]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function genManifest(): Promise<string>;
|
|
@@ -15,8 +15,8 @@ export declare class AnimationKeyframe<T extends AnimType> extends Class {
|
|
|
15
15
|
clearNext(): this;
|
|
16
16
|
protected toJsonUI(): KeyframeAnimationProperties<AnimType>;
|
|
17
17
|
protected toJSON(): (Partial<import("../types/properties/element/Animation.js").DurationAnimation> & import("../types/properties/element/Animation.js").KeyframeAnimationPropertiesItem) | (Partial<import("../types/properties/element/Animation.js").AsepriteFlipBookAnimation> & import("../types/properties/element/Animation.js").KeyframeAnimationPropertiesItem) | {
|
|
18
|
-
from?: import("../types/properties/value.js").
|
|
19
|
-
to?: import("../types/properties/value.js").
|
|
18
|
+
from?: import("../types/properties/value.js").Value<number> | undefined;
|
|
19
|
+
to?: import("../types/properties/value.js").Value<number> | undefined;
|
|
20
20
|
duration?: import("../types/properties/value.js").Value<number> | undefined;
|
|
21
21
|
easing?: import("../types/properties/value.js").Value<string | import("../index.js").Easing> | undefined;
|
|
22
22
|
next?: import("../types/properties/value.js").Value<string | AnimationKeyframe<AnimType> | Animation<AnimType>>;
|
|
@@ -33,8 +33,8 @@ export declare class AnimationKeyframe<T extends AnimType> extends Class {
|
|
|
33
33
|
wait_until_rendered_to_play?: import("../types/properties/value.js").Value<boolean>;
|
|
34
34
|
anim_type: T;
|
|
35
35
|
} | {
|
|
36
|
-
from?: import("../types/properties/value.js").
|
|
37
|
-
to?: import("../types/properties/value.js").
|
|
36
|
+
from?: import("../types/properties/value.js").Array2<string | number> | undefined;
|
|
37
|
+
to?: import("../types/properties/value.js").Array2<string | number> | undefined;
|
|
38
38
|
duration?: import("../types/properties/value.js").Value<number> | undefined;
|
|
39
39
|
easing?: import("../types/properties/value.js").Value<string | import("../index.js").Easing> | undefined;
|
|
40
40
|
next?: import("../types/properties/value.js").Value<string | AnimationKeyframe<AnimType> | Animation<AnimType>>;
|
|
@@ -7,12 +7,17 @@ import { Animation } from "./Animation.js";
|
|
|
7
7
|
import { AnimationKeyframe } from "./AnimationKeyframe.js";
|
|
8
8
|
import { Class } from "./Class.js";
|
|
9
9
|
import util from "node:util";
|
|
10
|
+
interface ExtendUI {
|
|
11
|
+
name: string;
|
|
12
|
+
namespace: string;
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
10
15
|
export declare class UI<T extends Type, K extends Renderer | null = null> extends Class {
|
|
11
16
|
type?: T | undefined;
|
|
12
17
|
readonly path: string;
|
|
13
18
|
readonly name: string;
|
|
14
19
|
readonly namespace: string;
|
|
15
|
-
readonly extend?: UI<Type, Renderer | null
|
|
20
|
+
readonly extend?: UI<Type, Renderer | null> | ExtendUI;
|
|
16
21
|
readonly extendable: boolean;
|
|
17
22
|
protected readonly controls: Map<string, [UI<Type, Renderer | null>, Properties<Type, Renderer | null>]>;
|
|
18
23
|
protected readonly bindings: BindingItem[];
|
|
@@ -21,6 +26,7 @@ export declare class UI<T extends Type, K extends Renderer | null = null> extend
|
|
|
21
26
|
protected readonly anims: (Animation<AnimType> | AnimationKeyframe<AnimType>)[];
|
|
22
27
|
protected readonly extendType?: Type;
|
|
23
28
|
protected properties: Properties<T, K>;
|
|
29
|
+
protected bindCache: Map<string, unknown>;
|
|
24
30
|
constructor(type?: T | undefined, name?: string, namespace?: string, path?: string);
|
|
25
31
|
/**
|
|
26
32
|
* Set properties for this element
|
|
@@ -62,7 +68,7 @@ export declare class UI<T extends Type, K extends Renderer | null = null> extend
|
|
|
62
68
|
* @param namespace
|
|
63
69
|
* @returns
|
|
64
70
|
*/
|
|
65
|
-
|
|
71
|
+
createExtends(properties?: Properties<T, K>, name?: string, namespace?: string): UI<T, K>;
|
|
66
72
|
protected toString(): string;
|
|
67
73
|
protected toJsonUI(): any;
|
|
68
74
|
protected toJSON(): any;
|
|
@@ -127,3 +133,4 @@ export declare class ModifyUI<T extends Type = Type.PANEL, S extends string = st
|
|
|
127
133
|
protected toJSON(): any;
|
|
128
134
|
protected [util.inspect.custom]($: any, opts: any): string;
|
|
129
135
|
}
|
|
136
|
+
export {};
|