laymur 0.17.0 → 0.17.1

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.
Files changed (395) hide show
  1. package/{src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts → dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts} +2 -3
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +22 -0
  3. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
  4. package/dist/core/constraints/UIConstraint.d.ts +12 -0
  5. package/dist/core/constraints/UIConstraint.js +11 -0
  6. package/dist/core/constraints/UICustomConstraint.d.ts +28 -0
  7. package/dist/core/constraints/UICustomConstraint.js +37 -0
  8. package/{src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts → dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts} +2 -3
  9. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +20 -0
  10. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
  11. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +11 -0
  12. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
  13. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +36 -0
  14. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
  15. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +14 -0
  16. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
  17. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +44 -0
  18. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
  19. package/{src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts → dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts} +2 -3
  20. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +22 -0
  21. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
  22. package/{src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts → dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts} +8 -9
  23. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +43 -0
  24. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
  25. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +11 -0
  26. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
  27. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +32 -0
  28. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
  29. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +14 -0
  30. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
  31. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +44 -0
  32. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
  33. package/{src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts → dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts} +2 -3
  34. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +22 -0
  35. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
  36. package/{src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts → dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts} +2 -3
  37. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +20 -0
  38. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
  39. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +64 -0
  40. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
  41. package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +46 -0
  42. package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
  43. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +13 -0
  44. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
  45. package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +29 -0
  46. package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
  47. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +13 -0
  48. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
  49. package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +29 -0
  50. package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
  51. package/dist/core/elements/UIAnchor/UIAnchor.Internal.d.ts +12 -0
  52. package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
  53. package/dist/core/elements/UIAnchor/UIAnchor.d.ts +32 -0
  54. package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
  55. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +27 -0
  56. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
  57. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +77 -0
  58. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
  59. package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +30 -0
  60. package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
  61. package/dist/core/elements/UIDummy/UIDummy.d.ts +82 -0
  62. package/dist/core/elements/UIDummy/UIDummy.js +173 -0
  63. package/{src/core/elements/UIElement/UIElement.Internal.ts → dist/core/elements/UIElement/UIElement.Internal.d.ts} +5 -7
  64. package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
  65. package/dist/core/elements/UIElement/UIElement.d.ts +38 -0
  66. package/dist/core/elements/UIElement/UIElement.js +74 -0
  67. package/{src/core/elements/UIGraphics/UIGraphics.Internal.ts → dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts} +5 -7
  68. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
  69. package/dist/core/elements/UIGraphics/UIGraphics.d.ts +51 -0
  70. package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
  71. package/{src/core/elements/UIImage/UIImage.Internal.ts → dist/core/elements/UIImage/UIImage.Internal.d.ts} +2 -3
  72. package/dist/core/elements/UIImage/UIImage.d.ts +32 -0
  73. package/dist/core/elements/UIImage/UIImage.js +85 -0
  74. package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +23 -0
  75. package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
  76. package/dist/core/elements/UINineSlice/UINineSlice.d.ts +60 -0
  77. package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
  78. package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +14 -0
  79. package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
  80. package/dist/core/elements/UIProgress/UIProgress.d.ts +45 -0
  81. package/dist/core/elements/UIProgress/UIProgress.js +165 -0
  82. package/dist/core/elements/UIScene/UIScene.Internal.d.ts +43 -0
  83. package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
  84. package/dist/core/elements/UIScene/UIScene.d.ts +59 -0
  85. package/dist/core/elements/UIScene/UIScene.js +157 -0
  86. package/{src/core/elements/UIText/UIText.Interfaces.ts → dist/core/elements/UIText/UIText.Interfaces.d.ts} +16 -21
  87. package/dist/core/elements/UIText/UIText.Internal.d.ts +26 -0
  88. package/dist/core/elements/UIText/UIText.Internal.js +12 -0
  89. package/dist/core/elements/UIText/UIText.Measuring.d.ts +50 -0
  90. package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
  91. package/dist/core/elements/UIText/UIText.Rendering.d.ts +20 -0
  92. package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
  93. package/dist/core/elements/UIText/UIText.d.ts +71 -0
  94. package/dist/core/elements/UIText/UIText.js +265 -0
  95. package/{src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts → dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts} +11 -14
  96. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
  97. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +63 -0
  98. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
  99. package/{src/core/layers/UILayer/UILayer.Internal.ts → dist/core/layers/UILayer/UILayer.Internal.d.ts} +11 -15
  100. package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
  101. package/dist/core/layers/UILayer/UILayer.d.ts +49 -0
  102. package/dist/core/layers/UILayer/UILayer.js +113 -0
  103. package/dist/core/miscellaneous/UIExpression.d.ts +69 -0
  104. package/dist/core/miscellaneous/UIExpression.js +128 -0
  105. package/dist/core/miscellaneous/UIMode.d.ts +23 -0
  106. package/dist/core/miscellaneous/UIMode.js +30 -0
  107. package/dist/core/miscellaneous/UIOrientation.d.ts +15 -0
  108. package/dist/core/miscellaneous/UIOrientation.js +20 -0
  109. package/dist/core/miscellaneous/UIPriority.d.ts +32 -0
  110. package/dist/core/miscellaneous/UIPriority.js +63 -0
  111. package/dist/core/miscellaneous/UIRelation.d.ts +23 -0
  112. package/dist/core/miscellaneous/UIRelation.js +40 -0
  113. package/dist/core/miscellaneous/UITransparencyMode.d.ts +9 -0
  114. package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
  115. package/dist/core/miscellaneous/area/UIArea.d.ts +3 -0
  116. package/dist/core/miscellaneous/area/UIArea.js +5 -0
  117. package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +15 -0
  118. package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
  119. package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +12 -0
  120. package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
  121. package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +17 -0
  122. package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
  123. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +21 -0
  124. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
  125. package/dist/core/miscellaneous/asserts.d.ts +43 -0
  126. package/dist/core/miscellaneous/asserts.js +163 -0
  127. package/dist/core/miscellaneous/canvas.d.ts +31 -0
  128. package/dist/core/miscellaneous/canvas.js +37 -0
  129. package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +7 -0
  130. package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
  131. package/dist/core/miscellaneous/color/UIColor.d.ts +234 -0
  132. package/dist/core/miscellaneous/color/UIColor.js +636 -0
  133. package/dist/core/miscellaneous/computeTransform.d.ts +18 -0
  134. package/dist/core/miscellaneous/computeTransform.js +82 -0
  135. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +19 -0
  136. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
  137. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +1 -0
  138. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
  139. package/{src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts → dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts} +8 -10
  140. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +1 -0
  141. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
  142. package/dist/core/miscellaneous/generic-plane/shared.d.ts +38 -0
  143. package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
  144. package/dist/core/miscellaneous/insets/UIInsets.Internal.d.ts +11 -0
  145. package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
  146. package/dist/core/miscellaneous/insets/UIInsets.d.ts +48 -0
  147. package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
  148. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +9 -0
  149. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
  150. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +21 -0
  151. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
  152. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +16 -0
  153. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
  154. package/dist/core/miscellaneous/math.d.ts +7 -0
  155. package/dist/core/miscellaneous/math.js +11 -0
  156. package/dist/core/miscellaneous/micro/UIMicro.Internal.d.ts +31 -0
  157. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
  158. package/dist/core/miscellaneous/micro/UIMicro.d.ts +59 -0
  159. package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
  160. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +3 -0
  161. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
  162. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +22 -0
  163. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
  164. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +22 -0
  165. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
  166. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +22 -0
  167. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
  168. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +22 -0
  169. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
  170. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +22 -0
  171. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
  172. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +22 -0
  173. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
  174. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +5 -0
  175. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
  176. package/dist/core/miscellaneous/shared.d.ts +46 -0
  177. package/dist/core/miscellaneous/shared.js +37 -0
  178. package/{src/core/miscellaneous/text-span/UITextSpan.Internal.ts → dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts} +4 -5
  179. package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +14 -0
  180. package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
  181. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.d.ts +48 -0
  182. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
  183. package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +85 -0
  184. package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
  185. package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +49 -0
  186. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
  187. package/dist/core/miscellaneous/texture/UITextureView.d.ts +67 -0
  188. package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
  189. package/dist/core/miscellaneous/webglCapabilities.d.ts +2 -0
  190. package/dist/core/miscellaneous/webglCapabilities.js +103 -0
  191. package/dist/core/shaders/UIImage.glsl.js +3 -0
  192. package/dist/core/shaders/UINineSlice.glsl.js +3 -0
  193. package/dist/core/shaders/UIProgress.glsl.js +3 -0
  194. package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
  195. package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
  196. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +17 -0
  197. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +13 -0
  198. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
  199. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +13 -0
  200. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +20 -0
  201. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
  202. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +49 -0
  203. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +215 -0
  204. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
  205. package/dist/index.js +51 -0
  206. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
  207. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
  208. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
  209. package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
  210. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
  211. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
  212. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
  213. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
  214. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
  215. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
  216. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
  217. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
  218. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
  219. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
  220. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
  221. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
  222. package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
  223. package/dist/particles/elements/UIEmitter.Internal.js +11 -0
  224. package/dist/particles/elements/UIEmitter.d.ts +68 -0
  225. package/dist/particles/elements/UIEmitter.js +203 -0
  226. package/dist/particles/index.js +18 -0
  227. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
  228. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
  229. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
  230. package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
  231. package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
  232. package/dist/particles/miscellaneous/miscellaneous.js +67 -0
  233. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
  234. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
  235. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
  236. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
  237. package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
  238. package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
  239. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
  240. package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
  241. package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
  242. package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
  243. package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
  244. package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
  245. package/dist/particles/spawnModules/UISpawnModule.js +9 -0
  246. package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
  247. package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
  248. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
  249. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
  250. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
  251. package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
  252. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
  253. package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
  254. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
  255. package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
  256. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
  257. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
  258. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
  259. package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
  260. package/package.json +8 -1
  261. package/.claude/settings.local.json +0 -9
  262. package/.editorconfig +0 -14
  263. package/CLAUDE.md +0 -181
  264. package/assets/logotype.png +0 -0
  265. package/eslint.config.js +0 -111
  266. package/rollup.config.js +0 -52
  267. package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +0 -60
  268. package/src/core/constraints/UIConstraint.ts +0 -20
  269. package/src/core/constraints/UICustomConstraint.ts +0 -62
  270. package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +0 -52
  271. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +0 -13
  272. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +0 -139
  273. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +0 -16
  274. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +0 -189
  275. package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +0 -68
  276. package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +0 -94
  277. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +0 -13
  278. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +0 -135
  279. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +0 -16
  280. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +0 -189
  281. package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +0 -68
  282. package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +0 -52
  283. package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +0 -84
  284. package/src/core/constraints/builders/UIConstraint2DBuilder.ts +0 -168
  285. package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +0 -15
  286. package/src/core/constraints/builders/UICoverConstraintBuilder.ts +0 -84
  287. package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +0 -15
  288. package/src/core/constraints/builders/UIFitConstraintBuilder.ts +0 -84
  289. package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +0 -13
  290. package/src/core/elements/UIAnchor/UIAnchor.ts +0 -70
  291. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +0 -30
  292. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +0 -355
  293. package/src/core/elements/UIDummy/UIDummy.Internal.ts +0 -33
  294. package/src/core/elements/UIDummy/UIDummy.ts +0 -244
  295. package/src/core/elements/UIElement/UIElement.ts +0 -127
  296. package/src/core/elements/UIGraphics/UIGraphics.ts +0 -168
  297. package/src/core/elements/UIImage/UIImage.ts +0 -138
  298. package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +0 -26
  299. package/src/core/elements/UINineSlice/UINineSlice.ts +0 -296
  300. package/src/core/elements/UIProgress/UIProgress.Internal.ts +0 -24
  301. package/src/core/elements/UIProgress/UIProgress.ts +0 -259
  302. package/src/core/elements/UIScene/UIScene.Internal.ts +0 -46
  303. package/src/core/elements/UIScene/UIScene.ts +0 -259
  304. package/src/core/elements/UIText/UIText.Internal.ts +0 -29
  305. package/src/core/elements/UIText/UIText.Measuring.ts +0 -183
  306. package/src/core/elements/UIText/UIText.Rendering.ts +0 -83
  307. package/src/core/elements/UIText/UIText.ts +0 -376
  308. package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +0 -233
  309. package/src/core/layers/UILayer/UILayer.ts +0 -156
  310. package/src/core/miscellaneous/UIExpression.ts +0 -142
  311. package/src/core/miscellaneous/UIMode.ts +0 -29
  312. package/src/core/miscellaneous/UIOrientation.ts +0 -18
  313. package/src/core/miscellaneous/UIPriority.ts +0 -63
  314. package/src/core/miscellaneous/UIRelation.ts +0 -39
  315. package/src/core/miscellaneous/UITransparencyMode.ts +0 -9
  316. package/src/core/miscellaneous/area/UIArea.ts +0 -5
  317. package/src/core/miscellaneous/area/UIAreaCircle.ts +0 -32
  318. package/src/core/miscellaneous/area/UIAreaPolygon.ts +0 -50
  319. package/src/core/miscellaneous/area/UIAreaRectangle.ts +0 -38
  320. package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +0 -78
  321. package/src/core/miscellaneous/asserts.ts +0 -187
  322. package/src/core/miscellaneous/canvas.ts +0 -73
  323. package/src/core/miscellaneous/color/UIColor.Internal.ts +0 -89
  324. package/src/core/miscellaneous/color/UIColor.ts +0 -844
  325. package/src/core/miscellaneous/computeTransform.ts +0 -127
  326. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +0 -235
  327. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +0 -524
  328. package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +0 -448
  329. package/src/core/miscellaneous/generic-plane/shared.ts +0 -323
  330. package/src/core/miscellaneous/insets/UIInsets.Internal.ts +0 -9
  331. package/src/core/miscellaneous/insets/UIInsets.ts +0 -248
  332. package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +0 -24
  333. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +0 -58
  334. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +0 -52
  335. package/src/core/miscellaneous/math.ts +0 -16
  336. package/src/core/miscellaneous/micro/UIMicro.Internal.ts +0 -33
  337. package/src/core/miscellaneous/micro/UIMicro.ts +0 -222
  338. package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +0 -8
  339. package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +0 -57
  340. package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +0 -65
  341. package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +0 -65
  342. package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +0 -57
  343. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +0 -65
  344. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +0 -65
  345. package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +0 -11
  346. package/src/core/miscellaneous/shared.ts +0 -73
  347. package/src/core/miscellaneous/text-span/UITextSpan.ts +0 -43
  348. package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +0 -52
  349. package/src/core/miscellaneous/text-style/UITextStyle.ts +0 -479
  350. package/src/core/miscellaneous/texture/UITextureView.Internal.ts +0 -55
  351. package/src/core/miscellaneous/texture/UITextureView.ts +0 -308
  352. package/src/core/miscellaneous/webglCapabilities.ts +0 -129
  353. package/src/core/shaders/UIImage.glsl +0 -10
  354. package/src/core/shaders/UINineSlice.glsl +0 -53
  355. package/src/core/shaders/UIProgress.glsl +0 -15
  356. package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +0 -13
  357. package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +0 -12
  358. package/src/core/shaders/glsl.d.ts +0 -27
  359. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +0 -23
  360. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +0 -124
  361. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +0 -22
  362. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +0 -101
  363. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +0 -58
  364. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +0 -605
  365. package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +0 -70
  366. package/src/particles/behaviorModules/UIBehaviorModule.ts +0 -20
  367. package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +0 -173
  368. package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +0 -104
  369. package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +0 -75
  370. package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +0 -115
  371. package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +0 -77
  372. package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +0 -118
  373. package/src/particles/elements/UIEmitter.Internal.ts +0 -22
  374. package/src/particles/elements/UIEmitter.ts +0 -313
  375. package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +0 -263
  376. package/src/particles/instancedParticle/UIInstancedParticle.ts +0 -138
  377. package/src/particles/miscellaneous/miscellaneous.ts +0 -115
  378. package/src/particles/renderingModules/UIRenderingColorOverLife.ts +0 -39
  379. package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +0 -49
  380. package/src/particles/renderingModules/UIRenderingModule.ts +0 -17
  381. package/src/particles/renderingModules/UIRenderingTexture.ts +0 -30
  382. package/src/particles/shaders/UIRenderingColorOverLife.glsl +0 -4
  383. package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +0 -6
  384. package/src/particles/shaders/UIRenderingTexture.glsl +0 -4
  385. package/src/particles/spawnModules/UISpawnModule.ts +0 -22
  386. package/src/particles/spawnModules/UISpawnOffset.ts +0 -62
  387. package/src/particles/spawnModules/UISpawnRandomLifetime.ts +0 -68
  388. package/src/particles/spawnModules/UISpawnRandomRotation.ts +0 -60
  389. package/src/particles/spawnModules/UISpawnRandomScale.ts +0 -81
  390. package/src/particles/spawnModules/UISpawnRandomTorque.ts +0 -62
  391. package/src/particles/spawnModules/UISpawnRandomVelocity.ts +0 -92
  392. package/src/particles/spawnModules/UISpawnRectangle.ts +0 -81
  393. package/tsconfig.json +0 -29
  394. /package/{src/core/index.ts → dist/core/index.d.ts} +0 -0
  395. /package/{src/particles/index.ts → dist/particles/index.d.ts} +0 -0
@@ -1,605 +0,0 @@
1
- import { Constraint, Expression, Solver, Variable } from "@lume/kiwi";
2
- import { UIExpression } from "../../miscellaneous/UIExpression";
3
- import { convertPriority, UIPriority } from "../../miscellaneous/UIPriority";
4
- import { convertRelation, UIRelation } from "../../miscellaneous/UIRelation";
5
- import type {
6
- ConstraintDescription,
7
- UISolverWrapperView,
8
- VariableDescription,
9
- } from "./UISolverWrapper.Internal";
10
-
11
- /**
12
- * Wrapper around the Kiwi constraint solver providing enhanced UI-specific functionality.
13
- *
14
- * UISolverWrapper abstracts the Kiwi (Cassowary) constraint solver to provide a more
15
- * UI-friendly interface with additional features like dynamic constraint modification,
16
- * required variables (P0 priority), partial constraint updates, and automatic solver
17
- * recovery. It manages variables and constraints through index-based references,
18
- * allowing for easy tracking and modification of layout constraints.
19
- *
20
- * Key features:
21
- * - Index-based variable and constraint management
22
- * - Required variables with P0 priority (always satisfied)
23
- * - Dynamic constraint modification without full rebuilds
24
- * - Automatic solver recovery on constraint conflicts
25
- * - Lazy evaluation with recalculation flags
26
- *
27
- * @see {@link UIExpression} - Expression system for constraint definitions
28
- * @see {@link UIPriority} - Priority levels for variables and constraints
29
- * @see {@link UIRelation} - Relational operators for constraints
30
- */
31
- export class UISolverWrapper implements UISolverWrapperView {
32
- /** @internal */
33
- public dirty = false;
34
-
35
- /** The underlying Kiwi solver instance, undefined when solver needs rebuilding. */
36
- private solver? = new Solver();
37
- /** Flag indicating whether variable values need recalculation. */
38
- private recalculationRequired = false;
39
-
40
- /** Map of variable indices to their descriptions. */
41
- private readonly variables = new Map<number, VariableDescription>();
42
- /** Counter for generating unique variable indices. */
43
- private lastVariableIndex = 0;
44
-
45
- /** Map of constraint indices to their descriptions. */
46
- private readonly constraints = new Map<number, ConstraintDescription>();
47
- /** Counter for generating unique constraint indices. */
48
- private lastConstraintIndex = 0;
49
-
50
- /**
51
- * Creates a new solver variable with the specified value and priority.
52
- *
53
- * Variables with P0 priority are treated as required (must be satisfied exactly)
54
- * and are implemented using equality constraints. Other priorities use edit
55
- * variables that can be adjusted by the solver.
56
- *
57
- * @param value - Initial value for the variable
58
- * @param priority - Priority level for constraint solving
59
- * @returns Unique index identifier for the created variable
60
- */
61
- public createVariable(value: number, priority: UIPriority): number {
62
- const index = this.lastVariableIndex++;
63
- const variable = new Variable();
64
-
65
- if (priority === UIPriority.P0) {
66
- const description: VariableDescription = { variable, priority, value };
67
- this.variables.set(index, description);
68
-
69
- description.constraint = this.buildConstraint(
70
- new UIExpression(0, [[index, 1]]),
71
- new UIExpression(value),
72
- UIRelation.EQUAL,
73
- priority,
74
- );
75
- try {
76
- this.solver?.addConstraint(description.constraint);
77
- } catch {
78
- this.solver = undefined;
79
- }
80
- } else {
81
- this.variables.set(index, { variable, priority, value });
82
-
83
- try {
84
- this.solver?.addEditVariable(variable, convertPriority(priority));
85
- this.solver?.suggestValue(variable, value);
86
- } catch {
87
- this.solver = undefined;
88
- }
89
- }
90
-
91
- this.recalculationRequired = true;
92
- this.dirty = true;
93
- return index;
94
- }
95
-
96
- /**
97
- * Removes a variable from the solver system.
98
- *
99
- * The variable must not be referenced by any existing constraints.
100
- * Cleans up both the variable itself and any associated required constraint.
101
- *
102
- * @param index - Index of the variable to remove
103
- * @throws Will throw an error if the variable doesn't exist or is still in use
104
- */
105
- public removeVariable(index: number): void {
106
- const description = this.variables.get(index);
107
- if (description === undefined) {
108
- throw new Error(`UISolverWrapper.removeVariable.index: variable does not exist`);
109
- }
110
-
111
- for (const cDescription of this.constraints.values()) {
112
- if (cDescription.lhs.hasTerm(index) || cDescription.rhs.hasTerm(index)) {
113
- throw new Error(`UISolverWrapper.removeVariable.index: variable is used in constraint`);
114
- }
115
- }
116
-
117
- try {
118
- description.constraint
119
- ? this.solver?.removeConstraint(description.constraint)
120
- : this.solver?.removeEditVariable(description.variable);
121
- } catch {
122
- this.solver = undefined;
123
- }
124
-
125
- this.variables.delete(index);
126
- this.recalculationRequired = true;
127
- this.dirty = true;
128
- }
129
-
130
- /**
131
- * Suggests a new value for an existing variable.
132
- *
133
- * For P0 priority variables, rebuilds the associated constraint.
134
- * For other priorities, suggests the value to the solver's edit system.
135
- * Only triggers updates if the value actually changes.
136
- *
137
- * @param index - Index of the variable to update
138
- * @param value - New suggested value
139
- * @throws Will throw an error if the variable doesn't exist
140
- */
141
- public suggestVariableValue(index: number, value: number): void {
142
- const description = this.variables.get(index);
143
- if (description === undefined) {
144
- throw new Error(`UISolverWrapper.suggestVariableValue.index: variable does not exist`);
145
- }
146
-
147
- if (description.value !== value) {
148
- description.value = value;
149
-
150
- if (description.constraint) {
151
- description.constraint = this.rebuildConstraint(
152
- description.constraint,
153
- new UIExpression().plus(index, 1),
154
- new UIExpression(description.value),
155
- UIRelation.EQUAL,
156
- description.priority,
157
- );
158
- } else {
159
- this.solver?.suggestValue(description.variable, value);
160
- }
161
-
162
- this.recalculationRequired = true;
163
- this.dirty = true;
164
- }
165
- }
166
-
167
- /**
168
- * Changes the priority of an existing variable.
169
- *
170
- * Switching to/from P0 priority changes how the variable is handled:
171
- * - P0: Creates required constraint (must be satisfied exactly)
172
- * - Other: Uses edit variable system (can be adjusted by solver)
173
- *
174
- * @param index - Index of the variable to modify
175
- * @param priority - New priority level
176
- * @throws Will throw an error if the variable doesn't exist
177
- */
178
- public setVariablePriority(index: number, priority: UIPriority): void {
179
- const description = this.variables.get(index);
180
- if (description === undefined) {
181
- throw new Error(`UISolverWrapper.setVariablePriority.index: variable does not exist`);
182
- }
183
-
184
- if (priority !== description.priority) {
185
- description.priority = priority;
186
-
187
- if (description.priority === UIPriority.P0) {
188
- const lhs = new UIExpression().plus(index, 1);
189
- const rhs = new UIExpression(description.value);
190
-
191
- description.constraint = this.buildConstraint(
192
- lhs,
193
- rhs,
194
- UIRelation.EQUAL,
195
- description.priority,
196
- );
197
-
198
- try {
199
- this.solver?.addConstraint(description.constraint);
200
- } catch {
201
- this.solver = undefined;
202
- }
203
- } else {
204
- if (description.constraint) {
205
- try {
206
- this.solver?.removeConstraint(description.constraint);
207
- } catch {
208
- this.solver = undefined;
209
- }
210
- }
211
-
212
- description.constraint = undefined;
213
- this.rebuildVariable(index, description);
214
- }
215
-
216
- this.recalculationRequired = true;
217
- this.dirty = true;
218
- }
219
- }
220
-
221
- /**
222
- * Reads the current solved value of a variable.
223
- *
224
- * Triggers solver recalculation if needed and rebuilds the solver
225
- * if it was invalidated due to constraint conflicts.
226
- *
227
- * @param index - Index of the variable to read
228
- * @returns Current solved value of the variable
229
- * @throws Will throw an error if the variable doesn't exist
230
- */
231
- public readVariableValue(index: number): number {
232
- const description = this.variables.get(index);
233
- if (description === undefined) {
234
- throw new Error(`UISolverWrapper.readVariableValue.index: variable does not exist`);
235
- }
236
-
237
- if (this.solver === undefined) {
238
- this.rebuildSolver();
239
- }
240
-
241
- if (this.recalculationRequired) {
242
- this.solver?.updateVariables();
243
- this.recalculationRequired = false;
244
- }
245
-
246
- return description.variable.value();
247
- }
248
-
249
- /**
250
- * Creates a new constraint between two expressions.
251
- *
252
- * Constraints can be enabled or disabled, and all properties can be
253
- * modified later without recreating the constraint.
254
- *
255
- * @param lhs - Left-hand side expression
256
- * @param rhs - Right-hand side expression
257
- * @param relation - Relational operator (equal, less than, greater than)
258
- * @param priority - Priority level for constraint solving
259
- * @param enabled - Whether the constraint is initially active
260
- * @returns Unique index identifier for the created constraint
261
- */
262
- public createConstraint(
263
- lhs: UIExpression,
264
- rhs: UIExpression,
265
- relation: UIRelation,
266
- priority: UIPriority,
267
- enabled: boolean,
268
- ): number {
269
- const index = this.lastConstraintIndex++;
270
- const constraint = this.buildConstraint(lhs, rhs, relation, priority);
271
- this.constraints.set(index, {
272
- constraint,
273
- lhs: lhs.clone(),
274
- rhs: rhs.clone(),
275
- priority,
276
- relation,
277
- enabled,
278
- });
279
- if (enabled) {
280
- try {
281
- this.solver?.addConstraint(constraint);
282
- } catch {
283
- this.solver = undefined;
284
- }
285
- this.recalculationRequired = true;
286
- this.dirty = true;
287
- }
288
- return index;
289
- }
290
-
291
- /**
292
- * Removes a constraint from the solver system.
293
- *
294
- * If the constraint is currently enabled, it will be removed from
295
- * the active solver before deletion.
296
- *
297
- * @param index - Index of the constraint to remove
298
- * @throws Will throw an error if the constraint doesn't exist
299
- */
300
- public removeConstraint(index: number): void {
301
- const description = this.constraints.get(index);
302
- if (description === undefined) {
303
- throw new Error(`UISolverWrapper.removeConstraint.index: constraint does not exist`);
304
- }
305
-
306
- if (description.enabled) {
307
- try {
308
- this.solver?.removeConstraint(description.constraint);
309
- } catch {
310
- this.solver = undefined;
311
- }
312
- }
313
-
314
- this.constraints.delete(index);
315
- this.recalculationRequired = true;
316
- this.dirty = true;
317
- }
318
-
319
- /**
320
- * Updates the left-hand side expression of an existing constraint.
321
- *
322
- * Rebuilds the underlying constraint with the new expression while
323
- * preserving all other properties.
324
- *
325
- * @param index - Index of the constraint to modify
326
- * @param lhs - New left-hand side expression
327
- * @throws Will throw an error if the constraint doesn't exist
328
- */
329
- public setConstraintLHS(index: number, lhs: UIExpression): void {
330
- const description = this.constraints.get(index);
331
- if (description === undefined) {
332
- throw new Error(`UISolverWrapper.setConstraintLHS.index: constraint does not exist`);
333
- }
334
-
335
- description.lhs.copy(lhs);
336
- this.rebuildConstraintByDescription(description);
337
- this.recalculationRequired = true;
338
- this.dirty = true;
339
- }
340
-
341
- /**
342
- * Updates the right-hand side expression of an existing constraint.
343
- *
344
- * Rebuilds the underlying constraint with the new expression while
345
- * preserving all other properties.
346
- *
347
- * @param index - Index of the constraint to modify
348
- * @param rhs - New right-hand side expression
349
- * @throws Will throw an error if the constraint doesn't exist
350
- */
351
- public setConstraintRHS(index: number, rhs: UIExpression): void {
352
- const description = this.constraints.get(index);
353
- if (description === undefined) {
354
- throw new Error(`UISolverWrapper.setConstraintRHS.index: constraint does not exist`);
355
- }
356
-
357
- description.rhs.copy(rhs);
358
- this.rebuildConstraintByDescription(description);
359
- this.recalculationRequired = true;
360
- this.dirty = true;
361
- }
362
-
363
- /**
364
- * Updates the relational operator of an existing constraint.
365
- *
366
- * Changes how the left and right expressions are compared
367
- * (equal, less than, greater than).
368
- *
369
- * @param index - Index of the constraint to modify
370
- * @param relation - New relational operator
371
- * @throws Will throw an error if the constraint doesn't exist
372
- */
373
- public setConstraintRelation(index: number, relation: UIRelation): void {
374
- const description = this.constraints.get(index);
375
- if (description === undefined) {
376
- throw new Error(`UISolverWrapper.setConstraintRelation.index: constraint does not exist`);
377
- }
378
-
379
- if (description.relation !== relation) {
380
- description.relation = relation;
381
- this.rebuildConstraintByDescription(description);
382
- this.recalculationRequired = true;
383
- this.dirty = true;
384
- }
385
- }
386
-
387
- /**
388
- * Updates the priority level of an existing constraint.
389
- *
390
- * Higher priority constraints are more likely to be satisfied
391
- * when conflicts arise.
392
- *
393
- * @param index - Index of the constraint to modify
394
- * @param priority - New priority level
395
- * @throws Will throw an error if the constraint doesn't exist
396
- */
397
- public setConstraintPriority(index: number, priority: UIPriority): void {
398
- const description = this.constraints.get(index);
399
- if (description === undefined) {
400
- throw new Error(`UISolverWrapper.setConstraintPriority.index: constraint does not exist`);
401
- }
402
-
403
- if (description.priority !== priority) {
404
- description.priority = priority;
405
- this.rebuildConstraintByDescription(description);
406
- this.recalculationRequired = true;
407
- this.dirty = true;
408
- }
409
- }
410
-
411
- /**
412
- * Enables or disables an existing constraint.
413
- *
414
- * Disabled constraints are not considered during solving but
415
- * remain in the system for potential re-enabling.
416
- *
417
- * @param index - Index of the constraint to modify
418
- * @param enabled - Whether the constraint should be active
419
- * @throws Will throw an error if the constraint doesn't exist
420
- */
421
- public setConstraintEnabled(index: number, enabled: boolean): void {
422
- const description = this.constraints.get(index);
423
- if (description === undefined) {
424
- throw new Error(`UISolverWrapper.setConstraintEnabled.index: constraint does not exist`);
425
- }
426
-
427
- if (enabled !== description.enabled) {
428
- description.enabled = enabled;
429
- try {
430
- description.enabled
431
- ? this.solver?.addConstraint(description.constraint)
432
- : this.solver?.removeConstraint(description.constraint);
433
- } catch {
434
- this.solver = undefined;
435
- }
436
- this.recalculationRequired = true;
437
- this.dirty = true;
438
- }
439
- }
440
-
441
- /**
442
- * Rebuilds a variable in the solver system with new properties.
443
- *
444
- * Temporarily removes all constraints that reference the variable,
445
- * updates the variable configuration, then rebuilds and re-adds
446
- * the dependent constraints.
447
- */
448
- private rebuildVariable(index: number, description: VariableDescription): void {
449
- const dependConstraints: ConstraintDescription[] = [];
450
-
451
- for (const cDescription of this.constraints.values()) {
452
- if (cDescription.lhs.hasTerm(index) || cDescription.rhs.hasTerm(index)) {
453
- try {
454
- this.solver?.removeConstraint(cDescription.constraint);
455
- } catch {
456
- this.solver = undefined;
457
- }
458
- dependConstraints.push(cDescription);
459
- }
460
- }
461
-
462
- this.solver?.removeEditVariable(description.variable);
463
- this.solver?.addEditVariable(description.variable, convertPriority(description.priority));
464
-
465
- for (const cDescription of dependConstraints) {
466
- cDescription.constraint = this.buildConstraint(
467
- cDescription.lhs,
468
- cDescription.rhs,
469
- cDescription.relation,
470
- cDescription.priority,
471
- );
472
- }
473
-
474
- for (const cDescription of dependConstraints) {
475
- try {
476
- this.solver?.addConstraint(cDescription.constraint);
477
- } catch {
478
- this.solver = undefined;
479
- break;
480
- }
481
- }
482
- }
483
-
484
- /**
485
- * Rebuilds a constraint based on its current description.
486
- *
487
- * Uses different rebuild strategies depending on whether the
488
- * constraint is currently enabled.
489
- */
490
- private rebuildConstraintByDescription(description: ConstraintDescription): void {
491
- description.constraint = description.enabled
492
- ? this.rebuildConstraint(
493
- description.constraint,
494
- description.lhs,
495
- description.rhs,
496
- description.relation,
497
- description.priority,
498
- )
499
- : this.buildConstraint(
500
- description.lhs,
501
- description.rhs,
502
- description.relation,
503
- description.priority,
504
- );
505
- }
506
-
507
- /**
508
- * Rebuilds a constraint by removing the old one and creating a new one.
509
- *
510
- * Safely handles solver state transitions and constraint replacement.
511
- */
512
- private rebuildConstraint(
513
- oldConstraint: Constraint,
514
- lhs: UIExpression,
515
- rhs: UIExpression,
516
- relation: UIRelation,
517
- priority: UIPriority,
518
- ): Constraint {
519
- try {
520
- this.solver?.removeConstraint(oldConstraint);
521
- } catch {
522
- this.solver = undefined;
523
- }
524
-
525
- const constraint = this.buildConstraint(lhs, rhs, relation, priority);
526
-
527
- try {
528
- this.solver?.addConstraint(constraint);
529
- } catch {
530
- this.solver = undefined;
531
- }
532
-
533
- return constraint;
534
- }
535
-
536
- /**
537
- * Creates a new Kiwi constraint from UI expressions and parameters.
538
- *
539
- * Converts UI-level expressions and enums to Kiwi-compatible formats.
540
- */
541
- private buildConstraint(
542
- lhs: UIExpression,
543
- rhs: UIExpression,
544
- relation: UIRelation,
545
- priority: UIPriority,
546
- ): Constraint {
547
- return new Constraint(
548
- this.convertExpression(lhs),
549
- convertRelation(relation),
550
- this.convertExpression(rhs),
551
- convertPriority(priority),
552
- );
553
- }
554
-
555
- /**
556
- * Converts a UIExpression to a Kiwi Expression.
557
- *
558
- * Maps variable indices to their corresponding Kiwi Variable instances
559
- * and preserves coefficients and constants.
560
- */
561
- private convertExpression(expression: UIExpression): Expression {
562
- return new Expression(
563
- ...expression.prepareTerms().map(([variableIndex, coefficient]): [number, Variable] => {
564
- const description = this.variables.get(variableIndex);
565
- if (description === undefined) {
566
- throw new Error(`UISolverWrapper.convertExpression.expression: variable does not exist`);
567
- }
568
- return [coefficient, description.variable];
569
- }),
570
- expression.constant,
571
- );
572
- }
573
-
574
- /**
575
- * Completely rebuilds the solver from scratch.
576
- *
577
- * Re-adds all variables and constraints to a fresh solver instance.
578
- * Used for recovery when the solver enters an invalid state.
579
- */
580
- private rebuildSolver(): void {
581
- if (this.solver) {
582
- throw new Error("UISolverWrapper.rebuildSolver: solver already exists");
583
- }
584
-
585
- this.solver = new Solver();
586
-
587
- for (const description of this.variables.values()) {
588
- if (description.constraint) {
589
- this.solver.addConstraint(description.constraint);
590
- } else {
591
- this.solver.addEditVariable(description.variable, convertPriority(description.priority));
592
- this.solver.suggestValue(description.variable, description.value);
593
- }
594
- }
595
-
596
- for (const description of this.constraints.values()) {
597
- if (description.enabled) {
598
- this.solver.addConstraint(description.constraint);
599
- }
600
- }
601
-
602
- this.recalculationRequired = true;
603
- this.dirty = true;
604
- }
605
- }
@@ -1,70 +0,0 @@
1
- import type { InstancedBufferAttribute } from "three";
2
- import { assertValidNumber } from "../../core/miscellaneous/asserts";
3
- import type { Vector2Like } from "../../core/miscellaneous/math";
4
- import {
5
- BUILTIN_OFFSET_VELOCITY_X,
6
- BUILTIN_OFFSET_VELOCITY_Y,
7
- resolveUIVector2Config,
8
- type UIVector2Config,
9
- } from "../miscellaneous/miscellaneous";
10
- import { UIBehaviorModule } from "./UIBehaviorModule";
11
-
12
- /**
13
- * Applies constant acceleration to all particles.
14
- *
15
- * Adds the direction vector to particle velocity each frame.
16
- */
17
- export class UIBehaviorDirectionalGravity extends UIBehaviorModule<{ builtin: "Matrix4" }> {
18
- /** @internal */
19
- public readonly requiredProperties = { builtin: "Matrix4" } as const;
20
- private directionInternal: Vector2Like;
21
-
22
- /**
23
- * @param direction - Acceleration vector in units/second²
24
- */
25
- constructor(direction: Vector2Like) {
26
- super();
27
- this.directionInternal = resolveUIVector2Config(direction);
28
- assertValidNumber(
29
- this.directionInternal.x,
30
- "UIBehaviorDirectionalGravity.constructor.direction.x",
31
- );
32
- assertValidNumber(
33
- this.directionInternal.y,
34
- "UIBehaviorDirectionalGravity.constructor.direction.y",
35
- );
36
- }
37
-
38
- /** Acceleration vector in units/second² */
39
- public get direction(): Vector2Like {
40
- return this.directionInternal;
41
- }
42
-
43
- /** Acceleration vector in units/second² */
44
- public set direction(value: UIVector2Config) {
45
- this.directionInternal = resolveUIVector2Config(value);
46
- assertValidNumber(this.directionInternal.x, "UIBehaviorDirectionalGravity.direction.x");
47
- assertValidNumber(this.directionInternal.y, "UIBehaviorDirectionalGravity.direction.y");
48
- }
49
-
50
- /** @internal */
51
- public update(
52
- properties: { builtin: InstancedBufferAttribute },
53
- instanceCount: number,
54
- deltaTime: number,
55
- ): void {
56
- const { builtin } = properties;
57
- const { array, itemSize } = builtin;
58
-
59
- const offsetX = this.directionInternal.x * deltaTime;
60
- const offsetY = this.directionInternal.y * deltaTime;
61
-
62
- for (let i = 0; i < instanceCount; i++) {
63
- const itemOffset = i * itemSize;
64
- array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] += offsetX;
65
- array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y] += offsetY;
66
- }
67
-
68
- builtin.needsUpdate = true;
69
- }
70
- }
@@ -1,20 +0,0 @@
1
- import type { InstancedBufferAttribute } from "three";
2
- import type { UIPropertyName } from "../../core/miscellaneous/generic-plane/shared";
3
-
4
- /**
5
- * Base class for particle behavior modules.
6
- *
7
- * Behavior modules update particle properties each frame.
8
- */
9
- export abstract class UIBehaviorModule<
10
- T extends Record<string, UIPropertyName> = Record<string, UIPropertyName>,
11
- > {
12
- public abstract readonly requiredProperties: T;
13
- public abstract update(
14
- properties: { [K in keyof T]: InstancedBufferAttribute },
15
- instanceCount: number,
16
- deltaTime: number,
17
- ): void;
18
-
19
- public destroy?(): void;
20
- }