@awesome-flow/noise 0.6.0 → 0.7.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 (59) hide show
  1. package/dist/abstract/index.cjs +663 -734
  2. package/dist/abstract/index.d.cts +6 -12
  3. package/dist/abstract/index.d.ts +6 -12
  4. package/dist/abstract/index.js +449 -522
  5. package/dist/{index-BungWYrh.d.cts → index-CfiOpOzX.d.cts} +1 -1
  6. package/dist/{index-DsQSjZC5.d.ts → index-mlK0X4O1.d.ts} +1 -1
  7. package/dist/modules/index.cjs +4 -30
  8. package/dist/modules/index.d.cts +2 -10
  9. package/dist/modules/index.d.ts +2 -10
  10. package/dist/modules/index.js +2 -17
  11. package/dist/{node-props-BbqbXDXn.d.cts → node-props-CAV2WNDN.d.cts} +3 -7
  12. package/dist/{node-props-BbqbXDXn.d.ts → node-props-CAV2WNDN.d.ts} +3 -7
  13. package/dist/nodes/generators/index.cjs +71 -114
  14. package/dist/nodes/generators/index.d.cts +3 -8
  15. package/dist/nodes/generators/index.d.ts +3 -8
  16. package/dist/nodes/generators/index.js +47 -79
  17. package/dist/nodes/index.cjs +604 -675
  18. package/dist/nodes/index.d.cts +3 -6
  19. package/dist/nodes/index.d.ts +3 -6
  20. package/dist/nodes/index.js +394 -466
  21. package/dist/nodes/modifiers/index.cjs +37 -52
  22. package/dist/nodes/modifiers/index.d.cts +2 -5
  23. package/dist/nodes/modifiers/index.d.ts +2 -5
  24. package/dist/nodes/modifiers/index.js +23 -38
  25. package/dist/nodes/output/index.cjs +239 -285
  26. package/dist/nodes/output/index.js +252 -290
  27. package/dist/nodes/selectors/index.cjs +230 -280
  28. package/dist/nodes/selectors/index.d.cts +2 -5
  29. package/dist/nodes/selectors/index.d.ts +2 -5
  30. package/dist/nodes/selectors/index.js +248 -290
  31. package/dist/nodes/transformers/index.cjs +10 -10
  32. package/dist/nodes/transformers/index.d.cts +2 -5
  33. package/dist/nodes/transformers/index.d.ts +2 -5
  34. package/dist/nodes/transformers/index.js +5 -5
  35. package/dist/templates/generators/index.cjs +201 -253
  36. package/dist/templates/generators/index.d.cts +3 -10
  37. package/dist/templates/generators/index.d.ts +3 -10
  38. package/dist/templates/generators/index.js +236 -279
  39. package/dist/templates/groups/index.cjs +201 -251
  40. package/dist/templates/groups/index.js +236 -278
  41. package/dist/templates/index.cjs +201 -253
  42. package/dist/templates/index.d.cts +4 -7
  43. package/dist/templates/index.d.ts +4 -7
  44. package/dist/templates/index.js +236 -279
  45. package/dist/templates/modifiers/index.cjs +201 -251
  46. package/dist/templates/modifiers/index.d.cts +2 -5
  47. package/dist/templates/modifiers/index.d.ts +2 -5
  48. package/dist/templates/modifiers/index.js +236 -278
  49. package/dist/templates/output/index.cjs +201 -251
  50. package/dist/templates/output/index.js +236 -278
  51. package/dist/templates/selectors/index.cjs +201 -251
  52. package/dist/templates/selectors/index.d.cts +2 -5
  53. package/dist/templates/selectors/index.d.ts +2 -5
  54. package/dist/templates/selectors/index.js +236 -278
  55. package/dist/templates/transformers/index.cjs +201 -251
  56. package/dist/templates/transformers/index.d.cts +3 -6
  57. package/dist/templates/transformers/index.d.ts +3 -6
  58. package/dist/templates/transformers/index.js +236 -278
  59. package/package.json +6 -4
@@ -1,7 +1,7 @@
1
1
  // src/nodes/generators/noise-billow-node.tsx
2
2
  import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
3
3
  import { useCallback, useMemo } from "react";
4
- import { Billow } from "libnoise-ts/module/generator";
4
+ import { Billow } from "libnoise-simplex-ts";
5
5
  import { useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
6
6
  import { NodePropertyVariables } from "@awesome-flow/core/components";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -27,7 +27,7 @@ var noise_billow_node_default = NoiseBillowNode;
27
27
  // src/nodes/generators/noise-checkerboard-node.tsx
28
28
  import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
29
29
  import { useEffect, useMemo as useMemo2 } from "react";
30
- import { Checkerboard } from "libnoise-ts/module/generator";
30
+ import { Checkerboard } from "libnoise-simplex-ts";
31
31
  import { useUpdateNodeComputedData as useUpdateNodeComputedData2 } from "@awesome-flow/core/hooks";
32
32
  import { jsx as jsx2 } from "react/jsx-runtime";
33
33
  function NoiseCheckerboardNode({ id, selected, data, type }) {
@@ -45,7 +45,7 @@ import { NodeContainer as NodeContainer3 } from "@awesome-flow/core/layout";
45
45
  import { useEffect as useEffect2, useMemo as useMemo3, useState } from "react";
46
46
  import { Group, NumberInput, Stack } from "@mantine/core";
47
47
  import { useUpdateNodeComputedData as useUpdateNodeComputedData3, useUpdateNodeData } from "@awesome-flow/core/hooks";
48
- import { Const } from "libnoise-ts/module/generator";
48
+ import { Const } from "libnoise-simplex-ts";
49
49
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
50
50
  function NoiseConstNode({ id, selected, data, type }) {
51
51
  const [min, setMin] = useState(data.min);
@@ -85,7 +85,7 @@ var noise_const_node_default = NoiseConstNode;
85
85
  // src/nodes/generators/noise-cylinders-node.tsx
86
86
  import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
87
87
  import { useCallback as useCallback2, useMemo as useMemo4 } from "react";
88
- import { Cylinders } from "libnoise-ts/module/generator";
88
+ import { Cylinders } from "libnoise-simplex-ts";
89
89
  import { useUpdateNodeComputedData as useUpdateNodeComputedData4 } from "@awesome-flow/core/hooks";
90
90
  import { NodePropertyVariables as NodePropertyVariables2 } from "@awesome-flow/core/components";
91
91
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -111,7 +111,7 @@ var noise_cylinders_node_default = NoiseCylindersNode;
111
111
  // src/nodes/generators/noise-perlin-node.tsx
112
112
  import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
113
113
  import { useCallback as useCallback3, useMemo as useMemo5 } from "react";
114
- import { Perlin } from "libnoise-ts/module/generator";
114
+ import { Perlin } from "libnoise-simplex-ts";
115
115
  import { useUpdateNodeComputedData as useUpdateNodeComputedData5 } from "@awesome-flow/core/hooks";
116
116
  import { NodePropertyVariables as NodePropertyVariables3 } from "@awesome-flow/core/components";
117
117
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -137,7 +137,7 @@ var noise_perlin_node_default = NoisePerlinNode;
137
137
  // src/nodes/generators/noise-ridgedmulti-node.tsx
138
138
  import { NodeContainer as NodeContainer6, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
139
139
  import { useCallback as useCallback4, useMemo as useMemo6 } from "react";
140
- import { RidgedMulti } from "libnoise-ts/module/generator";
140
+ import { RidgedMulti } from "libnoise-simplex-ts";
141
141
  import { useUpdateNodeComputedData as useUpdateNodeComputedData6 } from "@awesome-flow/core/hooks";
142
142
  import { NodePropertyVariables as NodePropertyVariables4 } from "@awesome-flow/core/components";
143
143
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -155,67 +155,36 @@ function NoiseRidgedMultiNode({ id, selected, data, type }) {
155
155
  }
156
156
  var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
157
157
 
158
- // src/nodes/generators/noise-simplex-node.tsx
159
- import { NodeContainer as NodeContainer7 } from "@awesome-flow/core/layout";
160
- import { useEffect as useEffect3, useMemo as useMemo7 } from "react";
161
- import { useUpdateNodeComputedData as useUpdateNodeComputedData7 } from "@awesome-flow/core/hooks";
162
-
163
- // src/modules/simplex-module.ts
164
- import Module from "libnoise-ts/module/Module";
165
- import { createNoise3D } from "simplex-noise";
166
- var SimplexModule = class extends Module {
167
- noise;
168
- constructor(random) {
169
- super();
170
- this.noise = createNoise3D(random);
171
- }
172
- getValue(x, y, z) {
173
- return this.noise(x, y, z);
174
- }
175
- };
176
-
177
- // src/nodes/generators/noise-simplex-node.tsx
178
- import { jsx as jsx7 } from "react/jsx-runtime";
179
- function NoiseSimplexNode({ id, selected, data, type }) {
180
- const updateComputedData = useUpdateNodeComputedData7();
181
- const module = useMemo7(() => new SimplexModule(), []);
182
- useEffect3(() => {
183
- updateComputedData(id, { module });
184
- }, []);
185
- return /* @__PURE__ */ jsx7(NodeContainer7, { id, selected, data, type });
186
- }
187
- var noise_simplex_node_default = NoiseSimplexNode;
188
-
189
158
  // src/nodes/generators/noise-spheres-node.tsx
190
- import { NodeContainer as NodeContainer8, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
191
- import { useCallback as useCallback5, useMemo as useMemo8 } from "react";
192
- import { Spheres } from "libnoise-ts/module/generator";
193
- import { useUpdateNodeComputedData as useUpdateNodeComputedData8 } from "@awesome-flow/core/hooks";
159
+ import { NodeContainer as NodeContainer7, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
160
+ import { useCallback as useCallback5, useMemo as useMemo7 } from "react";
161
+ import { Spheres } from "libnoise-simplex-ts";
162
+ import { useUpdateNodeComputedData as useUpdateNodeComputedData7 } from "@awesome-flow/core/hooks";
194
163
  import { NodePropertyVariables as NodePropertyVariables5 } from "@awesome-flow/core/components";
195
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
164
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
196
165
  function NoiseSpheresNode({ id, selected, data, type }) {
197
- const updateComputedData = useUpdateNodeComputedData8();
198
- const module = useMemo8(() => new Spheres(), []);
166
+ const updateComputedData = useUpdateNodeComputedData7();
167
+ const module = useMemo7(() => new Spheres(), []);
199
168
  const onPropertiesChange = useCallback5((properties) => {
200
169
  Object.keys(properties).forEach((k) => module[k] = properties[k].value);
201
170
  updateComputedData(id, { module });
202
171
  }, []);
203
- return /* @__PURE__ */ jsxs6(NodeContainer8, { id, selected, data, type, children: [
204
- /* @__PURE__ */ jsx8(NodePropertyVariables5, { data, nodeId: id, onPropertiesChange }),
205
- /* @__PURE__ */ jsx8(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
172
+ return /* @__PURE__ */ jsxs6(NodeContainer7, { id, selected, data, type, children: [
173
+ /* @__PURE__ */ jsx7(NodePropertyVariables5, { data, nodeId: id, onPropertiesChange }),
174
+ /* @__PURE__ */ jsx7(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
206
175
  ] });
207
176
  }
208
177
  var noise_spheres_node_default = NoiseSpheresNode;
209
178
 
210
179
  // src/nodes/generators/noise-voronoi-node.tsx
211
- import { NodeContainer as NodeContainer9, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
180
+ import { NodeContainer as NodeContainer8, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
212
181
  import { useCallback as useCallback6 } from "react";
213
- import { Voronoi } from "libnoise-ts/module/generator";
214
- import { useUpdateNodeComputedData as useUpdateNodeComputedData9 } from "@awesome-flow/core/hooks";
182
+ import { Voronoi } from "libnoise-simplex-ts";
183
+ import { useUpdateNodeComputedData as useUpdateNodeComputedData8 } from "@awesome-flow/core/hooks";
215
184
  import { NodePropertyVariables as NodePropertyVariables6 } from "@awesome-flow/core/components";
216
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
185
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
217
186
  function NoiseVoronoiNode({ id, selected, data, type }) {
218
- const updateComputedData = useUpdateNodeComputedData9();
187
+ const updateComputedData = useUpdateNodeComputedData8();
219
188
  const onPropertiesChange = useCallback6(
220
189
  (properties) => {
221
190
  const module = new Voronoi(
@@ -228,27 +197,27 @@ function NoiseVoronoiNode({ id, selected, data, type }) {
228
197
  },
229
198
  []
230
199
  );
231
- return /* @__PURE__ */ jsxs7(NodeContainer9, { id, selected, data, type, children: [
232
- /* @__PURE__ */ jsx9(NodePropertyVariables6, { data, nodeId: id, onPropertiesChange }),
233
- /* @__PURE__ */ jsx9(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" })
200
+ return /* @__PURE__ */ jsxs7(NodeContainer8, { id, selected, data, type, children: [
201
+ /* @__PURE__ */ jsx8(NodePropertyVariables6, { data, nodeId: id, onPropertiesChange }),
202
+ /* @__PURE__ */ jsx8(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" })
234
203
  ] });
235
204
  }
236
205
  var noise_voronoi_node_default = NoiseVoronoiNode;
237
206
 
238
207
  // src/nodes/generators/position-const-node.tsx
239
- import { NodeContainer as NodeContainer10 } from "@awesome-flow/core/layout";
240
- import { useEffect as useEffect4, useState as useState2 } from "react";
208
+ import { NodeContainer as NodeContainer9 } from "@awesome-flow/core/layout";
209
+ import { useEffect as useEffect3, useState as useState2 } from "react";
241
210
  import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
242
- import { useUpdateNodeComputedData as useUpdateNodeComputedData10, useUpdateNodeData as useUpdateNodeData2 } from "@awesome-flow/core/hooks";
243
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
211
+ import { useUpdateNodeComputedData as useUpdateNodeComputedData9, useUpdateNodeData as useUpdateNodeData2 } from "@awesome-flow/core/hooks";
212
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
244
213
  function PositionConstNode({ id, selected, data, type }) {
245
214
  const position = data.position ?? { x: 0, y: 0, z: 0 };
246
215
  const [x, setX] = useState2(position.x);
247
216
  const [y, setY] = useState2(position.y);
248
217
  const [z, setZ] = useState2(position.z);
249
218
  const updateNodeData = useUpdateNodeData2();
250
- const updateComputedData = useUpdateNodeComputedData10();
251
- useEffect4(() => {
219
+ const updateComputedData = useUpdateNodeComputedData9();
220
+ useEffect3(() => {
252
221
  const position2 = { x, y, z };
253
222
  updateNodeData(id, {
254
223
  position: position2
@@ -257,47 +226,47 @@ function PositionConstNode({ id, selected, data, type }) {
257
226
  positions: [position2]
258
227
  });
259
228
  }, [x, y, z]);
260
- return /* @__PURE__ */ jsx10(NodeContainer10, { id, selected, data, type, children: /* @__PURE__ */ jsxs8(Stack2, { children: [
229
+ return /* @__PURE__ */ jsx9(NodeContainer9, { id, selected, data, type, children: /* @__PURE__ */ jsxs8(Stack2, { children: [
261
230
  /* @__PURE__ */ jsxs8(Group2, { children: [
262
231
  "x: ",
263
- /* @__PURE__ */ jsx10(NumberInput2, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
232
+ /* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
264
233
  ] }),
265
234
  /* @__PURE__ */ jsxs8(Group2, { children: [
266
235
  "y: ",
267
- /* @__PURE__ */ jsx10(NumberInput2, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
236
+ /* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
268
237
  ] }),
269
238
  /* @__PURE__ */ jsxs8(Group2, { children: [
270
239
  "z: ",
271
- /* @__PURE__ */ jsx10(NumberInput2, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
240
+ /* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
272
241
  ] })
273
242
  ] }) });
274
243
  }
275
244
  var position_const_node_default = PositionConstNode;
276
245
 
277
246
  // src/nodes/generators/position-grid-node.tsx
278
- import { NodeContainer as NodeContainer11 } from "@awesome-flow/core/layout";
279
- import { useEffect as useEffect5, useState as useState3 } from "react";
247
+ import { NodeContainer as NodeContainer10 } from "@awesome-flow/core/layout";
248
+ import { useEffect as useEffect4, useState as useState3 } from "react";
280
249
  import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
281
- import { useUpdateNodeComputedData as useUpdateNodeComputedData11, useUpdateNodeData as useUpdateNodeData3 } from "@awesome-flow/core/hooks";
282
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
250
+ import { useUpdateNodeComputedData as useUpdateNodeComputedData10, useUpdateNodeData as useUpdateNodeData3 } from "@awesome-flow/core/hooks";
251
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
283
252
  function PositionGridNode({ id, selected, data, type }) {
284
253
  const [x, setX] = useState3(data.center?.x);
285
254
  const [y, setY] = useState3(data.center?.y);
286
255
  const [z, setZ] = useState3(data.center?.z);
287
256
  const [radius, setRadius] = useState3(data.radius);
288
257
  const updateNodeData = useUpdateNodeData3();
289
- const updateComputedData = useUpdateNodeComputedData11();
290
- useEffect5(() => {
258
+ const updateComputedData = useUpdateNodeComputedData10();
259
+ useEffect4(() => {
291
260
  updateNodeData(id, {
292
261
  center: { x, y, z }
293
262
  });
294
263
  }, [x, y, z]);
295
- useEffect5(() => {
264
+ useEffect4(() => {
296
265
  updateNodeData(id, {
297
266
  radius
298
267
  });
299
268
  }, [radius]);
300
- useEffect5(() => {
269
+ useEffect4(() => {
301
270
  const positions = [];
302
271
  for (let i = -radius; i < radius; i++) {
303
272
  for (let j = -radius; j < radius; j++) {
@@ -308,22 +277,22 @@ function PositionGridNode({ id, selected, data, type }) {
308
277
  positions
309
278
  });
310
279
  }, [x, y, z, radius]);
311
- return /* @__PURE__ */ jsx11(NodeContainer11, { id, selected, data, type, children: /* @__PURE__ */ jsxs9(Stack3, { children: [
280
+ return /* @__PURE__ */ jsx10(NodeContainer10, { id, selected, data, type, children: /* @__PURE__ */ jsxs9(Stack3, { children: [
312
281
  /* @__PURE__ */ jsxs9(Group3, { children: [
313
282
  "x: ",
314
- /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
283
+ /* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
315
284
  ] }),
316
285
  /* @__PURE__ */ jsxs9(Group3, { children: [
317
286
  "y: ",
318
- /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
287
+ /* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
319
288
  ] }),
320
289
  /* @__PURE__ */ jsxs9(Group3, { children: [
321
290
  "z: ",
322
- /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
291
+ /* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
323
292
  ] }),
324
293
  /* @__PURE__ */ jsxs9(Group3, { children: [
325
294
  "r: ",
326
- /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
295
+ /* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
327
296
  ] })
328
297
  ] }) });
329
298
  }
@@ -335,7 +304,6 @@ export {
335
304
  noise_cylinders_node_default as NoiseCylindersNode,
336
305
  noise_perlin_node_default as NoisePerlinNode,
337
306
  noise_ridgedmulti_node_default as NoiseRidgedMultiNode,
338
- noise_simplex_node_default as NoiseSimplexNode,
339
307
  noise_spheres_node_default as NoiseSpheresNode,
340
308
  noise_voronoi_node_default as NoiseVoronoiNode,
341
309
  position_const_node_default as PositionConstNode,