@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
@@ -0,0 +1,522 @@
1
+ import {
2
+ NormalizeNoiseModule
3
+ } from "./chunk-SGHEOOLW.js";
4
+
5
+ // src/nodes/modifiers/noise-abs-node.tsx
6
+ import { useIncomingComputedData, useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
7
+ import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
8
+ import { Abs } from "libnoise-simplex-ts";
9
+ import { useEffect } from "react";
10
+ import { jsx } from "react/jsx-runtime";
11
+ function NoiseAbsNode({ id, selected, data, type }) {
12
+ const incoming = useIncomingComputedData(id);
13
+ const updateComputedData = useUpdateNodeComputedData();
14
+ useEffect(() => {
15
+ if (incoming?.length > 0) {
16
+ const module = new Abs(incoming[0].module);
17
+ updateComputedData(id, { module });
18
+ }
19
+ }, [incoming]);
20
+ return /* @__PURE__ */ jsx(NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" }) });
21
+ }
22
+ var noise_abs_node_default = NoiseAbsNode;
23
+
24
+ // src/nodes/modifiers/noise-clamp-node.tsx
25
+ import {
26
+ useIncomingComputedData as useIncomingComputedData2,
27
+ useUpdateNodeComputedData as useUpdateNodeComputedData2,
28
+ useUpdateNodeData
29
+ } from "@awesome-flow/core/hooks";
30
+ import { NodeContainer as NodeContainer2, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
31
+ import { Group, NumberInput, Stack } from "@mantine/core";
32
+ import { Clamp } from "libnoise-simplex-ts";
33
+ import { useEffect as useEffect2, useState } from "react";
34
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
35
+ function NoiseClampNode({ id, selected, data, type }) {
36
+ const [lowerBound, setLowerBound] = useState(data.lowerBound);
37
+ const [upperBound, setUpperBound] = useState(data.upperBound);
38
+ const incoming = useIncomingComputedData2(id);
39
+ const updateNodeData = useUpdateNodeData();
40
+ const updateComputedData = useUpdateNodeComputedData2();
41
+ useEffect2(() => {
42
+ if (incoming?.length) {
43
+ const module = new Clamp(incoming[0].module, lowerBound, upperBound);
44
+ updateComputedData(id, { module });
45
+ }
46
+ updateNodeData(id, { lowerBound, upperBound });
47
+ }, [incoming, lowerBound, upperBound]);
48
+ return /* @__PURE__ */ jsxs(NodeContainer2, { id, selected, data, type, children: [
49
+ /* @__PURE__ */ jsx2(Stack, { children: /* @__PURE__ */ jsxs(Group, { children: [
50
+ /* @__PURE__ */ jsx2(
51
+ NumberInput,
52
+ {
53
+ size: "xs",
54
+ w: 100,
55
+ value: lowerBound,
56
+ onChange: (e) => setLowerBound(Number(e)),
57
+ step: 0.1
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx2(
61
+ NumberInput,
62
+ {
63
+ size: "xs",
64
+ w: 100,
65
+ value: upperBound,
66
+ onChange: (e) => setUpperBound(Number(e)),
67
+ step: 0.1
68
+ }
69
+ )
70
+ ] }) }),
71
+ /* @__PURE__ */ jsx2(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
72
+ ] });
73
+ }
74
+ var noise_clamp_node_default = NoiseClampNode;
75
+
76
+ // src/nodes/modifiers/noise-combine-node.tsx
77
+ import {
78
+ useIncomingComputedData as useIncomingComputedData3,
79
+ useUpdateNodeComputedData as useUpdateNodeComputedData3,
80
+ useUpdateNodeData as useUpdateNodeData2
81
+ } from "@awesome-flow/core/hooks";
82
+ import { NodeCombobox, NodeContainer as NodeContainer3, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
83
+ import {
84
+ IconAsterisk,
85
+ IconChevronLeft,
86
+ IconChevronRight,
87
+ IconChevronUp,
88
+ IconPlus
89
+ } from "@tabler/icons-react";
90
+ import { useCallback, useEffect as useEffect3 } from "react";
91
+
92
+ // src/abstract/operations.ts
93
+ import { Add, Max, Min, Multiply, Power } from "libnoise-simplex-ts";
94
+ var NoiseCombineType = /* @__PURE__ */ ((NoiseCombineType3) => {
95
+ NoiseCombineType3["add"] = "add";
96
+ NoiseCombineType3["max"] = "max";
97
+ NoiseCombineType3["min"] = "min";
98
+ NoiseCombineType3["multiply"] = "multiply";
99
+ NoiseCombineType3["power"] = "power";
100
+ return NoiseCombineType3;
101
+ })(NoiseCombineType || {});
102
+ var noiseCombineModuleMap = {
103
+ ["add" /* add */]: Add,
104
+ ["max" /* max */]: Max,
105
+ ["min" /* min */]: Min,
106
+ ["multiply" /* multiply */]: Multiply,
107
+ ["power" /* power */]: Power
108
+ };
109
+
110
+ // src/nodes/modifiers/noise-combine-node.tsx
111
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
112
+ var options = {
113
+ add: /* @__PURE__ */ jsx3(IconPlus, {}),
114
+ min: /* @__PURE__ */ jsx3(IconChevronLeft, {}),
115
+ max: /* @__PURE__ */ jsx3(IconChevronRight, {}),
116
+ multiply: /* @__PURE__ */ jsx3(IconAsterisk, {}),
117
+ power: /* @__PURE__ */ jsx3(IconChevronUp, {})
118
+ };
119
+ function NoiseCombineNode({ id, selected, data, type }) {
120
+ const updateNodeData = useUpdateNodeData2();
121
+ const updateComputedData = useUpdateNodeComputedData3();
122
+ const incoming = useIncomingComputedData3(id);
123
+ useEffect3(() => {
124
+ const ModuleFactory = noiseCombineModuleMap[data.operation];
125
+ if (incoming?.length > 1) {
126
+ const module = new ModuleFactory(incoming[0].module, incoming[1].module);
127
+ updateComputedData(id, { module });
128
+ }
129
+ }, [data.operation, incoming]);
130
+ const onChange = useCallback((operation) => {
131
+ updateNodeData(id, { operation });
132
+ }, []);
133
+ return /* @__PURE__ */ jsxs2(NodeContainer3, { id, selected, data, type, children: [
134
+ /* @__PURE__ */ jsx3(NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
135
+ /* @__PURE__ */ jsx3(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
136
+ ] });
137
+ }
138
+ var noise_combine_node_default = NoiseCombineNode;
139
+
140
+ // src/nodes/modifiers/noise-curve-node.tsx
141
+ import { NodeState } from "@awesome-flow/core/abstract";
142
+ import {
143
+ useIncomingComputedData as useIncomingComputedData4,
144
+ useUpdateNodeComputedData as useUpdateNodeComputedData4,
145
+ useUpdateNodeData as useUpdateNodeData3
146
+ } from "@awesome-flow/core/hooks";
147
+ import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
148
+ import { ActionIcon, Button, Group as Group2, NumberInput as NumberInput2, Space } from "@mantine/core";
149
+ import { FORM_INDEX, useForm } from "@mantine/form";
150
+ import { randomId } from "@mantine/hooks";
151
+ import { IconX } from "@tabler/icons-react";
152
+ import { Curve, Tuple } from "libnoise-simplex-ts";
153
+ import { useCallback as useCallback2, useEffect as useEffect4, useState as useState2 } from "react";
154
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
155
+ function NoiseCurveNode({ id, selected, data, type }) {
156
+ const incoming = useIncomingComputedData4(id);
157
+ const updateNodeData = useUpdateNodeData3();
158
+ const updateComputedData = useUpdateNodeComputedData4();
159
+ const [values, setValues] = useState2([]);
160
+ const form = useForm({
161
+ mode: "uncontrolled",
162
+ initialValues: {
163
+ points: []
164
+ },
165
+ validateInputOnChange: [`points.${FORM_INDEX}.input`],
166
+ clearInputErrorOnChange: true,
167
+ validate: {
168
+ points: {
169
+ input: (value, values2) => {
170
+ const counts = {};
171
+ values2.points.forEach((x) => {
172
+ counts[x.input] = (counts[x.input] || 0) + 1;
173
+ });
174
+ return counts[value] > 1;
175
+ }
176
+ }
177
+ },
178
+ onValuesChange: useCallback2((values2) => {
179
+ form.validate();
180
+ if (form.isValid()) {
181
+ const points = values2.points.map((v) => ({ input: v.input, output: v.output }));
182
+ setValues(points);
183
+ updateNodeData(id, { points });
184
+ }
185
+ }, [])
186
+ });
187
+ useEffect4(() => {
188
+ const points = data.points?.length ? data.points.map((v) => ({ input: v.input, output: v.output, key: randomId() })) : [1, 2, 3, 4].map(() => ({ input: 0, output: 0, key: randomId() }));
189
+ form.initialize({ points });
190
+ }, []);
191
+ useEffect4(() => {
192
+ if (incoming?.length && values?.length >= 4) {
193
+ const module = new Curve(
194
+ incoming[0].module,
195
+ values.map((p) => new Tuple(p.input, p.output))
196
+ );
197
+ updateComputedData(id, { module });
198
+ }
199
+ }, [values, incoming]);
200
+ const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs3(Group2, { mt: "xs", children: [
201
+ /* @__PURE__ */ jsx4(
202
+ NumberInput2,
203
+ {
204
+ size: "xs",
205
+ w: 100,
206
+ placeholder: "Input Value",
207
+ ...form.getInputProps(`points.${index}.input`),
208
+ step: 0.1
209
+ },
210
+ form.key(`points.${index}.input`)
211
+ ),
212
+ /* @__PURE__ */ jsx4(
213
+ NumberInput2,
214
+ {
215
+ size: "xs",
216
+ w: 100,
217
+ placeholder: "Output Value",
218
+ ...form.getInputProps(`points.${index}.output`),
219
+ step: 0.1
220
+ },
221
+ form.key(`points.${index}.output`)
222
+ ),
223
+ data.state === NodeState.edit && values.length > 4 && /* @__PURE__ */ jsx4(
224
+ ActionIcon,
225
+ {
226
+ color: "red",
227
+ variant: "outline",
228
+ size: "sm",
229
+ onClick: () => form.removeListItem("points", index),
230
+ children: /* @__PURE__ */ jsx4(IconX, { size: "1rem" })
231
+ }
232
+ )
233
+ ] }, item.key));
234
+ return /* @__PURE__ */ jsxs3(NodeContainer4, { id, selected, type, data, children: [
235
+ fields,
236
+ data.state === NodeState.edit && /* @__PURE__ */ jsxs3(Fragment, { children: [
237
+ /* @__PURE__ */ jsx4(Space, { h: 10 }),
238
+ /* @__PURE__ */ jsx4(
239
+ Button,
240
+ {
241
+ variant: "outline",
242
+ size: "xs",
243
+ fullWidth: true,
244
+ onClick: () => form.insertListItem("points", { input: 0, output: 0, key: randomId() }),
245
+ children: "Add control point"
246
+ }
247
+ )
248
+ ] }),
249
+ /* @__PURE__ */ jsx4(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
250
+ ] });
251
+ }
252
+ var noise_curve_node_default = NoiseCurveNode;
253
+
254
+ // src/nodes/modifiers/noise-exponent-node.tsx
255
+ import {
256
+ useIncomingComputedData as useIncomingComputedData5,
257
+ useUpdateNodeComputedData as useUpdateNodeComputedData5,
258
+ useUpdateNodeData as useUpdateNodeData4
259
+ } from "@awesome-flow/core/hooks";
260
+ import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
261
+ import { Group as Group3, NumberInput as NumberInput3, Stack as Stack2 } from "@mantine/core";
262
+ import { Exponent } from "libnoise-simplex-ts";
263
+ import { useEffect as useEffect5, useState as useState3 } from "react";
264
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
265
+ function NoiseExponentNode({ id, selected, data, type }) {
266
+ const [exponent, setExponent] = useState3(data.exponent);
267
+ const incoming = useIncomingComputedData5(id);
268
+ const updateNodeData = useUpdateNodeData4();
269
+ const updateComputedData = useUpdateNodeComputedData5();
270
+ useEffect5(() => {
271
+ if (incoming?.length > 0) {
272
+ const module = new Exponent(incoming[0].module, exponent);
273
+ updateComputedData(id, { module });
274
+ }
275
+ updateNodeData(id, { exponent });
276
+ }, [incoming, exponent]);
277
+ return /* @__PURE__ */ jsxs4(NodeContainer5, { id, selected, data, type, children: [
278
+ /* @__PURE__ */ jsx5(Stack2, { children: /* @__PURE__ */ jsxs4(Group3, { children: [
279
+ "Exponent:",
280
+ /* @__PURE__ */ jsx5(
281
+ NumberInput3,
282
+ {
283
+ size: "xs",
284
+ value: exponent,
285
+ onChange: (e) => setExponent(Number(e)),
286
+ step: 0.1
287
+ }
288
+ )
289
+ ] }) }),
290
+ /* @__PURE__ */ jsx5(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
291
+ ] });
292
+ }
293
+ var noise_exponent_node_default = NoiseExponentNode;
294
+
295
+ // src/nodes/modifiers/noise-invert-node.tsx
296
+ import { useIncomingComputedData as useIncomingComputedData6, useUpdateNodeComputedData as useUpdateNodeComputedData6 } from "@awesome-flow/core/hooks";
297
+ import { NodeContainer as NodeContainer6, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
298
+ import { Invert } from "libnoise-simplex-ts";
299
+ import { useEffect as useEffect6 } from "react";
300
+ import { jsx as jsx6 } from "react/jsx-runtime";
301
+ function NoiseInvertNode({ id, selected, data, type }) {
302
+ const incoming = useIncomingComputedData6(id);
303
+ const updateComputedData = useUpdateNodeComputedData6();
304
+ useEffect6(() => {
305
+ if (incoming?.length > 0) {
306
+ const module = new Invert(incoming[0].module);
307
+ updateComputedData(id, { module });
308
+ }
309
+ }, [incoming]);
310
+ return /* @__PURE__ */ jsx6(NodeContainer6, { id, selected, data, type, children: /* @__PURE__ */ jsx6(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" }) });
311
+ }
312
+ var noise_invert_node_default = NoiseInvertNode;
313
+
314
+ // src/nodes/modifiers/noise-normalize-node.tsx
315
+ import {
316
+ useIncomingComputedData as useIncomingComputedData7,
317
+ useUpdateNodeComputedData as useUpdateNodeComputedData7,
318
+ useUpdateNodeData as useUpdateNodeData5
319
+ } from "@awesome-flow/core/hooks";
320
+ import { NodeContainer as NodeContainer7, NodeTrackConnections as NodeTrackConnections7 } from "@awesome-flow/core/layout";
321
+ import { Group as Group4, NumberInput as NumberInput4, Stack as Stack3 } from "@mantine/core";
322
+ import { useEffect as useEffect7, useState as useState4 } from "react";
323
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
324
+ function NoiseNormalizeNode({ id, selected, data, type }) {
325
+ const [intervalStart, setIntervalStart] = useState4(data.intervalStart);
326
+ const [intervalEnd, setIntervalEnd] = useState4(data.intervalEnd);
327
+ const incoming = useIncomingComputedData7(id);
328
+ const updateNodeData = useUpdateNodeData5();
329
+ const updateComputedData = useUpdateNodeComputedData7();
330
+ useEffect7(() => {
331
+ if (incoming?.length) {
332
+ const source = incoming[0].module;
333
+ const module = new NormalizeNoiseModule(source, intervalStart, intervalEnd);
334
+ updateComputedData(id, { module });
335
+ }
336
+ updateNodeData(id, { intervalStart, intervalEnd });
337
+ }, [incoming, intervalStart, intervalEnd]);
338
+ return /* @__PURE__ */ jsxs5(NodeContainer7, { id, selected, data, type, children: [
339
+ /* @__PURE__ */ jsx7(Stack3, { children: /* @__PURE__ */ jsxs5(Group4, { children: [
340
+ /* @__PURE__ */ jsx7(
341
+ NumberInput4,
342
+ {
343
+ size: "xs",
344
+ w: 100,
345
+ value: intervalStart,
346
+ onChange: (e) => setIntervalStart(Number(e))
347
+ }
348
+ ),
349
+ /* @__PURE__ */ jsx7(
350
+ NumberInput4,
351
+ {
352
+ size: "xs",
353
+ w: 100,
354
+ value: intervalEnd,
355
+ onChange: (e) => setIntervalEnd(Number(e))
356
+ }
357
+ )
358
+ ] }) }),
359
+ /* @__PURE__ */ jsx7(NodeTrackConnections7, { handles: data.handles, nodeId: id, type: "target" })
360
+ ] });
361
+ }
362
+ var noise_normalize_node_default = NoiseNormalizeNode;
363
+
364
+ // src/nodes/modifiers/noise-scale-bias-node.tsx
365
+ import {
366
+ useIncomingComputedData as useIncomingComputedData8,
367
+ useUpdateNodeComputedData as useUpdateNodeComputedData8,
368
+ useUpdateNodeData as useUpdateNodeData6
369
+ } from "@awesome-flow/core/hooks";
370
+ import { NodeContainer as NodeContainer8, NodeTrackConnections as NodeTrackConnections8 } from "@awesome-flow/core/layout";
371
+ import { Group as Group5, NumberInput as NumberInput5, Stack as Stack4 } from "@mantine/core";
372
+ import { ScaleBias } from "libnoise-simplex-ts";
373
+ import { useEffect as useEffect8, useState as useState5 } from "react";
374
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
375
+ function NoiseScaleBiasNode({ id, selected, data, type }) {
376
+ const [scale, setScale] = useState5(data.scale);
377
+ const [bias, setBias] = useState5(data.bias);
378
+ const incoming = useIncomingComputedData8(id);
379
+ const updateNodeData = useUpdateNodeData6();
380
+ const updateComputedData = useUpdateNodeComputedData8();
381
+ useEffect8(() => {
382
+ if (incoming?.length > 0) {
383
+ const module = new ScaleBias(incoming[0].module, scale, bias);
384
+ updateComputedData(id, { module });
385
+ }
386
+ updateNodeData(id, { scale, bias });
387
+ }, [incoming, scale, bias]);
388
+ return /* @__PURE__ */ jsxs6(NodeContainer8, { id, selected, data, type, children: [
389
+ /* @__PURE__ */ jsxs6(Stack4, { children: [
390
+ /* @__PURE__ */ jsxs6(Group5, { children: [
391
+ "Scale:",
392
+ /* @__PURE__ */ jsx8(
393
+ NumberInput5,
394
+ {
395
+ size: "xs",
396
+ w: 100,
397
+ value: scale,
398
+ onChange: (e) => setScale(Number(e)),
399
+ step: 0.1
400
+ }
401
+ )
402
+ ] }),
403
+ /* @__PURE__ */ jsxs6(Group5, { children: [
404
+ "Bias:",
405
+ /* @__PURE__ */ jsx8(
406
+ NumberInput5,
407
+ {
408
+ size: "xs",
409
+ w: 100,
410
+ value: bias,
411
+ onChange: (e) => setBias(Number(e)),
412
+ step: 0.1
413
+ }
414
+ )
415
+ ] })
416
+ ] }),
417
+ /* @__PURE__ */ jsx8(NodeTrackConnections8, { handles: data.handles, nodeId: id, type: "target" })
418
+ ] });
419
+ }
420
+ var noise_scale_bias_node_default = NoiseScaleBiasNode;
421
+
422
+ // src/nodes/modifiers/noise-terrace-node.tsx
423
+ import { NodeState as NodeState2 } from "@awesome-flow/core/abstract";
424
+ import {
425
+ useIncomingComputedData as useIncomingComputedData9,
426
+ useUpdateNodeComputedData as useUpdateNodeComputedData9,
427
+ useUpdateNodeData as useUpdateNodeData7
428
+ } from "@awesome-flow/core/hooks";
429
+ import { NodeContainer as NodeContainer9, NodeTrackConnections as NodeTrackConnections9 } from "@awesome-flow/core/layout";
430
+ import { ActionIcon as ActionIcon2, Button as Button2, Group as Group6, NumberInput as NumberInput6, Space as Space2 } from "@mantine/core";
431
+ import { FORM_INDEX as FORM_INDEX2, useForm as useForm2 } from "@mantine/form";
432
+ import { randomId as randomId2 } from "@mantine/hooks";
433
+ import { IconX as IconX2 } from "@tabler/icons-react";
434
+ import { Terrace } from "libnoise-simplex-ts";
435
+ import { useCallback as useCallback3, useEffect as useEffect9, useState as useState6 } from "react";
436
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
437
+ function NoiseTerraceNode({ id, selected, data, type }) {
438
+ const incoming = useIncomingComputedData9(id);
439
+ const updateNodeData = useUpdateNodeData7();
440
+ const updateComputedData = useUpdateNodeComputedData9();
441
+ const [values, setValues] = useState6([]);
442
+ const form = useForm2({
443
+ mode: "uncontrolled",
444
+ initialValues: {
445
+ points: []
446
+ },
447
+ validateInputOnChange: [`points.${FORM_INDEX2}.input`],
448
+ clearInputErrorOnChange: true,
449
+ onValuesChange: useCallback3((values2) => {
450
+ if (form.isValid()) {
451
+ const points = values2.points.map((v) => v.value);
452
+ setValues(points);
453
+ updateNodeData(id, { points });
454
+ }
455
+ form.validate();
456
+ }, [])
457
+ });
458
+ useEffect9(() => {
459
+ const points = data.points?.length ? data.points.map((v) => ({ value: v, key: randomId2() })) : [1, 2].map(() => ({ value: 0, key: randomId2() }));
460
+ form.initialize({ points });
461
+ }, []);
462
+ useEffect9(() => {
463
+ if (incoming?.length && values?.length >= 2) {
464
+ const module = new Terrace(incoming[0].module, values);
465
+ updateComputedData(id, { module });
466
+ }
467
+ }, [values, incoming]);
468
+ const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs7(Group6, { mt: "xs", children: [
469
+ /* @__PURE__ */ jsx9(
470
+ NumberInput6,
471
+ {
472
+ size: "xs",
473
+ placeholder: "Input Value",
474
+ ...form.getInputProps(`points.${index}.value`),
475
+ step: 0.1
476
+ },
477
+ form.key(`points.${index}.value`)
478
+ ),
479
+ data.state === NodeState2.edit && values.length > 2 && /* @__PURE__ */ jsx9(
480
+ ActionIcon2,
481
+ {
482
+ color: "red",
483
+ variant: "outline",
484
+ size: "sm",
485
+ onClick: () => form.removeListItem("points", index),
486
+ children: /* @__PURE__ */ jsx9(IconX2, { size: "1rem" })
487
+ }
488
+ )
489
+ ] }, item.key));
490
+ return /* @__PURE__ */ jsxs7(NodeContainer9, { id, selected, type, data, children: [
491
+ fields,
492
+ data.state === NodeState2.edit && /* @__PURE__ */ jsxs7(Fragment2, { children: [
493
+ /* @__PURE__ */ jsx9(Space2, { h: 10 }),
494
+ /* @__PURE__ */ jsx9(
495
+ Button2,
496
+ {
497
+ variant: "outline",
498
+ size: "xs",
499
+ fullWidth: true,
500
+ onClick: () => form.insertListItem("points", { value: 0, key: randomId2() }),
501
+ children: "Add control point"
502
+ }
503
+ )
504
+ ] }),
505
+ /* @__PURE__ */ jsx9(NodeTrackConnections9, { handles: data.handles, nodeId: id, type: "target" })
506
+ ] });
507
+ }
508
+ var noise_terrace_node_default = NoiseTerraceNode;
509
+
510
+ export {
511
+ noise_abs_node_default,
512
+ noise_clamp_node_default,
513
+ NoiseCombineType,
514
+ noiseCombineModuleMap,
515
+ noise_combine_node_default,
516
+ noise_curve_node_default,
517
+ noise_exponent_node_default,
518
+ noise_invert_node_default,
519
+ noise_normalize_node_default,
520
+ noise_scale_bias_node_default,
521
+ noise_terrace_node_default
522
+ };