@awesome-flow/noise 0.8.0 → 0.9.1

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 (79) hide show
  1. package/dist/abstract/index.cjs +6 -6
  2. package/dist/abstract/index.d.cts +10 -8
  3. package/dist/abstract/index.d.ts +10 -8
  4. package/dist/abstract/index.js +5 -5
  5. package/dist/chunk-4YL2V7SE.js +641 -0
  6. package/dist/chunk-76MMGOOY.cjs +1008 -0
  7. package/dist/{chunk-BG6U3TYO.js → chunk-BE4RLT5P.js} +445 -178
  8. package/dist/chunk-D5QJ3563.cjs +641 -0
  9. package/dist/chunk-EHBNVDTI.js +60 -0
  10. package/dist/chunk-L45ZU7VL.js +1008 -0
  11. package/dist/{chunk-ACWBUUZ7.cjs → chunk-MIYOMNAG.cjs} +467 -200
  12. package/dist/chunk-O5DVJAMK.cjs +974 -0
  13. package/dist/chunk-S2ZGHJ75.js +974 -0
  14. package/dist/chunk-X2GXADE5.cjs +60 -0
  15. package/dist/{index-mlK0X4O1.d.ts → index-DAAmYCPU.d.ts} +1 -1
  16. package/dist/{index-CfiOpOzX.d.cts → index-EzT2GjIx.d.cts} +1 -1
  17. package/dist/{node-props-CAV2WNDN.d.ts → node-props-D8SnrgWa.d.cts} +1 -1
  18. package/dist/{node-props-CAV2WNDN.d.cts → node-props-D8SnrgWa.d.ts} +1 -1
  19. package/dist/nodes/generators/index.cjs +2 -2
  20. package/dist/nodes/generators/index.d.cts +1 -1
  21. package/dist/nodes/generators/index.d.ts +1 -1
  22. package/dist/nodes/generators/index.js +1 -1
  23. package/dist/nodes/groups/index.cjs +2 -2
  24. package/dist/nodes/groups/index.d.cts +1 -1
  25. package/dist/nodes/groups/index.d.ts +1 -1
  26. package/dist/nodes/groups/index.js +1 -1
  27. package/dist/nodes/index.cjs +6 -6
  28. package/dist/nodes/index.d.cts +4 -2
  29. package/dist/nodes/index.d.ts +4 -2
  30. package/dist/nodes/index.js +5 -5
  31. package/dist/nodes/modifiers/index.cjs +2 -2
  32. package/dist/nodes/modifiers/index.d.cts +6 -19
  33. package/dist/nodes/modifiers/index.d.ts +6 -19
  34. package/dist/nodes/modifiers/index.js +1 -1
  35. package/dist/nodes/output/index.cjs +6 -6
  36. package/dist/nodes/output/index.js +5 -5
  37. package/dist/nodes/selectors/index.cjs +6 -6
  38. package/dist/nodes/selectors/index.d.cts +1 -1
  39. package/dist/nodes/selectors/index.d.ts +1 -1
  40. package/dist/nodes/selectors/index.js +5 -5
  41. package/dist/nodes/transformers/index.cjs +2 -2
  42. package/dist/nodes/transformers/index.d.cts +1 -1
  43. package/dist/nodes/transformers/index.d.ts +1 -1
  44. package/dist/nodes/transformers/index.js +1 -1
  45. package/dist/noise-terrace-node-D2ezdTnC.d.cts +22 -0
  46. package/dist/noise-terrace-node-DW81ZQk6.d.ts +22 -0
  47. package/dist/templates/generators/index.cjs +6 -6
  48. package/dist/templates/generators/index.d.cts +1 -1
  49. package/dist/templates/generators/index.d.ts +1 -1
  50. package/dist/templates/generators/index.js +5 -5
  51. package/dist/templates/groups/index.cjs +6 -6
  52. package/dist/templates/groups/index.js +5 -5
  53. package/dist/templates/index.cjs +6 -6
  54. package/dist/templates/index.d.cts +2 -2
  55. package/dist/templates/index.d.ts +2 -2
  56. package/dist/templates/index.js +5 -5
  57. package/dist/templates/modifiers/index.cjs +6 -6
  58. package/dist/templates/modifiers/index.d.cts +1 -1
  59. package/dist/templates/modifiers/index.d.ts +1 -1
  60. package/dist/templates/modifiers/index.js +5 -5
  61. package/dist/templates/output/index.cjs +6 -6
  62. package/dist/templates/output/index.js +5 -5
  63. package/dist/templates/selectors/index.cjs +6 -6
  64. package/dist/templates/selectors/index.d.cts +1 -1
  65. package/dist/templates/selectors/index.d.ts +1 -1
  66. package/dist/templates/selectors/index.js +5 -5
  67. package/dist/templates/transformers/index.cjs +6 -6
  68. package/dist/templates/transformers/index.d.cts +2 -2
  69. package/dist/templates/transformers/index.d.ts +2 -2
  70. package/dist/templates/transformers/index.js +5 -5
  71. package/package.json +15 -14
  72. package/dist/chunk-D5JM4EYQ.cjs +0 -305
  73. package/dist/chunk-DWSACR65.js +0 -305
  74. package/dist/chunk-KHIIB5TH.js +0 -93
  75. package/dist/chunk-M67JHEU2.cjs +0 -93
  76. package/dist/chunk-PS5VUND5.js +0 -348
  77. package/dist/chunk-RDQ4BOOV.js +0 -522
  78. package/dist/chunk-RKTZQUWR.cjs +0 -348
  79. package/dist/chunk-TZCT2GZV.cjs +0 -522
@@ -1,522 +0,0 @@
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;