1681-engine 0.0.0-stage → 0.5.8

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 (1014) hide show
  1. package/CHANGELOG.md +304 -0
  2. package/LICENSE +21 -0
  3. package/README.md +164 -2
  4. package/dist/1681-engine.js +417 -0
  5. package/dist/1681-engine.js.map +1 -0
  6. package/dist/ambient/ColorGrade.js +41 -0
  7. package/dist/ambient/ColorGrade.js.map +1 -0
  8. package/dist/ambient/DayClock.js +57 -0
  9. package/dist/ambient/DayClock.js.map +1 -0
  10. package/dist/ambient/WeatherLayer.js +91 -0
  11. package/dist/ambient/WeatherLayer.js.map +1 -0
  12. package/dist/ambient/grade.js +13 -0
  13. package/dist/ambient/grade.js.map +1 -0
  14. package/dist/ambient/weather.js +52 -0
  15. package/dist/ambient/weather.js.map +1 -0
  16. package/dist/anim/AnimStateMachine.js +164 -0
  17. package/dist/anim/AnimStateMachine.js.map +1 -0
  18. package/dist/anim/Animator.js +67 -0
  19. package/dist/anim/Animator.js.map +1 -0
  20. package/dist/anim/animStateCompile.js +113 -0
  21. package/dist/anim/animStateCompile.js.map +1 -0
  22. package/dist/anim/animStateSystem.js +17 -0
  23. package/dist/anim/animStateSystem.js.map +1 -0
  24. package/dist/anim/animationSystem.js +15 -0
  25. package/dist/anim/animationSystem.js.map +1 -0
  26. package/dist/anim/asepriteSlices.js +22 -0
  27. package/dist/anim/asepriteSlices.js.map +1 -0
  28. package/dist/anim/asepriteTags.js +35 -0
  29. package/dist/anim/asepriteTags.js.map +1 -0
  30. package/dist/anim/parseAseprite.js +83 -0
  31. package/dist/anim/parseAseprite.js.map +1 -0
  32. package/dist/assets/AssetLoader.js +104 -0
  33. package/dist/assets/AssetLoader.js.map +1 -0
  34. package/dist/assets/loadAseprite.js +50 -0
  35. package/dist/assets/loadAseprite.js.map +1 -0
  36. package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +31 -0
  37. package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +1 -0
  38. package/dist/audio/Footsteps.js +26 -0
  39. package/dist/audio/Footsteps.js.map +1 -0
  40. package/dist/audio/MusicPlayer.js +78 -0
  41. package/dist/audio/MusicPlayer.js.map +1 -0
  42. package/dist/audio/SoundEngine.js +119 -0
  43. package/dist/audio/SoundEngine.js.map +1 -0
  44. package/dist/audio/cleanTake.js +30 -0
  45. package/dist/audio/cleanTake.js.map +1 -0
  46. package/dist/audio/music/ElementVoice.js +35 -0
  47. package/dist/audio/music/ElementVoice.js.map +1 -0
  48. package/dist/audio/music/GraphVoice.js +39 -0
  49. package/dist/audio/music/GraphVoice.js.map +1 -0
  50. package/dist/audio/music/MusicChannel.js +58 -0
  51. package/dist/audio/music/MusicChannel.js.map +1 -0
  52. package/dist/audio/music/musicVoice.js +13 -0
  53. package/dist/audio/music/musicVoice.js.map +1 -0
  54. package/dist/audio/sampleBank.js +82 -0
  55. package/dist/audio/sampleBank.js.map +1 -0
  56. package/dist/audio/soundTable.js +9 -0
  57. package/dist/audio/soundTable.js.map +1 -0
  58. package/dist/audio/synth.js +36 -0
  59. package/dist/audio/synth.js.map +1 -0
  60. package/dist/core/BitmapLabel.js +49 -0
  61. package/dist/core/BitmapLabel.js.map +1 -0
  62. package/dist/core/Camera.js +150 -0
  63. package/dist/core/Camera.js.map +1 -0
  64. package/dist/core/Clock.js +30 -0
  65. package/dist/core/Clock.js.map +1 -0
  66. package/dist/core/Graphics.js +69 -0
  67. package/dist/core/Graphics.js.map +1 -0
  68. package/dist/core/Group.js +29 -0
  69. package/dist/core/Group.js.map +1 -0
  70. package/dist/core/Image.js +51 -0
  71. package/dist/core/Image.js.map +1 -0
  72. package/dist/core/ObjectFactory.js +55 -0
  73. package/dist/core/ObjectFactory.js.map +1 -0
  74. package/dist/core/Pointer.js +58 -0
  75. package/dist/core/Pointer.js.map +1 -0
  76. package/dist/core/Rectangle.js +51 -0
  77. package/dist/core/Rectangle.js.map +1 -0
  78. package/dist/core/Stage.js +86 -0
  79. package/dist/core/Stage.js.map +1 -0
  80. package/dist/core/Text.js +22 -0
  81. package/dist/core/Text.js.map +1 -0
  82. package/dist/core/TextureRegistry.js +111 -0
  83. package/dist/core/TextureRegistry.js.map +1 -0
  84. package/dist/core/Timeline.js +211 -0
  85. package/dist/core/Timeline.js.map +1 -0
  86. package/dist/core/TimelineBuilder.js +73 -0
  87. package/dist/core/TimelineBuilder.js.map +1 -0
  88. package/dist/core/TimelineChild.js +84 -0
  89. package/dist/core/TimelineChild.js.map +1 -0
  90. package/dist/core/Tweener.js +136 -0
  91. package/dist/core/Tweener.js.map +1 -0
  92. package/dist/core/atlas.js +38 -0
  93. package/dist/core/atlas.js.map +1 -0
  94. package/dist/core/atlasPlan.js +22 -0
  95. package/dist/core/atlasPlan.js.map +1 -0
  96. package/dist/core/eases.js +21 -0
  97. package/dist/core/eases.js.map +1 -0
  98. package/dist/core/gameObject.js +115 -0
  99. package/dist/core/gameObject.js.map +1 -0
  100. package/dist/core/pixiPatches.js +18 -0
  101. package/dist/core/pixiPatches.js.map +1 -0
  102. package/dist/core/timelinePlace.js +24 -0
  103. package/dist/core/timelinePlace.js.map +1 -0
  104. package/dist/core/tweenProps.js +12 -0
  105. package/dist/core/tweenProps.js.map +1 -0
  106. package/dist/debug/DebugOverlay.js +94 -0
  107. package/dist/debug/DebugOverlay.js.map +1 -0
  108. package/dist/debug/DrawCallCounter.js +41 -0
  109. package/dist/debug/DrawCallCounter.js.map +1 -0
  110. package/dist/debug/ErrorLog.js +22 -0
  111. package/dist/debug/ErrorLog.js.map +1 -0
  112. package/dist/debug/FrameStats.js +42 -0
  113. package/dist/debug/FrameStats.js.map +1 -0
  114. package/dist/debug/inspectWorld.js +29 -0
  115. package/dist/debug/inspectWorld.js.map +1 -0
  116. package/dist/diagnostics/ErrorDeduper.js +27 -0
  117. package/dist/diagnostics/ErrorDeduper.js.map +1 -0
  118. package/dist/diagnostics/FrameSampler.js +42 -0
  119. package/dist/diagnostics/FrameSampler.js.map +1 -0
  120. package/dist/diagnostics/bootWatch.js +21 -0
  121. package/dist/diagnostics/bootWatch.js.map +1 -0
  122. package/dist/diagnostics/captureErrors.js +27 -0
  123. package/dist/diagnostics/captureErrors.js.map +1 -0
  124. package/dist/diagnostics/contextLoss.js +25 -0
  125. package/dist/diagnostics/contextLoss.js.map +1 -0
  126. package/dist/diagnostics/frameStats.js +31 -0
  127. package/dist/diagnostics/frameStats.js.map +1 -0
  128. package/dist/diagnostics/gpuInfo.js +22 -0
  129. package/dist/diagnostics/gpuInfo.js.map +1 -0
  130. package/dist/diagnostics/renderGuard.js +24 -0
  131. package/dist/diagnostics/renderGuard.js.map +1 -0
  132. package/dist/ecs/SparseSet.js +55 -0
  133. package/dist/ecs/SparseSet.js.map +1 -0
  134. package/dist/ecs/World.js +307 -0
  135. package/dist/ecs/World.js.map +1 -0
  136. package/dist/ecs/fields.js +26 -0
  137. package/dist/ecs/fields.js.map +1 -0
  138. package/dist/engine/Engine.js +82 -0
  139. package/dist/engine/Engine.js.map +1 -0
  140. package/dist/engine/FixedLoop.js +37 -0
  141. package/dist/engine/FixedLoop.js.map +1 -0
  142. package/dist/engine/Scene.js +79 -0
  143. package/dist/engine/Scene.js.map +1 -0
  144. package/dist/engine/SceneManager.js +73 -0
  145. package/dist/engine/SceneManager.js.map +1 -0
  146. package/dist/events/EventBus.js +42 -0
  147. package/dist/events/EventBus.js.map +1 -0
  148. package/dist/fx/FloatingText.js +72 -0
  149. package/dist/fx/FloatingText.js.map +1 -0
  150. package/dist/fx/hitStop.js +28 -0
  151. package/dist/fx/hitStop.js.map +1 -0
  152. package/dist/fx/viewCull.js +10 -0
  153. package/dist/fx/viewCull.js.map +1 -0
  154. package/dist/i18n/Translator.js +72 -0
  155. package/dist/i18n/Translator.js.map +1 -0
  156. package/dist/i18n/extractStrings.js +58 -0
  157. package/dist/i18n/extractStrings.js.map +1 -0
  158. package/dist/i18n/formatMessage.js +19 -0
  159. package/dist/i18n/formatMessage.js.map +1 -0
  160. package/dist/input/Actions.js +131 -0
  161. package/dist/input/Actions.js.map +1 -0
  162. package/dist/input/AimGesture.js +75 -0
  163. package/dist/input/AimGesture.js.map +1 -0
  164. package/dist/input/Keyboard.js +54 -0
  165. package/dist/input/Keyboard.js.map +1 -0
  166. package/dist/input/Keymap.js +171 -0
  167. package/dist/input/Keymap.js.map +1 -0
  168. package/dist/input/TargetLock.js +73 -0
  169. package/dist/input/TargetLock.js.map +1 -0
  170. package/dist/input/aimAxis.js +8 -0
  171. package/dist/input/aimAxis.js.map +1 -0
  172. package/dist/input/keyChord.js +29 -0
  173. package/dist/input/keyChord.js.map +1 -0
  174. package/dist/input/longPress.js +32 -0
  175. package/dist/input/longPress.js.map +1 -0
  176. package/dist/input/stickAxis.js +23 -0
  177. package/dist/input/stickAxis.js.map +1 -0
  178. package/dist/input/touchDetect.js +7 -0
  179. package/dist/input/touchDetect.js.map +1 -0
  180. package/dist/light/LightLayer.js +84 -0
  181. package/dist/light/LightLayer.js.map +1 -0
  182. package/dist/nav/MinHeap.js +39 -0
  183. package/dist/nav/MinHeap.js.map +1 -0
  184. package/dist/nav/findPath.js +78 -0
  185. package/dist/nav/findPath.js.map +1 -0
  186. package/dist/nav/navGrid.js +36 -0
  187. package/dist/nav/navGrid.js.map +1 -0
  188. package/dist/nav/nearestOpen.js +19 -0
  189. package/dist/nav/nearestOpen.js.map +1 -0
  190. package/dist/nav/straightenPath.js +51 -0
  191. package/dist/nav/straightenPath.js.map +1 -0
  192. package/dist/net/Connection.js +84 -0
  193. package/dist/net/Connection.js.map +1 -0
  194. package/dist/net/InterpolationBuffer.js +57 -0
  195. package/dist/net/InterpolationBuffer.js.map +1 -0
  196. package/dist/net/PredictedMover.js +61 -0
  197. package/dist/net/PredictedMover.js.map +1 -0
  198. package/dist/net/Room.js +92 -0
  199. package/dist/net/Room.js.map +1 -0
  200. package/dist/net/RoomHost.js +101 -0
  201. package/dist/net/RoomHost.js.map +1 -0
  202. package/dist/net/cadence.js +22 -0
  203. package/dist/net/cadence.js.map +1 -0
  204. package/dist/net/constants.js +11 -0
  205. package/dist/net/constants.js.map +1 -0
  206. package/dist/net/lobby/LobbyClient.js +124 -0
  207. package/dist/net/lobby/LobbyClient.js.map +1 -0
  208. package/dist/net/lobby/LobbyHost.js +366 -0
  209. package/dist/net/lobby/LobbyHost.js.map +1 -0
  210. package/dist/net/lobby/LobbyRooms.js +66 -0
  211. package/dist/net/lobby/LobbyRooms.js.map +1 -0
  212. package/dist/net/lobby/Matchmaker.js +106 -0
  213. package/dist/net/lobby/Matchmaker.js.map +1 -0
  214. package/dist/net/movement.js +83 -0
  215. package/dist/net/movement.js.map +1 -0
  216. package/dist/net/protocol.js +11 -0
  217. package/dist/net/protocol.js.map +1 -0
  218. package/dist/net/serverClock.js +22 -0
  219. package/dist/net/serverClock.js.map +1 -0
  220. package/dist/net/snapshotCodec.js +92 -0
  221. package/dist/net/snapshotCodec.js.map +1 -0
  222. package/dist/parallax/Parallax.js +32 -0
  223. package/dist/parallax/Parallax.js.map +1 -0
  224. package/dist/parallax/ParallaxLayer.js +70 -0
  225. package/dist/parallax/ParallaxLayer.js.map +1 -0
  226. package/dist/parallax/parallaxMath.js +27 -0
  227. package/dist/parallax/parallaxMath.js.map +1 -0
  228. package/dist/particles/Emitter.js +108 -0
  229. package/dist/particles/Emitter.js.map +1 -0
  230. package/dist/particles/ParticleBudget.js +32 -0
  231. package/dist/particles/ParticleBudget.js.map +1 -0
  232. package/dist/particles/ParticleSim.js +60 -0
  233. package/dist/particles/ParticleSim.js.map +1 -0
  234. package/dist/particles/particleCurves.js +48 -0
  235. package/dist/particles/particleCurves.js.map +1 -0
  236. package/dist/particles/particleSampling.js +30 -0
  237. package/dist/particles/particleSampling.js.map +1 -0
  238. package/dist/physics/Body.js +202 -0
  239. package/dist/physics/Body.js.map +1 -0
  240. package/dist/physics/BroadPhase.js +56 -0
  241. package/dist/physics/BroadPhase.js.map +1 -0
  242. package/dist/physics/Contact.js +76 -0
  243. package/dist/physics/Contact.js.map +1 -0
  244. package/dist/physics/ContactSolver.js +70 -0
  245. package/dist/physics/ContactSolver.js.map +1 -0
  246. package/dist/physics/PhysicsWorld.js +221 -0
  247. package/dist/physics/PhysicsWorld.js.map +1 -0
  248. package/dist/physics/SpatialHash.js +39 -0
  249. package/dist/physics/SpatialHash.js.map +1 -0
  250. package/dist/physics/collide.js +76 -0
  251. package/dist/physics/collide.js.map +1 -0
  252. package/dist/physics/collidePolygon.js +94 -0
  253. package/dist/physics/collidePolygon.js.map +1 -0
  254. package/dist/physics/contactReport.js +14 -0
  255. package/dist/physics/contactReport.js.map +1 -0
  256. package/dist/physics/drawColliders.js +31 -0
  257. package/dist/physics/drawColliders.js.map +1 -0
  258. package/dist/physics/physicsSystem.js +8 -0
  259. package/dist/physics/physicsSystem.js.map +1 -0
  260. package/dist/physics/polygon.js +80 -0
  261. package/dist/physics/polygon.js.map +1 -0
  262. package/dist/physics/raycast.js +62 -0
  263. package/dist/physics/raycast.js.map +1 -0
  264. package/dist/physics/syncToBody.js +19 -0
  265. package/dist/physics/syncToBody.js.map +1 -0
  266. package/dist/physics/tileBodies.js +59 -0
  267. package/dist/physics/tileBodies.js.map +1 -0
  268. package/dist/physics/types.js +8 -0
  269. package/dist/physics/types.js.map +1 -0
  270. package/dist/pixel/Darkness.js +166 -0
  271. package/dist/pixel/Darkness.js.map +1 -0
  272. package/dist/pixel/DitherVignette.js +57 -0
  273. package/dist/pixel/DitherVignette.js.map +1 -0
  274. package/dist/pixel/Evaporation.js +85 -0
  275. package/dist/pixel/Evaporation.js.map +1 -0
  276. package/dist/pixel/NightShade.js +34 -0
  277. package/dist/pixel/NightShade.js.map +1 -0
  278. package/dist/pixel/PixelLayer.js +211 -0
  279. package/dist/pixel/PixelLayer.js.map +1 -0
  280. package/dist/pixel/SwayProp.js +75 -0
  281. package/dist/pixel/SwayProp.js.map +1 -0
  282. package/dist/pixel/lights.js +44 -0
  283. package/dist/pixel/lights.js.map +1 -0
  284. package/dist/pixel/nineSlice.js +62 -0
  285. package/dist/pixel/nineSlice.js.map +1 -0
  286. package/dist/pixel/paintLayer.js +36 -0
  287. package/dist/pixel/paintLayer.js.map +1 -0
  288. package/dist/pixel/palette.js +57 -0
  289. package/dist/pixel/palette.js.map +1 -0
  290. package/dist/pixel/pixel.js +278 -0
  291. package/dist/pixel/pixel.js.map +1 -0
  292. package/dist/pixel/pixelPaint.js +194 -0
  293. package/dist/pixel/pixelPaint.js.map +1 -0
  294. package/dist/pixel/pixelTone.js +164 -0
  295. package/dist/pixel/pixelTone.js.map +1 -0
  296. package/dist/pixel/propKit.js +41 -0
  297. package/dist/pixel/propKit.js.map +1 -0
  298. package/dist/pixel/ramp.js +102 -0
  299. package/dist/pixel/ramp.js.map +1 -0
  300. package/dist/pixel/selout.js +35 -0
  301. package/dist/pixel/selout.js.map +1 -0
  302. package/dist/pixel/spritePixels.js +59 -0
  303. package/dist/pixel/spritePixels.js.map +1 -0
  304. package/dist/pixel/swayRig.js +87 -0
  305. package/dist/pixel/swayRig.js.map +1 -0
  306. package/dist/pixel/vignetteMask.js +24 -0
  307. package/dist/pixel/vignetteMask.js.map +1 -0
  308. package/dist/pixel/weatherArt.js +61 -0
  309. package/dist/pixel/weatherArt.js.map +1 -0
  310. package/dist/pixel.js +90 -0
  311. package/dist/pixel.js.map +1 -0
  312. package/dist/platform/touch.js +33 -0
  313. package/dist/platform/touch.js.map +1 -0
  314. package/dist/postfx/BloomFilter.js +65 -0
  315. package/dist/postfx/BloomFilter.js.map +1 -0
  316. package/dist/postfx/ChromaticAberrationFilter.js +25 -0
  317. package/dist/postfx/ChromaticAberrationFilter.js.map +1 -0
  318. package/dist/postfx/ColorAdjustFilter.js +76 -0
  319. package/dist/postfx/ColorAdjustFilter.js.map +1 -0
  320. package/dist/postfx/CrtFilter.js +42 -0
  321. package/dist/postfx/CrtFilter.js.map +1 -0
  322. package/dist/postfx/PixelateFilter.js +27 -0
  323. package/dist/postfx/PixelateFilter.js.map +1 -0
  324. package/dist/postfx/PostFx.js +123 -0
  325. package/dist/postfx/PostFx.js.map +1 -0
  326. package/dist/postfx/ShockwaveFilter.js +49 -0
  327. package/dist/postfx/ShockwaveFilter.js.map +1 -0
  328. package/dist/postfx/VignetteFilter.js +37 -0
  329. package/dist/postfx/VignetteFilter.js.map +1 -0
  330. package/dist/postfx/fxAnimator.js +38 -0
  331. package/dist/postfx/fxAnimator.js.map +1 -0
  332. package/dist/postfx/fxShader.js +128 -0
  333. package/dist/postfx/fxShader.js.map +1 -0
  334. package/dist/postfx.js +26 -0
  335. package/dist/postfx.js.map +1 -0
  336. package/dist/react/ChoiceDialog.js +51 -0
  337. package/dist/react/ChoiceDialog.js.map +1 -0
  338. package/dist/react/ConfirmDialog.js +53 -0
  339. package/dist/react/ConfirmDialog.js.map +1 -0
  340. package/dist/react/Glyph.js +63 -0
  341. package/dist/react/Glyph.js.map +1 -0
  342. package/dist/react/Modal.js +38 -0
  343. package/dist/react/Modal.js.map +1 -0
  344. package/dist/react/Panel.js +24 -0
  345. package/dist/react/Panel.js.map +1 -0
  346. package/dist/react/PixelImage.js +24 -0
  347. package/dist/react/PixelImage.js.map +1 -0
  348. package/dist/react/Select.js +99 -0
  349. package/dist/react/Select.js.map +1 -0
  350. package/dist/react/Slider.js +62 -0
  351. package/dist/react/Slider.js.map +1 -0
  352. package/dist/react/SplitPane.js +24 -0
  353. package/dist/react/SplitPane.js.map +1 -0
  354. package/dist/react/TabStrip.js +32 -0
  355. package/dist/react/TabStrip.js.map +1 -0
  356. package/dist/react/TitleTips.js +42 -0
  357. package/dist/react/TitleTips.js.map +1 -0
  358. package/dist/react/Tooltip.js +28 -0
  359. package/dist/react/Tooltip.js.map +1 -0
  360. package/dist/react/UiProvider.js +50 -0
  361. package/dist/react/UiProvider.js.map +1 -0
  362. package/dist/react/baseCss.js +222 -0
  363. package/dist/react/baseCss.js.map +1 -0
  364. package/dist/react/choiceStore.js +23 -0
  365. package/dist/react/choiceStore.js.map +1 -0
  366. package/dist/react/classNames.js +19 -0
  367. package/dist/react/classNames.js.map +1 -0
  368. package/dist/react/confirmStore.js +30 -0
  369. package/dist/react/confirmStore.js.map +1 -0
  370. package/dist/react/labels.js +18 -0
  371. package/dist/react/labels.js.map +1 -0
  372. package/dist/react/placement.js +49 -0
  373. package/dist/react/placement.js.map +1 -0
  374. package/dist/react/useFillSheet.js +23 -0
  375. package/dist/react/useFillSheet.js.map +1 -0
  376. package/dist/react/useFitToViewport.js +29 -0
  377. package/dist/react/useFitToViewport.js.map +1 -0
  378. package/dist/react/usePicked.js +13 -0
  379. package/dist/react/usePicked.js.map +1 -0
  380. package/dist/react/useStore.js +9 -0
  381. package/dist/react/useStore.js.map +1 -0
  382. package/dist/react/useViewport.js +17 -0
  383. package/dist/react/useViewport.js.map +1 -0
  384. package/dist/react.js +78 -0
  385. package/dist/react.js.map +1 -0
  386. package/dist/rig/PosePlayer.js +92 -0
  387. package/dist/rig/PosePlayer.js.map +1 -0
  388. package/dist/rig/RigView.js +125 -0
  389. package/dist/rig/RigView.js.map +1 -0
  390. package/dist/rig/Skeleton.js +31 -0
  391. package/dist/rig/Skeleton.js.map +1 -0
  392. package/dist/rig/humanoid.js +6 -0
  393. package/dist/rig/humanoid.js.map +1 -0
  394. package/dist/rig/humanoid.json.js +30 -0
  395. package/dist/rig/humanoid.json.js.map +1 -0
  396. package/dist/rig/humanoidPoses.js +30 -0
  397. package/dist/rig/humanoidPoses.js.map +1 -0
  398. package/dist/rig/poseMath.js +54 -0
  399. package/dist/rig/poseMath.js.map +1 -0
  400. package/dist/rig/poses.json.js +150 -0
  401. package/dist/rig/poses.json.js.map +1 -0
  402. package/dist/save/Autosaver.js +54 -0
  403. package/dist/save/Autosaver.js.map +1 -0
  404. package/dist/save/MemoryBackend.js +19 -0
  405. package/dist/save/MemoryBackend.js.map +1 -0
  406. package/dist/save/SaveStore.js +103 -0
  407. package/dist/save/SaveStore.js.map +1 -0
  408. package/dist/save/WebStorageBackend.js +27 -0
  409. package/dist/save/WebStorageBackend.js.map +1 -0
  410. package/dist/save/checksum.js +10 -0
  411. package/dist/save/checksum.js.map +1 -0
  412. package/dist/save/migrateSave.js +27 -0
  413. package/dist/save/migrateSave.js.map +1 -0
  414. package/dist/settings.js +27 -0
  415. package/dist/settings.js.map +1 -0
  416. package/dist/tilemap/TilemapView.js +69 -0
  417. package/dist/tilemap/TilemapView.js.map +1 -0
  418. package/dist/tilemap/collision.js +25 -0
  419. package/dist/tilemap/collision.js.map +1 -0
  420. package/dist/tilemap/tiled.js +138 -0
  421. package/dist/tilemap/tiled.js.map +1 -0
  422. package/dist/transitions/CrossfadeTransition.js +24 -0
  423. package/dist/transitions/CrossfadeTransition.js.map +1 -0
  424. package/dist/transitions/DitherWipeTransition.js +70 -0
  425. package/dist/transitions/DitherWipeTransition.js.map +1 -0
  426. package/dist/transitions/FadeTransition.js +34 -0
  427. package/dist/transitions/FadeTransition.js.map +1 -0
  428. package/dist/transitions/Letterbox.js +42 -0
  429. package/dist/transitions/Letterbox.js.map +1 -0
  430. package/dist/transitions/ditherMask.js +15 -0
  431. package/dist/transitions/ditherMask.js.map +1 -0
  432. package/dist/transitions/transitionTo.js +28 -0
  433. package/dist/transitions/transitionTo.js.map +1 -0
  434. package/dist/transitions/tweenDone.js +15 -0
  435. package/dist/transitions/tweenDone.js.map +1 -0
  436. package/dist/types/ambient/ColorGrade.d.ts +41 -0
  437. package/dist/types/ambient/ColorGrade.d.ts.map +1 -0
  438. package/dist/types/ambient/DayClock.d.ts +80 -0
  439. package/dist/types/ambient/DayClock.d.ts.map +1 -0
  440. package/dist/types/ambient/WeatherLayer.d.ts +78 -0
  441. package/dist/types/ambient/WeatherLayer.d.ts.map +1 -0
  442. package/dist/types/ambient/grade.d.ts +22 -0
  443. package/dist/types/ambient/grade.d.ts.map +1 -0
  444. package/dist/types/ambient/weather.d.ts +49 -0
  445. package/dist/types/ambient/weather.d.ts.map +1 -0
  446. package/dist/types/anim/AnimStateMachine.d.ts +80 -0
  447. package/dist/types/anim/AnimStateMachine.d.ts.map +1 -0
  448. package/dist/types/anim/Animator.d.ts +50 -0
  449. package/dist/types/anim/Animator.d.ts.map +1 -0
  450. package/dist/types/anim/animStateCompile.d.ts +52 -0
  451. package/dist/types/anim/animStateCompile.d.ts.map +1 -0
  452. package/dist/types/anim/animStateSystem.d.ts +10 -0
  453. package/dist/types/anim/animStateSystem.d.ts.map +1 -0
  454. package/dist/types/anim/animStateTypes.d.ts +50 -0
  455. package/dist/types/anim/animStateTypes.d.ts.map +1 -0
  456. package/dist/types/anim/animationSystem.d.ts +13 -0
  457. package/dist/types/anim/animationSystem.d.ts.map +1 -0
  458. package/dist/types/anim/asepriteSlices.d.ts +19 -0
  459. package/dist/types/anim/asepriteSlices.d.ts.map +1 -0
  460. package/dist/types/anim/asepriteTags.d.ts +16 -0
  461. package/dist/types/anim/asepriteTags.d.ts.map +1 -0
  462. package/dist/types/anim/asepriteTypes.d.ts +159 -0
  463. package/dist/types/anim/asepriteTypes.d.ts.map +1 -0
  464. package/dist/types/anim/parseAseprite.d.ts +21 -0
  465. package/dist/types/anim/parseAseprite.d.ts.map +1 -0
  466. package/dist/types/assets/AssetLoader.d.ts +85 -0
  467. package/dist/types/assets/AssetLoader.d.ts.map +1 -0
  468. package/dist/types/assets/loadAseprite.d.ts +27 -0
  469. package/dist/types/assets/loadAseprite.d.ts.map +1 -0
  470. package/dist/types/audio/Footsteps.d.ts +33 -0
  471. package/dist/types/audio/Footsteps.d.ts.map +1 -0
  472. package/dist/types/audio/MusicPlayer.d.ts +65 -0
  473. package/dist/types/audio/MusicPlayer.d.ts.map +1 -0
  474. package/dist/types/audio/SoundEngine.d.ts +42 -0
  475. package/dist/types/audio/SoundEngine.d.ts.map +1 -0
  476. package/dist/types/audio/cleanTake.d.ts +3 -0
  477. package/dist/types/audio/cleanTake.d.ts.map +1 -0
  478. package/dist/types/audio/music/ElementVoice.d.ts +14 -0
  479. package/dist/types/audio/music/ElementVoice.d.ts.map +1 -0
  480. package/dist/types/audio/music/GraphVoice.d.ts +22 -0
  481. package/dist/types/audio/music/GraphVoice.d.ts.map +1 -0
  482. package/dist/types/audio/music/MusicChannel.d.ts +35 -0
  483. package/dist/types/audio/music/MusicChannel.d.ts.map +1 -0
  484. package/dist/types/audio/music/musicVoice.d.ts +26 -0
  485. package/dist/types/audio/music/musicVoice.d.ts.map +1 -0
  486. package/dist/types/audio/sampleBank.d.ts +27 -0
  487. package/dist/types/audio/sampleBank.d.ts.map +1 -0
  488. package/dist/types/audio/soundTable.d.ts +14 -0
  489. package/dist/types/audio/soundTable.d.ts.map +1 -0
  490. package/dist/types/audio/synth.d.ts +34 -0
  491. package/dist/types/audio/synth.d.ts.map +1 -0
  492. package/dist/types/audio/takeCleanerWorker.d.ts +2 -0
  493. package/dist/types/audio/takeCleanerWorker.d.ts.map +1 -0
  494. package/dist/types/core/BitmapLabel.d.ts +36 -0
  495. package/dist/types/core/BitmapLabel.d.ts.map +1 -0
  496. package/dist/types/core/Camera.d.ts +115 -0
  497. package/dist/types/core/Camera.d.ts.map +1 -0
  498. package/dist/types/core/Clock.d.ts +11 -0
  499. package/dist/types/core/Clock.d.ts.map +1 -0
  500. package/dist/types/core/Graphics.d.ts +37 -0
  501. package/dist/types/core/Graphics.d.ts.map +1 -0
  502. package/dist/types/core/Group.d.ts +15 -0
  503. package/dist/types/core/Group.d.ts.map +1 -0
  504. package/dist/types/core/Image.d.ts +25 -0
  505. package/dist/types/core/Image.d.ts.map +1 -0
  506. package/dist/types/core/ObjectFactory.d.ts +34 -0
  507. package/dist/types/core/ObjectFactory.d.ts.map +1 -0
  508. package/dist/types/core/Pointer.d.ts +27 -0
  509. package/dist/types/core/Pointer.d.ts.map +1 -0
  510. package/dist/types/core/Rectangle.d.ts +26 -0
  511. package/dist/types/core/Rectangle.d.ts.map +1 -0
  512. package/dist/types/core/Stage.d.ts +58 -0
  513. package/dist/types/core/Stage.d.ts.map +1 -0
  514. package/dist/types/core/Text.d.ts +22 -0
  515. package/dist/types/core/Text.d.ts.map +1 -0
  516. package/dist/types/core/TextureRegistry.d.ts +51 -0
  517. package/dist/types/core/TextureRegistry.d.ts.map +1 -0
  518. package/dist/types/core/Timeline.d.ts +115 -0
  519. package/dist/types/core/Timeline.d.ts.map +1 -0
  520. package/dist/types/core/TimelineBuilder.d.ts +53 -0
  521. package/dist/types/core/TimelineBuilder.d.ts.map +1 -0
  522. package/dist/types/core/TimelineChild.d.ts +51 -0
  523. package/dist/types/core/TimelineChild.d.ts.map +1 -0
  524. package/dist/types/core/Tweener.d.ts +70 -0
  525. package/dist/types/core/Tweener.d.ts.map +1 -0
  526. package/dist/types/core/atlas.d.ts +16 -0
  527. package/dist/types/core/atlas.d.ts.map +1 -0
  528. package/dist/types/core/atlasPlan.d.ts +34 -0
  529. package/dist/types/core/atlasPlan.d.ts.map +1 -0
  530. package/dist/types/core/eases.d.ts +3 -0
  531. package/dist/types/core/eases.d.ts.map +1 -0
  532. package/dist/types/core/gameObject.d.ts +42 -0
  533. package/dist/types/core/gameObject.d.ts.map +1 -0
  534. package/dist/types/core/pixiPatches.d.ts +9 -0
  535. package/dist/types/core/pixiPatches.d.ts.map +1 -0
  536. package/dist/types/core/timelinePlace.d.ts +23 -0
  537. package/dist/types/core/timelinePlace.d.ts.map +1 -0
  538. package/dist/types/core/tweenProps.d.ts +8 -0
  539. package/dist/types/core/tweenProps.d.ts.map +1 -0
  540. package/dist/types/core/types.d.ts +4 -0
  541. package/dist/types/core/types.d.ts.map +1 -0
  542. package/dist/types/debug/DebugOverlay.d.ts +63 -0
  543. package/dist/types/debug/DebugOverlay.d.ts.map +1 -0
  544. package/dist/types/debug/DrawCallCounter.d.ts +20 -0
  545. package/dist/types/debug/DrawCallCounter.d.ts.map +1 -0
  546. package/dist/types/debug/ErrorLog.d.ts +20 -0
  547. package/dist/types/debug/ErrorLog.d.ts.map +1 -0
  548. package/dist/types/debug/FrameStats.d.ts +21 -0
  549. package/dist/types/debug/FrameStats.d.ts.map +1 -0
  550. package/dist/types/debug/inspectWorld.d.ts +14 -0
  551. package/dist/types/debug/inspectWorld.d.ts.map +1 -0
  552. package/dist/types/diagnostics/ErrorDeduper.d.ts +17 -0
  553. package/dist/types/diagnostics/ErrorDeduper.d.ts.map +1 -0
  554. package/dist/types/diagnostics/FrameSampler.d.ts +37 -0
  555. package/dist/types/diagnostics/FrameSampler.d.ts.map +1 -0
  556. package/dist/types/diagnostics/bootWatch.d.ts +25 -0
  557. package/dist/types/diagnostics/bootWatch.d.ts.map +1 -0
  558. package/dist/types/diagnostics/captureErrors.d.ts +24 -0
  559. package/dist/types/diagnostics/captureErrors.d.ts.map +1 -0
  560. package/dist/types/diagnostics/contextLoss.d.ts +35 -0
  561. package/dist/types/diagnostics/contextLoss.d.ts.map +1 -0
  562. package/dist/types/diagnostics/frameStats.d.ts +30 -0
  563. package/dist/types/diagnostics/frameStats.d.ts.map +1 -0
  564. package/dist/types/diagnostics/gpuInfo.d.ts +9 -0
  565. package/dist/types/diagnostics/gpuInfo.d.ts.map +1 -0
  566. package/dist/types/diagnostics/renderGuard.d.ts +12 -0
  567. package/dist/types/diagnostics/renderGuard.d.ts.map +1 -0
  568. package/dist/types/ecs/SparseSet.d.ts +25 -0
  569. package/dist/types/ecs/SparseSet.d.ts.map +1 -0
  570. package/dist/types/ecs/World.d.ts +137 -0
  571. package/dist/types/ecs/World.d.ts.map +1 -0
  572. package/dist/types/ecs/fields.d.ts +34 -0
  573. package/dist/types/ecs/fields.d.ts.map +1 -0
  574. package/dist/types/engine/Engine.d.ts +80 -0
  575. package/dist/types/engine/Engine.d.ts.map +1 -0
  576. package/dist/types/engine/FixedLoop.d.ts +32 -0
  577. package/dist/types/engine/FixedLoop.d.ts.map +1 -0
  578. package/dist/types/engine/Scene.d.ts +67 -0
  579. package/dist/types/engine/Scene.d.ts.map +1 -0
  580. package/dist/types/engine/SceneManager.d.ts +36 -0
  581. package/dist/types/engine/SceneManager.d.ts.map +1 -0
  582. package/dist/types/events/EventBus.d.ts +20 -0
  583. package/dist/types/events/EventBus.d.ts.map +1 -0
  584. package/dist/types/fx/FloatingText.d.ts +71 -0
  585. package/dist/types/fx/FloatingText.d.ts.map +1 -0
  586. package/dist/types/fx/hitStop.d.ts +20 -0
  587. package/dist/types/fx/hitStop.d.ts.map +1 -0
  588. package/dist/types/fx/viewCull.d.ts +14 -0
  589. package/dist/types/fx/viewCull.d.ts.map +1 -0
  590. package/dist/types/i18n/Translator.d.ts +52 -0
  591. package/dist/types/i18n/Translator.d.ts.map +1 -0
  592. package/dist/types/i18n/extractStrings.d.ts +25 -0
  593. package/dist/types/i18n/extractStrings.d.ts.map +1 -0
  594. package/dist/types/i18n/formatMessage.d.ts +10 -0
  595. package/dist/types/i18n/formatMessage.d.ts.map +1 -0
  596. package/dist/types/index.d.ts +149 -0
  597. package/dist/types/index.d.ts.map +1 -0
  598. package/dist/types/input/Actions.d.ts +94 -0
  599. package/dist/types/input/Actions.d.ts.map +1 -0
  600. package/dist/types/input/AimGesture.d.ts +106 -0
  601. package/dist/types/input/AimGesture.d.ts.map +1 -0
  602. package/dist/types/input/Keyboard.d.ts +30 -0
  603. package/dist/types/input/Keyboard.d.ts.map +1 -0
  604. package/dist/types/input/Keymap.d.ts +85 -0
  605. package/dist/types/input/Keymap.d.ts.map +1 -0
  606. package/dist/types/input/TargetLock.d.ts +56 -0
  607. package/dist/types/input/TargetLock.d.ts.map +1 -0
  608. package/dist/types/input/aimAxis.d.ts +9 -0
  609. package/dist/types/input/aimAxis.d.ts.map +1 -0
  610. package/dist/types/input/keyChord.d.ts +15 -0
  611. package/dist/types/input/keyChord.d.ts.map +1 -0
  612. package/dist/types/input/longPress.d.ts +21 -0
  613. package/dist/types/input/longPress.d.ts.map +1 -0
  614. package/dist/types/input/stickAxis.d.ts +26 -0
  615. package/dist/types/input/stickAxis.d.ts.map +1 -0
  616. package/dist/types/input/touchDetect.d.ts +18 -0
  617. package/dist/types/input/touchDetect.d.ts.map +1 -0
  618. package/dist/types/light/LightLayer.d.ts +65 -0
  619. package/dist/types/light/LightLayer.d.ts.map +1 -0
  620. package/dist/types/nav/MinHeap.d.ts +15 -0
  621. package/dist/types/nav/MinHeap.d.ts.map +1 -0
  622. package/dist/types/nav/findPath.d.ts +38 -0
  623. package/dist/types/nav/findPath.d.ts.map +1 -0
  624. package/dist/types/nav/navGrid.d.ts +48 -0
  625. package/dist/types/nav/navGrid.d.ts.map +1 -0
  626. package/dist/types/nav/nearestOpen.d.ts +8 -0
  627. package/dist/types/nav/nearestOpen.d.ts.map +1 -0
  628. package/dist/types/nav/straightenPath.d.ts +13 -0
  629. package/dist/types/nav/straightenPath.d.ts.map +1 -0
  630. package/dist/types/net/Connection.d.ts +66 -0
  631. package/dist/types/net/Connection.d.ts.map +1 -0
  632. package/dist/types/net/InterpolationBuffer.d.ts +36 -0
  633. package/dist/types/net/InterpolationBuffer.d.ts.map +1 -0
  634. package/dist/types/net/PredictedMover.d.ts +43 -0
  635. package/dist/types/net/PredictedMover.d.ts.map +1 -0
  636. package/dist/types/net/Room.d.ts +69 -0
  637. package/dist/types/net/Room.d.ts.map +1 -0
  638. package/dist/types/net/RoomHost.d.ts +74 -0
  639. package/dist/types/net/RoomHost.d.ts.map +1 -0
  640. package/dist/types/net/cadence.d.ts +22 -0
  641. package/dist/types/net/cadence.d.ts.map +1 -0
  642. package/dist/types/net/constants.d.ts +24 -0
  643. package/dist/types/net/constants.d.ts.map +1 -0
  644. package/dist/types/net/lobby/LobbyClient.d.ts +107 -0
  645. package/dist/types/net/lobby/LobbyClient.d.ts.map +1 -0
  646. package/dist/types/net/lobby/LobbyHost.d.ts +147 -0
  647. package/dist/types/net/lobby/LobbyHost.d.ts.map +1 -0
  648. package/dist/types/net/lobby/LobbyRooms.d.ts +56 -0
  649. package/dist/types/net/lobby/LobbyRooms.d.ts.map +1 -0
  650. package/dist/types/net/lobby/Matchmaker.d.ts +57 -0
  651. package/dist/types/net/lobby/Matchmaker.d.ts.map +1 -0
  652. package/dist/types/net/lobby/index.d.ts +6 -0
  653. package/dist/types/net/lobby/index.d.ts.map +1 -0
  654. package/dist/types/net/lobby/lobbyProtocol.d.ts +143 -0
  655. package/dist/types/net/lobby/lobbyProtocol.d.ts.map +1 -0
  656. package/dist/types/net/movement.d.ts +50 -0
  657. package/dist/types/net/movement.d.ts.map +1 -0
  658. package/dist/types/net/protocol.d.ts +59 -0
  659. package/dist/types/net/protocol.d.ts.map +1 -0
  660. package/dist/types/net/serverClock.d.ts +14 -0
  661. package/dist/types/net/serverClock.d.ts.map +1 -0
  662. package/dist/types/net/snapshotCodec.d.ts +55 -0
  663. package/dist/types/net/snapshotCodec.d.ts.map +1 -0
  664. package/dist/types/parallax/Parallax.d.ts +37 -0
  665. package/dist/types/parallax/Parallax.d.ts.map +1 -0
  666. package/dist/types/parallax/ParallaxLayer.d.ts +80 -0
  667. package/dist/types/parallax/ParallaxLayer.d.ts.map +1 -0
  668. package/dist/types/parallax/parallaxMath.d.ts +50 -0
  669. package/dist/types/parallax/parallaxMath.d.ts.map +1 -0
  670. package/dist/types/particles/Emitter.d.ts +97 -0
  671. package/dist/types/particles/Emitter.d.ts.map +1 -0
  672. package/dist/types/particles/ParticleBudget.d.ts +28 -0
  673. package/dist/types/particles/ParticleBudget.d.ts.map +1 -0
  674. package/dist/types/particles/ParticleSim.d.ts +38 -0
  675. package/dist/types/particles/ParticleSim.d.ts.map +1 -0
  676. package/dist/types/particles/particleCurves.d.ts +21 -0
  677. package/dist/types/particles/particleCurves.d.ts.map +1 -0
  678. package/dist/types/particles/particleSampling.d.ts +20 -0
  679. package/dist/types/particles/particleSampling.d.ts.map +1 -0
  680. package/dist/types/physics/Body.d.ts +130 -0
  681. package/dist/types/physics/Body.d.ts.map +1 -0
  682. package/dist/types/physics/BroadPhase.d.ts +26 -0
  683. package/dist/types/physics/BroadPhase.d.ts.map +1 -0
  684. package/dist/types/physics/Contact.d.ts +62 -0
  685. package/dist/types/physics/Contact.d.ts.map +1 -0
  686. package/dist/types/physics/ContactSolver.d.ts +29 -0
  687. package/dist/types/physics/ContactSolver.d.ts.map +1 -0
  688. package/dist/types/physics/PhysicsWorld.d.ts +78 -0
  689. package/dist/types/physics/PhysicsWorld.d.ts.map +1 -0
  690. package/dist/types/physics/PhysicsWorldOptions.d.ts +24 -0
  691. package/dist/types/physics/PhysicsWorldOptions.d.ts.map +1 -0
  692. package/dist/types/physics/SpatialHash.d.ts +23 -0
  693. package/dist/types/physics/SpatialHash.d.ts.map +1 -0
  694. package/dist/types/physics/collide.d.ts +27 -0
  695. package/dist/types/physics/collide.d.ts.map +1 -0
  696. package/dist/types/physics/collidePolygon.d.ts +14 -0
  697. package/dist/types/physics/collidePolygon.d.ts.map +1 -0
  698. package/dist/types/physics/contactReport.d.ts +8 -0
  699. package/dist/types/physics/contactReport.d.ts.map +1 -0
  700. package/dist/types/physics/drawColliders.d.ts +43 -0
  701. package/dist/types/physics/drawColliders.d.ts.map +1 -0
  702. package/dist/types/physics/physicsSystem.d.ts +5 -0
  703. package/dist/types/physics/physicsSystem.d.ts.map +1 -0
  704. package/dist/types/physics/polygon.d.ts +28 -0
  705. package/dist/types/physics/polygon.d.ts.map +1 -0
  706. package/dist/types/physics/raycast.d.ts +19 -0
  707. package/dist/types/physics/raycast.d.ts.map +1 -0
  708. package/dist/types/physics/syncToBody.d.ts +16 -0
  709. package/dist/types/physics/syncToBody.d.ts.map +1 -0
  710. package/dist/types/physics/tileBodies.d.ts +36 -0
  711. package/dist/types/physics/tileBodies.d.ts.map +1 -0
  712. package/dist/types/physics/types.d.ts +116 -0
  713. package/dist/types/physics/types.d.ts.map +1 -0
  714. package/dist/types/pixel/Darkness.d.ts +78 -0
  715. package/dist/types/pixel/Darkness.d.ts.map +1 -0
  716. package/dist/types/pixel/DitherVignette.d.ts +35 -0
  717. package/dist/types/pixel/DitherVignette.d.ts.map +1 -0
  718. package/dist/types/pixel/Evaporation.d.ts +30 -0
  719. package/dist/types/pixel/Evaporation.d.ts.map +1 -0
  720. package/dist/types/pixel/NightShade.d.ts +38 -0
  721. package/dist/types/pixel/NightShade.d.ts.map +1 -0
  722. package/dist/types/pixel/PixelLayer.d.ts +85 -0
  723. package/dist/types/pixel/PixelLayer.d.ts.map +1 -0
  724. package/dist/types/pixel/SwayProp.d.ts +52 -0
  725. package/dist/types/pixel/SwayProp.d.ts.map +1 -0
  726. package/dist/types/pixel/index.d.ts +31 -0
  727. package/dist/types/pixel/index.d.ts.map +1 -0
  728. package/dist/types/pixel/lights.d.ts +34 -0
  729. package/dist/types/pixel/lights.d.ts.map +1 -0
  730. package/dist/types/pixel/nineSlice.d.ts +71 -0
  731. package/dist/types/pixel/nineSlice.d.ts.map +1 -0
  732. package/dist/types/pixel/paintLayer.d.ts +35 -0
  733. package/dist/types/pixel/paintLayer.d.ts.map +1 -0
  734. package/dist/types/pixel/palette.d.ts +58 -0
  735. package/dist/types/pixel/palette.d.ts.map +1 -0
  736. package/dist/types/pixel/pixel.d.ts +80 -0
  737. package/dist/types/pixel/pixel.d.ts.map +1 -0
  738. package/dist/types/pixel/pixelPaint.d.ts +43 -0
  739. package/dist/types/pixel/pixelPaint.d.ts.map +1 -0
  740. package/dist/types/pixel/pixelTone.d.ts +51 -0
  741. package/dist/types/pixel/pixelTone.d.ts.map +1 -0
  742. package/dist/types/pixel/propKit.d.ts +26 -0
  743. package/dist/types/pixel/propKit.d.ts.map +1 -0
  744. package/dist/types/pixel/ramp.d.ts +57 -0
  745. package/dist/types/pixel/ramp.d.ts.map +1 -0
  746. package/dist/types/pixel/selout.d.ts +3 -0
  747. package/dist/types/pixel/selout.d.ts.map +1 -0
  748. package/dist/types/pixel/spritePixels.d.ts +29 -0
  749. package/dist/types/pixel/spritePixels.d.ts.map +1 -0
  750. package/dist/types/pixel/swayRig.d.ts +72 -0
  751. package/dist/types/pixel/swayRig.d.ts.map +1 -0
  752. package/dist/types/pixel/vignetteMask.d.ts +16 -0
  753. package/dist/types/pixel/vignetteMask.d.ts.map +1 -0
  754. package/dist/types/pixel/weatherArt.d.ts +29 -0
  755. package/dist/types/pixel/weatherArt.d.ts.map +1 -0
  756. package/dist/types/platform/touch.d.ts +10 -0
  757. package/dist/types/platform/touch.d.ts.map +1 -0
  758. package/dist/types/postfx/BloomFilter.d.ts +33 -0
  759. package/dist/types/postfx/BloomFilter.d.ts.map +1 -0
  760. package/dist/types/postfx/ChromaticAberrationFilter.d.ts +11 -0
  761. package/dist/types/postfx/ChromaticAberrationFilter.d.ts.map +1 -0
  762. package/dist/types/postfx/ColorAdjustFilter.d.ts +32 -0
  763. package/dist/types/postfx/ColorAdjustFilter.d.ts.map +1 -0
  764. package/dist/types/postfx/CrtFilter.d.ts +16 -0
  765. package/dist/types/postfx/CrtFilter.d.ts.map +1 -0
  766. package/dist/types/postfx/PixelateFilter.d.ts +8 -0
  767. package/dist/types/postfx/PixelateFilter.d.ts.map +1 -0
  768. package/dist/types/postfx/PostFx.d.ts +92 -0
  769. package/dist/types/postfx/PostFx.d.ts.map +1 -0
  770. package/dist/types/postfx/ShockwaveFilter.d.ts +20 -0
  771. package/dist/types/postfx/ShockwaveFilter.d.ts.map +1 -0
  772. package/dist/types/postfx/VignetteFilter.d.ts +19 -0
  773. package/dist/types/postfx/VignetteFilter.d.ts.map +1 -0
  774. package/dist/types/postfx/fxAnimator.d.ts +32 -0
  775. package/dist/types/postfx/fxAnimator.d.ts.map +1 -0
  776. package/dist/types/postfx/fxShader.d.ts +49 -0
  777. package/dist/types/postfx/fxShader.d.ts.map +1 -0
  778. package/dist/types/postfx/index.d.ts +11 -0
  779. package/dist/types/postfx/index.d.ts.map +1 -0
  780. package/dist/types/react/ChoiceDialog.d.ts +8 -0
  781. package/dist/types/react/ChoiceDialog.d.ts.map +1 -0
  782. package/dist/types/react/ConfirmDialog.d.ts +9 -0
  783. package/dist/types/react/ConfirmDialog.d.ts.map +1 -0
  784. package/dist/types/react/Glyph.d.ts +54 -0
  785. package/dist/types/react/Glyph.d.ts.map +1 -0
  786. package/dist/types/react/Modal.d.ts +22 -0
  787. package/dist/types/react/Modal.d.ts.map +1 -0
  788. package/dist/types/react/Panel.d.ts +29 -0
  789. package/dist/types/react/Panel.d.ts.map +1 -0
  790. package/dist/types/react/PixelImage.d.ts +19 -0
  791. package/dist/types/react/PixelImage.d.ts.map +1 -0
  792. package/dist/types/react/Select.d.ts +27 -0
  793. package/dist/types/react/Select.d.ts.map +1 -0
  794. package/dist/types/react/Slider.d.ts +24 -0
  795. package/dist/types/react/Slider.d.ts.map +1 -0
  796. package/dist/types/react/SplitPane.d.ts +26 -0
  797. package/dist/types/react/SplitPane.d.ts.map +1 -0
  798. package/dist/types/react/TabStrip.d.ts +31 -0
  799. package/dist/types/react/TabStrip.d.ts.map +1 -0
  800. package/dist/types/react/TitleTips.d.ts +15 -0
  801. package/dist/types/react/TitleTips.d.ts.map +1 -0
  802. package/dist/types/react/Tooltip.d.ts +22 -0
  803. package/dist/types/react/Tooltip.d.ts.map +1 -0
  804. package/dist/types/react/UiProvider.d.ts +52 -0
  805. package/dist/types/react/UiProvider.d.ts.map +1 -0
  806. package/dist/types/react/baseCss.d.ts +27 -0
  807. package/dist/types/react/baseCss.d.ts.map +1 -0
  808. package/dist/types/react/choiceStore.d.ts +34 -0
  809. package/dist/types/react/choiceStore.d.ts.map +1 -0
  810. package/dist/types/react/classNames.d.ts +12 -0
  811. package/dist/types/react/classNames.d.ts.map +1 -0
  812. package/dist/types/react/confirmStore.d.ts +30 -0
  813. package/dist/types/react/confirmStore.d.ts.map +1 -0
  814. package/dist/types/react/index.d.ts +33 -0
  815. package/dist/types/react/index.d.ts.map +1 -0
  816. package/dist/types/react/labels.d.ts +24 -0
  817. package/dist/types/react/labels.d.ts.map +1 -0
  818. package/dist/types/react/placement.d.ts +59 -0
  819. package/dist/types/react/placement.d.ts.map +1 -0
  820. package/dist/types/react/useFillSheet.d.ts +9 -0
  821. package/dist/types/react/useFillSheet.d.ts.map +1 -0
  822. package/dist/types/react/useFitToViewport.d.ts +20 -0
  823. package/dist/types/react/useFitToViewport.d.ts.map +1 -0
  824. package/dist/types/react/usePicked.d.ts +9 -0
  825. package/dist/types/react/usePicked.d.ts.map +1 -0
  826. package/dist/types/react/useStore.d.ts +8 -0
  827. package/dist/types/react/useStore.d.ts.map +1 -0
  828. package/dist/types/react/useViewport.d.ts +4 -0
  829. package/dist/types/react/useViewport.d.ts.map +1 -0
  830. package/dist/types/rig/PosePlayer.d.ts +64 -0
  831. package/dist/types/rig/PosePlayer.d.ts.map +1 -0
  832. package/dist/types/rig/RigView.d.ts +68 -0
  833. package/dist/types/rig/RigView.d.ts.map +1 -0
  834. package/dist/types/rig/Skeleton.d.ts +14 -0
  835. package/dist/types/rig/Skeleton.d.ts.map +1 -0
  836. package/dist/types/rig/humanoid.d.ts +4 -0
  837. package/dist/types/rig/humanoid.d.ts.map +1 -0
  838. package/dist/types/rig/humanoidPoses.d.ts +117 -0
  839. package/dist/types/rig/humanoidPoses.d.ts.map +1 -0
  840. package/dist/types/rig/poseMath.d.ts +14 -0
  841. package/dist/types/rig/poseMath.d.ts.map +1 -0
  842. package/dist/types/rig/rigTypes.d.ts +82 -0
  843. package/dist/types/rig/rigTypes.d.ts.map +1 -0
  844. package/dist/types/save/Autosaver.d.ts +43 -0
  845. package/dist/types/save/Autosaver.d.ts.map +1 -0
  846. package/dist/types/save/MemoryBackend.d.ts +10 -0
  847. package/dist/types/save/MemoryBackend.d.ts.map +1 -0
  848. package/dist/types/save/SaveBackend.d.ts +14 -0
  849. package/dist/types/save/SaveBackend.d.ts.map +1 -0
  850. package/dist/types/save/SaveStore.d.ts +73 -0
  851. package/dist/types/save/SaveStore.d.ts.map +1 -0
  852. package/dist/types/save/WebStorageBackend.d.ts +14 -0
  853. package/dist/types/save/WebStorageBackend.d.ts.map +1 -0
  854. package/dist/types/save/checksum.d.ts +7 -0
  855. package/dist/types/save/checksum.d.ts.map +1 -0
  856. package/dist/types/save/migrateSave.d.ts +17 -0
  857. package/dist/types/save/migrateSave.d.ts.map +1 -0
  858. package/dist/types/settings.d.ts +25 -0
  859. package/dist/types/settings.d.ts.map +1 -0
  860. package/dist/types/tilemap/TilemapView.d.ts +42 -0
  861. package/dist/types/tilemap/TilemapView.d.ts.map +1 -0
  862. package/dist/types/tilemap/collision.d.ts +16 -0
  863. package/dist/types/tilemap/collision.d.ts.map +1 -0
  864. package/dist/types/tilemap/tiled.d.ts +104 -0
  865. package/dist/types/tilemap/tiled.d.ts.map +1 -0
  866. package/dist/types/transitions/CrossfadeTransition.d.ts +20 -0
  867. package/dist/types/transitions/CrossfadeTransition.d.ts.map +1 -0
  868. package/dist/types/transitions/DitherWipeTransition.d.ts +35 -0
  869. package/dist/types/transitions/DitherWipeTransition.d.ts.map +1 -0
  870. package/dist/types/transitions/FadeTransition.d.ts +20 -0
  871. package/dist/types/transitions/FadeTransition.d.ts.map +1 -0
  872. package/dist/types/transitions/Letterbox.d.ts +33 -0
  873. package/dist/types/transitions/Letterbox.d.ts.map +1 -0
  874. package/dist/types/transitions/Transition.d.ts +22 -0
  875. package/dist/types/transitions/Transition.d.ts.map +1 -0
  876. package/dist/types/transitions/ditherMask.d.ts +13 -0
  877. package/dist/types/transitions/ditherMask.d.ts.map +1 -0
  878. package/dist/types/transitions/transitionTo.d.ts +16 -0
  879. package/dist/types/transitions/transitionTo.d.ts.map +1 -0
  880. package/dist/types/transitions/tweenDone.d.ts +5 -0
  881. package/dist/types/transitions/tweenDone.d.ts.map +1 -0
  882. package/dist/types/ui/Bar.d.ts +41 -0
  883. package/dist/types/ui/Bar.d.ts.map +1 -0
  884. package/dist/types/ui/Button.d.ts +47 -0
  885. package/dist/types/ui/Button.d.ts.map +1 -0
  886. package/dist/types/ui/Dialog.d.ts +47 -0
  887. package/dist/types/ui/Dialog.d.ts.map +1 -0
  888. package/dist/types/ui/FocusManager.d.ts +53 -0
  889. package/dist/types/ui/FocusManager.d.ts.map +1 -0
  890. package/dist/types/ui/Label.d.ts +24 -0
  891. package/dist/types/ui/Label.d.ts.map +1 -0
  892. package/dist/types/ui/List.d.ts +23 -0
  893. package/dist/types/ui/List.d.ts.map +1 -0
  894. package/dist/types/ui/Panel.d.ts +38 -0
  895. package/dist/types/ui/Panel.d.ts.map +1 -0
  896. package/dist/types/ui/ScrollView.d.ts +56 -0
  897. package/dist/types/ui/ScrollView.d.ts.map +1 -0
  898. package/dist/types/ui/Slider.d.ts +47 -0
  899. package/dist/types/ui/Slider.d.ts.map +1 -0
  900. package/dist/types/ui/Stack.d.ts +16 -0
  901. package/dist/types/ui/Stack.d.ts.map +1 -0
  902. package/dist/types/ui/Toggle.d.ts +31 -0
  903. package/dist/types/ui/Toggle.d.ts.map +1 -0
  904. package/dist/types/ui/UiHost.d.ts +18 -0
  905. package/dist/types/ui/UiHost.d.ts.map +1 -0
  906. package/dist/types/ui/UiPointerGate.d.ts +17 -0
  907. package/dist/types/ui/UiPointerGate.d.ts.map +1 -0
  908. package/dist/types/ui/UiRoot.d.ts +73 -0
  909. package/dist/types/ui/UiRoot.d.ts.map +1 -0
  910. package/dist/types/ui/Widget.d.ts +56 -0
  911. package/dist/types/ui/Widget.d.ts.map +1 -0
  912. package/dist/types/ui/dom/DomOverlay.d.ts +52 -0
  913. package/dist/types/ui/dom/DomOverlay.d.ts.map +1 -0
  914. package/dist/types/ui/dom/DomWorldAnchors.d.ts +50 -0
  915. package/dist/types/ui/dom/DomWorldAnchors.d.ts.map +1 -0
  916. package/dist/types/ui/dom/InputShield.d.ts +20 -0
  917. package/dist/types/ui/dom/InputShield.d.ts.map +1 -0
  918. package/dist/types/ui/dom/createStore.d.ts +22 -0
  919. package/dist/types/ui/dom/createStore.d.ts.map +1 -0
  920. package/dist/types/ui/dom/shieldDecision.d.ts +34 -0
  921. package/dist/types/ui/dom/shieldDecision.d.ts.map +1 -0
  922. package/dist/types/ui/dom/worldToScreen.d.ts +24 -0
  923. package/dist/types/ui/dom/worldToScreen.d.ts.map +1 -0
  924. package/dist/types/ui/index.d.ts +38 -0
  925. package/dist/types/ui/index.d.ts.map +1 -0
  926. package/dist/types/ui/layout/anchor.d.ts +9 -0
  927. package/dist/types/ui/layout/anchor.d.ts.map +1 -0
  928. package/dist/types/ui/layout/barDrain.d.ts +25 -0
  929. package/dist/types/ui/layout/barDrain.d.ts.map +1 -0
  930. package/dist/types/ui/layout/fitToViewport.d.ts +32 -0
  931. package/dist/types/ui/layout/fitToViewport.d.ts.map +1 -0
  932. package/dist/types/ui/layout/focusNav.d.ts +13 -0
  933. package/dist/types/ui/layout/focusNav.d.ts.map +1 -0
  934. package/dist/types/ui/layout/geometry.d.ts +35 -0
  935. package/dist/types/ui/layout/geometry.d.ts.map +1 -0
  936. package/dist/types/ui/layout/listWidth.d.ts +13 -0
  937. package/dist/types/ui/layout/listWidth.d.ts.map +1 -0
  938. package/dist/types/ui/layout/placeTooltip.d.ts +23 -0
  939. package/dist/types/ui/layout/placeTooltip.d.ts.map +1 -0
  940. package/dist/types/ui/layout/scroll.d.ts +17 -0
  941. package/dist/types/ui/layout/scroll.d.ts.map +1 -0
  942. package/dist/types/ui/layout/slider.d.ts +7 -0
  943. package/dist/types/ui/layout/slider.d.ts.map +1 -0
  944. package/dist/types/ui/layout/stack.d.ts +26 -0
  945. package/dist/types/ui/layout/stack.d.ts.map +1 -0
  946. package/dist/types/ui/layout/wrapRow.d.ts +6 -0
  947. package/dist/types/ui/layout/wrapRow.d.ts.map +1 -0
  948. package/dist/ui/Bar.js +54 -0
  949. package/dist/ui/Bar.js.map +1 -0
  950. package/dist/ui/Button.js +58 -0
  951. package/dist/ui/Button.js.map +1 -0
  952. package/dist/ui/Dialog.js +56 -0
  953. package/dist/ui/Dialog.js.map +1 -0
  954. package/dist/ui/FocusManager.js +97 -0
  955. package/dist/ui/FocusManager.js.map +1 -0
  956. package/dist/ui/Label.js +36 -0
  957. package/dist/ui/Label.js.map +1 -0
  958. package/dist/ui/List.js +45 -0
  959. package/dist/ui/List.js.map +1 -0
  960. package/dist/ui/Panel.js +38 -0
  961. package/dist/ui/Panel.js.map +1 -0
  962. package/dist/ui/ScrollView.js +96 -0
  963. package/dist/ui/ScrollView.js.map +1 -0
  964. package/dist/ui/Slider.js +55 -0
  965. package/dist/ui/Slider.js.map +1 -0
  966. package/dist/ui/Stack.js +28 -0
  967. package/dist/ui/Stack.js.map +1 -0
  968. package/dist/ui/Toggle.js +37 -0
  969. package/dist/ui/Toggle.js.map +1 -0
  970. package/dist/ui/UiHost.js +9 -0
  971. package/dist/ui/UiHost.js.map +1 -0
  972. package/dist/ui/UiPointerGate.js +25 -0
  973. package/dist/ui/UiPointerGate.js.map +1 -0
  974. package/dist/ui/UiRoot.js +93 -0
  975. package/dist/ui/UiRoot.js.map +1 -0
  976. package/dist/ui/Widget.js +90 -0
  977. package/dist/ui/Widget.js.map +1 -0
  978. package/dist/ui/dom/DomOverlay.js +59 -0
  979. package/dist/ui/dom/DomOverlay.js.map +1 -0
  980. package/dist/ui/dom/DomWorldAnchors.js +59 -0
  981. package/dist/ui/dom/DomWorldAnchors.js.map +1 -0
  982. package/dist/ui/dom/InputShield.js +27 -0
  983. package/dist/ui/dom/InputShield.js.map +1 -0
  984. package/dist/ui/dom/createStore.js +42 -0
  985. package/dist/ui/dom/createStore.js.map +1 -0
  986. package/dist/ui/dom/shieldDecision.js +36 -0
  987. package/dist/ui/dom/shieldDecision.js.map +1 -0
  988. package/dist/ui/dom/worldToScreen.js +11 -0
  989. package/dist/ui/dom/worldToScreen.js.map +1 -0
  990. package/dist/ui/layout/anchor.js +20 -0
  991. package/dist/ui/layout/anchor.js.map +1 -0
  992. package/dist/ui/layout/barDrain.js +25 -0
  993. package/dist/ui/layout/barDrain.js.map +1 -0
  994. package/dist/ui/layout/fitToViewport.js +17 -0
  995. package/dist/ui/layout/fitToViewport.js.map +1 -0
  996. package/dist/ui/layout/focusNav.js +42 -0
  997. package/dist/ui/layout/focusNav.js.map +1 -0
  998. package/dist/ui/layout/geometry.js +21 -0
  999. package/dist/ui/layout/geometry.js.map +1 -0
  1000. package/dist/ui/layout/listWidth.js +10 -0
  1001. package/dist/ui/layout/listWidth.js.map +1 -0
  1002. package/dist/ui/layout/placeTooltip.js +28 -0
  1003. package/dist/ui/layout/placeTooltip.js.map +1 -0
  1004. package/dist/ui/layout/scroll.js +24 -0
  1005. package/dist/ui/layout/scroll.js.map +1 -0
  1006. package/dist/ui/layout/slider.js +20 -0
  1007. package/dist/ui/layout/slider.js.map +1 -0
  1008. package/dist/ui/layout/stack.js +27 -0
  1009. package/dist/ui/layout/stack.js.map +1 -0
  1010. package/dist/ui/layout/wrapRow.js +13 -0
  1011. package/dist/ui/layout/wrapRow.js.map +1 -0
  1012. package/dist/ui.js +85 -0
  1013. package/dist/ui.js.map +1 -0
  1014. package/package.json +115 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomOverlay.js","sources":["../../../src/ui/dom/DomOverlay.ts"],"sourcesContent":["export interface DomOverlayOptions {\n /** Added to the root element (for the game's CSS). */\n className?: string;\n /** Stacking order over the canvas (default 1). */\n zIndex?: number;\n /**\n * The canvas's size in screen pixels (`() => app.screen`): when CSS stretches the canvas past it (a small fixed\n * canvas scaled up), `cssScale` is how much, and world placement follows it. Default: no stretch.\n */\n logicalSize?: () => { width: number; height: number };\n}\n\n/**\n * The element a DOM (or React) UI is mounted in, laid exactly over the canvas and resized with it. It sits beside the\n * canvas in the same parent, so it shares the canvas's positioned ancestor and needs no change to the page's CSS.\n *\n * The root lets presses through (`pointer-events: none`) so the world stays playable between panels; give what the\n * player presses `pointer-events: auto` (`DomOverlay.interactive`). `content` is drawn at `scale` (a whole multiple\n * for pixel-art UI): laid out on a box `1 / scale` the overlay and scaled back up, so a window sized for 320 × 180\n * fills the screen at ×4 with sharp edges.\n */\nexport class DomOverlay {\n readonly root: HTMLDivElement;\n /** Where the UI goes: scaled by `scale`. */\n readonly content: HTMLDivElement;\n private scaleNow = 1;\n private cssW = 0;\n private cssH = 0;\n private stretch = 1;\n private readonly observer: ResizeObserver | null;\n private readonly onWindow = () => this.sync();\n\n constructor(\n readonly canvas: HTMLCanvasElement,\n private readonly options: DomOverlayOptions = {},\n ) {\n const doc = canvas.ownerDocument;\n this.root = doc.createElement('div');\n this.content = doc.createElement('div');\n if (options.className) this.root.className = options.className;\n Object.assign(this.root.style, { position: 'absolute', overflow: 'hidden', pointerEvents: 'none', zIndex: String(options.zIndex ?? 1) });\n Object.assign(this.content.style, { position: 'absolute', left: '0', top: '0', transformOrigin: '0 0', pointerEvents: 'none' });\n this.root.appendChild(this.content);\n canvas.insertAdjacentElement('afterend', this.root);\n // the canvas's box changes on its own (a resizeTo parent, CSS), not only with the window\n this.observer = typeof ResizeObserver === 'function' ? new ResizeObserver(this.onWindow) : null;\n this.observer?.observe(canvas);\n window.addEventListener('resize', this.onWindow);\n this.sync();\n }\n\n /** Lets presses on `el` reach it (the overlay's root and content let them through to the canvas). */\n static interactive(el: HTMLElement): HTMLElement {\n el.style.pointerEvents = 'auto';\n return el;\n }\n\n /** The overlay's size in CSS pixels (the canvas's box). */\n get width(): number {\n return this.cssW;\n }\n\n get height(): number {\n return this.cssH;\n }\n\n /** CSS pixels per screen pixel of the canvas: 1 unless CSS stretches it. */\n get cssScale(): number {\n return this.stretch;\n }\n\n get scale(): number {\n return this.scaleNow;\n }\n\n /** Draws `content` at `scale` (also published as the CSS variable `--ui-scale`). */\n setScale(scale: number): void {\n if (scale === this.scaleNow || !(scale > 0)) return;\n this.scaleNow = scale;\n this.applySize();\n }\n\n /** Lines the overlay up with the canvas again; resizes do it by themselves. */\n sync(): void {\n const c = this.canvas;\n const w = c.clientWidth;\n const h = c.clientHeight;\n const s = this.root.style;\n s.left = `${c.offsetLeft + c.clientLeft}px`;\n s.top = `${c.offsetTop + c.clientTop}px`;\n if (w === this.cssW && h === this.cssH) return;\n this.cssW = w;\n this.cssH = h;\n s.width = `${w}px`;\n s.height = `${h}px`;\n const logical = this.options.logicalSize?.();\n this.stretch = logical && logical.width > 0 ? w / logical.width : 1;\n this.applySize();\n }\n\n destroy(): void {\n this.observer?.disconnect();\n window.removeEventListener('resize', this.onWindow);\n this.root.remove();\n }\n\n private applySize(): void {\n const k = this.scaleNow;\n const s = this.content.style;\n s.width = `${this.cssW / k}px`;\n s.height = `${this.cssH / k}px`;\n s.transform = k === 1 ? '' : `scale(${k})`;\n this.root.style.setProperty('--ui-scale', String(k));\n }\n}\n"],"names":["DomOverlay","canvas","options","doc","el","scale","c","w","h","s","logical","k"],"mappings":"AAqBO,MAAMA,EAAW;AAAA,EAWtB,YACWC,GACQC,IAA6B,IAC9C;AAFS,SAAA,SAAAD,GACQ,KAAA,UAAAC;AAEjB,UAAMC,IAAMF,EAAO;AACnB,SAAK,OAAOE,EAAI,cAAc,KAAK,GACnC,KAAK,UAAUA,EAAI,cAAc,KAAK,GAClCD,EAAQ,cAAW,KAAK,KAAK,YAAYA,EAAQ,YACrD,OAAO,OAAO,KAAK,KAAK,OAAO,EAAE,UAAU,YAAY,UAAU,UAAU,eAAe,QAAQ,QAAQ,OAAOA,EAAQ,UAAU,CAAC,GAAG,GACvI,OAAO,OAAO,KAAK,QAAQ,OAAO,EAAE,UAAU,YAAY,MAAM,KAAK,KAAK,KAAK,iBAAiB,OAAO,eAAe,QAAQ,GAC9H,KAAK,KAAK,YAAY,KAAK,OAAO,GAClCD,EAAO,sBAAsB,YAAY,KAAK,IAAI,GAElD,KAAK,WAAW,OAAO,kBAAmB,aAAa,IAAI,eAAe,KAAK,QAAQ,IAAI,MAC3F,KAAK,UAAU,QAAQA,CAAM,GAC7B,OAAO,iBAAiB,UAAU,KAAK,QAAQ,GAC/C,KAAK,KAAA;AAAA,EACP;AAAA,EAhBW;AAAA,EACQ;AAAA,EAZV;AAAA;AAAA,EAEA;AAAA,EACD,WAAW;AAAA,EACX,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACD;AAAA,EACA,WAAW,MAAM,KAAK,KAAA;AAAA;AAAA,EAsBvC,OAAO,YAAYG,GAA8B;AAC/C,WAAAA,EAAG,MAAM,gBAAgB,QAClBA;AAAA,EACT;AAAA;AAAA,EAGA,IAAI,QAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,SAAiB;AACnB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,IAAI,WAAmB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,QAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,SAASC,GAAqB;AAC5B,IAAIA,MAAU,KAAK,YAAY,EAAEA,IAAQ,OACzC,KAAK,WAAWA,GAChB,KAAK,UAAA;AAAA,EACP;AAAA;AAAA,EAGA,OAAa;AACX,UAAMC,IAAI,KAAK,QACTC,IAAID,EAAE,aACNE,IAAIF,EAAE,cACNG,IAAI,KAAK,KAAK;AAGpB,QAFAA,EAAE,OAAO,GAAGH,EAAE,aAAaA,EAAE,UAAU,MACvCG,EAAE,MAAM,GAAGH,EAAE,YAAYA,EAAE,SAAS,MAChCC,MAAM,KAAK,QAAQC,MAAM,KAAK,KAAM;AACxC,SAAK,OAAOD,GACZ,KAAK,OAAOC,GACZC,EAAE,QAAQ,GAAGF,CAAC,MACdE,EAAE,SAAS,GAAGD,CAAC;AACf,UAAME,IAAU,KAAK,QAAQ,cAAA;AAC7B,SAAK,UAAUA,KAAWA,EAAQ,QAAQ,IAAIH,IAAIG,EAAQ,QAAQ,GAClE,KAAK,UAAA;AAAA,EACP;AAAA,EAEA,UAAgB;AACd,SAAK,UAAU,WAAA,GACf,OAAO,oBAAoB,UAAU,KAAK,QAAQ,GAClD,KAAK,KAAK,OAAA;AAAA,EACZ;AAAA,EAEQ,YAAkB;AACxB,UAAMC,IAAI,KAAK,UACT,IAAI,KAAK,QAAQ;AACvB,MAAE,QAAQ,GAAG,KAAK,OAAOA,CAAC,MAC1B,EAAE,SAAS,GAAG,KAAK,OAAOA,CAAC,MAC3B,EAAE,YAAYA,MAAM,IAAI,KAAK,SAASA,CAAC,KACvC,KAAK,KAAK,MAAM,YAAY,cAAc,OAAOA,CAAC,CAAC;AAAA,EACrD;AACF;"}
@@ -0,0 +1,59 @@
1
+ import { UPDATE_PRIORITY as h } from "pixi.js";
2
+ import { worldToScreen as l, onScreen as c } from "./worldToScreen.js";
3
+ const i = { x: 0, y: 0 };
4
+ class m {
5
+ constructor(s, o) {
6
+ this.overlay = s, this.layer = o;
7
+ }
8
+ overlay;
9
+ layer;
10
+ anchors = [];
11
+ ticker = null;
12
+ onTick = () => this.update();
13
+ /** Places `el` (put inside the overlay's content if it is not already there) on `target`. Returns the remover. */
14
+ add(s, o, a = {}) {
15
+ s.parentElement || this.overlay.content.appendChild(s), s.style.position = "absolute", s.style.left = "0", s.style.top = "0";
16
+ const t = (a.alignX ?? 0.5) * 100, e = (a.alignY ?? 1) * 100, n = {
17
+ el: s,
18
+ target: o,
19
+ ox: a.offsetX ?? 0,
20
+ oy: a.offsetY ?? 0,
21
+ align: t === 0 && e === 0 ? "" : ` translate(${-t}%, ${-e}%)`,
22
+ margin: a.margin ?? 64,
23
+ lastX: NaN,
24
+ lastY: NaN,
25
+ shown: !0
26
+ };
27
+ return this.anchors.push(n), () => this.remove(s);
28
+ }
29
+ remove(s) {
30
+ const o = this.anchors.findIndex((a) => a.el === s);
31
+ o >= 0 && this.anchors.splice(o, 1);
32
+ }
33
+ /**
34
+ * Runs `update` on `ticker` after Pixi renders (`UTILITY` priority), so it reads the camera as this frame drew it,
35
+ * shake included. The returned function stops it.
36
+ */
37
+ attach(s) {
38
+ return this.detach(), this.ticker = s, s.add(this.onTick, void 0, h.UTILITY), () => this.detach();
39
+ }
40
+ detach() {
41
+ this.ticker?.remove(this.onTick), this.ticker = null;
42
+ }
43
+ /** Places every element for this frame. */
44
+ update() {
45
+ const s = this.overlay.cssScale / this.overlay.scale, o = this.overlay.width / this.overlay.scale, a = this.overlay.height / this.overlay.scale;
46
+ for (const t of this.anchors) {
47
+ l(this.layer, t.target.x, t.target.y, i, s);
48
+ const e = Math.round(i.x + t.ox), n = Math.round(i.y + t.oy), r = c(e, n, o, a, t.margin);
49
+ r !== t.shown && (t.shown = r, t.el.style.display = r ? "" : "none"), !(!r || e === t.lastX && n === t.lastY) && (t.lastX = e, t.lastY = n, t.el.style.transform = `translate3d(${e}px, ${n}px, 0)${t.align}`);
50
+ }
51
+ }
52
+ destroy() {
53
+ this.detach(), this.anchors.length = 0;
54
+ }
55
+ }
56
+ export {
57
+ m as DomWorldAnchors
58
+ };
59
+ //# sourceMappingURL=DomWorldAnchors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomWorldAnchors.js","sources":["../../../src/ui/dom/DomWorldAnchors.ts"],"sourcesContent":["import { UPDATE_PRIORITY, type Ticker } from 'pixi.js';\nimport type { DomOverlay } from './DomOverlay';\nimport { onScreen, worldToScreen, type LayerTransform } from './worldToScreen';\n\nexport interface WorldAnchorOptions {\n /** Moved this far after projecting (CSS px): a name 20 px over the feet. */\n offsetX?: number;\n offsetY?: number;\n /**\n * Which point of the element sits on the spot, as fractions of its size (default 0.5, 1: centred above it).\n * Written as a CSS translate in percent, so the element is never measured.\n */\n alignX?: number;\n alignY?: number;\n /** Kept shown this far past the screen's edge (default 64 px), so a wide label does not pop out early. */\n margin?: number;\n}\n\n/** Anything with a world position read every frame: an entity's position object, a sprite. */\nexport interface WorldPoint {\n readonly x: number;\n readonly y: number;\n}\n\ninterface Anchor {\n el: HTMLElement;\n target: WorldPoint;\n ox: number;\n oy: number;\n align: string;\n margin: number;\n lastX: number;\n lastY: number;\n shown: boolean;\n}\n\nconst point = { x: 0, y: 0 };\n\n/**\n * DOM elements that follow points in the world (names over heads, speech bubbles, markers): placed every frame\n * through the world layer's own transform, on whole CSS pixels, and hidden off screen. A style is written only when\n * the rounded position or visibility changed, so a still crowd costs no DOM writes.\n */\nexport class DomWorldAnchors {\n private readonly anchors: Anchor[] = [];\n private ticker: Ticker | null = null;\n private readonly onTick = () => this.update();\n\n constructor(\n private readonly overlay: DomOverlay,\n /** The layer the points are in: `engine.stage.world`. */\n private readonly layer: LayerTransform,\n ) {}\n\n /** Places `el` (put inside the overlay's content if it is not already there) on `target`. Returns the remover. */\n add(el: HTMLElement, target: WorldPoint, options: WorldAnchorOptions = {}): () => void {\n if (!el.parentElement) this.overlay.content.appendChild(el);\n el.style.position = 'absolute';\n el.style.left = '0';\n el.style.top = '0';\n const ax = (options.alignX ?? 0.5) * 100;\n const ay = (options.alignY ?? 1) * 100;\n const a: Anchor = {\n el,\n target,\n ox: options.offsetX ?? 0,\n oy: options.offsetY ?? 0,\n align: ax === 0 && ay === 0 ? '' : ` translate(${-ax}%, ${-ay}%)`,\n margin: options.margin ?? 64,\n lastX: NaN,\n lastY: NaN,\n shown: true,\n };\n this.anchors.push(a);\n return () => this.remove(el);\n }\n\n remove(el: HTMLElement): void {\n const i = this.anchors.findIndex((a) => a.el === el);\n if (i >= 0) this.anchors.splice(i, 1);\n }\n\n /**\n * Runs `update` on `ticker` after Pixi renders (`UTILITY` priority), so it reads the camera as this frame drew it,\n * shake included. The returned function stops it.\n */\n attach(ticker: Ticker): () => void {\n this.detach();\n this.ticker = ticker;\n ticker.add(this.onTick, undefined, UPDATE_PRIORITY.UTILITY);\n return () => this.detach();\n }\n\n detach(): void {\n this.ticker?.remove(this.onTick);\n this.ticker = null;\n }\n\n /** Places every element for this frame. */\n update(): void {\n // the overlay's content is scaled: positions are written in its own units\n const k = this.overlay.cssScale / this.overlay.scale;\n const w = this.overlay.width / this.overlay.scale;\n const h = this.overlay.height / this.overlay.scale;\n for (const a of this.anchors) {\n worldToScreen(this.layer, a.target.x, a.target.y, point, k);\n const x = Math.round(point.x + a.ox);\n const y = Math.round(point.y + a.oy);\n const show = onScreen(x, y, w, h, a.margin);\n if (show !== a.shown) {\n a.shown = show;\n a.el.style.display = show ? '' : 'none';\n }\n if (!show || (x === a.lastX && y === a.lastY)) continue;\n a.lastX = x;\n a.lastY = y;\n a.el.style.transform = `translate3d(${x}px, ${y}px, 0)${a.align}`;\n }\n }\n\n destroy(): void {\n this.detach();\n this.anchors.length = 0;\n }\n}\n"],"names":["point","DomWorldAnchors","overlay","layer","el","target","options","ax","ay","a","i","ticker","UPDATE_PRIORITY","k","w","h","worldToScreen","x","y","show","onScreen"],"mappings":";;AAoCA,MAAMA,IAAQ,EAAE,GAAG,GAAG,GAAG,EAAA;AAOlB,MAAMC,EAAgB;AAAA,EAK3B,YACmBC,GAEAC,GACjB;AAHiB,SAAA,UAAAD,GAEA,KAAA,QAAAC;AAAA,EAChB;AAAA,EAHgB;AAAA,EAEA;AAAA,EAPF,UAAoB,CAAA;AAAA,EAC7B,SAAwB;AAAA,EACf,SAAS,MAAM,KAAK,OAAA;AAAA;AAAA,EASrC,IAAIC,GAAiBC,GAAoBC,IAA8B,CAAA,GAAgB;AACrF,IAAKF,EAAG,sBAAoB,QAAQ,QAAQ,YAAYA,CAAE,GAC1DA,EAAG,MAAM,WAAW,YACpBA,EAAG,MAAM,OAAO,KAChBA,EAAG,MAAM,MAAM;AACf,UAAMG,KAAMD,EAAQ,UAAU,OAAO,KAC/BE,KAAMF,EAAQ,UAAU,KAAK,KAC7BG,IAAY;AAAA,MAChB,IAAAL;AAAA,MACA,QAAAC;AAAA,MACA,IAAIC,EAAQ,WAAW;AAAA,MACvB,IAAIA,EAAQ,WAAW;AAAA,MACvB,OAAOC,MAAO,KAAKC,MAAO,IAAI,KAAK,cAAc,CAACD,CAAE,MAAM,CAACC,CAAE;AAAA,MAC7D,QAAQF,EAAQ,UAAU;AAAA,MAC1B,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,IAAA;AAET,gBAAK,QAAQ,KAAKG,CAAC,GACZ,MAAM,KAAK,OAAOL,CAAE;AAAA,EAC7B;AAAA,EAEA,OAAOA,GAAuB;AAC5B,UAAMM,IAAI,KAAK,QAAQ,UAAU,CAAC,MAAM,EAAE,OAAON,CAAE;AACnD,IAAIM,KAAK,KAAG,KAAK,QAAQ,OAAOA,GAAG,CAAC;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAOC,GAA4B;AACjC,gBAAK,OAAA,GACL,KAAK,SAASA,GACdA,EAAO,IAAI,KAAK,QAAQ,QAAWC,EAAgB,OAAO,GACnD,MAAM,KAAK,OAAA;AAAA,EACpB;AAAA,EAEA,SAAe;AACb,SAAK,QAAQ,OAAO,KAAK,MAAM,GAC/B,KAAK,SAAS;AAAA,EAChB;AAAA;AAAA,EAGA,SAAe;AAEb,UAAMC,IAAI,KAAK,QAAQ,WAAW,KAAK,QAAQ,OACzCC,IAAI,KAAK,QAAQ,QAAQ,KAAK,QAAQ,OACtCC,IAAI,KAAK,QAAQ,SAAS,KAAK,QAAQ;AAC7C,eAAWN,KAAK,KAAK,SAAS;AAC5B,MAAAO,EAAc,KAAK,OAAOP,EAAE,OAAO,GAAGA,EAAE,OAAO,GAAGT,GAAOa,CAAC;AAC1D,YAAMI,IAAI,KAAK,MAAMjB,EAAM,IAAIS,EAAE,EAAE,GAC7BS,IAAI,KAAK,MAAMlB,EAAM,IAAIS,EAAE,EAAE,GAC7BU,IAAOC,EAASH,GAAGC,GAAGJ,GAAGC,GAAGN,EAAE,MAAM;AAK1C,MAJIU,MAASV,EAAE,UACbA,EAAE,QAAQU,GACVV,EAAE,GAAG,MAAM,UAAUU,IAAO,KAAK,SAE/B,GAACA,KAASF,MAAMR,EAAE,SAASS,MAAMT,EAAE,WACvCA,EAAE,QAAQQ,GACVR,EAAE,QAAQS,GACVT,EAAE,GAAG,MAAM,YAAY,eAAeQ,CAAC,OAAOC,CAAC,SAAST,EAAE,KAAK;AAAA,IACjE;AAAA,EACF;AAAA,EAEA,UAAgB;AACd,SAAK,OAAA,GACL,KAAK,QAAQ,SAAS;AAAA,EACxB;AACF;"}
@@ -0,0 +1,27 @@
1
+ import { isEditable as s, isInside as i, shouldShield as c } from "./shieldDecision.js";
2
+ const n = ["keydown", "keypress", "pointerdown", "mousedown", "touchstart", "click", "dblclick", "wheel", "contextmenu"];
3
+ class a {
4
+ constructor(t, o = {}) {
5
+ this.root = t, this.options = o;
6
+ for (const e of n) t.addEventListener(e, this.handler, { passive: !1 });
7
+ }
8
+ root;
9
+ options;
10
+ handler = (t) => this.check(t);
11
+ /** Whether the player is typing in a field of the UI now (a game may also skip its hotkeys). */
12
+ get typing() {
13
+ const t = this.root.ownerDocument.activeElement;
14
+ return s(t) && i(t, this.root);
15
+ }
16
+ destroy() {
17
+ for (const t of n) this.root.removeEventListener(t, this.handler);
18
+ }
19
+ check(t) {
20
+ const o = t.target, e = t.code, r = { insideUi: i(o, this.root), editable: s(o), ...e === void 0 ? {} : { code: e } };
21
+ c(t.type, r, this.options) && t.stopPropagation();
22
+ }
23
+ }
24
+ export {
25
+ a as InputShield
26
+ };
27
+ //# sourceMappingURL=InputShield.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputShield.js","sources":["../../../src/ui/dom/InputShield.ts"],"sourcesContent":["import { isEditable, isInside, shouldShield, type ShieldOptions } from './shieldDecision';\n\n/** The events checked on their way up out of the overlay. */\nconst EVENTS = ['keydown', 'keypress', 'pointerdown', 'mousedown', 'touchstart', 'click', 'dblclick', 'wheel', 'contextmenu'] as const;\n\n/**\n * Keeps input meant for the DOM UI from reaching the engine. It listens on the overlay's root as events bubble out\n * of it and stops the ones `shouldShield` names, so the element under them still gets them (a text field still\n * types) but listeners on the window and document (`Keyboard`, a game's own) never hear them.\n *\n * Presses on the overlay never reach `Pointer` anyway, which counts presses only on the canvas; the shield covers\n * keys, wheel and window-level listeners. Releases always pass, or a key held when a field took focus would stick.\n */\nexport class InputShield {\n private readonly handler = (e: Event) => this.check(e);\n\n constructor(\n private readonly root: HTMLElement,\n private readonly options: ShieldOptions = {},\n ) {\n for (const type of EVENTS) root.addEventListener(type, this.handler, { passive: false });\n }\n\n /** Whether the player is typing in a field of the UI now (a game may also skip its hotkeys). */\n get typing(): boolean {\n const active = this.root.ownerDocument.activeElement;\n return isEditable(active as HTMLElement | null) && isInside(active as HTMLElement | null, this.root);\n }\n\n destroy(): void {\n for (const type of EVENTS) this.root.removeEventListener(type, this.handler);\n }\n\n private check(e: Event): void {\n const target = e.target as HTMLElement | null;\n const code = (e as KeyboardEvent).code;\n const facts = { insideUi: isInside(target, this.root), editable: isEditable(target), ...(code === undefined ? {} : { code }) };\n if (shouldShield(e.type, facts, this.options)) e.stopPropagation();\n }\n}\n"],"names":["EVENTS","InputShield","root","options","type","e","active","isEditable","isInside","target","code","facts","shouldShield"],"mappings":";AAGA,MAAMA,IAAS,CAAC,WAAW,YAAY,eAAe,aAAa,cAAc,SAAS,YAAY,SAAS,aAAa;AAUrH,MAAMC,EAAY;AAAA,EAGvB,YACmBC,GACAC,IAAyB,IAC1C;AAFiB,SAAA,OAAAD,GACA,KAAA,UAAAC;AAEjB,eAAWC,KAAQJ,EAAQ,CAAAE,EAAK,iBAAiBE,GAAM,KAAK,SAAS,EAAE,SAAS,GAAA,CAAO;AAAA,EACzF;AAAA,EAJmB;AAAA,EACA;AAAA,EAJF,UAAU,CAACC,MAAa,KAAK,MAAMA,CAAC;AAAA;AAAA,EAUrD,IAAI,SAAkB;AACpB,UAAMC,IAAS,KAAK,KAAK,cAAc;AACvC,WAAOC,EAAWD,CAA4B,KAAKE,EAASF,GAA8B,KAAK,IAAI;AAAA,EACrG;AAAA,EAEA,UAAgB;AACd,eAAWF,KAAQJ,EAAQ,MAAK,KAAK,oBAAoBI,GAAM,KAAK,OAAO;AAAA,EAC7E;AAAA,EAEQ,MAAMC,GAAgB;AAC5B,UAAMI,IAASJ,EAAE,QACXK,IAAQL,EAAoB,MAC5BM,IAAQ,EAAE,UAAUH,EAASC,GAAQ,KAAK,IAAI,GAAG,UAAUF,EAAWE,CAAM,GAAG,GAAIC,MAAS,SAAY,CAAA,IAAK,EAAE,MAAAA,IAAK;AAC1H,IAAIE,EAAaP,EAAE,MAAMM,GAAO,KAAK,OAAO,OAAK,gBAAA;AAAA,EACnD;AACF;"}
@@ -0,0 +1,42 @@
1
+ function l(f) {
2
+ let t = f, s = [];
3
+ const i = {
4
+ getState: () => t,
5
+ setState(e) {
6
+ const r = typeof e == "function" ? e(t) : e;
7
+ let c = !1;
8
+ for (const o in r)
9
+ if (!Object.is(r[o], t[o])) {
10
+ c = !0;
11
+ break;
12
+ }
13
+ if (!c) return;
14
+ const n = t;
15
+ t = { ...t, ...r };
16
+ for (const o of s) o(t, n);
17
+ },
18
+ subscribe(e) {
19
+ return s = [...s, e], () => {
20
+ s = s.filter((r) => r !== e);
21
+ };
22
+ },
23
+ select(e, r, c = Object.is) {
24
+ let n = e(t);
25
+ return i.subscribe((o) => {
26
+ const u = e(o);
27
+ if (c(u, n)) return;
28
+ const b = n;
29
+ n = u, r(u, b);
30
+ });
31
+ },
32
+ reset() {
33
+ const e = t;
34
+ if (t = f, e !== f) for (const r of s) r(t, e);
35
+ }
36
+ };
37
+ return i;
38
+ }
39
+ export {
40
+ l as createStore
41
+ };
42
+ //# sourceMappingURL=createStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createStore.js","sources":["../../../src/ui/dom/createStore.ts"],"sourcesContent":["export type StoreListener<T> = (state: T, previous: T) => void;\n\n/**\n * A tiny shared state store between the game and its UI, framework-free. Same shape as the engine's settings store\n * and as zustand's vanilla stores (`getState`, `setState`, `subscribe`), so React reads it with\n * `useSyncExternalStore(store.subscribe, store.getState)`.\n */\nexport interface Store<T extends object> {\n getState(): T;\n /**\n * Merges a patch (or what a function of the state returns) into a new state object. A patch that changes nothing\n * notifies nobody: a game may set the player's health every frame and the UI renders only when it moved.\n */\n setState(patch: Partial<T> | ((state: T) => Partial<T>)): void;\n /** Calls `listener` after every change; the returned function unsubscribes. */\n subscribe(listener: StoreListener<T>): () => void;\n /** Calls `listener` only when `select(state)` changes (by `equals`, default `Object.is`). */\n select<S>(select: (state: T) => S, listener: (value: S, previous: S) => void, equals?: (a: S, b: S) => boolean): () => void;\n /** Back to the state it was made with. */\n reset(): void;\n}\n\nexport function createStore<T extends object>(initial: T): Store<T> {\n let state = initial;\n // replaced, never edited, on (un)subscribe: setState walks it without a copy, and a listener that unsubscribes\n // while it runs does not shift the walk\n let listeners: readonly StoreListener<T>[] = [];\n\n const store: Store<T> = {\n getState: () => state,\n setState(patch) {\n const p = typeof patch === 'function' ? patch(state) : patch;\n let changed = false;\n for (const k in p) {\n if (!Object.is(p[k], state[k])) {\n changed = true;\n break;\n }\n }\n if (!changed) return;\n const previous = state;\n state = { ...state, ...p };\n for (const l of listeners) l(state, previous);\n },\n subscribe(listener) {\n listeners = [...listeners, listener];\n return () => {\n listeners = listeners.filter((l) => l !== listener);\n };\n },\n select(select, listener, equals = Object.is) {\n let current = select(state);\n return store.subscribe((s) => {\n const next = select(s);\n if (equals(next, current)) return;\n const previous = current;\n current = next;\n listener(next, previous);\n });\n },\n reset() {\n const previous = state;\n state = initial;\n if (previous !== initial) for (const l of listeners) l(state, previous);\n },\n };\n return store;\n}\n"],"names":["createStore","initial","state","listeners","store","patch","p","changed","k","previous","l","listener","select","equals","current","s","next"],"mappings":"AAsBO,SAASA,EAA8BC,GAAsB;AAClE,MAAIC,IAAQD,GAGRE,IAAyC,CAAA;AAE7C,QAAMC,IAAkB;AAAA,IACtB,UAAU,MAAMF;AAAA,IAChB,SAASG,GAAO;AACd,YAAMC,IAAI,OAAOD,KAAU,aAAaA,EAAMH,CAAK,IAAIG;AACvD,UAAIE,IAAU;AACd,iBAAWC,KAAKF;AACd,YAAI,CAAC,OAAO,GAAGA,EAAEE,CAAC,GAAGN,EAAMM,CAAC,CAAC,GAAG;AAC9B,UAAAD,IAAU;AACV;AAAA,QACF;AAEF,UAAI,CAACA,EAAS;AACd,YAAME,IAAWP;AACjB,MAAAA,IAAQ,EAAE,GAAGA,GAAO,GAAGI,EAAA;AACvB,iBAAWI,KAAKP,EAAW,CAAAO,EAAER,GAAOO,CAAQ;AAAA,IAC9C;AAAA,IACA,UAAUE,GAAU;AAClB,aAAAR,IAAY,CAAC,GAAGA,GAAWQ,CAAQ,GAC5B,MAAM;AACX,QAAAR,IAAYA,EAAU,OAAO,CAACO,MAAMA,MAAMC,CAAQ;AAAA,MACpD;AAAA,IACF;AAAA,IACA,OAAOC,GAAQD,GAAUE,IAAS,OAAO,IAAI;AAC3C,UAAIC,IAAUF,EAAOV,CAAK;AAC1B,aAAOE,EAAM,UAAU,CAACW,MAAM;AAC5B,cAAMC,IAAOJ,EAAOG,CAAC;AACrB,YAAIF,EAAOG,GAAMF,CAAO,EAAG;AAC3B,cAAML,IAAWK;AACjB,QAAAA,IAAUE,GACVL,EAASK,GAAMP,CAAQ;AAAA,MACzB,CAAC;AAAA,IACH;AAAA,IACA,QAAQ;AACN,YAAMA,IAAWP;AAEjB,UADAA,IAAQD,GACJQ,MAAaR,EAAS,YAAWS,KAAKP,EAAW,CAAAO,EAAER,GAAOO,CAAQ;AAAA,IACxE;AAAA,EAAA;AAEF,SAAOL;AACT;"}
@@ -0,0 +1,36 @@
1
+ const n = /* @__PURE__ */ new Set(["text", "search", "email", "password", "number", "url", "tel", "date", "time", "datetime-local", "month", "week", ""]);
2
+ function a(t) {
3
+ if (!t) return !1;
4
+ if (t.isContentEditable) return !0;
5
+ const e = t.tagName?.toUpperCase();
6
+ return e === "TEXTAREA" || e === "SELECT" ? !0 : e === "INPUT" && n.has((t.type ?? "").toLowerCase());
7
+ }
8
+ function i(t, e) {
9
+ for (let r = t; r; r = r.parentElement) if (r === e) return !0;
10
+ return !1;
11
+ }
12
+ const s = ["Enter", "NumpadEnter", "Space"];
13
+ function u(t, e, r = {}) {
14
+ if (!e.insideUi) return !1;
15
+ switch (t) {
16
+ case "keydown":
17
+ case "keypress":
18
+ return e.editable ? !0 : e.code !== void 0 && (r.uiKeys ?? s).includes(e.code);
19
+ case "pointerdown":
20
+ case "mousedown":
21
+ case "touchstart":
22
+ case "click":
23
+ case "dblclick":
24
+ case "wheel":
25
+ case "contextmenu":
26
+ return !0;
27
+ default:
28
+ return !1;
29
+ }
30
+ }
31
+ export {
32
+ a as isEditable,
33
+ i as isInside,
34
+ u as shouldShield
35
+ };
36
+ //# sourceMappingURL=shieldDecision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shieldDecision.js","sources":["../../../src/ui/dom/shieldDecision.ts"],"sourcesContent":["/** The few fields of a DOM element the decision reads; real elements fit, and tests pass plain objects. */\nexport interface ElementLike {\n readonly tagName?: string;\n readonly type?: string;\n readonly isContentEditable?: boolean;\n readonly parentElement?: ElementLike | null;\n}\n\n/** `<input>` types that take typing; the rest (checkbox, range, button…) are pressed, not typed into. */\nconst TYPED_INPUTS = new Set(['text', 'search', 'email', 'password', 'number', 'url', 'tel', 'date', 'time', 'datetime-local', 'month', 'week', '']);\n\n/** Whether keys pressed on this element are typing (a text field, a text area, a select, editable content). */\nexport function isEditable(el: ElementLike | null | undefined): boolean {\n if (!el) return false;\n if (el.isContentEditable) return true;\n const tag = el.tagName?.toUpperCase();\n if (tag === 'TEXTAREA' || tag === 'SELECT') return true;\n return tag === 'INPUT' && TYPED_INPUTS.has((el.type ?? '').toLowerCase());\n}\n\n/** Whether `el` is `root` or inside it. */\nexport function isInside(el: ElementLike | null | undefined, root: ElementLike): boolean {\n for (let e = el; e; e = e.parentElement) if (e === root) return true;\n return false;\n}\n\nexport interface ShieldFacts {\n /** The event's target is in the DOM UI overlay. */\n insideUi: boolean;\n /** The target takes typing (`isEditable`). */\n editable: boolean;\n /** `KeyboardEvent.code`, for key events. */\n code?: string;\n}\n\nexport interface ShieldOptions {\n /**\n * Keys a focused, non-typing UI element (a button) keeps from the game: the ones that press it (default Enter,\n * Space). Others still reach the game, so a button left focused after a click does not stop the hero walking.\n */\n uiKeys?: readonly string[];\n}\n\nconst UI_KEYS = ['Enter', 'NumpadEnter', 'Space'];\n\n/**\n * Whether an event on the DOM UI must be kept from the engine's input. Releases (`keyup`, `pointerup`,\n * `pointercancel`) always go through, or a key or button held when the UI took over would stay down for good; moves\n * go through so aiming follows the pointer over a panel. Presses, wheel and context menus on the UI stay in the UI,\n * and so does every key typed into a field.\n */\nexport function shouldShield(type: string, facts: ShieldFacts, options: ShieldOptions = {}): boolean {\n if (!facts.insideUi) return false;\n switch (type) {\n case 'keydown':\n case 'keypress':\n if (facts.editable) return true;\n return facts.code !== undefined && (options.uiKeys ?? UI_KEYS).includes(facts.code);\n case 'pointerdown':\n case 'mousedown':\n case 'touchstart':\n case 'click':\n case 'dblclick':\n case 'wheel':\n case 'contextmenu':\n return true;\n default:\n return false;\n }\n}\n"],"names":["TYPED_INPUTS","isEditable","el","tag","isInside","root","e","UI_KEYS","shouldShield","type","facts","options"],"mappings":"AASA,MAAMA,IAAe,oBAAI,IAAI,CAAC,QAAQ,UAAU,SAAS,YAAY,UAAU,OAAO,OAAO,QAAQ,QAAQ,kBAAkB,SAAS,QAAQ,EAAE,CAAC;AAG5I,SAASC,EAAWC,GAA6C;AACtE,MAAI,CAACA,EAAI,QAAO;AAChB,MAAIA,EAAG,kBAAmB,QAAO;AACjC,QAAMC,IAAMD,EAAG,SAAS,YAAA;AACxB,SAAIC,MAAQ,cAAcA,MAAQ,WAAiB,KAC5CA,MAAQ,WAAWH,EAAa,KAAKE,EAAG,QAAQ,IAAI,aAAa;AAC1E;AAGO,SAASE,EAASF,GAAoCG,GAA4B;AACvF,WAASC,IAAIJ,GAAII,GAAGA,IAAIA,EAAE,cAAe,KAAIA,MAAMD,EAAM,QAAO;AAChE,SAAO;AACT;AAmBA,MAAME,IAAU,CAAC,SAAS,eAAe,OAAO;AAQzC,SAASC,EAAaC,GAAcC,GAAoBC,IAAyB,CAAA,GAAa;AACnG,MAAI,CAACD,EAAM,SAAU,QAAO;AAC5B,UAAQD,GAAA;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AACH,aAAIC,EAAM,WAAiB,KACpBA,EAAM,SAAS,WAAcC,EAAQ,UAAUJ,GAAS,SAASG,EAAM,IAAI;AAAA,IACpF,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EAAA;AAEb;"}
@@ -0,0 +1,11 @@
1
+ function x(n, o, t, c, e = 1) {
2
+ return c.x = (n.x + o * n.scale.x) * e, c.y = (n.y + t * n.scale.y) * e, c;
3
+ }
4
+ function f(n, o, t, c, e = 0) {
5
+ return n >= -e && o >= -e && n <= t + e && o <= c + e;
6
+ }
7
+ export {
8
+ f as onScreen,
9
+ x as worldToScreen
10
+ };
11
+ //# sourceMappingURL=worldToScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worldToScreen.js","sources":["../../../src/ui/dom/worldToScreen.ts"],"sourcesContent":["/** A layer's transform as drawn: `stage.world` (a Pixi container) fits it, with the camera and its shake applied. */\nexport interface LayerTransform {\n readonly x: number;\n readonly y: number;\n readonly scale: { readonly x: number; readonly y: number };\n}\n\n/**\n * Where a world point is on the overlay, in CSS pixels: through the world layer's own transform (so the camera's\n * zoom, scroll and shake are all in it), times how much CSS stretches the canvas (`cssScale`, 1 normally). Writes\n * into `out`: called for every placed element every frame.\n */\nexport function worldToScreen(layer: LayerTransform, wx: number, wy: number, out: { x: number; y: number }, cssScale = 1): { x: number; y: number } {\n out.x = (layer.x + wx * layer.scale.x) * cssScale;\n out.y = (layer.y + wy * layer.scale.y) * cssScale;\n return out;\n}\n\n/** Whether a point is on a `width` × `height` screen, or within `margin` of it (an element's own size past the point). */\nexport function onScreen(x: number, y: number, width: number, height: number, margin = 0): boolean {\n return x >= -margin && y >= -margin && x <= width + margin && y <= height + margin;\n}\n"],"names":["worldToScreen","layer","wx","wy","out","cssScale","onScreen","x","y","width","height","margin"],"mappings":"AAYO,SAASA,EAAcC,GAAuBC,GAAYC,GAAYC,GAA+BC,IAAW,GAA6B;AAClJ,SAAAD,EAAI,KAAKH,EAAM,IAAIC,IAAKD,EAAM,MAAM,KAAKI,GACzCD,EAAI,KAAKH,EAAM,IAAIE,IAAKF,EAAM,MAAM,KAAKI,GAClCD;AACT;AAGO,SAASE,EAASC,GAAWC,GAAWC,GAAeC,GAAgBC,IAAS,GAAY;AACjG,SAAOJ,KAAK,CAACI,KAAUH,KAAK,CAACG,KAAUJ,KAAKE,IAAQE,KAAUH,KAAKE,IAASC;AAC9E;"}
@@ -0,0 +1,20 @@
1
+ import { insets as s, snapPx as c } from "./geometry.js";
2
+ const l = {
3
+ "top-left": [0, 0],
4
+ top: [0.5, 0],
5
+ "top-right": [1, 0],
6
+ left: [0, 0.5],
7
+ center: [0.5, 0.5],
8
+ right: [1, 0.5],
9
+ "bottom-left": [0, 1],
10
+ bottom: [0.5, 1],
11
+ "bottom-right": [1, 1]
12
+ };
13
+ function b(e, t, o, g = 0, n = !1) {
14
+ const h = s(g), [i, f] = l[e], r = i === 0 ? h.left : i === 1 ? o.width - h.right - t.width : (o.width - t.width) / 2, m = f === 0 ? h.top : f === 1 ? o.height - h.bottom - t.height : (o.height - t.height) / 2;
15
+ return { x: c(r, n), y: c(m, n) };
16
+ }
17
+ export {
18
+ b as anchorPosition
19
+ };
20
+ //# sourceMappingURL=anchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchor.js","sources":["../../../src/ui/layout/anchor.ts"],"sourcesContent":["import { insets, snapPx, type Insets, type Point, type Size } from './geometry';\n\n/** A spot on the screen a HUD piece is pinned to; it stays there whatever the screen's size. */\nexport type ScreenAnchor = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';\n\n/** Fractions of the free space for each anchor: 0 hugs the left/top edge, 1 the right/bottom, 0.5 centres. */\nconst FRACTIONS: Record<ScreenAnchor, readonly [number, number]> = {\n 'top-left': [0, 0],\n top: [0.5, 0],\n 'top-right': [1, 0],\n left: [0, 0.5],\n center: [0.5, 0.5],\n right: [1, 0.5],\n 'bottom-left': [0, 1],\n bottom: [0.5, 1],\n 'bottom-right': [1, 1],\n};\n\n/**\n * Top-left of a box of `size` pinned to `anchor` of the viewport, `margin` in from the edges (a number, or per side\n * for a phone's notch). Centred anchors ignore the margins of the sides they do not touch.\n */\nexport function anchorPosition(anchor: ScreenAnchor, size: Size, viewport: Size, margin: number | Partial<Insets> = 0, snap = false): Point {\n const m = insets(margin);\n const [fx, fy] = FRACTIONS[anchor];\n const x = fx === 0 ? m.left : fx === 1 ? viewport.width - m.right - size.width : (viewport.width - size.width) / 2;\n const y = fy === 0 ? m.top : fy === 1 ? viewport.height - m.bottom - size.height : (viewport.height - size.height) / 2;\n return { x: snapPx(x, snap), y: snapPx(y, snap) };\n}\n"],"names":["FRACTIONS","anchorPosition","anchor","size","viewport","margin","snap","m","insets","fx","fy","x","y","snapPx"],"mappings":";AAMA,MAAMA,IAA6D;AAAA,EACjE,YAAY,CAAC,GAAG,CAAC;AAAA,EACjB,KAAK,CAAC,KAAK,CAAC;AAAA,EACZ,aAAa,CAAC,GAAG,CAAC;AAAA,EAClB,MAAM,CAAC,GAAG,GAAG;AAAA,EACb,QAAQ,CAAC,KAAK,GAAG;AAAA,EACjB,OAAO,CAAC,GAAG,GAAG;AAAA,EACd,eAAe,CAAC,GAAG,CAAC;AAAA,EACpB,QAAQ,CAAC,KAAK,CAAC;AAAA,EACf,gBAAgB,CAAC,GAAG,CAAC;AACvB;AAMO,SAASC,EAAeC,GAAsBC,GAAYC,GAAgBC,IAAmC,GAAGC,IAAO,IAAc;AAC1I,QAAMC,IAAIC,EAAOH,CAAM,GACjB,CAACI,GAAIC,CAAE,IAAIV,EAAUE,CAAM,GAC3BS,IAAIF,MAAO,IAAIF,EAAE,OAAOE,MAAO,IAAIL,EAAS,QAAQG,EAAE,QAAQJ,EAAK,SAASC,EAAS,QAAQD,EAAK,SAAS,GAC3GS,IAAIF,MAAO,IAAIH,EAAE,MAAMG,MAAO,IAAIN,EAAS,SAASG,EAAE,SAASJ,EAAK,UAAUC,EAAS,SAASD,EAAK,UAAU;AACrH,SAAO,EAAE,GAAGU,EAAOF,GAAGL,CAAI,GAAG,GAAGO,EAAOD,GAAGN,CAAI,EAAA;AAChD;"}
@@ -0,0 +1,25 @@
1
+ function u(i = 1) {
2
+ return { value: i, trail: i, holdMs: 0 };
3
+ }
4
+ function d(i, l, n = {}) {
5
+ const r = l < 0 ? 0 : l > 1 ? 1 : l;
6
+ r < i.value && (i.holdMs = n.delayMs ?? 400), r > i.trail && (i.trail = r), i.value = r;
7
+ }
8
+ function f(i, l, n = {}) {
9
+ if (i.trail <= i.value) {
10
+ i.trail = i.value;
11
+ return;
12
+ }
13
+ let r = l;
14
+ if (i.holdMs > 0) {
15
+ const o = Math.min(i.holdMs, r);
16
+ i.holdMs -= o, r -= o;
17
+ }
18
+ r <= 0 || (i.trail = Math.max(i.value, i.trail - (n.rate ?? 0.6) * r / 1e3));
19
+ }
20
+ export {
21
+ u as drainState,
22
+ d as setDrainValue,
23
+ f as stepDrain
24
+ };
25
+ //# sourceMappingURL=barDrain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barDrain.js","sources":["../../../src/ui/layout/barDrain.ts"],"sourcesContent":["/**\n * A bar's two lengths: what it holds now (`value`) and the trail behind it (`trail`) that drains down to it after a\n * short hold, so a hit shows how much it took. Fractions 0–1. Mutated in place: a health bar is set every frame.\n */\nexport interface DrainState {\n value: number;\n trail: number;\n /** What is left of the hold before the trail starts to drain (ms). */\n holdMs: number;\n}\n\nexport interface DrainOptions {\n /** How long the trail holds after a loss before draining (default 400 ms). */\n delayMs?: number;\n /** How fast it drains, in whole bars a second (default 0.6). */\n rate?: number;\n}\n\nexport function drainState(value = 1): DrainState {\n return { value, trail: value, holdMs: 0 };\n}\n\n/**\n * Sets the bar. A loss restarts the hold, so blows in quick succession show one trail for all of them; a gain fills\n * at once and pulls the trail up with it (a heal has nothing to show behind it).\n */\nexport function setDrainValue(state: DrainState, value: number, options: DrainOptions = {}): void {\n const v = value < 0 ? 0 : value > 1 ? 1 : value;\n if (v < state.value) state.holdMs = options.delayMs ?? 400;\n if (v > state.trail) state.trail = v;\n state.value = v;\n}\n\n/** Advances the trail by a frame `dtMs` long. */\nexport function stepDrain(state: DrainState, dtMs: number, options: DrainOptions = {}): void {\n if (state.trail <= state.value) {\n state.trail = state.value;\n return;\n }\n let dt = dtMs;\n if (state.holdMs > 0) {\n const used = Math.min(state.holdMs, dt);\n state.holdMs -= used;\n dt -= used;\n }\n if (dt <= 0) return;\n state.trail = Math.max(state.value, state.trail - ((options.rate ?? 0.6) * dt) / 1000);\n}\n"],"names":["drainState","value","setDrainValue","state","options","v","stepDrain","dtMs","dt","used"],"mappings":"AAkBO,SAASA,EAAWC,IAAQ,GAAe;AAChD,SAAO,EAAE,OAAAA,GAAO,OAAOA,GAAO,QAAQ,EAAA;AACxC;AAMO,SAASC,EAAcC,GAAmBF,GAAeG,IAAwB,CAAA,GAAU;AAChG,QAAMC,IAAIJ,IAAQ,IAAI,IAAIA,IAAQ,IAAI,IAAIA;AAC1C,EAAII,IAAIF,EAAM,UAAOA,EAAM,SAASC,EAAQ,WAAW,MACnDC,IAAIF,EAAM,UAAOA,EAAM,QAAQE,IACnCF,EAAM,QAAQE;AAChB;AAGO,SAASC,EAAUH,GAAmBI,GAAcH,IAAwB,CAAA,GAAU;AAC3F,MAAID,EAAM,SAASA,EAAM,OAAO;AAC9B,IAAAA,EAAM,QAAQA,EAAM;AACpB;AAAA,EACF;AACA,MAAIK,IAAKD;AACT,MAAIJ,EAAM,SAAS,GAAG;AACpB,UAAMM,IAAO,KAAK,IAAIN,EAAM,QAAQK,CAAE;AACtC,IAAAL,EAAM,UAAUM,GAChBD,KAAMC;AAAA,EACR;AACA,EAAID,KAAM,MACVL,EAAM,QAAQ,KAAK,IAAIA,EAAM,OAAOA,EAAM,SAAUC,EAAQ,QAAQ,OAAOI,IAAM,GAAI;AACvF;"}
@@ -0,0 +1,17 @@
1
+ import { clamp as o, snapPx as w } from "./geometry.js";
2
+ function W(h, a, n = {}) {
3
+ const t = n.margin ?? 8, s = n.scale ?? 1, e = Math.min(n.minScale ?? s, s), c = n.snap ?? !1, d = Math.max(0, a.width - 2 * t), g = Math.max(0, a.height - 2 * t), f = h.width > 0 && h.height > 0 ? Math.min(d / h.width, g / h.height) : s, i = o(f, e, s), m = Math.min(h.width, d / i), l = Math.min(h.height, g / i), x = m * i, M = l * i, y = n.centre || !("x" in h) ? (a.width - x) / 2 : h.x, r = n.centre || !("y" in h) ? (a.height - M) / 2 : h.y, u = o(y, t, Math.max(t, a.width - t - x)), H = o(r, t, Math.max(t, a.height - t - M));
4
+ return {
5
+ x: w(u, c),
6
+ y: w(H, c),
7
+ width: c ? Math.floor(m) : m,
8
+ height: c ? Math.floor(l) : l,
9
+ scale: i,
10
+ scrollX: m < h.width,
11
+ scrollY: l < h.height
12
+ };
13
+ }
14
+ export {
15
+ W as fitToViewport
16
+ };
17
+ //# sourceMappingURL=fitToViewport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fitToViewport.js","sources":["../../../src/ui/layout/fitToViewport.ts"],"sourcesContent":["import { clamp, snapPx, type Rect, type Size } from './geometry';\n\nexport interface FitOptions {\n /** Kept clear between the window and the screen's edges (default 8). */\n margin?: number;\n /**\n * The scale the window is meant to be drawn at (default 1): a player's \"window size\" setting, or a whole multiple\n * for pixel art. The window is laid out on a box `1 / scale` the screen and drawn back at `scale`.\n */\n scale?: number;\n /**\n * The smallest scale it may shrink to before it starts scrolling instead (default: `scale`, never shrinks). A\n * pixel-art game keeps it at its whole scale: a fractional one smears every texel.\n */\n minScale?: number;\n /** Centre it on the screen instead of keeping `rect.x/y` (default false). */\n centre?: boolean;\n snap?: boolean;\n}\n\nexport interface FitResult extends Rect {\n /** The scale to draw the window at; `x`, `y` are screen pixels, `width`, `height` the window's own units. */\n scale: number;\n /** The window was cut shorter (narrower) than it wanted: its body must scroll. */\n scrollY: boolean;\n scrollX: boolean;\n}\n\n/**\n * Fits a window into the screen so it never overflows it: shrunk down to `minScale` if that is allowed, then cut to\n * what is left (the caller scrolls its body), and moved back inside the edges. `rect` is where and how big the\n * window wants to be, in its own units; `x`, `y` are screen pixels.\n */\nexport function fitToViewport(rect: Rect | Size, viewport: Size, options: FitOptions = {}): FitResult {\n const margin = options.margin ?? 8;\n const preferred = options.scale ?? 1;\n const minScale = Math.min(options.minScale ?? preferred, preferred);\n const snap = options.snap ?? false;\n const availW = Math.max(0, viewport.width - 2 * margin);\n const availH = Math.max(0, viewport.height - 2 * margin);\n const fits = rect.width > 0 && rect.height > 0 ? Math.min(availW / rect.width, availH / rect.height) : preferred;\n const scale = clamp(fits, minScale, preferred);\n // what still does not fit at that scale is cut, and the body scrolls\n const width = Math.min(rect.width, availW / scale);\n const height = Math.min(rect.height, availH / scale);\n const drawnW = width * scale;\n const drawnH = height * scale;\n const wantX = options.centre || !('x' in rect) ? (viewport.width - drawnW) / 2 : rect.x;\n const wantY = options.centre || !('y' in rect) ? (viewport.height - drawnH) / 2 : rect.y;\n const x = clamp(wantX, margin, Math.max(margin, viewport.width - margin - drawnW));\n const y = clamp(wantY, margin, Math.max(margin, viewport.height - margin - drawnH));\n return {\n x: snapPx(x, snap),\n y: snapPx(y, snap),\n width: snap ? Math.floor(width) : width,\n height: snap ? Math.floor(height) : height,\n scale,\n scrollX: width < rect.width,\n scrollY: height < rect.height,\n };\n}\n"],"names":["fitToViewport","rect","viewport","options","margin","preferred","minScale","snap","availW","availH","fits","scale","clamp","width","height","drawnW","drawnH","wantX","wantY","x","y","snapPx"],"mappings":";AAiCO,SAASA,EAAcC,GAAmBC,GAAgBC,IAAsB,CAAA,GAAe;AACpG,QAAMC,IAASD,EAAQ,UAAU,GAC3BE,IAAYF,EAAQ,SAAS,GAC7BG,IAAW,KAAK,IAAIH,EAAQ,YAAYE,GAAWA,CAAS,GAC5DE,IAAOJ,EAAQ,QAAQ,IACvBK,IAAS,KAAK,IAAI,GAAGN,EAAS,QAAQ,IAAIE,CAAM,GAChDK,IAAS,KAAK,IAAI,GAAGP,EAAS,SAAS,IAAIE,CAAM,GACjDM,IAAOT,EAAK,QAAQ,KAAKA,EAAK,SAAS,IAAI,KAAK,IAAIO,IAASP,EAAK,OAAOQ,IAASR,EAAK,MAAM,IAAII,GACjGM,IAAQC,EAAMF,GAAMJ,GAAUD,CAAS,GAEvCQ,IAAQ,KAAK,IAAIZ,EAAK,OAAOO,IAASG,CAAK,GAC3CG,IAAS,KAAK,IAAIb,EAAK,QAAQQ,IAASE,CAAK,GAC7CI,IAASF,IAAQF,GACjBK,IAASF,IAASH,GAClBM,IAAQd,EAAQ,UAAU,EAAE,OAAOF,MAASC,EAAS,QAAQa,KAAU,IAAId,EAAK,GAChFiB,IAAQf,EAAQ,UAAU,EAAE,OAAOF,MAASC,EAAS,SAASc,KAAU,IAAIf,EAAK,GACjFkB,IAAIP,EAAMK,GAAOb,GAAQ,KAAK,IAAIA,GAAQF,EAAS,QAAQE,IAASW,CAAM,CAAC,GAC3EK,IAAIR,EAAMM,GAAOd,GAAQ,KAAK,IAAIA,GAAQF,EAAS,SAASE,IAASY,CAAM,CAAC;AAClF,SAAO;AAAA,IACL,GAAGK,EAAOF,GAAGZ,CAAI;AAAA,IACjB,GAAGc,EAAOD,GAAGb,CAAI;AAAA,IACjB,OAAOA,IAAO,KAAK,MAAMM,CAAK,IAAIA;AAAA,IAClC,QAAQN,IAAO,KAAK,MAAMO,CAAM,IAAIA;AAAA,IACpC,OAAAH;AAAA,IACA,SAASE,IAAQZ,EAAK;AAAA,IACtB,SAASa,IAASb,EAAK;AAAA,EAAA;AAE3B;"}
@@ -0,0 +1,42 @@
1
+ function h(n) {
2
+ return n.x + n.width / 2;
3
+ }
4
+ function a(n) {
5
+ return n.y + n.height / 2;
6
+ }
7
+ function E(n) {
8
+ let t = -1;
9
+ for (let o = 0; o < n.length; o++) {
10
+ const e = n[o], i = t < 0 ? null : n[t];
11
+ (!i || e.y < i.y || e.y === i.y && e.x < i.x) && (t = o);
12
+ }
13
+ return t;
14
+ }
15
+ function F(n, t, o, e = !1) {
16
+ if (n.length === 0) return -1;
17
+ const i = n[t];
18
+ if (!i) return E(n);
19
+ const y = h(i), g = a(i), S = o === "left" || o === "right", C = o === "right" || o === "down" ? 1 : -1;
20
+ let r = -1, b = 1 / 0, u = -1, x = 1 / 0;
21
+ for (let f = 0; f < n.length; f++) {
22
+ if (f === t) continue;
23
+ const l = n[f], c = (S ? h(l) - y : a(l) - g) * C, I = Math.abs(S ? a(l) - g : h(l) - y);
24
+ if (c > 0.5) {
25
+ const s = c + 2 * I;
26
+ s < b && (b = s, r = f);
27
+ } else if (e && c < -0.5) {
28
+ const s = c + 2 * I;
29
+ s < x && (x = s, u = f);
30
+ }
31
+ }
32
+ return r >= 0 ? r : u >= 0 ? u : t;
33
+ }
34
+ function G(n, t, o) {
35
+ return n === 0 ? -1 : t < 0 || t >= n ? o > 0 ? 0 : n - 1 : (t + o + n) % n;
36
+ }
37
+ export {
38
+ E as firstFocus,
39
+ G as linearFocus,
40
+ F as nextFocus
41
+ };
42
+ //# sourceMappingURL=focusNav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusNav.js","sources":["../../../src/ui/layout/focusNav.ts"],"sourcesContent":["import type { Rect } from './geometry';\n\nexport type NavDirection = 'up' | 'down' | 'left' | 'right';\n\n/** How much a step off the line of travel costs against a step along it: favours the item straight ahead. */\nconst CROSS_WEIGHT = 2;\n\nfunction cx(r: Rect): number {\n return r.x + r.width / 2;\n}\n\nfunction cy(r: Rect): number {\n return r.y + r.height / 2;\n}\n\n/** The item a fresh focus lands on: the top-most, then left-most. */\nexport function firstFocus(rects: readonly Rect[]): number {\n let best = -1;\n for (let i = 0; i < rects.length; i++) {\n const r = rects[i]!;\n const b = best < 0 ? null : rects[best]!;\n if (!b || r.y < b.y || (r.y === b.y && r.x < b.x)) best = i;\n }\n return best;\n}\n\n/**\n * Spatial navigation (a gamepad's d-pad, the arrow keys): from `current`, the nearest item whose centre lies in\n * `dir`, an item straight ahead preferred over a nearer one off to the side. With `wrap`, going past the last item\n * comes back in from the far side on the same line. Returns `current` when nothing lies that way.\n */\nexport function nextFocus(rects: readonly Rect[], current: number, dir: NavDirection, wrap = false): number {\n if (rects.length === 0) return -1;\n const from = rects[current];\n if (!from) return firstFocus(rects);\n const fx = cx(from);\n const fy = cy(from);\n const horizontal = dir === 'left' || dir === 'right';\n const sign = dir === 'right' || dir === 'down' ? 1 : -1;\n let best = -1;\n let bestScore = Infinity;\n // wrapping: the item farthest the other way, closest to the line\n let back = -1;\n let backScore = Infinity;\n for (let i = 0; i < rects.length; i++) {\n if (i === current) continue;\n const r = rects[i]!;\n const along = ((horizontal ? cx(r) - fx : cy(r) - fy) * sign);\n const across = Math.abs(horizontal ? cy(r) - fy : cx(r) - fx);\n if (along > 0.5) {\n const score = along + CROSS_WEIGHT * across;\n if (score < bestScore) {\n bestScore = score;\n best = i;\n }\n } else if (wrap && along < -0.5) {\n const score = along + CROSS_WEIGHT * across;\n if (score < backScore) {\n backScore = score;\n back = i;\n }\n }\n }\n if (best >= 0) return best;\n return back >= 0 ? back : current;\n}\n\n/** Tab order: the next (`step` 1) or previous (−1) of `count` items, wrapping round. */\nexport function linearFocus(count: number, current: number, step: 1 | -1): number {\n if (count === 0) return -1;\n if (current < 0 || current >= count) return step > 0 ? 0 : count - 1;\n return (current + step + count) % count;\n}\n"],"names":["cx","r","cy","firstFocus","rects","best","i","b","nextFocus","current","dir","wrap","from","fx","fy","horizontal","sign","bestScore","back","backScore","along","across","score","linearFocus","count","step"],"mappings":"AAOA,SAASA,EAAGC,GAAiB;AAC3B,SAAOA,EAAE,IAAIA,EAAE,QAAQ;AACzB;AAEA,SAASC,EAAGD,GAAiB;AAC3B,SAAOA,EAAE,IAAIA,EAAE,SAAS;AAC1B;AAGO,SAASE,EAAWC,GAAgC;AACzD,MAAIC,IAAO;AACX,WAASC,IAAI,GAAGA,IAAIF,EAAM,QAAQE,KAAK;AACrC,UAAML,IAAIG,EAAME,CAAC,GACXC,IAAIF,IAAO,IAAI,OAAOD,EAAMC,CAAI;AACtC,KAAI,CAACE,KAAKN,EAAE,IAAIM,EAAE,KAAMN,EAAE,MAAMM,EAAE,KAAKN,EAAE,IAAIM,EAAE,OAAIF,IAAOC;AAAA,EAC5D;AACA,SAAOD;AACT;AAOO,SAASG,EAAUJ,GAAwBK,GAAiBC,GAAmBC,IAAO,IAAe;AAC1G,MAAIP,EAAM,WAAW,EAAG,QAAO;AAC/B,QAAMQ,IAAOR,EAAMK,CAAO;AAC1B,MAAI,CAACG,EAAM,QAAOT,EAAWC,CAAK;AAClC,QAAMS,IAAKb,EAAGY,CAAI,GACZE,IAAKZ,EAAGU,CAAI,GACZG,IAAaL,MAAQ,UAAUA,MAAQ,SACvCM,IAAON,MAAQ,WAAWA,MAAQ,SAAS,IAAI;AACrD,MAAIL,IAAO,IACPY,IAAY,OAEZC,IAAO,IACPC,IAAY;AAChB,WAASb,IAAI,GAAGA,IAAIF,EAAM,QAAQE,KAAK;AACrC,QAAIA,MAAMG,EAAS;AACnB,UAAMR,IAAIG,EAAME,CAAC,GACXc,KAAUL,IAAaf,EAAGC,CAAC,IAAIY,IAAKX,EAAGD,CAAC,IAAIa,KAAME,GAClDK,IAAS,KAAK,IAAIN,IAAab,EAAGD,CAAC,IAAIa,IAAKd,EAAGC,CAAC,IAAIY,CAAE;AAC5D,QAAIO,IAAQ,KAAK;AACf,YAAME,IAAQF,IAAQ,IAAeC;AACrC,MAAIC,IAAQL,MACVA,IAAYK,GACZjB,IAAOC;AAAA,IAEX,WAAWK,KAAQS,IAAQ,MAAM;AAC/B,YAAME,IAAQF,IAAQ,IAAeC;AACrC,MAAIC,IAAQH,MACVA,IAAYG,GACZJ,IAAOZ;AAAA,IAEX;AAAA,EACF;AACA,SAAID,KAAQ,IAAUA,IACfa,KAAQ,IAAIA,IAAOT;AAC5B;AAGO,SAASc,EAAYC,GAAef,GAAiBgB,GAAsB;AAChF,SAAID,MAAU,IAAU,KACpBf,IAAU,KAAKA,KAAWe,IAAcC,IAAO,IAAI,IAAID,IAAQ,KAC3Df,IAAUgB,IAAOD,KAASA;AACpC;"}
@@ -0,0 +1,21 @@
1
+ function h(t) {
2
+ return t === void 0 ? { top: 0, right: 0, bottom: 0, left: 0 } : typeof t == "number" ? { top: t, right: t, bottom: t, left: t } : { top: t.top ?? 0, right: t.right ?? 0, bottom: t.bottom ?? 0, left: t.left ?? 0 };
3
+ }
4
+ function i(t, o = !0) {
5
+ return o ? Math.round(t) : t;
6
+ }
7
+ function u(t, o = !0) {
8
+ if (!o) return { x: t.x, y: t.y, width: t.width, height: t.height };
9
+ const n = Math.round(t.x), e = Math.round(t.y);
10
+ return { x: n, y: e, width: Math.round(t.x + t.width) - n, height: Math.round(t.y + t.height) - e };
11
+ }
12
+ function r(t, o, n) {
13
+ return t < o ? o : t > n ? n : t;
14
+ }
15
+ export {
16
+ r as clamp,
17
+ h as insets,
18
+ i as snapPx,
19
+ u as snapRect
20
+ };
21
+ //# sourceMappingURL=geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.js","sources":["../../../src/ui/layout/geometry.ts"],"sourcesContent":["/**\n * The shapes every UI layout function speaks: plain objects, no Pixi and no DOM, so the same maths places a canvas\n * widget, a DOM panel or a React component.\n */\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface Rect extends Point, Size {}\n\n/** Space kept clear on each side (padding, margins, a phone's safe area). */\nexport interface Insets {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\n/** `8` or `{ top: 8, left: 4 }` → all four sides; a missing side is 0. */\nexport function insets(v: number | Partial<Insets> | undefined): Insets {\n if (v === undefined) return { top: 0, right: 0, bottom: 0, left: 0 };\n if (typeof v === 'number') return { top: v, right: v, bottom: v, left: v };\n return { top: v.top ?? 0, right: v.right ?? 0, bottom: v.bottom ?? 0, left: v.left ?? 0 };\n}\n\n/**\n * Rounds to a whole pixel when `on`. Pixel art laid out at x.5 lands each texel across two screen pixels and reads\n * blurred or a pixel wider on one side, so a pixel-perfect game snaps every UI position and size.\n */\nexport function snapPx(v: number, on = true): number {\n return on ? Math.round(v) : v;\n}\n\n/**\n * A rect with its edges (not its size) rounded: two neighbours that touch before snapping still touch after, where\n * rounding x and width apart could open or overlap a pixel between them.\n */\nexport function snapRect(r: Rect, on = true): Rect {\n if (!on) return { x: r.x, y: r.y, width: r.width, height: r.height };\n const x = Math.round(r.x);\n const y = Math.round(r.y);\n return { x, y, width: Math.round(r.x + r.width) - x, height: Math.round(r.y + r.height) - y };\n}\n\nexport function clamp(v: number, min: number, max: number): number {\n return v < min ? min : v > max ? max : v;\n}\n"],"names":["insets","v","snapPx","on","snapRect","r","x","y","clamp","min","max"],"mappings":"AAyBO,SAASA,EAAOC,GAAiD;AACtE,SAAIA,MAAM,SAAkB,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAA,IAC7D,OAAOA,KAAM,WAAiB,EAAE,KAAKA,GAAG,OAAOA,GAAG,QAAQA,GAAG,MAAMA,EAAA,IAChE,EAAE,KAAKA,EAAE,OAAO,GAAG,OAAOA,EAAE,SAAS,GAAG,QAAQA,EAAE,UAAU,GAAG,MAAMA,EAAE,QAAQ,EAAA;AACxF;AAMO,SAASC,EAAOD,GAAWE,IAAK,IAAc;AACnD,SAAOA,IAAK,KAAK,MAAMF,CAAC,IAAIA;AAC9B;AAMO,SAASG,EAASC,GAASF,IAAK,IAAY;AACjD,MAAI,CAACA,EAAI,QAAO,EAAE,GAAGE,EAAE,GAAG,GAAGA,EAAE,GAAG,OAAOA,EAAE,OAAO,QAAQA,EAAE,OAAA;AAC5D,QAAMC,IAAI,KAAK,MAAMD,EAAE,CAAC,GAClBE,IAAI,KAAK,MAAMF,EAAE,CAAC;AACxB,SAAO,EAAE,GAAAC,GAAG,GAAAC,GAAG,OAAO,KAAK,MAAMF,EAAE,IAAIA,EAAE,KAAK,IAAIC,GAAG,QAAQ,KAAK,MAAMD,EAAE,IAAIA,EAAE,MAAM,IAAIE,EAAA;AAC5F;AAEO,SAASC,EAAMP,GAAWQ,GAAaC,GAAqB;AACjE,SAAOT,IAAIQ,IAAMA,IAAMR,IAAIS,IAAMA,IAAMT;AACzC;"}
@@ -0,0 +1,10 @@
1
+ function m(i, n, t = {}) {
2
+ let a = 0;
3
+ for (const h of i) a = Math.max(a, n(h));
4
+ const e = Math.ceil(a + (t.padding ?? 0));
5
+ return Math.min(t.max ?? 1 / 0, Math.max(t.min ?? 0, e));
6
+ }
7
+ export {
8
+ m as listWidth
9
+ };
10
+ //# sourceMappingURL=listWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listWidth.js","sources":["../../../src/ui/layout/listWidth.ts"],"sourcesContent":["export interface ListWidthOptions {\n /** Added to the longest label: the row's padding, a check mark, a scroll bar (default 0). */\n padding?: number;\n min?: number;\n max?: number;\n}\n\n/**\n * How wide a drop-down list (or a menu) must be so its longest label fits: measured, not guessed, so no label is\n * clipped. `measure` is the caller's (a canvas `measureText`, a bitmap font's advance sum). Rounded up to a whole\n * pixel so the measurement never loses the last half pixel of a letter.\n */\nexport function listWidth(labels: readonly string[], measure: (label: string) => number, options: ListWidthOptions = {}): number {\n let widest = 0;\n for (const l of labels) widest = Math.max(widest, measure(l));\n const w = Math.ceil(widest + (options.padding ?? 0));\n return Math.min(options.max ?? Infinity, Math.max(options.min ?? 0, w));\n}\n"],"names":["listWidth","labels","measure","options","widest","l","w"],"mappings":"AAYO,SAASA,EAAUC,GAA2BC,GAAoCC,IAA4B,CAAA,GAAY;AAC/H,MAAIC,IAAS;AACb,aAAWC,KAAKJ,EAAQ,CAAAG,IAAS,KAAK,IAAIA,GAAQF,EAAQG,CAAC,CAAC;AAC5D,QAAMC,IAAI,KAAK,KAAKF,KAAUD,EAAQ,WAAW,EAAE;AACnD,SAAO,KAAK,IAAIA,EAAQ,OAAO,OAAU,KAAK,IAAIA,EAAQ,OAAO,GAAGG,CAAC,CAAC;AACxE;"}
@@ -0,0 +1,28 @@
1
+ import { clamp as m, snapPx as n } from "./geometry.js";
2
+ const r = { below: "above", above: "below", right: "left", left: "right" };
3
+ function f(e, t, s, h, l) {
4
+ switch (e) {
5
+ case "below":
6
+ return s.height - l - (t.y + t.height + h);
7
+ case "above":
8
+ return t.y - h - l;
9
+ case "right":
10
+ return s.width - l - (t.x + t.width + h);
11
+ case "left":
12
+ return t.x - h - l;
13
+ }
14
+ }
15
+ function a(e, t, s, h = {}) {
16
+ const l = h.gap ?? 4, i = h.margin ?? 4, g = h.side ?? "below", b = g === "below" || g === "above", y = b ? t.height : t.width;
17
+ let x = g;
18
+ if (f(g, e, s, l, i) < y) {
19
+ const u = r[g], c = f(u, e, s, l, i);
20
+ (c >= y || c > f(g, e, s, l, i)) && (x = u);
21
+ }
22
+ let d, w;
23
+ return b ? (w = x === "below" ? e.y + e.height + l : e.y - l - t.height, d = h.align === "center" ? e.x + (e.width - t.width) / 2 : e.x) : (d = x === "right" ? e.x + e.width + l : e.x - l - t.width, w = h.align === "center" ? e.y + (e.height - t.height) / 2 : e.y), d = m(d, i, Math.max(i, s.width - i - t.width)), w = m(w, i, Math.max(i, s.height - i - t.height)), { x: n(d, h.snap ?? !1), y: n(w, h.snap ?? !1), side: x };
24
+ }
25
+ export {
26
+ a as placeTooltip
27
+ };
28
+ //# sourceMappingURL=placeTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeTooltip.js","sources":["../../../src/ui/layout/placeTooltip.ts"],"sourcesContent":["import { clamp, snapPx, type Point, type Rect, type Size } from './geometry';\n\nexport type TipSide = 'below' | 'above' | 'right' | 'left';\n\nexport interface TooltipOptions {\n /** The side tried first (default 'below'); the opposite one when it does not fit. */\n side?: TipSide;\n /** Between the anchor and the tip (default 4). */\n gap?: number;\n /** Kept clear of the screen's edges (default 4). */\n margin?: number;\n /** Across the side: line up with the anchor's start or centre on it (default 'start'). */\n align?: 'start' | 'center';\n snap?: boolean;\n}\n\nexport interface TooltipPlacement extends Point {\n /** The side it went on after flipping. */\n side: TipSide;\n}\n\nconst OPPOSITE: Record<TipSide, TipSide> = { below: 'above', above: 'below', right: 'left', left: 'right' };\n\n/** Room on `side` of the anchor, inside the margins. */\nfunction room(side: TipSide, a: Rect, view: Size, gap: number, margin: number): number {\n switch (side) {\n case 'below':\n return view.height - margin - (a.y + a.height + gap);\n case 'above':\n return a.y - gap - margin;\n case 'right':\n return view.width - margin - (a.x + a.width + gap);\n case 'left':\n return a.x - gap - margin;\n }\n}\n\n/**\n * Where a tooltip of `tip` size goes beside `anchor`: on the preferred side when it fits, flipped to the opposite one\n * when it does not, the roomier of the two when neither does; then slid along the edge to stay on screen.\n */\nexport function placeTooltip(anchor: Rect, tip: Size, viewport: Size, options: TooltipOptions = {}): TooltipPlacement {\n const gap = options.gap ?? 4;\n const margin = options.margin ?? 4;\n const want = options.side ?? 'below';\n const vertical = want === 'below' || want === 'above';\n const need = vertical ? tip.height : tip.width;\n let side = want;\n if (room(want, anchor, viewport, gap, margin) < need) {\n const other = OPPOSITE[want];\n const otherRoom = room(other, anchor, viewport, gap, margin);\n if (otherRoom >= need || otherRoom > room(want, anchor, viewport, gap, margin)) side = other;\n }\n let x: number;\n let y: number;\n if (vertical) {\n y = side === 'below' ? anchor.y + anchor.height + gap : anchor.y - gap - tip.height;\n x = options.align === 'center' ? anchor.x + (anchor.width - tip.width) / 2 : anchor.x;\n } else {\n x = side === 'right' ? anchor.x + anchor.width + gap : anchor.x - gap - tip.width;\n y = options.align === 'center' ? anchor.y + (anchor.height - tip.height) / 2 : anchor.y;\n }\n x = clamp(x, margin, Math.max(margin, viewport.width - margin - tip.width));\n y = clamp(y, margin, Math.max(margin, viewport.height - margin - tip.height));\n return { x: snapPx(x, options.snap ?? false), y: snapPx(y, options.snap ?? false), side };\n}\n"],"names":["OPPOSITE","room","side","a","view","gap","margin","placeTooltip","anchor","tip","viewport","options","want","vertical","need","other","otherRoom","x","y","clamp","snapPx"],"mappings":";AAqBA,MAAMA,IAAqC,EAAE,OAAO,SAAS,OAAO,SAAS,OAAO,QAAQ,MAAM,QAAA;AAGlG,SAASC,EAAKC,GAAeC,GAASC,GAAYC,GAAaC,GAAwB;AACrF,UAAQJ,GAAA;AAAA,IACN,KAAK;AACH,aAAOE,EAAK,SAASE,KAAUH,EAAE,IAAIA,EAAE,SAASE;AAAA,IAClD,KAAK;AACH,aAAOF,EAAE,IAAIE,IAAMC;AAAA,IACrB,KAAK;AACH,aAAOF,EAAK,QAAQE,KAAUH,EAAE,IAAIA,EAAE,QAAQE;AAAA,IAChD,KAAK;AACH,aAAOF,EAAE,IAAIE,IAAMC;AAAA,EAAA;AAEzB;AAMO,SAASC,EAAaC,GAAcC,GAAWC,GAAgBC,IAA0B,CAAA,GAAsB;AACpH,QAAMN,IAAMM,EAAQ,OAAO,GACrBL,IAASK,EAAQ,UAAU,GAC3BC,IAAOD,EAAQ,QAAQ,SACvBE,IAAWD,MAAS,WAAWA,MAAS,SACxCE,IAAOD,IAAWJ,EAAI,SAASA,EAAI;AACzC,MAAIP,IAAOU;AACX,MAAIX,EAAKW,GAAMJ,GAAQE,GAAUL,GAAKC,CAAM,IAAIQ,GAAM;AACpD,UAAMC,IAAQf,EAASY,CAAI,GACrBI,IAAYf,EAAKc,GAAOP,GAAQE,GAAUL,GAAKC,CAAM;AAC3D,KAAIU,KAAaF,KAAQE,IAAYf,EAAKW,GAAMJ,GAAQE,GAAUL,GAAKC,CAAM,OAAGJ,IAAOa;AAAA,EACzF;AACA,MAAIE,GACAC;AACJ,SAAIL,KACFK,IAAIhB,MAAS,UAAUM,EAAO,IAAIA,EAAO,SAASH,IAAMG,EAAO,IAAIH,IAAMI,EAAI,QAC7EQ,IAAIN,EAAQ,UAAU,WAAWH,EAAO,KAAKA,EAAO,QAAQC,EAAI,SAAS,IAAID,EAAO,MAEpFS,IAAIf,MAAS,UAAUM,EAAO,IAAIA,EAAO,QAAQH,IAAMG,EAAO,IAAIH,IAAMI,EAAI,OAC5ES,IAAIP,EAAQ,UAAU,WAAWH,EAAO,KAAKA,EAAO,SAASC,EAAI,UAAU,IAAID,EAAO,IAExFS,IAAIE,EAAMF,GAAGX,GAAQ,KAAK,IAAIA,GAAQI,EAAS,QAAQJ,IAASG,EAAI,KAAK,CAAC,GAC1ES,IAAIC,EAAMD,GAAGZ,GAAQ,KAAK,IAAIA,GAAQI,EAAS,SAASJ,IAASG,EAAI,MAAM,CAAC,GACrE,EAAE,GAAGW,EAAOH,GAAGN,EAAQ,QAAQ,EAAK,GAAG,GAAGS,EAAOF,GAAGP,EAAQ,QAAQ,EAAK,GAAG,MAAAT,EAAA;AACrF;"}
@@ -0,0 +1,24 @@
1
+ import { clamp as r } from "./geometry.js";
2
+ function u(o, n) {
3
+ return Math.max(0, o - n);
4
+ }
5
+ function f(o, n, c) {
6
+ return r(o, 0, u(n, c));
7
+ }
8
+ function a(o, n, c, l, e) {
9
+ let t = o;
10
+ return n < t ? t = n : n + c > t + l && (t = n + c - l), f(t, e, l);
11
+ }
12
+ const i = 8;
13
+ function p(o, n, c = 0.06) {
14
+ const l = o * Math.pow(1 - c, n / 16.666666666666668);
15
+ return Math.abs(l) < i ? 0 : l;
16
+ }
17
+ export {
18
+ i as FLING_STOP,
19
+ f as clampScroll,
20
+ u as maxScroll,
21
+ a as scrollIntoView,
22
+ p as stepFling
23
+ };
24
+ //# sourceMappingURL=scroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll.js","sources":["../../../src/ui/layout/scroll.ts"],"sourcesContent":["import { clamp } from './geometry';\n\n/** How far content of `content` length can scroll in a window of `viewport` length. */\nexport function maxScroll(content: number, viewport: number): number {\n return Math.max(0, content - viewport);\n}\n\n/** A scroll offset kept between the top and the last full window of content. */\nexport function clampScroll(offset: number, content: number, viewport: number): number {\n return clamp(offset, 0, maxScroll(content, viewport));\n}\n\n/**\n * The smallest scroll that brings an item (`start`, `size` along the scroll axis) fully into view: a list moved by\n * the keyboard follows the focus without jumping when the focus is already visible.\n */\nexport function scrollIntoView(offset: number, start: number, size: number, viewport: number, content: number): number {\n let next = offset;\n if (start < next) next = start;\n else if (start + size > next + viewport) next = start + size - viewport;\n return clampScroll(next, content, viewport);\n}\n\n/** Below this speed (px a second) a fling has stopped. */\nexport const FLING_STOP = 8;\n\n/**\n * A fling's speed after `dtMs`, losing `friction` of it every 60th of a second: the same glide at any frame rate.\n * 0 once it falls under `FLING_STOP`.\n */\nexport function stepFling(velocity: number, dtMs: number, friction = 0.06): number {\n const v = velocity * Math.pow(1 - friction, dtMs / (1000 / 60));\n return Math.abs(v) < FLING_STOP ? 0 : v;\n}\n"],"names":["maxScroll","content","viewport","clampScroll","offset","clamp","scrollIntoView","start","size","next","FLING_STOP","stepFling","velocity","dtMs","friction","v"],"mappings":";AAGO,SAASA,EAAUC,GAAiBC,GAA0B;AACnE,SAAO,KAAK,IAAI,GAAGD,IAAUC,CAAQ;AACvC;AAGO,SAASC,EAAYC,GAAgBH,GAAiBC,GAA0B;AACrF,SAAOG,EAAMD,GAAQ,GAAGJ,EAAUC,GAASC,CAAQ,CAAC;AACtD;AAMO,SAASI,EAAeF,GAAgBG,GAAeC,GAAcN,GAAkBD,GAAyB;AACrH,MAAIQ,IAAOL;AACX,SAAIG,IAAQE,IAAMA,IAAOF,IAChBA,IAAQC,IAAOC,IAAOP,MAAUO,IAAOF,IAAQC,IAAON,IACxDC,EAAYM,GAAMR,GAASC,CAAQ;AAC5C;AAGO,MAAMQ,IAAa;AAMnB,SAASC,EAAUC,GAAkBC,GAAcC,IAAW,MAAc;AACjF,QAAMC,IAAIH,IAAW,KAAK,IAAI,IAAIE,GAAUD,IAAQ,kBAAU;AAC9D,SAAO,KAAK,IAAIE,CAAC,IAAIL,IAAa,IAAIK;AACxC;"}
@@ -0,0 +1,20 @@
1
+ import { clamp as n } from "./geometry.js";
2
+ function d(u, r, t, o = 0) {
3
+ const e = n(u, r, t);
4
+ if (o <= 0) return e;
5
+ const c = r + Math.round((e - r) / o) * o;
6
+ return n(Number(c.toFixed(10)), r, t);
7
+ }
8
+ function i(u, r, t) {
9
+ return t > r ? n((u - r) / (t - r), 0, 1) : 0;
10
+ }
11
+ function s(u, r, t, o, e, c = 0) {
12
+ const f = t > 0 ? n((u - r) / t, 0, 1) : 0;
13
+ return d(o + f * (e - o), o, e, c);
14
+ }
15
+ export {
16
+ d as quantize,
17
+ i as sliderFraction,
18
+ s as sliderValueAt
19
+ };
20
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.js","sources":["../../../src/ui/layout/slider.ts"],"sourcesContent":["import { clamp } from './geometry';\n\n/** A value held to the range and to the nearest `step` above `min` (no step: any value). */\nexport function quantize(value: number, min: number, max: number, step = 0): number {\n const v = clamp(value, min, max);\n if (step <= 0) return v;\n const q = min + Math.round((v - min) / step) * step;\n // the last step may overshoot max when the range is not a whole number of steps\n return clamp(Number(q.toFixed(10)), min, max);\n}\n\n/** Where `value` sits along the range, 0–1. */\nexport function sliderFraction(value: number, min: number, max: number): number {\n return max > min ? clamp((value - min) / (max - min), 0, 1) : 0;\n}\n\n/** The value under a pointer at `px` on a track starting at `trackStart`, `trackLength` long. */\nexport function sliderValueAt(px: number, trackStart: number, trackLength: number, min: number, max: number, step = 0): number {\n const f = trackLength > 0 ? clamp((px - trackStart) / trackLength, 0, 1) : 0;\n return quantize(min + f * (max - min), min, max, step);\n}\n"],"names":["quantize","value","min","max","step","v","clamp","q","sliderFraction","sliderValueAt","px","trackStart","trackLength"],"mappings":";AAGO,SAASA,EAASC,GAAeC,GAAaC,GAAaC,IAAO,GAAW;AAClF,QAAMC,IAAIC,EAAML,GAAOC,GAAKC,CAAG;AAC/B,MAAIC,KAAQ,EAAG,QAAOC;AACtB,QAAME,IAAIL,IAAM,KAAK,OAAOG,IAAIH,KAAOE,CAAI,IAAIA;AAE/C,SAAOE,EAAM,OAAOC,EAAE,QAAQ,EAAE,CAAC,GAAGL,GAAKC,CAAG;AAC9C;AAGO,SAASK,EAAeP,GAAeC,GAAaC,GAAqB;AAC9E,SAAOA,IAAMD,IAAMI,GAAOL,IAAQC,MAAQC,IAAMD,IAAM,GAAG,CAAC,IAAI;AAChE;AAGO,SAASO,EAAcC,GAAYC,GAAoBC,GAAqBV,GAAaC,GAAaC,IAAO,GAAW;AAC7H,QAAM,IAAIQ,IAAc,IAAIN,GAAOI,IAAKC,KAAcC,GAAa,GAAG,CAAC,IAAI;AAC3E,SAAOZ,EAASE,IAAM,KAAKC,IAAMD,IAAMA,GAAKC,GAAKC,CAAI;AACvD;"}
@@ -0,0 +1,27 @@
1
+ import { insets as k, snapPx as o } from "./geometry.js";
2
+ function M(h, s = {}) {
3
+ const t = (s.direction ?? "vertical") === "vertical", S = s.gap ?? 0, e = k(s.padding), l = s.align ?? "start", c = s.snap ?? !1;
4
+ let i = 0;
5
+ for (const n of h) i = Math.max(i, t ? n.width : n.height);
6
+ s.crossSize !== void 0 && (i = s.crossSize);
7
+ const f = [];
8
+ let g = t ? e.top : e.left;
9
+ const m = t ? e.left : e.top;
10
+ for (let n = 0; n < h.length; n++) {
11
+ const a = h[n], x = t ? a.height : a.width;
12
+ let r = t ? a.width : a.height, d = 0;
13
+ l === "stretch" ? r = i : l === "center" ? d = (i - r) / 2 : l === "end" && (d = i - r);
14
+ const u = o(g, c), v = o(m + d, c), b = o(x, c), y = o(r, c);
15
+ f.push(t ? { x: v, y: u, width: y, height: b } : { x: u, y: v, width: b, height: y }), g += x + (n < h.length - 1 ? S : 0);
16
+ }
17
+ const p = g + (t ? e.bottom : e.right), w = m + i + (t ? e.right : e.bottom);
18
+ return {
19
+ items: f,
20
+ width: o(t ? w : p, c),
21
+ height: o(t ? p : w, c)
22
+ };
23
+ }
24
+ export {
25
+ M as stackLayout
26
+ };
27
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.js","sources":["../../../src/ui/layout/stack.ts"],"sourcesContent":["import { insets, snapPx, type Insets, type Rect, type Size } from './geometry';\n\nexport type StackDirection = 'vertical' | 'horizontal';\n/** Where items sit across the stack: its start, middle or end, or stretched to the widest (tallest) one. */\nexport type StackAlign = 'start' | 'center' | 'end' | 'stretch';\n\nexport interface StackOptions {\n direction?: StackDirection;\n /** Between two items (default 0). */\n gap?: number;\n /** Inside the stack's edge (default 0). */\n padding?: number | Partial<Insets>;\n align?: StackAlign;\n /** A cross size to align in instead of the widest item's (a column as wide as its window). */\n crossSize?: number;\n /** Whole pixels (pixel-perfect UI). */\n snap?: boolean;\n}\n\nexport interface StackResult extends Size {\n /** One rect per item, in the order given, relative to the stack's top-left. */\n items: Rect[];\n}\n\n/**\n * Lays items one after another down (or across) with a gap, inside padding. The stack's size is what the items\n * need, so a parent can lay the stack out in turn. Pure, for canvas widgets and DOM/React layouts alike.\n */\nexport function stackLayout(sizes: readonly Size[], options: StackOptions = {}): StackResult {\n const vertical = (options.direction ?? 'vertical') === 'vertical';\n const gap = options.gap ?? 0;\n const pad = insets(options.padding);\n const align = options.align ?? 'start';\n const snap = options.snap ?? false;\n let cross = 0;\n for (const s of sizes) cross = Math.max(cross, vertical ? s.width : s.height);\n if (options.crossSize !== undefined) cross = options.crossSize;\n const items: Rect[] = [];\n let main = vertical ? pad.top : pad.left;\n const crossStart = vertical ? pad.left : pad.top;\n for (let i = 0; i < sizes.length; i++) {\n const s = sizes[i]!;\n const itemMain = vertical ? s.height : s.width;\n let itemCross = vertical ? s.width : s.height;\n let offset = 0;\n if (align === 'stretch') itemCross = cross;\n else if (align === 'center') offset = (cross - itemCross) / 2;\n else if (align === 'end') offset = cross - itemCross;\n const a = snapPx(main, snap);\n const b = snapPx(crossStart + offset, snap);\n const len = snapPx(itemMain, snap);\n const thick = snapPx(itemCross, snap);\n items.push(vertical ? { x: b, y: a, width: thick, height: len } : { x: a, y: b, width: len, height: thick });\n main += itemMain + (i < sizes.length - 1 ? gap : 0);\n }\n const mainEnd = main + (vertical ? pad.bottom : pad.right);\n const crossEnd = crossStart + cross + (vertical ? pad.right : pad.bottom);\n return {\n items,\n width: snapPx(vertical ? crossEnd : mainEnd, snap),\n height: snapPx(vertical ? mainEnd : crossEnd, snap),\n };\n}\n"],"names":["stackLayout","sizes","options","vertical","gap","pad","insets","align","snap","cross","s","items","main","crossStart","i","itemMain","itemCross","offset","a","snapPx","b","len","thick","mainEnd","crossEnd"],"mappings":";AA4BO,SAASA,EAAYC,GAAwBC,IAAwB,IAAiB;AAC3F,QAAMC,KAAYD,EAAQ,aAAa,gBAAgB,YACjDE,IAAMF,EAAQ,OAAO,GACrBG,IAAMC,EAAOJ,EAAQ,OAAO,GAC5BK,IAAQL,EAAQ,SAAS,SACzBM,IAAON,EAAQ,QAAQ;AAC7B,MAAIO,IAAQ;AACZ,aAAWC,KAAKT,EAAO,CAAAQ,IAAQ,KAAK,IAAIA,GAAON,IAAWO,EAAE,QAAQA,EAAE,MAAM;AAC5E,EAAIR,EAAQ,cAAc,WAAWO,IAAQP,EAAQ;AACrD,QAAMS,IAAgB,CAAA;AACtB,MAAIC,IAAOT,IAAWE,EAAI,MAAMA,EAAI;AACpC,QAAMQ,IAAaV,IAAWE,EAAI,OAAOA,EAAI;AAC7C,WAASS,IAAI,GAAGA,IAAIb,EAAM,QAAQa,KAAK;AACrC,UAAMJ,IAAIT,EAAMa,CAAC,GACXC,IAAWZ,IAAWO,EAAE,SAASA,EAAE;AACzC,QAAIM,IAAYb,IAAWO,EAAE,QAAQA,EAAE,QACnCO,IAAS;AACb,IAAIV,MAAU,YAAWS,IAAYP,IAC5BF,MAAU,WAAUU,KAAUR,IAAQO,KAAa,IACnDT,MAAU,UAAOU,IAASR,IAAQO;AAC3C,UAAME,IAAIC,EAAOP,GAAMJ,CAAI,GACrBY,IAAID,EAAON,IAAaI,GAAQT,CAAI,GACpCa,IAAMF,EAAOJ,GAAUP,CAAI,GAC3Bc,IAAQH,EAAOH,GAAWR,CAAI;AACpC,IAAAG,EAAM,KAAKR,IAAW,EAAE,GAAGiB,GAAG,GAAGF,GAAG,OAAOI,GAAO,QAAQD,MAAQ,EAAE,GAAGH,GAAG,GAAGE,GAAG,OAAOC,GAAK,QAAQC,GAAO,GAC3GV,KAAQG,KAAYD,IAAIb,EAAM,SAAS,IAAIG,IAAM;AAAA,EACnD;AACA,QAAMmB,IAAUX,KAAQT,IAAWE,EAAI,SAASA,EAAI,QAC9CmB,IAAWX,IAAaJ,KAASN,IAAWE,EAAI,QAAQA,EAAI;AAClE,SAAO;AAAA,IACL,OAAAM;AAAA,IACA,OAAOQ,EAAOhB,IAAWqB,IAAWD,GAASf,CAAI;AAAA,IACjD,QAAQW,EAAOhB,IAAWoB,IAAUC,GAAUhB,CAAI;AAAA,EAAA;AAEtD;"}
@@ -0,0 +1,13 @@
1
+ function p(s, h, u = 0) {
2
+ const n = [];
3
+ let e = [], o = 0;
4
+ for (let t = 0; t < s.length; t++) {
5
+ const l = s[t], r = e.length === 0 ? l : o + u + l;
6
+ e.length > 0 && r > h ? (n.push(e), e = [t], o = l) : (e.push(t), o = r);
7
+ }
8
+ return e.length > 0 && n.push(e), n;
9
+ }
10
+ export {
11
+ p as wrapRow
12
+ };
13
+ //# sourceMappingURL=wrapRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapRow.js","sources":["../../../src/ui/layout/wrapRow.ts"],"sourcesContent":["/**\n * Breaks a row of items (tabs, chips, buttons) into lines no wider than `maxWidth`: each line holds the indices of\n * its items in order. An item wider than the line still gets a line of its own rather than being dropped.\n */\nexport function wrapRow(widths: readonly number[], maxWidth: number, gap = 0): number[][] {\n const rows: number[][] = [];\n let row: number[] = [];\n let used = 0;\n for (let i = 0; i < widths.length; i++) {\n const w = widths[i]!;\n const next = row.length === 0 ? w : used + gap + w;\n if (row.length > 0 && next > maxWidth) {\n rows.push(row);\n row = [i];\n used = w;\n } else {\n row.push(i);\n used = next;\n }\n }\n if (row.length > 0) rows.push(row);\n return rows;\n}\n"],"names":["wrapRow","widths","maxWidth","gap","rows","row","used","i","w","next"],"mappings":"AAIO,SAASA,EAAQC,GAA2BC,GAAkBC,IAAM,GAAe;AACxF,QAAMC,IAAmB,CAAA;AACzB,MAAIC,IAAgB,CAAA,GAChBC,IAAO;AACX,WAASC,IAAI,GAAGA,IAAIN,EAAO,QAAQM,KAAK;AACtC,UAAMC,IAAIP,EAAOM,CAAC,GACZE,IAAOJ,EAAI,WAAW,IAAIG,IAAIF,IAAOH,IAAMK;AACjD,IAAIH,EAAI,SAAS,KAAKI,IAAOP,KAC3BE,EAAK,KAAKC,CAAG,GACbA,IAAM,CAACE,CAAC,GACRD,IAAOE,MAEPH,EAAI,KAAKE,CAAC,GACVD,IAAOG;AAAA,EAEX;AACA,SAAIJ,EAAI,SAAS,KAAGD,EAAK,KAAKC,CAAG,GAC1BD;AACT;"}