@babylonjs/core 7.51.1 → 7.51.3

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 (343) hide show
  1. package/Animations/animation.js +2 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/Buffers/bufferUtils.d.ts +7 -5
  4. package/Buffers/bufferUtils.js +13 -9
  5. package/Buffers/bufferUtils.js.map +1 -1
  6. package/Engines/ICanvas.d.ts +96 -1
  7. package/Engines/ICanvas.js.map +1 -1
  8. package/Engines/Native/nativeInterfaces.d.ts +7 -1
  9. package/Engines/Native/nativeInterfaces.js.map +1 -1
  10. package/Engines/WebGPU/webgpuTextureManager.js +3 -3
  11. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  12. package/Engines/abstractEngine.d.ts +7 -1
  13. package/Engines/abstractEngine.js +10 -2
  14. package/Engines/abstractEngine.js.map +1 -1
  15. package/Engines/constants.d.ts +32 -0
  16. package/Engines/constants.js +33 -0
  17. package/Engines/constants.js.map +1 -1
  18. package/Engines/nativeEngine.d.ts +7 -1
  19. package/Engines/nativeEngine.js +12 -0
  20. package/Engines/nativeEngine.js.map +1 -1
  21. package/Engines/webgpuEngine.js +6 -3
  22. package/Engines/webgpuEngine.js.map +1 -1
  23. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +148 -465
  24. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +394 -691
  25. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  26. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.d.ts +142 -0
  27. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js +342 -0
  28. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js.map +1 -0
  29. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +111 -0
  30. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +141 -0
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -0
  32. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +77 -0
  33. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +139 -0
  34. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -0
  35. package/FlowGraph/Blocks/Data/Math/index.d.ts +3 -0
  36. package/FlowGraph/Blocks/Data/Math/index.js +3 -0
  37. package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
  38. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +85 -0
  39. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +133 -0
  40. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -0
  41. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.d.ts +49 -0
  42. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js +71 -0
  43. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js.map +1 -0
  44. package/FlowGraph/Blocks/Data/Transformers/index.d.ts +2 -0
  45. package/FlowGraph/Blocks/Data/Transformers/index.js +3 -0
  46. package/FlowGraph/Blocks/Data/Transformers/index.js.map +1 -0
  47. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.d.ts +39 -0
  48. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js +46 -0
  49. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js.map +1 -0
  50. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.d.ts +35 -0
  51. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +34 -0
  52. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -0
  53. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.d.ts +20 -0
  54. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js +25 -0
  55. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js.map +1 -0
  56. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.d.ts +34 -0
  57. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js +35 -0
  58. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js.map +1 -0
  59. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.d.ts +39 -0
  60. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js +42 -0
  61. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js.map +1 -0
  62. package/FlowGraph/Blocks/Data/Utils/index.d.ts +5 -0
  63. package/FlowGraph/Blocks/Data/Utils/index.js +6 -0
  64. package/FlowGraph/Blocks/Data/Utils/index.js.map +1 -0
  65. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +0 -1
  66. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -2
  67. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
  69. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +4 -4
  70. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  71. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +6 -3
  72. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +12 -6
  73. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  74. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +0 -2
  75. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +2 -3
  76. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  77. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +5 -4
  78. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -4
  79. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  80. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.d.ts +62 -0
  81. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js +41 -0
  82. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js.map +1 -0
  83. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +38 -33
  84. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +42 -25
  85. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -16
  87. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +9 -17
  88. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  89. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +1 -1
  90. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +1 -1
  91. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.d.ts → flowGraphTransformCoordinatesSystemBlock.d.ts} +1 -2
  93. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.js → flowGraphTransformCoordinatesSystemBlock.js} +4 -5
  94. package/FlowGraph/Blocks/Data/flowGraphTransformCoordinatesSystemBlock.js.map +1 -0
  95. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
  96. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
  97. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  98. package/FlowGraph/Blocks/Data/index.d.ts +7 -3
  99. package/FlowGraph/Blocks/Data/index.js +9 -4
  100. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  101. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +45 -24
  102. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +45 -51
  103. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  104. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.d.ts +61 -0
  105. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js +39 -0
  106. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js.map +1 -0
  107. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.d.ts +61 -0
  108. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js +40 -0
  109. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js.map +1 -0
  110. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +12 -14
  111. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +19 -26
  112. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  113. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -12
  114. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +13 -24
  115. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  116. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +31 -7
  117. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +22 -20
  118. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  119. package/FlowGraph/Blocks/{Execution → Event}/flowGraphSendCustomEventBlock.d.ts +12 -7
  120. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +39 -0
  121. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -0
  122. package/FlowGraph/Blocks/Event/index.d.ts +3 -0
  123. package/FlowGraph/Blocks/Event/index.js +3 -0
  124. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.d.ts +44 -0
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js +46 -0
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js.map +1 -0
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.d.ts +60 -0
  129. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js +93 -0
  130. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js.map +1 -0
  131. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.d.ts +82 -0
  132. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +105 -0
  133. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -0
  134. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
  135. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +2 -2
  136. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  137. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +40 -42
  138. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +116 -50
  139. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  140. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +12 -4
  141. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +86 -8
  142. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  143. package/FlowGraph/Blocks/Execution/Animation/index.d.ts +3 -0
  144. package/FlowGraph/Blocks/Execution/Animation/index.js +3 -0
  145. package/FlowGraph/Blocks/Execution/Animation/index.js.map +1 -1
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +1 -2
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -4
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  149. package/FlowGraph/Blocks/Execution/{Audio/flowGraphStopAudioBlock.d.ts → ControlFlow/flowGraphCancelDelayBlock.d.ts} +6 -8
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +31 -0
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -0
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +5 -5
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +0 -1
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -3
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +5 -10
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -15
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +11 -3
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +5 -6
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +27 -7
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +28 -30
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  167. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +13 -16
  168. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +50 -52
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +8 -9
  171. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -13
  172. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  173. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +32 -0
  174. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +84 -0
  175. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -0
  176. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +20 -6
  177. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +55 -16
  178. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -4
  180. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +36 -13
  181. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  182. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +13 -5
  183. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +22 -17
  184. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  185. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +12 -16
  186. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +21 -21
  187. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  188. package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +2 -1
  189. package/FlowGraph/Blocks/Execution/ControlFlow/index.js +2 -1
  190. package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
  191. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -5
  192. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +13 -8
  193. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  194. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +33 -36
  195. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +42 -26
  196. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  197. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +10 -25
  198. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +38 -24
  199. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  200. package/FlowGraph/Blocks/Execution/index.d.ts +0 -3
  201. package/FlowGraph/Blocks/Execution/index.js +0 -3
  202. package/FlowGraph/Blocks/Execution/index.js.map +1 -1
  203. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +16 -0
  204. package/FlowGraph/Blocks/flowGraphBlockFactory.js +292 -0
  205. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -0
  206. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +145 -0
  207. package/FlowGraph/Blocks/flowGraphBlockNames.js +147 -0
  208. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -0
  209. package/FlowGraph/Blocks/index.d.ts +2 -0
  210. package/FlowGraph/Blocks/index.js +2 -0
  211. package/FlowGraph/Blocks/index.js.map +1 -1
  212. package/FlowGraph/{flowGraphInteger.d.ts → CustomTypes/flowGraphInteger.d.ts} +2 -3
  213. package/FlowGraph/{flowGraphInteger.js → CustomTypes/flowGraphInteger.js} +4 -5
  214. package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -0
  215. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +196 -0
  216. package/FlowGraph/CustomTypes/flowGraphMatrix.js +272 -0
  217. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -0
  218. package/FlowGraph/CustomTypes/index.d.ts +2 -0
  219. package/FlowGraph/CustomTypes/index.js +3 -0
  220. package/FlowGraph/CustomTypes/index.js.map +1 -0
  221. package/FlowGraph/flowGraph.d.ts +29 -34
  222. package/FlowGraph/flowGraph.js +120 -104
  223. package/FlowGraph/flowGraph.js.map +1 -1
  224. package/FlowGraph/flowGraphAssetsContext.d.ts +29 -0
  225. package/FlowGraph/flowGraphAssetsContext.js +52 -0
  226. package/FlowGraph/flowGraphAssetsContext.js.map +1 -0
  227. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +15 -8
  228. package/FlowGraph/flowGraphAsyncExecutionBlock.js +25 -5
  229. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  230. package/FlowGraph/flowGraphBlock.d.ts +22 -15
  231. package/FlowGraph/flowGraphBlock.js +31 -52
  232. package/FlowGraph/flowGraphBlock.js.map +1 -1
  233. package/FlowGraph/flowGraphConnection.d.ts +13 -12
  234. package/FlowGraph/flowGraphConnection.js +31 -16
  235. package/FlowGraph/flowGraphConnection.js.map +1 -1
  236. package/FlowGraph/flowGraphContext.d.ts +89 -13
  237. package/FlowGraph/flowGraphContext.js +210 -23
  238. package/FlowGraph/flowGraphContext.js.map +1 -1
  239. package/FlowGraph/flowGraphCoordinator.d.ts +4 -10
  240. package/FlowGraph/flowGraphCoordinator.js +4 -16
  241. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  242. package/FlowGraph/flowGraphDataConnection.d.ts +52 -14
  243. package/FlowGraph/flowGraphDataConnection.js +73 -26
  244. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  245. package/FlowGraph/flowGraphEventBlock.d.ts +17 -1
  246. package/FlowGraph/flowGraphEventBlock.js +13 -2
  247. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  248. package/FlowGraph/flowGraphEventType.d.ts +16 -0
  249. package/FlowGraph/flowGraphEventType.js +18 -0
  250. package/FlowGraph/flowGraphEventType.js.map +1 -0
  251. package/FlowGraph/flowGraphExecutionBlock.d.ts +11 -1
  252. package/FlowGraph/flowGraphExecutionBlock.js +21 -2
  253. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  254. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.d.ts +2 -2
  255. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js +0 -1
  256. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -1
  257. package/FlowGraph/flowGraphLogger.d.ts +60 -0
  258. package/FlowGraph/flowGraphLogger.js +53 -0
  259. package/FlowGraph/flowGraphLogger.js.map +1 -0
  260. package/FlowGraph/flowGraphParser.d.ts +85 -0
  261. package/FlowGraph/flowGraphParser.js +271 -0
  262. package/FlowGraph/flowGraphParser.js.map +1 -0
  263. package/FlowGraph/flowGraphPathConverter.d.ts +1 -1
  264. package/FlowGraph/flowGraphPathConverter.js +3 -2
  265. package/FlowGraph/flowGraphPathConverter.js.map +1 -1
  266. package/FlowGraph/flowGraphPathConverterComponent.d.ts +8 -1
  267. package/FlowGraph/flowGraphPathConverterComponent.js +18 -2
  268. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  269. package/FlowGraph/flowGraphRichTypes.d.ts +51 -9
  270. package/FlowGraph/flowGraphRichTypes.js +160 -50
  271. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  272. package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +45 -0
  273. package/FlowGraph/flowGraphSceneEventCoordinator.js +77 -0
  274. package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -0
  275. package/FlowGraph/flowGraphSignalConnection.d.ts +8 -5
  276. package/FlowGraph/flowGraphSignalConnection.js +26 -9
  277. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  278. package/FlowGraph/index.d.ts +6 -1
  279. package/FlowGraph/index.js +7 -1
  280. package/FlowGraph/index.js.map +1 -1
  281. package/FlowGraph/serialization.d.ts +5 -2
  282. package/FlowGraph/serialization.js +94 -22
  283. package/FlowGraph/serialization.js.map +1 -1
  284. package/FlowGraph/typeDefinitions.d.ts +74 -12
  285. package/FlowGraph/typeDefinitions.js.map +1 -1
  286. package/FlowGraph/utils.d.ts +47 -0
  287. package/FlowGraph/utils.js +55 -0
  288. package/FlowGraph/utils.js.map +1 -1
  289. package/Layers/effectLayer.d.ts +5 -0
  290. package/Layers/effectLayer.js +7 -0
  291. package/Layers/effectLayer.js.map +1 -1
  292. package/Loading/sceneLoader.d.ts +25 -11
  293. package/Loading/sceneLoader.js +28 -11
  294. package/Loading/sceneLoader.js.map +1 -1
  295. package/Materials/material.js +1 -0
  296. package/Materials/material.js.map +1 -1
  297. package/Maths/math.path.js +3 -0
  298. package/Maths/math.path.js.map +1 -1
  299. package/Meshes/csg2.d.ts +2 -2
  300. package/Meshes/csg2.js +2 -2
  301. package/Meshes/csg2.js.map +1 -1
  302. package/Meshes/geometry.d.ts +2 -1
  303. package/Meshes/geometry.js +8 -2
  304. package/Meshes/geometry.js.map +1 -1
  305. package/Meshes/instancedMesh.d.ts +5 -0
  306. package/Meshes/instancedMesh.js +6 -0
  307. package/Meshes/instancedMesh.js.map +1 -1
  308. package/Meshes/mesh.d.ts +2 -1
  309. package/Meshes/mesh.js +3 -2
  310. package/Meshes/mesh.js.map +1 -1
  311. package/Misc/environmentTextureTools.js +2 -2
  312. package/Misc/environmentTextureTools.js.map +1 -1
  313. package/ObjectModel/objectModelInterfaces.d.ts +2 -2
  314. package/ObjectModel/objectModelInterfaces.js.map +1 -1
  315. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +26 -18
  316. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
  317. package/package.json +1 -1
  318. package/scene.js +8 -0
  319. package/scene.js.map +1 -1
  320. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +0 -24
  321. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +0 -39
  322. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +0 -1
  323. package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
  324. package/FlowGraph/Blocks/Data/Logic/index.js +0 -2
  325. package/FlowGraph/Blocks/Data/Logic/index.js.map +0 -1
  326. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +0 -1
  327. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +0 -19
  328. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +0 -26
  329. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +0 -1
  330. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +0 -25
  331. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +0 -1
  332. package/FlowGraph/Blocks/Execution/Audio/index.d.ts +0 -2
  333. package/FlowGraph/Blocks/Execution/Audio/index.js +0 -3
  334. package/FlowGraph/Blocks/Execution/Audio/index.js.map +0 -1
  335. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +0 -31
  336. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +0 -69
  337. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +0 -1
  338. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +0 -38
  339. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +0 -1
  340. package/FlowGraph/flowGraphContextLogger.d.ts +0 -9
  341. package/FlowGraph/flowGraphContextLogger.js +0 -14
  342. package/FlowGraph/flowGraphContextLogger.js.map +0 -1
  343. package/FlowGraph/flowGraphInteger.js.map +0 -1
@@ -0,0 +1,133 @@
1
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphPathConverterComponent } from "../../../flowGraphPathConverterComponent.js";
3
+ import { RichTypeAny } from "../../../flowGraphRichTypes.js";
4
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
5
+ import { Color3, Color4 } from "../../../../Maths/math.color.js";
6
+ /**
7
+ * This block will take a JSON pointer and parse it to get the value from the JSON object.
8
+ * The output is an object and a property name.
9
+ * Optionally, the block can also output the value of the property. This is configurable.
10
+ */
11
+ export class FlowGraphJsonPointerParserBlock extends FlowGraphBlock {
12
+ constructor(
13
+ /**
14
+ * the configuration of the block
15
+ */
16
+ config) {
17
+ super(config);
18
+ this.config = config;
19
+ this.object = this.registerDataOutput("object", RichTypeAny);
20
+ this.propertyName = this.registerDataOutput("propertyName", RichTypeAny);
21
+ this.isValid = this.registerDataOutput("isValid", RichTypeAny);
22
+ if (config.outputValue) {
23
+ this.value = this.registerDataOutput("value", RichTypeAny);
24
+ }
25
+ this.setterFunction = this.registerDataOutput("setFunction", RichTypeAny, this._setPropertyValue.bind(this));
26
+ this.getterFunction = this.registerDataOutput("getFunction", RichTypeAny, this._getPropertyValue.bind(this));
27
+ this.generateAnimationsFunction = this.registerDataOutput("generateAnimationsFunction", RichTypeAny, this._getInterpolationAnimationPropertyInfo.bind(this));
28
+ this.templateComponent = new FlowGraphPathConverterComponent(config.jsonPointer, this);
29
+ }
30
+ _updateOutputs(context) {
31
+ try {
32
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
33
+ const value = accessorContainer.info.get(accessorContainer.object);
34
+ const object = accessorContainer.info.getTarget?.(accessorContainer.object);
35
+ const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);
36
+ if (!object) {
37
+ this.isValid.setValue(false, context);
38
+ return;
39
+ }
40
+ else {
41
+ this.object.setValue(object, context);
42
+ if (propertyName) {
43
+ this.propertyName.setValue(propertyName, context);
44
+ }
45
+ this.isValid.setValue(true, context);
46
+ }
47
+ if (this.config.outputValue) {
48
+ if (value === undefined) {
49
+ this.isValid.setValue(false, context);
50
+ }
51
+ else {
52
+ this.value.setValue(value, context);
53
+ this.isValid.setValue(true, context);
54
+ }
55
+ }
56
+ }
57
+ catch (e) {
58
+ this.isValid.setValue(false, context);
59
+ return;
60
+ }
61
+ }
62
+ _setPropertyValue(_target, _propertyName, value, context) {
63
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
64
+ const type = accessorContainer.info.type;
65
+ if (type.startsWith("Color")) {
66
+ value = ToColor(value, type);
67
+ }
68
+ accessorContainer.info.set?.(value, accessorContainer.object);
69
+ }
70
+ _getPropertyValue(_target, _propertyName, context) {
71
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
72
+ return accessorContainer.info.get(accessorContainer.object);
73
+ }
74
+ _getInterpolationAnimationPropertyInfo(_target, _propertyName, context) {
75
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
76
+ return (keys, fps, animationType, easingFunction) => {
77
+ const animations = [];
78
+ // make sure keys are of the right type (in case of float3 color/vector)
79
+ const type = accessorContainer.info.type;
80
+ if (type.startsWith("Color")) {
81
+ keys = keys.map((key) => {
82
+ return {
83
+ frame: key.frame,
84
+ value: ToColor(key.value, type),
85
+ };
86
+ });
87
+ }
88
+ accessorContainer.info.interpolation?.forEach((info, index) => {
89
+ const name = accessorContainer.info.getPropertyName?.[index](accessorContainer.object) || "Animation-interpolation-" + index;
90
+ // generate the keys based on interpolation info
91
+ let newKeys = keys;
92
+ if (animationType !== info.type) {
93
+ // convert the keys to the right type
94
+ newKeys = keys.map((key) => {
95
+ return {
96
+ frame: key.frame,
97
+ value: info.getValue(undefined, key.value.asArray ? key.value.asArray() : [key.value], 0, 1),
98
+ };
99
+ });
100
+ }
101
+ const animationData = info.buildAnimations(accessorContainer.object, name, 60, newKeys);
102
+ animationData.forEach((animation) => {
103
+ if (easingFunction) {
104
+ animation.babylonAnimation.setEasingFunction(easingFunction);
105
+ }
106
+ animations.push(animation.babylonAnimation);
107
+ });
108
+ });
109
+ return animations;
110
+ };
111
+ }
112
+ /**
113
+ * Gets the class name of this block
114
+ * @returns the class name
115
+ */
116
+ getClassName() {
117
+ return "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */;
118
+ }
119
+ }
120
+ function ToColor(value, expectedValue) {
121
+ if (value.getClassName().startsWith("Color")) {
122
+ return value;
123
+ }
124
+ if (expectedValue === "Color3") {
125
+ return new Color3(value.x, value.y, value.z);
126
+ }
127
+ else if (expectedValue === "Color4") {
128
+ return new Color4(value.x, value.y, value.z, value.w);
129
+ }
130
+ return value;
131
+ }
132
+ RegisterClass("FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, FlowGraphJsonPointerParserBlock);
133
+ //# sourceMappingURL=flowGraphJsonPointerParserBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphJsonPointerParserBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAG/D,OAAO,EAAE,+BAA+B,EAAE,oDAAuD;AACjG,OAAO,EAAE,WAAW,EAAE,uCAA0C;AAIhE,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAIpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,wCAA8B;AAqBvD;;;;GAIG;AACH,MAAM,OAAO,+BAA6E,SAAQ,cAAc;IA0C5G;IACI;;OAEG;IACa,MAAqD;QAErE,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAA+C;QAGrE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,C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N,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,qFAA6C;IACjD,CAAC;CACJ;AAED,SAAS,OAAO,CAAC,KAAU,EAAE,aAAqB;IAC9C,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3C,OAAO,KAAmC,CAAC;IAC/C,CAAC;IACD,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;SAAM,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,aAAa,gFAAwC,+BAA+B,CAAC,CAAC","sourcesContent":["import type { FlowGraphAssetType } from \"core/FlowGraph/flowGraphAssetsContext\";\nimport type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { FlowGraphPathConverterComponent } from \"core/FlowGraph/flowGraphPathConverterComponent\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes\";\nimport type { IObjectAccessor } from \"core/FlowGraph/typeDefinitions\";\nimport type { IPathToObjectConverter } from \"core/ObjectModel/objectModelInterfaces\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport type { Animation } from \"core/Animations/animation\";\nimport type { EasingFunction } from \"core/Animations/easing\";\nimport type { Vector4 } from \"core/Maths/math.vector\";\nimport { Color3, Color4 } from \"core/Maths/math.color\";\n\n/**\n * Configuration for the JSON pointer parser block.\n */\nexport interface IFlowGraphJsonPointerParserBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The JSON pointer to parse.\n */\n jsonPointer: string;\n /**\n * The path converter to use to convert the path to an object accessor.\n */\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\n\n /**\n * Whether to output the value of the property.\n */\n outputValue?: boolean;\n}\n\n/**\n * This block will take a JSON pointer and parse it to get the value from the JSON object.\n * The output is an object and a property name.\n * Optionally, the block can also output the value of the property. This is configurable.\n */\nexport class FlowGraphJsonPointerParserBlock<P extends any, O extends FlowGraphAssetType> extends FlowGraphBlock {\n /**\n * Output connection: The object that contains the property.\n */\n public readonly object: FlowGraphDataConnection<O>;\n\n /**\n * Output connection: The property name.\n */\n public readonly propertyName: FlowGraphDataConnection<string>;\n\n /**\n * Output connection: The value of the property.\n * Note that per default this is not outputted. It can be enabled by setting the outputValue property to true.\n */\n public readonly value: FlowGraphDataConnection<P>;\n\n /**\n * Output connection: A function that can be used to update the value of the property.\n */\n public readonly setterFunction: FlowGraphDataConnection<(target: O, propertyName: string, value: P, context: FlowGraphContext) => void>;\n\n /**\n * Output connection: A function that can be used to get the value of the property.\n */\n public readonly getterFunction: FlowGraphDataConnection<(target: O, propertyName: string, context: FlowGraphContext) => P | undefined>;\n\n /**\n * Output connection: A function that can be used to get the interpolation animation property info.\n */\n public readonly generateAnimationsFunction: FlowGraphDataConnection<() => (keys: any[], fps: number, easingFunction?: EasingFunction) => Animation[]>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n /**\n * The component with the templated inputs for the provided path.\n */\n public readonly templateComponent: FlowGraphPathConverterComponent;\n\n constructor(\n /**\n * the configuration of the block\n */\n public override config: IFlowGraphJsonPointerParserBlockConfiguration\n ) {\n super(config);\n this.object = this.registerDataOutput(\"object\", RichTypeAny);\n this.propertyName = this.registerDataOutput(\"propertyName\", RichTypeAny);\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeAny);\n if (config.outputValue) {\n this.value = this.registerDataOutput(\"value\", RichTypeAny);\n }\n this.setterFunction = this.registerDataOutput(\"setFunction\", RichTypeAny, this._setPropertyValue.bind(this));\n this.getterFunction = this.registerDataOutput(\"getFunction\", RichTypeAny, this._getPropertyValue.bind(this));\n this.generateAnimationsFunction = this.registerDataOutput(\"generateAnimationsFunction\", RichTypeAny, this._getInterpolationAnimationPropertyInfo.bind(this));\n this.templateComponent = new FlowGraphPathConverterComponent(config.jsonPointer, this);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n try {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n const value = accessorContainer.info.get(accessorContainer.object);\n const object = accessorContainer.info.getTarget?.(accessorContainer.object);\n const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);\n if (!object) {\n this.isValid.setValue(false, context);\n return;\n } else {\n this.object.setValue(object, context);\n if (propertyName) {\n this.propertyName.setValue(propertyName, context);\n }\n this.isValid.setValue(true, context);\n }\n if (this.config.outputValue) {\n if (value === undefined) {\n this.isValid.setValue(false, context);\n } else {\n this.value.setValue(value, context);\n this.isValid.setValue(true, context);\n }\n }\n } catch (e) {\n this.isValid.setValue(false, context);\n return;\n }\n }\n\n private _setPropertyValue(_target: O, _propertyName: string, value: P, context: FlowGraphContext): void {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n const type = accessorContainer.info.type;\n if (type.startsWith(\"Color\")) {\n value = ToColor(value as Vector4, type) as unknown as P;\n }\n accessorContainer.info.set?.(value, accessorContainer.object);\n }\n\n private _getPropertyValue(_target: O, _propertyName: string, context: FlowGraphContext): P | undefined {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n return accessorContainer.info.get(accessorContainer.object);\n }\n\n private _getInterpolationAnimationPropertyInfo(\n _target: O,\n _propertyName: string,\n context: FlowGraphContext\n ): (keys: any[], fps: number, animationType: number, easingFunction?: EasingFunction) => Animation[] {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n return (keys: any[], fps: number, animationType: number, easingFunction?: EasingFunction) => {\n const animations: Animation[] = [];\n // make sure keys are of the right type (in case of float3 color/vector)\n const type = accessorContainer.info.type;\n if (type.startsWith(\"Color\")) {\n keys = keys.map((key) => {\n return {\n frame: key.frame,\n value: ToColor(key.value, type),\n };\n });\n }\n accessorContainer.info.interpolation?.forEach((info, index) => {\n const name = accessorContainer.info.getPropertyName?.[index](accessorContainer.object) || \"Animation-interpolation-\" + index;\n // generate the keys based on interpolation info\n let newKeys: any[] = keys;\n if (animationType !== info.type) {\n // convert the keys to the right type\n newKeys = keys.map((key) => {\n return {\n frame: key.frame,\n value: info.getValue(undefined, key.value.asArray ? key.value.asArray() : [key.value], 0, 1),\n };\n });\n }\n const animationData = info.buildAnimations(accessorContainer.object, name, 60, newKeys);\n animationData.forEach((animation) => {\n if (easingFunction) {\n animation.babylonAnimation.setEasingFunction(easingFunction);\n }\n animations.push(animation.babylonAnimation);\n });\n });\n\n return animations;\n };\n }\n\n /**\n * Gets the class name of this block\n * @returns the class name\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.JsonPointerParser;\n }\n}\n\nfunction ToColor(value: any, expectedValue: string) {\n if (value.getClassName().startsWith(\"Color\")) {\n return value as unknown as Color3 | Color4;\n }\n if (expectedValue === \"Color3\") {\n return new Color3(value.x, value.y, value.z);\n } else if (expectedValue === \"Color4\") {\n return new Color4(value.x, value.y, value.z, value.w);\n }\n return value;\n}\n\nRegisterClass(FlowGraphBlockNames.JsonPointerParser, FlowGraphJsonPointerParserBlock);\n"]}
@@ -0,0 +1,49 @@
1
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock";
3
+ import { FlowGraphInteger } from "../../../CustomTypes/flowGraphInteger.js";
4
+ /**
5
+ * A block that converts a boolean to a float.
6
+ */
7
+ export declare class FlowGraphBooleanToFloat extends FlowGraphUnaryOperationBlock<boolean, number> {
8
+ constructor(config?: IFlowGraphBlockConfiguration);
9
+ }
10
+ /**
11
+ * A block that converts a boolean to an integer
12
+ */
13
+ export declare class FlowGraphBooleanToInt extends FlowGraphUnaryOperationBlock<boolean, FlowGraphInteger> {
14
+ constructor(config?: IFlowGraphBlockConfiguration);
15
+ }
16
+ /**
17
+ * A block that converts a float to a boolean.
18
+ */
19
+ export declare class FlowGraphFloatToBoolean extends FlowGraphUnaryOperationBlock<number, boolean> {
20
+ constructor(config?: IFlowGraphBlockConfiguration);
21
+ }
22
+ /**
23
+ * A block that converts an integer to a boolean.
24
+ */
25
+ export declare class FlowGraphIntToBoolean extends FlowGraphUnaryOperationBlock<FlowGraphInteger, boolean> {
26
+ constructor(config?: IFlowGraphBlockConfiguration);
27
+ }
28
+ /**
29
+ * A block that converts an integer to a float.
30
+ */
31
+ export declare class FlowGraphIntToFloat extends FlowGraphUnaryOperationBlock<FlowGraphInteger, number> {
32
+ constructor(config?: IFlowGraphBlockConfiguration);
33
+ }
34
+ /**
35
+ * Configuration for the float to int block.
36
+ */
37
+ export interface IFlowGraphFloatToIntConfiguration extends IFlowGraphBlockConfiguration {
38
+ /**
39
+ * The rounding mode to use.
40
+ * if not defined, it will use the FlowGraphInteger default rounding ( a | 0 )
41
+ */
42
+ roundingMode?: "floor" | "ceil" | "round";
43
+ }
44
+ /**
45
+ * A block that converts a float to an integer.
46
+ */
47
+ export declare class FlowGraphFloatToInt extends FlowGraphUnaryOperationBlock<number, FlowGraphInteger> {
48
+ constructor(config?: IFlowGraphFloatToIntConfiguration);
49
+ }
@@ -0,0 +1,71 @@
1
+ import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
2
+ import { RichTypeBoolean, RichTypeFlowGraphInteger, RichTypeNumber } from "../../../flowGraphRichTypes.js";
3
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
4
+ import { FlowGraphInteger } from "../../../CustomTypes/flowGraphInteger.js";
5
+ /**
6
+ * A block that converts a boolean to a float.
7
+ */
8
+ export class FlowGraphBooleanToFloat extends FlowGraphUnaryOperationBlock {
9
+ constructor(config) {
10
+ super(RichTypeBoolean, RichTypeNumber, (a) => +a, "FlowGraphBooleanToFloat" /* FlowGraphBlockNames.BooleanToFloat */, config);
11
+ }
12
+ }
13
+ RegisterClass("FlowGraphBooleanToFloat" /* FlowGraphBlockNames.BooleanToFloat */, FlowGraphBooleanToFloat);
14
+ /**
15
+ * A block that converts a boolean to an integer
16
+ */
17
+ export class FlowGraphBooleanToInt extends FlowGraphUnaryOperationBlock {
18
+ constructor(config) {
19
+ super(RichTypeBoolean, RichTypeFlowGraphInteger, (a) => FlowGraphInteger.FromValue(+a), "FlowGraphBooleanToInt" /* FlowGraphBlockNames.BooleanToInt */, config);
20
+ }
21
+ }
22
+ RegisterClass("FlowGraphBooleanToInt" /* FlowGraphBlockNames.BooleanToInt */, FlowGraphBooleanToInt);
23
+ /**
24
+ * A block that converts a float to a boolean.
25
+ */
26
+ export class FlowGraphFloatToBoolean extends FlowGraphUnaryOperationBlock {
27
+ constructor(config) {
28
+ super(RichTypeNumber, RichTypeBoolean, (a) => !!a, "FlowGraphFloatToBoolean" /* FlowGraphBlockNames.FloatToBoolean */, config);
29
+ }
30
+ }
31
+ RegisterClass("FlowGraphFloatToBoolean" /* FlowGraphBlockNames.FloatToBoolean */, FlowGraphFloatToBoolean);
32
+ /**
33
+ * A block that converts an integer to a boolean.
34
+ */
35
+ export class FlowGraphIntToBoolean extends FlowGraphUnaryOperationBlock {
36
+ constructor(config) {
37
+ super(RichTypeFlowGraphInteger, RichTypeBoolean, (a) => !!a.value, "FlowGraphIntToBoolean" /* FlowGraphBlockNames.IntToBoolean */, config);
38
+ }
39
+ }
40
+ RegisterClass("FlowGraphIntToBoolean" /* FlowGraphBlockNames.IntToBoolean */, FlowGraphIntToBoolean);
41
+ /**
42
+ * A block that converts an integer to a float.
43
+ */
44
+ export class FlowGraphIntToFloat extends FlowGraphUnaryOperationBlock {
45
+ constructor(config) {
46
+ super(RichTypeFlowGraphInteger, RichTypeNumber, (a) => a.value, "FlowGraphIntToFloat" /* FlowGraphBlockNames.IntToFloat */, config);
47
+ }
48
+ }
49
+ RegisterClass("FlowGraphIntToFloat" /* FlowGraphBlockNames.IntToFloat */, FlowGraphIntToFloat);
50
+ /**
51
+ * A block that converts a float to an integer.
52
+ */
53
+ export class FlowGraphFloatToInt extends FlowGraphUnaryOperationBlock {
54
+ constructor(config) {
55
+ super(RichTypeNumber, RichTypeFlowGraphInteger, (a) => {
56
+ const roundingMode = config?.roundingMode;
57
+ switch (roundingMode) {
58
+ case "floor":
59
+ return FlowGraphInteger.FromValue(Math.floor(a));
60
+ case "ceil":
61
+ return FlowGraphInteger.FromValue(Math.ceil(a));
62
+ case "round":
63
+ return FlowGraphInteger.FromValue(Math.round(a));
64
+ default:
65
+ return FlowGraphInteger.FromValue(a);
66
+ }
67
+ }, "FlowGraphFloatToInt" /* FlowGraphBlockNames.FloatToInt */, config);
68
+ }
69
+ }
70
+ RegisterClass("FlowGraphFloatToInt" /* FlowGraphBlockNames.FloatToInt */, FlowGraphFloatToInt);
71
+ //# sourceMappingURL=flowGraphTypeToTypeBlocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphTypeToTypeBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,cAAc,EAAE,uCAA0C;AAE9G,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,gBAAgB,EAAE,iDAAoD;AAE/E;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,4BAA6C;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C,CAAC;AAYnE;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,4BAAsD;IAC3F,YAAY,MAA0C;QAClD,KAAK,CACD,cAAc,EACd,wBAAwB,EACxB,CAAC,CAAC,EAAE,EAAE;YACF,MAAM,YAAY,GAAG,MAAM,EAAE,YAAY,CAAC;YAC1C,QAAQ,YAAY,EAAE,CAAC;gBACnB,KAAK,OAAO;oBACR,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrD,KAAK,MAAM;oBACP,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpD,KAAK,OAAO;oBACR,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrD;oBACI,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC7C,CAAC;QACL,CAAC,8DAED,MAAM,CACT,CAAC;IACN,CAAC;CACJ;AAED,aAAa,6DAAiC,mBAAmB,CAAC,CAAC","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { RichTypeBoolean, RichTypeFlowGraphInteger, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphInteger } from \"core/FlowGraph/CustomTypes/flowGraphInteger\";\n\n/**\n * A block that converts a boolean to a float.\n */\nexport class FlowGraphBooleanToFloat extends FlowGraphUnaryOperationBlock<boolean, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeBoolean, RichTypeNumber, (a) => +a, FlowGraphBlockNames.BooleanToFloat, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.BooleanToFloat, FlowGraphBooleanToFloat);\n\n/**\n * A block that converts a boolean to an integer\n */\nexport class FlowGraphBooleanToInt extends FlowGraphUnaryOperationBlock<boolean, FlowGraphInteger> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeBoolean, RichTypeFlowGraphInteger, (a) => FlowGraphInteger.FromValue(+a), FlowGraphBlockNames.BooleanToInt, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.BooleanToInt, FlowGraphBooleanToInt);\n\n/**\n * A block that converts a float to a boolean.\n */\nexport class FlowGraphFloatToBoolean extends FlowGraphUnaryOperationBlock<number, boolean> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeNumber, RichTypeBoolean, (a) => !!a, FlowGraphBlockNames.FloatToBoolean, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.FloatToBoolean, FlowGraphFloatToBoolean);\n\n/**\n * A block that converts an integer to a boolean.\n */\nexport class FlowGraphIntToBoolean extends FlowGraphUnaryOperationBlock<FlowGraphInteger, boolean> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeFlowGraphInteger, RichTypeBoolean, (a) => !!a.value, FlowGraphBlockNames.IntToBoolean, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.IntToBoolean, FlowGraphIntToBoolean);\n\n/**\n * A block that converts an integer to a float.\n */\nexport class FlowGraphIntToFloat extends FlowGraphUnaryOperationBlock<FlowGraphInteger, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeFlowGraphInteger, RichTypeNumber, (a) => a.value, FlowGraphBlockNames.IntToFloat, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.IntToFloat, FlowGraphIntToFloat);\n\n/**\n * Configuration for the float to int block.\n */\nexport interface IFlowGraphFloatToIntConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The rounding mode to use.\n * if not defined, it will use the FlowGraphInteger default rounding ( a | 0 )\n */\n roundingMode?: \"floor\" | \"ceil\" | \"round\";\n}\n/**\n * A block that converts a float to an integer.\n */\nexport class FlowGraphFloatToInt extends FlowGraphUnaryOperationBlock<number, FlowGraphInteger> {\n constructor(config?: IFlowGraphFloatToIntConfiguration) {\n super(\n RichTypeNumber,\n RichTypeFlowGraphInteger,\n (a) => {\n const roundingMode = config?.roundingMode;\n switch (roundingMode) {\n case \"floor\":\n return FlowGraphInteger.FromValue(Math.floor(a));\n case \"ceil\":\n return FlowGraphInteger.FromValue(Math.ceil(a));\n case \"round\":\n return FlowGraphInteger.FromValue(Math.round(a));\n default:\n return FlowGraphInteger.FromValue(a);\n }\n },\n FlowGraphBlockNames.FloatToInt,\n config\n );\n }\n}\n\nRegisterClass(FlowGraphBlockNames.FloatToInt, FlowGraphFloatToInt);\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./flowGraphJsonPointerParserBlock";
2
+ export * from "./flowGraphTypeToTypeBlocks";
@@ -0,0 +1,3 @@
1
+ export * from "./flowGraphJsonPointerParserBlock.js";
2
+ export * from "./flowGraphTypeToTypeBlocks.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Transformers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC","sourcesContent":["export * from \"./flowGraphJsonPointerParserBlock\";\nexport * from \"./flowGraphTypeToTypeBlocks\";\n"]}
@@ -0,0 +1,39 @@
1
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
3
+ import type { FlowGraphContext } from "../../../flowGraphContext.js";
4
+ import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection.js";
5
+ import type { FlowGraphNumber } from "../../../utils.js";
6
+ import type { Nullable } from "../../../../types.js";
7
+ /**
8
+ * This simple Util block takes an array as input and selects a single element from it.
9
+ */
10
+ export declare class FlowGraphArrayIndexBlock<T = any> extends FlowGraphBlock {
11
+ config: IFlowGraphBlockConfiguration;
12
+ /**
13
+ * Input connection: The array to select from.
14
+ */
15
+ readonly array: FlowGraphDataConnection<T[]>;
16
+ /**
17
+ * Input connection: The index to select.
18
+ */
19
+ readonly index: FlowGraphDataConnection<FlowGraphNumber>;
20
+ /**
21
+ * Output connection: The selected element.
22
+ */
23
+ readonly value: FlowGraphDataConnection<Nullable<T>>;
24
+ /**
25
+ * Construct a FlowGraphArrayIndexBlock.
26
+ * @param config construction parameters
27
+ */
28
+ constructor(config: IFlowGraphBlockConfiguration);
29
+ /**
30
+ * @internal
31
+ */
32
+ _updateOutputs(context: FlowGraphContext): void;
33
+ /**
34
+ * Serializes this block
35
+ * @param serializationObject the object to serialize to
36
+ */
37
+ serialize(serializationObject?: any): void;
38
+ getClassName(): string;
39
+ }
@@ -0,0 +1,46 @@
1
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
2
+ import { RichTypeAny } from "../../../flowGraphRichTypes.js";
3
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
4
+ import { FlowGraphInteger } from "../../../CustomTypes/flowGraphInteger.js";
5
+ import { getNumericValue } from "../../../utils.js";
6
+ /**
7
+ * This simple Util block takes an array as input and selects a single element from it.
8
+ */
9
+ export class FlowGraphArrayIndexBlock extends FlowGraphBlock {
10
+ /**
11
+ * Construct a FlowGraphArrayIndexBlock.
12
+ * @param config construction parameters
13
+ */
14
+ constructor(config) {
15
+ super(config);
16
+ this.config = config;
17
+ this.array = this.registerDataInput("array", RichTypeAny);
18
+ this.index = this.registerDataInput("index", RichTypeAny, new FlowGraphInteger(-1));
19
+ this.value = this.registerDataOutput("value", RichTypeAny);
20
+ }
21
+ /**
22
+ * @internal
23
+ */
24
+ _updateOutputs(context) {
25
+ const array = this.array.getValue(context);
26
+ const index = getNumericValue(this.index.getValue(context));
27
+ if (array && index >= 0 && index < array.length) {
28
+ this.value.setValue(array[index], context);
29
+ }
30
+ else {
31
+ this.value.setValue(null, context);
32
+ }
33
+ }
34
+ /**
35
+ * Serializes this block
36
+ * @param serializationObject the object to serialize to
37
+ */
38
+ serialize(serializationObject) {
39
+ super.serialize(serializationObject);
40
+ }
41
+ getClassName() {
42
+ return "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */;
43
+ }
44
+ }
45
+ RegisterClass("FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, FlowGraphArrayIndexBlock);
46
+ //# sourceMappingURL=flowGraphArrayIndexBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphArrayIndexBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAG/D,OAAO,EAAE,WAAW,EAAE,uCAA0C;AAEhE,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,gBAAgB,EAAE,iDAAoD;AAE/E,OAAO,EAAE,eAAe,EAAE,0BAA6B;AAGvD;;GAEG;AACH,MAAM,OAAO,wBAAkC,SAAQ,cAAc;IAgBjE;;;OAGG;IACH,YAA4B,MAAoC;QAC5D,KAAK,CAAC,MAAM,CAAC,CAAC;QADU,WAAM,GAAN,MAAM,CAA8B;QAG5D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpF,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACa,cAAc,CAAC,OAAyB;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IAED;;;OAGG;IACa,SAAS,CAAC,mBAAyB;QAC/C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IAEe,YAAY;QACxB,uEAAsC;IAC1C,CAAC;CACJ;AAED,aAAa,kEAAiC,wBAAwB,CAAC,CAAC","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphInteger } from \"core/FlowGraph/CustomTypes/flowGraphInteger\";\nimport type { FlowGraphNumber } from \"core/FlowGraph/utils\";\nimport { getNumericValue } from \"core/FlowGraph/utils\";\nimport type { Nullable } from \"core/types\";\n\n/**\n * This simple Util block takes an array as input and selects a single element from it.\n */\nexport class FlowGraphArrayIndexBlock<T = any> extends FlowGraphBlock {\n /**\n * Input connection: The array to select from.\n */\n public readonly array: FlowGraphDataConnection<T[]>;\n\n /**\n * Input connection: The index to select.\n */\n public readonly index: FlowGraphDataConnection<FlowGraphNumber>;\n\n /**\n * Output connection: The selected element.\n */\n public readonly value: FlowGraphDataConnection<Nullable<T>>;\n\n /**\n * Construct a FlowGraphArrayIndexBlock.\n * @param config construction parameters\n */\n constructor(public override config: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.array = this.registerDataInput(\"array\", RichTypeAny);\n this.index = this.registerDataInput(\"index\", RichTypeAny, new FlowGraphInteger(-1));\n this.value = this.registerDataOutput(\"value\", RichTypeAny);\n }\n\n /**\n * @internal\n */\n public override _updateOutputs(context: FlowGraphContext): void {\n const array = this.array.getValue(context);\n const index = getNumericValue(this.index.getValue(context));\n if (array && index >= 0 && index < array.length) {\n this.value.setValue(array[index], context);\n } else {\n this.value.setValue(null, context);\n }\n }\n\n /**\n * Serializes this block\n * @param serializationObject the object to serialize to\n */\n public override serialize(serializationObject?: any): void {\n super.serialize(serializationObject);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ArrayIndex;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.ArrayIndex, FlowGraphArrayIndexBlock);\n"]}
@@ -0,0 +1,35 @@
1
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
3
+ import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection.js";
4
+ import type { FlowGraphContext } from "../../../flowGraphContext.js";
5
+ export type CodeExecutionFunction = (value: any, context: FlowGraphContext) => any;
6
+ /**
7
+ * This block takes in a function that is defined OUTSIDE of the flow graph and executes it.
8
+ * The function can be a normal function or an async function.
9
+ * The function's arguments will be the value of the input connection as the first variable, and the flow graph context as the second variable.
10
+ */
11
+ export declare class FlowGraphCodeExecutionBlock extends FlowGraphBlock {
12
+ config: IFlowGraphBlockConfiguration;
13
+ /**
14
+ * Input connection: The function to execute.
15
+ */
16
+ readonly executionFunction: FlowGraphDataConnection<CodeExecutionFunction>;
17
+ /**
18
+ * Input connection: The value to pass to the function.
19
+ */
20
+ readonly value: FlowGraphDataConnection<any>;
21
+ /**
22
+ * Output connection: The result of the function.
23
+ */
24
+ readonly result: FlowGraphDataConnection<any>;
25
+ /**
26
+ * Construct a FlowGraphCodeExecutionBlock.
27
+ * @param config construction parameters
28
+ */
29
+ constructor(config: IFlowGraphBlockConfiguration);
30
+ /**
31
+ * @internal
32
+ */
33
+ _updateOutputs(context: FlowGraphContext): void;
34
+ getClassName(): string;
35
+ }
@@ -0,0 +1,34 @@
1
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
2
+ import { RichTypeAny } from "../../../flowGraphRichTypes.js";
3
+ /**
4
+ * This block takes in a function that is defined OUTSIDE of the flow graph and executes it.
5
+ * The function can be a normal function or an async function.
6
+ * The function's arguments will be the value of the input connection as the first variable, and the flow graph context as the second variable.
7
+ */
8
+ export class FlowGraphCodeExecutionBlock extends FlowGraphBlock {
9
+ /**
10
+ * Construct a FlowGraphCodeExecutionBlock.
11
+ * @param config construction parameters
12
+ */
13
+ constructor(config) {
14
+ super(config);
15
+ this.config = config;
16
+ this.executionFunction = this.registerDataInput("function", RichTypeAny);
17
+ this.value = this.registerDataInput("value", RichTypeAny);
18
+ this.result = this.registerDataOutput("result", RichTypeAny);
19
+ }
20
+ /**
21
+ * @internal
22
+ */
23
+ _updateOutputs(context) {
24
+ const func = this.executionFunction.getValue(context);
25
+ const value = this.value.getValue(context);
26
+ if (func) {
27
+ this.result.setValue(func(value, context), context);
28
+ }
29
+ }
30
+ getClassName() {
31
+ return "FlowGraphCodeExecutionBlock" /* FlowGraphBlockNames.CodeExecution */;
32
+ }
33
+ }
34
+ //# sourceMappingURL=flowGraphCodeExecutionBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphCodeExecutionBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAE/D,OAAO,EAAE,WAAW,EAAE,uCAA0C;AAMhE;;;;GAIG;AACH,MAAM,OAAO,2BAA4B,SAAQ,cAAc;IAgB3D;;;OAGG;IACH,YAA4B,MAAoC;QAC5D,KAAK,CAAC,MAAM,CAAC,CAAC;QADU,WAAM,GAAN,MAAM,CAA8B;QAG5D,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACzE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACa,cAAc,CAAC,OAAyB;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IAEe,YAAY;QACxB,6EAAyC;IAC7C,CAAC;CACJ","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\n\nexport type CodeExecutionFunction = (value: any, context: FlowGraphContext) => any;\n\n/**\n * This block takes in a function that is defined OUTSIDE of the flow graph and executes it.\n * The function can be a normal function or an async function.\n * The function's arguments will be the value of the input connection as the first variable, and the flow graph context as the second variable.\n */\nexport class FlowGraphCodeExecutionBlock extends FlowGraphBlock {\n /**\n * Input connection: The function to execute.\n */\n public readonly executionFunction: FlowGraphDataConnection<CodeExecutionFunction>;\n\n /**\n * Input connection: The value to pass to the function.\n */\n public readonly value: FlowGraphDataConnection<any>;\n\n /**\n * Output connection: The result of the function.\n */\n public readonly result: FlowGraphDataConnection<any>;\n\n /**\n * Construct a FlowGraphCodeExecutionBlock.\n * @param config construction parameters\n */\n constructor(public override config: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.executionFunction = this.registerDataInput(\"function\", RichTypeAny);\n this.value = this.registerDataInput(\"value\", RichTypeAny);\n this.result = this.registerDataOutput(\"result\", RichTypeAny);\n }\n\n /**\n * @internal\n */\n public override _updateOutputs(context: FlowGraphContext): void {\n const func = this.executionFunction.getValue(context);\n const value = this.value.getValue(context);\n if (func) {\n this.result.setValue(func(value, context), context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CodeExecution;\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
2
+ import type { FlowGraphContext } from "../../../flowGraphContext.js";
3
+ import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection.js";
4
+ /**
5
+ * A block that outputs elements from the context
6
+ */
7
+ export declare class FlowGraphContextBlock extends FlowGraphBlock {
8
+ /**
9
+ * Output connection: The user variables from the context
10
+ */
11
+ readonly userVariables: FlowGraphDataConnection<FlowGraphContext["userVariables"]>;
12
+ /**
13
+ * Output connection: The execution id from the context
14
+ */
15
+ readonly executionId: FlowGraphDataConnection<FlowGraphContext["executionId"]>;
16
+ constructor(config?: IFlowGraphBlockConfiguration);
17
+ _updateOutputs(context: FlowGraphContext): void;
18
+ serialize(serializationObject?: any): void;
19
+ getClassName(): string;
20
+ }
@@ -0,0 +1,25 @@
1
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
2
+ import { RichTypeAny, RichTypeNumber } from "../../../flowGraphRichTypes.js";
3
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
4
+ /**
5
+ * A block that outputs elements from the context
6
+ */
7
+ export class FlowGraphContextBlock extends FlowGraphBlock {
8
+ constructor(config) {
9
+ super(config);
10
+ this.userVariables = this.registerDataOutput("userVariables", RichTypeAny);
11
+ this.executionId = this.registerDataOutput("executionId", RichTypeNumber);
12
+ }
13
+ _updateOutputs(context) {
14
+ this.userVariables.setValue(context.userVariables, context);
15
+ this.executionId.setValue(context.executionId, context);
16
+ }
17
+ serialize(serializationObject) {
18
+ super.serialize(serializationObject);
19
+ }
20
+ getClassName() {
21
+ return "FlowGraphContextBlock" /* FlowGraphBlockNames.Context */;
22
+ }
23
+ }
24
+ RegisterClass("FlowGraphContextBlock" /* FlowGraphBlockNames.Context */, FlowGraphContextBlock);
25
+ //# sourceMappingURL=flowGraphContextBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphContextBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,mCAAsC;AAGlG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,uCAA0C;AAEhF,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAEpD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IAWrD,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAC3E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAC9E,CAAC;IAEe,cAAc,CAAC,OAAyB;QACpD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEe,SAAS,CAAC,mBAAyB;QAC/C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IAEe,YAAY;QACxB,iEAAmC;IACvC,CAAC;CACJ;AAED,aAAa,4DAA8B,qBAAqB,CAAC,CAAC","sourcesContent":["import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\n/**\n * A block that outputs elements from the context\n */\nexport class FlowGraphContextBlock extends FlowGraphBlock {\n /**\n * Output connection: The user variables from the context\n */\n public readonly userVariables: FlowGraphDataConnection<FlowGraphContext[\"userVariables\"]>;\n\n /**\n * Output connection: The execution id from the context\n */\n public readonly executionId: FlowGraphDataConnection<FlowGraphContext[\"executionId\"]>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.userVariables = this.registerDataOutput(\"userVariables\", RichTypeAny);\n this.executionId = this.registerDataOutput(\"executionId\", RichTypeNumber);\n }\n\n public override _updateOutputs(context: FlowGraphContext): void {\n this.userVariables.setValue(context.userVariables, context);\n this.executionId.setValue(context.executionId, context);\n }\n\n public override serialize(serializationObject?: any): void {\n super.serialize(serializationObject);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.Context;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.Context, FlowGraphContextBlock);\n"]}
@@ -0,0 +1,34 @@
1
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
3
+ import type { FlowGraphContext } from "../../../flowGraphContext.js";
4
+ import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection.js";
5
+ /**
6
+ * A flow graph block that takes a function name, an object and an optional context as inputs and calls the function on the object.
7
+ */
8
+ export declare class FlowGraphFunctionReferenceBlock extends FlowGraphBlock {
9
+ /**
10
+ * Input: The function name.
11
+ */
12
+ readonly functionName: FlowGraphDataConnection<string>;
13
+ /**
14
+ * Input: The object to get the function from.
15
+ * This can be a constructed class or a collection of stand-alone functions.
16
+ */
17
+ readonly object: FlowGraphDataConnection<any>;
18
+ /**
19
+ * Input: The context to call the function with.
20
+ * This is optional. If not provided, the function will be bound to null.
21
+ */
22
+ readonly context: FlowGraphDataConnection<any>;
23
+ /**
24
+ * Output: The function referenced by functionName from the object, bound to the context.
25
+ */
26
+ readonly output: FlowGraphDataConnection<Function>;
27
+ constructor(
28
+ /**
29
+ * the configuration of the block
30
+ */
31
+ config?: IFlowGraphBlockConfiguration);
32
+ _updateOutputs(context: FlowGraphContext): void;
33
+ getClassName(): string;
34
+ }
@@ -0,0 +1,35 @@
1
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
2
+ import { RichTypeAny, RichTypeString } from "../../../flowGraphRichTypes.js";
3
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
4
+ /**
5
+ * A flow graph block that takes a function name, an object and an optional context as inputs and calls the function on the object.
6
+ */
7
+ export class FlowGraphFunctionReferenceBlock extends FlowGraphBlock {
8
+ constructor(
9
+ /**
10
+ * the configuration of the block
11
+ */
12
+ config) {
13
+ super(config);
14
+ this.functionName = this.registerDataInput("functionName", RichTypeString);
15
+ this.object = this.registerDataInput("object", RichTypeAny);
16
+ this.context = this.registerDataInput("context", RichTypeAny, null);
17
+ this.output = this.registerDataOutput("output", RichTypeAny);
18
+ }
19
+ _updateOutputs(context) {
20
+ const functionName = this.functionName.getValue(context);
21
+ const object = this.object.getValue(context);
22
+ const contextValue = this.context.getValue(context);
23
+ if (object && functionName) {
24
+ const func = object[functionName];
25
+ if (func && typeof func === "function") {
26
+ this.output.setValue(func.bind(contextValue), context);
27
+ }
28
+ }
29
+ }
30
+ getClassName() {
31
+ return "FlowGraphFunctionReference" /* FlowGraphBlockNames.FunctionReference */;
32
+ }
33
+ }
34
+ RegisterClass("FlowGraphFunctionReference" /* FlowGraphBlockNames.FunctionReference */, FlowGraphFunctionReferenceBlock);
35
+ //# sourceMappingURL=flowGraphFunctionReferenceBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphFunctionReferenceBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAG/D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,uCAA0C;AAChF,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAGpD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,cAAc;IAoB/D;IACI;;OAEG;IACH,MAAqC;QAErC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC3E,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IAEe,cAAc,CAAC,OAAyB;QACpD,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,MAAM,IAAI,YAAY,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;YAClC,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;YAC3D,CAAC;QACL,CAAC;IACL,CAAC;IAEe,YAAY;QACxB,gFAA6C;IACjD,CAAC;CACJ;AAED,aAAa,2EAAwC,+BAA+B,CAAC,CAAC","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeString } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\n\n/**\n * A flow graph block that takes a function name, an object and an optional context as inputs and calls the function on the object.\n */\nexport class FlowGraphFunctionReferenceBlock extends FlowGraphBlock {\n /**\n * Input: The function name.\n */\n public readonly functionName: FlowGraphDataConnection<string>;\n /**\n * Input: The object to get the function from.\n * This can be a constructed class or a collection of stand-alone functions.\n */\n public readonly object: FlowGraphDataConnection<any>;\n /**\n * Input: The context to call the function with.\n * This is optional. If not provided, the function will be bound to null.\n */\n public readonly context: FlowGraphDataConnection<any>;\n /**\n * Output: The function referenced by functionName from the object, bound to the context.\n */\n public readonly output: FlowGraphDataConnection<Function>;\n\n constructor(\n /**\n * the configuration of the block\n */\n config?: IFlowGraphBlockConfiguration\n ) {\n super(config);\n this.functionName = this.registerDataInput(\"functionName\", RichTypeString);\n this.object = this.registerDataInput(\"object\", RichTypeAny);\n this.context = this.registerDataInput(\"context\", RichTypeAny, null);\n this.output = this.registerDataOutput(\"output\", RichTypeAny);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n const functionName = this.functionName.getValue(context);\n const object = this.object.getValue(context);\n const contextValue = this.context.getValue(context);\n if (object && functionName) {\n const func = object[functionName];\n if (func && typeof func === \"function\") {\n this.output.setValue(func.bind(contextValue), context);\n }\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.FunctionReference;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.FunctionReference, FlowGraphFunctionReferenceBlock);\n"]}