asajs 4.0.0-indev-2 → 4.0.0-indev-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/config.d.ts +29 -0
- package/dist/js/compilers/Configuration.js +20 -1
- package/dist/js/compilers/Memory.js +1 -1
- package/dist/js/compilers/PreCompile.js +12 -1
- package/dist/js/compilers/bindings/Checker.js +9 -0
- package/dist/js/compilers/bindings/{Funtion.js → Function.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/builder.js +44 -14
- package/dist/js/compilers/ui/installer.js +139 -4
- package/dist/js/compilers/ui/linker.js +36 -9
- package/dist/js/compilers/ui/manifest.js +9 -5
- package/dist/js/components/AnimationKeyframe.js +1 -1
- package/dist/js/components/UI.js +4 -3
- package/dist/js/components/Utils.js +83 -20
- package/dist/js/index.js +3 -0
- package/dist/types/compilers/Configuration.d.ts +5 -1
- package/dist/types/compilers/PreCompile.d.ts +2 -0
- package/dist/types/compilers/bindings/Checker.d.ts +3 -0
- package/dist/types/compilers/bindings/{Funtion.d.ts → Function.d.ts} +1 -1
- package/dist/types/compilers/bindings/Parser.d.ts +12 -3
- package/dist/types/compilers/ui/installer.d.ts +11 -1
- package/dist/types/compilers/ui/linker.d.ts +2 -0
- package/dist/types/compilers/ui/manifest.d.ts +1 -0
- package/dist/types/components/AnimationKeyframe.d.ts +4 -4
- package/dist/types/components/UI.d.ts +1 -0
- package/dist/types/components/Utils.d.ts +16 -16
- package/dist/types/index.d.ts +3 -0
- package/dist/types/types/enums/index.d.ts +0 -1
- package/dist/types/types/vanilla/intellisense.d.ts +11194 -11194
- package/package.json +1 -1
- package/resources/asajs.config.cjs +17 -0
- package/dist/js/compilers/RunEnd.js +0 -7
- package/dist/js/compilers/ui/builddata.js +0 -4
- package/dist/js/compilers/ui/config.js +0 -1
- package/dist/js/compilers/ui/prevdata.js +0 -8
- package/dist/js/types/enums/SmartAnimationType.js +0 -3
- package/dist/types/compilers/RunEnd.d.ts +0 -1
- package/dist/types/compilers/ui/builddata.d.ts +0 -1
- package/dist/types/compilers/ui/config.d.ts +0 -1
- package/dist/types/compilers/ui/prevdata.d.ts +0 -3
- package/dist/types/types/enums/SmartAnimationType.d.ts +0 -2
|
@@ -1,15 +1,150 @@
|
|
|
1
1
|
import os from "os";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import fsp from "fs/promises";
|
|
5
|
+
import { config } from "../Configuration.js";
|
|
6
|
+
import { BuildCache } from "./buildcache.js";
|
|
7
|
+
import { version } from "./manifest.js";
|
|
8
|
+
import { Log } from "../PreCompile.js";
|
|
9
|
+
export const pathinfo = {
|
|
10
|
+
os: os.platform(),
|
|
11
|
+
isGdk: false,
|
|
12
|
+
gamepath: null,
|
|
13
|
+
};
|
|
14
|
+
function getGlobalResourcePackFile(gamepath) {
|
|
15
|
+
return path.join(gamepath, "minecraftpe/global_resource_packs.json");
|
|
16
|
+
}
|
|
17
|
+
async function readGlobalRspFile(filepath) {
|
|
18
|
+
try {
|
|
19
|
+
if (await fsp.stat(filepath)) {
|
|
20
|
+
return JSON.parse(await fsp.readFile(filepath, "utf-8"));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function writeGlobalRspFile(filepath, data) {
|
|
28
|
+
try {
|
|
29
|
+
await fsp.writeFile(filepath, JSON.stringify(data), "utf-8");
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function enable(uuid, version, filepath) {
|
|
36
|
+
try {
|
|
37
|
+
const globalRsp = await readGlobalRspFile(filepath);
|
|
38
|
+
if (!globalRsp)
|
|
39
|
+
return null;
|
|
40
|
+
const index = globalRsp.findIndex(data => data.pack_id === uuid);
|
|
41
|
+
if (index === -1) {
|
|
42
|
+
globalRsp.push({ pack_id: uuid, version });
|
|
43
|
+
await writeGlobalRspFile(filepath, globalRsp);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
else if (globalRsp[index].version.join(".") !== version.join(".")) {
|
|
47
|
+
globalRsp[index].version = version;
|
|
48
|
+
await writeGlobalRspFile(filepath, globalRsp);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export async function disable(uuid, filepath) {
|
|
58
|
+
try {
|
|
59
|
+
let globalRsp = await readGlobalRspFile(filepath);
|
|
60
|
+
if (!globalRsp)
|
|
61
|
+
return null;
|
|
62
|
+
let isWrite = false;
|
|
63
|
+
globalRsp = globalRsp.filter(data => {
|
|
64
|
+
if (data.pack_id === uuid)
|
|
65
|
+
isWrite = true;
|
|
66
|
+
return data.pack_id !== uuid;
|
|
67
|
+
});
|
|
68
|
+
if (isWrite) {
|
|
69
|
+
await writeGlobalRspFile(filepath, globalRsp);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
else
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export async function enableRSP() {
|
|
80
|
+
if (pathinfo.isGdk && pathinfo.gamepath) {
|
|
81
|
+
const ids = [], gamepath = path.join(pathinfo.gamepath, "../../..");
|
|
82
|
+
if (config.compiler?.gdkUserId && /^\d+$/.test(config.compiler.gdkUserId))
|
|
83
|
+
ids.push(config.compiler.gdkUserId);
|
|
84
|
+
else
|
|
85
|
+
ids.push(...(await fsp.readdir(gamepath, { withFileTypes: false })).filter((id) => id !== "Shared"));
|
|
86
|
+
const [uuid] = await Promise.all([BuildCache.get("uuid")]);
|
|
87
|
+
if (!uuid)
|
|
88
|
+
return;
|
|
89
|
+
await Promise.all(ids.map(async (id) => enable(uuid[0], version, getGlobalResourcePackFile(path.join(gamepath, id, "games/com.mojang"))).then(v => {
|
|
90
|
+
if (v) {
|
|
91
|
+
Log("INFO", "Resource Pack enabled automaticly for " + id);
|
|
92
|
+
}
|
|
93
|
+
})));
|
|
94
|
+
}
|
|
95
|
+
else if (pathinfo.gamepath) {
|
|
96
|
+
const [uuid] = await Promise.all([BuildCache.get("uuid")]);
|
|
97
|
+
if (!uuid)
|
|
98
|
+
return;
|
|
99
|
+
await enable(uuid[0], version, getGlobalResourcePackFile(pathinfo.gamepath)).then(v => {
|
|
100
|
+
if (v) {
|
|
101
|
+
Log("INFO", "Resource Pack enabled automaticly");
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export async function disableRSP() {
|
|
107
|
+
if (pathinfo.isGdk && pathinfo.gamepath) {
|
|
108
|
+
const gamepath = path.join(pathinfo.gamepath, "../../..");
|
|
109
|
+
const [uuid] = await Promise.all([BuildCache.get("uuid")]);
|
|
110
|
+
if (!uuid)
|
|
111
|
+
return;
|
|
112
|
+
await Promise.all((await fsp.readdir(gamepath, { withFileTypes: false })).map(async (id) => disable(uuid[0], getGlobalResourcePackFile(path.join(gamepath, id, "games/com.mojang"))).then(v => {
|
|
113
|
+
if (v) {
|
|
114
|
+
Log("INFO", "Resource Pack disabled automaticly for " + id);
|
|
115
|
+
}
|
|
116
|
+
})));
|
|
117
|
+
}
|
|
118
|
+
else if (pathinfo.gamepath) {
|
|
119
|
+
const [uuid] = await Promise.all([BuildCache.get("uuid")]);
|
|
120
|
+
if (!uuid)
|
|
121
|
+
return;
|
|
122
|
+
await disable(uuid[0], getGlobalResourcePackFile(pathinfo.gamepath)).then(v => {
|
|
123
|
+
if (v) {
|
|
124
|
+
Log("INFO", "Resource Pack disabled automaticly");
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
3
129
|
export function getGamedataPath() {
|
|
4
|
-
switch (os
|
|
130
|
+
switch (pathinfo.os) {
|
|
5
131
|
case "win32": {
|
|
6
132
|
if (/Windows (10|11)/.test(os.version())) {
|
|
7
|
-
|
|
133
|
+
let gamedata = path.join(process.env.APPDATA, config.compiler?.importToPreview ? "Minecraft Bedrock Preview" : "Minecraft Bedrock", "\\Users\\Shared\\games\\com.mojang");
|
|
134
|
+
if (fs.existsSync(gamedata)) {
|
|
135
|
+
pathinfo.isGdk = true;
|
|
136
|
+
return (pathinfo.gamepath = gamedata);
|
|
137
|
+
}
|
|
138
|
+
gamedata = path.join(process.env.LOCALAPPDATA, "Packages", config.compiler?.importToPreview
|
|
139
|
+
? "Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe"
|
|
140
|
+
: "Microsoft.MinecraftUWP_8wekyb3d8bbwe", "LocalState\\games\\com.mojang");
|
|
141
|
+
if (fs.existsSync(gamedata)) {
|
|
142
|
+
return (pathinfo.gamepath = gamedata);
|
|
143
|
+
}
|
|
8
144
|
}
|
|
9
145
|
}
|
|
10
146
|
default: {
|
|
11
|
-
console.
|
|
12
|
-
process.exit(1);
|
|
147
|
+
console.warn(`Your platform is not supported the install feature yet! \nYour OS version: ${os.version()}`);
|
|
13
148
|
}
|
|
14
149
|
}
|
|
15
150
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from "fs/promises";
|
|
2
2
|
import { BuildCache } from "./buildcache.js";
|
|
3
3
|
import { RandomString } from "../../components/Utils.js";
|
|
4
|
-
import { prevData } from "./prevdata.js";
|
|
5
4
|
import path from "path";
|
|
6
|
-
import { getGamedataPath } from "./installer.js";
|
|
5
|
+
import { getGamedataPath, pathinfo } from "./installer.js";
|
|
6
|
+
import { Log } from "../PreCompile.js";
|
|
7
7
|
const HEX = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
8
8
|
function genUUID() {
|
|
9
9
|
const b = Array.from({ length: 16 }, () => Math.floor(Math.random() * 256));
|
|
@@ -18,23 +18,50 @@ function genUUID() {
|
|
|
18
18
|
`${HEX[b[10]]}${HEX[b[11]]}${HEX[b[12]]}${HEX[b[13]]}${HEX[b[14]]}${HEX[b[15]]}`);
|
|
19
19
|
}
|
|
20
20
|
export async function clearBuild() {
|
|
21
|
-
|
|
21
|
+
const files = (await BuildCache.get("build-files")) || [];
|
|
22
|
+
await Promise.all(files.map(file => fs.rm(`build/${file}`).catch(() => null))).then(() => {
|
|
23
|
+
if (files.length) {
|
|
24
|
+
Log("INFO", `Build folder cleared (${files.length} files removed)!`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
22
27
|
}
|
|
23
28
|
export async function createBuildFolder() {
|
|
24
29
|
return fs
|
|
25
30
|
.stat("build")
|
|
26
|
-
.catch(() => fs.mkdir("build"))
|
|
31
|
+
.catch(() => fs.mkdir("build").then(() => Log("INFO", "Build folder created!")))
|
|
27
32
|
.then(() => clearBuild());
|
|
28
33
|
}
|
|
29
34
|
export async function getBuildFolderName() {
|
|
30
35
|
return await BuildCache.getWithSetDefault("build-key", () => RandomString(16));
|
|
31
36
|
}
|
|
37
|
+
export let gamePath = null;
|
|
32
38
|
export async function linkToGame() {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
const gamedataPath = getGamedataPath();
|
|
40
|
+
await BuildCache.set("last-gamedata-path", pathinfo);
|
|
41
|
+
if (gamedataPath) {
|
|
42
|
+
const sourcePath = path.resolve("build");
|
|
43
|
+
const targetPath = path.resolve(gamedataPath, "development_resource_packs", await getBuildFolderName());
|
|
44
|
+
await fs.stat(targetPath).catch(async () => {
|
|
45
|
+
await fs
|
|
46
|
+
.symlink(sourcePath, targetPath, "junction")
|
|
47
|
+
.then(() => Log("INFO", "Linked build folder to gamedata!"));
|
|
48
|
+
});
|
|
49
|
+
gamePath = gamedataPath;
|
|
50
|
+
}
|
|
51
|
+
else
|
|
52
|
+
console.warn("No gamedata path found, cannot link!");
|
|
53
|
+
}
|
|
54
|
+
export async function unlink() {
|
|
55
|
+
const gamedataPath = await BuildCache.get("last-gamedata-path");
|
|
56
|
+
if (!gamedataPath?.gamepath)
|
|
57
|
+
return;
|
|
58
|
+
const targetPath = path.resolve(gamedataPath.gamepath, "development_resource_packs", await getBuildFolderName());
|
|
59
|
+
try {
|
|
60
|
+
await fs.unlink(targetPath).then(() => Log("INFO", "Unlinked build folder from gamedata!"));
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error(error);
|
|
64
|
+
}
|
|
38
65
|
}
|
|
39
66
|
export async function getUUID() {
|
|
40
67
|
return await BuildCache.getWithSetDefault("uuid", () => {
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
+
import { config } from "../Configuration.js";
|
|
1
2
|
import { getUUID } from "./linker.js";
|
|
3
|
+
export const version = config.packinfo?.version || [4, 0, 0];
|
|
2
4
|
export async function genManifest() {
|
|
3
5
|
const [uuid1, uuid2] = await getUUID();
|
|
4
6
|
return JSON.stringify({
|
|
5
7
|
format_version: 2,
|
|
6
8
|
header: {
|
|
7
|
-
name: "AsaJS
|
|
8
|
-
description: "
|
|
9
|
+
name: config.packinfo?.name || "AsaJS",
|
|
10
|
+
description: config.packinfo?.description || "Create your Minecraft JSON-UI resource packs using JavaScript.",
|
|
9
11
|
uuid: uuid1,
|
|
10
|
-
version
|
|
11
|
-
min_engine_version: [1, 21,
|
|
12
|
+
version,
|
|
13
|
+
min_engine_version: [1, 21, 80],
|
|
12
14
|
},
|
|
13
15
|
modules: [
|
|
14
16
|
{
|
|
15
17
|
description: "This resource pack generate by AsaJS.",
|
|
16
18
|
type: "resources",
|
|
17
19
|
uuid: uuid2,
|
|
18
|
-
version:
|
|
20
|
+
version: version,
|
|
19
21
|
},
|
|
20
22
|
],
|
|
23
|
+
subpacks: config.packinfo?.subpacks,
|
|
24
|
+
metadata: config.packinfo?.metadata,
|
|
21
25
|
});
|
|
22
26
|
}
|
|
@@ -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
|
@@ -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;
|
|
@@ -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
|
/**
|
|
@@ -270,14 +271,14 @@ export class ModifyUI extends UI {
|
|
|
270
271
|
return this.addModifications({
|
|
271
272
|
array_name: ArrayName.BINDINGS,
|
|
272
273
|
operation: Operation.INSERT_BACK,
|
|
273
|
-
value: ResolveBinding(...bindings),
|
|
274
|
+
value: ResolveBinding(this.bindCache, ...bindings),
|
|
274
275
|
});
|
|
275
276
|
}
|
|
276
277
|
insertFrontBindings(...bindings) {
|
|
277
278
|
return this.addModifications({
|
|
278
279
|
array_name: ArrayName.BINDINGS,
|
|
279
280
|
operation: Operation.INSERT_FRONT,
|
|
280
|
-
value: ResolveBinding(...bindings),
|
|
281
|
+
value: ResolveBinding(this.bindCache, ...bindings),
|
|
281
282
|
});
|
|
282
283
|
}
|
|
283
284
|
insertBindings(...bindings) {
|
|
@@ -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
|
|
@@ -205,49 +268,49 @@ properties, namespace, name) {
|
|
|
205
268
|
return ui;
|
|
206
269
|
}
|
|
207
270
|
// Quick Keyframe
|
|
208
|
-
export function
|
|
271
|
+
export function OffsetKeyframe(properties, namespace, name) {
|
|
209
272
|
return new AnimationKeyframe(AnimType.OFFSET, properties || {}, name, namespace);
|
|
210
273
|
}
|
|
211
|
-
export function
|
|
274
|
+
export function SizeKeyframe(properties, namespace, name) {
|
|
212
275
|
return new AnimationKeyframe(AnimType.SIZE, properties || {}, name, namespace);
|
|
213
276
|
}
|
|
214
|
-
export function
|
|
277
|
+
export function UVKeyframe(properties, namespace, name) {
|
|
215
278
|
return new AnimationKeyframe(AnimType.UV, properties || {}, name, namespace);
|
|
216
279
|
}
|
|
217
|
-
export function
|
|
280
|
+
export function ClipKeyframe(properties, namespace, name) {
|
|
218
281
|
return new AnimationKeyframe(AnimType.CLIP, properties || {}, name, namespace);
|
|
219
282
|
}
|
|
220
|
-
export function
|
|
283
|
+
export function ColorKeyframe(properties, namespace, name) {
|
|
221
284
|
return new AnimationKeyframe(AnimType.COLOR, properties || {}, name, namespace);
|
|
222
285
|
}
|
|
223
|
-
export function
|
|
286
|
+
export function AlphaKeyframe(properties, namespace, name) {
|
|
224
287
|
return new AnimationKeyframe(AnimType.ALPHA, properties || {}, name, namespace);
|
|
225
288
|
}
|
|
226
|
-
export function
|
|
289
|
+
export function WaitKeyframe(properties, namespace, name) {
|
|
227
290
|
return new AnimationKeyframe(AnimType.WAIT, properties || {}, name, namespace);
|
|
228
291
|
}
|
|
229
|
-
export function
|
|
292
|
+
export function FlipBookKeyframe(properties, namespace, name) {
|
|
230
293
|
return new AnimationKeyframe(AnimType.FLIP_BOOK, properties || {}, name, namespace);
|
|
231
294
|
}
|
|
232
|
-
export function
|
|
295
|
+
export function AsepriteFlipBookKeyframe(properties, namespace, name) {
|
|
233
296
|
return new AnimationKeyframe(AnimType.ASEPRITE_FLIP_BOOK, properties || {}, name, namespace);
|
|
234
297
|
}
|
|
235
|
-
export function
|
|
298
|
+
export function OffsetAnimation(...keyframes) {
|
|
236
299
|
return new Animation(AnimType.OFFSET, ...keyframes);
|
|
237
300
|
}
|
|
238
|
-
export function
|
|
301
|
+
export function SizeAnimation(...keyframes) {
|
|
239
302
|
return new Animation(AnimType.SIZE, ...keyframes);
|
|
240
303
|
}
|
|
241
|
-
export function
|
|
304
|
+
export function UVAnimation(...keyframes) {
|
|
242
305
|
return new Animation(AnimType.UV, ...keyframes);
|
|
243
306
|
}
|
|
244
|
-
export function
|
|
307
|
+
export function ClipAnimation(...keyframes) {
|
|
245
308
|
return new Animation(AnimType.CLIP, ...keyframes);
|
|
246
309
|
}
|
|
247
|
-
export function
|
|
310
|
+
export function ColorAnimation(...keyframes) {
|
|
248
311
|
return new Animation(AnimType.COLOR, ...keyframes);
|
|
249
312
|
}
|
|
250
|
-
export function
|
|
313
|
+
export function AlphaAnimation(...keyframes) {
|
|
251
314
|
return new Animation(AnimType.ALPHA, ...keyframes);
|
|
252
315
|
}
|
|
253
316
|
// Animation ExtendsOf
|
package/dist/js/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./compilers/Configuration.js";
|
|
1
2
|
import "./compilers/PreCompile.js";
|
|
2
3
|
import "./compilers/ui/builder.js";
|
|
3
4
|
import "./compilers/ui/installer.js";
|
|
@@ -8,3 +9,5 @@ export * from "./components/Utils.js";
|
|
|
8
9
|
export * from "./types/enums/index.js";
|
|
9
10
|
export * as Properties from "./types/properties/index.js";
|
|
10
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";
|
|
@@ -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
|
}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface PathInfo<Platform = NodeJS.Platform> {
|
|
2
|
+
os: Platform;
|
|
3
|
+
isGdk: Platform extends "win32" ? boolean : never;
|
|
4
|
+
gamepath: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const pathinfo: PathInfo;
|
|
7
|
+
export declare function enable(uuid: string, version: [number, number, number], filepath: string): Promise<boolean | null>;
|
|
8
|
+
export declare function disable(uuid: string, filepath: string): Promise<boolean | null>;
|
|
9
|
+
export declare function enableRSP(): Promise<void>;
|
|
10
|
+
export declare function disableRSP(): Promise<void>;
|
|
11
|
+
export declare function getGamedataPath(): string | undefined;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function clearBuild(): Promise<void>;
|
|
2
2
|
export declare function createBuildFolder(): Promise<void>;
|
|
3
3
|
export declare function getBuildFolderName(): Promise<string>;
|
|
4
|
+
export declare let gamePath: string | null;
|
|
4
5
|
export declare function linkToGame(): Promise<void>;
|
|
6
|
+
export declare function unlink(): Promise<void>;
|
|
5
7
|
export declare function getUUID(): Promise<[string, 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>>;
|
|
@@ -26,6 +26,7 @@ export declare class UI<T extends Type, K extends Renderer | null = null> extend
|
|
|
26
26
|
protected readonly anims: (Animation<AnimType> | AnimationKeyframe<AnimType>)[];
|
|
27
27
|
protected readonly extendType?: Type;
|
|
28
28
|
protected properties: Properties<T, K>;
|
|
29
|
+
protected bindCache: Map<string, unknown>;
|
|
29
30
|
constructor(type?: T | undefined, name?: string, namespace?: string, path?: string);
|
|
30
31
|
/**
|
|
31
32
|
* Set properties for this element
|