asajs 4.1.13 → 4.1.15-indev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +1 -9
  2. package/dist/js/analyzer/vanilladefs.js +291 -52
  3. package/dist/js/compilers/FormatProperties.js +4 -0
  4. package/dist/js/components/Factory.js +49 -0
  5. package/dist/js/components/UI.js +48 -21
  6. package/dist/js/components/Utils.js +7 -1
  7. package/dist/js/types/enums/ArrayName.js +1 -0
  8. package/dist/js/types/enums/Binding.js +935 -0
  9. package/dist/js/types/enums/ButtonId.js +275 -0
  10. package/dist/js/types/enums/TextureFileSystem.js +2 -0
  11. package/dist/js/types/properties/element/Dropdown.js +2 -0
  12. package/dist/js/types/properties/element/index.js +1 -1
  13. package/dist/js/types/properties/enum.js +15 -0
  14. package/dist/js/types/properties/index.js +1 -0
  15. package/dist/js/types/vanilla/paths.js +208 -207
  16. package/dist/types/components/Animation.d.ts +2 -1
  17. package/dist/types/components/AnimationKeyframe.d.ts +6 -5
  18. package/dist/types/components/Factory.d.ts +19 -0
  19. package/dist/types/components/UI.d.ts +18 -12
  20. package/dist/types/components/Utils.d.ts +4 -2
  21. package/dist/types/types/enums/ArrayName.d.ts +2 -1
  22. package/dist/types/types/enums/Binding.d.ts +936 -1
  23. package/dist/types/types/enums/ButtonId.d.ts +276 -1
  24. package/dist/types/types/enums/TextureFileSystem.d.ts +1 -0
  25. package/dist/types/types/properties/components.d.ts +1 -1
  26. package/dist/types/types/properties/element/Control.d.ts +4 -1
  27. package/dist/types/types/properties/element/Dropdown.d.ts +6 -0
  28. package/dist/types/types/properties/element/Layout.d.ts +3 -0
  29. package/dist/types/types/properties/element/ScrollView.d.ts +1 -1
  30. package/dist/types/types/properties/element/Slider.d.ts +1 -7
  31. package/dist/types/types/properties/element/Sprite.d.ts +3 -3
  32. package/dist/types/types/properties/element/index.d.ts +1 -1
  33. package/dist/types/types/properties/enum.d.ts +13 -0
  34. package/dist/types/types/properties/index.d.ts +1 -0
  35. package/dist/types/types/properties/value.d.ts +3 -2
  36. package/dist/types/types/vanilla/intellisense.d.ts +178 -27
  37. package/dist/types/types/vanilla/paths.d.ts +1 -0
  38. package/extends/binding.txt +1477 -0
  39. package/extends/button_id.txt +947 -0
  40. package/package.json +1 -1
  41. package/resources/example-config.js +5 -15
package/README.md CHANGED
@@ -18,16 +18,8 @@ Say goodbye to the tedious and repetitive nature of manual JSON editing. AsaJS s
18
18
 
19
19
  To use AsaJS, ensure you have **[Node.js](https://nodejs.org/en)** installed on your system.
20
20
 
21
- **Latest stable version:**
22
-
23
21
  ```bash
24
- npm install asajs
25
- ```
26
-
27
- **For our nightly builds:**
28
-
29
- ```
30
- npm install asajs@indev
22
+ npx create-asajs
31
23
  ```
32
24
 
33
25
  ## 📖 "Hello World!" Example
@@ -40436,6 +40436,50 @@ export const vanilladefs = {
40436
40436
  "file": "ui/hud_screen.json",
40437
40437
  "type": "stack_panel"
40438
40438
  },
40439
+ "subtitle_direction_label": {
40440
+ "file": "ui/hud_screen.json",
40441
+ "type": "label"
40442
+ },
40443
+ "subtitle_grid_item": {
40444
+ "file": "ui/hud_screen.json",
40445
+ "type": "panel",
40446
+ "children": [
40447
+ "subtitle_background"
40448
+ ]
40449
+ },
40450
+ "subtitle_grid_item/subtitle_background": {
40451
+ "file": "ui/hud_screen.json",
40452
+ "type": "image",
40453
+ "children": [
40454
+ "direction_left",
40455
+ "subtitle_text",
40456
+ "direction_right"
40457
+ ]
40458
+ },
40459
+ "subtitle_grid_item/subtitle_background/direction_left": {
40460
+ "file": "ui/hud_screen.json",
40461
+ "type": "label",
40462
+ "extend": {
40463
+ "name": "subtitle_direction_label",
40464
+ "namespace": "hud"
40465
+ }
40466
+ },
40467
+ "subtitle_grid_item/subtitle_background/subtitle_text": {
40468
+ "file": "ui/hud_screen.json",
40469
+ "type": "label",
40470
+ "extend": {
40471
+ "name": "chat_label",
40472
+ "namespace": "hud"
40473
+ }
40474
+ },
40475
+ "subtitle_grid_item/subtitle_background/direction_right": {
40476
+ "file": "ui/hud_screen.json",
40477
+ "type": "label",
40478
+ "extend": {
40479
+ "name": "subtitle_direction_label",
40480
+ "namespace": "hud"
40481
+ }
40482
+ },
40439
40483
  "subtitle_panel": {
40440
40484
  "file": "ui/hud_screen.json",
40441
40485
  "type": "panel",
@@ -51232,6 +51276,232 @@ export const vanilladefs = {
51232
51276
  }
51233
51277
  }
51234
51278
  },
51279
+ "sdl_content_navigation": {
51280
+ "content_navigation_factory": {
51281
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51282
+ "type": "stack_panel"
51283
+ },
51284
+ "inventory_nav_item_panel": {
51285
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51286
+ "type": "panel",
51287
+ "children": [
51288
+ "inventory_nav_item"
51289
+ ]
51290
+ },
51291
+ "inventory_nav_item_panel/inventory_nav_item": {
51292
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51293
+ "type": "image",
51294
+ "children": [
51295
+ "divider_stack_panel"
51296
+ ]
51297
+ },
51298
+ "inventory_nav_item_panel/inventory_nav_item/divider_stack_panel": {
51299
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51300
+ "type": "stack_panel",
51301
+ "children": [
51302
+ "top_pad",
51303
+ "nav_button",
51304
+ "divider"
51305
+ ]
51306
+ },
51307
+ "inventory_nav_item_panel/inventory_nav_item/divider_stack_panel/top_pad": {
51308
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51309
+ "type": "panel"
51310
+ },
51311
+ "inventory_nav_item_panel/inventory_nav_item/divider_stack_panel/nav_button": {
51312
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51313
+ "type": "button",
51314
+ "extend": {
51315
+ "name": "category_panel_button",
51316
+ "namespace": "sdl_content_navigation"
51317
+ }
51318
+ },
51319
+ "inventory_nav_item_panel/inventory_nav_item/divider_stack_panel/divider": {
51320
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51321
+ "type": "stack_panel",
51322
+ "extend": {
51323
+ "name": "divider_panel",
51324
+ "namespace": "sdl_content_navigation"
51325
+ }
51326
+ },
51327
+ "category_panel_button": {
51328
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51329
+ "type": "button",
51330
+ "extend": {
51331
+ "name": "button",
51332
+ "namespace": "common"
51333
+ },
51334
+ "children": [
51335
+ "default",
51336
+ "hover",
51337
+ "pressed"
51338
+ ]
51339
+ },
51340
+ "category_panel_button/default": {
51341
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51342
+ "type": "stack_panel",
51343
+ "extend": {
51344
+ "name": "category_stack_panel",
51345
+ "namespace": "sdl_content_navigation"
51346
+ }
51347
+ },
51348
+ "category_panel_button/hover": {
51349
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51350
+ "type": "stack_panel",
51351
+ "extend": {
51352
+ "name": "category_stack_panel",
51353
+ "namespace": "sdl_content_navigation"
51354
+ }
51355
+ },
51356
+ "category_panel_button/pressed": {
51357
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51358
+ "type": "stack_panel",
51359
+ "extend": {
51360
+ "name": "category_stack_panel",
51361
+ "namespace": "sdl_content_navigation"
51362
+ }
51363
+ },
51364
+ "divider_panel": {
51365
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51366
+ "type": "stack_panel",
51367
+ "children": [
51368
+ "top_pad",
51369
+ "divider"
51370
+ ]
51371
+ },
51372
+ "divider_panel/top_pad": {
51373
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51374
+ "type": "panel"
51375
+ },
51376
+ "divider_panel/divider": {
51377
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51378
+ "type": "panel",
51379
+ "extend": {
51380
+ "name": "horizontal_divider",
51381
+ "namespace": "common"
51382
+ }
51383
+ },
51384
+ "category_stack_panel": {
51385
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51386
+ "type": "stack_panel",
51387
+ "children": [
51388
+ "pad_1",
51389
+ "text",
51390
+ "fill_pad",
51391
+ "icon",
51392
+ "pad_2",
51393
+ "number"
51394
+ ]
51395
+ },
51396
+ "category_stack_panel/pad_1": {
51397
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51398
+ "type": "panel"
51399
+ },
51400
+ "category_stack_panel/text": {
51401
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51402
+ "type": "unknown"
51403
+ },
51404
+ "category_stack_panel/fill_pad": {
51405
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51406
+ "type": "panel"
51407
+ },
51408
+ "category_stack_panel/icon": {
51409
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51410
+ "type": "image"
51411
+ },
51412
+ "category_stack_panel/pad_2": {
51413
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51414
+ "type": "panel"
51415
+ },
51416
+ "category_stack_panel/number": {
51417
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51418
+ "type": "label"
51419
+ },
51420
+ "light_redirect_button_panel": {
51421
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51422
+ "type": "panel",
51423
+ "children": [
51424
+ "light_redirect_button"
51425
+ ]
51426
+ },
51427
+ "light_redirect_button_panel/light_redirect_button": {
51428
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51429
+ "type": "button",
51430
+ "extend": {
51431
+ "name": "light_content_button",
51432
+ "namespace": "common_buttons"
51433
+ }
51434
+ },
51435
+ "sdl_button_no_click_panel": {
51436
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51437
+ "type": "panel",
51438
+ "children": [
51439
+ "sdl_button_no_click"
51440
+ ]
51441
+ },
51442
+ "sdl_button_no_click_panel/sdl_button_no_click": {
51443
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51444
+ "type": "button",
51445
+ "extend": {
51446
+ "name": "light_content_button",
51447
+ "namespace": "common_buttons"
51448
+ }
51449
+ },
51450
+ "no_click_button": {
51451
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51452
+ "type": "stack_panel",
51453
+ "children": [
51454
+ "pad_1",
51455
+ "text",
51456
+ "fill_pad",
51457
+ "icon_panel",
51458
+ "pad_2"
51459
+ ]
51460
+ },
51461
+ "no_click_button/pad_1": {
51462
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51463
+ "type": "panel"
51464
+ },
51465
+ "no_click_button/text": {
51466
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51467
+ "type": "unknown"
51468
+ },
51469
+ "no_click_button/fill_pad": {
51470
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51471
+ "type": "panel"
51472
+ },
51473
+ "no_click_button/icon_panel": {
51474
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51475
+ "type": "panel",
51476
+ "children": [
51477
+ "icon"
51478
+ ]
51479
+ },
51480
+ "no_click_button/icon_panel/icon": {
51481
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51482
+ "type": "image",
51483
+ "extend": {
51484
+ "name": "arrow_down",
51485
+ "namespace": "sdl_content_navigation"
51486
+ }
51487
+ },
51488
+ "no_click_button/pad_2": {
51489
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51490
+ "type": "panel"
51491
+ },
51492
+ "arrow_down": {
51493
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51494
+ "type": "image"
51495
+ },
51496
+ "section_header_no_color_binding": {
51497
+ "file": "ui/marketplace_sdl/sdl_content_navigation.json",
51498
+ "type": "label",
51499
+ "extend": {
51500
+ "name": "store_section_header_label",
51501
+ "namespace": "common_store"
51502
+ }
51503
+ }
51504
+ },
51235
51505
  "sdl_dropdowns": {
51236
51506
  "sdl_dropdown_rows": {
51237
51507
  "file": "ui/marketplace_sdl/sdl_dropdowns.json",
@@ -99791,8 +100061,6 @@ export const vanilladefs = {
99791
100061
  "file": "ui/settings_sections/realms_world_section.json",
99792
100062
  "type": "stack_panel",
99793
100063
  "children": [
99794
- "new_edit_world_opt_in_panel",
99795
- "new_edit_world_opt_in_divider",
99796
100064
  "option_info_label",
99797
100065
  "hardcore_info_label",
99798
100066
  "realm_name_edit",
@@ -99837,50 +100105,6 @@ export const vanilladefs = {
99837
100105
  "manage_feed_button"
99838
100106
  ]
99839
100107
  },
99840
- "panel_content/new_edit_world_opt_in_panel": {
99841
- "file": "ui/settings_sections/realms_world_section.json",
99842
- "type": "stack_panel",
99843
- "children": [
99844
- "panel_title",
99845
- "panel_text",
99846
- "opt_in_button"
99847
- ]
99848
- },
99849
- "panel_content/new_edit_world_opt_in_panel/panel_title": {
99850
- "file": "ui/settings_sections/realms_world_section.json",
99851
- "type": "panel",
99852
- "extend": {
99853
- "name": "option_group_label",
99854
- "namespace": "settings_common"
99855
- }
99856
- },
99857
- "panel_content/new_edit_world_opt_in_panel/panel_text": {
99858
- "file": "ui/settings_sections/realms_world_section.json",
99859
- "type": "panel",
99860
- "extend": {
99861
- "name": "option_group_label",
99862
- "namespace": "settings_common"
99863
- }
99864
- },
99865
- "panel_content/new_edit_world_opt_in_panel/opt_in_button": {
99866
- "file": "ui/settings_sections/realms_world_section.json",
99867
- "type": "button",
99868
- "extend": {
99869
- "name": "action_button",
99870
- "namespace": "settings_common"
99871
- }
99872
- },
99873
- "panel_content/new_edit_world_opt_in_divider": {
99874
- "file": "ui/settings_sections/realms_world_section.json",
99875
- "type": "panel",
99876
- "children": [
99877
- "section_divider"
99878
- ]
99879
- },
99880
- "panel_content/new_edit_world_opt_in_divider/section_divider": {
99881
- "file": "ui/settings_sections/realms_world_section.json",
99882
- "type": "image"
99883
- },
99884
100108
  "panel_content/option_info_label": {
99885
100109
  "file": "ui/settings_sections/realms_world_section.json",
99886
100110
  "type": "panel",
@@ -118537,11 +118761,7 @@ export const vanilladefs = {
118537
118761
  },
118538
118762
  "sdl_scrolling_content_stack/store_screen_layout_factory": {
118539
118763
  "file": "ui/store_data_driven_screen.json",
118540
- "type": "stack_panel",
118541
- "extend": {
118542
- "name": "store_section_factory",
118543
- "namespace": "common_store"
118544
- }
118764
+ "type": "unknown"
118545
118765
  },
118546
118766
  "sdl_scrolling_content_stack/footer": {
118547
118767
  "file": "ui/store_data_driven_screen.json",
@@ -118700,13 +118920,32 @@ export const vanilladefs = {
118700
118920
  "type": "image"
118701
118921
  },
118702
118922
  "main_panel/main_panel_content": {
118923
+ "file": "ui/store_data_driven_screen.json",
118924
+ "type": "stack_panel",
118925
+ "children": [
118926
+ "nav_panel",
118927
+ "main_panel_because_screen_content_is_a_whiny_baby_and_cant_use_fill"
118928
+ ]
118929
+ },
118930
+ "main_panel/main_panel_content/nav_panel": {
118931
+ "file": "ui/store_data_driven_screen.json",
118932
+ "type": "panel",
118933
+ "children": [
118934
+ "sdl_screen_content"
118935
+ ]
118936
+ },
118937
+ "main_panel/main_panel_content/nav_panel/sdl_screen_content": {
118938
+ "file": "ui/store_data_driven_screen.json",
118939
+ "type": "unknown"
118940
+ },
118941
+ "main_panel/main_panel_content/main_panel_because_screen_content_is_a_whiny_baby_and_cant_use_fill": {
118703
118942
  "file": "ui/store_data_driven_screen.json",
118704
118943
  "type": "panel",
118705
118944
  "children": [
118706
118945
  "sdl_screen_content"
118707
118946
  ]
118708
118947
  },
118709
- "main_panel/main_panel_content/sdl_screen_content": {
118948
+ "main_panel/main_panel_content/main_panel_because_screen_content_is_a_whiny_baby_and_cant_use_fill/sdl_screen_content": {
118710
118949
  "file": "ui/store_data_driven_screen.json",
118711
118950
  "type": "unknown"
118712
118951
  },
@@ -32,6 +32,10 @@ export function FormatProperties(properties) {
32
32
  properties.anchor_from = properties.anchor_to = properties.anchor;
33
33
  delete properties.anchor;
34
34
  }
35
+ if (properties.fit_to_width) {
36
+ properties["$fit_to_width"] = properties.fit_to_width;
37
+ delete properties.fit_to_width;
38
+ }
35
39
  if (Object.keys(property_bag).length) {
36
40
  if (properties.property_bag) {
37
41
  properties.property_bag = { ...property_bag, ...properties.property_bag };
@@ -0,0 +1,49 @@
1
+ import { Class } from "./Class.js";
2
+ export class FactoryManager extends Class {
3
+ name;
4
+ maxChildrenSize;
5
+ factoryVariables;
6
+ controlIds;
7
+ control;
8
+ constructor(name) {
9
+ super();
10
+ this.name = name;
11
+ this.controlIds = new Map();
12
+ }
13
+ setControlId(name, element) {
14
+ if (this.control)
15
+ throw new Error("Cannot set control id after setting control");
16
+ this.controlIds.set(name, element);
17
+ return this;
18
+ }
19
+ setControlIds(...elements) {
20
+ elements.forEach(({ name, element }) => this.controlIds.set(name, element));
21
+ return this;
22
+ }
23
+ setControl(element) {
24
+ if (this.controlIds.size)
25
+ throw new Error("Cannot set control after setting control ids");
26
+ this.control = element;
27
+ return this;
28
+ }
29
+ setMaxChildrenSize(size) {
30
+ this.maxChildrenSize = size;
31
+ return this;
32
+ }
33
+ toJSON() {
34
+ const obj = { name: this.name };
35
+ if (this.maxChildrenSize)
36
+ obj.max_children_size = this.maxChildrenSize;
37
+ if (this.factoryVariables)
38
+ obj.variables = this.factoryVariables;
39
+ if (this.control)
40
+ obj.control_name = this.control.toString().slice(1);
41
+ if (this.controlIds.size) {
42
+ const controlIds = {};
43
+ this.controlIds.forEach((value, key) => (controlIds[key] = key + value.toString()));
44
+ obj.control_ids = controlIds;
45
+ }
46
+ return obj;
47
+ }
48
+ }
49
+ //# sourceMappingURL=Factory.js.map
@@ -25,17 +25,14 @@ export class UI extends Class {
25
25
  buttonMappings = [];
26
26
  anims = [];
27
27
  extendType;
28
+ factory;
28
29
  properties = {};
29
30
  bindCache = new Map();
30
31
  constructor(type, name, namespace, path, allowObfuscate) {
31
32
  super();
32
33
  this.type = type;
33
- if (name === "namespace") {
34
- console.error("The 'namespace' cannot be used as a name");
35
- process.exit(1);
36
- }
37
34
  if (isNotObfuscate || !(allowObfuscate ?? true)) {
38
- this.name = name?.match(/^(\w|\/)+/)?.[0] || RandomString(16);
35
+ this.name = name || RandomString(16);
39
36
  this.namespace = namespace || defaultNamespace || RandomNamespace();
40
37
  }
41
38
  else {
@@ -58,6 +55,10 @@ export class UI extends Class {
58
55
  this.properties = { ...this.properties, ...properties };
59
56
  return this;
60
57
  }
58
+ setFactory(factory) {
59
+ this.factory = factory;
60
+ return this;
61
+ }
61
62
  /**
62
63
  * Bind data (coming from the code) to this UI element to use.
63
64
  * @param bindings
@@ -105,6 +106,13 @@ export class UI extends Class {
105
106
  callback?.(childName, this);
106
107
  return this;
107
108
  }
109
+ addChilds(...childs) {
110
+ const childrenList = childs;
111
+ childrenList.forEach(({ child, properties, name, callback }) => {
112
+ this.addChild(child, properties, name, callback);
113
+ });
114
+ return this;
115
+ }
108
116
  addAnimations(...anims) {
109
117
  this.anims.push(...anims);
110
118
  return this;
@@ -143,6 +151,8 @@ export class UI extends Class {
143
151
  obj.variables = this.variables;
144
152
  if (this.buttonMappings.length)
145
153
  obj.button_mappings = this.buttonMappings;
154
+ if (this.factory)
155
+ obj.factory = this.factory;
146
156
  if (this.anims.length)
147
157
  obj.anims = this.anims.map(a => String(a));
148
158
  if (this.controls.size) {
@@ -161,18 +171,30 @@ export class UI extends Class {
161
171
  export class ModifyUI extends UI {
162
172
  isClearBinding = false;
163
173
  isClearVariables = false;
174
+ isClearControls = false;
175
+ isClearAnims = false;
164
176
  isClearButtonMappings = false;
165
177
  modifications = [];
166
178
  constructor(namespace, name, path) {
167
179
  super(undefined, name, namespace, path, false);
168
180
  }
169
- /**
170
- * Remove all bindings of this modify element
171
- * @returns
172
- */
173
- clearBinding() {
174
- this.isClearBinding = true;
175
- return this;
181
+ clearArray(arrayName) {
182
+ switch (arrayName) {
183
+ case ArrayName.BINDINGS:
184
+ this.isClearBinding = true;
185
+ return this;
186
+ case ArrayName.CONTROLS:
187
+ this.isClearControls = true;
188
+ return this;
189
+ case ArrayName.BUTTON_MAPPINGS:
190
+ this.isClearButtonMappings = true;
191
+ return this;
192
+ case ArrayName.ANIMS:
193
+ this.isClearAnims = true;
194
+ return this;
195
+ default:
196
+ return arrayName;
197
+ }
176
198
  }
177
199
  /**
178
200
  * Remove all variables of this modfy element
@@ -182,14 +204,6 @@ export class ModifyUI extends UI {
182
204
  this.isClearVariables = true;
183
205
  return this;
184
206
  }
185
- /**
186
- * Remove all button mappings of this element
187
- * @returns
188
- */
189
- clearButtonMappings() {
190
- this.isClearButtonMappings = true;
191
- return this;
192
- }
193
207
  /**
194
208
  * Allows to modify the UI elements from resource packs below this one
195
209
  * @returns
@@ -338,12 +352,25 @@ export class ModifyUI extends UI {
338
352
  const obj = this.toJsonUI();
339
353
  if (this.isClearBinding)
340
354
  obj.bindings = [];
355
+ if (this.isClearControls)
356
+ obj.controls = [];
357
+ if (this.isClearAnims)
358
+ obj.anims = [];
341
359
  if (this.isClearVariables)
342
360
  obj.variables = [];
343
361
  if (this.isClearButtonMappings)
344
362
  obj.button_mappings = [];
345
- if (this.modifications.length)
363
+ if (this.modifications.length) {
364
+ // const map = new Map<ArrayName, Map<string, unknown>>()
365
+ // this.modifications.forEach(mod => {
366
+ // const { operation, array_name, control_name, target, target_control, value, where } = mod
367
+ // switch (array_name) {
368
+ // case ArrayName.CONTROLS: {
369
+ // }
370
+ // }
371
+ // })
346
372
  obj.modifications = this.modifications;
373
+ }
347
374
  return obj;
348
375
  }
349
376
  toJSON() {
@@ -12,6 +12,7 @@ import { MemoryModify } from "../compilers/Memory.js";
12
12
  import { Lexer } from "../compilers/bindings/Lexer.js";
13
13
  import { TokenKind, TSTokenKind } from "../compilers/bindings/types.js";
14
14
  import { allowRandomStringName, forceRandomStringLength, isNotObfuscate, namespaceCount, } from "../compilers/Configuration.js";
15
+ import { FactoryManager } from "./Factory.js";
15
16
  export function Color(hex) {
16
17
  if (typeof hex === "number") {
17
18
  return [((hex >> 16) & 0xff) / 0xff, ((hex >> 8) & 0xff) / 0xff, (hex & 0xff) / 0xff];
@@ -119,6 +120,8 @@ export function ResolveBinding(cache, ...bindings) {
119
120
  }
120
121
  export let defaultNamespace = null;
121
122
  export function SetDefaultNamespace(input) {
123
+ if (!/\p{L}+/u.test(input))
124
+ throw new Error("Invalid namespace");
122
125
  defaultNamespace = input;
123
126
  }
124
127
  export function ClearDefaultNamespace() {
@@ -181,7 +184,7 @@ export function s(input) {
181
184
  if (rndMap.has(input))
182
185
  return rndMap.get(input);
183
186
  else {
184
- const ret = RandomBindingString();
187
+ const ret = RandomString(16);
185
188
  rndMap.set(input, ret);
186
189
  return ret;
187
190
  }
@@ -269,6 +272,9 @@ export function Modify(namespace, name) {
269
272
  (MemoryModify[getPath] ||= {})[name] = modifyUI;
270
273
  return modifyUI;
271
274
  }
275
+ export function Factory(name) {
276
+ return new FactoryManager(name);
277
+ }
272
278
  export function Panel(properties, namespace, name, allowObfuscate) {
273
279
  return new UI(Type.PANEL, name, namespace, undefined, allowObfuscate).setProperties(properties || {});
274
280
  }
@@ -3,5 +3,6 @@ export var ArrayName;
3
3
  ArrayName["CONTROLS"] = "controls";
4
4
  ArrayName["BINDINGS"] = "bindings";
5
5
  ArrayName["BUTTON_MAPPINGS"] = "button_mappings";
6
+ ArrayName["ANIMS"] = "anims";
6
7
  })(ArrayName || (ArrayName = {}));
7
8
  //# sourceMappingURL=ArrayName.js.map