@nice2dev/game-engine 1.3.15 → 1.3.16

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 (434) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/accessibility/Accessibility.js +152 -165
  3. package/dist/cjs/ai/AI.js +292 -294
  4. package/dist/cjs/ai/BehaviorTree.js +1029 -1113
  5. package/dist/cjs/ai/StateMachine.js +694 -756
  6. package/dist/cjs/animation/Animation.js +232 -241
  7. package/dist/cjs/audio/AudioAdvanced.js +221 -236
  8. package/dist/cjs/audio/AudioBridge.js +441 -435
  9. package/dist/cjs/audio/AudioManager.js +242 -259
  10. package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
  11. package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
  12. package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
  13. package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
  14. package/dist/cjs/core/EventBus.js +51 -56
  15. package/dist/cjs/core/GameClock.js +62 -66
  16. package/dist/cjs/core/GameConfig.js +72 -79
  17. package/dist/cjs/core/GameLoop.js +80 -89
  18. package/dist/cjs/core/ServiceLocator.js +61 -65
  19. package/dist/cjs/core/Validation.js +72 -82
  20. package/dist/cjs/core/math.js +108 -112
  21. package/dist/cjs/devtools/DevTools.js +542 -563
  22. package/dist/cjs/devtools/DeveloperExperience.js +521 -559
  23. package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
  24. package/dist/cjs/dialogue/DialogueSystem.js +984 -986
  25. package/dist/cjs/docs/DocGenerator.js +339 -364
  26. package/dist/cjs/ecs/World.js +355 -371
  27. package/dist/cjs/editor/AchievementEditor.js +580 -636
  28. package/dist/cjs/editor/AdvancedEditor.js +184 -191
  29. package/dist/cjs/editor/AnimationRetargeting.js +696 -741
  30. package/dist/cjs/editor/AssetBrowser.js +1072 -1160
  31. package/dist/cjs/editor/AssetManager.js +187 -192
  32. package/dist/cjs/editor/ConsolePro.js +971 -1061
  33. package/dist/cjs/editor/CraftingEditor.js +680 -730
  34. package/dist/cjs/editor/DebugTools.js +187 -185
  35. package/dist/cjs/editor/DialogueSystem.js +844 -901
  36. package/dist/cjs/editor/LeaderboardSystem.js +429 -483
  37. package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
  38. package/dist/cjs/editor/PrefabSystem.js +772 -838
  39. package/dist/cjs/editor/ProfilerPanel.js +649 -700
  40. package/dist/cjs/editor/QuestEditor.js +792 -839
  41. package/dist/cjs/editor/ReplaySystem.js +585 -634
  42. package/dist/cjs/editor/SceneEditor.js +176 -200
  43. package/dist/cjs/editor/ScreenshotMode.js +621 -688
  44. package/dist/cjs/editor/ShaderGraph.js +1556 -1582
  45. package/dist/cjs/editor/TimelineEditor.js +715 -778
  46. package/dist/cjs/editor/UndoRedoPro.js +830 -904
  47. package/dist/cjs/editor/VRARMode.js +582 -645
  48. package/dist/cjs/engine/NiceGameEngine.js +141 -164
  49. package/dist/cjs/engine/SaveSystem.js +441 -495
  50. package/dist/cjs/enterprise/Enterprise.js +254 -261
  51. package/dist/cjs/export/BevyExporter.js +927 -967
  52. package/dist/cjs/export/CocosExporter.js +644 -673
  53. package/dist/cjs/export/Construct3Exporter.js +783 -794
  54. package/dist/cjs/export/DefoldExporter.js +1028 -1069
  55. package/dist/cjs/export/GDevelopExporter.js +674 -708
  56. package/dist/cjs/export/GameMakerExporter.js +791 -805
  57. package/dist/cjs/export/GodotExporter.js +1003 -1045
  58. package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
  59. package/dist/cjs/export/MonoGameExporter.js +1265 -1293
  60. package/dist/cjs/export/Pico8Exporter.js +766 -812
  61. package/dist/cjs/export/PlatformExporter.js +188 -206
  62. package/dist/cjs/export/RPGMakerExporter.js +860 -879
  63. package/dist/cjs/export/RobloxExporter.js +883 -919
  64. package/dist/cjs/export/Solar2DExporter.js +1218 -1256
  65. package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
  66. package/dist/cjs/export/Tic80Exporter.js +1210 -1267
  67. package/dist/cjs/export/UnityExporter.js +1116 -1131
  68. package/dist/cjs/export/UnrealExporter.js +889 -919
  69. package/dist/cjs/export/WebExporter.js +931 -970
  70. package/dist/cjs/export/index.js +42 -65
  71. package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
  72. package/dist/cjs/godot-integration/GodotImport.js +929 -1027
  73. package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
  74. package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
  75. package/dist/cjs/i18n/I18n.js +860 -900
  76. package/dist/cjs/i18n/useTranslation.js +84 -89
  77. package/dist/cjs/import/AsepriteImporter.js +658 -716
  78. package/dist/cjs/import/DragonBonesImporter.js +437 -461
  79. package/dist/cjs/import/GameMakerImporter.js +511 -521
  80. package/dist/cjs/import/GodotSceneImporter.js +788 -822
  81. package/dist/cjs/import/LDtkImporter.js +436 -454
  82. package/dist/cjs/import/Live2DImporter.js +497 -518
  83. package/dist/cjs/import/NdgFormat.js +424 -457
  84. package/dist/cjs/import/OgmoImporter.js +466 -493
  85. package/dist/cjs/import/RPGMakerImporter.js +451 -477
  86. package/dist/cjs/import/SceneImporter.js +378 -423
  87. package/dist/cjs/import/SpineImporter.js +511 -546
  88. package/dist/cjs/import/SpriterImporter.js +590 -613
  89. package/dist/cjs/import/TiledMapImporter.js +811 -846
  90. package/dist/cjs/import/UnitySceneImporter.js +687 -703
  91. package/dist/cjs/import/index.js +206 -251
  92. package/dist/cjs/index.js +275 -278
  93. package/dist/cjs/input/GamepadNavigation.js +185 -205
  94. package/dist/cjs/input/InputManager.js +397 -421
  95. package/dist/cjs/input/useGamepads.js +70 -81
  96. package/dist/cjs/integration/IconSprite.js +129 -256
  97. package/dist/cjs/inventory/InventorySystem.js +920 -995
  98. package/dist/cjs/kids/KidMode.js +997 -1022
  99. package/dist/cjs/kids/KidTools.js +570 -594
  100. package/dist/cjs/monetization/Monetization.js +170 -177
  101. package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
  102. package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
  103. package/dist/cjs/native-engine/AnimationSystem.js +731 -806
  104. package/dist/cjs/native-engine/AssetPipeline.js +454 -515
  105. package/dist/cjs/native-engine/AudioEngine.js +763 -804
  106. package/dist/cjs/native-engine/InputSystem.js +1075 -1145
  107. package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
  108. package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
  109. package/dist/cjs/native-engine/RenderingEngine.js +302 -350
  110. package/dist/cjs/native-engine/SceneGraph.js +769 -808
  111. package/dist/cjs/network/MultiplayerTransport.js +97 -132
  112. package/dist/cjs/network/Networking.js +549 -564
  113. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
  114. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
  115. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
  116. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
  117. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
  118. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
  119. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
  120. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
  121. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
  122. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
  123. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
  124. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
  125. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
  126. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
  127. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
  128. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
  129. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
  130. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
  131. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
  132. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
  133. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
  134. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
  135. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
  136. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
  137. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
  138. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
  139. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
  140. package/dist/cjs/pathfinding/Pathfinding.js +245 -263
  141. package/dist/cjs/performance/AssetStreaming.js +561 -635
  142. package/dist/cjs/performance/BenchmarkSuite.js +283 -311
  143. package/dist/cjs/performance/DeltaCompression.js +467 -526
  144. package/dist/cjs/performance/DeterministicPhysics.js +450 -498
  145. package/dist/cjs/performance/ECSOptimization.js +644 -695
  146. package/dist/cjs/performance/GameSaveSystem.js +509 -556
  147. package/dist/cjs/performance/HotReload.js +447 -500
  148. package/dist/cjs/performance/InputRecording.js +511 -561
  149. package/dist/cjs/performance/InterestManagement.js +453 -500
  150. package/dist/cjs/performance/LocalizationRuntime.js +376 -423
  151. package/dist/cjs/performance/MemoryManagement.js +410 -470
  152. package/dist/cjs/performance/ModSupport.js +445 -496
  153. package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
  154. package/dist/cjs/performance/NetworkPrediction.js +424 -482
  155. package/dist/cjs/performance/ObjectPooling.js +569 -617
  156. package/dist/cjs/performance/Performance.js +174 -190
  157. package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
  158. package/dist/cjs/performance/WebGPURenderer.js +656 -683
  159. package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
  160. package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
  161. package/dist/cjs/plugins/PluginSDK.js +432 -466
  162. package/dist/cjs/plugins/PluginTestKit.js +307 -330
  163. package/dist/cjs/procedural/Procedural.js +243 -254
  164. package/dist/cjs/procedural/WorldBuilding.js +297 -314
  165. package/dist/cjs/quest/QuestSystem.js +975 -932
  166. package/dist/cjs/release/MobileExport.js +157 -163
  167. package/dist/cjs/release/Release.js +225 -238
  168. package/dist/cjs/rendering/Camera2D.js +121 -124
  169. package/dist/cjs/rendering/Renderer2D.js +321 -335
  170. package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
  171. package/dist/cjs/runtime3d/Runtime3D.js +359 -378
  172. package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
  173. package/dist/cjs/scene/SceneManager.js +177 -193
  174. package/dist/cjs/scripting/GraphToAST.js +574 -547
  175. package/dist/cjs/scripting/LanguageExporter.js +254 -279
  176. package/dist/cjs/scripting/NodeGraph.js +546 -570
  177. package/dist/cjs/scripting/ScriptAST.js +31 -39
  178. package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
  179. package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
  180. package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
  181. package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
  182. package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
  183. package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
  184. package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
  185. package/dist/cjs/social/Social.js +72 -80
  186. package/dist/cjs/systems/LightingSystem.js +844 -931
  187. package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
  188. package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
  189. package/dist/cjs/systems/TerrainSystem.js +985 -1098
  190. package/dist/cjs/templates/ActionTemplates.js +296 -309
  191. package/dist/cjs/templates/FightingTemplate.js +417 -463
  192. package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
  193. package/dist/cjs/templates/PartyTemplates.js +190 -202
  194. package/dist/cjs/templates/PuzzleTemplates.js +245 -261
  195. package/dist/cjs/templates/RPGTemplates.js +160 -178
  196. package/dist/cjs/templates/SportsTemplates.js +237 -250
  197. package/dist/cjs/templates/StrategyTemplates.js +143 -153
  198. package/dist/cjs/templates/SurvivalTemplate.js +336 -380
  199. package/dist/cjs/templates/WaveDefense.js +499 -526
  200. package/dist/cjs/tilemap/Tilemap.js +207 -214
  201. package/dist/cjs/tutorials/TutorialBranching.js +396 -417
  202. package/dist/cjs/tutorials/TutorialEngine.js +888 -931
  203. package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
  204. package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
  205. package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
  206. package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
  207. package/dist/cjs/ui/GameUI.js +295 -312
  208. package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
  209. package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
  210. package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
  211. package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
  212. package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
  213. package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
  214. package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
  215. package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
  216. package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
  217. package/dist/cjs/xr/ARVR.js +167 -175
  218. package/dist/esm/accessibility/Accessibility.js +160 -164
  219. package/dist/esm/ai/AI.js +310 -293
  220. package/dist/esm/ai/BehaviorTree.js +1057 -1112
  221. package/dist/esm/ai/StateMachine.js +709 -755
  222. package/dist/esm/animation/Animation.js +237 -240
  223. package/dist/esm/audio/AudioAdvanced.js +239 -235
  224. package/dist/esm/audio/AudioBridge.js +448 -434
  225. package/dist/esm/audio/AudioManager.js +243 -258
  226. package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
  227. package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
  228. package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
  229. package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
  230. package/dist/esm/core/EventBus.js +52 -55
  231. package/dist/esm/core/GameClock.js +63 -65
  232. package/dist/esm/core/GameConfig.js +77 -78
  233. package/dist/esm/core/GameLoop.js +81 -88
  234. package/dist/esm/core/ServiceLocator.js +63 -64
  235. package/dist/esm/core/Validation.js +82 -81
  236. package/dist/esm/core/math.js +109 -111
  237. package/dist/esm/devtools/DevTools.js +546 -562
  238. package/dist/esm/devtools/DeveloperExperience.js +535 -558
  239. package/dist/esm/devtools/GameplayAnalytics.js +647 -645
  240. package/dist/esm/dialogue/DialogueSystem.js +998 -985
  241. package/dist/esm/docs/DocGenerator.js +342 -363
  242. package/dist/esm/ecs/World.js +358 -370
  243. package/dist/esm/editor/AchievementEditor.js +584 -635
  244. package/dist/esm/editor/AdvancedEditor.js +191 -190
  245. package/dist/esm/editor/AnimationRetargeting.js +700 -740
  246. package/dist/esm/editor/AssetBrowser.js +1078 -1159
  247. package/dist/esm/editor/AssetManager.js +188 -191
  248. package/dist/esm/editor/ConsolePro.js +977 -1060
  249. package/dist/esm/editor/CraftingEditor.js +684 -729
  250. package/dist/esm/editor/DebugTools.js +194 -184
  251. package/dist/esm/editor/DialogueSystem.js +849 -900
  252. package/dist/esm/editor/LeaderboardSystem.js +433 -482
  253. package/dist/esm/editor/NiceGameEditor.js +1908 -1200
  254. package/dist/esm/editor/PrefabSystem.js +777 -837
  255. package/dist/esm/editor/ProfilerPanel.js +654 -699
  256. package/dist/esm/editor/QuestEditor.js +795 -838
  257. package/dist/esm/editor/ReplaySystem.js +591 -633
  258. package/dist/esm/editor/SceneEditor.js +189 -199
  259. package/dist/esm/editor/ScreenshotMode.js +628 -687
  260. package/dist/esm/editor/ShaderGraph.js +1565 -1581
  261. package/dist/esm/editor/TimelineEditor.js +733 -777
  262. package/dist/esm/editor/UndoRedoPro.js +835 -903
  263. package/dist/esm/editor/VRARMode.js +586 -644
  264. package/dist/esm/engine/NiceGameEngine.js +142 -163
  265. package/dist/esm/engine/SaveSystem.js +447 -494
  266. package/dist/esm/enterprise/Enterprise.js +265 -260
  267. package/dist/esm/export/BevyExporter.js +929 -966
  268. package/dist/esm/export/CocosExporter.js +646 -672
  269. package/dist/esm/export/Construct3Exporter.js +785 -793
  270. package/dist/esm/export/DefoldExporter.js +1030 -1068
  271. package/dist/esm/export/GDevelopExporter.js +676 -707
  272. package/dist/esm/export/GameMakerExporter.js +793 -804
  273. package/dist/esm/export/GodotExporter.js +1004 -1044
  274. package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
  275. package/dist/esm/export/MonoGameExporter.js +1267 -1292
  276. package/dist/esm/export/Pico8Exporter.js +768 -811
  277. package/dist/esm/export/PlatformExporter.js +193 -205
  278. package/dist/esm/export/RPGMakerExporter.js +862 -878
  279. package/dist/esm/export/RobloxExporter.js +885 -918
  280. package/dist/esm/export/Solar2DExporter.js +1220 -1255
  281. package/dist/esm/export/ThreeJSExporter.js +1007 -1072
  282. package/dist/esm/export/Tic80Exporter.js +1212 -1266
  283. package/dist/esm/export/UnityExporter.js +1117 -1130
  284. package/dist/esm/export/UnrealExporter.js +891 -918
  285. package/dist/esm/export/WebExporter.js +933 -969
  286. package/dist/esm/export/index.js +86 -71
  287. package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
  288. package/dist/esm/godot-integration/GodotImport.js +935 -1026
  289. package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
  290. package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
  291. package/dist/esm/i18n/I18n.js +871 -899
  292. package/dist/esm/i18n/useTranslation.js +88 -88
  293. package/dist/esm/import/AsepriteImporter.js +637 -715
  294. package/dist/esm/import/DragonBonesImporter.js +417 -460
  295. package/dist/esm/import/GameMakerImporter.js +491 -520
  296. package/dist/esm/import/GodotSceneImporter.js +767 -821
  297. package/dist/esm/import/LDtkImporter.js +415 -453
  298. package/dist/esm/import/Live2DImporter.js +477 -517
  299. package/dist/esm/import/NdgFormat.js +410 -456
  300. package/dist/esm/import/OgmoImporter.js +446 -492
  301. package/dist/esm/import/RPGMakerImporter.js +431 -476
  302. package/dist/esm/import/SceneImporter.js +385 -422
  303. package/dist/esm/import/SpineImporter.js +491 -545
  304. package/dist/esm/import/SpriterImporter.js +570 -612
  305. package/dist/esm/import/TiledMapImporter.js +790 -845
  306. package/dist/esm/import/UnitySceneImporter.js +666 -702
  307. package/dist/esm/import/index.js +247 -258
  308. package/dist/esm/index.js +1332 -188
  309. package/dist/esm/input/GamepadNavigation.js +187 -204
  310. package/dist/esm/input/InputManager.js +401 -420
  311. package/dist/esm/input/useGamepads.js +72 -80
  312. package/dist/esm/integration/IconSprite.js +143 -255
  313. package/dist/esm/inventory/InventorySystem.js +925 -994
  314. package/dist/esm/kids/KidMode.js +1003 -1021
  315. package/dist/esm/kids/KidTools.js +573 -593
  316. package/dist/esm/monetization/Monetization.js +180 -176
  317. package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
  318. package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
  319. package/dist/esm/native-engine/AnimationSystem.js +735 -805
  320. package/dist/esm/native-engine/AssetPipeline.js +456 -514
  321. package/dist/esm/native-engine/AudioEngine.js +765 -803
  322. package/dist/esm/native-engine/InputSystem.js +1079 -1144
  323. package/dist/esm/native-engine/NetworkingSystem.js +740 -792
  324. package/dist/esm/native-engine/PhysicsEngine.js +585 -606
  325. package/dist/esm/native-engine/RenderingEngine.js +304 -349
  326. package/dist/esm/native-engine/SceneGraph.js +773 -807
  327. package/dist/esm/network/MultiplayerTransport.js +99 -131
  328. package/dist/esm/network/Networking.js +556 -563
  329. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
  330. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
  331. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
  332. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
  333. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
  334. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
  335. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
  336. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
  337. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
  338. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
  339. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
  340. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
  341. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
  342. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
  343. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
  344. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
  345. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
  346. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
  347. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
  348. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
  349. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
  350. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
  351. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
  352. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
  353. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
  354. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
  355. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
  356. package/dist/esm/pathfinding/Pathfinding.js +249 -262
  357. package/dist/esm/performance/AssetStreaming.js +567 -634
  358. package/dist/esm/performance/BenchmarkSuite.js +285 -310
  359. package/dist/esm/performance/DeltaCompression.js +478 -525
  360. package/dist/esm/performance/DeterministicPhysics.js +479 -497
  361. package/dist/esm/performance/ECSOptimization.js +653 -694
  362. package/dist/esm/performance/GameSaveSystem.js +515 -555
  363. package/dist/esm/performance/HotReload.js +454 -499
  364. package/dist/esm/performance/InputRecording.js +520 -560
  365. package/dist/esm/performance/InterestManagement.js +460 -499
  366. package/dist/esm/performance/LocalizationRuntime.js +382 -422
  367. package/dist/esm/performance/MemoryManagement.js +415 -469
  368. package/dist/esm/performance/ModSupport.js +455 -495
  369. package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
  370. package/dist/esm/performance/NetworkPrediction.js +436 -481
  371. package/dist/esm/performance/ObjectPooling.js +582 -616
  372. package/dist/esm/performance/Performance.js +182 -189
  373. package/dist/esm/performance/PerformanceAdvanced.js +621 -636
  374. package/dist/esm/performance/WebGPURenderer.js +660 -682
  375. package/dist/esm/physics/PhysicsAdvanced.js +359 -378
  376. package/dist/esm/physics/PhysicsEngine2D.js +393 -426
  377. package/dist/esm/plugins/PluginSDK.js +435 -465
  378. package/dist/esm/plugins/PluginTestKit.js +315 -329
  379. package/dist/esm/procedural/Procedural.js +248 -253
  380. package/dist/esm/procedural/WorldBuilding.js +316 -313
  381. package/dist/esm/quest/QuestSystem.js +982 -931
  382. package/dist/esm/release/MobileExport.js +163 -162
  383. package/dist/esm/release/Release.js +234 -237
  384. package/dist/esm/rendering/Camera2D.js +122 -123
  385. package/dist/esm/rendering/Renderer2D.js +323 -334
  386. package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
  387. package/dist/esm/runtime3d/Runtime3D.js +368 -377
  388. package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
  389. package/dist/esm/scene/SceneManager.js +178 -192
  390. package/dist/esm/scripting/GraphToAST.js +576 -546
  391. package/dist/esm/scripting/LanguageExporter.js +263 -278
  392. package/dist/esm/scripting/NodeGraph.js +550 -569
  393. package/dist/esm/scripting/ScriptAST.js +45 -38
  394. package/dist/esm/scripting/VisualScripting2.js +1025 -1064
  395. package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
  396. package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
  397. package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
  398. package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
  399. package/dist/esm/scripting/exporters/RustExporter.js +460 -511
  400. package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
  401. package/dist/esm/social/Social.js +77 -79
  402. package/dist/esm/systems/LightingSystem.js +855 -930
  403. package/dist/esm/systems/ParticleSystem2.js +1453 -1450
  404. package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
  405. package/dist/esm/systems/TerrainSystem.js +996 -1097
  406. package/dist/esm/templates/ActionTemplates.js +307 -308
  407. package/dist/esm/templates/FightingTemplate.js +439 -462
  408. package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
  409. package/dist/esm/templates/PartyTemplates.js +206 -201
  410. package/dist/esm/templates/PuzzleTemplates.js +260 -260
  411. package/dist/esm/templates/RPGTemplates.js +172 -177
  412. package/dist/esm/templates/SportsTemplates.js +251 -249
  413. package/dist/esm/templates/StrategyTemplates.js +158 -152
  414. package/dist/esm/templates/SurvivalTemplate.js +367 -379
  415. package/dist/esm/templates/WaveDefense.js +501 -525
  416. package/dist/esm/tilemap/Tilemap.js +209 -213
  417. package/dist/esm/tutorials/TutorialBranching.js +399 -416
  418. package/dist/esm/tutorials/TutorialEngine.js +893 -930
  419. package/dist/esm/tutorials/TutorialOverlay.js +603 -639
  420. package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
  421. package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
  422. package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
  423. package/dist/esm/ui/GameUI.js +296 -311
  424. package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
  425. package/dist/esm/unity-integration/UnityImport.js +1071 -1175
  426. package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
  427. package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
  428. package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
  429. package/dist/esm/unreal-integration/UnrealImport.js +395 -411
  430. package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
  431. package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
  432. package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
  433. package/dist/esm/xr/ARVR.js +181 -174
  434. package/package.json +7 -12
@@ -1,499 +1,465 @@
1
- 'use strict';
2
-
3
- var EventBus = require('../core/EventBus.js');
4
-
5
- /* ────────────────────────────────────────────────────────────────
6
- Plugin SDK — Architecture for 3rd party plugins
7
-
8
- Sprint L9: Plugin lifecycle, sandboxing, dependencies,
9
- extension points, templates, and marketplace API.
10
- ──────────────────────────────────────────────────────────────── */
11
- /* ══════════════════════════════════════════════════════════════
12
- Plugin Storage (in-memory with optional persistence)
13
- ══════════════════════════════════════════════════════════════ */
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const EventBus = require("../core/EventBus.js");
14
4
  class InMemoryPluginStorage {
15
- constructor(pluginId) {
16
- this.data = new Map();
17
- this.prefix = `nice2dev.plugin.${pluginId}.`;
5
+ constructor(pluginId) {
6
+ this.data = /* @__PURE__ */ new Map();
7
+ this.prefix = `nice2dev.plugin.${pluginId}.`;
8
+ }
9
+ get(key) {
10
+ if (this.data.has(key)) {
11
+ return this.data.get(key);
18
12
  }
19
- get(key) {
20
- if (this.data.has(key)) {
21
- return this.data.get(key);
22
- }
23
- // Try localStorage as fallback
24
- if (typeof localStorage !== 'undefined') {
25
- const raw = localStorage.getItem(this.prefix + key);
26
- if (raw !== null) {
27
- try {
28
- return JSON.parse(raw);
29
- }
30
- catch {
31
- /* ignore */
32
- }
33
- }
13
+ if (typeof localStorage !== "undefined") {
14
+ const raw = localStorage.getItem(this.prefix + key);
15
+ if (raw !== null) {
16
+ try {
17
+ return JSON.parse(raw);
18
+ } catch {
34
19
  }
35
- return undefined;
20
+ }
36
21
  }
37
- set(key, value) {
38
- this.data.set(key, value);
39
- if (typeof localStorage !== 'undefined') {
40
- localStorage.setItem(this.prefix + key, JSON.stringify(value));
41
- }
22
+ return void 0;
23
+ }
24
+ set(key, value) {
25
+ this.data.set(key, value);
26
+ if (typeof localStorage !== "undefined") {
27
+ localStorage.setItem(this.prefix + key, JSON.stringify(value));
42
28
  }
43
- remove(key) {
44
- this.data.delete(key);
45
- if (typeof localStorage !== 'undefined') {
46
- localStorage.removeItem(this.prefix + key);
47
- }
29
+ }
30
+ remove(key) {
31
+ this.data.delete(key);
32
+ if (typeof localStorage !== "undefined") {
33
+ localStorage.removeItem(this.prefix + key);
48
34
  }
49
- clear() {
50
- this.data.clear();
51
- if (typeof localStorage !== 'undefined') {
52
- const toRemove = [];
53
- for (let i = 0; i < localStorage.length; i++) {
54
- const k = localStorage.key(i);
55
- if (k?.startsWith(this.prefix)) {
56
- toRemove.push(k);
57
- }
58
- }
59
- for (const k of toRemove) {
60
- localStorage.removeItem(k);
61
- }
35
+ }
36
+ clear() {
37
+ this.data.clear();
38
+ if (typeof localStorage !== "undefined") {
39
+ const toRemove = [];
40
+ for (let i = 0; i < localStorage.length; i++) {
41
+ const k = localStorage.key(i);
42
+ if (k?.startsWith(this.prefix)) {
43
+ toRemove.push(k);
62
44
  }
45
+ }
46
+ for (const k of toRemove) {
47
+ localStorage.removeItem(k);
48
+ }
63
49
  }
64
- keys() {
65
- return Array.from(this.data.keys());
66
- }
50
+ }
51
+ keys() {
52
+ return Array.from(this.data.keys());
53
+ }
67
54
  }
68
- /* ══════════════════════════════════════════════════════════════
69
- Plugin Manager
70
- ══════════════════════════════════════════════════════════════ */
71
55
  class PluginManager {
72
- constructor() {
73
- this.events = new EventBus.EventBus();
74
- this.plugins = new Map();
75
- this.extensions = new Map();
56
+ constructor() {
57
+ this.events = new EventBus.EventBus();
58
+ this.plugins = /* @__PURE__ */ new Map();
59
+ this.extensions = /* @__PURE__ */ new Map();
60
+ }
61
+ /* ── Install ────────────────────────────────────────────────── */
62
+ install(definition) {
63
+ const id = definition.manifest.id;
64
+ if (this.plugins.has(id)) {
65
+ throw new Error(`[PluginManager] Plugin "${id}" is already installed.`);
76
66
  }
77
- /* ── Install ────────────────────────────────────────────────── */
78
- install(definition) {
79
- const id = definition.manifest.id;
80
- if (this.plugins.has(id)) {
81
- throw new Error(`[PluginManager] Plugin "${id}" is already installed.`);
67
+ if (definition.manifest.dependencies) {
68
+ for (const depId of Object.keys(definition.manifest.dependencies)) {
69
+ if (!this.plugins.has(depId)) {
70
+ throw new Error(
71
+ `[PluginManager] Plugin "${id}" requires "${depId}" which is not installed.`
72
+ );
82
73
  }
83
- // Check dependencies
84
- if (definition.manifest.dependencies) {
85
- for (const depId of Object.keys(definition.manifest.dependencies)) {
86
- if (!this.plugins.has(depId)) {
87
- throw new Error(`[PluginManager] Plugin "${id}" requires "${depId}" which is not installed.`);
88
- }
89
- }
90
- }
91
- const instance = {
92
- definition,
93
- state: 'installed',
94
- activatedAt: null,
95
- error: null,
96
- extensions: new Map(),
97
- };
98
- this.plugins.set(id, instance);
99
- this.events.emit('plugin:installed', { id, manifest: definition.manifest });
74
+ }
100
75
  }
101
- /* ── Activate ───────────────────────────────────────────────── */
102
- async activate(id) {
103
- const instance = this.plugins.get(id);
104
- if (!instance) {
105
- throw new Error(`[PluginManager] Plugin "${id}" is not installed.`);
106
- }
107
- if (instance.state === 'active') {
108
- return;
109
- }
110
- const ctx = this.createContext(instance);
111
- try {
112
- await instance.definition.activate(ctx);
113
- instance.state = 'active';
114
- instance.activatedAt = Date.now();
115
- instance.error = null;
116
- this.events.emit('plugin:activated', { id });
117
- }
118
- catch (err) {
119
- instance.state = 'error';
120
- instance.error = err instanceof Error ? err.message : String(err);
121
- this.events.emit('plugin:error', { id, error: instance.error });
122
- throw err;
123
- }
76
+ const instance = {
77
+ definition,
78
+ state: "installed",
79
+ activatedAt: null,
80
+ error: null,
81
+ extensions: /* @__PURE__ */ new Map()
82
+ };
83
+ this.plugins.set(id, instance);
84
+ this.events.emit("plugin:installed", { id, manifest: definition.manifest });
85
+ }
86
+ /* ── Activate ───────────────────────────────────────────────── */
87
+ async activate(id) {
88
+ const instance = this.plugins.get(id);
89
+ if (!instance) {
90
+ throw new Error(`[PluginManager] Plugin "${id}" is not installed.`);
124
91
  }
125
- /* ── Deactivate ─────────────────────────────────────────────── */
126
- async deactivate(id) {
127
- const instance = this.plugins.get(id);
128
- if (!instance || instance.state !== 'active') {
129
- return;
130
- }
131
- const ctx = this.createContext(instance);
132
- try {
133
- await instance.definition.deactivate?.(ctx);
134
- }
135
- catch (err) {
136
- if (typeof console !== 'undefined') {
137
- console.warn(`[PluginManager] Error deactivating "${id}":`, err);
138
- }
139
- }
140
- // Remove all extensions registered by this plugin
141
- for (const [point, entries] of instance.extensions) {
142
- const global = this.extensions.get(point);
143
- if (global) {
144
- for (const entry of entries) {
145
- const idx = global.indexOf(entry);
146
- if (idx >= 0) {
147
- global.splice(idx, 1);
148
- }
149
- }
150
- }
151
- }
152
- instance.extensions.clear();
153
- instance.state = 'inactive';
154
- instance.activatedAt = null;
155
- this.events.emit('plugin:deactivated', { id });
92
+ if (instance.state === "active") {
93
+ return;
156
94
  }
157
- /* ── Uninstall ──────────────────────────────────────────────── */
158
- async uninstall(id) {
159
- const instance = this.plugins.get(id);
160
- if (!instance) {
161
- return;
162
- }
163
- // Check if other plugins depend on this
164
- for (const [otherId, other] of this.plugins) {
165
- if (otherId === id) {
166
- continue;
167
- }
168
- if (other.definition.manifest.dependencies?.[id]) {
169
- throw new Error(`[PluginManager] Cannot uninstall "${id}": plugin "${otherId}" depends on it.`);
170
- }
171
- }
172
- if (instance.state === 'active') {
173
- await this.deactivate(id);
174
- }
175
- const ctx = this.createContext(instance);
176
- try {
177
- await instance.definition.uninstall?.(ctx);
178
- }
179
- catch (e) {
180
- console.warn(`Plugin '${id}' uninstall error:`, e);
181
- }
182
- this.plugins.delete(id);
183
- this.events.emit('plugin:uninstalled', { id });
95
+ const ctx = this.createContext(instance);
96
+ try {
97
+ await instance.definition.activate(ctx);
98
+ instance.state = "active";
99
+ instance.activatedAt = Date.now();
100
+ instance.error = null;
101
+ this.events.emit("plugin:activated", { id });
102
+ } catch (err) {
103
+ instance.state = "error";
104
+ instance.error = err instanceof Error ? err.message : String(err);
105
+ this.events.emit("plugin:error", { id, error: instance.error });
106
+ throw err;
184
107
  }
185
- /* ── Queries ────────────────────────────────────────────────── */
186
- getPlugin(id) {
187
- return this.plugins.get(id);
108
+ }
109
+ /* ── Deactivate ─────────────────────────────────────────────── */
110
+ async deactivate(id) {
111
+ const instance = this.plugins.get(id);
112
+ if (!instance || instance.state !== "active") {
113
+ return;
188
114
  }
189
- get allPlugins() {
190
- return Array.from(this.plugins.values());
115
+ const ctx = this.createContext(instance);
116
+ try {
117
+ await instance.definition.deactivate?.(ctx);
118
+ } catch (err) {
119
+ if (typeof console !== "undefined") {
120
+ console.warn(`[PluginManager] Error deactivating "${id}":`, err);
121
+ }
191
122
  }
192
- get activePlugins() {
193
- return this.allPlugins.filter((p) => p.state === 'active');
123
+ for (const [point, entries] of instance.extensions) {
124
+ const global = this.extensions.get(point);
125
+ if (global) {
126
+ for (const entry of entries) {
127
+ const idx = global.indexOf(entry);
128
+ if (idx >= 0) {
129
+ global.splice(idx, 1);
130
+ }
131
+ }
132
+ }
133
+ }
134
+ instance.extensions.clear();
135
+ instance.state = "inactive";
136
+ instance.activatedAt = null;
137
+ this.events.emit("plugin:deactivated", { id });
138
+ }
139
+ /* ── Uninstall ──────────────────────────────────────────────── */
140
+ async uninstall(id) {
141
+ const instance = this.plugins.get(id);
142
+ if (!instance) {
143
+ return;
194
144
  }
195
- getExtensions(point) {
196
- return (this.extensions.get(point) ?? []);
145
+ for (const [otherId, other] of this.plugins) {
146
+ if (otherId === id) {
147
+ continue;
148
+ }
149
+ if (other.definition.manifest.dependencies?.[id]) {
150
+ throw new Error(
151
+ `[PluginManager] Cannot uninstall "${id}": plugin "${otherId}" depends on it.`
152
+ );
153
+ }
197
154
  }
198
- /** Search plugins by keyword. */
199
- search(query) {
200
- const q = query.toLowerCase();
201
- return this.allPlugins.filter((p) => {
202
- const m = p.definition.manifest;
203
- return (m.name.toLowerCase().includes(q) ||
204
- m.description.toLowerCase().includes(q) ||
205
- m.keywords?.some((k) => k.toLowerCase().includes(q)) ||
206
- m.id.toLowerCase().includes(q));
207
- });
155
+ if (instance.state === "active") {
156
+ await this.deactivate(id);
208
157
  }
209
- /* ── Context factory ────────────────────────────────────────── */
210
- createContext(instance) {
211
- const manifest = instance.definition.manifest;
212
- const pluginId = manifest.id;
213
- const storage = new InMemoryPluginStorage(pluginId);
214
- return {
215
- manifest,
216
- events: this.events,
217
- storage,
218
- log: (msg) => {
219
- if (typeof console !== 'undefined') {
220
- console.log(`[Plugin:${pluginId}] ${msg}`);
221
- }
222
- },
223
- warn: (msg) => {
224
- if (typeof console !== 'undefined') {
225
- console.warn(`[Plugin:${pluginId}] ${msg}`);
226
- }
227
- },
228
- registerExtension: (point, entry) => {
229
- // Global
230
- let global = this.extensions.get(point);
231
- if (!global) {
232
- global = [];
233
- this.extensions.set(point, global);
234
- }
235
- global.push(entry);
236
- // Per-plugin tracking
237
- let pluginExts = instance.extensions.get(point);
238
- if (!pluginExts) {
239
- pluginExts = [];
240
- instance.extensions.set(point, pluginExts);
241
- }
242
- pluginExts.push(entry);
243
- this.events.emit('extension:registered', { pluginId, point });
244
- },
245
- unregisterExtension: (point, entry) => {
246
- const global = this.extensions.get(point);
247
- if (global) {
248
- const idx = global.indexOf(entry);
249
- if (idx >= 0) {
250
- global.splice(idx, 1);
251
- }
252
- }
253
- const pluginExts = instance.extensions.get(point);
254
- if (pluginExts) {
255
- const idx = pluginExts.indexOf(entry);
256
- if (idx >= 0) {
257
- pluginExts.splice(idx, 1);
258
- }
259
- }
260
- },
261
- };
158
+ const ctx = this.createContext(instance);
159
+ try {
160
+ await instance.definition.uninstall?.(ctx);
161
+ } catch (e) {
162
+ console.warn(`Plugin '${id}' uninstall error:`, e);
262
163
  }
263
- /* ── Lifecycle ──────────────────────────────────────────────── */
264
- /** Deactivate and remove all plugins. */
265
- async dispose() {
266
- const ids = Array.from(this.plugins.keys());
267
- for (const id of ids) {
268
- try {
269
- await this.uninstall(id);
270
- }
271
- catch (e) {
272
- console.warn(`Plugin '${id}' dispose error:`, e);
273
- }
164
+ this.plugins.delete(id);
165
+ this.events.emit("plugin:uninstalled", { id });
166
+ }
167
+ /* ── Queries ────────────────────────────────────────────────── */
168
+ getPlugin(id) {
169
+ return this.plugins.get(id);
170
+ }
171
+ get allPlugins() {
172
+ return Array.from(this.plugins.values());
173
+ }
174
+ get activePlugins() {
175
+ return this.allPlugins.filter((p) => p.state === "active");
176
+ }
177
+ getExtensions(point) {
178
+ return this.extensions.get(point) ?? [];
179
+ }
180
+ /** Search plugins by keyword. */
181
+ search(query) {
182
+ const q = query.toLowerCase();
183
+ return this.allPlugins.filter((p) => {
184
+ const m = p.definition.manifest;
185
+ return m.name.toLowerCase().includes(q) || m.description.toLowerCase().includes(q) || m.keywords?.some((k) => k.toLowerCase().includes(q)) || m.id.toLowerCase().includes(q);
186
+ });
187
+ }
188
+ /* ── Context factory ────────────────────────────────────────── */
189
+ createContext(instance) {
190
+ const manifest = instance.definition.manifest;
191
+ const pluginId = manifest.id;
192
+ const storage = new InMemoryPluginStorage(pluginId);
193
+ return {
194
+ manifest,
195
+ events: this.events,
196
+ storage,
197
+ log: (msg) => {
198
+ if (typeof console !== "undefined") {
199
+ console.log(`[Plugin:${pluginId}] ${msg}`);
200
+ }
201
+ },
202
+ warn: (msg) => {
203
+ if (typeof console !== "undefined") {
204
+ console.warn(`[Plugin:${pluginId}] ${msg}`);
205
+ }
206
+ },
207
+ registerExtension: (point, entry) => {
208
+ let global = this.extensions.get(point);
209
+ if (!global) {
210
+ global = [];
211
+ this.extensions.set(point, global);
212
+ }
213
+ global.push(entry);
214
+ let pluginExts = instance.extensions.get(point);
215
+ if (!pluginExts) {
216
+ pluginExts = [];
217
+ instance.extensions.set(point, pluginExts);
218
+ }
219
+ pluginExts.push(entry);
220
+ this.events.emit("extension:registered", { pluginId, point });
221
+ },
222
+ unregisterExtension: (point, entry) => {
223
+ const global = this.extensions.get(point);
224
+ if (global) {
225
+ const idx = global.indexOf(entry);
226
+ if (idx >= 0) {
227
+ global.splice(idx, 1);
228
+ }
274
229
  }
275
- this.extensions.clear();
230
+ const pluginExts = instance.extensions.get(point);
231
+ if (pluginExts) {
232
+ const idx = pluginExts.indexOf(entry);
233
+ if (idx >= 0) {
234
+ pluginExts.splice(idx, 1);
235
+ }
236
+ }
237
+ }
238
+ };
239
+ }
240
+ /* ── Lifecycle ──────────────────────────────────────────────── */
241
+ /** Deactivate and remove all plugins. */
242
+ async dispose() {
243
+ const ids = Array.from(this.plugins.keys());
244
+ for (const id of ids) {
245
+ try {
246
+ await this.uninstall(id);
247
+ } catch (e) {
248
+ console.warn(`Plugin '${id}' dispose error:`, e);
249
+ }
276
250
  }
251
+ this.extensions.clear();
252
+ }
277
253
  }
278
254
  const PLUGIN_TEMPLATES = [
279
- {
280
- type: 'component',
281
- name: 'Custom Component Plugin',
282
- description: 'Template for a plugin that adds a new ECS component type.',
283
- code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
284
-
285
- const plugin: PluginDefinition = {
286
- manifest: {
287
- id: 'com.example.health-component',
288
- name: 'Health Component',
289
- version: '1.0.0',
290
- description: 'Adds a Health component to the ECS.',
291
- author: 'Your Name',
292
- types: ['component'],
293
- engineVersion: '>=0.1.0',
294
- },
295
- activate(ctx: PluginContext) {
296
- ctx.registerExtension('component-type', {
297
- type: 'Health',
298
- defaults: { current: 100, max: 100, regeneration: 0 },
299
- });
300
- ctx.log('Health component registered');
301
- },
302
- deactivate(ctx: PluginContext) {
303
- ctx.log('Health component unregistered');
304
- },
305
- };
306
-
307
- export default plugin;`,
308
- },
309
- {
310
- type: 'system',
311
- name: 'Custom System Plugin',
312
- description: 'Template for a plugin that adds a new ECS system.',
313
- code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
314
-
315
- const plugin: PluginDefinition = {
316
- manifest: {
317
- id: 'com.example.damage-system',
318
- name: 'Damage System',
319
- version: '1.0.0',
320
- description: 'Processes damage events and updates health.',
321
- author: 'Your Name',
322
- types: ['system'],
323
- engineVersion: '>=0.1.0',
324
- },
325
- activate(ctx: PluginContext) {
326
- ctx.registerExtension('system-type', {
327
- name: 'DamageSystem',
328
- priority: 50,
329
- update: (world: unknown, dt: number) => {
330
- // Process damage events
331
- },
332
- });
333
- ctx.log('DamageSystem registered');
334
- },
335
- };
336
-
337
- export default plugin;`,
338
- },
339
- {
340
- type: 'node',
341
- name: 'Custom Node Plugin',
342
- description: 'Template for a plugin that adds visual scripting nodes.',
343
- code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
344
-
345
- const plugin: PluginDefinition = {
346
- manifest: {
347
- id: 'com.example.timer-nodes',
348
- name: 'Timer Nodes',
349
- version: '1.0.0',
350
- description: 'Adds timer and delay nodes to visual scripting.',
351
- author: 'Your Name',
352
- types: ['node'],
353
- engineVersion: '>=0.1.0',
354
- },
355
- activate(ctx: PluginContext) {
356
- ctx.registerExtension('node-type', {
357
- type: 'wait-seconds',
358
- name: 'Wait Seconds',
359
- category: 'flow',
360
- description: 'Waits for a specified number of seconds.',
361
- ports: [
362
- { id: 'flow-in', name: 'In', direction: 'input', dataType: 'flow' },
363
- { id: 'seconds', name: 'Seconds', direction: 'input', dataType: 'number', defaultValue: 1 },
364
- { id: 'flow-out', name: 'Out', direction: 'output', dataType: 'flow' },
365
- ],
366
- execute: (inputs: Record<string, unknown>) => {
367
- // Timer logic here
368
- return {};
369
- },
370
- });
371
- ctx.log('Timer nodes registered');
372
- },
373
- };
374
-
375
- export default plugin;`,
376
- },
377
- {
378
- type: 'editor-panel',
379
- name: 'Custom Editor Panel Plugin',
380
- description: 'Template for a plugin that adds a new panel to the editor.',
381
- code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
382
-
383
- const plugin: PluginDefinition = {
384
- manifest: {
385
- id: 'com.example.performance-panel',
386
- name: 'Performance Panel',
387
- version: '1.0.0',
388
- description: 'Adds a performance monitoring panel to the editor.',
389
- author: 'Your Name',
390
- types: ['editor-panel'],
391
- engineVersion: '>=0.1.0',
392
- },
393
- activate(ctx: PluginContext) {
394
- ctx.registerExtension('editor-panel', {
395
- id: 'perf-panel',
396
- title: 'Performance',
397
- icon: 'bar-chart',
398
- position: 'right',
399
- render: () => null, // React component
400
- });
401
- ctx.log('Performance panel registered');
402
- },
403
- };
404
-
405
- export default plugin;`,
406
- },
407
- {
408
- type: 'template',
409
- name: 'Game Template Plugin',
410
- description: 'Template for a plugin that adds a new game template.',
411
- code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
412
-
413
- const plugin: PluginDefinition = {
414
- manifest: {
415
- id: 'com.example.infinite-runner',
416
- name: 'Infinite Runner Template',
417
- version: '1.0.0',
418
- description: 'Adds an infinite runner game template.',
419
- author: 'Your Name',
420
- types: ['template'],
421
- engineVersion: '>=0.1.0',
422
- },
423
- activate(ctx: PluginContext) {
424
- ctx.registerExtension('game-template', {
425
- id: 'infinite-runner',
426
- name: 'Infinite Runner',
427
- description: 'An auto-scrolling endless runner game.',
428
- category: 'action',
429
- difficulty: 'beginner',
430
- setup: (engine: unknown) => {
431
- // Initialize template
432
- },
433
- });
434
- ctx.log('Infinite Runner template registered');
435
- },
436
- };
437
-
438
- export default plugin;`,
439
- },
255
+ {
256
+ type: "component",
257
+ name: "Custom Component Plugin",
258
+ description: "Template for a plugin that adds a new ECS component type.",
259
+ code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
260
+
261
+ const plugin: PluginDefinition = {
262
+ manifest: {
263
+ id: 'com.example.health-component',
264
+ name: 'Health Component',
265
+ version: '1.0.0',
266
+ description: 'Adds a Health component to the ECS.',
267
+ author: 'Your Name',
268
+ types: ['component'],
269
+ engineVersion: '>=0.1.0',
270
+ },
271
+ activate(ctx: PluginContext) {
272
+ ctx.registerExtension('component-type', {
273
+ type: 'Health',
274
+ defaults: { current: 100, max: 100, regeneration: 0 },
275
+ });
276
+ ctx.log('Health component registered');
277
+ },
278
+ deactivate(ctx: PluginContext) {
279
+ ctx.log('Health component unregistered');
280
+ },
281
+ };
282
+
283
+ export default plugin;`
284
+ },
285
+ {
286
+ type: "system",
287
+ name: "Custom System Plugin",
288
+ description: "Template for a plugin that adds a new ECS system.",
289
+ code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
290
+
291
+ const plugin: PluginDefinition = {
292
+ manifest: {
293
+ id: 'com.example.damage-system',
294
+ name: 'Damage System',
295
+ version: '1.0.0',
296
+ description: 'Processes damage events and updates health.',
297
+ author: 'Your Name',
298
+ types: ['system'],
299
+ engineVersion: '>=0.1.0',
300
+ },
301
+ activate(ctx: PluginContext) {
302
+ ctx.registerExtension('system-type', {
303
+ name: 'DamageSystem',
304
+ priority: 50,
305
+ update: (world: unknown, dt: number) => {
306
+ // Process damage events
307
+ },
308
+ });
309
+ ctx.log('DamageSystem registered');
310
+ },
311
+ };
312
+
313
+ export default plugin;`
314
+ },
315
+ {
316
+ type: "node",
317
+ name: "Custom Node Plugin",
318
+ description: "Template for a plugin that adds visual scripting nodes.",
319
+ code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
320
+
321
+ const plugin: PluginDefinition = {
322
+ manifest: {
323
+ id: 'com.example.timer-nodes',
324
+ name: 'Timer Nodes',
325
+ version: '1.0.0',
326
+ description: 'Adds timer and delay nodes to visual scripting.',
327
+ author: 'Your Name',
328
+ types: ['node'],
329
+ engineVersion: '>=0.1.0',
330
+ },
331
+ activate(ctx: PluginContext) {
332
+ ctx.registerExtension('node-type', {
333
+ type: 'wait-seconds',
334
+ name: 'Wait Seconds',
335
+ category: 'flow',
336
+ description: 'Waits for a specified number of seconds.',
337
+ ports: [
338
+ { id: 'flow-in', name: 'In', direction: 'input', dataType: 'flow' },
339
+ { id: 'seconds', name: 'Seconds', direction: 'input', dataType: 'number', defaultValue: 1 },
340
+ { id: 'flow-out', name: 'Out', direction: 'output', dataType: 'flow' },
341
+ ],
342
+ execute: (inputs: Record<string, unknown>) => {
343
+ // Timer logic here
344
+ return {};
345
+ },
346
+ });
347
+ ctx.log('Timer nodes registered');
348
+ },
349
+ };
350
+
351
+ export default plugin;`
352
+ },
353
+ {
354
+ type: "editor-panel",
355
+ name: "Custom Editor Panel Plugin",
356
+ description: "Template for a plugin that adds a new panel to the editor.",
357
+ code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
358
+
359
+ const plugin: PluginDefinition = {
360
+ manifest: {
361
+ id: 'com.example.performance-panel',
362
+ name: 'Performance Panel',
363
+ version: '1.0.0',
364
+ description: 'Adds a performance monitoring panel to the editor.',
365
+ author: 'Your Name',
366
+ types: ['editor-panel'],
367
+ engineVersion: '>=0.1.0',
368
+ },
369
+ activate(ctx: PluginContext) {
370
+ ctx.registerExtension('editor-panel', {
371
+ id: 'perf-panel',
372
+ title: 'Performance',
373
+ icon: 'bar-chart',
374
+ position: 'right',
375
+ render: () => null, // React component
376
+ });
377
+ ctx.log('Performance panel registered');
378
+ },
379
+ };
380
+
381
+ export default plugin;`
382
+ },
383
+ {
384
+ type: "template",
385
+ name: "Game Template Plugin",
386
+ description: "Template for a plugin that adds a new game template.",
387
+ code: `import type { PluginDefinition, PluginContext } from '@nice2dev/game-engine';
388
+
389
+ const plugin: PluginDefinition = {
390
+ manifest: {
391
+ id: 'com.example.infinite-runner',
392
+ name: 'Infinite Runner Template',
393
+ version: '1.0.0',
394
+ description: 'Adds an infinite runner game template.',
395
+ author: 'Your Name',
396
+ types: ['template'],
397
+ engineVersion: '>=0.1.0',
398
+ },
399
+ activate(ctx: PluginContext) {
400
+ ctx.registerExtension('game-template', {
401
+ id: 'infinite-runner',
402
+ name: 'Infinite Runner',
403
+ description: 'An auto-scrolling endless runner game.',
404
+ category: 'action',
405
+ difficulty: 'beginner',
406
+ setup: (engine: unknown) => {
407
+ // Initialize template
408
+ },
409
+ });
410
+ ctx.log('Infinite Runner template registered');
411
+ },
412
+ };
413
+
414
+ export default plugin;`
415
+ }
440
416
  ];
441
- /** Offline-capable marketplace API (can be backed by REST later). */
442
417
  class PluginMarketplace {
443
- constructor() {
444
- this.catalog = [];
445
- }
446
- /** Register entries in the catalog (for offline/bundled). */
447
- addEntries(entries) {
448
- for (const entry of entries) {
449
- const idx = this.catalog.findIndex((e) => e.id === entry.id);
450
- if (idx >= 0) {
451
- this.catalog[idx] = entry;
452
- }
453
- else {
454
- this.catalog.push(entry);
455
- }
456
- }
457
- }
458
- /** Search the marketplace. */
459
- search(query, options = {}) {
460
- const { type, free, page = 0, pageSize = 20 } = options;
461
- const q = query.toLowerCase();
462
- let results = this.catalog.filter((e) => {
463
- if (type && !e.types.includes(type)) {
464
- return false;
465
- }
466
- if (free !== undefined && e.free !== free) {
467
- return false;
468
- }
469
- if (q.length > 0) {
470
- return (e.name.toLowerCase().includes(q) ||
471
- e.description.toLowerCase().includes(q) ||
472
- e.keywords.some((k) => k.toLowerCase().includes(q)) ||
473
- e.author.toLowerCase().includes(q));
474
- }
475
- return true;
476
- });
477
- // Sort by rating then downloads
478
- results.sort((a, b) => b.rating - a.rating || b.downloads - a.downloads);
479
- const total = results.length;
480
- const start = page * pageSize;
481
- results = results.slice(start, start + pageSize);
482
- return { entries: results, total, page, pageSize };
483
- }
484
- /** Get a single entry by ID. */
485
- getEntry(id) {
486
- return this.catalog.find((e) => e.id === id);
487
- }
488
- /** Featured / top-rated plugins. */
489
- getFeatured(count = 5) {
490
- return this.catalog
491
- .slice()
492
- .sort((a, b) => b.rating - a.rating || b.downloads - a.downloads)
493
- .slice(0, count);
418
+ constructor() {
419
+ this.catalog = [];
420
+ }
421
+ /** Register entries in the catalog (for offline/bundled). */
422
+ addEntries(entries) {
423
+ for (const entry of entries) {
424
+ const idx = this.catalog.findIndex((e) => e.id === entry.id);
425
+ if (idx >= 0) {
426
+ this.catalog[idx] = entry;
427
+ } else {
428
+ this.catalog.push(entry);
429
+ }
494
430
  }
431
+ }
432
+ /** Search the marketplace. */
433
+ search(query, options = {}) {
434
+ const { type, free, page = 0, pageSize = 20 } = options;
435
+ const q = query.toLowerCase();
436
+ let results = this.catalog.filter((e) => {
437
+ if (type && !e.types.includes(type)) {
438
+ return false;
439
+ }
440
+ if (free !== void 0 && e.free !== free) {
441
+ return false;
442
+ }
443
+ if (q.length > 0) {
444
+ return e.name.toLowerCase().includes(q) || e.description.toLowerCase().includes(q) || e.keywords.some((k) => k.toLowerCase().includes(q)) || e.author.toLowerCase().includes(q);
445
+ }
446
+ return true;
447
+ });
448
+ results.sort((a, b) => b.rating - a.rating || b.downloads - a.downloads);
449
+ const total = results.length;
450
+ const start = page * pageSize;
451
+ results = results.slice(start, start + pageSize);
452
+ return { entries: results, total, page, pageSize };
453
+ }
454
+ /** Get a single entry by ID. */
455
+ getEntry(id) {
456
+ return this.catalog.find((e) => e.id === id);
457
+ }
458
+ /** Featured / top-rated plugins. */
459
+ getFeatured(count = 5) {
460
+ return this.catalog.slice().sort((a, b) => b.rating - a.rating || b.downloads - a.downloads).slice(0, count);
461
+ }
495
462
  }
496
-
497
463
  exports.PLUGIN_TEMPLATES = PLUGIN_TEMPLATES;
498
464
  exports.PluginManager = PluginManager;
499
465
  exports.PluginMarketplace = PluginMarketplace;