@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../filters/ChromaKeyFilter.ts"],"names":["ChromaKeyMode"],"mappings":";;;AASO,IAAK,aAAA,qBAAAA,cAAAA,KAAL;AACL,EAAAA,cAAAA,CAAAA,cAAAA,CAAA,SAAM,CAAA,CAAA,GAAN,KAAA;AACA,EAAAA,cAAAA,CAAAA,cAAAA,CAAA,SAAM,CAAA,CAAA,GAAN,KAAA;AACA,EAAAA,cAAAA,CAAAA,cAAAA,CAAA,WAAQ,CAAA,CAAA,GAAR,OAAA;AACA,EAAAA,cAAAA,CAAAA,cAAAA,CAAA,eAAY,CAAA,CAAA,GAAZ,WAAA;AAJU,EAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA;AAOZ,IAAM,MAAA,GAAS;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AA4Bf,IAAM,QAAA,GAAW;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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ram } from 'pixi.js';\n\n/**\n * Chroma key algorithm modes.\n * - `rgb`: Simple RGB Euclidean distance (legacy)\n * - `hsv`: Hue-based keying with saturation threshold\n * - `ycbcr`: YCbCr color space (TV/video standard)\n * - `colorDiff`: YCbCr + Color Difference hybrid (best quality, default)\n */\nexport enum ChromaKeyMode {\n RGB = 0,\n HSV = 1,\n YCbCr = 2,\n ColorDiff = 3,\n}\n\nconst vertex = `\n in vec2 aPosition;\n out vec2 vTextureCoord;\n\n uniform vec4 uInputSize;\n uniform vec4 uOutputFrame;\n uniform vec4 uOutputTexture;\n\n vec4 filterVertexPosition(void)\n {\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n return vec4(position, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord(void)\n {\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n }\n`;\n\nconst fragment = `\n in vec2 vTextureCoord;\n\n uniform sampler2D uTexture;\n uniform vec3 uKeyColor;\n uniform float uSimilarity;\n uniform float uSmoothness;\n uniform int uMode;\n uniform float uMinSaturation;\n\n out vec4 finalColor;\n\n // Convert RGB to HSV\n vec3 rgb2hsv(vec3 c) {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n }\n\n // Convert RGB to YCbCr\n vec3 rgb2ycbcr(vec3 c) {\n float y = 0.299 * c.r + 0.587 * c.g + 0.114 * c.b;\n float cb = 0.564 * (c.b - y);\n float cr = 0.713 * (c.r - y);\n return vec3(y, cb, cr);\n }\n\n // RGB mode: Simple Euclidean distance\n float calcAlphaRGB(vec3 color, vec3 keyColor, float similarity, float smoothness) {\n float dist = distance(color, keyColor);\n return smoothstep(similarity, similarity + smoothness, dist);\n }\n\n // HSV mode: Hue-based keying with saturation threshold\n float calcAlphaHSV(vec3 color, vec3 keyColor, float similarity, float smoothness, float minSat) {\n vec3 hsv = rgb2hsv(color);\n vec3 keyHsv = rgb2hsv(keyColor);\n \n // Protect low saturation colors (grays)\n if (hsv.y < minSat) return 1.0;\n \n // Circular hue distance\n float hueDist = abs(hsv.x - keyHsv.x);\n hueDist = min(hueDist, 1.0 - hueDist);\n \n // Also consider saturation difference\n float satDist = abs(hsv.y - keyHsv.y) * 0.5;\n float dist = hueDist + satDist;\n \n return smoothstep(similarity * 0.5, (similarity + smoothness) * 0.5, dist);\n }\n\n // YCbCr mode: Chrominance-based keying\n float calcAlphaYCbCr(vec3 color, vec3 keyColor, float similarity, float smoothness) {\n vec3 ycbcr = rgb2ycbcr(color);\n vec3 keyYcbcr = rgb2ycbcr(keyColor);\n \n // Only compare chrominance (Cb, Cr), ignore luminance\n float dist = distance(ycbcr.yz, keyYcbcr.yz);\n return smoothstep(similarity * 0.5, (similarity + smoothness) * 0.5, dist);\n }\n\n // ColorDiff mode: YCbCr + Color Difference hybrid (best quality)\n float calcAlphaColorDiff(vec3 color, vec3 keyColor, float similarity, float smoothness, float minSat) {\n vec3 hsv = rgb2hsv(color);\n \n // Protect low saturation colors (grays, whites, blacks)\n if (hsv.y < minSat) return 1.0;\n \n vec3 ycbcr = rgb2ycbcr(color);\n vec3 keyYcbcr = rgb2ycbcr(keyColor);\n \n // Chrominance distance\n float chromaDist = distance(ycbcr.yz, keyYcbcr.yz);\n \n // Color difference: for green key, green should dominate\n // For other keys, the dominant channel should match\n float maxRB = max(color.r, color.b);\n float maxRG = max(color.r, color.g);\n float maxGB = max(color.g, color.b);\n \n float keyMaxRB = max(keyColor.r, keyColor.b);\n float keyMaxRG = max(keyColor.r, keyColor.g);\n float keyMaxGB = max(keyColor.g, keyColor.b);\n \n // Calculate color difference based on key color's dominant channel\n float colorDiff;\n if (keyColor.g > keyColor.r && keyColor.g > keyColor.b) {\n // Green key: green - max(red, blue)\n float keyDiff = keyColor.g - keyMaxRB;\n float pixelDiff = color.g - maxRB;\n colorDiff = abs(pixelDiff - keyDiff);\n } else if (keyColor.b > keyColor.r && keyColor.b > keyColor.g) {\n // Blue key: blue - max(red, green)\n float keyDiff = keyColor.b - keyMaxRG;\n float pixelDiff = color.b - maxRG;\n colorDiff = abs(pixelDiff - keyDiff);\n } else {\n // Red key: red - max(green, blue)\n float keyDiff = keyColor.r - keyMaxGB;\n float pixelDiff = color.r - maxGB;\n colorDiff = abs(pixelDiff - keyDiff);\n }\n \n // Combine chrominance distance and color difference\n float combinedDist = chromaDist * 0.7 + colorDiff * 0.3;\n \n return smoothstep(similarity * 0.4, (similarity + smoothness) * 0.4, combinedDist);\n }\n\n void main(void)\n {\n vec4 color = texture(uTexture, vTextureCoord);\n \n float alpha;\n \n if (uMode == 0) {\n // RGB mode\n alpha = calcAlphaRGB(color.rgb, uKeyColor, uSimilarity, uSmoothness);\n } else if (uMode == 1) {\n // HSV mode\n alpha = calcAlphaHSV(color.rgb, uKeyColor, uSimilarity, uSmoothness, uMinSaturation);\n } else if (uMode == 2) {\n // YCbCr mode\n alpha = calcAlphaYCbCr(color.rgb, uKeyColor, uSimilarity, uSmoothness);\n } else {\n // ColorDiff mode (default)\n alpha = calcAlphaColorDiff(color.rgb, uKeyColor, uSimilarity, uSmoothness, uMinSaturation);\n }\n \n // Apply the calculated alpha\n finalColor = vec4(color.rgb * alpha, color.a * alpha);\n }\n`;\n\nexport interface ChromaKeyFilterOptions {\n /** The color to make transparent. Default: 0x000000 (black) */\n keyColor?: number;\n /** How similar colors need to be to the key color to be removed (0-1). Default: 0.4 */\n similarity?: number;\n /** Smoothness of the edge transition (0-1). Default: 0.1 */\n smoothness?: number;\n /** Keying algorithm mode. Default: ChromaKeyMode.ColorDiff */\n mode?: ChromaKeyMode;\n /** Minimum saturation threshold to protect gray/white/black colors (0-1). Default: 0.1 */\n minSaturation?: number;\n}\n\n/**\n * ChromaKeyFilter - Makes a specific color transparent in a texture/video.\n * Useful for green screen effects or removing black backgrounds from video sprites.\n *\n * @example\n * ```ts\n * // Remove black background\n * const filter = new ChromaKeyFilter({ keyColor: 0x000000 });\n * sprite.filters = [filter];\n *\n * // Remove green screen\n * const greenFilter = new ChromaKeyFilter({\n * keyColor: 0x00ff00,\n * similarity: 0.2,\n * smoothness: 0.1\n * });\n * videoSprite.filters = [greenFilter];\n * ```\n */\nexport class ChromaKeyFilter extends Filter {\n constructor(options: ChromaKeyFilterOptions = {}) {\n const {\n keyColor = 0x000000,\n similarity = 0.4,\n smoothness = 0.1,\n mode = ChromaKeyMode.ColorDiff,\n minSaturation = 0.1,\n } = options;\n\n // Convert hex color to RGB (0-1 range)\n const r = ((keyColor >> 16) & 0xff) / 255;\n const g = ((keyColor >> 8) & 0xff) / 255;\n const b = (keyColor & 0xff) / 255;\n\n super({\n glProgram: new GlProgram({\n fragment,\n vertex,\n }),\n resources: {\n chromaKeyUniforms: {\n uKeyColor: { value: [r, g, b], type: 'vec3<f32>' },\n uSimilarity: { value: similarity, type: 'f32' },\n uSmoothness: { value: smoothness, type: 'f32' },\n uMode: { value: mode, type: 'i32' },\n uMinSaturation: { value: minSaturation, type: 'f32' },\n },\n },\n });\n }\n\n /** The color to make transparent (hex value) */\n get keyColor(): number {\n const rgb = this.resources.chromaKeyUniforms.uniforms.uKeyColor as number[];\n return ((rgb[0] * 255) << 16) | ((rgb[1] * 255) << 8) | (rgb[2] * 255);\n }\n\n set keyColor(value: number) {\n const r = ((value >> 16) & 0xff) / 255;\n const g = ((value >> 8) & 0xff) / 255;\n const b = (value & 0xff) / 255;\n (this.resources.chromaKeyUniforms.uniforms.uKeyColor as number[])[0] = r;\n (this.resources.chromaKeyUniforms.uniforms.uKeyColor as number[])[1] = g;\n (this.resources.chromaKeyUniforms.uniforms.uKeyColor as number[])[2] = b;\n }\n\n /** How similar colors need to be to the key color to be removed (0-1) */\n get similarity(): number {\n return this.resources.chromaKeyUniforms.uniforms.uSimilarity as number;\n }\n\n set similarity(value: number) {\n this.resources.chromaKeyUniforms.uniforms.uSimilarity = value;\n }\n\n /** Smoothness of the edge transition (0-1) */\n get smoothness(): number {\n return this.resources.chromaKeyUniforms.uniforms.uSmoothness as number;\n }\n\n set smoothness(value: number) {\n this.resources.chromaKeyUniforms.uniforms.uSmoothness = value;\n }\n\n /** Keying algorithm mode */\n get mode(): ChromaKeyMode {\n return this.resources.chromaKeyUniforms.uniforms.uMode as ChromaKeyMode;\n }\n\n set mode(value: ChromaKeyMode) {\n this.resources.chromaKeyUniforms.uniforms.uMode = value;\n }\n\n /** Minimum saturation threshold to protect gray/white/black colors (0-1) */\n get minSaturation(): number {\n return this.resources.chromaKeyUniforms.uniforms.uMinSaturation as number;\n }\n\n set minSaturation(value: number) {\n this.resources.chromaKeyUniforms.uniforms.uMinSaturation = value;\n }\n}\n"]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Texture } from 'pixi.js';
|
|
2
|
+
import type { ButtonCompSkinData, ButtonStateKey } from '../ui/components';
|
|
3
|
+
/**
|
|
4
|
+
* Generates ButtonComp skin data from asset alias and states.
|
|
5
|
+
*
|
|
6
|
+
* Uses ButtonComp state keys directly (up, over, down, disabled) without any mapping.
|
|
7
|
+
* Creates texture references for each state with the naming convention `{alias}_{state}`.
|
|
8
|
+
*
|
|
9
|
+
* @param alias - Asset alias used in texture names (e.g., 'btn_bet_minus')
|
|
10
|
+
* @param states - Array of ButtonComp state names (default: ['up', 'over', 'down', 'disabled'])
|
|
11
|
+
* @returns ButtonComp skin data with texture references for each state
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Generate skin for a button with all states
|
|
16
|
+
* const decreaseButtonSkin = generateButtonSkinFromAsset('btn_bet_minus');
|
|
17
|
+
* // Result: { up: { background: { texture: 'btn_bet_minus_up' } }, over: ..., down: ..., disabled: ... }
|
|
18
|
+
*
|
|
19
|
+
* // Generate skin for a button with custom states (only up and over)
|
|
20
|
+
* const playButtonSkin = generateButtonSkinFromAsset('btn_play', undefined, ['up', 'over']);
|
|
21
|
+
* // Result: { up: { background: { texture: 'btn_play_up' } }, over: { background: { texture: 'btn_play_over' } } }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function generateButtonSkinFromAsset(backgroundName: string, iconName?: string, buttonStates?: ButtonStateKey[], iconStates?: ButtonStateKey[]): ButtonCompSkinData;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves animation frames as PixiJS textures from various definition formats.
|
|
27
|
+
*
|
|
28
|
+
* This helper function supports three input formats:
|
|
29
|
+
* 1. **Single texture name**: String identifier for a static sprite
|
|
30
|
+
* 2. **Array of texture names**: Direct list of texture identifiers for animation
|
|
31
|
+
* 3. **Spritesheet reference**: Object with `sheet` (spritesheet asset name) and `anim` (animation name)
|
|
32
|
+
*
|
|
33
|
+
* The function handles spritesheet parsing automatically and safely returns an empty array
|
|
34
|
+
* if the definition is invalid or assets are not found.
|
|
35
|
+
*
|
|
36
|
+
* @param def - Animation definition in one of the supported formats:
|
|
37
|
+
* - `string`: Single texture name for static sprite
|
|
38
|
+
* - `string[]`: Array of texture names to load directly
|
|
39
|
+
* - `{ sheet: string; anim: string }`: Reference to a spritesheet animation
|
|
40
|
+
* - `undefined`: Returns empty array
|
|
41
|
+
* @returns Array of PixiJS Texture objects for the animation frames. Returns empty array if:
|
|
42
|
+
* - Definition is undefined
|
|
43
|
+
* - Spritesheet is not found
|
|
44
|
+
* - Animation name doesn't exist in the spritesheet
|
|
45
|
+
* - Animation data is invalid
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* Using single texture name:
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const frames = getAnimationFrames('logo_static');
|
|
51
|
+
* const sprite = new Sprite(frames[0]);
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* Using array of texture names:
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const frames = getAnimationFrames([
|
|
58
|
+
* 'symbol_cherry_0',
|
|
59
|
+
* 'symbol_cherry_1',
|
|
60
|
+
* 'symbol_cherry_2'
|
|
61
|
+
* ]);
|
|
62
|
+
* const sprite = new AnimatedSprite(frames);
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* Using spritesheet reference:
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const frames = getAnimationFrames({
|
|
69
|
+
* sheet: 'symbols_spritesheet',
|
|
70
|
+
* anim: 'cherry_win'
|
|
71
|
+
* });
|
|
72
|
+
* const sprite = new AnimatedSprite(frames);
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* Usage in SlotSymbol component:
|
|
77
|
+
* ```typescript
|
|
78
|
+
* private getAnimationTextures(type: string): Texture[] {
|
|
79
|
+
* const key = this.resolveAssetKey(type);
|
|
80
|
+
* const animations = skin?.sources?.animations || {};
|
|
81
|
+
* const def = animations[key] as string[] | { sheet: string; anim: string } | undefined;
|
|
82
|
+
* return getAnimationFrames(def);
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export declare function getAnimationFrames(def: string | string[] | {
|
|
89
|
+
sheet: string;
|
|
90
|
+
anim: string;
|
|
91
|
+
} | undefined): Texture[];
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves animation frame names as strings from various definition formats.
|
|
94
|
+
* Similar to getAnimationFrames but returns string[] instead of Texture[].
|
|
95
|
+
* Useful for particle systems that need texture names rather than Texture objects.
|
|
96
|
+
*
|
|
97
|
+
* @param def - Animation definition in one of the supported formats:
|
|
98
|
+
* - `string`: Single texture name
|
|
99
|
+
* - `string[]`: Array of texture names (returned as-is)
|
|
100
|
+
* - `{ sheet: string; anim: string }`: Reference to a spritesheet animation
|
|
101
|
+
* - `undefined`: Returns empty array
|
|
102
|
+
* @returns Array of texture name strings
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const frameNames = getAnimationFrameNames({
|
|
107
|
+
* sheet: 'symbols',
|
|
108
|
+
* anim: 'symbols/pic1'
|
|
109
|
+
* });
|
|
110
|
+
* // Returns: ['pic1_0', 'pic1_1', 'pic1_2', ...]
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare function getAnimationFrameNames(def: string | string[] | {
|
|
114
|
+
sheet: string;
|
|
115
|
+
anim: string;
|
|
116
|
+
} | undefined): string[];
|
|
117
|
+
//# sourceMappingURL=AssetHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetHelper.d.ts","sourceRoot":"","sources":["../../helpers/AssetHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,OAAO,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,MAAM,EACtB,QAAQ,CAAC,EAAE,MAAM,EACjB,YAAY,GAAE,cAAc,EAAuC,EACnE,UAAU,CAAC,EAAE,cAAc,EAAE,GAC5B,kBAAkB,CAiCpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACnE,OAAO,EAAE,CAGX;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACnE,MAAM,EAAE,CAUV"}
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { type ColorSource } from 'pixi.js';
|
|
2
|
+
import { SVGStyleData } from './SVGParser';
|
|
3
|
+
import type { ButtonStateKey } from '../ui/components/ButtonComp';
|
|
4
|
+
/**
|
|
5
|
+
* Button state styles for SVG assets.
|
|
6
|
+
*
|
|
7
|
+
* Defines the visual appearance of buttons in different interaction states.
|
|
8
|
+
* Each state contains CSS-like style definitions for SVG elements.
|
|
9
|
+
* Uses ButtonComp state names: up, down, over, disabled.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const buttonStyles: ButtonState = {
|
|
14
|
+
* up: { '#primary': { fill: '#4CAF50' } },
|
|
15
|
+
* over: { '#primary': { fill: '#66BB6A' } },
|
|
16
|
+
* down: { '#primary': { fill: '#388E3C' } },
|
|
17
|
+
* disabled: { '#primary': { fill: '#CCCCCC' } }
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface ButtonState {
|
|
22
|
+
/** Up/default state styles */
|
|
23
|
+
up: SVGStyleData;
|
|
24
|
+
/** Over/hover state styles */
|
|
25
|
+
over: SVGStyleData;
|
|
26
|
+
/** Down/pressed state styles */
|
|
27
|
+
down: SVGStyleData;
|
|
28
|
+
/** Disabled state styles (optional) */
|
|
29
|
+
disabled?: SVGStyleData;
|
|
30
|
+
/** Selected up state styles */
|
|
31
|
+
selected_up?: SVGStyleData;
|
|
32
|
+
/** Selected over state styles */
|
|
33
|
+
selected_over?: SVGStyleData;
|
|
34
|
+
/** Selected down state styles */
|
|
35
|
+
selected_down?: SVGStyleData;
|
|
36
|
+
/** Selected disabled state styles */
|
|
37
|
+
selected_disabled?: SVGStyleData;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for loading SVG assets.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const config: SVGAssetConfig = {
|
|
45
|
+
* alias: 'play_button',
|
|
46
|
+
* src: 'assets/svg/buttons/play.svg',
|
|
47
|
+
* size: { width: 120, height: 120 },
|
|
48
|
+
* resolution: 2,
|
|
49
|
+
* themeColor: '#4CAF50',
|
|
50
|
+
* states: ['up', 'over', 'down']
|
|
51
|
+
* };
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export interface SVGAssetConfig {
|
|
55
|
+
/** Unique identifier for the asset */
|
|
56
|
+
alias: string;
|
|
57
|
+
/** Path to the SVG file */
|
|
58
|
+
src: string;
|
|
59
|
+
/** Target size for rasterization */
|
|
60
|
+
size?: {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
};
|
|
64
|
+
/** Resolution multiplier for high-DPI displays */
|
|
65
|
+
resolution?: number;
|
|
66
|
+
/** Theme color for styling (supports all PixiJS ColorSource formats) */
|
|
67
|
+
themeColor?: ColorSource;
|
|
68
|
+
/** Button states to generate (e.g., ['up', 'over', 'down', 'disabled']) */
|
|
69
|
+
states?: ButtonStateKey[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* High-level utility for loading and managing SVG assets in PixiJS.
|
|
73
|
+
*
|
|
74
|
+
* SVGAssetHelper provides a convenient API for loading SVG files as PixiJS textures
|
|
75
|
+
* with automatic theming, button state management, and batch loading capabilities.
|
|
76
|
+
*
|
|
77
|
+
* ## Features
|
|
78
|
+
*
|
|
79
|
+
* - **Theme Support**: Global and per-asset theme colors
|
|
80
|
+
* - **Button States**: Automatic generation of up, over, down, disabled states
|
|
81
|
+
* - **Batch Loading**: Load multiple assets efficiently
|
|
82
|
+
* - **Color Manipulation**: Automatic lighten/darken for button states
|
|
83
|
+
* - **Cache Management**: Check and clear loaded assets
|
|
84
|
+
* - **Custom Styles**: Create custom style configurations
|
|
85
|
+
*
|
|
86
|
+
* ## Workflow
|
|
87
|
+
*
|
|
88
|
+
* 1. **Initialize**: Set global theme color (optional)
|
|
89
|
+
* 2. **Load**: Load SVG assets with configuration
|
|
90
|
+
* 3. **Use**: Retrieve textures and create sprites
|
|
91
|
+
* 4. **Manage**: Check cache and clear unused assets
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* import { SVGAssetHelper, SVGLoader } from '@rb-games/core/helpers';
|
|
96
|
+
* import { Sprite } from 'pixi.js';
|
|
97
|
+
*
|
|
98
|
+
* // Initialize SVG system
|
|
99
|
+
* SVGLoader.install();
|
|
100
|
+
* SVGAssetHelper.setThemeColor('#4CAF50');
|
|
101
|
+
*
|
|
102
|
+
* // Load a simple icon
|
|
103
|
+
* await SVGAssetHelper.loadSVGAsset({
|
|
104
|
+
* alias: 'settings_icon',
|
|
105
|
+
* src: 'assets/svg/settings.svg',
|
|
106
|
+
* size: { width: 48, height: 48 },
|
|
107
|
+
* themeColor: '#2196F3'
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* // Create sprite
|
|
111
|
+
* const icon = new Sprite(SVGAssetHelper.getAsset('settings_icon'));
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* // Load button with states
|
|
117
|
+
* await SVGAssetHelper.loadButtonAsset({
|
|
118
|
+
* alias: 'play_btn',
|
|
119
|
+
* src: 'assets/svg/play.svg',
|
|
120
|
+
* size: { width: 120, height: 120 },
|
|
121
|
+
* themeColor: '#4CAF50',
|
|
122
|
+
* states: ['up', 'over', 'down']
|
|
123
|
+
* });
|
|
124
|
+
*
|
|
125
|
+
* // Create interactive button
|
|
126
|
+
* const button = new Sprite(SVGAssetHelper.getAsset('play_btn', 'up'));
|
|
127
|
+
* button.eventMode = 'static';
|
|
128
|
+
* button.cursor = 'pointer';
|
|
129
|
+
*
|
|
130
|
+
* button.on('pointerover', () => {
|
|
131
|
+
* button.texture = SVGAssetHelper.getAsset('play_btn', 'over');
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* button.on('pointerout', () => {
|
|
135
|
+
* button.texture = SVGAssetHelper.getAsset('play_btn', 'up');
|
|
136
|
+
* });
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* // Batch load multiple assets
|
|
142
|
+
* await SVGAssetHelper.loadBatchAssets([
|
|
143
|
+
* {
|
|
144
|
+
* alias: 'star_icon',
|
|
145
|
+
* src: 'assets/svg/icons/star.svg',
|
|
146
|
+
* size: { width: 32, height: 32 },
|
|
147
|
+
* themeColor: '#FFD700'
|
|
148
|
+
* },
|
|
149
|
+
* {
|
|
150
|
+
* alias: 'close_btn',
|
|
151
|
+
* src: 'assets/svg/buttons/close.svg',
|
|
152
|
+
* size: { width: 40, height: 40 },
|
|
153
|
+
* states: ['up', 'over'],
|
|
154
|
+
* themeColor: '#F44336'
|
|
155
|
+
* }
|
|
156
|
+
* ]);
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
export declare class SVGAssetHelper {
|
|
162
|
+
private static themeColor;
|
|
163
|
+
/**
|
|
164
|
+
* Sets the global theme color for all SVG assets.
|
|
165
|
+
*
|
|
166
|
+
* This color will be used as the default for all assets unless overridden
|
|
167
|
+
* in individual asset configurations.
|
|
168
|
+
*
|
|
169
|
+
* @param color - Theme color (supports all PixiJS ColorSource formats)
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* // Set theme with hex string
|
|
174
|
+
* SVGAssetHelper.setThemeColor('#4CAF50');
|
|
175
|
+
*
|
|
176
|
+
* // Set theme with number
|
|
177
|
+
* SVGAssetHelper.setThemeColor(0x4CAF50);
|
|
178
|
+
*
|
|
179
|
+
* // Set theme with RGB array
|
|
180
|
+
* SVGAssetHelper.setThemeColor([0.3, 0.69, 0.31]);
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
static setThemeColor(color: ColorSource): void;
|
|
184
|
+
/**
|
|
185
|
+
* Gets the current global theme color.
|
|
186
|
+
*
|
|
187
|
+
* @returns The current theme color as ColorSource
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const currentTheme = SVGAssetHelper.getThemeColor();
|
|
192
|
+
* // Can be used directly or converted as needed
|
|
193
|
+
* const hex = new Color(currentTheme).toHex();
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
static getThemeColor(): ColorSource;
|
|
197
|
+
/**
|
|
198
|
+
* Create button state styles based on theme color
|
|
199
|
+
*/
|
|
200
|
+
static createButtonStyles(themeColor?: ColorSource, variations?: {
|
|
201
|
+
over: number; /** darken amount */
|
|
202
|
+
down: number;
|
|
203
|
+
}): ButtonState;
|
|
204
|
+
/**
|
|
205
|
+
* Create custom styles
|
|
206
|
+
*/
|
|
207
|
+
static createCustomStyles(config: {
|
|
208
|
+
selectors: string[];
|
|
209
|
+
colors: {
|
|
210
|
+
[state: string]: string[];
|
|
211
|
+
};
|
|
212
|
+
}): {
|
|
213
|
+
[state: string]: SVGStyleData;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Loads a single SVG asset as a PixiJS texture.
|
|
217
|
+
*
|
|
218
|
+
* This method loads an SVG file, applies optional theme colors and styles,
|
|
219
|
+
* and registers it with the PixiJS Assets system for later retrieval.
|
|
220
|
+
*
|
|
221
|
+
* @param config - Asset configuration
|
|
222
|
+
* @returns Promise that resolves when the asset is loaded
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* // Load a simple icon
|
|
227
|
+
* await SVGAssetHelper.loadSVGAsset({
|
|
228
|
+
* alias: 'home_icon',
|
|
229
|
+
* src: 'assets/svg/home.svg',
|
|
230
|
+
* size: { width: 64, height: 64 },
|
|
231
|
+
* resolution: 2
|
|
232
|
+
* });
|
|
233
|
+
*
|
|
234
|
+
* // Load with theme color
|
|
235
|
+
* await SVGAssetHelper.loadSVGAsset({
|
|
236
|
+
* alias: 'settings_icon',
|
|
237
|
+
* src: 'assets/svg/settings.svg',
|
|
238
|
+
* size: { width: 48, height: 48 },
|
|
239
|
+
* themeColor: '#2196F3'
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
static loadSVGAsset(config: SVGAssetConfig): Promise<void>;
|
|
244
|
+
/**
|
|
245
|
+
* Loads a button SVG asset with multiple interaction states.
|
|
246
|
+
*
|
|
247
|
+
* Automatically generates up, over, down, and optionally disabled states
|
|
248
|
+
* by applying color variations (lighten for over, darken for down).
|
|
249
|
+
* Each state is loaded as a separate texture with the naming convention `{alias}_{state}`.
|
|
250
|
+
*
|
|
251
|
+
* @param config - Button asset configuration
|
|
252
|
+
* @returns Promise that resolves when all button states are loaded
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* // Load button with default states
|
|
257
|
+
* await SVGAssetHelper.loadButtonAsset({
|
|
258
|
+
* alias: 'play_btn',
|
|
259
|
+
* src: 'assets/svg/play.svg',
|
|
260
|
+
* size: { width: 120, height: 120 },
|
|
261
|
+
* themeColor: '#4CAF50'
|
|
262
|
+
* });
|
|
263
|
+
*
|
|
264
|
+
* // Access different states
|
|
265
|
+
* const upTexture = SVGAssetHelper.getAsset('play_btn', 'up');
|
|
266
|
+
* const overTexture = SVGAssetHelper.getAsset('play_btn', 'over');
|
|
267
|
+
* const downTexture = SVGAssetHelper.getAsset('play_btn', 'down');
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* // Custom states
|
|
273
|
+
* await SVGAssetHelper.loadButtonAsset({
|
|
274
|
+
* alias: 'custom_btn',
|
|
275
|
+
* src: 'assets/svg/button.svg',
|
|
276
|
+
* size: { width: 100, height: 40 },
|
|
277
|
+
* themeColor: '#E91E63',
|
|
278
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
279
|
+
* });
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
static loadButtonAsset(config: SVGAssetConfig): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Loads multiple SVG assets in parallel for efficient batch loading.
|
|
285
|
+
*
|
|
286
|
+
* Automatically determines whether to load each asset as a simple SVG or
|
|
287
|
+
* as a button with states based on the states property.
|
|
288
|
+
*
|
|
289
|
+
* @param basePath - Base directory path for all assets (assets without src will use basePath/alias.svg)
|
|
290
|
+
* @param assets - Array of asset configurations (strings, objects, or mixed)
|
|
291
|
+
* @param defaults - Optional default configuration applied to all assets
|
|
292
|
+
* @returns Promise that resolves when all assets are loaded
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* // Simple string array (most convenient)
|
|
297
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
298
|
+
* 'assets/svg/desktop',
|
|
299
|
+
* ['btn_bet_minus', 'btn_bet_plus', 'btn_spin'],
|
|
300
|
+
* {
|
|
301
|
+
* size: { width: 100, height: 100 },
|
|
302
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
303
|
+
* }
|
|
304
|
+
* );
|
|
305
|
+
*
|
|
306
|
+
* // Mixed array (strings and objects for customization)
|
|
307
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
308
|
+
* 'assets/svg/desktop',
|
|
309
|
+
* [
|
|
310
|
+
* 'btn_bet_minus', // uses default size
|
|
311
|
+
* 'btn_bet_plus', // uses default size
|
|
312
|
+
* { alias: 'btn_spin', size: { width: 120, height: 120 } } // custom size
|
|
313
|
+
* ],
|
|
314
|
+
* {
|
|
315
|
+
* size: { width: 80, height: 80 },
|
|
316
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
317
|
+
* }
|
|
318
|
+
* );
|
|
319
|
+
*
|
|
320
|
+
* // All objects (full customization)
|
|
321
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
322
|
+
* 'assets/svg/desktop',
|
|
323
|
+
* [
|
|
324
|
+
* { alias: 'btn_bet_minus', size: { width: 90, height: 90 } },
|
|
325
|
+
* { alias: 'btn_bet_plus' }, // uses default size
|
|
326
|
+
* { alias: 'btn_spin', states: ['up', 'over'] } // custom states
|
|
327
|
+
* ],
|
|
328
|
+
* {
|
|
329
|
+
* size: { width: 100, height: 100 },
|
|
330
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
331
|
+
* }
|
|
332
|
+
* );
|
|
333
|
+
*
|
|
334
|
+
* // With full src paths (when assets are in different directories)
|
|
335
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
336
|
+
* '',
|
|
337
|
+
* [
|
|
338
|
+
* {
|
|
339
|
+
* alias: 'star_icon',
|
|
340
|
+
* src: 'assets/svg/icons/star.svg',
|
|
341
|
+
* size: { width: 32, height: 32 },
|
|
342
|
+
* themeColor: '#FFD700'
|
|
343
|
+
* },
|
|
344
|
+
* {
|
|
345
|
+
* alias: 'close_btn',
|
|
346
|
+
* src: 'assets/svg/buttons/close.svg',
|
|
347
|
+
* size: { width: 40, height: 40 },
|
|
348
|
+
* states: ['up', 'over'],
|
|
349
|
+
* themeColor: '#F44336'
|
|
350
|
+
* }
|
|
351
|
+
* ]
|
|
352
|
+
* );
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
static loadBatchAssets(basePath: string, assets: Array<string | Partial<SVGAssetConfig>>, defaults?: Partial<SVGAssetConfig>): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* Retrieves a loaded SVG asset texture.
|
|
358
|
+
*
|
|
359
|
+
* For button assets with states, specify the state parameter to get
|
|
360
|
+
* the specific state texture.
|
|
361
|
+
*
|
|
362
|
+
* @param alias - Asset alias used during loading
|
|
363
|
+
* @param state - Button state (for button assets)
|
|
364
|
+
* @returns The PixiJS texture
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* ```typescript
|
|
368
|
+
* // Get simple asset
|
|
369
|
+
* const iconTexture = SVGAssetHelper.getAsset('home_icon');
|
|
370
|
+
* const sprite = new Sprite(iconTexture);
|
|
371
|
+
*
|
|
372
|
+
* // Get button state
|
|
373
|
+
* const upTexture = SVGAssetHelper.getAsset('play_btn', 'up');
|
|
374
|
+
* const overTexture = SVGAssetHelper.getAsset('play_btn', 'over');
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
static getAsset(alias: string, state?: string): any;
|
|
378
|
+
/**
|
|
379
|
+
* Check if asset exists in cache
|
|
380
|
+
*/
|
|
381
|
+
static hasAsset(alias: string, state?: string): boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Clear specific asset from cache
|
|
384
|
+
*/
|
|
385
|
+
static clearAsset(alias: string, state?: string): void;
|
|
386
|
+
/**
|
|
387
|
+
* Generate SHA-256 hash for asset configuration.
|
|
388
|
+
* This creates a unique identifier based on the actual asset properties (src, styles, size, resolution)
|
|
389
|
+
* rather than the state name, enabling efficient cache reuse when multiple states have identical configurations.
|
|
390
|
+
*
|
|
391
|
+
* @param src - Source path of the SVG
|
|
392
|
+
* @param data - Load data containing styles, size, and resolution
|
|
393
|
+
* @returns SHA-256 hash string
|
|
394
|
+
*/
|
|
395
|
+
private static generateAssetHash;
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=SVGAssetHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SVGAssetHelper.d.ts","sourceRoot":"","sources":["../../helpers/SVGAssetHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAe,YAAY,EAAE,MAA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AAO;IAKvD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtD;;;;;;;;OAQG;mBACkB,iBAAiB;CAgBvC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for the SVG loader.
|
|
3
|
+
*/
|
|
4
|
+
export interface SVGLoaderConfig {
|
|
5
|
+
/** Glob pattern to match SVG files (uses minimatch) */
|
|
6
|
+
testPattern?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* SVG loader plugin for PixiJS Assets system.
|
|
10
|
+
*
|
|
11
|
+
* SVGLoader integrates the SVG parser into PixiJS asset loading pipeline,
|
|
12
|
+
* enabling automatic loading and processing of SVG files as textures.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Install once at application startup using SVGLoader.install().
|
|
16
|
+
* After installation, SVG files can be loaded using PixiJS Assets API or SVGAssetHelper.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare class SVGLoader {
|
|
21
|
+
private static installed;
|
|
22
|
+
/**
|
|
23
|
+
* Installs the SVG loader into the PixiJS Assets system.
|
|
24
|
+
*
|
|
25
|
+
* This method must be called once at application startup before loading any SVG assets.
|
|
26
|
+
* It registers the SVG parser with PixiJS, enabling automatic SVG file processing.
|
|
27
|
+
* This method is idempotent - calling it multiple times is safe but only the first call will take effect.
|
|
28
|
+
*
|
|
29
|
+
* @param config - Optional configuration for SVG file matching
|
|
30
|
+
*/
|
|
31
|
+
static install(config?: SVGLoaderConfig): void;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the SVG loader has been installed.
|
|
34
|
+
*
|
|
35
|
+
* @returns True if the loader is installed, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
static isInstalled(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Uninstalls the SVG loader from the PixiJS Assets system.
|
|
40
|
+
*
|
|
41
|
+
* This method is primarily intended for testing purposes.
|
|
42
|
+
* In production, you typically install the loader once and never uninstall it.
|
|
43
|
+
*/
|
|
44
|
+
static uninstall(): void;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=SVGLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SVGLoader.d.ts","sourceRoot":"","sources":["../../helpers/SVGLoader.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAS;IAEjC;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI;IAkB9C;;;;OAIG;IACH,MAAM,CAAC,WAAW,IAAI,OAAO;IAI7B;;;;;OAKG;IACH,MAAM,CAAC,SAAS,IAAI,IAAI;CAczB"}
|