laymur 0.22.0 → 0.25.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.
Files changed (314) hide show
  1. package/README.md +1 -1
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
  3. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
  4. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
  5. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
  6. package/dist/core/constraints/UIConstraint.d.ts +22 -2
  7. package/dist/core/constraints/UIConstraint.js +26 -3
  8. package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
  9. package/dist/core/constraints/UICustomConstraint.js +15 -15
  10. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
  11. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
  12. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
  13. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
  14. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
  15. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
  16. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
  17. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
  18. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
  19. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
  20. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
  21. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
  22. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
  23. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
  24. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
  25. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
  26. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
  27. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
  28. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
  29. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
  30. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
  31. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
  32. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
  33. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
  34. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
  35. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
  36. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
  37. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
  38. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
  39. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
  40. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
  41. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
  42. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
  43. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
  44. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
  45. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
  46. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
  47. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
  48. package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
  49. package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
  50. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
  51. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
  52. package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
  53. package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
  54. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
  55. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
  56. package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
  57. package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
  58. package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
  59. package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
  60. package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
  61. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
  62. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
  63. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
  64. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
  65. package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
  66. package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
  67. package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
  68. package/dist/core/elements/UIDummy/UIDummy.js +59 -42
  69. package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
  70. package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
  71. package/dist/core/elements/UIElement/UIElement.d.ts +25 -17
  72. package/dist/core/elements/UIElement/UIElement.js +76 -69
  73. package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
  74. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
  75. package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
  76. package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
  77. package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
  78. package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
  79. package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
  80. package/dist/core/elements/UIImage/UIImage.js +21 -24
  81. package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
  82. package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
  83. package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
  84. package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
  85. package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
  86. package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
  87. package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -8
  88. package/dist/core/elements/UIProgress/UIProgress.js +60 -58
  89. package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
  90. package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
  91. package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
  92. package/dist/core/elements/UIScene/UIScene.js +68 -69
  93. package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
  94. package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
  95. package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
  96. package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
  97. package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
  98. package/dist/core/elements/UIText/UIText.Internal.js +5 -7
  99. package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
  100. package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
  101. package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
  102. package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
  103. package/dist/core/elements/UIText/UIText.d.ts +28 -14
  104. package/dist/core/elements/UIText/UIText.js +181 -141
  105. package/dist/core/index.d.ts +55 -54
  106. package/dist/core/index.js +53 -0
  107. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
  108. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
  109. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
  110. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
  111. package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
  112. package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
  113. package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
  114. package/dist/core/layers/UILayer/UILayer.js +125 -62
  115. package/dist/core/miscellaneous/UIBlendMode.js +1 -3
  116. package/dist/core/miscellaneous/UIExpression.js +16 -19
  117. package/dist/core/miscellaneous/UIMode.js +3 -5
  118. package/dist/core/miscellaneous/UIOrientation.js +2 -4
  119. package/dist/core/miscellaneous/UIPriority.js +5 -8
  120. package/dist/core/miscellaneous/UIRelation.js +5 -8
  121. package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
  122. package/dist/core/miscellaneous/area/UIArea.js +1 -3
  123. package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
  124. package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
  125. package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
  126. package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
  127. package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
  128. package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
  129. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
  130. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
  131. package/dist/core/miscellaneous/asserts.d.ts +20 -1
  132. package/dist/core/miscellaneous/asserts.js +71 -19
  133. package/dist/core/miscellaneous/canvas.js +13 -7
  134. package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +1 -1
  135. package/dist/core/miscellaneous/color/UIColor.Internal.js +1 -3
  136. package/dist/core/miscellaneous/color/UIColor.d.ts +1 -1
  137. package/dist/core/miscellaneous/color/UIColor.js +202 -205
  138. package/dist/core/miscellaneous/computeTransform.d.ts +1 -1
  139. package/dist/core/miscellaneous/computeTransform.js +4 -7
  140. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +2 -2
  141. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +13 -16
  142. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +115 -118
  143. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +3 -3
  144. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.js +1 -0
  145. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +208 -114
  146. package/dist/core/miscellaneous/generic-plane/shared.d.ts +2 -2
  147. package/dist/core/miscellaneous/generic-plane/shared.js +16 -19
  148. package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
  149. package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
  150. package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
  151. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
  152. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
  153. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
  154. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
  155. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +14 -17
  156. package/dist/core/miscellaneous/math.js +3 -5
  157. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
  158. package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
  159. package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
  160. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
  161. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
  162. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
  163. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
  164. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
  165. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
  166. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
  167. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
  168. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
  169. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
  170. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
  171. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
  172. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
  173. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
  174. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
  175. package/dist/core/miscellaneous/shared.d.ts +1 -1
  176. package/dist/core/miscellaneous/shared.js +4 -7
  177. package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
  178. package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
  179. package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
  180. package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
  181. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
  182. package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
  183. package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
  184. package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
  185. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
  186. package/dist/core/miscellaneous/texture/UITextureView.d.ts +3 -3
  187. package/dist/core/miscellaneous/texture/UITextureView.js +114 -118
  188. package/dist/core/miscellaneous/webglCapabilities.js +3 -4
  189. package/dist/core/shaders/UIImage.d.ts +9 -0
  190. package/dist/core/shaders/UIImage.js +14 -0
  191. package/dist/core/shaders/UINineSlice.d.ts +11 -0
  192. package/dist/core/shaders/UINineSlice.js +57 -0
  193. package/dist/core/shaders/UIProgress.d.ts +14 -0
  194. package/dist/core/shaders/UIProgress.js +21 -0
  195. package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
  196. package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
  197. package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
  198. package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
  199. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
  200. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
  201. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
  202. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
  203. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
  204. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
  205. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
  206. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
  207. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
  208. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
  209. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +27 -4
  210. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +162 -123
  211. package/dist/debug/UIAspectDebug.d.ts +3 -3
  212. package/dist/debug/UIAspectDebug.js +64 -68
  213. package/dist/debug/UIConstraintDebug.d.ts +1 -1
  214. package/dist/debug/UIConstraintDebug.js +1 -0
  215. package/dist/debug/UIHeightDebug.d.ts +3 -3
  216. package/dist/debug/UIHeightDebug.js +63 -67
  217. package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
  218. package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
  219. package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
  220. package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
  221. package/dist/debug/UILayerDebug.d.ts +1 -1
  222. package/dist/debug/UILayerDebug.js +55 -64
  223. package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
  224. package/dist/debug/UIVerticalDistanceDebug.js +76 -81
  225. package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
  226. package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
  227. package/dist/debug/UIWidthDebug.d.ts +3 -3
  228. package/dist/debug/UIWidthDebug.js +63 -67
  229. package/dist/debug/index.d.ts +8 -8
  230. package/dist/debug/index.js +8 -8
  231. package/dist/debug/miscellaneous.js +8 -11
  232. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
  233. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
  234. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
  235. package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
  236. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
  237. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
  238. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
  239. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
  240. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
  241. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
  242. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
  243. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
  244. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
  245. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
  246. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
  247. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
  248. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
  249. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
  250. package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
  251. package/dist/particles/elements/UIEmitter.Internal.js +6 -9
  252. package/dist/particles/elements/UIEmitter.d.ts +17 -11
  253. package/dist/particles/elements/UIEmitter.js +100 -88
  254. package/dist/particles/index.d.ts +20 -18
  255. package/dist/particles/index.js +19 -18
  256. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
  257. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
  258. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +1 -1
  259. package/dist/particles/instancedParticle/UIInstancedParticle.js +29 -32
  260. package/dist/particles/miscellaneous/miscellaneous.d.ts +3 -3
  261. package/dist/particles/miscellaneous/miscellaneous.js +26 -27
  262. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +2 -2
  263. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +5 -8
  264. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +2 -2
  265. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +6 -9
  266. package/dist/particles/renderingModules/UIRenderingModule.js +1 -3
  267. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +2 -2
  268. package/dist/particles/renderingModules/UIRenderingTexture.js +4 -7
  269. package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +2 -0
  270. package/dist/particles/shaders/UIRenderingColorOverLife.js +7 -0
  271. package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +9 -0
  272. package/dist/particles/shaders/UIRenderingColorOverVelocity.js +16 -0
  273. package/dist/particles/shaders/UIRenderingTexture.d.ts +2 -0
  274. package/dist/particles/shaders/UIRenderingTexture.js +7 -0
  275. package/dist/particles/spawnModules/UISpawnModule.d.ts +1 -1
  276. package/dist/particles/spawnModules/UISpawnModule.js +1 -3
  277. package/dist/particles/spawnModules/UISpawnOffset.d.ts +3 -3
  278. package/dist/particles/spawnModules/UISpawnOffset.js +12 -15
  279. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
  280. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +13 -16
  281. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +2 -2
  282. package/dist/particles/spawnModules/UISpawnRandomRotation.js +13 -16
  283. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +2 -2
  284. package/dist/particles/spawnModules/UISpawnRandomScale.js +19 -22
  285. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +2 -2
  286. package/dist/particles/spawnModules/UISpawnRandomTorque.js +13 -16
  287. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +2 -2
  288. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +21 -24
  289. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +3 -3
  290. package/dist/particles/spawnModules/UISpawnRectangle.js +21 -24
  291. package/package.json +13 -17
  292. package/dist/_virtual/2d.js +0 -3
  293. package/dist/_virtual/3d.js +0 -3
  294. package/dist/_virtual/4d.js +0 -3
  295. package/dist/_virtual/mod.js +0 -5
  296. package/dist/_virtual/mod2.js +0 -3
  297. package/dist/core/shaders/UIImage.glsl.js +0 -3
  298. package/dist/core/shaders/UINineSlice.glsl.js +0 -3
  299. package/dist/core/shaders/UIProgress.glsl.js +0 -3
  300. package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +0 -3
  301. package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +0 -3
  302. package/dist/index.js +0 -52
  303. package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
  304. package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
  305. package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
  306. package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
  307. package/dist/node_modules/three/examples/jsm/lines/Line2.js +0 -56
  308. package/dist/node_modules/three/examples/jsm/lines/LineGeometry.js +0 -157
  309. package/dist/node_modules/three/examples/jsm/lines/LineMaterial.js +0 -691
  310. package/dist/node_modules/three/examples/jsm/lines/LineSegments2.js +0 -415
  311. package/dist/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +0 -289
  312. package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +0 -3
  313. package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +0 -3
  314. package/dist/particles/shaders/UIRenderingTexture.glsl.js +0 -3
@@ -1,22 +1,39 @@
1
- import { UITextStyle } from '../../miscellaneous/text-style/UITextStyle.js';
2
- import { detectBidiClass } from './UIText.Bidi.js';
3
-
1
+ import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle.js";
2
+ import { detectBidiClass, reorderChunksVisually } from "./UIText.Bidi.js";
4
3
  /**
5
4
  * Applies font of a resolved style to a canvas context.
6
5
  * Shared by measuring and rendering so both stay in sync.
7
6
  * @param context Canvas context to configure
8
7
  * @param textStyle Resolved text style
9
8
  */
10
- function applyFontStyle(context, textStyle) {
9
+ export function applyFontStyle(context, textStyle) {
11
10
  context.font = `${textStyle.fontStyle} ${textStyle.fontWeight} ${textStyle.fontSize}px "${textStyle.fontFamily}"`;
12
11
  }
13
12
  /**
14
13
  * Splits text into renderable chunks.
14
+ * No-break spaces stay inside words, so a line never breaks at them.
15
15
  * @param text Text to split
16
16
  * @returns Array of words, spaces, and newlines
17
17
  */
18
- function splitTextIntoChunks(text) {
19
- return text.match(/\S+|\s|\n/g) ?? [];
18
+ export function splitTextIntoChunks(text) {
19
+ return text.match(/(?:\S|[\u00A0\u2007\u202F])+|\s/g) ?? [];
20
+ }
21
+ /**
22
+ * Checks whether a chunk is a breakable space, which may end a line and is not drawn there.
23
+ * @param textChunk Chunk to check
24
+ * @returns True for a single breakable whitespace character other than a newline
25
+ */
26
+ function isBreakableSpace(textChunk) {
27
+ return textChunk.text !== "\n" && /^\s$/.test(textChunk.text);
28
+ }
29
+ /**
30
+ * Rounds an overhang up; a negative or missing value means none, so a line never gets narrower
31
+ * than its advances.
32
+ * @param value Overhang in pixels
33
+ * @returns Overhang in whole pixels, at least 0
34
+ */
35
+ function ceilOverhang(value) {
36
+ return value > 0 ? Math.ceil(value) : 0;
20
37
  }
21
38
  /**
22
39
  * Measures single text chunk.
@@ -25,7 +42,7 @@ function splitTextIntoChunks(text) {
25
42
  * @param textStyle Resolved text style
26
43
  * @returns Chunk metrics
27
44
  */
28
- function measureTextChunk(context, text, textStyle) {
45
+ export function measureTextChunk(context, text, textStyle) {
29
46
  applyFontStyle(context, textStyle);
30
47
  if (text === "\n") {
31
48
  return {
@@ -33,82 +50,125 @@ function measureTextChunk(context, text, textStyle) {
33
50
  height: textStyle.lineHeight,
34
51
  baseline: 0,
35
52
  lineHeight: textStyle.lineHeight,
53
+ overhangLeft: 0,
54
+ overhangRight: 0,
36
55
  };
37
56
  }
38
57
  const metrics = context.measureText(text);
39
58
  const ascent = Math.ceil(metrics.actualBoundingBoxAscent);
40
59
  const descent = Math.ceil(metrics.actualBoundingBoxDescent);
60
+ const width = Math.ceil(metrics.width);
41
61
  return {
42
- width: Math.ceil(metrics.width),
62
+ width,
43
63
  height: ascent + descent,
44
64
  baseline: ascent,
45
65
  lineHeight: textStyle.lineHeight,
66
+ overhangLeft: ceilOverhang(metrics.actualBoundingBoxLeft),
67
+ overhangRight: ceilOverhang(metrics.actualBoundingBoxRight - width),
46
68
  };
47
69
  }
48
70
  /**
49
- * Appends a line built from accumulated metrics.
50
- * Ascent and descent are separate because the tallest and deepest chunks may differ.
51
- * @param lines Lines to append to
52
- * @param chunks Chunks of the line
53
- * @param width Line width in pixels
54
- * @param ascent Maximum chunk ascent in pixels
55
- * @param descent Maximum chunk descent in pixels
56
- * @param lineHeight Maximum chunk line height in pixels
71
+ * Builds a line from its chunks in logical order.
72
+ * The width spans the glyphs, not only their advances: the left overhang of the visually first
73
+ * chunk and the right overhang of the visually last one are part of it, so italic and swash
74
+ * glyphs at the line edges are not cut.
75
+ * @param chunks Chunks of the line without trailing spaces
76
+ * @param emptyLineHeight Line height used when the line has no chunks
77
+ * @param isRTL Whether the paragraph reads right to left
78
+ * @returns Text line
57
79
  */
58
- function pushTextLine(lines, chunks, width, ascent, descent, lineHeight) {
59
- lines.push({
80
+ function buildTextLine(chunks, emptyLineHeight, isRTL) {
81
+ if (chunks.length === 0) {
82
+ return {
83
+ chunks,
84
+ width: 0,
85
+ height: 0,
86
+ baseline: 0,
87
+ lineHeight: emptyLineHeight,
88
+ overhangLeft: 0,
89
+ overhangRight: 0,
90
+ };
91
+ }
92
+ let advance = 0;
93
+ let ascent = 0;
94
+ let descent = 0;
95
+ let lineHeight = 0;
96
+ for (const chunk of chunks) {
97
+ advance += chunk.metrics.width;
98
+ ascent = Math.max(ascent, chunk.metrics.baseline);
99
+ descent = Math.max(descent, chunk.metrics.height - chunk.metrics.baseline);
100
+ lineHeight = Math.max(lineHeight, chunk.metrics.lineHeight);
101
+ }
102
+ const visualChunks = reorderChunksVisually(chunks, isRTL);
103
+ const overhangLeft = visualChunks[0].metrics.overhangLeft;
104
+ const overhangRight = visualChunks[visualChunks.length - 1].metrics.overhangRight;
105
+ return {
60
106
  chunks,
61
- width,
107
+ width: overhangLeft + advance + overhangRight,
62
108
  height: ascent + descent,
63
109
  baseline: ascent,
64
110
  lineHeight,
65
- });
111
+ overhangLeft,
112
+ overhangRight,
113
+ };
114
+ }
115
+ /**
116
+ * Removes breakable spaces from the end of a line.
117
+ * @param chunks Chunks of the line in logical order
118
+ * @returns The same chunks without trailing spaces
119
+ */
120
+ function trimTrailingSpaces(chunks) {
121
+ let end = chunks.length;
122
+ while (end > 0 && isBreakableSpace(chunks[end - 1])) {
123
+ end--;
124
+ }
125
+ return end === chunks.length ? chunks : chunks.slice(0, end);
66
126
  }
67
127
  /**
68
128
  * Builds text lines with word wrapping.
129
+ * Spaces behave as in a browser: a space never moves to the next line by itself, spaces at the
130
+ * end of a line are not part of it, and a line made by wrapping does not start with a space.
131
+ * Spaces at the start of the text and after a newline are kept. A newline always ends a line,
132
+ * so two newlines in a row leave an empty line.
69
133
  * @param maxWidth Maximum line width in pixels
70
134
  * @param textChunks Measured text chunks
135
+ * @param isRTL Whether the paragraph reads right to left
71
136
  * @returns Array of text lines
72
137
  */
73
- function buildTextLines(maxWidth, textChunks) {
138
+ export function buildTextLines(maxWidth, textChunks, isRTL) {
74
139
  const lines = [];
75
140
  let currentLine = [];
76
- let currentWidth = 0;
77
- let currentAscent = 0;
78
- let currentDescent = 0;
79
141
  let currentLineHeight = 0;
142
+ let isWrapped = false;
143
+ const pushLine = () => {
144
+ lines.push(buildTextLine(trimTrailingSpaces(currentLine), currentLineHeight, isRTL));
145
+ currentLine = [];
146
+ currentLineHeight = 0;
147
+ };
80
148
  for (const textChunk of textChunks) {
81
- const ascent = textChunk.metrics.baseline;
82
- const descent = textChunk.metrics.height - textChunk.metrics.baseline;
83
149
  if (textChunk.text === "\n") {
84
- if (currentLine.length > 0) {
85
- pushTextLine(lines, currentLine, currentWidth, currentAscent, currentDescent, currentLineHeight);
86
- }
87
- currentLine = [];
88
- currentWidth = 0;
89
- currentAscent = 0;
90
- currentDescent = 0;
91
- currentLineHeight = 0;
150
+ currentLineHeight = Math.max(currentLineHeight, textChunk.metrics.lineHeight);
151
+ pushLine();
152
+ isWrapped = false;
92
153
  continue;
93
154
  }
94
- if (currentLine.length === 0 || currentWidth + textChunk.metrics.width <= maxWidth) {
95
- currentLine.push(textChunk);
96
- currentWidth += textChunk.metrics.width;
97
- currentAscent = Math.max(currentAscent, ascent);
98
- currentDescent = Math.max(currentDescent, descent);
99
- currentLineHeight = Math.max(currentLineHeight, textChunk.metrics.lineHeight);
155
+ if (isBreakableSpace(textChunk)) {
156
+ if (!(isWrapped && currentLine.length === 0)) {
157
+ currentLine.push(textChunk);
158
+ currentLineHeight = Math.max(currentLineHeight, textChunk.metrics.lineHeight);
159
+ }
160
+ continue;
100
161
  }
101
- else {
102
- pushTextLine(lines, currentLine, currentWidth, currentAscent, currentDescent, currentLineHeight);
103
- currentLine = [textChunk];
104
- currentWidth = textChunk.metrics.width;
105
- currentAscent = ascent;
106
- currentDescent = descent;
107
- currentLineHeight = textChunk.metrics.lineHeight;
162
+ const candidate = trimTrailingSpaces(currentLine).length === 0 ? null : [...currentLine, textChunk];
163
+ if (candidate && buildTextLine(candidate, 0, isRTL).width > maxWidth) {
164
+ pushLine();
165
+ isWrapped = true;
108
166
  }
167
+ currentLine.push(textChunk);
168
+ currentLineHeight = Math.max(currentLineHeight, textChunk.metrics.lineHeight);
109
169
  }
110
- if (currentLine.length > 0) {
111
- pushTextLine(lines, currentLine, currentWidth, currentAscent, currentDescent, currentLineHeight);
170
+ if (trimTrailingSpaces(currentLine).length > 0) {
171
+ pushLine();
112
172
  }
113
173
  return lines;
114
174
  }
@@ -118,7 +178,7 @@ function buildTextLines(maxWidth, textChunks) {
118
178
  * @param lines Text lines
119
179
  * @returns Total width and height
120
180
  */
121
- function calculateTextSize(lines) {
181
+ export function calculateTextSize(lines) {
122
182
  if (lines.length === 0) {
123
183
  return { width: 0, height: 0 };
124
184
  }
@@ -138,8 +198,9 @@ function calculateTextSize(lines) {
138
198
  * @param isRTL Whether the paragraph reads right to left
139
199
  * @returns Measured text chunks
140
200
  */
141
- function buildTextChunks(context, textSpans, commonStyle, isRTL) {
201
+ export function buildTextChunks(context, textSpans, commonStyle, isRTL) {
142
202
  context.direction = isRTL ? "rtl" : "ltr";
203
+ context.textAlign = "left";
143
204
  const textChunks = [];
144
205
  for (const textSpan of textSpans) {
145
206
  const textStyle = UITextStyle.resolve(textSpan.style, commonStyle);
@@ -159,12 +220,11 @@ function buildTextChunks(context, textSpans, commonStyle, isRTL) {
159
220
  * Calculates text layout parameters.
160
221
  * @param textChunks Measured text chunks
161
222
  * @param maxLineWidth Maximum line width in pixels
223
+ * @param isRTL Whether the paragraph reads right to left
162
224
  * @returns Lines and total size
163
225
  */
164
- function calculateTextContentParameters(textChunks, maxLineWidth) {
165
- const lines = buildTextLines(maxLineWidth, textChunks);
226
+ export function calculateTextContentParameters(textChunks, maxLineWidth, isRTL) {
227
+ const lines = buildTextLines(maxLineWidth, textChunks, isRTL);
166
228
  const size = calculateTextSize(lines);
167
229
  return { lines, size };
168
230
  }
169
-
170
- export { applyFontStyle, buildTextChunks, buildTextLines, calculateTextContentParameters, calculateTextSize, measureTextChunk, splitTextIntoChunks };
@@ -1,6 +1,6 @@
1
- import type { UICanvasRenderingContext2D } from "../../miscellaneous/canvas";
2
- import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal";
3
- import type { UITextLine } from "./UIText.Interfaces";
1
+ import type { UICanvasRenderingContext2D } from "../../miscellaneous/canvas.js";
2
+ import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal.js";
3
+ import type { UITextLine } from "./UIText.Interfaces.js";
4
4
  /**
5
5
  * Renders single text chunk.
6
6
  * @param x X coordinate in pixels
@@ -1,7 +1,6 @@
1
- import { TEXT_STYLE_DEFAULT_ALIGN } from '../../miscellaneous/text-style/UITextStyle.Internal.js';
2
- import { reorderChunksVisually } from './UIText.Bidi.js';
3
- import { applyFontStyle } from './UIText.Measuring.js';
4
-
1
+ import { TEXT_STYLE_DEFAULT_ALIGN } from "../../miscellaneous/text-style/UITextStyle.Internal.js";
2
+ import { reorderChunksVisually } from "./UIText.Bidi.js";
3
+ import { applyFontStyle } from "./UIText.Measuring.js";
5
4
  /**
6
5
  * Resolves logical alignment into a physical one.
7
6
  * @param align Alignment to resolve
@@ -25,7 +24,7 @@ function resolveAlign(align, isRTL) {
25
24
  * @param style Resolved text style
26
25
  * @param context Canvas rendering context
27
26
  */
28
- function renderTextChunk(x, y, text, style, context) {
27
+ export function renderTextChunk(x, y, text, style, context) {
29
28
  applyFontStyle(context, style);
30
29
  if (style.enableShadow) {
31
30
  context.shadowOffsetX = style.shadowOffsetX;
@@ -53,7 +52,7 @@ function renderTextChunk(x, y, text, style, context) {
53
52
  * @param isRTL Whether the paragraph reads right to left
54
53
  * @param context Canvas rendering context
55
54
  */
56
- function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
55
+ export function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
57
56
  context.clearRect(0, 0, context.canvas.width, context.canvas.height);
58
57
  context.direction = isRTL ? "rtl" : "ltr";
59
58
  context.textAlign = "left";
@@ -74,7 +73,7 @@ function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
74
73
  else if (lineAlign === "right") {
75
74
  offsetX = textWidth - line.width;
76
75
  }
77
- let currentX = paddingLeft + offsetX;
76
+ let currentX = paddingLeft + offsetX + line.overhangLeft;
78
77
  currentY += i === 0 ? line.baseline : line.lineHeight;
79
78
  for (const chunk of reorderChunksVisually(line.chunks, isRTL)) {
80
79
  renderTextChunk(currentX, currentY, chunk.text, chunk.style, context);
@@ -82,5 +81,3 @@ function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
82
81
  }
83
82
  }
84
83
  }
85
-
86
- export { renderTextChunk, renderTextLines };
@@ -1,21 +1,24 @@
1
1
  import type { WebGLRenderer } from "three";
2
- import type { UILayer } from "../../layers/UILayer/UILayer";
3
- import { UIColor } from "../../miscellaneous/color/UIColor";
4
- import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
5
- import { UIInsets } from "../../miscellaneous/insets/UIInsets";
6
- import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal";
7
- import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan";
8
- import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle";
9
- import { UIElement } from "../UIElement/UIElement";
10
- import type { UITextContent } from "./UIText.Interfaces";
11
- import type { UITextOptions } from "./UIText.Internal";
12
- import { UITextDirection, UITextResizeMode } from "./UIText.Internal";
2
+ import type { UILayer } from "../../layers/UILayer/UILayer.js";
3
+ import { UIColor } from "../../miscellaneous/color/UIColor.js";
4
+ import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
5
+ import { UIInsets } from "../../miscellaneous/insets/UIInsets.js";
6
+ import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal.js";
7
+ import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan.js";
8
+ import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle.js";
9
+ import { UIElement } from "../UIElement/UIElement.js";
10
+ import type { UITextContent } from "./UIText.Interfaces.js";
11
+ import type { UITextOptions } from "./UIText.Internal.js";
12
+ import { UITextDirection, UITextResizeMode } from "./UIText.Internal.js";
13
13
  /** Canvas-based text rendering element */
14
14
  export declare class UIText extends UIElement {
15
15
  /** Default style applied to all text spans */
16
16
  readonly commonStyle: UITextStyle;
17
17
  private readonly colorInternal;
18
18
  private readonly paddingInternal;
19
+ private autoPaddingInternal;
20
+ /** Padding last set by auto padding; any other value means it was changed by hand */
21
+ private lastAutoPadding;
19
22
  private readonly canvas;
20
23
  private readonly context;
21
24
  private texture;
@@ -47,6 +50,11 @@ export declare class UIText extends UIElement {
47
50
  get maxLineWidth(): number;
48
51
  /** Text padding in world units */
49
52
  get padding(): UIInsets;
53
+ /**
54
+ * Whether the padding follows the stroke and shadow of the styles. On by default, off once
55
+ * the padding is set by hand.
56
+ */
57
+ get autoPadding(): boolean;
50
58
  /** Controls how text adapts to element size */
51
59
  get resizeMode(): UITextResizeMode;
52
60
  /** Base direction used for bidirectional text reordering */
@@ -57,18 +65,24 @@ export declare class UIText extends UIElement {
57
65
  set content(value: UITextContent);
58
66
  /** Maximum line width before wrapping in pixels */
59
67
  set maxLineWidth(value: number);
60
- /** Text padding in world units */
68
+ /** Text padding in world units. Turns auto padding off. */
61
69
  set padding(value: UIInsetsConfig);
70
+ /**
71
+ * Whether the padding follows the stroke and shadow of the styles. On by default, off once
72
+ * the padding is set by hand.
73
+ */
74
+ set autoPadding(value: boolean);
62
75
  /** Controls how text adapts to size constraints */
63
76
  set resizeMode(value: UITextResizeMode);
64
77
  /** Base direction used for bidirectional text reordering */
65
78
  set direction(value: UITextDirection);
66
- /** Removes element and frees resources */
67
- destroy(): void;
79
+ /** Frees resources of the text */
80
+ protected destroyInternal(): void;
68
81
  protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
69
82
  private tryToRenderTextScaleMode;
70
83
  private tryToRenderTextBreakMode;
71
84
  private updateProperties;
85
+ private updateAutoPadding;
72
86
  private buildTextChunks;
73
87
  private checkDimensionsDirty;
74
88
  private setDimensionsDirtyFalse;