@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,673 @@
|
|
|
1
|
+
import { Point, Container, Rectangle } from 'pixi.js';
|
|
2
|
+
|
|
3
|
+
// layout/Bounds.ts
|
|
4
|
+
function rectToBoundsLike(r) {
|
|
5
|
+
const left = r.x;
|
|
6
|
+
const top = r.y;
|
|
7
|
+
const width = r.width;
|
|
8
|
+
const height = r.height;
|
|
9
|
+
const right = left + width;
|
|
10
|
+
const bottom = top + height;
|
|
11
|
+
return {
|
|
12
|
+
left,
|
|
13
|
+
right,
|
|
14
|
+
top,
|
|
15
|
+
bottom,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
centerX: left + width / 2,
|
|
19
|
+
centerY: top + height / 2
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function getCommonParent(items) {
|
|
23
|
+
var _a;
|
|
24
|
+
const parent = (_a = items[0]) == null ? void 0 : _a.parent;
|
|
25
|
+
if (!parent) throw new Error("Items must have a parent");
|
|
26
|
+
for (const it of items) {
|
|
27
|
+
if (it.parent !== parent) throw new Error("All items must share the same parent");
|
|
28
|
+
}
|
|
29
|
+
return parent;
|
|
30
|
+
}
|
|
31
|
+
function getLocalBoundsInParent(child, parent) {
|
|
32
|
+
const world = child.getBounds();
|
|
33
|
+
const topLeft = parent.toLocal(new Point(world.x, world.y));
|
|
34
|
+
const bottomRight = parent.toLocal(new Point(world.x + world.width, world.y + world.height));
|
|
35
|
+
const left = Math.min(topLeft.x, bottomRight.x);
|
|
36
|
+
const right = Math.max(topLeft.x, bottomRight.x);
|
|
37
|
+
const top = Math.min(topLeft.y, bottomRight.y);
|
|
38
|
+
const bottom = Math.max(topLeft.y, bottomRight.y);
|
|
39
|
+
const width = right - left;
|
|
40
|
+
const height = bottom - top;
|
|
41
|
+
return {
|
|
42
|
+
left,
|
|
43
|
+
right,
|
|
44
|
+
top,
|
|
45
|
+
bottom,
|
|
46
|
+
width,
|
|
47
|
+
height,
|
|
48
|
+
centerX: left + width / 2,
|
|
49
|
+
centerY: top + height / 2
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function getSelectionBounds(items, parent) {
|
|
53
|
+
const p = parent ?? getCommonParent(items);
|
|
54
|
+
let left = Infinity, right = -Infinity, top = Infinity, bottom = -Infinity;
|
|
55
|
+
for (const it of items) {
|
|
56
|
+
const b = getLocalBoundsInParent(it, p);
|
|
57
|
+
left = Math.min(left, b.left);
|
|
58
|
+
right = Math.max(right, b.right);
|
|
59
|
+
top = Math.min(top, b.top);
|
|
60
|
+
bottom = Math.max(bottom, b.bottom);
|
|
61
|
+
}
|
|
62
|
+
const width = right - left;
|
|
63
|
+
const height = bottom - top;
|
|
64
|
+
return {
|
|
65
|
+
left,
|
|
66
|
+
right,
|
|
67
|
+
top,
|
|
68
|
+
bottom,
|
|
69
|
+
width,
|
|
70
|
+
height,
|
|
71
|
+
centerX: left + width / 2,
|
|
72
|
+
centerY: top + height / 2
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function getReferenceBounds(items, options) {
|
|
76
|
+
if (options == null ? void 0 : options.container) {
|
|
77
|
+
const box = options.container;
|
|
78
|
+
if (box instanceof Container) {
|
|
79
|
+
const parent2 = box;
|
|
80
|
+
const world = parent2.getBounds();
|
|
81
|
+
const topLeft = parent2.toLocal(new Point(world.x, world.y));
|
|
82
|
+
const bottomRight = parent2.toLocal(new Point(world.x + world.width, world.y + world.height));
|
|
83
|
+
const left = Math.min(topLeft.x, bottomRight.x);
|
|
84
|
+
const right = Math.max(topLeft.x, bottomRight.x);
|
|
85
|
+
const top = Math.min(topLeft.y, bottomRight.y);
|
|
86
|
+
const bottom = Math.max(topLeft.y, bottomRight.y);
|
|
87
|
+
const width = right - left;
|
|
88
|
+
const height = bottom - top;
|
|
89
|
+
return {
|
|
90
|
+
ref: {
|
|
91
|
+
left,
|
|
92
|
+
right,
|
|
93
|
+
top,
|
|
94
|
+
bottom,
|
|
95
|
+
width,
|
|
96
|
+
height,
|
|
97
|
+
centerX: left + width / 2,
|
|
98
|
+
centerY: top + height / 2
|
|
99
|
+
},
|
|
100
|
+
parent: parent2
|
|
101
|
+
};
|
|
102
|
+
} else {
|
|
103
|
+
const parent2 = getCommonParent(items);
|
|
104
|
+
return { ref: rectToBoundsLike(box), parent: parent2 };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const parent = getCommonParent(items);
|
|
108
|
+
if (options == null ? void 0 : options.key) {
|
|
109
|
+
if (options.key.parent !== parent) throw new Error("key and items must share the same parent");
|
|
110
|
+
return { ref: getLocalBoundsInParent(options.key, parent), parent };
|
|
111
|
+
}
|
|
112
|
+
return { ref: getSelectionBounds(items, parent), parent };
|
|
113
|
+
}
|
|
114
|
+
function nudgeX(child, dx) {
|
|
115
|
+
child.x += dx;
|
|
116
|
+
}
|
|
117
|
+
function nudgeY(child, dy) {
|
|
118
|
+
child.y += dy;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// layout/Align.ts
|
|
122
|
+
var Align = class {
|
|
123
|
+
/**
|
|
124
|
+
* Aligns containers to the left edge of the reference bounds.
|
|
125
|
+
*
|
|
126
|
+
* @param items - Array of containers to align
|
|
127
|
+
* @param options - Alignment options to control the reference point
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* // Align to selection bounds (default)
|
|
132
|
+
* Align.left([sprite1, sprite2, sprite3]);
|
|
133
|
+
*
|
|
134
|
+
* // Align to container
|
|
135
|
+
* Align.left([sprite1, sprite2], { container: bounds });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
static left(items, options) {
|
|
139
|
+
const { ref, parent } = getReferenceBounds(items, options);
|
|
140
|
+
for (const it of items) {
|
|
141
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
142
|
+
nudgeX(it, ref.left - b.left);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Aligns containers to the horizontal center of the reference bounds.
|
|
147
|
+
*
|
|
148
|
+
* @param items - Array of containers to align
|
|
149
|
+
* @param options - Alignment options to control the reference point
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* // Center horizontally within selection
|
|
154
|
+
* Align.hCenter([sprite1, sprite2, sprite3]);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
static hCenter(items, options) {
|
|
158
|
+
const { ref, parent } = getReferenceBounds(items, options);
|
|
159
|
+
for (const it of items) {
|
|
160
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
161
|
+
nudgeX(it, ref.centerX - b.centerX);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Aligns containers to the right edge of the reference bounds.
|
|
166
|
+
*
|
|
167
|
+
* @param items - Array of containers to align
|
|
168
|
+
* @param options - Alignment options to control the reference point
|
|
169
|
+
*/
|
|
170
|
+
static right(items, options) {
|
|
171
|
+
const { ref, parent } = getReferenceBounds(items, options);
|
|
172
|
+
for (const it of items) {
|
|
173
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
174
|
+
nudgeX(it, ref.right - b.right);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Aligns containers to the top edge of the reference bounds.
|
|
179
|
+
*
|
|
180
|
+
* @param items - Array of containers to align
|
|
181
|
+
* @param options - Alignment options to control the reference point
|
|
182
|
+
*/
|
|
183
|
+
static top(items, options) {
|
|
184
|
+
const { ref, parent } = getReferenceBounds(items, options);
|
|
185
|
+
for (const it of items) {
|
|
186
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
187
|
+
nudgeY(it, ref.top - b.top);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Aligns containers to the vertical center of the reference bounds.
|
|
192
|
+
*
|
|
193
|
+
* @param items - Array of containers to align
|
|
194
|
+
* @param options - Alignment options to control the reference point
|
|
195
|
+
*/
|
|
196
|
+
static vCenter(items, options) {
|
|
197
|
+
const { ref, parent } = getReferenceBounds(items, options);
|
|
198
|
+
for (const it of items) {
|
|
199
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
200
|
+
nudgeY(it, ref.centerY - b.centerY);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Aligns containers to the bottom edge of the reference bounds.
|
|
205
|
+
*
|
|
206
|
+
* @param items - Array of containers to align
|
|
207
|
+
* @param options - Alignment options to control the reference point
|
|
208
|
+
*/
|
|
209
|
+
static bottom(items, options) {
|
|
210
|
+
const { ref, parent } = getReferenceBounds(items, options);
|
|
211
|
+
for (const it of items) {
|
|
212
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
213
|
+
nudgeY(it, ref.bottom - b.bottom);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var Distribute = class {
|
|
218
|
+
static hLeft(items, options) {
|
|
219
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
220
|
+
const sorted = [...items].sort(
|
|
221
|
+
(a, b) => getLocalBoundsInParent(a, parent).left - getLocalBoundsInParent(b, parent).left
|
|
222
|
+
);
|
|
223
|
+
if (sorted.length <= 2) return;
|
|
224
|
+
const first = getLocalBoundsInParent(sorted[0], parent).left;
|
|
225
|
+
const last = getLocalBoundsInParent(sorted[sorted.length - 1], parent).left;
|
|
226
|
+
const step = (last - first) / (sorted.length - 1);
|
|
227
|
+
sorted.forEach((it, i) => {
|
|
228
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
229
|
+
nudgeX(it, first + step * i - b.left);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
static hCenters(items, options) {
|
|
233
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
234
|
+
const sorted = [...items].sort(
|
|
235
|
+
(a, b) => getLocalBoundsInParent(a, parent).centerX - getLocalBoundsInParent(b, parent).centerX
|
|
236
|
+
);
|
|
237
|
+
if (sorted.length <= 2) return;
|
|
238
|
+
const first = getLocalBoundsInParent(sorted[0], parent).centerX;
|
|
239
|
+
const last = getLocalBoundsInParent(sorted[sorted.length - 1], parent).centerX;
|
|
240
|
+
const step = (last - first) / (sorted.length - 1);
|
|
241
|
+
sorted.forEach((it, i) => {
|
|
242
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
243
|
+
nudgeX(it, first + step * i - b.centerX);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
static hRight(items, options) {
|
|
247
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
248
|
+
const sorted = [...items].sort(
|
|
249
|
+
(a, b) => getLocalBoundsInParent(a, parent).right - getLocalBoundsInParent(b, parent).right
|
|
250
|
+
);
|
|
251
|
+
if (sorted.length <= 2) return;
|
|
252
|
+
const first = getLocalBoundsInParent(sorted[0], parent).right;
|
|
253
|
+
const last = getLocalBoundsInParent(sorted[sorted.length - 1], parent).right;
|
|
254
|
+
const step = (last - first) / (sorted.length - 1);
|
|
255
|
+
sorted.forEach((it, i) => {
|
|
256
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
257
|
+
nudgeX(it, first + step * i - b.right);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
static vTop(items, options) {
|
|
261
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
262
|
+
const sorted = [...items].sort(
|
|
263
|
+
(a, b) => getLocalBoundsInParent(a, parent).top - getLocalBoundsInParent(b, parent).top
|
|
264
|
+
);
|
|
265
|
+
if (sorted.length <= 2) return;
|
|
266
|
+
const first = getLocalBoundsInParent(sorted[0], parent).top;
|
|
267
|
+
const last = getLocalBoundsInParent(sorted[sorted.length - 1], parent).top;
|
|
268
|
+
const step = (last - first) / (sorted.length - 1);
|
|
269
|
+
sorted.forEach((it, i) => {
|
|
270
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
271
|
+
nudgeY(it, first + step * i - b.top);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
static vCenters(items, options) {
|
|
275
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
276
|
+
const sorted = [...items].sort(
|
|
277
|
+
(a, b) => getLocalBoundsInParent(a, parent).centerY - getLocalBoundsInParent(b, parent).centerY
|
|
278
|
+
);
|
|
279
|
+
if (sorted.length <= 2) return;
|
|
280
|
+
const first = getLocalBoundsInParent(sorted[0], parent).centerY;
|
|
281
|
+
const last = getLocalBoundsInParent(sorted[sorted.length - 1], parent).centerY;
|
|
282
|
+
const step = (last - first) / (sorted.length - 1);
|
|
283
|
+
sorted.forEach((it, i) => {
|
|
284
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
285
|
+
nudgeY(it, first + step * i - b.centerY);
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
static vBottom(items, options) {
|
|
289
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
290
|
+
const sorted = [...items].sort(
|
|
291
|
+
(a, b) => getLocalBoundsInParent(a, parent).bottom - getLocalBoundsInParent(b, parent).bottom
|
|
292
|
+
);
|
|
293
|
+
if (sorted.length <= 2) return;
|
|
294
|
+
const first = getLocalBoundsInParent(sorted[0], parent).bottom;
|
|
295
|
+
const last = getLocalBoundsInParent(sorted[sorted.length - 1], parent).bottom;
|
|
296
|
+
const step = (last - first) / (sorted.length - 1);
|
|
297
|
+
sorted.forEach((it, i) => {
|
|
298
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
299
|
+
nudgeY(it, first + step * i - b.bottom);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
static hSpacing(items, options) {
|
|
303
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
304
|
+
if (items.length <= 2) return;
|
|
305
|
+
const sorted = [...items].sort(
|
|
306
|
+
(a, b) => getLocalBoundsInParent(a, parent).left - getLocalBoundsInParent(b, parent).left
|
|
307
|
+
);
|
|
308
|
+
const ref = (options == null ? void 0 : options.container) ?? getSelectionBounds(sorted, parent);
|
|
309
|
+
const totalWidth = sorted.reduce(
|
|
310
|
+
(sum, it) => sum + getLocalBoundsInParent(it, parent).width,
|
|
311
|
+
0
|
|
312
|
+
);
|
|
313
|
+
const width = ref instanceof Rectangle ? ref.width : ref.width;
|
|
314
|
+
const left = ref instanceof Rectangle ? ref.x : ref.left;
|
|
315
|
+
const gap = (width - totalWidth) / (sorted.length - 1);
|
|
316
|
+
let cursor = left;
|
|
317
|
+
sorted.forEach((it) => {
|
|
318
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
319
|
+
nudgeX(it, cursor - b.left);
|
|
320
|
+
const newB = getLocalBoundsInParent(it, parent);
|
|
321
|
+
cursor = newB.right + gap;
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
static vSpacing(items, options) {
|
|
325
|
+
const parent = (options == null ? void 0 : options.parent) ?? getCommonParent(items);
|
|
326
|
+
if (items.length <= 2) return;
|
|
327
|
+
const sorted = [...items].sort(
|
|
328
|
+
(a, b) => getLocalBoundsInParent(a, parent).top - getLocalBoundsInParent(b, parent).top
|
|
329
|
+
);
|
|
330
|
+
const ref = (options == null ? void 0 : options.container) ?? getSelectionBounds(sorted, parent);
|
|
331
|
+
const totalHeight = sorted.reduce(
|
|
332
|
+
(sum, it) => sum + getLocalBoundsInParent(it, parent).height,
|
|
333
|
+
0
|
|
334
|
+
);
|
|
335
|
+
const height = ref instanceof Rectangle ? ref.height : ref.height;
|
|
336
|
+
const top = ref instanceof Rectangle ? ref.y : ref.top;
|
|
337
|
+
const gap = (height - totalHeight) / (sorted.length - 1);
|
|
338
|
+
let cursor = top;
|
|
339
|
+
sorted.forEach((it) => {
|
|
340
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
341
|
+
nudgeY(it, cursor - b.top);
|
|
342
|
+
const newB = getLocalBoundsInParent(it, parent);
|
|
343
|
+
cursor = newB.bottom + gap;
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
function normalizeGap(opts) {
|
|
348
|
+
if (typeof opts.gap === "number") return { h: opts.gap, v: opts.gap };
|
|
349
|
+
if (typeof opts.gap === "object" && opts.gap) return { h: opts.gap.h ?? 0, v: opts.gap.v ?? 0 };
|
|
350
|
+
const h = opts.columnGap ?? 0;
|
|
351
|
+
const v = opts.rowGap ?? 0;
|
|
352
|
+
return { h, v };
|
|
353
|
+
}
|
|
354
|
+
function normalizePadding(p) {
|
|
355
|
+
if (typeof p === "number") return { top: p, right: p, bottom: p, left: p };
|
|
356
|
+
return { top: (p == null ? void 0 : p.top) ?? 0, right: (p == null ? void 0 : p.right) ?? 0, bottom: (p == null ? void 0 : p.bottom) ?? 0, left: (p == null ? void 0 : p.left) ?? 0 };
|
|
357
|
+
}
|
|
358
|
+
function normalizeMargin(value) {
|
|
359
|
+
if (value === void 0) {
|
|
360
|
+
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
361
|
+
}
|
|
362
|
+
if (typeof value === "number") {
|
|
363
|
+
return { top: value, right: value, bottom: value, left: value };
|
|
364
|
+
}
|
|
365
|
+
const top = value.top ?? value.y ?? 0;
|
|
366
|
+
const bottom = value.bottom ?? value.y ?? 0;
|
|
367
|
+
const left = value.left ?? value.x ?? 0;
|
|
368
|
+
const right = value.right ?? value.x ?? 0;
|
|
369
|
+
return { top, right, bottom, left };
|
|
370
|
+
}
|
|
371
|
+
function getFlowBounds(items, opts, parent) {
|
|
372
|
+
const pad = normalizePadding(opts.padding);
|
|
373
|
+
if (opts.wrap === "bounds" && opts.bounds) {
|
|
374
|
+
let r;
|
|
375
|
+
if (opts.bounds instanceof Rectangle) {
|
|
376
|
+
r = opts.bounds;
|
|
377
|
+
} else {
|
|
378
|
+
const b = getLocalBoundsInParent(opts.bounds, parent);
|
|
379
|
+
r = new Rectangle(b.left, b.top, b.width, b.height);
|
|
380
|
+
}
|
|
381
|
+
return new Rectangle(
|
|
382
|
+
r.x + pad.left,
|
|
383
|
+
r.y + pad.top,
|
|
384
|
+
Math.max(0, r.width - pad.left - pad.right),
|
|
385
|
+
Math.max(0, r.height - pad.top - pad.bottom)
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
const sel = getSelectionBounds(items, parent);
|
|
389
|
+
return new Rectangle(
|
|
390
|
+
// TODO Not sure side effects check this out latter
|
|
391
|
+
/*sel.left +*/
|
|
392
|
+
pad.left,
|
|
393
|
+
/*sel.top + */
|
|
394
|
+
pad.top,
|
|
395
|
+
Math.max(0, sel.width - pad.left - pad.right),
|
|
396
|
+
Math.max(0, sel.height - pad.top - pad.bottom)
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
var Flow = class {
|
|
400
|
+
/**
|
|
401
|
+
* Arranges containers in a flexbox-like layout.
|
|
402
|
+
*
|
|
403
|
+
* This method modifies container positions in-place to create the desired layout.
|
|
404
|
+
* Items are sorted (if order function provided) and then arranged according to
|
|
405
|
+
* direction, wrapping, alignment, and justification settings.
|
|
406
|
+
*
|
|
407
|
+
* @param items - Array of containers to layout
|
|
408
|
+
* @param options - Layout configuration options
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```typescript
|
|
412
|
+
* // Simple horizontal row
|
|
413
|
+
* Flow.layout(items, { direction: 'row', gap: 10 });
|
|
414
|
+
*
|
|
415
|
+
* // Grid with 4 columns
|
|
416
|
+
* Flow.layout(items, {
|
|
417
|
+
* direction: 'row',
|
|
418
|
+
* wrap: 'count',
|
|
419
|
+
* columnCount: 4,
|
|
420
|
+
* gap: { h: 10, v: 15 }
|
|
421
|
+
* });
|
|
422
|
+
*
|
|
423
|
+
* // Centered vertical list
|
|
424
|
+
* Flow.layout(items, {
|
|
425
|
+
* direction: 'column',
|
|
426
|
+
* align: 'center',
|
|
427
|
+
* gap: 20
|
|
428
|
+
* });
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
static layout(items, options) {
|
|
432
|
+
if (!items || items.length === 0) return;
|
|
433
|
+
const opts = {
|
|
434
|
+
direction: "row",
|
|
435
|
+
wrap: "none",
|
|
436
|
+
gap: 0,
|
|
437
|
+
justify: "start",
|
|
438
|
+
align: "start",
|
|
439
|
+
...options
|
|
440
|
+
};
|
|
441
|
+
const parent = getCommonParent(items);
|
|
442
|
+
const gap = normalizeGap(opts);
|
|
443
|
+
const dir = opts.direction ?? "row";
|
|
444
|
+
const wrap = opts.wrap ?? "none";
|
|
445
|
+
const ordered = opts.order ? [...items].sort(opts.order) : [...items];
|
|
446
|
+
const area = getFlowBounds(ordered, opts, parent);
|
|
447
|
+
if (wrap === "count") {
|
|
448
|
+
if (dir === "row") {
|
|
449
|
+
const cols = opts.columnCount ?? (opts.rowCount ? Math.ceil(ordered.length / opts.rowCount) : ordered.length);
|
|
450
|
+
const lines = [];
|
|
451
|
+
for (let i = 0; i < ordered.length; i += cols) lines.push(ordered.slice(i, i + cols));
|
|
452
|
+
layoutLinesRow(lines, parent, area, gap, opts.justify, opts.align, opts.margins);
|
|
453
|
+
} else {
|
|
454
|
+
const rows = opts.rowCount ?? (opts.columnCount ? Math.ceil(ordered.length / opts.columnCount) : ordered.length);
|
|
455
|
+
const columns = [];
|
|
456
|
+
for (let i = 0; i < ordered.length; i += rows) columns.push(ordered.slice(i, i + rows));
|
|
457
|
+
layoutLinesColumn(columns, parent, area, gap, opts.justify, opts.align, opts.margins);
|
|
458
|
+
}
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (wrap === "bounds") {
|
|
462
|
+
if (dir === "row") {
|
|
463
|
+
const lines = [];
|
|
464
|
+
let line = [];
|
|
465
|
+
let lineW = 0;
|
|
466
|
+
for (const it of ordered) {
|
|
467
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
468
|
+
const needed = line.length === 0 ? b.width : gap.h + b.width;
|
|
469
|
+
if (line.length > 0 && lineW + needed > area.width) {
|
|
470
|
+
lines.push(line);
|
|
471
|
+
line = [it];
|
|
472
|
+
lineW = b.width;
|
|
473
|
+
} else {
|
|
474
|
+
line.push(it);
|
|
475
|
+
lineW += needed;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (line.length) lines.push(line);
|
|
479
|
+
layoutLinesRow(lines, parent, area, gap, opts.justify, opts.align, opts.margins);
|
|
480
|
+
} else {
|
|
481
|
+
const columns = [];
|
|
482
|
+
let col = [];
|
|
483
|
+
let colH = 0;
|
|
484
|
+
for (const it of ordered) {
|
|
485
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
486
|
+
const needed = col.length === 0 ? b.height : gap.v + b.height;
|
|
487
|
+
if (col.length > 0 && colH + needed > area.height) {
|
|
488
|
+
columns.push(col);
|
|
489
|
+
col = [it];
|
|
490
|
+
colH = b.height;
|
|
491
|
+
} else {
|
|
492
|
+
col.push(it);
|
|
493
|
+
colH += needed;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (col.length) columns.push(col);
|
|
497
|
+
layoutLinesColumn(columns, parent, area, gap, opts.justify, opts.align, opts.margins);
|
|
498
|
+
}
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (wrap === "none") {
|
|
502
|
+
if (dir === "row") {
|
|
503
|
+
const lines = [ordered];
|
|
504
|
+
layoutLinesRow(lines, parent, area, gap, opts.justify, opts.align, opts.margins);
|
|
505
|
+
} else {
|
|
506
|
+
const columns = [ordered];
|
|
507
|
+
layoutLinesColumn(columns, parent, area, gap, opts.justify, opts.align, opts.margins);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
function layoutLinesRow(lines, parent, area, gap, justify, align, margins) {
|
|
513
|
+
let y = area.y;
|
|
514
|
+
for (const line of lines) {
|
|
515
|
+
let contentW = 0;
|
|
516
|
+
let lineH = 0;
|
|
517
|
+
const sizes = line.map((it) => {
|
|
518
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
519
|
+
lineH = Math.max(lineH, b.height);
|
|
520
|
+
return b;
|
|
521
|
+
});
|
|
522
|
+
if (line.length > 0) contentW = sizes.reduce((s, b, i) => s + b.width + (i > 0 ? gap.h : 0), 0);
|
|
523
|
+
let x = area.x;
|
|
524
|
+
if (justify === "center") {
|
|
525
|
+
x += Math.max(0, (area.width - contentW) / 2);
|
|
526
|
+
} else if (justify === "end") {
|
|
527
|
+
x += Math.max(0, area.width - contentW);
|
|
528
|
+
} else if (justify === "space-between" && line.length > 1) {
|
|
529
|
+
const free = Math.max(0, area.width - sizes.reduce((s, b) => s + b.width, 0));
|
|
530
|
+
const g = free / (line.length - 1);
|
|
531
|
+
positionRow(line, sizes, parent, x, y, lineH, { h: g, v: gap.v }, align, margins);
|
|
532
|
+
y += lineH + gap.v;
|
|
533
|
+
continue;
|
|
534
|
+
} else if (justify === "space-around" && line.length > 0) {
|
|
535
|
+
const free = Math.max(0, area.width - sizes.reduce((s, b) => s + b.width, 0));
|
|
536
|
+
const g = free / line.length;
|
|
537
|
+
x += g / 2;
|
|
538
|
+
positionRow(line, sizes, parent, x, y, lineH, { h: g, v: gap.v }, align, margins);
|
|
539
|
+
y += lineH + gap.v;
|
|
540
|
+
continue;
|
|
541
|
+
} else if (justify === "space-evenly" && line.length > 0) {
|
|
542
|
+
const free = Math.max(0, area.width - sizes.reduce((s, b) => s + b.width, 0));
|
|
543
|
+
const g = free / (line.length + 1);
|
|
544
|
+
x += g;
|
|
545
|
+
positionRow(line, sizes, parent, x, y, lineH, { h: g, v: gap.v }, align, margins);
|
|
546
|
+
y += lineH + gap.v;
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
positionRow(line, sizes, parent, x, y, lineH, gap, align, margins);
|
|
550
|
+
y += lineH + gap.v;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function positionRow(line, sizes, parent, x, y, lineH, gap, align, margins) {
|
|
554
|
+
let cursor = x;
|
|
555
|
+
for (let i = 0; i < line.length; i++) {
|
|
556
|
+
const it = line[i];
|
|
557
|
+
const b = sizes[i];
|
|
558
|
+
const margin = normalizeMargin(margins == null ? void 0 : margins[i]);
|
|
559
|
+
const dx = cursor + margin.left - b.left;
|
|
560
|
+
let dy = 0;
|
|
561
|
+
if (align === "start") dy = y + margin.top - b.top;
|
|
562
|
+
else if (align === "center") dy = y + margin.top + (lineH - b.height) / 2 - b.top;
|
|
563
|
+
else dy = y + margin.top + (lineH - b.height) - b.top;
|
|
564
|
+
nudgeX(it, dx);
|
|
565
|
+
nudgeY(it, dy);
|
|
566
|
+
cursor += margin.left + b.width + margin.right + gap.h;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
function layoutLinesColumn(columns, parent, area, gap, justify, align, margins) {
|
|
570
|
+
let x = area.x;
|
|
571
|
+
for (const col of columns) {
|
|
572
|
+
let contentH = 0;
|
|
573
|
+
let colW = 0;
|
|
574
|
+
const sizes = col.map((it) => {
|
|
575
|
+
const b = getLocalBoundsInParent(it, parent);
|
|
576
|
+
colW = Math.max(colW, b.width);
|
|
577
|
+
return b;
|
|
578
|
+
});
|
|
579
|
+
if (col.length > 0) contentH = sizes.reduce((s, b, i) => s + b.height + (i > 0 ? gap.v : 0), 0);
|
|
580
|
+
let y = area.y;
|
|
581
|
+
if (justify === "center") {
|
|
582
|
+
y += Math.max(0, (area.height - contentH) / 2);
|
|
583
|
+
} else if (justify === "end") {
|
|
584
|
+
y += Math.max(0, area.height - contentH);
|
|
585
|
+
} else if (justify === "space-between" && col.length > 1) {
|
|
586
|
+
const free = Math.max(0, area.height - sizes.reduce((s, b) => s + b.height, 0));
|
|
587
|
+
const g = free / (col.length - 1);
|
|
588
|
+
positionColumn(col, sizes, parent, x, y, colW, { h: gap.h, v: g }, align, margins);
|
|
589
|
+
x += colW + gap.h;
|
|
590
|
+
continue;
|
|
591
|
+
} else if (justify === "space-around" && col.length > 0) {
|
|
592
|
+
const free = Math.max(0, area.height - sizes.reduce((s, b) => s + b.height, 0));
|
|
593
|
+
const g = free / col.length;
|
|
594
|
+
y += g / 2;
|
|
595
|
+
positionColumn(col, sizes, parent, x, y, colW, { h: gap.h, v: g }, align, margins);
|
|
596
|
+
x += colW + gap.h;
|
|
597
|
+
continue;
|
|
598
|
+
} else if (justify === "space-evenly" && col.length > 0) {
|
|
599
|
+
const free = Math.max(0, area.height - sizes.reduce((s, b) => s + b.height, 0));
|
|
600
|
+
const g = free / (col.length + 1);
|
|
601
|
+
y += g;
|
|
602
|
+
positionColumn(col, sizes, parent, x, y, colW, { h: gap.h, v: g }, align, margins);
|
|
603
|
+
x += colW + gap.h;
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
positionColumn(col, sizes, parent, x, y, colW, gap, align, margins);
|
|
607
|
+
x += colW + gap.h;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function positionColumn(col, sizes, parent, x, y, colW, gap, align, margins) {
|
|
611
|
+
let cursor = y;
|
|
612
|
+
for (let i = 0; i < col.length; i++) {
|
|
613
|
+
const it = col[i];
|
|
614
|
+
const b = sizes[i];
|
|
615
|
+
const margin = normalizeMargin(margins == null ? void 0 : margins[i]);
|
|
616
|
+
let dx = 0;
|
|
617
|
+
if (align === "start") dx = x + margin.left - b.left;
|
|
618
|
+
else if (align === "center") dx = x + margin.left + (colW - b.width) / 2 - b.left;
|
|
619
|
+
else dx = x + margin.left + (colW - b.width) - b.left;
|
|
620
|
+
const dy = cursor + margin.top - b.top;
|
|
621
|
+
nudgeX(it, dx);
|
|
622
|
+
nudgeY(it, dy);
|
|
623
|
+
cursor += margin.top + b.height + margin.bottom + gap.v;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// layout/PositionUtils.ts
|
|
628
|
+
function resolvePositionValue(value, axis, viewportSize, sourceScaledSize) {
|
|
629
|
+
if (typeof value === "number") {
|
|
630
|
+
return value;
|
|
631
|
+
}
|
|
632
|
+
const trimmed = value.trim();
|
|
633
|
+
if (trimmed.endsWith("%")) {
|
|
634
|
+
const percent = parseFloat(trimmed) / 100;
|
|
635
|
+
return viewportSize * percent - sourceScaledSize * percent;
|
|
636
|
+
}
|
|
637
|
+
switch (trimmed) {
|
|
638
|
+
case "center":
|
|
639
|
+
return (viewportSize - sourceScaledSize) / 2;
|
|
640
|
+
case "top":
|
|
641
|
+
return axis === "y" ? 0 : (viewportSize - sourceScaledSize) / 2;
|
|
642
|
+
case "bottom":
|
|
643
|
+
return axis === "y" ? viewportSize - sourceScaledSize : (viewportSize - sourceScaledSize) / 2;
|
|
644
|
+
case "left":
|
|
645
|
+
return axis === "x" ? 0 : (viewportSize - sourceScaledSize) / 2;
|
|
646
|
+
case "right":
|
|
647
|
+
return axis === "x" ? viewportSize - sourceScaledSize : (viewportSize - sourceScaledSize) / 2;
|
|
648
|
+
default:
|
|
649
|
+
const num = parseFloat(trimmed);
|
|
650
|
+
return isNaN(num) ? 0 : num;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
function resolvePosition(position, viewportWidth, viewportHeight, sourceScaledWidth, sourceScaledHeight) {
|
|
654
|
+
if (typeof position === "number") {
|
|
655
|
+
return { x: position, y: position };
|
|
656
|
+
}
|
|
657
|
+
const parts = position.trim().split(/\s+/);
|
|
658
|
+
if (parts.length === 1) {
|
|
659
|
+
const val = parts[0];
|
|
660
|
+
return {
|
|
661
|
+
x: resolvePositionValue(val, "x", viewportWidth, sourceScaledWidth),
|
|
662
|
+
y: resolvePositionValue(val, "y", viewportHeight, sourceScaledHeight)
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
return {
|
|
666
|
+
x: resolvePositionValue(parts[0], "x", viewportWidth, sourceScaledWidth),
|
|
667
|
+
y: resolvePositionValue(parts[1], "y", viewportHeight, sourceScaledHeight)
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export { Align, Distribute, Flow, getCommonParent, getLocalBoundsInParent, getReferenceBounds, getSelectionBounds, nudgeX, nudgeY, resolvePosition, resolvePositionValue };
|
|
672
|
+
//# sourceMappingURL=index.js.map
|
|
673
|
+
//# sourceMappingURL=index.js.map
|