1681-engine 0.5.8 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (724) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +3 -0
  3. package/dist/1681-engine.js +526 -409
  4. package/dist/ambient/ColorGrade.js +0 -1
  5. package/dist/ambient/DayClock.js +0 -1
  6. package/dist/ambient/WeatherLayer.js +0 -1
  7. package/dist/ambient/grade.js +0 -1
  8. package/dist/ambient/life/Birds.js +73 -0
  9. package/dist/ambient/life/Butterflies.js +43 -0
  10. package/dist/ambient/life/ChimneySmoke.js +50 -0
  11. package/dist/ambient/life/Drift.js +75 -0
  12. package/dist/ambient/life/Fireflies.js +52 -0
  13. package/dist/ambient/life/lifeMotion.js +49 -0
  14. package/dist/ambient/weather.js +0 -1
  15. package/dist/anim/AnimStateMachine.js +0 -1
  16. package/dist/anim/Animator.js +0 -1
  17. package/dist/anim/animStateCompile.js +0 -1
  18. package/dist/anim/animStateSystem.js +0 -1
  19. package/dist/anim/animationSystem.js +0 -1
  20. package/dist/anim/asepriteSlices.js +0 -1
  21. package/dist/anim/asepriteTags.js +0 -1
  22. package/dist/anim/parseAseprite.js +0 -1
  23. package/dist/assets/AssetLoader.js +177 -34
  24. package/dist/assets/Prepainter.js +61 -0
  25. package/dist/assets/loadAseprite.js +0 -1
  26. package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +0 -1
  27. package/dist/assets/textureAtlas.js +58 -0
  28. package/dist/assets/workerPainter.js +39 -0
  29. package/dist/audio/Footsteps.js +0 -1
  30. package/dist/audio/MusicPlayer.js +0 -1
  31. package/dist/audio/SoundEngine.js +13 -7
  32. package/dist/audio/cleanTake.js +0 -1
  33. package/dist/audio/music/ElementVoice.js +0 -1
  34. package/dist/audio/music/GraphVoice.js +0 -1
  35. package/dist/audio/music/MusicChannel.js +0 -1
  36. package/dist/audio/music/musicVoice.js +0 -1
  37. package/dist/audio/sampleBank.js +0 -1
  38. package/dist/audio/soundTable.js +0 -1
  39. package/dist/audio/synth.js +0 -1
  40. package/dist/cjs/electron/electronLike.d.ts +55 -0
  41. package/dist/cjs/electron/electronLike.js +7 -0
  42. package/dist/cjs/electron/index.d.ts +14 -0
  43. package/dist/cjs/electron/index.js +20 -0
  44. package/dist/cjs/electron/lockdown.d.ts +33 -0
  45. package/dist/cjs/electron/lockdown.js +69 -0
  46. package/dist/cjs/electron/lockdownRules.d.ts +28 -0
  47. package/dist/cjs/electron/lockdownRules.js +61 -0
  48. package/dist/cjs/electron/sessionStore.d.ts +40 -0
  49. package/dist/cjs/electron/sessionStore.js +77 -0
  50. package/dist/cjs/electron/shellId.d.ts +22 -0
  51. package/dist/cjs/electron/shellId.js +31 -0
  52. package/dist/cjs/electron/webFiles.d.ts +13 -0
  53. package/dist/cjs/electron/webFiles.js +52 -0
  54. package/dist/cjs/electron/webPatcher.d.ts +80 -0
  55. package/dist/cjs/electron/webPatcher.js +216 -0
  56. package/dist/cjs/electron/webPointers.d.ts +19 -0
  57. package/dist/cjs/electron/webPointers.js +35 -0
  58. package/dist/cjs/package.json +1 -0
  59. package/dist/cjs/updates/index.d.ts +8 -0
  60. package/dist/cjs/updates/index.js +21 -0
  61. package/dist/cjs/updates/manifest.d.ts +73 -0
  62. package/dist/cjs/updates/manifest.js +67 -0
  63. package/dist/cjs/updates/pickUpdate.d.ts +42 -0
  64. package/dist/cjs/updates/pickUpdate.js +52 -0
  65. package/dist/cjs/updates/webPlan.d.ts +20 -0
  66. package/dist/cjs/updates/webPlan.js +34 -0
  67. package/dist/core/BitmapLabel.js +0 -1
  68. package/dist/core/Camera.js +1 -2
  69. package/dist/core/Clock.js +31 -21
  70. package/dist/core/Graphics.js +0 -1
  71. package/dist/core/Group.js +0 -1
  72. package/dist/core/Image.js +0 -1
  73. package/dist/core/ObjectFactory.js +0 -1
  74. package/dist/core/Pointer.js +46 -24
  75. package/dist/core/Rectangle.js +0 -1
  76. package/dist/core/Stage.js +5 -6
  77. package/dist/core/Text.js +0 -1
  78. package/dist/core/TextureRegistry.js +54 -24
  79. package/dist/core/Timeline.js +0 -1
  80. package/dist/core/TimelineBuilder.js +0 -1
  81. package/dist/core/TimelineChild.js +0 -1
  82. package/dist/core/Tweener.js +0 -1
  83. package/dist/core/atlas.js +0 -1
  84. package/dist/core/atlasPlan.js +0 -1
  85. package/dist/core/blendLayer.js +11 -0
  86. package/dist/core/eases.js +0 -1
  87. package/dist/core/gameObject.js +22 -20
  88. package/dist/core/pixelZoom.js +43 -0
  89. package/dist/core/pixiPatches.js +0 -1
  90. package/dist/core/runDue.js +28 -0
  91. package/dist/core/silhouette.js +49 -0
  92. package/dist/core/timelinePlace.js +0 -1
  93. package/dist/core/tweenProps.js +0 -1
  94. package/dist/debug/DebugOverlay.js +0 -1
  95. package/dist/debug/DrawCallCounter.js +15 -12
  96. package/dist/debug/ErrorLog.js +0 -1
  97. package/dist/debug/FrameStats.js +0 -1
  98. package/dist/debug/inspectWorld.js +0 -1
  99. package/dist/diagnostics/ErrorDeduper.js +0 -1
  100. package/dist/diagnostics/FrameSampler.js +0 -1
  101. package/dist/diagnostics/bootWatch.js +0 -1
  102. package/dist/diagnostics/captureErrors.js +0 -1
  103. package/dist/diagnostics/contextLoss.js +0 -1
  104. package/dist/diagnostics/frameStats.js +0 -1
  105. package/dist/diagnostics/gpuInfo.js +0 -1
  106. package/dist/diagnostics/renderGuard.js +0 -1
  107. package/dist/ecs/SparseSet.js +0 -1
  108. package/dist/ecs/World.js +0 -1
  109. package/dist/ecs/fields.js +0 -1
  110. package/dist/electron/lockdown.js +31 -0
  111. package/dist/electron/lockdownRules.js +42 -0
  112. package/dist/electron/sessionStore.js +48 -0
  113. package/dist/electron/shellId.js +18 -0
  114. package/dist/electron/webFiles.js +36 -0
  115. package/dist/electron/webPatcher.js +147 -0
  116. package/dist/electron/webPointers.js +25 -0
  117. package/dist/electron.js +19 -0
  118. package/dist/engine/Engine.js +42 -18
  119. package/dist/engine/FixedLoop.js +0 -1
  120. package/dist/engine/HiddenPause.js +27 -0
  121. package/dist/engine/Scene.js +0 -1
  122. package/dist/engine/SceneManager.js +0 -1
  123. package/dist/events/EventBus.js +0 -1
  124. package/dist/fx/Afterimages.js +82 -0
  125. package/dist/fx/FloatingText.js +0 -1
  126. package/dist/fx/hitStop.js +0 -1
  127. package/dist/fx/viewCull.js +0 -1
  128. package/dist/i18n/Translator.js +0 -1
  129. package/dist/i18n/extractStrings.js +0 -1
  130. package/dist/i18n/formatMessage.js +0 -1
  131. package/dist/input/Actions.js +29 -21
  132. package/dist/input/AimGesture.js +0 -1
  133. package/dist/input/Keyboard.js +0 -1
  134. package/dist/input/Keymap.js +0 -1
  135. package/dist/input/TargetLock.js +0 -1
  136. package/dist/input/aimAxis.js +0 -1
  137. package/dist/input/haptics.js +50 -0
  138. package/dist/input/keyChord.js +0 -1
  139. package/dist/input/longPress.js +0 -1
  140. package/dist/input/rumble.js +42 -0
  141. package/dist/input/stickAxis.js +0 -1
  142. package/dist/input/touchDetect.js +0 -1
  143. package/dist/light/LightLayer.js +0 -1
  144. package/dist/nav/MinHeap.js +0 -1
  145. package/dist/nav/findPath.js +0 -1
  146. package/dist/nav/navGrid.js +0 -1
  147. package/dist/nav/nearestOpen.js +0 -1
  148. package/dist/nav/straightenPath.js +0 -1
  149. package/dist/net/ApiClient.js +96 -0
  150. package/dist/net/Connection.js +39 -16
  151. package/dist/net/InterpolationBuffer.js +0 -1
  152. package/dist/net/PredictedMover.js +0 -1
  153. package/dist/net/Room.js +0 -1
  154. package/dist/net/RoomHost.js +0 -1
  155. package/dist/net/cadence.js +0 -1
  156. package/dist/net/constants.js +0 -1
  157. package/dist/net/lobby/LobbyClient.js +0 -1
  158. package/dist/net/lobby/LobbyHost.js +0 -1
  159. package/dist/net/lobby/LobbyRooms.js +0 -1
  160. package/dist/net/lobby/Matchmaker.js +0 -1
  161. package/dist/net/movement.js +40 -39
  162. package/dist/net/protocol.js +0 -1
  163. package/dist/net/reconnect.js +10 -0
  164. package/dist/net/serverClock.js +0 -1
  165. package/dist/net/snapshotCodec.js +0 -1
  166. package/dist/parallax/Parallax.js +0 -1
  167. package/dist/parallax/ParallaxLayer.js +0 -1
  168. package/dist/parallax/parallaxMath.js +0 -1
  169. package/dist/particles/Emitter.js +0 -1
  170. package/dist/particles/ParticleBudget.js +0 -1
  171. package/dist/particles/ParticleSim.js +0 -1
  172. package/dist/particles/particleCurves.js +0 -1
  173. package/dist/particles/particleSampling.js +0 -1
  174. package/dist/physics/Body.js +0 -1
  175. package/dist/physics/BroadPhase.js +0 -1
  176. package/dist/physics/Contact.js +0 -1
  177. package/dist/physics/ContactSolver.js +0 -1
  178. package/dist/physics/PhysicsWorld.js +0 -1
  179. package/dist/physics/SpatialHash.js +0 -1
  180. package/dist/physics/collide.js +0 -1
  181. package/dist/physics/collidePolygon.js +0 -1
  182. package/dist/physics/contactReport.js +0 -1
  183. package/dist/physics/drawColliders.js +0 -1
  184. package/dist/physics/physicsSystem.js +0 -1
  185. package/dist/physics/polygon.js +0 -1
  186. package/dist/physics/raycast.js +0 -1
  187. package/dist/physics/syncToBody.js +0 -1
  188. package/dist/physics/tileBodies.js +0 -1
  189. package/dist/physics/types.js +0 -1
  190. package/dist/pixel/Darkness.js +50 -47
  191. package/dist/pixel/DitherVignette.js +0 -1
  192. package/dist/pixel/Evaporation.js +0 -1
  193. package/dist/pixel/NightShade.js +0 -1
  194. package/dist/pixel/PixelLayer.js +0 -1
  195. package/dist/pixel/PixelMarks.js +99 -0
  196. package/dist/pixel/SwayProp.js +0 -1
  197. package/dist/pixel/aimPixels.js +67 -0
  198. package/dist/pixel/lifeArt.js +83 -0
  199. package/dist/pixel/lights.js +0 -1
  200. package/dist/pixel/nineSlice.js +0 -1
  201. package/dist/pixel/paintLayer.js +0 -1
  202. package/dist/pixel/palette.js +0 -1
  203. package/dist/pixel/pixel.js +0 -1
  204. package/dist/pixel/pixelPaint.js +27 -24
  205. package/dist/pixel/pixelParticles.js +35 -0
  206. package/dist/pixel/pixelTone.js +0 -1
  207. package/dist/pixel/propKit.js +0 -1
  208. package/dist/pixel/ramp.js +0 -1
  209. package/dist/pixel/selout.js +0 -1
  210. package/dist/pixel/spritePixels.js +0 -1
  211. package/dist/pixel/swayRig.js +0 -1
  212. package/dist/pixel/vignetteMask.js +0 -1
  213. package/dist/pixel/weatherArt.js +0 -1
  214. package/dist/pixel.js +82 -71
  215. package/dist/platform/appResume.js +18 -0
  216. package/dist/platform/fullscreen.js +52 -0
  217. package/dist/platform/orientation.js +26 -0
  218. package/dist/platform/pointerLock.js +37 -0
  219. package/dist/platform/reducedMotion.js +23 -0
  220. package/dist/platform/timeoutSignal.js +14 -0
  221. package/dist/platform/touch.js +0 -1
  222. package/dist/postfx/BloomFilter.js +0 -1
  223. package/dist/postfx/ChromaticAberrationFilter.js +0 -1
  224. package/dist/postfx/ColorAdjustFilter.js +0 -1
  225. package/dist/postfx/CrtFilter.js +0 -1
  226. package/dist/postfx/PixelateFilter.js +0 -1
  227. package/dist/postfx/PostFx.js +0 -1
  228. package/dist/postfx/ShockwaveFilter.js +0 -1
  229. package/dist/postfx/VignetteFilter.js +0 -1
  230. package/dist/postfx/fxAnimator.js +0 -1
  231. package/dist/postfx/fxShader.js +0 -1
  232. package/dist/postfx.js +0 -1
  233. package/dist/react/ChoiceDialog.js +0 -1
  234. package/dist/react/ConfirmButton.js +24 -0
  235. package/dist/react/ConfirmDialog.js +0 -1
  236. package/dist/react/Glyph.js +0 -1
  237. package/dist/react/Modal.js +0 -1
  238. package/dist/react/Panel.js +0 -1
  239. package/dist/react/PixelImage.js +0 -1
  240. package/dist/react/Select.js +0 -1
  241. package/dist/react/Slider.js +0 -1
  242. package/dist/react/SplitPane.js +0 -1
  243. package/dist/react/TabStrip.js +0 -1
  244. package/dist/react/TitleTips.js +0 -1
  245. package/dist/react/Tooltip.js +0 -1
  246. package/dist/react/UiProvider.js +0 -1
  247. package/dist/react/baseCss.js +1 -1
  248. package/dist/react/choiceStore.js +0 -1
  249. package/dist/react/classNames.js +0 -1
  250. package/dist/react/confirmStore.js +0 -1
  251. package/dist/react/labels.js +7 -7
  252. package/dist/react/placement.js +0 -1
  253. package/dist/react/useFillSheet.js +0 -1
  254. package/dist/react/useFitToViewport.js +0 -1
  255. package/dist/react/useJsonSelector.js +13 -0
  256. package/dist/react/usePicked.js +0 -1
  257. package/dist/react/useStore.js +0 -1
  258. package/dist/react/useViewport.js +0 -1
  259. package/dist/react.js +73 -69
  260. package/dist/rig/PosePlayer.js +0 -1
  261. package/dist/rig/RigView.js +0 -1
  262. package/dist/rig/Skeleton.js +0 -1
  263. package/dist/rig/humanoid.js +0 -1
  264. package/dist/rig/humanoid.json.js +0 -1
  265. package/dist/rig/humanoidPoses.js +0 -1
  266. package/dist/rig/poseMath.js +0 -1
  267. package/dist/rig/poses.json.js +0 -1
  268. package/dist/save/Autosaver.js +0 -1
  269. package/dist/save/MemoryBackend.js +0 -1
  270. package/dist/save/SaveStore.js +0 -1
  271. package/dist/save/WebStorageBackend.js +0 -1
  272. package/dist/save/checksum.js +0 -1
  273. package/dist/save/migrateSave.js +0 -1
  274. package/dist/settings.js +0 -1
  275. package/dist/tilemap/TilemapView.js +57 -33
  276. package/dist/tilemap/autotile.js +103 -0
  277. package/dist/tilemap/collision.js +29 -19
  278. package/dist/tilemap/ldtk.js +21 -0
  279. package/dist/tilemap/ldtkParse.js +191 -0
  280. package/dist/tilemap/tiled.js +0 -1
  281. package/dist/transitions/CrossfadeTransition.js +0 -1
  282. package/dist/transitions/DitherWipeTransition.js +0 -1
  283. package/dist/transitions/FadeTransition.js +0 -1
  284. package/dist/transitions/Letterbox.js +0 -1
  285. package/dist/transitions/ditherMask.js +0 -1
  286. package/dist/transitions/transitionTo.js +0 -1
  287. package/dist/transitions/tweenDone.js +0 -1
  288. package/dist/types/ambient/life/Birds.d.ts +50 -0
  289. package/dist/types/ambient/life/Birds.d.ts.map +1 -0
  290. package/dist/types/ambient/life/Butterflies.d.ts +32 -0
  291. package/dist/types/ambient/life/Butterflies.d.ts.map +1 -0
  292. package/dist/types/ambient/life/ChimneySmoke.d.ts +37 -0
  293. package/dist/types/ambient/life/ChimneySmoke.d.ts.map +1 -0
  294. package/dist/types/ambient/life/Drift.d.ts +58 -0
  295. package/dist/types/ambient/life/Drift.d.ts.map +1 -0
  296. package/dist/types/ambient/life/Fireflies.d.ts +43 -0
  297. package/dist/types/ambient/life/Fireflies.d.ts.map +1 -0
  298. package/dist/types/ambient/life/lifeMotion.d.ts +63 -0
  299. package/dist/types/ambient/life/lifeMotion.d.ts.map +1 -0
  300. package/dist/types/assets/AssetLoader.d.ts +83 -8
  301. package/dist/types/assets/AssetLoader.d.ts.map +1 -1
  302. package/dist/types/assets/Prepainter.d.ts +64 -0
  303. package/dist/types/assets/Prepainter.d.ts.map +1 -0
  304. package/dist/types/assets/textureAtlas.d.ts +35 -0
  305. package/dist/types/assets/textureAtlas.d.ts.map +1 -0
  306. package/dist/types/assets/workerPainter.d.ts +21 -0
  307. package/dist/types/assets/workerPainter.d.ts.map +1 -0
  308. package/dist/types/audio/SoundEngine.d.ts +5 -0
  309. package/dist/types/audio/SoundEngine.d.ts.map +1 -1
  310. package/dist/types/core/Camera.d.ts +1 -1
  311. package/dist/types/core/Camera.d.ts.map +1 -1
  312. package/dist/types/core/Clock.d.ts +14 -2
  313. package/dist/types/core/Clock.d.ts.map +1 -1
  314. package/dist/types/core/Pointer.d.ts +18 -0
  315. package/dist/types/core/Pointer.d.ts.map +1 -1
  316. package/dist/types/core/Stage.d.ts.map +1 -1
  317. package/dist/types/core/TextureRegistry.d.ts +39 -0
  318. package/dist/types/core/TextureRegistry.d.ts.map +1 -1
  319. package/dist/types/core/blendLayer.d.ts +23 -0
  320. package/dist/types/core/blendLayer.d.ts.map +1 -0
  321. package/dist/types/core/gameObject.d.ts.map +1 -1
  322. package/dist/types/core/pixelZoom.d.ts +45 -0
  323. package/dist/types/core/pixelZoom.d.ts.map +1 -0
  324. package/dist/types/core/runDue.d.ts +15 -0
  325. package/dist/types/core/runDue.d.ts.map +1 -0
  326. package/dist/types/core/silhouette.d.ts +16 -0
  327. package/dist/types/core/silhouette.d.ts.map +1 -0
  328. package/dist/types/debug/DrawCallCounter.d.ts.map +1 -1
  329. package/dist/types/electron/electronLike.d.ts +56 -0
  330. package/dist/types/electron/electronLike.d.ts.map +1 -0
  331. package/dist/types/electron/index.d.ts +15 -0
  332. package/dist/types/electron/index.d.ts.map +1 -0
  333. package/dist/types/electron/lockdown.d.ts +34 -0
  334. package/dist/types/electron/lockdown.d.ts.map +1 -0
  335. package/dist/types/electron/lockdownRules.d.ts +29 -0
  336. package/dist/types/electron/lockdownRules.d.ts.map +1 -0
  337. package/dist/types/electron/sessionStore.d.ts +41 -0
  338. package/dist/types/electron/sessionStore.d.ts.map +1 -0
  339. package/dist/types/electron/shellId.d.ts +23 -0
  340. package/dist/types/electron/shellId.d.ts.map +1 -0
  341. package/dist/types/electron/webFiles.d.ts +14 -0
  342. package/dist/types/electron/webFiles.d.ts.map +1 -0
  343. package/dist/types/electron/webPatcher.d.ts +81 -0
  344. package/dist/types/electron/webPatcher.d.ts.map +1 -0
  345. package/dist/types/electron/webPointers.d.ts +20 -0
  346. package/dist/types/electron/webPointers.d.ts.map +1 -0
  347. package/dist/types/engine/Engine.d.ts +16 -0
  348. package/dist/types/engine/Engine.d.ts.map +1 -1
  349. package/dist/types/engine/HiddenPause.d.ts +22 -0
  350. package/dist/types/engine/HiddenPause.d.ts.map +1 -0
  351. package/dist/types/fx/Afterimages.d.ts +62 -0
  352. package/dist/types/fx/Afterimages.d.ts.map +1 -0
  353. package/dist/types/index.d.ts +32 -4
  354. package/dist/types/index.d.ts.map +1 -1
  355. package/dist/types/input/Actions.d.ts +7 -1
  356. package/dist/types/input/Actions.d.ts.map +1 -1
  357. package/dist/types/input/haptics.d.ts +42 -0
  358. package/dist/types/input/haptics.d.ts.map +1 -0
  359. package/dist/types/input/rumble.d.ts +41 -0
  360. package/dist/types/input/rumble.d.ts.map +1 -0
  361. package/dist/types/net/ApiClient.d.ts +74 -0
  362. package/dist/types/net/ApiClient.d.ts.map +1 -0
  363. package/dist/types/net/Connection.d.ts +22 -0
  364. package/dist/types/net/Connection.d.ts.map +1 -1
  365. package/dist/types/net/constants.d.ts +13 -4
  366. package/dist/types/net/constants.d.ts.map +1 -1
  367. package/dist/types/net/movement.d.ts.map +1 -1
  368. package/dist/types/net/reconnect.d.ts +14 -0
  369. package/dist/types/net/reconnect.d.ts.map +1 -0
  370. package/dist/types/pixel/Darkness.d.ts +17 -5
  371. package/dist/types/pixel/Darkness.d.ts.map +1 -1
  372. package/dist/types/pixel/PixelMarks.d.ts +68 -0
  373. package/dist/types/pixel/PixelMarks.d.ts.map +1 -0
  374. package/dist/types/pixel/aimPixels.d.ts +23 -0
  375. package/dist/types/pixel/aimPixels.d.ts.map +1 -0
  376. package/dist/types/pixel/index.d.ts +4 -1
  377. package/dist/types/pixel/index.d.ts.map +1 -1
  378. package/dist/types/pixel/lifeArt.d.ts +63 -0
  379. package/dist/types/pixel/lifeArt.d.ts.map +1 -0
  380. package/dist/types/pixel/pixelPaint.d.ts +1 -0
  381. package/dist/types/pixel/pixelPaint.d.ts.map +1 -1
  382. package/dist/types/pixel/pixelParticles.d.ts +21 -0
  383. package/dist/types/pixel/pixelParticles.d.ts.map +1 -0
  384. package/dist/types/platform/appResume.d.ts +25 -0
  385. package/dist/types/platform/appResume.d.ts.map +1 -0
  386. package/dist/types/platform/fullscreen.d.ts +37 -0
  387. package/dist/types/platform/fullscreen.d.ts.map +1 -0
  388. package/dist/types/platform/orientation.d.ts +19 -0
  389. package/dist/types/platform/orientation.d.ts.map +1 -0
  390. package/dist/types/platform/pointerLock.d.ts +26 -0
  391. package/dist/types/platform/pointerLock.d.ts.map +1 -0
  392. package/dist/types/platform/reducedMotion.d.ts +20 -0
  393. package/dist/types/platform/reducedMotion.d.ts.map +1 -0
  394. package/dist/types/platform/timeoutSignal.d.ts +6 -0
  395. package/dist/types/platform/timeoutSignal.d.ts.map +1 -0
  396. package/dist/types/react/ConfirmButton.d.ts +26 -0
  397. package/dist/types/react/ConfirmButton.d.ts.map +1 -0
  398. package/dist/types/react/baseCss.d.ts +1 -1
  399. package/dist/types/react/baseCss.d.ts.map +1 -1
  400. package/dist/types/react/index.d.ts +2 -0
  401. package/dist/types/react/index.d.ts.map +1 -1
  402. package/dist/types/react/labels.d.ts +2 -0
  403. package/dist/types/react/labels.d.ts.map +1 -1
  404. package/dist/types/react/useJsonSelector.d.ts +13 -0
  405. package/dist/types/react/useJsonSelector.d.ts.map +1 -0
  406. package/dist/types/tilemap/TilemapView.d.ts +17 -0
  407. package/dist/types/tilemap/TilemapView.d.ts.map +1 -1
  408. package/dist/types/tilemap/autotile.d.ts +95 -0
  409. package/dist/types/tilemap/autotile.d.ts.map +1 -0
  410. package/dist/types/tilemap/collision.d.ts +8 -0
  411. package/dist/types/tilemap/collision.d.ts.map +1 -1
  412. package/dist/types/tilemap/ldtk.d.ts +97 -0
  413. package/dist/types/tilemap/ldtk.d.ts.map +1 -0
  414. package/dist/types/tilemap/ldtkParse.d.ts +26 -0
  415. package/dist/types/tilemap/ldtkParse.d.ts.map +1 -0
  416. package/dist/types/ui/index.d.ts +4 -0
  417. package/dist/types/ui/index.d.ts.map +1 -1
  418. package/dist/types/ui/rich/RichText.d.ts +48 -0
  419. package/dist/types/ui/rich/RichText.d.ts.map +1 -0
  420. package/dist/types/ui/rich/richFonts.d.ts +70 -0
  421. package/dist/types/ui/rich/richFonts.d.ts.map +1 -0
  422. package/dist/types/ui/rich/richLayout.d.ts +76 -0
  423. package/dist/types/ui/rich/richLayout.d.ts.map +1 -0
  424. package/dist/types/ui/rich/richMarkup.d.ts +48 -0
  425. package/dist/types/ui/rich/richMarkup.d.ts.map +1 -0
  426. package/dist/types/updates/index.d.ts +9 -0
  427. package/dist/types/updates/index.d.ts.map +1 -0
  428. package/dist/types/updates/manifest.d.ts +74 -0
  429. package/dist/types/updates/manifest.d.ts.map +1 -0
  430. package/dist/types/updates/pickUpdate.d.ts +43 -0
  431. package/dist/types/updates/pickUpdate.d.ts.map +1 -0
  432. package/dist/types/updates/webPlan.d.ts +21 -0
  433. package/dist/types/updates/webPlan.d.ts.map +1 -0
  434. package/dist/ui/Bar.js +0 -1
  435. package/dist/ui/Button.js +0 -1
  436. package/dist/ui/Dialog.js +0 -1
  437. package/dist/ui/FocusManager.js +0 -1
  438. package/dist/ui/Label.js +0 -1
  439. package/dist/ui/List.js +0 -1
  440. package/dist/ui/Panel.js +0 -1
  441. package/dist/ui/ScrollView.js +0 -1
  442. package/dist/ui/Slider.js +0 -1
  443. package/dist/ui/Stack.js +0 -1
  444. package/dist/ui/Toggle.js +0 -1
  445. package/dist/ui/UiHost.js +0 -1
  446. package/dist/ui/UiPointerGate.js +0 -1
  447. package/dist/ui/UiRoot.js +0 -1
  448. package/dist/ui/Widget.js +0 -1
  449. package/dist/ui/dom/DomOverlay.js +0 -1
  450. package/dist/ui/dom/DomWorldAnchors.js +0 -1
  451. package/dist/ui/dom/InputShield.js +0 -1
  452. package/dist/ui/dom/createStore.js +0 -1
  453. package/dist/ui/dom/shieldDecision.js +0 -1
  454. package/dist/ui/dom/worldToScreen.js +0 -1
  455. package/dist/ui/layout/anchor.js +0 -1
  456. package/dist/ui/layout/barDrain.js +0 -1
  457. package/dist/ui/layout/fitToViewport.js +0 -1
  458. package/dist/ui/layout/focusNav.js +0 -1
  459. package/dist/ui/layout/geometry.js +0 -1
  460. package/dist/ui/layout/listWidth.js +0 -1
  461. package/dist/ui/layout/placeTooltip.js +0 -1
  462. package/dist/ui/layout/scroll.js +0 -1
  463. package/dist/ui/layout/slider.js +0 -1
  464. package/dist/ui/layout/stack.js +0 -1
  465. package/dist/ui/layout/wrapRow.js +0 -1
  466. package/dist/ui/rich/RichText.js +87 -0
  467. package/dist/ui/rich/richFonts.js +105 -0
  468. package/dist/ui/rich/richLayout.js +132 -0
  469. package/dist/ui/rich/richMarkup.js +67 -0
  470. package/dist/ui.js +75 -65
  471. package/dist/updates/manifest.js +35 -0
  472. package/dist/updates/pickUpdate.js +27 -0
  473. package/dist/updates/webPlan.js +14 -0
  474. package/dist/updates.js +15 -0
  475. package/package.json +31 -6
  476. package/dist/1681-engine.js.map +0 -1
  477. package/dist/ambient/ColorGrade.js.map +0 -1
  478. package/dist/ambient/DayClock.js.map +0 -1
  479. package/dist/ambient/WeatherLayer.js.map +0 -1
  480. package/dist/ambient/grade.js.map +0 -1
  481. package/dist/ambient/weather.js.map +0 -1
  482. package/dist/anim/AnimStateMachine.js.map +0 -1
  483. package/dist/anim/Animator.js.map +0 -1
  484. package/dist/anim/animStateCompile.js.map +0 -1
  485. package/dist/anim/animStateSystem.js.map +0 -1
  486. package/dist/anim/animationSystem.js.map +0 -1
  487. package/dist/anim/asepriteSlices.js.map +0 -1
  488. package/dist/anim/asepriteTags.js.map +0 -1
  489. package/dist/anim/parseAseprite.js.map +0 -1
  490. package/dist/assets/AssetLoader.js.map +0 -1
  491. package/dist/assets/loadAseprite.js.map +0 -1
  492. package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +0 -1
  493. package/dist/audio/Footsteps.js.map +0 -1
  494. package/dist/audio/MusicPlayer.js.map +0 -1
  495. package/dist/audio/SoundEngine.js.map +0 -1
  496. package/dist/audio/cleanTake.js.map +0 -1
  497. package/dist/audio/music/ElementVoice.js.map +0 -1
  498. package/dist/audio/music/GraphVoice.js.map +0 -1
  499. package/dist/audio/music/MusicChannel.js.map +0 -1
  500. package/dist/audio/music/musicVoice.js.map +0 -1
  501. package/dist/audio/sampleBank.js.map +0 -1
  502. package/dist/audio/soundTable.js.map +0 -1
  503. package/dist/audio/synth.js.map +0 -1
  504. package/dist/core/BitmapLabel.js.map +0 -1
  505. package/dist/core/Camera.js.map +0 -1
  506. package/dist/core/Clock.js.map +0 -1
  507. package/dist/core/Graphics.js.map +0 -1
  508. package/dist/core/Group.js.map +0 -1
  509. package/dist/core/Image.js.map +0 -1
  510. package/dist/core/ObjectFactory.js.map +0 -1
  511. package/dist/core/Pointer.js.map +0 -1
  512. package/dist/core/Rectangle.js.map +0 -1
  513. package/dist/core/Stage.js.map +0 -1
  514. package/dist/core/Text.js.map +0 -1
  515. package/dist/core/TextureRegistry.js.map +0 -1
  516. package/dist/core/Timeline.js.map +0 -1
  517. package/dist/core/TimelineBuilder.js.map +0 -1
  518. package/dist/core/TimelineChild.js.map +0 -1
  519. package/dist/core/Tweener.js.map +0 -1
  520. package/dist/core/atlas.js.map +0 -1
  521. package/dist/core/atlasPlan.js.map +0 -1
  522. package/dist/core/eases.js.map +0 -1
  523. package/dist/core/gameObject.js.map +0 -1
  524. package/dist/core/pixiPatches.js.map +0 -1
  525. package/dist/core/timelinePlace.js.map +0 -1
  526. package/dist/core/tweenProps.js.map +0 -1
  527. package/dist/debug/DebugOverlay.js.map +0 -1
  528. package/dist/debug/DrawCallCounter.js.map +0 -1
  529. package/dist/debug/ErrorLog.js.map +0 -1
  530. package/dist/debug/FrameStats.js.map +0 -1
  531. package/dist/debug/inspectWorld.js.map +0 -1
  532. package/dist/diagnostics/ErrorDeduper.js.map +0 -1
  533. package/dist/diagnostics/FrameSampler.js.map +0 -1
  534. package/dist/diagnostics/bootWatch.js.map +0 -1
  535. package/dist/diagnostics/captureErrors.js.map +0 -1
  536. package/dist/diagnostics/contextLoss.js.map +0 -1
  537. package/dist/diagnostics/frameStats.js.map +0 -1
  538. package/dist/diagnostics/gpuInfo.js.map +0 -1
  539. package/dist/diagnostics/renderGuard.js.map +0 -1
  540. package/dist/ecs/SparseSet.js.map +0 -1
  541. package/dist/ecs/World.js.map +0 -1
  542. package/dist/ecs/fields.js.map +0 -1
  543. package/dist/engine/Engine.js.map +0 -1
  544. package/dist/engine/FixedLoop.js.map +0 -1
  545. package/dist/engine/Scene.js.map +0 -1
  546. package/dist/engine/SceneManager.js.map +0 -1
  547. package/dist/events/EventBus.js.map +0 -1
  548. package/dist/fx/FloatingText.js.map +0 -1
  549. package/dist/fx/hitStop.js.map +0 -1
  550. package/dist/fx/viewCull.js.map +0 -1
  551. package/dist/i18n/Translator.js.map +0 -1
  552. package/dist/i18n/extractStrings.js.map +0 -1
  553. package/dist/i18n/formatMessage.js.map +0 -1
  554. package/dist/input/Actions.js.map +0 -1
  555. package/dist/input/AimGesture.js.map +0 -1
  556. package/dist/input/Keyboard.js.map +0 -1
  557. package/dist/input/Keymap.js.map +0 -1
  558. package/dist/input/TargetLock.js.map +0 -1
  559. package/dist/input/aimAxis.js.map +0 -1
  560. package/dist/input/keyChord.js.map +0 -1
  561. package/dist/input/longPress.js.map +0 -1
  562. package/dist/input/stickAxis.js.map +0 -1
  563. package/dist/input/touchDetect.js.map +0 -1
  564. package/dist/light/LightLayer.js.map +0 -1
  565. package/dist/nav/MinHeap.js.map +0 -1
  566. package/dist/nav/findPath.js.map +0 -1
  567. package/dist/nav/navGrid.js.map +0 -1
  568. package/dist/nav/nearestOpen.js.map +0 -1
  569. package/dist/nav/straightenPath.js.map +0 -1
  570. package/dist/net/Connection.js.map +0 -1
  571. package/dist/net/InterpolationBuffer.js.map +0 -1
  572. package/dist/net/PredictedMover.js.map +0 -1
  573. package/dist/net/Room.js.map +0 -1
  574. package/dist/net/RoomHost.js.map +0 -1
  575. package/dist/net/cadence.js.map +0 -1
  576. package/dist/net/constants.js.map +0 -1
  577. package/dist/net/lobby/LobbyClient.js.map +0 -1
  578. package/dist/net/lobby/LobbyHost.js.map +0 -1
  579. package/dist/net/lobby/LobbyRooms.js.map +0 -1
  580. package/dist/net/lobby/Matchmaker.js.map +0 -1
  581. package/dist/net/movement.js.map +0 -1
  582. package/dist/net/protocol.js.map +0 -1
  583. package/dist/net/serverClock.js.map +0 -1
  584. package/dist/net/snapshotCodec.js.map +0 -1
  585. package/dist/parallax/Parallax.js.map +0 -1
  586. package/dist/parallax/ParallaxLayer.js.map +0 -1
  587. package/dist/parallax/parallaxMath.js.map +0 -1
  588. package/dist/particles/Emitter.js.map +0 -1
  589. package/dist/particles/ParticleBudget.js.map +0 -1
  590. package/dist/particles/ParticleSim.js.map +0 -1
  591. package/dist/particles/particleCurves.js.map +0 -1
  592. package/dist/particles/particleSampling.js.map +0 -1
  593. package/dist/physics/Body.js.map +0 -1
  594. package/dist/physics/BroadPhase.js.map +0 -1
  595. package/dist/physics/Contact.js.map +0 -1
  596. package/dist/physics/ContactSolver.js.map +0 -1
  597. package/dist/physics/PhysicsWorld.js.map +0 -1
  598. package/dist/physics/SpatialHash.js.map +0 -1
  599. package/dist/physics/collide.js.map +0 -1
  600. package/dist/physics/collidePolygon.js.map +0 -1
  601. package/dist/physics/contactReport.js.map +0 -1
  602. package/dist/physics/drawColliders.js.map +0 -1
  603. package/dist/physics/physicsSystem.js.map +0 -1
  604. package/dist/physics/polygon.js.map +0 -1
  605. package/dist/physics/raycast.js.map +0 -1
  606. package/dist/physics/syncToBody.js.map +0 -1
  607. package/dist/physics/tileBodies.js.map +0 -1
  608. package/dist/physics/types.js.map +0 -1
  609. package/dist/pixel/Darkness.js.map +0 -1
  610. package/dist/pixel/DitherVignette.js.map +0 -1
  611. package/dist/pixel/Evaporation.js.map +0 -1
  612. package/dist/pixel/NightShade.js.map +0 -1
  613. package/dist/pixel/PixelLayer.js.map +0 -1
  614. package/dist/pixel/SwayProp.js.map +0 -1
  615. package/dist/pixel/lights.js.map +0 -1
  616. package/dist/pixel/nineSlice.js.map +0 -1
  617. package/dist/pixel/paintLayer.js.map +0 -1
  618. package/dist/pixel/palette.js.map +0 -1
  619. package/dist/pixel/pixel.js.map +0 -1
  620. package/dist/pixel/pixelPaint.js.map +0 -1
  621. package/dist/pixel/pixelTone.js.map +0 -1
  622. package/dist/pixel/propKit.js.map +0 -1
  623. package/dist/pixel/ramp.js.map +0 -1
  624. package/dist/pixel/selout.js.map +0 -1
  625. package/dist/pixel/spritePixels.js.map +0 -1
  626. package/dist/pixel/swayRig.js.map +0 -1
  627. package/dist/pixel/vignetteMask.js.map +0 -1
  628. package/dist/pixel/weatherArt.js.map +0 -1
  629. package/dist/pixel.js.map +0 -1
  630. package/dist/platform/touch.js.map +0 -1
  631. package/dist/postfx/BloomFilter.js.map +0 -1
  632. package/dist/postfx/ChromaticAberrationFilter.js.map +0 -1
  633. package/dist/postfx/ColorAdjustFilter.js.map +0 -1
  634. package/dist/postfx/CrtFilter.js.map +0 -1
  635. package/dist/postfx/PixelateFilter.js.map +0 -1
  636. package/dist/postfx/PostFx.js.map +0 -1
  637. package/dist/postfx/ShockwaveFilter.js.map +0 -1
  638. package/dist/postfx/VignetteFilter.js.map +0 -1
  639. package/dist/postfx/fxAnimator.js.map +0 -1
  640. package/dist/postfx/fxShader.js.map +0 -1
  641. package/dist/postfx.js.map +0 -1
  642. package/dist/react/ChoiceDialog.js.map +0 -1
  643. package/dist/react/ConfirmDialog.js.map +0 -1
  644. package/dist/react/Glyph.js.map +0 -1
  645. package/dist/react/Modal.js.map +0 -1
  646. package/dist/react/Panel.js.map +0 -1
  647. package/dist/react/PixelImage.js.map +0 -1
  648. package/dist/react/Select.js.map +0 -1
  649. package/dist/react/Slider.js.map +0 -1
  650. package/dist/react/SplitPane.js.map +0 -1
  651. package/dist/react/TabStrip.js.map +0 -1
  652. package/dist/react/TitleTips.js.map +0 -1
  653. package/dist/react/Tooltip.js.map +0 -1
  654. package/dist/react/UiProvider.js.map +0 -1
  655. package/dist/react/baseCss.js.map +0 -1
  656. package/dist/react/choiceStore.js.map +0 -1
  657. package/dist/react/classNames.js.map +0 -1
  658. package/dist/react/confirmStore.js.map +0 -1
  659. package/dist/react/labels.js.map +0 -1
  660. package/dist/react/placement.js.map +0 -1
  661. package/dist/react/useFillSheet.js.map +0 -1
  662. package/dist/react/useFitToViewport.js.map +0 -1
  663. package/dist/react/usePicked.js.map +0 -1
  664. package/dist/react/useStore.js.map +0 -1
  665. package/dist/react/useViewport.js.map +0 -1
  666. package/dist/react.js.map +0 -1
  667. package/dist/rig/PosePlayer.js.map +0 -1
  668. package/dist/rig/RigView.js.map +0 -1
  669. package/dist/rig/Skeleton.js.map +0 -1
  670. package/dist/rig/humanoid.js.map +0 -1
  671. package/dist/rig/humanoid.json.js.map +0 -1
  672. package/dist/rig/humanoidPoses.js.map +0 -1
  673. package/dist/rig/poseMath.js.map +0 -1
  674. package/dist/rig/poses.json.js.map +0 -1
  675. package/dist/save/Autosaver.js.map +0 -1
  676. package/dist/save/MemoryBackend.js.map +0 -1
  677. package/dist/save/SaveStore.js.map +0 -1
  678. package/dist/save/WebStorageBackend.js.map +0 -1
  679. package/dist/save/checksum.js.map +0 -1
  680. package/dist/save/migrateSave.js.map +0 -1
  681. package/dist/settings.js.map +0 -1
  682. package/dist/tilemap/TilemapView.js.map +0 -1
  683. package/dist/tilemap/collision.js.map +0 -1
  684. package/dist/tilemap/tiled.js.map +0 -1
  685. package/dist/transitions/CrossfadeTransition.js.map +0 -1
  686. package/dist/transitions/DitherWipeTransition.js.map +0 -1
  687. package/dist/transitions/FadeTransition.js.map +0 -1
  688. package/dist/transitions/Letterbox.js.map +0 -1
  689. package/dist/transitions/ditherMask.js.map +0 -1
  690. package/dist/transitions/transitionTo.js.map +0 -1
  691. package/dist/transitions/tweenDone.js.map +0 -1
  692. package/dist/ui/Bar.js.map +0 -1
  693. package/dist/ui/Button.js.map +0 -1
  694. package/dist/ui/Dialog.js.map +0 -1
  695. package/dist/ui/FocusManager.js.map +0 -1
  696. package/dist/ui/Label.js.map +0 -1
  697. package/dist/ui/List.js.map +0 -1
  698. package/dist/ui/Panel.js.map +0 -1
  699. package/dist/ui/ScrollView.js.map +0 -1
  700. package/dist/ui/Slider.js.map +0 -1
  701. package/dist/ui/Stack.js.map +0 -1
  702. package/dist/ui/Toggle.js.map +0 -1
  703. package/dist/ui/UiHost.js.map +0 -1
  704. package/dist/ui/UiPointerGate.js.map +0 -1
  705. package/dist/ui/UiRoot.js.map +0 -1
  706. package/dist/ui/Widget.js.map +0 -1
  707. package/dist/ui/dom/DomOverlay.js.map +0 -1
  708. package/dist/ui/dom/DomWorldAnchors.js.map +0 -1
  709. package/dist/ui/dom/InputShield.js.map +0 -1
  710. package/dist/ui/dom/createStore.js.map +0 -1
  711. package/dist/ui/dom/shieldDecision.js.map +0 -1
  712. package/dist/ui/dom/worldToScreen.js.map +0 -1
  713. package/dist/ui/layout/anchor.js.map +0 -1
  714. package/dist/ui/layout/barDrain.js.map +0 -1
  715. package/dist/ui/layout/fitToViewport.js.map +0 -1
  716. package/dist/ui/layout/focusNav.js.map +0 -1
  717. package/dist/ui/layout/geometry.js.map +0 -1
  718. package/dist/ui/layout/listWidth.js.map +0 -1
  719. package/dist/ui/layout/placeTooltip.js.map +0 -1
  720. package/dist/ui/layout/scroll.js.map +0 -1
  721. package/dist/ui/layout/slider.js.map +0 -1
  722. package/dist/ui/layout/stack.js.map +0 -1
  723. package/dist/ui/layout/wrapRow.js.map +0 -1
  724. package/dist/ui.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const c = ["drawElements", "drawArrays", "drawElementsInstanced", "drawArraysInstanced"];
2
- class i {
1
+ const u = ["drawElements", "drawArrays", "drawElementsInstanced", "drawArraysInstanced", "drawRangeElements"];
2
+ class f {
3
3
  constructor(r) {
4
4
  this.renderer = r;
5
5
  }
@@ -9,18 +9,22 @@ class i {
9
9
  restore = null;
10
10
  /** Whether this renderer can be counted (WebGL). */
11
11
  get supported() {
12
- return o(this.renderer) !== null;
12
+ return c(this.renderer) !== null;
13
13
  }
14
14
  install() {
15
- const r = o(this.renderer);
15
+ const r = c(this.renderer);
16
16
  if (!r || this.restore) return;
17
- const n = r, l = [];
18
- for (const t of c) {
17
+ const n = r, o = [];
18
+ let a = !0;
19
+ for (const t of u) {
19
20
  const e = n[t];
20
- typeof e == "function" && (l.push([t, e]), n[t] = (...a) => (this.calls++, e.apply(r, a)));
21
+ if (typeof e != "function") continue;
22
+ const s = (...i) => (a && this.calls++, e.apply(r, i));
23
+ o.push([t, e, s]), n[t] = s;
21
24
  }
22
25
  this.restore = () => {
23
- for (const [t, e] of l) n[t] = e;
26
+ a = !1;
27
+ for (const [t, e, s] of o) n[t] === s && (n[t] = e);
24
28
  };
25
29
  }
26
30
  uninstall() {
@@ -32,10 +36,9 @@ class i {
32
36
  return this.calls = 0, r;
33
37
  }
34
38
  }
35
- function o(s) {
36
- return s.gl ?? null;
39
+ function c(l) {
40
+ return l.gl ?? null;
37
41
  }
38
42
  export {
39
- i as DrawCallCounter
43
+ f as DrawCallCounter
40
44
  };
41
- //# sourceMappingURL=DrawCallCounter.js.map
@@ -19,4 +19,3 @@ class h {
19
19
  export {
20
20
  h as ErrorLog
21
21
  };
22
- //# sourceMappingURL=ErrorLog.js.map
@@ -39,4 +39,3 @@ class s {
39
39
  export {
40
40
  s as FrameStats
41
41
  };
42
- //# sourceMappingURL=FrameStats.js.map
@@ -26,4 +26,3 @@ function f(t, r, s) {
26
26
  export {
27
27
  p as inspectWorld
28
28
  };
29
- //# sourceMappingURL=inspectWorld.js.map
@@ -24,4 +24,3 @@ export {
24
24
  n as ErrorDeduper,
25
25
  i as trimStack
26
26
  };
27
- //# sourceMappingURL=ErrorDeduper.js.map
@@ -39,4 +39,3 @@ class c {
39
39
  export {
40
40
  c as FrameSampler
41
41
  };
42
- //# sourceMappingURL=FrameSampler.js.map
@@ -18,4 +18,3 @@ function c(o, i, n = () => performance.now()) {
18
18
  export {
19
19
  c as bootWatch
20
20
  };
21
- //# sourceMappingURL=bootWatch.js.map
@@ -24,4 +24,3 @@ function k(m, t = {}) {
24
24
  export {
25
25
  k as captureErrors
26
26
  };
27
- //# sourceMappingURL=captureErrors.js.map
@@ -22,4 +22,3 @@ export {
22
22
  f as rebuildDelayMs,
23
23
  w as watchContextLoss
24
24
  };
25
- //# sourceMappingURL=contextLoss.js.map
@@ -28,4 +28,3 @@ export {
28
28
  h as percentile,
29
29
  a as summarizeFrames
30
30
  };
31
- //# sourceMappingURL=frameStats.js.map
@@ -19,4 +19,3 @@ export {
19
19
  i as gpuName,
20
20
  l as maxTextureSize
21
21
  };
22
- //# sourceMappingURL=gpuInfo.js.map
@@ -21,4 +21,3 @@ export {
21
21
  f as describeError,
22
22
  l as guardRender
23
23
  };
24
- //# sourceMappingURL=renderGuard.js.map
@@ -52,4 +52,3 @@ class n {
52
52
  export {
53
53
  n as SparseSet
54
54
  };
55
- //# sourceMappingURL=SparseSet.js.map
package/dist/ecs/World.js CHANGED
@@ -304,4 +304,3 @@ export {
304
304
  h as entityIndex,
305
305
  b as system
306
306
  };
307
- //# sourceMappingURL=World.js.map
@@ -23,4 +23,3 @@ export {
23
23
  f as growColumns,
24
24
  u as isFields
25
25
  };
26
- //# sourceMappingURL=fields.js.map
@@ -0,0 +1,31 @@
1
+ import { isAllowedNavigation as a, isDevToolsKey as d, debuggerRequested as f, isAllowedExternal as u } from "./lockdownRules.js";
2
+ function g(r, n) {
3
+ const i = n.log ?? ((...e) => console.log(...e)), t = r.webContents, s = (e, o) => {
4
+ u(e, n.external) ? n.shell.openExternal(e).catch((c) => i("could not open", e, c)) : i(`refused ${o}:`, e);
5
+ };
6
+ t.setWindowOpenHandler(({ url: e }) => (s(e, "external link"), { action: "deny" })), t.on("will-navigate", (e, o) => {
7
+ a(o, n.devServerUrl) || (e.preventDefault(), s(o, "navigation"));
8
+ }), t.on("will-redirect", (e, o) => {
9
+ a(o, n.devServerUrl) || e.preventDefault();
10
+ });
11
+ const l = n.devToolsKey === void 0 ? "F12" : n.devToolsKey;
12
+ t.on("before-input-event", (e, o) => {
13
+ if (n.packaged) {
14
+ d(o) && e.preventDefault();
15
+ return;
16
+ }
17
+ l && o.type === "keyDown" && o.key === l && (t.toggleDevTools(), e.preventDefault());
18
+ });
19
+ }
20
+ function w(r, n = []) {
21
+ const i = new Set(n);
22
+ r.setPermissionRequestHandler((t, s, l) => l(i.has(s))), r.setPermissionCheckHandler((t, s) => i.has(s));
23
+ }
24
+ function p(r, n = process.argv, i = (t) => process.exit(t)) {
25
+ return !r.isPackaged || !f(n, (t) => r.commandLine.hasSwitch(t)) ? !1 : (console.error("[main] refusing to run with a debugger attached"), i(1), !0);
26
+ }
27
+ export {
28
+ w as denyPermissions,
29
+ g as lockDownWindow,
30
+ p as refuseDebugLaunch
31
+ };
@@ -0,0 +1,42 @@
1
+ function i(e) {
2
+ try {
3
+ return new URL(e);
4
+ } catch {
5
+ return null;
6
+ }
7
+ }
8
+ function g(e, r) {
9
+ const t = i(e);
10
+ if (!t || t.protocol !== "https:" || t.username || t.password) return !1;
11
+ const o = t.hostname.toLowerCase(), s = (r.paths ?? []).filter((n) => n.host.toLowerCase() === o);
12
+ return s.length ? s.some((n) => t.pathname.toLowerCase().startsWith(n.prefix.toLowerCase())) : r.hosts.some((n) => {
13
+ const a = n.toLowerCase();
14
+ return o === a || o.endsWith(`.${a}`);
15
+ });
16
+ }
17
+ function f(e, r) {
18
+ const t = i(e);
19
+ if (!t) return !1;
20
+ if (r) {
21
+ const o = i(r);
22
+ return !!o && t.origin === o.origin;
23
+ }
24
+ return t.protocol === "file:";
25
+ }
26
+ function l(e) {
27
+ if (e.type !== "keyDown") return !1;
28
+ if (e.key === "F12") return !0;
29
+ const r = e.key.toLowerCase();
30
+ return (e.control || e.meta) && (e.shift || e.alt) && (r === "i" || r === "j" || r === "c");
31
+ }
32
+ const c = ["--inspect", "--remote-debugging-port", "--remote-debugging-pipe", "--remote-debugging-address"], u = ["remote-debugging-port", "remote-debugging-pipe", "inspect", "inspect-brk"];
33
+ function d(e, r = () => !1) {
34
+ return e.some((o) => c.some((s) => o === s || o.startsWith(`${s}=`) || o.startsWith(`${s}-`))) || u.some((o) => r(o));
35
+ }
36
+ export {
37
+ c as DEBUG_SWITCHES,
38
+ d as debuggerRequested,
39
+ g as isAllowedExternal,
40
+ f as isAllowedNavigation,
41
+ l as isDevToolsKey
42
+ };
@@ -0,0 +1,48 @@
1
+ import { promises as r } from "node:fs";
2
+ import { join as n } from "node:path";
3
+ class l {
4
+ constructor(t) {
5
+ this.o = t, this.file = n(t.dir, t.fileName ?? "session.bin"), this.maxLength = t.maxLength ?? 4096, this.platform = t.platform ?? process.platform;
6
+ }
7
+ o;
8
+ file;
9
+ maxLength;
10
+ platform;
11
+ /** Whether the OS can encrypt for real here. */
12
+ canEncrypt() {
13
+ const t = this.o.safeStorage;
14
+ return t.isEncryptionAvailable() ? this.platform !== "linux" || t.getSelectedStorageBackend?.() !== "basic_text" : !1;
15
+ }
16
+ /** The saved value, or null when there is none, it cannot be decrypted (another OS user, a reinstall) or nothing may be. */
17
+ async get() {
18
+ if (!this.canEncrypt()) return null;
19
+ try {
20
+ return this.o.safeStorage.decryptString(await r.readFile(this.file));
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+ /** Saves `value`; false when it is not a string, too long, or the OS cannot encrypt it. */
26
+ async set(t) {
27
+ if (typeof t != "string" || t.length > this.maxLength || !this.canEncrypt()) return !1;
28
+ const e = `${this.file}.${process.pid}.${Date.now()}.tmp`;
29
+ try {
30
+ await r.mkdir(this.o.dir, { recursive: !0 }), await r.writeFile(e, this.o.safeStorage.encryptString(t)), await r.rename(e, this.file);
31
+ } catch (a) {
32
+ throw await r.rm(e, { force: !0 }), a;
33
+ }
34
+ return !0;
35
+ }
36
+ async clear() {
37
+ await r.rm(this.file, { force: !0 });
38
+ }
39
+ }
40
+ function h(s, t, e = "session") {
41
+ return s.handle(`${e}:get`, () => t.get()), s.handle(`${e}:set`, (a, i) => t.set(i)), s.handle(`${e}:clear`, () => t.clear()), () => {
42
+ for (const a of ["get", "set", "clear"]) s.removeHandler?.(`${e}:${a}`);
43
+ };
44
+ }
45
+ export {
46
+ l as SessionStore,
47
+ h as registerSessionStore
48
+ };
@@ -0,0 +1,18 @@
1
+ import { createHash as a } from "node:crypto";
2
+ import { readdirSync as f, readFileSync as d } from "node:fs";
3
+ import { join as i } from "node:path";
4
+ function p(n, r) {
5
+ const o = typeof r == "string" ? { dirs: [r] } : r, s = o.match ?? ((t) => t.endsWith(".cjs")), e = a("sha256");
6
+ e.update(`electron ${n}
7
+ `);
8
+ for (const t of o.dirs)
9
+ for (const c of f(t).filter(s).sort())
10
+ e.update(`${c}
11
+ `), e.update(d(i(t, c)));
12
+ for (const t of o.extra ?? []) e.update(`extra ${t}
13
+ `);
14
+ return e.digest("hex").slice(0, o.length ?? 16);
15
+ }
16
+ export {
17
+ p as shellId
18
+ };
@@ -0,0 +1,36 @@
1
+ import { createHash as s } from "node:crypto";
2
+ import { readFile as c, mkdir as l, writeFile as u, readdir as f } from "node:fs/promises";
3
+ import { join as r, dirname as h } from "node:path";
4
+ const m = (t) => s("sha256").update(t).digest("hex");
5
+ async function n(t, e = "") {
6
+ const i = [];
7
+ for (const a of await f(r(t, e), { withFileTypes: !0 })) {
8
+ const o = e ? `${e}/${a.name}` : a.name;
9
+ a.isDirectory() ? i.push(...await n(t, o)) : i.push(o);
10
+ }
11
+ return i;
12
+ }
13
+ async function d(t) {
14
+ const e = /* @__PURE__ */ new Map();
15
+ for (const i of await n(t)) e.set(i, m(await c(r(t, ...i.split("/")))));
16
+ return e;
17
+ }
18
+ async function F(t, e, i) {
19
+ const a = r(t, ...e.split("/"));
20
+ await l(h(a), { recursive: !0 }), await u(a, i);
21
+ }
22
+ async function T(t, e, i) {
23
+ const a = new AbortController(), o = setTimeout(() => a.abort(), i);
24
+ try {
25
+ return await t(e, { signal: a.signal, cache: "no-store" });
26
+ } finally {
27
+ clearTimeout(o);
28
+ }
29
+ }
30
+ export {
31
+ T as fetchWithTimeout,
32
+ d as hashWeb,
33
+ n as listFiles,
34
+ F as putFile,
35
+ m as sha256
36
+ };
@@ -0,0 +1,147 @@
1
+ import { existsSync as b } from "node:fs";
2
+ import { rm as d, mkdir as M, readFile as V, rename as T, readdir as x } from "node:fs/promises";
3
+ import { join as s } from "node:path";
4
+ import { isNewer as y, validManifest as $, fileUrl as U } from "../updates/manifest.js";
5
+ import { planWeb as D } from "../updates/webPlan.js";
6
+ import { fetchWithTimeout as u, hashWeb as E, putFile as g, sha256 as P } from "./webFiles.js";
7
+ import { WebPointers as W } from "./webPointers.js";
8
+ class C {
9
+ constructor(e) {
10
+ this.options = e, this.o = {
11
+ root: e.root,
12
+ builtinDir: e.builtinDir,
13
+ appVersion: e.appVersion,
14
+ channelUrl: e.channelUrl,
15
+ packaged: e.packaged ?? !0,
16
+ maxTries: e.maxTries ?? 2,
17
+ keepPrevious: e.keepPrevious ?? !0,
18
+ entry: e.entry ?? "index.html",
19
+ parallel: e.parallel ?? 6,
20
+ fetchTimeoutMs: e.fetchTimeoutMs ?? 15e3,
21
+ fetch: e.fetch ?? ((t, i) => globalThis.fetch(t, i)),
22
+ log: e.log ?? ((...t) => console.error(...t))
23
+ }, this.pointers = new W(e.root);
24
+ }
25
+ options;
26
+ o;
27
+ pointers;
28
+ shellValue = null;
29
+ /** The web this run loads, and its version (the installed build's own when none is patched in). */
30
+ loaded = null;
31
+ /** The tidy a start began: a build waits for it, or it could delete the `.part` folder being filled. */
32
+ tidying = Promise.resolve();
33
+ /** This shell's identity. */
34
+ get shell() {
35
+ const e = this.options.shell;
36
+ return this.shellValue ??= typeof e == "string" ? e : e(), this.shellValue;
37
+ }
38
+ /** Where the window loads the page from: a patched web when there is a good one, else the built-in copy. */
39
+ startEntry() {
40
+ if (!this.o.packaged)
41
+ return this.loaded = { dir: this.o.builtinDir, version: this.o.appVersion }, s(this.o.builtinDir, this.o.entry);
42
+ try {
43
+ const e = this.pointers.read("pending");
44
+ this.usable(e) && this.promote(e, 0), this.pointers.write("pending", null);
45
+ const t = this.pointers.read("active");
46
+ if (this.usable(t) && (t.booted || t.tries < this.o.maxTries))
47
+ t.booted || this.pointers.write("active", { ...t, tries: t.tries + 1 }), this.loaded = { dir: s(this.o.root, t.version), version: t.version };
48
+ else {
49
+ t && this.pointers.write("active", null);
50
+ const i = this.pointers.read("previous");
51
+ this.pointers.write("previous", null), this.o.keepPrevious && i?.booted && this.usable(i) && (this.pointers.write("active", i), this.loaded = { dir: s(this.o.root, i.version), version: i.version });
52
+ }
53
+ } catch (e) {
54
+ this.o.log("[web] could not read the patched web, using the built-in one", e);
55
+ }
56
+ return this.loaded ??= { dir: this.o.builtinDir, version: this.o.appVersion }, this.tidying = this.tidy(), s(this.loaded.dir, this.o.entry);
57
+ }
58
+ /** The version of the web running now. */
59
+ webVersion() {
60
+ return this.loaded?.version ?? this.o.appVersion;
61
+ }
62
+ /** The page came up: the web it was loaded from is kept from now on. Call it from the page's own "booted" message. */
63
+ markBooted() {
64
+ const e = this.pointers.read("active");
65
+ e && this.loaded && e.version === this.loaded.version && !e.booted && this.pointers.write("active", { ...e, booted: !0 });
66
+ }
67
+ /** The channel's newest build, or null when the store cannot be read. */
68
+ async latest() {
69
+ try {
70
+ const e = await u(this.o.fetch, `${this.o.channelUrl}/latest.json`, this.o.fetchTimeoutMs);
71
+ if (!e.ok) return null;
72
+ const t = await e.json();
73
+ return typeof t?.version == "string" ? t : null;
74
+ } catch {
75
+ return null;
76
+ }
77
+ }
78
+ /** Whether `l`'s web can be patched in here rather than installed: newer than the web running, for this shell. */
79
+ patchable(e) {
80
+ return !!e.web && e.web.shell === this.shell && y(e.version, this.webVersion());
81
+ }
82
+ /**
83
+ * Builds `l`'s web beside the one running: the files held are copied, the rest downloaded and checked, into
84
+ * `<version>.part/`, which becomes `<version>/` and the pending web once whole — a crash mid-way never leaves a
85
+ * folder that looks finished. `onProgress` gets 0–100. Resolves with the version built; throws on any failure.
86
+ */
87
+ async prepare(e, t = () => {
88
+ }) {
89
+ if (!e.web) throw new Error("no web in this release");
90
+ const i = await u(this.o.fetch, `${this.o.channelUrl}/${e.web.manifest}`, this.o.fetchTimeoutMs);
91
+ if (!i.ok) throw new Error(`web manifest ${i.status}`);
92
+ const o = await i.json();
93
+ if (!$(o) || o.version !== e.version || o.shell !== this.shell) throw new Error("bad web manifest");
94
+ const l = s(this.o.root, o.version), p = { version: o.version, shell: o.shell, booted: !1, tries: 0 };
95
+ if (b(s(l, this.o.entry)) && this.pointers.read("active")?.version !== o.version)
96
+ return this.pointers.write("pending", p), t(100), o.version;
97
+ await this.tidying;
98
+ const f = this.loaded?.dir ?? this.o.builtinDir, h = D(o, await E(f)), n = s(this.o.root, `${o.version}.part`);
99
+ await d(n, { recursive: !0, force: !0 }), await M(n, { recursive: !0 });
100
+ for (const r of h.copy) await g(n, r.path, await V(s(f, ...r.from.split("/"))));
101
+ let v = 0;
102
+ const w = /* @__PURE__ */ new Map(), m = [...h.download];
103
+ t(h.bytes ? 0 : 100);
104
+ const k = async () => {
105
+ for (let r = m.shift(); r; r = m.shift()) {
106
+ let a = w.get(r.sha256);
107
+ if (!a) {
108
+ const c = await u(this.o.fetch, U(this.o.channelUrl, r.sha256), this.o.fetchTimeoutMs);
109
+ if (!c.ok) throw new Error(`${r.path}: ${c.status}`);
110
+ if (a = new Uint8Array(await c.arrayBuffer()), P(a) !== r.sha256) throw new Error(`${r.path}: checksum`);
111
+ w.set(r.sha256, a), v += r.size, t(Math.min(99, Math.round(v / Math.max(1, h.bytes) * 100)));
112
+ }
113
+ await g(n, r.path, a);
114
+ }
115
+ };
116
+ return await Promise.all(Array.from({ length: Math.max(1, this.o.parallel) }, k)), await d(l, { recursive: !0, force: !0 }), await T(n, l), this.pointers.write("pending", p), t(100), o.version;
117
+ }
118
+ /**
119
+ * Puts the pending web in use now and returns the page to load (reload every window from it), or null when there is
120
+ * none this shell may load. The switch counts as its first start, so a web that never boots is still dropped.
121
+ */
122
+ applyPending() {
123
+ const e = this.pointers.read("pending");
124
+ return this.usable(e) ? (this.promote(e, 1), this.pointers.write("pending", null), this.loaded = { dir: s(this.o.root, e.version), version: e.version }, s(this.loaded.dir, this.o.entry)) : null;
125
+ }
126
+ /** Makes `p` the active web, keeping the one it replaces as the fallback when that one ever booted. */
127
+ promote(e, t) {
128
+ const i = this.pointers.read("active");
129
+ this.o.keepPrevious && i?.booted && i.version !== e.version && this.pointers.write("previous", i), this.pointers.write("active", { ...e, booted: !1, tries: t });
130
+ }
131
+ /** A pointer this shell may load: its own shell, newer than the installed build, its folder whole. */
132
+ usable(e) {
133
+ return !!e && e.shell === this.shell && y(e.version, this.o.appVersion) && b(s(this.o.root, e.version, this.o.entry));
134
+ }
135
+ /** Removes every patched web but the active, pending and previous one, and any half-made folder. */
136
+ async tidy() {
137
+ try {
138
+ const e = ["active", "pending", "previous"], t = new Set([...e.map((i) => this.pointers.read(i)?.version), this.loaded?.version].filter((i) => !!i));
139
+ for (const i of await x(this.o.root))
140
+ i.endsWith(".json") || t.has(i) || await d(s(this.o.root, i), { recursive: !0, force: !0 });
141
+ } catch {
142
+ }
143
+ }
144
+ }
145
+ export {
146
+ C as WebPatcher
147
+ };
@@ -0,0 +1,25 @@
1
+ import { readFileSync as t, mkdirSync as i, writeFileSync as o, rmSync as s } from "node:fs";
2
+ import { join as n } from "node:path";
3
+ class c {
4
+ constructor(e) {
5
+ this.root = e;
6
+ }
7
+ root;
8
+ read(e) {
9
+ try {
10
+ const r = JSON.parse(t(this.file(e), "utf8"));
11
+ return typeof r?.version != "string" || typeof r.shell != "string" ? null : { version: r.version, shell: r.shell, booted: r.booted === !0, tries: typeof r.tries == "number" ? r.tries : 0 };
12
+ } catch {
13
+ return null;
14
+ }
15
+ }
16
+ write(e, r) {
17
+ r ? (i(this.root, { recursive: !0 }), o(this.file(e), JSON.stringify(r))) : s(this.file(e), { force: !0 });
18
+ }
19
+ file(e) {
20
+ return n(this.root, `${e}.json`);
21
+ }
22
+ }
23
+ export {
24
+ c as WebPointers
25
+ };
@@ -0,0 +1,19 @@
1
+ import { shellId as r } from "./electron/shellId.js";
2
+ import { WebPatcher as t } from "./electron/webPatcher.js";
3
+ import { SessionStore as l, registerSessionStore as n } from "./electron/sessionStore.js";
4
+ import { DEBUG_SWITCHES as f, debuggerRequested as m, isAllowedExternal as x, isAllowedNavigation as S, isDevToolsKey as a } from "./electron/lockdownRules.js";
5
+ import { denyPermissions as p, lockDownWindow as u, refuseDebugLaunch as w } from "./electron/lockdown.js";
6
+ export {
7
+ f as DEBUG_SWITCHES,
8
+ l as SessionStore,
9
+ t as WebPatcher,
10
+ m as debuggerRequested,
11
+ p as denyPermissions,
12
+ x as isAllowedExternal,
13
+ S as isAllowedNavigation,
14
+ a as isDevToolsKey,
15
+ u as lockDownWindow,
16
+ w as refuseDebugLaunch,
17
+ n as registerSessionStore,
18
+ r as shellId
19
+ };
@@ -1,9 +1,11 @@
1
- import { TextureSource as d, Application as l } from "pixi.js";
1
+ import { TextureSource as d, Application as p } from "pixi.js";
2
2
  import { Stage as o } from "../core/Stage.js";
3
- import { TextureRegistry as p } from "../core/TextureRegistry.js";
3
+ import { TextureRegistry as l } from "../core/TextureRegistry.js";
4
4
  import { patchPixi as m } from "../core/pixiPatches.js";
5
5
  import { EventBus as f } from "../events/EventBus.js";
6
- import { FixedLoop as g } from "./FixedLoop.js";
6
+ import { followReducedMotion as g } from "../platform/reducedMotion.js";
7
+ import { FixedLoop as w } from "./FixedLoop.js";
8
+ import { HiddenPause as k } from "./HiddenPause.js";
7
9
  import { SceneManager as v } from "./SceneManager.js";
8
10
  class x extends o {
9
11
  constructor(e, t, r) {
@@ -14,11 +16,11 @@ class x extends o {
14
16
  this.tick(e, t);
15
17
  }
16
18
  }
17
- class c {
19
+ class u {
18
20
  constructor(e, t, r) {
19
- this.app = e, this.loop = new g(r.hz === void 0 ? {} : { hz: r.hz }), this.stage = new x(e, t, (s, n) => this.tick(s, n));
20
- const i = this.stage.cameras.main;
21
- i.setZoom(r.zoom ?? 1), i.defaultZoom = i.zoom, i.roundPixels = r.pixelPerfect === !0, i.resolution = e.renderer.resolution, this.scenes = new v(this), o.onCaught = (s, n) => this.events.emit("error", { where: s, error: n }), e.ticker.add(this.onTick);
21
+ this.app = e, this.loop = new w(r.hz === void 0 ? {} : { hz: r.hz }), this.stage = new x(e, t, (i, n) => this.tick(i, n));
22
+ const s = this.stage.cameras.main;
23
+ s.setZoom(r.zoom ?? 1), s.defaultZoom = s.zoom, s.roundPixels = r.pixelPerfect === !0, s.resolution = e.renderer.resolution, this.scenes = new v(this), o.onCaught = (i, n) => this.events.emit("error", { where: i, error: n }), e.ticker.add(this.onTick), r.pauseWhenHidden === !0 && this.unwatch.push(this.hiddenPause.watch()), r.followReducedMotion === !0 && this.unwatch.push(g());
22
24
  }
23
25
  app;
24
26
  stage;
@@ -27,21 +29,24 @@ class c {
27
29
  events = new f();
28
30
  running = !0;
29
31
  destroyed = !1;
32
+ /** Pauses through the loop's own switch, so a hidden tab never counts as the game's own pause (`forget`). */
33
+ hiddenPause = this.makeHiddenPause();
34
+ unwatch = [];
30
35
  onTick = (e) => this.stage.frame(e.deltaMS);
31
36
  static async create(e) {
32
37
  const t = e.pixelPerfect === !0;
33
38
  d.defaultOptions.scaleMode = t ? "nearest" : "linear";
34
39
  const r = t ? 1 : e.resolution ?? Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1);
35
40
  m();
36
- const i = new l(), s = e.width === void 0 && e.height === void 0;
37
- return await i.init({
38
- ...s ? { resizeTo: e.parent } : { width: e.width ?? 800, height: e.height ?? 600 },
41
+ const s = new p(), i = e.width === void 0 && e.height === void 0;
42
+ return await s.init({
43
+ ...i ? { resizeTo: e.parent } : { width: e.width ?? 800, height: e.height ?? 600 },
39
44
  background: e.background ?? "#000000",
40
45
  antialias: !t,
41
46
  resolution: r,
42
47
  autoDensity: !0,
43
48
  preference: e.preference ?? "webgl"
44
- }), e.parent.appendChild(i.canvas), new c(i, e.textures ?? new p(), e);
49
+ }), e.parent.appendChild(s.canvas), new u(s, e.textures ?? new l(), e);
45
50
  }
46
51
  /** The scene that updates now, if any. */
47
52
  get scene() {
@@ -49,9 +54,25 @@ class c {
49
54
  }
50
55
  /** Stops simulating and drawing; the canvas keeps its last frame. */
51
56
  pause() {
52
- this.running && (this.running = !1, this.app.ticker.stop());
57
+ this.hiddenPause.forget(), this.pauseLoop();
53
58
  }
54
59
  resume() {
60
+ this.hiddenPause.forget(), this.resumeLoop();
61
+ }
62
+ makeHiddenPause() {
63
+ const e = this;
64
+ return new k({
65
+ get paused() {
66
+ return !e.running;
67
+ },
68
+ pause: () => e.pauseLoop(),
69
+ resume: () => e.resumeLoop()
70
+ });
71
+ }
72
+ pauseLoop() {
73
+ this.running && (this.running = !1, this.app.ticker.stop());
74
+ }
75
+ resumeLoop() {
55
76
  this.running || this.destroyed || (this.running = !0, this.loop.reset(), this.app.ticker.start());
56
77
  }
57
78
  get paused() {
@@ -63,20 +84,23 @@ class c {
63
84
  }
64
85
  /** Leaves every scene, removes the canvas and frees the renderer. */
65
86
  async destroy() {
66
- this.destroyed || (this.destroyed = !0, await this.scenes.clear(), this.app.ticker.remove(this.onTick), o.onCaught && (o.onCaught = null), this.stage.destroy(), this.events.clear(), this.app.destroy({ removeView: !0 }, { children: !0 }));
87
+ if (!this.destroyed) {
88
+ this.destroyed = !0;
89
+ for (const e of this.unwatch.splice(0)) e();
90
+ await this.scenes.clear(), this.app.ticker.remove(this.onTick), o.onCaught && (o.onCaught = null), this.stage.destroy(), this.events.clear(), this.app.destroy({ removeView: !0 }, { children: !0 });
91
+ }
67
92
  }
68
93
  tick(e, t) {
69
94
  const r = this.scenes.current;
70
95
  if (r) {
71
- const i = (h, u) => this.reportError(`system ${h.name}`, u), s = this.loop.stepSeconds, n = this.loop.advance(t, () => {
72
- r.world.run("fixed", { dt: s, now: e, alpha: 0 }, i), r.fixedUpdate(s);
96
+ const s = (h, c) => this.reportError(`system ${h.name}`, c), i = this.loop.stepSeconds, n = this.loop.advance(t, () => {
97
+ r.world.run("fixed", { dt: i, now: e, alpha: 0 }, s), r.fixedUpdate(i);
73
98
  }), a = t / 1e3;
74
- r.world.run("frame", { dt: a, now: e, alpha: n }, i), r.update(a, n);
99
+ r.world.run("frame", { dt: a, now: e, alpha: n }, s), r.update(a, n);
75
100
  }
76
101
  this.events.emit("frame", { now: e, dt: t / 1e3 });
77
102
  }
78
103
  }
79
104
  export {
80
- c as Engine
105
+ u as Engine
81
106
  };
82
- //# sourceMappingURL=Engine.js.map
@@ -34,4 +34,3 @@ class i {
34
34
  export {
35
35
  i as FixedLoop
36
36
  };
37
- //# sourceMappingURL=FixedLoop.js.map
@@ -0,0 +1,27 @@
1
+ class s {
2
+ constructor(e) {
3
+ this.target = e;
4
+ }
5
+ target;
6
+ pausedByUs = !1;
7
+ hidden() {
8
+ this.target.paused || (this.target.pause(), this.pausedByUs = !0);
9
+ }
10
+ shown() {
11
+ this.pausedByUs && (this.pausedByUs = !1, this.target.paused && this.target.resume());
12
+ }
13
+ /** The game paused or resumed it itself: whatever happens next is its choice, not ours to undo. */
14
+ forget() {
15
+ this.pausedByUs = !1;
16
+ }
17
+ /** Listens to `visibilitychange` on `doc`; returns the unsubscribe. A no-op without a document. */
18
+ watch(e = typeof document > "u" ? null : document) {
19
+ if (!e) return () => {
20
+ };
21
+ const t = () => e.visibilityState === "hidden" ? this.hidden() : this.shown();
22
+ return e.addEventListener("visibilitychange", t), e.visibilityState === "hidden" && this.hidden(), () => e.removeEventListener("visibilitychange", t);
23
+ }
24
+ }
25
+ export {
26
+ s as HiddenPause
27
+ };