@onerjs/core 8.54.4 → 8.54.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/Engines/Native/nativeHelpers.js +5 -0
  2. package/Engines/Native/nativeHelpers.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
  4. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
  5. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
  6. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
  7. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
  8. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
  9. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  10. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
  11. package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
  12. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
  13. package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
  14. package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
  15. package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
  16. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
  17. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
  18. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  19. package/Engines/WebGPU/webgpuTextureManager.js +4 -2
  20. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  21. package/Engines/abstractEngine.pure.js +2 -2
  22. package/Engines/abstractEngine.pure.js.map +1 -1
  23. package/Engines/engineCapabilities.d.ts +5 -0
  24. package/Engines/engineCapabilities.js.map +1 -1
  25. package/Engines/thinNativeEngine.pure.d.ts +5 -0
  26. package/Engines/thinNativeEngine.pure.js +52 -10
  27. package/Engines/thinNativeEngine.pure.js.map +1 -1
  28. package/Engines/webgpuEngine.pure.d.ts +1 -0
  29. package/Engines/webgpuEngine.pure.js +22 -8
  30. package/Engines/webgpuEngine.pure.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
  32. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
  33. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  34. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
  35. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
  36. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
  38. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
  39. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
  41. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
  42. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
  44. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  47. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
  48. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
  49. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  50. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
  51. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
  52. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  53. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
  54. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
  55. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  56. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
  57. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
  58. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  59. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
  60. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
  61. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
  62. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
  63. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
  64. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
  65. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  66. package/FlowGraph/Blocks/Event/index.js +1 -0
  67. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  68. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  69. package/FlowGraph/Blocks/Event/pure.js +1 -0
  70. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  71. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
  72. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
  73. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
  75. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
  76. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
  78. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
  86. package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
  87. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
  89. package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
  90. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  91. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
  92. package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
  93. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  94. package/FlowGraph/flowGraphContext.d.ts +23 -0
  95. package/FlowGraph/flowGraphContext.js +29 -0
  96. package/FlowGraph/flowGraphContext.js.map +1 -1
  97. package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
  98. package/FlowGraph/flowGraphCoordinator.js +72 -0
  99. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  100. package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
  101. package/FlowGraph/flowGraphDelayRegistry.js +50 -0
  102. package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
  103. package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
  104. package/FlowGraph/flowGraphHostResolver.js +25 -0
  105. package/FlowGraph/flowGraphHostResolver.js.map +1 -0
  106. package/FlowGraph/flowGraphMath.d.ts +48 -1
  107. package/FlowGraph/flowGraphMath.js +169 -4
  108. package/FlowGraph/flowGraphMath.js.map +1 -1
  109. package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
  110. package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
  111. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  112. package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
  113. package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
  114. package/FlowGraph/index.d.ts +2 -0
  115. package/FlowGraph/index.js +2 -0
  116. package/FlowGraph/index.js.map +1 -1
  117. package/FlowGraph/pure.d.ts +2 -0
  118. package/FlowGraph/pure.js +2 -0
  119. package/FlowGraph/pure.js.map +1 -1
  120. package/Materials/Node/nodeMaterial.pure.d.ts +3 -1
  121. package/Materials/Node/nodeMaterial.pure.js +18 -1
  122. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  123. package/Materials/Textures/envCubeTexture.pure.js +7 -2
  124. package/Materials/Textures/envCubeTexture.pure.js.map +1 -1
  125. package/Materials/materialHelper.functions.d.ts +14 -0
  126. package/Materials/materialHelper.functions.js +67 -0
  127. package/Materials/materialHelper.functions.js.map +1 -1
  128. package/Maths/math.vector.pure.d.ts +11 -1
  129. package/Maths/math.vector.pure.js +13 -0
  130. package/Maths/math.vector.pure.js.map +1 -1
  131. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
  132. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
  133. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  134. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
  135. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
  136. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  137. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
  138. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
  139. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  140. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
  141. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  142. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
  143. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  144. package/Meshes/abstractMesh.pure.js +1 -0
  145. package/Meshes/abstractMesh.pure.js.map +1 -1
  146. package/Meshes/mesh.pure.js +5 -0
  147. package/Meshes/mesh.pure.js.map +1 -1
  148. package/Meshes/transformNode.pure.js +1 -0
  149. package/Meshes/transformNode.pure.js.map +1 -1
  150. package/Misc/areaLightsTextureTools.js +1 -1
  151. package/Misc/areaLightsTextureTools.js.map +1 -1
  152. package/Misc/greasedLineTools.js +1 -1
  153. package/Misc/greasedLineTools.js.map +1 -1
  154. package/Misc/tools.pure.js +14 -2
  155. package/Misc/tools.pure.js.map +1 -1
  156. package/Particles/gpuParticleSystem.pure.d.ts +66 -1
  157. package/Particles/gpuParticleSystem.pure.js +189 -49
  158. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  159. package/Physics/v2/characterController.js +69 -17
  160. package/Physics/v2/characterController.js.map +1 -1
  161. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.d.ts +79 -0
  162. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js +171 -0
  163. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js.map +1 -0
  164. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +5 -0
  165. package/PostProcesses/RenderPipeline/Pipelines/index.js +6 -0
  166. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  167. package/PostProcesses/RenderPipeline/Pipelines/pure.d.ts +1 -0
  168. package/PostProcesses/RenderPipeline/Pipelines/pure.js +1 -0
  169. package/PostProcesses/RenderPipeline/Pipelines/pure.js.map +1 -1
  170. package/PostProcesses/thinFSR1SharpenPostProcess.d.ts +32 -0
  171. package/PostProcesses/thinFSR1SharpenPostProcess.js +58 -0
  172. package/PostProcesses/thinFSR1SharpenPostProcess.js.map +1 -0
  173. package/PostProcesses/thinFSR1UpscalePostProcess.d.ts +37 -0
  174. package/PostProcesses/thinFSR1UpscalePostProcess.js +68 -0
  175. package/PostProcesses/thinFSR1UpscalePostProcess.js.map +1 -0
  176. package/Shaders/ShadersInclude/ffxFunctions.d.ts +5 -0
  177. package/Shaders/ShadersInclude/ffxFunctions.js +18 -0
  178. package/Shaders/ShadersInclude/ffxFunctions.js.map +1 -0
  179. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -2
  180. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  181. package/Shaders/ShadersInclude/openpbrIblFunctions.js +1 -6
  182. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  183. package/Shaders/fsr1Sharpen.fragment.d.ts +5 -0
  184. package/Shaders/fsr1Sharpen.fragment.js +26 -0
  185. package/Shaders/fsr1Sharpen.fragment.js.map +1 -0
  186. package/Shaders/fsr1Upscale.fragment.d.ts +5 -0
  187. package/Shaders/fsr1Upscale.fragment.js +77 -0
  188. package/Shaders/fsr1Upscale.fragment.js.map +1 -0
  189. package/ShadersWGSL/ShadersInclude/ffxFunctions.d.ts +5 -0
  190. package/ShadersWGSL/ShadersInclude/ffxFunctions.js +18 -0
  191. package/ShadersWGSL/ShadersInclude/ffxFunctions.js.map +1 -0
  192. package/ShadersWGSL/fsr1Sharpen.fragment.d.ts +5 -0
  193. package/ShadersWGSL/fsr1Sharpen.fragment.js +34 -0
  194. package/ShadersWGSL/fsr1Sharpen.fragment.js.map +1 -0
  195. package/ShadersWGSL/fsr1Upscale.fragment.d.ts +5 -0
  196. package/ShadersWGSL/fsr1Upscale.fragment.js +68 -0
  197. package/ShadersWGSL/fsr1Upscale.fragment.js.map +1 -0
  198. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
  199. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
  200. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  201. package/XR/features/WebXRAbstractFeature.d.ts +9 -0
  202. package/XR/features/WebXRAbstractFeature.js +16 -0
  203. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  204. package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
  205. package/XR/features/WebXRDepthSensing.pure.js +350 -39
  206. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  207. package/XR/features/WebXRImageTracking.pure.js.map +1 -1
  208. package/XR/features/WebXRLayers.pure.d.ts +6 -5
  209. package/XR/features/WebXRLayers.pure.js +65 -8
  210. package/XR/features/WebXRLayers.pure.js.map +1 -1
  211. package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
  212. package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
  213. package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
  214. package/XR/features/WebXRSpaceWarp.pure.js +13 -4
  215. package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
  216. package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
  217. package/XR/webXRCamera.js +27 -0
  218. package/XR/webXRCamera.js.map +1 -1
  219. package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
  220. package/XR/webXRFeatureWarningRegistry.js +19 -0
  221. package/XR/webXRFeatureWarningRegistry.js.map +1 -0
  222. package/XR/webXRFeaturesManager.d.ts +5 -0
  223. package/XR/webXRFeaturesManager.js +23 -4
  224. package/XR/webXRFeaturesManager.js.map +1 -1
  225. package/XR/webXRGraphicsBinding.d.ts +17 -10
  226. package/XR/webXRGraphicsBinding.js +8 -5
  227. package/XR/webXRGraphicsBinding.js.map +1 -1
  228. package/XR/webXRSessionManager.d.ts +3 -5
  229. package/XR/webXRSessionManager.js +1 -3
  230. package/XR/webXRSessionManager.js.map +1 -1
  231. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
  232. package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
  233. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  234. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ /** This file must only contain pure code and pure imports */
2
+ /**
3
+ * Prefix used by the default event-reference format.
4
+ *
5
+ * A host that maps behavior graphs onto its own object model (for example the glTF
6
+ * `KHR_interactivity` loader) supplies its own format through {@link IFlowGraphHostResolver}.
7
+ */
8
+ export const FlowGraphDefaultEventReferencePrefix = "flowgraph://events/";
9
+ /**
10
+ * Builds the default reference for an event source key.
11
+ * @param key the event source key (e.g. `"sceneReady"`, `"sceneTick"`, or a custom event id)
12
+ * @returns the event reference
13
+ */
14
+ export function GetDefaultEventReference(key) {
15
+ return FlowGraphDefaultEventReferencePrefix + key;
16
+ }
17
+ /**
18
+ * Extracts the event source key from a default-format event reference.
19
+ * @param reference the value to decode
20
+ * @returns the event source key, or `undefined` when the value is not an event reference
21
+ */
22
+ export function GetDefaultEventReferenceKey(reference) {
23
+ return reference.startsWith(FlowGraphDefaultEventReferencePrefix) ? reference.substring(FlowGraphDefaultEventReferencePrefix.length) : undefined;
24
+ }
25
+ //# sourceMappingURL=flowGraphHostResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphHostResolver.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphHostResolver.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,qBAAqB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAChD,OAAO,oCAAoC,GAAG,GAAG,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAiB;IACzD,OAAO,SAAS,CAAC,UAAU,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,oCAAoC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrJ,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\n/**\r\n * Prefix used by the default event-reference format.\r\n *\r\n * A host that maps behavior graphs onto its own object model (for example the glTF\r\n * `KHR_interactivity` loader) supplies its own format through {@link IFlowGraphHostResolver}.\r\n */\r\nexport const FlowGraphDefaultEventReferencePrefix = \"flowgraph://events/\";\r\n\r\n/**\r\n * Builds the default reference for an event source key.\r\n * @param key the event source key (e.g. `\"sceneReady\"`, `\"sceneTick\"`, or a custom event id)\r\n * @returns the event reference\r\n */\r\nexport function GetDefaultEventReference(key: string): string {\r\n return FlowGraphDefaultEventReferencePrefix + key;\r\n}\r\n\r\n/**\r\n * Extracts the event source key from a default-format event reference.\r\n * @param reference the value to decode\r\n * @returns the event source key, or `undefined` when the value is not an event reference\r\n */\r\nexport function GetDefaultEventReferenceKey(reference: string): string | undefined {\r\n return reference.startsWith(FlowGraphDefaultEventReferencePrefix) ? reference.substring(FlowGraphDefaultEventReferencePrefix.length) : undefined;\r\n}\r\n\r\n/**\r\n * Lets the environment hosting a flow graph decide how runtime entities are represented as opaque\r\n * reference values, so the graph engine itself stays agnostic of the host's object model.\r\n *\r\n * A host (e.g. a glTF loader extension) provides an implementation through\r\n * {@link IFlowGraphCoordinatorConfiguration.hostResolver}. Every member is optional; the engine\r\n * falls back to a neutral built-in representation for anything the host does not provide.\r\n */\r\nexport interface IFlowGraphHostResolver {\r\n /**\r\n * Encodes an event source key as the opaque reference exposed by event blocks on their\r\n * `event` output.\r\n *\r\n * References must be stable: two calls with the same key must produce equal values so that\r\n * equality comparisons of two `event` outputs of the same source succeed.\r\n * @param key the event source key\r\n * @returns the reference representing the event source\r\n */\r\n encodeEventReference?(key: string): string;\r\n\r\n /**\r\n * Decodes an event reference produced by {@link IFlowGraphHostResolver.encodeEventReference}\r\n * back into its event source key. Must return `undefined` for values that are not event\r\n * references.\r\n * @param reference the reference to decode\r\n * @returns the event source key, or `undefined` when the value is not an event reference\r\n */\r\n decodeEventReference?(reference: string): string | undefined;\r\n\r\n /**\r\n * Decodes the array index denoted by a reference, for cases where a reference addresses an\r\n * element of one of the host's collections. Must return `undefined` for values the host does\r\n * not recognise as an indexed reference.\r\n * @param reference the reference to decode\r\n * @returns the index the reference denotes, or `undefined` when it does not denote one\r\n */\r\n decodeIndexReference?(reference: string): number | undefined;\r\n\r\n /**\r\n * Maps a runtime object to the reference the host addresses it by, for example the JSON\r\n * Pointer of the resource a loaded object originates from.\r\n *\r\n * Used when an object value is supplied to a templated path input. Returning `undefined`\r\n * means the host cannot address the object, and the value is rejected.\r\n * @param object the runtime object to address\r\n * @param hint optional disambiguation hint, taken from the path segment preceding the template\r\n * parameter being resolved. A single object may be addressable in several ways, and the hint\r\n * tells the host which kind of reference the graph is asking for.\r\n * @returns the reference for the object, or `undefined` when it cannot be addressed\r\n */\r\n getObjectReference?(object: object, hint?: string): string | undefined;\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type IQuaternionLike } from "../Maths/math.like.js";
2
- import { Quaternion, Vector3 } from "../Maths/math.vector.pure.js";
2
+ import { Quaternion, Vector2, Vector3 } from "../Maths/math.vector.pure.js";
3
3
  import { type DeepImmutable } from "../types.js";
4
4
  /**
5
5
  * Returns the angle in radians between two quaternions
@@ -23,3 +23,50 @@ export declare function GetQuaternionFromDirections<T extends Vector3>(a: DeepIm
23
23
  * @returns the target quaternion
24
24
  */
25
25
  export declare function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT;
26
+ /**
27
+ * Spherical linear interpolation between two 2D vectors.
28
+ * NaN and infinity values are propagated through the arithmetic.
29
+ * @param a the first vector
30
+ * @param b the second vector
31
+ * @param c the (unclamped) interpolation coefficient
32
+ * @returns the interpolated 2D vector
33
+ */
34
+ export declare function GetVector2Slerp(a: DeepImmutable<Vector2>, b: DeepImmutable<Vector2>, c: number): Vector2;
35
+ /**
36
+ * Spherical linear interpolation between two 3D vectors.
37
+ * NaN and infinity values are propagated through the arithmetic.
38
+ * @param a the first vector
39
+ * @param b the second vector
40
+ * @param c the (unclamped) interpolation coefficient
41
+ * @returns the interpolated 3D vector
42
+ */
43
+ export declare function GetVector3Slerp(a: DeepImmutable<Vector3>, b: DeepImmutable<Vector3>, c: number): Vector3;
44
+ /**
45
+ * Creates a quaternion from the specified up and forward directions, as defined by the
46
+ * up/forward quaternion operation. Both inputs are assumed to be unit length.
47
+ * @param up the up direction
48
+ * @param forward the forward direction
49
+ * @returns the rotation quaternion
50
+ */
51
+ export declare function GetQuaternionFromUpForward(up: DeepImmutable<Vector3>, forward: DeepImmutable<Vector3>): Quaternion;
52
+ /**
53
+ * The rotation orders accepted by the Euler-angle quaternion operation
54
+ * (and {@link GetQuaternionFromEulerAngles}). The default order is `yxz`.
55
+ */
56
+ export declare const QuaternionEulerAngleOrders: readonly ["xyz", "xzy", "yxz", "yzx", "zxy", "zyx"];
57
+ /**
58
+ * Builds a rotation quaternion from three Tait–Bryan intrinsic Euler angles applied in the
59
+ * specified order.
60
+ *
61
+ * Babylon only exposes the `yxz` order natively (via `Quaternion.RotationYawPitchRoll`), so the
62
+ * result is composed from the individual per-axis rotations to support every order. For an
63
+ * intrinsic order `o1o2o3` the result is the Hamilton product `q(o1) * q(o2) * q(o3)`, where each
64
+ * `q(axis)` is a rotation about that axis; this matches the corresponding reference intrinsic
65
+ * Tait–Bryan rotation matrices. NaN and infinite angle inputs propagate into the result.
66
+ * @param order the rotation order, one of {@link QuaternionEulerAngleOrders}; any other value uses the default `yxz`
67
+ * @param x rotation around the X axis, in radians
68
+ * @param y rotation around the Y axis, in radians
69
+ * @param z rotation around the Z axis, in radians
70
+ * @returns the composed rotation quaternion
71
+ */
72
+ export declare function GetQuaternionFromEulerAngles(order: string, x: number, y: number, z: number): Quaternion;
@@ -1,9 +1,36 @@
1
1
  import { Clamp } from "../Maths/math.scalar.functions.js";
2
- import { Quaternion, Vector3 } from "../Maths/math.vector.pure.js";
2
+ import { Matrix, Quaternion, Vector2, Vector3 } from "../Maths/math.vector.pure.js";
3
3
  import { Vector3Dot, Vector4Dot } from "../Maths/math.vector.functions.js";
4
4
  // *** NOTE ***
5
5
  // These functions should ideally go in math.vector.functions.ts, but they require math.vector.ts to
6
6
  // be imported which is big. To avoid the larger bundle size, they are kept inside flow graph for now.
7
+ /**
8
+ * Implementation-defined threshold used by the slerp and up/forward quaternion operations
9
+ * to detect near-zero lengths and (anti)parallel vectors.
10
+ */
11
+ const SlerpEpsilon = 1e-6;
12
+ /**
13
+ * Returns a unit vector perpendicular to the provided vector.
14
+ * @param v the input vector (does not need to be unit length)
15
+ * @returns a unit vector perpendicular to `v`
16
+ */
17
+ function GetAnyPerpendicularVector(v) {
18
+ const absX = Math.abs(v.x);
19
+ const absY = Math.abs(v.y);
20
+ const absZ = Math.abs(v.z);
21
+ // Cross with whichever cardinal axis is least aligned with `v` to avoid a degenerate cross product.
22
+ let other;
23
+ if (absX <= absY && absX <= absZ) {
24
+ other = Vector3.RightReadOnly;
25
+ }
26
+ else if (absY <= absZ) {
27
+ other = Vector3.UpReadOnly;
28
+ }
29
+ else {
30
+ other = Vector3.LeftHandedForwardReadOnly;
31
+ }
32
+ return Vector3.Cross(v, other).normalize();
33
+ }
7
34
  /**
8
35
  * Returns the angle in radians between two quaternions
9
36
  * @param q1 defines the first quaternion
@@ -32,9 +59,147 @@ export function GetQuaternionFromDirections(a, b) {
32
59
  * @returns the target quaternion
33
60
  */
34
61
  export function GetQuaternionFromDirectionsToRef(a, b, result) {
35
- const axis = Vector3.Cross(a, b);
36
- const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));
37
- Quaternion.RotationAxisToRef(axis, angle, result);
62
+ const dot = Vector3Dot(a, b);
63
+ if (Number.isFinite(dot) && dot > 1 - SlerpEpsilon) {
64
+ result.copyFromFloats(0, 0, 0, 1);
65
+ return result;
66
+ }
67
+ if (Number.isFinite(dot) && dot < -1 + SlerpEpsilon) {
68
+ const axis = GetAnyPerpendicularVector(a);
69
+ result.copyFromFloats(axis.x, axis.y, axis.z, 0);
70
+ return result;
71
+ }
72
+ const axis = Vector3.Cross(a, b).normalize();
73
+ const axisScale = Math.sqrt(0.5 - 0.5 * dot);
74
+ result.copyFromFloats(axis.x * axisScale, axis.y * axisScale, axis.z * axisScale, Math.sqrt(0.5 + 0.5 * dot));
38
75
  return result;
39
76
  }
77
+ /**
78
+ * Spherical linear interpolation between two 2D vectors.
79
+ * NaN and infinity values are propagated through the arithmetic.
80
+ * @param a the first vector
81
+ * @param b the second vector
82
+ * @param c the (unclamped) interpolation coefficient
83
+ * @returns the interpolated 2D vector
84
+ */
85
+ export function GetVector2Slerp(a, b, c) {
86
+ const lengthA = Math.sqrt(a.x * a.x + a.y * a.y);
87
+ const lengthB = Math.sqrt(b.x * b.x + b.y * b.y);
88
+ // If either vector is (close to) zero length the rotation is undefined; fall back to a linear interpolation.
89
+ if (lengthA < SlerpEpsilon || lengthB < SlerpEpsilon) {
90
+ return new Vector2((1 - c) * a.x + c * b.x, (1 - c) * a.y + c * b.y);
91
+ }
92
+ const aHatX = a.x / lengthA;
93
+ const aHatY = a.y / lengthA;
94
+ const bHatX = b.x / lengthB;
95
+ const bHatY = b.y / lengthB;
96
+ let theta = Math.acos(Clamp(aHatX * bHatX + aHatY * bHatY, -1, 1));
97
+ if (aHatX * bHatY - aHatY * bHatX < 0) {
98
+ theta = -theta;
99
+ }
100
+ const length = (1 - c) * lengthA + c * lengthB;
101
+ const cosCTheta = Math.cos(c * theta);
102
+ const sinCTheta = Math.sin(c * theta);
103
+ return new Vector2((aHatX * cosCTheta - aHatY * sinCTheta) * length, (aHatX * sinCTheta + aHatY * cosCTheta) * length);
104
+ }
105
+ /**
106
+ * Spherical linear interpolation between two 3D vectors.
107
+ * NaN and infinity values are propagated through the arithmetic.
108
+ * @param a the first vector
109
+ * @param b the second vector
110
+ * @param c the (unclamped) interpolation coefficient
111
+ * @returns the interpolated 3D vector
112
+ */
113
+ export function GetVector3Slerp(a, b, c) {
114
+ const lengthA = a.length();
115
+ const lengthB = b.length();
116
+ const lerp = () => new Vector3((1 - c) * a.x + c * b.x, (1 - c) * a.y + c * b.y, (1 - c) * a.z + c * b.z);
117
+ // If either vector is (close to) zero length the rotation is undefined; fall back to a linear interpolation.
118
+ if (lengthA < SlerpEpsilon || lengthB < SlerpEpsilon) {
119
+ return lerp();
120
+ }
121
+ const aHat = new Vector3(a.x / lengthA, a.y / lengthA, a.z / lengthA);
122
+ const bHat = new Vector3(b.x / lengthB, b.y / lengthB, b.z / lengthB);
123
+ const dot = Vector3Dot(aHat, bHat);
124
+ // Parallel vectors share a direction; a linear interpolation already produces the correct result.
125
+ if (dot > 1 - SlerpEpsilon) {
126
+ return lerp();
127
+ }
128
+ let rotationAxis;
129
+ if (dot < -1 + SlerpEpsilon) {
130
+ // Anti-parallel vectors: any axis perpendicular to aHat is a valid rotation axis.
131
+ rotationAxis = GetAnyPerpendicularVector(aHat);
132
+ }
133
+ else {
134
+ rotationAxis = Vector3.Cross(aHat, bHat).normalize();
135
+ }
136
+ const angle = c * Math.acos(Clamp(dot, -1, 1));
137
+ const rotation = Quaternion.RotationAxis(rotationAxis, angle);
138
+ const length = (1 - c) * lengthA + c * lengthB;
139
+ return aHat.applyRotationQuaternion(rotation).scaleInPlace(length);
140
+ }
141
+ /**
142
+ * Creates a quaternion from the specified up and forward directions, as defined by the
143
+ * up/forward quaternion operation. Both inputs are assumed to be unit length.
144
+ * @param up the up direction
145
+ * @param forward the forward direction
146
+ * @returns the rotation quaternion
147
+ */
148
+ export function GetQuaternionFromUpForward(up, forward) {
149
+ const r = new Vector3(forward.x, forward.y, forward.z);
150
+ let s = Vector3.Cross(up, r);
151
+ if (s.lengthSquared() < SlerpEpsilon * SlerpEpsilon) {
152
+ // up and forward are colinear; pick any unit vector perpendicular to forward.
153
+ s = GetAnyPerpendicularVector(r);
154
+ }
155
+ else {
156
+ s.normalize();
157
+ }
158
+ const t = Vector3.Cross(r, s);
159
+ // Build the rotation matrix with columns s, t and r (Babylon matrices are column-major) and convert it.
160
+ const matrix = Matrix.FromValues(s.x, s.y, s.z, 0, t.x, t.y, t.z, 0, r.x, r.y, r.z, 0, 0, 0, 0, 1);
161
+ return Quaternion.FromRotationMatrix(matrix);
162
+ }
163
+ /**
164
+ * The rotation orders accepted by the Euler-angle quaternion operation
165
+ * (and {@link GetQuaternionFromEulerAngles}). The default order is `yxz`.
166
+ */
167
+ export const QuaternionEulerAngleOrders = ["xyz", "xzy", "yxz", "yzx", "zxy", "zyx"];
168
+ /**
169
+ * Builds a rotation quaternion from three Tait–Bryan intrinsic Euler angles applied in the
170
+ * specified order.
171
+ *
172
+ * Babylon only exposes the `yxz` order natively (via `Quaternion.RotationYawPitchRoll`), so the
173
+ * result is composed from the individual per-axis rotations to support every order. For an
174
+ * intrinsic order `o1o2o3` the result is the Hamilton product `q(o1) * q(o2) * q(o3)`, where each
175
+ * `q(axis)` is a rotation about that axis; this matches the corresponding reference intrinsic
176
+ * Tait–Bryan rotation matrices. NaN and infinite angle inputs propagate into the result.
177
+ * @param order the rotation order, one of {@link QuaternionEulerAngleOrders}; any other value uses the default `yxz`
178
+ * @param x rotation around the X axis, in radians
179
+ * @param y rotation around the Y axis, in radians
180
+ * @param z rotation around the Z axis, in radians
181
+ * @returns the composed rotation quaternion
182
+ */
183
+ export function GetQuaternionFromEulerAngles(order, x, y, z) {
184
+ const qx = Quaternion.RotationAxis(Vector3.RightReadOnly, x);
185
+ const qy = Quaternion.RotationAxis(Vector3.UpReadOnly, y);
186
+ const qz = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, z);
187
+ // `a.multiplyInPlace(b)` computes the Hamilton product `a * b` in place and returns `a`.
188
+ switch (order) {
189
+ case "xyz":
190
+ return qx.multiplyInPlace(qy).multiplyInPlace(qz);
191
+ case "xzy":
192
+ return qx.multiplyInPlace(qz).multiplyInPlace(qy);
193
+ case "yzx":
194
+ return qy.multiplyInPlace(qz).multiplyInPlace(qx);
195
+ case "zxy":
196
+ return qz.multiplyInPlace(qx).multiplyInPlace(qy);
197
+ case "zyx":
198
+ return qz.multiplyInPlace(qy).multiplyInPlace(qx);
199
+ case "yxz":
200
+ default:
201
+ // Default order.
202
+ return qy.multiplyInPlace(qx).multiplyInPlace(qz);
203
+ }
204
+ }
40
205
  //# sourceMappingURL=flowGraphMath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphMath.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphMath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAe;AACf,oGAAoG;AACpG,sGAAsG;AAEtG;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,EAAkC,EAAE,EAAkC;IAC7G,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAoB,CAAmB,EAAE,CAAmB;IACnG,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,gCAAgC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAAgD,CAAmB,EAAE,CAAmB,EAAE,MAAe;IACrJ,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { type IQuaternionLike } from \"../Maths/math.like\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { Vector3Dot, Vector4Dot } from \"../Maths/math.vector.functions\";\r\nimport { type DeepImmutable } from \"../types\";\r\n\r\n// *** NOTE ***\r\n// These functions should ideally go in math.vector.functions.ts, but they require math.vector.ts to\r\n// be imported which is big. To avoid the larger bundle size, they are kept inside flow graph for now.\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number {\r\n return Math.acos(Clamp(Vector4Dot(q1, q2), -1, 1)) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const axis = Vector3.Cross(a, b);\r\n const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));\r\n Quaternion.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphMath.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphMath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAe;AACf,oGAAoG;AACpG,sGAAsG;AAEtG;;;GAGG;AACH,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B;;;;GAIG;AACH,SAAS,yBAAyB,CAAC,CAAyB;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,CA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CAAC,CAAC;QACtD,KAAK,KAAK;YACN,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACtD,KAAK,KAAK;YACN,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACtD,KAAK,KAAK,CAAC;QACX;YACI,iBAAiB;YACjB,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;AACL,CAAC","sourcesContent":["import { type IQuaternionLike } from \"../Maths/math.like\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport { Matrix, Quaternion, Vector2, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { Vector3Dot, Vector4Dot } from \"../Maths/math.vector.functions\";\r\nimport { type DeepImmutable } from \"../types\";\r\n\r\n// *** NOTE ***\r\n// These functions should ideally go in math.vector.functions.ts, but they require math.vector.ts to\r\n// be imported which is big. To avoid the larger bundle size, they are kept inside flow graph for now.\r\n\r\n/**\r\n * Implementation-defined threshold used by the slerp and up/forward quaternion operations\r\n * to detect near-zero lengths and (anti)parallel vectors.\r\n */\r\nconst SlerpEpsilon = 1e-6;\r\n\r\n/**\r\n * Returns a unit vector perpendicular to the provided vector.\r\n * @param v the input vector (does not need to be unit length)\r\n * @returns a unit vector perpendicular to `v`\r\n */\r\nfunction GetAnyPerpendicularVector(v: DeepImmutable<Vector3>): Vector3 {\r\n const absX = Math.abs(v.x);\r\n const absY = Math.abs(v.y);\r\n const absZ = Math.abs(v.z);\r\n // Cross with whichever cardinal axis is least aligned with `v` to avoid a degenerate cross product.\r\n let other: DeepImmutable<Vector3>;\r\n if (absX <= absY && absX <= absZ) {\r\n other = Vector3.RightReadOnly;\r\n } else if (absY <= absZ) {\r\n other = Vector3.UpReadOnly;\r\n } else {\r\n other = Vector3.LeftHandedForwardReadOnly;\r\n }\r\n return Vector3.Cross(v, other).normalize();\r\n}\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number {\r\n return Math.acos(Clamp(Vector4Dot(q1, q2), -1, 1)) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const dot = Vector3Dot(a, b);\r\n if (Number.isFinite(dot) && dot > 1 - SlerpEpsilon) {\r\n result.copyFromFloats(0, 0, 0, 1);\r\n return result;\r\n }\r\n if (Number.isFinite(dot) && dot < -1 + SlerpEpsilon) {\r\n const axis = GetAnyPerpendicularVector(a);\r\n result.copyFromFloats(axis.x, axis.y, axis.z, 0);\r\n return result;\r\n }\r\n\r\n const axis = Vector3.Cross(a, b).normalize();\r\n const axisScale = Math.sqrt(0.5 - 0.5 * dot);\r\n result.copyFromFloats(axis.x * axisScale, axis.y * axisScale, axis.z * axisScale, Math.sqrt(0.5 + 0.5 * dot));\r\n return result;\r\n}\r\n\r\n/**\r\n * Spherical linear interpolation between two 2D vectors.\r\n * NaN and infinity values are propagated through the arithmetic.\r\n * @param a the first vector\r\n * @param b the second vector\r\n * @param c the (unclamped) interpolation coefficient\r\n * @returns the interpolated 2D vector\r\n */\r\nexport function GetVector2Slerp(a: DeepImmutable<Vector2>, b: DeepImmutable<Vector2>, c: number): Vector2 {\r\n const lengthA = Math.sqrt(a.x * a.x + a.y * a.y);\r\n const lengthB = Math.sqrt(b.x * b.x + b.y * b.y);\r\n // If either vector is (close to) zero length the rotation is undefined; fall back to a linear interpolation.\r\n if (lengthA < SlerpEpsilon || lengthB < SlerpEpsilon) {\r\n return new Vector2((1 - c) * a.x + c * b.x, (1 - c) * a.y + c * b.y);\r\n }\r\n const aHatX = a.x / lengthA;\r\n const aHatY = a.y / lengthA;\r\n const bHatX = b.x / lengthB;\r\n const bHatY = b.y / lengthB;\r\n let theta = Math.acos(Clamp(aHatX * bHatX + aHatY * bHatY, -1, 1));\r\n if (aHatX * bHatY - aHatY * bHatX < 0) {\r\n theta = -theta;\r\n }\r\n const length = (1 - c) * lengthA + c * lengthB;\r\n const cosCTheta = Math.cos(c * theta);\r\n const sinCTheta = Math.sin(c * theta);\r\n return new Vector2((aHatX * cosCTheta - aHatY * sinCTheta) * length, (aHatX * sinCTheta + aHatY * cosCTheta) * length);\r\n}\r\n\r\n/**\r\n * Spherical linear interpolation between two 3D vectors.\r\n * NaN and infinity values are propagated through the arithmetic.\r\n * @param a the first vector\r\n * @param b the second vector\r\n * @param c the (unclamped) interpolation coefficient\r\n * @returns the interpolated 3D vector\r\n */\r\nexport function GetVector3Slerp(a: DeepImmutable<Vector3>, b: DeepImmutable<Vector3>, c: number): Vector3 {\r\n const lengthA = a.length();\r\n const lengthB = b.length();\r\n const lerp = () => new Vector3((1 - c) * a.x + c * b.x, (1 - c) * a.y + c * b.y, (1 - c) * a.z + c * b.z);\r\n // If either vector is (close to) zero length the rotation is undefined; fall back to a linear interpolation.\r\n if (lengthA < SlerpEpsilon || lengthB < SlerpEpsilon) {\r\n return lerp();\r\n }\r\n const aHat = new Vector3(a.x / lengthA, a.y / lengthA, a.z / lengthA);\r\n const bHat = new Vector3(b.x / lengthB, b.y / lengthB, b.z / lengthB);\r\n const dot = Vector3Dot(aHat, bHat);\r\n // Parallel vectors share a direction; a linear interpolation already produces the correct result.\r\n if (dot > 1 - SlerpEpsilon) {\r\n return lerp();\r\n }\r\n let rotationAxis: Vector3;\r\n if (dot < -1 + SlerpEpsilon) {\r\n // Anti-parallel vectors: any axis perpendicular to aHat is a valid rotation axis.\r\n rotationAxis = GetAnyPerpendicularVector(aHat);\r\n } else {\r\n rotationAxis = Vector3.Cross(aHat, bHat).normalize();\r\n }\r\n const angle = c * Math.acos(Clamp(dot, -1, 1));\r\n const rotation = Quaternion.RotationAxis(rotationAxis, angle);\r\n const length = (1 - c) * lengthA + c * lengthB;\r\n return aHat.applyRotationQuaternion(rotation).scaleInPlace(length);\r\n}\r\n\r\n/**\r\n * Creates a quaternion from the specified up and forward directions, as defined by the\r\n * up/forward quaternion operation. Both inputs are assumed to be unit length.\r\n * @param up the up direction\r\n * @param forward the forward direction\r\n * @returns the rotation quaternion\r\n */\r\nexport function GetQuaternionFromUpForward(up: DeepImmutable<Vector3>, forward: DeepImmutable<Vector3>): Quaternion {\r\n const r = new Vector3(forward.x, forward.y, forward.z);\r\n let s = Vector3.Cross(up, r);\r\n if (s.lengthSquared() < SlerpEpsilon * SlerpEpsilon) {\r\n // up and forward are colinear; pick any unit vector perpendicular to forward.\r\n s = GetAnyPerpendicularVector(r);\r\n } else {\r\n s.normalize();\r\n }\r\n const t = Vector3.Cross(r, s);\r\n // Build the rotation matrix with columns s, t and r (Babylon matrices are column-major) and convert it.\r\n const matrix = Matrix.FromValues(s.x, s.y, s.z, 0, t.x, t.y, t.z, 0, r.x, r.y, r.z, 0, 0, 0, 0, 1);\r\n return Quaternion.FromRotationMatrix(matrix);\r\n}\r\n\r\n/**\r\n * The rotation orders accepted by the Euler-angle quaternion operation\r\n * (and {@link GetQuaternionFromEulerAngles}). The default order is `yxz`.\r\n */\r\nexport const QuaternionEulerAngleOrders = [\"xyz\", \"xzy\", \"yxz\", \"yzx\", \"zxy\", \"zyx\"] as const;\r\n\r\n/**\r\n * Builds a rotation quaternion from three Tait–Bryan intrinsic Euler angles applied in the\r\n * specified order.\r\n *\r\n * Babylon only exposes the `yxz` order natively (via `Quaternion.RotationYawPitchRoll`), so the\r\n * result is composed from the individual per-axis rotations to support every order. For an\r\n * intrinsic order `o1o2o3` the result is the Hamilton product `q(o1) * q(o2) * q(o3)`, where each\r\n * `q(axis)` is a rotation about that axis; this matches the corresponding reference intrinsic\r\n * Tait–Bryan rotation matrices. NaN and infinite angle inputs propagate into the result.\r\n * @param order the rotation order, one of {@link QuaternionEulerAngleOrders}; any other value uses the default `yxz`\r\n * @param x rotation around the X axis, in radians\r\n * @param y rotation around the Y axis, in radians\r\n * @param z rotation around the Z axis, in radians\r\n * @returns the composed rotation quaternion\r\n */\r\nexport function GetQuaternionFromEulerAngles(order: string, x: number, y: number, z: number): Quaternion {\r\n const qx = Quaternion.RotationAxis(Vector3.RightReadOnly, x);\r\n const qy = Quaternion.RotationAxis(Vector3.UpReadOnly, y);\r\n const qz = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, z);\r\n // `a.multiplyInPlace(b)` computes the Hamilton product `a * b` in place and returns `a`.\r\n switch (order) {\r\n case \"xyz\":\r\n return qx.multiplyInPlace(qy).multiplyInPlace(qz);\r\n case \"xzy\":\r\n return qx.multiplyInPlace(qz).multiplyInPlace(qy);\r\n case \"yzx\":\r\n return qy.multiplyInPlace(qz).multiplyInPlace(qx);\r\n case \"zxy\":\r\n return qz.multiplyInPlace(qx).multiplyInPlace(qy);\r\n case \"zyx\":\r\n return qz.multiplyInPlace(qy).multiplyInPlace(qx);\r\n case \"yxz\":\r\n default:\r\n // Default order.\r\n return qy.multiplyInPlace(qx).multiplyInPlace(qz);\r\n }\r\n}\r\n"]}
@@ -2,8 +2,15 @@ import { type IObjectInfo, type IPathToObjectConverter } from "../ObjectModel/ob
2
2
  import { type FlowGraphBlock } from "./flowGraphBlock.js";
3
3
  import { type FlowGraphContext } from "./flowGraphContext.js";
4
4
  import { type FlowGraphDataConnection } from "./flowGraphDataConnection.js";
5
- import { FlowGraphInteger } from "./CustomTypes/flowGraphInteger.pure.js";
6
5
  import { type IObjectAccessor } from "./typeDefinitions.js";
6
+ interface IPathTemplateInfo {
7
+ /** Template variable name (without surrounding brackets). */
8
+ name: string;
9
+ /** Bracket style used in the source path; preserved so we replace the right placeholder. */
10
+ style: "curly" | "square";
11
+ /** The connection that supplies the runtime value for substitution. */
12
+ connection: FlowGraphDataConnection<any>;
13
+ }
7
14
  /**
8
15
  * @experimental
9
16
  * A component that converts a path to an object accessor.
@@ -12,9 +19,12 @@ export declare class FlowGraphPathConverterComponent {
12
19
  path: string;
13
20
  ownerBlock: FlowGraphBlock;
14
21
  /**
15
- * The templated inputs for the provided path.
22
+ * The templated inputs for the provided path. Values may be FlowGraphInteger, number, or
23
+ * string (an opaque reference encoded as a JSON Pointer).
16
24
  */
17
- readonly templatedInputs: FlowGraphDataConnection<FlowGraphInteger>[];
25
+ readonly templatedInputs: FlowGraphDataConnection<any>[];
26
+ /** Per-template metadata (name + bracket style + input connection). */
27
+ readonly templateInfos: IPathTemplateInfo[];
18
28
  constructor(path: string, ownerBlock: FlowGraphBlock);
19
29
  /**
20
30
  * Get the accessor for the path.
@@ -25,3 +35,4 @@ export declare class FlowGraphPathConverterComponent {
25
35
  */
26
36
  getAccessor(pathConverter: IPathToObjectConverter<IObjectAccessor>, context: FlowGraphContext): IObjectInfo<IObjectAccessor>;
27
37
  }
38
+ export {};
@@ -1,6 +1,16 @@
1
1
  import { FlowGraphInteger } from "./CustomTypes/flowGraphInteger.pure.js";
2
- import { RichTypeFlowGraphInteger } from "./flowGraphRichTypes.pure.js";
3
- const PathHasTemplatesRegex = new RegExp(/\/\{(\w+)\}(?=\/|$)/g);
2
+ import { RichTypeAny } from "./flowGraphRichTypes.pure.js";
3
+ // JSON Pointer templates may use either bracket style:
4
+ // {name} → a reference template parameter.
5
+ // [name] → an integer template parameter.
6
+ // Real-world assets mix both conventions, so the bracket style by itself is not enough to determine
7
+ // the input's type. We therefore accept both and decide how to substitute at resolution time based
8
+ // on the runtime value supplied to the input socket (FlowGraphInteger / number → int substitution,
9
+ // string → reference substitution by extracting the matching JSON-Pointer segment).
10
+ // These are constructed per scan rather than shared, because a global regex carries `lastIndex`
11
+ // state across calls and a scan that throws part-way would otherwise leave it set for the next one.
12
+ const CreateRefTemplateRegex = () => new RegExp(/\/\{(\w+)\}(?=\/|$)/g);
13
+ const CreateIntTemplateRegex = () => new RegExp(/\/\[(\w+)\](?=\/|$)/g);
4
14
  /**
5
15
  * @experimental
6
16
  * A component that converts a path to an object accessor.
@@ -10,20 +20,34 @@ export class FlowGraphPathConverterComponent {
10
20
  this.path = path;
11
21
  this.ownerBlock = ownerBlock;
12
22
  /**
13
- * The templated inputs for the provided path.
23
+ * The templated inputs for the provided path. Values may be FlowGraphInteger, number, or
24
+ * string (an opaque reference encoded as a JSON Pointer).
14
25
  */
15
26
  this.templatedInputs = [];
16
- let match = PathHasTemplatesRegex.exec(path);
27
+ /** Per-template metadata (name + bracket style + input connection). */
28
+ this.templateInfos = [];
17
29
  const templateSet = new Set();
18
- while (match) {
19
- const [, matchGroup] = match;
20
- if (templateSet.has(matchGroup)) {
21
- throw new Error("Duplicate template variable detected.");
30
+ const collect = (regex, style) => {
31
+ let match = regex.exec(path);
32
+ while (match) {
33
+ const [, name] = match;
34
+ if (templateSet.has(name)) {
35
+ throw new Error("Duplicate template variable detected.");
36
+ }
37
+ templateSet.add(name);
38
+ // Use RichTypeAny so the same socket can receive either an integer (legacy /
39
+ // [name] style) or a string ref (post-ref-update {name} style); the value's
40
+ // runtime type drives the substitution behaviour in getAccessor. Default to
41
+ // FlowGraphInteger(0) — not undefined — so an unconnected index input still
42
+ // resolves to index 0 (the natural default) instead of throwing at path resolution.
43
+ const conn = ownerBlock.registerDataInput(name, RichTypeAny, new FlowGraphInteger(0));
44
+ this.templatedInputs.push(conn);
45
+ this.templateInfos.push({ name, style, connection: conn });
46
+ match = regex.exec(path);
22
47
  }
23
- templateSet.add(matchGroup);
24
- this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger, new FlowGraphInteger(0)));
25
- match = PathHasTemplatesRegex.exec(path);
26
- }
48
+ };
49
+ collect(CreateRefTemplateRegex(), "curly");
50
+ collect(CreateIntTemplateRegex(), "square");
27
51
  }
28
52
  /**
29
53
  * Get the accessor for the path.
@@ -34,14 +58,82 @@ export class FlowGraphPathConverterComponent {
34
58
  */
35
59
  getAccessor(pathConverter, context) {
36
60
  let finalPath = this.path;
37
- for (const templatedInput of this.templatedInputs) {
38
- const valueToReplace = templatedInput.getValue(context).value;
39
- if (typeof valueToReplace !== "number" || valueToReplace < 0) {
40
- throw new Error("Invalid value for templated input.");
41
- }
42
- finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());
61
+ for (const info of this.templateInfos) {
62
+ const raw = info.connection.getValue(context);
63
+ const placeholder = info.style === "curly" ? `{${info.name}}` : `[${info.name}]`;
64
+ const substitution = ResolveTemplateSubstitution(this.path, info.name, raw, context);
65
+ finalPath = finalPath.replace(placeholder, substitution);
43
66
  }
44
67
  return pathConverter.convert(finalPath);
45
68
  }
46
69
  }
70
+ /**
71
+ * Decide what string to splice into a templated path for a given runtime value.
72
+ *
73
+ * - FlowGraphInteger / number → use the integer's decimal representation.
74
+ * - string → treat as a JSON Pointer to an object and pull the segment whose position
75
+ * in the ref matches the position of `{name}` (or `[name]`) in the surrounding template.
76
+ * Falls back to the last non-empty segment, then to the raw ref string.
77
+ * - object → ask the host environment for the reference addressing it, then substitute as above.
78
+ * @param template the original templated path (used to locate the placeholder position)
79
+ * @param name the name of the template parameter being resolved
80
+ * @param raw the runtime value supplied for the template parameter
81
+ * @param context the context used to reach the host resolver for object values
82
+ * @returns the substring to splice into the templated path in place of the placeholder
83
+ */
84
+ function ResolveTemplateSubstitution(template, name, raw, context) {
85
+ if (raw instanceof FlowGraphInteger) {
86
+ AssertNonNegativeInt(raw.value, name);
87
+ return raw.value.toString();
88
+ }
89
+ if (typeof raw === "number") {
90
+ AssertNonNegativeInt(raw, name);
91
+ return raw.toString();
92
+ }
93
+ if (typeof raw === "string") {
94
+ if (raw === "") {
95
+ throw new Error(`Templated reference input "${name}" is null.`);
96
+ }
97
+ return ExtractRefSubstitution(template, name, raw);
98
+ }
99
+ // A runtime object (e.g. a Mesh delivered by a selection event). Mapping it back to a
100
+ // reference is knowledge the host environment owns, so it is delegated to the host resolver.
101
+ // The segment preceding the placeholder (e.g. "nodes" in `/nodes/{nodeRef}/globalMatrix`) is
102
+ // passed as a hint, because an object may be addressable in more than one way.
103
+ if (raw && typeof raw === "object") {
104
+ const pointer = context.getObjectReference(raw, GetPlaceholderParentSegment(template, name));
105
+ if (pointer) {
106
+ return ExtractRefSubstitution(template, name, pointer);
107
+ }
108
+ }
109
+ throw new Error(`Invalid value for templated input "${name}": got ${typeof raw}.`);
110
+ }
111
+ function GetPlaceholderIndex(template, name) {
112
+ const placeholders = [`{${name}}`, `[${name}]`];
113
+ return template.split("/").findIndex((segment) => placeholders.indexOf(segment) >= 0);
114
+ }
115
+ function GetPlaceholderParentSegment(template, name) {
116
+ const placeholderIndex = GetPlaceholderIndex(template, name);
117
+ return placeholderIndex > 0 ? template.split("/")[placeholderIndex - 1] : undefined;
118
+ }
119
+ function AssertNonNegativeInt(value, name) {
120
+ if (typeof value !== "number" || value < 0 || !Number.isFinite(value)) {
121
+ throw new Error(`Invalid value for templated input "${name}": ${value}.`);
122
+ }
123
+ }
124
+ function ExtractRefSubstitution(template, name, refValue) {
125
+ const templateSegments = template.split("/");
126
+ const placeholders = [`{${name}}`, `[${name}]`];
127
+ const placeholderIndex = templateSegments.findIndex((s) => placeholders.indexOf(s) >= 0);
128
+ const refSegments = refValue.split("/");
129
+ if (placeholderIndex >= 0 && placeholderIndex < refSegments.length && refSegments[placeholderIndex] !== "") {
130
+ return refSegments[placeholderIndex];
131
+ }
132
+ for (let i = refSegments.length - 1; i >= 0; i--) {
133
+ if (refSegments[i] !== "") {
134
+ return refSegments[i];
135
+ }
136
+ }
137
+ return refValue;
138
+ }
47
139
  //# sourceMappingURL=flowGraphPathConverterComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphPathConverterComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPathConverterComponent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAGrE,MAAM,qBAAqB,GAAG,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IAKxC,YACW,IAAY,EACZ,UAA0B;QAD1B,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAgB;QANrC;;WAEG;QACa,oBAAe,GAAgD,EAAE,CAAC;QAK9E,IAAI,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;QACtC,OAAO,KAAK,EAAE,CAAC;YACX,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC;YAC7B,IAAI,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAC7D,CAAC;YACD,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC5B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvH,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CAAC,aAAsD,EAAE,OAAyB;QAChG,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAChD,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;YAC9D,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;gBAC3D,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAC1D,CAAC;YACD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC,IAAI,GAAG,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import { type IObjectInfo, type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger.pure\";\r\nimport { RichTypeFlowGraphInteger } from \"./flowGraphRichTypes.pure\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\n\r\nconst PathHasTemplatesRegex = new RegExp(/\\/\\{(\\w+)\\}(?=\\/|$)/g);\r\n\r\n/**\r\n * @experimental\r\n * A component that converts a path to an object accessor.\r\n */\r\nexport class FlowGraphPathConverterComponent {\r\n /**\r\n * The templated inputs for the provided path.\r\n */\r\n public readonly templatedInputs: FlowGraphDataConnection<FlowGraphInteger>[] = [];\r\n public constructor(\r\n public path: string,\r\n public ownerBlock: FlowGraphBlock\r\n ) {\r\n let match = PathHasTemplatesRegex.exec(path);\r\n const templateSet = new Set<string>();\r\n while (match) {\r\n const [, matchGroup] = match;\r\n if (templateSet.has(matchGroup)) {\r\n throw new Error(\"Duplicate template variable detected.\");\r\n }\r\n templateSet.add(matchGroup);\r\n this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger, new FlowGraphInteger(0)));\r\n match = PathHasTemplatesRegex.exec(path);\r\n }\r\n }\r\n\r\n /**\r\n * Get the accessor for the path.\r\n * @param pathConverter the path converter to use to convert the path to an object accessor.\r\n * @param context the context to use.\r\n * @returns the accessor for the path.\r\n * @throws if the value for a templated input is invalid.\r\n */\r\n public getAccessor(pathConverter: IPathToObjectConverter<IObjectAccessor>, context: FlowGraphContext): IObjectInfo<IObjectAccessor> {\r\n let finalPath = this.path;\r\n for (const templatedInput of this.templatedInputs) {\r\n const valueToReplace = templatedInput.getValue(context).value;\r\n if (typeof valueToReplace !== \"number\" || valueToReplace < 0) {\r\n throw new Error(\"Invalid value for templated input.\");\r\n }\r\n finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());\r\n }\r\n return pathConverter.convert(finalPath);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphPathConverterComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPathConverterComponent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,uDAAuD;AACvD,8CAA8C;AAC9C,6CAA6C;AAC7C,oGAAoG;AACpG,mGAAmG;AACnG,mGAAmG;AACnG,oFAAoF;AACpF,gGAAgG;AAChG,oGAAoG;AACpG,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACxE,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAWx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AO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC;IAC9E,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAgB,EAAE,IAAY,EAAE,QAAgB;IAC5E,MAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,CAAC,IAAI,IAAI,GAAG,EAAE,IAAI,IAAI,GAAG,CAAC,CAAC;IAChD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzF,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,gBAAgB,IAAI,CAAC,IAAI,gBAAgB,GAAG,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,gBAAgB,CAAC,KAAK,EAAE,EAAE,CAAC;QACzG,OAAO,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACzC,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/C,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;YACxB,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { type IObjectInfo, type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger.pure\";\r\nimport { RichTypeAny } from \"./flowGraphRichTypes.pure\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\n\r\n// JSON Pointer templates may use either bracket style:\r\n// {name} → a reference template parameter.\r\n// [name] → an integer template parameter.\r\n// Real-world assets mix both conventions, so the bracket style by itself is not enough to determine\r\n// the input's type. We therefore accept both and decide how to substitute at resolution time based\r\n// on the runtime value supplied to the input socket (FlowGraphInteger / number → int substitution,\r\n// string → reference substitution by extracting the matching JSON-Pointer segment).\r\n// These are constructed per scan rather than shared, because a global regex carries `lastIndex`\r\n// state across calls and a scan that throws part-way would otherwise leave it set for the next one.\r\nconst CreateRefTemplateRegex = () => new RegExp(/\\/\\{(\\w+)\\}(?=\\/|$)/g);\r\nconst CreateIntTemplateRegex = () => new RegExp(/\\/\\[(\\w+)\\](?=\\/|$)/g);\r\n\r\ninterface IPathTemplateInfo {\r\n /** Template variable name (without surrounding brackets). */\r\n name: string;\r\n /** Bracket style used in the source path; preserved so we replace the right placeholder. */\r\n style: \"curly\" | \"square\";\r\n /** The connection that supplies the runtime value for substitution. */\r\n connection: FlowGraphDataConnection<any>;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * A component that converts a path to an object accessor.\r\n */\r\nexport class FlowGraphPathConverterComponent {\r\n /**\r\n * The templated inputs for the provided path. Values may be FlowGraphInteger, number, or\r\n * string (an opaque reference encoded as a JSON Pointer).\r\n */\r\n public readonly templatedInputs: FlowGraphDataConnection<any>[] = [];\r\n\r\n /** Per-template metadata (name + bracket style + input connection). */\r\n public readonly templateInfos: IPathTemplateInfo[] = [];\r\n\r\n public constructor(\r\n public path: string,\r\n public ownerBlock: FlowGraphBlock\r\n ) {\r\n const templateSet = new Set<string>();\r\n\r\n const collect = (regex: RegExp, style: \"curly\" | \"square\") => {\r\n let match = regex.exec(path);\r\n while (match) {\r\n const [, name] = match;\r\n if (templateSet.has(name)) {\r\n throw new Error(\"Duplicate template variable detected.\");\r\n }\r\n templateSet.add(name);\r\n // Use RichTypeAny so the same socket can receive either an integer (legacy /\r\n // [name] style) or a string ref (post-ref-update {name} style); the value's\r\n // runtime type drives the substitution behaviour in getAccessor. Default to\r\n // FlowGraphInteger(0) — not undefined — so an unconnected index input still\r\n // resolves to index 0 (the natural default) instead of throwing at path resolution.\r\n const conn = ownerBlock.registerDataInput(name, RichTypeAny, new FlowGraphInteger(0));\r\n this.templatedInputs.push(conn);\r\n this.templateInfos.push({ name, style, connection: conn });\r\n match = regex.exec(path);\r\n }\r\n };\r\n\r\n collect(CreateRefTemplateRegex(), \"curly\");\r\n collect(CreateIntTemplateRegex(), \"square\");\r\n }\r\n\r\n /**\r\n * Get the accessor for the path.\r\n * @param pathConverter the path converter to use to convert the path to an object accessor.\r\n * @param context the context to use.\r\n * @returns the accessor for the path.\r\n * @throws if the value for a templated input is invalid.\r\n */\r\n public getAccessor(pathConverter: IPathToObjectConverter<IObjectAccessor>, context: FlowGraphContext): IObjectInfo<IObjectAccessor> {\r\n let finalPath = this.path;\r\n for (const info of this.templateInfos) {\r\n const raw = info.connection.getValue(context);\r\n const placeholder = info.style === \"curly\" ? `{${info.name}}` : `[${info.name}]`;\r\n const substitution = ResolveTemplateSubstitution(this.path, info.name, raw, context);\r\n finalPath = finalPath.replace(placeholder, substitution);\r\n }\r\n return pathConverter.convert(finalPath);\r\n }\r\n}\r\n\r\n/**\r\n * Decide what string to splice into a templated path for a given runtime value.\r\n *\r\n * - FlowGraphInteger / number → use the integer's decimal representation.\r\n * - string → treat as a JSON Pointer to an object and pull the segment whose position\r\n * in the ref matches the position of `{name}` (or `[name]`) in the surrounding template.\r\n * Falls back to the last non-empty segment, then to the raw ref string.\r\n * - object → ask the host environment for the reference addressing it, then substitute as above.\r\n * @param template the original templated path (used to locate the placeholder position)\r\n * @param name the name of the template parameter being resolved\r\n * @param raw the runtime value supplied for the template parameter\r\n * @param context the context used to reach the host resolver for object values\r\n * @returns the substring to splice into the templated path in place of the placeholder\r\n */\r\nfunction ResolveTemplateSubstitution(template: string, name: string, raw: any, context: FlowGraphContext): string {\r\n if (raw instanceof FlowGraphInteger) {\r\n AssertNonNegativeInt(raw.value, name);\r\n return raw.value.toString();\r\n }\r\n if (typeof raw === \"number\") {\r\n AssertNonNegativeInt(raw, name);\r\n return raw.toString();\r\n }\r\n if (typeof raw === \"string\") {\r\n if (raw === \"\") {\r\n throw new Error(`Templated reference input \"${name}\" is null.`);\r\n }\r\n return ExtractRefSubstitution(template, name, raw);\r\n }\r\n // A runtime object (e.g. a Mesh delivered by a selection event). Mapping it back to a\r\n // reference is knowledge the host environment owns, so it is delegated to the host resolver.\r\n // The segment preceding the placeholder (e.g. \"nodes\" in `/nodes/{nodeRef}/globalMatrix`) is\r\n // passed as a hint, because an object may be addressable in more than one way.\r\n if (raw && typeof raw === \"object\") {\r\n const pointer = context.getObjectReference(raw as object, GetPlaceholderParentSegment(template, name));\r\n if (pointer) {\r\n return ExtractRefSubstitution(template, name, pointer);\r\n }\r\n }\r\n throw new Error(`Invalid value for templated input \"${name}\": got ${typeof raw}.`);\r\n}\r\n\r\nfunction GetPlaceholderIndex(template: string, name: string): number {\r\n const placeholders = [`{${name}}`, `[${name}]`];\r\n return template.split(\"/\").findIndex((segment) => placeholders.indexOf(segment) >= 0);\r\n}\r\n\r\nfunction GetPlaceholderParentSegment(template: string, name: string): string | undefined {\r\n const placeholderIndex = GetPlaceholderIndex(template, name);\r\n return placeholderIndex > 0 ? template.split(\"/\")[placeholderIndex - 1] : undefined;\r\n}\r\n\r\nfunction AssertNonNegativeInt(value: number, name: string): void {\r\n if (typeof value !== \"number\" || value < 0 || !Number.isFinite(value)) {\r\n throw new Error(`Invalid value for templated input \"${name}\": ${value}.`);\r\n }\r\n}\r\n\r\nfunction ExtractRefSubstitution(template: string, name: string, refValue: string): string {\r\n const templateSegments = template.split(\"/\");\r\n const placeholders = [`{${name}}`, `[${name}]`];\r\n const placeholderIndex = templateSegments.findIndex((s) => placeholders.indexOf(s) >= 0);\r\n const refSegments = refValue.split(\"/\");\r\n if (placeholderIndex >= 0 && placeholderIndex < refSegments.length && refSegments[placeholderIndex] !== \"\") {\r\n return refSegments[placeholderIndex];\r\n }\r\n for (let i = refSegments.length - 1; i >= 0; i--) {\r\n if (refSegments[i] !== \"\") {\r\n return refSegments[i];\r\n }\r\n }\r\n return refValue;\r\n}\r\n"]}
@@ -47,11 +47,17 @@ export class FlowGraphSignalConnection extends FlowGraphConnection {
47
47
  if (context._shouldBreak(this._ownerBlock, this)) {
48
48
  return; // Execution paused — stored as pending activation
49
49
  }
50
+ // Start a new execution frame BEFORE executing the node: an output value socket (a random
51
+ // value, for instance) retains its value until a node with one or more flow sockets is
52
+ // executed, after which it is recomputed on the next access. Because flow execution is
53
+ // synchronous and nested, the id must be increased before the block runs so each flow
54
+ // socket activation (including loop self-activations) observes a fresh frame, while
55
+ // staying constant within a single block execution so per-frame value caching still works.
56
+ context._increaseExecutionId();
50
57
  context._notifyExecuteNode(this._ownerBlock);
51
58
  const startTime = performance.now();
52
59
  this._ownerBlock._execute(context, this);
53
60
  this._ownerBlock._lastExecutionTime = performance.now() - startTime;
54
- context._increaseExecutionId();
55
61
  }
56
62
  else {
57
63
  for (const connectedPoint of this._connectedPoint) {
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphSignalConnection.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAuE;IAAtH;;QAMI;;;WAGG;QACI,aAAQ,GAAW,CAAC,CAAC;QAY5B;;;WAGG;QACI,wBAAmB,GAAW,CAAC,CAA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YACJ,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBAChD,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,iCAAiC;IAC7C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphAction } from \"./flowGraphLogger\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * Represents a connection point for a signal.\r\n * When an output point is activated, it will activate the connected input point.\r\n * When an input point is activated, it will execute the block it belongs to.\r\n */\r\nexport class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {\r\n /**\r\n * Optional payload. Can be used, for example, when an error is thrown to pass additional information.\r\n */\r\n public payload: any;\r\n\r\n /**\r\n * The priority of the signal. Signals with higher priority will be executed first.\r\n * Set priority before adding the connection as sorting happens only when the connection is added.\r\n */\r\n public priority: number = 0;\r\n\r\n public override _isSingularConnection(): boolean {\r\n return false;\r\n }\r\n\r\n public override connectTo(point: FlowGraphSignalConnection): void {\r\n super.connectTo(point);\r\n // sort according to priority to handle execution order\r\n this._connectedPoint.sort((a, b) => b.priority - a.priority);\r\n }\r\n\r\n /**\r\n * Timestamp of the last activation (set on output signals when they fire).\r\n * @internal\r\n */\r\n public _lastActivationTime: number = -1;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _activateSignal(context: FlowGraphContext): void {\r\n this._lastActivationTime = performance.now();\r\n context.logger?.addLogItem({\r\n action: FlowGraphAction.ActivateSignal,\r\n className: this._ownerBlock.getClassName(),\r\n uniqueId: this._ownerBlock.uniqueId,\r\n payload: {\r\n connectionType: this.connectionType,\r\n name: this.name,\r\n },\r\n });\r\n if (this.connectionType === FlowGraphConnectionType.Input) {\r\n // Check breakpoint before executing\r\n if (context._shouldBreak(this._ownerBlock, this)) {\r\n return; // Execution paused — stored as pending activation\r\n }\r\n context._notifyExecuteNode(this._ownerBlock);\r\n const startTime = performance.now();\r\n this._ownerBlock._execute(context, this);\r\n this._ownerBlock._lastExecutionTime = performance.now() - startTime;\r\n context._increaseExecutionId();\r\n } else {\r\n for (const connectedPoint of this._connectedPoint) {\r\n connectedPoint._activateSignal(context);\r\n }\r\n }\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphSignalConnection.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphSignalConnection(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"FlowGraphSignalConnection\", FlowGraphSignalConnection);\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphSignalConnection.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAuE;IAAtH;;QAMI;;;WAGG;QACI,aAAQ,GAAW,CAAC,CAAC;QAY5B;;;WAGG;QACI,wBAAmB,GAAW,CAAC,CAAC,CAAC;IAsC5C,CAAC;IApDmB,qBAAqB;QACjC,OAAO,KAAK,CAAC;IACjB,CAAC;IAEe,SAAS,CAA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ACJ,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBAChD,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,iCAAiC;IAC7C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphAction } from \"./flowGraphLogger\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * Represents a connection point for a signal.\r\n * When an output point is activated, it will activate the connected input point.\r\n * When an input point is activated, it will execute the block it belongs to.\r\n */\r\nexport class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {\r\n /**\r\n * Optional payload. Can be used, for example, when an error is thrown to pass additional information.\r\n */\r\n public payload: any;\r\n\r\n /**\r\n * The priority of the signal. Signals with higher priority will be executed first.\r\n * Set priority before adding the connection as sorting happens only when the connection is added.\r\n */\r\n public priority: number = 0;\r\n\r\n public override _isSingularConnection(): boolean {\r\n return false;\r\n }\r\n\r\n public override connectTo(point: FlowGraphSignalConnection): void {\r\n super.connectTo(point);\r\n // sort according to priority to handle execution order\r\n this._connectedPoint.sort((a, b) => b.priority - a.priority);\r\n }\r\n\r\n /**\r\n * Timestamp of the last activation (set on output signals when they fire).\r\n * @internal\r\n */\r\n public _lastActivationTime: number = -1;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _activateSignal(context: FlowGraphContext): void {\r\n this._lastActivationTime = performance.now();\r\n context.logger?.addLogItem({\r\n action: FlowGraphAction.ActivateSignal,\r\n className: this._ownerBlock.getClassName(),\r\n uniqueId: this._ownerBlock.uniqueId,\r\n payload: {\r\n connectionType: this.connectionType,\r\n name: this.name,\r\n },\r\n });\r\n if (this.connectionType === FlowGraphConnectionType.Input) {\r\n // Check breakpoint before executing\r\n if (context._shouldBreak(this._ownerBlock, this)) {\r\n return; // Execution paused — stored as pending activation\r\n }\r\n // Start a new execution frame BEFORE executing the node: an output value socket (a random\r\n // value, for instance) retains its value until a node with one or more flow sockets is\r\n // executed, after which it is recomputed on the next access. Because flow execution is\r\n // synchronous and nested, the id must be increased before the block runs so each flow\r\n // socket activation (including loop self-activations) observes a fresh frame, while\r\n // staying constant within a single block execution so per-frame value caching still works.\r\n context._increaseExecutionId();\r\n context._notifyExecuteNode(this._ownerBlock);\r\n const startTime = performance.now();\r\n this._ownerBlock._execute(context, this);\r\n this._ownerBlock._lastExecutionTime = performance.now() - startTime;\r\n } else {\r\n for (const connectedPoint of this._connectedPoint) {\r\n connectedPoint._activateSignal(context);\r\n }\r\n }\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphSignalConnection.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphSignalConnection(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"FlowGraphSignalConnection\", FlowGraphSignalConnection);\r\n}\r\n"]}
@@ -13,6 +13,8 @@ export * from "./flowGraphAssetsContext.js";
13
13
  export * from "./flowGraphParser.js";
14
14
  export * from "./flowGraphPathConverter.js";
15
15
  export * from "./flowGraphPathConverterComponent.js";
16
+ export * from "./flowGraphHostResolver.js";
17
+ export * from "./flowGraphDelayRegistry.js";
16
18
  export * from "./flowGraphLogger.js";
17
19
  export * from "./flowGraphValidator.js";
18
20
  export * from "./Blocks/index.js";