@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,702 @@
|
|
|
1
|
+
import { ExtensionType, Assets, Color, Cache, Texture, TextureSource } from 'pixi.js';
|
|
2
|
+
import { minimatch } from 'minimatch';
|
|
3
|
+
import { mergeWith, isPlainObject } from 'lodash';
|
|
4
|
+
|
|
5
|
+
// helpers/SVGLoader.ts
|
|
6
|
+
var parserConfig = {};
|
|
7
|
+
function manipulateSVG(svgString, data) {
|
|
8
|
+
const parser = new DOMParser();
|
|
9
|
+
const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
|
|
10
|
+
const svgElement = svgDoc.documentElement;
|
|
11
|
+
if (data == null ? void 0 : data.styles) {
|
|
12
|
+
Object.entries(data.styles).forEach(([selector, styles]) => {
|
|
13
|
+
const elements = svgDoc.querySelectorAll(selector);
|
|
14
|
+
elements.forEach((element) => {
|
|
15
|
+
Object.entries(styles).forEach(([attr, value]) => {
|
|
16
|
+
element.setAttribute(attr, value);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (data == null ? void 0 : data.size) {
|
|
22
|
+
svgElement.setAttribute("width", data.size.width.toString());
|
|
23
|
+
svgElement.setAttribute("height", data.size.height.toString());
|
|
24
|
+
}
|
|
25
|
+
return new XMLSerializer().serializeToString(svgDoc);
|
|
26
|
+
}
|
|
27
|
+
async function createTextureFromSVG(svgString, data) {
|
|
28
|
+
const blob = new Blob([svgString], { type: "image/svg+xml" });
|
|
29
|
+
const url = URL.createObjectURL(blob);
|
|
30
|
+
const img = new Image();
|
|
31
|
+
img.src = url;
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
img.onload = () => {
|
|
34
|
+
try {
|
|
35
|
+
const canvas = document.createElement("canvas");
|
|
36
|
+
const ctx = canvas.getContext("2d");
|
|
37
|
+
if (!ctx) {
|
|
38
|
+
reject(new Error("Could not get canvas context"));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const resolution = (data == null ? void 0 : data.resolution) || 1;
|
|
42
|
+
canvas.width = img.width * resolution;
|
|
43
|
+
canvas.height = img.height * resolution;
|
|
44
|
+
ctx.drawImage(img, 0, 0);
|
|
45
|
+
const source = TextureSource.from(canvas);
|
|
46
|
+
const texture = new Texture(source);
|
|
47
|
+
resolve(texture);
|
|
48
|
+
URL.revokeObjectURL(url);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
reject(error);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
img.onerror = () => {
|
|
54
|
+
URL.revokeObjectURL(url);
|
|
55
|
+
reject(new Error("Failed to load SVG image"));
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
var SVGParser = {
|
|
60
|
+
/**
|
|
61
|
+
* Extension metadata for the parser.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
extension: {
|
|
66
|
+
type: ExtensionType.LoadParser,
|
|
67
|
+
name: "svgParser",
|
|
68
|
+
priority: 0
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* Unique identifier for the parser.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
id: "svgParser",
|
|
76
|
+
/**
|
|
77
|
+
* Tests if a URL should be handled by this parser.
|
|
78
|
+
*
|
|
79
|
+
* By default, matches files ending with .svg extension.
|
|
80
|
+
* Can be customized via configureSVGParser() with a glob pattern.
|
|
81
|
+
*
|
|
82
|
+
* @param url - Asset URL to test
|
|
83
|
+
* @returns True if this parser should handle the URL
|
|
84
|
+
*/
|
|
85
|
+
test: (url) => {
|
|
86
|
+
if (parserConfig.testPattern) {
|
|
87
|
+
try {
|
|
88
|
+
const urlObj = new URL(url);
|
|
89
|
+
const pathname = urlObj.pathname.startsWith("/") ? urlObj.pathname.slice(1) : urlObj.pathname;
|
|
90
|
+
return minimatch(pathname, parserConfig.testPattern, { partial: true });
|
|
91
|
+
} catch {
|
|
92
|
+
return minimatch(url, parserConfig.testPattern, { partial: true });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return /\.svg$/i.test(url);
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Loads and processes an SVG file into a PixiJS Texture.
|
|
99
|
+
*
|
|
100
|
+
* This method:
|
|
101
|
+
* 1. Fetches the SVG file from the URL
|
|
102
|
+
* 2. Applies style and size manipulations
|
|
103
|
+
* 3. Rasterizes the SVG to a canvas
|
|
104
|
+
* 4. Creates a PixiJS Texture from the canvas
|
|
105
|
+
*
|
|
106
|
+
* @param url - URL of the SVG file to load
|
|
107
|
+
* @param resolvedAsset - Resolved asset with optional load data
|
|
108
|
+
* @returns Promise that resolves to a PixiJS Texture
|
|
109
|
+
*/
|
|
110
|
+
async load(url, resolvedAsset) {
|
|
111
|
+
const response = await fetch(url);
|
|
112
|
+
const svgString = await response.text();
|
|
113
|
+
const manipulatedSVG = manipulateSVG(svgString, resolvedAsset == null ? void 0 : resolvedAsset.data);
|
|
114
|
+
const texture = await createTextureFromSVG(manipulatedSVG, resolvedAsset == null ? void 0 : resolvedAsset.data);
|
|
115
|
+
texture.label = (resolvedAsset == null ? void 0 : resolvedAsset.src) ?? "unknown";
|
|
116
|
+
return texture;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
function configureSVGParser(config) {
|
|
120
|
+
parserConfig = { ...parserConfig, ...config };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// helpers/SVGLoader.ts
|
|
124
|
+
var SVGLoader = class {
|
|
125
|
+
static installed = false;
|
|
126
|
+
/**
|
|
127
|
+
* Installs the SVG loader into the PixiJS Assets system.
|
|
128
|
+
*
|
|
129
|
+
* This method must be called once at application startup before loading any SVG assets.
|
|
130
|
+
* It registers the SVG parser with PixiJS, enabling automatic SVG file processing.
|
|
131
|
+
* This method is idempotent - calling it multiple times is safe but only the first call will take effect.
|
|
132
|
+
*
|
|
133
|
+
* @param config - Optional configuration for SVG file matching
|
|
134
|
+
*/
|
|
135
|
+
static install(config) {
|
|
136
|
+
if (this.installed) {
|
|
137
|
+
console.warn("SVGLoader is already installed");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (config) {
|
|
141
|
+
configureSVGParser(config);
|
|
142
|
+
}
|
|
143
|
+
Assets.loader.parsers.unshift(SVGParser);
|
|
144
|
+
this.installed = true;
|
|
145
|
+
console.log("SVG Loader installed successfully");
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Checks if the SVG loader has been installed.
|
|
149
|
+
*
|
|
150
|
+
* @returns True if the loader is installed, false otherwise
|
|
151
|
+
*/
|
|
152
|
+
static isInstalled() {
|
|
153
|
+
return this.installed;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Uninstalls the SVG loader from the PixiJS Assets system.
|
|
157
|
+
*
|
|
158
|
+
* This method is primarily intended for testing purposes.
|
|
159
|
+
* In production, you typically install the loader once and never uninstall it.
|
|
160
|
+
*/
|
|
161
|
+
static uninstall() {
|
|
162
|
+
if (!this.installed) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const index = Assets.loader.parsers.indexOf(SVGParser);
|
|
166
|
+
if (index > -1) {
|
|
167
|
+
Assets.loader.parsers.splice(index, 1);
|
|
168
|
+
}
|
|
169
|
+
this.installed = false;
|
|
170
|
+
console.log("SVG Loader uninstalled");
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
function adjustColor(color, amount, sign) {
|
|
174
|
+
const colorObj = new Color(color);
|
|
175
|
+
const rgb = {
|
|
176
|
+
r: colorObj.red * 255,
|
|
177
|
+
g: colorObj.green * 255,
|
|
178
|
+
b: colorObj.blue * 255
|
|
179
|
+
};
|
|
180
|
+
const delta = 255 * amount * sign;
|
|
181
|
+
const newR = Math.max(0, Math.min(255, rgb.r + delta));
|
|
182
|
+
const newG = Math.max(0, Math.min(255, rgb.g + delta));
|
|
183
|
+
const newB = Math.max(0, Math.min(255, rgb.b + delta));
|
|
184
|
+
return new Color([newR / 255, newG / 255, newB / 255]);
|
|
185
|
+
}
|
|
186
|
+
function lightenColor(color, amount) {
|
|
187
|
+
return adjustColor(color, amount, 1);
|
|
188
|
+
}
|
|
189
|
+
function darkenColor(color, amount) {
|
|
190
|
+
return adjustColor(color, amount, -1);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// helpers/SVGAssetHelper.ts
|
|
194
|
+
var SVGAssetHelper = class {
|
|
195
|
+
static themeColor = "#4CAF50";
|
|
196
|
+
/**
|
|
197
|
+
* Sets the global theme color for all SVG assets.
|
|
198
|
+
*
|
|
199
|
+
* This color will be used as the default for all assets unless overridden
|
|
200
|
+
* in individual asset configurations.
|
|
201
|
+
*
|
|
202
|
+
* @param color - Theme color (supports all PixiJS ColorSource formats)
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* // Set theme with hex string
|
|
207
|
+
* SVGAssetHelper.setThemeColor('#4CAF50');
|
|
208
|
+
*
|
|
209
|
+
* // Set theme with number
|
|
210
|
+
* SVGAssetHelper.setThemeColor(0x4CAF50);
|
|
211
|
+
*
|
|
212
|
+
* // Set theme with RGB array
|
|
213
|
+
* SVGAssetHelper.setThemeColor([0.3, 0.69, 0.31]);
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
static setThemeColor(color) {
|
|
217
|
+
this.themeColor = color;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Gets the current global theme color.
|
|
221
|
+
*
|
|
222
|
+
* @returns The current theme color as ColorSource
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* const currentTheme = SVGAssetHelper.getThemeColor();
|
|
227
|
+
* // Can be used directly or converted as needed
|
|
228
|
+
* const hex = new Color(currentTheme).toHex();
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
static getThemeColor() {
|
|
232
|
+
return this.themeColor;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create button state styles based on theme color
|
|
236
|
+
*/
|
|
237
|
+
static createButtonStyles(themeColor, variations) {
|
|
238
|
+
const baseColor = themeColor || this.themeColor;
|
|
239
|
+
const baseColorHex = new Color(baseColor).toHex();
|
|
240
|
+
return {
|
|
241
|
+
up: {
|
|
242
|
+
"#primary": { fill: baseColorHex },
|
|
243
|
+
"#secondary": { fill: "#ffffff" },
|
|
244
|
+
"#background": { fill: baseColorHex }
|
|
245
|
+
},
|
|
246
|
+
over: {
|
|
247
|
+
"#primary": { fill: lightenColor(baseColor, (variations == null ? void 0 : variations.over) || 0.15).toHex() },
|
|
248
|
+
"#secondary": { fill: "#ffffff" },
|
|
249
|
+
"#background": { fill: lightenColor(baseColor, (variations == null ? void 0 : variations.over) || 0.15).toHex() }
|
|
250
|
+
},
|
|
251
|
+
down: {
|
|
252
|
+
"#primary": { fill: darkenColor(baseColor, (variations == null ? void 0 : variations.down) || 0.15).toHex() },
|
|
253
|
+
"#secondary": { fill: "#ffffff" },
|
|
254
|
+
"#background": { fill: darkenColor(baseColor, (variations == null ? void 0 : variations.down) || 0.15).toHex() }
|
|
255
|
+
},
|
|
256
|
+
disabled: {
|
|
257
|
+
"#primary": { fill: "#cccccc" },
|
|
258
|
+
"#secondary": { fill: "#999999" },
|
|
259
|
+
"#background": { fill: "#cccccc" }
|
|
260
|
+
},
|
|
261
|
+
selected_up: {
|
|
262
|
+
"#primary": { fill: baseColorHex },
|
|
263
|
+
"#secondary": { fill: "#ffffff" },
|
|
264
|
+
"#background": { fill: baseColorHex }
|
|
265
|
+
},
|
|
266
|
+
selected_over: {
|
|
267
|
+
"#primary": { fill: lightenColor(baseColor, (variations == null ? void 0 : variations.over) || 0.15).toHex() },
|
|
268
|
+
"#secondary": { fill: "#ffffff" },
|
|
269
|
+
"#background": { fill: lightenColor(baseColor, (variations == null ? void 0 : variations.over) || 0.15).toHex() }
|
|
270
|
+
},
|
|
271
|
+
selected_down: {
|
|
272
|
+
"#primary": { fill: darkenColor(baseColor, (variations == null ? void 0 : variations.down) || 0.15).toHex() },
|
|
273
|
+
"#secondary": { fill: "#ffffff" },
|
|
274
|
+
"#background": { fill: darkenColor(baseColor, (variations == null ? void 0 : variations.down) || 0.15).toHex() }
|
|
275
|
+
},
|
|
276
|
+
selected_disabled: {
|
|
277
|
+
"#primary": { fill: "#cccccc" },
|
|
278
|
+
"#secondary": { fill: "#999999" },
|
|
279
|
+
"#background": { fill: "#cccccc" }
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Create custom styles
|
|
285
|
+
*/
|
|
286
|
+
static createCustomStyles(config) {
|
|
287
|
+
const result = {};
|
|
288
|
+
Object.entries(config.colors).forEach(([state, colors]) => {
|
|
289
|
+
result[state] = {};
|
|
290
|
+
config.selectors.forEach((selector, index) => {
|
|
291
|
+
if (colors[index]) {
|
|
292
|
+
result[state][selector] = { fill: colors[index] };
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Loads a single SVG asset as a PixiJS texture.
|
|
300
|
+
*
|
|
301
|
+
* This method loads an SVG file, applies optional theme colors and styles,
|
|
302
|
+
* and registers it with the PixiJS Assets system for later retrieval.
|
|
303
|
+
*
|
|
304
|
+
* @param config - Asset configuration
|
|
305
|
+
* @returns Promise that resolves when the asset is loaded
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* // Load a simple icon
|
|
310
|
+
* await SVGAssetHelper.loadSVGAsset({
|
|
311
|
+
* alias: 'home_icon',
|
|
312
|
+
* src: 'assets/svg/home.svg',
|
|
313
|
+
* size: { width: 64, height: 64 },
|
|
314
|
+
* resolution: 2
|
|
315
|
+
* });
|
|
316
|
+
*
|
|
317
|
+
* // Load with theme color
|
|
318
|
+
* await SVGAssetHelper.loadSVGAsset({
|
|
319
|
+
* alias: 'settings_icon',
|
|
320
|
+
* src: 'assets/svg/settings.svg',
|
|
321
|
+
* size: { width: 48, height: 48 },
|
|
322
|
+
* themeColor: '#2196F3'
|
|
323
|
+
* });
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
static async loadSVGAsset(config) {
|
|
327
|
+
const loadData = {
|
|
328
|
+
size: config.size,
|
|
329
|
+
resolution: config.resolution || 1
|
|
330
|
+
};
|
|
331
|
+
if (config.themeColor) {
|
|
332
|
+
const styles = this.createButtonStyles(config.themeColor);
|
|
333
|
+
loadData.styles = styles.up;
|
|
334
|
+
}
|
|
335
|
+
await Assets.load({
|
|
336
|
+
alias: config.alias,
|
|
337
|
+
src: `${config.src}`,
|
|
338
|
+
data: loadData
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Loads a button SVG asset with multiple interaction states.
|
|
343
|
+
*
|
|
344
|
+
* Automatically generates up, over, down, and optionally disabled states
|
|
345
|
+
* by applying color variations (lighten for over, darken for down).
|
|
346
|
+
* Each state is loaded as a separate texture with the naming convention `{alias}_{state}`.
|
|
347
|
+
*
|
|
348
|
+
* @param config - Button asset configuration
|
|
349
|
+
* @returns Promise that resolves when all button states are loaded
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```typescript
|
|
353
|
+
* // Load button with default states
|
|
354
|
+
* await SVGAssetHelper.loadButtonAsset({
|
|
355
|
+
* alias: 'play_btn',
|
|
356
|
+
* src: 'assets/svg/play.svg',
|
|
357
|
+
* size: { width: 120, height: 120 },
|
|
358
|
+
* themeColor: '#4CAF50'
|
|
359
|
+
* });
|
|
360
|
+
*
|
|
361
|
+
* // Access different states
|
|
362
|
+
* const upTexture = SVGAssetHelper.getAsset('play_btn', 'up');
|
|
363
|
+
* const overTexture = SVGAssetHelper.getAsset('play_btn', 'over');
|
|
364
|
+
* const downTexture = SVGAssetHelper.getAsset('play_btn', 'down');
|
|
365
|
+
* ```
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```typescript
|
|
369
|
+
* // Custom states
|
|
370
|
+
* await SVGAssetHelper.loadButtonAsset({
|
|
371
|
+
* alias: 'custom_btn',
|
|
372
|
+
* src: 'assets/svg/button.svg',
|
|
373
|
+
* size: { width: 100, height: 40 },
|
|
374
|
+
* themeColor: '#E91E63',
|
|
375
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
376
|
+
* });
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
static async loadButtonAsset(config) {
|
|
380
|
+
const styles = this.createButtonStyles(
|
|
381
|
+
config.themeColor ? typeof config.themeColor === "number" ? new Color(config.themeColor).toHex() : config.themeColor : void 0
|
|
382
|
+
);
|
|
383
|
+
const states = config.states || ["up", "over", "down"];
|
|
384
|
+
for (const state of states) {
|
|
385
|
+
const stateStyles = styles[state];
|
|
386
|
+
if (stateStyles) {
|
|
387
|
+
const loadData = {
|
|
388
|
+
styles: stateStyles,
|
|
389
|
+
size: config.size,
|
|
390
|
+
resolution: config.resolution || 1
|
|
391
|
+
};
|
|
392
|
+
const hash = await this.generateAssetHash(config.src, loadData);
|
|
393
|
+
await Assets.load({
|
|
394
|
+
alias: `${config.alias}_${state}`,
|
|
395
|
+
src: `${config.src}?hash=${hash}`,
|
|
396
|
+
data: loadData
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Loads multiple SVG assets in parallel for efficient batch loading.
|
|
403
|
+
*
|
|
404
|
+
* Automatically determines whether to load each asset as a simple SVG or
|
|
405
|
+
* as a button with states based on the states property.
|
|
406
|
+
*
|
|
407
|
+
* @param basePath - Base directory path for all assets (assets without src will use basePath/alias.svg)
|
|
408
|
+
* @param assets - Array of asset configurations (strings, objects, or mixed)
|
|
409
|
+
* @param defaults - Optional default configuration applied to all assets
|
|
410
|
+
* @returns Promise that resolves when all assets are loaded
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```typescript
|
|
414
|
+
* // Simple string array (most convenient)
|
|
415
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
416
|
+
* 'assets/svg/desktop',
|
|
417
|
+
* ['btn_bet_minus', 'btn_bet_plus', 'btn_spin'],
|
|
418
|
+
* {
|
|
419
|
+
* size: { width: 100, height: 100 },
|
|
420
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
421
|
+
* }
|
|
422
|
+
* );
|
|
423
|
+
*
|
|
424
|
+
* // Mixed array (strings and objects for customization)
|
|
425
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
426
|
+
* 'assets/svg/desktop',
|
|
427
|
+
* [
|
|
428
|
+
* 'btn_bet_minus', // uses default size
|
|
429
|
+
* 'btn_bet_plus', // uses default size
|
|
430
|
+
* { alias: 'btn_spin', size: { width: 120, height: 120 } } // custom size
|
|
431
|
+
* ],
|
|
432
|
+
* {
|
|
433
|
+
* size: { width: 80, height: 80 },
|
|
434
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
435
|
+
* }
|
|
436
|
+
* );
|
|
437
|
+
*
|
|
438
|
+
* // All objects (full customization)
|
|
439
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
440
|
+
* 'assets/svg/desktop',
|
|
441
|
+
* [
|
|
442
|
+
* { alias: 'btn_bet_minus', size: { width: 90, height: 90 } },
|
|
443
|
+
* { alias: 'btn_bet_plus' }, // uses default size
|
|
444
|
+
* { alias: 'btn_spin', states: ['up', 'over'] } // custom states
|
|
445
|
+
* ],
|
|
446
|
+
* {
|
|
447
|
+
* size: { width: 100, height: 100 },
|
|
448
|
+
* states: ['up', 'over', 'down', 'disabled']
|
|
449
|
+
* }
|
|
450
|
+
* );
|
|
451
|
+
*
|
|
452
|
+
* // With full src paths (when assets are in different directories)
|
|
453
|
+
* await SVGAssetHelper.loadBatchAssets(
|
|
454
|
+
* '',
|
|
455
|
+
* [
|
|
456
|
+
* {
|
|
457
|
+
* alias: 'star_icon',
|
|
458
|
+
* src: 'assets/svg/icons/star.svg',
|
|
459
|
+
* size: { width: 32, height: 32 },
|
|
460
|
+
* themeColor: '#FFD700'
|
|
461
|
+
* },
|
|
462
|
+
* {
|
|
463
|
+
* alias: 'close_btn',
|
|
464
|
+
* src: 'assets/svg/buttons/close.svg',
|
|
465
|
+
* size: { width: 40, height: 40 },
|
|
466
|
+
* states: ['up', 'over'],
|
|
467
|
+
* themeColor: '#F44336'
|
|
468
|
+
* }
|
|
469
|
+
* ]
|
|
470
|
+
* );
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
static async loadBatchAssets(basePath, assets, defaults) {
|
|
474
|
+
const defaultConfig = defaults || {};
|
|
475
|
+
const assetConfigs = assets.map(
|
|
476
|
+
(asset) => typeof asset === "string" ? { alias: asset } : asset
|
|
477
|
+
);
|
|
478
|
+
const configs = assetConfigs.map((asset) => ({
|
|
479
|
+
alias: asset.alias,
|
|
480
|
+
src: asset.src || (basePath ? `${basePath}/${asset.alias}.svg` : asset.alias),
|
|
481
|
+
size: asset.size || defaultConfig.size,
|
|
482
|
+
states: asset.states || defaultConfig.states,
|
|
483
|
+
themeColor: asset.themeColor || defaultConfig.themeColor,
|
|
484
|
+
resolution: asset.resolution || defaultConfig.resolution
|
|
485
|
+
}));
|
|
486
|
+
const promises = configs.map((config) => {
|
|
487
|
+
if (config.states && config.states.length > 1) {
|
|
488
|
+
return this.loadButtonAsset(config);
|
|
489
|
+
} else {
|
|
490
|
+
return this.loadSVGAsset(config);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
await Promise.all(promises);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Retrieves a loaded SVG asset texture.
|
|
497
|
+
*
|
|
498
|
+
* For button assets with states, specify the state parameter to get
|
|
499
|
+
* the specific state texture.
|
|
500
|
+
*
|
|
501
|
+
* @param alias - Asset alias used during loading
|
|
502
|
+
* @param state - Button state (for button assets)
|
|
503
|
+
* @returns The PixiJS texture
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```typescript
|
|
507
|
+
* // Get simple asset
|
|
508
|
+
* const iconTexture = SVGAssetHelper.getAsset('home_icon');
|
|
509
|
+
* const sprite = new Sprite(iconTexture);
|
|
510
|
+
*
|
|
511
|
+
* // Get button state
|
|
512
|
+
* const upTexture = SVGAssetHelper.getAsset('play_btn', 'up');
|
|
513
|
+
* const overTexture = SVGAssetHelper.getAsset('play_btn', 'over');
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
static getAsset(alias, state) {
|
|
517
|
+
const fullAlias = state ? `${alias}_${state}` : alias;
|
|
518
|
+
return Assets.get(fullAlias);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Check if asset exists in cache
|
|
522
|
+
*/
|
|
523
|
+
static hasAsset(alias, state) {
|
|
524
|
+
const fullAlias = state ? `${alias}_${state}` : alias;
|
|
525
|
+
return Cache.has(fullAlias);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Clear specific asset from cache
|
|
529
|
+
*/
|
|
530
|
+
static clearAsset(alias, state) {
|
|
531
|
+
const fullAlias = state ? `${alias}_${state}` : alias;
|
|
532
|
+
if (Cache.has(fullAlias)) {
|
|
533
|
+
Cache.remove(fullAlias);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Generate SHA-256 hash for asset configuration.
|
|
538
|
+
* This creates a unique identifier based on the actual asset properties (src, styles, size, resolution)
|
|
539
|
+
* rather than the state name, enabling efficient cache reuse when multiple states have identical configurations.
|
|
540
|
+
*
|
|
541
|
+
* @param src - Source path of the SVG
|
|
542
|
+
* @param data - Load data containing styles, size, and resolution
|
|
543
|
+
* @returns SHA-256 hash string
|
|
544
|
+
*/
|
|
545
|
+
static async generateAssetHash(src, data) {
|
|
546
|
+
const configString = JSON.stringify({
|
|
547
|
+
src,
|
|
548
|
+
styles: data.styles || {},
|
|
549
|
+
size: data.size || {},
|
|
550
|
+
resolution: data.resolution || 1
|
|
551
|
+
});
|
|
552
|
+
const encoder = new TextEncoder();
|
|
553
|
+
const dataBuffer = encoder.encode(configString);
|
|
554
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
|
|
555
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
556
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
557
|
+
return hashHex.substring(0, 12);
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
function generateButtonSkinFromAsset(backgroundName, iconName, buttonStates = ["up", "over", "down", "disabled"], iconStates) {
|
|
561
|
+
const skinData = {};
|
|
562
|
+
buttonStates.forEach((state) => {
|
|
563
|
+
skinData[state] = {
|
|
564
|
+
...skinData[state] ?? {},
|
|
565
|
+
background: { texture: `${backgroundName}_${state}` }
|
|
566
|
+
};
|
|
567
|
+
});
|
|
568
|
+
if (iconName) {
|
|
569
|
+
if (iconStates === void 0) {
|
|
570
|
+
buttonStates.forEach((state) => {
|
|
571
|
+
skinData[state] = {
|
|
572
|
+
...skinData[state] ?? {},
|
|
573
|
+
icon: { texture: iconName }
|
|
574
|
+
};
|
|
575
|
+
});
|
|
576
|
+
} else {
|
|
577
|
+
iconStates.forEach((state) => {
|
|
578
|
+
skinData[state] = {
|
|
579
|
+
...skinData[state] ?? {},
|
|
580
|
+
icon: { texture: `${iconName}_${state}` }
|
|
581
|
+
};
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return skinData;
|
|
586
|
+
}
|
|
587
|
+
function getAnimationFrames(def) {
|
|
588
|
+
const names = getAnimationFrameNames(def);
|
|
589
|
+
return names.map((n) => Texture.from(n));
|
|
590
|
+
}
|
|
591
|
+
function getAnimationFrameNames(def) {
|
|
592
|
+
var _a, _b, _c;
|
|
593
|
+
if (!def) return [];
|
|
594
|
+
if (typeof def === "string") return [def];
|
|
595
|
+
if (Array.isArray(def)) return def;
|
|
596
|
+
const sheetRes = Assets.get(def.sheet);
|
|
597
|
+
if (!sheetRes) return [];
|
|
598
|
+
(_a = sheetRes.parse) == null ? void 0 : _a.call(sheetRes);
|
|
599
|
+
const nameList = (_c = (_b = sheetRes.data) == null ? void 0 : _b.animations) == null ? void 0 : _c[def.anim];
|
|
600
|
+
if (!nameList || !Array.isArray(nameList)) return [];
|
|
601
|
+
return nameList;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// helpers/resolvePublicPath.ts
|
|
605
|
+
function resolvePublicPath(path) {
|
|
606
|
+
var _a;
|
|
607
|
+
if (path.startsWith("http://") || path.startsWith("https://")) {
|
|
608
|
+
return path;
|
|
609
|
+
}
|
|
610
|
+
const base = typeof import.meta !== "undefined" && ((_a = import.meta.env) == null ? void 0 : _a.BASE_URL) ? import.meta.env.BASE_URL : "/";
|
|
611
|
+
const normalizedBase = base.endsWith("/") ? base : `${base}/`;
|
|
612
|
+
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
613
|
+
return `${normalizedBase}${normalizedPath}`;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// helpers/eventBridge.ts
|
|
617
|
+
function createEventBridge(source, target, config = {}) {
|
|
618
|
+
var _a;
|
|
619
|
+
const originalEmit = source.emit.bind(source);
|
|
620
|
+
const originalDestroy = (_a = source.destroy) == null ? void 0 : _a.bind(source);
|
|
621
|
+
source.emit = function(event, ...args) {
|
|
622
|
+
const result = originalEmit(event, ...args);
|
|
623
|
+
if (typeof event !== "string") {
|
|
624
|
+
return result;
|
|
625
|
+
}
|
|
626
|
+
if (config.filter && !config.filter(event)) {
|
|
627
|
+
return result;
|
|
628
|
+
}
|
|
629
|
+
if (config.intercept) {
|
|
630
|
+
config.intercept(event, ...args);
|
|
631
|
+
}
|
|
632
|
+
let forwardEvent;
|
|
633
|
+
let forwardArgs;
|
|
634
|
+
if (config.transform) {
|
|
635
|
+
[forwardEvent, ...forwardArgs] = config.transform(event, ...args);
|
|
636
|
+
} else if (config.namespace) {
|
|
637
|
+
forwardEvent = `${config.namespace}:${event}`;
|
|
638
|
+
forwardArgs = args;
|
|
639
|
+
} else {
|
|
640
|
+
forwardEvent = event;
|
|
641
|
+
forwardArgs = args;
|
|
642
|
+
}
|
|
643
|
+
target.emit(forwardEvent, ...forwardArgs);
|
|
644
|
+
return result;
|
|
645
|
+
};
|
|
646
|
+
if (typeof source.destroy === "function") {
|
|
647
|
+
source.destroy = function(options) {
|
|
648
|
+
source.emit = originalEmit;
|
|
649
|
+
if (originalDestroy) {
|
|
650
|
+
source.destroy = originalDestroy;
|
|
651
|
+
}
|
|
652
|
+
if (originalDestroy) {
|
|
653
|
+
originalDestroy(options);
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
return {
|
|
658
|
+
disconnect: () => {
|
|
659
|
+
source.emit = originalEmit;
|
|
660
|
+
if (originalDestroy) {
|
|
661
|
+
source.destroy = originalDestroy;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
function createTypedEventBridge(source, target, config) {
|
|
667
|
+
const bridgeConfig = {
|
|
668
|
+
namespace: config.namespace,
|
|
669
|
+
filter: config.filter,
|
|
670
|
+
intercept: config.intercept,
|
|
671
|
+
transform: config.transform
|
|
672
|
+
};
|
|
673
|
+
return createEventBridge(source, target, bridgeConfig);
|
|
674
|
+
}
|
|
675
|
+
var REMOVE = Symbol("REMOVE");
|
|
676
|
+
var mergeWithRemove = (base, ...overrides) => {
|
|
677
|
+
const result = mergeWith({}, base, ...overrides, (_objValue, srcValue) => {
|
|
678
|
+
if (srcValue === REMOVE) {
|
|
679
|
+
return REMOVE;
|
|
680
|
+
}
|
|
681
|
+
if (Array.isArray(srcValue)) {
|
|
682
|
+
return srcValue;
|
|
683
|
+
}
|
|
684
|
+
return void 0;
|
|
685
|
+
});
|
|
686
|
+
const cleanRemoved = (obj) => {
|
|
687
|
+
if (!isPlainObject(obj)) return obj;
|
|
688
|
+
for (const key of Object.keys(obj)) {
|
|
689
|
+
if (obj[key] === REMOVE) {
|
|
690
|
+
delete obj[key];
|
|
691
|
+
} else if (isPlainObject(obj[key])) {
|
|
692
|
+
cleanRemoved(obj[key]);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return obj;
|
|
696
|
+
};
|
|
697
|
+
return cleanRemoved(result);
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
export { REMOVE, SVGAssetHelper, SVGLoader, SVGParser, configureSVGParser, createEventBridge, createTypedEventBridge, generateButtonSkinFromAsset, getAnimationFrameNames, getAnimationFrames, mergeWithRemove, resolvePublicPath };
|
|
701
|
+
//# sourceMappingURL=index.js.map
|
|
702
|
+
//# sourceMappingURL=index.js.map
|