@lightningjs/renderer 2.14.1 → 2.14.2

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 (288) hide show
  1. package/COPYING +1 -0
  2. package/LICENSE +202 -202
  3. package/NOTICE +3 -3
  4. package/README.md +147 -147
  5. package/dist/exports/canvas-shaders.d.ts +10 -0
  6. package/dist/exports/canvas-shaders.js +27 -0
  7. package/dist/exports/canvas-shaders.js.map +1 -0
  8. package/dist/exports/webgl-shaders.d.ts +11 -0
  9. package/dist/exports/webgl-shaders.js +28 -0
  10. package/dist/exports/webgl-shaders.js.map +1 -0
  11. package/dist/src/core/CoreNode.js +6 -0
  12. package/dist/src/core/CoreNode.js.map +1 -1
  13. package/dist/src/core/platforms/Platform.d.ts +37 -0
  14. package/dist/src/core/platforms/Platform.js +22 -0
  15. package/dist/src/core/platforms/Platform.js.map +1 -0
  16. package/dist/src/core/platforms/web/WebPlatform.d.ts +9 -0
  17. package/dist/src/core/platforms/web/WebPlatform.js +58 -0
  18. package/dist/src/core/platforms/web/WebPlatform.js.map +1 -0
  19. package/dist/src/core/renderers/CoreShaderNode.d.ts +58 -0
  20. package/dist/src/core/renderers/CoreShaderNode.js +104 -0
  21. package/dist/src/core/renderers/CoreShaderNode.js.map +1 -0
  22. package/dist/src/core/renderers/CoreShaderProgram.d.ts +4 -0
  23. package/dist/src/core/renderers/CoreShaderProgram.js +20 -0
  24. package/dist/src/core/renderers/CoreShaderProgram.js.map +1 -0
  25. package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +36 -0
  26. package/dist/src/core/renderers/canvas/CanvasRenderer.js +212 -0
  27. package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -0
  28. package/dist/src/core/renderers/canvas/CanvasShaderNode.d.ts +21 -0
  29. package/dist/src/core/renderers/canvas/CanvasShaderNode.js +60 -0
  30. package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +1 -0
  31. package/dist/src/core/renderers/canvas/CanvasTexture.d.ts +16 -0
  32. package/dist/src/core/renderers/canvas/CanvasTexture.js +124 -0
  33. package/dist/src/core/renderers/canvas/CanvasTexture.js.map +1 -0
  34. package/dist/src/core/renderers/webgl/WebGlCoreShader.js +3 -1
  35. package/dist/src/core/renderers/webgl/WebGlCoreShader.js.map +1 -1
  36. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.d.ts +12 -0
  37. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js +55 -0
  38. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js.map +1 -0
  39. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.d.ts +9 -0
  40. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js +38 -0
  41. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js.map +1 -0
  42. package/dist/src/core/renderers/webgl/WebGlCtxTexture.d.ts +57 -0
  43. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +227 -0
  44. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +1 -0
  45. package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +44 -0
  46. package/dist/src/core/renderers/webgl/WebGlRenderOp.js +118 -0
  47. package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +1 -0
  48. package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +135 -0
  49. package/dist/src/core/renderers/webgl/WebGlRenderer.js +571 -0
  50. package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -0
  51. package/dist/src/core/renderers/webgl/WebGlShaderNode.d.ts +222 -0
  52. package/dist/src/core/renderers/webgl/WebGlShaderNode.js +334 -0
  53. package/dist/src/core/renderers/webgl/WebGlShaderNode.js.map +1 -0
  54. package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +35 -0
  55. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +201 -0
  56. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -0
  57. package/dist/src/core/renderers/webgl/shaders/DefaultShader.js +45 -45
  58. package/dist/src/core/renderers/webgl/shaders/DefaultShaderBatched.js +61 -61
  59. package/dist/src/core/renderers/webgl/shaders/DynamicShader.js +93 -93
  60. package/dist/src/core/renderers/webgl/shaders/RoundedRectangle.js +63 -63
  61. package/dist/src/core/renderers/webgl/shaders/SdfShader.js +62 -62
  62. package/dist/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.js +15 -15
  63. package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js +6 -6
  64. package/dist/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.js +15 -15
  65. package/dist/src/core/renderers/webgl/shaders/effects/BorderRightEffect.js +15 -15
  66. package/dist/src/core/renderers/webgl/shaders/effects/BorderTopEffect.js +15 -15
  67. package/dist/src/core/renderers/webgl/shaders/effects/FadeOutEffect.js +42 -42
  68. package/dist/src/core/renderers/webgl/shaders/effects/GlitchEffect.js +44 -44
  69. package/dist/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.js +3 -3
  70. package/dist/src/core/renderers/webgl/shaders/effects/HolePunchEffect.js +22 -22
  71. package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js +28 -28
  72. package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js +10 -10
  73. package/dist/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.js +37 -37
  74. package/dist/src/core/renderers/webgl/shaders/effects/RadiusEffect.js +19 -19
  75. package/dist/src/core/shaders/canvas/Border.d.ts +9 -0
  76. package/dist/src/core/shaders/canvas/Border.js +57 -0
  77. package/dist/src/core/shaders/canvas/Border.js.map +1 -0
  78. package/dist/src/core/shaders/canvas/HolePunch.d.ts +7 -0
  79. package/dist/src/core/shaders/canvas/HolePunch.js +38 -0
  80. package/dist/src/core/shaders/canvas/HolePunch.js.map +1 -0
  81. package/dist/src/core/shaders/canvas/LinearGradient.d.ts +10 -0
  82. package/dist/src/core/shaders/canvas/LinearGradient.js +46 -0
  83. package/dist/src/core/shaders/canvas/LinearGradient.js.map +1 -0
  84. package/dist/src/core/shaders/canvas/RadialGradient.d.ts +11 -0
  85. package/dist/src/core/shaders/canvas/RadialGradient.js +68 -0
  86. package/dist/src/core/shaders/canvas/RadialGradient.js.map +1 -0
  87. package/dist/src/core/shaders/canvas/Rounded.d.ts +7 -0
  88. package/dist/src/core/shaders/canvas/Rounded.js +33 -0
  89. package/dist/src/core/shaders/canvas/Rounded.js.map +1 -0
  90. package/dist/src/core/shaders/canvas/RoundedWithBorder.d.ts +7 -0
  91. package/dist/src/core/shaders/canvas/RoundedWithBorder.js +41 -0
  92. package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +1 -0
  93. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.d.ts +8 -0
  94. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +39 -0
  95. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +1 -0
  96. package/dist/src/core/shaders/canvas/RoundedWithShadow.d.ts +7 -0
  97. package/dist/src/core/shaders/canvas/RoundedWithShadow.js +38 -0
  98. package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +1 -0
  99. package/dist/src/core/shaders/canvas/Shadow.d.ts +8 -0
  100. package/dist/src/core/shaders/canvas/Shadow.js +31 -0
  101. package/dist/src/core/shaders/canvas/Shadow.js.map +1 -0
  102. package/dist/src/core/shaders/canvas/utils/render.d.ts +5 -0
  103. package/dist/src/core/shaders/canvas/utils/render.js +84 -0
  104. package/dist/src/core/shaders/canvas/utils/render.js.map +1 -0
  105. package/dist/src/core/shaders/templates/BorderTemplate.d.ts +37 -0
  106. package/dist/src/core/shaders/templates/BorderTemplate.js +73 -0
  107. package/dist/src/core/shaders/templates/BorderTemplate.js.map +1 -0
  108. package/dist/src/core/shaders/templates/HolePunchTemplate.d.ts +46 -0
  109. package/dist/src/core/shaders/templates/HolePunchTemplate.js +35 -0
  110. package/dist/src/core/shaders/templates/HolePunchTemplate.js.map +1 -0
  111. package/dist/src/core/shaders/templates/LinearGradientTemplate.d.ts +23 -0
  112. package/dist/src/core/shaders/templates/LinearGradientTemplate.js +47 -0
  113. package/dist/src/core/shaders/templates/LinearGradientTemplate.js.map +1 -0
  114. package/dist/src/core/shaders/templates/RadialGradientTemplate.d.ts +31 -0
  115. package/dist/src/core/shaders/templates/RadialGradientTemplate.js +49 -0
  116. package/dist/src/core/shaders/templates/RadialGradientTemplate.js.map +1 -0
  117. package/dist/src/core/shaders/templates/RoundedTemplate.d.ts +29 -0
  118. package/dist/src/core/shaders/templates/RoundedTemplate.js +67 -0
  119. package/dist/src/core/shaders/templates/RoundedTemplate.js.map +1 -0
  120. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.d.ts +7 -0
  121. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js +24 -0
  122. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js.map +1 -0
  123. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.d.ts +6 -0
  124. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js +23 -0
  125. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js.map +1 -0
  126. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.d.ts +6 -0
  127. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js +23 -0
  128. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js.map +1 -0
  129. package/dist/src/core/shaders/templates/ShadowTemplate.d.ts +34 -0
  130. package/dist/src/core/shaders/templates/ShadowTemplate.js +66 -0
  131. package/dist/src/core/shaders/templates/ShadowTemplate.js.map +1 -0
  132. package/dist/src/core/shaders/templates/shaderUtils.d.ts +5 -0
  133. package/dist/src/core/shaders/templates/shaderUtils.js +41 -0
  134. package/dist/src/core/shaders/templates/shaderUtils.js.map +1 -0
  135. package/dist/src/core/shaders/webgl/Border.d.ts +3 -0
  136. package/dist/src/core/shaders/webgl/Border.js +110 -0
  137. package/dist/src/core/shaders/webgl/Border.js.map +1 -0
  138. package/dist/src/core/shaders/webgl/Default.d.ts +2 -0
  139. package/dist/src/core/shaders/webgl/Default.js +86 -0
  140. package/dist/src/core/shaders/webgl/Default.js.map +1 -0
  141. package/dist/src/core/shaders/webgl/DefaultBatched.d.ts +2 -0
  142. package/dist/src/core/shaders/webgl/DefaultBatched.js +104 -0
  143. package/dist/src/core/shaders/webgl/DefaultBatched.js.map +1 -0
  144. package/dist/src/core/shaders/webgl/HolePunch.d.ts +3 -0
  145. package/dist/src/core/shaders/webgl/HolePunch.js +64 -0
  146. package/dist/src/core/shaders/webgl/HolePunch.js.map +1 -0
  147. package/dist/src/core/shaders/webgl/LinearGradient.d.ts +3 -0
  148. package/dist/src/core/shaders/webgl/LinearGradient.js +75 -0
  149. package/dist/src/core/shaders/webgl/LinearGradient.js.map +1 -0
  150. package/dist/src/core/shaders/webgl/RadialGradient.d.ts +3 -0
  151. package/dist/src/core/shaders/webgl/RadialGradient.js +73 -0
  152. package/dist/src/core/shaders/webgl/RadialGradient.js.map +1 -0
  153. package/dist/src/core/shaders/webgl/Rounded.d.ts +7 -0
  154. package/dist/src/core/shaders/webgl/Rounded.js +86 -0
  155. package/dist/src/core/shaders/webgl/Rounded.js.map +1 -0
  156. package/dist/src/core/shaders/webgl/RoundedWithBorder.d.ts +3 -0
  157. package/dist/src/core/shaders/webgl/RoundedWithBorder.js +129 -0
  158. package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -0
  159. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.d.ts +3 -0
  160. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +149 -0
  161. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -0
  162. package/dist/src/core/shaders/webgl/RoundedWithShadow.d.ts +3 -0
  163. package/dist/src/core/shaders/webgl/RoundedWithShadow.js +84 -0
  164. package/dist/src/core/shaders/webgl/RoundedWithShadow.js.map +1 -0
  165. package/dist/src/core/shaders/webgl/SdfShader.d.ts +32 -0
  166. package/dist/src/core/shaders/webgl/SdfShader.js +116 -0
  167. package/dist/src/core/shaders/webgl/SdfShader.js.map +1 -0
  168. package/dist/src/core/shaders/webgl/Shadow.d.ts +3 -0
  169. package/dist/src/core/shaders/webgl/Shadow.js +110 -0
  170. package/dist/src/core/shaders/webgl/Shadow.js.map +1 -0
  171. package/dist/src/core/temp.js +77 -0
  172. package/dist/src/core/temp.js.map +1 -0
  173. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  174. package/exports/canvas.ts +39 -39
  175. package/exports/index.ts +89 -89
  176. package/exports/inspector.ts +24 -24
  177. package/exports/utils.ts +44 -44
  178. package/exports/webgl.ts +38 -38
  179. package/package.json +1 -1
  180. package/scripts/please-use-pnpm.js +13 -13
  181. package/src/common/CommonTypes.ts +146 -146
  182. package/src/common/EventEmitter.ts +77 -77
  183. package/src/common/IAnimationController.ts +92 -92
  184. package/src/common/IEventEmitter.ts +28 -28
  185. package/src/core/CoreNode.test.ts +202 -202
  186. package/src/core/CoreNode.ts +2468 -2462
  187. package/src/core/CoreShaderManager.ts +292 -292
  188. package/src/core/CoreTextNode.ts +455 -455
  189. package/src/core/CoreTextureManager.ts +558 -558
  190. package/src/core/Stage.ts +743 -743
  191. package/src/core/TextureMemoryManager.ts +404 -404
  192. package/src/core/animations/AnimationManager.ts +38 -38
  193. package/src/core/animations/CoreAnimation.ts +347 -347
  194. package/src/core/animations/CoreAnimationController.ts +166 -166
  195. package/src/core/lib/ContextSpy.ts +41 -41
  196. package/src/core/lib/ImageWorker.ts +280 -280
  197. package/src/core/lib/Matrix3d.ts +244 -244
  198. package/src/core/lib/RenderCoords.ts +86 -86
  199. package/src/core/lib/WebGlContextWrapper.ts +1332 -1332
  200. package/src/core/lib/textureCompression.ts +152 -152
  201. package/src/core/lib/textureSvg.ts +78 -78
  202. package/src/core/lib/utils.ts +384 -384
  203. package/src/core/lib/validateImageBitmap.ts +76 -76
  204. package/src/core/platform.ts +63 -63
  205. package/src/core/renderers/CoreContextTexture.ts +43 -43
  206. package/src/core/renderers/CoreRenderOp.ts +22 -22
  207. package/src/core/renderers/CoreRenderer.ts +115 -115
  208. package/src/core/renderers/CoreShader.ts +41 -41
  209. package/src/core/renderers/canvas/CanvasCoreRenderer.ts +375 -375
  210. package/src/core/renderers/canvas/CanvasCoreTexture.ts +153 -153
  211. package/src/core/renderers/canvas/internal/C2DShaderUtils.ts +231 -231
  212. package/src/core/renderers/canvas/internal/ColorUtils.ts +69 -69
  213. package/src/core/renderers/canvas/shaders/UnsupportedShader.ts +48 -48
  214. package/src/core/renderers/webgl/WebGlCoreCtxRenderTexture.ts +86 -86
  215. package/src/core/renderers/webgl/WebGlCoreCtxSubTexture.ts +50 -50
  216. package/src/core/renderers/webgl/WebGlCoreCtxTexture.ts +301 -301
  217. package/src/core/renderers/webgl/WebGlCoreRenderOp.ts +125 -125
  218. package/src/core/renderers/webgl/WebGlCoreRenderer.ts +821 -821
  219. package/src/core/renderers/webgl/WebGlCoreShader.ts +365 -362
  220. package/src/core/renderers/webgl/internal/BufferCollection.ts +54 -54
  221. package/src/core/renderers/webgl/internal/RendererUtils.ts +155 -155
  222. package/src/core/renderers/webgl/internal/ShaderUtils.ts +143 -143
  223. package/src/core/renderers/webgl/internal/WebGlUtils.ts +35 -35
  224. package/src/core/renderers/webgl/shaders/DefaultShader.ts +93 -93
  225. package/src/core/renderers/webgl/shaders/DefaultShaderBatched.ts +132 -132
  226. package/src/core/renderers/webgl/shaders/DynamicShader.ts +580 -580
  227. package/src/core/renderers/webgl/shaders/RoundedRectangle.ts +167 -167
  228. package/src/core/renderers/webgl/shaders/SdfShader.ts +204 -204
  229. package/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.ts +101 -101
  230. package/src/core/renderers/webgl/shaders/effects/BorderEffect.ts +87 -87
  231. package/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.ts +101 -101
  232. package/src/core/renderers/webgl/shaders/effects/BorderRightEffect.ts +101 -101
  233. package/src/core/renderers/webgl/shaders/effects/BorderTopEffect.ts +101 -101
  234. package/src/core/renderers/webgl/shaders/effects/EffectUtils.ts +159 -159
  235. package/src/core/renderers/webgl/shaders/effects/FadeOutEffect.ts +127 -127
  236. package/src/core/renderers/webgl/shaders/effects/GlitchEffect.ts +148 -148
  237. package/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.ts +67 -67
  238. package/src/core/renderers/webgl/shaders/effects/HolePunchEffect.ts +157 -157
  239. package/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts +171 -171
  240. package/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts +168 -168
  241. package/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.ts +187 -187
  242. package/src/core/renderers/webgl/shaders/effects/RadiusEffect.ts +110 -110
  243. package/src/core/renderers/webgl/shaders/effects/ShaderEffect.ts +196 -196
  244. package/src/core/text-rendering/TextRenderingUtils.ts +36 -36
  245. package/src/core/text-rendering/TextTextureRendererUtils.ts +263 -263
  246. package/src/core/text-rendering/TrFontManager.ts +183 -183
  247. package/src/core/text-rendering/font-face-types/SdfTrFontFace/SdfTrFontFace.ts +176 -176
  248. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/FontShaper.ts +139 -139
  249. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.test.ts +173 -173
  250. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.ts +171 -171
  251. package/src/core/text-rendering/font-face-types/TrFontFace.ts +187 -187
  252. package/src/core/text-rendering/font-face-types/WebTrFontFace.ts +94 -94
  253. package/src/core/text-rendering/font-face-types/utils.ts +39 -39
  254. package/src/core/text-rendering/renderers/CanvasTextRenderer.ts +509 -509
  255. package/src/core/text-rendering/renderers/LightningTextTextureRenderer.ts +808 -808
  256. package/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.ts +853 -853
  257. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.test.ts +48 -48
  258. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.ts +66 -66
  259. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/SpecialCodepoints.ts +52 -52
  260. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/constants.ts +32 -32
  261. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getStartConditions.ts +117 -117
  262. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.test.ts +133 -133
  263. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.ts +38 -38
  264. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText.ts +408 -408
  265. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.test.ts +49 -49
  266. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.ts +52 -52
  267. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.test.ts +205 -205
  268. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.ts +93 -93
  269. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/util.ts +40 -40
  270. package/src/core/text-rendering/renderers/TextRenderer.ts +557 -557
  271. package/src/core/textures/ColorTexture.ts +102 -102
  272. package/src/core/textures/ImageTexture.ts +399 -399
  273. package/src/core/textures/NoiseTexture.ts +104 -104
  274. package/src/core/textures/RenderTexture.ts +85 -85
  275. package/src/core/textures/SubTexture.ts +205 -205
  276. package/src/core/textures/Texture.ts +367 -367
  277. package/src/core/utils.ts +227 -227
  278. package/src/env.d.ts +7 -7
  279. package/src/main-api/DynamicShaderController.ts +104 -104
  280. package/src/main-api/INode.ts +101 -101
  281. package/src/main-api/Inspector.ts +522 -522
  282. package/src/main-api/Renderer.ts +751 -751
  283. package/src/main-api/ShaderController.ts +80 -80
  284. package/src/main-api/utils.ts +45 -45
  285. package/src/utils.ts +248 -248
  286. package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js +0 -2
  287. package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js.map +0 -1
  288. /package/dist/src/core/{renderers/webgl/WebGlCoreShader.destroy.d.ts → temp.d.ts} +0 -0
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ import { calcFactoredRadiusArray, valuesAreEqual } from '../../lib/utils.js';
18
+ import { RoundedWithBorderTemplate, } from '../templates/RoundedWithBorderTemplate.js';
19
+ import { roundedRectWithBorder } from './utils/render.js';
20
+ export const RoundedWithBorder = {
21
+ props: RoundedWithBorderTemplate.props,
22
+ saveAndRestore: true,
23
+ update(node) {
24
+ const radius = calcFactoredRadiusArray(this.props.radius, node.width, node.height);
25
+ this.computed.radius = radius;
26
+ this.computed.borderColor = this.toColorString(this.props['border-color']);
27
+ this.computed.borderAsym = !valuesAreEqual(this.props['border-width']);
28
+ //following vec4 convention 0, 1, 2, 3 => x, y, z, w;
29
+ const [x, y, z, w] = this.props['border-width'];
30
+ this.computed.borderRadius = [
31
+ Math.max(0.0, radius[0] - Math.max(x, w) * 0.5),
32
+ Math.max(0.0, radius[1] - Math.max(x, y) * 0.5),
33
+ Math.max(0.0, radius[2] - Math.max(z, y) * 0.5),
34
+ Math.max(0.0, radius[3] - Math.max(z, w) * 0.5),
35
+ ];
36
+ },
37
+ render(ctx, quad, renderContext) {
38
+ roundedRectWithBorder(ctx, quad.tx, quad.ty, quad.width, quad.height, this.computed.radius, this.props['border-width'], this.computed.borderRadius, this.computed.borderColor, this.computed.borderAsym, renderContext);
39
+ },
40
+ };
41
+ //# sourceMappingURL=RoundedWithBorder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoundedWithBorder.js","sourceRoot":"","sources":["../../../../../src/core/shaders/canvas/RoundedWithBorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EACL,yBAAyB,GAE1B,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,MAAM,CAAC,MAAM,iBAAiB,GAG1B;IACF,KAAK,EAAE,yBAAyB,CAAC,KAAK;IACtC,cAAc,EAAE,IAAI;IACpB,MAAM,CAAC,IAAI;QACT,MAAM,MAAM,GAAG,uBAAuB,CACpC,IAAI,CAAC,KAAM,CAAC,MAAc,EAC1B,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,CACZ,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAM,CAAC,cAAc,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,CAAC,cAAc,CACxC,IAAI,CAAC,KAAM,CAAC,cAAc,CAAa,CACxC,CAAC;QACF,qDAAqD;QACrD,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,KAAM,CAAC,cAAc,CAAS,CAAC;QACzD,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG;YAC3B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;YAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;YAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;YAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;SAChD,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa;QAC7B,qBAAqB,CACnB,GAAG,EACH,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,QAAQ,CAAC,MAAO,EACrB,IAAI,CAAC,KAAM,CAAC,cAAc,CAAS,EACnC,IAAI,CAAC,QAAQ,CAAC,YAAa,EAC3B,IAAI,CAAC,QAAQ,CAAC,WAAY,EAC1B,IAAI,CAAC,QAAQ,CAAC,UAAW,EACzB,aAAa,CACd,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { CanvasShaderType } from '../../renderers/canvas/CanvasShaderNode.js';
2
+ import { type RoundedWithBorderAndShadowProps } from '../templates/RoundedWithBorderAndShadowTemplate.js';
3
+ import type { ComputedBorderValues } from './Border.js';
4
+ import type { ComputedRoundedValues } from './Rounded.js';
5
+ import type { ComputedShadowValues } from './Shadow.js';
6
+ type ComputedValues = ComputedRoundedValues & ComputedBorderValues & ComputedShadowValues;
7
+ export declare const RoundedWithBorderAndShadow: CanvasShaderType<RoundedWithBorderAndShadowProps, ComputedValues>;
8
+ export {};
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ import { calcFactoredRadiusArray, valuesAreEqual } from '../../lib/utils.js';
18
+ import { RoundedWithBorderAndShadowTemplate, } from '../templates/RoundedWithBorderAndShadowTemplate.js';
19
+ import * as render from './utils/render.js';
20
+ export const RoundedWithBorderAndShadow = {
21
+ props: RoundedWithBorderAndShadowTemplate.props,
22
+ saveAndRestore: true,
23
+ update(node) {
24
+ const radius = calcFactoredRadiusArray(this.props.radius, node.width, node.height);
25
+ this.computed.radius = radius;
26
+ this.computed.borderColor = this.toColorString(this.props['border-color']);
27
+ this.computed.borderAsym = !valuesAreEqual(this.props['border-width']);
28
+ const borderWidth = this.props['border-width'];
29
+ this.computed.borderRadius = radius.map((value, index) => Math.max(0, value - borderWidth[index] * 0.5));
30
+ this.computed.shadowColor = this.toColorString(this.props['shadow-color']);
31
+ this.computed.shadowRadius = radius.map((value) => value + this.props['shadow-blur']);
32
+ },
33
+ render(ctx, quad, renderContext) {
34
+ const { tx, ty, width, height } = quad;
35
+ render.shadow(ctx, tx, ty, height, width, this.computed.shadowColor, this.props['shadow-projection'], this.computed.shadowRadius, this.stage.pixelRatio);
36
+ render.roundedRectWithBorder(ctx, quad.tx, quad.ty, quad.width, quad.height, this.computed.radius, this.props['border-width'], this.computed.borderRadius, this.computed.borderColor, this.computed.borderAsym, renderContext);
37
+ },
38
+ };
39
+ //# sourceMappingURL=RoundedWithBorderAndShadow.js.map
@@ -0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AAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,MAAM,CAAC,GAAG,CACrC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAM,CAAC,aAAa,CAAC,CACtC,CAAC;IACZ,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa;QAC7B,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,MAAM,CACX,GAAG,EACH,EAAE,EACF,EAAE,EACF,MAAM,EACN,KAAK,EACL,IAAI,CAAC,QAAQ,CAAC,WAAY,EAC1B,IAAI,CAAC,KAAM,CAAC,mBAAmB,CAAC,EAChC,IAAI,CAAC,QAAQ,CAAC,YAAa,EAC3B,IAAI,CAAC,KAAK,CAAC,UAAU,CACtB,CAAC;QACF,MAAM,CAAC,qBAAqB,CAC1B,GAAG,EACH,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,QAAQ,CAAC,MAAO,EACrB,IAAI,CAAC,KAAM,CAAC,cAAc,CAAS,EACnC,IAAI,CAAC,QAAQ,CAAC,YAAa,EAC3B,IAAI,CAAC,QAAQ,CAAC,WAAY,EAC1B,IAAI,CAAC,QAAQ,CAAC,UAAW,EACzB,aAAa,CACd,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { CanvasShaderType } from '../../renderers/canvas/CanvasShaderNode.js';
2
+ import { type RoundedWithShadowProps } from '../templates/RoundedWithShadowTemplate.js';
3
+ import type { ComputedRoundedValues } from './Rounded.js';
4
+ import type { ComputedShadowValues } from './Shadow.js';
5
+ type ComputedValues = ComputedRoundedValues & ComputedShadowValues;
6
+ export declare const RoundedWithShadow: CanvasShaderType<RoundedWithShadowProps, ComputedValues>;
7
+ export {};
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ import { calcFactoredRadiusArray } from '../../lib/utils.js';
18
+ import { RoundedWithShadowTemplate, } from '../templates/RoundedWithShadowTemplate.js';
19
+ import * as render from './utils/render.js';
20
+ export const RoundedWithShadow = {
21
+ props: RoundedWithShadowTemplate.props,
22
+ saveAndRestore: true,
23
+ update(node) {
24
+ const radius = calcFactoredRadiusArray(this.props.radius, node.width, node.height);
25
+ this.computed.radius = radius;
26
+ this.computed.shadowColor = this.toColorString(this.props['shadow-color']);
27
+ this.computed.shadowRadius = radius.map((value) => value + this.props['shadow-blur']);
28
+ },
29
+ render(ctx, quad, renderContext) {
30
+ const { tx, ty, width, height } = quad;
31
+ render.shadow(ctx, tx, ty, width, height, this.computed.shadowColor, this.props['shadow-projection'], this.computed.shadowRadius, this.stage.pixelRatio);
32
+ const path = new Path2D();
33
+ render.roundRect(path, tx, ty, width, height, this.computed.radius);
34
+ ctx.clip(path);
35
+ renderContext();
36
+ },
37
+ };
38
+ //# sourceMappingURL=RoundedWithShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoundedWithShadow.js","sourceRoot":"","sources":["../../../../../src/core/shaders/canvas/RoundedWithShadow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EACL,yBAAyB,G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ACrE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf,aAAa,EAAE,CAAC;IAClB,CAAC;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { CanvasShaderType } from '../../renderers/canvas/CanvasShaderNode.js';
2
+ import type { Vec4 } from '../../renderers/webgl/internal/ShaderUtils.js';
3
+ import { type ShadowProps } from '../templates/ShadowTemplate.js';
4
+ export interface ComputedShadowValues {
5
+ shadowColor: string;
6
+ shadowRadius: Vec4;
7
+ }
8
+ export declare const Shadow: CanvasShaderType<ShadowProps, ComputedShadowValues>;
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ import { ShadowTemplate, } from '../templates/ShadowTemplate.js';
18
+ import { shadow } from './utils/render.js';
19
+ export const Shadow = {
20
+ props: ShadowTemplate.props,
21
+ update() {
22
+ this.computed.shadowColor = this.toColorString(this.props['color']);
23
+ const blur = this.props['blur'];
24
+ this.computed.shadowRadius = [blur, blur, blur, blur];
25
+ },
26
+ render(ctx, quad, renderContext) {
27
+ shadow(ctx, quad.tx, quad.ty, quad.width, quad.height, this.computed.shadowColor, this.props['projection'], this.computed.shadowRadius, this.stage.pixelRatio);
28
+ renderContext();
29
+ },
30
+ };
31
+ //# sourceMappingURL=Shadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shadow.js","sourceRoot":"","sources":["../../../../../src/core/shaders/canvas/Shadow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EACL,cAAc,GAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAO3C,MAAM,CAAC,MAAM,MAAM,GAAwD;IACzE,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,MAAM;QACJ,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa;QAC7B,MAAM,CACJ,GAAG,EACH,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,QAAQ,CAAC,WAAY,EAC1B,IAAI,CAAC,KAAM,CAAC,YAAY,CAAC,EACzB,IAAI,CAAC,QAAQ,CAAC,YAAa,EAC3B,IAAI,CAAC,KAAK,CAAC,UAAU,CACtB,CAAC;QACF,aAAa,EAAE,CAAC;IAClB,CAAC;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Vec4 } from '../../../renderers/webgl/internal/ShaderUtils.js';
2
+ export declare function roundRect(ctx: CanvasRenderingContext2D | Path2D, x: number, y: number, width: number, height: number, radius: Vec4): void;
3
+ export declare function roundedRectWithBorder(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: Vec4, borderWidth: Vec4, borderRadius: Vec4, borderColor: string, borderAsym: boolean, renderContext: () => void): void;
4
+ export declare function shadow(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, color: string, projection: Vec4, radius: Vec4, pixelRatio: number): void;
5
+ export declare function strokeLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, lineWidth: number): void;
@@ -0,0 +1,84 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ export function roundRect(ctx, x, y, width, height, radius) {
18
+ if (ctx.roundRect !== undefined) {
19
+ ctx.roundRect(x, y, width, height, radius);
20
+ return;
21
+ }
22
+ const { 0: tl, 1: tr, 2: br, 3: bl } = radius;
23
+ ctx.moveTo(x + tl, y);
24
+ ctx.lineTo(x + width - tr, y);
25
+ ctx.ellipse(x + width - tr, y + tr, tr, tr, 0, 1.5 * Math.PI, 2 * Math.PI);
26
+ ctx.lineTo(x + width, y - height - br);
27
+ ctx.ellipse(x + width - br, y + height - br, br, br, 0, 0, 0.5 * Math.PI);
28
+ ctx.lineTo(x + bl, y + height);
29
+ ctx.ellipse(x + bl, y + height - bl, bl, bl, 0, 0.5 * Math.PI, Math.PI);
30
+ ctx.lineTo(x, y + tl);
31
+ ctx.ellipse(x + tl, y + tl, tl, tl, 0, Math.PI, 1.5 * Math.PI);
32
+ }
33
+ export function roundedRectWithBorder(ctx, x, y, width, height, radius, borderWidth, borderRadius, borderColor, borderAsym, renderContext) {
34
+ if (borderAsym === false) {
35
+ const bWidth = borderWidth[0];
36
+ const bHalfWidth = bWidth * 0.5;
37
+ const path = new Path2D();
38
+ roundRect(path, x, y, width, height, radius);
39
+ ctx.clip(path);
40
+ renderContext();
41
+ if (bWidth > 0) {
42
+ ctx.beginPath();
43
+ ctx.lineWidth = bWidth;
44
+ ctx.strokeStyle = borderColor;
45
+ roundRect(ctx, x + bHalfWidth, y + bHalfWidth, width - bWidth, height - bWidth, borderRadius);
46
+ ctx.stroke();
47
+ }
48
+ return;
49
+ }
50
+ ctx.beginPath();
51
+ roundRect(ctx, x, y, width, height, radius);
52
+ ctx.fillStyle = borderColor;
53
+ ctx.fill();
54
+ const { 0: t, 1: r, 2: b, 3: l } = borderWidth;
55
+ const path = new Path2D();
56
+ roundRect(path, x + l, y + t, width - (l + r), height - (t + b), borderRadius);
57
+ ctx.clip(path);
58
+ renderContext();
59
+ }
60
+ export function shadow(ctx, x, y, width, height, color, projection, radius, pixelRatio) {
61
+ ctx.save();
62
+ const cw = ctx.canvas.width;
63
+ const ch = ctx.canvas.height;
64
+ const scaleFactor = (2 * projection[3] + width) / width;
65
+ ctx.scale(scaleFactor, scaleFactor);
66
+ ctx.shadowColor = color;
67
+ ctx.shadowBlur = projection[2] * pixelRatio;
68
+ ctx.shadowOffsetX = projection[0] + cw * pixelRatio - projection[3] * 0.5;
69
+ ctx.shadowOffsetY = projection[1] + ch * pixelRatio - projection[3] * 0.5;
70
+ const spreadFactor = projection[3];
71
+ ctx.beginPath();
72
+ roundRect(ctx, (x - spreadFactor - cw) / scaleFactor, (y - spreadFactor - ch) / scaleFactor, width + spreadFactor, height + spreadFactor, radius);
73
+ ctx.fillStyle = color;
74
+ ctx.fill();
75
+ ctx.restore();
76
+ }
77
+ export function strokeLine(ctx, x, y, x2, y2, lineWidth) {
78
+ ctx.beginPath();
79
+ ctx.lineWidth = lineWidth;
80
+ ctx.moveTo(x, y);
81
+ ctx.lineTo(x2, y2);
82
+ ctx.stroke();
83
+ }
84
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../../../../../src/core/shaders/canvas/utils/render.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xB,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IAC5C,GAAG,CAAC,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1E,GAAG,CAAC,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IAE1E,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACnC,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,SAAS,CACP,GAAG,EACH,CAAC,CAAC,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,WAAW,EACrC,CAAC,CAAC,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,WAAW,EACrC,KAAK,GAAG,YAAY,EACpB,MAAM,GAAG,YAAY,EACrB,MAAM,CACP,CAAC;IACF,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;IACtB,GAAG,CAAC,IAAI,EAAE,CAAC;IACX,GAAG,CAAC,OAAO,EAAE,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,GAA6B,EAC7B,CAAS,EACT,CAAS,EACT,EAAU,EACV,EAAU,EACV,SAAiB;IAEjB,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;IAC1B,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjB,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACnB,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
2
+ import { type PrefixedType } from './shaderUtils.js';
3
+ /**
4
+ * Properties of the {@link Border} shader
5
+ */
6
+ export interface BorderProps {
7
+ /**
8
+ * Width of the border in pixels
9
+ *
10
+ * @default 0
11
+ */
12
+ width: number | [number, number, number, number];
13
+ /**
14
+ * Color of the border in 0xRRGGBBAA
15
+ *
16
+ * @default 0xffffffff
17
+ */
18
+ color: number;
19
+ /**
20
+ * Top width
21
+ */
22
+ top: number;
23
+ /**
24
+ * Right width
25
+ */
26
+ right: number;
27
+ /**
28
+ * Bottom width
29
+ */
30
+ bottom: number;
31
+ /**
32
+ * Left width
33
+ */
34
+ left: number;
35
+ }
36
+ export declare function getBorderProps<P extends string>(prefix?: P): PrefixedType<BorderProps, P>;
37
+ export declare const BorderTemplate: CoreShaderType<BorderProps>;
@@ -0,0 +1,73 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ import { validateArrayLength4 } from './shaderUtils.js';
18
+ export function getBorderProps(prefix) {
19
+ const pf = prefix && prefix.length > 0 ? `${prefix}-` : '';
20
+ const width = pf + 'width';
21
+ return {
22
+ [width]: {
23
+ default: [0, 0, 0, 0],
24
+ resolve(value) {
25
+ if (value !== undefined) {
26
+ return validateArrayLength4(value);
27
+ }
28
+ return [].concat(this.default);
29
+ },
30
+ },
31
+ [pf + 'color']: 0xffffffff,
32
+ [pf + 'top']: {
33
+ default: 0,
34
+ set(value, props) {
35
+ props[width][0] = value;
36
+ },
37
+ get(props) {
38
+ return props[width][0];
39
+ },
40
+ },
41
+ [pf + 'right']: {
42
+ default: 0,
43
+ set(value, props) {
44
+ props[width][1] = value;
45
+ },
46
+ get(props) {
47
+ return props[width][1];
48
+ },
49
+ },
50
+ [pf + 'bottom']: {
51
+ default: 0,
52
+ set(value, props) {
53
+ props[width][2] = value;
54
+ },
55
+ get(props) {
56
+ return props[width][2];
57
+ },
58
+ },
59
+ [pf + 'left']: {
60
+ default: 0,
61
+ set(value, props) {
62
+ props[width][3] = value;
63
+ },
64
+ get(props) {
65
+ return props[width][3];
66
+ },
67
+ },
68
+ };
69
+ }
70
+ export const BorderTemplate = {
71
+ props: getBorderProps(),
72
+ };
73
+ //# sourceMappingURL=BorderTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BorderTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/BorderTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,oBAAoB,EAAqB,MAAM,kBAAkB,CAAC;AAoC3E,MAAM,UAAU,cAAc,CAC5B,MAAU;IAEV,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC;IAC3B,OAAO;QACL,CAAC,KAAK,CAAC,EAAE;YACP,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK;gBACX,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,OAAQ,EAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC;SACF;QACD,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,UAAU;QAC1B,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE;YACZ,OAAO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2
+ /**
3
+ * Properties of the {@link HolePunch} shader
4
+ */
5
+ export interface HolePunchProps {
6
+ /**
7
+ * X position where the hole punch starts
8
+ */
9
+ x: number;
10
+ /**
11
+ * Y position where the hole punch starts
12
+ */
13
+ y: number;
14
+ /**
15
+ * Width of the hole punch
16
+ */
17
+ width: number;
18
+ /**
19
+ * height of the hole punch
20
+ *
21
+ * @remarks if not defined uses the width value
22
+ */
23
+ height: number;
24
+ /**
25
+ * Corner radius in pixels, to cut out of the corners of the hole punch
26
+ *
27
+ * @remarks
28
+ * You can input an array with a length of up to four or a number.
29
+ *
30
+ * array length 4:
31
+ * [topLeft, topRight, bottomRight, bottomLeft]
32
+ *
33
+ * array length 2:
34
+ * [20, 40] -> [20(topLeft), 40(topRight), 20(bottomRight), 40(bottomLeft)]
35
+ *
36
+ * array length 3:
37
+ * [20, 40, 60] -> [20(topLeft), 40(topRight), 60(bottomRight), 20(bottomLeft)]
38
+ *
39
+ * number:
40
+ * 30 -> [30, 30, 30, 30]
41
+ *
42
+ * @default -1
43
+ */
44
+ radius: number | number[];
45
+ }
46
+ export declare const HolePunchTemplate: CoreShaderType<HolePunchProps>;
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ import { validateArrayLength4 } from './shaderUtils.js';
18
+ export const HolePunchTemplate = {
19
+ props: {
20
+ x: 0,
21
+ y: 0,
22
+ width: 50,
23
+ height: 50,
24
+ radius: {
25
+ default: [0, 0, 0, 0],
26
+ resolve(value) {
27
+ if (value !== undefined) {
28
+ return validateArrayLength4(value);
29
+ }
30
+ return [].concat(this.default);
31
+ },
32
+ },
33
+ },
34
+ };
35
+ //# sourceMappingURL=HolePunchTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HolePunchTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/HolePunchTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA+CxD,MAAM,CAAC,MAAM,iBAAiB,GAAmC;IAC/D,KAAK,EAAE;QACL,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE;YACN,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK;gBACX,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,OAAQ,EAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
2
+ /**
3
+ * Properties of the {@link LinearGradient} shader
4
+ */
5
+ export interface LinearGradientProps {
6
+ /**
7
+ * Array of colors to be used in the LinearGradient shader
8
+ *
9
+ * @default [0xff000000, 0xffffffff]
10
+ */
11
+ colors: number[];
12
+ /**
13
+ * Angle of the LinearGradient shader, Angle in Radians
14
+ *
15
+ * @default 0
16
+ */
17
+ angle: number;
18
+ /**
19
+ * Array of color stops
20
+ */
21
+ stops: number[];
22
+ }
23
+ export declare const LinearGradientTemplate: CoreShaderType<LinearGradientProps>;
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ export const LinearGradientTemplate = {
18
+ props: {
19
+ colors: {
20
+ default: [0x000000ff, 0xffffffff],
21
+ resolve(value) {
22
+ if (value !== undefined && value.length > 0) {
23
+ return value;
24
+ }
25
+ return [].concat(this.default);
26
+ },
27
+ },
28
+ stops: {
29
+ default: [0, 1],
30
+ resolve(value, props) {
31
+ if (value !== undefined && value.length === props.colors.length) {
32
+ return value;
33
+ }
34
+ if (value === undefined) {
35
+ value = [];
36
+ }
37
+ const len = props.colors.length;
38
+ for (let i = 0; i < len; i++) {
39
+ value[i] = i * (1 / (len - 1));
40
+ }
41
+ return value;
42
+ },
43
+ },
44
+ angle: 0,
45
+ },
46
+ };
47
+ //# sourceMappingURL=LinearGradientTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinearGradientTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/LinearGradientTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0BH,MAAM,CAAC,MAAM,sBAAsB,GAAwC;IACzE,KAAK,EAAE;QACL,MAAM,EAAE;YACN,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;YACjC,OAAO,CAAC,KAAK;gBACX,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC5C,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,OAAQ,EAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACf,OAAO,CAAC,KAAK,EAAE,KAAK;gBAClB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;oBAChE,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,KAAK,GAAG,EAAE,CAAC;gBACb,CAAC;gBACD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;gBAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC7B,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBACjC,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SACF;QACD,KAAK,EAAE,CAAC;KACT;CACF,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
2
+ /**
3
+ * Properties of the {@link RadialGradient} shader
4
+ */
5
+ export interface RadialGradientProps {
6
+ /**
7
+ * Array of colors to be used in the RadialGradient shader
8
+ *
9
+ * @default [0xff000000, 0xffffffff]
10
+ */
11
+ colors: number[];
12
+ /**
13
+ * Array of color stops
14
+ */
15
+ stops: number[];
16
+ /**
17
+ * Width of the RadialGradientEffect
18
+ */
19
+ width: number;
20
+ /**
21
+ * height of the RadialGradientEffect
22
+ *
23
+ * @remarks if not defined uses the width value
24
+ */
25
+ height: number;
26
+ /**
27
+ * center point of where the RadialGradientEffect is drawn
28
+ */
29
+ pivot: [number, number];
30
+ }
31
+ export declare const RadialGradientTemplate: CoreShaderType<RadialGradientProps>;