@rb-games/core 0.1.0
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/README.md +488 -0
- package/dist/devtools/DraggableController.d.ts +10 -0
- package/dist/devtools/DraggableController.d.ts.map +1 -0
- package/dist/devtools/ResizableController.d.ts +19 -0
- package/dist/devtools/ResizableController.d.ts.map +1 -0
- package/dist/devtools/index.d.ts +7 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +884 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/devtools/overlayPlugin.d.ts +3 -0
- package/dist/devtools/overlayPlugin.d.ts.map +1 -0
- package/dist/devtools/spinePropertiesPlugin.d.ts +3 -0
- package/dist/devtools/spinePropertiesPlugin.d.ts.map +1 -0
- package/dist/devtools/spriteTextPropertiesPlugin.d.ts +3 -0
- package/dist/devtools/spriteTextPropertiesPlugin.d.ts.map +1 -0
- package/dist/devtools/treePlugin.d.ts +7 -0
- package/dist/devtools/treePlugin.d.ts.map +1 -0
- package/dist/engine/PixiEngine.d.ts +404 -0
- package/dist/engine/PixiEngine.d.ts.map +1 -0
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +1818 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/filters/ChromaKeyFilter.d.ts +64 -0
- package/dist/filters/ChromaKeyFilter.d.ts.map +1 -0
- package/dist/filters/index.d.ts +2 -0
- package/dist/filters/index.d.ts.map +1 -0
- package/dist/filters/index.js +248 -0
- package/dist/filters/index.js.map +1 -0
- package/dist/helpers/AssetHelper.d.ts +117 -0
- package/dist/helpers/AssetHelper.d.ts.map +1 -0
- package/dist/helpers/SVGAssetHelper.d.ts +397 -0
- package/dist/helpers/SVGAssetHelper.d.ts.map +1 -0
- package/dist/helpers/SVGLoader.d.ts +46 -0
- package/dist/helpers/SVGLoader.d.ts.map +1 -0
- package/dist/helpers/SVGParser.d.ts +121 -0
- package/dist/helpers/SVGParser.d.ts.map +1 -0
- package/dist/helpers/eventBridge.d.ts +150 -0
- package/dist/helpers/eventBridge.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +702 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/mergeUtils.d.ts +21 -0
- package/dist/helpers/mergeUtils.d.ts.map +1 -0
- package/dist/helpers/resolvePublicPath.d.ts +6 -0
- package/dist/helpers/resolvePublicPath.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +527 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/sharedI18n.d.ts +11 -0
- package/dist/i18n/sharedI18n.d.ts.map +1 -0
- package/dist/layout/Align.d.ts +126 -0
- package/dist/layout/Align.d.ts.map +1 -0
- package/dist/layout/Bounds.d.ts +120 -0
- package/dist/layout/Bounds.d.ts.map +1 -0
- package/dist/layout/Distribute.d.ts +103 -0
- package/dist/layout/Distribute.d.ts.map +1 -0
- package/dist/layout/Flow.d.ts +213 -0
- package/dist/layout/Flow.d.ts.map +1 -0
- package/dist/layout/PositionUtils.d.ts +57 -0
- package/dist/layout/PositionUtils.d.ts.map +1 -0
- package/dist/layout/index.d.ts +6 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +673 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/particle/Emitter.d.ts +290 -0
- package/dist/particle/Emitter.d.ts.map +1 -0
- package/dist/particle/EmitterConfig.d.ts +228 -0
- package/dist/particle/EmitterConfig.d.ts.map +1 -0
- package/dist/particle/LinkedListContainer.d.ts +7 -0
- package/dist/particle/LinkedListContainer.d.ts.map +1 -0
- package/dist/particle/Particle.d.ts +63 -0
- package/dist/particle/Particle.d.ts.map +1 -0
- package/dist/particle/ParticleUtils.d.ts +97 -0
- package/dist/particle/ParticleUtils.d.ts.map +1 -0
- package/dist/particle/PropertyList.d.ts +40 -0
- package/dist/particle/PropertyList.d.ts.map +1 -0
- package/dist/particle/PropertyNode.d.ts +74 -0
- package/dist/particle/PropertyNode.d.ts.map +1 -0
- package/dist/particle/SpineEmitter.d.ts +55 -0
- package/dist/particle/SpineEmitter.d.ts.map +1 -0
- package/dist/particle/SpineParticle.d.ts +74 -0
- package/dist/particle/SpineParticle.d.ts.map +1 -0
- package/dist/particle/behaviors/AccelerationMovement.d.ts +62 -0
- package/dist/particle/behaviors/AccelerationMovement.d.ts.map +1 -0
- package/dist/particle/behaviors/Alpha.d.ts +60 -0
- package/dist/particle/behaviors/Alpha.d.ts.map +1 -0
- package/dist/particle/behaviors/AnimatedTexture.d.ts +111 -0
- package/dist/particle/behaviors/AnimatedTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/Behaviors.d.ts +71 -0
- package/dist/particle/behaviors/Behaviors.d.ts.map +1 -0
- package/dist/particle/behaviors/BlendMode.d.ts +31 -0
- package/dist/particle/behaviors/BlendMode.d.ts.map +1 -0
- package/dist/particle/behaviors/BurstSpawn.d.ts +43 -0
- package/dist/particle/behaviors/BurstSpawn.d.ts.map +1 -0
- package/dist/particle/behaviors/Color.d.ts +60 -0
- package/dist/particle/behaviors/Color.d.ts.map +1 -0
- package/dist/particle/behaviors/MultiStateAnimatedTexture.d.ts +99 -0
- package/dist/particle/behaviors/MultiStateAnimatedTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/OrderedTexture.d.ts +33 -0
- package/dist/particle/behaviors/OrderedTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/PathMovement.d.ts +68 -0
- package/dist/particle/behaviors/PathMovement.d.ts.map +1 -0
- package/dist/particle/behaviors/PointSpawn.d.ts +21 -0
- package/dist/particle/behaviors/PointSpawn.d.ts.map +1 -0
- package/dist/particle/behaviors/RandomColor.d.ts +17 -0
- package/dist/particle/behaviors/RandomColor.d.ts.map +1 -0
- package/dist/particle/behaviors/RandomTexture.d.ts +32 -0
- package/dist/particle/behaviors/RandomTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/Rotation.d.ts +114 -0
- package/dist/particle/behaviors/Rotation.d.ts.map +1 -0
- package/dist/particle/behaviors/Scale.d.ts +74 -0
- package/dist/particle/behaviors/Scale.d.ts.map +1 -0
- package/dist/particle/behaviors/ShapeSpawn.d.ts +58 -0
- package/dist/particle/behaviors/ShapeSpawn.d.ts.map +1 -0
- package/dist/particle/behaviors/SingleTexture.d.ts +32 -0
- package/dist/particle/behaviors/SingleTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/SpeedMovement.d.ts +76 -0
- package/dist/particle/behaviors/SpeedMovement.d.ts.map +1 -0
- package/dist/particle/behaviors/SpineTexture.d.ts +173 -0
- package/dist/particle/behaviors/SpineTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/ZindexBehavior.d.ts +16 -0
- package/dist/particle/behaviors/ZindexBehavior.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/Types.d.ts +104 -0
- package/dist/particle/behaviors/editor/Types.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/AccelerationMovement.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/AccelerationMovement.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/Alpha.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/Alpha.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/AnimatedTexture.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/AnimatedTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/BlendMode.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/BlendMode.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/BurstSpawn.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/BurstSpawn.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/Color.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/Color.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/OrderedTexture.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/OrderedTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/PathMovement.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/PathMovement.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/PointSpawn.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/PointSpawn.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/RandomTexture.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/RandomTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/Rotation.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/Rotation.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/Scale.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/Scale.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/ShapeSpawn.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/ShapeSpawn.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/SingleTexture.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/SingleTexture.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/SpeedMovement.d.ts +2 -0
- package/dist/particle/behaviors/editor/behaviors/SpeedMovement.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/behaviors/index.d.ts +15 -0
- package/dist/particle/behaviors/editor/behaviors/index.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/index.d.ts +5 -0
- package/dist/particle/behaviors/editor/index.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/shapes/PolygonalChain.d.ts +2 -0
- package/dist/particle/behaviors/editor/shapes/PolygonalChain.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/shapes/Rectangle.d.ts +2 -0
- package/dist/particle/behaviors/editor/shapes/Rectangle.d.ts.map +1 -0
- package/dist/particle/behaviors/editor/shapes/Torus.d.ts +2 -0
- package/dist/particle/behaviors/editor/shapes/Torus.d.ts.map +1 -0
- package/dist/particle/behaviors/index.d.ts +25 -0
- package/dist/particle/behaviors/index.d.ts.map +1 -0
- package/dist/particle/behaviors/shapes/PolygonalChain.d.ts +57 -0
- package/dist/particle/behaviors/shapes/PolygonalChain.d.ts.map +1 -0
- package/dist/particle/behaviors/shapes/Rectangle.d.ts +59 -0
- package/dist/particle/behaviors/shapes/Rectangle.d.ts.map +1 -0
- package/dist/particle/behaviors/shapes/SpawnShape.d.ts +32 -0
- package/dist/particle/behaviors/shapes/SpawnShape.d.ts.map +1 -0
- package/dist/particle/behaviors/shapes/Torus.d.ts +71 -0
- package/dist/particle/behaviors/shapes/Torus.d.ts.map +1 -0
- package/dist/particle/behaviors/shapes/index.d.ts +5 -0
- package/dist/particle/behaviors/shapes/index.d.ts.map +1 -0
- package/dist/particle/index.d.ts +11 -0
- package/dist/particle/index.d.ts.map +1 -0
- package/dist/particle/index.js +2845 -0
- package/dist/particle/index.js.map +1 -0
- package/dist/plugins/Plugin.types.d.ts +80 -0
- package/dist/plugins/Plugin.types.d.ts.map +1 -0
- package/dist/plugins/device/DeviceOptimizerPlugin.d.ts +187 -0
- package/dist/plugins/device/DeviceOptimizerPlugin.d.ts.map +1 -0
- package/dist/plugins/device/DeviceOptimizerPlugin.types.d.ts +134 -0
- package/dist/plugins/device/DeviceOptimizerPlugin.types.d.ts.map +1 -0
- package/dist/plugins/device/index.d.ts +3 -0
- package/dist/plugins/device/index.d.ts.map +1 -0
- package/dist/plugins/display/DisplayPlugin.d.ts +208 -0
- package/dist/plugins/display/DisplayPlugin.d.ts.map +1 -0
- package/dist/plugins/display/DisplayPlugin.types.d.ts +174 -0
- package/dist/plugins/display/DisplayPlugin.types.d.ts.map +1 -0
- package/dist/plugins/display/displayViewport.d.ts +10 -0
- package/dist/plugins/display/displayViewport.d.ts.map +1 -0
- package/dist/plugins/display/index.d.ts +4 -0
- package/dist/plugins/display/index.d.ts.map +1 -0
- package/dist/plugins/eventbus/EventBusPlugin.d.ts +21 -0
- package/dist/plugins/eventbus/EventBusPlugin.d.ts.map +1 -0
- package/dist/plugins/eventbus/EventBusPlugin.types.d.ts +24 -0
- package/dist/plugins/eventbus/EventBusPlugin.types.d.ts.map +1 -0
- package/dist/plugins/eventbus/index.d.ts +3 -0
- package/dist/plugins/eventbus/index.d.ts.map +1 -0
- package/dist/plugins/gsap/GsapPlugin.d.ts +307 -0
- package/dist/plugins/gsap/GsapPlugin.d.ts.map +1 -0
- package/dist/plugins/gsap/index.d.ts +2 -0
- package/dist/plugins/gsap/index.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +13 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +12806 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/input/InputPlugin.const.d.ts +80 -0
- package/dist/plugins/input/InputPlugin.const.d.ts.map +1 -0
- package/dist/plugins/input/InputPlugin.d.ts +141 -0
- package/dist/plugins/input/InputPlugin.d.ts.map +1 -0
- package/dist/plugins/input/InputPlugin.types.d.ts +41 -0
- package/dist/plugins/input/InputPlugin.types.d.ts.map +1 -0
- package/dist/plugins/input/KeyboardManager.d.ts +139 -0
- package/dist/plugins/input/KeyboardManager.d.ts.map +1 -0
- package/dist/plugins/input/KeyboardManager.types.d.ts +27 -0
- package/dist/plugins/input/KeyboardManager.types.d.ts.map +1 -0
- package/dist/plugins/input/index.d.ts +4 -0
- package/dist/plugins/input/index.d.ts.map +1 -0
- package/dist/plugins/language/I18NextPlugin.d.ts +30 -0
- package/dist/plugins/language/I18NextPlugin.d.ts.map +1 -0
- package/dist/plugins/language/I18NextPlugin.types.d.ts +29 -0
- package/dist/plugins/language/I18NextPlugin.types.d.ts.map +1 -0
- package/dist/plugins/language/index.d.ts +3 -0
- package/dist/plugins/language/index.d.ts.map +1 -0
- package/dist/plugins/resource/ResourcePlugin.d.ts +189 -0
- package/dist/plugins/resource/ResourcePlugin.d.ts.map +1 -0
- package/dist/plugins/resource/ResourcePlugin.types.d.ts +153 -0
- package/dist/plugins/resource/ResourcePlugin.types.d.ts.map +1 -0
- package/dist/plugins/resource/index.d.ts +3 -0
- package/dist/plugins/resource/index.d.ts.map +1 -0
- package/dist/plugins/scene/Scene.d.ts +203 -0
- package/dist/plugins/scene/Scene.d.ts.map +1 -0
- package/dist/plugins/scene/ScenePlugin.d.ts +162 -0
- package/dist/plugins/scene/ScenePlugin.d.ts.map +1 -0
- package/dist/plugins/scene/ScenePlugin.types.d.ts +35 -0
- package/dist/plugins/scene/ScenePlugin.types.d.ts.map +1 -0
- package/dist/plugins/scene/index.d.ts +4 -0
- package/dist/plugins/scene/index.d.ts.map +1 -0
- package/dist/plugins/sentry/SentryPlugin.d.ts +66 -0
- package/dist/plugins/sentry/SentryPlugin.d.ts.map +1 -0
- package/dist/plugins/sentry/SentryPlugin.types.d.ts +8 -0
- package/dist/plugins/sentry/SentryPlugin.types.d.ts.map +1 -0
- package/dist/plugins/sentry/index.d.ts +3 -0
- package/dist/plugins/sentry/index.d.ts.map +1 -0
- package/dist/plugins/service/ServiceAdapter.d.ts +88 -0
- package/dist/plugins/service/ServiceAdapter.d.ts.map +1 -0
- package/dist/plugins/service/ServiceEventHelper.d.ts +6 -0
- package/dist/plugins/service/ServiceEventHelper.d.ts.map +1 -0
- package/dist/plugins/service/ServicePlugin.d.ts +135 -0
- package/dist/plugins/service/ServicePlugin.d.ts.map +1 -0
- package/dist/plugins/service/ServicePlugin.types.d.ts +14 -0
- package/dist/plugins/service/ServicePlugin.types.d.ts.map +1 -0
- package/dist/plugins/service/adapters/DevAuthAdapter.d.ts +56 -0
- package/dist/plugins/service/adapters/DevAuthAdapter.d.ts.map +1 -0
- package/dist/plugins/service/adapters/RGSAdapter.d.ts +82 -0
- package/dist/plugins/service/adapters/RGSAdapter.d.ts.map +1 -0
- package/dist/plugins/service/adapters/index.d.ts +7 -0
- package/dist/plugins/service/adapters/index.d.ts.map +1 -0
- package/dist/plugins/service/adapters/resolvePublicIp.d.ts +10 -0
- package/dist/plugins/service/adapters/resolvePublicIp.d.ts.map +1 -0
- package/dist/plugins/service/index.d.ts +10 -0
- package/dist/plugins/service/index.d.ts.map +1 -0
- package/dist/plugins/service/types/api.types.d.ts +299 -0
- package/dist/plugins/service/types/api.types.d.ts.map +1 -0
- package/dist/plugins/service/types/index.d.ts +6 -0
- package/dist/plugins/service/types/index.d.ts.map +1 -0
- package/dist/plugins/skin/ISkin.d.ts +62 -0
- package/dist/plugins/skin/ISkin.d.ts.map +1 -0
- package/dist/plugins/skin/Skin.d.ts +155 -0
- package/dist/plugins/skin/Skin.d.ts.map +1 -0
- package/dist/plugins/skin/SkinPlugin.d.ts +285 -0
- package/dist/plugins/skin/SkinPlugin.d.ts.map +1 -0
- package/dist/plugins/skin/SkinPlugin.types.d.ts +56 -0
- package/dist/plugins/skin/SkinPlugin.types.d.ts.map +1 -0
- package/dist/plugins/skin/index.d.ts +5 -0
- package/dist/plugins/skin/index.d.ts.map +1 -0
- package/dist/plugins/sound/SoundPlugin.d.ts +319 -0
- package/dist/plugins/sound/SoundPlugin.d.ts.map +1 -0
- package/dist/plugins/sound/SoundPlugin.types.d.ts +102 -0
- package/dist/plugins/sound/SoundPlugin.types.d.ts.map +1 -0
- package/dist/plugins/sound/SoundTestGUI.d.ts +42 -0
- package/dist/plugins/sound/SoundTestGUI.d.ts.map +1 -0
- package/dist/plugins/sound/index.d.ts +4 -0
- package/dist/plugins/sound/index.d.ts.map +1 -0
- package/dist/state-machine/ConfigBuilder.d.ts +239 -0
- package/dist/state-machine/ConfigBuilder.d.ts.map +1 -0
- package/dist/state-machine/StateMachine.d.ts +251 -0
- package/dist/state-machine/StateMachine.d.ts.map +1 -0
- package/dist/state-machine/guards.d.ts +151 -0
- package/dist/state-machine/guards.d.ts.map +1 -0
- package/dist/state-machine/index.d.ts +5 -0
- package/dist/state-machine/index.d.ts.map +1 -0
- package/dist/state-machine/index.js +954 -0
- package/dist/state-machine/index.js.map +1 -0
- package/dist/state-machine/types.d.ts +65 -0
- package/dist/state-machine/types.d.ts.map +1 -0
- package/dist/store/DataStore.d.ts +167 -0
- package/dist/store/DataStore.d.ts.map +1 -0
- package/dist/store/index.d.ts +3 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +197 -0
- package/dist/store/index.js.map +1 -0
- package/dist/ui/behaviors/ButtonBehavior.d.ts +245 -0
- package/dist/ui/behaviors/ButtonBehavior.d.ts.map +1 -0
- package/dist/ui/behaviors/InputBehavior.d.ts +169 -0
- package/dist/ui/behaviors/InputBehavior.d.ts.map +1 -0
- package/dist/ui/behaviors/ScrollbarBehavior.d.ts +371 -0
- package/dist/ui/behaviors/ScrollbarBehavior.d.ts.map +1 -0
- package/dist/ui/behaviors/index.d.ts +4 -0
- package/dist/ui/behaviors/index.d.ts.map +1 -0
- package/dist/ui/components/ButtonComp.d.ts +138 -0
- package/dist/ui/components/ButtonComp.d.ts.map +1 -0
- package/dist/ui/components/Comp.utils.d.ts +390 -0
- package/dist/ui/components/Comp.utils.d.ts.map +1 -0
- package/dist/ui/components/Component.types.d.ts +41 -0
- package/dist/ui/components/Component.types.d.ts.map +1 -0
- package/dist/ui/components/InputComp.d.ts +43 -0
- package/dist/ui/components/InputComp.d.ts.map +1 -0
- package/dist/ui/components/LabelBox.d.ts +49 -0
- package/dist/ui/components/LabelBox.d.ts.map +1 -0
- package/dist/ui/components/ListTableComp.d.ts +106 -0
- package/dist/ui/components/ListTableComp.d.ts.map +1 -0
- package/dist/ui/components/Skinable.d.ts +261 -0
- package/dist/ui/components/Skinable.d.ts.map +1 -0
- package/dist/ui/components/SliderComp.d.ts +60 -0
- package/dist/ui/components/SliderComp.d.ts.map +1 -0
- package/dist/ui/components/SpriteTextBBCode.d.ts +16 -0
- package/dist/ui/components/SpriteTextBBCode.d.ts.map +1 -0
- package/dist/ui/components/StepperComp.d.ts +89 -0
- package/dist/ui/components/StepperComp.d.ts.map +1 -0
- package/dist/ui/components/index.d.ts +12 -0
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteText.d.ts +114 -0
- package/dist/ui/components/spriteText/SpriteText.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteText.types.d.ts +109 -0
- package/dist/ui/components/spriteText/SpriteText.types.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteTextAlignment.d.ts +25 -0
- package/dist/ui/components/spriteText/SpriteTextAlignment.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteTextBezier.d.ts +20 -0
- package/dist/ui/components/spriteText/SpriteTextBezier.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteTextCurve.d.ts +4 -0
- package/dist/ui/components/spriteText/SpriteTextCurve.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteTextKerning.d.ts +7 -0
- package/dist/ui/components/spriteText/SpriteTextKerning.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteTextTexture.d.ts +16 -0
- package/dist/ui/components/spriteText/SpriteTextTexture.d.ts.map +1 -0
- package/dist/ui/components/spriteText/SpriteTextWrap.d.ts +19 -0
- package/dist/ui/components/spriteText/SpriteTextWrap.d.ts.map +1 -0
- package/dist/ui/components/spriteText/index.d.ts +3 -0
- package/dist/ui/components/spriteText/index.d.ts.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +4778 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/utils/ArrayUtils.d.ts +24 -0
- package/dist/utils/ArrayUtils.d.ts.map +1 -0
- package/dist/utils/ColorUtils.d.ts +34 -0
- package/dist/utils/ColorUtils.d.ts.map +1 -0
- package/dist/utils/DataInjector.d.ts +67 -0
- package/dist/utils/DataInjector.d.ts.map +1 -0
- package/dist/utils/Logger.d.ts +332 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/NumberFormatter.d.ts +126 -0
- package/dist/utils/NumberFormatter.d.ts.map +1 -0
- package/dist/utils/ObjectUtils.d.ts +64 -0
- package/dist/utils/ObjectUtils.d.ts.map +1 -0
- package/dist/utils/PixiUtils.d.ts +118 -0
- package/dist/utils/PixiUtils.d.ts.map +1 -0
- package/dist/utils/Throttle.d.ts +103 -0
- package/dist/utils/Throttle.d.ts.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +899 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/vite/index.d.ts +3 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +126 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/mergeLocalesPlugin.d.ts +22 -0
- package/dist/vite/mergeLocalesPlugin.d.ts.map +1 -0
- package/package.json +143 -0
|
@@ -0,0 +1,1818 @@
|
|
|
1
|
+
import '@pixi/layout';
|
|
2
|
+
import '@pixi/layout/devtools';
|
|
3
|
+
import { Application, isMobile } from 'pixi.js';
|
|
4
|
+
|
|
5
|
+
// engine/PixiEngine.ts
|
|
6
|
+
|
|
7
|
+
// devtools/DraggableController.ts
|
|
8
|
+
var dragStates = /* @__PURE__ */ new WeakMap();
|
|
9
|
+
var originalEventModes = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
var originalCursors = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
function onDragStart(e) {
|
|
12
|
+
if (!this.__draggable) return;
|
|
13
|
+
this.__dragging = true;
|
|
14
|
+
this.cursor = "grabbing";
|
|
15
|
+
const parent = this.parent;
|
|
16
|
+
if (!parent) return;
|
|
17
|
+
const localPos = parent.toLocal(e.global);
|
|
18
|
+
dragStates.set(this, {
|
|
19
|
+
offsetX: localPos.x - this.x,
|
|
20
|
+
offsetY: localPos.y - this.y
|
|
21
|
+
});
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
}
|
|
24
|
+
function onDragMove(e) {
|
|
25
|
+
if (!this.__dragging) return;
|
|
26
|
+
const state = dragStates.get(this);
|
|
27
|
+
if (!state) return;
|
|
28
|
+
const parent = this.parent;
|
|
29
|
+
if (!parent) return;
|
|
30
|
+
const localPos = parent.toLocal(e.global);
|
|
31
|
+
this.x = localPos.x - state.offsetX;
|
|
32
|
+
this.y = localPos.y - state.offsetY;
|
|
33
|
+
}
|
|
34
|
+
function onDragEnd() {
|
|
35
|
+
if (!this.__dragging) return;
|
|
36
|
+
this.__dragging = false;
|
|
37
|
+
this.cursor = "grab";
|
|
38
|
+
dragStates.delete(this);
|
|
39
|
+
}
|
|
40
|
+
function enableDrag(container) {
|
|
41
|
+
originalEventModes.set(container, container.eventMode);
|
|
42
|
+
originalCursors.set(container, container.cursor);
|
|
43
|
+
container.eventMode = "static";
|
|
44
|
+
container.cursor = "grab";
|
|
45
|
+
container.on("pointerdown", onDragStart, container);
|
|
46
|
+
container.on("globalpointermove", onDragMove, container);
|
|
47
|
+
container.on("pointerup", onDragEnd, container);
|
|
48
|
+
container.on("pointerupoutside", onDragEnd, container);
|
|
49
|
+
}
|
|
50
|
+
function disableDrag(container) {
|
|
51
|
+
container.off("pointerdown", onDragStart, container);
|
|
52
|
+
container.off("globalpointermove", onDragMove, container);
|
|
53
|
+
container.off("pointerup", onDragEnd, container);
|
|
54
|
+
container.off("pointerupoutside", onDragEnd, container);
|
|
55
|
+
const originalMode = originalEventModes.get(container);
|
|
56
|
+
if (originalMode !== void 0) {
|
|
57
|
+
container.eventMode = originalMode;
|
|
58
|
+
}
|
|
59
|
+
const originalCursor = originalCursors.get(container);
|
|
60
|
+
if (originalCursor !== void 0) {
|
|
61
|
+
container.cursor = originalCursor;
|
|
62
|
+
}
|
|
63
|
+
container.__dragging = false;
|
|
64
|
+
dragStates.delete(container);
|
|
65
|
+
originalEventModes.delete(container);
|
|
66
|
+
originalCursors.delete(container);
|
|
67
|
+
}
|
|
68
|
+
function isDragging(container) {
|
|
69
|
+
return container.__dragging === true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// devtools/ResizableController.ts
|
|
73
|
+
var resizeStates = /* @__PURE__ */ new WeakMap();
|
|
74
|
+
var HANDLE_SIZE = 10;
|
|
75
|
+
var cursors = {
|
|
76
|
+
nw: "nwse-resize",
|
|
77
|
+
n: "ns-resize",
|
|
78
|
+
ne: "nesw-resize",
|
|
79
|
+
e: "ew-resize",
|
|
80
|
+
se: "nwse-resize",
|
|
81
|
+
s: "ns-resize",
|
|
82
|
+
sw: "nesw-resize",
|
|
83
|
+
w: "ew-resize"
|
|
84
|
+
};
|
|
85
|
+
function getCanvasElement(container) {
|
|
86
|
+
var _a2, _b;
|
|
87
|
+
try {
|
|
88
|
+
const renderer = ((_a2 = container.__pixiApp) == null ? void 0 : _a2.renderer) ?? ((_b = globalThis.__PIXI_APP__) == null ? void 0 : _b.renderer);
|
|
89
|
+
if (renderer == null ? void 0 : renderer.canvas) return renderer.canvas;
|
|
90
|
+
return document.querySelector("canvas");
|
|
91
|
+
} catch {
|
|
92
|
+
return document.querySelector("canvas");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function createOverlayContainer(canvas) {
|
|
96
|
+
var _a2;
|
|
97
|
+
const div = document.createElement("div");
|
|
98
|
+
div.className = "__pixi_resize_overlay__";
|
|
99
|
+
div.style.cssText = `
|
|
100
|
+
position: absolute;
|
|
101
|
+
top: 0;
|
|
102
|
+
left: 0;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 100%;
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
z-index: 10000;
|
|
107
|
+
`;
|
|
108
|
+
(_a2 = canvas.parentElement) == null ? void 0 : _a2.appendChild(div);
|
|
109
|
+
return div;
|
|
110
|
+
}
|
|
111
|
+
function createBorderDiv() {
|
|
112
|
+
const div = document.createElement("div");
|
|
113
|
+
div.style.cssText = `
|
|
114
|
+
position: absolute;
|
|
115
|
+
border: 2px dashed #00aaff;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
box-sizing: border-box;
|
|
118
|
+
`;
|
|
119
|
+
return div;
|
|
120
|
+
}
|
|
121
|
+
function createHandleDiv(pos) {
|
|
122
|
+
const div = document.createElement("div");
|
|
123
|
+
div.dataset.handle = pos;
|
|
124
|
+
div.style.cssText = `
|
|
125
|
+
position: absolute;
|
|
126
|
+
width: ${HANDLE_SIZE}px;
|
|
127
|
+
height: ${HANDLE_SIZE}px;
|
|
128
|
+
background: #00aaff;
|
|
129
|
+
border: 1px solid white;
|
|
130
|
+
border-radius: 2px;
|
|
131
|
+
cursor: ${cursors[pos]};
|
|
132
|
+
pointer-events: auto;
|
|
133
|
+
transform: translate(-50%, -50%);
|
|
134
|
+
transition: background 0.1s;
|
|
135
|
+
`;
|
|
136
|
+
div.addEventListener("mouseenter", () => {
|
|
137
|
+
div.style.background = "#ff6600";
|
|
138
|
+
});
|
|
139
|
+
div.addEventListener("mouseleave", () => {
|
|
140
|
+
div.style.background = "#00aaff";
|
|
141
|
+
});
|
|
142
|
+
return div;
|
|
143
|
+
}
|
|
144
|
+
function createResizeOverlay(container, canvas) {
|
|
145
|
+
const overlayContainer = createOverlayContainer(canvas);
|
|
146
|
+
const border = createBorderDiv();
|
|
147
|
+
overlayContainer.appendChild(border);
|
|
148
|
+
const handles = /* @__PURE__ */ new Map();
|
|
149
|
+
const positions = ["nw", "n", "ne", "e", "se", "s", "sw", "w"];
|
|
150
|
+
positions.forEach((pos) => {
|
|
151
|
+
const handle = createHandleDiv(pos);
|
|
152
|
+
handles.set(pos, handle);
|
|
153
|
+
overlayContainer.appendChild(handle);
|
|
154
|
+
handle.addEventListener("pointerdown", (e) => {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
e.stopPropagation();
|
|
157
|
+
onResizeStart(container, pos, e);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
return {
|
|
161
|
+
container: overlayContainer,
|
|
162
|
+
handles,
|
|
163
|
+
border,
|
|
164
|
+
animationId: null
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function updateOverlayPositions(container, canvas) {
|
|
168
|
+
var _a2, _b;
|
|
169
|
+
const overlay = container.__resizeOverlay;
|
|
170
|
+
if (!overlay) return;
|
|
171
|
+
const bounds = container.getBounds();
|
|
172
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
173
|
+
const renderer = ((_a2 = globalThis.__PIXI_APP__) == null ? void 0 : _a2.renderer) ?? ((_b = container.__pixiApp) == null ? void 0 : _b.renderer);
|
|
174
|
+
let scaleX = 1;
|
|
175
|
+
let scaleY = 1;
|
|
176
|
+
if (renderer) {
|
|
177
|
+
scaleX = canvasRect.width / renderer.width;
|
|
178
|
+
scaleY = canvasRect.height / renderer.height;
|
|
179
|
+
}
|
|
180
|
+
const x = bounds.x * scaleX;
|
|
181
|
+
const y = bounds.y * scaleY;
|
|
182
|
+
const w = bounds.width * scaleX;
|
|
183
|
+
const h = bounds.height * scaleY;
|
|
184
|
+
overlay.border.style.left = `${x}px`;
|
|
185
|
+
overlay.border.style.top = `${y}px`;
|
|
186
|
+
overlay.border.style.width = `${w}px`;
|
|
187
|
+
overlay.border.style.height = `${h}px`;
|
|
188
|
+
const handlePositions = {
|
|
189
|
+
nw: { x, y },
|
|
190
|
+
n: { x: x + w / 2, y },
|
|
191
|
+
ne: { x: x + w, y },
|
|
192
|
+
e: { x: x + w, y: y + h / 2 },
|
|
193
|
+
se: { x: x + w, y: y + h },
|
|
194
|
+
s: { x: x + w / 2, y: y + h },
|
|
195
|
+
sw: { x, y: y + h },
|
|
196
|
+
w: { x, y: y + h / 2 }
|
|
197
|
+
};
|
|
198
|
+
overlay.handles.forEach((handle, pos) => {
|
|
199
|
+
const { x: hx, y: hy } = handlePositions[pos];
|
|
200
|
+
handle.style.left = `${hx}px`;
|
|
201
|
+
handle.style.top = `${hy}px`;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function startUpdateLoop(container, canvas) {
|
|
205
|
+
const overlay = container.__resizeOverlay;
|
|
206
|
+
if (!overlay) return;
|
|
207
|
+
const update = () => {
|
|
208
|
+
if (!container.__resizable || !container.__resizeOverlay) return;
|
|
209
|
+
updateOverlayPositions(container, canvas);
|
|
210
|
+
overlay.animationId = requestAnimationFrame(update);
|
|
211
|
+
};
|
|
212
|
+
overlay.animationId = requestAnimationFrame(update);
|
|
213
|
+
}
|
|
214
|
+
function stopUpdateLoop(overlay) {
|
|
215
|
+
if (overlay.animationId !== null) {
|
|
216
|
+
cancelAnimationFrame(overlay.animationId);
|
|
217
|
+
overlay.animationId = null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function onResizeStart(container, handle, e) {
|
|
221
|
+
if (!container.__resizable) return;
|
|
222
|
+
container.__resizing = true;
|
|
223
|
+
const bounds = container.getLocalBounds();
|
|
224
|
+
resizeStates.set(container, {
|
|
225
|
+
handle,
|
|
226
|
+
startX: e.clientX,
|
|
227
|
+
startY: e.clientY,
|
|
228
|
+
startScaleX: container.scale.x,
|
|
229
|
+
startScaleY: container.scale.y,
|
|
230
|
+
startPosX: container.x,
|
|
231
|
+
startPosY: container.y,
|
|
232
|
+
startBounds: { width: bounds.width, height: bounds.height }
|
|
233
|
+
});
|
|
234
|
+
const onMove = (moveEvent) => {
|
|
235
|
+
onResizeMove(container, moveEvent);
|
|
236
|
+
};
|
|
237
|
+
const onUp = () => {
|
|
238
|
+
onResizeEnd(container);
|
|
239
|
+
document.removeEventListener("pointermove", onMove);
|
|
240
|
+
document.removeEventListener("pointerup", onUp);
|
|
241
|
+
};
|
|
242
|
+
document.addEventListener("pointermove", onMove);
|
|
243
|
+
document.addEventListener("pointerup", onUp);
|
|
244
|
+
}
|
|
245
|
+
function onResizeMove(container, e) {
|
|
246
|
+
const state = resizeStates.get(container);
|
|
247
|
+
if (!state || !container.__resizing) return;
|
|
248
|
+
const dx = e.clientX - state.startX;
|
|
249
|
+
const dy = e.clientY - state.startY;
|
|
250
|
+
const baseWidth = state.startBounds.width;
|
|
251
|
+
const baseHeight = state.startBounds.height;
|
|
252
|
+
const startWidth = baseWidth * state.startScaleX;
|
|
253
|
+
const startHeight = baseHeight * state.startScaleY;
|
|
254
|
+
let newScaleX = state.startScaleX;
|
|
255
|
+
let newScaleY = state.startScaleY;
|
|
256
|
+
let newX = state.startPosX;
|
|
257
|
+
let newY = state.startPosY;
|
|
258
|
+
switch (state.handle) {
|
|
259
|
+
case "e":
|
|
260
|
+
newScaleX = (startWidth + dx) / baseWidth;
|
|
261
|
+
break;
|
|
262
|
+
case "w":
|
|
263
|
+
newScaleX = (startWidth - dx) / baseWidth;
|
|
264
|
+
newX = state.startPosX + dx;
|
|
265
|
+
break;
|
|
266
|
+
case "s":
|
|
267
|
+
newScaleY = (startHeight + dy) / baseHeight;
|
|
268
|
+
break;
|
|
269
|
+
case "n":
|
|
270
|
+
newScaleY = (startHeight - dy) / baseHeight;
|
|
271
|
+
newY = state.startPosY + dy;
|
|
272
|
+
break;
|
|
273
|
+
case "se":
|
|
274
|
+
newScaleX = (startWidth + dx) / baseWidth;
|
|
275
|
+
newScaleY = (startHeight + dy) / baseHeight;
|
|
276
|
+
break;
|
|
277
|
+
case "sw":
|
|
278
|
+
newScaleX = (startWidth - dx) / baseWidth;
|
|
279
|
+
newScaleY = (startHeight + dy) / baseHeight;
|
|
280
|
+
newX = state.startPosX + dx;
|
|
281
|
+
break;
|
|
282
|
+
case "ne":
|
|
283
|
+
newScaleX = (startWidth + dx) / baseWidth;
|
|
284
|
+
newScaleY = (startHeight - dy) / baseHeight;
|
|
285
|
+
newY = state.startPosY + dy;
|
|
286
|
+
break;
|
|
287
|
+
case "nw":
|
|
288
|
+
newScaleX = (startWidth - dx) / baseWidth;
|
|
289
|
+
newScaleY = (startHeight - dy) / baseHeight;
|
|
290
|
+
newX = state.startPosX + dx;
|
|
291
|
+
newY = state.startPosY + dy;
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
if (newScaleX > 0.1) {
|
|
295
|
+
container.scale.x = newScaleX;
|
|
296
|
+
container.x = newX;
|
|
297
|
+
}
|
|
298
|
+
if (newScaleY > 0.1) {
|
|
299
|
+
container.scale.y = newScaleY;
|
|
300
|
+
container.y = newY;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function onResizeEnd(container) {
|
|
304
|
+
container.__resizing = false;
|
|
305
|
+
resizeStates.delete(container);
|
|
306
|
+
}
|
|
307
|
+
function enableResize(container) {
|
|
308
|
+
if (container.__resizeOverlay) return;
|
|
309
|
+
const canvas = getCanvasElement(container);
|
|
310
|
+
if (!canvas) {
|
|
311
|
+
console.warn("[ResizableController] Canvas not found");
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const overlay = createResizeOverlay(container, canvas);
|
|
315
|
+
container.__resizeOverlay = overlay;
|
|
316
|
+
updateOverlayPositions(container, canvas);
|
|
317
|
+
startUpdateLoop(container, canvas);
|
|
318
|
+
}
|
|
319
|
+
function disableResize(container) {
|
|
320
|
+
const overlay = container.__resizeOverlay;
|
|
321
|
+
if (overlay) {
|
|
322
|
+
stopUpdateLoop(overlay);
|
|
323
|
+
overlay.container.remove();
|
|
324
|
+
container.__resizeOverlay = void 0;
|
|
325
|
+
}
|
|
326
|
+
container.__resizing = false;
|
|
327
|
+
resizeStates.delete(container);
|
|
328
|
+
}
|
|
329
|
+
function isResizing(container) {
|
|
330
|
+
return container.__resizing === true;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// devtools/treePlugin.ts
|
|
334
|
+
var draggableTreePlugin = {
|
|
335
|
+
extension: {
|
|
336
|
+
name: "draggable-tree",
|
|
337
|
+
type: "sceneTree"
|
|
338
|
+
},
|
|
339
|
+
updateNodeMetadata(node, metadata) {
|
|
340
|
+
metadata.buttons.push({
|
|
341
|
+
name: "drag",
|
|
342
|
+
icon: "\u270B",
|
|
343
|
+
type: "toggle",
|
|
344
|
+
value: node.__draggable ?? false
|
|
345
|
+
});
|
|
346
|
+
metadata.buttons.push({
|
|
347
|
+
name: "resize",
|
|
348
|
+
icon: "\u2921",
|
|
349
|
+
type: "toggle",
|
|
350
|
+
value: node.__resizable ?? false
|
|
351
|
+
});
|
|
352
|
+
const suffixes = [];
|
|
353
|
+
if (node.__draggable) suffixes.push("\u{1F500}");
|
|
354
|
+
if (node.__resizable) suffixes.push("\u{1F4D0}");
|
|
355
|
+
if (suffixes.length > 0) {
|
|
356
|
+
metadata.suffix = (metadata.suffix ?? "") + " " + suffixes.join("");
|
|
357
|
+
}
|
|
358
|
+
return metadata;
|
|
359
|
+
},
|
|
360
|
+
onButtonPress(container, buttonName, pressed) {
|
|
361
|
+
if (buttonName === "drag") {
|
|
362
|
+
container.__draggable = pressed;
|
|
363
|
+
if (pressed) {
|
|
364
|
+
enableDrag(container);
|
|
365
|
+
} else {
|
|
366
|
+
disableDrag(container);
|
|
367
|
+
}
|
|
368
|
+
} else if (buttonName === "resize") {
|
|
369
|
+
container.__resizable = pressed;
|
|
370
|
+
if (pressed) {
|
|
371
|
+
enableResize(container);
|
|
372
|
+
} else {
|
|
373
|
+
disableResize(container);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
// devtools/overlayPlugin.ts
|
|
380
|
+
var defaultSelectedStyle = {
|
|
381
|
+
backgroundColor: "hsla(340, 70%, 44%, 0.35)",
|
|
382
|
+
border: "1px solid hsla(0, 0%, 100%, 0.5)"
|
|
383
|
+
};
|
|
384
|
+
var defaultHoverStyle = {
|
|
385
|
+
backgroundColor: "hsla(192, 84%, 40%, 0.40)",
|
|
386
|
+
border: "1px solid hsla(0, 0%, 100%, 0.5)"
|
|
387
|
+
};
|
|
388
|
+
var draggableOverlayPlugin = {
|
|
389
|
+
extension: {
|
|
390
|
+
name: "draggable-overlay",
|
|
391
|
+
type: "overlay"
|
|
392
|
+
},
|
|
393
|
+
getSelectedStyle(node) {
|
|
394
|
+
const n = node;
|
|
395
|
+
if (n && isDragging(n)) {
|
|
396
|
+
return {
|
|
397
|
+
backgroundColor: "rgba(255, 165, 0, 0.3)",
|
|
398
|
+
border: "2px dashed orange"
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
if (n && isResizing(n)) {
|
|
402
|
+
return {
|
|
403
|
+
backgroundColor: "rgba(255, 165, 0, 0.3)",
|
|
404
|
+
border: "2px dashed orange"
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
if (n && (n.__draggable || n.__resizable)) {
|
|
408
|
+
return {
|
|
409
|
+
backgroundColor: "rgba(255, 165, 0, 0.2)",
|
|
410
|
+
border: "2px solid orange"
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
return defaultSelectedStyle;
|
|
414
|
+
},
|
|
415
|
+
getHoverStyle(node) {
|
|
416
|
+
const n = node;
|
|
417
|
+
if (n && (n.__draggable || n.__resizable)) {
|
|
418
|
+
return {
|
|
419
|
+
backgroundColor: "rgba(255, 165, 0, 0.15)",
|
|
420
|
+
border: "1px dashed orange"
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
return defaultHoverStyle;
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// devtools/spriteTextPropertiesPlugin.ts
|
|
428
|
+
var SECTION = "SpriteText";
|
|
429
|
+
var spriteTextProps = [
|
|
430
|
+
"spriteText.text",
|
|
431
|
+
"spriteText.font",
|
|
432
|
+
"spriteText.tint",
|
|
433
|
+
"spriteText.fontSize",
|
|
434
|
+
"spriteText.pivotHorizontal",
|
|
435
|
+
"spriteText.pivotVertical",
|
|
436
|
+
"spriteText.lineAlign",
|
|
437
|
+
"spriteText.letterSpacing",
|
|
438
|
+
"spriteText.spaceWidth",
|
|
439
|
+
"spriteText.wordWrap",
|
|
440
|
+
"spriteText.wordWrapWidth",
|
|
441
|
+
"spriteText.breakWord",
|
|
442
|
+
"spriteText.allowLineBreak",
|
|
443
|
+
"spriteText.kerningEnabled",
|
|
444
|
+
"spriteText.curveEnabled",
|
|
445
|
+
"spriteText.curveControlXPercent",
|
|
446
|
+
"spriteText.curveControlYPercent"
|
|
447
|
+
];
|
|
448
|
+
function isSpriteText(container) {
|
|
449
|
+
const name = container.constructor.name;
|
|
450
|
+
if (name === "SpriteText") return true;
|
|
451
|
+
const c = container;
|
|
452
|
+
const isDuck = c._text !== void 0 && c._font !== void 0 && c._glyphs !== void 0;
|
|
453
|
+
if (isDuck) {
|
|
454
|
+
console.log("[SpriteText Plugin] Detected via duck typing:", name);
|
|
455
|
+
}
|
|
456
|
+
return isDuck;
|
|
457
|
+
}
|
|
458
|
+
var spriteTextPropertiesPlugin = {
|
|
459
|
+
extension: {
|
|
460
|
+
type: "sceneProperties",
|
|
461
|
+
name: "spritetext-properties",
|
|
462
|
+
priority: 10
|
|
463
|
+
},
|
|
464
|
+
testNode(container) {
|
|
465
|
+
return isSpriteText(container);
|
|
466
|
+
},
|
|
467
|
+
testProp(prop) {
|
|
468
|
+
return spriteTextProps.includes(prop);
|
|
469
|
+
},
|
|
470
|
+
setProperty(container, prop, value) {
|
|
471
|
+
const spriteText = container;
|
|
472
|
+
const propName = prop.replace("spriteText.", "");
|
|
473
|
+
switch (propName) {
|
|
474
|
+
case "text":
|
|
475
|
+
spriteText.text = value;
|
|
476
|
+
break;
|
|
477
|
+
case "font":
|
|
478
|
+
spriteText.font = value;
|
|
479
|
+
break;
|
|
480
|
+
case "tint":
|
|
481
|
+
if (typeof value === "string") {
|
|
482
|
+
spriteText.tint = parseInt(value.replace("#", ""), 16);
|
|
483
|
+
} else {
|
|
484
|
+
spriteText.tint = value;
|
|
485
|
+
}
|
|
486
|
+
break;
|
|
487
|
+
case "fontSize":
|
|
488
|
+
spriteText.fontSize = value;
|
|
489
|
+
break;
|
|
490
|
+
case "pivotHorizontal":
|
|
491
|
+
spriteText.pivotHorizontal = value;
|
|
492
|
+
break;
|
|
493
|
+
case "pivotVertical":
|
|
494
|
+
spriteText.pivotVertical = value;
|
|
495
|
+
break;
|
|
496
|
+
case "lineAlign":
|
|
497
|
+
spriteText.lineAlign = value;
|
|
498
|
+
break;
|
|
499
|
+
case "letterSpacing":
|
|
500
|
+
spriteText.letterSpacing = value;
|
|
501
|
+
break;
|
|
502
|
+
case "spaceWidth":
|
|
503
|
+
spriteText.spaceWidth = value;
|
|
504
|
+
break;
|
|
505
|
+
case "wordWrap":
|
|
506
|
+
spriteText.wordWrap = value;
|
|
507
|
+
break;
|
|
508
|
+
case "wordWrapWidth":
|
|
509
|
+
spriteText.wordWrapWidth = value;
|
|
510
|
+
break;
|
|
511
|
+
case "breakWord":
|
|
512
|
+
spriteText.breakWord = value;
|
|
513
|
+
break;
|
|
514
|
+
case "allowLineBreak":
|
|
515
|
+
spriteText.allowLineBreak = value;
|
|
516
|
+
break;
|
|
517
|
+
case "kerningEnabled":
|
|
518
|
+
spriteText.kerningEnabled = value;
|
|
519
|
+
break;
|
|
520
|
+
case "curveEnabled":
|
|
521
|
+
spriteText.curveEnabled = value;
|
|
522
|
+
break;
|
|
523
|
+
case "curveControlXPercent":
|
|
524
|
+
spriteText.curveControlXPercent = value;
|
|
525
|
+
break;
|
|
526
|
+
case "curveControlYPercent":
|
|
527
|
+
spriteText.curveControlYPercent = value;
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
getProperties(container) {
|
|
532
|
+
try {
|
|
533
|
+
const spriteText = container;
|
|
534
|
+
return [
|
|
535
|
+
{
|
|
536
|
+
prop: "spriteText.text",
|
|
537
|
+
value: spriteText.text,
|
|
538
|
+
entry: {
|
|
539
|
+
section: SECTION,
|
|
540
|
+
label: "Text",
|
|
541
|
+
type: "text"
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
prop: "spriteText.plainText",
|
|
546
|
+
value: spriteText.plainText,
|
|
547
|
+
entry: {
|
|
548
|
+
section: SECTION,
|
|
549
|
+
label: "Plain Text",
|
|
550
|
+
type: "text"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
prop: "spriteText.bbcodeEnabled",
|
|
555
|
+
value: spriteText.bbcodeEnabled,
|
|
556
|
+
entry: {
|
|
557
|
+
section: SECTION,
|
|
558
|
+
label: "BBCode Enabled",
|
|
559
|
+
type: "boolean"
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
prop: "spriteText.font",
|
|
564
|
+
value: spriteText.font,
|
|
565
|
+
entry: {
|
|
566
|
+
section: SECTION,
|
|
567
|
+
label: "Font",
|
|
568
|
+
type: "text"
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
prop: "spriteText.fonts",
|
|
573
|
+
value: spriteText.fonts.join(", "),
|
|
574
|
+
entry: {
|
|
575
|
+
section: SECTION,
|
|
576
|
+
label: "Fonts",
|
|
577
|
+
type: "text"
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
prop: "spriteText.tint",
|
|
582
|
+
// DevTools color picker expects number
|
|
583
|
+
value: spriteText.tint,
|
|
584
|
+
entry: {
|
|
585
|
+
section: SECTION,
|
|
586
|
+
label: "Tint",
|
|
587
|
+
type: "color"
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
prop: "spriteText.fontSize",
|
|
592
|
+
value: spriteText.fontSize,
|
|
593
|
+
entry: {
|
|
594
|
+
section: SECTION,
|
|
595
|
+
label: "Font Size",
|
|
596
|
+
type: "number"
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
prop: "spriteText.pivotHorizontal",
|
|
601
|
+
value: spriteText.pivotHorizontal,
|
|
602
|
+
entry: {
|
|
603
|
+
section: SECTION,
|
|
604
|
+
label: "Pivot H",
|
|
605
|
+
type: "select",
|
|
606
|
+
options: { options: ["left", "center", "right"] }
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
prop: "spriteText.pivotVertical",
|
|
611
|
+
value: spriteText.pivotVertical,
|
|
612
|
+
entry: {
|
|
613
|
+
section: SECTION,
|
|
614
|
+
label: "Pivot V",
|
|
615
|
+
type: "select",
|
|
616
|
+
options: { options: ["top", "middle", "bottom"] }
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
prop: "spriteText.lineAlign",
|
|
621
|
+
value: spriteText.lineAlign,
|
|
622
|
+
entry: {
|
|
623
|
+
section: SECTION,
|
|
624
|
+
label: "Line Align",
|
|
625
|
+
type: "select",
|
|
626
|
+
options: { options: ["left", "center", "right"] }
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
prop: "spriteText.letterSpacing",
|
|
631
|
+
value: spriteText.letterSpacing,
|
|
632
|
+
entry: {
|
|
633
|
+
section: SECTION,
|
|
634
|
+
label: "Letter Spacing",
|
|
635
|
+
type: "number"
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
prop: "spriteText.spaceWidth",
|
|
640
|
+
value: spriteText.spaceWidth,
|
|
641
|
+
entry: {
|
|
642
|
+
section: SECTION,
|
|
643
|
+
label: "Space Width",
|
|
644
|
+
type: "number"
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
prop: "spriteText.wordWrap",
|
|
649
|
+
value: spriteText.wordWrap,
|
|
650
|
+
entry: {
|
|
651
|
+
section: SECTION,
|
|
652
|
+
label: "Word Wrap",
|
|
653
|
+
type: "boolean"
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
prop: "spriteText.wordWrapWidth",
|
|
658
|
+
value: spriteText.wordWrapWidth,
|
|
659
|
+
entry: {
|
|
660
|
+
section: SECTION,
|
|
661
|
+
label: "Wrap Width",
|
|
662
|
+
type: "number"
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
prop: "spriteText.breakWord",
|
|
667
|
+
value: spriteText.breakWord,
|
|
668
|
+
entry: {
|
|
669
|
+
section: SECTION,
|
|
670
|
+
label: "Break Word",
|
|
671
|
+
type: "boolean"
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
prop: "spriteText.allowLineBreak",
|
|
676
|
+
value: spriteText.allowLineBreak,
|
|
677
|
+
entry: {
|
|
678
|
+
section: SECTION,
|
|
679
|
+
label: "Allow Line Break",
|
|
680
|
+
type: "boolean"
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
prop: "spriteText.kerningEnabled",
|
|
685
|
+
value: spriteText.kerningEnabled,
|
|
686
|
+
entry: {
|
|
687
|
+
section: SECTION,
|
|
688
|
+
label: "Kerning",
|
|
689
|
+
type: "boolean"
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
prop: "spriteText.curveEnabled",
|
|
694
|
+
value: spriteText.curveEnabled,
|
|
695
|
+
entry: {
|
|
696
|
+
section: SECTION,
|
|
697
|
+
label: "Curve Enabled",
|
|
698
|
+
type: "boolean"
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
prop: "spriteText.curveControlXPercent",
|
|
703
|
+
value: spriteText.curveControlXPercent,
|
|
704
|
+
entry: {
|
|
705
|
+
section: SECTION,
|
|
706
|
+
label: "Curve X %",
|
|
707
|
+
type: "number"
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
prop: "spriteText.curveControlYPercent",
|
|
712
|
+
value: spriteText.curveControlYPercent,
|
|
713
|
+
entry: {
|
|
714
|
+
section: SECTION,
|
|
715
|
+
label: "Curve Y %",
|
|
716
|
+
type: "number"
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
];
|
|
720
|
+
} catch (e) {
|
|
721
|
+
console.error("[SpriteText Plugin] Error getting properties:", e);
|
|
722
|
+
return [];
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// devtools/spinePropertiesPlugin.ts
|
|
728
|
+
var SECTION2 = "Spine";
|
|
729
|
+
var spineProps = [
|
|
730
|
+
"spine.currentAnimation",
|
|
731
|
+
"spine.currentSkin",
|
|
732
|
+
"spine.autoUpdate",
|
|
733
|
+
"spine.playAnimation"
|
|
734
|
+
];
|
|
735
|
+
function isSpine(container) {
|
|
736
|
+
var _a2, _b;
|
|
737
|
+
const name = container.constructor.name;
|
|
738
|
+
if (name === "Spine") return true;
|
|
739
|
+
const c = container;
|
|
740
|
+
return c.skeleton !== void 0 && c.state !== void 0 && ((_b = (_a2 = c.skeleton) == null ? void 0 : _a2.data) == null ? void 0 : _b.animations) !== void 0;
|
|
741
|
+
}
|
|
742
|
+
function getAnimationNames(spine) {
|
|
743
|
+
try {
|
|
744
|
+
return spine.skeleton.data.animations.map((a) => a.name);
|
|
745
|
+
} catch {
|
|
746
|
+
return [];
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function getSkinNames(spine) {
|
|
750
|
+
try {
|
|
751
|
+
return spine.skeleton.data.skins.map((s) => s.name);
|
|
752
|
+
} catch {
|
|
753
|
+
return [];
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
function getCurrentAnimation(spine) {
|
|
757
|
+
var _a2;
|
|
758
|
+
try {
|
|
759
|
+
const track = spine.state.tracks[0];
|
|
760
|
+
return ((_a2 = track == null ? void 0 : track.animation) == null ? void 0 : _a2.name) ?? "(none)";
|
|
761
|
+
} catch {
|
|
762
|
+
return "(none)";
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
function getCurrentSkin(spine) {
|
|
766
|
+
var _a2;
|
|
767
|
+
try {
|
|
768
|
+
return ((_a2 = spine.skeleton.skin) == null ? void 0 : _a2.name) ?? "default";
|
|
769
|
+
} catch {
|
|
770
|
+
return "default";
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
var spinePropertiesPlugin = {
|
|
774
|
+
extension: {
|
|
775
|
+
type: "sceneProperties",
|
|
776
|
+
name: "spine-properties",
|
|
777
|
+
priority: 10
|
|
778
|
+
},
|
|
779
|
+
testNode(container) {
|
|
780
|
+
return isSpine(container);
|
|
781
|
+
},
|
|
782
|
+
testProp(prop) {
|
|
783
|
+
return spineProps.includes(prop);
|
|
784
|
+
},
|
|
785
|
+
setProperty(container, prop, value) {
|
|
786
|
+
const spine = container;
|
|
787
|
+
const propName = prop.replace("spine.", "");
|
|
788
|
+
switch (propName) {
|
|
789
|
+
case "currentSkin":
|
|
790
|
+
try {
|
|
791
|
+
spine.skeleton.setSkinByName(value);
|
|
792
|
+
spine.skeleton.setSlotsToSetupPose();
|
|
793
|
+
} catch (e) {
|
|
794
|
+
console.error("[Spine Plugin] Error setting skin:", e);
|
|
795
|
+
}
|
|
796
|
+
break;
|
|
797
|
+
case "playAnimation":
|
|
798
|
+
try {
|
|
799
|
+
if (value && value !== "(none)") {
|
|
800
|
+
spine.state.setAnimation(0, value, true);
|
|
801
|
+
} else {
|
|
802
|
+
spine.state.setEmptyAnimation(0, 0.2);
|
|
803
|
+
}
|
|
804
|
+
} catch (e) {
|
|
805
|
+
console.error("[Spine Plugin] Error playing animation:", e);
|
|
806
|
+
}
|
|
807
|
+
break;
|
|
808
|
+
case "autoUpdate":
|
|
809
|
+
spine.autoUpdate = value;
|
|
810
|
+
break;
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
getProperties(container) {
|
|
814
|
+
try {
|
|
815
|
+
const spine = container;
|
|
816
|
+
const animations = getAnimationNames(spine);
|
|
817
|
+
const skins = getSkinNames(spine);
|
|
818
|
+
const currentAnim = getCurrentAnimation(spine);
|
|
819
|
+
const currentSkin = getCurrentSkin(spine);
|
|
820
|
+
return [
|
|
821
|
+
{
|
|
822
|
+
prop: "spine.currentAnimation",
|
|
823
|
+
value: currentAnim,
|
|
824
|
+
entry: {
|
|
825
|
+
section: SECTION2,
|
|
826
|
+
label: "Current Animation",
|
|
827
|
+
type: "text",
|
|
828
|
+
options: { disabled: true }
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
prop: "spine.playAnimation",
|
|
833
|
+
value: currentAnim,
|
|
834
|
+
entry: {
|
|
835
|
+
section: SECTION2,
|
|
836
|
+
label: "Play Animation",
|
|
837
|
+
type: "select",
|
|
838
|
+
options: { options: ["(none)", ...animations] }
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
prop: "spine.currentSkin",
|
|
843
|
+
value: currentSkin,
|
|
844
|
+
entry: {
|
|
845
|
+
section: SECTION2,
|
|
846
|
+
label: "Skin",
|
|
847
|
+
type: "select",
|
|
848
|
+
options: { options: skins }
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
prop: "spine.autoUpdate",
|
|
853
|
+
value: spine.autoUpdate,
|
|
854
|
+
entry: {
|
|
855
|
+
section: SECTION2,
|
|
856
|
+
label: "Auto Update",
|
|
857
|
+
type: "boolean"
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
];
|
|
861
|
+
} catch (e) {
|
|
862
|
+
console.error("[Spine Plugin] Error getting properties:", e);
|
|
863
|
+
return [];
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
// devtools/index.ts
|
|
869
|
+
var gThis = globalThis;
|
|
870
|
+
var _a;
|
|
871
|
+
gThis.__PIXI_DEVTOOLS__ = {
|
|
872
|
+
...gThis.__PIXI_DEVTOOLS__,
|
|
873
|
+
extensions: [
|
|
874
|
+
...((_a = gThis.__PIXI_DEVTOOLS__) == null ? void 0 : _a.extensions) ?? [],
|
|
875
|
+
draggableTreePlugin,
|
|
876
|
+
draggableOverlayPlugin,
|
|
877
|
+
spriteTextPropertiesPlugin,
|
|
878
|
+
spinePropertiesPlugin
|
|
879
|
+
]
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
// utils/Logger.ts
|
|
883
|
+
var Logger = class _Logger {
|
|
884
|
+
static instance;
|
|
885
|
+
config;
|
|
886
|
+
// Terminal colors (for Node.js environment)
|
|
887
|
+
terminalColors = {
|
|
888
|
+
reset: "\x1B[0m",
|
|
889
|
+
red: "\x1B[31m",
|
|
890
|
+
yellow: "\x1B[33m",
|
|
891
|
+
blue: "\x1B[34m",
|
|
892
|
+
green: "\x1B[32m",
|
|
893
|
+
gray: "\x1B[90m",
|
|
894
|
+
cyan: "\x1B[36m",
|
|
895
|
+
magenta: "\x1B[35m",
|
|
896
|
+
white: "\x1B[37m"
|
|
897
|
+
};
|
|
898
|
+
// Browser console colors (using CSS)
|
|
899
|
+
browserColors = {
|
|
900
|
+
timestamp: "color: gray",
|
|
901
|
+
context: "color: cyan; font-weight: bold",
|
|
902
|
+
message: "color: white",
|
|
903
|
+
error: "color: red; font-weight: bold",
|
|
904
|
+
warn: "color: orange; font-weight: bold",
|
|
905
|
+
info: "color: dodgerblue; font-weight: bold",
|
|
906
|
+
debug: "color: green",
|
|
907
|
+
trace: "color: gray"
|
|
908
|
+
};
|
|
909
|
+
levelLabels = {
|
|
910
|
+
[0 /* ERROR */]: "ERROR",
|
|
911
|
+
[1 /* WARN */]: "WARN",
|
|
912
|
+
[2 /* INFO */]: "INFO",
|
|
913
|
+
[3 /* DEBUG */]: "DEBUG",
|
|
914
|
+
[4 /* TRACE */]: "TRACE"
|
|
915
|
+
};
|
|
916
|
+
levelColors = {
|
|
917
|
+
[0 /* ERROR */]: this.terminalColors.red,
|
|
918
|
+
[1 /* WARN */]: this.terminalColors.yellow,
|
|
919
|
+
[2 /* INFO */]: this.terminalColors.blue,
|
|
920
|
+
[3 /* DEBUG */]: this.terminalColors.green,
|
|
921
|
+
[4 /* TRACE */]: this.terminalColors.gray
|
|
922
|
+
};
|
|
923
|
+
levelBrowserColors = {
|
|
924
|
+
[0 /* ERROR */]: this.browserColors.error,
|
|
925
|
+
[1 /* WARN */]: this.browserColors.warn,
|
|
926
|
+
[2 /* INFO */]: this.browserColors.info,
|
|
927
|
+
[3 /* DEBUG */]: this.browserColors.debug,
|
|
928
|
+
[4 /* TRACE */]: this.browserColors.trace
|
|
929
|
+
};
|
|
930
|
+
/**
|
|
931
|
+
* Private constructor for singleton pattern
|
|
932
|
+
*/
|
|
933
|
+
constructor() {
|
|
934
|
+
var _a2;
|
|
935
|
+
this.config = {
|
|
936
|
+
level: 3 /* DEBUG */,
|
|
937
|
+
// Default log level
|
|
938
|
+
enabled: true,
|
|
939
|
+
// Logging enabled by default
|
|
940
|
+
showTimestamp: false,
|
|
941
|
+
// Show timestamps by default
|
|
942
|
+
showColors: true
|
|
943
|
+
// Show colors by default
|
|
944
|
+
};
|
|
945
|
+
if ((_a2 = import.meta.env) == null ? void 0 : _a2.DEV) {
|
|
946
|
+
console.warn(
|
|
947
|
+
"[Logger] For better debugging experience, add Logger.ts to DevTools ignore list:\nDevTools \u2192 Settings (F1) \u2192 Ignore List \u2192 Add pattern: /Logger\\.ts$"
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Get the singleton instance of the Logger
|
|
953
|
+
*/
|
|
954
|
+
static getInstance() {
|
|
955
|
+
if (!_Logger.instance) {
|
|
956
|
+
_Logger.instance = new _Logger();
|
|
957
|
+
}
|
|
958
|
+
return _Logger.instance;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Configure the logger
|
|
962
|
+
* @param config Configuration options
|
|
963
|
+
*/
|
|
964
|
+
configure(config) {
|
|
965
|
+
this.config = { ...this.config, ...config };
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Enable or disable logging
|
|
969
|
+
* @param enabled Whether logging is enabled
|
|
970
|
+
*/
|
|
971
|
+
setEnabled(enabled) {
|
|
972
|
+
this.config.enabled = enabled;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Set the log level
|
|
976
|
+
* @param level The log level to set
|
|
977
|
+
*/
|
|
978
|
+
setLevel(level) {
|
|
979
|
+
this.config.level = level;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Get the current log level
|
|
983
|
+
*/
|
|
984
|
+
getLevel() {
|
|
985
|
+
return this.config.level;
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Log an error message
|
|
989
|
+
* @param message The message to log
|
|
990
|
+
* @param args Additional arguments to log
|
|
991
|
+
*/
|
|
992
|
+
error(message, ...args) {
|
|
993
|
+
this.log(0 /* ERROR */, message, ...args);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Log a warning message
|
|
997
|
+
* @param message The message to log
|
|
998
|
+
* @param args Additional arguments to log
|
|
999
|
+
*/
|
|
1000
|
+
warn(message, ...args) {
|
|
1001
|
+
this.log(1 /* WARN */, message, ...args);
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Log an info message
|
|
1005
|
+
* @param message The message to log
|
|
1006
|
+
* @param args Additional arguments to log
|
|
1007
|
+
*/
|
|
1008
|
+
info(message, ...args) {
|
|
1009
|
+
this.log(2 /* INFO */, message, ...args);
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Log a debug message
|
|
1013
|
+
* @param message The message to log
|
|
1014
|
+
* @param args Additional arguments to log
|
|
1015
|
+
*/
|
|
1016
|
+
debug(message, ...args) {
|
|
1017
|
+
this.log(3 /* DEBUG */, message, ...args);
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Log a trace message
|
|
1021
|
+
* @param message The message to log
|
|
1022
|
+
* @param args Additional arguments to log
|
|
1023
|
+
*/
|
|
1024
|
+
trace(message, ...args) {
|
|
1025
|
+
this.log(4 /* TRACE */, message, ...args);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Log a message with a specific log level
|
|
1029
|
+
* @param level The log level
|
|
1030
|
+
* @param message The message to log
|
|
1031
|
+
* @param args Additional arguments to log
|
|
1032
|
+
*/
|
|
1033
|
+
log(level, message, ...args) {
|
|
1034
|
+
if (!this.config.enabled || level > this.config.level) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (!this.shouldLogMessage(message)) {
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
const isBrowser = typeof window !== "undefined";
|
|
1041
|
+
if (isBrowser && this.config.showColors) {
|
|
1042
|
+
this.logBrowser(level, message, ...args);
|
|
1043
|
+
} else {
|
|
1044
|
+
this.logTerminal(level, message, ...args);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
extractContext(message) {
|
|
1048
|
+
const contextMatch = message.match(/^\[([^\]]+)\]\s(.*)$/);
|
|
1049
|
+
if (!contextMatch) {
|
|
1050
|
+
return {
|
|
1051
|
+
context: "",
|
|
1052
|
+
messageContent: message
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
return {
|
|
1056
|
+
context: contextMatch[1],
|
|
1057
|
+
messageContent: contextMatch[2]
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
matchesFilter(value, matchers) {
|
|
1061
|
+
if (!(matchers == null ? void 0 : matchers.length)) {
|
|
1062
|
+
return false;
|
|
1063
|
+
}
|
|
1064
|
+
return matchers.some((matcher) => {
|
|
1065
|
+
if (typeof matcher === "string") {
|
|
1066
|
+
return value.includes(matcher);
|
|
1067
|
+
}
|
|
1068
|
+
matcher.lastIndex = 0;
|
|
1069
|
+
return matcher.test(value);
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
shouldLogMessage(message) {
|
|
1073
|
+
var _a2, _b;
|
|
1074
|
+
const filter = this.config.filter;
|
|
1075
|
+
if (!filter) {
|
|
1076
|
+
return true;
|
|
1077
|
+
}
|
|
1078
|
+
const hasFilters = Boolean(((_a2 = filter.contexts) == null ? void 0 : _a2.length) || ((_b = filter.messages) == null ? void 0 : _b.length));
|
|
1079
|
+
if (!hasFilters) {
|
|
1080
|
+
return true;
|
|
1081
|
+
}
|
|
1082
|
+
const { context, messageContent } = this.extractContext(message);
|
|
1083
|
+
const contextMatches = this.matchesFilter(context, filter.contexts);
|
|
1084
|
+
const messageMatches = this.matchesFilter(messageContent, filter.messages);
|
|
1085
|
+
const matches = contextMatches || messageMatches;
|
|
1086
|
+
return filter.mode === "exclude" ? !matches : matches;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Log a message in terminal/node environment
|
|
1090
|
+
*/
|
|
1091
|
+
logTerminal(level, message, ...args) {
|
|
1092
|
+
let timestamp = "";
|
|
1093
|
+
let levelStr = "";
|
|
1094
|
+
let contextPart = "";
|
|
1095
|
+
const contextMatch = message.match(/^\[([^\]]+)\]\s(.*)$/);
|
|
1096
|
+
let messageContent = message;
|
|
1097
|
+
if (contextMatch) {
|
|
1098
|
+
contextPart = `[${contextMatch[1]}] `;
|
|
1099
|
+
messageContent = contextMatch[2];
|
|
1100
|
+
}
|
|
1101
|
+
if (this.config.showTimestamp) {
|
|
1102
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1103
|
+
timestamp = `[${now}] `;
|
|
1104
|
+
}
|
|
1105
|
+
levelStr = `[${this.levelLabels[level]}] `;
|
|
1106
|
+
if (this.config.showColors) {
|
|
1107
|
+
const levelColor = this.levelColors[level];
|
|
1108
|
+
const contextColor = this.terminalColors.cyan;
|
|
1109
|
+
const timestampColor = this.terminalColors.gray;
|
|
1110
|
+
const messageColor = this.terminalColors.white;
|
|
1111
|
+
timestamp = `${timestampColor}${timestamp}${this.terminalColors.reset}`;
|
|
1112
|
+
levelStr = `${levelColor}${levelStr}${this.terminalColors.reset}`;
|
|
1113
|
+
if (contextPart) {
|
|
1114
|
+
contextPart = `${contextColor}${contextPart}${this.terminalColors.reset}`;
|
|
1115
|
+
}
|
|
1116
|
+
messageContent = `${messageColor}${messageContent}${this.terminalColors.reset}`;
|
|
1117
|
+
}
|
|
1118
|
+
const formattedMessage = timestamp + levelStr + contextPart + messageContent;
|
|
1119
|
+
switch (level) {
|
|
1120
|
+
case 0 /* ERROR */:
|
|
1121
|
+
console.error(formattedMessage, ...args);
|
|
1122
|
+
break;
|
|
1123
|
+
case 1 /* WARN */:
|
|
1124
|
+
console.warn(formattedMessage, ...args);
|
|
1125
|
+
break;
|
|
1126
|
+
case 2 /* INFO */:
|
|
1127
|
+
console.info(formattedMessage, ...args);
|
|
1128
|
+
break;
|
|
1129
|
+
case 3 /* DEBUG */:
|
|
1130
|
+
case 4 /* TRACE */:
|
|
1131
|
+
default:
|
|
1132
|
+
console.log(formattedMessage, ...args);
|
|
1133
|
+
break;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Log a message in browser environment with CSS styling
|
|
1138
|
+
*/
|
|
1139
|
+
logBrowser(level, message, ...args) {
|
|
1140
|
+
const contextMatch = message.match(/^\[([^\]]+)\]\s(.*)$/);
|
|
1141
|
+
let context = "";
|
|
1142
|
+
let messageContent = message;
|
|
1143
|
+
if (contextMatch) {
|
|
1144
|
+
context = contextMatch[1];
|
|
1145
|
+
messageContent = contextMatch[2];
|
|
1146
|
+
}
|
|
1147
|
+
let format = "";
|
|
1148
|
+
const formatArgs = [];
|
|
1149
|
+
if (this.config.showTimestamp) {
|
|
1150
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1151
|
+
format += "%c[" + now + "] ";
|
|
1152
|
+
formatArgs.push(this.browserColors.timestamp);
|
|
1153
|
+
}
|
|
1154
|
+
format += "%c[" + this.levelLabels[level] + "] ";
|
|
1155
|
+
formatArgs.push(this.levelBrowserColors[level]);
|
|
1156
|
+
if (context) {
|
|
1157
|
+
format += "%c[" + context + "] ";
|
|
1158
|
+
formatArgs.push(this.browserColors.context);
|
|
1159
|
+
}
|
|
1160
|
+
format += "%c" + messageContent;
|
|
1161
|
+
formatArgs.push(this.browserColors.message);
|
|
1162
|
+
switch (level) {
|
|
1163
|
+
case 0 /* ERROR */:
|
|
1164
|
+
console.error(format, ...formatArgs, ...args);
|
|
1165
|
+
break;
|
|
1166
|
+
case 1 /* WARN */:
|
|
1167
|
+
console.warn(format, ...formatArgs, ...args);
|
|
1168
|
+
break;
|
|
1169
|
+
case 2 /* INFO */:
|
|
1170
|
+
console.info(format, ...formatArgs, ...args);
|
|
1171
|
+
break;
|
|
1172
|
+
case 3 /* DEBUG */:
|
|
1173
|
+
case 4 /* TRACE */:
|
|
1174
|
+
default:
|
|
1175
|
+
console.log(format, ...formatArgs, ...args);
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Creates a context-specific logger.
|
|
1181
|
+
*
|
|
1182
|
+
* Context loggers automatically prefix all log messages with a context tag.
|
|
1183
|
+
* Commonly used in plugins and classes to identify log sources.
|
|
1184
|
+
*
|
|
1185
|
+
* @param context - Context name (e.g., 'MyPlugin', 'SceneManager')
|
|
1186
|
+
* @returns ContextLogger instance
|
|
1187
|
+
*
|
|
1188
|
+
* @example
|
|
1189
|
+
* ```typescript
|
|
1190
|
+
* class DisplayPlugin {
|
|
1191
|
+
* private logger = logger.createContextLogger('DisplayPlugin');
|
|
1192
|
+
*
|
|
1193
|
+
* initialize() {
|
|
1194
|
+
* this.logger.info('Initializing display');
|
|
1195
|
+
* // Output: [INFO] [DisplayPlugin] Initializing display
|
|
1196
|
+
* }
|
|
1197
|
+
* }
|
|
1198
|
+
* ```
|
|
1199
|
+
*/
|
|
1200
|
+
createContextLogger(context) {
|
|
1201
|
+
return new ContextLogger(this, context);
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
var ContextLogger = class {
|
|
1205
|
+
logger;
|
|
1206
|
+
context;
|
|
1207
|
+
constructor(logger2, context) {
|
|
1208
|
+
this.logger = logger2;
|
|
1209
|
+
this.context = context;
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Log an error message
|
|
1213
|
+
* @param message The message to log
|
|
1214
|
+
* @param args Additional arguments to log
|
|
1215
|
+
*/
|
|
1216
|
+
error(message, ...args) {
|
|
1217
|
+
this.logger.error(`[${this.context}] ${message}`, ...args);
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Log a warning message
|
|
1221
|
+
* @param message The message to log
|
|
1222
|
+
* @param args Additional arguments to log
|
|
1223
|
+
*/
|
|
1224
|
+
warn(message, ...args) {
|
|
1225
|
+
this.logger.warn(`[${this.context}] ${message}`, ...args);
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Log an info message
|
|
1229
|
+
* @param message The message to log
|
|
1230
|
+
* @param args Additional arguments to log
|
|
1231
|
+
*/
|
|
1232
|
+
info(message, ...args) {
|
|
1233
|
+
this.logger.info(`[${this.context}] ${message}`, ...args);
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Log a debug message
|
|
1237
|
+
* @param message The message to log
|
|
1238
|
+
* @param args Additional arguments to log
|
|
1239
|
+
*/
|
|
1240
|
+
debug(message, ...args) {
|
|
1241
|
+
this.logger.debug(`[${this.context}] ${message}`, ...args);
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Log a trace message
|
|
1245
|
+
* @param message The message to log
|
|
1246
|
+
* @param args Additional arguments to log
|
|
1247
|
+
*/
|
|
1248
|
+
trace(message, ...args) {
|
|
1249
|
+
this.logger.trace(`[${this.context}] ${message}`, ...args);
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
var logger = Logger.getInstance();
|
|
1253
|
+
var contextLoggers = /* @__PURE__ */ new Map();
|
|
1254
|
+
function getLogger(context) {
|
|
1255
|
+
let cached = contextLoggers.get(context);
|
|
1256
|
+
if (!cached) {
|
|
1257
|
+
cached = new ContextLogger(logger, context);
|
|
1258
|
+
contextLoggers.set(context, cached);
|
|
1259
|
+
}
|
|
1260
|
+
return cached;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
// plugins/Plugin.types.ts
|
|
1264
|
+
var ENGINE_HOOKS = {
|
|
1265
|
+
onEngineReady: Symbol("onEngineReady"),
|
|
1266
|
+
onPause: Symbol("onPause"),
|
|
1267
|
+
onResume: Symbol("onResume"),
|
|
1268
|
+
onResize: Symbol("onResize")
|
|
1269
|
+
};
|
|
1270
|
+
var devtools = globalThis.__PIXI_DEVTOOLS__;
|
|
1271
|
+
if (devtools == null ? void 0 : devtools.extensions) {
|
|
1272
|
+
devtools.extensions = devtools.extensions.filter(
|
|
1273
|
+
(e) => {
|
|
1274
|
+
var _a2;
|
|
1275
|
+
return ((_a2 = e == null ? void 0 : e.extension) == null ? void 0 : _a2.name) !== "layout-scene-overlay";
|
|
1276
|
+
}
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1279
|
+
var PixiEngine = class {
|
|
1280
|
+
/**
|
|
1281
|
+
* Creates a new PixiEngine instance.
|
|
1282
|
+
*
|
|
1283
|
+
* The constructor creates the underlying PixiJS application but does not initialize it.
|
|
1284
|
+
* Call {@link initialize} after registering all plugins to start the engine.
|
|
1285
|
+
*
|
|
1286
|
+
* @param config - Engine configuration options extending PixiJS ApplicationOptions
|
|
1287
|
+
*
|
|
1288
|
+
* @example
|
|
1289
|
+
* ```typescript
|
|
1290
|
+
* const engine = new PixiEngine({
|
|
1291
|
+
* width: 1920,
|
|
1292
|
+
* height: 1080,
|
|
1293
|
+
* backgroundColor: 0x1a1a1a,
|
|
1294
|
+
* antialias: true,
|
|
1295
|
+
* resolution: window.devicePixelRatio
|
|
1296
|
+
* });
|
|
1297
|
+
* ```
|
|
1298
|
+
*/
|
|
1299
|
+
constructor(config) {
|
|
1300
|
+
this.config = config;
|
|
1301
|
+
getLogger("PixiEngine").info("PixiEngine initializing with config", config);
|
|
1302
|
+
this._pixiApp = new Application();
|
|
1303
|
+
getLogger("PixiEngine").info("PixiEngine initialized successfully");
|
|
1304
|
+
}
|
|
1305
|
+
_pixiApp;
|
|
1306
|
+
plugins = /* @__PURE__ */ new Map();
|
|
1307
|
+
isInitialized = false;
|
|
1308
|
+
pluginStates = /* @__PURE__ */ new Map();
|
|
1309
|
+
readyPlugins = /* @__PURE__ */ new Set();
|
|
1310
|
+
/**
|
|
1311
|
+
* Registers a plugin with the engine.
|
|
1312
|
+
*
|
|
1313
|
+
* Plugins must be registered before calling {@link initialize}. If the engine is already
|
|
1314
|
+
* initialized, the plugin will be initialized immediately upon registration.
|
|
1315
|
+
*
|
|
1316
|
+
* The plugin's state is set to {@link PluginState.REGISTERED} and it will be initialized
|
|
1317
|
+
* during the engine's initialization phase based on its priority and dependencies.
|
|
1318
|
+
*
|
|
1319
|
+
* @param plugin - The plugin instance to register
|
|
1320
|
+
* @returns `true` if the plugin was successfully registered, `false` if a plugin with the same name already exists
|
|
1321
|
+
*
|
|
1322
|
+
* @example
|
|
1323
|
+
* ```typescript
|
|
1324
|
+
* const scenePlugin = new ScenePlugin();
|
|
1325
|
+
* const success = engine.registerPlugin(scenePlugin);
|
|
1326
|
+
*
|
|
1327
|
+
* if (!success) {
|
|
1328
|
+
* console.warn('Plugin already registered');
|
|
1329
|
+
* }
|
|
1330
|
+
* ```
|
|
1331
|
+
*
|
|
1332
|
+
* @see {@link EnginePlugin} for plugin interface details
|
|
1333
|
+
* @see {@link getPlugin} to retrieve registered plugins
|
|
1334
|
+
*/
|
|
1335
|
+
registerPlugin(plugin) {
|
|
1336
|
+
if (this.plugins.has(plugin.name)) {
|
|
1337
|
+
getLogger("PixiEngine").warn(`Plugin with name "${plugin.name}" is already registered.`);
|
|
1338
|
+
return false;
|
|
1339
|
+
}
|
|
1340
|
+
plugin.state = "registered" /* REGISTERED */;
|
|
1341
|
+
this.pluginStates.set(plugin.name, "registered" /* REGISTERED */);
|
|
1342
|
+
this.plugins.set(plugin.name, plugin);
|
|
1343
|
+
getLogger("PixiEngine").debug(`Plugin "${plugin.name}" registered`);
|
|
1344
|
+
if (this.isInitialized) {
|
|
1345
|
+
this.initializePlugin(plugin);
|
|
1346
|
+
}
|
|
1347
|
+
return true;
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* Checks if a plugin has completed initialization and is ready to use.
|
|
1351
|
+
*
|
|
1352
|
+
* A plugin is considered ready when it has successfully completed both its
|
|
1353
|
+
* `initialize()` and `onReady()` lifecycle methods.
|
|
1354
|
+
*
|
|
1355
|
+
* @param name - The name of the plugin to check
|
|
1356
|
+
* @returns `true` if the plugin is in the {@link PluginState.READY} state, `false` otherwise
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* ```typescript
|
|
1360
|
+
* if (engine.isPluginReady('ScenePlugin')) {
|
|
1361
|
+
* const scenePlugin = engine.getPlugin<ScenePlugin>('ScenePlugin');
|
|
1362
|
+
* scenePlugin?.loadScene('MainMenu');
|
|
1363
|
+
* }
|
|
1364
|
+
* ```
|
|
1365
|
+
*/
|
|
1366
|
+
isPluginReady(name) {
|
|
1367
|
+
return this.readyPlugins.has(name);
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Waits asynchronously for specific plugins to reach the ready state.
|
|
1371
|
+
*
|
|
1372
|
+
* This method is useful when you need to ensure certain plugins are fully initialized
|
|
1373
|
+
* before proceeding with game logic. It polls every 10ms until all specified plugins
|
|
1374
|
+
* are ready.
|
|
1375
|
+
*
|
|
1376
|
+
* @param pluginNames - Array of plugin names to wait for
|
|
1377
|
+
* @returns A promise that resolves when all specified plugins are ready
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* ```typescript
|
|
1381
|
+
* // Wait for multiple plugins before starting the game
|
|
1382
|
+
* await engine.waitForPlugins(['ScenePlugin', 'AudioPlugin', 'GameStatePlugin']);
|
|
1383
|
+
*
|
|
1384
|
+
* // Now safe to use these plugins
|
|
1385
|
+
* const scenePlugin = engine.getPlugin<ScenePlugin>('ScenePlugin');
|
|
1386
|
+
* scenePlugin?.loadScene('MainMenu');
|
|
1387
|
+
* ```
|
|
1388
|
+
*
|
|
1389
|
+
* @remarks
|
|
1390
|
+
* If any of the specified plugins are not registered, this method will wait indefinitely.
|
|
1391
|
+
* Ensure all required plugins are registered before calling this method.
|
|
1392
|
+
*/
|
|
1393
|
+
async waitForPlugins(pluginNames) {
|
|
1394
|
+
const checkPlugins = () => {
|
|
1395
|
+
return pluginNames.every((name) => this.isPluginReady(name));
|
|
1396
|
+
};
|
|
1397
|
+
if (checkPlugins()) {
|
|
1398
|
+
return Promise.resolve();
|
|
1399
|
+
}
|
|
1400
|
+
return new Promise((resolve) => {
|
|
1401
|
+
const checkInterval = setInterval(() => {
|
|
1402
|
+
if (checkPlugins()) {
|
|
1403
|
+
clearInterval(checkInterval);
|
|
1404
|
+
resolve();
|
|
1405
|
+
}
|
|
1406
|
+
}, 10);
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Initialize a single plugin with dependency checking
|
|
1411
|
+
*/
|
|
1412
|
+
async initializePlugin(plugin) {
|
|
1413
|
+
if (this.pluginStates.get(plugin.name) !== "registered" /* REGISTERED */) {
|
|
1414
|
+
return;
|
|
1415
|
+
}
|
|
1416
|
+
try {
|
|
1417
|
+
getLogger("PixiEngine").debug(`Initializing plugin: ${plugin.name}`);
|
|
1418
|
+
plugin.state = "initializing" /* INITIALIZING */;
|
|
1419
|
+
this.pluginStates.set(plugin.name, "initializing" /* INITIALIZING */);
|
|
1420
|
+
await plugin.initialize(this);
|
|
1421
|
+
plugin.state = "initialized" /* INITIALIZED */;
|
|
1422
|
+
this.pluginStates.set(plugin.name, "initialized" /* INITIALIZED */);
|
|
1423
|
+
getLogger("PixiEngine").debug(`Plugin "${plugin.name}" initialized successfully`);
|
|
1424
|
+
} catch (error) {
|
|
1425
|
+
plugin.state = "error" /* ERROR */;
|
|
1426
|
+
this.pluginStates.set(plugin.name, "error" /* ERROR */);
|
|
1427
|
+
getLogger("PixiEngine").error(`Failed to initialize plugin "${plugin.name}":`, error);
|
|
1428
|
+
throw error;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Call onReady for all plugins after initialization is complete
|
|
1433
|
+
*/
|
|
1434
|
+
async finalizePlugins() {
|
|
1435
|
+
const plugins = this.getPluginsSortedByPriorityAndDependencies();
|
|
1436
|
+
for (const plugin of plugins) {
|
|
1437
|
+
try {
|
|
1438
|
+
if (plugin.onReady) {
|
|
1439
|
+
getLogger("PixiEngine").debug(`Calling onReady for plugin: ${plugin.name}`);
|
|
1440
|
+
await plugin.onReady(this);
|
|
1441
|
+
}
|
|
1442
|
+
plugin.state = "ready" /* READY */;
|
|
1443
|
+
this.pluginStates.set(plugin.name, "ready" /* READY */);
|
|
1444
|
+
this.readyPlugins.add(plugin.name);
|
|
1445
|
+
getLogger("PixiEngine").debug(`Plugin "${plugin.name}" is now ready`);
|
|
1446
|
+
} catch (error) {
|
|
1447
|
+
plugin.state = "error" /* ERROR */;
|
|
1448
|
+
this.pluginStates.set(plugin.name, "error" /* ERROR */);
|
|
1449
|
+
getLogger("PixiEngine").error(`Failed to finalize plugin "${plugin.name}":`, error);
|
|
1450
|
+
throw error;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Initializes all plugins.
|
|
1456
|
+
*/
|
|
1457
|
+
async initializePlugins() {
|
|
1458
|
+
const sortedPlugins = this.getPluginsSortedByPriorityAndDependencies();
|
|
1459
|
+
getLogger("PixiEngine").info(`Initializing ${sortedPlugins.length} plugins`);
|
|
1460
|
+
for (const plugin of sortedPlugins) {
|
|
1461
|
+
await this.initializePlugin(plugin);
|
|
1462
|
+
}
|
|
1463
|
+
getLogger("PixiEngine").info("All plugins initialized and ready");
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Get plugins sorted by priority and dependency order
|
|
1467
|
+
*/
|
|
1468
|
+
getPluginsSortedByPriorityAndDependencies() {
|
|
1469
|
+
const plugins = Array.from(this.plugins.values());
|
|
1470
|
+
const resolved = [];
|
|
1471
|
+
const resolving = /* @__PURE__ */ new Set();
|
|
1472
|
+
const missingDependencies = [];
|
|
1473
|
+
const resolve = (plugin) => {
|
|
1474
|
+
if (resolved.includes(plugin)) return;
|
|
1475
|
+
if (resolving.has(plugin.name)) {
|
|
1476
|
+
getLogger("PixiEngine").warn(`Circular dependency detected for plugin: ${plugin.name}`);
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
resolving.add(plugin.name);
|
|
1480
|
+
if (plugin.dependencies && plugin.dependencies.length > 0) {
|
|
1481
|
+
plugin.dependencies.forEach((depName) => {
|
|
1482
|
+
const depPlugin = this.plugins.get(depName);
|
|
1483
|
+
if (depPlugin) {
|
|
1484
|
+
resolve(depPlugin);
|
|
1485
|
+
} else {
|
|
1486
|
+
missingDependencies.push(
|
|
1487
|
+
`Plugin "${plugin.name}" requires "${depName}" but it's not registered`
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
resolving.delete(plugin.name);
|
|
1493
|
+
resolved.push(plugin);
|
|
1494
|
+
};
|
|
1495
|
+
const sortedByPriority = plugins.sort((a, b) => (a.priority || 100) - (b.priority || 100));
|
|
1496
|
+
sortedByPriority.forEach((plugin) => resolve(plugin));
|
|
1497
|
+
if (missingDependencies.length > 0) {
|
|
1498
|
+
const errorMessage = [
|
|
1499
|
+
"\u274C Plugin dependency validation failed:",
|
|
1500
|
+
...missingDependencies.map((msg) => ` \u2022 ${msg}`),
|
|
1501
|
+
"",
|
|
1502
|
+
"\u{1F4A1} Solutions:",
|
|
1503
|
+
" \u2022 Register missing plugins before calling engine.initialize()",
|
|
1504
|
+
" \u2022 Remove dependencies from plugin configuration",
|
|
1505
|
+
" \u2022 Make dependencies optional in plugin code"
|
|
1506
|
+
].join("\n");
|
|
1507
|
+
getLogger("PixiEngine").error(errorMessage);
|
|
1508
|
+
throw new Error(`Missing plugin dependencies. Check console for details.`);
|
|
1509
|
+
}
|
|
1510
|
+
getLogger("PixiEngine").debug(
|
|
1511
|
+
"Plugin initialization order:",
|
|
1512
|
+
resolved.map((p) => `${p.name}(priority:${p.priority})`)
|
|
1513
|
+
);
|
|
1514
|
+
return resolved;
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Initializes the engine and all registered plugins.
|
|
1518
|
+
*
|
|
1519
|
+
* This method performs the complete engine startup sequence:
|
|
1520
|
+
* 1. Initializes the PixiJS application with the provided configuration
|
|
1521
|
+
* 2. Appends the canvas to the document body
|
|
1522
|
+
* 3. Initializes all plugins in dependency order (respecting priorities)
|
|
1523
|
+
* 4. Calls `onReady()` on all plugins after initialization
|
|
1524
|
+
* 5. Sets up window resize event handling
|
|
1525
|
+
*
|
|
1526
|
+
* Plugins are initialized in order based on:
|
|
1527
|
+
* - Dependencies (plugins wait for their dependencies)
|
|
1528
|
+
* - Priority (lower numbers = higher priority)
|
|
1529
|
+
*
|
|
1530
|
+
* @returns A promise that resolves when the engine and all plugins are fully initialized
|
|
1531
|
+
* @throws {Error} If plugin dependencies are missing or circular dependencies are detected
|
|
1532
|
+
*
|
|
1533
|
+
* @example
|
|
1534
|
+
* ```typescript
|
|
1535
|
+
* const engine = new PixiEngine({ width: 1920, height: 1080 });
|
|
1536
|
+
*
|
|
1537
|
+
* // Register plugins
|
|
1538
|
+
* engine.registerPlugin(new ScenePlugin());
|
|
1539
|
+
* engine.registerPlugin(new AudioPlugin());
|
|
1540
|
+
*
|
|
1541
|
+
* // Initialize everything
|
|
1542
|
+
* await engine.initialize();
|
|
1543
|
+
*
|
|
1544
|
+
* // Engine is now ready to use
|
|
1545
|
+
* console.log('Engine initialized successfully');
|
|
1546
|
+
* ```
|
|
1547
|
+
*
|
|
1548
|
+
* @remarks
|
|
1549
|
+
* - This method should only be called once
|
|
1550
|
+
* - All plugins should be registered before calling this method
|
|
1551
|
+
* - The canvas will be automatically appended to `document.body`
|
|
1552
|
+
* - Window resize events are automatically handled
|
|
1553
|
+
*/
|
|
1554
|
+
async initialize() {
|
|
1555
|
+
const width = this.config.width ?? 1920;
|
|
1556
|
+
const height = this.config.height ?? 1080;
|
|
1557
|
+
await this._pixiApp.init({
|
|
1558
|
+
width,
|
|
1559
|
+
height,
|
|
1560
|
+
antialias: true,
|
|
1561
|
+
autoStart: false,
|
|
1562
|
+
sharedTicker: false,
|
|
1563
|
+
useBackBuffer: true,
|
|
1564
|
+
autoDensity: false,
|
|
1565
|
+
...this.config
|
|
1566
|
+
});
|
|
1567
|
+
if (this.config.resizeTo || this.config.appendTo) {
|
|
1568
|
+
(this.config.resizeTo || this.config.appendTo).appendChild(this._pixiApp.canvas);
|
|
1569
|
+
} else {
|
|
1570
|
+
document.body.appendChild(this._pixiApp.canvas);
|
|
1571
|
+
}
|
|
1572
|
+
getLogger("PixiEngine").info("Starting engine initialization");
|
|
1573
|
+
await this.initializePlugins();
|
|
1574
|
+
await this.finalizePlugins();
|
|
1575
|
+
window.onresize = () => {
|
|
1576
|
+
this.onResize();
|
|
1577
|
+
};
|
|
1578
|
+
this.onResize();
|
|
1579
|
+
getLogger("PixiEngine").info("Engine initialization completed");
|
|
1580
|
+
this.isInitialized = true;
|
|
1581
|
+
await this.notifyEngineReady();
|
|
1582
|
+
getLogger("PixiEngine").info("PixiEngine initialized");
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Handles window resize events and notifies plugins.
|
|
1586
|
+
*
|
|
1587
|
+
* This method is automatically called when the window is resized and during
|
|
1588
|
+
* engine initialization. It updates the renderer size and notifies all plugins
|
|
1589
|
+
* about the resize event in priority order.
|
|
1590
|
+
*
|
|
1591
|
+
* If a plugin's `onResize` method returns `true`, it indicates that the plugin
|
|
1592
|
+
* has handled the resize and propagation stops. Otherwise, the engine will
|
|
1593
|
+
* resize the renderer to match the window dimensions.
|
|
1594
|
+
*
|
|
1595
|
+
* @remarks
|
|
1596
|
+
* This is a private method called automatically by the engine.
|
|
1597
|
+
* Plugins can implement `onResize(width, height)` to handle custom resize logic.
|
|
1598
|
+
*/
|
|
1599
|
+
onResize(_width, _height) {
|
|
1600
|
+
const renderer = this._pixiApp.renderer;
|
|
1601
|
+
const width = _width ?? window.innerWidth;
|
|
1602
|
+
const height = _height ?? window.innerHeight;
|
|
1603
|
+
const sortedPlugins = this.getPlugins();
|
|
1604
|
+
let handled = false;
|
|
1605
|
+
getLogger("PixiEngine").info(`Window resized: ${width}x${height}, dpr: ${renderer.resolution}`);
|
|
1606
|
+
for (const plugin of sortedPlugins) {
|
|
1607
|
+
if (plugin[ENGINE_HOOKS.onResize] && plugin[ENGINE_HOOKS.onResize](width, height, this.devicePixelRatio)) {
|
|
1608
|
+
handled = true;
|
|
1609
|
+
getLogger("PixiEngine").debug(`Resize handled by plugin: ${plugin.name}`);
|
|
1610
|
+
break;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
if (!handled) {
|
|
1614
|
+
renderer.resize(width, height);
|
|
1615
|
+
getLogger("PixiEngine").info(`Resized renderer to ${width}x${height}`);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Notifies all plugins that the engine is fully ready
|
|
1620
|
+
* This is called after all plugins are initialized and ready
|
|
1621
|
+
*/
|
|
1622
|
+
async notifyEngineReady() {
|
|
1623
|
+
const sortedPlugins = this.getPlugins();
|
|
1624
|
+
for (const plugin of sortedPlugins) {
|
|
1625
|
+
if (plugin[ENGINE_HOOKS.onEngineReady]) {
|
|
1626
|
+
try {
|
|
1627
|
+
await plugin[ENGINE_HOOKS.onEngineReady](this);
|
|
1628
|
+
getLogger("PixiEngine").debug(`Plugin ${plugin.name} onEngineReady completed`);
|
|
1629
|
+
} catch (error) {
|
|
1630
|
+
getLogger("PixiEngine").error(`Plugin ${plugin.name} onEngineReady failed:`, error);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* Retrieves a registered plugin by name with type safety.
|
|
1637
|
+
*
|
|
1638
|
+
* This method allows you to access registered plugins with proper TypeScript typing.
|
|
1639
|
+
* Returns `undefined` if the plugin is not found.
|
|
1640
|
+
*
|
|
1641
|
+
* @typeParam T - The plugin type extending {@link EnginePlugin}
|
|
1642
|
+
* @param name - The unique name of the plugin to retrieve
|
|
1643
|
+
* @returns The plugin instance if found, `undefined` otherwise
|
|
1644
|
+
*
|
|
1645
|
+
* @example
|
|
1646
|
+
* ```typescript
|
|
1647
|
+
* // Get plugin with type safety
|
|
1648
|
+
* const scenePlugin = engine.getPlugin<ScenePlugin>('ScenePlugin');
|
|
1649
|
+
*
|
|
1650
|
+
* if (scenePlugin) {
|
|
1651
|
+
* scenePlugin.loadScene('MainMenu');
|
|
1652
|
+
* } else {
|
|
1653
|
+
* console.warn('ScenePlugin not found');
|
|
1654
|
+
* }
|
|
1655
|
+
* ```
|
|
1656
|
+
*
|
|
1657
|
+
* @see {@link getPluginThrow} for a version that throws an error if plugin is not found
|
|
1658
|
+
*/
|
|
1659
|
+
getPlugin(name) {
|
|
1660
|
+
return this.plugins.get(name);
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Retrieves a registered plugin by name, throwing an error if not found.
|
|
1664
|
+
*
|
|
1665
|
+
* This is a convenience method for cases where you expect the plugin to exist
|
|
1666
|
+
* and want to avoid null checks.
|
|
1667
|
+
*
|
|
1668
|
+
* @typeParam T - The plugin type extending {@link EnginePlugin}
|
|
1669
|
+
* @param name - The unique name of the plugin to retrieve
|
|
1670
|
+
* @returns The plugin instance
|
|
1671
|
+
* @throws {Error} If the plugin is not registered
|
|
1672
|
+
*
|
|
1673
|
+
* @example
|
|
1674
|
+
* ```typescript
|
|
1675
|
+
* // Get plugin or throw error
|
|
1676
|
+
* const scenePlugin = engine.getPluginThrow<ScenePlugin>('ScenePlugin');
|
|
1677
|
+
* scenePlugin.loadScene('MainMenu'); // No null check needed
|
|
1678
|
+
* ```
|
|
1679
|
+
*
|
|
1680
|
+
* @see {@link getPlugin} for a version that returns undefined instead of throwing
|
|
1681
|
+
*/
|
|
1682
|
+
getPluginThrow(name) {
|
|
1683
|
+
const plugin = this.getPlugin(name);
|
|
1684
|
+
if (!plugin) {
|
|
1685
|
+
throw new Error(`Plugin with name "${name}" is not registered.`);
|
|
1686
|
+
}
|
|
1687
|
+
return plugin;
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Gets all registered plugins sorted by priority.
|
|
1691
|
+
*
|
|
1692
|
+
* Returns an array of all plugins currently registered with the engine,
|
|
1693
|
+
* sorted by priority in descending order (highest priority first).
|
|
1694
|
+
*
|
|
1695
|
+
* @returns Array of all registered plugins sorted by priority
|
|
1696
|
+
*
|
|
1697
|
+
* @example
|
|
1698
|
+
* ```typescript
|
|
1699
|
+
* // List all registered plugins
|
|
1700
|
+
* const plugins = engine.getPlugins();
|
|
1701
|
+
* plugins.forEach(plugin => {
|
|
1702
|
+
* console.log(`Plugin: ${plugin.name}, Priority: ${plugin.priority}, State: ${plugin.state}`);
|
|
1703
|
+
* });
|
|
1704
|
+
* ```
|
|
1705
|
+
*
|
|
1706
|
+
* @example
|
|
1707
|
+
* ```typescript
|
|
1708
|
+
* // Find plugins by type
|
|
1709
|
+
* const plugins = engine.getPlugins();
|
|
1710
|
+
* const scenePlugins = plugins.filter(p => p.name.includes('Scene'));
|
|
1711
|
+
* ```
|
|
1712
|
+
*
|
|
1713
|
+
* @remarks
|
|
1714
|
+
* Plugins with undefined priority are treated as having priority 0.
|
|
1715
|
+
* Lower priority numbers mean higher priority (e.g., priority 1 comes before priority 10).
|
|
1716
|
+
*/
|
|
1717
|
+
getPlugins() {
|
|
1718
|
+
return Array.from(this.plugins.values()).sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
1721
|
+
* Updates the plugins
|
|
1722
|
+
* @param deltaTime Frame duration
|
|
1723
|
+
*/
|
|
1724
|
+
updatePlugins(deltaTime) {
|
|
1725
|
+
const sortedPlugins = this.getPlugins();
|
|
1726
|
+
for (const plugin of sortedPlugins) {
|
|
1727
|
+
if (plugin.onUpdate && plugin.onUpdate(deltaTime)) {
|
|
1728
|
+
getLogger("PixiEngine").debug(`Update cycle handled by plugin: ${plugin.name}`);
|
|
1729
|
+
break;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Main update loop called every frame.
|
|
1735
|
+
*
|
|
1736
|
+
* This method should be called from your game's main loop (typically GSAP ticker)
|
|
1737
|
+
* to update all plugins. Plugins are updated in priority order, and update
|
|
1738
|
+
* propagation stops if a plugin returns `true` from its `onUpdate` method.
|
|
1739
|
+
*
|
|
1740
|
+
* @param deltaTime - Time elapsed since the last frame in seconds
|
|
1741
|
+
*
|
|
1742
|
+
* @example
|
|
1743
|
+
* ```typescript
|
|
1744
|
+
* // Integrate with GSAP ticker
|
|
1745
|
+
* import { gsap } from 'gsap';
|
|
1746
|
+
*
|
|
1747
|
+
* gsap.ticker.add((time, deltaTime) => {
|
|
1748
|
+
* engine.onUpdate(deltaTime);
|
|
1749
|
+
* });
|
|
1750
|
+
* ```
|
|
1751
|
+
*
|
|
1752
|
+
* @example
|
|
1753
|
+
* ```typescript
|
|
1754
|
+
* // Manual update loop
|
|
1755
|
+
* let lastTime = performance.now();
|
|
1756
|
+
*
|
|
1757
|
+
* function gameLoop() {
|
|
1758
|
+
* const currentTime = performance.now();
|
|
1759
|
+
* const deltaTime = (currentTime - lastTime) / 1000;
|
|
1760
|
+
* lastTime = currentTime;
|
|
1761
|
+
*
|
|
1762
|
+
* engine.onUpdate(deltaTime);
|
|
1763
|
+
* requestAnimationFrame(gameLoop);
|
|
1764
|
+
* }
|
|
1765
|
+
*
|
|
1766
|
+
* gameLoop();
|
|
1767
|
+
* ```
|
|
1768
|
+
*
|
|
1769
|
+
* @remarks
|
|
1770
|
+
* The deltaTime is typically provided in seconds by GSAP ticker.
|
|
1771
|
+
* Plugins with higher priority (lower priority number) are updated first.
|
|
1772
|
+
*/
|
|
1773
|
+
onUpdate(deltaTime) {
|
|
1774
|
+
this.updatePlugins(deltaTime);
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Gets the underlying PixiJS Application instance.
|
|
1778
|
+
*
|
|
1779
|
+
* Provides direct access to the PixiJS application for advanced use cases
|
|
1780
|
+
* such as accessing the renderer, ticker, or other PixiJS-specific features.
|
|
1781
|
+
*
|
|
1782
|
+
* @returns The PixiJS Application instance
|
|
1783
|
+
*
|
|
1784
|
+
* @example
|
|
1785
|
+
* ```typescript
|
|
1786
|
+
* // Access the renderer
|
|
1787
|
+
* const renderer = engine.pixiApp.renderer;
|
|
1788
|
+
* console.log('Renderer type:', renderer.type);
|
|
1789
|
+
*
|
|
1790
|
+
* // Access the ticker
|
|
1791
|
+
* engine.pixiApp.ticker.add((delta) => {
|
|
1792
|
+
* console.log('Ticker delta:', delta);
|
|
1793
|
+
* });
|
|
1794
|
+
* ```
|
|
1795
|
+
*
|
|
1796
|
+
* @remarks
|
|
1797
|
+
* Use this getter sparingly. Most functionality should be accessed through
|
|
1798
|
+
* plugins or the engine's public API.
|
|
1799
|
+
*/
|
|
1800
|
+
get pixiApp() {
|
|
1801
|
+
return this._pixiApp;
|
|
1802
|
+
}
|
|
1803
|
+
get platform() {
|
|
1804
|
+
return isMobile.any ? "mobile" : "desktop";
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Gets the device pixel ratio, capped at 2 for performance reasons.
|
|
1808
|
+
*
|
|
1809
|
+
* @returns The device pixel ratio, capped at 2
|
|
1810
|
+
*/
|
|
1811
|
+
get devicePixelRatio() {
|
|
1812
|
+
return Math.min(window.devicePixelRatio ?? 1, 2);
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
|
|
1816
|
+
export { PixiEngine };
|
|
1817
|
+
//# sourceMappingURL=index.js.map
|
|
1818
|
+
//# sourceMappingURL=index.js.map
|