@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,821 +1,758 @@
1
- 'use strict';
2
-
3
- /**
4
- * @file TimelineEditor.ts
5
- * @description Timeline System for Cutscenes, Cinematics, and Sequencing
6
- * PRO-1.4: Professional Editor Features
7
- *
8
- * Features:
9
- * - Multi-track timeline
10
- * - Track types: animation, audio, event, property, activation
11
- * - Keyframe animation with curves
12
- * - Clips with blending
13
- * - Markers and events
14
- * - Playback control
15
- * - Recording mode
16
- * - Debugger integration
17
- */
18
- // ============================================================
19
- // Easing Implementation
20
- // ============================================================
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
21
3
  const easingFunctions = {
22
- linear: (t) => t,
23
- easeIn: (t) => t * t,
24
- easeOut: (t) => t * (2 - t),
25
- easeInOut: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
26
- easeInQuad: (t) => t * t,
27
- easeOutQuad: (t) => t * (2 - t),
28
- easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
29
- easeInCubic: (t) => t * t * t,
30
- easeOutCubic: (t) => --t * t * t + 1,
31
- easeInOutCubic: (t) => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1),
32
- easeInQuart: (t) => t * t * t * t,
33
- easeOutQuart: (t) => 1 - --t * t * t * t,
34
- easeInOutQuart: (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t),
35
- easeInQuint: (t) => t * t * t * t * t,
36
- easeOutQuint: (t) => 1 + --t * t * t * t * t,
37
- easeInOutQuint: (t) => (t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t),
38
- easeInSine: (t) => 1 - Math.cos((t * Math.PI) / 2),
39
- easeOutSine: (t) => Math.sin((t * Math.PI) / 2),
40
- easeInOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2,
41
- easeInExpo: (t) => (t === 0 ? 0 : Math.pow(2, 10 * t - 10)),
42
- easeOutExpo: (t) => (t === 1 ? 1 : 1 - Math.pow(2, -10 * t)),
43
- easeInOutExpo: (t) => {
44
- if (t === 0) {
45
- return 0;
46
- }
47
- if (t === 1) {
48
- return 1;
49
- }
50
- if (t < 0.5) {
51
- return Math.pow(2, 20 * t - 10) / 2;
52
- }
53
- return (2 - Math.pow(2, -20 * t + 10)) / 2;
54
- },
55
- easeInCirc: (t) => 1 - Math.sqrt(1 - t * t),
56
- easeOutCirc: (t) => Math.sqrt(1 - --t * t),
57
- easeInOutCirc: (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 : (Math.sqrt(1 - Math.pow(-2 * t + 2, 2)) + 1) / 2,
58
- easeInBack: (t) => {
59
- const c1 = 1.70158;
60
- const c3 = c1 + 1;
61
- return c3 * t * t * t - c1 * t * t;
62
- },
63
- easeOutBack: (t) => {
64
- const c1 = 1.70158;
65
- const c3 = c1 + 1;
66
- return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
67
- },
68
- easeInOutBack: (t) => {
69
- const c1 = 1.70158;
70
- const c2 = c1 * 1.525;
71
- return t < 0.5
72
- ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
73
- : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
74
- },
75
- easeInElastic: (t) => {
76
- if (t === 0) {
77
- return 0;
78
- }
79
- if (t === 1) {
80
- return 1;
81
- }
82
- const c4 = (2 * Math.PI) / 3;
83
- return -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
84
- },
85
- easeOutElastic: (t) => {
86
- if (t === 0) {
87
- return 0;
88
- }
89
- if (t === 1) {
90
- return 1;
91
- }
92
- const c4 = (2 * Math.PI) / 3;
93
- return Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
94
- },
95
- easeInOutElastic: (t) => {
96
- if (t === 0) {
97
- return 0;
98
- }
99
- if (t === 1) {
100
- return 1;
101
- }
102
- const c5 = (2 * Math.PI) / 4.5;
103
- return t < 0.5
104
- ? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2
105
- : (Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5)) / 2 + 1;
106
- },
107
- easeInBounce: (t) => 1 - easingFunctions.easeOutBounce(1 - t),
108
- easeOutBounce: (t) => {
109
- const n1 = 7.5625;
110
- const d1 = 2.75;
111
- if (t < 1 / d1) {
112
- return n1 * t * t;
113
- }
114
- else if (t < 2 / d1) {
115
- return n1 * (t -= 1.5 / d1) * t + 0.75;
116
- }
117
- else if (t < 2.5 / d1) {
118
- return n1 * (t -= 2.25 / d1) * t + 0.9375;
119
- }
120
- else {
121
- return n1 * (t -= 2.625 / d1) * t + 0.984375;
122
- }
123
- },
124
- easeInOutBounce: (t) => t < 0.5
125
- ? (1 - easingFunctions.easeOutBounce(1 - 2 * t)) / 2
126
- : (1 + easingFunctions.easeOutBounce(2 * t - 1)) / 2,
4
+ linear: (t) => t,
5
+ easeIn: (t) => t * t,
6
+ easeOut: (t) => t * (2 - t),
7
+ easeInOut: (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,
8
+ easeInQuad: (t) => t * t,
9
+ easeOutQuad: (t) => t * (2 - t),
10
+ easeInOutQuad: (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,
11
+ easeInCubic: (t) => t * t * t,
12
+ easeOutCubic: (t) => --t * t * t + 1,
13
+ easeInOutCubic: (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
14
+ easeInQuart: (t) => t * t * t * t,
15
+ easeOutQuart: (t) => 1 - --t * t * t * t,
16
+ easeInOutQuart: (t) => t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t,
17
+ easeInQuint: (t) => t * t * t * t * t,
18
+ easeOutQuint: (t) => 1 + --t * t * t * t * t,
19
+ easeInOutQuint: (t) => t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t,
20
+ easeInSine: (t) => 1 - Math.cos(t * Math.PI / 2),
21
+ easeOutSine: (t) => Math.sin(t * Math.PI / 2),
22
+ easeInOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2,
23
+ easeInExpo: (t) => t === 0 ? 0 : Math.pow(2, 10 * t - 10),
24
+ easeOutExpo: (t) => t === 1 ? 1 : 1 - Math.pow(2, -10 * t),
25
+ easeInOutExpo: (t) => {
26
+ if (t === 0) {
27
+ return 0;
28
+ }
29
+ if (t === 1) {
30
+ return 1;
31
+ }
32
+ if (t < 0.5) {
33
+ return Math.pow(2, 20 * t - 10) / 2;
34
+ }
35
+ return (2 - Math.pow(2, -20 * t + 10)) / 2;
36
+ },
37
+ easeInCirc: (t) => 1 - Math.sqrt(1 - t * t),
38
+ easeOutCirc: (t) => Math.sqrt(1 - --t * t),
39
+ easeInOutCirc: (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 : (Math.sqrt(1 - Math.pow(-2 * t + 2, 2)) + 1) / 2,
40
+ easeInBack: (t) => {
41
+ const c1 = 1.70158;
42
+ const c3 = c1 + 1;
43
+ return c3 * t * t * t - c1 * t * t;
44
+ },
45
+ easeOutBack: (t) => {
46
+ const c1 = 1.70158;
47
+ const c3 = c1 + 1;
48
+ return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
49
+ },
50
+ easeInOutBack: (t) => {
51
+ const c1 = 1.70158;
52
+ const c2 = c1 * 1.525;
53
+ return t < 0.5 ? Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2) / 2 : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
54
+ },
55
+ easeInElastic: (t) => {
56
+ if (t === 0) {
57
+ return 0;
58
+ }
59
+ if (t === 1) {
60
+ return 1;
61
+ }
62
+ const c4 = 2 * Math.PI / 3;
63
+ return -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
64
+ },
65
+ easeOutElastic: (t) => {
66
+ if (t === 0) {
67
+ return 0;
68
+ }
69
+ if (t === 1) {
70
+ return 1;
71
+ }
72
+ const c4 = 2 * Math.PI / 3;
73
+ return Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
74
+ },
75
+ easeInOutElastic: (t) => {
76
+ if (t === 0) {
77
+ return 0;
78
+ }
79
+ if (t === 1) {
80
+ return 1;
81
+ }
82
+ const c5 = 2 * Math.PI / 4.5;
83
+ return t < 0.5 ? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2 : Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5) / 2 + 1;
84
+ },
85
+ easeInBounce: (t) => 1 - easingFunctions.easeOutBounce(1 - t),
86
+ easeOutBounce: (t) => {
87
+ const n1 = 7.5625;
88
+ const d1 = 2.75;
89
+ if (t < 1 / d1) {
90
+ return n1 * t * t;
91
+ } else if (t < 2 / d1) {
92
+ return n1 * (t -= 1.5 / d1) * t + 0.75;
93
+ } else if (t < 2.5 / d1) {
94
+ return n1 * (t -= 2.25 / d1) * t + 0.9375;
95
+ } else {
96
+ return n1 * (t -= 2.625 / d1) * t + 0.984375;
97
+ }
98
+ },
99
+ easeInOutBounce: (t) => t < 0.5 ? (1 - easingFunctions.easeOutBounce(1 - 2 * t)) / 2 : (1 + easingFunctions.easeOutBounce(2 * t - 1)) / 2
127
100
  };
128
- function applyEasing(t, easing = 'linear') {
129
- return easingFunctions[easing](t);
101
+ function applyEasing(t, easing = "linear") {
102
+ return easingFunctions[easing](t);
130
103
  }
131
- // ============================================================
132
- // Curve Evaluation
133
- // ============================================================
134
104
  function evaluateCurve(curve, time) {
135
- const keyframes = curve.keyframes;
136
- if (keyframes.length === 0) {
137
- return 0;
138
- }
139
- if (keyframes.length === 1) {
140
- return keyframes[0].value;
141
- }
142
- // Handle pre/post infinity
143
- const firstKey = keyframes[0];
144
- const lastKey = keyframes[keyframes.length - 1];
145
- if (time <= firstKey.time) {
146
- return firstKey.value;
147
- }
148
- if (time >= lastKey.time) {
149
- return lastKey.value;
150
- }
151
- // Find surrounding keyframes
152
- let prevKey = firstKey;
153
- let nextKey = lastKey;
154
- for (let i = 0; i < keyframes.length - 1; i++) {
155
- if (time >= keyframes[i].time && time <= keyframes[i + 1].time) {
156
- prevKey = keyframes[i];
157
- nextKey = keyframes[i + 1];
158
- break;
159
- }
160
- }
161
- // Calculate local t
162
- const duration = nextKey.time - prevKey.time;
163
- const localT = duration > 0 ? (time - prevKey.time) / duration : 0;
164
- // Apply easing
165
- const easedT = applyEasing(localT, prevKey.easing || 'linear');
166
- // Interpolate
167
- if (prevKey.tangentMode === 'constant') {
168
- return prevKey.value;
169
- }
170
- // Bezier interpolation if tangents are specified
171
- if (prevKey.outTangent && nextKey.inTangent) {
172
- return bezierInterpolate(prevKey.value, prevKey.value + prevKey.outTangent.y * duration, nextKey.value + nextKey.inTangent.y * duration, nextKey.value, easedT);
173
- }
174
- // Linear interpolation
175
- return prevKey.value + (nextKey.value - prevKey.value) * easedT;
105
+ const keyframes = curve.keyframes;
106
+ if (keyframes.length === 0) {
107
+ return 0;
108
+ }
109
+ if (keyframes.length === 1) {
110
+ return keyframes[0].value;
111
+ }
112
+ const firstKey = keyframes[0];
113
+ const lastKey = keyframes[keyframes.length - 1];
114
+ if (time <= firstKey.time) {
115
+ return firstKey.value;
116
+ }
117
+ if (time >= lastKey.time) {
118
+ return lastKey.value;
119
+ }
120
+ let prevKey = firstKey;
121
+ let nextKey = lastKey;
122
+ for (let i = 0; i < keyframes.length - 1; i++) {
123
+ if (time >= keyframes[i].time && time <= keyframes[i + 1].time) {
124
+ prevKey = keyframes[i];
125
+ nextKey = keyframes[i + 1];
126
+ break;
127
+ }
128
+ }
129
+ const duration = nextKey.time - prevKey.time;
130
+ const localT = duration > 0 ? (time - prevKey.time) / duration : 0;
131
+ const easedT = applyEasing(localT, prevKey.easing || "linear");
132
+ if (prevKey.tangentMode === "constant") {
133
+ return prevKey.value;
134
+ }
135
+ if (prevKey.outTangent && nextKey.inTangent) {
136
+ return bezierInterpolate(
137
+ prevKey.value,
138
+ prevKey.value + prevKey.outTangent.y * duration,
139
+ nextKey.value + nextKey.inTangent.y * duration,
140
+ nextKey.value,
141
+ easedT
142
+ );
143
+ }
144
+ return prevKey.value + (nextKey.value - prevKey.value) * easedT;
176
145
  }
177
146
  function bezierInterpolate(p0, p1, p2, p3, t) {
178
- const mt = 1 - t;
179
- return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3;
147
+ const mt = 1 - t;
148
+ return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3;
180
149
  }
181
- // ============================================================
182
- // Timeline Player
183
- // ============================================================
184
150
  class TimelinePlayer {
185
- constructor(definition) {
186
- this.state = 'stopped';
187
- this.currentTime = 0;
188
- this.speed = 1;
189
- this.direction = 1; // 1 = forward, -1 = backward
190
- /** Active clips per track */
191
- this.activeClips = new Map();
192
- /** Previous time for detecting clip transitions */
193
- this.previousTime = 0;
194
- /** Event listeners */
195
- this.listeners = new Map();
196
- /** Property bindings */
197
- this.propertyBindings = new Map();
198
- this.audioNodes = new Map();
199
- /** Debug mode */
200
- this.debugMode = false;
201
- this.history = [];
202
- this.definition = definition;
203
- }
204
- // ─── Playback Control ────────────────────────────
205
- play() {
206
- if (this.state === 'playing') {
207
- return;
208
- }
209
- this.state = 'playing';
210
- this.emit('play');
211
- }
212
- pause() {
213
- if (this.state !== 'playing') {
214
- return;
215
- }
216
- this.state = 'paused';
217
- this.emit('pause');
218
- }
219
- stop() {
220
- this.state = 'stopped';
221
- this.currentTime = 0;
222
- this.previousTime = 0;
223
- this.activeClips.clear();
224
- this.stopAllAudio();
225
- this.emit('stop');
226
- }
227
- seek(time) {
228
- this.previousTime = this.currentTime;
229
- this.currentTime = Math.max(0, Math.min(time, this.definition.duration));
230
- this.emit('seek', { time: this.currentTime });
231
- }
232
- seekToMarker(markerName) {
233
- const marker = this.definition.markers.find((m) => m.name === markerName);
234
- if (marker) {
235
- this.seek(marker.time);
236
- return true;
237
- }
238
- return false;
239
- }
240
- setSpeed(speed) {
241
- this.speed = speed;
242
- this.direction = speed >= 0 ? 1 : -1;
243
- }
244
- getSpeed() {
245
- return this.speed;
246
- }
247
- // ─── Update ──────────────────────────────────────
248
- update(dt) {
249
- if (this.state !== 'playing') {
250
- return;
251
- }
252
- this.previousTime = this.currentTime;
253
- this.currentTime += dt * this.speed;
254
- // Handle wrap modes
255
- if (this.currentTime >= this.definition.duration) {
256
- switch (this.definition.wrapMode) {
257
- case 'once':
258
- this.currentTime = this.definition.duration;
259
- this.state = 'stopped';
260
- this.emit('complete');
261
- break;
262
- case 'loop':
263
- this.currentTime = this.currentTime % this.definition.duration;
264
- this.emit('loop');
265
- this.activeClips.clear();
266
- break;
267
- case 'pingPong':
268
- this.direction *= -1;
269
- this.currentTime =
270
- this.definition.duration - (this.currentTime - this.definition.duration);
271
- this.emit('loop');
272
- break;
273
- case 'clampForever':
274
- this.currentTime = this.definition.duration;
275
- break;
276
- }
277
- }
278
- else if (this.currentTime < 0) {
279
- switch (this.definition.wrapMode) {
280
- case 'once':
281
- this.currentTime = 0;
282
- this.state = 'stopped';
283
- this.emit('complete');
284
- break;
285
- case 'loop':
286
- this.currentTime = this.definition.duration + this.currentTime;
287
- this.emit('loop');
288
- this.activeClips.clear();
289
- break;
290
- case 'pingPong':
291
- this.direction *= -1;
292
- this.currentTime = -this.currentTime;
293
- this.emit('loop');
294
- break;
295
- case 'clampForever':
296
- this.currentTime = 0;
297
- break;
298
- }
299
- }
300
- // Process tracks
301
- this.processTracks();
302
- // Check markers
303
- this.processMarkers();
304
- }
305
- processTracks() {
306
- for (const track of this.definition.tracks) {
307
- if (track.muted) {
308
- continue;
309
- }
310
- this.processTrack(track);
311
- }
312
- }
313
- processTrack(track) {
314
- let activeSet = this.activeClips.get(track.id);
315
- if (!activeSet) {
316
- activeSet = new Set();
317
- this.activeClips.set(track.id, activeSet);
318
- }
319
- for (const clip of track.clips) {
320
- if (clip.muted) {
321
- continue;
151
+ constructor(definition) {
152
+ this.state = "stopped";
153
+ this.currentTime = 0;
154
+ this.speed = 1;
155
+ this.direction = 1;
156
+ this.activeClips = /* @__PURE__ */ new Map();
157
+ this.previousTime = 0;
158
+ this.listeners = /* @__PURE__ */ new Map();
159
+ this.propertyBindings = /* @__PURE__ */ new Map();
160
+ this.audioNodes = /* @__PURE__ */ new Map();
161
+ this.debugMode = false;
162
+ this.history = [];
163
+ this.definition = definition;
164
+ }
165
+ // ─── Playback Control ────────────────────────────
166
+ play() {
167
+ if (this.state === "playing") {
168
+ return;
169
+ }
170
+ this.state = "playing";
171
+ this.emit("play");
172
+ }
173
+ pause() {
174
+ if (this.state !== "playing") {
175
+ return;
176
+ }
177
+ this.state = "paused";
178
+ this.emit("pause");
179
+ }
180
+ stop() {
181
+ this.state = "stopped";
182
+ this.currentTime = 0;
183
+ this.previousTime = 0;
184
+ this.activeClips.clear();
185
+ this.stopAllAudio();
186
+ this.emit("stop");
187
+ }
188
+ seek(time) {
189
+ this.previousTime = this.currentTime;
190
+ this.currentTime = Math.max(0, Math.min(time, this.definition.duration));
191
+ this.emit("seek", { time: this.currentTime });
192
+ }
193
+ seekToMarker(markerName) {
194
+ const marker = this.definition.markers.find((m) => m.name === markerName);
195
+ if (marker) {
196
+ this.seek(marker.time);
197
+ return true;
198
+ }
199
+ return false;
200
+ }
201
+ setSpeed(speed) {
202
+ this.speed = speed;
203
+ this.direction = speed >= 0 ? 1 : -1;
204
+ }
205
+ getSpeed() {
206
+ return this.speed;
207
+ }
208
+ // ─── Update ──────────────────────────────────────
209
+ update(dt) {
210
+ if (this.state !== "playing") {
211
+ return;
212
+ }
213
+ this.previousTime = this.currentTime;
214
+ this.currentTime += dt * this.speed;
215
+ if (this.currentTime >= this.definition.duration) {
216
+ switch (this.definition.wrapMode) {
217
+ case "once":
218
+ this.currentTime = this.definition.duration;
219
+ this.state = "stopped";
220
+ this.emit("complete");
221
+ break;
222
+ case "loop":
223
+ this.currentTime = this.currentTime % this.definition.duration;
224
+ this.emit("loop");
225
+ this.activeClips.clear();
226
+ break;
227
+ case "pingPong":
228
+ this.direction *= -1;
229
+ this.currentTime = this.definition.duration - (this.currentTime - this.definition.duration);
230
+ this.emit("loop");
231
+ break;
232
+ case "clampForever":
233
+ this.currentTime = this.definition.duration;
234
+ break;
235
+ }
236
+ } else if (this.currentTime < 0) {
237
+ switch (this.definition.wrapMode) {
238
+ case "once":
239
+ this.currentTime = 0;
240
+ this.state = "stopped";
241
+ this.emit("complete");
242
+ break;
243
+ case "loop":
244
+ this.currentTime = this.definition.duration + this.currentTime;
245
+ this.emit("loop");
246
+ this.activeClips.clear();
247
+ break;
248
+ case "pingPong":
249
+ this.direction *= -1;
250
+ this.currentTime = -this.currentTime;
251
+ this.emit("loop");
252
+ break;
253
+ case "clampForever":
254
+ this.currentTime = 0;
255
+ break;
256
+ }
257
+ }
258
+ this.processTracks();
259
+ this.processMarkers();
260
+ }
261
+ processTracks() {
262
+ for (const track of this.definition.tracks) {
263
+ if (track.muted) {
264
+ continue;
265
+ }
266
+ this.processTrack(track);
267
+ }
268
+ }
269
+ processTrack(track) {
270
+ let activeSet = this.activeClips.get(track.id);
271
+ if (!activeSet) {
272
+ activeSet = /* @__PURE__ */ new Set();
273
+ this.activeClips.set(track.id, activeSet);
274
+ }
275
+ for (const clip of track.clips) {
276
+ if (clip.muted) {
277
+ continue;
278
+ }
279
+ const clipEnd = clip.startTime + clip.duration;
280
+ const wasActive = activeSet.has(clip.id);
281
+ const isActive = this.currentTime >= clip.startTime && this.currentTime < clipEnd;
282
+ if (isActive && !wasActive) {
283
+ activeSet.add(clip.id);
284
+ this.onClipEnter(track, clip);
285
+ }
286
+ if (!isActive && wasActive) {
287
+ activeSet.delete(clip.id);
288
+ this.onClipExit(track, clip);
289
+ }
290
+ if (isActive) {
291
+ const localTime = (this.currentTime - clip.startTime) * (clip.speed || 1);
292
+ this.updateClip(track, clip, localTime);
293
+ }
294
+ }
295
+ }
296
+ onClipEnter(track, clip) {
297
+ this.emit("clip-enter", { track, clip });
298
+ if (clip.type === "audio") {
299
+ this.playAudioClip(clip);
300
+ }
301
+ }
302
+ onClipExit(track, clip) {
303
+ this.emit("clip-exit", { track, clip });
304
+ if (clip.type === "event" && clip.fireMode === "on-exit") {
305
+ this.fireEventClip(clip);
306
+ }
307
+ if (clip.type === "audio") {
308
+ this.stopAudioClip(clip.id);
309
+ }
310
+ }
311
+ updateClip(track, clip, localTime) {
312
+ switch (clip.type) {
313
+ case "animation":
314
+ this.updateAnimationClip(clip, localTime);
315
+ break;
316
+ case "property":
317
+ this.updatePropertyClip(clip, localTime);
318
+ break;
319
+ case "event":
320
+ this.updateEventClip(clip, localTime);
321
+ break;
322
+ case "transform":
323
+ this.updateTransformClip(clip, localTime);
324
+ break;
325
+ case "camera":
326
+ this.updateCameraClip(clip, localTime);
327
+ break;
328
+ case "audio":
329
+ this.updateAudioClip(clip, localTime);
330
+ break;
331
+ }
332
+ }
333
+ updateAnimationClip(clip, localTime) {
334
+ for (const curve of clip.curves) {
335
+ const value = evaluateCurve(curve, localTime);
336
+ this.applyProperty(curve.property, value);
337
+ }
338
+ }
339
+ updatePropertyClip(clip, localTime) {
340
+ for (const curve of clip.curves) {
341
+ const value = evaluateCurve(curve, localTime);
342
+ this.applyProperty(clip.propertyPath + "." + curve.property, value);
343
+ }
344
+ }
345
+ updateEventClip(clip, localTime) {
346
+ if (clip.fireMode === "every-frame") {
347
+ this.fireEventClip(clip);
348
+ } else if (clip.fireMode === "once" && localTime < 0.016) {
349
+ this.fireEventClip(clip);
350
+ }
351
+ }
352
+ updateTransformClip(clip, localTime) {
353
+ if (clip.positionCurve) {
354
+ const x = evaluateCurve(clip.positionCurve.x, localTime);
355
+ const y = evaluateCurve(clip.positionCurve.y, localTime);
356
+ const z = evaluateCurve(clip.positionCurve.z, localTime);
357
+ this.applyProperty(`${clip.trackId}.position`, { x, y, z });
358
+ }
359
+ if (clip.rotationCurve) {
360
+ const x = evaluateCurve(clip.rotationCurve.x, localTime);
361
+ const y = evaluateCurve(clip.rotationCurve.y, localTime);
362
+ const z = evaluateCurve(clip.rotationCurve.z, localTime);
363
+ this.applyProperty(`${clip.trackId}.rotation`, { x, y, z });
364
+ }
365
+ if (clip.scaleCurve) {
366
+ const x = evaluateCurve(clip.scaleCurve.x, localTime);
367
+ const y = evaluateCurve(clip.scaleCurve.y, localTime);
368
+ const z = evaluateCurve(clip.scaleCurve.z, localTime);
369
+ this.applyProperty(`${clip.trackId}.scale`, { x, y, z });
370
+ }
371
+ }
372
+ updateCameraClip(clip, localTime) {
373
+ if (clip.fieldOfView) {
374
+ const fov = evaluateCurve(clip.fieldOfView, localTime);
375
+ this.applyProperty(`${clip.trackId}.fov`, fov);
376
+ }
377
+ if (clip.dof) {
378
+ const focusDistance = evaluateCurve(clip.dof.focusDistance, localTime);
379
+ const aperture = evaluateCurve(clip.dof.aperture, localTime);
380
+ const focalLength = evaluateCurve(clip.dof.focalLength, localTime);
381
+ this.applyProperty(`${clip.trackId}.dof`, { focusDistance, aperture, focalLength });
382
+ }
383
+ if (clip.shake) {
384
+ const amplitude = evaluateCurve(clip.shake.amplitude, localTime);
385
+ const frequency = evaluateCurve(clip.shake.frequency, localTime);
386
+ this.applyProperty(`${clip.trackId}.shake`, { amplitude, frequency });
387
+ }
388
+ }
389
+ updateAudioClip(clip, localTime) {
390
+ if (clip.volumeCurve) {
391
+ evaluateCurve(clip.volumeCurve, localTime);
392
+ this.audioNodes.get(clip.id);
393
+ }
394
+ }
395
+ fireEventClip(clip) {
396
+ this.emit("event", {
397
+ eventName: clip.eventName,
398
+ payload: clip.payload
399
+ });
400
+ }
401
+ // ─── Audio ───────────────────────────────────────
402
+ playAudioClip(_clip) {
403
+ }
404
+ stopAudioClip(clipId) {
405
+ const node = this.audioNodes.get(clipId);
406
+ if (node) {
407
+ node.stop();
408
+ this.audioNodes.delete(clipId);
409
+ }
410
+ }
411
+ stopAllAudio() {
412
+ for (const node of this.audioNodes.values()) {
413
+ node.stop();
414
+ }
415
+ this.audioNodes.clear();
416
+ }
417
+ // ─── Markers ─────────────────────────────────────
418
+ processMarkers() {
419
+ for (const marker of this.definition.markers) {
420
+ const crossedForward = this.previousTime < marker.time && this.currentTime >= marker.time;
421
+ const crossedBackward = this.previousTime > marker.time && this.currentTime <= marker.time;
422
+ if (crossedForward || crossedBackward) {
423
+ this.emit("marker", { marker });
424
+ if (marker.type === "signal" && marker.signalName) {
425
+ this.emit("signal", {
426
+ signalName: marker.signalName,
427
+ payload: marker.signalPayload
428
+ });
429
+ }
430
+ if (marker.type === "jump" && marker.jumpTarget) {
431
+ const targetMarker = this.definition.markers.find((m) => m.name === marker.jumpTarget);
432
+ if (targetMarker) {
433
+ if (!marker.jumpCondition || this.evaluateCondition(marker.jumpCondition)) {
434
+ this.seek(targetMarker.time);
322
435
  }
323
- const clipEnd = clip.startTime + clip.duration;
324
- const wasActive = activeSet.has(clip.id);
325
- const isActive = this.currentTime >= clip.startTime && this.currentTime < clipEnd;
326
- // Clip enter
327
- if (isActive && !wasActive) {
328
- activeSet.add(clip.id);
329
- this.onClipEnter(track, clip);
330
- }
331
- // Clip exit
332
- if (!isActive && wasActive) {
333
- activeSet.delete(clip.id);
334
- this.onClipExit(track, clip);
335
- }
336
- // Clip update
337
- if (isActive) {
338
- const localTime = (this.currentTime - clip.startTime) * (clip.speed || 1);
339
- this.updateClip(track, clip, localTime);
340
- }
341
- }
342
- }
343
- onClipEnter(track, clip) {
344
- this.emit('clip-enter', { track, clip });
345
- // Handle audio clips
346
- if (clip.type === 'audio') {
347
- this.playAudioClip(clip);
348
- }
349
- }
350
- onClipExit(track, clip) {
351
- this.emit('clip-exit', { track, clip });
352
- // Handle event clips with on-exit fire mode
353
- if (clip.type === 'event' && clip.fireMode === 'on-exit') {
354
- this.fireEventClip(clip);
355
- }
356
- // Stop audio
357
- if (clip.type === 'audio') {
358
- this.stopAudioClip(clip.id);
359
- }
360
- }
361
- updateClip(track, clip, localTime) {
362
- switch (clip.type) {
363
- case 'animation':
364
- this.updateAnimationClip(clip, localTime);
365
- break;
366
- case 'property':
367
- this.updatePropertyClip(clip, localTime);
368
- break;
369
- case 'event':
370
- this.updateEventClip(clip, localTime);
371
- break;
372
- case 'transform':
373
- this.updateTransformClip(clip, localTime);
374
- break;
375
- case 'camera':
376
- this.updateCameraClip(clip, localTime);
377
- break;
378
- case 'audio':
379
- this.updateAudioClip(clip, localTime);
380
- break;
381
- }
382
- }
383
- updateAnimationClip(clip, localTime) {
384
- for (const curve of clip.curves) {
385
- const value = evaluateCurve(curve, localTime);
386
- this.applyProperty(curve.property, value);
387
- }
388
- }
389
- updatePropertyClip(clip, localTime) {
390
- for (const curve of clip.curves) {
391
- const value = evaluateCurve(curve, localTime);
392
- this.applyProperty(clip.propertyPath + '.' + curve.property, value);
393
- }
394
- }
395
- updateEventClip(clip, localTime) {
396
- if (clip.fireMode === 'every-frame') {
397
- this.fireEventClip(clip);
398
- }
399
- else if (clip.fireMode === 'once' && localTime < 0.016) {
400
- // Fire once at the start (within one frame)
401
- this.fireEventClip(clip);
402
- }
403
- }
404
- updateTransformClip(clip, localTime) {
405
- if (clip.positionCurve) {
406
- const x = evaluateCurve(clip.positionCurve.x, localTime);
407
- const y = evaluateCurve(clip.positionCurve.y, localTime);
408
- const z = evaluateCurve(clip.positionCurve.z, localTime);
409
- this.applyProperty(`${clip.trackId}.position`, { x, y, z });
410
- }
411
- if (clip.rotationCurve) {
412
- const x = evaluateCurve(clip.rotationCurve.x, localTime);
413
- const y = evaluateCurve(clip.rotationCurve.y, localTime);
414
- const z = evaluateCurve(clip.rotationCurve.z, localTime);
415
- this.applyProperty(`${clip.trackId}.rotation`, { x, y, z });
416
- }
417
- if (clip.scaleCurve) {
418
- const x = evaluateCurve(clip.scaleCurve.x, localTime);
419
- const y = evaluateCurve(clip.scaleCurve.y, localTime);
420
- const z = evaluateCurve(clip.scaleCurve.z, localTime);
421
- this.applyProperty(`${clip.trackId}.scale`, { x, y, z });
422
- }
423
- }
424
- updateCameraClip(clip, localTime) {
425
- if (clip.fieldOfView) {
426
- const fov = evaluateCurve(clip.fieldOfView, localTime);
427
- this.applyProperty(`${clip.trackId}.fov`, fov);
428
- }
429
- if (clip.dof) {
430
- const focusDistance = evaluateCurve(clip.dof.focusDistance, localTime);
431
- const aperture = evaluateCurve(clip.dof.aperture, localTime);
432
- const focalLength = evaluateCurve(clip.dof.focalLength, localTime);
433
- this.applyProperty(`${clip.trackId}.dof`, { focusDistance, aperture, focalLength });
434
- }
435
- if (clip.shake) {
436
- const amplitude = evaluateCurve(clip.shake.amplitude, localTime);
437
- const frequency = evaluateCurve(clip.shake.frequency, localTime);
438
- this.applyProperty(`${clip.trackId}.shake`, { amplitude, frequency });
439
- }
440
- }
441
- updateAudioClip(clip, localTime) {
442
- if (clip.volumeCurve) {
443
- evaluateCurve(clip.volumeCurve, localTime);
444
- // Apply volume to audio node
445
- this.audioNodes.get(clip.id);
446
- // Volume adjustment would go here
447
- }
448
- }
449
- fireEventClip(clip) {
450
- this.emit('event', {
451
- eventName: clip.eventName,
452
- payload: clip.payload,
453
- });
454
- }
455
- // ─── Audio ───────────────────────────────────────
456
- playAudioClip(_clip) {
457
- // Audio playback would be implemented with Web Audio API
458
- // This is a placeholder for the interface
459
- }
460
- stopAudioClip(clipId) {
461
- const node = this.audioNodes.get(clipId);
462
- if (node) {
463
- node.stop();
464
- this.audioNodes.delete(clipId);
465
- }
466
- }
467
- stopAllAudio() {
468
- for (const node of this.audioNodes.values()) {
469
- node.stop();
470
- }
471
- this.audioNodes.clear();
472
- }
473
- // ─── Markers ─────────────────────────────────────
474
- processMarkers() {
475
- for (const marker of this.definition.markers) {
476
- // Check if we crossed the marker
477
- const crossedForward = this.previousTime < marker.time && this.currentTime >= marker.time;
478
- const crossedBackward = this.previousTime > marker.time && this.currentTime <= marker.time;
479
- if (crossedForward || crossedBackward) {
480
- this.emit('marker', { marker });
481
- if (marker.type === 'signal' && marker.signalName) {
482
- this.emit('signal', {
483
- signalName: marker.signalName,
484
- payload: marker.signalPayload,
485
- });
486
- }
487
- if (marker.type === 'jump' && marker.jumpTarget) {
488
- const targetMarker = this.definition.markers.find((m) => m.name === marker.jumpTarget);
489
- if (targetMarker) {
490
- // Check condition if present
491
- if (!marker.jumpCondition || this.evaluateCondition(marker.jumpCondition)) {
492
- this.seek(targetMarker.time);
493
- }
494
- }
495
- }
496
- }
497
- }
498
- }
499
- evaluateCondition(_condition) {
500
- // Simple condition evaluation - could be extended
501
- return true;
502
- }
503
- // ─── Property Binding ────────────────────────────
504
- bindProperty(path, setter) {
505
- this.propertyBindings.set(path, setter);
506
- }
507
- unbindProperty(path) {
508
- this.propertyBindings.delete(path);
509
- }
510
- applyProperty(path, value) {
511
- const binding = this.propertyBindings.get(path);
512
- if (binding) {
513
- binding(value);
514
- }
515
- }
516
- // ─── Events ──────────────────────────────────────
517
- on(event, listener) {
518
- let listeners = this.listeners.get(event);
519
- if (!listeners) {
520
- listeners = [];
521
- this.listeners.set(event, listeners);
522
- }
523
- listeners.push(listener);
524
- }
525
- off(event, listener) {
526
- const listeners = this.listeners.get(event);
527
- if (listeners) {
528
- const idx = listeners.indexOf(listener);
529
- if (idx >= 0) {
530
- listeners.splice(idx, 1);
531
- }
532
- }
533
- }
534
- emit(type, data) {
535
- const event = {
536
- type,
537
- time: this.currentTime,
538
- data,
539
- };
540
- if (this.debugMode) {
541
- this.history.push(event);
542
- if (this.history.length > 100) {
543
- this.history.shift();
544
- }
545
- }
546
- const listeners = this.listeners.get(type);
547
- if (listeners) {
548
- for (const listener of listeners) {
549
- listener(event);
550
- }
551
- }
552
- }
553
- // ─── State Queries ───────────────────────────────
554
- getState() {
555
- return this.state;
556
- }
557
- getCurrentTime() {
558
- return this.currentTime;
559
- }
560
- getDuration() {
561
- return this.definition.duration;
562
- }
563
- getProgress() {
564
- return this.definition.duration > 0 ? this.currentTime / this.definition.duration : 0;
565
- }
566
- isPlaying() {
567
- return this.state === 'playing';
568
- }
569
- isPaused() {
570
- return this.state === 'paused';
571
- }
572
- isStopped() {
573
- return this.state === 'stopped';
574
- }
575
- getDefinition() {
576
- return this.definition;
577
- }
578
- // ─── Debugging ───────────────────────────────────
579
- getHistory() {
580
- return [...this.history];
581
- }
582
- clearHistory() {
583
- this.history = [];
584
- }
585
- getDebugInfo() {
586
- let activeClipCount = 0;
587
- for (const set of this.activeClips.values()) {
588
- activeClipCount += set.size;
589
- }
590
- return {
591
- state: this.state,
592
- time: this.currentTime,
593
- duration: this.definition.duration,
594
- progress: this.getProgress(),
595
- speed: this.speed,
596
- activeClipCount,
597
- };
436
+ }
437
+ }
438
+ }
439
+ }
440
+ }
441
+ evaluateCondition(_condition) {
442
+ return true;
443
+ }
444
+ // ─── Property Binding ────────────────────────────
445
+ bindProperty(path, setter) {
446
+ this.propertyBindings.set(path, setter);
447
+ }
448
+ unbindProperty(path) {
449
+ this.propertyBindings.delete(path);
450
+ }
451
+ applyProperty(path, value) {
452
+ const binding = this.propertyBindings.get(path);
453
+ if (binding) {
454
+ binding(value);
455
+ }
456
+ }
457
+ // ─── Events ──────────────────────────────────────
458
+ on(event, listener) {
459
+ let listeners = this.listeners.get(event);
460
+ if (!listeners) {
461
+ listeners = [];
462
+ this.listeners.set(event, listeners);
463
+ }
464
+ listeners.push(listener);
465
+ }
466
+ off(event, listener) {
467
+ const listeners = this.listeners.get(event);
468
+ if (listeners) {
469
+ const idx = listeners.indexOf(listener);
470
+ if (idx >= 0) {
471
+ listeners.splice(idx, 1);
472
+ }
473
+ }
474
+ }
475
+ emit(type, data) {
476
+ const event = {
477
+ type,
478
+ time: this.currentTime,
479
+ data
480
+ };
481
+ if (this.debugMode) {
482
+ this.history.push(event);
483
+ if (this.history.length > 100) {
484
+ this.history.shift();
485
+ }
486
+ }
487
+ const listeners = this.listeners.get(type);
488
+ if (listeners) {
489
+ for (const listener of listeners) {
490
+ listener(event);
491
+ }
492
+ }
493
+ }
494
+ // ─── State Queries ───────────────────────────────
495
+ getState() {
496
+ return this.state;
497
+ }
498
+ getCurrentTime() {
499
+ return this.currentTime;
500
+ }
501
+ getDuration() {
502
+ return this.definition.duration;
503
+ }
504
+ getProgress() {
505
+ return this.definition.duration > 0 ? this.currentTime / this.definition.duration : 0;
506
+ }
507
+ isPlaying() {
508
+ return this.state === "playing";
509
+ }
510
+ isPaused() {
511
+ return this.state === "paused";
512
+ }
513
+ isStopped() {
514
+ return this.state === "stopped";
515
+ }
516
+ getDefinition() {
517
+ return this.definition;
518
+ }
519
+ // ─── Debugging ───────────────────────────────────
520
+ getHistory() {
521
+ return [...this.history];
522
+ }
523
+ clearHistory() {
524
+ this.history = [];
525
+ }
526
+ getDebugInfo() {
527
+ let activeClipCount = 0;
528
+ for (const set of this.activeClips.values()) {
529
+ activeClipCount += set.size;
598
530
  }
531
+ return {
532
+ state: this.state,
533
+ time: this.currentTime,
534
+ duration: this.definition.duration,
535
+ progress: this.getProgress(),
536
+ speed: this.speed,
537
+ activeClipCount
538
+ };
539
+ }
599
540
  }
600
541
  class TimelineRecorder {
601
- constructor(player, options) {
602
- this.recording = false;
603
- this.recordedKeyframes = new Map();
604
- this.lastSampleTime = 0;
605
- this.player = player;
606
- this.options = options;
607
- }
608
- startRecording() {
609
- this.recording = true;
610
- this.recordedKeyframes.clear();
611
- this.lastSampleTime = 0;
612
- }
613
- stopRecording() {
614
- this.recording = false;
615
- return new Map(this.recordedKeyframes);
616
- }
617
- isRecording() {
618
- return this.recording;
619
- }
620
- recordValue(property, value) {
621
- if (!this.recording) {
622
- return;
623
- }
624
- const time = this.player.getCurrentTime();
625
- const sampleRate = this.options.sampleRate || 30;
626
- const minInterval = 1 / sampleRate;
627
- // Check if enough time has passed
628
- if (time - this.lastSampleTime < minInterval) {
629
- return;
630
- }
631
- let keyframes = this.recordedKeyframes.get(property);
632
- if (!keyframes) {
633
- keyframes = [];
634
- this.recordedKeyframes.set(property, keyframes);
635
- }
636
- keyframes.push({
637
- id: `key_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
638
- time,
639
- value,
640
- easing: 'linear',
641
- });
642
- this.lastSampleTime = time;
643
- }
644
- getRecordedKeyframes() {
645
- return new Map(this.recordedKeyframes);
646
- }
542
+ constructor(player, options) {
543
+ this.recording = false;
544
+ this.recordedKeyframes = /* @__PURE__ */ new Map();
545
+ this.lastSampleTime = 0;
546
+ this.player = player;
547
+ this.options = options;
548
+ }
549
+ startRecording() {
550
+ this.recording = true;
551
+ this.recordedKeyframes.clear();
552
+ this.lastSampleTime = 0;
553
+ }
554
+ stopRecording() {
555
+ this.recording = false;
556
+ return new Map(this.recordedKeyframes);
557
+ }
558
+ isRecording() {
559
+ return this.recording;
560
+ }
561
+ recordValue(property, value) {
562
+ if (!this.recording) {
563
+ return;
564
+ }
565
+ const time = this.player.getCurrentTime();
566
+ const sampleRate = this.options.sampleRate || 30;
567
+ const minInterval = 1 / sampleRate;
568
+ if (time - this.lastSampleTime < minInterval) {
569
+ return;
570
+ }
571
+ let keyframes = this.recordedKeyframes.get(property);
572
+ if (!keyframes) {
573
+ keyframes = [];
574
+ this.recordedKeyframes.set(property, keyframes);
575
+ }
576
+ keyframes.push({
577
+ id: `key_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
578
+ time,
579
+ value,
580
+ easing: "linear"
581
+ });
582
+ this.lastSampleTime = time;
583
+ }
584
+ getRecordedKeyframes() {
585
+ return new Map(this.recordedKeyframes);
586
+ }
647
587
  }
648
- // ============================================================
649
- // Factory Functions
650
- // ============================================================
651
588
  function createTimelineDefinition(name, duration = 10) {
652
- return {
653
- id: `timeline_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
654
- name,
655
- description: '',
656
- duration,
657
- fps: 60,
658
- wrapMode: 'once',
659
- tracks: [],
660
- markers: [],
661
- };
589
+ return {
590
+ id: `timeline_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
591
+ name,
592
+ description: "",
593
+ duration,
594
+ fps: 60,
595
+ wrapMode: "once",
596
+ tracks: [],
597
+ markers: []
598
+ };
662
599
  }
663
600
  function createTimelinePlayer(definition) {
664
- return new TimelinePlayer(definition);
601
+ return new TimelinePlayer(definition);
665
602
  }
666
603
  function createTimelineRecorder(player, options) {
667
- return new TimelineRecorder(player, options);
604
+ return new TimelineRecorder(player, options);
668
605
  }
669
606
  function createTrack(name, type) {
670
- const baseTrack = {
671
- id: `track_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
672
- name,
673
- type,
674
- muted: false,
675
- locked: false,
676
- collapsed: false,
677
- clips: [],
678
- };
679
- switch (type) {
680
- case 'animation':
681
- return { ...baseTrack, type: 'animation' };
682
- case 'audio':
683
- return { ...baseTrack, type: 'audio', volume: 1 };
684
- case 'event':
685
- return { ...baseTrack, type: 'event' };
686
- case 'property':
687
- return {
688
- ...baseTrack,
689
- type: 'property',
690
- targetEntity: '',
691
- propertyPath: '',
692
- };
693
- case 'activation':
694
- return {
695
- ...baseTrack,
696
- type: 'activation',
697
- targetEntity: '',
698
- };
699
- case 'transform':
700
- return {
701
- ...baseTrack,
702
- type: 'transform',
703
- targetEntity: '',
704
- space: 'local',
705
- };
706
- case 'camera':
707
- return {
708
- ...baseTrack,
709
- type: 'camera',
710
- cameraEntity: '',
711
- };
712
- case 'group':
713
- return { ...baseTrack, type: 'group', children: [] };
714
- default:
715
- return baseTrack;
716
- }
607
+ const baseTrack = {
608
+ id: `track_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
609
+ name,
610
+ type,
611
+ muted: false,
612
+ locked: false,
613
+ collapsed: false,
614
+ clips: []
615
+ };
616
+ switch (type) {
617
+ case "animation":
618
+ return { ...baseTrack, type: "animation" };
619
+ case "audio":
620
+ return { ...baseTrack, type: "audio", volume: 1 };
621
+ case "event":
622
+ return { ...baseTrack, type: "event" };
623
+ case "property":
624
+ return {
625
+ ...baseTrack,
626
+ type: "property",
627
+ targetEntity: "",
628
+ propertyPath: ""
629
+ };
630
+ case "activation":
631
+ return {
632
+ ...baseTrack,
633
+ type: "activation",
634
+ targetEntity: ""
635
+ };
636
+ case "transform":
637
+ return {
638
+ ...baseTrack,
639
+ type: "transform",
640
+ targetEntity: "",
641
+ space: "local"
642
+ };
643
+ case "camera":
644
+ return {
645
+ ...baseTrack,
646
+ type: "camera",
647
+ cameraEntity: ""
648
+ };
649
+ case "group":
650
+ return { ...baseTrack, type: "group", children: [] };
651
+ default:
652
+ return baseTrack;
653
+ }
717
654
  }
718
655
  function createAnimationClip(trackId, startTime, duration) {
719
- return {
720
- id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
721
- name: 'Animation Clip',
722
- type: 'animation',
723
- trackId,
724
- startTime,
725
- duration,
726
- curves: [],
727
- };
656
+ return {
657
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
658
+ name: "Animation Clip",
659
+ type: "animation",
660
+ trackId,
661
+ startTime,
662
+ duration,
663
+ curves: []
664
+ };
728
665
  }
729
666
  function createAudioClip(trackId, startTime, duration, audioSource) {
730
- return {
731
- id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
732
- name: 'Audio Clip',
733
- type: 'audio',
734
- trackId,
735
- startTime,
736
- duration,
737
- audioSource,
738
- volume: 1,
739
- };
667
+ return {
668
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
669
+ name: "Audio Clip",
670
+ type: "audio",
671
+ trackId,
672
+ startTime,
673
+ duration,
674
+ audioSource,
675
+ volume: 1
676
+ };
740
677
  }
741
678
  function createEventClip(trackId, time, eventName) {
742
- return {
743
- id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
744
- name: eventName,
745
- type: 'event',
746
- trackId,
747
- startTime: time,
748
- duration: 0.01, // Instant
749
- eventName,
750
- fireMode: 'once',
751
- };
679
+ return {
680
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
681
+ name: eventName,
682
+ type: "event",
683
+ trackId,
684
+ startTime: time,
685
+ duration: 0.01,
686
+ // Instant
687
+ eventName,
688
+ fireMode: "once"
689
+ };
752
690
  }
753
691
  function createPropertyClip(trackId, startTime, duration, propertyPath) {
754
- return {
755
- id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
756
- name: 'Property Clip',
757
- type: 'property',
758
- trackId,
759
- startTime,
760
- duration,
761
- propertyPath,
762
- curves: [],
763
- };
692
+ return {
693
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
694
+ name: "Property Clip",
695
+ type: "property",
696
+ trackId,
697
+ startTime,
698
+ duration,
699
+ propertyPath,
700
+ curves: []
701
+ };
764
702
  }
765
703
  function createTransformClip(trackId, startTime, duration) {
766
- return {
767
- id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
768
- name: 'Transform Clip',
769
- type: 'transform',
770
- trackId,
771
- startTime,
772
- duration,
773
- };
704
+ return {
705
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
706
+ name: "Transform Clip",
707
+ type: "transform",
708
+ trackId,
709
+ startTime,
710
+ duration
711
+ };
774
712
  }
775
713
  function createCameraClip(trackId, startTime, duration) {
776
- return {
777
- id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
778
- name: 'Camera Clip',
779
- type: 'camera',
780
- trackId,
781
- startTime,
782
- duration,
783
- };
714
+ return {
715
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
716
+ name: "Camera Clip",
717
+ type: "camera",
718
+ trackId,
719
+ startTime,
720
+ duration
721
+ };
784
722
  }
785
723
  function createAnimationCurve(property) {
786
- return {
787
- id: `curve_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
788
- property,
789
- keyframes: [],
790
- };
724
+ return {
725
+ id: `curve_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
726
+ property,
727
+ keyframes: []
728
+ };
791
729
  }
792
- function createKeyframe(time, value, easing = 'linear') {
793
- return {
794
- id: `key_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
795
- time,
796
- value,
797
- easing,
798
- };
730
+ function createKeyframe(time, value, easing = "linear") {
731
+ return {
732
+ id: `key_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
733
+ time,
734
+ value,
735
+ easing
736
+ };
799
737
  }
800
738
  function createMarker(name, time) {
801
- return {
802
- id: `marker_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
803
- name,
804
- time,
805
- type: 'marker',
806
- };
739
+ return {
740
+ id: `marker_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
741
+ name,
742
+ time,
743
+ type: "marker"
744
+ };
807
745
  }
808
746
  function createSignalMarker(name, time, signalName, payload) {
809
- return {
810
- id: `marker_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
811
- name,
812
- time,
813
- type: 'signal',
814
- signalName,
815
- signalPayload: payload,
816
- };
747
+ return {
748
+ id: `marker_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
749
+ name,
750
+ time,
751
+ type: "signal",
752
+ signalName,
753
+ signalPayload: payload
754
+ };
817
755
  }
818
-
819
756
  exports.TimelinePlayer = TimelinePlayer;
820
757
  exports.TimelineRecorder = TimelineRecorder;
821
758
  exports.applyEasing = applyEasing;