asajs 4.1.15 → 4.2.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/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
  },
@@ -31,12 +31,8 @@ export class UI extends Class {
31
31
  constructor(type, name, namespace, path, allowObfuscate) {
32
32
  super();
33
33
  this.type = type;
34
- if (name === "namespace") {
35
- console.error("The 'namespace' cannot be used as a name");
36
- process.exit(1);
37
- }
38
34
  if (isNotObfuscate || !(allowObfuscate ?? true)) {
39
- this.name = name?.match(/^(\w|\/)+/)?.[0] || RandomString(16);
35
+ this.name = name || RandomString(16);
40
36
  this.namespace = namespace || defaultNamespace || RandomNamespace();
41
37
  }
42
38
  else {
@@ -175,18 +171,30 @@ export class UI extends Class {
175
171
  export class ModifyUI extends UI {
176
172
  isClearBinding = false;
177
173
  isClearVariables = false;
174
+ isClearControls = false;
175
+ isClearAnims = false;
178
176
  isClearButtonMappings = false;
179
177
  modifications = [];
180
178
  constructor(namespace, name, path) {
181
179
  super(undefined, name, namespace, path, false);
182
180
  }
183
- /**
184
- * Remove all bindings of this modify element
185
- * @returns
186
- */
187
- clearBinding() {
188
- this.isClearBinding = true;
189
- 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
+ }
190
198
  }
191
199
  /**
192
200
  * Remove all variables of this modfy element
@@ -196,14 +204,6 @@ export class ModifyUI extends UI {
196
204
  this.isClearVariables = true;
197
205
  return this;
198
206
  }
199
- /**
200
- * Remove all button mappings of this element
201
- * @returns
202
- */
203
- clearButtonMappings() {
204
- this.isClearButtonMappings = true;
205
- return this;
206
- }
207
207
  /**
208
208
  * Allows to modify the UI elements from resource packs below this one
209
209
  * @returns
@@ -352,12 +352,25 @@ export class ModifyUI extends UI {
352
352
  const obj = this.toJsonUI();
353
353
  if (this.isClearBinding)
354
354
  obj.bindings = [];
355
+ if (this.isClearControls)
356
+ obj.controls = [];
357
+ if (this.isClearAnims)
358
+ obj.anims = [];
355
359
  if (this.isClearVariables)
356
360
  obj.variables = [];
357
361
  if (this.isClearButtonMappings)
358
362
  obj.button_mappings = [];
359
- 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
+ // })
360
372
  obj.modifications = this.modifications;
373
+ }
361
374
  return obj;
362
375
  }
363
376
  toJSON() {
@@ -120,6 +120,8 @@ export function ResolveBinding(cache, ...bindings) {
120
120
  }
121
121
  export let defaultNamespace = null;
122
122
  export function SetDefaultNamespace(input) {
123
+ if (!/\p{L}+/u.test(input))
124
+ throw new Error("Invalid namespace");
123
125
  defaultNamespace = input;
124
126
  }
125
127
  export function ClearDefaultNamespace() {
@@ -182,7 +184,7 @@ export function s(input) {
182
184
  if (rndMap.has(input))
183
185
  return rndMap.get(input);
184
186
  else {
185
- const ret = RandomBindingString();
187
+ const ret = RandomString(16);
186
188
  rndMap.set(input, ret);
187
189
  return ret;
188
190
  }
@@ -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