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.
- package/CHANGELOG.md +304 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/dist/1681-engine.js +417 -0
- package/dist/1681-engine.js.map +1 -0
- package/dist/ambient/ColorGrade.js +41 -0
- package/dist/ambient/ColorGrade.js.map +1 -0
- package/dist/ambient/DayClock.js +57 -0
- package/dist/ambient/DayClock.js.map +1 -0
- package/dist/ambient/WeatherLayer.js +91 -0
- package/dist/ambient/WeatherLayer.js.map +1 -0
- package/dist/ambient/grade.js +13 -0
- package/dist/ambient/grade.js.map +1 -0
- package/dist/ambient/weather.js +52 -0
- package/dist/ambient/weather.js.map +1 -0
- package/dist/anim/AnimStateMachine.js +164 -0
- package/dist/anim/AnimStateMachine.js.map +1 -0
- package/dist/anim/Animator.js +67 -0
- package/dist/anim/Animator.js.map +1 -0
- package/dist/anim/animStateCompile.js +113 -0
- package/dist/anim/animStateCompile.js.map +1 -0
- package/dist/anim/animStateSystem.js +17 -0
- package/dist/anim/animStateSystem.js.map +1 -0
- package/dist/anim/animationSystem.js +15 -0
- package/dist/anim/animationSystem.js.map +1 -0
- package/dist/anim/asepriteSlices.js +22 -0
- package/dist/anim/asepriteSlices.js.map +1 -0
- package/dist/anim/asepriteTags.js +35 -0
- package/dist/anim/asepriteTags.js.map +1 -0
- package/dist/anim/parseAseprite.js +83 -0
- package/dist/anim/parseAseprite.js.map +1 -0
- package/dist/assets/AssetLoader.js +104 -0
- package/dist/assets/AssetLoader.js.map +1 -0
- package/dist/assets/loadAseprite.js +50 -0
- package/dist/assets/loadAseprite.js.map +1 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +31 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +1 -0
- package/dist/audio/Footsteps.js +26 -0
- package/dist/audio/Footsteps.js.map +1 -0
- package/dist/audio/MusicPlayer.js +78 -0
- package/dist/audio/MusicPlayer.js.map +1 -0
- package/dist/audio/SoundEngine.js +119 -0
- package/dist/audio/SoundEngine.js.map +1 -0
- package/dist/audio/cleanTake.js +30 -0
- package/dist/audio/cleanTake.js.map +1 -0
- package/dist/audio/music/ElementVoice.js +35 -0
- package/dist/audio/music/ElementVoice.js.map +1 -0
- package/dist/audio/music/GraphVoice.js +39 -0
- package/dist/audio/music/GraphVoice.js.map +1 -0
- package/dist/audio/music/MusicChannel.js +58 -0
- package/dist/audio/music/MusicChannel.js.map +1 -0
- package/dist/audio/music/musicVoice.js +13 -0
- package/dist/audio/music/musicVoice.js.map +1 -0
- package/dist/audio/sampleBank.js +82 -0
- package/dist/audio/sampleBank.js.map +1 -0
- package/dist/audio/soundTable.js +9 -0
- package/dist/audio/soundTable.js.map +1 -0
- package/dist/audio/synth.js +36 -0
- package/dist/audio/synth.js.map +1 -0
- package/dist/core/BitmapLabel.js +49 -0
- package/dist/core/BitmapLabel.js.map +1 -0
- package/dist/core/Camera.js +150 -0
- package/dist/core/Camera.js.map +1 -0
- package/dist/core/Clock.js +30 -0
- package/dist/core/Clock.js.map +1 -0
- package/dist/core/Graphics.js +69 -0
- package/dist/core/Graphics.js.map +1 -0
- package/dist/core/Group.js +29 -0
- package/dist/core/Group.js.map +1 -0
- package/dist/core/Image.js +51 -0
- package/dist/core/Image.js.map +1 -0
- package/dist/core/ObjectFactory.js +55 -0
- package/dist/core/ObjectFactory.js.map +1 -0
- package/dist/core/Pointer.js +58 -0
- package/dist/core/Pointer.js.map +1 -0
- package/dist/core/Rectangle.js +51 -0
- package/dist/core/Rectangle.js.map +1 -0
- package/dist/core/Stage.js +86 -0
- package/dist/core/Stage.js.map +1 -0
- package/dist/core/Text.js +22 -0
- package/dist/core/Text.js.map +1 -0
- package/dist/core/TextureRegistry.js +111 -0
- package/dist/core/TextureRegistry.js.map +1 -0
- package/dist/core/Timeline.js +211 -0
- package/dist/core/Timeline.js.map +1 -0
- package/dist/core/TimelineBuilder.js +73 -0
- package/dist/core/TimelineBuilder.js.map +1 -0
- package/dist/core/TimelineChild.js +84 -0
- package/dist/core/TimelineChild.js.map +1 -0
- package/dist/core/Tweener.js +136 -0
- package/dist/core/Tweener.js.map +1 -0
- package/dist/core/atlas.js +38 -0
- package/dist/core/atlas.js.map +1 -0
- package/dist/core/atlasPlan.js +22 -0
- package/dist/core/atlasPlan.js.map +1 -0
- package/dist/core/eases.js +21 -0
- package/dist/core/eases.js.map +1 -0
- package/dist/core/gameObject.js +115 -0
- package/dist/core/gameObject.js.map +1 -0
- package/dist/core/pixiPatches.js +18 -0
- package/dist/core/pixiPatches.js.map +1 -0
- package/dist/core/timelinePlace.js +24 -0
- package/dist/core/timelinePlace.js.map +1 -0
- package/dist/core/tweenProps.js +12 -0
- package/dist/core/tweenProps.js.map +1 -0
- package/dist/debug/DebugOverlay.js +94 -0
- package/dist/debug/DebugOverlay.js.map +1 -0
- package/dist/debug/DrawCallCounter.js +41 -0
- package/dist/debug/DrawCallCounter.js.map +1 -0
- package/dist/debug/ErrorLog.js +22 -0
- package/dist/debug/ErrorLog.js.map +1 -0
- package/dist/debug/FrameStats.js +42 -0
- package/dist/debug/FrameStats.js.map +1 -0
- package/dist/debug/inspectWorld.js +29 -0
- package/dist/debug/inspectWorld.js.map +1 -0
- package/dist/diagnostics/ErrorDeduper.js +27 -0
- package/dist/diagnostics/ErrorDeduper.js.map +1 -0
- package/dist/diagnostics/FrameSampler.js +42 -0
- package/dist/diagnostics/FrameSampler.js.map +1 -0
- package/dist/diagnostics/bootWatch.js +21 -0
- package/dist/diagnostics/bootWatch.js.map +1 -0
- package/dist/diagnostics/captureErrors.js +27 -0
- package/dist/diagnostics/captureErrors.js.map +1 -0
- package/dist/diagnostics/contextLoss.js +25 -0
- package/dist/diagnostics/contextLoss.js.map +1 -0
- package/dist/diagnostics/frameStats.js +31 -0
- package/dist/diagnostics/frameStats.js.map +1 -0
- package/dist/diagnostics/gpuInfo.js +22 -0
- package/dist/diagnostics/gpuInfo.js.map +1 -0
- package/dist/diagnostics/renderGuard.js +24 -0
- package/dist/diagnostics/renderGuard.js.map +1 -0
- package/dist/ecs/SparseSet.js +55 -0
- package/dist/ecs/SparseSet.js.map +1 -0
- package/dist/ecs/World.js +307 -0
- package/dist/ecs/World.js.map +1 -0
- package/dist/ecs/fields.js +26 -0
- package/dist/ecs/fields.js.map +1 -0
- package/dist/engine/Engine.js +82 -0
- package/dist/engine/Engine.js.map +1 -0
- package/dist/engine/FixedLoop.js +37 -0
- package/dist/engine/FixedLoop.js.map +1 -0
- package/dist/engine/Scene.js +79 -0
- package/dist/engine/Scene.js.map +1 -0
- package/dist/engine/SceneManager.js +73 -0
- package/dist/engine/SceneManager.js.map +1 -0
- package/dist/events/EventBus.js +42 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/fx/FloatingText.js +72 -0
- package/dist/fx/FloatingText.js.map +1 -0
- package/dist/fx/hitStop.js +28 -0
- package/dist/fx/hitStop.js.map +1 -0
- package/dist/fx/viewCull.js +10 -0
- package/dist/fx/viewCull.js.map +1 -0
- package/dist/i18n/Translator.js +72 -0
- package/dist/i18n/Translator.js.map +1 -0
- package/dist/i18n/extractStrings.js +58 -0
- package/dist/i18n/extractStrings.js.map +1 -0
- package/dist/i18n/formatMessage.js +19 -0
- package/dist/i18n/formatMessage.js.map +1 -0
- package/dist/input/Actions.js +131 -0
- package/dist/input/Actions.js.map +1 -0
- package/dist/input/AimGesture.js +75 -0
- package/dist/input/AimGesture.js.map +1 -0
- package/dist/input/Keyboard.js +54 -0
- package/dist/input/Keyboard.js.map +1 -0
- package/dist/input/Keymap.js +171 -0
- package/dist/input/Keymap.js.map +1 -0
- package/dist/input/TargetLock.js +73 -0
- package/dist/input/TargetLock.js.map +1 -0
- package/dist/input/aimAxis.js +8 -0
- package/dist/input/aimAxis.js.map +1 -0
- package/dist/input/keyChord.js +29 -0
- package/dist/input/keyChord.js.map +1 -0
- package/dist/input/longPress.js +32 -0
- package/dist/input/longPress.js.map +1 -0
- package/dist/input/stickAxis.js +23 -0
- package/dist/input/stickAxis.js.map +1 -0
- package/dist/input/touchDetect.js +7 -0
- package/dist/input/touchDetect.js.map +1 -0
- package/dist/light/LightLayer.js +84 -0
- package/dist/light/LightLayer.js.map +1 -0
- package/dist/nav/MinHeap.js +39 -0
- package/dist/nav/MinHeap.js.map +1 -0
- package/dist/nav/findPath.js +78 -0
- package/dist/nav/findPath.js.map +1 -0
- package/dist/nav/navGrid.js +36 -0
- package/dist/nav/navGrid.js.map +1 -0
- package/dist/nav/nearestOpen.js +19 -0
- package/dist/nav/nearestOpen.js.map +1 -0
- package/dist/nav/straightenPath.js +51 -0
- package/dist/nav/straightenPath.js.map +1 -0
- package/dist/net/Connection.js +84 -0
- package/dist/net/Connection.js.map +1 -0
- package/dist/net/InterpolationBuffer.js +57 -0
- package/dist/net/InterpolationBuffer.js.map +1 -0
- package/dist/net/PredictedMover.js +61 -0
- package/dist/net/PredictedMover.js.map +1 -0
- package/dist/net/Room.js +92 -0
- package/dist/net/Room.js.map +1 -0
- package/dist/net/RoomHost.js +101 -0
- package/dist/net/RoomHost.js.map +1 -0
- package/dist/net/cadence.js +22 -0
- package/dist/net/cadence.js.map +1 -0
- package/dist/net/constants.js +11 -0
- package/dist/net/constants.js.map +1 -0
- package/dist/net/lobby/LobbyClient.js +124 -0
- package/dist/net/lobby/LobbyClient.js.map +1 -0
- package/dist/net/lobby/LobbyHost.js +366 -0
- package/dist/net/lobby/LobbyHost.js.map +1 -0
- package/dist/net/lobby/LobbyRooms.js +66 -0
- package/dist/net/lobby/LobbyRooms.js.map +1 -0
- package/dist/net/lobby/Matchmaker.js +106 -0
- package/dist/net/lobby/Matchmaker.js.map +1 -0
- package/dist/net/movement.js +83 -0
- package/dist/net/movement.js.map +1 -0
- package/dist/net/protocol.js +11 -0
- package/dist/net/protocol.js.map +1 -0
- package/dist/net/serverClock.js +22 -0
- package/dist/net/serverClock.js.map +1 -0
- package/dist/net/snapshotCodec.js +92 -0
- package/dist/net/snapshotCodec.js.map +1 -0
- package/dist/parallax/Parallax.js +32 -0
- package/dist/parallax/Parallax.js.map +1 -0
- package/dist/parallax/ParallaxLayer.js +70 -0
- package/dist/parallax/ParallaxLayer.js.map +1 -0
- package/dist/parallax/parallaxMath.js +27 -0
- package/dist/parallax/parallaxMath.js.map +1 -0
- package/dist/particles/Emitter.js +108 -0
- package/dist/particles/Emitter.js.map +1 -0
- package/dist/particles/ParticleBudget.js +32 -0
- package/dist/particles/ParticleBudget.js.map +1 -0
- package/dist/particles/ParticleSim.js +60 -0
- package/dist/particles/ParticleSim.js.map +1 -0
- package/dist/particles/particleCurves.js +48 -0
- package/dist/particles/particleCurves.js.map +1 -0
- package/dist/particles/particleSampling.js +30 -0
- package/dist/particles/particleSampling.js.map +1 -0
- package/dist/physics/Body.js +202 -0
- package/dist/physics/Body.js.map +1 -0
- package/dist/physics/BroadPhase.js +56 -0
- package/dist/physics/BroadPhase.js.map +1 -0
- package/dist/physics/Contact.js +76 -0
- package/dist/physics/Contact.js.map +1 -0
- package/dist/physics/ContactSolver.js +70 -0
- package/dist/physics/ContactSolver.js.map +1 -0
- package/dist/physics/PhysicsWorld.js +221 -0
- package/dist/physics/PhysicsWorld.js.map +1 -0
- package/dist/physics/SpatialHash.js +39 -0
- package/dist/physics/SpatialHash.js.map +1 -0
- package/dist/physics/collide.js +76 -0
- package/dist/physics/collide.js.map +1 -0
- package/dist/physics/collidePolygon.js +94 -0
- package/dist/physics/collidePolygon.js.map +1 -0
- package/dist/physics/contactReport.js +14 -0
- package/dist/physics/contactReport.js.map +1 -0
- package/dist/physics/drawColliders.js +31 -0
- package/dist/physics/drawColliders.js.map +1 -0
- package/dist/physics/physicsSystem.js +8 -0
- package/dist/physics/physicsSystem.js.map +1 -0
- package/dist/physics/polygon.js +80 -0
- package/dist/physics/polygon.js.map +1 -0
- package/dist/physics/raycast.js +62 -0
- package/dist/physics/raycast.js.map +1 -0
- package/dist/physics/syncToBody.js +19 -0
- package/dist/physics/syncToBody.js.map +1 -0
- package/dist/physics/tileBodies.js +59 -0
- package/dist/physics/tileBodies.js.map +1 -0
- package/dist/physics/types.js +8 -0
- package/dist/physics/types.js.map +1 -0
- package/dist/pixel/Darkness.js +166 -0
- package/dist/pixel/Darkness.js.map +1 -0
- package/dist/pixel/DitherVignette.js +57 -0
- package/dist/pixel/DitherVignette.js.map +1 -0
- package/dist/pixel/Evaporation.js +85 -0
- package/dist/pixel/Evaporation.js.map +1 -0
- package/dist/pixel/NightShade.js +34 -0
- package/dist/pixel/NightShade.js.map +1 -0
- package/dist/pixel/PixelLayer.js +211 -0
- package/dist/pixel/PixelLayer.js.map +1 -0
- package/dist/pixel/SwayProp.js +75 -0
- package/dist/pixel/SwayProp.js.map +1 -0
- package/dist/pixel/lights.js +44 -0
- package/dist/pixel/lights.js.map +1 -0
- package/dist/pixel/nineSlice.js +62 -0
- package/dist/pixel/nineSlice.js.map +1 -0
- package/dist/pixel/paintLayer.js +36 -0
- package/dist/pixel/paintLayer.js.map +1 -0
- package/dist/pixel/palette.js +57 -0
- package/dist/pixel/palette.js.map +1 -0
- package/dist/pixel/pixel.js +278 -0
- package/dist/pixel/pixel.js.map +1 -0
- package/dist/pixel/pixelPaint.js +194 -0
- package/dist/pixel/pixelPaint.js.map +1 -0
- package/dist/pixel/pixelTone.js +164 -0
- package/dist/pixel/pixelTone.js.map +1 -0
- package/dist/pixel/propKit.js +41 -0
- package/dist/pixel/propKit.js.map +1 -0
- package/dist/pixel/ramp.js +102 -0
- package/dist/pixel/ramp.js.map +1 -0
- package/dist/pixel/selout.js +35 -0
- package/dist/pixel/selout.js.map +1 -0
- package/dist/pixel/spritePixels.js +59 -0
- package/dist/pixel/spritePixels.js.map +1 -0
- package/dist/pixel/swayRig.js +87 -0
- package/dist/pixel/swayRig.js.map +1 -0
- package/dist/pixel/vignetteMask.js +24 -0
- package/dist/pixel/vignetteMask.js.map +1 -0
- package/dist/pixel/weatherArt.js +61 -0
- package/dist/pixel/weatherArt.js.map +1 -0
- package/dist/pixel.js +90 -0
- package/dist/pixel.js.map +1 -0
- package/dist/platform/touch.js +33 -0
- package/dist/platform/touch.js.map +1 -0
- package/dist/postfx/BloomFilter.js +65 -0
- package/dist/postfx/BloomFilter.js.map +1 -0
- package/dist/postfx/ChromaticAberrationFilter.js +25 -0
- package/dist/postfx/ChromaticAberrationFilter.js.map +1 -0
- package/dist/postfx/ColorAdjustFilter.js +76 -0
- package/dist/postfx/ColorAdjustFilter.js.map +1 -0
- package/dist/postfx/CrtFilter.js +42 -0
- package/dist/postfx/CrtFilter.js.map +1 -0
- package/dist/postfx/PixelateFilter.js +27 -0
- package/dist/postfx/PixelateFilter.js.map +1 -0
- package/dist/postfx/PostFx.js +123 -0
- package/dist/postfx/PostFx.js.map +1 -0
- package/dist/postfx/ShockwaveFilter.js +49 -0
- package/dist/postfx/ShockwaveFilter.js.map +1 -0
- package/dist/postfx/VignetteFilter.js +37 -0
- package/dist/postfx/VignetteFilter.js.map +1 -0
- package/dist/postfx/fxAnimator.js +38 -0
- package/dist/postfx/fxAnimator.js.map +1 -0
- package/dist/postfx/fxShader.js +128 -0
- package/dist/postfx/fxShader.js.map +1 -0
- package/dist/postfx.js +26 -0
- package/dist/postfx.js.map +1 -0
- package/dist/react/ChoiceDialog.js +51 -0
- package/dist/react/ChoiceDialog.js.map +1 -0
- package/dist/react/ConfirmDialog.js +53 -0
- package/dist/react/ConfirmDialog.js.map +1 -0
- package/dist/react/Glyph.js +63 -0
- package/dist/react/Glyph.js.map +1 -0
- package/dist/react/Modal.js +38 -0
- package/dist/react/Modal.js.map +1 -0
- package/dist/react/Panel.js +24 -0
- package/dist/react/Panel.js.map +1 -0
- package/dist/react/PixelImage.js +24 -0
- package/dist/react/PixelImage.js.map +1 -0
- package/dist/react/Select.js +99 -0
- package/dist/react/Select.js.map +1 -0
- package/dist/react/Slider.js +62 -0
- package/dist/react/Slider.js.map +1 -0
- package/dist/react/SplitPane.js +24 -0
- package/dist/react/SplitPane.js.map +1 -0
- package/dist/react/TabStrip.js +32 -0
- package/dist/react/TabStrip.js.map +1 -0
- package/dist/react/TitleTips.js +42 -0
- package/dist/react/TitleTips.js.map +1 -0
- package/dist/react/Tooltip.js +28 -0
- package/dist/react/Tooltip.js.map +1 -0
- package/dist/react/UiProvider.js +50 -0
- package/dist/react/UiProvider.js.map +1 -0
- package/dist/react/baseCss.js +222 -0
- package/dist/react/baseCss.js.map +1 -0
- package/dist/react/choiceStore.js +23 -0
- package/dist/react/choiceStore.js.map +1 -0
- package/dist/react/classNames.js +19 -0
- package/dist/react/classNames.js.map +1 -0
- package/dist/react/confirmStore.js +30 -0
- package/dist/react/confirmStore.js.map +1 -0
- package/dist/react/labels.js +18 -0
- package/dist/react/labels.js.map +1 -0
- package/dist/react/placement.js +49 -0
- package/dist/react/placement.js.map +1 -0
- package/dist/react/useFillSheet.js +23 -0
- package/dist/react/useFillSheet.js.map +1 -0
- package/dist/react/useFitToViewport.js +29 -0
- package/dist/react/useFitToViewport.js.map +1 -0
- package/dist/react/usePicked.js +13 -0
- package/dist/react/usePicked.js.map +1 -0
- package/dist/react/useStore.js +9 -0
- package/dist/react/useStore.js.map +1 -0
- package/dist/react/useViewport.js +17 -0
- package/dist/react/useViewport.js.map +1 -0
- package/dist/react.js +78 -0
- package/dist/react.js.map +1 -0
- package/dist/rig/PosePlayer.js +92 -0
- package/dist/rig/PosePlayer.js.map +1 -0
- package/dist/rig/RigView.js +125 -0
- package/dist/rig/RigView.js.map +1 -0
- package/dist/rig/Skeleton.js +31 -0
- package/dist/rig/Skeleton.js.map +1 -0
- package/dist/rig/humanoid.js +6 -0
- package/dist/rig/humanoid.js.map +1 -0
- package/dist/rig/humanoid.json.js +30 -0
- package/dist/rig/humanoid.json.js.map +1 -0
- package/dist/rig/humanoidPoses.js +30 -0
- package/dist/rig/humanoidPoses.js.map +1 -0
- package/dist/rig/poseMath.js +54 -0
- package/dist/rig/poseMath.js.map +1 -0
- package/dist/rig/poses.json.js +150 -0
- package/dist/rig/poses.json.js.map +1 -0
- package/dist/save/Autosaver.js +54 -0
- package/dist/save/Autosaver.js.map +1 -0
- package/dist/save/MemoryBackend.js +19 -0
- package/dist/save/MemoryBackend.js.map +1 -0
- package/dist/save/SaveStore.js +103 -0
- package/dist/save/SaveStore.js.map +1 -0
- package/dist/save/WebStorageBackend.js +27 -0
- package/dist/save/WebStorageBackend.js.map +1 -0
- package/dist/save/checksum.js +10 -0
- package/dist/save/checksum.js.map +1 -0
- package/dist/save/migrateSave.js +27 -0
- package/dist/save/migrateSave.js.map +1 -0
- package/dist/settings.js +27 -0
- package/dist/settings.js.map +1 -0
- package/dist/tilemap/TilemapView.js +69 -0
- package/dist/tilemap/TilemapView.js.map +1 -0
- package/dist/tilemap/collision.js +25 -0
- package/dist/tilemap/collision.js.map +1 -0
- package/dist/tilemap/tiled.js +138 -0
- package/dist/tilemap/tiled.js.map +1 -0
- package/dist/transitions/CrossfadeTransition.js +24 -0
- package/dist/transitions/CrossfadeTransition.js.map +1 -0
- package/dist/transitions/DitherWipeTransition.js +70 -0
- package/dist/transitions/DitherWipeTransition.js.map +1 -0
- package/dist/transitions/FadeTransition.js +34 -0
- package/dist/transitions/FadeTransition.js.map +1 -0
- package/dist/transitions/Letterbox.js +42 -0
- package/dist/transitions/Letterbox.js.map +1 -0
- package/dist/transitions/ditherMask.js +15 -0
- package/dist/transitions/ditherMask.js.map +1 -0
- package/dist/transitions/transitionTo.js +28 -0
- package/dist/transitions/transitionTo.js.map +1 -0
- package/dist/transitions/tweenDone.js +15 -0
- package/dist/transitions/tweenDone.js.map +1 -0
- package/dist/types/ambient/ColorGrade.d.ts +41 -0
- package/dist/types/ambient/ColorGrade.d.ts.map +1 -0
- package/dist/types/ambient/DayClock.d.ts +80 -0
- package/dist/types/ambient/DayClock.d.ts.map +1 -0
- package/dist/types/ambient/WeatherLayer.d.ts +78 -0
- package/dist/types/ambient/WeatherLayer.d.ts.map +1 -0
- package/dist/types/ambient/grade.d.ts +22 -0
- package/dist/types/ambient/grade.d.ts.map +1 -0
- package/dist/types/ambient/weather.d.ts +49 -0
- package/dist/types/ambient/weather.d.ts.map +1 -0
- package/dist/types/anim/AnimStateMachine.d.ts +80 -0
- package/dist/types/anim/AnimStateMachine.d.ts.map +1 -0
- package/dist/types/anim/Animator.d.ts +50 -0
- package/dist/types/anim/Animator.d.ts.map +1 -0
- package/dist/types/anim/animStateCompile.d.ts +52 -0
- package/dist/types/anim/animStateCompile.d.ts.map +1 -0
- package/dist/types/anim/animStateSystem.d.ts +10 -0
- package/dist/types/anim/animStateSystem.d.ts.map +1 -0
- package/dist/types/anim/animStateTypes.d.ts +50 -0
- package/dist/types/anim/animStateTypes.d.ts.map +1 -0
- package/dist/types/anim/animationSystem.d.ts +13 -0
- package/dist/types/anim/animationSystem.d.ts.map +1 -0
- package/dist/types/anim/asepriteSlices.d.ts +19 -0
- package/dist/types/anim/asepriteSlices.d.ts.map +1 -0
- package/dist/types/anim/asepriteTags.d.ts +16 -0
- package/dist/types/anim/asepriteTags.d.ts.map +1 -0
- package/dist/types/anim/asepriteTypes.d.ts +159 -0
- package/dist/types/anim/asepriteTypes.d.ts.map +1 -0
- package/dist/types/anim/parseAseprite.d.ts +21 -0
- package/dist/types/anim/parseAseprite.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +85 -0
- package/dist/types/assets/AssetLoader.d.ts.map +1 -0
- package/dist/types/assets/loadAseprite.d.ts +27 -0
- package/dist/types/assets/loadAseprite.d.ts.map +1 -0
- package/dist/types/audio/Footsteps.d.ts +33 -0
- package/dist/types/audio/Footsteps.d.ts.map +1 -0
- package/dist/types/audio/MusicPlayer.d.ts +65 -0
- package/dist/types/audio/MusicPlayer.d.ts.map +1 -0
- package/dist/types/audio/SoundEngine.d.ts +42 -0
- package/dist/types/audio/SoundEngine.d.ts.map +1 -0
- package/dist/types/audio/cleanTake.d.ts +3 -0
- package/dist/types/audio/cleanTake.d.ts.map +1 -0
- package/dist/types/audio/music/ElementVoice.d.ts +14 -0
- package/dist/types/audio/music/ElementVoice.d.ts.map +1 -0
- package/dist/types/audio/music/GraphVoice.d.ts +22 -0
- package/dist/types/audio/music/GraphVoice.d.ts.map +1 -0
- package/dist/types/audio/music/MusicChannel.d.ts +35 -0
- package/dist/types/audio/music/MusicChannel.d.ts.map +1 -0
- package/dist/types/audio/music/musicVoice.d.ts +26 -0
- package/dist/types/audio/music/musicVoice.d.ts.map +1 -0
- package/dist/types/audio/sampleBank.d.ts +27 -0
- package/dist/types/audio/sampleBank.d.ts.map +1 -0
- package/dist/types/audio/soundTable.d.ts +14 -0
- package/dist/types/audio/soundTable.d.ts.map +1 -0
- package/dist/types/audio/synth.d.ts +34 -0
- package/dist/types/audio/synth.d.ts.map +1 -0
- package/dist/types/audio/takeCleanerWorker.d.ts +2 -0
- package/dist/types/audio/takeCleanerWorker.d.ts.map +1 -0
- package/dist/types/core/BitmapLabel.d.ts +36 -0
- package/dist/types/core/BitmapLabel.d.ts.map +1 -0
- package/dist/types/core/Camera.d.ts +115 -0
- package/dist/types/core/Camera.d.ts.map +1 -0
- package/dist/types/core/Clock.d.ts +11 -0
- package/dist/types/core/Clock.d.ts.map +1 -0
- package/dist/types/core/Graphics.d.ts +37 -0
- package/dist/types/core/Graphics.d.ts.map +1 -0
- package/dist/types/core/Group.d.ts +15 -0
- package/dist/types/core/Group.d.ts.map +1 -0
- package/dist/types/core/Image.d.ts +25 -0
- package/dist/types/core/Image.d.ts.map +1 -0
- package/dist/types/core/ObjectFactory.d.ts +34 -0
- package/dist/types/core/ObjectFactory.d.ts.map +1 -0
- package/dist/types/core/Pointer.d.ts +27 -0
- package/dist/types/core/Pointer.d.ts.map +1 -0
- package/dist/types/core/Rectangle.d.ts +26 -0
- package/dist/types/core/Rectangle.d.ts.map +1 -0
- package/dist/types/core/Stage.d.ts +58 -0
- package/dist/types/core/Stage.d.ts.map +1 -0
- package/dist/types/core/Text.d.ts +22 -0
- package/dist/types/core/Text.d.ts.map +1 -0
- package/dist/types/core/TextureRegistry.d.ts +51 -0
- package/dist/types/core/TextureRegistry.d.ts.map +1 -0
- package/dist/types/core/Timeline.d.ts +115 -0
- package/dist/types/core/Timeline.d.ts.map +1 -0
- package/dist/types/core/TimelineBuilder.d.ts +53 -0
- package/dist/types/core/TimelineBuilder.d.ts.map +1 -0
- package/dist/types/core/TimelineChild.d.ts +51 -0
- package/dist/types/core/TimelineChild.d.ts.map +1 -0
- package/dist/types/core/Tweener.d.ts +70 -0
- package/dist/types/core/Tweener.d.ts.map +1 -0
- package/dist/types/core/atlas.d.ts +16 -0
- package/dist/types/core/atlas.d.ts.map +1 -0
- package/dist/types/core/atlasPlan.d.ts +34 -0
- package/dist/types/core/atlasPlan.d.ts.map +1 -0
- package/dist/types/core/eases.d.ts +3 -0
- package/dist/types/core/eases.d.ts.map +1 -0
- package/dist/types/core/gameObject.d.ts +42 -0
- package/dist/types/core/gameObject.d.ts.map +1 -0
- package/dist/types/core/pixiPatches.d.ts +9 -0
- package/dist/types/core/pixiPatches.d.ts.map +1 -0
- package/dist/types/core/timelinePlace.d.ts +23 -0
- package/dist/types/core/timelinePlace.d.ts.map +1 -0
- package/dist/types/core/tweenProps.d.ts +8 -0
- package/dist/types/core/tweenProps.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +4 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/debug/DebugOverlay.d.ts +63 -0
- package/dist/types/debug/DebugOverlay.d.ts.map +1 -0
- package/dist/types/debug/DrawCallCounter.d.ts +20 -0
- package/dist/types/debug/DrawCallCounter.d.ts.map +1 -0
- package/dist/types/debug/ErrorLog.d.ts +20 -0
- package/dist/types/debug/ErrorLog.d.ts.map +1 -0
- package/dist/types/debug/FrameStats.d.ts +21 -0
- package/dist/types/debug/FrameStats.d.ts.map +1 -0
- package/dist/types/debug/inspectWorld.d.ts +14 -0
- package/dist/types/debug/inspectWorld.d.ts.map +1 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts +17 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts.map +1 -0
- package/dist/types/diagnostics/FrameSampler.d.ts +37 -0
- package/dist/types/diagnostics/FrameSampler.d.ts.map +1 -0
- package/dist/types/diagnostics/bootWatch.d.ts +25 -0
- package/dist/types/diagnostics/bootWatch.d.ts.map +1 -0
- package/dist/types/diagnostics/captureErrors.d.ts +24 -0
- package/dist/types/diagnostics/captureErrors.d.ts.map +1 -0
- package/dist/types/diagnostics/contextLoss.d.ts +35 -0
- package/dist/types/diagnostics/contextLoss.d.ts.map +1 -0
- package/dist/types/diagnostics/frameStats.d.ts +30 -0
- package/dist/types/diagnostics/frameStats.d.ts.map +1 -0
- package/dist/types/diagnostics/gpuInfo.d.ts +9 -0
- package/dist/types/diagnostics/gpuInfo.d.ts.map +1 -0
- package/dist/types/diagnostics/renderGuard.d.ts +12 -0
- package/dist/types/diagnostics/renderGuard.d.ts.map +1 -0
- package/dist/types/ecs/SparseSet.d.ts +25 -0
- package/dist/types/ecs/SparseSet.d.ts.map +1 -0
- package/dist/types/ecs/World.d.ts +137 -0
- package/dist/types/ecs/World.d.ts.map +1 -0
- package/dist/types/ecs/fields.d.ts +34 -0
- package/dist/types/ecs/fields.d.ts.map +1 -0
- package/dist/types/engine/Engine.d.ts +80 -0
- package/dist/types/engine/Engine.d.ts.map +1 -0
- package/dist/types/engine/FixedLoop.d.ts +32 -0
- package/dist/types/engine/FixedLoop.d.ts.map +1 -0
- package/dist/types/engine/Scene.d.ts +67 -0
- package/dist/types/engine/Scene.d.ts.map +1 -0
- package/dist/types/engine/SceneManager.d.ts +36 -0
- package/dist/types/engine/SceneManager.d.ts.map +1 -0
- package/dist/types/events/EventBus.d.ts +20 -0
- package/dist/types/events/EventBus.d.ts.map +1 -0
- package/dist/types/fx/FloatingText.d.ts +71 -0
- package/dist/types/fx/FloatingText.d.ts.map +1 -0
- package/dist/types/fx/hitStop.d.ts +20 -0
- package/dist/types/fx/hitStop.d.ts.map +1 -0
- package/dist/types/fx/viewCull.d.ts +14 -0
- package/dist/types/fx/viewCull.d.ts.map +1 -0
- package/dist/types/i18n/Translator.d.ts +52 -0
- package/dist/types/i18n/Translator.d.ts.map +1 -0
- package/dist/types/i18n/extractStrings.d.ts +25 -0
- package/dist/types/i18n/extractStrings.d.ts.map +1 -0
- package/dist/types/i18n/formatMessage.d.ts +10 -0
- package/dist/types/i18n/formatMessage.d.ts.map +1 -0
- package/dist/types/index.d.ts +149 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input/Actions.d.ts +94 -0
- package/dist/types/input/Actions.d.ts.map +1 -0
- package/dist/types/input/AimGesture.d.ts +106 -0
- package/dist/types/input/AimGesture.d.ts.map +1 -0
- package/dist/types/input/Keyboard.d.ts +30 -0
- package/dist/types/input/Keyboard.d.ts.map +1 -0
- package/dist/types/input/Keymap.d.ts +85 -0
- package/dist/types/input/Keymap.d.ts.map +1 -0
- package/dist/types/input/TargetLock.d.ts +56 -0
- package/dist/types/input/TargetLock.d.ts.map +1 -0
- package/dist/types/input/aimAxis.d.ts +9 -0
- package/dist/types/input/aimAxis.d.ts.map +1 -0
- package/dist/types/input/keyChord.d.ts +15 -0
- package/dist/types/input/keyChord.d.ts.map +1 -0
- package/dist/types/input/longPress.d.ts +21 -0
- package/dist/types/input/longPress.d.ts.map +1 -0
- package/dist/types/input/stickAxis.d.ts +26 -0
- package/dist/types/input/stickAxis.d.ts.map +1 -0
- package/dist/types/input/touchDetect.d.ts +18 -0
- package/dist/types/input/touchDetect.d.ts.map +1 -0
- package/dist/types/light/LightLayer.d.ts +65 -0
- package/dist/types/light/LightLayer.d.ts.map +1 -0
- package/dist/types/nav/MinHeap.d.ts +15 -0
- package/dist/types/nav/MinHeap.d.ts.map +1 -0
- package/dist/types/nav/findPath.d.ts +38 -0
- package/dist/types/nav/findPath.d.ts.map +1 -0
- package/dist/types/nav/navGrid.d.ts +48 -0
- package/dist/types/nav/navGrid.d.ts.map +1 -0
- package/dist/types/nav/nearestOpen.d.ts +8 -0
- package/dist/types/nav/nearestOpen.d.ts.map +1 -0
- package/dist/types/nav/straightenPath.d.ts +13 -0
- package/dist/types/nav/straightenPath.d.ts.map +1 -0
- package/dist/types/net/Connection.d.ts +66 -0
- package/dist/types/net/Connection.d.ts.map +1 -0
- package/dist/types/net/InterpolationBuffer.d.ts +36 -0
- package/dist/types/net/InterpolationBuffer.d.ts.map +1 -0
- package/dist/types/net/PredictedMover.d.ts +43 -0
- package/dist/types/net/PredictedMover.d.ts.map +1 -0
- package/dist/types/net/Room.d.ts +69 -0
- package/dist/types/net/Room.d.ts.map +1 -0
- package/dist/types/net/RoomHost.d.ts +74 -0
- package/dist/types/net/RoomHost.d.ts.map +1 -0
- package/dist/types/net/cadence.d.ts +22 -0
- package/dist/types/net/cadence.d.ts.map +1 -0
- package/dist/types/net/constants.d.ts +24 -0
- package/dist/types/net/constants.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyClient.d.ts +107 -0
- package/dist/types/net/lobby/LobbyClient.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyHost.d.ts +147 -0
- package/dist/types/net/lobby/LobbyHost.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts +56 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts.map +1 -0
- package/dist/types/net/lobby/Matchmaker.d.ts +57 -0
- package/dist/types/net/lobby/Matchmaker.d.ts.map +1 -0
- package/dist/types/net/lobby/index.d.ts +6 -0
- package/dist/types/net/lobby/index.d.ts.map +1 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts +143 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts.map +1 -0
- package/dist/types/net/movement.d.ts +50 -0
- package/dist/types/net/movement.d.ts.map +1 -0
- package/dist/types/net/protocol.d.ts +59 -0
- package/dist/types/net/protocol.d.ts.map +1 -0
- package/dist/types/net/serverClock.d.ts +14 -0
- package/dist/types/net/serverClock.d.ts.map +1 -0
- package/dist/types/net/snapshotCodec.d.ts +55 -0
- package/dist/types/net/snapshotCodec.d.ts.map +1 -0
- package/dist/types/parallax/Parallax.d.ts +37 -0
- package/dist/types/parallax/Parallax.d.ts.map +1 -0
- package/dist/types/parallax/ParallaxLayer.d.ts +80 -0
- package/dist/types/parallax/ParallaxLayer.d.ts.map +1 -0
- package/dist/types/parallax/parallaxMath.d.ts +50 -0
- package/dist/types/parallax/parallaxMath.d.ts.map +1 -0
- package/dist/types/particles/Emitter.d.ts +97 -0
- package/dist/types/particles/Emitter.d.ts.map +1 -0
- package/dist/types/particles/ParticleBudget.d.ts +28 -0
- package/dist/types/particles/ParticleBudget.d.ts.map +1 -0
- package/dist/types/particles/ParticleSim.d.ts +38 -0
- package/dist/types/particles/ParticleSim.d.ts.map +1 -0
- package/dist/types/particles/particleCurves.d.ts +21 -0
- package/dist/types/particles/particleCurves.d.ts.map +1 -0
- package/dist/types/particles/particleSampling.d.ts +20 -0
- package/dist/types/particles/particleSampling.d.ts.map +1 -0
- package/dist/types/physics/Body.d.ts +130 -0
- package/dist/types/physics/Body.d.ts.map +1 -0
- package/dist/types/physics/BroadPhase.d.ts +26 -0
- package/dist/types/physics/BroadPhase.d.ts.map +1 -0
- package/dist/types/physics/Contact.d.ts +62 -0
- package/dist/types/physics/Contact.d.ts.map +1 -0
- package/dist/types/physics/ContactSolver.d.ts +29 -0
- package/dist/types/physics/ContactSolver.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorld.d.ts +78 -0
- package/dist/types/physics/PhysicsWorld.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts +24 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts.map +1 -0
- package/dist/types/physics/SpatialHash.d.ts +23 -0
- package/dist/types/physics/SpatialHash.d.ts.map +1 -0
- package/dist/types/physics/collide.d.ts +27 -0
- package/dist/types/physics/collide.d.ts.map +1 -0
- package/dist/types/physics/collidePolygon.d.ts +14 -0
- package/dist/types/physics/collidePolygon.d.ts.map +1 -0
- package/dist/types/physics/contactReport.d.ts +8 -0
- package/dist/types/physics/contactReport.d.ts.map +1 -0
- package/dist/types/physics/drawColliders.d.ts +43 -0
- package/dist/types/physics/drawColliders.d.ts.map +1 -0
- package/dist/types/physics/physicsSystem.d.ts +5 -0
- package/dist/types/physics/physicsSystem.d.ts.map +1 -0
- package/dist/types/physics/polygon.d.ts +28 -0
- package/dist/types/physics/polygon.d.ts.map +1 -0
- package/dist/types/physics/raycast.d.ts +19 -0
- package/dist/types/physics/raycast.d.ts.map +1 -0
- package/dist/types/physics/syncToBody.d.ts +16 -0
- package/dist/types/physics/syncToBody.d.ts.map +1 -0
- package/dist/types/physics/tileBodies.d.ts +36 -0
- package/dist/types/physics/tileBodies.d.ts.map +1 -0
- package/dist/types/physics/types.d.ts +116 -0
- package/dist/types/physics/types.d.ts.map +1 -0
- package/dist/types/pixel/Darkness.d.ts +78 -0
- package/dist/types/pixel/Darkness.d.ts.map +1 -0
- package/dist/types/pixel/DitherVignette.d.ts +35 -0
- package/dist/types/pixel/DitherVignette.d.ts.map +1 -0
- package/dist/types/pixel/Evaporation.d.ts +30 -0
- package/dist/types/pixel/Evaporation.d.ts.map +1 -0
- package/dist/types/pixel/NightShade.d.ts +38 -0
- package/dist/types/pixel/NightShade.d.ts.map +1 -0
- package/dist/types/pixel/PixelLayer.d.ts +85 -0
- package/dist/types/pixel/PixelLayer.d.ts.map +1 -0
- package/dist/types/pixel/SwayProp.d.ts +52 -0
- package/dist/types/pixel/SwayProp.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +31 -0
- package/dist/types/pixel/index.d.ts.map +1 -0
- package/dist/types/pixel/lights.d.ts +34 -0
- package/dist/types/pixel/lights.d.ts.map +1 -0
- package/dist/types/pixel/nineSlice.d.ts +71 -0
- package/dist/types/pixel/nineSlice.d.ts.map +1 -0
- package/dist/types/pixel/paintLayer.d.ts +35 -0
- package/dist/types/pixel/paintLayer.d.ts.map +1 -0
- package/dist/types/pixel/palette.d.ts +58 -0
- package/dist/types/pixel/palette.d.ts.map +1 -0
- package/dist/types/pixel/pixel.d.ts +80 -0
- package/dist/types/pixel/pixel.d.ts.map +1 -0
- package/dist/types/pixel/pixelPaint.d.ts +43 -0
- package/dist/types/pixel/pixelPaint.d.ts.map +1 -0
- package/dist/types/pixel/pixelTone.d.ts +51 -0
- package/dist/types/pixel/pixelTone.d.ts.map +1 -0
- package/dist/types/pixel/propKit.d.ts +26 -0
- package/dist/types/pixel/propKit.d.ts.map +1 -0
- package/dist/types/pixel/ramp.d.ts +57 -0
- package/dist/types/pixel/ramp.d.ts.map +1 -0
- package/dist/types/pixel/selout.d.ts +3 -0
- package/dist/types/pixel/selout.d.ts.map +1 -0
- package/dist/types/pixel/spritePixels.d.ts +29 -0
- package/dist/types/pixel/spritePixels.d.ts.map +1 -0
- package/dist/types/pixel/swayRig.d.ts +72 -0
- package/dist/types/pixel/swayRig.d.ts.map +1 -0
- package/dist/types/pixel/vignetteMask.d.ts +16 -0
- package/dist/types/pixel/vignetteMask.d.ts.map +1 -0
- package/dist/types/pixel/weatherArt.d.ts +29 -0
- package/dist/types/pixel/weatherArt.d.ts.map +1 -0
- package/dist/types/platform/touch.d.ts +10 -0
- package/dist/types/platform/touch.d.ts.map +1 -0
- package/dist/types/postfx/BloomFilter.d.ts +33 -0
- package/dist/types/postfx/BloomFilter.d.ts.map +1 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts +11 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts.map +1 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts +32 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts.map +1 -0
- package/dist/types/postfx/CrtFilter.d.ts +16 -0
- package/dist/types/postfx/CrtFilter.d.ts.map +1 -0
- package/dist/types/postfx/PixelateFilter.d.ts +8 -0
- package/dist/types/postfx/PixelateFilter.d.ts.map +1 -0
- package/dist/types/postfx/PostFx.d.ts +92 -0
- package/dist/types/postfx/PostFx.d.ts.map +1 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts +20 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts.map +1 -0
- package/dist/types/postfx/VignetteFilter.d.ts +19 -0
- package/dist/types/postfx/VignetteFilter.d.ts.map +1 -0
- package/dist/types/postfx/fxAnimator.d.ts +32 -0
- package/dist/types/postfx/fxAnimator.d.ts.map +1 -0
- package/dist/types/postfx/fxShader.d.ts +49 -0
- package/dist/types/postfx/fxShader.d.ts.map +1 -0
- package/dist/types/postfx/index.d.ts +11 -0
- package/dist/types/postfx/index.d.ts.map +1 -0
- package/dist/types/react/ChoiceDialog.d.ts +8 -0
- package/dist/types/react/ChoiceDialog.d.ts.map +1 -0
- package/dist/types/react/ConfirmDialog.d.ts +9 -0
- package/dist/types/react/ConfirmDialog.d.ts.map +1 -0
- package/dist/types/react/Glyph.d.ts +54 -0
- package/dist/types/react/Glyph.d.ts.map +1 -0
- package/dist/types/react/Modal.d.ts +22 -0
- package/dist/types/react/Modal.d.ts.map +1 -0
- package/dist/types/react/Panel.d.ts +29 -0
- package/dist/types/react/Panel.d.ts.map +1 -0
- package/dist/types/react/PixelImage.d.ts +19 -0
- package/dist/types/react/PixelImage.d.ts.map +1 -0
- package/dist/types/react/Select.d.ts +27 -0
- package/dist/types/react/Select.d.ts.map +1 -0
- package/dist/types/react/Slider.d.ts +24 -0
- package/dist/types/react/Slider.d.ts.map +1 -0
- package/dist/types/react/SplitPane.d.ts +26 -0
- package/dist/types/react/SplitPane.d.ts.map +1 -0
- package/dist/types/react/TabStrip.d.ts +31 -0
- package/dist/types/react/TabStrip.d.ts.map +1 -0
- package/dist/types/react/TitleTips.d.ts +15 -0
- package/dist/types/react/TitleTips.d.ts.map +1 -0
- package/dist/types/react/Tooltip.d.ts +22 -0
- package/dist/types/react/Tooltip.d.ts.map +1 -0
- package/dist/types/react/UiProvider.d.ts +52 -0
- package/dist/types/react/UiProvider.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +27 -0
- package/dist/types/react/baseCss.d.ts.map +1 -0
- package/dist/types/react/choiceStore.d.ts +34 -0
- package/dist/types/react/choiceStore.d.ts.map +1 -0
- package/dist/types/react/classNames.d.ts +12 -0
- package/dist/types/react/classNames.d.ts.map +1 -0
- package/dist/types/react/confirmStore.d.ts +30 -0
- package/dist/types/react/confirmStore.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +33 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/react/labels.d.ts +24 -0
- package/dist/types/react/labels.d.ts.map +1 -0
- package/dist/types/react/placement.d.ts +59 -0
- package/dist/types/react/placement.d.ts.map +1 -0
- package/dist/types/react/useFillSheet.d.ts +9 -0
- package/dist/types/react/useFillSheet.d.ts.map +1 -0
- package/dist/types/react/useFitToViewport.d.ts +20 -0
- package/dist/types/react/useFitToViewport.d.ts.map +1 -0
- package/dist/types/react/usePicked.d.ts +9 -0
- package/dist/types/react/usePicked.d.ts.map +1 -0
- package/dist/types/react/useStore.d.ts +8 -0
- package/dist/types/react/useStore.d.ts.map +1 -0
- package/dist/types/react/useViewport.d.ts +4 -0
- package/dist/types/react/useViewport.d.ts.map +1 -0
- package/dist/types/rig/PosePlayer.d.ts +64 -0
- package/dist/types/rig/PosePlayer.d.ts.map +1 -0
- package/dist/types/rig/RigView.d.ts +68 -0
- package/dist/types/rig/RigView.d.ts.map +1 -0
- package/dist/types/rig/Skeleton.d.ts +14 -0
- package/dist/types/rig/Skeleton.d.ts.map +1 -0
- package/dist/types/rig/humanoid.d.ts +4 -0
- package/dist/types/rig/humanoid.d.ts.map +1 -0
- package/dist/types/rig/humanoidPoses.d.ts +117 -0
- package/dist/types/rig/humanoidPoses.d.ts.map +1 -0
- package/dist/types/rig/poseMath.d.ts +14 -0
- package/dist/types/rig/poseMath.d.ts.map +1 -0
- package/dist/types/rig/rigTypes.d.ts +82 -0
- package/dist/types/rig/rigTypes.d.ts.map +1 -0
- package/dist/types/save/Autosaver.d.ts +43 -0
- package/dist/types/save/Autosaver.d.ts.map +1 -0
- package/dist/types/save/MemoryBackend.d.ts +10 -0
- package/dist/types/save/MemoryBackend.d.ts.map +1 -0
- package/dist/types/save/SaveBackend.d.ts +14 -0
- package/dist/types/save/SaveBackend.d.ts.map +1 -0
- package/dist/types/save/SaveStore.d.ts +73 -0
- package/dist/types/save/SaveStore.d.ts.map +1 -0
- package/dist/types/save/WebStorageBackend.d.ts +14 -0
- package/dist/types/save/WebStorageBackend.d.ts.map +1 -0
- package/dist/types/save/checksum.d.ts +7 -0
- package/dist/types/save/checksum.d.ts.map +1 -0
- package/dist/types/save/migrateSave.d.ts +17 -0
- package/dist/types/save/migrateSave.d.ts.map +1 -0
- package/dist/types/settings.d.ts +25 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +42 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +16 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -0
- package/dist/types/tilemap/tiled.d.ts +104 -0
- package/dist/types/tilemap/tiled.d.ts.map +1 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts +20 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts +35 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts.map +1 -0
- package/dist/types/transitions/FadeTransition.d.ts +20 -0
- package/dist/types/transitions/FadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/Letterbox.d.ts +33 -0
- package/dist/types/transitions/Letterbox.d.ts.map +1 -0
- package/dist/types/transitions/Transition.d.ts +22 -0
- package/dist/types/transitions/Transition.d.ts.map +1 -0
- package/dist/types/transitions/ditherMask.d.ts +13 -0
- package/dist/types/transitions/ditherMask.d.ts.map +1 -0
- package/dist/types/transitions/transitionTo.d.ts +16 -0
- package/dist/types/transitions/transitionTo.d.ts.map +1 -0
- package/dist/types/transitions/tweenDone.d.ts +5 -0
- package/dist/types/transitions/tweenDone.d.ts.map +1 -0
- package/dist/types/ui/Bar.d.ts +41 -0
- package/dist/types/ui/Bar.d.ts.map +1 -0
- package/dist/types/ui/Button.d.ts +47 -0
- package/dist/types/ui/Button.d.ts.map +1 -0
- package/dist/types/ui/Dialog.d.ts +47 -0
- package/dist/types/ui/Dialog.d.ts.map +1 -0
- package/dist/types/ui/FocusManager.d.ts +53 -0
- package/dist/types/ui/FocusManager.d.ts.map +1 -0
- package/dist/types/ui/Label.d.ts +24 -0
- package/dist/types/ui/Label.d.ts.map +1 -0
- package/dist/types/ui/List.d.ts +23 -0
- package/dist/types/ui/List.d.ts.map +1 -0
- package/dist/types/ui/Panel.d.ts +38 -0
- package/dist/types/ui/Panel.d.ts.map +1 -0
- package/dist/types/ui/ScrollView.d.ts +56 -0
- package/dist/types/ui/ScrollView.d.ts.map +1 -0
- package/dist/types/ui/Slider.d.ts +47 -0
- package/dist/types/ui/Slider.d.ts.map +1 -0
- package/dist/types/ui/Stack.d.ts +16 -0
- package/dist/types/ui/Stack.d.ts.map +1 -0
- package/dist/types/ui/Toggle.d.ts +31 -0
- package/dist/types/ui/Toggle.d.ts.map +1 -0
- package/dist/types/ui/UiHost.d.ts +18 -0
- package/dist/types/ui/UiHost.d.ts.map +1 -0
- package/dist/types/ui/UiPointerGate.d.ts +17 -0
- package/dist/types/ui/UiPointerGate.d.ts.map +1 -0
- package/dist/types/ui/UiRoot.d.ts +73 -0
- package/dist/types/ui/UiRoot.d.ts.map +1 -0
- package/dist/types/ui/Widget.d.ts +56 -0
- package/dist/types/ui/Widget.d.ts.map +1 -0
- package/dist/types/ui/dom/DomOverlay.d.ts +52 -0
- package/dist/types/ui/dom/DomOverlay.d.ts.map +1 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts +50 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts.map +1 -0
- package/dist/types/ui/dom/InputShield.d.ts +20 -0
- package/dist/types/ui/dom/InputShield.d.ts.map +1 -0
- package/dist/types/ui/dom/createStore.d.ts +22 -0
- package/dist/types/ui/dom/createStore.d.ts.map +1 -0
- package/dist/types/ui/dom/shieldDecision.d.ts +34 -0
- package/dist/types/ui/dom/shieldDecision.d.ts.map +1 -0
- package/dist/types/ui/dom/worldToScreen.d.ts +24 -0
- package/dist/types/ui/dom/worldToScreen.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +38 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/types/ui/layout/anchor.d.ts +9 -0
- package/dist/types/ui/layout/anchor.d.ts.map +1 -0
- package/dist/types/ui/layout/barDrain.d.ts +25 -0
- package/dist/types/ui/layout/barDrain.d.ts.map +1 -0
- package/dist/types/ui/layout/fitToViewport.d.ts +32 -0
- package/dist/types/ui/layout/fitToViewport.d.ts.map +1 -0
- package/dist/types/ui/layout/focusNav.d.ts +13 -0
- package/dist/types/ui/layout/focusNav.d.ts.map +1 -0
- package/dist/types/ui/layout/geometry.d.ts +35 -0
- package/dist/types/ui/layout/geometry.d.ts.map +1 -0
- package/dist/types/ui/layout/listWidth.d.ts +13 -0
- package/dist/types/ui/layout/listWidth.d.ts.map +1 -0
- package/dist/types/ui/layout/placeTooltip.d.ts +23 -0
- package/dist/types/ui/layout/placeTooltip.d.ts.map +1 -0
- package/dist/types/ui/layout/scroll.d.ts +17 -0
- package/dist/types/ui/layout/scroll.d.ts.map +1 -0
- package/dist/types/ui/layout/slider.d.ts +7 -0
- package/dist/types/ui/layout/slider.d.ts.map +1 -0
- package/dist/types/ui/layout/stack.d.ts +26 -0
- package/dist/types/ui/layout/stack.d.ts.map +1 -0
- package/dist/types/ui/layout/wrapRow.d.ts +6 -0
- package/dist/types/ui/layout/wrapRow.d.ts.map +1 -0
- package/dist/ui/Bar.js +54 -0
- package/dist/ui/Bar.js.map +1 -0
- package/dist/ui/Button.js +58 -0
- package/dist/ui/Button.js.map +1 -0
- package/dist/ui/Dialog.js +56 -0
- package/dist/ui/Dialog.js.map +1 -0
- package/dist/ui/FocusManager.js +97 -0
- package/dist/ui/FocusManager.js.map +1 -0
- package/dist/ui/Label.js +36 -0
- package/dist/ui/Label.js.map +1 -0
- package/dist/ui/List.js +45 -0
- package/dist/ui/List.js.map +1 -0
- package/dist/ui/Panel.js +38 -0
- package/dist/ui/Panel.js.map +1 -0
- package/dist/ui/ScrollView.js +96 -0
- package/dist/ui/ScrollView.js.map +1 -0
- package/dist/ui/Slider.js +55 -0
- package/dist/ui/Slider.js.map +1 -0
- package/dist/ui/Stack.js +28 -0
- package/dist/ui/Stack.js.map +1 -0
- package/dist/ui/Toggle.js +37 -0
- package/dist/ui/Toggle.js.map +1 -0
- package/dist/ui/UiHost.js +9 -0
- package/dist/ui/UiHost.js.map +1 -0
- package/dist/ui/UiPointerGate.js +25 -0
- package/dist/ui/UiPointerGate.js.map +1 -0
- package/dist/ui/UiRoot.js +93 -0
- package/dist/ui/UiRoot.js.map +1 -0
- package/dist/ui/Widget.js +90 -0
- package/dist/ui/Widget.js.map +1 -0
- package/dist/ui/dom/DomOverlay.js +59 -0
- package/dist/ui/dom/DomOverlay.js.map +1 -0
- package/dist/ui/dom/DomWorldAnchors.js +59 -0
- package/dist/ui/dom/DomWorldAnchors.js.map +1 -0
- package/dist/ui/dom/InputShield.js +27 -0
- package/dist/ui/dom/InputShield.js.map +1 -0
- package/dist/ui/dom/createStore.js +42 -0
- package/dist/ui/dom/createStore.js.map +1 -0
- package/dist/ui/dom/shieldDecision.js +36 -0
- package/dist/ui/dom/shieldDecision.js.map +1 -0
- package/dist/ui/dom/worldToScreen.js +11 -0
- package/dist/ui/dom/worldToScreen.js.map +1 -0
- package/dist/ui/layout/anchor.js +20 -0
- package/dist/ui/layout/anchor.js.map +1 -0
- package/dist/ui/layout/barDrain.js +25 -0
- package/dist/ui/layout/barDrain.js.map +1 -0
- package/dist/ui/layout/fitToViewport.js +17 -0
- package/dist/ui/layout/fitToViewport.js.map +1 -0
- package/dist/ui/layout/focusNav.js +42 -0
- package/dist/ui/layout/focusNav.js.map +1 -0
- package/dist/ui/layout/geometry.js +21 -0
- package/dist/ui/layout/geometry.js.map +1 -0
- package/dist/ui/layout/listWidth.js +10 -0
- package/dist/ui/layout/listWidth.js.map +1 -0
- package/dist/ui/layout/placeTooltip.js +28 -0
- package/dist/ui/layout/placeTooltip.js.map +1 -0
- package/dist/ui/layout/scroll.js +24 -0
- package/dist/ui/layout/scroll.js.map +1 -0
- package/dist/ui/layout/slider.js +20 -0
- package/dist/ui/layout/slider.js.map +1 -0
- package/dist/ui/layout/stack.js +27 -0
- package/dist/ui/layout/stack.js.map +1 -0
- package/dist/ui/layout/wrapRow.js +13 -0
- package/dist/ui/layout/wrapRow.js.map +1 -0
- package/dist/ui.js +85 -0
- package/dist/ui.js.map +1 -0
- package/package.json +115 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Point, type Rect, type Size } from './geometry.js';
|
|
2
|
+
export type TipSide = 'below' | 'above' | 'right' | 'left';
|
|
3
|
+
export interface TooltipOptions {
|
|
4
|
+
/** The side tried first (default 'below'); the opposite one when it does not fit. */
|
|
5
|
+
side?: TipSide;
|
|
6
|
+
/** Between the anchor and the tip (default 4). */
|
|
7
|
+
gap?: number;
|
|
8
|
+
/** Kept clear of the screen's edges (default 4). */
|
|
9
|
+
margin?: number;
|
|
10
|
+
/** Across the side: line up with the anchor's start or centre on it (default 'start'). */
|
|
11
|
+
align?: 'start' | 'center';
|
|
12
|
+
snap?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface TooltipPlacement extends Point {
|
|
15
|
+
/** The side it went on after flipping. */
|
|
16
|
+
side: TipSide;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Where a tooltip of `tip` size goes beside `anchor`: on the preferred side when it fits, flipped to the opposite one
|
|
20
|
+
* when it does not, the roomier of the two when neither does; then slid along the edge to stay on screen.
|
|
21
|
+
*/
|
|
22
|
+
export declare function placeTooltip(anchor: Rect, tip: Size, viewport: Size, options?: TooltipOptions): TooltipPlacement;
|
|
23
|
+
//# sourceMappingURL=placeTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeTooltip.d.ts","sourceRoot":"","sources":["../../../../src/ui/layout/placeTooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B,qFAAqF;IACrF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,0CAA0C;IAC1C,IAAI,EAAE,OAAO,CAAC;CACf;AAkBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,GAAE,cAAmB,GAAG,gBAAgB,CAwBpH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** How far content of `content` length can scroll in a window of `viewport` length. */
|
|
2
|
+
export declare function maxScroll(content: number, viewport: number): number;
|
|
3
|
+
/** A scroll offset kept between the top and the last full window of content. */
|
|
4
|
+
export declare function clampScroll(offset: number, content: number, viewport: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* The smallest scroll that brings an item (`start`, `size` along the scroll axis) fully into view: a list moved by
|
|
7
|
+
* the keyboard follows the focus without jumping when the focus is already visible.
|
|
8
|
+
*/
|
|
9
|
+
export declare function scrollIntoView(offset: number, start: number, size: number, viewport: number, content: number): number;
|
|
10
|
+
/** Below this speed (px a second) a fling has stopped. */
|
|
11
|
+
export declare const FLING_STOP = 8;
|
|
12
|
+
/**
|
|
13
|
+
* A fling's speed after `dtMs`, losing `friction` of it every 60th of a second: the same glide at any frame rate.
|
|
14
|
+
* 0 once it falls under `FLING_STOP`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function stepFling(velocity: number, dtMs: number, friction?: number): number;
|
|
17
|
+
//# sourceMappingURL=scroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../../../src/ui/layout/scroll.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKrH;AAED,0DAA0D;AAC1D,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAO,GAAG,MAAM,CAGjF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A value held to the range and to the nearest `step` above `min` (no step: any value). */
|
|
2
|
+
export declare function quantize(value: number, min: number, max: number, step?: number): number;
|
|
3
|
+
/** Where `value` sits along the range, 0–1. */
|
|
4
|
+
export declare function sliderFraction(value: number, min: number, max: number): number;
|
|
5
|
+
/** The value under a pointer at `px` on a track starting at `trackStart`, `trackLength` long. */
|
|
6
|
+
export declare function sliderValueAt(px: number, trackStart: number, trackLength: number, min: number, max: number, step?: number): number;
|
|
7
|
+
//# sourceMappingURL=slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../../src/ui/layout/slider.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,MAAM,CAMlF;AAED,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,MAAM,CAG7H"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Insets, type Rect, type Size } from './geometry.js';
|
|
2
|
+
export type StackDirection = 'vertical' | 'horizontal';
|
|
3
|
+
/** Where items sit across the stack: its start, middle or end, or stretched to the widest (tallest) one. */
|
|
4
|
+
export type StackAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
5
|
+
export interface StackOptions {
|
|
6
|
+
direction?: StackDirection;
|
|
7
|
+
/** Between two items (default 0). */
|
|
8
|
+
gap?: number;
|
|
9
|
+
/** Inside the stack's edge (default 0). */
|
|
10
|
+
padding?: number | Partial<Insets>;
|
|
11
|
+
align?: StackAlign;
|
|
12
|
+
/** A cross size to align in instead of the widest item's (a column as wide as its window). */
|
|
13
|
+
crossSize?: number;
|
|
14
|
+
/** Whole pixels (pixel-perfect UI). */
|
|
15
|
+
snap?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface StackResult extends Size {
|
|
18
|
+
/** One rect per item, in the order given, relative to the stack's top-left. */
|
|
19
|
+
items: Rect[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Lays items one after another down (or across) with a gap, inside padding. The stack's size is what the items
|
|
23
|
+
* need, so a parent can lay the stack out in turn. Pure, for canvas widgets and DOM/React layouts alike.
|
|
24
|
+
*/
|
|
25
|
+
export declare function stackLayout(sizes: readonly Size[], options?: StackOptions): StackResult;
|
|
26
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/ui/layout/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE/E,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,YAAY,CAAC;AACvD,4GAA4G;AAC5G,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI;IACvC,+EAA+E;IAC/E,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,OAAO,GAAE,YAAiB,GAAG,WAAW,CAkC3F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breaks a row of items (tabs, chips, buttons) into lines no wider than `maxWidth`: each line holds the indices of
|
|
3
|
+
* its items in order. An item wider than the line still gets a line of its own rather than being dropped.
|
|
4
|
+
*/
|
|
5
|
+
export declare function wrapRow(widths: readonly number[], maxWidth: number, gap?: number): number[][];
|
|
6
|
+
//# sourceMappingURL=wrapRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapRow.d.ts","sourceRoot":"","sources":["../../../../src/ui/layout/wrapRow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAI,GAAG,MAAM,EAAE,EAAE,CAkBxF"}
|
package/dist/ui/Bar.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Sprite as n, Texture as o } from "pixi.js";
|
|
2
|
+
import { drainState as c, setDrainValue as u, stepDrain as f } from "./layout/barDrain.js";
|
|
3
|
+
import { Widget as d } from "./Widget.js";
|
|
4
|
+
function h(e, t) {
|
|
5
|
+
const i = new n(o.WHITE);
|
|
6
|
+
return i.tint = e, i.alpha = t, i;
|
|
7
|
+
}
|
|
8
|
+
function a(e, t, i) {
|
|
9
|
+
return i ? Math.round(e * t) : e * t;
|
|
10
|
+
}
|
|
11
|
+
class v extends d {
|
|
12
|
+
constructor(t) {
|
|
13
|
+
super(), this.options = t, this.state = c(t.value ?? 1), this.back = h(t.backColor ?? 0, t.backAlpha ?? 0.5), this.trail = h(t.trailColor ?? 16777215, t.trailAlpha ?? 0.6), this.fill = h(t.color, 1), this.addChild(this.back, this.trail, this.fill), this.resize(t.width, t.height);
|
|
14
|
+
}
|
|
15
|
+
options;
|
|
16
|
+
state;
|
|
17
|
+
back;
|
|
18
|
+
trail;
|
|
19
|
+
fill;
|
|
20
|
+
ticking = !1;
|
|
21
|
+
get value() {
|
|
22
|
+
return this.state.value;
|
|
23
|
+
}
|
|
24
|
+
/** The trail's length (what was held before the last losses), 0–1. */
|
|
25
|
+
get trailValue() {
|
|
26
|
+
return this.state.trail;
|
|
27
|
+
}
|
|
28
|
+
/** Sets the bar, 0–1; `instant` drops the trail with it (a respawn, a new target). */
|
|
29
|
+
setValue(t, i = !1) {
|
|
30
|
+
if (t === this.state.value && !i) return this;
|
|
31
|
+
if (u(this.state, t, this.options), i && (this.state.trail = this.state.value), this.redraw(), this.state.trail > this.state.value && !this.ticking) {
|
|
32
|
+
const s = this.host;
|
|
33
|
+
s && (this.ticking = !0, s.animate(this));
|
|
34
|
+
}
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
/** Advances the drain; a bar under a `UiRoot` is ticked for you, one standing alone is ticked by the game. */
|
|
38
|
+
tick(t) {
|
|
39
|
+
return this.destroyed ? this.ticking = !1 : (f(this.state, t, this.options), this.redraw(), this.ticking = this.state.trail > this.state.value, this.ticking);
|
|
40
|
+
}
|
|
41
|
+
redraw() {
|
|
42
|
+
const t = this.boxW, i = this.boxH, s = this.host?.pixelPerfect ?? !1;
|
|
43
|
+
if (this.back.setSize(t, i), this.options.vertical) {
|
|
44
|
+
const r = a(this.state.trail, i, s), l = a(this.state.value, i, s);
|
|
45
|
+
this.trail.setSize(t, r), this.trail.position.set(0, i - r), this.fill.setSize(t, l), this.fill.position.set(0, i - l);
|
|
46
|
+
} else
|
|
47
|
+
this.trail.setSize(a(this.state.trail, t, s), i), this.fill.setSize(a(this.state.value, t, s), i);
|
|
48
|
+
this.alpha = this.enabled ? 1 : 0.5;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
v as Bar
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=Bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bar.js","sources":["../../src/ui/Bar.ts"],"sourcesContent":["import { Sprite, Texture } from 'pixi.js';\nimport { drainState, setDrainValue, stepDrain, type DrainOptions, type DrainState } from './layout/barDrain';\nimport type { UiTicking } from './UiHost';\nimport { Widget } from './Widget';\n\nexport interface BarOptions extends DrainOptions {\n width: number;\n height: number;\n /** The bar itself. */\n color: number;\n /** The trail behind it after a loss (default white at 0.6 alpha). */\n trailColor?: number;\n trailAlpha?: number;\n /** The empty part (default black at half alpha). */\n backColor?: number;\n backAlpha?: number;\n /** Fills upward instead of rightward. */\n vertical?: boolean;\n /** Starting value, 0–1 (default 1). */\n value?: number;\n}\n\n/** One white texel stretched and tinted: three sprites a bar, no Graphics rebuilt while it drains. */\nfunction strip(color: number, alpha: number): Sprite {\n const s = new Sprite(Texture.WHITE);\n s.tint = color;\n s.alpha = alpha;\n return s;\n}\n\n/** A fraction of a length, on whole pixels when `snap`. */\nfunction part(f: number, full: number, snap: boolean): number {\n return snap ? Math.round(f * full) : f * full;\n}\n\n/**\n * A health or progress bar with a delayed drain: a loss shows as a trail that holds a moment, then drains down to\n * the bar, so the player sees how much a hit took. Ticks only while the trail is draining.\n */\nexport class Bar extends Widget implements UiTicking {\n private readonly state: DrainState;\n private readonly back: Sprite;\n private readonly trail: Sprite;\n private readonly fill: Sprite;\n private ticking = false;\n\n constructor(private readonly options: BarOptions) {\n super();\n this.state = drainState(options.value ?? 1);\n this.back = strip(options.backColor ?? 0x000000, options.backAlpha ?? 0.5);\n this.trail = strip(options.trailColor ?? 0xffffff, options.trailAlpha ?? 0.6);\n this.fill = strip(options.color, 1);\n this.addChild(this.back, this.trail, this.fill);\n this.resize(options.width, options.height);\n }\n\n get value(): number {\n return this.state.value;\n }\n\n /** The trail's length (what was held before the last losses), 0–1. */\n get trailValue(): number {\n return this.state.trail;\n }\n\n /** Sets the bar, 0–1; `instant` drops the trail with it (a respawn, a new target). */\n setValue(value: number, instant = false): this {\n if (value === this.state.value && !instant) return this;\n setDrainValue(this.state, value, this.options);\n if (instant) this.state.trail = this.state.value;\n this.redraw();\n if (this.state.trail > this.state.value && !this.ticking) {\n const host = this.host;\n if (host) {\n this.ticking = true;\n host.animate(this);\n }\n }\n return this;\n }\n\n /** Advances the drain; a bar under a `UiRoot` is ticked for you, one standing alone is ticked by the game. */\n tick(dtMs: number): boolean {\n if (this.destroyed) return (this.ticking = false);\n stepDrain(this.state, dtMs, this.options);\n this.redraw();\n this.ticking = this.state.trail > this.state.value;\n return this.ticking;\n }\n\n protected redraw(): void {\n const w = this.boxW;\n const h = this.boxH;\n const snap = this.host?.pixelPerfect ?? false;\n this.back.setSize(w, h);\n if (this.options.vertical) {\n const t = part(this.state.trail, h, snap);\n const v = part(this.state.value, h, snap);\n this.trail.setSize(w, t);\n this.trail.position.set(0, h - t);\n this.fill.setSize(w, v);\n this.fill.position.set(0, h - v);\n } else {\n this.trail.setSize(part(this.state.trail, w, snap), h);\n this.fill.setSize(part(this.state.value, w, snap), h);\n }\n this.alpha = this.enabled ? 1 : 0.5;\n }\n}\n"],"names":["strip","color","alpha","s","Sprite","Texture","part","f","full","snap","Bar","Widget","options","drainState","value","instant","setDrainValue","host","dtMs","stepDrain","w","h","t","v"],"mappings":";;;AAuBA,SAASA,EAAMC,GAAeC,GAAuB;AACnD,QAAMC,IAAI,IAAIC,EAAOC,EAAQ,KAAK;AAClC,SAAAF,EAAE,OAAOF,GACTE,EAAE,QAAQD,GACHC;AACT;AAGA,SAASG,EAAKC,GAAWC,GAAcC,GAAuB;AAC5D,SAAOA,IAAO,KAAK,MAAMF,IAAIC,CAAI,IAAID,IAAIC;AAC3C;AAMO,MAAME,UAAYC,EAA4B;AAAA,EAOnD,YAA6BC,GAAqB;AAChD,UAAA,GAD2B,KAAA,UAAAA,GAE3B,KAAK,QAAQC,EAAWD,EAAQ,SAAS,CAAC,GAC1C,KAAK,OAAOZ,EAAMY,EAAQ,aAAa,GAAUA,EAAQ,aAAa,GAAG,GACzE,KAAK,QAAQZ,EAAMY,EAAQ,cAAc,UAAUA,EAAQ,cAAc,GAAG,GAC5E,KAAK,OAAOZ,EAAMY,EAAQ,OAAO,CAAC,GAClC,KA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,MAAM,SAAS,IAAI,GAAGD,IAAIC,CAAC,GAChC,KAAK,KAAK,QAAQF,GAAGG,CAAC,GACtB,KAAK,KAAK,SAAS,IAAI,GAAGF,IAAIE,CAAC;AAAA,IACjC;AACE,WAAK,MAAM,QAAQjB,EAAK,KAAK,MAAM,OAAOc,GAAGX,CAAI,GAAGY,CAAC,GACrD,KAAK,KAAK,QAAQf,EAAK,KAAK,MAAM,OAAOc,GAAGX,CAAI,GAAGY,CAAC;AAEtD,SAAK,QAAQ,KAAK,UAAU,IAAI;AAAA,EAClC;AACF;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Rectangle as c } from "pixi.js";
|
|
2
|
+
import { Panel as f } from "./Panel.js";
|
|
3
|
+
import { Widget as d, sizeOf as l } from "./Widget.js";
|
|
4
|
+
function u(o) {
|
|
5
|
+
for (let t = o; t; t = t.parent) if (t.suppressesTaps === !0) return !0;
|
|
6
|
+
return !1;
|
|
7
|
+
}
|
|
8
|
+
class v extends d {
|
|
9
|
+
constructor(t) {
|
|
10
|
+
super(), this.options = t, this.focusable = !0, this.onClick = t.onClick ?? null;
|
|
11
|
+
const s = t.skin;
|
|
12
|
+
for (const i of [s.normal, s.hover, s.pressed, s.disabled])
|
|
13
|
+
if (i && !this.faces.has(i)) {
|
|
14
|
+
const e = new f(i, t.width, t.height, { blocksPointer: !1 });
|
|
15
|
+
this.faces.set(i, e), this.addChild(e);
|
|
16
|
+
}
|
|
17
|
+
this.focusFace = s.focus ? new f(s.focus, t.width, t.height, { blocksPointer: !1 }) : null, this.focusFace && this.addChild(this.focusFace), this.content = t.content ?? null, this.content && this.addChild(this.content), this.makeInteractive(), this.cursor = "pointer", this.hitArea = new c(0, 0, 0, 0), this.on("pointerover", () => this.setPointer(!0, this.pressing)), this.on("pointerout", () => this.setPointer(!1, this.pressing)), this.on("pointerdown", () => this.setPointer(this.hovered, !0)), this.on("pointerup", () => this.setPointer(this.hovered, !1)), this.on("pointerupoutside", () => this.setPointer(!1, !1)), this.on("pointercancel", () => this.setPointer(!1, !1)), this.on("pointertap", () => {
|
|
18
|
+
u(this) || this.click();
|
|
19
|
+
}), this.resize(t.width, t.height);
|
|
20
|
+
}
|
|
21
|
+
options;
|
|
22
|
+
onClick;
|
|
23
|
+
faces = /* @__PURE__ */ new Map();
|
|
24
|
+
focusFace;
|
|
25
|
+
content;
|
|
26
|
+
hovered = !1;
|
|
27
|
+
pressing = !1;
|
|
28
|
+
get state() {
|
|
29
|
+
return this.enabled ? this.pressing ? "pressed" : this.hovered ? "hover" : "normal" : "disabled";
|
|
30
|
+
}
|
|
31
|
+
/** Runs the button's action, if it is enabled. */
|
|
32
|
+
click() {
|
|
33
|
+
this.enabled && this.onClick?.();
|
|
34
|
+
}
|
|
35
|
+
activate() {
|
|
36
|
+
this.click();
|
|
37
|
+
}
|
|
38
|
+
childResized(t) {
|
|
39
|
+
t === this.content && this.redraw();
|
|
40
|
+
}
|
|
41
|
+
setPointer(t, s) {
|
|
42
|
+
t === this.hovered && s === this.pressing || (this.hovered = t, this.pressing = s, this.redraw());
|
|
43
|
+
}
|
|
44
|
+
redraw() {
|
|
45
|
+
const t = this.options.skin, s = this.state, i = (s === "disabled" ? t.disabled : s === "pressed" ? t.pressed ?? t.hover : s === "hover" ? t.hover : void 0) ?? t.normal;
|
|
46
|
+
for (const [e, h] of this.faces)
|
|
47
|
+
h.visible = e === i, (h.boxWidth !== this.boxW || h.boxHeight !== this.boxH) && h.resize(this.boxW, this.boxH);
|
|
48
|
+
if (this.focusFace && (this.focusFace.visible = this.focused && this.enabled, (this.focusFace.boxWidth !== this.boxW || this.focusFace.boxHeight !== this.boxH) && this.focusFace.resize(this.boxW, this.boxH)), this.hitArea instanceof c && (this.hitArea.width = this.boxW, this.hitArea.height = this.boxH), this.content) {
|
|
49
|
+
const e = l(this.content), h = s === "pressed" ? t.pressOffset ?? 1 : 0, n = this.host?.pixelPerfect ?? !1, r = (this.boxW - e.width) / 2, a = (this.boxH - e.height) / 2 + h;
|
|
50
|
+
this.content.position.set(n ? Math.round(r) : r, n ? Math.round(a) : a);
|
|
51
|
+
}
|
|
52
|
+
this.alpha = s === "disabled" && !t.disabled ? 0.5 : 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
v as Button
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../src/ui/Button.ts"],"sourcesContent":["import { Container, Rectangle } from 'pixi.js';\nimport { Panel, type PanelSkin } from './Panel';\nimport { sizeOf, Widget } from './Widget';\n\nexport type ButtonState = 'normal' | 'hover' | 'pressed' | 'disabled';\n\nexport interface ButtonSkin {\n normal: PanelSkin;\n hover?: PanelSkin;\n pressed?: PanelSkin;\n disabled?: PanelSkin;\n /** Drawn over the face while it has keyboard or gamepad focus (a ring, a brighter frame). */\n focus?: PanelSkin;\n /** How far the content drops while pressed (px, default 1): a pressed face is the same face a pixel lower. */\n pressOffset?: number;\n}\n\nexport interface ButtonOptions {\n width: number;\n height: number;\n skin: ButtonSkin;\n /**\n * Centred on the face: a `Label`, an icon, anything. A widget that changes size by itself (a `Label` given new\n * text) is centred again at once; anything else, after `resize` or a state change.\n */\n content?: Container;\n onClick?: () => void;\n}\n\n/** Walks up for a scroll view that was just dragged: lifting a finger after scrolling a list is not a tap. */\nfunction tapSuppressed(c: Container | null): boolean {\n for (let p = c; p; p = p.parent) if ((p as { suppressesTaps?: boolean }).suppressesTaps === true) return true;\n return false;\n}\n\n/**\n * A pressable button: normal, hover, pressed and disabled faces, a focus overlay, pointer and touch through Pixi's\n * events, and Accept from the keyboard or a gamepad through the focus manager.\n */\nexport class Button extends Widget {\n onClick: (() => void) | null;\n private readonly faces = new Map<PanelSkin, Panel>();\n private readonly focusFace: Panel | null;\n private readonly content: Container | null;\n private hovered = false;\n private pressing = false;\n\n constructor(private readonly options: ButtonOptions) {\n super();\n this.focusable = true;\n this.onClick = options.onClick ?? null;\n const skin = options.skin;\n // one panel per distinct skin, shown in turn: no redraw when the state changes\n for (const s of [skin.normal, skin.hover, skin.pressed, skin.disabled]) {\n if (s && !this.faces.has(s)) {\n const face = new Panel(s, options.width, options.height, { blocksPointer: false });\n this.faces.set(s, face);\n this.addChild(face);\n }\n }\n this.focusFace = skin.focus ? new Panel(skin.focus, options.width, options.height, { blocksPointer: false }) : null;\n if (this.focusFace) this.addChild(this.focusFace);\n this.content = options.content ?? null;\n if (this.content) this.addChild(this.content);\n this.makeInteractive();\n this.cursor = 'pointer';\n this.hitArea = new Rectangle(0, 0, 0, 0);\n this.on('pointerover', () => this.setPointer(true, this.pressing));\n this.on('pointerout', () => this.setPointer(false, this.pressing));\n this.on('pointerdown', () => this.setPointer(this.hovered, true));\n this.on('pointerup', () => this.setPointer(this.hovered, false));\n this.on('pointerupoutside', () => this.setPointer(false, false));\n this.on('pointercancel', () => this.setPointer(false, false));\n // a tap: down and up on the button, by mouse, pen or finger\n this.on('pointertap', () => {\n if (!tapSuppressed(this)) this.click();\n });\n this.resize(options.width, options.height);\n }\n\n get state(): ButtonState {\n if (!this.enabled) return 'disabled';\n if (this.pressing) return 'pressed';\n return this.hovered ? 'hover' : 'normal';\n }\n\n /** Runs the button's action, if it is enabled. */\n click(): void {\n if (this.enabled) this.onClick?.();\n }\n\n override activate(): void {\n this.click();\n }\n\n protected override childResized(child: Widget): void {\n if (child === this.content) this.redraw();\n }\n\n private setPointer(hovered: boolean, pressing: boolean): void {\n if (hovered === this.hovered && pressing === this.pressing) return;\n this.hovered = hovered;\n this.pressing = pressing;\n this.redraw();\n }\n\n protected redraw(): void {\n const skin = this.options.skin;\n const state = this.state;\n const wanted = (state === 'disabled' ? skin.disabled : state === 'pressed' ? (skin.pressed ?? skin.hover) : state === 'hover' ? skin.hover : undefined) ?? skin.normal;\n for (const [s, face] of this.faces) {\n face.visible = s === wanted;\n if (face.boxWidth !== this.boxW || face.boxHeight !== this.boxH) face.resize(this.boxW, this.boxH);\n }\n if (this.focusFace) {\n this.focusFace.visible = this.focused && this.enabled;\n if (this.focusFace.boxWidth !== this.boxW || this.focusFace.boxHeight !== this.boxH) this.focusFace.resize(this.boxW, this.boxH);\n }\n if (this.hitArea instanceof Rectangle) {\n this.hitArea.width = this.boxW;\n this.hitArea.height = this.boxH;\n }\n if (this.content) {\n const s = sizeOf(this.content);\n const drop = state === 'pressed' ? (skin.pressOffset ?? 1) : 0;\n const snap = this.host?.pixelPerfect ?? false;\n const x = (this.boxW - s.width) / 2;\n const y = (this.boxH - s.height) / 2 + drop;\n this.content.position.set(snap ? Math.round(x) : x, snap ? Math.round(y) : y);\n }\n // without a disabled face, a disabled button fades\n this.alpha = state === 'disabled' && !skin.disabled ? 0.5 : 1;\n }\n}\n"],"names":["tapSuppressed","c","p","Button","Widget","options","skin","s","face","Panel","Rectangle","child","hovered","pressing","state","wanted","sizeOf","drop","snap","x","y"],"mappings":";;;AA8BA,SAASA,EAAcC,GAA8B;AACnD,WAASC,IAAID,GAAGC,GAAGA,IAAIA,EAAE,OAAQ,KAAKA,EAAmC,mBAAmB,GAAM,QAAO;AACzG,SAAO;AACT;AAMO,MAAMC,UAAeC,EAAO;AAAA,EAQjC,YAA6BC,GAAwB;AACnD,UAAA,GAD2B,KAAA,UAAAA,GAE3B,KAAK,YAAY,IACjB,KAAK,UAAUA,EAAQ,WAAW;AAClC,UAAMC,IAAOD,EAAQ;AAErB,eAAWE,KAAK,CAACD,EAAK,QAAQA,EAAK,OAAOA,EAAK,SAASA,EAAK,QAAQ;AACnE,UAAIC,KAAK,CAAC,KAAK,MAAM,IAAIA,CAAC,GAAG;AAC3B,cAAMC,IAAO,IAAIC,EAAMF,GAAGF,EAAQ,OAAOA,EAAQ,QAAQ,EAAE,eAAe,GAAA,CAAO;AACjF,aAAK,MAAM,IAAIE,GAAGC,CAAI,GACtB,KAAK,SAASA,CAAI;AAAA,MACpB;AAEF,SAAK,YAAYF,EAAK,QAAQ,IAAIG,EAAMH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|
1
|
+
import { Sprite as d, Texture as a, Container as l, Rectangle as m } from "pixi.js";
|
|
2
|
+
import { fitToViewport as c } from "./layout/fitToViewport.js";
|
|
3
|
+
import { Panel as w } from "./Panel.js";
|
|
4
|
+
import { Widget as p, sizeOf as n } from "./Widget.js";
|
|
5
|
+
class H extends p {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
super(), this.options = t, this.onClose = t.onClose ?? null, this.dim.tint = t.dimColor ?? 0, this.dim.alpha = t.dimAlpha ?? 0.5, this.dim.eventMode = "static", this.dim.on("pointertap", () => {
|
|
8
|
+
(t.dismissable ?? !0) && this.close();
|
|
9
|
+
});
|
|
10
|
+
const i = this.windowHeight();
|
|
11
|
+
this.frame = new w(t.frame, t.width, i), this.window.addChild(this.frame, t.content), this.addChild(this.dim, this.window), this.makeInteractive(), this.boxW = t.width, this.boxH = i;
|
|
12
|
+
}
|
|
13
|
+
options;
|
|
14
|
+
onClose;
|
|
15
|
+
dim = new d(a.WHITE);
|
|
16
|
+
window = new l();
|
|
17
|
+
frame;
|
|
18
|
+
root = null;
|
|
19
|
+
/** The window's height: the one given, or the content's with its padding. */
|
|
20
|
+
windowHeight() {
|
|
21
|
+
return this.options.height !== void 0 ? this.options.height : n(this.options.content).height + 2 * (this.options.padding ?? 8);
|
|
22
|
+
}
|
|
23
|
+
get isOpen() {
|
|
24
|
+
return this.root !== null;
|
|
25
|
+
}
|
|
26
|
+
open(t) {
|
|
27
|
+
return this.root ? this : (this.root = t, t.openModal(this), this);
|
|
28
|
+
}
|
|
29
|
+
close() {
|
|
30
|
+
const t = this.root;
|
|
31
|
+
t && (this.root = null, t.closeModal(this), this.onClose?.());
|
|
32
|
+
}
|
|
33
|
+
cancel() {
|
|
34
|
+
return this.options.dismissable ?? !0 ? (this.close(), !0) : !1;
|
|
35
|
+
}
|
|
36
|
+
layoutFor(t) {
|
|
37
|
+
this.dim.setSize(t.width, t.height), this.hitArea = new m(0, 0, t.width, t.height);
|
|
38
|
+
const i = this.host?.pixelPerfect ?? !1, o = this.windowHeight();
|
|
39
|
+
this.boxH = o;
|
|
40
|
+
const s = c({ width: this.options.width, height: o }, t, {
|
|
41
|
+
margin: this.options.margin ?? 8,
|
|
42
|
+
centre: !0,
|
|
43
|
+
minScale: i ? 1 : 0.5,
|
|
44
|
+
snap: i
|
|
45
|
+
});
|
|
46
|
+
this.window.position.set(s.x, s.y), this.window.scale.set(s.scale), this.frame.resize(s.width, s.height);
|
|
47
|
+
const e = this.options.padding ?? 8, r = n(this.options.content), h = (s.width - r.width) / 2;
|
|
48
|
+
this.options.content.position.set(i ? Math.round(Math.max(e, h)) : Math.max(e, h), e);
|
|
49
|
+
}
|
|
50
|
+
redraw() {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
H as Dialog
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../src/ui/Dialog.ts"],"sourcesContent":["import { Container, Rectangle, Sprite, Texture } from 'pixi.js';\nimport { fitToViewport } from './layout/fitToViewport';\nimport type { Size } from './layout/geometry';\nimport { Panel, type PanelSkin } from './Panel';\nimport type { UiModal, UiRoot } from './UiRoot';\nimport { sizeOf, Widget } from './Widget';\n\nexport interface DialogOptions {\n width: number;\n /**\n * The window's height. Left out, it is the content's height plus the padding above and below, measured again\n * whenever the dialog is laid out (`UiRoot.layout()` after the content changed size).\n */\n height?: number;\n frame: PanelSkin;\n /** The body: a `Stack` of text and buttons, anything. Laid `padding` in from the frame. */\n content: Container;\n padding?: number;\n /** The screen behind it is dimmed by this (default black at 0.5); every press on it is eaten. */\n dimColor?: number;\n dimAlpha?: number;\n /** Cancel (Esc, the pad's B) or a press outside closes it (default true). */\n dismissable?: boolean;\n /** Kept clear of the screen's edges (default 8). */\n margin?: number;\n onClose?: () => void;\n}\n\n/**\n * A modal window: the world behind it dimmed and deaf to presses, keyboard and gamepad focus trapped inside it,\n * centred and kept inside the screen however small it gets (shrunk, never past its whole scale under pixel art).\n */\nexport class Dialog extends Widget implements UiModal {\n onClose: (() => void) | null;\n private readonly dim = new Sprite(Texture.WHITE);\n private readonly window = new Container();\n private readonly frame: Panel;\n private root: UiRoot | null = null;\n\n constructor(private readonly options: DialogOptions) {\n super();\n this.onClose = options.onClose ?? null;\n this.dim.tint = options.dimColor ?? 0x000000;\n this.dim.alpha = options.dimAlpha ?? 0.5;\n this.dim.eventMode = 'static';\n this.dim.on('pointertap', () => {\n if (options.dismissable ?? true) this.close();\n });\n const height = this.windowHeight();\n this.frame = new Panel(options.frame, options.width, height);\n this.window.addChild(this.frame, options.content);\n this.addChild(this.dim, this.window);\n // the dim is the dialog's own: every press on it is the UI's\n this.makeInteractive();\n this.boxW = options.width;\n this.boxH = height;\n }\n\n /** The window's height: the one given, or the content's with its padding. */\n private windowHeight(): number {\n if (this.options.height !== undefined) return this.options.height;\n return sizeOf(this.options.content).height + 2 * (this.options.padding ?? 8);\n }\n\n get isOpen(): boolean {\n return this.root !== null;\n }\n\n open(root: UiRoot): this {\n if (this.root) return this;\n this.root = root;\n root.openModal(this);\n return this;\n }\n\n close(): void {\n const root = this.root;\n if (!root) return;\n this.root = null;\n root.closeModal(this);\n this.onClose?.();\n }\n\n cancel(): boolean {\n if (!(this.options.dismissable ?? true)) return false;\n this.close();\n return true;\n }\n\n layoutFor(viewport: Size): void {\n this.dim.setSize(viewport.width, viewport.height);\n this.hitArea = new Rectangle(0, 0, viewport.width, viewport.height);\n const pixel = this.host?.pixelPerfect ?? false;\n const height = this.windowHeight();\n this.boxH = height;\n const fit = fitToViewport({ width: this.options.width, height }, viewport, {\n margin: this.options.margin ?? 8,\n centre: true,\n minScale: pixel ? 1 : 0.5,\n snap: pixel,\n });\n this.window.position.set(fit.x, fit.y);\n this.window.scale.set(fit.scale);\n this.frame.resize(fit.width, fit.height);\n const pad = this.options.padding ?? 8;\n const s = sizeOf(this.options.content);\n const x = (fit.width - s.width) / 2;\n this.options.content.position.set(pixel ? Math.round(Math.max(pad, x)) : Math.max(pad, x), pad);\n }\n\n protected redraw(): void {}\n}\n"],"names":["Dialog","Widget","options","height","Panel","Sprite","Texture","Container","sizeOf","root","viewport","Rectangle","pixel","fit","fitToViewport","pad","s","x"],"mappings":";;;;AAgCO,MAAMA,UAAeC,EAA0B;AAAA,EAOpD,YAA6BC,GAAwB;AACnD,UAAA,GAD2B,KAAA,UAAAA,GAE3B,KAAK,UAAUA,EAAQ,WAAW,MAClC,KAAK,IAAI,OAAOA,EAAQ,YAAY,GACpC,KAAK,IAAI,QAAQA,EAAQ,YAAY,KACrC,KAAK,IAAI,YAAY,UACrB,KAAK,IAAI,GAAG,cAAc,MAAM;AAC9B,OAAIA,EAAQ,eAAe,OAAM,KAAK,MAAA;AAAA,IACxC,CAAC;AACD,UAAMC,IAAS,KAAK,aAAA;AACpB,SAAK,QAAQ,IAAIC,EAAMF,EAAQ,OAAOA,EAAQ,OAAOC,CAAM,GAC3D,KAAK,OAAO,SAAS,KAAK,OAAOD,EAAQ,OAAO,GAChD,KAAK,SAAS,KAAK,KAAK,KAAK,MAAM,GAEnC,KAAK,gBAAA,GACL,KAAK,OAAOA,EAAQ,OACpB,KAAK,OAAOC;AAAA,EACd;AAAA,EAjB6B;AAAA,EAN7B;AAAA,EACiB,MAAM,IAAIE,EAAOC,EAAQ,KAAK;AAAA,EAC9B,SAAS,IAAIC,EAAA;AAAA,EACb;AAAA,EACT,OAAsB;AAAA;AAAA,EAsBtB,eAAuB;AAC7B,WAAI,KAAK,QAAQ,WAAW,SAAkB,KAAK,QAAQ,SACpDC,EAAO,KAAK,QAAQ,OAAO,EAAE,SAAS,KAAK,KAAK,QAAQ,WAAW;AAAA,EAC5E;AAAA,EAEA,IAAI,SAAkB;AACpB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,KAAKC,GAAoB;AACvB,WAAI,KAAK,OAAa,QACtB,KAAK,OAAOA,GACZA,EAAK,UAAU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js";
|
|
2
|
+
import { Widget as h } from "./Widget.js";
|
|
3
|
+
const f = {
|
|
4
|
+
up: "ui_up",
|
|
5
|
+
down: "ui_down",
|
|
6
|
+
left: "ui_left",
|
|
7
|
+
right: "ui_right",
|
|
8
|
+
accept: "ui_accept",
|
|
9
|
+
cancel: "ui_cancel",
|
|
10
|
+
next: "ui_next",
|
|
11
|
+
prev: "ui_prev"
|
|
12
|
+
}, p = ["up", "down", "left", "right"];
|
|
13
|
+
class x {
|
|
14
|
+
constructor(t, e = f) {
|
|
15
|
+
this.bindings = e, this.scopes.push({ container: t, onCancel: null });
|
|
16
|
+
}
|
|
17
|
+
bindings;
|
|
18
|
+
scopes = [];
|
|
19
|
+
list = null;
|
|
20
|
+
current = null;
|
|
21
|
+
get focused() {
|
|
22
|
+
return this.current;
|
|
23
|
+
}
|
|
24
|
+
/** The focusable widgets changed (added, removed, shown, hidden, enabled): collect them again on the next move. */
|
|
25
|
+
invalidate() {
|
|
26
|
+
this.list = null, this.current && (this.current.destroyed || !this.current.canFocus() || !this.inScope(this.current)) && this.focus(null);
|
|
27
|
+
}
|
|
28
|
+
/** Traps focus inside `container` until `popScope`; `onCancel` answers Cancel there (true when it used it). */
|
|
29
|
+
pushScope(t, e = null) {
|
|
30
|
+
this.scopes.push({ container: t, onCancel: e }), this.list = null, this.focus(null);
|
|
31
|
+
}
|
|
32
|
+
popScope(t) {
|
|
33
|
+
const e = this.scopes.findIndex((s) => s.container === t);
|
|
34
|
+
e <= 0 || (this.scopes.splice(e), this.list = null, this.focus(null));
|
|
35
|
+
}
|
|
36
|
+
/** The innermost scope's container (the open dialog, or the root). */
|
|
37
|
+
get scope() {
|
|
38
|
+
return this.scopes[this.scopes.length - 1].container;
|
|
39
|
+
}
|
|
40
|
+
focus(t) {
|
|
41
|
+
if (t !== this.current && (this.current?.setFocused(!1), this.current = t, !!t)) {
|
|
42
|
+
t.setFocused(!0);
|
|
43
|
+
for (let e = t.parent; e; e = e.parent) e.reveal?.(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Moves focus one way; the first press with nothing focused lands on the top-left widget. */
|
|
47
|
+
move(t) {
|
|
48
|
+
const e = this.widgets();
|
|
49
|
+
if (e.length === 0) return !1;
|
|
50
|
+
const s = e.map(a), n = this.current ? e.indexOf(this.current) : -1, r = n < 0 ? u(s) : o(s, n, t);
|
|
51
|
+
return r < 0 || r === n ? !1 : (this.focus(e[r]), !0);
|
|
52
|
+
}
|
|
53
|
+
/** Tab (1) or Shift+Tab (−1), in tree order, wrapping. */
|
|
54
|
+
step(t) {
|
|
55
|
+
const e = this.widgets();
|
|
56
|
+
if (e.length === 0) return !1;
|
|
57
|
+
const s = this.current ? e.indexOf(this.current) : -1;
|
|
58
|
+
return this.focus(e[l(e.length, s, t)]), !0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Reads one step of input; call it between the game's `actions.poll()` and `endStep()`. True when the UI used a
|
|
62
|
+
* press, so the game leaves it alone.
|
|
63
|
+
*/
|
|
64
|
+
handle(t) {
|
|
65
|
+
const e = this.bindings;
|
|
66
|
+
let s = !1;
|
|
67
|
+
for (const n of p)
|
|
68
|
+
t.pressed(e[n]) && (s = (this.current?.navigate(n) ?? !1) || this.move(n) || s);
|
|
69
|
+
return t.pressed(e.next) && (s = this.step(1) || s), t.pressed(e.prev) && (s = this.step(-1) || s), t.pressed(e.accept) && this.current?.canFocus() && (this.current.activate(), s = !0), t.pressed(e.cancel) && (this.scopes[this.scopes.length - 1].onCancel?.() ? s = !0 : this.current && (this.focus(null), s = !0)), s;
|
|
70
|
+
}
|
|
71
|
+
inScope(t) {
|
|
72
|
+
for (let e = t; e; e = e.parent) if (e === this.scope) return !0;
|
|
73
|
+
return !1;
|
|
74
|
+
}
|
|
75
|
+
widgets() {
|
|
76
|
+
if (!this.list) {
|
|
77
|
+
const t = [];
|
|
78
|
+
c(this.scope, t), this.list = t;
|
|
79
|
+
}
|
|
80
|
+
return this.list.filter((t) => !t.destroyed && t.canFocus());
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function c(i, t) {
|
|
84
|
+
if (i.visible) {
|
|
85
|
+
i instanceof h && i.focusable && t.push(i);
|
|
86
|
+
for (const e of i.children) c(e, t);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function a(i) {
|
|
90
|
+
const t = i.getBounds();
|
|
91
|
+
return { x: t.x, y: t.y, width: t.width, height: t.height };
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
f as DEFAULT_NAV,
|
|
95
|
+
x as FocusManager
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=FocusManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusManager.js","sources":["../../src/ui/FocusManager.ts"],"sourcesContent":["import type { Container } from 'pixi.js';\nimport { firstFocus, linearFocus, nextFocus, type NavDirection } from './layout/focusNav';\nimport type { Rect } from './layout/geometry';\nimport { Widget } from './Widget';\n\n/** Anything that answers `pressed(action)`: the engine's `Actions`, or a game's own input. */\nexport interface NavInput {\n pressed(action: string): boolean;\n}\n\n/** The action names the UI reads; a game binds them in its `Actions` (`ui_up: ['ArrowUp', 'pad:up', 'pad:ly-']`…). */\nexport interface NavBindings {\n up: string;\n down: string;\n left: string;\n right: string;\n accept: string;\n cancel: string;\n /** Tab order, for a keyboard. */\n next: string;\n prev: string;\n}\n\nexport const DEFAULT_NAV: NavBindings = {\n up: 'ui_up',\n down: 'ui_down',\n left: 'ui_left',\n right: 'ui_right',\n accept: 'ui_accept',\n cancel: 'ui_cancel',\n next: 'ui_next',\n prev: 'ui_prev',\n};\n\n/** A container focus is kept inside (a dialog's trap), and what Cancel does there. */\ninterface Scope {\n container: Container;\n onCancel: (() => boolean) | null;\n}\n\nconst DIRECTIONS: readonly NavDirection[] = ['up', 'down', 'left', 'right'];\n\n/**\n * Keyboard and gamepad navigation between widgets: directions move spatially (to the nearest widget that way), Tab\n * steps in tree order, Accept activates, Cancel asks the innermost scope. A modal pushes a scope, and focus cannot\n * leave it until it is popped (the focus trap). The list of focusable widgets is collected only when stale.\n */\nexport class FocusManager {\n private readonly scopes: Scope[] = [];\n private list: Widget[] | null = null;\n private current: Widget | null = null;\n\n constructor(\n root: Container,\n readonly bindings: NavBindings = DEFAULT_NAV,\n ) {\n this.scopes.push({ container: root, onCancel: null });\n }\n\n get focused(): Widget | null {\n return this.current;\n }\n\n /** The focusable widgets changed (added, removed, shown, hidden, enabled): collect them again on the next move. */\n invalidate(): void {\n this.list = null;\n if (this.current && (this.current.destroyed || !this.current.canFocus() || !this.inScope(this.current))) this.focus(null);\n }\n\n /** Traps focus inside `container` until `popScope`; `onCancel` answers Cancel there (true when it used it). */\n pushScope(container: Container, onCancel: (() => boolean) | null = null): void {\n this.scopes.push({ container, onCancel });\n this.list = null;\n this.focus(null);\n }\n\n popScope(container: Container): void {\n const i = this.scopes.findIndex((s) => s.container === container);\n if (i <= 0) return;\n this.scopes.splice(i);\n this.list = null;\n this.focus(null);\n }\n\n /** The innermost scope's container (the open dialog, or the root). */\n get scope(): Container {\n return this.scopes[this.scopes.length - 1]!.container;\n }\n\n focus(w: Widget | null): void {\n if (w === this.current) return;\n this.current?.setFocused(false);\n this.current = w;\n if (!w) return;\n w.setFocused(true);\n // a scroll view holding it brings it into view\n for (let p = w.parent; p; p = p.parent) (p as { reveal?: (c: Widget) => void }).reveal?.(w);\n }\n\n /** Moves focus one way; the first press with nothing focused lands on the top-left widget. */\n move(dir: NavDirection): boolean {\n const list = this.widgets();\n if (list.length === 0) return false;\n const rects = list.map(rectOf);\n const i = this.current ? list.indexOf(this.current) : -1;\n const next = i < 0 ? firstFocus(rects) : nextFocus(rects, i, dir);\n if (next < 0 || next === i) return false;\n this.focus(list[next]!);\n return true;\n }\n\n /** Tab (1) or Shift+Tab (−1), in tree order, wrapping. */\n step(step: 1 | -1): boolean {\n const list = this.widgets();\n if (list.length === 0) return false;\n const i = this.current ? list.indexOf(this.current) : -1;\n this.focus(list[linearFocus(list.length, i, step)]!);\n return true;\n }\n\n /**\n * Reads one step of input; call it between the game's `actions.poll()` and `endStep()`. True when the UI used a\n * press, so the game leaves it alone.\n */\n handle(input: NavInput): boolean {\n const b = this.bindings;\n let used = false;\n for (const dir of DIRECTIONS) {\n if (!input.pressed(b[dir])) continue;\n // a focused widget may use the direction itself (a slider steps on left/right)\n used = (this.current?.navigate(dir) ?? false) || this.move(dir) || used;\n }\n if (input.pressed(b.next)) used = this.step(1) || used;\n if (input.pressed(b.prev)) used = this.step(-1) || used;\n if (input.pressed(b.accept) && this.current?.canFocus()) {\n this.current.activate();\n used = true;\n }\n if (input.pressed(b.cancel)) {\n const scope = this.scopes[this.scopes.length - 1]!;\n if (scope.onCancel?.()) used = true;\n else if (this.current) {\n this.focus(null);\n used = true;\n }\n }\n return used;\n }\n\n private inScope(w: Container): boolean {\n for (let p: Container | null = w; p; p = p.parent) if (p === this.scope) return true;\n return false;\n }\n\n private widgets(): Widget[] {\n if (!this.list) {\n const out: Widget[] = [];\n collect(this.scope, out);\n this.list = out;\n }\n return this.list.filter((w) => !w.destroyed && w.canFocus());\n }\n}\n\nfunction collect(c: Container, out: Widget[]): void {\n if (!c.visible) return;\n if (c instanceof Widget && c.focusable) out.push(c);\n for (const child of c.children) collect(child, out);\n}\n\n/** A widget's box on screen: comparable across parents, whatever scrolled or scaled them. */\nfunction rectOf(w: Widget): Rect {\n const b = w.getBounds();\n return { x: b.x, y: b.y, width: b.width, height: b.height };\n}\n"],"names":["DEFAULT_NAV","DIRECTIONS","FocusManager","root","bindings","container","onCancel","i","w","p","dir","list","rects","rectOf","next","firstFocus","nextFocus","step","linearFocus","input","b","used","out","collect","c","Widget","child"],"mappings":";;AAuBO,MAAMA,IAA2B;AAAA,EACtC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AACR,GAQMC,I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EACT;AAAA,EAEQ,QAAQb,GAAuB;AACrC,aAASC,IAAsBD,GAAGC,GAAGA,IAAIA,EAAE,OAAQ,KAAIA,MAAM,KAAK,MAAO,QAAO;AAChF,WAAO;AAAA,EACT;AAAA,EAEQ,UAAoB;AAC1B,QAAI,CAAC,KAAK,MAAM;AACd,YAAMa,IAAgB,CAAA;AACtB,MAAAC,EAAQ,KAAK,OAAOD,CAAG,GACvB,KAAK,OAAOA;AAAA,IACd;AACA,WAAO,KAAK,KAAK,OAAO,CAACd,MAAM,CAACA,EAAE,aAAaA,EAAE,UAAU;AAAA,EAC7D;AACF;AAEA,SAASe,EAAQC,GAAcF,GAAqB;AAClD,MAAKE,EAAE,SACP;AAAA,IAAIA,aAAaC,KAAUD,EAAE,aAAWF,EAAI,KAAKE,CAAC;AAClD,eAAWE,KAASF,EAAE,SAAU,CAAAD,EAAQG,GAAOJ,CAAG;AAAA;AACpD;AAGA,SAAST,EAAOL,GAAiB;AAC/B,QAAMY,IAAIZ,EAAE,UAAA;AACZ,SAAO,EAAE,GAAGY,EAAE,GAAG,GAAGA,EAAE,GAAG,OAAOA,EAAE,OAAO,QAAQA,EAAE,OAAA;AACrD;"}
|
package/dist/ui/Label.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BitmapLabel as x } from "../core/BitmapLabel.js";
|
|
2
|
+
import { Text as m } from "../core/Text.js";
|
|
3
|
+
import { Widget as c } from "./Widget.js";
|
|
4
|
+
class i extends c {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
super(), this.text = t, t.anchor.set(0, 0), t.position.set(0, 0), this.addChild(t), this.last = t.text, this.measure();
|
|
7
|
+
}
|
|
8
|
+
text;
|
|
9
|
+
last = "";
|
|
10
|
+
/** A label printed with a canvas `Text`. */
|
|
11
|
+
static text(t, s) {
|
|
12
|
+
return new i(new m(0, 0, t, s));
|
|
13
|
+
}
|
|
14
|
+
/** A label printed from a bitmap font (see `installLabelFont`; `glyphs` beyond ASCII it will print). */
|
|
15
|
+
static bitmap(t, s, e, h, r = "#000000", o = 0, a = 1, n = "") {
|
|
16
|
+
return new i(new x(0, 0, t, s, e, h, r, o, a, n));
|
|
17
|
+
}
|
|
18
|
+
get value() {
|
|
19
|
+
return this.last;
|
|
20
|
+
}
|
|
21
|
+
/** Changes the text; the same string again costs nothing (a HUD may set it every frame). */
|
|
22
|
+
setText(t) {
|
|
23
|
+
return t === this.last ? this : (this.last = t, this.text.text = t, this.measure(), this);
|
|
24
|
+
}
|
|
25
|
+
measure() {
|
|
26
|
+
const t = this.boxW, s = this.boxH;
|
|
27
|
+
this.boxW = Math.ceil(this.text.width), this.boxH = Math.ceil(this.text.height), (this.boxW !== t || this.boxH !== s) && this.notifyResized();
|
|
28
|
+
}
|
|
29
|
+
redraw() {
|
|
30
|
+
this.alpha = this.enabled ? 1 : 0.5;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
i as Label
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","sources":["../../src/ui/Label.ts"],"sourcesContent":["import { BitmapLabel } from '../core/BitmapLabel';\nimport { Text, type TextStyle } from '../core/Text';\nimport { Widget } from './Widget';\n\n/** What a label prints with: a canvas `Text` (any font, rich wrapping) or a `BitmapLabel` (cheap to change). */\nexport type LabelText = Text | BitmapLabel;\n\n/**\n * A line (or block) of text with a layout box measured from what it prints. A HUD number rewritten every frame\n * should be a `BitmapLabel`: a `Text` repaints and uploads its canvas on every change.\n */\nexport class Label extends Widget {\n private last = '';\n\n constructor(readonly text: LabelText) {\n super();\n text.anchor.set(0, 0);\n text.position.set(0, 0);\n this.addChild(text);\n this.last = text.text;\n this.measure();\n }\n\n /** A label printed with a canvas `Text`. */\n static text(value: string, style: TextStyle): Label {\n return new Label(new Text(0, 0, value, style));\n }\n\n /** A label printed from a bitmap font (see `installLabelFont`; `glyphs` beyond ASCII it will print). */\n static bitmap(value: string, fontFamily: string, size: number, color: string, stroke = '#000000', strokeWidth = 0, resolution = 1, glyphs = ''): Label {\n return new Label(new BitmapLabel(0, 0, value, fontFamily, size, color, stroke, strokeWidth, resolution, glyphs));\n }\n\n get value(): string {\n return this.last;\n }\n\n /** Changes the text; the same string again costs nothing (a HUD may set it every frame). */\n setText(value: string): this {\n if (value === this.last) return this;\n this.last = value;\n this.text.text = value;\n this.measure();\n return this;\n }\n\n private measure(): void {\n const w = this.boxW;\n const h = this.boxH;\n // rounded up: a box that loses the last half pixel of a glyph clips it in a tight layout\n this.boxW = Math.ceil(this.text.width);\n this.boxH = Math.ceil(this.text.height);\n if (this.boxW !== w || this.boxH !== h) this.notifyResized();\n }\n\n protected redraw(): void {\n this.alpha = this.enabled ? 1 : 0.5;\n }\n}\n"],"names":["Label","Widget","text","value","style","Text","fontFamily","size","color","stroke","strokeWidth","resolution","glyphs","BitmapLabel","w","h"],"mappings":";;;AAWO,MAAMA,UAAcC,EAAO;AAAA,EAGhC,YAAqBC,GAAiB;AACpC,UAAA,GADmB,KAAA,OAAAA,GAEnBA,EAAK,OAAO,IAAI,GAAG,CAAC,GACpBA,EAAK,SAAS,IAAI,GAAG,CAAC,GACtB,KAAK,SAASA,CAAI,GAClB,KAAK,OAAOA,EAAK,MACjB,KAAK,QAAA;AAAA,EACP;AAAA,EAPqB;AAAA,EAFb,OAAO;AAAA;AAAA,EAYf,OAAO,KAAKC,GAAeC,GAAyB;AAClD,WAAO,IAAIJ,EAAM,IAAIK,EAAK,GAAG,GAAGF,GAAOC,CAAK,CAAC;AAAA,EAC/C;AAAA;AAAA,EAGA,OAAO,OAAOD,GAAeG,GAAoBC,GAAcC,GAAeC,IAAS,WAAWC,IAAc,GAAGC,IAAa,GAAGC,IAAS,IAAW;AACrJ,WAAO,IAAIZ,EAAM,IAAIa,EAAY,GAAG,GAAGV,GAAOG,GAAYC,GAAMC,GAAOC,GAAQC,GAAaC,GAAYC,CAAM,CAAC;AAAA,EACjH;AAAA,EAEA,IAAI,QAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,QAAQT,GAAqB;AAC3B,WAAIA,MAAU,KAAK,OAAa,QAChC,KAAK,OAAOA,GACZ,KAAK,KAAK,OAAOA,GACjB,KAAK,QAAA,GACE;AAAA,EACT;AAAA,EAEQ,UAAgB;AACtB,UAAMW,IAAI,KAAK,MACTC,IAAI,KAAK;AAEf,SAAK,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK,GACrC,KAAK,OAAO,KAAK,KAAK,KAAK,KAAK,MAAM,IAClC,KAAK,SAASD,KAAK,KAAK,SAASC,WAAQ,cAAA;AAAA,EAC/C;AAAA,EAEU,SAAe;AACvB,SAAK,QAAQ,KAAK,UAAU,IAAI;AAAA,EAClC;AACF;"}
|
package/dist/ui/List.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { stackLayout as n } from "./layout/stack.js";
|
|
2
|
+
import { ScrollView as c } from "./ScrollView.js";
|
|
3
|
+
import { sizeOf as a, Widget as l } from "./Widget.js";
|
|
4
|
+
class m extends c {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
super(t), this.listOptions = t;
|
|
7
|
+
}
|
|
8
|
+
listOptions;
|
|
9
|
+
rows = [];
|
|
10
|
+
get items() {
|
|
11
|
+
return this.rows;
|
|
12
|
+
}
|
|
13
|
+
add(...t) {
|
|
14
|
+
for (const s of t)
|
|
15
|
+
this.rows.push(s), this.content.addChild(s);
|
|
16
|
+
return this.relayout();
|
|
17
|
+
}
|
|
18
|
+
remove(t, s = !1) {
|
|
19
|
+
const e = this.rows.indexOf(t);
|
|
20
|
+
return e >= 0 && this.rows.splice(e, 1), t.parent === this.content && this.content.removeChild(t), s && t.destroy({ children: !0 }), this.relayout();
|
|
21
|
+
}
|
|
22
|
+
clear(t = !0) {
|
|
23
|
+
for (const s of this.rows.splice(0))
|
|
24
|
+
this.content.removeChild(s), t && s.destroy({ children: !0 });
|
|
25
|
+
return this.relayout();
|
|
26
|
+
}
|
|
27
|
+
/** Lays the rows out again (after a row changed size). */
|
|
28
|
+
relayout() {
|
|
29
|
+
const t = this.listOptions.padding ?? 0, s = this.listOptions.stretch ?? !0, e = this.host?.pixelPerfect ?? !1, r = n(this.rows.map(a), {
|
|
30
|
+
gap: this.listOptions.gap ?? 0,
|
|
31
|
+
padding: t,
|
|
32
|
+
align: s ? "stretch" : "start",
|
|
33
|
+
crossSize: this.boxWidth - 2 * t,
|
|
34
|
+
snap: e
|
|
35
|
+
});
|
|
36
|
+
return this.rows.forEach((i, h) => {
|
|
37
|
+
const o = r.items[h];
|
|
38
|
+
i.position.set(o.x, o.y), s && i instanceof l && i.boxWidth !== o.width && i.resize(o.width, i.boxHeight);
|
|
39
|
+
}), this.setContentHeight(r.height), this.host?.invalidateFocus(), this;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
m as List
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=List.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../src/ui/List.ts"],"sourcesContent":["import type { Container } from 'pixi.js';\nimport { stackLayout } from './layout/stack';\nimport { ScrollView, type ScrollViewOptions } from './ScrollView';\nimport { sizeOf, Widget } from './Widget';\n\nexport interface ListOptions extends ScrollViewOptions {\n /** Between rows (default 0). */\n gap?: number;\n /** Inside the list's edge (default 0). */\n padding?: number;\n /** Rows as wide as the list, less the padding (default true). */\n stretch?: boolean;\n}\n\n/** A vertical list of rows in a scroll view: rows stacked with a gap, clipped, scrolled, followed by the focus. */\nexport class List extends ScrollView {\n private readonly rows: Container[] = [];\n\n constructor(private readonly listOptions: ListOptions) {\n super(listOptions);\n }\n\n get items(): readonly Container[] {\n return this.rows;\n }\n\n add(...rows: Container[]): this {\n for (const r of rows) {\n this.rows.push(r);\n this.content.addChild(r);\n }\n return this.relayout();\n }\n\n remove(row: Container, destroy = false): this {\n const i = this.rows.indexOf(row);\n if (i >= 0) this.rows.splice(i, 1);\n if (row.parent === this.content) this.content.removeChild(row);\n if (destroy) row.destroy({ children: true });\n return this.relayout();\n }\n\n clear(destroy = true): this {\n for (const r of this.rows.splice(0)) {\n this.content.removeChild(r);\n if (destroy) r.destroy({ children: true });\n }\n return this.relayout();\n }\n\n /** Lays the rows out again (after a row changed size). */\n relayout(): this {\n const pad = this.listOptions.padding ?? 0;\n const stretch = this.listOptions.stretch ?? true;\n const snap = this.host?.pixelPerfect ?? false;\n const result = stackLayout(this.rows.map(sizeOf), {\n gap: this.listOptions.gap ?? 0,\n padding: pad,\n align: stretch ? 'stretch' : 'start',\n crossSize: this.boxWidth - 2 * pad,\n snap,\n });\n this.rows.forEach((r, i) => {\n const rect = result.items[i]!;\n r.position.set(rect.x, rect.y);\n if (stretch && r instanceof Widget && r.boxWidth !== rect.width) r.resize(rect.width, r.boxHeight);\n });\n this.setContentHeight(result.height);\n this.host?.invalidateFocus();\n return this;\n }\n}\n"],"names":["List","ScrollView","listOptions","rows","r","row","destroy","i","pad","stretch","snap","result","stackLayout","sizeOf","rect","Widget"],"mappings":";;;AAeO,MAAMA,UAAaC,EAAW;AAAA,EAGnC,YAA6BC,GAA0B;AACrD,UAAMA,CAAW,GADU,KAAA,cAAAA;AAAA,EAE7B;AAAA,EAF6B;AAAA,EAFZ,OAAoB,CAAA;AAAA,EAMrC,IAAI,QAA8B;AAChC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,OAAOC,GAAyB;AAC9B,eAAWC,KAAKD;AACd,WAAK,KAAK,KAAKC,CAAC,GAChB,KAAK,QAAQ,SAASA,CAAC;AAEzB,WAAO,KAAK,SAAA;AAAA,EACd;AAAA,EAEA,OAAOC,GAAgBC,IAAU,IAAa;AAC5C,UAAMC,IAAI,KAAK,KAAK,QAAQF,CAAG;AAC/B,WAAIE,KAAK,KAAG,KAAK,KAAK,OAAOA,GAAG,CAAC,GAC7BF,EAAI,WAAW,KAAK,WAAS,KAAK,QAAQ,YAAYA,CAAG,GACzDC,KAASD,EAAI,QAAQ,EAAE,UAAU,IAAM,GACpC,KAAK,SAAA;AAAA,EACd;AAAA,EAEA,MAAMC,IAAU,IAAY;AAC1B,eAAWF,KAAK,KAAK,KAAK,OAAO,CAAC;AAChC,WAAK,QAAQ,YAAYA,CAAC,GACtBE,KAASF,EAAE,QAAQ,EAAE,UAAU,IAAM;AAE3C,WAAO,KAAK,SAAA;AAAA,EACd;AAAA;AAAA,EAGA,WAAiB;AACf,UAAMI,IAAM,KAAK,YAAY,WAAW,GAClCC,IAAU,KAAK,YAAY,WAAW,IACtCC,IAAO,KAAK,MAAM,gBAAgB,IAClCC,IAASC,EAAY,KAAK,KAAK,IAAIC,CAAM,GAAG;AAAA,MAChD,KAAK,KAAK,YAAY,OAAO;AAAA,MAC7B,SAASL;AAAA,MACT,OAAOC,IAAU,YAAY;AAAA,MAC7B,WAAW,KAAK,WAAW,IAAID;AAAA,MAC/B,MAAAE;AAAA,IAAA,CACD;AACD,gBAAK,KAAK,QAAQ,CAACN,GAAGG,MAAM;AAC1B,YAAMO,IAAOH,EAAO,MAAMJ,CAAC;AAC3B,MAAAH,EAAE,SAAS,IAAIU,EAAK,GAAGA,EAAK,CAAC,GACzBL,KAAWL,aAAaW,KAAUX,EAAE,aAAaU,EAAK,SAAOV,EAAE,OAAOU,EAAK,OAAOV,EAAE,SAAS;AAAA,IACnG,CAAC,GACD,KAAK,iBAAiBO,EAAO,MAAM,GACnC,KAAK,MAAM,gBAAA,GACJ;AAAA,EACT;AACF;"}
|
package/dist/ui/Panel.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NineSliceSprite as a, Graphics as n, Rectangle as c } from "pixi.js";
|
|
2
|
+
import { Widget as f } from "./Widget.js";
|
|
3
|
+
class x extends f {
|
|
4
|
+
constructor(i, e, l, s = {}) {
|
|
5
|
+
if (super(), this.skin = i, "texture" in i) {
|
|
6
|
+
const { left: t, top: h, right: o, bottom: r } = i.insets;
|
|
7
|
+
this.slice = new a({ texture: i.texture, leftWidth: t, topHeight: h, rightWidth: o, bottomHeight: r }), this.addChild(this.slice);
|
|
8
|
+
} else
|
|
9
|
+
this.box = new n(), this.addChild(this.box);
|
|
10
|
+
(s.blocksPointer ?? !0) && (this.makeInteractive(), this.hitArea = new c(0, 0, 0, 0)), this.resize(e, l);
|
|
11
|
+
}
|
|
12
|
+
skin;
|
|
13
|
+
slice = null;
|
|
14
|
+
box = null;
|
|
15
|
+
redraw() {
|
|
16
|
+
const i = this.boxW, e = this.boxH;
|
|
17
|
+
if (this.hitArea instanceof c && (this.hitArea.width = i, this.hitArea.height = e), this.slice) {
|
|
18
|
+
this.slice.roundPixels = this.host?.pixelPerfect ?? !1, this.slice.width = i, this.slice.height = e;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const l = this.skin, s = this.box;
|
|
22
|
+
s.clear();
|
|
23
|
+
const t = l.border ?? 0, h = l.fillAlpha ?? l.alpha ?? 1, o = l.borderAlpha ?? l.alpha ?? 1;
|
|
24
|
+
if (!(i <= 0 || e <= 0))
|
|
25
|
+
if (t > 0) {
|
|
26
|
+
const r = { color: l.borderColor ?? 16777215, alpha: o };
|
|
27
|
+
if (i <= 2 * t || e <= 2 * t) {
|
|
28
|
+
s.rect(0, 0, i, e).fill(r);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
s.rect(0, 0, i, t).fill(r), s.rect(0, e - t, i, t).fill(r), s.rect(0, t, t, e - 2 * t).fill(r), s.rect(i - t, t, t, e - 2 * t).fill(r), h > 0 && s.rect(t, t, i - 2 * t, e - 2 * t).fill({ color: l.color, alpha: h });
|
|
32
|
+
} else h > 0 && s.rect(0, 0, i, e).fill({ color: l.color, alpha: h });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
x as Panel
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=Panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Panel.js","sources":["../../src/ui/Panel.ts"],"sourcesContent":["import { Graphics, NineSliceSprite, Rectangle, type Texture } from 'pixi.js';\nimport type { Insets } from './layout/geometry';\nimport { Widget } from './Widget';\n\n/** A 9-slice texture: the corners stay as drawn, the edges stretch one way, the middle both. */\nexport interface TextureSkin {\n texture: Texture;\n /** Corner sizes in texture pixels. */\n insets: Insets;\n}\n\n/** A plain box: fill, and an optional border drawn inside the edge. */\nexport interface ColourSkin {\n color: number;\n /** Opacity of fill and border alike (default 1); `fillAlpha` and `borderAlpha` override it for one of them. */\n alpha?: number;\n /** Opacity of the fill alone: 0 draws a bare ring (a focus mark over a face that should still show). */\n fillAlpha?: number;\n /** Opacity of the border alone. */\n borderAlpha?: number;\n border?: number;\n borderColor?: number;\n}\n\nexport type PanelSkin = TextureSkin | ColourSkin;\n\nexport interface PanelOptions {\n /** Presses on it are the UI's and never reach the world under it (default true). */\n blocksPointer?: boolean;\n}\n\n/**\n * A framed box: a 9-slice of any texture (a window frame, a button face), or a colour box when a game has no art\n * yet. The background of windows, buttons, bars and dialogs.\n */\nexport class Panel extends Widget {\n private readonly slice: NineSliceSprite | null = null;\n private readonly box: Graphics | null = null;\n\n constructor(\n readonly skin: PanelSkin,\n width: number,\n height: number,\n options: PanelOptions = {},\n ) {\n super();\n if ('texture' in skin) {\n const { left, top, right, bottom } = skin.insets;\n this.slice = new NineSliceSprite({ texture: skin.texture, leftWidth: left, topHeight: top, rightWidth: right, bottomHeight: bottom });\n this.addChild(this.slice);\n } else {\n this.box = new Graphics();\n this.addChild(this.box);\n }\n if (options.blocksPointer ?? true) {\n this.makeInteractive();\n this.hitArea = new Rectangle(0, 0, 0, 0);\n }\n this.resize(width, height);\n }\n\n protected redraw(): void {\n const w = this.boxW;\n const h = this.boxH;\n if (this.hitArea instanceof Rectangle) {\n this.hitArea.width = w;\n this.hitArea.height = h;\n }\n if (this.slice) {\n // pixel art: the frame's corners land on whole pixels\n this.slice.roundPixels = this.host?.pixelPerfect ?? false;\n this.slice.width = w;\n this.slice.height = h;\n return;\n }\n const skin = this.skin as ColourSkin;\n const g = this.box!;\n g.clear();\n const b = skin.border ?? 0;\n const fillAlpha = skin.fillAlpha ?? skin.alpha ?? 1;\n const borderAlpha = skin.borderAlpha ?? skin.alpha ?? 1;\n if (w <= 0 || h <= 0) return;\n if (b > 0) {\n // the border as four strips round the fill, never a box under it: a see-through fill would show it through\n const bc = { color: skin.borderColor ?? 0xffffff, alpha: borderAlpha };\n if (w <= 2 * b || h <= 2 * b) {\n g.rect(0, 0, w, h).fill(bc);\n return;\n }\n g.rect(0, 0, w, b).fill(bc);\n g.rect(0, h - b, w, b).fill(bc);\n g.rect(0, b, b, h - 2 * b).fill(bc);\n g.rect(w - b, b, b, h - 2 * b).fill(bc);\n if (fillAlpha > 0) g.rect(b, b, w - 2 * b, h - 2 * b).fill({ color: skin.color, alpha: fillAlpha });\n } else if (fillAlpha > 0) {\n g.rect(0, 0, w, h).fill({ color: skin.color, alpha: fillAlpha });\n }\n }\n}\n"],"names":["Panel","Widget","skin","width","height","options","left","top","right","bottom","NineSliceSprite","Graphics","Rectangle","w","h","g","b","fillAlpha","borderAlpha","bc"],"mappings":";;AAmCO,MAAMA,UAAcC,EAAO;AAAA,EAIhC,YACWC,GACTC,GACAC,GACAC,IAAwB,CAAA,GACxB;AAEA,QADA,MAAA,GALS,KAAA,OAAAH,GAML,aAAaA,GAAM;AACrB,YAAM,EAAE,MAAAI,GAAM,KAAAC,GAAK,OAAAC,GAAO,QAAAC,EAAA,IAAWP,EAAK;AAC1C,WAAK,QAAQ,IAAIQ,EAAgB,EAAE,SAASR,EAAK,SAAS,WAAWI,GAAM,WAAWC,GAAK,YAAYC,GAAO,cAAcC,GAAQ,GACpI,KAAK,SAAS,KAAK,KAAK;AAAA,IAC1B;AACE,WAAK,MAAM,IAAIE,EAAA,GACf,KAAK,SAAS,KAAK,GAAG;AAExB,KAAIN,EAAQ,iBAAiB,QAC3B,KAAK,gBAAA,GACL,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