@lightningjs/renderer 0.7.5 → 0.7.6

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 (218) hide show
  1. package/LICENSE +202 -202
  2. package/NOTICE +3 -3
  3. package/README.md +229 -221
  4. package/dist/src/common/CommonTypes.d.ts +6 -0
  5. package/dist/src/core/CoreNode.d.ts +21 -4
  6. package/dist/src/core/CoreNode.js +145 -34
  7. package/dist/src/core/CoreNode.js.map +1 -1
  8. package/dist/src/core/CoreTextNode.d.ts +1 -1
  9. package/dist/src/core/CoreTextNode.js +18 -10
  10. package/dist/src/core/CoreTextNode.js.map +1 -1
  11. package/dist/src/core/CoreTextureManager.d.ts +3 -1
  12. package/dist/src/core/CoreTextureManager.js +9 -2
  13. package/dist/src/core/CoreTextureManager.js.map +1 -1
  14. package/dist/src/core/Stage.d.ts +2 -0
  15. package/dist/src/core/Stage.js +9 -1
  16. package/dist/src/core/Stage.js.map +1 -1
  17. package/dist/src/core/lib/ImageWorker.d.ts +0 -1
  18. package/dist/src/core/lib/ImageWorker.js +55 -40
  19. package/dist/src/core/lib/ImageWorker.js.map +1 -1
  20. package/dist/src/core/lib/RenderCoords.d.ts +13 -0
  21. package/dist/src/core/lib/RenderCoords.js +63 -0
  22. package/dist/src/core/lib/RenderCoords.js.map +1 -0
  23. package/dist/src/core/lib/WebGlContext.d.ts +414 -0
  24. package/dist/src/core/lib/WebGlContext.js +640 -0
  25. package/dist/src/core/lib/WebGlContext.js.map +1 -0
  26. package/dist/src/core/lib/utils.d.ts +1 -0
  27. package/dist/src/core/lib/utils.js +6 -0
  28. package/dist/src/core/lib/utils.js.map +1 -1
  29. package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js +4 -1
  30. package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js.map +1 -1
  31. package/dist/src/core/renderers/webgl/internal/RendererUtils.d.ts +9 -0
  32. package/dist/src/core/renderers/webgl/internal/RendererUtils.js +14 -0
  33. package/dist/src/core/renderers/webgl/internal/RendererUtils.js.map +1 -1
  34. package/dist/src/core/renderers/webgl/shaders/DefaultShader.js +47 -47
  35. package/dist/src/core/renderers/webgl/shaders/DefaultShaderBatched.js +61 -61
  36. package/dist/src/core/renderers/webgl/shaders/DynamicShader.js +93 -93
  37. package/dist/src/core/renderers/webgl/shaders/RoundedRectangle.js +63 -63
  38. package/dist/src/core/renderers/webgl/shaders/SdfShader.js +49 -49
  39. package/dist/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.js +15 -15
  40. package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js +5 -5
  41. package/dist/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.js +15 -15
  42. package/dist/src/core/renderers/webgl/shaders/effects/BorderRightEffect.js +15 -15
  43. package/dist/src/core/renderers/webgl/shaders/effects/BorderTopEffect.js +15 -15
  44. package/dist/src/core/renderers/webgl/shaders/effects/FadeOutEffect.js +42 -42
  45. package/dist/src/core/renderers/webgl/shaders/effects/GlitchEffect.js +44 -44
  46. package/dist/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.js +3 -3
  47. package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js +31 -31
  48. package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js +13 -13
  49. package/dist/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.js +37 -37
  50. package/dist/src/core/renderers/webgl/shaders/effects/RadiusEffect.js +19 -19
  51. package/dist/src/core/scene/Scene.d.ts +59 -0
  52. package/dist/src/core/scene/Scene.js +106 -0
  53. package/dist/src/core/scene/Scene.js.map +1 -0
  54. package/dist/src/core/text-rendering/TrFontManager.js +30 -25
  55. package/dist/src/core/text-rendering/TrFontManager.js.map +1 -1
  56. package/dist/src/core/text-rendering/renderers/CanvasTextRenderer.js +8 -2
  57. package/dist/src/core/text-rendering/renderers/CanvasTextRenderer.js.map +1 -1
  58. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js +8 -2
  59. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js.map +1 -1
  60. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/findNearestMultiple.d.ts +8 -0
  61. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/findNearestMultiple.js +29 -0
  62. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/findNearestMultiple.js.map +1 -0
  63. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/SdfBufferHelper.d.ts +19 -0
  64. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/SdfBufferHelper.js +84 -0
  65. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/SdfBufferHelper.js.map +1 -0
  66. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutLine.d.ts +8 -0
  67. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutLine.js +40 -0
  68. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutLine.js.map +1 -0
  69. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutText2.d.ts +2 -0
  70. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutText2.js +41 -0
  71. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutText2.js.map +1 -0
  72. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/utils.d.ts +1 -0
  73. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/utils.js +4 -0
  74. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/utils.js.map +1 -0
  75. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2.d.ts +1 -0
  76. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2.js +2 -0
  77. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2.js.map +1 -0
  78. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.d.ts +20 -0
  79. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.js +55 -0
  80. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.js.map +1 -0
  81. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/roundUpToMultiple.d.ts +9 -0
  82. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/roundUpToMultiple.js +32 -0
  83. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/roundUpToMultiple.js.map +1 -0
  84. package/dist/src/core/text-rendering/renderers/TextRenderer.d.ts +12 -0
  85. package/dist/src/core/text-rendering/renderers/TextRenderer.js.map +1 -1
  86. package/dist/src/core/textures/ImageTexture.js +16 -2
  87. package/dist/src/core/textures/ImageTexture.js.map +1 -1
  88. package/dist/src/core/textures/Texture.d.ts +1 -1
  89. package/dist/src/core/textures/Texture.js.map +1 -1
  90. package/dist/src/core/utils.d.ts +1 -1
  91. package/dist/src/main-api/RendererMain.d.ts +6 -0
  92. package/dist/src/main-api/RendererMain.js +1 -0
  93. package/dist/src/main-api/RendererMain.js.map +1 -1
  94. package/dist/src/render-drivers/main/MainCoreDriver.js +1 -0
  95. package/dist/src/render-drivers/main/MainCoreDriver.js.map +1 -1
  96. package/dist/src/render-drivers/main/MainOnlyNode.d.ts +4 -0
  97. package/dist/src/render-drivers/main/MainOnlyNode.js +22 -0
  98. package/dist/src/render-drivers/main/MainOnlyNode.js.map +1 -1
  99. package/dist/src/render-drivers/threadx/ThreadXCoreDriver.js +1 -0
  100. package/dist/src/render-drivers/threadx/ThreadXCoreDriver.js.map +1 -1
  101. package/dist/src/render-drivers/threadx/ThreadXRendererMessage.d.ts +1 -0
  102. package/dist/src/render-drivers/threadx/ThreadXRendererMessage.js.map +1 -1
  103. package/dist/src/render-drivers/threadx/worker/renderer.js +1 -0
  104. package/dist/src/render-drivers/threadx/worker/renderer.js.map +1 -1
  105. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  106. package/exports/core-api.ts +102 -102
  107. package/exports/main-api.ts +60 -60
  108. package/exports/utils.ts +41 -41
  109. package/package.json +1 -1
  110. package/scripts/please-use-pnpm.js +13 -13
  111. package/src/common/CommonTypes.ts +125 -113
  112. package/src/common/EventEmitter.ts +77 -77
  113. package/src/common/IAnimationController.ts +29 -29
  114. package/src/core/CoreExtension.ts +32 -32
  115. package/src/core/CoreNode.ts +1114 -955
  116. package/src/core/CoreShaderManager.ts +243 -243
  117. package/src/core/CoreTextNode.ts +399 -391
  118. package/src/core/CoreTextureManager.ts +337 -326
  119. package/src/core/Stage.ts +365 -354
  120. package/src/core/animations/AnimationManager.ts +38 -38
  121. package/src/core/animations/CoreAnimation.ts +181 -181
  122. package/src/core/animations/CoreAnimationController.ts +148 -148
  123. package/src/core/lib/ContextSpy.ts +41 -41
  124. package/src/core/lib/ImageWorker.ts +149 -135
  125. package/src/core/lib/Matrix3d.ts +290 -290
  126. package/src/core/lib/RenderCoords.ts +86 -0
  127. package/src/core/lib/WebGlContextWrapper.ts +992 -992
  128. package/src/core/lib/textureCompression.ts +152 -152
  129. package/src/core/lib/utils.ts +250 -241
  130. package/src/core/platform.ts +46 -46
  131. package/src/core/renderers/CoreContextTexture.ts +30 -30
  132. package/src/core/renderers/CoreRenderOp.ts +22 -22
  133. package/src/core/renderers/CoreRenderer.ts +63 -63
  134. package/src/core/renderers/CoreShader.ts +41 -41
  135. package/src/core/renderers/webgl/WebGlCoreCtxSubTexture.ts +37 -37
  136. package/src/core/renderers/webgl/WebGlCoreCtxTexture.ts +233 -230
  137. package/src/core/renderers/webgl/WebGlCoreRenderOp.ts +107 -107
  138. package/src/core/renderers/webgl/WebGlCoreRenderer.ts +520 -520
  139. package/src/core/renderers/webgl/WebGlCoreShader.ts +337 -337
  140. package/src/core/renderers/webgl/internal/BufferCollection.ts +54 -54
  141. package/src/core/renderers/webgl/internal/RendererUtils.ts +148 -131
  142. package/src/core/renderers/webgl/internal/ShaderUtils.ts +136 -136
  143. package/src/core/renderers/webgl/internal/WebGlUtils.ts +35 -35
  144. package/src/core/renderers/webgl/shaders/DefaultShader.ts +95 -95
  145. package/src/core/renderers/webgl/shaders/DefaultShaderBatched.ts +132 -132
  146. package/src/core/renderers/webgl/shaders/DynamicShader.ts +474 -474
  147. package/src/core/renderers/webgl/shaders/RoundedRectangle.ts +161 -161
  148. package/src/core/renderers/webgl/shaders/SdfShader.ts +174 -174
  149. package/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.ts +101 -101
  150. package/src/core/renderers/webgl/shaders/effects/BorderEffect.ts +86 -86
  151. package/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.ts +101 -101
  152. package/src/core/renderers/webgl/shaders/effects/BorderRightEffect.ts +101 -101
  153. package/src/core/renderers/webgl/shaders/effects/BorderTopEffect.ts +101 -101
  154. package/src/core/renderers/webgl/shaders/effects/EffectUtils.ts +33 -33
  155. package/src/core/renderers/webgl/shaders/effects/FadeOutEffect.ts +135 -135
  156. package/src/core/renderers/webgl/shaders/effects/GlitchEffect.ts +145 -145
  157. package/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.ts +67 -67
  158. package/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts +176 -176
  159. package/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts +159 -159
  160. package/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.ts +186 -186
  161. package/src/core/renderers/webgl/shaders/effects/RadiusEffect.ts +121 -121
  162. package/src/core/renderers/webgl/shaders/effects/ShaderEffect.ts +114 -114
  163. package/src/core/text-rendering/TextTextureRendererUtils.ts +189 -189
  164. package/src/core/text-rendering/TrFontManager.ts +170 -166
  165. package/src/core/text-rendering/font-face-types/SdfTrFontFace/SdfTrFontFace.ts +141 -141
  166. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/FontShaper.ts +139 -139
  167. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.test.ts +173 -173
  168. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.ts +169 -169
  169. package/src/core/text-rendering/font-face-types/TrFontFace.ts +105 -105
  170. package/src/core/text-rendering/font-face-types/WebTrFontFace.ts +77 -77
  171. package/src/core/text-rendering/renderers/CanvasTextRenderer.ts +757 -751
  172. package/src/core/text-rendering/renderers/LightningTextTextureRenderer.ts +741 -741
  173. package/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.ts +784 -778
  174. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.test.ts +48 -48
  175. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.ts +66 -66
  176. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/SpecialCodepoints.ts +52 -52
  177. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/constants.ts +32 -32
  178. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getStartConditions.ts +84 -84
  179. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.test.ts +133 -133
  180. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.ts +38 -38
  181. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText.ts +393 -393
  182. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.test.ts +49 -49
  183. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.ts +51 -51
  184. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.test.ts +205 -205
  185. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.ts +93 -93
  186. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/util.ts +40 -40
  187. package/src/core/text-rendering/renderers/TextRenderer.ts +516 -504
  188. package/src/core/textures/ColorTexture.ts +86 -86
  189. package/src/core/textures/ImageTexture.ts +154 -140
  190. package/src/core/textures/NoiseTexture.ts +96 -96
  191. package/src/core/textures/SubTexture.ts +143 -143
  192. package/src/core/textures/Texture.ts +224 -218
  193. package/src/core/utils.ts +224 -224
  194. package/src/env.d.ts +7 -7
  195. package/src/main-api/ICoreDriver.ts +66 -66
  196. package/src/main-api/INode.ts +499 -499
  197. package/src/main-api/Inspector.ts +439 -439
  198. package/src/main-api/RendererMain.ts +659 -652
  199. package/src/main-api/texture-usage-trackers/FinalizationRegistryTextureUsageTracker.ts +45 -45
  200. package/src/main-api/texture-usage-trackers/ManualCountTextureUsageTracker.ts +154 -154
  201. package/src/main-api/texture-usage-trackers/TextureUsageTracker.ts +54 -54
  202. package/src/render-drivers/main/MainCoreDriver.ts +149 -148
  203. package/src/render-drivers/main/MainOnlyNode.ts +494 -466
  204. package/src/render-drivers/main/MainOnlyTextNode.ts +261 -261
  205. package/src/render-drivers/threadx/NodeStruct.ts +300 -300
  206. package/src/render-drivers/threadx/SharedNode.ts +97 -97
  207. package/src/render-drivers/threadx/TextNodeStruct.ts +211 -211
  208. package/src/render-drivers/threadx/ThreadXCoreDriver.ts +286 -285
  209. package/src/render-drivers/threadx/ThreadXMainAnimationController.ts +99 -99
  210. package/src/render-drivers/threadx/ThreadXMainNode.ts +192 -192
  211. package/src/render-drivers/threadx/ThreadXMainTextNode.ts +85 -85
  212. package/src/render-drivers/threadx/ThreadXRendererMessage.ts +111 -110
  213. package/src/render-drivers/threadx/worker/ThreadXRendererNode.ts +238 -238
  214. package/src/render-drivers/threadx/worker/ThreadXRendererTextNode.ts +149 -149
  215. package/src/render-drivers/threadx/worker/renderer.ts +152 -151
  216. package/src/render-drivers/utils.ts +97 -97
  217. package/src/utils.ts +207 -207
  218. package/COPYING +0 -1
@@ -1,499 +1,499 @@
1
- /*
2
- * If not stated otherwise in this file or this component's LICENSE file the
3
- * following copyright and licenses apply:
4
- *
5
- * Copyright 2023 Comcast Cable Communications Management, LLC.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the License);
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
-
20
- import type { IEventEmitter } from '@lightningjs/threadx';
21
- import type { IAnimationController } from '../common/IAnimationController.js';
22
- import type { ShaderRef, TextureRef } from './RendererMain.js';
23
- import type {
24
- TextRendererMap,
25
- TrProps,
26
- } from '../core/text-rendering/renderers/TextRenderer.js';
27
- import type { AnimationSettings } from '../core/animations/CoreAnimation.js';
28
-
29
- /**
30
- * Writable properties of a Node.
31
- */
32
- export interface INodeWritableProps {
33
- /**
34
- * The x coordinate of the Node's Mount Point.
35
- *
36
- * @remarks
37
- * See {@link mountX} and {@link mountY} for more information about setting
38
- * the Mount Point.
39
- *
40
- * @default `0`
41
- */
42
- x: number;
43
- /**
44
- * The y coordinate of the Node's Mount Point.
45
- *
46
- * @remarks
47
- * See {@link mountX} and {@link mountY} for more information about setting
48
- * the Mount Point.
49
- *
50
- * @default `0`
51
- */
52
- y: number;
53
- /**
54
- * The width of the Node.
55
- *
56
- * @default `0`
57
- */
58
- width: number;
59
- /**
60
- * The height of the Node.
61
- *
62
- * @default `0`
63
- */
64
- height: number;
65
- /**
66
- * The alpha opacity of the Node.
67
- *
68
- * @remarks
69
- * The alpha value is a number between 0 and 1, where 0 is fully transparent
70
- * and 1 is fully opaque.
71
- *
72
- * @default `1`
73
- */
74
- alpha: number;
75
- /**
76
- * Clipping Mode
77
- *
78
- * @remarks
79
- * Enable Clipping Mode when you want to prevent the drawing of a Node and
80
- * its descendants from overflowing outside of the Node's x/y/width/height
81
- * bounds.
82
- *
83
- * For WebGL, clipping is implemented using the high-performance WebGL
84
- * operation scissor. As a consequence, clipping does not work for
85
- * non-rectangular areas. So, if the element is rotated
86
- * (by itself or by any of its ancestors), clipping will not work as intended.
87
- *
88
- * TODO: Add support for non-rectangular clipping either automatically or
89
- * via Render-To-Texture.
90
- *
91
- * @default `false`
92
- */
93
- clipping: boolean;
94
- /**
95
- * The color of the Node.
96
- *
97
- * @remarks
98
- * The color value is a number in the format 0xRRGGBBAA, where RR is the red
99
- * component, GG is the green component, BB is the blue component, and AA is
100
- * the alpha component.
101
- *
102
- * Gradient colors may be set by setting the different color sub-properties:
103
- * {@link colorTop}, {@link colorBottom}, {@link colorLeft}, {@link colorRight},
104
- * {@link colorTl}, {@link colorTr}, {@link colorBr}, {@link colorBl} accordingly.
105
- *
106
- * @default `0xffffffff` (opaque white)
107
- */
108
- color: number;
109
- /**
110
- * The color of the top edge of the Node for gradient rendering.
111
- *
112
- * @remarks
113
- * See {@link color} for more information about color values and gradient
114
- * rendering.
115
- */
116
- colorTop: number;
117
- /**
118
- * The color of the bottom edge of the Node for gradient rendering.
119
- *
120
- * @remarks
121
- * See {@link color} for more information about color values and gradient
122
- * rendering.
123
- */
124
- colorBottom: number;
125
- /**
126
- * The color of the left edge of the Node for gradient rendering.
127
- *
128
- * @remarks
129
- * See {@link color} for more information about color values and gradient
130
- * rendering.
131
- */
132
- colorLeft: number;
133
- /**
134
- * The color of the right edge of the Node for gradient rendering.
135
- *
136
- * @remarks
137
- * See {@link color} for more information about color values and gradient
138
- * rendering.
139
- */
140
- colorRight: number;
141
- /**
142
- * The color of the top-left corner of the Node for gradient rendering.
143
- *
144
- * @remarks
145
- * See {@link color} for more information about color values and gradient
146
- * rendering.
147
- */
148
- colorTl: number;
149
- /**
150
- * The color of the top-right corner of the Node for gradient rendering.
151
- *
152
- * @remarks
153
- * See {@link color} for more information about color values and gradient
154
- * rendering.
155
- */
156
- colorTr: number;
157
- /**
158
- * The color of the bottom-right corner of the Node for gradient rendering.
159
- *
160
- * @remarks
161
- * See {@link color} for more information about color values and gradient
162
- * rendering.
163
- */
164
- colorBr: number;
165
- /**
166
- * The color of the bottom-left corner of the Node for gradient rendering.
167
- *
168
- * @remarks
169
- * See {@link color} for more information about color values and gradient
170
- * rendering.
171
- */
172
- colorBl: number;
173
- /**
174
- * The Node's parent Node.
175
- *
176
- * @remarks
177
- * The value `null` indicates that the Node has no parent. This may either be
178
- * because the Node is the root Node of the scene graph, or because the Node
179
- * has been removed from the scene graph.
180
- *
181
- * In order to make sure that a Node can be rendered on the screen, it must
182
- * be added to the scene graph by setting it's parent property to a Node that
183
- * is already in the scene graph such as the root Node.
184
- *
185
- * @default `null`
186
- */
187
- parent: INode | null;
188
- /**
189
- * The Node's z-index.
190
- *
191
- * @remarks
192
- * TBD
193
- */
194
- zIndex: number;
195
- /**
196
- * The Node's Texture.
197
- *
198
- * @remarks
199
- * The `texture` defines a rasterized image that is contained within the
200
- * {@link width} and {@link height} dimensions of the Node. If null, the
201
- * Node will use an opaque white {@link ColorTexture} when being drawn, which
202
- * essentially enables colors (including gradients) to be drawn.
203
- *
204
- * If set, by default, the texture will be drawn, as is, stretched to the
205
- * dimensions of the Node. This behavior can be modified by setting the TBD
206
- * and TBD properties.
207
- *
208
- * To create a Texture in order to set it on this property, call
209
- * {@link RendererMain.createTexture}.
210
- *
211
- * If the {@link src} is set on a Node, the Node will use the
212
- * {@link ImageTexture} by default and the Node will simply load the image at
213
- * the specified URL.
214
- *
215
- * Note: If this is a Text Node, the Texture will be managed by the Node's
216
- * {@link TextRenderer} and should not be set explicitly.
217
- */
218
- texture: TextureRef | null;
219
- /**
220
- * The Node's shader
221
- *
222
- * @remarks
223
- * The `shader` defines a {@link Shader} used to draw the Node. By default,
224
- * the Default Shader is used which simply draws the defined {@link texture}
225
- * or {@link color}(s) within the Node without any special effects.
226
- *
227
- * To create a Shader in order to set it on this property, call
228
- * {@link RendererMain.createShader}.
229
- *
230
- * Note: If this is a Text Node, the Shader will be managed by the Node's
231
- * {@link TextRenderer} and should not be set explicitly.
232
- */
233
- shader: ShaderRef | null;
234
- /**
235
- * Image URL
236
- *
237
- * @remarks
238
- * When set, the Node's {@link texture} is automatically set to an
239
- * {@link ImageTexture} using the source image URL provided (with all other
240
- * settings being defaults)
241
- */
242
- src: string;
243
- zIndexLocked: number;
244
- /**
245
- * Scale to render the Node at
246
- *
247
- * @remarks
248
- * The scale value multiplies the provided {@link width} and {@link height}
249
- * of the Node around the Node's Pivot Point (defined by the {@link pivot}
250
- * props).
251
- *
252
- * Behind the scenes, setting this property sets both the {@link scaleX} and
253
- * {@link scaleY} props to the same value.
254
- *
255
- * NOTE: When the scaleX and scaleY props are explicitly set to different values,
256
- * this property returns `null`. Setting `null` on this property will have no
257
- * effect.
258
- *
259
- * @default 1.0
260
- */
261
- scale: number | null;
262
- /**
263
- * Scale to render the Node at (X-Axis)
264
- *
265
- * @remarks
266
- * The scaleX value multiplies the provided {@link width} of the Node around
267
- * the Node's Pivot Point (defined by the {@link pivot} props).
268
- *
269
- * @default 1.0
270
- */
271
- scaleX: number;
272
- /**
273
- * Scale to render the Node at (Y-Axis)
274
- *
275
- * @remarks
276
- * The scaleY value multiplies the provided {@link height} of the Node around
277
- * the Node's Pivot Point (defined by the {@link pivot} props).
278
- *
279
- * @default 1.0
280
- */
281
- scaleY: number;
282
- /**
283
- * Combined position of the Node's Mount Point
284
- *
285
- * @remarks
286
- * The value can be any number between `0.0` and `1.0`:
287
- * - `0.0` defines the Mount Point at the top-left corner of the Node.
288
- * - `0.5` defines it at the center of the Node.
289
- * - `1.0` defines it at the bottom-right corner of the node.
290
- *
291
- * Use the {@link mountX} and {@link mountY} props seperately for more control
292
- * of the Mount Point.
293
- *
294
- * When assigned, the same value is also passed to both the {@link mountX} and
295
- * {@link mountY} props.
296
- *
297
- * @default 0 (top-left)
298
- */
299
- mount: number;
300
- /**
301
- * X position of the Node's Mount Point
302
- *
303
- * @remarks
304
- * The value can be any number between `0.0` and `1.0`:
305
- * - `0.0` defines the Mount Point's X position as the left-most edge of the
306
- * Node
307
- * - `0.5` defines it as the horizontal center of the Node
308
- * - `1.0` defines it as the right-most edge of the Node.
309
- *
310
- * The combination of {@link mountX} and {@link mountY} define the Mount Point
311
- *
312
- * @default 0 (left-most edge)
313
- */
314
- mountX: number;
315
- /**
316
- * Y position of the Node's Mount Point
317
- *
318
- * @remarks
319
- * The value can be any number between `0.0` and `1.0`:
320
- * - `0.0` defines the Mount Point's Y position as the top-most edge of the
321
- * Node
322
- * - `0.5` defines it as the vertical center of the Node
323
- * - `1.0` defines it as the bottom-most edge of the Node.
324
- *
325
- * The combination of {@link mountX} and {@link mountY} define the Mount Point
326
- *
327
- * @default 0 (top-most edge)
328
- */
329
- mountY: number;
330
- /**
331
- * Combined position of the Node's Pivot Point
332
- *
333
- * @remarks
334
- * The value can be any number between `0.0` and `1.0`:
335
- * - `0.0` defines the Pivot Point at the top-left corner of the Node.
336
- * - `0.5` defines it at the center of the Node.
337
- * - `1.0` defines it at the bottom-right corner of the node.
338
- *
339
- * Use the {@link pivotX} and {@link pivotY} props seperately for more control
340
- * of the Pivot Point.
341
- *
342
- * When assigned, the same value is also passed to both the {@link pivotX} and
343
- * {@link pivotY} props.
344
- *
345
- * @default 0.5 (center)
346
- */
347
- pivot: number;
348
- /**
349
- * X position of the Node's Pivot Point
350
- *
351
- * @remarks
352
- * The value can be any number between `0.0` and `1.0`:
353
- * - `0.0` defines the Pivot Point's X position as the left-most edge of the
354
- * Node
355
- * - `0.5` defines it as the horizontal center of the Node
356
- * - `1.0` defines it as the right-most edge of the Node.
357
- *
358
- * The combination of {@link pivotX} and {@link pivotY} define the Pivot Point
359
- *
360
- * @default 0.5 (centered on x-axis)
361
- */
362
- pivotX: number;
363
- /**
364
- * Y position of the Node's Pivot Point
365
- *
366
- * @remarks
367
- * The value can be any number between `0.0` and `1.0`:
368
- * - `0.0` defines the Pivot Point's Y position as the top-most edge of the
369
- * Node
370
- * - `0.5` defines it as the vertical center of the Node
371
- * - `1.0` defines it as the bottom-most edge of the Node.
372
- *
373
- * The combination of {@link pivotX} and {@link pivotY} define the Pivot Point
374
- *
375
- * @default 0.5 (centered on y-axis)
376
- */
377
- pivotY: number;
378
- /**
379
- * Rotation of the Node (in Radians)
380
- *
381
- * @remarks
382
- * Sets the amount to rotate the Node by around it's Pivot Point (defined by
383
- * the {@link pivot} props). Positive values rotate the Node clockwise, while
384
- * negative values rotate it counter-clockwise.
385
- *
386
- * Example values:
387
- * - `-Math.PI / 2`: 90 degree rotation counter-clockwise
388
- * - `0`: No rotation
389
- * - `Math.PI / 2`: 90 degree rotation clockwise
390
- * - `Math.PI`: 180 degree rotation clockwise
391
- * - `3 * Math.PI / 2`: 270 degree rotation clockwise
392
- * - `2 * Math.PI`: 360 rotation clockwise
393
- */
394
- rotation: number;
395
- /**
396
- * Node data element for custom data storage (optional)
397
- *
398
- * @remarks
399
- * This property is used to store custom data on the Node as a key/value data store.
400
- * Data values are limited to string, numbers, booleans. Strings will be truncated
401
- * to a 2048 character limit for performance reasons.
402
- *
403
- * This is not a data storage mechanism for large amounts of data please use a
404
- * dedicated data storage mechanism for that.
405
- *
406
- * The custom data will be reflected in the inspector as part of `data-*` attributes
407
- *
408
- * @default `undefined`
409
- */
410
- data?: CustomDataMap;
411
- }
412
-
413
- /**
414
- * A custom data map which can be stored on the INode
415
- *
416
- * @remarks
417
- * This is a map of key-value pairs that can be stored on an INode. It is used
418
- * to store custom data that can be used by the application.
419
- * The data stored can only be of type string, number or boolean.
420
- */
421
- export type CustomDataMap = {
422
- [key: string]: string | number | boolean;
423
- };
424
-
425
- export type INodeAnimatableProps = {
426
- [Key in keyof INodeWritableProps as NonNullable<
427
- INodeWritableProps[Key]
428
- > extends number
429
- ? Key
430
- : never]: number;
431
- };
432
-
433
- export interface INodeEvents {
434
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
435
- [s: string]: (target: INode, data: any) => void;
436
- }
437
-
438
- /**
439
- * Main API interface representing a Node in the Renderer scene graph.
440
- *
441
- * @remarks
442
- * A Node is a basic building block of the Renderer scene graph. It can be a
443
- * container for other Nodes, or it can be a leaf Node that renders a solid
444
- * color, gradient, image, or specific texture, using a specific shader.
445
- *
446
- * For text rendering, see {@link ITextNode}.
447
- *
448
- * Nodes are represented by an interface since they may be implemented in
449
- * different ways depending on the Core Driver. For example, the MainCoreDriver
450
- * implements it with it's `MainOnlyNode` while the ThreadXCoreDriver implements
451
- * it with it's `ThreadXMainNode`.
452
- */
453
- export interface INode extends INodeWritableProps, IEventEmitter<INodeEvents> {
454
- id: number;
455
- readonly children: INode[];
456
- animate(
457
- props: Partial<INodeAnimatableProps>,
458
- settings: Partial<AnimationSettings>,
459
- ): IAnimationController;
460
- destroy(): void;
461
- flush(): void;
462
- }
463
-
464
- export interface ITextNodeWritableProps extends INodeWritableProps, TrProps {
465
- /**
466
- * Force Text Node to use a specific Text Renderer
467
- *
468
- * @remarks
469
- * By default, Text Nodes resolve the Text Renderer to use based on the font
470
- * that is matched using the font family and other font selection properties.
471
- *
472
- * If two fonts supported by two separate Text Renderers are matched setting
473
- * this override forces the Text Node to resolve to the Text Renderer defined
474
- * here.
475
- *
476
- * @default null
477
- */
478
- textRendererOverride: keyof TextRendererMap | null;
479
- }
480
-
481
- /**
482
- * Main API interface representing a Node in the Renderer scene graph that renders text.
483
- *
484
- * @remarks
485
- * A Text Node is the second graphical building block of the Renderer scene
486
- * graph. It renders text using a specific text renderer that is automatically
487
- * chosen based on the font requested and what type of fonts are installed
488
- * into an app via a CoreExtension.
489
- *
490
- * The text renderer can be overridden by setting the `textRendererOverride`
491
- *
492
- * The `texture` and `shader` properties are managed by loaded text renderer and
493
- * should not be set directly.
494
- *
495
- * For non-text rendering, see {@link INode}.
496
- */
497
- export interface ITextNode extends INode, ITextNodeWritableProps {
498
- // Based on inputs
499
- }
1
+ /*
2
+ * If not stated otherwise in this file or this component's LICENSE file the
3
+ * following copyright and licenses apply:
4
+ *
5
+ * Copyright 2023 Comcast Cable Communications Management, LLC.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the License);
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ import type { IEventEmitter } from '@lightningjs/threadx';
21
+ import type { IAnimationController } from '../common/IAnimationController.js';
22
+ import type { ShaderRef, TextureRef } from './RendererMain.js';
23
+ import type {
24
+ TextRendererMap,
25
+ TrProps,
26
+ } from '../core/text-rendering/renderers/TextRenderer.js';
27
+ import type { AnimationSettings } from '../core/animations/CoreAnimation.js';
28
+
29
+ /**
30
+ * Writable properties of a Node.
31
+ */
32
+ export interface INodeWritableProps {
33
+ /**
34
+ * The x coordinate of the Node's Mount Point.
35
+ *
36
+ * @remarks
37
+ * See {@link mountX} and {@link mountY} for more information about setting
38
+ * the Mount Point.
39
+ *
40
+ * @default `0`
41
+ */
42
+ x: number;
43
+ /**
44
+ * The y coordinate of the Node's Mount Point.
45
+ *
46
+ * @remarks
47
+ * See {@link mountX} and {@link mountY} for more information about setting
48
+ * the Mount Point.
49
+ *
50
+ * @default `0`
51
+ */
52
+ y: number;
53
+ /**
54
+ * The width of the Node.
55
+ *
56
+ * @default `0`
57
+ */
58
+ width: number;
59
+ /**
60
+ * The height of the Node.
61
+ *
62
+ * @default `0`
63
+ */
64
+ height: number;
65
+ /**
66
+ * The alpha opacity of the Node.
67
+ *
68
+ * @remarks
69
+ * The alpha value is a number between 0 and 1, where 0 is fully transparent
70
+ * and 1 is fully opaque.
71
+ *
72
+ * @default `1`
73
+ */
74
+ alpha: number;
75
+ /**
76
+ * Clipping Mode
77
+ *
78
+ * @remarks
79
+ * Enable Clipping Mode when you want to prevent the drawing of a Node and
80
+ * its descendants from overflowing outside of the Node's x/y/width/height
81
+ * bounds.
82
+ *
83
+ * For WebGL, clipping is implemented using the high-performance WebGL
84
+ * operation scissor. As a consequence, clipping does not work for
85
+ * non-rectangular areas. So, if the element is rotated
86
+ * (by itself or by any of its ancestors), clipping will not work as intended.
87
+ *
88
+ * TODO: Add support for non-rectangular clipping either automatically or
89
+ * via Render-To-Texture.
90
+ *
91
+ * @default `false`
92
+ */
93
+ clipping: boolean;
94
+ /**
95
+ * The color of the Node.
96
+ *
97
+ * @remarks
98
+ * The color value is a number in the format 0xRRGGBBAA, where RR is the red
99
+ * component, GG is the green component, BB is the blue component, and AA is
100
+ * the alpha component.
101
+ *
102
+ * Gradient colors may be set by setting the different color sub-properties:
103
+ * {@link colorTop}, {@link colorBottom}, {@link colorLeft}, {@link colorRight},
104
+ * {@link colorTl}, {@link colorTr}, {@link colorBr}, {@link colorBl} accordingly.
105
+ *
106
+ * @default `0xffffffff` (opaque white)
107
+ */
108
+ color: number;
109
+ /**
110
+ * The color of the top edge of the Node for gradient rendering.
111
+ *
112
+ * @remarks
113
+ * See {@link color} for more information about color values and gradient
114
+ * rendering.
115
+ */
116
+ colorTop: number;
117
+ /**
118
+ * The color of the bottom edge of the Node for gradient rendering.
119
+ *
120
+ * @remarks
121
+ * See {@link color} for more information about color values and gradient
122
+ * rendering.
123
+ */
124
+ colorBottom: number;
125
+ /**
126
+ * The color of the left edge of the Node for gradient rendering.
127
+ *
128
+ * @remarks
129
+ * See {@link color} for more information about color values and gradient
130
+ * rendering.
131
+ */
132
+ colorLeft: number;
133
+ /**
134
+ * The color of the right edge of the Node for gradient rendering.
135
+ *
136
+ * @remarks
137
+ * See {@link color} for more information about color values and gradient
138
+ * rendering.
139
+ */
140
+ colorRight: number;
141
+ /**
142
+ * The color of the top-left corner of the Node for gradient rendering.
143
+ *
144
+ * @remarks
145
+ * See {@link color} for more information about color values and gradient
146
+ * rendering.
147
+ */
148
+ colorTl: number;
149
+ /**
150
+ * The color of the top-right corner of the Node for gradient rendering.
151
+ *
152
+ * @remarks
153
+ * See {@link color} for more information about color values and gradient
154
+ * rendering.
155
+ */
156
+ colorTr: number;
157
+ /**
158
+ * The color of the bottom-right corner of the Node for gradient rendering.
159
+ *
160
+ * @remarks
161
+ * See {@link color} for more information about color values and gradient
162
+ * rendering.
163
+ */
164
+ colorBr: number;
165
+ /**
166
+ * The color of the bottom-left corner of the Node for gradient rendering.
167
+ *
168
+ * @remarks
169
+ * See {@link color} for more information about color values and gradient
170
+ * rendering.
171
+ */
172
+ colorBl: number;
173
+ /**
174
+ * The Node's parent Node.
175
+ *
176
+ * @remarks
177
+ * The value `null` indicates that the Node has no parent. This may either be
178
+ * because the Node is the root Node of the scene graph, or because the Node
179
+ * has been removed from the scene graph.
180
+ *
181
+ * In order to make sure that a Node can be rendered on the screen, it must
182
+ * be added to the scene graph by setting it's parent property to a Node that
183
+ * is already in the scene graph such as the root Node.
184
+ *
185
+ * @default `null`
186
+ */
187
+ parent: INode | null;
188
+ /**
189
+ * The Node's z-index.
190
+ *
191
+ * @remarks
192
+ * TBD
193
+ */
194
+ zIndex: number;
195
+ /**
196
+ * The Node's Texture.
197
+ *
198
+ * @remarks
199
+ * The `texture` defines a rasterized image that is contained within the
200
+ * {@link width} and {@link height} dimensions of the Node. If null, the
201
+ * Node will use an opaque white {@link ColorTexture} when being drawn, which
202
+ * essentially enables colors (including gradients) to be drawn.
203
+ *
204
+ * If set, by default, the texture will be drawn, as is, stretched to the
205
+ * dimensions of the Node. This behavior can be modified by setting the TBD
206
+ * and TBD properties.
207
+ *
208
+ * To create a Texture in order to set it on this property, call
209
+ * {@link RendererMain.createTexture}.
210
+ *
211
+ * If the {@link src} is set on a Node, the Node will use the
212
+ * {@link ImageTexture} by default and the Node will simply load the image at
213
+ * the specified URL.
214
+ *
215
+ * Note: If this is a Text Node, the Texture will be managed by the Node's
216
+ * {@link TextRenderer} and should not be set explicitly.
217
+ */
218
+ texture: TextureRef | null;
219
+ /**
220
+ * The Node's shader
221
+ *
222
+ * @remarks
223
+ * The `shader` defines a {@link Shader} used to draw the Node. By default,
224
+ * the Default Shader is used which simply draws the defined {@link texture}
225
+ * or {@link color}(s) within the Node without any special effects.
226
+ *
227
+ * To create a Shader in order to set it on this property, call
228
+ * {@link RendererMain.createShader}.
229
+ *
230
+ * Note: If this is a Text Node, the Shader will be managed by the Node's
231
+ * {@link TextRenderer} and should not be set explicitly.
232
+ */
233
+ shader: ShaderRef | null;
234
+ /**
235
+ * Image URL
236
+ *
237
+ * @remarks
238
+ * When set, the Node's {@link texture} is automatically set to an
239
+ * {@link ImageTexture} using the source image URL provided (with all other
240
+ * settings being defaults)
241
+ */
242
+ src: string;
243
+ zIndexLocked: number;
244
+ /**
245
+ * Scale to render the Node at
246
+ *
247
+ * @remarks
248
+ * The scale value multiplies the provided {@link width} and {@link height}
249
+ * of the Node around the Node's Pivot Point (defined by the {@link pivot}
250
+ * props).
251
+ *
252
+ * Behind the scenes, setting this property sets both the {@link scaleX} and
253
+ * {@link scaleY} props to the same value.
254
+ *
255
+ * NOTE: When the scaleX and scaleY props are explicitly set to different values,
256
+ * this property returns `null`. Setting `null` on this property will have no
257
+ * effect.
258
+ *
259
+ * @default 1.0
260
+ */
261
+ scale: number | null;
262
+ /**
263
+ * Scale to render the Node at (X-Axis)
264
+ *
265
+ * @remarks
266
+ * The scaleX value multiplies the provided {@link width} of the Node around
267
+ * the Node's Pivot Point (defined by the {@link pivot} props).
268
+ *
269
+ * @default 1.0
270
+ */
271
+ scaleX: number;
272
+ /**
273
+ * Scale to render the Node at (Y-Axis)
274
+ *
275
+ * @remarks
276
+ * The scaleY value multiplies the provided {@link height} of the Node around
277
+ * the Node's Pivot Point (defined by the {@link pivot} props).
278
+ *
279
+ * @default 1.0
280
+ */
281
+ scaleY: number;
282
+ /**
283
+ * Combined position of the Node's Mount Point
284
+ *
285
+ * @remarks
286
+ * The value can be any number between `0.0` and `1.0`:
287
+ * - `0.0` defines the Mount Point at the top-left corner of the Node.
288
+ * - `0.5` defines it at the center of the Node.
289
+ * - `1.0` defines it at the bottom-right corner of the node.
290
+ *
291
+ * Use the {@link mountX} and {@link mountY} props seperately for more control
292
+ * of the Mount Point.
293
+ *
294
+ * When assigned, the same value is also passed to both the {@link mountX} and
295
+ * {@link mountY} props.
296
+ *
297
+ * @default 0 (top-left)
298
+ */
299
+ mount: number;
300
+ /**
301
+ * X position of the Node's Mount Point
302
+ *
303
+ * @remarks
304
+ * The value can be any number between `0.0` and `1.0`:
305
+ * - `0.0` defines the Mount Point's X position as the left-most edge of the
306
+ * Node
307
+ * - `0.5` defines it as the horizontal center of the Node
308
+ * - `1.0` defines it as the right-most edge of the Node.
309
+ *
310
+ * The combination of {@link mountX} and {@link mountY} define the Mount Point
311
+ *
312
+ * @default 0 (left-most edge)
313
+ */
314
+ mountX: number;
315
+ /**
316
+ * Y position of the Node's Mount Point
317
+ *
318
+ * @remarks
319
+ * The value can be any number between `0.0` and `1.0`:
320
+ * - `0.0` defines the Mount Point's Y position as the top-most edge of the
321
+ * Node
322
+ * - `0.5` defines it as the vertical center of the Node
323
+ * - `1.0` defines it as the bottom-most edge of the Node.
324
+ *
325
+ * The combination of {@link mountX} and {@link mountY} define the Mount Point
326
+ *
327
+ * @default 0 (top-most edge)
328
+ */
329
+ mountY: number;
330
+ /**
331
+ * Combined position of the Node's Pivot Point
332
+ *
333
+ * @remarks
334
+ * The value can be any number between `0.0` and `1.0`:
335
+ * - `0.0` defines the Pivot Point at the top-left corner of the Node.
336
+ * - `0.5` defines it at the center of the Node.
337
+ * - `1.0` defines it at the bottom-right corner of the node.
338
+ *
339
+ * Use the {@link pivotX} and {@link pivotY} props seperately for more control
340
+ * of the Pivot Point.
341
+ *
342
+ * When assigned, the same value is also passed to both the {@link pivotX} and
343
+ * {@link pivotY} props.
344
+ *
345
+ * @default 0.5 (center)
346
+ */
347
+ pivot: number;
348
+ /**
349
+ * X position of the Node's Pivot Point
350
+ *
351
+ * @remarks
352
+ * The value can be any number between `0.0` and `1.0`:
353
+ * - `0.0` defines the Pivot Point's X position as the left-most edge of the
354
+ * Node
355
+ * - `0.5` defines it as the horizontal center of the Node
356
+ * - `1.0` defines it as the right-most edge of the Node.
357
+ *
358
+ * The combination of {@link pivotX} and {@link pivotY} define the Pivot Point
359
+ *
360
+ * @default 0.5 (centered on x-axis)
361
+ */
362
+ pivotX: number;
363
+ /**
364
+ * Y position of the Node's Pivot Point
365
+ *
366
+ * @remarks
367
+ * The value can be any number between `0.0` and `1.0`:
368
+ * - `0.0` defines the Pivot Point's Y position as the top-most edge of the
369
+ * Node
370
+ * - `0.5` defines it as the vertical center of the Node
371
+ * - `1.0` defines it as the bottom-most edge of the Node.
372
+ *
373
+ * The combination of {@link pivotX} and {@link pivotY} define the Pivot Point
374
+ *
375
+ * @default 0.5 (centered on y-axis)
376
+ */
377
+ pivotY: number;
378
+ /**
379
+ * Rotation of the Node (in Radians)
380
+ *
381
+ * @remarks
382
+ * Sets the amount to rotate the Node by around it's Pivot Point (defined by
383
+ * the {@link pivot} props). Positive values rotate the Node clockwise, while
384
+ * negative values rotate it counter-clockwise.
385
+ *
386
+ * Example values:
387
+ * - `-Math.PI / 2`: 90 degree rotation counter-clockwise
388
+ * - `0`: No rotation
389
+ * - `Math.PI / 2`: 90 degree rotation clockwise
390
+ * - `Math.PI`: 180 degree rotation clockwise
391
+ * - `3 * Math.PI / 2`: 270 degree rotation clockwise
392
+ * - `2 * Math.PI`: 360 rotation clockwise
393
+ */
394
+ rotation: number;
395
+ /**
396
+ * Node data element for custom data storage (optional)
397
+ *
398
+ * @remarks
399
+ * This property is used to store custom data on the Node as a key/value data store.
400
+ * Data values are limited to string, numbers, booleans. Strings will be truncated
401
+ * to a 2048 character limit for performance reasons.
402
+ *
403
+ * This is not a data storage mechanism for large amounts of data please use a
404
+ * dedicated data storage mechanism for that.
405
+ *
406
+ * The custom data will be reflected in the inspector as part of `data-*` attributes
407
+ *
408
+ * @default `undefined`
409
+ */
410
+ data?: CustomDataMap;
411
+ }
412
+
413
+ /**
414
+ * A custom data map which can be stored on the INode
415
+ *
416
+ * @remarks
417
+ * This is a map of key-value pairs that can be stored on an INode. It is used
418
+ * to store custom data that can be used by the application.
419
+ * The data stored can only be of type string, number or boolean.
420
+ */
421
+ export type CustomDataMap = {
422
+ [key: string]: string | number | boolean;
423
+ };
424
+
425
+ export type INodeAnimatableProps = {
426
+ [Key in keyof INodeWritableProps as NonNullable<
427
+ INodeWritableProps[Key]
428
+ > extends number
429
+ ? Key
430
+ : never]: number;
431
+ };
432
+
433
+ export interface INodeEvents {
434
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
435
+ [s: string]: (target: INode, data: any) => void;
436
+ }
437
+
438
+ /**
439
+ * Main API interface representing a Node in the Renderer scene graph.
440
+ *
441
+ * @remarks
442
+ * A Node is a basic building block of the Renderer scene graph. It can be a
443
+ * container for other Nodes, or it can be a leaf Node that renders a solid
444
+ * color, gradient, image, or specific texture, using a specific shader.
445
+ *
446
+ * For text rendering, see {@link ITextNode}.
447
+ *
448
+ * Nodes are represented by an interface since they may be implemented in
449
+ * different ways depending on the Core Driver. For example, the MainCoreDriver
450
+ * implements it with it's `MainOnlyNode` while the ThreadXCoreDriver implements
451
+ * it with it's `ThreadXMainNode`.
452
+ */
453
+ export interface INode extends INodeWritableProps, IEventEmitter<INodeEvents> {
454
+ id: number;
455
+ readonly children: INode[];
456
+ animate(
457
+ props: Partial<INodeAnimatableProps>,
458
+ settings: Partial<AnimationSettings>,
459
+ ): IAnimationController;
460
+ destroy(): void;
461
+ flush(): void;
462
+ }
463
+
464
+ export interface ITextNodeWritableProps extends INodeWritableProps, TrProps {
465
+ /**
466
+ * Force Text Node to use a specific Text Renderer
467
+ *
468
+ * @remarks
469
+ * By default, Text Nodes resolve the Text Renderer to use based on the font
470
+ * that is matched using the font family and other font selection properties.
471
+ *
472
+ * If two fonts supported by two separate Text Renderers are matched setting
473
+ * this override forces the Text Node to resolve to the Text Renderer defined
474
+ * here.
475
+ *
476
+ * @default null
477
+ */
478
+ textRendererOverride: keyof TextRendererMap | null;
479
+ }
480
+
481
+ /**
482
+ * Main API interface representing a Node in the Renderer scene graph that renders text.
483
+ *
484
+ * @remarks
485
+ * A Text Node is the second graphical building block of the Renderer scene
486
+ * graph. It renders text using a specific text renderer that is automatically
487
+ * chosen based on the font requested and what type of fonts are installed
488
+ * into an app via a CoreExtension.
489
+ *
490
+ * The text renderer can be overridden by setting the `textRendererOverride`
491
+ *
492
+ * The `texture` and `shader` properties are managed by loaded text renderer and
493
+ * should not be set directly.
494
+ *
495
+ * For non-text rendering, see {@link INode}.
496
+ */
497
+ export interface ITextNode extends INode, ITextNodeWritableProps {
498
+ // Based on inputs
499
+ }