@awesome-flow/noise 0.7.0 → 0.8.0

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 (77) hide show
  1. package/dist/abstract/index.cjs +8 -3469
  2. package/dist/abstract/index.d.cts +2 -2
  3. package/dist/abstract/index.d.ts +2 -2
  4. package/dist/abstract/index.js +15 -3508
  5. package/dist/chunk-2Y22M2Y4.js +0 -0
  6. package/dist/chunk-4PQ4USYV.cjs +1 -0
  7. package/dist/chunk-5ELMFIRV.js +0 -0
  8. package/dist/chunk-ACWBUUZ7.cjs +1376 -0
  9. package/dist/chunk-BG6U3TYO.js +1376 -0
  10. package/dist/chunk-D5JM4EYQ.cjs +305 -0
  11. package/dist/chunk-DWSACR65.js +305 -0
  12. package/dist/chunk-FFQRP23R.cjs +1 -0
  13. package/dist/chunk-JACBT4MS.cjs +1 -0
  14. package/dist/chunk-KHIIB5TH.js +93 -0
  15. package/dist/chunk-M67JHEU2.cjs +93 -0
  16. package/dist/chunk-N6YNJKLS.cjs +1 -0
  17. package/dist/chunk-PS5VUND5.js +348 -0
  18. package/dist/chunk-Q5FVGKKM.cjs +1 -0
  19. package/dist/chunk-RDQ4BOOV.js +522 -0
  20. package/dist/chunk-RKTZQUWR.cjs +348 -0
  21. package/dist/chunk-RVWCBH7K.js +0 -0
  22. package/dist/chunk-SD3T3LFY.js +0 -0
  23. package/dist/chunk-SGHEOOLW.js +19 -0
  24. package/dist/chunk-TOYKGWYO.js +0 -0
  25. package/dist/chunk-TZCT2GZV.cjs +522 -0
  26. package/dist/chunk-UNMRBZ5X.cjs +19 -0
  27. package/dist/chunk-WOJTKQKO.cjs +1 -0
  28. package/dist/chunk-XZQQ6N3L.js +0 -0
  29. package/dist/modules/index.cjs +4 -42
  30. package/dist/modules/index.js +3 -15
  31. package/dist/nodes/generators/index.cjs +13 -335
  32. package/dist/nodes/generators/index.d.cts +7 -7
  33. package/dist/nodes/generators/index.d.ts +7 -7
  34. package/dist/nodes/generators/index.js +12 -299
  35. package/dist/nodes/groups/index.cjs +4 -111
  36. package/dist/nodes/groups/index.d.cts +2 -2
  37. package/dist/nodes/groups/index.d.ts +2 -2
  38. package/dist/nodes/groups/index.js +2 -88
  39. package/dist/nodes/index.cjs +75 -3425
  40. package/dist/nodes/index.js +37 -3397
  41. package/dist/nodes/modifiers/index.cjs +4 -1459
  42. package/dist/nodes/modifiers/index.d.cts +6 -6
  43. package/dist/nodes/modifiers/index.d.ts +6 -6
  44. package/dist/nodes/modifiers/index.js +11 -1479
  45. package/dist/nodes/output/index.cjs +8 -1335
  46. package/dist/nodes/output/index.d.cts +3 -3
  47. package/dist/nodes/output/index.d.ts +3 -3
  48. package/dist/nodes/output/index.js +10 -1361
  49. package/dist/nodes/selectors/index.cjs +8 -1317
  50. package/dist/nodes/selectors/index.d.cts +1 -1
  51. package/dist/nodes/selectors/index.d.ts +1 -1
  52. package/dist/nodes/selectors/index.js +8 -1343
  53. package/dist/nodes/transformers/index.cjs +8 -331
  54. package/dist/nodes/transformers/index.d.cts +5 -5
  55. package/dist/nodes/transformers/index.d.ts +5 -5
  56. package/dist/nodes/transformers/index.js +6 -311
  57. package/dist/templates/generators/index.cjs +8 -1199
  58. package/dist/templates/generators/index.d.cts +5 -5
  59. package/dist/templates/generators/index.d.ts +5 -5
  60. package/dist/templates/generators/index.js +17 -1226
  61. package/dist/templates/groups/index.cjs +8 -1199
  62. package/dist/templates/groups/index.js +8 -1226
  63. package/dist/templates/index.cjs +77 -1263
  64. package/dist/templates/index.js +43 -1226
  65. package/dist/templates/modifiers/index.cjs +8 -1199
  66. package/dist/templates/modifiers/index.d.cts +9 -9
  67. package/dist/templates/modifiers/index.d.ts +9 -9
  68. package/dist/templates/modifiers/index.js +16 -1226
  69. package/dist/templates/output/index.cjs +8 -1199
  70. package/dist/templates/output/index.d.cts +3 -3
  71. package/dist/templates/output/index.d.ts +3 -3
  72. package/dist/templates/output/index.js +11 -1226
  73. package/dist/templates/selectors/index.cjs +8 -1199
  74. package/dist/templates/selectors/index.js +9 -1226
  75. package/dist/templates/transformers/index.cjs +8 -1199
  76. package/dist/templates/transformers/index.js +12 -1226
  77. package/package.json +30 -20
@@ -1,315 +1,10 @@
1
- // src/nodes/transformers/noise-displace-node.tsx
2
- import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
3
- import { useCallback } from "react";
4
- import { useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
5
- import { Displace } from "libnoise-simplex-ts";
6
- import { HandlesIncomingDataStatus } from "@awesome-flow/core/components";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- function NoiseDisplaceNode({ id, selected, data, type }) {
9
- const updateComputedData = useUpdateNodeComputedData();
10
- const onDataUpdated = useCallback(
11
- (handleData) => {
12
- const sourceModule = handleData["source" /* sourceModule */];
13
- const xModule = handleData["x-module" /* xModule */];
14
- const yModule = handleData["y-module" /* yModule */];
15
- const zModule = handleData["z-module" /* zModule */];
16
- if (sourceModule && xModule && yModule && zModule) {
17
- const module = new Displace(
18
- sourceModule[0].module,
19
- xModule[0].module,
20
- yModule[0].module,
21
- zModule[0].module
22
- );
23
- updateComputedData(id, { module });
24
- }
25
- },
26
- []
27
- );
28
- return /* @__PURE__ */ jsxs(NodeContainer, { id, selected, data, type, children: [
29
- /* @__PURE__ */ jsx(
30
- HandlesIncomingDataStatus,
31
- {
32
- nodeId: id,
33
- handles: data.handles,
34
- handleKey: "dataId",
35
- onDataUpdated,
36
- type: "target",
37
- resetComputedData: true
38
- }
39
- ),
40
- /* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
41
- ] });
42
- }
43
- var noise_displace_node_default = NoiseDisplaceNode;
44
-
45
- // src/nodes/transformers/noise-rotate-point-node.tsx
46
- import { NodeContainer as NodeContainer2, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
47
- import { useEffect, useState } from "react";
48
1
  import {
49
- useIncomingComputedData,
50
- useUpdateNodeComputedData as useUpdateNodeComputedData2,
51
- useUpdateNodeData
52
- } from "@awesome-flow/core/hooks";
53
- import { Group, NumberInput, Stack } from "@mantine/core";
54
- import { RotatePoint } from "libnoise-simplex-ts";
55
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
56
- function NoiseRotatePointNode({
57
- id,
58
- selected,
59
- data,
60
- type
61
- }) {
62
- const [xAngle, setXAngle] = useState(data.xAngle);
63
- const [yAngle, setYAngle] = useState(data.yAngle);
64
- const [zAngle, setZAngle] = useState(data.zAngle);
65
- const incoming = useIncomingComputedData(id);
66
- const updateNodeData = useUpdateNodeData();
67
- const updateComputedData = useUpdateNodeComputedData2();
68
- useEffect(() => {
69
- if (incoming?.length) {
70
- const module = new RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
71
- updateComputedData(id, { module });
72
- }
73
- updateNodeData(id, { xAngle, yAngle, zAngle });
74
- }, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
75
- return /* @__PURE__ */ jsxs2(NodeContainer2, { id, selected, data, type, children: [
76
- /* @__PURE__ */ jsxs2(Stack, { children: [
77
- /* @__PURE__ */ jsxs2(Group, { children: [
78
- "X Angle:",
79
- /* @__PURE__ */ jsx2(
80
- NumberInput,
81
- {
82
- size: "xs",
83
- w: 100,
84
- value: xAngle,
85
- onChange: (e) => setXAngle(Number(e)),
86
- step: 0.01
87
- }
88
- )
89
- ] }),
90
- /* @__PURE__ */ jsxs2(Group, { children: [
91
- "Y Angle:",
92
- /* @__PURE__ */ jsx2(
93
- NumberInput,
94
- {
95
- size: "xs",
96
- w: 100,
97
- value: yAngle,
98
- onChange: (e) => setYAngle(Number(e)),
99
- step: 0.01
100
- }
101
- )
102
- ] }),
103
- /* @__PURE__ */ jsxs2(Group, { children: [
104
- "Z Angle:",
105
- /* @__PURE__ */ jsx2(
106
- NumberInput,
107
- {
108
- size: "xs",
109
- w: 100,
110
- value: zAngle,
111
- onChange: (e) => setZAngle(Number(e)),
112
- step: 0.01
113
- }
114
- )
115
- ] })
116
- ] }),
117
- /* @__PURE__ */ jsx2(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
118
- ] });
119
- }
120
- var noise_rotate_point_node_default = NoiseRotatePointNode;
121
-
122
- // src/nodes/transformers/noise-scale-point-node.tsx
123
- import { NodeContainer as NodeContainer3, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
124
- import { useEffect as useEffect2, useState as useState2 } from "react";
125
- import {
126
- useIncomingComputedData as useIncomingComputedData2,
127
- useUpdateNodeComputedData as useUpdateNodeComputedData3,
128
- useUpdateNodeData as useUpdateNodeData2
129
- } from "@awesome-flow/core/hooks";
130
- import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
131
- import { ScalePoint } from "libnoise-simplex-ts";
132
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
133
- function NoiseScalePointNode({
134
- id,
135
- selected,
136
- data,
137
- type
138
- }) {
139
- const [xScale, setXScale] = useState2(data.xScale);
140
- const [yScale, setYScale] = useState2(data.yScale);
141
- const [zScale, setZScale] = useState2(data.zScale);
142
- const incoming = useIncomingComputedData2(id);
143
- const updateNodeData = useUpdateNodeData2();
144
- const updateComputedData = useUpdateNodeComputedData3();
145
- useEffect2(() => {
146
- if (incoming?.length) {
147
- const module = new ScalePoint(incoming[0].module, xScale, yScale, zScale);
148
- updateComputedData(id, { module });
149
- }
150
- updateNodeData(id, { xScale, yScale, zScale });
151
- }, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
152
- return /* @__PURE__ */ jsxs3(NodeContainer3, { id, selected, data, type, children: [
153
- /* @__PURE__ */ jsxs3(Stack2, { children: [
154
- /* @__PURE__ */ jsxs3(Group2, { children: [
155
- "X Scale:",
156
- /* @__PURE__ */ jsx3(
157
- NumberInput2,
158
- {
159
- size: "xs",
160
- w: 100,
161
- value: xScale,
162
- onChange: (e) => setXScale(Number(e)),
163
- step: 0.01
164
- }
165
- )
166
- ] }),
167
- /* @__PURE__ */ jsxs3(Group2, { children: [
168
- "Y Scale:",
169
- /* @__PURE__ */ jsx3(
170
- NumberInput2,
171
- {
172
- size: "xs",
173
- w: 100,
174
- value: yScale,
175
- onChange: (e) => setYScale(Number(e)),
176
- step: 0.01
177
- }
178
- )
179
- ] }),
180
- /* @__PURE__ */ jsxs3(Group2, { children: [
181
- "Z Scale:",
182
- /* @__PURE__ */ jsx3(
183
- NumberInput2,
184
- {
185
- size: "xs",
186
- w: 100,
187
- value: zScale,
188
- onChange: (e) => setZScale(Number(e)),
189
- step: 0.01
190
- }
191
- )
192
- ] })
193
- ] }),
194
- /* @__PURE__ */ jsx3(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
195
- ] });
196
- }
197
- var noise_scale_point_node_default = NoiseScalePointNode;
198
-
199
- // src/nodes/transformers/noise-translate-point-node.tsx
200
- import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
201
- import { useEffect as useEffect3, useState as useState3 } from "react";
202
- import {
203
- useIncomingComputedData as useIncomingComputedData3,
204
- useUpdateNodeComputedData as useUpdateNodeComputedData4,
205
- useUpdateNodeData as useUpdateNodeData3
206
- } from "@awesome-flow/core/hooks";
207
- import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
208
- import { TranslatePoint } from "libnoise-simplex-ts";
209
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
210
- function NoiseTranslatePointNode({
211
- id,
212
- selected,
213
- data,
214
- type
215
- }) {
216
- const [translateX, setTranslateX] = useState3(data.translateX);
217
- const [translateY, setTranslateY] = useState3(data.translateY);
218
- const [translateZ, setTranslateZ] = useState3(data.translateZ);
219
- const incoming = useIncomingComputedData3(id);
220
- const updateNodeData = useUpdateNodeData3();
221
- const updateComputedData = useUpdateNodeComputedData4();
222
- useEffect3(() => {
223
- if (incoming?.length) {
224
- const module = new TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
225
- updateComputedData(id, { module });
226
- }
227
- updateNodeData(id, { translateX, translateY, translateZ });
228
- }, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
229
- return /* @__PURE__ */ jsxs4(NodeContainer4, { id, selected, data, type, children: [
230
- /* @__PURE__ */ jsxs4(Stack3, { children: [
231
- /* @__PURE__ */ jsxs4(Group3, { children: [
232
- "Translate X:",
233
- /* @__PURE__ */ jsx4(
234
- NumberInput3,
235
- {
236
- size: "xs",
237
- w: 100,
238
- value: translateX,
239
- onChange: (e) => setTranslateX(Number(e)),
240
- step: 1
241
- }
242
- )
243
- ] }),
244
- /* @__PURE__ */ jsxs4(Group3, { children: [
245
- "Translate Y:",
246
- /* @__PURE__ */ jsx4(
247
- NumberInput3,
248
- {
249
- size: "xs",
250
- w: 100,
251
- value: translateY,
252
- onChange: (e) => setTranslateY(Number(e)),
253
- step: 1
254
- }
255
- )
256
- ] }),
257
- /* @__PURE__ */ jsxs4(Group3, { children: [
258
- "Translate Z:",
259
- /* @__PURE__ */ jsx4(
260
- NumberInput3,
261
- {
262
- size: "xs",
263
- w: 100,
264
- value: translateZ,
265
- onChange: (e) => setTranslateZ(Number(e)),
266
- step: 1
267
- }
268
- )
269
- ] })
270
- ] }),
271
- /* @__PURE__ */ jsx4(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
272
- ] });
273
- }
274
- var noise_translate_point_node_default = NoiseTranslatePointNode;
275
-
276
- // src/nodes/transformers/noise-turbulence-node .tsx
277
- import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
278
- import { useCallback as useCallback2, useEffect as useEffect4, useState as useState4 } from "react";
279
- import { useIncomingComputedData as useIncomingComputedData4, useUpdateNodeComputedData as useUpdateNodeComputedData5 } from "@awesome-flow/core/hooks";
280
- import { Turbulence } from "libnoise-simplex-ts";
281
- import { NodePropertyVariables } from "@awesome-flow/core/components";
282
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
283
- function NoiseTurbulenceNode({
284
- id,
285
- selected,
286
- data,
287
- type
288
- }) {
289
- const [properties, setProperties] = useState4(null);
290
- const incoming = useIncomingComputedData4(id);
291
- const updateComputedData = useUpdateNodeComputedData5();
292
- const onPropertiesChange = useCallback2((props) => {
293
- setProperties(props);
294
- }, []);
295
- useEffect4(() => {
296
- if (incoming?.length && properties) {
297
- const module = new Turbulence(
298
- incoming[0].module,
299
- properties.frequency.value,
300
- properties.power.value,
301
- properties.roughness.value,
302
- properties.seed.value
303
- );
304
- updateComputedData(id, { module });
305
- }
306
- }, [id, incoming, properties]);
307
- return /* @__PURE__ */ jsxs5(NodeContainer5, { id, selected, data, type, children: [
308
- /* @__PURE__ */ jsx5(NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
309
- /* @__PURE__ */ jsx5(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
310
- ] });
311
- }
312
- var noise_turbulence_node_default = NoiseTurbulenceNode;
2
+ noise_displace_node_default,
3
+ noise_rotate_point_node_default,
4
+ noise_scale_point_node_default,
5
+ noise_translate_point_node_default,
6
+ noise_turbulence_node_default
7
+ } from "../../chunk-PS5VUND5.js";
313
8
  export {
314
9
  noise_displace_node_default as NoiseDisplaceNode,
315
10
  noise_rotate_point_node_default as NoiseRotatePointNode,