asajs 4.2.0 → 5.0.0-indev-0
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/dist/js/{compilers → compiler}/FormatProperties.js +1 -6
- package/dist/js/compiler/builder.js +27 -0
- package/dist/js/compiler/cache.js +18 -0
- package/dist/js/compiler/properties.js +50 -0
- package/dist/js/compiler/storage.js +2 -0
- package/dist/js/compiler/ui/animstorage.js +9 -0
- package/dist/js/{compilers → compiler/ui}/bindings/Binary.js +3 -3
- package/dist/js/{compilers → compiler/ui}/bindings/Function.js +21 -58
- package/dist/js/{compilers → compiler/ui}/bindings/Parser.js +7 -7
- package/dist/js/compiler/ui/initstorate.js +21 -0
- package/dist/js/compiler/ui/modifystorage.js +26 -0
- package/dist/js/compiler/ui/resolve.js +85 -0
- package/dist/js/compiler/ui/uidefs.js +23 -0
- package/dist/js/compiler/ui/uistorage.js +37 -0
- package/dist/js/components/builder/Builder.js +10 -0
- package/dist/js/components/builder/JsonBuilder.js +12 -0
- package/dist/js/components/builder/UIDefs.js +2 -0
- package/dist/js/components/{Animation.js → ui/Animation.js} +6 -15
- package/dist/js/components/ui/AnimationKeyframe.js +41 -0
- package/dist/js/components/{Factory.js → ui/Factory.js} +1 -3
- package/dist/js/components/{UI.js → ui/ModifyUI.js} +24 -186
- package/dist/js/components/ui/UI.js +25 -0
- package/dist/js/components/ui/UIInit.js +83 -0
- package/dist/js/components/ui/UIStorage.js +14 -0
- package/dist/js/index.js +14 -15
- package/dist/js/utils/FastUI.js +70 -0
- package/dist/js/utils/QuickAnim.js +50 -0
- package/dist/js/utils/Random.js +17 -0
- package/dist/js/utils/Utils.js +37 -0
- package/dist/types/{compilers → compiler}/FormatProperties.d.ts +2 -2
- package/dist/types/compiler/cache.d.ts +6 -0
- package/dist/types/compiler/properties.d.ts +4 -0
- package/dist/types/compiler/storage.d.ts +2 -0
- package/dist/types/compiler/ui/animstorage.d.ts +6 -0
- package/dist/types/{compilers → compiler/ui}/bindings/Binary.d.ts +1 -1
- package/dist/types/{compilers → compiler/ui}/bindings/Function.d.ts +0 -8
- package/dist/types/{compilers → compiler/ui}/bindings/Parser.d.ts +1 -1
- package/dist/types/compiler/ui/initstorate.d.ts +17 -0
- package/dist/types/compiler/ui/modifystorage.d.ts +10 -0
- package/dist/types/compiler/ui/resolve.d.ts +2 -0
- package/dist/types/compiler/ui/uidefs.d.ts +11 -0
- package/dist/types/compiler/ui/uistorage.d.ts +11 -0
- package/dist/types/components/builder/Builder.d.ts +5 -0
- package/dist/types/components/builder/JsonBuilder.d.ts +7 -0
- package/dist/types/components/ui/Animation.d.ts +21 -0
- package/dist/types/components/ui/AnimationKeyframe.d.ts +117 -0
- package/dist/types/components/{Factory.d.ts → ui/Factory.d.ts} +2 -3
- package/dist/types/components/ui/ModifyUI.d.ts +59 -0
- package/dist/types/components/ui/UI.d.ts +10 -0
- package/dist/types/components/ui/UIInit.d.ts +42 -0
- package/dist/types/components/ui/UIStorage.d.ts +5 -0
- package/dist/types/index.d.ts +14 -15
- package/dist/types/types/{properties → ui/properties}/element/Animation.d.ts +2 -2
- package/dist/types/types/{properties → ui/properties}/value.d.ts +2 -2
- package/dist/types/utils/FastUI.d.ts +26 -0
- package/dist/types/utils/QuickAnim.d.ts +22 -0
- package/dist/types/utils/Random.d.ts +5 -0
- package/dist/types/utils/Utils.d.ts +5 -0
- package/package.json +6 -11
- package/config.d.ts +0 -50
- package/dist/js/analyzer/generate-code.js +0 -83
- package/dist/js/analyzer/generate-ui-defs.js +0 -118
- package/dist/js/analyzer/rebaseUIFiles.js +0 -28
- package/dist/js/analyzer/utils.js +0 -19
- package/dist/js/analyzer/vanilladefs.js +0 -143828
- package/dist/js/compilers/Configuration.js +0 -81
- package/dist/js/compilers/Memory.js +0 -34
- package/dist/js/compilers/PreCompile.js +0 -23
- package/dist/js/compilers/Random.js +0 -2
- package/dist/js/compilers/ui/buildcache.js +0 -57
- package/dist/js/compilers/ui/builder.js +0 -88
- package/dist/js/compilers/ui/installer.js +0 -159
- package/dist/js/compilers/ui/linker.js +0 -71
- package/dist/js/compilers/ui/manifest.js +0 -27
- package/dist/js/components/API.js +0 -9
- package/dist/js/components/AnimationKeyframe.js +0 -71
- package/dist/js/components/Class.js +0 -11
- package/dist/js/components/KeyframeController.js +0 -10
- package/dist/js/components/Utils.js +0 -421
- package/dist/js/types/properties/element/DropdownName.js +0 -2
- package/dist/js/types/vanilla/index.js +0 -2
- package/dist/js/types/vanilla/intellisense.js +0 -2
- package/dist/js/types/vanilla/paths.js +0 -212
- package/dist/types/analyzer/generate-code.d.ts +0 -1
- package/dist/types/analyzer/generate-ui-defs.d.ts +0 -1
- package/dist/types/analyzer/rebaseUIFiles.d.ts +0 -1
- package/dist/types/analyzer/utils.d.ts +0 -3
- package/dist/types/analyzer/vanilladefs.d.ts +0 -16
- package/dist/types/compilers/Configuration.d.ts +0 -14
- package/dist/types/compilers/Memory.d.ts +0 -19
- package/dist/types/compilers/PreCompile.d.ts +0 -11
- package/dist/types/compilers/ui/buildcache.d.ts +0 -8
- package/dist/types/compilers/ui/installer.d.ts +0 -11
- package/dist/types/compilers/ui/linker.d.ts +0 -7
- package/dist/types/compilers/ui/manifest.d.ts +0 -2
- package/dist/types/components/API.d.ts +0 -7
- package/dist/types/components/Animation.d.ts +0 -25
- package/dist/types/components/AnimationKeyframe.d.ts +0 -94
- package/dist/types/components/Class.d.ts +0 -10
- package/dist/types/components/KeyframeController.d.ts +0 -7
- package/dist/types/components/UI.d.ts +0 -142
- package/dist/types/components/Utils.d.ts +0 -82
- package/dist/types/types/properties/element/DropdownName.d.ts +0 -6
- package/dist/types/types/vanilla/index.d.ts +0 -1
- package/dist/types/types/vanilla/intellisense.d.ts +0 -77203
- package/dist/types/types/vanilla/paths.d.ts +0 -211
- package/extends/binding.txt +0 -1477
- package/extends/button_id.txt +0 -947
- /package/dist/js/{compilers → compiler/ui}/bindings/Checker.js +0 -0
- /package/dist/js/{compilers → compiler/ui}/bindings/Lexer.js +0 -0
- /package/dist/js/{compilers → compiler/ui}/bindings/index.js +0 -0
- /package/dist/js/{compilers → compiler/ui}/bindings/types.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Anchor.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/AnimType.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/ArrayName.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/BagBinding.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Binding.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/BindingCondition.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/BindingType.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/ButtonId.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/ClipDirection.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/CollectionName.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Color.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/DebugColor.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Easing.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/FocusNavigationMode.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/FontSize.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/FontType.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/GlobalVariables.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/GridDimensions.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/InputModeCondition.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Items.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Links.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/MappingType.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/McColor.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Operation.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Orientation.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Renderer.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Rotation.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Scope.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/SliderName.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/SmartAnimation.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/TextAlignment.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/TextType.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/TextboxName.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/TextureFileSystem.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/ToggleName.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/Type.js +0 -0
- /package/dist/js/types/{enums → ui/enums}/index.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/components.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Animation.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Button.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/CarouselLabel.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Collection.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Control.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/CustomRenderer.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Cycler.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/DataBinding.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Dropdown.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/EditBox.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Factory.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Focus.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Grid.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/GridItem.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/GridPageIndicator.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Input.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Layout.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Screen.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/ScrollView.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/SelectionWheel.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Slider.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Sliderbox.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Sound.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Sprite.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/StackPanel.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/TTS.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Tab.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Text.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/Toggle.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/TooltipTrigger.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/element/index.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/enum.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/index.js +0 -0
- /package/dist/js/types/{properties → ui/properties}/value.js +0 -0
- /package/dist/types/{compilers/ui → compiler}/builder.d.ts +0 -0
- /package/dist/types/{compilers → compiler/ui}/bindings/Checker.d.ts +0 -0
- /package/dist/types/{compilers → compiler/ui}/bindings/Lexer.d.ts +0 -0
- /package/dist/types/{compilers → compiler/ui}/bindings/index.d.ts +0 -0
- /package/dist/types/{compilers → compiler/ui}/bindings/types.d.ts +0 -0
- /package/dist/types/{compilers/Random.d.ts → components/builder/UIDefs.d.ts} +0 -0
- /package/dist/types/types/{enums → ui/enums}/Anchor.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/AnimType.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/ArrayName.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/BagBinding.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Binding.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/BindingCondition.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/BindingType.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/ButtonId.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/ClipDirection.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/CollectionName.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Color.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/DebugColor.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Easing.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/FocusNavigationMode.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/FontSize.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/FontType.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/GlobalVariables.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/GridDimensions.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/InputModeCondition.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Items.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Links.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/MappingType.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/McColor.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Operation.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Orientation.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Renderer.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Rotation.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Scope.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/SliderName.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/SmartAnimation.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/TextAlignment.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/TextType.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/TextboxName.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/TextureFileSystem.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/ToggleName.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/Type.d.ts +0 -0
- /package/dist/types/types/{enums → ui/enums}/index.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/components.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Button.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/CarouselLabel.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Collection.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Control.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/CustomRenderer.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Cycler.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/DataBinding.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Dropdown.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/EditBox.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Factory.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Focus.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Grid.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/GridItem.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/GridPageIndicator.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Input.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Layout.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Screen.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/ScrollView.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/SelectionWheel.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Slider.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Sliderbox.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Sound.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Sprite.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/StackPanel.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/TTS.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Tab.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Text.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/Toggle.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/TooltipTrigger.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/element/index.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/enum.d.ts +0 -0
- /package/dist/types/types/{properties → ui/properties}/index.d.ts +0 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { AnimationKeyframe } from "../components/AnimationKeyframe.js";
|
|
2
|
-
import { BagBinding } from "../types/enums/BagBinding.js";
|
|
3
|
-
import { config } from "./Configuration.js";
|
|
1
|
+
import { AnimationKeyframe } from "../components/ui/AnimationKeyframe.js";
|
|
4
2
|
export function FormatProperties(properties) {
|
|
5
3
|
const property_bag = {};
|
|
6
4
|
for (const key in properties) {
|
|
@@ -25,9 +23,6 @@ export function FormatProperties(properties) {
|
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
|
-
if (config.compiler?.fixInventoryItemRenderer && property_bag[BagBinding.ITEM_ID_AUX]) {
|
|
29
|
-
property_bag[BagBinding.ITEM_ID_AUX] = `(${property_bag[BagBinding.ITEM_ID_AUX]} / 1)`;
|
|
30
|
-
}
|
|
31
26
|
if (properties.anchor) {
|
|
32
27
|
properties.anchor_from = properties.anchor_to = properties.anchor;
|
|
33
28
|
delete properties.anchor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { storage } from "./storage.js";
|
|
2
|
+
import fs from "fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { Cache } from "./cache.js";
|
|
5
|
+
let isFirstRun = true;
|
|
6
|
+
process.on("beforeExit", async () => {
|
|
7
|
+
if (isFirstRun) {
|
|
8
|
+
isFirstRun = false;
|
|
9
|
+
await Promise.all(Cache.get("build_files").map(async (file) => {
|
|
10
|
+
await fs.rm(path.resolve(file)).catch(() => { });
|
|
11
|
+
}) || []).then(v => {
|
|
12
|
+
if (v.length) {
|
|
13
|
+
console.log(`Removed ${v.length} build files.`);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Cache.set("build_files", await Promise.all(storage.entries().map(async ([file, builder]) => {
|
|
17
|
+
const fullpath = path.resolve(file);
|
|
18
|
+
const dirname = path.dirname(fullpath);
|
|
19
|
+
await fs.stat(dirname).catch(async () => await fs.mkdir(dirname, { recursive: true }));
|
|
20
|
+
await fs.writeFile(fullpath, builder.build());
|
|
21
|
+
storage.delete(fullpath);
|
|
22
|
+
return file;
|
|
23
|
+
})));
|
|
24
|
+
await Cache.save();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import _fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
export class Cache {
|
|
5
|
+
static cache = _fs.existsSync(path.join("build", "cache.json"))
|
|
6
|
+
? JSON.parse(_fs.readFileSync(path.join("build", "cache.json"), "utf-8"))
|
|
7
|
+
: {};
|
|
8
|
+
static set(key, value) {
|
|
9
|
+
this.cache[key] = value;
|
|
10
|
+
}
|
|
11
|
+
static get(key) {
|
|
12
|
+
return this.cache[key];
|
|
13
|
+
}
|
|
14
|
+
static async save() {
|
|
15
|
+
await fs.writeFile(path.resolve(path.join("build", "cache.json")), JSON.stringify(this.cache));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AnimationKeyframe } from "../components/ui/AnimationKeyframe.js";
|
|
2
|
+
export function FormatProperties(properties) {
|
|
3
|
+
const property_bag = {};
|
|
4
|
+
for (const key in properties) {
|
|
5
|
+
const value = properties[key];
|
|
6
|
+
if (key.startsWith("#")) {
|
|
7
|
+
property_bag[key] = value;
|
|
8
|
+
delete properties[key];
|
|
9
|
+
}
|
|
10
|
+
if (key.startsWith("$")) {
|
|
11
|
+
const [varName, varType] = key.split("|");
|
|
12
|
+
if (!varType)
|
|
13
|
+
break;
|
|
14
|
+
switch (varType) {
|
|
15
|
+
case "d":
|
|
16
|
+
properties[`${varName}|default`] = value;
|
|
17
|
+
delete properties[key];
|
|
18
|
+
break;
|
|
19
|
+
case "default":
|
|
20
|
+
break;
|
|
21
|
+
default:
|
|
22
|
+
throw new Error("Invalid variable type");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (properties.anchor) {
|
|
27
|
+
properties.anchor_from = properties.anchor_to = properties.anchor;
|
|
28
|
+
delete properties.anchor;
|
|
29
|
+
}
|
|
30
|
+
if (properties.fit_to_width) {
|
|
31
|
+
properties["$fit_to_width"] = properties.fit_to_width;
|
|
32
|
+
delete properties.fit_to_width;
|
|
33
|
+
}
|
|
34
|
+
if (Object.keys(property_bag).length) {
|
|
35
|
+
if (properties.property_bag) {
|
|
36
|
+
properties.property_bag = { ...property_bag, ...properties.property_bag };
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
properties.property_bag = property_bag;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return properties;
|
|
43
|
+
}
|
|
44
|
+
export function FormatAnimationProperties(properties) {
|
|
45
|
+
if (properties.next instanceof AnimationKeyframe) {
|
|
46
|
+
properties.next = `${properties.next}`;
|
|
47
|
+
}
|
|
48
|
+
return properties;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JsonBuilder } from "../../components/builder/JsonBuilder.js";
|
|
2
|
+
export const storage = new Map();
|
|
3
|
+
export class AnimStorage extends JsonBuilder {
|
|
4
|
+
constructor(namespace) {
|
|
5
|
+
super(namespace);
|
|
6
|
+
}
|
|
7
|
+
toJSON() { }
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=animstorage.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetRandomBindingString } from "../../../utils/Random.js";
|
|
2
2
|
import { defaultFunctions } from "./Function.js";
|
|
3
3
|
export function intToBin(input) {
|
|
4
4
|
const { abs, negabs } = defaultFunctions;
|
|
5
|
-
const ret =
|
|
5
|
+
const ret = GetRandomBindingString();
|
|
6
6
|
const bindings = [];
|
|
7
7
|
// negative bit
|
|
8
8
|
bindings.push({
|
|
@@ -15,7 +15,7 @@ export function intToBin(input) {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
export function binToInt(input) {
|
|
18
|
-
const ret =
|
|
18
|
+
const ret = GetRandomBindingString();
|
|
19
19
|
const bindings = [];
|
|
20
20
|
const nevBind = (input + "0");
|
|
21
21
|
// Is reverse to positive
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { isBinding, isNumber, isString, isVariable } from "./Checker.js";
|
|
1
|
+
import { GetRandomBindingString, GetRandomString } from "../../../utils/Random.js";
|
|
2
|
+
import { isBinding, isNumber, isString } from "./Checker.js";
|
|
4
3
|
export const FunctionMap = new Map();
|
|
5
4
|
export const defaultFunctions = {
|
|
6
5
|
/**
|
|
@@ -9,7 +8,7 @@ export const defaultFunctions = {
|
|
|
9
8
|
* @returns
|
|
10
9
|
*/
|
|
11
10
|
abs: number => {
|
|
12
|
-
const randomBinding =
|
|
11
|
+
const randomBinding = GetRandomBindingString();
|
|
13
12
|
return {
|
|
14
13
|
genBindings: [{ source: `((-1 + (${number} > 0) * 2) * ${number})`, target: randomBinding }],
|
|
15
14
|
value: randomBinding,
|
|
@@ -21,7 +20,7 @@ export const defaultFunctions = {
|
|
|
21
20
|
* @returns
|
|
22
21
|
*/
|
|
23
22
|
negabs: number => {
|
|
24
|
-
const randomBinding =
|
|
23
|
+
const randomBinding = GetRandomBindingString();
|
|
25
24
|
return {
|
|
26
25
|
genBindings: [{ source: `((-1 + (${number} < 0) * 2) * ${number})`, target: randomBinding }],
|
|
27
26
|
value: randomBinding,
|
|
@@ -33,18 +32,18 @@ export const defaultFunctions = {
|
|
|
33
32
|
* @returns
|
|
34
33
|
*/
|
|
35
34
|
new: expression => {
|
|
36
|
-
const randomBinding =
|
|
35
|
+
const randomBinding = GetRandomBindingString();
|
|
37
36
|
return {
|
|
38
37
|
genBindings: [{ source: expression, target: randomBinding }],
|
|
39
38
|
value: randomBinding,
|
|
40
39
|
};
|
|
41
40
|
},
|
|
42
41
|
sqrt: input => {
|
|
43
|
-
const ret =
|
|
44
|
-
const isNegative =
|
|
45
|
-
const isLowerThanTwo =
|
|
46
|
-
const next =
|
|
47
|
-
const nextEqualOrGreaterThan =
|
|
42
|
+
const ret = GetRandomBindingString();
|
|
43
|
+
const isNegative = GetRandomBindingString();
|
|
44
|
+
const isLowerThanTwo = GetRandomBindingString();
|
|
45
|
+
const next = GetRandomBindingString();
|
|
46
|
+
const nextEqualOrGreaterThan = GetRandomBindingString();
|
|
48
47
|
const isNextEqualOrGreaterThanRet = `(${nextEqualOrGreaterThan} * ${ret})`;
|
|
49
48
|
const isNotNextEqualOrGreaterThanRet = `((not ${nextEqualOrGreaterThan}) * ${next})`;
|
|
50
49
|
const lowerThanTwoPart = `(${isLowerThanTwo} * ${input})`;
|
|
@@ -97,8 +96,8 @@ export const defaultFunctions = {
|
|
|
97
96
|
strlen: str => {
|
|
98
97
|
if (!/\#\w+/.test(str))
|
|
99
98
|
throw new Error("Invalid string");
|
|
100
|
-
const count =
|
|
101
|
-
const inputStr =
|
|
99
|
+
const count = GetRandomBindingString();
|
|
100
|
+
const inputStr = GetRandomBindingString();
|
|
102
101
|
return {
|
|
103
102
|
genBindings: [
|
|
104
103
|
{
|
|
@@ -128,7 +127,7 @@ export const defaultFunctions = {
|
|
|
128
127
|
};
|
|
129
128
|
},
|
|
130
129
|
starts_with: (source_str, start_str) => {
|
|
131
|
-
const prefix = `'asajs:${
|
|
130
|
+
const prefix = `'asajs:${GetRandomString()}:'`;
|
|
132
131
|
if (isString(source_str)) {
|
|
133
132
|
if (isString(start_str)) {
|
|
134
133
|
return {
|
|
@@ -137,7 +136,7 @@ export const defaultFunctions = {
|
|
|
137
136
|
}
|
|
138
137
|
else {
|
|
139
138
|
source_str = prefix.slice(0, -1) + source_str.slice(1);
|
|
140
|
-
const start_str_bind =
|
|
139
|
+
const start_str_bind = GetRandomBindingString();
|
|
141
140
|
return {
|
|
142
141
|
genBindings: [
|
|
143
142
|
{
|
|
@@ -157,8 +156,8 @@ export const defaultFunctions = {
|
|
|
157
156
|
};
|
|
158
157
|
}
|
|
159
158
|
else {
|
|
160
|
-
const source_str_bind =
|
|
161
|
-
const start_str_bind =
|
|
159
|
+
const source_str_bind = GetRandomBindingString();
|
|
160
|
+
const start_str_bind = GetRandomBindingString();
|
|
162
161
|
return {
|
|
163
162
|
genBindings: [
|
|
164
163
|
{
|
|
@@ -176,10 +175,10 @@ export const defaultFunctions = {
|
|
|
176
175
|
}
|
|
177
176
|
},
|
|
178
177
|
str_slice: (str, start, end) => {
|
|
179
|
-
const prefix = `'asajs:${
|
|
178
|
+
const prefix = `'asajs:${GetRandomString()}:'`;
|
|
180
179
|
const genStrBinds = {
|
|
181
180
|
source: ``,
|
|
182
|
-
target:
|
|
181
|
+
target: GetRandomBindingString(),
|
|
183
182
|
};
|
|
184
183
|
if (isBinding(str))
|
|
185
184
|
genStrBinds.source = `(${prefix} + ${str})`;
|
|
@@ -202,7 +201,7 @@ export const defaultFunctions = {
|
|
|
202
201
|
throw new Error("Invalid end");
|
|
203
202
|
const sliceEnd = {
|
|
204
203
|
source: `(${end} * ${genStrBinds.target})`,
|
|
205
|
-
target:
|
|
204
|
+
target: GetRandomBindingString(),
|
|
206
205
|
};
|
|
207
206
|
return {
|
|
208
207
|
genBindings: [genStrBinds, sliceEnd],
|
|
@@ -216,22 +215,6 @@ export const defaultFunctions = {
|
|
|
216
215
|
};
|
|
217
216
|
}
|
|
218
217
|
},
|
|
219
|
-
bs: input_binding => {
|
|
220
|
-
if (!isBinding(input_binding))
|
|
221
|
-
throw new Error("Invalid input binding");
|
|
222
|
-
return {
|
|
223
|
-
doNotAddParentesis: true,
|
|
224
|
-
value: bs(input_binding),
|
|
225
|
-
};
|
|
226
|
-
},
|
|
227
|
-
vs: input_variable => {
|
|
228
|
-
if (!isVariable(input_variable))
|
|
229
|
-
throw new Error("Invalid input binding");
|
|
230
|
-
return {
|
|
231
|
-
doNotAddParentesis: true,
|
|
232
|
-
value: vs(input_variable),
|
|
233
|
-
};
|
|
234
|
-
},
|
|
235
218
|
/**
|
|
236
219
|
* Return a translatable string
|
|
237
220
|
* @param key
|
|
@@ -262,7 +245,7 @@ export const defaultFunctions = {
|
|
|
262
245
|
* @returns
|
|
263
246
|
*/
|
|
264
247
|
bind: (value, bait) => {
|
|
265
|
-
const ret =
|
|
248
|
+
const ret = GetRandomBindingString();
|
|
266
249
|
if (!bait) {
|
|
267
250
|
throw new Error("Bait is required");
|
|
268
251
|
}
|
|
@@ -277,7 +260,7 @@ export const defaultFunctions = {
|
|
|
277
260
|
* @returns
|
|
278
261
|
*/
|
|
279
262
|
int: input => {
|
|
280
|
-
const ret =
|
|
263
|
+
const ret = GetRandomBindingString();
|
|
281
264
|
return {
|
|
282
265
|
genBindings: [{ source: `${input}`, target: ret }],
|
|
283
266
|
value: ret,
|
|
@@ -285,24 +268,4 @@ export const defaultFunctions = {
|
|
|
285
268
|
},
|
|
286
269
|
};
|
|
287
270
|
Object.entries(defaultFunctions).forEach(([key, value]) => FunctionMap.set(key, value));
|
|
288
|
-
if (bindingFuntions)
|
|
289
|
-
Object.entries(bindingFuntions).forEach(([key, value]) => {
|
|
290
|
-
// @ts-ignore
|
|
291
|
-
FunctionMap.set(key, (...args) => {
|
|
292
|
-
const { generate_bindings, return_value } = value(...args);
|
|
293
|
-
if (generate_bindings) {
|
|
294
|
-
const resolve = ResolveBinding(new Map(), ...generate_bindings);
|
|
295
|
-
return {
|
|
296
|
-
genBindings: resolve.map(({ source_property_name, target_property_name }) => ({
|
|
297
|
-
source: source_property_name,
|
|
298
|
-
target: target_property_name,
|
|
299
|
-
})),
|
|
300
|
-
value: return_value,
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
return {
|
|
304
|
-
value: return_value,
|
|
305
|
-
};
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
271
|
//# sourceMappingURL=Function.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TokenKind, TSTokenKind } from "./types.js";
|
|
2
|
-
import { BindingType } from "../../types/enums/BindingType.js";
|
|
3
2
|
import { FunctionMap } from "./Function.js";
|
|
4
3
|
import { Lexer } from "./Lexer.js";
|
|
5
|
-
import { RandomBindingString } from "../../components/Utils.js";
|
|
6
4
|
import { isHasBinding } from "./Checker.js";
|
|
5
|
+
import { GetRandomBindingString } from "../../../utils/Random.js";
|
|
6
|
+
import { BindingType } from "../../../types/ui/enums/BindingType.js";
|
|
7
7
|
export class Parser {
|
|
8
8
|
input;
|
|
9
9
|
cache;
|
|
@@ -28,7 +28,7 @@ export class Parser {
|
|
|
28
28
|
}
|
|
29
29
|
static intToBin(input) {
|
|
30
30
|
const bindings = [];
|
|
31
|
-
const rtn =
|
|
31
|
+
const rtn = GetRandomBindingString();
|
|
32
32
|
for (let i = 0; i < 30; i++) {
|
|
33
33
|
bindings.push({
|
|
34
34
|
source: `(${input} / ${2 ** i} - (${input} / ${2 ** (i + 1)}) * 2)`,
|
|
@@ -77,7 +77,7 @@ export class Parser {
|
|
|
77
77
|
this.expect(TokenKind.OPERATOR, "Unexpected token!");
|
|
78
78
|
let leftBind, middleBind, rightBind;
|
|
79
79
|
if (isHasBinding(left)) {
|
|
80
|
-
leftBind =
|
|
80
|
+
leftBind = GetRandomBindingString();
|
|
81
81
|
this.genBindings.push({
|
|
82
82
|
source: `((0 + ${left}) > 0)`,
|
|
83
83
|
target: leftBind,
|
|
@@ -86,7 +86,7 @@ export class Parser {
|
|
|
86
86
|
else
|
|
87
87
|
this.expect(TokenKind.WORD, "Unexpected token!");
|
|
88
88
|
if (isHasBinding(middle)) {
|
|
89
|
-
middleBind =
|
|
89
|
+
middleBind = GetRandomBindingString();
|
|
90
90
|
this.genBindings.push({
|
|
91
91
|
source: middle,
|
|
92
92
|
target: middleBind,
|
|
@@ -95,7 +95,7 @@ export class Parser {
|
|
|
95
95
|
else
|
|
96
96
|
this.expect(TokenKind.WORD, "Unexpected token!");
|
|
97
97
|
if (isHasBinding(right)) {
|
|
98
|
-
rightBind =
|
|
98
|
+
rightBind = GetRandomBindingString();
|
|
99
99
|
this.genBindings.push({
|
|
100
100
|
source: right,
|
|
101
101
|
target: rightBind,
|
|
@@ -173,7 +173,7 @@ export class Parser {
|
|
|
173
173
|
if (this.cache.has(cacheStr)) {
|
|
174
174
|
return (left = this.cache.get(cacheStr));
|
|
175
175
|
}
|
|
176
|
-
const ret =
|
|
176
|
+
const ret = GetRandomBindingString();
|
|
177
177
|
this.genBindings.push({
|
|
178
178
|
source: `(${left} - (${left} / ${right} * ${right}))`,
|
|
179
179
|
target: ret,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JsonBuilder } from "../../components/builder/JsonBuilder.js";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export const storage = new Map();
|
|
4
|
+
export class InitStorage extends JsonBuilder {
|
|
5
|
+
file;
|
|
6
|
+
uiMap = new Map();
|
|
7
|
+
constructor(file) {
|
|
8
|
+
file = path.join("resoucepack", file);
|
|
9
|
+
super(file);
|
|
10
|
+
this.file = file;
|
|
11
|
+
}
|
|
12
|
+
add(key, ui) {
|
|
13
|
+
if (this.uiMap.has(key))
|
|
14
|
+
throw new Error("UI already exists");
|
|
15
|
+
this.uiMap.set(key, ui);
|
|
16
|
+
}
|
|
17
|
+
get() {
|
|
18
|
+
return Object.fromEntries(this.uiMap.entries());
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=initstorate.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InitStorage, storage } from "./initstorate.js";
|
|
2
|
+
export function GetModifyStorage(file) {
|
|
3
|
+
const $ = storage.get(file);
|
|
4
|
+
if ($) {
|
|
5
|
+
if ($.isUI)
|
|
6
|
+
throw new Error(`${file} is not a Modify file`);
|
|
7
|
+
else {
|
|
8
|
+
return $;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
const modify = new ModifyStorage(file);
|
|
13
|
+
storage.set(file, modify);
|
|
14
|
+
return modify;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class ModifyStorage extends InitStorage {
|
|
18
|
+
isUI = false;
|
|
19
|
+
constructor(file) {
|
|
20
|
+
super(file);
|
|
21
|
+
}
|
|
22
|
+
toJSON() {
|
|
23
|
+
return this.get();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=modifystorage.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BindingType } from "../../types/ui/enums/BindingType.js";
|
|
2
|
+
import { GetRandomBindingString } from "../../utils/Random.js";
|
|
3
|
+
import { isCompileBinding } from "./bindings/Checker.js";
|
|
4
|
+
import { Lexer } from "./bindings/Lexer.js";
|
|
5
|
+
import { Parser } from "./bindings/Parser.js";
|
|
6
|
+
import { TokenKind, TSTokenKind } from "./bindings/types.js";
|
|
7
|
+
export function ResolveBinding(cache, ...bindings) {
|
|
8
|
+
const result = [];
|
|
9
|
+
for (const binding of bindings) {
|
|
10
|
+
if (binding.source_property_name) {
|
|
11
|
+
if (isCompileBinding(binding.source_property_name)) {
|
|
12
|
+
const inputBindings = binding.source_property_name.slice(1, -1);
|
|
13
|
+
if (binding.source_control_name) {
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
const tokensMapping = (token) => {
|
|
16
|
+
if (token.kind === TokenKind.VARIABLE) {
|
|
17
|
+
const mapkey = `mapping:${binding.source_control_name}:${token.value}`;
|
|
18
|
+
if (cache.has(mapkey)) {
|
|
19
|
+
return {
|
|
20
|
+
...token,
|
|
21
|
+
value: cache.get(mapkey),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const ret = GetRandomBindingString();
|
|
26
|
+
cache.set(mapkey, ret);
|
|
27
|
+
result.push({
|
|
28
|
+
source_property_name: token.value,
|
|
29
|
+
source_control_name: binding.source_control_name,
|
|
30
|
+
target_property_name: ret,
|
|
31
|
+
binding_type: BindingType.VIEW,
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
...token,
|
|
35
|
+
value: ret,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (token.kind === TokenKind.TEMPLATE_STRING) {
|
|
40
|
+
return {
|
|
41
|
+
...token,
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
value: token.value.map((tstoken) => {
|
|
44
|
+
if (tstoken.kind === TSTokenKind.STRING)
|
|
45
|
+
return tstoken;
|
|
46
|
+
else {
|
|
47
|
+
return {
|
|
48
|
+
...tstoken,
|
|
49
|
+
tokens: tstoken.tokens.map(tokensMapping),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
else
|
|
56
|
+
return token;
|
|
57
|
+
};
|
|
58
|
+
const { gen, out } = new Parser(inputBindings, cache, Lexer(inputBindings).map(tokensMapping)).out();
|
|
59
|
+
delete binding.source_control_name;
|
|
60
|
+
if (gen)
|
|
61
|
+
result.push(...gen);
|
|
62
|
+
binding.source_property_name = out;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const { gen, out } = new Parser(inputBindings, cache).out();
|
|
66
|
+
if (gen)
|
|
67
|
+
result.push(...gen);
|
|
68
|
+
binding.source_property_name = out;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
binding.binding_type ||= BindingType.VIEW;
|
|
72
|
+
if (!binding.target_property_name)
|
|
73
|
+
throw new Error("Binding must have a target property name");
|
|
74
|
+
}
|
|
75
|
+
else if (binding.binding_collection_name) {
|
|
76
|
+
if (Object.keys(binding).length > 1)
|
|
77
|
+
binding.binding_type ||= BindingType.COLLECTION;
|
|
78
|
+
else
|
|
79
|
+
binding.binding_type ||= BindingType.COLLECTION_DETAILS;
|
|
80
|
+
}
|
|
81
|
+
result.push(binding);
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { JsonBuilder } from "../../components/builder/JsonBuilder.js";
|
|
3
|
+
export class UIDefs extends JsonBuilder {
|
|
4
|
+
static instance;
|
|
5
|
+
static getInstance() {
|
|
6
|
+
if (!UIDefs.instance)
|
|
7
|
+
UIDefs.instance = new UIDefs();
|
|
8
|
+
return UIDefs.instance;
|
|
9
|
+
}
|
|
10
|
+
set = new Set();
|
|
11
|
+
constructor() {
|
|
12
|
+
super(path.join("resoucepack", "ui", "ui_defs.json"));
|
|
13
|
+
}
|
|
14
|
+
add(filepath) {
|
|
15
|
+
this.set.add(filepath.replaceAll("\\", "/"));
|
|
16
|
+
}
|
|
17
|
+
toJSON() {
|
|
18
|
+
return {
|
|
19
|
+
_ui_defs: Array.from(this.set),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=uidefs.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InitStorage, storage } from "./initstorate.js";
|
|
2
|
+
import { UIDefs } from "./uidefs.js";
|
|
3
|
+
export function GetUIStorage(namespace, file) {
|
|
4
|
+
const $ = storage.get(file);
|
|
5
|
+
if ($) {
|
|
6
|
+
if ($.isUI) {
|
|
7
|
+
const $ui = $;
|
|
8
|
+
if ($ui.namespace === namespace)
|
|
9
|
+
return $ui;
|
|
10
|
+
else
|
|
11
|
+
throw new Error("UI already exists");
|
|
12
|
+
}
|
|
13
|
+
else
|
|
14
|
+
throw new Error(`${file} is not a UI file`);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const ui = new UIStorage(namespace, file);
|
|
18
|
+
storage.set(file, ui);
|
|
19
|
+
return ui;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
class UIStorage extends InitStorage {
|
|
23
|
+
namespace;
|
|
24
|
+
isUI = true;
|
|
25
|
+
constructor(namespace, file) {
|
|
26
|
+
super(file);
|
|
27
|
+
this.namespace = namespace;
|
|
28
|
+
UIDefs.getInstance().add(file);
|
|
29
|
+
}
|
|
30
|
+
toJSON() {
|
|
31
|
+
return {
|
|
32
|
+
namespace: this.namespace,
|
|
33
|
+
...this.get(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=uistorage.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { storage } from "../../compiler/storage.js";
|
|
3
|
+
export class Builder {
|
|
4
|
+
path;
|
|
5
|
+
constructor(filepath) {
|
|
6
|
+
this.path = path.join("build", filepath);
|
|
7
|
+
storage.set(this.path, this);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Builder.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Builder } from "./Builder.js";
|
|
2
|
+
export class JsonBuilder extends Builder {
|
|
3
|
+
file;
|
|
4
|
+
constructor(file) {
|
|
5
|
+
super(file);
|
|
6
|
+
this.file = file;
|
|
7
|
+
}
|
|
8
|
+
build() {
|
|
9
|
+
return JSON.stringify(this.toJSON());
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=JsonBuilder.js.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { AnimType } from "
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import util from "node:util";
|
|
5
|
-
export class Animation extends Class {
|
|
1
|
+
import { AnimType } from "../../types/ui/enums/AnimType.js";
|
|
2
|
+
import { AnimationKeyframe } from "./AnimationKeyframe.js";
|
|
3
|
+
export class Animation {
|
|
6
4
|
type;
|
|
7
5
|
keyframes = [];
|
|
8
6
|
loop = false;
|
|
9
7
|
smartAnimationMode = "none";
|
|
10
8
|
constructor(type, ...keyframes) {
|
|
11
|
-
super();
|
|
12
9
|
this.type = type;
|
|
13
10
|
if ([AnimType.ASEPRITE_FLIP_BOOK, AnimType.FLIP_BOOK, AnimType.WAIT].includes(type)) {
|
|
14
11
|
throw new Error(`${type} is not need for Animation constructor, please use AnimetionKeyframe instead!`);
|
|
@@ -45,7 +42,7 @@ export class Animation extends Class {
|
|
|
45
42
|
if (this.smartAnimationMode === "none") {
|
|
46
43
|
for (const $ of keyframes) {
|
|
47
44
|
const { type, properties } = this.transformKeyframe($);
|
|
48
|
-
const keyframeController = new
|
|
45
|
+
const keyframeController = new AnimationKeyframe(type, properties);
|
|
49
46
|
const prevKeyframe = this.lastKey();
|
|
50
47
|
if (prevKeyframe)
|
|
51
48
|
prevKeyframe.setNext(keyframeController);
|
|
@@ -66,7 +63,7 @@ export class Animation extends Class {
|
|
|
66
63
|
else if (to === undefined)
|
|
67
64
|
properties.to = from;
|
|
68
65
|
}
|
|
69
|
-
const keyframeController = new
|
|
66
|
+
const keyframeController = new AnimationKeyframe(type, properties);
|
|
70
67
|
const prevKeyframe = this.lastKey();
|
|
71
68
|
if (prevKeyframe)
|
|
72
69
|
prevKeyframe.setNext(keyframeController);
|
|
@@ -89,7 +86,7 @@ export class Animation extends Class {
|
|
|
89
86
|
lastTo = properties.to;
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
|
-
const keyframeController = new
|
|
89
|
+
const keyframeController = new AnimationKeyframe(type, properties);
|
|
93
90
|
const prevKeyframe = this.lastKey();
|
|
94
91
|
if (prevKeyframe)
|
|
95
92
|
prevKeyframe.setNext(keyframeController);
|
|
@@ -124,11 +121,5 @@ export class Animation extends Class {
|
|
|
124
121
|
toString() {
|
|
125
122
|
return String(this.firstKey());
|
|
126
123
|
}
|
|
127
|
-
[util.inspect.custom]($, opts) {
|
|
128
|
-
const out = this.keyframes.map((v, i) => {
|
|
129
|
-
return ` \x1b[33m${i}\x1b[0m: \x1b[33mKeyframe\x1b[0m<\x1b[92m${v.type}\x1b[0m> \x1b[92m"${v}\x1b[92m"\x1b[0m ${util.inspect(v.serialize(), opts)}`.replace(/\n/g, "\n ");
|
|
130
|
-
});
|
|
131
|
-
return `\x1b[33mAnimation\x1b[0m<\x1b[92m${this.type}\x1b[0m> \x1b[92m"${this}\x1b[92m"\x1b[0m {\n${out.join("\n")}\n}\n`;
|
|
132
|
-
}
|
|
133
124
|
}
|
|
134
125
|
//# sourceMappingURL=Animation.js.map
|