asajs 3.0.7 → 3.0.10

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 (290) hide show
  1. package/debug.log +2 -0
  2. package/dist/cjs/compilers/BindingCompiler.js +1 -0
  3. package/dist/cjs/compilers/BindingCompiler.js.map +7 -0
  4. package/dist/cjs/compilers/BindingFunctions.js +1 -0
  5. package/dist/cjs/compilers/BindingFunctions.js.map +7 -0
  6. package/dist/cjs/compilers/Compiler.js +1 -0
  7. package/dist/cjs/compilers/Compiler.js.map +7 -0
  8. package/dist/cjs/compilers/Compress.js +1 -0
  9. package/dist/cjs/compilers/Compress.js.map +7 -0
  10. package/dist/cjs/compilers/Config.js +2 -0
  11. package/dist/cjs/compilers/Config.js.map +7 -0
  12. package/dist/cjs/compilers/Encoder.js +1 -0
  13. package/dist/cjs/compilers/Encoder.js.map +7 -0
  14. package/dist/cjs/compilers/Installer.js +1 -0
  15. package/dist/cjs/compilers/Installer.js.map +7 -0
  16. package/dist/cjs/compilers/PreCompile.js +1 -0
  17. package/dist/cjs/compilers/PreCompile.js.map +7 -0
  18. package/dist/cjs/compilers/generator/GenerateDir.js +1 -0
  19. package/dist/cjs/compilers/generator/GenerateDir.js.map +7 -0
  20. package/dist/cjs/compilers/generator/JsonBuilder.js +1 -0
  21. package/dist/cjs/compilers/generator/JsonBuilder.js.map +7 -0
  22. package/dist/cjs/compilers/generator/LangBuilder.js +1 -0
  23. package/dist/cjs/compilers/generator/LangBuilder.js.map +7 -0
  24. package/dist/cjs/compilers/generator/Log.js +1 -0
  25. package/dist/cjs/compilers/generator/Log.js.map +7 -0
  26. package/dist/cjs/compilers/generator/Manifest.js +1 -0
  27. package/dist/cjs/compilers/generator/Manifest.js.map +7 -0
  28. package/dist/cjs/compilers/generator/Save.js +1 -0
  29. package/dist/cjs/compilers/generator/Save.js.map +7 -0
  30. package/dist/cjs/compilers/generator/SearchFiles.js +1 -0
  31. package/dist/cjs/compilers/generator/SearchFiles.js.map +7 -0
  32. package/dist/cjs/compilers/generator/Sounds.js +1 -0
  33. package/dist/cjs/compilers/generator/Sounds.js.map +7 -0
  34. package/dist/cjs/compilers/generator/Template.js +1 -0
  35. package/dist/cjs/compilers/generator/Template.js.map +7 -0
  36. package/dist/cjs/compilers/generator/UIBuilder.js +16 -5
  37. package/dist/cjs/compilers/generator/UIBuilder.js.map +7 -0
  38. package/dist/cjs/compilers/reader/Audio.js +1 -0
  39. package/dist/cjs/compilers/reader/Audio.js.map +7 -0
  40. package/dist/cjs/compilers/reader/Color.js +1 -0
  41. package/dist/cjs/compilers/reader/Color.js.map +7 -0
  42. package/dist/cjs/compilers/reader/CurrentLine.js +1 -0
  43. package/dist/cjs/compilers/reader/CurrentLine.js.map +7 -0
  44. package/dist/cjs/compilers/reader/Env.js +1 -0
  45. package/dist/cjs/compilers/reader/Env.js.map +7 -0
  46. package/dist/cjs/compilers/reader/GlobalVariables.js +1 -0
  47. package/dist/cjs/compilers/reader/GlobalVariables.js.map +7 -0
  48. package/dist/cjs/compilers/reader/Object.js +1 -0
  49. package/dist/cjs/compilers/reader/Object.js.map +7 -0
  50. package/dist/cjs/compilers/reader/ReadBinding.js +1 -0
  51. package/dist/cjs/compilers/reader/ReadBinding.js.map +7 -0
  52. package/dist/cjs/compilers/reader/ReadProperties.js +1 -0
  53. package/dist/cjs/compilers/reader/ReadProperties.js.map +7 -0
  54. package/dist/cjs/components/AddCollectionChill.js +1 -0
  55. package/dist/cjs/components/AddCollectionChill.js.map +7 -0
  56. package/dist/cjs/components/Animation.js +1 -0
  57. package/dist/cjs/components/Animation.js.map +7 -0
  58. package/dist/cjs/components/AnimationKeyFrame.js +1 -0
  59. package/dist/cjs/components/AnimationKeyFrame.js.map +7 -0
  60. package/dist/cjs/components/Class.js +1 -0
  61. package/dist/cjs/components/Class.js.map +7 -0
  62. package/dist/cjs/components/LocalizeText.js +1 -0
  63. package/dist/cjs/components/LocalizeText.js.map +7 -0
  64. package/dist/cjs/components/Modify.js +9 -2
  65. package/dist/cjs/components/Modify.js.map +7 -0
  66. package/dist/cjs/components/Random.js +1 -0
  67. package/dist/cjs/components/Random.js.map +7 -0
  68. package/dist/cjs/components/UI.js +29 -7
  69. package/dist/cjs/components/UI.js.map +7 -0
  70. package/dist/cjs/components/Vanilla.js +1 -0
  71. package/dist/cjs/components/Vanilla.js.map +7 -0
  72. package/dist/cjs/index.js +1 -0
  73. package/dist/cjs/index.js.map +7 -0
  74. package/dist/cjs/template.js +2 -1
  75. package/dist/cjs/template.js.map +7 -0
  76. package/dist/cjs/types/components/ChildIdentifier.js +1 -0
  77. package/dist/cjs/types/components/ChildIdentifier.js.map +7 -0
  78. package/dist/cjs/types/components/Identifier.js +1 -0
  79. package/dist/cjs/types/components/Identifier.js.map +7 -0
  80. package/dist/cjs/types/components/NameCallback.js +1 -0
  81. package/dist/cjs/types/components/NameCallback.js.map +7 -0
  82. package/dist/cjs/types/components/UIIdentifier.js +1 -0
  83. package/dist/cjs/types/components/UIIdentifier.js.map +7 -0
  84. package/dist/cjs/types/components/UIInterface.js +1 -0
  85. package/dist/cjs/types/components/UIInterface.js.map +7 -0
  86. package/dist/cjs/types/enums/Anchor.js +1 -0
  87. package/dist/cjs/types/enums/Anchor.js.map +7 -0
  88. package/dist/cjs/types/enums/AnimTypes.js +1 -0
  89. package/dist/cjs/types/enums/AnimTypes.js.map +7 -0
  90. package/dist/cjs/types/enums/BindingCondition.js +1 -0
  91. package/dist/cjs/types/enums/BindingCondition.js.map +7 -0
  92. package/dist/cjs/types/enums/BindingName.js +1 -0
  93. package/dist/cjs/types/enums/BindingName.js.map +7 -0
  94. package/dist/cjs/types/enums/BindingType.js +1 -0
  95. package/dist/cjs/types/enums/BindingType.js.map +7 -0
  96. package/dist/cjs/types/enums/ClipDirecion.js +1 -0
  97. package/dist/cjs/types/enums/ClipDirecion.js.map +7 -0
  98. package/dist/cjs/types/enums/Collection.js +1 -0
  99. package/dist/cjs/types/enums/Collection.js.map +7 -0
  100. package/dist/cjs/types/enums/Direction.js +1 -0
  101. package/dist/cjs/types/enums/Direction.js.map +7 -0
  102. package/dist/cjs/types/enums/EasingTypes.js +1 -0
  103. package/dist/cjs/types/enums/EasingTypes.js.map +7 -0
  104. package/dist/cjs/types/enums/EnumColor.js +1 -0
  105. package/dist/cjs/types/enums/EnumColor.js.map +7 -0
  106. package/dist/cjs/types/enums/FocusNavigationMode.js +1 -0
  107. package/dist/cjs/types/enums/FocusNavigationMode.js.map +7 -0
  108. package/dist/cjs/types/enums/FontSize.js +1 -0
  109. package/dist/cjs/types/enums/FontSize.js.map +7 -0
  110. package/dist/cjs/types/enums/FontType.js +1 -0
  111. package/dist/cjs/types/enums/FontType.js.map +7 -0
  112. package/dist/cjs/types/enums/GlobalVariables.js +1 -0
  113. package/dist/cjs/types/enums/GlobalVariables.js.map +7 -0
  114. package/dist/cjs/types/enums/InputModeCondition.js +1 -0
  115. package/dist/cjs/types/enums/InputModeCondition.js.map +7 -0
  116. package/dist/cjs/types/enums/ItemAuxID.js +1 -0
  117. package/dist/cjs/types/enums/ItemAuxID.js.map +7 -0
  118. package/dist/cjs/types/enums/JsonUIArrayName.js +1 -0
  119. package/dist/cjs/types/enums/JsonUIArrayName.js.map +7 -0
  120. package/dist/cjs/types/enums/MappingFrom.js +1 -0
  121. package/dist/cjs/types/enums/MappingFrom.js.map +7 -0
  122. package/dist/cjs/types/enums/MappingTo.js +1 -0
  123. package/dist/cjs/types/enums/MappingTo.js.map +7 -0
  124. package/dist/cjs/types/enums/MappingTypes.js +1 -0
  125. package/dist/cjs/types/enums/MappingTypes.js.map +7 -0
  126. package/dist/cjs/types/enums/Orientation.js +1 -0
  127. package/dist/cjs/types/enums/Orientation.js.map +7 -0
  128. package/dist/cjs/types/enums/Renderer.js +1 -0
  129. package/dist/cjs/types/enums/Renderer.js.map +7 -0
  130. package/dist/cjs/types/enums/Rotation.js +1 -0
  131. package/dist/cjs/types/enums/Rotation.js.map +7 -0
  132. package/dist/cjs/types/enums/Scope.js +1 -0
  133. package/dist/cjs/types/enums/Scope.js.map +7 -0
  134. package/dist/cjs/types/enums/TextTypes.js +1 -0
  135. package/dist/cjs/types/enums/TextTypes.js.map +7 -0
  136. package/dist/cjs/types/enums/TextureFileSystem.js +1 -0
  137. package/dist/cjs/types/enums/TextureFileSystem.js.map +7 -0
  138. package/dist/cjs/types/enums/Types.js +1 -0
  139. package/dist/cjs/types/enums/Types.js.map +7 -0
  140. package/dist/cjs/types/objects/Animation.js +1 -0
  141. package/dist/cjs/types/objects/Animation.js.map +7 -0
  142. package/dist/cjs/types/objects/BindingHook.js +1 -0
  143. package/dist/cjs/types/objects/BindingHook.js.map +7 -0
  144. package/dist/cjs/types/objects/BindingInterface.js +1 -0
  145. package/dist/cjs/types/objects/BindingInterface.js.map +7 -0
  146. package/dist/cjs/types/objects/ButtonMapping.js +1 -0
  147. package/dist/cjs/types/objects/ButtonMapping.js.map +7 -0
  148. package/dist/cjs/types/objects/Factory.js +1 -0
  149. package/dist/cjs/types/objects/Factory.js.map +7 -0
  150. package/dist/cjs/types/objects/Installer.js +1 -0
  151. package/dist/cjs/types/objects/Installer.js.map +7 -0
  152. package/dist/cjs/types/objects/Manifest.js +1 -0
  153. package/dist/cjs/types/objects/Manifest.js.map +7 -0
  154. package/dist/cjs/types/objects/Modify.js +1 -0
  155. package/dist/cjs/types/objects/Modify.js.map +7 -0
  156. package/dist/cjs/types/objects/PropertyBag.js +1 -0
  157. package/dist/cjs/types/objects/PropertyBag.js.map +7 -0
  158. package/dist/cjs/types/objects/Sound.js +1 -0
  159. package/dist/cjs/types/objects/Sound.js.map +7 -0
  160. package/dist/cjs/types/objects/Variables.js +1 -0
  161. package/dist/cjs/types/objects/Variables.js.map +7 -0
  162. package/dist/cjs/types/objects/elements/Button.js +1 -0
  163. package/dist/cjs/types/objects/elements/Button.js.map +7 -0
  164. package/dist/cjs/types/objects/elements/CollectionPanel.js +1 -0
  165. package/dist/cjs/types/objects/elements/CollectionPanel.js.map +7 -0
  166. package/dist/cjs/types/objects/elements/Custom.js +1 -0
  167. package/dist/cjs/types/objects/elements/Custom.js.map +7 -0
  168. package/dist/cjs/types/objects/elements/Dropdown.js +1 -0
  169. package/dist/cjs/types/objects/elements/Dropdown.js.map +7 -0
  170. package/dist/cjs/types/objects/elements/EditBox.js +1 -0
  171. package/dist/cjs/types/objects/elements/EditBox.js.map +7 -0
  172. package/dist/cjs/types/objects/elements/Grid.js +1 -0
  173. package/dist/cjs/types/objects/elements/Grid.js.map +7 -0
  174. package/dist/cjs/types/objects/elements/Image.js +1 -0
  175. package/dist/cjs/types/objects/elements/Image.js.map +7 -0
  176. package/dist/cjs/types/objects/elements/InputPanel.js +1 -0
  177. package/dist/cjs/types/objects/elements/InputPanel.js.map +7 -0
  178. package/dist/cjs/types/objects/elements/Label.js +1 -0
  179. package/dist/cjs/types/objects/elements/Label.js.map +7 -0
  180. package/dist/cjs/types/objects/elements/PropertiesType.js +1 -0
  181. package/dist/cjs/types/objects/elements/PropertiesType.js.map +7 -0
  182. package/dist/cjs/types/objects/elements/Screen.js +1 -0
  183. package/dist/cjs/types/objects/elements/Screen.js.map +7 -0
  184. package/dist/cjs/types/objects/elements/ScrollView.js +1 -0
  185. package/dist/cjs/types/objects/elements/ScrollView.js.map +7 -0
  186. package/dist/cjs/types/objects/elements/ScrollbarBox.js +1 -0
  187. package/dist/cjs/types/objects/elements/ScrollbarBox.js.map +7 -0
  188. package/dist/cjs/types/objects/elements/ScrollbarTrack.js +1 -0
  189. package/dist/cjs/types/objects/elements/ScrollbarTrack.js.map +7 -0
  190. package/dist/cjs/types/objects/elements/SelectionWheel.js +1 -0
  191. package/dist/cjs/types/objects/elements/SelectionWheel.js.map +7 -0
  192. package/dist/cjs/types/objects/elements/Slider.js +1 -0
  193. package/dist/cjs/types/objects/elements/Slider.js.map +7 -0
  194. package/dist/cjs/types/objects/elements/SliderBox.js +1 -0
  195. package/dist/cjs/types/objects/elements/SliderBox.js.map +7 -0
  196. package/dist/cjs/types/objects/elements/StackPanel.js +1 -0
  197. package/dist/cjs/types/objects/elements/StackPanel.js.map +7 -0
  198. package/dist/cjs/types/objects/elements/Toggle.js +1 -0
  199. package/dist/cjs/types/objects/elements/Toggle.js.map +7 -0
  200. package/dist/cjs/types/objects/elements/TooltipTrigger.js +1 -0
  201. package/dist/cjs/types/objects/elements/TooltipTrigger.js.map +7 -0
  202. package/dist/cjs/types/objects/elements/panel.js +1 -0
  203. package/dist/cjs/types/objects/elements/panel.js.map +7 -0
  204. package/dist/cjs/types/objects/properties/Buttons.js +1 -0
  205. package/dist/cjs/types/objects/properties/Buttons.js.map +7 -0
  206. package/dist/cjs/types/objects/properties/CollectionIndexs.js +1 -0
  207. package/dist/cjs/types/objects/properties/CollectionIndexs.js.map +7 -0
  208. package/dist/cjs/types/objects/properties/Collections.js +1 -0
  209. package/dist/cjs/types/objects/properties/Collections.js.map +7 -0
  210. package/dist/cjs/types/objects/properties/Controls.js +1 -0
  211. package/dist/cjs/types/objects/properties/Controls.js.map +7 -0
  212. package/dist/cjs/types/objects/properties/Dropdowns.js +1 -0
  213. package/dist/cjs/types/objects/properties/Dropdowns.js.map +7 -0
  214. package/dist/cjs/types/objects/properties/Focus.js +1 -0
  215. package/dist/cjs/types/objects/properties/Focus.js.map +7 -0
  216. package/dist/cjs/types/objects/properties/FocusContainerCustom.js +1 -0
  217. package/dist/cjs/types/objects/properties/FocusContainerCustom.js.map +7 -0
  218. package/dist/cjs/types/objects/properties/Grids.js +1 -0
  219. package/dist/cjs/types/objects/properties/Grids.js.map +7 -0
  220. package/dist/cjs/types/objects/properties/Inputs.js +1 -0
  221. package/dist/cjs/types/objects/properties/Inputs.js.map +7 -0
  222. package/dist/cjs/types/objects/properties/Layouts.js +1 -0
  223. package/dist/cjs/types/objects/properties/Layouts.js.map +7 -0
  224. package/dist/cjs/types/objects/properties/Properties.js +1 -0
  225. package/dist/cjs/types/objects/properties/Properties.js.map +7 -0
  226. package/dist/cjs/types/objects/properties/Renderers.js +1 -0
  227. package/dist/cjs/types/objects/properties/Renderers.js.map +7 -0
  228. package/dist/cjs/types/objects/properties/Screens.js +1 -0
  229. package/dist/cjs/types/objects/properties/Screens.js.map +7 -0
  230. package/dist/cjs/types/objects/properties/ScrollViews.js +1 -0
  231. package/dist/cjs/types/objects/properties/ScrollViews.js.map +7 -0
  232. package/dist/cjs/types/objects/properties/SelectionWheels.js +1 -0
  233. package/dist/cjs/types/objects/properties/SelectionWheels.js.map +7 -0
  234. package/dist/cjs/types/objects/properties/SliderBoxs.js +1 -0
  235. package/dist/cjs/types/objects/properties/SliderBoxs.js.map +7 -0
  236. package/dist/cjs/types/objects/properties/Sliders.js +1 -0
  237. package/dist/cjs/types/objects/properties/Sliders.js.map +7 -0
  238. package/dist/cjs/types/objects/properties/Sounds.js +1 -0
  239. package/dist/cjs/types/objects/properties/Sounds.js.map +7 -0
  240. package/dist/cjs/types/objects/properties/Specials.js +1 -0
  241. package/dist/cjs/types/objects/properties/Specials.js.map +7 -0
  242. package/dist/cjs/types/objects/properties/Sprites.js +1 -0
  243. package/dist/cjs/types/objects/properties/Sprites.js.map +7 -0
  244. package/dist/cjs/types/objects/properties/StackPanels.js +1 -0
  245. package/dist/cjs/types/objects/properties/StackPanels.js.map +7 -0
  246. package/dist/cjs/types/objects/properties/TTS.js +1 -0
  247. package/dist/cjs/types/objects/properties/TTS.js.map +7 -0
  248. package/dist/cjs/types/objects/properties/TextEdits.js +1 -0
  249. package/dist/cjs/types/objects/properties/TextEdits.js.map +7 -0
  250. package/dist/cjs/types/objects/properties/Texts.js +1 -0
  251. package/dist/cjs/types/objects/properties/Texts.js.map +7 -0
  252. package/dist/cjs/types/objects/properties/Toggles.js +1 -0
  253. package/dist/cjs/types/objects/properties/Toggles.js.map +7 -0
  254. package/dist/cjs/types/objects/properties/TooltipTriggers.js +1 -0
  255. package/dist/cjs/types/objects/properties/TooltipTriggers.js.map +7 -0
  256. package/dist/cjs/types/objects/properties/Variables.js +1 -0
  257. package/dist/cjs/types/objects/properties/Variables.js.map +7 -0
  258. package/dist/cjs/types/values/Any.js +1 -0
  259. package/dist/cjs/types/values/Any.js.map +7 -0
  260. package/dist/cjs/types/values/Binding.js +1 -0
  261. package/dist/cjs/types/values/Binding.js.map +7 -0
  262. package/dist/cjs/types/values/Bool.js +1 -0
  263. package/dist/cjs/types/values/Bool.js.map +7 -0
  264. package/dist/cjs/types/values/ColorVector.js +1 -0
  265. package/dist/cjs/types/values/ColorVector.js.map +7 -0
  266. package/dist/cjs/types/values/ElementPath.js +1 -0
  267. package/dist/cjs/types/values/ElementPath.js.map +7 -0
  268. package/dist/cjs/types/values/Hex.js +1 -0
  269. package/dist/cjs/types/values/Hex.js.map +7 -0
  270. package/dist/cjs/types/values/Number.js +1 -0
  271. package/dist/cjs/types/values/Number.js.map +7 -0
  272. package/dist/cjs/types/values/RangeVector.js +1 -0
  273. package/dist/cjs/types/values/RangeVector.js.map +7 -0
  274. package/dist/cjs/types/values/Str.js +1 -0
  275. package/dist/cjs/types/values/Str.js.map +7 -0
  276. package/dist/cjs/types/values/StringVector.js +1 -0
  277. package/dist/cjs/types/values/StringVector.js.map +7 -0
  278. package/dist/cjs/types/values/TargetElementPath.js +1 -0
  279. package/dist/cjs/types/values/TargetElementPath.js.map +7 -0
  280. package/dist/cjs/types/values/Variable.js +1 -0
  281. package/dist/cjs/types/values/Variable.js.map +7 -0
  282. package/dist/cjs/types/values/Vector.js +1 -0
  283. package/dist/cjs/types/values/Vector.js.map +7 -0
  284. package/dist/esm/index.js +319 -282
  285. package/dist/esm/index.js.map +7 -0
  286. package/dist/types/compilers/Config.d.ts +1 -0
  287. package/dist/types/components/UI.d.ts +2 -0
  288. package/dist/types/components/Vanilla.d.ts +4 -4
  289. package/dist/types/template.d.ts +1 -1
  290. package/package.json +2 -2
package/dist/esm/index.js CHANGED
@@ -3053,7 +3053,7 @@ var Obj = class extends Class {
3053
3053
  // src/template.ts
3054
3054
  var env = "const env = {};\n\nmodule.exports = { env };";
3055
3055
  var globalVariables = 'const {} = require("asajs");\n\nconst global_variables = {};\n\nmodule.exports = { global_variables };';
3056
- var config = '/**\n * Configuration object for the AsaJS build process.\n * @type {import(\'asajs\').Config}\n */\nconst config = {\n compiler: {\n autoCompress: false,\n fileExtension: "json",\n encodeJson: false,\n UI: {\n nameLength: 32,\n namespaceAmount: 16,\n namespaceLength: 32,\n obfuscateName: false,\n obfuscateType: false,\n },\n },\n installer: {\n autoInstall: true,\n developEvironment: true,\n previewVersion: false,\n customPath: false,\n installPath: "/your/minecraft/data/path",\n },\n manifest: {\n name: "AsaJS",\n description: "Build with AsaJS <3",\n },\n};\n\nmodule.exports = { config }';
3056
+ var config = '/**\n * Configuration object for the AsaJS build process.\n * @type {import(\'asajs\').Config}\n */\nconst config = {\n compiler: {\n autoCompress: false,\n fileExtension: "json",\n encodeJson: false,\n UI: {\n nameLength: 32,\n namespaceAmount: 16,\n namespaceLength: 32,\n optimizeControls: true,\n obfuscateName: false,\n obfuscateType: false,\n },\n },\n installer: {\n autoInstall: true,\n developEvironment: true,\n previewVersion: false,\n customPath: false,\n installPath: "/your/minecraft/data/path",\n },\n manifest: {\n name: "AsaJS",\n description: "Build with AsaJS <3",\n },\n};\n\nmodule.exports = { config }';
3057
3057
  var gitignore = "# Node packages\nnode_modules\n\n# Build Folders\n.minecraft\n.build\n.save\n\n# Build variables\nasakiyuki.env.cjs\n\n# Compress package\nMinecraft-UIBuild.mcpack";
3058
3058
 
3059
3059
  // src/compilers/generator/GenerateDir.ts
@@ -3100,6 +3100,7 @@ var defaultConfig = {
3100
3100
  nameLength: 32,
3101
3101
  namespaceAmount: 16,
3102
3102
  namespaceLength: 32,
3103
+ optimizeControls: true,
3103
3104
  obfuscateName: false,
3104
3105
  obfuscateType: false
3105
3106
  }
@@ -3993,8 +3994,8 @@ var Manifest = class {
3993
3994
  };
3994
3995
 
3995
3996
  // src/compilers/generator/UIBuilder.ts
3996
- var import_jsonc_parser = __toESM(require_main());
3997
- import fs6 from "fs";
3997
+ var import_jsonc_parser2 = __toESM(require_main());
3998
+ import fs7 from "fs";
3998
3999
 
3999
4000
  // src/compilers/generator/JsonBuilder.ts
4000
4001
  var JsonBuilder = class extends Class {
@@ -4065,254 +4066,6 @@ var SearchFiles = class _SearchFiles extends Class {
4065
4066
  }
4066
4067
  };
4067
4068
 
4068
- // src/compilers/generator/UIBuilder.ts
4069
- var UIBuilder = class {
4070
- static delete(installPath) {
4071
- try {
4072
- fs6.unlinkSync(installPath);
4073
- } catch (error) {
4074
- if (fs6.existsSync(installPath)) fs6.rmSync(installPath, { recursive: true });
4075
- }
4076
- }
4077
- static jsonUI(installPath) {
4078
- const build = JsonBuilder.save.build;
4079
- let count = 0;
4080
- for (const file in build) {
4081
- const namespace = build[file].namespace;
4082
- delete build[file].namespace;
4083
- for (const jsonUI in build[file]) build[file][jsonUI] = build[file][jsonUI].getUI();
4084
- console.timeLog(
4085
- "COMPILER",
4086
- "".concat(file, " ").concat(Object.keys(build[file]).length, " elements has generated!")
4087
- );
4088
- build[file].namespace = namespace;
4089
- UIWriteJson("".concat(installPath, "/@/").concat(file), build[file], "utf-8");
4090
- delete build[file];
4091
- count++;
4092
- }
4093
- return count;
4094
- }
4095
- static modify(installPath) {
4096
- if (!fs6.existsSync("".concat(installPath, "/ui"))) fs6.mkdirSync("".concat(installPath, "/ui"));
4097
- let count = 0;
4098
- const modify = JsonBuilder.save.modify;
4099
- for (const key in modify) {
4100
- GenerateDir(installPath, key);
4101
- for (const element in modify[key]) modify[key][element] = modify[key][element].getUI();
4102
- console.timeLog(
4103
- "COMPILER",
4104
- "".concat(key, " ").concat(Object.keys(modify[key]).length, " modify element(s) has generated!")
4105
- );
4106
- UIWriteJson("".concat(installPath, "/").concat(key), modify[key], "utf-8");
4107
- delete modify[key];
4108
- count++;
4109
- }
4110
- return count;
4111
- }
4112
- static uiDefs(installPath) {
4113
- const arr = SearchFiles.array("".concat(installPath, "/@"), "@");
4114
- UIWriteJson("".concat(installPath, "/ui/_ui_defs.json"), { ui_defs: arr }, "utf-8");
4115
- return arr.length;
4116
- }
4117
- static contents(installPath) {
4118
- const arr = SearchFiles.array(installPath);
4119
- UIWriteJson(
4120
- "".concat(installPath, "/contents.json"),
4121
- {
4122
- content: arr.map((v) => ({ path: v }))
4123
- },
4124
- "utf-8"
4125
- );
4126
- return arr.length;
4127
- }
4128
- static texturesList(installPath) {
4129
- const arr = SearchFiles.array(installPath).filter((v) => /\.(png|jpg|jpeg)$/.test(v)).map((v) => v.replace(/\.(png|jpg|jpeg)$/, ""));
4130
- let textureList = [];
4131
- if (fs6.existsSync(".bedrock/textures/textures_list.json")) {
4132
- const texturesList = fs6.readFileSync(".bedrock/textures/textures_list.json", "utf-8");
4133
- textureList = (0, import_jsonc_parser.parse)(texturesList);
4134
- }
4135
- if (!fs6.existsSync("".concat(installPath, "/textures"))) fs6.mkdirSync("".concat(installPath, "/textures"));
4136
- UIWriteJson(
4137
- "".concat(installPath, "/textures/textures_list.json"),
4138
- [...arr, ...textureList],
4139
- "utf-8"
4140
- );
4141
- return arr.length;
4142
- }
4143
- static globalVariables(installPath) {
4144
- const globalVariables2 = JsonBuilder.save.globalVariables;
4145
- UIWriteJson("".concat(installPath, "/ui/_global_variables.json"), globalVariables2, "utf-8");
4146
- return Object.keys(globalVariables2).length;
4147
- }
4148
- };
4149
-
4150
- // src/compilers/Compress.ts
4151
- var import_adm_zip = __toESM(require_adm_zip());
4152
- import fs7 from "fs";
4153
- function CompressPack(buildPath) {
4154
- if (fs7.existsSync("Minecraft-UIBuild.mcpack"))
4155
- fs7.rmSync("Minecraft-UIBuild.mcpack");
4156
- const zip = new import_adm_zip.default(void 0, {
4157
- fs: fs7
4158
- });
4159
- SearchFiles.forEach(buildPath, (path) => {
4160
- const pathSplit = path.path.split("/");
4161
- zip.addLocalFile(
4162
- "".concat(buildPath, "/").concat(path.path),
4163
- pathSplit.length !== 1 ? pathSplit.slice(0, pathSplit.length - 1).join("/") : void 0
4164
- );
4165
- });
4166
- zip.writeZip("Minecraft-UIBuild.mcpack");
4167
- }
4168
-
4169
- // src/compilers/generator/Sounds.ts
4170
- var import_jsonc_parser2 = __toESM(require_main());
4171
- import fs8 from "fs";
4172
- var sounds = {};
4173
- var SoundHandler = class extends Class {
4174
- static get(path) {
4175
- if (sounds[path]) {
4176
- return sounds[path];
4177
- } else {
4178
- return sounds[path] = "jsonui_scripting.".concat(Random.getName());
4179
- }
4180
- }
4181
- static compile(installPath) {
4182
- const soundIds = Object.keys(sounds);
4183
- if (soundIds.length) {
4184
- if (!fs8.existsSync("".concat(installPath, "/sounds"))) fs8.mkdirSync("".concat(installPath, "/sounds"));
4185
- const soundDefinitions = {};
4186
- for (const soundPath of soundIds) {
4187
- const soundId = sounds[soundPath];
4188
- soundDefinitions[soundId] = {
4189
- category: "ui",
4190
- sounds: [
4191
- {
4192
- load_on_low_memory: true,
4193
- name: soundPath,
4194
- stream: true,
4195
- volume: 1
4196
- }
4197
- ]
4198
- };
4199
- }
4200
- let bak;
4201
- if (fs8.existsSync(".bedrock/sounds/sound_definitions.json")) {
4202
- bak = (0, import_jsonc_parser2.parse)(
4203
- fs8.readFileSync(".bedrock/sounds/sound_definitions.json", "utf-8")
4204
- ).sound_definitions;
4205
- }
4206
- UIWriteJson(
4207
- "".concat(installPath, "/sounds/sound_definitions.json"),
4208
- {
4209
- format_version: "1.20.20",
4210
- sound_definitions: {
4211
- ...bak,
4212
- ...soundDefinitions
4213
- }
4214
- },
4215
- "utf-8"
4216
- );
4217
- }
4218
- return soundIds.length;
4219
- }
4220
- };
4221
-
4222
- // src/compilers/reader/Audio.ts
4223
- import fs9 from "fs";
4224
- import { spawnSync, execSync } from "child_process";
4225
- function FormatAudio() {
4226
- const reg = /\.(mp3|m4a|mp4|mov|opus|acc|flac)$/;
4227
- const files = SearchFiles.array(".bedrock", ".bedrock").filter(
4228
- (path) => reg.test(path)
4229
- );
4230
- if (!files.length) return;
4231
- try {
4232
- spawnSync("ffmpeg", ["-version"], {
4233
- stdio: ["ignore", "ignore", "ignore"]
4234
- }).error;
4235
- console.timeLog(
4236
- "Compiler",
4237
- ">> Starting to convert all found audio files to WAV format"
4238
- );
4239
- for (const file of files) {
4240
- const out = file.replace(reg, ".wav");
4241
- execSync("ffmpeg -i ".concat(file, " ").concat(out), {
4242
- stdio: "ignore"
4243
- });
4244
- fs9.rmSync(file);
4245
- console.timeLog(
4246
- "Compiler",
4247
- ">> Reformatting of ".concat(file.replace(
4248
- /^\.bedrock\//,
4249
- ""
4250
- ), " is complete.")
4251
- );
4252
- }
4253
- console.timeLog(
4254
- "Compiler",
4255
- ">> Successfully reformatted ".concat(files.length, " audio file(s).")
4256
- );
4257
- console.log();
4258
- } catch (error) {
4259
- Log.warning(
4260
- "You need to install 'ffmpeg' to your system environment variables to automatic convert all audio files to a format minecraft can read."
4261
- );
4262
- console.log();
4263
- }
4264
- }
4265
-
4266
- // src/compilers/Encoder.ts
4267
- import fs10 from "fs";
4268
- var _Encoder = class _Encoder extends Class {
4269
- static start() {
4270
- for (const path of jsonFilePath) {
4271
- const code = _Encoder.readCode(path);
4272
- const encode = _Encoder.encode(code);
4273
- _Encoder.replaceCode(path, encode);
4274
- _Encoder.count++;
4275
- }
4276
- }
4277
- static replaceCode(path, code) {
4278
- fs10.writeFileSync(path, WritePreComment(code).replaceAll("\\\\", "\\"), "utf-8");
4279
- }
4280
- static encode(code) {
4281
- return Array.isArray(code) ? _Encoder.encodeArray(code) : _Encoder.encodeObject(code);
4282
- }
4283
- static encodeArray(code) {
4284
- return code.map((value) => {
4285
- const valueType = typeof value;
4286
- if (valueType === "object") {
4287
- return _Encoder.encode(value);
4288
- } else if (valueType === "string") return _Encoder.encodeString(value);
4289
- else return value;
4290
- });
4291
- }
4292
- static encodeObject(code) {
4293
- return Obj.map(code, (key, value) => {
4294
- const valueType = typeof value;
4295
- key = _Encoder.encodeString(key);
4296
- if (valueType === "object") {
4297
- return {
4298
- key,
4299
- value: _Encoder.encode(value)
4300
- };
4301
- } else if (valueType === "string") {
4302
- return { key, value: _Encoder.encodeString(value) };
4303
- } else return { key, value };
4304
- });
4305
- }
4306
- static encodeString(code) {
4307
- return Array.from(code).map((char) => "\\u".concat(char.charCodeAt(0).toString(16).padStart(4, "0"))).join("");
4308
- }
4309
- static readCode(path) {
4310
- return JSON.parse(fs10.readFileSync(path, "utf-8"));
4311
- }
4312
- };
4313
- __publicField(_Encoder, "count", 0);
4314
- var Encoder = _Encoder;
4315
-
4316
4069
  // src/types/enums/BindingType.ts
4317
4070
  var BindingType = /* @__PURE__ */ ((BindingType2) => {
4318
4071
  BindingType2["Global"] = "global";
@@ -4489,6 +4242,37 @@ var Animation = class _Animation extends Class {
4489
4242
  }
4490
4243
  };
4491
4244
 
4245
+ // src/components/LocalizeText.ts
4246
+ var localizeText = {};
4247
+ var LocalizeText = class _LocalizeText {
4248
+ constructor(key, value) {
4249
+ this.key = key;
4250
+ if (typeof value === "string") {
4251
+ this.set({ en_US: value });
4252
+ } else {
4253
+ this.set(value);
4254
+ }
4255
+ }
4256
+ createLabel(properties, identifier) {
4257
+ const label = UI.label(properties, identifier);
4258
+ label.setProperties({
4259
+ text: this.key
4260
+ });
4261
+ return label;
4262
+ }
4263
+ set(texts) {
4264
+ for (const language in texts) {
4265
+ (localizeText[language] || (localizeText[language] = {}))[this.key] = texts[language];
4266
+ }
4267
+ }
4268
+ get() {
4269
+ return this.key;
4270
+ }
4271
+ static register(key, value) {
4272
+ return new _LocalizeText(key, value);
4273
+ }
4274
+ };
4275
+
4492
4276
  // src/types/enums/MappingTypes.ts
4493
4277
  var MappingType = /* @__PURE__ */ ((MappingType2) => {
4494
4278
  MappingType2["Global"] = "global";
@@ -4545,6 +4329,7 @@ var Modify = class _Modify extends Class {
4545
4329
  this.controls.push({
4546
4330
  ["".concat(name, "@").concat(typeof element === "string" ? element.startsWith("@") ? element.slice(1) : element : element.getPath())]: properties ? ReadProperties(properties) : {}
4547
4331
  });
4332
+ if (element instanceof UI) element.isExtended = true;
4548
4333
  callback == null ? void 0 : callback(this, name);
4549
4334
  return this.override;
4550
4335
  },
@@ -4657,6 +4442,7 @@ var Modify = class _Modify extends Class {
4657
4442
  return this.modify.controls;
4658
4443
  },
4659
4444
  replace: (childName, ui, properties, elementName) => {
4445
+ if (ui instanceof UI) ui.isExtended = true;
4660
4446
  this.modifyControls.replace.push([
4661
4447
  childName,
4662
4448
  {
@@ -4666,6 +4452,7 @@ var Modify = class _Modify extends Class {
4666
4452
  return this.modify.controls;
4667
4453
  },
4668
4454
  insertAfter: (childName, ui, properties, elementName) => {
4455
+ if (ui instanceof UI) ui.isExtended = true;
4669
4456
  this.modifyControls.insertAfter.push([
4670
4457
  childName,
4671
4458
  {
@@ -4675,6 +4462,7 @@ var Modify = class _Modify extends Class {
4675
4462
  return this.modify.controls;
4676
4463
  },
4677
4464
  insertBefore: (childName, ui, properties, elementName) => {
4465
+ if (ui instanceof UI) ui.isExtended = true;
4678
4466
  this.modifyControls.insertBefore.push([
4679
4467
  childName,
4680
4468
  {
@@ -4684,12 +4472,14 @@ var Modify = class _Modify extends Class {
4684
4472
  return this.modify.controls;
4685
4473
  },
4686
4474
  insertBack: (ui, properties, elementName) => {
4475
+ if (ui instanceof UI) ui.isExtended = true;
4687
4476
  this.modifyControls.insertBack.push({
4688
4477
  ["".concat(elementName || Random.getName(), "@").concat(typeof ui === "string" ? ui : ui.getPath())]: ReadProperties(properties || {})
4689
4478
  });
4690
4479
  return this.modify.controls;
4691
4480
  },
4692
4481
  insertFront: (ui, properties, elementName) => {
4482
+ if (ui instanceof UI) ui.isExtended = true;
4693
4483
  this.modifyControls.insertFront.push({
4694
4484
  ["".concat(elementName || Random.getName(), "@").concat(typeof ui === "string" ? ui : ui.getPath())]: ReadProperties(properties || {})
4695
4485
  });
@@ -4723,9 +4513,9 @@ var Modify = class _Modify extends Class {
4723
4513
  for (const key of ["type", "controls", "bindings", "button_mappings", "anims"])
4724
4514
  if (this[key]) code[key] = this[key];
4725
4515
  if (this.variables) code.variables;
4726
- if (this.variables && Object(this.variables).length !== 0)
4516
+ if (this.variables && Object.keys(this.variables).length !== 0)
4727
4517
  Obj.forEach(this.variables, (k, v) => {
4728
- code.variables.push({
4518
+ (code.variables || (code.variables = [])).push({
4729
4519
  requires: k,
4730
4520
  ...v
4731
4521
  });
@@ -4856,6 +4646,59 @@ var Modify = class _Modify extends Class {
4856
4646
  }
4857
4647
  };
4858
4648
 
4649
+ // src/compilers/generator/Sounds.ts
4650
+ var import_jsonc_parser = __toESM(require_main());
4651
+ import fs6 from "fs";
4652
+ var sounds = {};
4653
+ var SoundHandler = class extends Class {
4654
+ static get(path) {
4655
+ if (sounds[path]) {
4656
+ return sounds[path];
4657
+ } else {
4658
+ return sounds[path] = "jsonui_scripting.".concat(Random.getName());
4659
+ }
4660
+ }
4661
+ static compile(installPath) {
4662
+ const soundIds = Object.keys(sounds);
4663
+ if (soundIds.length) {
4664
+ if (!fs6.existsSync("".concat(installPath, "/sounds"))) fs6.mkdirSync("".concat(installPath, "/sounds"));
4665
+ const soundDefinitions = {};
4666
+ for (const soundPath of soundIds) {
4667
+ const soundId = sounds[soundPath];
4668
+ soundDefinitions[soundId] = {
4669
+ category: "ui",
4670
+ sounds: [
4671
+ {
4672
+ load_on_low_memory: true,
4673
+ name: soundPath,
4674
+ stream: true,
4675
+ volume: 1
4676
+ }
4677
+ ]
4678
+ };
4679
+ }
4680
+ let bak;
4681
+ if (fs6.existsSync(".bedrock/sounds/sound_definitions.json")) {
4682
+ bak = (0, import_jsonc_parser.parse)(
4683
+ fs6.readFileSync(".bedrock/sounds/sound_definitions.json", "utf-8")
4684
+ ).sound_definitions;
4685
+ }
4686
+ UIWriteJson(
4687
+ "".concat(installPath, "/sounds/sound_definitions.json"),
4688
+ {
4689
+ format_version: "1.20.20",
4690
+ sound_definitions: {
4691
+ ...bak,
4692
+ ...soundDefinitions
4693
+ }
4694
+ },
4695
+ "utf-8"
4696
+ );
4697
+ }
4698
+ return soundIds.length;
4699
+ }
4700
+ };
4701
+
4859
4702
  // src/compilers/reader/Color.ts
4860
4703
  var ColorHandler = class extends Class {
4861
4704
  static parse(data) {
@@ -5018,6 +4861,8 @@ var _UI = class _UI {
5018
4861
  __publicField(this, "namespace");
5019
4862
  __publicField(this, "extends");
5020
4863
  __publicField(this, "sourceBindings", {});
4864
+ __publicField(this, "isExtended", false);
4865
+ __publicField(this, "addCount", 0);
5021
4866
  __publicField(this, "type");
5022
4867
  __publicField(this, "controls");
5023
4868
  __publicField(this, "bindings");
@@ -5039,7 +4884,8 @@ var _UI = class _UI {
5039
4884
  }
5040
4885
  if (identifier.extends instanceof _UI)
5041
4886
  this.extends = "".concat(identifier.extends.getPath());
5042
- else if (identifier.extends instanceof Modify) this.extends = identifier.extends.getPath();
4887
+ else if (identifier.extends instanceof Modify)
4888
+ this.extends = identifier.extends.getPath();
5043
4889
  else if (typeof identifier.extends === "string") this.extends = identifier.extends;
5044
4890
  else this.extends = "".concat(identifier.extends.namespace, ".").concat(identifier.extends.name);
5045
4891
  } else {
@@ -5257,21 +5103,26 @@ var _UI = class _UI {
5257
5103
  this.controls || (this.controls = []);
5258
5104
  if (!element) return this;
5259
5105
  name || (name = Random.getName());
5260
- if (this.isDuplicate(name)) {
5106
+ if (this.isDuplicate(name))
5261
5107
  Log.warning("".concat(CurrentLine(), " child element should have a unique name!"));
5262
- }
5263
5108
  if (typeof element === "string") {
5264
5109
  this.controls.push({
5265
5110
  ["".concat(name, "@").concat(element)]: properties ? ReadProperties(properties) : {}
5266
5111
  });
5267
5112
  } else if (element instanceof _UI || element instanceof Modify) {
5268
- {
5269
- if ((element == null ? void 0 : element.getPath()) === this.getPath()) {
5270
- Log.warning("".concat(CurrentLine(), " child element should have a unique name!"));
5113
+ if ((element == null ? void 0 : element.getPath()) === this.getPath())
5114
+ Log.warning("".concat(CurrentLine(), " child element should have a unique name!"));
5115
+ if (properties || element instanceof Modify) {
5116
+ if (element instanceof _UI) {
5117
+ element.isExtended = true;
5118
+ element.addCount++;
5271
5119
  }
5272
5120
  this.controls.push({
5273
5121
  ["".concat(name, "@").concat(element == null ? void 0 : element.getPath())]: properties ? ReadProperties(properties) : {}
5274
5122
  });
5123
+ } else {
5124
+ element.addCount++;
5125
+ this.controls.push({ [name]: element });
5275
5126
  }
5276
5127
  }
5277
5128
  callback == null ? void 0 : callback(this, name);
@@ -5312,8 +5163,9 @@ var _UI = class _UI {
5312
5163
  return this;
5313
5164
  }
5314
5165
  getUI() {
5315
- var _a;
5166
+ var _a, _b;
5316
5167
  const code = ReadProperties((_a = this.properties) != null ? _a : {});
5168
+ const config4 = Configs.getConfig();
5317
5169
  for (const key of ["type", "controls", "bindings", "button_mappings", "anims"])
5318
5170
  if (this[key]) code[key] = this[key];
5319
5171
  for (const bindingKey in this.sourceBindings) {
@@ -5334,6 +5186,18 @@ var _UI = class _UI {
5334
5186
  ...v
5335
5187
  });
5336
5188
  });
5189
+ code.controls = (_b = this.controls) == null ? void 0 : _b.map((control) => {
5190
+ const key = Object.keys(control)[0];
5191
+ const element = control[key];
5192
+ if (element instanceof _UI) {
5193
+ if (element.isExtended || element.addCount > 1 || !config4.compiler.UI.optimizeControls)
5194
+ return { ["".concat(key, "@").concat(element.getPath())]: {} };
5195
+ else
5196
+ return {
5197
+ [key]: element.getUI()
5198
+ };
5199
+ } else return control;
5200
+ });
5337
5201
  return code;
5338
5202
  }
5339
5203
  getPath() {
@@ -5367,36 +5231,208 @@ __publicField(_UI, "length", "");
5367
5231
  __publicField(_UI, "name", "");
5368
5232
  var UI = _UI;
5369
5233
 
5370
- // src/components/LocalizeText.ts
5371
- var localizeText = {};
5372
- var LocalizeText = class _LocalizeText {
5373
- constructor(key, value) {
5374
- this.key = key;
5375
- if (typeof value === "string") {
5376
- this.set({ en_US: value });
5377
- } else {
5378
- this.set(value);
5234
+ // src/compilers/generator/UIBuilder.ts
5235
+ var UIBuilder = class {
5236
+ static delete(installPath) {
5237
+ try {
5238
+ fs7.unlinkSync(installPath);
5239
+ } catch (error) {
5240
+ if (fs7.existsSync(installPath)) fs7.rmSync(installPath, { recursive: true });
5379
5241
  }
5380
5242
  }
5381
- createLabel(properties, identifier) {
5382
- const label = UI.label(properties, identifier);
5383
- label.setProperties({
5384
- text: this.key
5385
- });
5386
- return label;
5243
+ static jsonUI(installPath) {
5244
+ const build = JsonBuilder.save.build;
5245
+ const config4 = Configs.getConfig();
5246
+ let count = 0;
5247
+ for (const file in build) {
5248
+ const namespace = build[file].namespace;
5249
+ delete build[file].namespace;
5250
+ let compileElementsCount = 0;
5251
+ for (const jsonUI in build[file]) {
5252
+ const element = build[file][jsonUI];
5253
+ if (element instanceof UI && element.addCount < 2 && !element.isExtended && config4.compiler.UI.optimizeControls)
5254
+ build[file][jsonUI] = void 0;
5255
+ else {
5256
+ build[file][jsonUI] = element.getUI();
5257
+ compileElementsCount++;
5258
+ }
5259
+ }
5260
+ if (!compileElementsCount) continue;
5261
+ console.timeLog("COMPILER", "".concat(file, " ").concat(!compileElementsCount, " elements has generated!"));
5262
+ build[file].namespace = namespace;
5263
+ UIWriteJson("".concat(installPath, "/@/").concat(file), build[file], "utf-8");
5264
+ delete build[file];
5265
+ count++;
5266
+ }
5267
+ return count;
5387
5268
  }
5388
- set(texts) {
5389
- for (const language in texts) {
5390
- (localizeText[language] || (localizeText[language] = {}))[this.key] = texts[language];
5269
+ static modify(installPath) {
5270
+ if (!fs7.existsSync("".concat(installPath, "/ui"))) fs7.mkdirSync("".concat(installPath, "/ui"));
5271
+ let count = 0;
5272
+ const modify = JsonBuilder.save.modify;
5273
+ for (const key in modify) {
5274
+ GenerateDir(installPath, key);
5275
+ for (const element in modify[key]) modify[key][element] = modify[key][element].getUI();
5276
+ console.timeLog(
5277
+ "COMPILER",
5278
+ "".concat(key, " ").concat(Object.keys(modify[key]).length, " modify element(s) has generated!")
5279
+ );
5280
+ UIWriteJson("".concat(installPath, "/").concat(key), modify[key], "utf-8");
5281
+ delete modify[key];
5282
+ count++;
5391
5283
  }
5284
+ return count;
5392
5285
  }
5393
- get() {
5394
- return this.key;
5286
+ static uiDefs(installPath) {
5287
+ const arr = SearchFiles.array("".concat(installPath, "/@"), "@");
5288
+ UIWriteJson("".concat(installPath, "/ui/_ui_defs.json"), { ui_defs: arr }, "utf-8");
5289
+ return arr.length;
5395
5290
  }
5396
- static register(key, value) {
5397
- return new _LocalizeText(key, value);
5291
+ static contents(installPath) {
5292
+ const arr = SearchFiles.array(installPath);
5293
+ UIWriteJson(
5294
+ "".concat(installPath, "/contents.json"),
5295
+ {
5296
+ content: arr.map((v) => ({ path: v }))
5297
+ },
5298
+ "utf-8"
5299
+ );
5300
+ return arr.length;
5301
+ }
5302
+ static texturesList(installPath) {
5303
+ const arr = SearchFiles.array(installPath).filter((v) => /\.(png|jpg|jpeg)$/.test(v)).map((v) => v.replace(/\.(png|jpg|jpeg)$/, ""));
5304
+ let textureList = [];
5305
+ if (fs7.existsSync(".bedrock/textures/textures_list.json")) {
5306
+ const texturesList = fs7.readFileSync(".bedrock/textures/textures_list.json", "utf-8");
5307
+ textureList = (0, import_jsonc_parser2.parse)(texturesList);
5308
+ }
5309
+ if (!fs7.existsSync("".concat(installPath, "/textures"))) fs7.mkdirSync("".concat(installPath, "/textures"));
5310
+ UIWriteJson(
5311
+ "".concat(installPath, "/textures/textures_list.json"),
5312
+ [...arr, ...textureList],
5313
+ "utf-8"
5314
+ );
5315
+ return arr.length;
5316
+ }
5317
+ static globalVariables(installPath) {
5318
+ const globalVariables2 = JsonBuilder.save.globalVariables;
5319
+ UIWriteJson("".concat(installPath, "/ui/_global_variables.json"), globalVariables2, "utf-8");
5320
+ return Object.keys(globalVariables2).length;
5321
+ }
5322
+ };
5323
+
5324
+ // src/compilers/Compress.ts
5325
+ var import_adm_zip = __toESM(require_adm_zip());
5326
+ import fs8 from "fs";
5327
+ function CompressPack(buildPath) {
5328
+ if (fs8.existsSync("Minecraft-UIBuild.mcpack"))
5329
+ fs8.rmSync("Minecraft-UIBuild.mcpack");
5330
+ const zip = new import_adm_zip.default(void 0, {
5331
+ fs: fs8
5332
+ });
5333
+ SearchFiles.forEach(buildPath, (path) => {
5334
+ const pathSplit = path.path.split("/");
5335
+ zip.addLocalFile(
5336
+ "".concat(buildPath, "/").concat(path.path),
5337
+ pathSplit.length !== 1 ? pathSplit.slice(0, pathSplit.length - 1).join("/") : void 0
5338
+ );
5339
+ });
5340
+ zip.writeZip("Minecraft-UIBuild.mcpack");
5341
+ }
5342
+
5343
+ // src/compilers/reader/Audio.ts
5344
+ import fs9 from "fs";
5345
+ import { spawnSync, execSync } from "child_process";
5346
+ function FormatAudio() {
5347
+ const reg = /\.(mp3|m4a|mp4|mov|opus|acc|flac)$/;
5348
+ const files = SearchFiles.array(".bedrock", ".bedrock").filter(
5349
+ (path) => reg.test(path)
5350
+ );
5351
+ if (!files.length) return;
5352
+ try {
5353
+ spawnSync("ffmpeg", ["-version"], {
5354
+ stdio: ["ignore", "ignore", "ignore"]
5355
+ }).error;
5356
+ console.timeLog(
5357
+ "Compiler",
5358
+ ">> Starting to convert all found audio files to WAV format"
5359
+ );
5360
+ for (const file of files) {
5361
+ const out = file.replace(reg, ".wav");
5362
+ execSync("ffmpeg -i ".concat(file, " ").concat(out), {
5363
+ stdio: "ignore"
5364
+ });
5365
+ fs9.rmSync(file);
5366
+ console.timeLog(
5367
+ "Compiler",
5368
+ ">> Reformatting of ".concat(file.replace(
5369
+ /^\.bedrock\//,
5370
+ ""
5371
+ ), " is complete.")
5372
+ );
5373
+ }
5374
+ console.timeLog(
5375
+ "Compiler",
5376
+ ">> Successfully reformatted ".concat(files.length, " audio file(s).")
5377
+ );
5378
+ console.log();
5379
+ } catch (error) {
5380
+ Log.warning(
5381
+ "You need to install 'ffmpeg' to your system environment variables to automatic convert all audio files to a format minecraft can read."
5382
+ );
5383
+ console.log();
5384
+ }
5385
+ }
5386
+
5387
+ // src/compilers/Encoder.ts
5388
+ import fs10 from "fs";
5389
+ var _Encoder = class _Encoder extends Class {
5390
+ static start() {
5391
+ for (const path of jsonFilePath) {
5392
+ const code = _Encoder.readCode(path);
5393
+ const encode = _Encoder.encode(code);
5394
+ _Encoder.replaceCode(path, encode);
5395
+ _Encoder.count++;
5396
+ }
5397
+ }
5398
+ static replaceCode(path, code) {
5399
+ fs10.writeFileSync(path, WritePreComment(code).replaceAll("\\\\", "\\"), "utf-8");
5400
+ }
5401
+ static encode(code) {
5402
+ return Array.isArray(code) ? _Encoder.encodeArray(code) : _Encoder.encodeObject(code);
5403
+ }
5404
+ static encodeArray(code) {
5405
+ return code.map((value) => {
5406
+ const valueType = typeof value;
5407
+ if (valueType === "object") {
5408
+ return _Encoder.encode(value);
5409
+ } else if (valueType === "string") return _Encoder.encodeString(value);
5410
+ else return value;
5411
+ });
5412
+ }
5413
+ static encodeObject(code) {
5414
+ return Obj.map(code, (key, value) => {
5415
+ const valueType = typeof value;
5416
+ key = _Encoder.encodeString(key);
5417
+ if (valueType === "object") {
5418
+ return {
5419
+ key,
5420
+ value: _Encoder.encode(value)
5421
+ };
5422
+ } else if (valueType === "string") {
5423
+ return { key, value: _Encoder.encodeString(value) };
5424
+ } else return { key, value };
5425
+ });
5426
+ }
5427
+ static encodeString(code) {
5428
+ return Array.from(code).map((char) => "\\u".concat(char.charCodeAt(0).toString(16).padStart(4, "0"))).join("");
5429
+ }
5430
+ static readCode(path) {
5431
+ return JSON.parse(fs10.readFileSync(path, "utf-8"));
5398
5432
  }
5399
5433
  };
5434
+ __publicField(_Encoder, "count", 0);
5435
+ var Encoder = _Encoder;
5400
5436
 
5401
5437
  // src/compilers/generator/LangBuilder.ts
5402
5438
  import fs11 from "fs";
@@ -68115,3 +68151,4 @@ export {
68115
68151
  localizeText,
68116
68152
  readObject
68117
68153
  };
68154
+ //# sourceMappingURL=index.js.map