1681-engine 0.5.8 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/README.md +3 -0
- package/dist/1681-engine.js +526 -409
- package/dist/ambient/ColorGrade.js +0 -1
- package/dist/ambient/DayClock.js +0 -1
- package/dist/ambient/WeatherLayer.js +0 -1
- package/dist/ambient/grade.js +0 -1
- package/dist/ambient/life/Birds.js +73 -0
- package/dist/ambient/life/Butterflies.js +43 -0
- package/dist/ambient/life/ChimneySmoke.js +50 -0
- package/dist/ambient/life/Drift.js +75 -0
- package/dist/ambient/life/Fireflies.js +52 -0
- package/dist/ambient/life/lifeMotion.js +49 -0
- package/dist/ambient/weather.js +0 -1
- package/dist/anim/AnimStateMachine.js +0 -1
- package/dist/anim/Animator.js +0 -1
- package/dist/anim/animStateCompile.js +0 -1
- package/dist/anim/animStateSystem.js +0 -1
- package/dist/anim/animationSystem.js +0 -1
- package/dist/anim/asepriteSlices.js +0 -1
- package/dist/anim/asepriteTags.js +0 -1
- package/dist/anim/parseAseprite.js +0 -1
- package/dist/assets/AssetLoader.js +177 -34
- package/dist/assets/Prepainter.js +61 -0
- package/dist/assets/loadAseprite.js +0 -1
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +0 -1
- package/dist/assets/textureAtlas.js +58 -0
- package/dist/assets/workerPainter.js +39 -0
- package/dist/audio/Footsteps.js +0 -1
- package/dist/audio/MusicPlayer.js +0 -1
- package/dist/audio/SoundEngine.js +13 -7
- package/dist/audio/cleanTake.js +0 -1
- package/dist/audio/music/ElementVoice.js +0 -1
- package/dist/audio/music/GraphVoice.js +0 -1
- package/dist/audio/music/MusicChannel.js +0 -1
- package/dist/audio/music/musicVoice.js +0 -1
- package/dist/audio/sampleBank.js +0 -1
- package/dist/audio/soundTable.js +0 -1
- package/dist/audio/synth.js +0 -1
- package/dist/cjs/electron/electronLike.d.ts +55 -0
- package/dist/cjs/electron/electronLike.js +7 -0
- package/dist/cjs/electron/index.d.ts +14 -0
- package/dist/cjs/electron/index.js +20 -0
- package/dist/cjs/electron/lockdown.d.ts +33 -0
- package/dist/cjs/electron/lockdown.js +69 -0
- package/dist/cjs/electron/lockdownRules.d.ts +28 -0
- package/dist/cjs/electron/lockdownRules.js +61 -0
- package/dist/cjs/electron/sessionStore.d.ts +40 -0
- package/dist/cjs/electron/sessionStore.js +77 -0
- package/dist/cjs/electron/shellId.d.ts +22 -0
- package/dist/cjs/electron/shellId.js +31 -0
- package/dist/cjs/electron/webFiles.d.ts +13 -0
- package/dist/cjs/electron/webFiles.js +52 -0
- package/dist/cjs/electron/webPatcher.d.ts +80 -0
- package/dist/cjs/electron/webPatcher.js +216 -0
- package/dist/cjs/electron/webPointers.d.ts +19 -0
- package/dist/cjs/electron/webPointers.js +35 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/updates/index.d.ts +8 -0
- package/dist/cjs/updates/index.js +21 -0
- package/dist/cjs/updates/manifest.d.ts +73 -0
- package/dist/cjs/updates/manifest.js +67 -0
- package/dist/cjs/updates/pickUpdate.d.ts +42 -0
- package/dist/cjs/updates/pickUpdate.js +52 -0
- package/dist/cjs/updates/webPlan.d.ts +20 -0
- package/dist/cjs/updates/webPlan.js +34 -0
- package/dist/core/BitmapLabel.js +0 -1
- package/dist/core/Camera.js +1 -2
- package/dist/core/Clock.js +31 -21
- package/dist/core/Graphics.js +0 -1
- package/dist/core/Group.js +0 -1
- package/dist/core/Image.js +0 -1
- package/dist/core/ObjectFactory.js +0 -1
- package/dist/core/Pointer.js +46 -24
- package/dist/core/Rectangle.js +0 -1
- package/dist/core/Stage.js +5 -6
- package/dist/core/Text.js +0 -1
- package/dist/core/TextureRegistry.js +54 -24
- package/dist/core/Timeline.js +0 -1
- package/dist/core/TimelineBuilder.js +0 -1
- package/dist/core/TimelineChild.js +0 -1
- package/dist/core/Tweener.js +0 -1
- package/dist/core/atlas.js +0 -1
- package/dist/core/atlasPlan.js +0 -1
- package/dist/core/blendLayer.js +11 -0
- package/dist/core/eases.js +0 -1
- package/dist/core/gameObject.js +22 -20
- package/dist/core/pixelZoom.js +43 -0
- package/dist/core/pixiPatches.js +0 -1
- package/dist/core/runDue.js +28 -0
- package/dist/core/silhouette.js +49 -0
- package/dist/core/timelinePlace.js +0 -1
- package/dist/core/tweenProps.js +0 -1
- package/dist/debug/DebugOverlay.js +0 -1
- package/dist/debug/DrawCallCounter.js +15 -12
- package/dist/debug/ErrorLog.js +0 -1
- package/dist/debug/FrameStats.js +0 -1
- package/dist/debug/inspectWorld.js +0 -1
- package/dist/diagnostics/ErrorDeduper.js +0 -1
- package/dist/diagnostics/FrameSampler.js +0 -1
- package/dist/diagnostics/bootWatch.js +0 -1
- package/dist/diagnostics/captureErrors.js +0 -1
- package/dist/diagnostics/contextLoss.js +0 -1
- package/dist/diagnostics/frameStats.js +0 -1
- package/dist/diagnostics/gpuInfo.js +0 -1
- package/dist/diagnostics/renderGuard.js +0 -1
- package/dist/ecs/SparseSet.js +0 -1
- package/dist/ecs/World.js +0 -1
- package/dist/ecs/fields.js +0 -1
- package/dist/electron/lockdown.js +31 -0
- package/dist/electron/lockdownRules.js +42 -0
- package/dist/electron/sessionStore.js +48 -0
- package/dist/electron/shellId.js +18 -0
- package/dist/electron/webFiles.js +36 -0
- package/dist/electron/webPatcher.js +147 -0
- package/dist/electron/webPointers.js +25 -0
- package/dist/electron.js +19 -0
- package/dist/engine/Engine.js +42 -18
- package/dist/engine/FixedLoop.js +0 -1
- package/dist/engine/HiddenPause.js +27 -0
- package/dist/engine/Scene.js +0 -1
- package/dist/engine/SceneManager.js +0 -1
- package/dist/events/EventBus.js +0 -1
- package/dist/fx/Afterimages.js +82 -0
- package/dist/fx/FloatingText.js +0 -1
- package/dist/fx/hitStop.js +0 -1
- package/dist/fx/viewCull.js +0 -1
- package/dist/i18n/Translator.js +0 -1
- package/dist/i18n/extractStrings.js +0 -1
- package/dist/i18n/formatMessage.js +0 -1
- package/dist/input/Actions.js +29 -21
- package/dist/input/AimGesture.js +0 -1
- package/dist/input/Keyboard.js +0 -1
- package/dist/input/Keymap.js +0 -1
- package/dist/input/TargetLock.js +0 -1
- package/dist/input/aimAxis.js +0 -1
- package/dist/input/haptics.js +50 -0
- package/dist/input/keyChord.js +0 -1
- package/dist/input/longPress.js +0 -1
- package/dist/input/rumble.js +42 -0
- package/dist/input/stickAxis.js +0 -1
- package/dist/input/touchDetect.js +0 -1
- package/dist/light/LightLayer.js +0 -1
- package/dist/nav/MinHeap.js +0 -1
- package/dist/nav/findPath.js +0 -1
- package/dist/nav/navGrid.js +0 -1
- package/dist/nav/nearestOpen.js +0 -1
- package/dist/nav/straightenPath.js +0 -1
- package/dist/net/ApiClient.js +96 -0
- package/dist/net/Connection.js +39 -16
- package/dist/net/InterpolationBuffer.js +0 -1
- package/dist/net/PredictedMover.js +0 -1
- package/dist/net/Room.js +0 -1
- package/dist/net/RoomHost.js +0 -1
- package/dist/net/cadence.js +0 -1
- package/dist/net/constants.js +0 -1
- package/dist/net/lobby/LobbyClient.js +0 -1
- package/dist/net/lobby/LobbyHost.js +0 -1
- package/dist/net/lobby/LobbyRooms.js +0 -1
- package/dist/net/lobby/Matchmaker.js +0 -1
- package/dist/net/movement.js +40 -39
- package/dist/net/protocol.js +0 -1
- package/dist/net/reconnect.js +10 -0
- package/dist/net/serverClock.js +0 -1
- package/dist/net/snapshotCodec.js +0 -1
- package/dist/parallax/Parallax.js +0 -1
- package/dist/parallax/ParallaxLayer.js +0 -1
- package/dist/parallax/parallaxMath.js +0 -1
- package/dist/particles/Emitter.js +0 -1
- package/dist/particles/ParticleBudget.js +0 -1
- package/dist/particles/ParticleSim.js +0 -1
- package/dist/particles/particleCurves.js +0 -1
- package/dist/particles/particleSampling.js +0 -1
- package/dist/physics/Body.js +0 -1
- package/dist/physics/BroadPhase.js +0 -1
- package/dist/physics/Contact.js +0 -1
- package/dist/physics/ContactSolver.js +0 -1
- package/dist/physics/PhysicsWorld.js +0 -1
- package/dist/physics/SpatialHash.js +0 -1
- package/dist/physics/collide.js +0 -1
- package/dist/physics/collidePolygon.js +0 -1
- package/dist/physics/contactReport.js +0 -1
- package/dist/physics/drawColliders.js +0 -1
- package/dist/physics/physicsSystem.js +0 -1
- package/dist/physics/polygon.js +0 -1
- package/dist/physics/raycast.js +0 -1
- package/dist/physics/syncToBody.js +0 -1
- package/dist/physics/tileBodies.js +0 -1
- package/dist/physics/types.js +0 -1
- package/dist/pixel/Darkness.js +50 -47
- package/dist/pixel/DitherVignette.js +0 -1
- package/dist/pixel/Evaporation.js +0 -1
- package/dist/pixel/NightShade.js +0 -1
- package/dist/pixel/PixelLayer.js +0 -1
- package/dist/pixel/PixelMarks.js +99 -0
- package/dist/pixel/SwayProp.js +0 -1
- package/dist/pixel/aimPixels.js +67 -0
- package/dist/pixel/lifeArt.js +83 -0
- package/dist/pixel/lights.js +0 -1
- package/dist/pixel/nineSlice.js +0 -1
- package/dist/pixel/paintLayer.js +0 -1
- package/dist/pixel/palette.js +0 -1
- package/dist/pixel/pixel.js +0 -1
- package/dist/pixel/pixelPaint.js +27 -24
- package/dist/pixel/pixelParticles.js +35 -0
- package/dist/pixel/pixelTone.js +0 -1
- package/dist/pixel/propKit.js +0 -1
- package/dist/pixel/ramp.js +0 -1
- package/dist/pixel/selout.js +0 -1
- package/dist/pixel/spritePixels.js +0 -1
- package/dist/pixel/swayRig.js +0 -1
- package/dist/pixel/vignetteMask.js +0 -1
- package/dist/pixel/weatherArt.js +0 -1
- package/dist/pixel.js +82 -71
- 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 +0 -1
- package/dist/postfx/BloomFilter.js +0 -1
- package/dist/postfx/ChromaticAberrationFilter.js +0 -1
- package/dist/postfx/ColorAdjustFilter.js +0 -1
- package/dist/postfx/CrtFilter.js +0 -1
- package/dist/postfx/PixelateFilter.js +0 -1
- package/dist/postfx/PostFx.js +0 -1
- package/dist/postfx/ShockwaveFilter.js +0 -1
- package/dist/postfx/VignetteFilter.js +0 -1
- package/dist/postfx/fxAnimator.js +0 -1
- package/dist/postfx/fxShader.js +0 -1
- package/dist/postfx.js +0 -1
- package/dist/react/ChoiceDialog.js +0 -1
- package/dist/react/ConfirmButton.js +24 -0
- package/dist/react/ConfirmDialog.js +0 -1
- package/dist/react/Glyph.js +0 -1
- package/dist/react/Modal.js +0 -1
- package/dist/react/Panel.js +0 -1
- package/dist/react/PixelImage.js +0 -1
- package/dist/react/Select.js +0 -1
- package/dist/react/Slider.js +0 -1
- package/dist/react/SplitPane.js +0 -1
- package/dist/react/TabStrip.js +0 -1
- package/dist/react/TitleTips.js +0 -1
- package/dist/react/Tooltip.js +0 -1
- package/dist/react/UiProvider.js +0 -1
- package/dist/react/baseCss.js +1 -1
- package/dist/react/choiceStore.js +0 -1
- package/dist/react/classNames.js +0 -1
- package/dist/react/confirmStore.js +0 -1
- package/dist/react/labels.js +7 -7
- package/dist/react/placement.js +0 -1
- package/dist/react/useFillSheet.js +0 -1
- package/dist/react/useFitToViewport.js +0 -1
- package/dist/react/useJsonSelector.js +13 -0
- package/dist/react/usePicked.js +0 -1
- package/dist/react/useStore.js +0 -1
- package/dist/react/useViewport.js +0 -1
- package/dist/react.js +73 -69
- package/dist/rig/PosePlayer.js +0 -1
- package/dist/rig/RigView.js +0 -1
- package/dist/rig/Skeleton.js +0 -1
- package/dist/rig/humanoid.js +0 -1
- package/dist/rig/humanoid.json.js +0 -1
- package/dist/rig/humanoidPoses.js +0 -1
- package/dist/rig/poseMath.js +0 -1
- package/dist/rig/poses.json.js +0 -1
- package/dist/save/Autosaver.js +0 -1
- package/dist/save/MemoryBackend.js +0 -1
- package/dist/save/SaveStore.js +0 -1
- package/dist/save/WebStorageBackend.js +0 -1
- package/dist/save/checksum.js +0 -1
- package/dist/save/migrateSave.js +0 -1
- package/dist/settings.js +0 -1
- package/dist/tilemap/TilemapView.js +57 -33
- package/dist/tilemap/autotile.js +103 -0
- package/dist/tilemap/collision.js +29 -19
- package/dist/tilemap/ldtk.js +21 -0
- package/dist/tilemap/ldtkParse.js +191 -0
- package/dist/tilemap/tiled.js +0 -1
- package/dist/transitions/CrossfadeTransition.js +0 -1
- package/dist/transitions/DitherWipeTransition.js +0 -1
- package/dist/transitions/FadeTransition.js +0 -1
- package/dist/transitions/Letterbox.js +0 -1
- package/dist/transitions/ditherMask.js +0 -1
- package/dist/transitions/transitionTo.js +0 -1
- package/dist/transitions/tweenDone.js +0 -1
- package/dist/types/ambient/life/Birds.d.ts +50 -0
- package/dist/types/ambient/life/Birds.d.ts.map +1 -0
- package/dist/types/ambient/life/Butterflies.d.ts +32 -0
- package/dist/types/ambient/life/Butterflies.d.ts.map +1 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts +37 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts.map +1 -0
- package/dist/types/ambient/life/Drift.d.ts +58 -0
- package/dist/types/ambient/life/Drift.d.ts.map +1 -0
- package/dist/types/ambient/life/Fireflies.d.ts +43 -0
- package/dist/types/ambient/life/Fireflies.d.ts.map +1 -0
- package/dist/types/ambient/life/lifeMotion.d.ts +63 -0
- package/dist/types/ambient/life/lifeMotion.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +83 -8
- package/dist/types/assets/AssetLoader.d.ts.map +1 -1
- package/dist/types/assets/Prepainter.d.ts +64 -0
- package/dist/types/assets/Prepainter.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/assets/workerPainter.d.ts +21 -0
- package/dist/types/assets/workerPainter.d.ts.map +1 -0
- package/dist/types/audio/SoundEngine.d.ts +5 -0
- package/dist/types/audio/SoundEngine.d.ts.map +1 -1
- package/dist/types/core/Camera.d.ts +1 -1
- package/dist/types/core/Camera.d.ts.map +1 -1
- package/dist/types/core/Clock.d.ts +14 -2
- package/dist/types/core/Clock.d.ts.map +1 -1
- package/dist/types/core/Pointer.d.ts +18 -0
- package/dist/types/core/Pointer.d.ts.map +1 -1
- package/dist/types/core/Stage.d.ts.map +1 -1
- package/dist/types/core/TextureRegistry.d.ts +39 -0
- package/dist/types/core/TextureRegistry.d.ts.map +1 -1
- package/dist/types/core/blendLayer.d.ts +23 -0
- package/dist/types/core/blendLayer.d.ts.map +1 -0
- package/dist/types/core/gameObject.d.ts.map +1 -1
- package/dist/types/core/pixelZoom.d.ts +45 -0
- package/dist/types/core/pixelZoom.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/debug/DrawCallCounter.d.ts.map +1 -1
- package/dist/types/electron/electronLike.d.ts +56 -0
- package/dist/types/electron/electronLike.d.ts.map +1 -0
- package/dist/types/electron/index.d.ts +15 -0
- package/dist/types/electron/index.d.ts.map +1 -0
- package/dist/types/electron/lockdown.d.ts +34 -0
- package/dist/types/electron/lockdown.d.ts.map +1 -0
- package/dist/types/electron/lockdownRules.d.ts +29 -0
- package/dist/types/electron/lockdownRules.d.ts.map +1 -0
- package/dist/types/electron/sessionStore.d.ts +41 -0
- package/dist/types/electron/sessionStore.d.ts.map +1 -0
- package/dist/types/electron/shellId.d.ts +23 -0
- package/dist/types/electron/shellId.d.ts.map +1 -0
- package/dist/types/electron/webFiles.d.ts +14 -0
- package/dist/types/electron/webFiles.d.ts.map +1 -0
- package/dist/types/electron/webPatcher.d.ts +81 -0
- package/dist/types/electron/webPatcher.d.ts.map +1 -0
- package/dist/types/electron/webPointers.d.ts +20 -0
- package/dist/types/electron/webPointers.d.ts.map +1 -0
- package/dist/types/engine/Engine.d.ts +16 -0
- package/dist/types/engine/Engine.d.ts.map +1 -1
- package/dist/types/engine/HiddenPause.d.ts +22 -0
- package/dist/types/engine/HiddenPause.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/index.d.ts +32 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/input/Actions.d.ts +7 -1
- package/dist/types/input/Actions.d.ts.map +1 -1
- package/dist/types/input/haptics.d.ts +42 -0
- package/dist/types/input/haptics.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/net/ApiClient.d.ts +74 -0
- package/dist/types/net/ApiClient.d.ts.map +1 -0
- package/dist/types/net/Connection.d.ts +22 -0
- package/dist/types/net/Connection.d.ts.map +1 -1
- package/dist/types/net/constants.d.ts +13 -4
- package/dist/types/net/constants.d.ts.map +1 -1
- package/dist/types/net/movement.d.ts.map +1 -1
- package/dist/types/net/reconnect.d.ts +14 -0
- package/dist/types/net/reconnect.d.ts.map +1 -0
- package/dist/types/pixel/Darkness.d.ts +17 -5
- package/dist/types/pixel/Darkness.d.ts.map +1 -1
- package/dist/types/pixel/PixelMarks.d.ts +68 -0
- package/dist/types/pixel/PixelMarks.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 +4 -1
- package/dist/types/pixel/index.d.ts.map +1 -1
- package/dist/types/pixel/lifeArt.d.ts +63 -0
- package/dist/types/pixel/lifeArt.d.ts.map +1 -0
- package/dist/types/pixel/pixelPaint.d.ts +1 -0
- package/dist/types/pixel/pixelPaint.d.ts.map +1 -1
- package/dist/types/pixel/pixelParticles.d.ts +21 -0
- package/dist/types/pixel/pixelParticles.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/react/ConfirmButton.d.ts +26 -0
- package/dist/types/react/ConfirmButton.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +1 -1
- package/dist/types/react/baseCss.d.ts.map +1 -1
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/index.d.ts.map +1 -1
- package/dist/types/react/labels.d.ts +2 -0
- package/dist/types/react/labels.d.ts.map +1 -1
- package/dist/types/react/useJsonSelector.d.ts +13 -0
- package/dist/types/react/useJsonSelector.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +17 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -1
- package/dist/types/tilemap/autotile.d.ts +95 -0
- package/dist/types/tilemap/autotile.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +8 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -1
- package/dist/types/tilemap/ldtk.d.ts +97 -0
- package/dist/types/tilemap/ldtk.d.ts.map +1 -0
- package/dist/types/tilemap/ldtkParse.d.ts +26 -0
- package/dist/types/tilemap/ldtkParse.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +4 -0
- package/dist/types/ui/index.d.ts.map +1 -1
- 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/types/updates/index.d.ts +9 -0
- package/dist/types/updates/index.d.ts.map +1 -0
- package/dist/types/updates/manifest.d.ts +74 -0
- package/dist/types/updates/manifest.d.ts.map +1 -0
- package/dist/types/updates/pickUpdate.d.ts +43 -0
- package/dist/types/updates/pickUpdate.d.ts.map +1 -0
- package/dist/types/updates/webPlan.d.ts +21 -0
- package/dist/types/updates/webPlan.d.ts.map +1 -0
- package/dist/ui/Bar.js +0 -1
- package/dist/ui/Button.js +0 -1
- package/dist/ui/Dialog.js +0 -1
- package/dist/ui/FocusManager.js +0 -1
- package/dist/ui/Label.js +0 -1
- package/dist/ui/List.js +0 -1
- package/dist/ui/Panel.js +0 -1
- package/dist/ui/ScrollView.js +0 -1
- package/dist/ui/Slider.js +0 -1
- package/dist/ui/Stack.js +0 -1
- package/dist/ui/Toggle.js +0 -1
- package/dist/ui/UiHost.js +0 -1
- package/dist/ui/UiPointerGate.js +0 -1
- package/dist/ui/UiRoot.js +0 -1
- package/dist/ui/Widget.js +0 -1
- package/dist/ui/dom/DomOverlay.js +0 -1
- package/dist/ui/dom/DomWorldAnchors.js +0 -1
- package/dist/ui/dom/InputShield.js +0 -1
- package/dist/ui/dom/createStore.js +0 -1
- package/dist/ui/dom/shieldDecision.js +0 -1
- package/dist/ui/dom/worldToScreen.js +0 -1
- package/dist/ui/layout/anchor.js +0 -1
- package/dist/ui/layout/barDrain.js +0 -1
- package/dist/ui/layout/fitToViewport.js +0 -1
- package/dist/ui/layout/focusNav.js +0 -1
- package/dist/ui/layout/geometry.js +0 -1
- package/dist/ui/layout/listWidth.js +0 -1
- package/dist/ui/layout/placeTooltip.js +0 -1
- package/dist/ui/layout/scroll.js +0 -1
- package/dist/ui/layout/slider.js +0 -1
- package/dist/ui/layout/stack.js +0 -1
- package/dist/ui/layout/wrapRow.js +0 -1
- 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 +75 -65
- package/dist/updates/manifest.js +35 -0
- package/dist/updates/pickUpdate.js +27 -0
- package/dist/updates/webPlan.js +14 -0
- package/dist/updates.js +15 -0
- package/package.json +31 -6
- package/dist/1681-engine.js.map +0 -1
- package/dist/ambient/ColorGrade.js.map +0 -1
- package/dist/ambient/DayClock.js.map +0 -1
- package/dist/ambient/WeatherLayer.js.map +0 -1
- package/dist/ambient/grade.js.map +0 -1
- package/dist/ambient/weather.js.map +0 -1
- package/dist/anim/AnimStateMachine.js.map +0 -1
- package/dist/anim/Animator.js.map +0 -1
- package/dist/anim/animStateCompile.js.map +0 -1
- package/dist/anim/animStateSystem.js.map +0 -1
- package/dist/anim/animationSystem.js.map +0 -1
- package/dist/anim/asepriteSlices.js.map +0 -1
- package/dist/anim/asepriteTags.js.map +0 -1
- package/dist/anim/parseAseprite.js.map +0 -1
- package/dist/assets/AssetLoader.js.map +0 -1
- package/dist/assets/loadAseprite.js.map +0 -1
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +0 -1
- package/dist/audio/Footsteps.js.map +0 -1
- package/dist/audio/MusicPlayer.js.map +0 -1
- package/dist/audio/SoundEngine.js.map +0 -1
- package/dist/audio/cleanTake.js.map +0 -1
- package/dist/audio/music/ElementVoice.js.map +0 -1
- package/dist/audio/music/GraphVoice.js.map +0 -1
- package/dist/audio/music/MusicChannel.js.map +0 -1
- package/dist/audio/music/musicVoice.js.map +0 -1
- package/dist/audio/sampleBank.js.map +0 -1
- package/dist/audio/soundTable.js.map +0 -1
- package/dist/audio/synth.js.map +0 -1
- package/dist/core/BitmapLabel.js.map +0 -1
- package/dist/core/Camera.js.map +0 -1
- package/dist/core/Clock.js.map +0 -1
- package/dist/core/Graphics.js.map +0 -1
- package/dist/core/Group.js.map +0 -1
- package/dist/core/Image.js.map +0 -1
- package/dist/core/ObjectFactory.js.map +0 -1
- package/dist/core/Pointer.js.map +0 -1
- package/dist/core/Rectangle.js.map +0 -1
- package/dist/core/Stage.js.map +0 -1
- package/dist/core/Text.js.map +0 -1
- package/dist/core/TextureRegistry.js.map +0 -1
- package/dist/core/Timeline.js.map +0 -1
- package/dist/core/TimelineBuilder.js.map +0 -1
- package/dist/core/TimelineChild.js.map +0 -1
- package/dist/core/Tweener.js.map +0 -1
- package/dist/core/atlas.js.map +0 -1
- package/dist/core/atlasPlan.js.map +0 -1
- package/dist/core/eases.js.map +0 -1
- package/dist/core/gameObject.js.map +0 -1
- package/dist/core/pixiPatches.js.map +0 -1
- package/dist/core/timelinePlace.js.map +0 -1
- package/dist/core/tweenProps.js.map +0 -1
- package/dist/debug/DebugOverlay.js.map +0 -1
- package/dist/debug/DrawCallCounter.js.map +0 -1
- package/dist/debug/ErrorLog.js.map +0 -1
- package/dist/debug/FrameStats.js.map +0 -1
- package/dist/debug/inspectWorld.js.map +0 -1
- package/dist/diagnostics/ErrorDeduper.js.map +0 -1
- package/dist/diagnostics/FrameSampler.js.map +0 -1
- package/dist/diagnostics/bootWatch.js.map +0 -1
- package/dist/diagnostics/captureErrors.js.map +0 -1
- package/dist/diagnostics/contextLoss.js.map +0 -1
- package/dist/diagnostics/frameStats.js.map +0 -1
- package/dist/diagnostics/gpuInfo.js.map +0 -1
- package/dist/diagnostics/renderGuard.js.map +0 -1
- package/dist/ecs/SparseSet.js.map +0 -1
- package/dist/ecs/World.js.map +0 -1
- package/dist/ecs/fields.js.map +0 -1
- package/dist/engine/Engine.js.map +0 -1
- package/dist/engine/FixedLoop.js.map +0 -1
- package/dist/engine/Scene.js.map +0 -1
- package/dist/engine/SceneManager.js.map +0 -1
- package/dist/events/EventBus.js.map +0 -1
- package/dist/fx/FloatingText.js.map +0 -1
- package/dist/fx/hitStop.js.map +0 -1
- package/dist/fx/viewCull.js.map +0 -1
- package/dist/i18n/Translator.js.map +0 -1
- package/dist/i18n/extractStrings.js.map +0 -1
- package/dist/i18n/formatMessage.js.map +0 -1
- package/dist/input/Actions.js.map +0 -1
- package/dist/input/AimGesture.js.map +0 -1
- package/dist/input/Keyboard.js.map +0 -1
- package/dist/input/Keymap.js.map +0 -1
- package/dist/input/TargetLock.js.map +0 -1
- package/dist/input/aimAxis.js.map +0 -1
- package/dist/input/keyChord.js.map +0 -1
- package/dist/input/longPress.js.map +0 -1
- package/dist/input/stickAxis.js.map +0 -1
- package/dist/input/touchDetect.js.map +0 -1
- package/dist/light/LightLayer.js.map +0 -1
- package/dist/nav/MinHeap.js.map +0 -1
- package/dist/nav/findPath.js.map +0 -1
- package/dist/nav/navGrid.js.map +0 -1
- package/dist/nav/nearestOpen.js.map +0 -1
- package/dist/nav/straightenPath.js.map +0 -1
- package/dist/net/Connection.js.map +0 -1
- package/dist/net/InterpolationBuffer.js.map +0 -1
- package/dist/net/PredictedMover.js.map +0 -1
- package/dist/net/Room.js.map +0 -1
- package/dist/net/RoomHost.js.map +0 -1
- package/dist/net/cadence.js.map +0 -1
- package/dist/net/constants.js.map +0 -1
- package/dist/net/lobby/LobbyClient.js.map +0 -1
- package/dist/net/lobby/LobbyHost.js.map +0 -1
- package/dist/net/lobby/LobbyRooms.js.map +0 -1
- package/dist/net/lobby/Matchmaker.js.map +0 -1
- package/dist/net/movement.js.map +0 -1
- package/dist/net/protocol.js.map +0 -1
- package/dist/net/serverClock.js.map +0 -1
- package/dist/net/snapshotCodec.js.map +0 -1
- package/dist/parallax/Parallax.js.map +0 -1
- package/dist/parallax/ParallaxLayer.js.map +0 -1
- package/dist/parallax/parallaxMath.js.map +0 -1
- package/dist/particles/Emitter.js.map +0 -1
- package/dist/particles/ParticleBudget.js.map +0 -1
- package/dist/particles/ParticleSim.js.map +0 -1
- package/dist/particles/particleCurves.js.map +0 -1
- package/dist/particles/particleSampling.js.map +0 -1
- package/dist/physics/Body.js.map +0 -1
- package/dist/physics/BroadPhase.js.map +0 -1
- package/dist/physics/Contact.js.map +0 -1
- package/dist/physics/ContactSolver.js.map +0 -1
- package/dist/physics/PhysicsWorld.js.map +0 -1
- package/dist/physics/SpatialHash.js.map +0 -1
- package/dist/physics/collide.js.map +0 -1
- package/dist/physics/collidePolygon.js.map +0 -1
- package/dist/physics/contactReport.js.map +0 -1
- package/dist/physics/drawColliders.js.map +0 -1
- package/dist/physics/physicsSystem.js.map +0 -1
- package/dist/physics/polygon.js.map +0 -1
- package/dist/physics/raycast.js.map +0 -1
- package/dist/physics/syncToBody.js.map +0 -1
- package/dist/physics/tileBodies.js.map +0 -1
- package/dist/physics/types.js.map +0 -1
- package/dist/pixel/Darkness.js.map +0 -1
- package/dist/pixel/DitherVignette.js.map +0 -1
- package/dist/pixel/Evaporation.js.map +0 -1
- package/dist/pixel/NightShade.js.map +0 -1
- package/dist/pixel/PixelLayer.js.map +0 -1
- package/dist/pixel/SwayProp.js.map +0 -1
- package/dist/pixel/lights.js.map +0 -1
- package/dist/pixel/nineSlice.js.map +0 -1
- package/dist/pixel/paintLayer.js.map +0 -1
- package/dist/pixel/palette.js.map +0 -1
- package/dist/pixel/pixel.js.map +0 -1
- package/dist/pixel/pixelPaint.js.map +0 -1
- package/dist/pixel/pixelTone.js.map +0 -1
- package/dist/pixel/propKit.js.map +0 -1
- package/dist/pixel/ramp.js.map +0 -1
- package/dist/pixel/selout.js.map +0 -1
- package/dist/pixel/spritePixels.js.map +0 -1
- package/dist/pixel/swayRig.js.map +0 -1
- package/dist/pixel/vignetteMask.js.map +0 -1
- package/dist/pixel/weatherArt.js.map +0 -1
- package/dist/pixel.js.map +0 -1
- package/dist/platform/touch.js.map +0 -1
- package/dist/postfx/BloomFilter.js.map +0 -1
- package/dist/postfx/ChromaticAberrationFilter.js.map +0 -1
- package/dist/postfx/ColorAdjustFilter.js.map +0 -1
- package/dist/postfx/CrtFilter.js.map +0 -1
- package/dist/postfx/PixelateFilter.js.map +0 -1
- package/dist/postfx/PostFx.js.map +0 -1
- package/dist/postfx/ShockwaveFilter.js.map +0 -1
- package/dist/postfx/VignetteFilter.js.map +0 -1
- package/dist/postfx/fxAnimator.js.map +0 -1
- package/dist/postfx/fxShader.js.map +0 -1
- package/dist/postfx.js.map +0 -1
- package/dist/react/ChoiceDialog.js.map +0 -1
- package/dist/react/ConfirmDialog.js.map +0 -1
- package/dist/react/Glyph.js.map +0 -1
- package/dist/react/Modal.js.map +0 -1
- package/dist/react/Panel.js.map +0 -1
- package/dist/react/PixelImage.js.map +0 -1
- package/dist/react/Select.js.map +0 -1
- package/dist/react/Slider.js.map +0 -1
- package/dist/react/SplitPane.js.map +0 -1
- package/dist/react/TabStrip.js.map +0 -1
- package/dist/react/TitleTips.js.map +0 -1
- package/dist/react/Tooltip.js.map +0 -1
- package/dist/react/UiProvider.js.map +0 -1
- package/dist/react/baseCss.js.map +0 -1
- package/dist/react/choiceStore.js.map +0 -1
- package/dist/react/classNames.js.map +0 -1
- package/dist/react/confirmStore.js.map +0 -1
- package/dist/react/labels.js.map +0 -1
- package/dist/react/placement.js.map +0 -1
- package/dist/react/useFillSheet.js.map +0 -1
- package/dist/react/useFitToViewport.js.map +0 -1
- package/dist/react/usePicked.js.map +0 -1
- package/dist/react/useStore.js.map +0 -1
- package/dist/react/useViewport.js.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/rig/PosePlayer.js.map +0 -1
- package/dist/rig/RigView.js.map +0 -1
- package/dist/rig/Skeleton.js.map +0 -1
- package/dist/rig/humanoid.js.map +0 -1
- package/dist/rig/humanoid.json.js.map +0 -1
- package/dist/rig/humanoidPoses.js.map +0 -1
- package/dist/rig/poseMath.js.map +0 -1
- package/dist/rig/poses.json.js.map +0 -1
- package/dist/save/Autosaver.js.map +0 -1
- package/dist/save/MemoryBackend.js.map +0 -1
- package/dist/save/SaveStore.js.map +0 -1
- package/dist/save/WebStorageBackend.js.map +0 -1
- package/dist/save/checksum.js.map +0 -1
- package/dist/save/migrateSave.js.map +0 -1
- package/dist/settings.js.map +0 -1
- package/dist/tilemap/TilemapView.js.map +0 -1
- package/dist/tilemap/collision.js.map +0 -1
- package/dist/tilemap/tiled.js.map +0 -1
- package/dist/transitions/CrossfadeTransition.js.map +0 -1
- package/dist/transitions/DitherWipeTransition.js.map +0 -1
- package/dist/transitions/FadeTransition.js.map +0 -1
- package/dist/transitions/Letterbox.js.map +0 -1
- package/dist/transitions/ditherMask.js.map +0 -1
- package/dist/transitions/transitionTo.js.map +0 -1
- package/dist/transitions/tweenDone.js.map +0 -1
- package/dist/ui/Bar.js.map +0 -1
- package/dist/ui/Button.js.map +0 -1
- package/dist/ui/Dialog.js.map +0 -1
- package/dist/ui/FocusManager.js.map +0 -1
- package/dist/ui/Label.js.map +0 -1
- package/dist/ui/List.js.map +0 -1
- package/dist/ui/Panel.js.map +0 -1
- package/dist/ui/ScrollView.js.map +0 -1
- package/dist/ui/Slider.js.map +0 -1
- package/dist/ui/Stack.js.map +0 -1
- package/dist/ui/Toggle.js.map +0 -1
- package/dist/ui/UiHost.js.map +0 -1
- package/dist/ui/UiPointerGate.js.map +0 -1
- package/dist/ui/UiRoot.js.map +0 -1
- package/dist/ui/Widget.js.map +0 -1
- package/dist/ui/dom/DomOverlay.js.map +0 -1
- package/dist/ui/dom/DomWorldAnchors.js.map +0 -1
- package/dist/ui/dom/InputShield.js.map +0 -1
- package/dist/ui/dom/createStore.js.map +0 -1
- package/dist/ui/dom/shieldDecision.js.map +0 -1
- package/dist/ui/dom/worldToScreen.js.map +0 -1
- package/dist/ui/layout/anchor.js.map +0 -1
- package/dist/ui/layout/barDrain.js.map +0 -1
- package/dist/ui/layout/fitToViewport.js.map +0 -1
- package/dist/ui/layout/focusNav.js.map +0 -1
- package/dist/ui/layout/geometry.js.map +0 -1
- package/dist/ui/layout/listWidth.js.map +0 -1
- package/dist/ui/layout/placeTooltip.js.map +0 -1
- package/dist/ui/layout/scroll.js.map +0 -1
- package/dist/ui/layout/slider.js.map +0 -1
- package/dist/ui/layout/stack.js.map +0 -1
- package/dist/ui/layout/wrapRow.js.map +0 -1
- package/dist/ui.js.map +0 -1
|
@@ -1,40 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { sound as f } from "../audio/SoundEngine.js";
|
|
2
|
+
import { ldtkExternalLevels as w, parseLdtk as m } from "../tilemap/ldtkParse.js";
|
|
3
|
+
import { parseTiled as p } from "../tilemap/tiled.js";
|
|
4
|
+
import { collectAtlasPages as g, duplicateFrames as x, parseAtlas as v } from "./textureAtlas.js";
|
|
5
|
+
function l(r) {
|
|
6
|
+
return r instanceof Error ? r.message : String(r);
|
|
7
|
+
}
|
|
8
|
+
function h(r, t) {
|
|
3
9
|
if (/^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("/")) return r;
|
|
4
|
-
const
|
|
5
|
-
for (const o of
|
|
6
|
-
o === ".." &&
|
|
7
|
-
return
|
|
10
|
+
const s = (t.slice(0, t.lastIndexOf("/") + 1) + r).split("/"), a = [];
|
|
11
|
+
for (const o of s)
|
|
12
|
+
o === ".." && a.length && a[a.length - 1] !== ".." && a[a.length - 1] !== "" ? a.pop() : o !== "." && a.push(o);
|
|
13
|
+
return a.join("/");
|
|
14
|
+
}
|
|
15
|
+
function A(r, t, e) {
|
|
16
|
+
const s = r;
|
|
17
|
+
return [...s.levels ?? [], ...(s.worlds ?? []).flatMap((o) => o.levels ?? [])].some((o) => o.externalRelPath === t && o.identifier !== void 0 && e.has(o.identifier));
|
|
8
18
|
}
|
|
9
|
-
async function
|
|
19
|
+
async function $(r) {
|
|
10
20
|
const t = await createImageBitmap(r), e = document.createElement("canvas");
|
|
11
21
|
e.width = t.width, e.height = t.height;
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
return
|
|
22
|
+
const s = e.getContext("2d");
|
|
23
|
+
if (!s) throw new Error("AssetLoader: no 2D context (out of canvas memory?)");
|
|
24
|
+
return s.drawImage(t, 0, 0), t.close(), e;
|
|
15
25
|
}
|
|
16
|
-
|
|
26
|
+
async function b(r, t, e) {
|
|
27
|
+
if (typeof FontFace > "u" || typeof document > "u" || !document.fonts)
|
|
28
|
+
throw new Error(`AssetLoader: this browser cannot load the font "${r}" (no FontFace)`);
|
|
29
|
+
const s = new FontFace(r, t, e);
|
|
30
|
+
await s.load(), document.fonts.add(s);
|
|
31
|
+
}
|
|
32
|
+
class B {
|
|
17
33
|
constructor(t, e = {}) {
|
|
18
|
-
this.textures = t, this.options = e, this.fetcher = e.fetch ?? ((
|
|
34
|
+
this.textures = t, this.options = e, this.fetcher = e.fetch ?? ((s) => fetch(s)), this.toCanvas = e.toCanvas ?? $;
|
|
19
35
|
}
|
|
20
36
|
textures;
|
|
21
37
|
options;
|
|
22
38
|
queue = [];
|
|
23
39
|
data = /* @__PURE__ */ new Map();
|
|
24
40
|
maps = /* @__PURE__ */ new Map();
|
|
41
|
+
ldtks = /* @__PURE__ */ new Map();
|
|
42
|
+
atlases = /* @__PURE__ */ new Map();
|
|
43
|
+
/** Decoded audio by key; a key with bytes only waits for a context (`decodeAudio`). */
|
|
44
|
+
audioBuffers = /* @__PURE__ */ new Map();
|
|
45
|
+
audioBytes = /* @__PURE__ */ new Map();
|
|
46
|
+
decoding = /* @__PURE__ */ new Map();
|
|
25
47
|
fetcher;
|
|
26
48
|
toCanvas;
|
|
27
49
|
total = 0;
|
|
28
50
|
done = 0;
|
|
29
51
|
image(t, e) {
|
|
30
52
|
return this.add(t, async () => {
|
|
31
|
-
this.textures.addCanvas(t, await this.
|
|
53
|
+
this.textures.addCanvas(t, await this.canvas(e));
|
|
32
54
|
});
|
|
33
55
|
}
|
|
34
56
|
/** An image cut into equal frames named 0, 1, 2…, left to right, then row by row. */
|
|
35
|
-
spritesheet(t, e,
|
|
57
|
+
spritesheet(t, e, s) {
|
|
36
58
|
return this.add(t, async () => {
|
|
37
|
-
this.textures.addSpriteSheet(t, await this.
|
|
59
|
+
this.textures.addSpriteSheet(t, await this.canvas(e), s);
|
|
38
60
|
});
|
|
39
61
|
}
|
|
40
62
|
json(t, e) {
|
|
@@ -48,21 +70,120 @@ class u {
|
|
|
48
70
|
});
|
|
49
71
|
}
|
|
50
72
|
/** A Tiled JSON map, then every tileset image it names (resolved beside the map file). */
|
|
51
|
-
tilemap(t, e,
|
|
73
|
+
tilemap(t, e, s = {}) {
|
|
74
|
+
return this.add(t, async () => {
|
|
75
|
+
const a = p(await (await this.request(e)).json());
|
|
76
|
+
this.maps.set(t, a);
|
|
77
|
+
const o = s.textureKey ?? ((i) => i.name);
|
|
78
|
+
for (const i of a.tilesets) this.image(o(i), h(i.image, e));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* An LDtk project: the `.ldtk` file, the `.ldtkl` file of each level it saves apart (resolved beside the project),
|
|
83
|
+
* then every tileset image (resolved beside the project, as LDtk writes `relPath`). Counts as one asset, plus one
|
|
84
|
+
* per tileset image. Read it back with `ldtkProject(key)`; each level's `map` goes to `TilemapView` as it is.
|
|
85
|
+
*/
|
|
86
|
+
ldtk(t, e, s = {}) {
|
|
87
|
+
return this.add(t, async () => {
|
|
88
|
+
const a = await (await this.request(e)).json(), o = s.levels ? new Set(s.levels) : null, i = w(a).filter((d) => !o || A(a, d, o)), c = await Promise.all(i.map(async (d) => [d, await (await this.request(h(d, e))).json()])), n = m(a, { levels: Object.fromEntries(c) });
|
|
89
|
+
this.ldtks.set(t, n);
|
|
90
|
+
const u = s.textureKey ?? ((d) => d.name);
|
|
91
|
+
for (const d of n.tilesets) this.image(u(d), h(d.image, e));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/** A loaded LDtk project. */
|
|
95
|
+
ldtkProject(t) {
|
|
96
|
+
const e = this.ldtks.get(t);
|
|
97
|
+
if (!e) throw new Error(`AssetLoader: no LDtk project loaded as "${t}"`);
|
|
98
|
+
return e;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A TexturePacker (or Pixi) JSON atlas, hash or array format: its page image, and for a multipack atlas every page
|
|
102
|
+
* named in `meta.related_multi_packs` (each resolved beside the file naming it). The first page is the texture
|
|
103
|
+
* `key`, further pages `key~1`, `key~2`…, and every frame of every page is found as `textures.get(key, frameName)`.
|
|
104
|
+
* Counts as one asset in the progress.
|
|
105
|
+
*/
|
|
106
|
+
atlas(t, e) {
|
|
107
|
+
return this.add(t, async () => {
|
|
108
|
+
const s = this.textures.addAtlas?.bind(this.textures);
|
|
109
|
+
if (!s) throw new Error(`AssetLoader: the texture sink cannot take atlases (no addAtlas) for "${t}"`);
|
|
110
|
+
const a = await g(
|
|
111
|
+
e,
|
|
112
|
+
async (n) => v(await (await this.request(n)).json(), n),
|
|
113
|
+
h
|
|
114
|
+
), o = await Promise.all(a.map((n) => this.canvas(h(n.page.image, n.url)))), i = x(a.map((n) => n.page));
|
|
115
|
+
i.length && console.warn(`[assets] atlas "${t}" names ${i.length} frame(s) on more than one page: ${i.slice(0, 5).join(", ")}`), s(t, a.map((n, u) => ({ canvas: o[u], frames: n.page.frames })));
|
|
116
|
+
const c = {};
|
|
117
|
+
for (const n of a) Object.assign(c, n.page.animations);
|
|
118
|
+
this.atlases.set(t, { frames: [...new Set(a.flatMap((n) => n.page.frames.map((u) => u.name)))], animations: c, pages: a.length });
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A web font (woff2, woff, ttf) under `family`, added to `document.fonts` once loaded so canvas text and the DOM can
|
|
123
|
+
* use it at once — load fonts before the first `Text` is drawn, or it measures with the fallback.
|
|
124
|
+
*/
|
|
125
|
+
font(t, e, s) {
|
|
126
|
+
const a = this.options.addFont ?? b;
|
|
52
127
|
return this.add(t, async () => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
128
|
+
const o = await this.bytes(e);
|
|
129
|
+
try {
|
|
130
|
+
await a(t, o, s);
|
|
131
|
+
} catch (i) {
|
|
132
|
+
throw new Error(`AssetLoader: could not load font "${t}" from ${this.full(e)}: ${l(i)}`);
|
|
133
|
+
}
|
|
57
134
|
});
|
|
58
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* A sound file decoded into an `AudioBuffer` through the engine's audio context (`getAudio`). Before any context
|
|
138
|
+
* exists (browsers open one only after a gesture) the bytes are kept and decoded by `decodeAudio`, so a loading
|
|
139
|
+
* screen never has to wait for the player to click.
|
|
140
|
+
*/
|
|
141
|
+
audio(t, e) {
|
|
142
|
+
return this.add(t, async () => {
|
|
143
|
+
const s = await this.bytes(e);
|
|
144
|
+
this.audioBuffers.delete(t), this.decoding.delete(t);
|
|
145
|
+
const a = (this.options.audioContext ?? (() => f.audioContext))();
|
|
146
|
+
a ? this.audioBuffers.set(t, await this.decode(a, s, e)) : this.audioBytes.set(t, s);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** A loaded sound, decoded; null while it waits for an audio context (`decodeAudio`). */
|
|
150
|
+
getAudio(t) {
|
|
151
|
+
const e = this.audioBuffers.get(t);
|
|
152
|
+
if (e) return e;
|
|
153
|
+
if (this.audioBytes.has(t)) return null;
|
|
154
|
+
throw new Error(`AssetLoader: no audio loaded as "${t}"`);
|
|
155
|
+
}
|
|
156
|
+
/** A loaded sound, decoding its kept bytes through `ctx` (default: the loader's context) the first time. */
|
|
157
|
+
decodeAudio(t, e) {
|
|
158
|
+
const s = this.audioBuffers.get(t);
|
|
159
|
+
if (s) return Promise.resolve(s);
|
|
160
|
+
const a = this.decoding.get(t);
|
|
161
|
+
if (a) return a;
|
|
162
|
+
const o = this.audioBytes.get(t);
|
|
163
|
+
if (!o) return Promise.reject(new Error(`AssetLoader: no audio loaded as "${t}"`));
|
|
164
|
+
const i = e ?? (this.options.audioContext ?? (() => f.audioContext))();
|
|
165
|
+
if (!i) return Promise.reject(new Error(`AssetLoader: no audio context to decode "${t}" yet`));
|
|
166
|
+
const c = this.decode(i, o, t).then(
|
|
167
|
+
(n) => (this.audioBuffers.set(t, n), this.audioBytes.delete(t), this.decoding.delete(t), n),
|
|
168
|
+
(n) => {
|
|
169
|
+
throw this.decoding.delete(t), n;
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
return this.decoding.set(t, c), c;
|
|
173
|
+
}
|
|
174
|
+
/** What a loaded atlas holds: its frame names and animations. */
|
|
175
|
+
getAtlas(t) {
|
|
176
|
+
const e = this.atlases.get(t);
|
|
177
|
+
if (!e) throw new Error(`AssetLoader: no atlas loaded as "${t}"`);
|
|
178
|
+
return e;
|
|
179
|
+
}
|
|
59
180
|
/** Runs everything queued; `onProgress` after each asset. Safe to call again after queueing more. */
|
|
60
181
|
async load(t) {
|
|
61
|
-
const e = Math.max(1, this.options.concurrency ?? 6),
|
|
62
|
-
for (let
|
|
63
|
-
await
|
|
182
|
+
const e = Math.max(1, this.options.concurrency ?? 6), s = async () => {
|
|
183
|
+
for (let a = this.queue.shift(); a; a = this.queue.shift())
|
|
184
|
+
await a.run(), this.done++, t?.({ done: this.done, total: this.total, key: a.key });
|
|
64
185
|
};
|
|
65
|
-
for (; this.queue.length; ) await Promise.all(Array.from({ length: e },
|
|
186
|
+
for (; this.queue.length; ) await Promise.all(Array.from({ length: e }, s));
|
|
66
187
|
}
|
|
67
188
|
/** A loaded JSON value. */
|
|
68
189
|
getJson(t) {
|
|
@@ -82,23 +203,45 @@ class u {
|
|
|
82
203
|
add(t, e) {
|
|
83
204
|
return this.queue.push({ key: t, run: e }), this.total++, this;
|
|
84
205
|
}
|
|
206
|
+
full(t) {
|
|
207
|
+
return h(t, this.options.baseUrl ?? "");
|
|
208
|
+
}
|
|
85
209
|
async request(t) {
|
|
86
|
-
const e =
|
|
87
|
-
let
|
|
210
|
+
const e = this.full(t);
|
|
211
|
+
let s;
|
|
88
212
|
try {
|
|
89
|
-
|
|
90
|
-
} catch (
|
|
91
|
-
throw new Error(`AssetLoader: could not fetch ${e}: ${
|
|
213
|
+
s = await this.fetcher(e);
|
|
214
|
+
} catch (a) {
|
|
215
|
+
throw new Error(`AssetLoader: could not fetch ${e}: ${l(a)}`);
|
|
92
216
|
}
|
|
93
|
-
if (!
|
|
94
|
-
return
|
|
217
|
+
if (!s.ok) throw new Error(`AssetLoader: ${e} answered ${s.status}`);
|
|
218
|
+
return s;
|
|
95
219
|
}
|
|
96
220
|
async blob(t) {
|
|
97
221
|
return (await this.request(t)).blob();
|
|
98
222
|
}
|
|
223
|
+
/** An image file decoded into a canvas; a file that is not an image fails naming its URL. */
|
|
224
|
+
async canvas(t) {
|
|
225
|
+
const e = await this.blob(t);
|
|
226
|
+
try {
|
|
227
|
+
return await this.toCanvas(e);
|
|
228
|
+
} catch (s) {
|
|
229
|
+
throw new Error(`AssetLoader: could not decode image ${this.full(t)}: ${l(s)}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async bytes(t) {
|
|
233
|
+
const e = await this.request(t);
|
|
234
|
+
return typeof e.arrayBuffer == "function" ? e.arrayBuffer() : (await e.blob()).arrayBuffer();
|
|
235
|
+
}
|
|
236
|
+
async decode(t, e, s) {
|
|
237
|
+
try {
|
|
238
|
+
return await t.decodeAudioData(e.slice(0));
|
|
239
|
+
} catch (a) {
|
|
240
|
+
throw new Error(`AssetLoader: could not decode audio ${s}: ${l(a)}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
99
243
|
}
|
|
100
244
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
245
|
+
B as AssetLoader,
|
|
246
|
+
h as resolveUrl
|
|
103
247
|
};
|
|
104
|
-
//# sourceMappingURL=AssetLoader.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function d({ w: o, h: t, pixels: e }) {
|
|
2
|
+
if (typeof document > "u") return null;
|
|
3
|
+
const s = document.createElement("canvas");
|
|
4
|
+
s.width = o, s.height = t;
|
|
5
|
+
const n = s.getContext("2d");
|
|
6
|
+
return n ? (n.putImageData(new ImageData(new Uint8ClampedArray(e), o, t), 0, 0), s) : null;
|
|
7
|
+
}
|
|
8
|
+
class h {
|
|
9
|
+
constructor(t) {
|
|
10
|
+
this.options = t, this.key = t.key ?? ((e) => e);
|
|
11
|
+
}
|
|
12
|
+
options;
|
|
13
|
+
pending = /* @__PURE__ */ new Set();
|
|
14
|
+
/** Ids whose painting is held as a texture: the current one and its neighbours. */
|
|
15
|
+
held = /* @__PURE__ */ new Set();
|
|
16
|
+
key;
|
|
17
|
+
destroyed = !1;
|
|
18
|
+
/**
|
|
19
|
+
* Stands on `current`: its texture (painted by the caller on arrival, or ahead) and its neighbours' are kept, every
|
|
20
|
+
* other one this prepainter held is freed, and the neighbours not yet painted are started.
|
|
21
|
+
*/
|
|
22
|
+
enter(t, e) {
|
|
23
|
+
const s = this.options.id, n = s(t), r = /* @__PURE__ */ new Set([n, ...e.map(s)]);
|
|
24
|
+
for (const i of this.held)
|
|
25
|
+
r.has(i) || (this.options.textures.remove(this.key(i)), this.held.delete(i));
|
|
26
|
+
this.held.add(n);
|
|
27
|
+
for (const i of e) this.prepare(i);
|
|
28
|
+
}
|
|
29
|
+
/** Whether `id` is being painted right now (so a caller may wait for it a moment rather than paint it again). */
|
|
30
|
+
painting(t) {
|
|
31
|
+
return this.pending.has(t);
|
|
32
|
+
}
|
|
33
|
+
/** Ids held as textures now. */
|
|
34
|
+
get holding() {
|
|
35
|
+
return this.held;
|
|
36
|
+
}
|
|
37
|
+
/** Starts painting `item` unless it is painted or under way. */
|
|
38
|
+
prepare(t) {
|
|
39
|
+
const e = this.options.id(t), s = this.options.textures.exists(this.key(e));
|
|
40
|
+
s && this.held.add(e);
|
|
41
|
+
const n = this.options.painter;
|
|
42
|
+
s || this.pending.has(e) || !n || this.destroyed || (this.pending.add(e), n.paint(t, e).then(
|
|
43
|
+
(r) => this.receive(e, r),
|
|
44
|
+
() => this.pending.delete(e)
|
|
45
|
+
));
|
|
46
|
+
}
|
|
47
|
+
/** Stops painting; textures already made are left to the registry. */
|
|
48
|
+
destroy() {
|
|
49
|
+
this.destroyed = !0, this.options.painter?.dispose?.(), this.pending.clear();
|
|
50
|
+
}
|
|
51
|
+
receive(t, e) {
|
|
52
|
+
if (this.pending.delete(t), this.destroyed) return;
|
|
53
|
+
const s = this.key(t);
|
|
54
|
+
if (this.options.textures.exists(s)) return;
|
|
55
|
+
const n = (this.options.canvas ?? d)(e);
|
|
56
|
+
n && (this.options.textures.addCanvas(s, n), this.held.add(t), this.options.onPainted?.(t));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
h as Prepainter
|
|
61
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
function m(n) {
|
|
2
|
+
const e = n;
|
|
3
|
+
return typeof e == "object" && e !== null && [e.x, e.y, e.w, e.h].every((t) => typeof t == "number" && Number.isFinite(t));
|
|
4
|
+
}
|
|
5
|
+
function u(n, e, t) {
|
|
6
|
+
if (!m(e.frame)) throw new Error(`${t}: frame "${n}" has no frame rect`);
|
|
7
|
+
const o = e.frame, i = e.rotated === !0, a = {
|
|
8
|
+
name: n,
|
|
9
|
+
x: Math.floor(o.x),
|
|
10
|
+
y: Math.floor(o.y),
|
|
11
|
+
w: Math.floor(i ? o.h : o.w),
|
|
12
|
+
h: Math.floor(i ? o.w : o.h),
|
|
13
|
+
rotated: i,
|
|
14
|
+
sourceW: Math.floor(e.trimmed && e.sourceSize ? e.sourceSize.w : o.w),
|
|
15
|
+
sourceH: Math.floor(e.trimmed && e.sourceSize ? e.sourceSize.h : o.h)
|
|
16
|
+
};
|
|
17
|
+
if (e.trimmed !== !1 && m(e.spriteSourceSize) && e.sourceSize) {
|
|
18
|
+
const f = e.spriteSourceSize;
|
|
19
|
+
f.x === 0 && f.y === 0 && o.w === e.sourceSize.w && o.h === e.sourceSize.h || (a.trim = { x: Math.floor(f.x), y: Math.floor(f.y), w: Math.floor(o.w), h: Math.floor(o.h) }, a.sourceW = Math.floor(e.sourceSize.w), a.sourceH = Math.floor(e.sourceSize.h));
|
|
20
|
+
}
|
|
21
|
+
const r = e.anchor ?? e.pivot;
|
|
22
|
+
return r && typeof r.x == "number" && typeof r.y == "number" && (a.anchor = { x: r.x, y: r.y }), a;
|
|
23
|
+
}
|
|
24
|
+
function h(n, e = "atlas") {
|
|
25
|
+
const t = n;
|
|
26
|
+
if (typeof t != "object" || t === null || typeof t.frames != "object" || t.frames === null)
|
|
27
|
+
throw new Error(`${e}: not a TexturePacker JSON atlas (no "frames")`);
|
|
28
|
+
const o = t.meta?.image;
|
|
29
|
+
if (typeof o != "string" || o === "") throw new Error(`${e}: no "meta.image"`);
|
|
30
|
+
const i = Array.isArray(t.frames) ? t.frames.map((s, c) => u(typeof s?.filename == "string" ? s.filename : String(c), s ?? {}, e)) : Object.entries(t.frames).map(([s, c]) => u(s, c ?? {}, e)), a = Array.isArray(t.meta?.related_multi_packs) ? t.meta.related_multi_packs.filter((s) => typeof s == "string" && s !== "") : [], r = {};
|
|
31
|
+
if (typeof t.animations == "object" && t.animations !== null)
|
|
32
|
+
for (const [s, c] of Object.entries(t.animations))
|
|
33
|
+
Array.isArray(c) && (r[s] = c.filter((l) => typeof l == "string"));
|
|
34
|
+
const f = Number(t.meta?.scale);
|
|
35
|
+
return { image: o, frames: i, animations: r, related: a, scale: Number.isFinite(f) && f > 0 ? f : 1 };
|
|
36
|
+
}
|
|
37
|
+
async function y(n, e, t) {
|
|
38
|
+
const o = /* @__PURE__ */ new Set([n]), i = [], a = [n];
|
|
39
|
+
for (let r = a.shift(); r !== void 0; r = a.shift()) {
|
|
40
|
+
const f = await e(r);
|
|
41
|
+
i.push({ url: r, page: f });
|
|
42
|
+
for (const s of f.related) {
|
|
43
|
+
const c = t(s, r);
|
|
44
|
+
o.has(c) || (o.add(c), a.push(c));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return i;
|
|
48
|
+
}
|
|
49
|
+
function p(n) {
|
|
50
|
+
const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
51
|
+
for (const o of n) for (const i of o.frames) (e.has(i.name) ? t : e).add(i.name);
|
|
52
|
+
return [...t];
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
y as collectAtlasPages,
|
|
56
|
+
p as duplicateFrames,
|
|
57
|
+
h as parseAtlas
|
|
58
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function w(i) {
|
|
2
|
+
let n;
|
|
3
|
+
const o = /* @__PURE__ */ new Map(), c = (r) => {
|
|
4
|
+
n?.terminate(), n = null;
|
|
5
|
+
for (const t of o.values()) for (const e of t) e.reject(new Error(r));
|
|
6
|
+
o.clear();
|
|
7
|
+
}, f = () => {
|
|
8
|
+
if (n !== void 0) return n;
|
|
9
|
+
try {
|
|
10
|
+
const r = i.create();
|
|
11
|
+
r.onmessage = (t) => {
|
|
12
|
+
const e = t.data, s = o.get(e.id);
|
|
13
|
+
if (s) {
|
|
14
|
+
o.delete(e.id);
|
|
15
|
+
for (const a of s)
|
|
16
|
+
"error" in e ? a.reject(new Error(e.error)) : a.resolve(e);
|
|
17
|
+
}
|
|
18
|
+
}, r.onerror = () => c("the painter worker failed"), n = r;
|
|
19
|
+
} catch {
|
|
20
|
+
n = null;
|
|
21
|
+
}
|
|
22
|
+
return n;
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
paint(r, t) {
|
|
26
|
+
const e = f();
|
|
27
|
+
return e ? new Promise((s, a) => {
|
|
28
|
+
const l = o.get(t);
|
|
29
|
+
l ? l.push({ resolve: s, reject: a }) : (o.set(t, [{ resolve: s, reject: a }]), e.postMessage(i.message ? i.message(r, t) : { id: t, item: r }));
|
|
30
|
+
}) : Promise.reject(new Error("no painter worker"));
|
|
31
|
+
},
|
|
32
|
+
dispose() {
|
|
33
|
+
c("disposed");
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
w as workerPainter
|
|
39
|
+
};
|
package/dist/audio/Footsteps.js
CHANGED
|
@@ -2,8 +2,8 @@ import { engineSettings as m } from "../settings.js";
|
|
|
2
2
|
import { SampleBank as E, hasTakes as y } from "./sampleBank.js";
|
|
3
3
|
import { SOUNDS as u } from "./soundTable.js";
|
|
4
4
|
import { renderRecipe as R, SYNTH_RATE as k } from "./synth.js";
|
|
5
|
-
const p = 480, _ = 10, q = 6, B = 60, F = 0.45,
|
|
6
|
-
class
|
|
5
|
+
const p = 480, _ = 10, q = 6, B = 60, F = 0.45, C = 0.05, w = 80, g = [18e3, 1800], T = { freq: 3500, gainDb: -7 }, O = 11e3;
|
|
6
|
+
class V {
|
|
7
7
|
ctx = null;
|
|
8
8
|
master = null;
|
|
9
9
|
buffers = /* @__PURE__ */ new Map();
|
|
@@ -32,6 +32,13 @@ class C {
|
|
|
32
32
|
this.ctx && this.master && this.master.gain.setTargetAtTime(this.level(s.sfxVolume), this.ctx.currentTime, 0.02);
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The effects' audio context once something opened it (the first gesture does), else null: never created here, so
|
|
37
|
+
* asking does not open a context the browser would hold suspended. `AssetLoader.audio` decodes through it.
|
|
38
|
+
*/
|
|
39
|
+
get audioContext() {
|
|
40
|
+
return this.ctx;
|
|
41
|
+
}
|
|
35
42
|
play(t, n = {}) {
|
|
36
43
|
if (!t || !u.recipes[t] && !y(t) || m.getState().sfxVolume <= 0) return;
|
|
37
44
|
const e = this.ctx;
|
|
@@ -53,7 +60,7 @@ class C {
|
|
|
53
60
|
v && (i *= u.recipes[t]?.fileGain ?? 1), this.lastAt.set(t, x);
|
|
54
61
|
const c = e.createBufferSource();
|
|
55
62
|
c.buffer = l;
|
|
56
|
-
const S = u.recipes[t]?.jitter ??
|
|
63
|
+
const S = u.recipes[t]?.jitter ?? C;
|
|
57
64
|
c.playbackRate.value = 1 + (Math.random() * 2 - 1) * S;
|
|
58
65
|
const a = e.createGain();
|
|
59
66
|
a.gain.value = Math.min(1, i);
|
|
@@ -79,7 +86,7 @@ class C {
|
|
|
79
86
|
const t = this.ctx.createBiquadFilter();
|
|
80
87
|
t.type = "highshelf", t.frequency.value = T.freq, t.gain.value = T.gainDb;
|
|
81
88
|
const n = this.ctx.createBiquadFilter();
|
|
82
|
-
n.type = "lowpass", n.frequency.value =
|
|
89
|
+
n.type = "lowpass", n.frequency.value = O, this.master.connect(t).connect(n).connect(this.ctx.destination);
|
|
83
90
|
const e = this.ctx, i = () => {
|
|
84
91
|
const s = e.state === "running";
|
|
85
92
|
this.onRunning(s), s && this.prerender(e);
|
|
@@ -111,9 +118,8 @@ class C {
|
|
|
111
118
|
return this.buffers.set(n, s), s;
|
|
112
119
|
}
|
|
113
120
|
}
|
|
114
|
-
const H = new
|
|
121
|
+
const H = new V();
|
|
115
122
|
export {
|
|
116
|
-
|
|
123
|
+
V as SoundEngine,
|
|
117
124
|
H as sound
|
|
118
125
|
};
|
|
119
|
-
//# sourceMappingURL=SoundEngine.js.map
|
package/dist/audio/cleanTake.js
CHANGED
package/dist/audio/sampleBank.js
CHANGED
package/dist/audio/soundTable.js
CHANGED
package/dist/audio/synth.js
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** `electron.safeStorage`. */
|
|
2
|
+
export interface SafeStorageLike {
|
|
3
|
+
isEncryptionAvailable(): boolean;
|
|
4
|
+
/** Linux only: `basic_text` means a hard-coded key, which is no encryption at all. */
|
|
5
|
+
getSelectedStorageBackend?(): string;
|
|
6
|
+
encryptString(plainText: string): Uint8Array;
|
|
7
|
+
decryptString(encrypted: Buffer): string;
|
|
8
|
+
}
|
|
9
|
+
/** `electron.ipcMain`. */
|
|
10
|
+
export interface IpcMainLike {
|
|
11
|
+
handle(channel: string, listener: (event: any, ...args: any[]) => unknown): void;
|
|
12
|
+
removeHandler?(channel: string): void;
|
|
13
|
+
}
|
|
14
|
+
/** `electron.shell`. */
|
|
15
|
+
export interface ShellLike {
|
|
16
|
+
openExternal(url: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/** What `before-input-event` hands a listener (`Electron.Input`). */
|
|
19
|
+
export interface InputLike {
|
|
20
|
+
type: string;
|
|
21
|
+
key: string;
|
|
22
|
+
control: boolean;
|
|
23
|
+
meta: boolean;
|
|
24
|
+
shift: boolean;
|
|
25
|
+
alt: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** An event a listener may cancel. */
|
|
28
|
+
export interface PreventableLike {
|
|
29
|
+
preventDefault(): void;
|
|
30
|
+
}
|
|
31
|
+
/** `electron.Session`, for the permission handlers. */
|
|
32
|
+
export interface SessionLike {
|
|
33
|
+
setPermissionRequestHandler(handler: ((webContents: any, permission: any, callback: (granted: boolean) => void, details: any) => void) | null): void;
|
|
34
|
+
setPermissionCheckHandler(handler: ((webContents: any, permission: any, requestingOrigin: string, details: any) => boolean) | null): void;
|
|
35
|
+
}
|
|
36
|
+
/** `electron.WebContents`. */
|
|
37
|
+
export interface WebContentsLike {
|
|
38
|
+
setWindowOpenHandler(handler: (details: {
|
|
39
|
+
url: string;
|
|
40
|
+
}) => any): void;
|
|
41
|
+
on(event: any, listener: (...args: any[]) => void): unknown;
|
|
42
|
+
toggleDevTools(): void;
|
|
43
|
+
session?: SessionLike;
|
|
44
|
+
}
|
|
45
|
+
/** `electron.BrowserWindow`, as far as a lockdown needs it. */
|
|
46
|
+
export interface WindowLike {
|
|
47
|
+
webContents: WebContentsLike;
|
|
48
|
+
}
|
|
49
|
+
/** `electron.app`, as far as the debugger refusal needs it. */
|
|
50
|
+
export interface AppLike {
|
|
51
|
+
isPackaged: boolean;
|
|
52
|
+
commandLine: {
|
|
53
|
+
hasSwitch(name: string): boolean;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* The few parts of Electron's main-process API this module touches, written as structural types so the engine never
|
|
4
|
+
* imports or depends on `electron`: a game passes its own `app`, `safeStorage`, `ipcMain`, `shell` and windows, and
|
|
5
|
+
* a test passes fakes. Each is a subset of Electron's own type, so Electron's objects fit them as they are.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `1681-engine/electron`: the main-process side of a desktop build on Electron — file-by-file web patching from a
|
|
3
|
+
* release store, the shell's identity, an OS-encrypted session store and a window lockdown. Electron is an optional
|
|
4
|
+
* peer: nothing here imports it, the game hands in its own `app`, `safeStorage`, `ipcMain`, `shell` and windows. Runs
|
|
5
|
+
* in the main process only (it uses Node's `fs` and `crypto`); the pure rules it shares with browsers and phones are
|
|
6
|
+
* `1681-engine/updates`. Importable from ESM (`import`) and from a CommonJS main process (`require`).
|
|
7
|
+
*/
|
|
8
|
+
export type { SafeStorageLike, IpcMainLike, ShellLike, InputLike, PreventableLike, SessionLike, WebContentsLike, WindowLike, AppLike } from './electronLike';
|
|
9
|
+
export { shellId, type ShellIdOptions } from './shellId';
|
|
10
|
+
export { WebPatcher, type WebPatcherOptions } from './webPatcher';
|
|
11
|
+
export type { WebPointer, PointerName } from './webPointers';
|
|
12
|
+
export { SessionStore, registerSessionStore, type SessionStoreOptions } from './sessionStore';
|
|
13
|
+
export { isAllowedExternal, isAllowedNavigation, isDevToolsKey, debuggerRequested, DEBUG_SWITCHES, type ExternalPolicy } from './lockdownRules';
|
|
14
|
+
export { lockDownWindow, denyPermissions, refuseDebugLaunch, type LockdownOptions } from './lockdown';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refuseDebugLaunch = exports.denyPermissions = exports.lockDownWindow = exports.DEBUG_SWITCHES = exports.debuggerRequested = exports.isDevToolsKey = exports.isAllowedNavigation = exports.isAllowedExternal = exports.registerSessionStore = exports.SessionStore = exports.WebPatcher = exports.shellId = void 0;
|
|
4
|
+
var shellId_1 = require("./shellId");
|
|
5
|
+
Object.defineProperty(exports, "shellId", { enumerable: true, get: function () { return shellId_1.shellId; } });
|
|
6
|
+
var webPatcher_1 = require("./webPatcher");
|
|
7
|
+
Object.defineProperty(exports, "WebPatcher", { enumerable: true, get: function () { return webPatcher_1.WebPatcher; } });
|
|
8
|
+
var sessionStore_1 = require("./sessionStore");
|
|
9
|
+
Object.defineProperty(exports, "SessionStore", { enumerable: true, get: function () { return sessionStore_1.SessionStore; } });
|
|
10
|
+
Object.defineProperty(exports, "registerSessionStore", { enumerable: true, get: function () { return sessionStore_1.registerSessionStore; } });
|
|
11
|
+
var lockdownRules_1 = require("./lockdownRules");
|
|
12
|
+
Object.defineProperty(exports, "isAllowedExternal", { enumerable: true, get: function () { return lockdownRules_1.isAllowedExternal; } });
|
|
13
|
+
Object.defineProperty(exports, "isAllowedNavigation", { enumerable: true, get: function () { return lockdownRules_1.isAllowedNavigation; } });
|
|
14
|
+
Object.defineProperty(exports, "isDevToolsKey", { enumerable: true, get: function () { return lockdownRules_1.isDevToolsKey; } });
|
|
15
|
+
Object.defineProperty(exports, "debuggerRequested", { enumerable: true, get: function () { return lockdownRules_1.debuggerRequested; } });
|
|
16
|
+
Object.defineProperty(exports, "DEBUG_SWITCHES", { enumerable: true, get: function () { return lockdownRules_1.DEBUG_SWITCHES; } });
|
|
17
|
+
var lockdown_1 = require("./lockdown");
|
|
18
|
+
Object.defineProperty(exports, "lockDownWindow", { enumerable: true, get: function () { return lockdown_1.lockDownWindow; } });
|
|
19
|
+
Object.defineProperty(exports, "denyPermissions", { enumerable: true, get: function () { return lockdown_1.denyPermissions; } });
|
|
20
|
+
Object.defineProperty(exports, "refuseDebugLaunch", { enumerable: true, get: function () { return lockdown_1.refuseDebugLaunch; } });
|