@onerjs/smart-filters 8.25.1 → 8.25.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 (251) hide show
  1. package/dist/IDisposable.d.ts +10 -0
  2. package/dist/IDisposable.d.ts.map +1 -0
  3. package/dist/IDisposable.js +2 -0
  4. package/dist/IDisposable.js.map +1 -0
  5. package/dist/blockFoundation/aggregateBlock.d.ts +56 -0
  6. package/dist/blockFoundation/aggregateBlock.d.ts.map +1 -0
  7. package/dist/blockFoundation/aggregateBlock.js +130 -0
  8. package/dist/blockFoundation/aggregateBlock.js.map +1 -0
  9. package/dist/blockFoundation/baseBlock.d.ts +176 -0
  10. package/dist/blockFoundation/baseBlock.d.ts.map +1 -0
  11. package/dist/blockFoundation/baseBlock.js +276 -0
  12. package/dist/blockFoundation/baseBlock.js.map +1 -0
  13. package/dist/blockFoundation/customAggregateBlock.d.ts +38 -0
  14. package/dist/blockFoundation/customAggregateBlock.d.ts.map +1 -0
  15. package/dist/blockFoundation/customAggregateBlock.js +63 -0
  16. package/dist/blockFoundation/customAggregateBlock.js.map +1 -0
  17. package/dist/blockFoundation/customShaderBlock.d.ts +73 -0
  18. package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -0
  19. package/dist/blockFoundation/customShaderBlock.js +232 -0
  20. package/dist/blockFoundation/customShaderBlock.js.map +1 -0
  21. package/dist/blockFoundation/disableableShaderBlock.d.ts +56 -0
  22. package/dist/blockFoundation/disableableShaderBlock.d.ts.map +1 -0
  23. package/dist/blockFoundation/disableableShaderBlock.js +68 -0
  24. package/dist/blockFoundation/disableableShaderBlock.js.map +1 -0
  25. package/dist/blockFoundation/index.d.ts +10 -0
  26. package/dist/blockFoundation/index.d.ts.map +1 -0
  27. package/dist/blockFoundation/index.js +8 -0
  28. package/dist/blockFoundation/index.js.map +1 -0
  29. package/dist/blockFoundation/inputBlock.d.ts +127 -0
  30. package/dist/blockFoundation/inputBlock.d.ts.map +1 -0
  31. package/dist/blockFoundation/inputBlock.deserializer.d.ts +12 -0
  32. package/dist/blockFoundation/inputBlock.deserializer.d.ts.map +1 -0
  33. package/dist/blockFoundation/inputBlock.deserializer.js +65 -0
  34. package/dist/blockFoundation/inputBlock.deserializer.js.map +1 -0
  35. package/dist/blockFoundation/inputBlock.js +89 -0
  36. package/dist/blockFoundation/inputBlock.js.map +1 -0
  37. package/dist/blockFoundation/inputBlock.serialization.types.d.ts +105 -0
  38. package/dist/blockFoundation/inputBlock.serialization.types.d.ts.map +1 -0
  39. package/dist/blockFoundation/inputBlock.serialization.types.js +2 -0
  40. package/dist/blockFoundation/inputBlock.serialization.types.js.map +1 -0
  41. package/dist/blockFoundation/inputBlock.serializer.d.ts +6 -0
  42. package/dist/blockFoundation/inputBlock.serializer.d.ts.map +1 -0
  43. package/dist/blockFoundation/inputBlock.serializer.js +130 -0
  44. package/dist/blockFoundation/inputBlock.serializer.js.map +1 -0
  45. package/dist/blockFoundation/outputBlock.d.ts +47 -0
  46. package/dist/blockFoundation/outputBlock.d.ts.map +1 -0
  47. package/dist/blockFoundation/outputBlock.js +123 -0
  48. package/dist/blockFoundation/outputBlock.js.map +1 -0
  49. package/dist/blockFoundation/shaderBlock.d.ts +64 -0
  50. package/dist/blockFoundation/shaderBlock.d.ts.map +1 -0
  51. package/dist/blockFoundation/shaderBlock.js +125 -0
  52. package/dist/blockFoundation/shaderBlock.js.map +1 -0
  53. package/dist/blockFoundation/textureOptions.d.ts +47 -0
  54. package/dist/blockFoundation/textureOptions.d.ts.map +1 -0
  55. package/dist/blockFoundation/textureOptions.js +37 -0
  56. package/dist/blockFoundation/textureOptions.js.map +1 -0
  57. package/dist/command/command.d.ts +48 -0
  58. package/dist/command/command.d.ts.map +1 -0
  59. package/dist/command/command.js +15 -0
  60. package/dist/command/command.js.map +1 -0
  61. package/dist/command/commandBuffer.d.ts +40 -0
  62. package/dist/command/commandBuffer.d.ts.map +1 -0
  63. package/dist/command/commandBuffer.js +58 -0
  64. package/dist/command/commandBuffer.js.map +1 -0
  65. package/dist/command/commandBufferDebugger.d.ts +7 -0
  66. package/dist/command/commandBufferDebugger.d.ts.map +1 -0
  67. package/dist/command/commandBufferDebugger.js +13 -0
  68. package/dist/command/commandBufferDebugger.js.map +1 -0
  69. package/dist/command/index.d.ts +6 -0
  70. package/dist/command/index.d.ts.map +1 -0
  71. package/dist/command/index.js +8 -0
  72. package/dist/command/index.js.map +1 -0
  73. package/dist/connection/connectionPoint.d.ts +110 -0
  74. package/dist/connection/connectionPoint.d.ts.map +1 -0
  75. package/dist/connection/connectionPoint.js +154 -0
  76. package/dist/connection/connectionPoint.js.map +1 -0
  77. package/dist/connection/connectionPointCompatibilityState.d.ts +20 -0
  78. package/dist/connection/connectionPointCompatibilityState.d.ts.map +1 -0
  79. package/dist/connection/connectionPointCompatibilityState.js +32 -0
  80. package/dist/connection/connectionPointCompatibilityState.js.map +1 -0
  81. package/dist/connection/connectionPointDirection.d.ts +10 -0
  82. package/dist/connection/connectionPointDirection.d.ts.map +1 -0
  83. package/dist/connection/connectionPointDirection.js +11 -0
  84. package/dist/connection/connectionPointDirection.js.map +1 -0
  85. package/dist/connection/connectionPointType.d.ts +29 -0
  86. package/dist/connection/connectionPointType.d.ts.map +1 -0
  87. package/dist/connection/connectionPointType.js +19 -0
  88. package/dist/connection/connectionPointType.js.map +1 -0
  89. package/dist/connection/connectionPointWithDefault.d.ts +23 -0
  90. package/dist/connection/connectionPointWithDefault.d.ts.map +1 -0
  91. package/dist/connection/connectionPointWithDefault.js +19 -0
  92. package/dist/connection/connectionPointWithDefault.js.map +1 -0
  93. package/dist/connection/index.d.ts +8 -0
  94. package/dist/connection/index.d.ts.map +1 -0
  95. package/dist/connection/index.js +7 -0
  96. package/dist/connection/index.js.map +1 -0
  97. package/dist/editorUtils/editableInPropertyPage.d.ts +80 -0
  98. package/dist/editorUtils/editableInPropertyPage.d.ts.map +1 -0
  99. package/dist/editorUtils/editableInPropertyPage.js +42 -0
  100. package/dist/editorUtils/editableInPropertyPage.js.map +1 -0
  101. package/dist/editorUtils/index.d.ts +3 -0
  102. package/dist/editorUtils/index.d.ts.map +1 -0
  103. package/dist/editorUtils/index.js +4 -0
  104. package/dist/editorUtils/index.js.map +1 -0
  105. package/dist/index.d.ts +13 -0
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.js +14 -0
  108. package/dist/index.js.map +1 -0
  109. package/dist/optimization/dependencyGraph.d.ts +31 -0
  110. package/dist/optimization/dependencyGraph.d.ts.map +1 -0
  111. package/dist/optimization/dependencyGraph.js +78 -0
  112. package/dist/optimization/dependencyGraph.js.map +1 -0
  113. package/dist/optimization/index.d.ts +2 -0
  114. package/dist/optimization/index.d.ts.map +1 -0
  115. package/dist/optimization/index.js +2 -0
  116. package/dist/optimization/index.js.map +1 -0
  117. package/dist/optimization/optimizedShaderBlock.d.ts +75 -0
  118. package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -0
  119. package/dist/optimization/optimizedShaderBlock.js +105 -0
  120. package/dist/optimization/optimizedShaderBlock.js.map +1 -0
  121. package/dist/optimization/smartFilterOptimizer.d.ts +126 -0
  122. package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -0
  123. package/dist/optimization/smartFilterOptimizer.js +666 -0
  124. package/dist/optimization/smartFilterOptimizer.js.map +1 -0
  125. package/dist/runtime/index.d.ts +8 -0
  126. package/dist/runtime/index.d.ts.map +1 -0
  127. package/dist/runtime/index.js +7 -0
  128. package/dist/runtime/index.js.map +1 -0
  129. package/dist/runtime/renderTargetGenerator.d.ts +43 -0
  130. package/dist/runtime/renderTargetGenerator.d.ts.map +1 -0
  131. package/dist/runtime/renderTargetGenerator.js +169 -0
  132. package/dist/runtime/renderTargetGenerator.js.map +1 -0
  133. package/dist/runtime/shaderRuntime.d.ts +103 -0
  134. package/dist/runtime/shaderRuntime.d.ts.map +1 -0
  135. package/dist/runtime/shaderRuntime.js +132 -0
  136. package/dist/runtime/shaderRuntime.js.map +1 -0
  137. package/dist/runtime/smartFilterRuntime.d.ts +69 -0
  138. package/dist/runtime/smartFilterRuntime.d.ts.map +1 -0
  139. package/dist/runtime/smartFilterRuntime.js +63 -0
  140. package/dist/runtime/smartFilterRuntime.js.map +1 -0
  141. package/dist/runtime/strongRef.d.ts +16 -0
  142. package/dist/runtime/strongRef.d.ts.map +1 -0
  143. package/dist/runtime/strongRef.js +9 -0
  144. package/dist/runtime/strongRef.js.map +1 -0
  145. package/dist/serialization/importCustomBlockDefinition.d.ts +15 -0
  146. package/dist/serialization/importCustomBlockDefinition.d.ts.map +1 -0
  147. package/dist/serialization/importCustomBlockDefinition.js +76 -0
  148. package/dist/serialization/importCustomBlockDefinition.js.map +1 -0
  149. package/dist/serialization/index.d.ts +9 -0
  150. package/dist/serialization/index.d.ts.map +1 -0
  151. package/dist/serialization/index.js +11 -0
  152. package/dist/serialization/index.js.map +1 -0
  153. package/dist/serialization/serializedBlockDefinition.d.ts +12 -0
  154. package/dist/serialization/serializedBlockDefinition.d.ts.map +1 -0
  155. package/dist/serialization/serializedBlockDefinition.js +2 -0
  156. package/dist/serialization/serializedBlockDefinition.js.map +1 -0
  157. package/dist/serialization/serializedShaderBlockDefinition.d.ts +7 -0
  158. package/dist/serialization/serializedShaderBlockDefinition.d.ts.map +1 -0
  159. package/dist/serialization/serializedShaderBlockDefinition.js +2 -0
  160. package/dist/serialization/serializedShaderBlockDefinition.js.map +1 -0
  161. package/dist/serialization/serializedSmartFilter.d.ts +6 -0
  162. package/dist/serialization/serializedSmartFilter.d.ts.map +1 -0
  163. package/dist/serialization/serializedSmartFilter.js +2 -0
  164. package/dist/serialization/serializedSmartFilter.js.map +1 -0
  165. package/dist/serialization/smartFilterDeserializer.d.ts +34 -0
  166. package/dist/serialization/smartFilterDeserializer.d.ts.map +1 -0
  167. package/dist/serialization/smartFilterDeserializer.js +141 -0
  168. package/dist/serialization/smartFilterDeserializer.js.map +1 -0
  169. package/dist/serialization/smartFilterSerializer.d.ts +23 -0
  170. package/dist/serialization/smartFilterSerializer.d.ts.map +1 -0
  171. package/dist/serialization/smartFilterSerializer.js +95 -0
  172. package/dist/serialization/smartFilterSerializer.js.map +1 -0
  173. package/dist/serialization/v1/defaultBlockSerializer.d.ts +9 -0
  174. package/dist/serialization/v1/defaultBlockSerializer.d.ts.map +1 -0
  175. package/dist/serialization/v1/defaultBlockSerializer.js +19 -0
  176. package/dist/serialization/v1/defaultBlockSerializer.js.map +1 -0
  177. package/dist/serialization/v1/index.d.ts +4 -0
  178. package/dist/serialization/v1/index.d.ts.map +1 -0
  179. package/dist/serialization/v1/index.js +5 -0
  180. package/dist/serialization/v1/index.js.map +1 -0
  181. package/dist/serialization/v1/shaderBlockSerialization.types.d.ts +73 -0
  182. package/dist/serialization/v1/shaderBlockSerialization.types.d.ts.map +1 -0
  183. package/dist/serialization/v1/shaderBlockSerialization.types.js +7 -0
  184. package/dist/serialization/v1/shaderBlockSerialization.types.js.map +1 -0
  185. package/dist/serialization/v1/smartFilterSerialization.types.d.ts +98 -0
  186. package/dist/serialization/v1/smartFilterSerialization.types.d.ts.map +1 -0
  187. package/dist/serialization/v1/smartFilterSerialization.types.js +2 -0
  188. package/dist/serialization/v1/smartFilterSerialization.types.js.map +1 -0
  189. package/dist/smartFilter.d.ts +118 -0
  190. package/dist/smartFilter.d.ts.map +1 -0
  191. package/dist/smartFilter.js +169 -0
  192. package/dist/smartFilter.js.map +1 -0
  193. package/dist/utils/buildTools/buildShaders.d.ts +9 -0
  194. package/dist/utils/buildTools/buildShaders.d.ts.map +1 -0
  195. package/dist/utils/buildTools/buildShaders.js +13 -0
  196. package/dist/utils/buildTools/buildShaders.js.map +1 -0
  197. package/dist/utils/buildTools/convertGlslIntoBlock.d.ts +9 -0
  198. package/dist/utils/buildTools/convertGlslIntoBlock.d.ts.map +1 -0
  199. package/dist/utils/buildTools/convertGlslIntoBlock.js +346 -0
  200. package/dist/utils/buildTools/convertGlslIntoBlock.js.map +1 -0
  201. package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts +26 -0
  202. package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts.map +1 -0
  203. package/dist/utils/buildTools/convertGlslIntoShaderProgram.js +141 -0
  204. package/dist/utils/buildTools/convertGlslIntoShaderProgram.js.map +1 -0
  205. package/dist/utils/buildTools/convertShaders.d.ts +16 -0
  206. package/dist/utils/buildTools/convertShaders.d.ts.map +1 -0
  207. package/dist/utils/buildTools/convertShaders.js +62 -0
  208. package/dist/utils/buildTools/convertShaders.js.map +1 -0
  209. package/dist/utils/buildTools/shaderCode.types.d.ts +51 -0
  210. package/dist/utils/buildTools/shaderCode.types.d.ts.map +1 -0
  211. package/dist/utils/buildTools/shaderCode.types.js +2 -0
  212. package/dist/utils/buildTools/shaderCode.types.js.map +1 -0
  213. package/dist/utils/buildTools/shaderConverter.d.ts +77 -0
  214. package/dist/utils/buildTools/shaderConverter.d.ts.map +1 -0
  215. package/dist/utils/buildTools/shaderConverter.js +297 -0
  216. package/dist/utils/buildTools/shaderConverter.js.map +1 -0
  217. package/dist/utils/buildTools/watchShaders.d.ts +9 -0
  218. package/dist/utils/buildTools/watchShaders.d.ts.map +1 -0
  219. package/dist/utils/buildTools/watchShaders.js +39 -0
  220. package/dist/utils/buildTools/watchShaders.js.map +1 -0
  221. package/dist/utils/index.d.ts +4 -0
  222. package/dist/utils/index.d.ts.map +1 -0
  223. package/dist/utils/index.js +4 -0
  224. package/dist/utils/index.js.map +1 -0
  225. package/dist/utils/renderTargetUtils.d.ts +14 -0
  226. package/dist/utils/renderTargetUtils.d.ts.map +1 -0
  227. package/dist/utils/renderTargetUtils.js +23 -0
  228. package/dist/utils/renderTargetUtils.js.map +1 -0
  229. package/dist/utils/shaderCodeUtils.d.ts +91 -0
  230. package/dist/utils/shaderCodeUtils.d.ts.map +1 -0
  231. package/dist/utils/shaderCodeUtils.js +111 -0
  232. package/dist/utils/shaderCodeUtils.js.map +1 -0
  233. package/dist/utils/textureLoaders.d.ts +16 -0
  234. package/dist/utils/textureLoaders.d.ts.map +1 -0
  235. package/dist/utils/textureLoaders.js +22 -0
  236. package/dist/utils/textureLoaders.js.map +1 -0
  237. package/dist/utils/textureUtils.d.ts +13 -0
  238. package/dist/utils/textureUtils.d.ts.map +1 -0
  239. package/dist/utils/textureUtils.js +25 -0
  240. package/dist/utils/textureUtils.js.map +1 -0
  241. package/dist/utils/uniqueIdGenerator.d.ts +19 -0
  242. package/dist/utils/uniqueIdGenerator.d.ts.map +1 -0
  243. package/dist/utils/uniqueIdGenerator.js +27 -0
  244. package/dist/utils/uniqueIdGenerator.js.map +1 -0
  245. package/dist/version.d.ts +5 -0
  246. package/dist/version.d.ts.map +1 -0
  247. package/dist/version.js +5 -0
  248. package/dist/version.js.map +1 -0
  249. package/package.json +1 -1
  250. package/src/optimization/smartFilterOptimizer.ts +305 -158
  251. package/src/version.ts +1 -1
@@ -0,0 +1,125 @@
1
+ import { __decorate } from "@onerjs/core/tslib.es6.js";
2
+ import "@onerjs/core/Engines/Extensions/engine.renderTarget.js";
3
+ import { ShaderRuntime } from "../runtime/shaderRuntime.js";
4
+ import { ConnectionPointType } from "../connection/connectionPointType.js";
5
+ import { CreateCommand } from "../command/command.js";
6
+ import { UndecorateSymbol } from "../utils/shaderCodeUtils.js";
7
+ import { RegisterFinalRenderCommand } from "../utils/renderTargetUtils.js";
8
+ import { BaseBlock } from "./baseBlock.js";
9
+ import { TextureFormat, TextureType } from "./textureOptions.js";
10
+ import { EditableInPropertyPage, PropertyTypeForEdition } from "../editorUtils/editableInPropertyPage.js";
11
+ const OutputTexturePropertiesGroupName = "OUTPUT TEXTURE PROPERTIES";
12
+ /**
13
+ * This is the base class for all shader blocks.
14
+ *
15
+ * It contains the redundant part of wrapping a shader for a full screen pass.
16
+ *
17
+ * The only required function to implement is the bind function.
18
+ */
19
+ export class ShaderBlock extends BaseBlock {
20
+ /**
21
+ * Disconnects the block from the graph.
22
+ * @param disconnectedConnections - Stores the connections that have been broken in the process. You can reconnect them later if needed.
23
+ */
24
+ disconnectFromGraph(disconnectedConnections) {
25
+ const input = this._getConnectionForMainInputTexture();
26
+ for (const endpoint of this.output.endpoints) {
27
+ disconnectedConnections?.push([endpoint, this.output]);
28
+ input.connectTo(endpoint);
29
+ }
30
+ }
31
+ _getConnectionForMainInputTexture() {
32
+ const mainInputTextureName = this.getShaderProgram().fragment.mainInputTexture;
33
+ if (!mainInputTextureName) {
34
+ throw `The block named "${this.name}" does not have a main input texture defined!`;
35
+ }
36
+ const mainInputTexture = this.findInput(UndecorateSymbol(mainInputTextureName));
37
+ if (!mainInputTexture || !mainInputTexture.connectedTo) {
38
+ throw `The main input texture "${mainInputTextureName}" of block named "${this.name}" is not connected!`;
39
+ }
40
+ return mainInputTexture.connectedTo;
41
+ }
42
+ /**
43
+ * Instantiates a new block.
44
+ * @param smartFilter - Defines the smart filter the block belongs to
45
+ * @param name - Defines the name of the block
46
+ * @param disableOptimization - Defines if the block should not be optimized (default: false)
47
+ */
48
+ constructor(smartFilter, name, disableOptimization = false) {
49
+ super(smartFilter, name, disableOptimization);
50
+ /**
51
+ * The output connection point of the block.
52
+ */
53
+ this.output = this._registerOutput("output", ConnectionPointType.Texture);
54
+ /**
55
+ * The options used when creating the texture this block outputs to
56
+ */
57
+ this.outputTextureOptions = {
58
+ ratio: 1,
59
+ format: TextureFormat.RGBA,
60
+ type: TextureType.UNSIGNED_BYTE,
61
+ };
62
+ }
63
+ /**
64
+ * Gets the shader program to use to render the block.
65
+ * @returns The shader program to use to render the block
66
+ */
67
+ getShaderProgram() {
68
+ return this.constructor.ShaderCode;
69
+ }
70
+ /**
71
+ * Generates the commands needed to execute the block at runtime and gathers promises for initialization work
72
+ * @param initializationData - The initialization data to use
73
+ * @param finalOutput - Defines if the block is the final output of the smart filter
74
+ */
75
+ generateCommandsAndGatherInitPromises(initializationData, finalOutput) {
76
+ const runtime = initializationData.runtime;
77
+ const shaderBlockRuntime = new ShaderRuntime(runtime.effectRenderer, this.getShaderProgram(), this.getShaderBinding());
78
+ initializationData.initializationPromises.push(shaderBlockRuntime.onReadyAsync);
79
+ runtime.registerResource(shaderBlockRuntime);
80
+ if (finalOutput) {
81
+ RegisterFinalRenderCommand(initializationData.outputBlock, runtime, this, shaderBlockRuntime);
82
+ }
83
+ else {
84
+ const renderTargetTexture = this.output.runtimeData?.value;
85
+ if (!renderTargetTexture) {
86
+ throw new Error(`${this.blockType} did not have a render target texture.`);
87
+ }
88
+ runtime.registerCommand(CreateCommand(`${this.blockType}.render`, this, () => {
89
+ shaderBlockRuntime.renderToTargetTexture(renderTargetTexture);
90
+ }));
91
+ }
92
+ super.generateCommandsAndGatherInitPromises(initializationData, finalOutput);
93
+ }
94
+ }
95
+ /**
96
+ * The class name of the block.
97
+ */
98
+ ShaderBlock.ClassName = "ShaderBlock";
99
+ __decorate([
100
+ EditableInPropertyPage("Ratio", PropertyTypeForEdition.Float, OutputTexturePropertiesGroupName, {
101
+ min: 0.1,
102
+ max: 10.0,
103
+ notifiers: { rebuild: true },
104
+ subPropertyName: "ratio",
105
+ }),
106
+ EditableInPropertyPage("Format", PropertyTypeForEdition.List, OutputTexturePropertiesGroupName, {
107
+ notifiers: { rebuild: true },
108
+ subPropertyName: "format",
109
+ options: [
110
+ { label: "R", value: TextureFormat.R },
111
+ { label: "RG", value: TextureFormat.RG },
112
+ { label: "RGBA", value: TextureFormat.RGBA },
113
+ ],
114
+ }),
115
+ EditableInPropertyPage("Type", PropertyTypeForEdition.List, OutputTexturePropertiesGroupName, {
116
+ notifiers: { rebuild: true },
117
+ subPropertyName: "type",
118
+ options: [
119
+ { label: "UByte", value: TextureType.UNSIGNED_BYTE },
120
+ { label: "Float", value: TextureType.FLOAT },
121
+ { label: "Half Float", value: TextureType.HALF_FLOAT },
122
+ ],
123
+ })
124
+ ], ShaderBlock.prototype, "outputTextureOptions", void 0);
125
+ //# sourceMappingURL=shaderBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shaderBlock.js","sourceRoot":"","sources":["../../src/blockFoundation/shaderBlock.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;QAC5B,eAAe,EAAE,MAAM;QACvB,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,aAAa,EAAE;YACpD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE;YAC5C,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC,UAAU,EAAE;SACzD;KACJ,CAAC;yDAKA"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The format of a texture - corresponds to the Babylon.js TextureFormat constants
3
+ */
4
+ export declare enum TextureFormat {
5
+ /** Babylon Constants.TEXTUREFORMAT_RGBA */
6
+ RGBA = 5,
7
+ /** Babylon Constants.TEXTUREFORMAT_R */
8
+ R = 6,
9
+ /** Babylon Constants.TEXTUREFORMAT_RG */
10
+ RG = 7
11
+ }
12
+ /**
13
+ * The type of a texture - corresponds to the Babylon.js TextureType constants
14
+ */
15
+ export declare enum TextureType {
16
+ /** Babylon Constants.TEXTURETYPE_UNSIGNED_BYTE */
17
+ UNSIGNED_BYTE = 0,
18
+ /** Babylon Constants.TEXTURETYPE_FLOAT */
19
+ FLOAT = 1,
20
+ /** Babylon Constants.TEXTURETYPE_HALF_FLOAT */
21
+ HALF_FLOAT = 2
22
+ }
23
+ /**
24
+ * Describes the requirements for the output texture of a shader block.
25
+ */
26
+ export type OutputTextureOptions = {
27
+ /**
28
+ * The texture size ratio (output size of this block / size of the Smart Filter output)
29
+ */
30
+ ratio: number;
31
+ /**
32
+ * The format of the texture
33
+ */
34
+ format: TextureFormat;
35
+ /**
36
+ * The type of the texture
37
+ */
38
+ type: TextureType;
39
+ };
40
+ /**
41
+ * Compares two OutputTextureOptions to see if they match.
42
+ * @param a - The first OutputTextureOptions
43
+ * @param b - The second OutputTextureOptions
44
+ * @returns True if the two options match, false otherwise
45
+ */
46
+ export declare function TextureOptionsMatch(a: OutputTextureOptions | undefined, b: OutputTextureOptions | undefined): boolean;
47
+ //# sourceMappingURL=textureOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textureOptions.d.ts","sourceRoot":"","sources":["../../src/blockFoundation/textureOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa;IACrB,2CAA2C;IAC3C,IAAI,IAAI;IACR,wCAAwC;IACxC,CAAC,IAAI;IACL,yCAAyC;IACzC,EAAE,IAAI;CACT;AAED;;GAEG;AACH,oBAAY,WAAW;IACnB,kDAAkD;IAClD,aAAa,IAAI;IACjB,0CAA0C;IAC1C,KAAK,IAAI;IACT,+CAA+C;IAC/C,UAAU,IAAI;CACjB;AAGD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,oBAAoB,GAAG,SAAS,EAAE,CAAC,EAAE,oBAAoB,GAAG,SAAS,GAAG,OAAO,CAKrH"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The format of a texture - corresponds to the Babylon.js TextureFormat constants
3
+ */
4
+ export var TextureFormat;
5
+ (function (TextureFormat) {
6
+ /** Babylon Constants.TEXTUREFORMAT_RGBA */
7
+ TextureFormat[TextureFormat["RGBA"] = 5] = "RGBA";
8
+ /** Babylon Constants.TEXTUREFORMAT_R */
9
+ TextureFormat[TextureFormat["R"] = 6] = "R";
10
+ /** Babylon Constants.TEXTUREFORMAT_RG */
11
+ TextureFormat[TextureFormat["RG"] = 7] = "RG";
12
+ })(TextureFormat || (TextureFormat = {}));
13
+ /**
14
+ * The type of a texture - corresponds to the Babylon.js TextureType constants
15
+ */
16
+ export var TextureType;
17
+ (function (TextureType) {
18
+ /** Babylon Constants.TEXTURETYPE_UNSIGNED_BYTE */
19
+ TextureType[TextureType["UNSIGNED_BYTE"] = 0] = "UNSIGNED_BYTE";
20
+ /** Babylon Constants.TEXTURETYPE_FLOAT */
21
+ TextureType[TextureType["FLOAT"] = 1] = "FLOAT";
22
+ /** Babylon Constants.TEXTURETYPE_HALF_FLOAT */
23
+ TextureType[TextureType["HALF_FLOAT"] = 2] = "HALF_FLOAT";
24
+ })(TextureType || (TextureType = {}));
25
+ /**
26
+ * Compares two OutputTextureOptions to see if they match.
27
+ * @param a - The first OutputTextureOptions
28
+ * @param b - The second OutputTextureOptions
29
+ * @returns True if the two options match, false otherwise
30
+ */
31
+ export function TextureOptionsMatch(a, b) {
32
+ if (a === undefined || b === undefined) {
33
+ return false;
34
+ }
35
+ return a.ratio === b.ratio && a.format === b.format && a.type === b.type;
36
+ }
37
+ //# sourceMappingURL=textureOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textureOptions.js","sourceRoot":"","sources":["../../src/blockFoundation/textureOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACrB,2CAA2C;IAC3C,iDAAQ,CAAA;IACR,wCAAwC;IACxC,2CAAK,CAAA;IACL,yCAAyC;IACzC,6CAAM,CAAA;AACV,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB,kDAAkD;IAClD,+DAAiB,CAAA;IACjB,0CAA0C;IAC1C,+CAAS,CAAA;IACT,+CAA+C;IAC/C,yDAAc,CAAA;AAClB,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB;AAuBD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAmC,EAAE,CAAmC;IACxG,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Represents the owner of a command.
3
+ */
4
+ export interface ICommandOwner {
5
+ /**
6
+ * The friendly name of the owner.
7
+ */
8
+ readonly name: string;
9
+ /**
10
+ * The blockType of the owner;
11
+ */
12
+ readonly blockType: string;
13
+ }
14
+ /**
15
+ * Represents a the action of a @see Command. This is what will be executed during a command buffer execution.
16
+ */
17
+ export type CommandAction = () => void;
18
+ /**
19
+ * Represents a command to execute.
20
+ *
21
+ * A command contains a function that will be executed at runtime by the smart filter.
22
+ *
23
+ * It also contains the owner of the command for debugging purposes.
24
+ */
25
+ export type Command = {
26
+ /**
27
+ * The friendly name of the command.
28
+ */
29
+ readonly name: string;
30
+ /**
31
+ * The owner of the command.
32
+ * In practice, it will mostly be a block, the smart filter or a tool injecting commands.
33
+ */
34
+ readonly owner: ICommandOwner;
35
+ /**
36
+ * Defines the action to execute.
37
+ */
38
+ readonly action: CommandAction;
39
+ };
40
+ /**
41
+ * Creates a new command.
42
+ * @param name - The friendly name of the command
43
+ * @param owner - The owner of the command
44
+ * @param action - The action to execute when the command is executed
45
+ * @returns The new command
46
+ */
47
+ export declare function CreateCommand(name: string, owner: ICommandOwner, action: CommandAction): Command;
48
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command/command.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG;IAClB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAMhG"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Creates a new command.
3
+ * @param name - The friendly name of the command
4
+ * @param owner - The owner of the command
5
+ * @param action - The action to execute when the command is executed
6
+ * @returns The new command
7
+ */
8
+ export function CreateCommand(name, owner, action) {
9
+ return {
10
+ name,
11
+ owner,
12
+ action,
13
+ };
14
+ }
15
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/command/command.ts"],"names":[],"mappings":"AA6CA;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAAoB,EAAE,MAAqB;IACnF,OAAO;QACH,IAAI;QACJ,KAAK;QACL,MAAM;KACT,CAAC;AACN,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { Command } from "./command.js";
2
+ /**
3
+ * Represents the action to run when calling `visitCommands` on a @see CommandBuffer.
4
+ */
5
+ export type CommandsVisitor = (command: Command) => void;
6
+ /**
7
+ * A command buffer is a list of commands to execute.
8
+ * This is used to store the list of tasks the current smart filter needs to execute.
9
+ */
10
+ export declare class CommandBuffer {
11
+ private readonly _commands;
12
+ /**
13
+ * Creates a new command buffer.
14
+ * @param args - the list of commands to add to the command buffer
15
+ */
16
+ constructor(...args: Command[]);
17
+ /**
18
+ * Adds a command to the command buffer.
19
+ * @param command - the command to add
20
+ */
21
+ push(command: Command): void;
22
+ /**
23
+ * Clears the command buffer and empty the list of commands.
24
+ */
25
+ clear(): void;
26
+ /**
27
+ * Visits all the commands in the command buffer.
28
+ * @param commandVisitor - The action to execute on each command
29
+ */
30
+ visitCommands(commandVisitor: CommandsVisitor): void;
31
+ /**
32
+ * Execute all the commands in the command buffer.
33
+ */
34
+ execute(): void;
35
+ /**
36
+ * Dispose the resources associated to the command buffer.
37
+ */
38
+ dispose(): void;
39
+ }
40
+ //# sourceMappingURL=commandBuffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandBuffer.d.ts","sourceRoot":"","sources":["../../src/command/commandBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAUzD;;;GAGG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAE3C;;;OAGG;gBACS,GAAG,IAAI,EAAE,OAAO,EAAE;IAM9B;;;OAGG;IACI,IAAI,CAAC,OAAO,EAAE,OAAO;IAI5B;;OAEG;IACI,KAAK;IAIZ;;;OAGG;IACI,aAAa,CAAC,cAAc,EAAE,eAAe,GAAG,IAAI;IAM3D;;OAEG;IACI,OAAO;IAId;;OAEG;IACI,OAAO;CAGjB"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @see CommandsVisitor used to execute the commands of a @see CommandBuffer.
3
+ * @param command - The command to execute.
4
+ */
5
+ function ExecuteCommandsVisitor(command) {
6
+ command.action();
7
+ }
8
+ /**
9
+ * A command buffer is a list of commands to execute.
10
+ * This is used to store the list of tasks the current smart filter needs to execute.
11
+ */
12
+ export class CommandBuffer {
13
+ /**
14
+ * Creates a new command buffer.
15
+ * @param args - the list of commands to add to the command buffer
16
+ */
17
+ constructor(...args) {
18
+ this._commands = [];
19
+ for (const command of args) {
20
+ this.push(command);
21
+ }
22
+ }
23
+ /**
24
+ * Adds a command to the command buffer.
25
+ * @param command - the command to add
26
+ */
27
+ push(command) {
28
+ this._commands.push(command);
29
+ }
30
+ /**
31
+ * Clears the command buffer and empty the list of commands.
32
+ */
33
+ clear() {
34
+ this._commands.length = 0;
35
+ }
36
+ /**
37
+ * Visits all the commands in the command buffer.
38
+ * @param commandVisitor - The action to execute on each command
39
+ */
40
+ visitCommands(commandVisitor) {
41
+ for (const command of this._commands) {
42
+ commandVisitor(command);
43
+ }
44
+ }
45
+ /**
46
+ * Execute all the commands in the command buffer.
47
+ */
48
+ execute() {
49
+ this.visitCommands(ExecuteCommandsVisitor);
50
+ }
51
+ /**
52
+ * Dispose the resources associated to the command buffer.
53
+ */
54
+ dispose() {
55
+ this.clear();
56
+ }
57
+ }
58
+ //# sourceMappingURL=commandBuffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandBuffer.js","sourceRoot":"","sources":["../../src/command/commandBuffer.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,SAAS,sBAAsB,CAAC,OAAgB;IAC5C,OAAO,CAAC,MAAM,EAAE,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,aAAa;IAGtB;;;OAGG;IACH,YAAY,GAAG,IAAe;QANb,cAAS,GAAc,EAAE,CAAC;QAOvC,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,IAAI,CAAC,OAAgB;QACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK;QACR,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,cAA+B;QAChD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ"}
@@ -0,0 +1,7 @@
1
+ import type { CommandBuffer } from "./commandBuffer.js";
2
+ /**
3
+ * Logs all the commands associated to a command buffer.
4
+ * @param commandBuffer - The command buffer to log
5
+ */
6
+ export declare function LogCommands(commandBuffer: Readonly<CommandBuffer>): void;
7
+ //# sourceMappingURL=commandBufferDebugger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandBufferDebugger.d.ts","sourceRoot":"","sources":["../../src/command/commandBufferDebugger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,QAMjE"}
@@ -0,0 +1,13 @@
1
+ import { Logger } from "@onerjs/core/Misc/logger.js";
2
+ /**
3
+ * Logs all the commands associated to a command buffer.
4
+ * @param commandBuffer - The command buffer to log
5
+ */
6
+ export function LogCommands(commandBuffer) {
7
+ Logger.Log("----- Command buffer commands -----");
8
+ commandBuffer.visitCommands((command) => {
9
+ Logger.Log(` Owner: ${command.owner.blockType} (${command.owner.name}) - Command: ${command.name}`);
10
+ });
11
+ Logger.Log("-----------------------------------");
12
+ }
13
+ //# sourceMappingURL=commandBufferDebugger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandBufferDebugger.js","sourceRoot":"","sources":["../../src/command/commandBufferDebugger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,oCAA4B;AAG7C;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,aAAsC;IAC9D,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAClD,aAAa,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE;QACpC,MAAM,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,gBAAgB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./command.js";
2
+ export { CreateCommand as createCommand } from "./command.js";
3
+ export * from "./commandBuffer.js";
4
+ export { LogCommands } from "./commandBufferDebugger.js";
5
+ export { LogCommands as logCommands } from "./commandBufferDebugger.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from "./command.js";
2
+ // Back compat for when camelCase was used
3
+ export { CreateCommand as createCommand } from "./command.js";
4
+ export * from "./commandBuffer.js";
5
+ export { LogCommands } from "./commandBufferDebugger.js";
6
+ // Back compat for when camelCase was used
7
+ export { LogCommands as logCommands } from "./commandBufferDebugger.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,0CAA0C;AAC1C,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,0CAA0C;AAC1C,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,110 @@
1
+ import type { Nullable } from "@onerjs/core/types.js";
2
+ import { ConnectionPointCompatibilityState } from "./connectionPointCompatibilityState.js";
3
+ import { ConnectionPointDirection } from "./connectionPointDirection.js";
4
+ import type { BaseBlock } from "../blockFoundation/baseBlock.js";
5
+ import type { ConnectionPointType, ConnectionPointValue } from "./connectionPointType.js";
6
+ import type { StrongRef } from "../runtime/strongRef.js";
7
+ /**
8
+ * This represents a strong reference to the data being passed through a connection point.
9
+ */
10
+ export type RuntimeData<U extends ConnectionPointType> = StrongRef<ConnectionPointValue<U>>;
11
+ /**
12
+ * This defines a connection point.
13
+ *
14
+ * A connection point is any input/output of a block.
15
+ * It can be linked to another connection point following some rules:
16
+ * - The type of the connection point must be compatible with the other one.
17
+ * - The direction of the connection point must be different from the other one.
18
+ * - The connection cannot create a cycle in the list of blocks.
19
+ * The relationship is always 1:N for input:output
20
+ */
21
+ export declare class ConnectionPoint<U extends ConnectionPointType = ConnectionPointType> {
22
+ /**
23
+ * The name of the connection point.
24
+ * This is used to identify the connection point inside a block.
25
+ */
26
+ readonly name: string;
27
+ /**
28
+ * The type of the connection point (float, texture, etc.)
29
+ */
30
+ readonly type: U;
31
+ /**
32
+ * The direction of the connection point (input or output)
33
+ */
34
+ readonly direction: ConnectionPointDirection;
35
+ /**
36
+ * The smart filter block the connection point belongs to.
37
+ */
38
+ readonly ownerBlock: BaseBlock;
39
+ /**
40
+ * User provided name for the connection point.
41
+ */
42
+ displayName: Nullable<string>;
43
+ /**
44
+ * The @see RunTimeData used during the init phase to reference the result of the previous block.
45
+ * Those are only used for input connection points.
46
+ * The previous block are "pushing" this in during the init stage.
47
+ */
48
+ runtimeData: Nullable<RuntimeData<U>>;
49
+ /**
50
+ * The default runtimeData used when no connection is made to the connection point.
51
+ */
52
+ readonly defaultRuntimeData: Nullable<RuntimeData<U>>;
53
+ private _connectedTo;
54
+ private _endpoints;
55
+ /**
56
+ * Create a new connection point.
57
+ * @param name - The name the connection point has in the block
58
+ * @param ownerBlock - The block the connection point belongs to
59
+ * @param type - The type of the connection point
60
+ * @param direction - The direction of the connection point
61
+ * @param defaultRuntimeData - The default runtime data to use when no connection is made to the connection point
62
+ */
63
+ constructor(name: string, ownerBlock: BaseBlock, type: U, direction: ConnectionPointDirection, defaultRuntimeData?: Nullable<RuntimeData<U>>);
64
+ /**
65
+ * @returns The connection point this connection point is connected to.
66
+ * (the one on the other side of the connection)
67
+ * Only input connection points have a connected point which they received their value from.
68
+ * (Relation is always 1:N for input:output)
69
+ */
70
+ get connectedTo(): Nullable<ConnectionPoint<U>>;
71
+ /**
72
+ * @returns The connection points this output connection point is connected to.
73
+ * (the ones on the other side of the connection)
74
+ * Only output connection points have a list of endpoints which they provide their value to.
75
+ * (Relation is always 1:N for input:output)
76
+ */
77
+ get endpoints(): ReadonlyArray<ConnectionPoint<U>>;
78
+ /**
79
+ * Gets a state indicating if the current point can be connected to another point
80
+ * @param other - defines the other connection point
81
+ * @returns the compatibility state
82
+ */
83
+ checkCompatibilityState(other: ConnectionPoint<U>): ConnectionPointCompatibilityState;
84
+ /**
85
+ * Checks if the connection point can be connected to another one.
86
+ * @param connectionPoint - The other connection point to check compatibility with
87
+ * @returns true if the connection point can be connected to the other one
88
+ */
89
+ canConnectTo(connectionPoint: ConnectionPoint<U>): boolean;
90
+ /**
91
+ * Connect this connection point to another one.
92
+ * @param other - The other connection point to connect to
93
+ * @throws if the connection point cannot be connected to the other one
94
+ */
95
+ connectTo(other: ConnectionPoint<U>): void;
96
+ /**
97
+ * Disconnects this point from one of his endpoint
98
+ * @param endpoint - defines the other connection point
99
+ */
100
+ disconnectFrom(endpoint: ConnectionPoint<U>): void;
101
+ /**
102
+ * Disconnects this point from all its endpoints.
103
+ */
104
+ disconnectAllEndpoints(): void;
105
+ /**
106
+ * Propagates the current runtime data to all endpoints.
107
+ */
108
+ propagateRuntimeData(): void;
109
+ }
110
+ //# sourceMappingURL=connectionPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectionPoint.d.ts","sourceRoot":"","sources":["../../src/connection/connectionPoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,8BAAsB;AAC9C,OAAO,EAAE,iCAAiC,EAAgC,MAAM,wCAAwC,CAAC;AACzH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,mBAAmB,IAAI,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5F;;;;;;;;;GASG;AACH,qBAAa,eAAe,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB;IAC5E;;;OAGG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,SAAgB,IAAI,EAAE,CAAC,CAAC;IAExB;;OAEG;IACH,SAAgB,SAAS,EAAE,wBAAwB,CAAC;IAEpD;;OAEG;IACH,SAAgB,UAAU,EAAE,SAAS,CAAC;IAEtC;;OAEG;IACI,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAQ;IAE5C;;;;OAIG;IACI,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAQ;IAEpD;;OAEG;IACH,SAAgB,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAQ;IAEpE,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAA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