@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
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkUNMRBZ5Xcjs = require('./chunk-UNMRBZ5X.cjs');
4
+
5
+ // src/nodes/modifiers/noise-abs-node.tsx
6
+ var _hooks = require('@awesome-flow/core/hooks');
7
+ var _layout = require('@awesome-flow/core/layout');
8
+ var _libnoisesimplexts = require('libnoise-simplex-ts');
9
+ var _react = require('react');
10
+ var _jsxruntime = require('react/jsx-runtime');
11
+ function NoiseAbsNode({ id, selected, data, type }) {
12
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
13
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
14
+ _react.useEffect.call(void 0, () => {
15
+ if (_optionalChain([incoming, 'optionalAccess', _ => _.length]) > 0) {
16
+ const module = new (0, _libnoisesimplexts.Abs)(incoming[0].module);
17
+ updateComputedData(id, { module });
18
+ }
19
+ }, [incoming]);
20
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.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
+
26
+
27
+
28
+
29
+
30
+
31
+ var _core = require('@mantine/core');
32
+
33
+
34
+
35
+ function NoiseClampNode({ id, selected, data, type }) {
36
+ const [lowerBound, setLowerBound] = _react.useState.call(void 0, data.lowerBound);
37
+ const [upperBound, setUpperBound] = _react.useState.call(void 0, data.upperBound);
38
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
39
+ const updateNodeData = _hooks.useUpdateNodeData.call(void 0, );
40
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
41
+ _react.useEffect.call(void 0, () => {
42
+ if (_optionalChain([incoming, 'optionalAccess', _2 => _2.length])) {
43
+ const module = new (0, _libnoisesimplexts.Clamp)(incoming[0].module, lowerBound, upperBound);
44
+ updateComputedData(id, { module });
45
+ }
46
+ updateNodeData(id, { lowerBound, upperBound });
47
+ }, [incoming, lowerBound, upperBound]);
48
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _layout.NodeContainer, { id, selected, data, type, children: [
49
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { children: [
50
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
51
+ _core.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__ */ _jsxruntime.jsx.call(void 0,
61
+ _core.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__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { 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
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ var _iconsreact = require('@tabler/icons-react');
90
+
91
+
92
+ // src/abstract/operations.ts
93
+
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 */]: _libnoisesimplexts.Add,
104
+ ["max" /* max */]: _libnoisesimplexts.Max,
105
+ ["min" /* min */]: _libnoisesimplexts.Min,
106
+ ["multiply" /* multiply */]: _libnoisesimplexts.Multiply,
107
+ ["power" /* power */]: _libnoisesimplexts.Power
108
+ };
109
+
110
+ // src/nodes/modifiers/noise-combine-node.tsx
111
+
112
+ var options = {
113
+ add: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, {}),
114
+ min: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconChevronLeft, {}),
115
+ max: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconChevronRight, {}),
116
+ multiply: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconAsterisk, {}),
117
+ power: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconChevronUp, {})
118
+ };
119
+ function NoiseCombineNode({ id, selected, data, type }) {
120
+ const updateNodeData = _hooks.useUpdateNodeData.call(void 0, );
121
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
122
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
123
+ _react.useEffect.call(void 0, () => {
124
+ const ModuleFactory = noiseCombineModuleMap[data.operation];
125
+ if (_optionalChain([incoming, 'optionalAccess', _3 => _3.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 = _react.useCallback.call(void 0, (operation) => {
131
+ updateNodeData(id, { operation });
132
+ }, []);
133
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _layout.NodeContainer, { id, selected, data, type, children: [
134
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
135
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { 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
+ var _abstract = require('@awesome-flow/core/abstract');
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ var _form = require('@mantine/form');
150
+ var _hooks3 = require('@mantine/hooks');
151
+
152
+
153
+
154
+
155
+ function NoiseCurveNode({ id, selected, data, type }) {
156
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
157
+ const updateNodeData = _hooks.useUpdateNodeData.call(void 0, );
158
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
159
+ const [values, setValues] = _react.useState.call(void 0, []);
160
+ const form = _form.useForm.call(void 0, {
161
+ mode: "uncontrolled",
162
+ initialValues: {
163
+ points: []
164
+ },
165
+ validateInputOnChange: [`points.${_form.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: _react.useCallback.call(void 0, (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
+ _react.useEffect.call(void 0, () => {
188
+ const points = _optionalChain([data, 'access', _4 => _4.points, 'optionalAccess', _5 => _5.length]) ? data.points.map((v) => ({ input: v.input, output: v.output, key: _hooks3.randomId.call(void 0, ) })) : [1, 2, 3, 4].map(() => ({ input: 0, output: 0, key: _hooks3.randomId.call(void 0, ) }));
189
+ form.initialize({ points });
190
+ }, []);
191
+ _react.useEffect.call(void 0, () => {
192
+ if (_optionalChain([incoming, 'optionalAccess', _6 => _6.length]) && _optionalChain([values, 'optionalAccess', _7 => _7.length]) >= 4) {
193
+ const module = new (0, _libnoisesimplexts.Curve)(
194
+ incoming[0].module,
195
+ values.map((p) => new (0, _libnoisesimplexts.Tuple)(p.input, p.output))
196
+ );
197
+ updateComputedData(id, { module });
198
+ }
199
+ }, [values, incoming]);
200
+ const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { mt: "xs", children: [
201
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
202
+ _core.NumberInput,
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__ */ _jsxruntime.jsx.call(void 0,
213
+ _core.NumberInput,
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 === _abstract.NodeState.edit && values.length > 4 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
224
+ _core.ActionIcon,
225
+ {
226
+ color: "red",
227
+ variant: "outline",
228
+ size: "sm",
229
+ onClick: () => form.removeListItem("points", index),
230
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconX, { size: "1rem" })
231
+ }
232
+ )
233
+ ] }, item.key));
234
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _layout.NodeContainer, { id, selected, type, data, children: [
235
+ fields,
236
+ data.state === _abstract.NodeState.edit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
237
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Space, { h: 10 }),
238
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
239
+ _core.Button,
240
+ {
241
+ variant: "outline",
242
+ size: "xs",
243
+ fullWidth: true,
244
+ onClick: () => form.insertListItem("points", { input: 0, output: 0, key: _hooks3.randomId.call(void 0, ) }),
245
+ children: "Add control point"
246
+ }
247
+ )
248
+ ] }),
249
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { 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
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+ function NoiseExponentNode({ id, selected, data, type }) {
266
+ const [exponent, setExponent] = _react.useState.call(void 0, data.exponent);
267
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
268
+ const updateNodeData = _hooks.useUpdateNodeData.call(void 0, );
269
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
270
+ _react.useEffect.call(void 0, () => {
271
+ if (_optionalChain([incoming, 'optionalAccess', _8 => _8.length]) > 0) {
272
+ const module = new (0, _libnoisesimplexts.Exponent)(incoming[0].module, exponent);
273
+ updateComputedData(id, { module });
274
+ }
275
+ updateNodeData(id, { exponent });
276
+ }, [incoming, exponent]);
277
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _layout.NodeContainer, { id, selected, data, type, children: [
278
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { children: [
279
+ "Exponent:",
280
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
281
+ _core.NumberInput,
282
+ {
283
+ size: "xs",
284
+ value: exponent,
285
+ onChange: (e) => setExponent(Number(e)),
286
+ step: 0.1
287
+ }
288
+ )
289
+ ] }) }),
290
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { 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
+
297
+
298
+
299
+
300
+
301
+ function NoiseInvertNode({ id, selected, data, type }) {
302
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
303
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
304
+ _react.useEffect.call(void 0, () => {
305
+ if (_optionalChain([incoming, 'optionalAccess', _9 => _9.length]) > 0) {
306
+ const module = new (0, _libnoisesimplexts.Invert)(incoming[0].module);
307
+ updateComputedData(id, { module });
308
+ }
309
+ }, [incoming]);
310
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { 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
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+ function NoiseNormalizeNode({ id, selected, data, type }) {
325
+ const [intervalStart, setIntervalStart] = _react.useState.call(void 0, data.intervalStart);
326
+ const [intervalEnd, setIntervalEnd] = _react.useState.call(void 0, data.intervalEnd);
327
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
328
+ const updateNodeData = _hooks.useUpdateNodeData.call(void 0, );
329
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
330
+ _react.useEffect.call(void 0, () => {
331
+ if (_optionalChain([incoming, 'optionalAccess', _10 => _10.length])) {
332
+ const source = incoming[0].module;
333
+ const module = new (0, _chunkUNMRBZ5Xcjs.NormalizeNoiseModule)(source, intervalStart, intervalEnd);
334
+ updateComputedData(id, { module });
335
+ }
336
+ updateNodeData(id, { intervalStart, intervalEnd });
337
+ }, [incoming, intervalStart, intervalEnd]);
338
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _layout.NodeContainer, { id, selected, data, type, children: [
339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { children: [
340
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
341
+ _core.NumberInput,
342
+ {
343
+ size: "xs",
344
+ w: 100,
345
+ value: intervalStart,
346
+ onChange: (e) => setIntervalStart(Number(e))
347
+ }
348
+ ),
349
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
350
+ _core.NumberInput,
351
+ {
352
+ size: "xs",
353
+ w: 100,
354
+ value: intervalEnd,
355
+ onChange: (e) => setIntervalEnd(Number(e))
356
+ }
357
+ )
358
+ ] }) }),
359
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { 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
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+ function NoiseScaleBiasNode({ id, selected, data, type }) {
376
+ const [scale, setScale] = _react.useState.call(void 0, data.scale);
377
+ const [bias, setBias] = _react.useState.call(void 0, data.bias);
378
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
379
+ const updateNodeData = _hooks.useUpdateNodeData.call(void 0, );
380
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
381
+ _react.useEffect.call(void 0, () => {
382
+ if (_optionalChain([incoming, 'optionalAccess', _11 => _11.length]) > 0) {
383
+ const module = new (0, _libnoisesimplexts.ScaleBias)(incoming[0].module, scale, bias);
384
+ updateComputedData(id, { module });
385
+ }
386
+ updateNodeData(id, { scale, bias });
387
+ }, [incoming, scale, bias]);
388
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _layout.NodeContainer, { id, selected, data, type, children: [
389
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Stack, { children: [
390
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { children: [
391
+ "Scale:",
392
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
393
+ _core.NumberInput,
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__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { children: [
404
+ "Bias:",
405
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
406
+ _core.NumberInput,
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__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { 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
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+ function NoiseTerraceNode({ id, selected, data, type }) {
438
+ const incoming = _hooks.useIncomingComputedData.call(void 0, id);
439
+ const updateNodeData = _hooks.useUpdateNodeData.call(void 0, );
440
+ const updateComputedData = _hooks.useUpdateNodeComputedData.call(void 0, );
441
+ const [values, setValues] = _react.useState.call(void 0, []);
442
+ const form = _form.useForm.call(void 0, {
443
+ mode: "uncontrolled",
444
+ initialValues: {
445
+ points: []
446
+ },
447
+ validateInputOnChange: [`points.${_form.FORM_INDEX}.input`],
448
+ clearInputErrorOnChange: true,
449
+ onValuesChange: _react.useCallback.call(void 0, (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
+ _react.useEffect.call(void 0, () => {
459
+ const points = _optionalChain([data, 'access', _12 => _12.points, 'optionalAccess', _13 => _13.length]) ? data.points.map((v) => ({ value: v, key: _hooks3.randomId.call(void 0, ) })) : [1, 2].map(() => ({ value: 0, key: _hooks3.randomId.call(void 0, ) }));
460
+ form.initialize({ points });
461
+ }, []);
462
+ _react.useEffect.call(void 0, () => {
463
+ if (_optionalChain([incoming, 'optionalAccess', _14 => _14.length]) && _optionalChain([values, 'optionalAccess', _15 => _15.length]) >= 2) {
464
+ const module = new (0, _libnoisesimplexts.Terrace)(incoming[0].module, values);
465
+ updateComputedData(id, { module });
466
+ }
467
+ }, [values, incoming]);
468
+ const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { mt: "xs", children: [
469
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
470
+ _core.NumberInput,
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 === _abstract.NodeState.edit && values.length > 2 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
480
+ _core.ActionIcon,
481
+ {
482
+ color: "red",
483
+ variant: "outline",
484
+ size: "sm",
485
+ onClick: () => form.removeListItem("points", index),
486
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconX, { size: "1rem" })
487
+ }
488
+ )
489
+ ] }, item.key));
490
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _layout.NodeContainer, { id, selected, type, data, children: [
491
+ fields,
492
+ data.state === _abstract.NodeState.edit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
493
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Space, { h: 10 }),
494
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
495
+ _core.Button,
496
+ {
497
+ variant: "outline",
498
+ size: "xs",
499
+ fullWidth: true,
500
+ onClick: () => form.insertListItem("points", { value: 0, key: _hooks3.randomId.call(void 0, ) }),
501
+ children: "Add control point"
502
+ }
503
+ )
504
+ ] }),
505
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
506
+ ] });
507
+ }
508
+ var noise_terrace_node_default = NoiseTerraceNode;
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+ exports.noise_abs_node_default = noise_abs_node_default; exports.noise_clamp_node_default = noise_clamp_node_default; exports.NoiseCombineType = NoiseCombineType; exports.noiseCombineModuleMap = noiseCombineModuleMap; exports.noise_combine_node_default = noise_combine_node_default; exports.noise_curve_node_default = noise_curve_node_default; exports.noise_exponent_node_default = noise_exponent_node_default; exports.noise_invert_node_default = noise_invert_node_default; exports.noise_normalize_node_default = noise_normalize_node_default; exports.noise_scale_bias_node_default = noise_scale_bias_node_default; exports.noise_terrace_node_default = noise_terrace_node_default;
@@ -0,0 +1,19 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/modules/normalize-noise-module.ts
2
+ var _libnoisesimplexts = require('libnoise-simplex-ts');
3
+ var NormalizeNoiseModule = class extends _libnoisesimplexts.ModifierModule {
4
+ constructor(source, lowerBound, upperBound) {
5
+ super(source);
6
+ this.lowerBound = lowerBound;
7
+ this.upperBound = upperBound;
8
+ }
9
+ getValue(x, y, z) {
10
+ return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
11
+ }
12
+ };
13
+ function normalize(value, min, max) {
14
+ return (value - min) / (max - min);
15
+ }
16
+
17
+
18
+
19
+ exports.NormalizeNoiseModule = NormalizeNoiseModule;
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -1,44 +1,6 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
18
2
 
19
- // src/modules/index.ts
20
- var modules_exports = {};
21
- __export(modules_exports, {
22
- NormalizeNoiseModule: () => NormalizeNoiseModule
23
- });
24
- module.exports = __toCommonJS(modules_exports);
3
+ var _chunkUNMRBZ5Xcjs = require('../chunk-UNMRBZ5X.cjs');
25
4
 
26
- // src/modules/normalize-noise-module.ts
27
- var import_libnoise_simplex_ts = require("libnoise-simplex-ts");
28
- var NormalizeNoiseModule = class extends import_libnoise_simplex_ts.ModifierModule {
29
- constructor(source, lowerBound, upperBound) {
30
- super(source);
31
- this.lowerBound = lowerBound;
32
- this.upperBound = upperBound;
33
- }
34
- getValue(x, y, z) {
35
- return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
36
- }
37
- };
38
- function normalize(value, min, max) {
39
- return (value - min) / (max - min);
40
- }
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
43
- NormalizeNoiseModule
44
- });
5
+
6
+ exports.NormalizeNoiseModule = _chunkUNMRBZ5Xcjs.NormalizeNoiseModule;
@@ -1,18 +1,6 @@
1
- // src/modules/normalize-noise-module.ts
2
- import { ModifierModule } from "libnoise-simplex-ts";
3
- var NormalizeNoiseModule = class extends ModifierModule {
4
- constructor(source, lowerBound, upperBound) {
5
- super(source);
6
- this.lowerBound = lowerBound;
7
- this.upperBound = upperBound;
8
- }
9
- getValue(x, y, z) {
10
- return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
11
- }
12
- };
13
- function normalize(value, min, max) {
14
- return (value - min) / (max - min);
15
- }
1
+ import {
2
+ NormalizeNoiseModule
3
+ } from "../chunk-SGHEOOLW.js";
16
4
  export {
17
5
  NormalizeNoiseModule
18
6
  };