1681-engine 0.0.0-stage → 0.5.9
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 +357 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/dist/1681-engine.js +471 -0
- package/dist/ambient/ColorGrade.js +40 -0
- package/dist/ambient/DayClock.js +56 -0
- package/dist/ambient/WeatherLayer.js +90 -0
- package/dist/ambient/grade.js +12 -0
- package/dist/ambient/weather.js +51 -0
- package/dist/anim/AnimStateMachine.js +163 -0
- package/dist/anim/Animator.js +66 -0
- package/dist/anim/animStateCompile.js +112 -0
- package/dist/anim/animStateSystem.js +16 -0
- package/dist/anim/animationSystem.js +14 -0
- package/dist/anim/asepriteSlices.js +21 -0
- package/dist/anim/asepriteTags.js +34 -0
- package/dist/anim/parseAseprite.js +82 -0
- package/dist/assets/AssetLoader.js +202 -0
- package/dist/assets/loadAseprite.js +49 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +30 -0
- package/dist/assets/textureAtlas.js +58 -0
- package/dist/audio/Footsteps.js +25 -0
- package/dist/audio/MusicPlayer.js +77 -0
- package/dist/audio/SoundEngine.js +125 -0
- package/dist/audio/cleanTake.js +29 -0
- package/dist/audio/music/ElementVoice.js +34 -0
- package/dist/audio/music/GraphVoice.js +38 -0
- package/dist/audio/music/MusicChannel.js +57 -0
- package/dist/audio/music/musicVoice.js +12 -0
- package/dist/audio/sampleBank.js +81 -0
- package/dist/audio/soundTable.js +8 -0
- package/dist/audio/synth.js +35 -0
- package/dist/core/BitmapLabel.js +48 -0
- package/dist/core/Camera.js +149 -0
- package/dist/core/Clock.js +40 -0
- package/dist/core/Graphics.js +68 -0
- package/dist/core/Group.js +28 -0
- package/dist/core/Image.js +50 -0
- package/dist/core/ObjectFactory.js +54 -0
- package/dist/core/Pointer.js +80 -0
- package/dist/core/Rectangle.js +50 -0
- package/dist/core/Stage.js +85 -0
- package/dist/core/Text.js +21 -0
- package/dist/core/TextureRegistry.js +141 -0
- package/dist/core/Timeline.js +210 -0
- package/dist/core/TimelineBuilder.js +72 -0
- package/dist/core/TimelineChild.js +83 -0
- package/dist/core/Tweener.js +135 -0
- package/dist/core/atlas.js +37 -0
- package/dist/core/atlasPlan.js +21 -0
- package/dist/core/blendLayer.js +11 -0
- package/dist/core/eases.js +20 -0
- package/dist/core/gameObject.js +117 -0
- package/dist/core/pixelZoom.js +43 -0
- package/dist/core/pixiPatches.js +17 -0
- package/dist/core/runDue.js +28 -0
- package/dist/core/silhouette.js +49 -0
- package/dist/core/timelinePlace.js +23 -0
- package/dist/core/tweenProps.js +11 -0
- package/dist/debug/DebugOverlay.js +93 -0
- package/dist/debug/DrawCallCounter.js +44 -0
- package/dist/debug/ErrorLog.js +21 -0
- package/dist/debug/FrameStats.js +41 -0
- package/dist/debug/inspectWorld.js +28 -0
- package/dist/diagnostics/ErrorDeduper.js +26 -0
- package/dist/diagnostics/FrameSampler.js +41 -0
- package/dist/diagnostics/bootWatch.js +20 -0
- package/dist/diagnostics/captureErrors.js +26 -0
- package/dist/diagnostics/contextLoss.js +24 -0
- package/dist/diagnostics/frameStats.js +30 -0
- package/dist/diagnostics/gpuInfo.js +21 -0
- package/dist/diagnostics/renderGuard.js +23 -0
- package/dist/ecs/SparseSet.js +54 -0
- package/dist/ecs/World.js +306 -0
- package/dist/ecs/fields.js +25 -0
- package/dist/engine/Engine.js +106 -0
- package/dist/engine/FixedLoop.js +36 -0
- package/dist/engine/HiddenPause.js +27 -0
- package/dist/engine/Scene.js +78 -0
- package/dist/engine/SceneManager.js +72 -0
- package/dist/events/EventBus.js +41 -0
- package/dist/fx/Afterimages.js +82 -0
- package/dist/fx/FloatingText.js +71 -0
- package/dist/fx/hitStop.js +27 -0
- package/dist/fx/viewCull.js +9 -0
- package/dist/i18n/Translator.js +71 -0
- package/dist/i18n/extractStrings.js +57 -0
- package/dist/i18n/formatMessage.js +18 -0
- package/dist/input/Actions.js +139 -0
- package/dist/input/AimGesture.js +74 -0
- package/dist/input/Keyboard.js +53 -0
- package/dist/input/Keymap.js +170 -0
- package/dist/input/TargetLock.js +72 -0
- package/dist/input/aimAxis.js +7 -0
- package/dist/input/keyChord.js +28 -0
- package/dist/input/longPress.js +31 -0
- package/dist/input/rumble.js +42 -0
- package/dist/input/stickAxis.js +22 -0
- package/dist/input/touchDetect.js +6 -0
- package/dist/light/LightLayer.js +83 -0
- package/dist/nav/MinHeap.js +38 -0
- package/dist/nav/findPath.js +77 -0
- package/dist/nav/navGrid.js +35 -0
- package/dist/nav/nearestOpen.js +18 -0
- package/dist/nav/straightenPath.js +50 -0
- package/dist/net/Connection.js +107 -0
- package/dist/net/InterpolationBuffer.js +56 -0
- package/dist/net/PredictedMover.js +60 -0
- package/dist/net/Room.js +91 -0
- package/dist/net/RoomHost.js +100 -0
- package/dist/net/cadence.js +21 -0
- package/dist/net/constants.js +10 -0
- package/dist/net/lobby/LobbyClient.js +123 -0
- package/dist/net/lobby/LobbyHost.js +365 -0
- package/dist/net/lobby/LobbyRooms.js +65 -0
- package/dist/net/lobby/Matchmaker.js +105 -0
- package/dist/net/movement.js +84 -0
- package/dist/net/protocol.js +10 -0
- package/dist/net/reconnect.js +10 -0
- package/dist/net/serverClock.js +21 -0
- package/dist/net/snapshotCodec.js +91 -0
- package/dist/parallax/Parallax.js +31 -0
- package/dist/parallax/ParallaxLayer.js +69 -0
- package/dist/parallax/parallaxMath.js +26 -0
- package/dist/particles/Emitter.js +107 -0
- package/dist/particles/ParticleBudget.js +31 -0
- package/dist/particles/ParticleSim.js +59 -0
- package/dist/particles/particleCurves.js +47 -0
- package/dist/particles/particleSampling.js +29 -0
- package/dist/physics/Body.js +201 -0
- package/dist/physics/BroadPhase.js +55 -0
- package/dist/physics/Contact.js +75 -0
- package/dist/physics/ContactSolver.js +69 -0
- package/dist/physics/PhysicsWorld.js +220 -0
- package/dist/physics/SpatialHash.js +38 -0
- package/dist/physics/collide.js +75 -0
- package/dist/physics/collidePolygon.js +93 -0
- package/dist/physics/contactReport.js +13 -0
- package/dist/physics/drawColliders.js +30 -0
- package/dist/physics/physicsSystem.js +7 -0
- package/dist/physics/polygon.js +79 -0
- package/dist/physics/raycast.js +61 -0
- package/dist/physics/syncToBody.js +18 -0
- package/dist/physics/tileBodies.js +58 -0
- package/dist/physics/types.js +7 -0
- package/dist/pixel/Darkness.js +169 -0
- package/dist/pixel/DitherVignette.js +56 -0
- package/dist/pixel/Evaporation.js +84 -0
- package/dist/pixel/NightShade.js +33 -0
- package/dist/pixel/PixelLayer.js +210 -0
- package/dist/pixel/PixelMarks.js +99 -0
- package/dist/pixel/SwayProp.js +74 -0
- package/dist/pixel/aimPixels.js +67 -0
- package/dist/pixel/lights.js +43 -0
- package/dist/pixel/nineSlice.js +61 -0
- package/dist/pixel/paintLayer.js +35 -0
- package/dist/pixel/palette.js +56 -0
- package/dist/pixel/pixel.js +277 -0
- package/dist/pixel/pixelPaint.js +197 -0
- package/dist/pixel/pixelParticles.js +35 -0
- package/dist/pixel/pixelTone.js +163 -0
- package/dist/pixel/propKit.js +40 -0
- package/dist/pixel/ramp.js +101 -0
- package/dist/pixel/selout.js +34 -0
- package/dist/pixel/spritePixels.js +58 -0
- package/dist/pixel/swayRig.js +86 -0
- package/dist/pixel/vignetteMask.js +23 -0
- package/dist/pixel/weatherArt.js +60 -0
- package/dist/pixel.js +96 -0
- package/dist/platform/appResume.js +18 -0
- package/dist/platform/fullscreen.js +52 -0
- package/dist/platform/orientation.js +26 -0
- package/dist/platform/pointerLock.js +37 -0
- package/dist/platform/reducedMotion.js +23 -0
- package/dist/platform/timeoutSignal.js +14 -0
- package/dist/platform/touch.js +32 -0
- package/dist/postfx/BloomFilter.js +64 -0
- package/dist/postfx/ChromaticAberrationFilter.js +24 -0
- package/dist/postfx/ColorAdjustFilter.js +75 -0
- package/dist/postfx/CrtFilter.js +41 -0
- package/dist/postfx/PixelateFilter.js +26 -0
- package/dist/postfx/PostFx.js +122 -0
- package/dist/postfx/ShockwaveFilter.js +48 -0
- package/dist/postfx/VignetteFilter.js +36 -0
- package/dist/postfx/fxAnimator.js +37 -0
- package/dist/postfx/fxShader.js +127 -0
- package/dist/postfx.js +25 -0
- package/dist/react/ChoiceDialog.js +50 -0
- package/dist/react/ConfirmDialog.js +52 -0
- package/dist/react/Glyph.js +62 -0
- package/dist/react/Modal.js +37 -0
- package/dist/react/Panel.js +23 -0
- package/dist/react/PixelImage.js +23 -0
- package/dist/react/Select.js +98 -0
- package/dist/react/Slider.js +61 -0
- package/dist/react/SplitPane.js +23 -0
- package/dist/react/TabStrip.js +31 -0
- package/dist/react/TitleTips.js +41 -0
- package/dist/react/Tooltip.js +27 -0
- package/dist/react/UiProvider.js +49 -0
- package/dist/react/baseCss.js +221 -0
- package/dist/react/choiceStore.js +22 -0
- package/dist/react/classNames.js +18 -0
- package/dist/react/confirmStore.js +29 -0
- package/dist/react/labels.js +17 -0
- package/dist/react/placement.js +48 -0
- package/dist/react/useFillSheet.js +22 -0
- package/dist/react/useFitToViewport.js +28 -0
- package/dist/react/usePicked.js +12 -0
- package/dist/react/useStore.js +8 -0
- package/dist/react/useViewport.js +16 -0
- package/dist/react.js +77 -0
- package/dist/rig/PosePlayer.js +91 -0
- package/dist/rig/RigView.js +124 -0
- package/dist/rig/Skeleton.js +30 -0
- package/dist/rig/humanoid.js +5 -0
- package/dist/rig/humanoid.json.js +29 -0
- package/dist/rig/humanoidPoses.js +29 -0
- package/dist/rig/poseMath.js +53 -0
- package/dist/rig/poses.json.js +149 -0
- package/dist/save/Autosaver.js +53 -0
- package/dist/save/MemoryBackend.js +18 -0
- package/dist/save/SaveStore.js +102 -0
- package/dist/save/WebStorageBackend.js +26 -0
- package/dist/save/checksum.js +9 -0
- package/dist/save/migrateSave.js +26 -0
- package/dist/settings.js +26 -0
- package/dist/tilemap/TilemapView.js +68 -0
- package/dist/tilemap/collision.js +24 -0
- package/dist/tilemap/tiled.js +137 -0
- package/dist/transitions/CrossfadeTransition.js +23 -0
- package/dist/transitions/DitherWipeTransition.js +69 -0
- package/dist/transitions/FadeTransition.js +33 -0
- package/dist/transitions/Letterbox.js +41 -0
- package/dist/transitions/ditherMask.js +14 -0
- package/dist/transitions/transitionTo.js +27 -0
- package/dist/transitions/tweenDone.js +14 -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 +140 -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/assets/textureAtlas.d.ts +35 -0
- package/dist/types/assets/textureAtlas.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 +47 -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 +23 -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 +45 -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 +90 -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/blendLayer.d.ts +23 -0
- package/dist/types/core/blendLayer.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/pixelZoom.d.ts +45 -0
- package/dist/types/core/pixelZoom.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/runDue.d.ts +15 -0
- package/dist/types/core/runDue.d.ts.map +1 -0
- package/dist/types/core/silhouette.d.ts +16 -0
- package/dist/types/core/silhouette.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 +96 -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/HiddenPause.d.ts +22 -0
- package/dist/types/engine/HiddenPause.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/Afterimages.d.ts +62 -0
- package/dist/types/fx/Afterimages.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 +164 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input/Actions.d.ts +100 -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/rumble.d.ts +41 -0
- package/dist/types/input/rumble.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 +88 -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 +33 -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/reconnect.d.ts +14 -0
- package/dist/types/net/reconnect.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 +90 -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/PixelMarks.d.ts +68 -0
- package/dist/types/pixel/PixelMarks.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/aimPixels.d.ts +23 -0
- package/dist/types/pixel/aimPixels.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +33 -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 +44 -0
- package/dist/types/pixel/pixelPaint.d.ts.map +1 -0
- package/dist/types/pixel/pixelParticles.d.ts +21 -0
- package/dist/types/pixel/pixelParticles.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/appResume.d.ts +25 -0
- package/dist/types/platform/appResume.d.ts.map +1 -0
- package/dist/types/platform/fullscreen.d.ts +37 -0
- package/dist/types/platform/fullscreen.d.ts.map +1 -0
- package/dist/types/platform/orientation.d.ts +19 -0
- package/dist/types/platform/orientation.d.ts.map +1 -0
- package/dist/types/platform/pointerLock.d.ts +26 -0
- package/dist/types/platform/pointerLock.d.ts.map +1 -0
- package/dist/types/platform/reducedMotion.d.ts +20 -0
- package/dist/types/platform/reducedMotion.d.ts.map +1 -0
- package/dist/types/platform/timeoutSignal.d.ts +6 -0
- package/dist/types/platform/timeoutSignal.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 +42 -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/types/ui/rich/RichText.d.ts +48 -0
- package/dist/types/ui/rich/RichText.d.ts.map +1 -0
- package/dist/types/ui/rich/richFonts.d.ts +70 -0
- package/dist/types/ui/rich/richFonts.d.ts.map +1 -0
- package/dist/types/ui/rich/richLayout.d.ts +76 -0
- package/dist/types/ui/rich/richLayout.d.ts.map +1 -0
- package/dist/types/ui/rich/richMarkup.d.ts +48 -0
- package/dist/types/ui/rich/richMarkup.d.ts.map +1 -0
- package/dist/ui/Bar.js +53 -0
- package/dist/ui/Button.js +57 -0
- package/dist/ui/Dialog.js +55 -0
- package/dist/ui/FocusManager.js +96 -0
- package/dist/ui/Label.js +35 -0
- package/dist/ui/List.js +44 -0
- package/dist/ui/Panel.js +37 -0
- package/dist/ui/ScrollView.js +95 -0
- package/dist/ui/Slider.js +54 -0
- package/dist/ui/Stack.js +27 -0
- package/dist/ui/Toggle.js +36 -0
- package/dist/ui/UiHost.js +8 -0
- package/dist/ui/UiPointerGate.js +24 -0
- package/dist/ui/UiRoot.js +92 -0
- package/dist/ui/Widget.js +89 -0
- package/dist/ui/dom/DomOverlay.js +58 -0
- package/dist/ui/dom/DomWorldAnchors.js +58 -0
- package/dist/ui/dom/InputShield.js +26 -0
- package/dist/ui/dom/createStore.js +41 -0
- package/dist/ui/dom/shieldDecision.js +35 -0
- package/dist/ui/dom/worldToScreen.js +10 -0
- package/dist/ui/layout/anchor.js +19 -0
- package/dist/ui/layout/barDrain.js +24 -0
- package/dist/ui/layout/fitToViewport.js +16 -0
- package/dist/ui/layout/focusNav.js +41 -0
- package/dist/ui/layout/geometry.js +20 -0
- package/dist/ui/layout/listWidth.js +9 -0
- package/dist/ui/layout/placeTooltip.js +27 -0
- package/dist/ui/layout/scroll.js +23 -0
- package/dist/ui/layout/slider.js +19 -0
- package/dist/ui/layout/stack.js +26 -0
- package/dist/ui/layout/wrapRow.js +12 -0
- package/dist/ui/rich/RichText.js +87 -0
- package/dist/ui/rich/richFonts.js +105 -0
- package/dist/ui/rich/richLayout.js +132 -0
- package/dist/ui/rich/richMarkup.js +67 -0
- package/dist/ui.js +95 -0
- package/package.json +112 -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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type DestroyOptions } from 'pixi.js';
|
|
2
|
+
import type { TextureRegistry } from '../../core/TextureRegistry.js';
|
|
3
|
+
import { Widget } from '../Widget.js';
|
|
4
|
+
import type { RichFont } from './richFonts.js';
|
|
5
|
+
import { type RichAlign, type RichLayout, type RichLayoutOptions } from './richLayout.js';
|
|
6
|
+
import { type RichMarkupOptions } from './richMarkup.js';
|
|
7
|
+
export interface RichTextOptions extends RichLayoutOptions, RichMarkupOptions {
|
|
8
|
+
/** What the runs are drawn with: `CanvasRichFont`, `BitmapRichFont`, or a game's own. */
|
|
9
|
+
font: RichFont;
|
|
10
|
+
/** Where `[icon=…]` keys are looked up; without it icons take no room and draw nothing. */
|
|
11
|
+
textures?: TextureRegistry;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Text with inline markup — colour, bold, italic, size and icons (see `parseRichText`) — wrapped to a width and
|
|
15
|
+
* aligned. A `Widget`, so it stacks and pins like a `Label`, and a plain Pixi container in the world too.
|
|
16
|
+
*
|
|
17
|
+
* It does its work only when the text or the layout options change: no per-frame cost. Its runs and icons are kept
|
|
18
|
+
* and reused when the text changes, so a log line rewritten keeps its display objects. Under a pixel-perfect UI root
|
|
19
|
+
* (or with `pixelPerfect`) every run and icon lands on a whole pixel and icons scale by whole multiples.
|
|
20
|
+
*/
|
|
21
|
+
export declare class RichText extends Widget {
|
|
22
|
+
private source;
|
|
23
|
+
private last;
|
|
24
|
+
private readonly runs;
|
|
25
|
+
private readonly icons;
|
|
26
|
+
private readonly measure;
|
|
27
|
+
private readonly options;
|
|
28
|
+
/** Whether the last layout was on whole pixels. */
|
|
29
|
+
private snapped;
|
|
30
|
+
constructor(markup: string, options: RichTextOptions);
|
|
31
|
+
/** The markup shown. */
|
|
32
|
+
get markup(): string;
|
|
33
|
+
/** Where every line, run and icon was placed, for hit-testing a word or drawing behind one. */
|
|
34
|
+
get layout(): RichLayout;
|
|
35
|
+
/** Changes the text; the same markup again costs nothing. */
|
|
36
|
+
setText(markup: string): this;
|
|
37
|
+
/** Wraps to a new width (undefined: only at `\n`). */
|
|
38
|
+
setWrapWidth(width: number | undefined): this;
|
|
39
|
+
setAlign(align: RichAlign): this;
|
|
40
|
+
/** Lays out and draws again: after the font's colours or the icons' textures were swapped under it. */
|
|
41
|
+
relayout(): void;
|
|
42
|
+
destroy(options?: DestroyOptions): void;
|
|
43
|
+
protected redraw(): void;
|
|
44
|
+
private pixelPerfect;
|
|
45
|
+
private addRun;
|
|
46
|
+
private addIcon;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=RichText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../../../src/ui/rich/RichText.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAoB,MAAM,cAAc,CAAC;AACzH,OAAO,EAAiB,KAAK,iBAAiB,EAAkB,MAAM,cAAc,CAAC;AAErF,MAAM,WAAW,eAAgB,SAAQ,iBAAiB,EAAE,iBAAiB;IAC3E,yFAAyF;IACzF,IAAI,EAAE,QAAQ,CAAC;IACf,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,qBAAa,QAAS,SAAQ,MAAM;IAClC,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,IAAI,CAAkD;IAC9D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,mDAAmD;IACnD,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe;IAmBpD,wBAAwB;IACxB,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,+FAA+F;IAC/F,IAAI,MAAM,IAAI,UAAU,CAEvB;IAED,6DAA6D;IAC7D,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAO7B,sDAAsD;IACtD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAQ7C,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAOhC,uGAAuG;IACvG,QAAQ,IAAI,IAAI;IAoCP,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAKhD,SAAS,CAAC,MAAM,IAAI,IAAI;IAIxB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,OAAO;CAOhB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type Container } from 'pixi.js';
|
|
2
|
+
import type { RichMeasure } from './richLayout.js';
|
|
3
|
+
import type { RichStyle } from './richMarkup.js';
|
|
4
|
+
/**
|
|
5
|
+
* What `RichText` draws its runs with: it measures text for the layout and makes and updates one display object a
|
|
6
|
+
* run. Two come with the engine — `CanvasRichFont` (any font, bold and italic) and `BitmapRichFont` (glyphs baked
|
|
7
|
+
* once, cheap to change) — and a game may write its own.
|
|
8
|
+
*/
|
|
9
|
+
export interface RichFont extends Omit<RichMeasure, 'iconSize'> {
|
|
10
|
+
/** A fresh, empty run. */
|
|
11
|
+
createRun(): Container;
|
|
12
|
+
/** Shows `text` in `style` on a run made by `createRun`; cheap when neither changed. */
|
|
13
|
+
updateRun(run: Container, text: string, style: RichStyle): void;
|
|
14
|
+
}
|
|
15
|
+
export interface RichFontOptions {
|
|
16
|
+
/** Must already be loaded (`document.fonts.load`), or the text measures and bakes in the fallback. */
|
|
17
|
+
fontFamily: string;
|
|
18
|
+
/** The size of text with no `[size]`. */
|
|
19
|
+
fontSize: number;
|
|
20
|
+
/** The colour of text with no `[color]`. */
|
|
21
|
+
color?: string;
|
|
22
|
+
stroke?: string;
|
|
23
|
+
strokeWidth?: number;
|
|
24
|
+
/** Texture pixels per pixel: text in the world is zoomed by the camera, so it is rasterised finer. */
|
|
25
|
+
resolution?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Runs as canvas `Text`: any font the page has, with bold and italic. Every style used gets one Pixi `TextStyle`,
|
|
29
|
+
* shared by every run in it. Changing a run's text repaints and uploads its canvas, so text rewritten every frame
|
|
30
|
+
* belongs in a `BitmapRichFont`.
|
|
31
|
+
*/
|
|
32
|
+
export declare class CanvasRichFont implements RichFont {
|
|
33
|
+
private readonly options;
|
|
34
|
+
private readonly styles;
|
|
35
|
+
private readonly metrics;
|
|
36
|
+
constructor(options: RichFontOptions);
|
|
37
|
+
textWidth(text: string, style: RichStyle): number;
|
|
38
|
+
lineHeight(style: RichStyle): number;
|
|
39
|
+
ascent(style: RichStyle): number;
|
|
40
|
+
createRun(): Container;
|
|
41
|
+
updateRun(run: Container, text: string, style: RichStyle): void;
|
|
42
|
+
private metricsOf;
|
|
43
|
+
private pixiStyle;
|
|
44
|
+
}
|
|
45
|
+
export interface BitmapRichFontOptions extends RichFontOptions {
|
|
46
|
+
/** Letters beyond ASCII the text prints (see `installLabelFont`). */
|
|
47
|
+
glyphs?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Runs as `BitmapText` from label fonts (`installLabelFont`): changing the text costs no canvas and no upload, and the
|
|
51
|
+
* runs batch. Each colour × size is a font of its own, baked the first time it is used — keep to a few and print each
|
|
52
|
+
* once while loading, or the first line to use one bakes it on that frame. Bitmap fonts have no bold or italic: those
|
|
53
|
+
* tags change nothing here.
|
|
54
|
+
*/
|
|
55
|
+
export declare class BitmapRichFont implements RichFont {
|
|
56
|
+
private readonly options;
|
|
57
|
+
private readonly styles;
|
|
58
|
+
private readonly metrics;
|
|
59
|
+
constructor(options: BitmapRichFontOptions);
|
|
60
|
+
textWidth(text: string, style: RichStyle): number;
|
|
61
|
+
lineHeight(style: RichStyle): number;
|
|
62
|
+
ascent(style: RichStyle): number;
|
|
63
|
+
createRun(): Container;
|
|
64
|
+
updateRun(run: Container, text: string, style: RichStyle): void;
|
|
65
|
+
private metricsOf;
|
|
66
|
+
/** Bold and italic do not reach a bitmap font: styles differing only by them share one. */
|
|
67
|
+
private fontKey;
|
|
68
|
+
private pixiStyle;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=richFonts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richFonts.d.ts","sourceRoot":"","sources":["../../../../src/ui/rich/richFonts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;IAC7D,0BAA0B;IAC1B,SAAS,IAAI,SAAS,CAAC;IACvB,wFAAwF;IACxF,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,WAAW,eAAe;IAC9B,sGAAsG;IACtG,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sGAAsG;IACtG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAWD;;;;GAIG;AACH,qBAAa,cAAe,YAAW,QAAQ;IAIjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;gBAEzB,OAAO,EAAE,eAAe;IAErD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM;IAKjD,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAIpC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAIhC,SAAS,IAAI,SAAS;IAItB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI;IAO/D,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,SAAS;CAiBlB;AAED,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,cAAe,YAAW,QAAQ;IAIjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;gBAEzB,OAAO,EAAE,qBAAqB;IAE3D,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM;IAKjD,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAIpC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAIhC,SAAS,IAAI,SAAS;IAItB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI;IAO/D,OAAO,CAAC,SAAS;IAajB,2FAA2F;IAC3F,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,SAAS;CAYlB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { RichSpan, RichStyle } from './richMarkup.js';
|
|
2
|
+
/**
|
|
3
|
+
* Line breaking and placement for `RichText`, pure: every width and height comes from a `RichMeasure` the caller
|
|
4
|
+
* hands in, so the same layout runs under node in a test, with a canvas font, or with a bitmap font.
|
|
5
|
+
*
|
|
6
|
+
* Lines break only at spaces and `\n`; a word wider than the whole line is broken between letters. Text and icons
|
|
7
|
+
* with no space between them (`[icon=coin]50`) stay together. Text of one style that ends up side by side on a line
|
|
8
|
+
* is one item, so a paragraph in one colour costs one display object a line.
|
|
9
|
+
*/
|
|
10
|
+
export interface RichMeasure {
|
|
11
|
+
/** Advance width of `text` in `style` (spaces included: they are measured on their own). */
|
|
12
|
+
textWidth(text: string, style: RichStyle): number;
|
|
13
|
+
/** Height of a line of text in `style`. */
|
|
14
|
+
lineHeight(style: RichStyle): number;
|
|
15
|
+
/** Baseline from the top of such a line; 0.8 of the line height when not given. */
|
|
16
|
+
ascent?(style: RichStyle): number;
|
|
17
|
+
/** Size of an icon's frame in texture pixels. */
|
|
18
|
+
iconSize(key: string, frame: string | undefined): {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export type RichAlign = 'left' | 'center' | 'right';
|
|
24
|
+
export interface RichLayoutOptions {
|
|
25
|
+
/** Wrap lines to this width; unset, lines break only at `\n`. */
|
|
26
|
+
wrapWidth?: number;
|
|
27
|
+
align?: RichAlign;
|
|
28
|
+
/** Extra pixels between lines. */
|
|
29
|
+
lineSpacing?: number;
|
|
30
|
+
/**
|
|
31
|
+
* `'line'` (default): an icon is as tall as its style's line — on a pixel-perfect layout the largest whole multiple
|
|
32
|
+
* of its frame that fits, never below 1×, so its texels stay square. A number: that scale, whatever the line.
|
|
33
|
+
*/
|
|
34
|
+
iconScale?: 'line' | number;
|
|
35
|
+
/** Whole-pixel positions and icon scales (a pixel-art game). */
|
|
36
|
+
pixelPerfect?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface RichTextItem {
|
|
39
|
+
kind: 'text';
|
|
40
|
+
text: string;
|
|
41
|
+
style: RichStyle;
|
|
42
|
+
x: number;
|
|
43
|
+
/** Top of the text's own line box. */
|
|
44
|
+
y: number;
|
|
45
|
+
width: number;
|
|
46
|
+
height: number;
|
|
47
|
+
}
|
|
48
|
+
export interface RichIconItem {
|
|
49
|
+
kind: 'icon';
|
|
50
|
+
key: string;
|
|
51
|
+
frame?: string;
|
|
52
|
+
style: RichStyle;
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
}
|
|
58
|
+
export type RichItem = RichTextItem | RichIconItem;
|
|
59
|
+
export interface RichLine {
|
|
60
|
+
y: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
/** Baseline from the line's top. */
|
|
64
|
+
baseline: number;
|
|
65
|
+
items: RichItem[];
|
|
66
|
+
}
|
|
67
|
+
export interface RichLayout {
|
|
68
|
+
/** The box: `wrapWidth` when wrapping, else the widest line. */
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
lines: RichLine[];
|
|
72
|
+
}
|
|
73
|
+
/** Breaks spans into lines and places every run and icon. */
|
|
74
|
+
export declare function layoutRichText(spans: readonly RichSpan[], measure: RichMeasure, options?: RichLayoutOptions): RichLayout;
|
|
75
|
+
export declare function sameStyle(a: RichStyle, b: RichStyle): boolean;
|
|
76
|
+
//# sourceMappingURL=richLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richLayout.d.ts","sourceRoot":"","sources":["../../../../src/ui/rich/richLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;;;GAOG;AAEH,MAAM,WAAW,WAAW;IAC1B,4FAA4F;IAC5F,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IAClD,2CAA2C;IAC3C,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IACrC,mFAAmF;IACnF,MAAM,CAAC,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IAClC,iDAAiD;IACjD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACrF;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,gEAAgE;IAChE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,sCAAsC;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAEnD,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAaD,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CA+D5H;AA4HD,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,CAE7D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The markup `RichText` reads: square-bracket tags, like BBCode, chosen because a translator can type them, a chat
|
|
3
|
+
* line can carry them, and nothing in ordinary prose looks like one.
|
|
4
|
+
*
|
|
5
|
+
* | Markup | Means |
|
|
6
|
+
* |---|---|
|
|
7
|
+
* | `[color=#f0c060]…[/color]` | colour: `#rgb`, `#rrggbb`, or a name the caller defines (`colors: { gold: '#f0c060' }`) |
|
|
8
|
+
* | `[b]…[/b]`, `[i]…[/i]` | bold, italic (where the font has them) |
|
|
9
|
+
* | `[size=16]…[/size]` | font size in pixels |
|
|
10
|
+
* | `[icon=coin]`, `[icon=items:12]` | an inline icon: a texture key, and after the last `:` a frame of it |
|
|
11
|
+
* | `[[` | a literal `[` |
|
|
12
|
+
*
|
|
13
|
+
* Anything else in brackets — an unknown tag, a bad value, a close with nothing open — is printed as written, so a
|
|
14
|
+
* typo shows on screen instead of swallowing the text after it. Tags still open at the end are closed there; closing
|
|
15
|
+
* an outer tag closes the ones opened inside it. Text from players (names, chat) goes through `escapeRichText` first.
|
|
16
|
+
* Pure: no Pixi, no DOM.
|
|
17
|
+
*/
|
|
18
|
+
/** How a run of text is drawn. Unset fields fall back to the font's own. */
|
|
19
|
+
export interface RichStyle {
|
|
20
|
+
color?: string;
|
|
21
|
+
bold: boolean;
|
|
22
|
+
italic: boolean;
|
|
23
|
+
size?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface RichTextSpan {
|
|
26
|
+
kind: 'text';
|
|
27
|
+
text: string;
|
|
28
|
+
style: RichStyle;
|
|
29
|
+
}
|
|
30
|
+
export interface RichIconSpan {
|
|
31
|
+
kind: 'icon';
|
|
32
|
+
key: string;
|
|
33
|
+
frame?: string;
|
|
34
|
+
/** The style around it: its size decides the icon's height. */
|
|
35
|
+
style: RichStyle;
|
|
36
|
+
}
|
|
37
|
+
export type RichSpan = RichTextSpan | RichIconSpan;
|
|
38
|
+
export interface RichMarkupOptions {
|
|
39
|
+
/** Colour names the markup may use besides hex (`[color=gold]`). */
|
|
40
|
+
colors?: Readonly<Record<string, string>>;
|
|
41
|
+
}
|
|
42
|
+
/** Makes text safe to put inside markup: every `[` doubled, so a player named `[b]` prints as typed. */
|
|
43
|
+
export declare function escapeRichText(text: string): string;
|
|
44
|
+
/** Parses markup into spans; adjacent text of one style is one span. */
|
|
45
|
+
export declare function parseRichText(source: string, options?: RichMarkupOptions): RichSpan[];
|
|
46
|
+
/** Plain text of markup: tags gone, icons gone, escapes undone (for measuring, logs, screen readers). */
|
|
47
|
+
export declare function stripRichText(source: string, options?: RichMarkupOptions): string;
|
|
48
|
+
//# sourceMappingURL=richMarkup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richMarkup.d.ts","sourceRoot":"","sources":["../../../../src/ui/rich/richMarkup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,4EAA4E;AAC5E,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C;AAMD,wGAAwG;AACxG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,QAAQ,EAAE,CAwCzF;AAED,yGAAyG;AACzG,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAIrF"}
|
package/dist/ui/Bar.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { firstFocus as u, nextFocus as o, linearFocus as l } from "./layout/focusNav.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
|
+
};
|