laymur 0.15.1 → 0.17.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 (248) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.editorconfig +14 -0
  3. package/CLAUDE.md +181 -0
  4. package/README.md +84 -208
  5. package/assets/logotype.png +0 -0
  6. package/eslint.config.js +111 -0
  7. package/package.json +20 -36
  8. package/rollup.config.js +52 -0
  9. package/{dist/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts → src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts} +3 -2
  10. package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +60 -0
  11. package/src/core/constraints/UIConstraint.ts +20 -0
  12. package/src/core/constraints/UICustomConstraint.ts +62 -0
  13. package/{dist/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts → src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts} +3 -2
  14. package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +52 -0
  15. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +13 -0
  16. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +139 -0
  17. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +16 -0
  18. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +189 -0
  19. package/{dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts → src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts} +3 -2
  20. package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +68 -0
  21. package/{dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts → src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts} +9 -8
  22. package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +94 -0
  23. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +13 -0
  24. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +135 -0
  25. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +16 -0
  26. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +189 -0
  27. package/{dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts → src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts} +3 -2
  28. package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +68 -0
  29. package/{dist/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts → src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts} +3 -2
  30. package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +52 -0
  31. package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +84 -0
  32. package/src/core/constraints/builders/UIConstraint2DBuilder.ts +168 -0
  33. package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +15 -0
  34. package/src/core/constraints/builders/UICoverConstraintBuilder.ts +84 -0
  35. package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +15 -0
  36. package/src/core/constraints/builders/UIFitConstraintBuilder.ts +84 -0
  37. package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +13 -0
  38. package/src/core/elements/UIAnchor/UIAnchor.ts +70 -0
  39. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +30 -0
  40. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +355 -0
  41. package/src/core/elements/UIDummy/UIDummy.Internal.ts +33 -0
  42. package/src/core/elements/UIDummy/UIDummy.ts +244 -0
  43. package/src/core/elements/UIElement/UIElement.Internal.ts +13 -0
  44. package/src/core/elements/UIElement/UIElement.ts +127 -0
  45. package/{dist/elements/UIGraphics/UIGraphics.Internal.d.ts → src/core/elements/UIGraphics/UIGraphics.Internal.ts} +7 -5
  46. package/src/core/elements/UIGraphics/UIGraphics.ts +168 -0
  47. package/{dist/elements/UIImage/UIImage.Internal.d.ts → src/core/elements/UIImage/UIImage.Internal.ts} +3 -2
  48. package/src/core/elements/UIImage/UIImage.ts +138 -0
  49. package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +26 -0
  50. package/src/core/elements/UINineSlice/UINineSlice.ts +296 -0
  51. package/src/core/elements/UIProgress/UIProgress.Internal.ts +24 -0
  52. package/src/core/elements/UIProgress/UIProgress.ts +259 -0
  53. package/src/core/elements/UIScene/UIScene.Internal.ts +46 -0
  54. package/src/core/elements/UIScene/UIScene.ts +259 -0
  55. package/{dist/elements/UIText/UIText.Interfaces.d.ts → src/core/elements/UIText/UIText.Interfaces.ts} +21 -16
  56. package/src/core/elements/UIText/UIText.Internal.ts +29 -0
  57. package/src/core/elements/UIText/UIText.Measuring.ts +183 -0
  58. package/src/core/elements/UIText/UIText.Rendering.ts +83 -0
  59. package/src/core/elements/UIText/UIText.ts +376 -0
  60. package/{dist/index.d.ts → src/core/index.ts} +2 -1
  61. package/{dist/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts → src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts} +14 -11
  62. package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +233 -0
  63. package/{dist/layers/UILayer/UILayer.Internal.d.ts → src/core/layers/UILayer/UILayer.Internal.ts} +15 -11
  64. package/src/core/layers/UILayer/UILayer.ts +156 -0
  65. package/src/core/miscellaneous/UIExpression.ts +142 -0
  66. package/src/core/miscellaneous/UIMode.ts +29 -0
  67. package/src/core/miscellaneous/UIOrientation.ts +18 -0
  68. package/src/core/miscellaneous/UIPriority.ts +63 -0
  69. package/src/core/miscellaneous/UIRelation.ts +39 -0
  70. package/src/core/miscellaneous/UITransparencyMode.ts +9 -0
  71. package/src/core/miscellaneous/area/UIArea.ts +5 -0
  72. package/src/core/miscellaneous/area/UIAreaCircle.ts +32 -0
  73. package/src/core/miscellaneous/area/UIAreaPolygon.ts +50 -0
  74. package/src/core/miscellaneous/area/UIAreaRectangle.ts +38 -0
  75. package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +78 -0
  76. package/src/core/miscellaneous/asserts.ts +187 -0
  77. package/src/core/miscellaneous/canvas.ts +73 -0
  78. package/src/core/miscellaneous/color/UIColor.Internal.ts +89 -0
  79. package/src/core/miscellaneous/color/UIColor.ts +844 -0
  80. package/src/core/miscellaneous/computeTransform.ts +127 -0
  81. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +235 -0
  82. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +524 -0
  83. package/{dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts → src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts} +10 -8
  84. package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +448 -0
  85. package/src/core/miscellaneous/generic-plane/shared.ts +323 -0
  86. package/src/core/miscellaneous/insets/UIInsets.Internal.ts +9 -0
  87. package/src/core/miscellaneous/insets/UIInsets.ts +248 -0
  88. package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +24 -0
  89. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +58 -0
  90. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +52 -0
  91. package/src/core/miscellaneous/math.ts +16 -0
  92. package/src/core/miscellaneous/micro/UIMicro.Internal.ts +33 -0
  93. package/src/core/miscellaneous/micro/UIMicro.ts +222 -0
  94. package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +8 -0
  95. package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +57 -0
  96. package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +65 -0
  97. package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +65 -0
  98. package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +57 -0
  99. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +65 -0
  100. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +65 -0
  101. package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +11 -0
  102. package/src/core/miscellaneous/shared.ts +73 -0
  103. package/{dist/miscellaneous/text-span/UITextSpan.Internal.d.ts → src/core/miscellaneous/text-span/UITextSpan.Internal.ts} +5 -4
  104. package/src/core/miscellaneous/text-span/UITextSpan.ts +43 -0
  105. package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +52 -0
  106. package/src/core/miscellaneous/text-style/UITextStyle.ts +479 -0
  107. package/src/core/miscellaneous/texture/UITextureView.Internal.ts +55 -0
  108. package/src/core/miscellaneous/texture/UITextureView.ts +308 -0
  109. package/src/core/miscellaneous/webglCapabilities.ts +129 -0
  110. package/src/core/shaders/UIImage.glsl +10 -0
  111. package/src/core/shaders/UINineSlice.glsl +53 -0
  112. package/src/core/shaders/UIProgress.glsl +15 -0
  113. package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +13 -0
  114. package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +12 -0
  115. package/src/core/shaders/glsl.d.ts +27 -0
  116. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +23 -0
  117. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +124 -0
  118. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +22 -0
  119. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +101 -0
  120. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +58 -0
  121. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +605 -0
  122. package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +70 -0
  123. package/src/particles/behaviorModules/UIBehaviorModule.ts +20 -0
  124. package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +173 -0
  125. package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +104 -0
  126. package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +75 -0
  127. package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +115 -0
  128. package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +77 -0
  129. package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +118 -0
  130. package/src/particles/elements/UIEmitter.Internal.ts +22 -0
  131. package/src/particles/elements/UIEmitter.ts +313 -0
  132. package/src/particles/index.ts +18 -0
  133. package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +263 -0
  134. package/src/particles/instancedParticle/UIInstancedParticle.ts +138 -0
  135. package/src/particles/miscellaneous/miscellaneous.ts +115 -0
  136. package/src/particles/renderingModules/UIRenderingColorOverLife.ts +39 -0
  137. package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +49 -0
  138. package/src/particles/renderingModules/UIRenderingModule.ts +17 -0
  139. package/src/particles/renderingModules/UIRenderingTexture.ts +30 -0
  140. package/src/particles/shaders/UIRenderingColorOverLife.glsl +4 -0
  141. package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +6 -0
  142. package/src/particles/shaders/UIRenderingTexture.glsl +4 -0
  143. package/src/particles/spawnModules/UISpawnModule.ts +22 -0
  144. package/src/particles/spawnModules/UISpawnOffset.ts +62 -0
  145. package/src/particles/spawnModules/UISpawnRandomLifetime.ts +68 -0
  146. package/src/particles/spawnModules/UISpawnRandomRotation.ts +60 -0
  147. package/src/particles/spawnModules/UISpawnRandomScale.ts +81 -0
  148. package/src/particles/spawnModules/UISpawnRandomTorque.ts +62 -0
  149. package/src/particles/spawnModules/UISpawnRandomVelocity.ts +92 -0
  150. package/src/particles/spawnModules/UISpawnRectangle.ts +81 -0
  151. package/tsconfig.json +29 -0
  152. package/dist/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +0 -22
  153. package/dist/constraints/UIConstraint.d.ts +0 -12
  154. package/dist/constraints/UICustomConstraint.d.ts +0 -28
  155. package/dist/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +0 -20
  156. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -11
  157. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -36
  158. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -14
  159. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -44
  160. package/dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -22
  161. package/dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -43
  162. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -11
  163. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -32
  164. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -14
  165. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -44
  166. package/dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -22
  167. package/dist/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +0 -20
  168. package/dist/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +0 -64
  169. package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +0 -46
  170. package/dist/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +0 -13
  171. package/dist/constraints/builders/UICoverConstraintBuilder.d.ts +0 -29
  172. package/dist/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +0 -13
  173. package/dist/constraints/builders/UIFitConstraintBuilder.d.ts +0 -29
  174. package/dist/elements/UIAnchor/UIAnchor.Internal.d.ts +0 -9
  175. package/dist/elements/UIAnchor/UIAnchor.d.ts +0 -32
  176. package/dist/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -27
  177. package/dist/elements/UIAnimatedImage/UIAnimatedImage.d.ts +0 -77
  178. package/dist/elements/UIElement/UIElement.Internal.d.ts +0 -11
  179. package/dist/elements/UIElement/UIElement.d.ts +0 -38
  180. package/dist/elements/UIGraphics/UIGraphics.d.ts +0 -51
  181. package/dist/elements/UIImage/UIImage.d.ts +0 -32
  182. package/dist/elements/UIInputDummy/UIInputDummy.Internal.d.ts +0 -30
  183. package/dist/elements/UIInputDummy/UIInputDummy.d.ts +0 -82
  184. package/dist/elements/UINineSlice/UINineSlice.Internal.d.ts +0 -23
  185. package/dist/elements/UINineSlice/UINineSlice.d.ts +0 -60
  186. package/dist/elements/UIProgress/UIProgress.Internal.d.ts +0 -14
  187. package/dist/elements/UIProgress/UIProgress.d.ts +0 -45
  188. package/dist/elements/UIScene/UIScene.Internal.d.ts +0 -43
  189. package/dist/elements/UIScene/UIScene.d.ts +0 -59
  190. package/dist/elements/UIText/UIText.Internal.d.ts +0 -26
  191. package/dist/elements/UIText/UIText.Measuring.d.ts +0 -50
  192. package/dist/elements/UIText/UIText.Rendering.d.ts +0 -20
  193. package/dist/elements/UIText/UIText.d.ts +0 -71
  194. package/dist/index.js +0 -9236
  195. package/dist/index.js.map +0 -1
  196. package/dist/index.min.js +0 -2
  197. package/dist/index.min.js.map +0 -1
  198. package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -63
  199. package/dist/layers/UILayer/UILayer.d.ts +0 -49
  200. package/dist/miscellaneous/UIExpression.d.ts +0 -69
  201. package/dist/miscellaneous/UIMode.d.ts +0 -23
  202. package/dist/miscellaneous/UIOrientation.d.ts +0 -15
  203. package/dist/miscellaneous/UIPriority.d.ts +0 -32
  204. package/dist/miscellaneous/UIRelation.d.ts +0 -23
  205. package/dist/miscellaneous/UITransparencyMode.d.ts +0 -9
  206. package/dist/miscellaneous/area/UIArea.d.ts +0 -3
  207. package/dist/miscellaneous/area/UIAreaCircle.d.ts +0 -15
  208. package/dist/miscellaneous/area/UIAreaPolygon.d.ts +0 -12
  209. package/dist/miscellaneous/area/UIAreaRectangle.d.ts +0 -17
  210. package/dist/miscellaneous/area/UIAreaRoundedRectangle.d.ts +0 -21
  211. package/dist/miscellaneous/asserts.d.ts +0 -43
  212. package/dist/miscellaneous/canvas.d.ts +0 -31
  213. package/dist/miscellaneous/color/UIColor.Internal.d.ts +0 -7
  214. package/dist/miscellaneous/color/UIColor.d.ts +0 -234
  215. package/dist/miscellaneous/computeTransform.d.ts +0 -18
  216. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -19
  217. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -1
  218. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -1
  219. package/dist/miscellaneous/generic-plane/shared.d.ts +0 -38
  220. package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +0 -11
  221. package/dist/miscellaneous/insets/UIInsets.d.ts +0 -48
  222. package/dist/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +0 -9
  223. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -21
  224. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -16
  225. package/dist/miscellaneous/math.d.ts +0 -5
  226. package/dist/miscellaneous/micro/UIMicro.Internal.d.ts +0 -31
  227. package/dist/miscellaneous/micro/UIMicro.d.ts +0 -59
  228. package/dist/miscellaneous/resize-policy/UIResizePolicy.d.ts +0 -3
  229. package/dist/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +0 -22
  230. package/dist/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +0 -22
  231. package/dist/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -22
  232. package/dist/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +0 -22
  233. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -22
  234. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -22
  235. package/dist/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +0 -5
  236. package/dist/miscellaneous/shared.d.ts +0 -46
  237. package/dist/miscellaneous/text-span/UITextSpan.d.ts +0 -14
  238. package/dist/miscellaneous/text-style/UITextStyle.Internal.d.ts +0 -48
  239. package/dist/miscellaneous/text-style/UITextStyle.d.ts +0 -85
  240. package/dist/miscellaneous/texture/UITextureView.Internal.d.ts +0 -49
  241. package/dist/miscellaneous/texture/UITextureView.d.ts +0 -67
  242. package/dist/miscellaneous/webglCapabilities.d.ts +0 -2
  243. package/dist/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +0 -17
  244. package/dist/wrappers/UIInputWrapper/UIInputWrapper.d.ts +0 -13
  245. package/dist/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +0 -13
  246. package/dist/wrappers/UISceneWrapper/UISceneWrapper.d.ts +0 -20
  247. package/dist/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +0 -49
  248. package/dist/wrappers/UISolverWrapper/UISolverWrapper.d.ts +0 -215
@@ -0,0 +1,259 @@
1
+ import type { Matrix3, Texture, Vector2 } from "three";
2
+ import { MathUtils } from "three";
3
+ import type { UILayer } from "../../layers/UILayer/UILayer";
4
+ import { assertValidNumber } from "../../miscellaneous/asserts";
5
+ import { UIColor } from "../../miscellaneous/color/UIColor";
6
+ import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
7
+ import { computeTrimmedTransformMatrix } from "../../miscellaneous/computeTransform";
8
+ import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
9
+ import type { UIProgressMaskFunction } from "../../miscellaneous/mask-function/UIProgressMaskFunction";
10
+ import { UIProgressMaskFunctionDirectional } from "../../miscellaneous/mask-function/UIProgressMaskFunctionDirectional";
11
+ import { UITextureView } from "../../miscellaneous/texture/UITextureView";
12
+ import { isUIModeVisible } from "../../miscellaneous/UIMode";
13
+ import source from "../../shaders/UIProgress.glsl";
14
+ import { UIElement } from "../UIElement/UIElement";
15
+ import type { UIProgressOptions } from "./UIProgress.Internal";
16
+ import { PROGRESS_DEFAULT_VALUE } from "./UIProgress.Internal";
17
+
18
+ /** Progress bar with customizable fill direction */
19
+ export class UIProgress extends UIElement {
20
+ /** Texture displayed by this element */
21
+ public readonly texture: UITextureView;
22
+
23
+ private readonly colorInternal: UIColor;
24
+ private readonly textureTransform: Matrix3;
25
+ private readonly textureResolution: Vector2;
26
+
27
+ private maskFunctionInternal: UIProgressMaskFunction;
28
+ private progressInternal: number;
29
+ private progressDirty = false;
30
+ private textureResolutionDirty = false;
31
+
32
+ /**
33
+ * Creates a new UIProgress instance.
34
+ *
35
+ * Defaults size to texture dimensions if width and height not provided.
36
+ *
37
+ * @param layer - Layer containing this element
38
+ * @param texture - Texture to display
39
+ * @param options - Configuration options
40
+ */
41
+ constructor(layer: UILayer, texture: Texture, options: Partial<UIProgressOptions> = {}) {
42
+ if (options.progress !== undefined) {
43
+ assertValidNumber(options.progress, "UIProgress.constructor.options.progress");
44
+ }
45
+
46
+ const color = new UIColor(options.color);
47
+ const textureView = new UITextureView(texture);
48
+ const textureTransform = textureView.calculateUVTransform();
49
+ const textureResolution = textureView.getResolution();
50
+
51
+ options.width = options.width ?? textureView.width;
52
+ options.height = options.height ?? textureView.height;
53
+
54
+ const progress = MathUtils.clamp(options.progress ?? PROGRESS_DEFAULT_VALUE, 0, 1);
55
+
56
+ const maskFunction = options.maskFunction ?? new UIProgressMaskFunctionDirectional();
57
+
58
+ super(
59
+ layer,
60
+ maskFunction.source + source,
61
+ {
62
+ texture: textureView.texture,
63
+ textureTransform,
64
+ textureResolution,
65
+ color,
66
+ progress,
67
+ ...maskFunction.enumerateProperties(),
68
+ },
69
+ options,
70
+ );
71
+
72
+ this.texture = textureView;
73
+ this.textureTransform = textureTransform;
74
+ this.textureResolution = textureResolution;
75
+ this.colorInternal = color;
76
+ this.progressInternal = progress;
77
+ this.maskFunctionInternal = maskFunction;
78
+
79
+ this.texture.signalDiminsionsChanged.on(this.onTextureDimensionsChanged);
80
+ }
81
+
82
+ /** Multiplicative tint. Alpha channel controls opacity. */
83
+ public get color(): UIColor {
84
+ return this.colorInternal;
85
+ }
86
+
87
+ /** Function controlling fill direction and shape */
88
+ public get maskFunction(): UIProgressMaskFunction {
89
+ return this.maskFunctionInternal;
90
+ }
91
+
92
+ /** Progress from 0 (empty) to 1 (full) */
93
+ public get progress(): number {
94
+ return this.progressInternal;
95
+ }
96
+
97
+ /** Multiplicative tint. Alpha channel controls opacity. */
98
+ public set color(value: UIColorConfig) {
99
+ this.colorInternal.set(value);
100
+ }
101
+
102
+ /** Function controlling fill direction and shape */
103
+ public set maskFunction(value: UIProgressMaskFunction) {
104
+ if (this.maskFunctionInternal !== value) {
105
+ this.maskFunctionInternal = value;
106
+ this.rebuildPlane();
107
+ }
108
+ }
109
+
110
+ /** Progress from 0 (empty) to 1 (full). Clamped. */
111
+ public set progress(value: number) {
112
+ assertValidNumber(value, "UIProgress.progress");
113
+ value = MathUtils.clamp(value, 0, 1);
114
+ if (this.progressInternal !== value) {
115
+ this.progressInternal = value;
116
+ this.progressDirty = true;
117
+ }
118
+ }
119
+
120
+ protected override setPlaneTransform(): void {
121
+ let properties: Record<string, UIProperty> | undefined;
122
+
123
+ if (this.colorInternal.dirty) {
124
+ properties ??= {};
125
+ properties["color"] = this.colorInternal;
126
+ this.colorInternal.setDirtyFalse();
127
+ }
128
+
129
+ if (this.texture.textureDirty) {
130
+ properties ??= {};
131
+ properties["texture"] = this.texture.texture;
132
+ this.texture.setTextureDirtyFalse();
133
+ }
134
+
135
+ if (this.texture.uvTransformDirty) {
136
+ properties ??= {};
137
+ properties["textureTransform"] = this.texture.calculateUVTransform(this.textureTransform);
138
+ this.texture.setUVTransformDirtyFalse();
139
+ }
140
+
141
+ if (this.progressDirty) {
142
+ properties ??= {};
143
+ properties["progress"] = this.progressInternal;
144
+ this.progressDirty = false;
145
+ }
146
+
147
+ if (this.textureResolutionDirty) {
148
+ properties ??= {};
149
+ properties["textureResolution"] = this.texture.getResolution(this.textureResolution);
150
+ this.textureResolutionDirty = false;
151
+ }
152
+
153
+ if (this.maskFunction.dirty) {
154
+ properties ??= {};
155
+ const maskProperties = this.maskFunction.enumerateProperties();
156
+ for (const key in maskProperties) {
157
+ properties[key] = maskProperties[key];
158
+ }
159
+ this.maskFunction.setDirtyFalse();
160
+ }
161
+
162
+ if (properties) {
163
+ this.sceneWrapper.setProperties(this.planeHandler, properties);
164
+ }
165
+
166
+ const isTransformDirty =
167
+ this.micro.dirty ||
168
+ this.texture.trimDirty ||
169
+ this.inputWrapper.dirty ||
170
+ this.solverWrapper.dirty;
171
+
172
+ if (isTransformDirty) {
173
+ const micro = this.micro;
174
+ const textureTrim = this.texture.trim;
175
+
176
+ this.sceneWrapper.setTransform(
177
+ this.planeHandler,
178
+ computeTrimmedTransformMatrix(
179
+ this.x,
180
+ this.y,
181
+ this.width,
182
+ this.height,
183
+ this.zIndex,
184
+ micro.x,
185
+ micro.y,
186
+ micro.anchorX,
187
+ micro.anchorY,
188
+ micro.scaleX,
189
+ micro.scaleY,
190
+ micro.rotation,
191
+ micro.anchorMode,
192
+ textureTrim.left,
193
+ textureTrim.right,
194
+ textureTrim.top,
195
+ textureTrim.bottom,
196
+ ),
197
+ );
198
+ this.micro.setDirtyFalse();
199
+ this.texture.setTrimDirtyFalse();
200
+ }
201
+ }
202
+
203
+ private readonly onTextureDimensionsChanged = (width: number, height: number): void => {
204
+ if (this.width !== width || this.height !== height) {
205
+ this.width = width;
206
+ this.height = height;
207
+ this.textureResolutionDirty = true;
208
+ }
209
+ };
210
+
211
+ private rebuildPlane(): void {
212
+ this.sceneWrapper.destroyPlane(this.planeHandler);
213
+
214
+ const micro = this.micro;
215
+ const textureTrim = this.texture.trim;
216
+
217
+ this.planeHandler = this.sceneWrapper.createPlane(
218
+ this.maskFunctionInternal.source + source,
219
+ {
220
+ texture: this.texture.texture,
221
+ textureTransform: this.texture.calculateUVTransform(this.textureTransform),
222
+ textureResolution: this.texture.getResolution(this.textureResolution),
223
+ color: this.colorInternal,
224
+ progress: this.progressInternal,
225
+ ...this.maskFunctionInternal.enumerateProperties(),
226
+ },
227
+ computeTrimmedTransformMatrix(
228
+ this.x,
229
+ this.y,
230
+ this.width,
231
+ this.height,
232
+ this.zIndex,
233
+ micro.x,
234
+ micro.y,
235
+ micro.anchorX,
236
+ micro.anchorY,
237
+ micro.scaleX,
238
+ micro.scaleY,
239
+ micro.rotation,
240
+ micro.anchorMode,
241
+ textureTrim.left,
242
+ textureTrim.right,
243
+ textureTrim.top,
244
+ textureTrim.bottom,
245
+ ),
246
+ isUIModeVisible(this.mode),
247
+ this.transparencyMode,
248
+ );
249
+
250
+ this.colorInternal.setDirtyFalse();
251
+ this.texture.setTextureDirtyFalse();
252
+ this.texture.setUVTransformDirtyFalse();
253
+ this.texture.setTrimDirtyFalse();
254
+ this.progressDirty = false;
255
+ this.textureResolutionDirty = false;
256
+ this.maskFunctionInternal.setDirtyFalse();
257
+ this.micro.setDirtyFalse();
258
+ }
259
+ }
@@ -0,0 +1,46 @@
1
+ import type { Camera, Scene } from "three";
2
+ import { UIColor } from "../../miscellaneous/color/UIColor";
3
+ import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
4
+ import type { UIElementOptions } from "../UIElement/UIElement.Internal";
5
+
6
+ /** Controls when scene re-renders */
7
+ export enum UISceneUpdateMode {
8
+ /** Re-render every frame */
9
+ EVERY_FRAME = 1,
10
+ /** Re-render every other frame */
11
+ EVERY_SECOND_FRAME = 2,
12
+ /** Re-render when scene, camera, or updateMode changes */
13
+ ON_PROPERTIES_CHANGE = 3,
14
+ /** Re-render when dimensions or resolutionFactor changes */
15
+ ON_DIMENSIONS_CHANGE = 4,
16
+ /** Re-render only via requestUpdate() */
17
+ MANUAL = 5,
18
+ }
19
+
20
+ /** Configuration options for UIScene */
21
+ export interface UISceneOptions extends UIElementOptions {
22
+ /** Multiplicative tint */
23
+ color: UIColorConfig;
24
+ /** Three.js scene to render */
25
+ scene: Scene;
26
+ /** Camera used for rendering */
27
+ camera: Camera;
28
+ /** When to re-render */
29
+ updateMode: UISceneUpdateMode;
30
+ /** Render target resolution multiplier. Range 0.1 to 2.0. */
31
+ resolutionFactor: number;
32
+ /** Background color */
33
+ clearColor: UIColorConfig;
34
+ /** Whether to use depth buffer */
35
+ enableDepthBuffer: boolean;
36
+ }
37
+
38
+ export const SCENE_DEFAULT_RESOLUTION_FACTOR = 0.5;
39
+ export const SCENE_MIN_RESOLUTION_FACTOR = 0.1;
40
+ export const SCENE_MAX_RESOLUTION_FACTOR = 2;
41
+ export const SCENE_DEFAULT_CAMERA_FOV = 60;
42
+ export const SCENE_DEFAULT_CAMERA_NEAR = 0.1;
43
+ export const SCENE_DEFAULT_CAMERA_FAR = 100;
44
+ export const SCENE_DEFAULT_UPDATE_MODE = UISceneUpdateMode.ON_PROPERTIES_CHANGE;
45
+ export const SCENE_DEFAULT_CLEAR_COLOR = new UIColor(0, 0, 0, 1);
46
+ export const SCENE_DEFAULT_USE_DEPTH = true;
@@ -0,0 +1,259 @@
1
+ import type { Camera, WebGLRenderer } from "three";
2
+ import {
3
+ LinearFilter,
4
+ MathUtils,
5
+ Matrix3,
6
+ PerspectiveCamera,
7
+ RGBAFormat,
8
+ Scene,
9
+ UnsignedByteType,
10
+ WebGLRenderTarget,
11
+ } from "three";
12
+ import type { UILayer } from "../../layers/UILayer/UILayer";
13
+ import { assertValidPositiveNumber } from "../../miscellaneous/asserts";
14
+ import { UIColor } from "../../miscellaneous/color/UIColor";
15
+ import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
16
+ import source from "../../shaders/UIImage.glsl";
17
+ import {
18
+ DUMMY_DEFAULT_HEIGHT,
19
+ DUMMY_DEFAULT_WIDTH,
20
+ } from "../UIDummy/UIDummy.Internal";
21
+ import { UIElement } from "../UIElement/UIElement";
22
+ import type { UISceneOptions } from "./UIScene.Internal";
23
+ import {
24
+ SCENE_DEFAULT_CAMERA_FAR,
25
+ SCENE_DEFAULT_CAMERA_FOV,
26
+ SCENE_DEFAULT_CAMERA_NEAR,
27
+ SCENE_DEFAULT_CLEAR_COLOR,
28
+ SCENE_DEFAULT_RESOLUTION_FACTOR,
29
+ SCENE_DEFAULT_UPDATE_MODE,
30
+ SCENE_DEFAULT_USE_DEPTH,
31
+ SCENE_MAX_RESOLUTION_FACTOR,
32
+ SCENE_MIN_RESOLUTION_FACTOR,
33
+ UISceneUpdateMode,
34
+ } from "./UIScene.Internal";
35
+
36
+ /** Renders Three.js scene to texture */
37
+ export class UIScene extends UIElement {
38
+ private readonly colorInternal: UIColor;
39
+ private readonly clearColorInternal: UIColor;
40
+ private readonly renderTarget: WebGLRenderTarget;
41
+ private sceneInternal: Scene;
42
+ private cameraInternal: Camera;
43
+ private updateModeInternal: UISceneUpdateMode;
44
+ private resolutionFactorInternal: number;
45
+ private evenFrame = true;
46
+
47
+ private updateRequired = false;
48
+ private resolutionFactorDirty = false;
49
+ private propertyDirty = false;
50
+
51
+ /**
52
+ * Creates a new UIScene instance.
53
+ *
54
+ * @param layer - Layer containing this element
55
+ * @param options - Configuration options
56
+ * @throws If resolutionFactor outside range 0.1 to 2.0
57
+ */
58
+ constructor(layer: UILayer, options: Partial<UISceneOptions> = {}) {
59
+ if (options.resolutionFactor !== undefined) {
60
+ assertValidPositiveNumber(
61
+ options.resolutionFactor,
62
+ "UIScene.constructor.resolutionFactor",
63
+ );
64
+ }
65
+
66
+ const resolutionFactor = MathUtils.clamp(
67
+ options.resolutionFactor ?? SCENE_DEFAULT_RESOLUTION_FACTOR,
68
+ SCENE_MIN_RESOLUTION_FACTOR,
69
+ SCENE_MAX_RESOLUTION_FACTOR,
70
+ );
71
+
72
+ const w = options.width ?? DUMMY_DEFAULT_WIDTH;
73
+ const h = options.height ?? DUMMY_DEFAULT_HEIGHT;
74
+
75
+ const renderTarget = new WebGLRenderTarget(
76
+ w * resolutionFactor,
77
+ h * resolutionFactor,
78
+ {
79
+ format: RGBAFormat,
80
+ minFilter: LinearFilter,
81
+ magFilter: LinearFilter,
82
+ type: UnsignedByteType,
83
+ depthBuffer: options.enableDepthBuffer ?? SCENE_DEFAULT_USE_DEPTH,
84
+ stencilBuffer: false,
85
+ },
86
+ );
87
+
88
+ const color = new UIColor(options.color);
89
+
90
+ super(
91
+ layer,
92
+ source,
93
+ {
94
+ texture: renderTarget.texture,
95
+ textureTransform: new Matrix3(),
96
+ color,
97
+ },
98
+ options,
99
+ );
100
+
101
+ this.colorInternal = color;
102
+ this.clearColorInternal = new UIColor(
103
+ options.clearColor ?? SCENE_DEFAULT_CLEAR_COLOR,
104
+ );
105
+
106
+ this.renderTarget = renderTarget;
107
+ this.sceneInternal = options.scene ?? new Scene();
108
+
109
+ this.cameraInternal =
110
+ options.camera ??
111
+ new PerspectiveCamera(
112
+ SCENE_DEFAULT_CAMERA_FOV,
113
+ w / h,
114
+ SCENE_DEFAULT_CAMERA_NEAR,
115
+ SCENE_DEFAULT_CAMERA_FAR,
116
+ );
117
+
118
+ this.resolutionFactorInternal = resolutionFactor;
119
+ this.updateModeInternal = options.updateMode ?? SCENE_DEFAULT_UPDATE_MODE;
120
+ this.propertyDirty = options.updateMode !== UISceneUpdateMode.MANUAL;
121
+ }
122
+
123
+ /** Camera used for rendering */
124
+ public get camera(): Camera {
125
+ return this.cameraInternal;
126
+ }
127
+
128
+ /** Background color for render target */
129
+ public get clearColor(): UIColor {
130
+ return this.clearColorInternal;
131
+ }
132
+
133
+ /** Multiplicative tint. Alpha channel controls opacity. */
134
+ public get color(): UIColor {
135
+ return this.colorInternal;
136
+ }
137
+
138
+ /** Render target resolution multiplier. Range 0.1 to 2.0. */
139
+ public get resolutionFactor(): number {
140
+ return this.resolutionFactorInternal;
141
+ }
142
+
143
+ /** Three.js scene to render */
144
+ public get scene(): Scene {
145
+ return this.sceneInternal;
146
+ }
147
+
148
+ /** Controls when scene re-renders */
149
+ public get updateMode(): UISceneUpdateMode {
150
+ return this.updateModeInternal;
151
+ }
152
+
153
+ /** Camera used for rendering */
154
+ public set camera(value: Camera) {
155
+ if (this.cameraInternal !== value) {
156
+ this.cameraInternal = value;
157
+ this.propertyDirty = true;
158
+ }
159
+ }
160
+
161
+ /** Background color for render target */
162
+ public set clearColor(value: UIColorConfig) {
163
+ this.clearColorInternal.set(value);
164
+ }
165
+
166
+ /** Multiplicative tint. Alpha channel controls opacity. */
167
+ public set color(value: UIColorConfig) {
168
+ this.colorInternal.set(value);
169
+ }
170
+
171
+ /** Render target resolution multiplier. Range 0.1 to 2.0. */
172
+ public set resolutionFactor(value: number) {
173
+ assertValidPositiveNumber(value, "UIScene.resolutionFactor");
174
+ value = MathUtils.clamp(
175
+ value,
176
+ SCENE_MIN_RESOLUTION_FACTOR,
177
+ SCENE_MAX_RESOLUTION_FACTOR,
178
+ );
179
+ if (this.resolutionFactorInternal !== value) {
180
+ this.resolutionFactorInternal = value;
181
+ this.resolutionFactorDirty = true;
182
+ }
183
+ }
184
+
185
+ /** Three.js scene to render */
186
+ public set scene(value: Scene) {
187
+ if (this.sceneInternal !== value) {
188
+ this.sceneInternal = value;
189
+ this.propertyDirty = true;
190
+ }
191
+ }
192
+
193
+ /** Controls when scene re-renders */
194
+ public set updateMode(value: UISceneUpdateMode) {
195
+ if (this.updateModeInternal !== value) {
196
+ this.updateModeInternal = value;
197
+ this.propertyDirty = true;
198
+ }
199
+ }
200
+
201
+ /** Removes element and frees resources */
202
+ public override destroy(): void {
203
+ this.renderTarget.dispose();
204
+ super.destroy();
205
+ }
206
+
207
+ /** Triggers re-render on next frame. Useful in MANUAL mode. */
208
+ public requestUpdate(): void {
209
+ this.updateRequired = true;
210
+ }
211
+
212
+ protected override onWillRender(
213
+ renderer: WebGLRenderer,
214
+ deltaTime: number,
215
+ ): void {
216
+ this.evenFrame = !this.evenFrame;
217
+
218
+ const isFramebufferDirty =
219
+ this.updateRequired ||
220
+ this.updateModeInternal === UISceneUpdateMode.EVERY_FRAME ||
221
+ (this.updateModeInternal === UISceneUpdateMode.EVERY_SECOND_FRAME &&
222
+ this.evenFrame) ||
223
+ (this.updateModeInternal === UISceneUpdateMode.ON_PROPERTIES_CHANGE &&
224
+ this.propertyDirty) ||
225
+ this.colorInternal.dirty ||
226
+ this.clearColorInternal.dirty ||
227
+ (this.updateModeInternal === UISceneUpdateMode.ON_DIMENSIONS_CHANGE &&
228
+ (this.resolutionFactorDirty || this.solverWrapper.dirty));
229
+
230
+ if (isFramebufferDirty) {
231
+ if (this.resolutionFactorDirty || this.solverWrapper.dirty) {
232
+ this.renderTarget.setSize(
233
+ this.width * this.resolutionFactorInternal,
234
+ this.height * this.resolutionFactorInternal,
235
+ );
236
+ this.resolutionFactorDirty = false;
237
+ }
238
+
239
+ if (this.colorInternal.dirty) {
240
+ this.sceneWrapper.setProperties(this.planeHandler, {
241
+ color: this.colorInternal,
242
+ });
243
+ this.colorInternal.setDirtyFalse();
244
+ }
245
+
246
+ renderer.setClearColor(
247
+ this.clearColorInternal.getHexRGB(),
248
+ this.clearColorInternal.a,
249
+ );
250
+ renderer.setRenderTarget(this.renderTarget);
251
+ renderer.clear(true, true, false);
252
+ renderer.render(this.sceneInternal, this.cameraInternal);
253
+
254
+ this.propertyDirty = false;
255
+ this.updateRequired = false;
256
+ }
257
+ super.onWillRender(renderer, deltaTime);
258
+ }
259
+ }
@@ -1,32 +1,37 @@
1
1
  import type { UITextSpanConfig } from "../../miscellaneous/text-span/UITextSpan.Internal";
2
2
  import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal";
3
+
3
4
  /** Text content configuration */
4
5
  export type UITextContent = (UITextSpanConfig | string)[] | UITextSpanConfig | string;
6
+
5
7
  /** Text dimensions */
6
8
  export interface UITextSize {
7
- /** Width in pixels */
8
- width: number;
9
- /** Height in pixels */
10
- height: number;
9
+ /** Width in pixels */
10
+ width: number;
11
+ /** Height in pixels */
12
+ height: number;
11
13
  }
14
+
12
15
  /** Text chunk metrics */
13
16
  export interface UIChunkMetrics extends UITextSize {
14
- /** Baseline offset from top in pixels */
15
- baseline: number;
16
- /** Line height in pixels */
17
- lineHeight: number;
17
+ /** Baseline offset from top in pixels */
18
+ baseline: number;
19
+ /** Line height in pixels */
20
+ lineHeight: number;
18
21
  }
22
+
19
23
  /** Styled text chunk */
20
24
  export interface UITextChunk {
21
- /** Text content */
22
- text: string;
23
- /** Resolved style */
24
- style: UITextStyleConfig;
25
- /** Chunk metrics */
26
- metrics: UIChunkMetrics;
25
+ /** Text content */
26
+ text: string;
27
+ /** Resolved style */
28
+ style: UITextStyleConfig;
29
+ /** Chunk metrics */
30
+ metrics: UIChunkMetrics;
27
31
  }
32
+
28
33
  /** Line of text chunks */
29
34
  export interface UITextLine extends UIChunkMetrics {
30
- /** Chunks in this line */
31
- chunks: UITextChunk[];
35
+ /** Chunks in this line */
36
+ chunks: UITextChunk[];
32
37
  }
@@ -0,0 +1,29 @@
1
+ import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
2
+ import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal";
3
+ import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal";
4
+ import type { UIElementOptions } from "../UIElement/UIElement.Internal";
5
+
6
+ /** Controls how text adapts to element size */
7
+ export enum UITextResizeMode {
8
+ /** Break text into multiple lines when narrower than content*/
9
+ BREAK = 0,
10
+ /** Scale text to fit fixed element size */
11
+ SCALE = 1,
12
+ }
13
+
14
+ /** Configuration options for UIText */
15
+ export interface UITextOptions extends UIElementOptions {
16
+ /** Multiplicative tint */
17
+ color: UIColorConfig;
18
+ /** Text padding in world units */
19
+ padding: UIInsetsConfig;
20
+ /** Default style applied to all spans */
21
+ commonStyle: Partial<UITextStyleConfig>;
22
+ /** How text adapts to size constraints */
23
+ resizeMode: UITextResizeMode;
24
+ /** Maximum line width before wrapping in pixels */
25
+ maxLineWidth: number;
26
+ }
27
+
28
+ export const TEXT_DEFAULT_MAX_LINE_WIDTH = 1024;
29
+ export const TEXT_DEFAULT_RESIZE_MODE = UITextResizeMode.SCALE;