@awesome-flow/noise 0.3.0 → 0.5.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 (105) hide show
  1. package/dist/abstract/index.cjs +1403 -2079
  2. package/dist/abstract/index.d.cts +23 -25
  3. package/dist/abstract/index.d.ts +23 -25
  4. package/dist/abstract/index.js +1319 -1998
  5. package/dist/index-BungWYrh.d.cts +49 -0
  6. package/dist/index-DsQSjZC5.d.ts +49 -0
  7. package/dist/modules/index.cjs +0 -1
  8. package/dist/modules/index.js +0 -1
  9. package/dist/{node-props-CeZ8Oshz.d.ts → node-props-BbqbXDXn.d.cts} +2 -22
  10. package/dist/{node-props-hKW-_KOU.d.cts → node-props-BbqbXDXn.d.ts} +2 -22
  11. package/dist/nodes/generators/index.cjs +130 -381
  12. package/dist/nodes/generators/index.d.cts +2 -8
  13. package/dist/nodes/generators/index.d.ts +2 -8
  14. package/dist/nodes/generators/index.js +112 -361
  15. package/dist/nodes/groups/index.cjs +27 -18
  16. package/dist/nodes/groups/index.js +34 -20
  17. package/dist/nodes/index.cjs +1652 -989
  18. package/dist/nodes/index.d.cts +3 -5
  19. package/dist/nodes/index.d.ts +3 -5
  20. package/dist/nodes/index.js +1629 -965
  21. package/dist/nodes/modifiers/index.cjs +17 -120
  22. package/dist/nodes/modifiers/index.d.cts +2 -6
  23. package/dist/nodes/modifiers/index.d.ts +2 -6
  24. package/dist/nodes/modifiers/index.js +16 -125
  25. package/dist/nodes/output/index.cjs +1270 -90
  26. package/dist/nodes/output/index.js +1318 -93
  27. package/dist/nodes/selectors/index.cjs +1295 -59
  28. package/dist/nodes/selectors/index.d.cts +1 -3
  29. package/dist/nodes/selectors/index.d.ts +1 -3
  30. package/dist/nodes/selectors/index.js +1343 -66
  31. package/dist/nodes/transformers/index.cjs +67 -207
  32. package/dist/nodes/transformers/index.d.cts +3 -5
  33. package/dist/nodes/transformers/index.d.ts +3 -5
  34. package/dist/nodes/transformers/index.js +54 -194
  35. package/dist/templates/generators/index.cjs +838 -1279
  36. package/dist/templates/generators/index.d.cts +13 -50
  37. package/dist/templates/generators/index.d.ts +13 -50
  38. package/dist/templates/generators/index.js +840 -1281
  39. package/dist/templates/groups/index.cjs +836 -1273
  40. package/dist/templates/groups/index.d.cts +1 -5
  41. package/dist/templates/groups/index.d.ts +1 -5
  42. package/dist/templates/groups/index.js +839 -1278
  43. package/dist/templates/index.cjs +838 -1281
  44. package/dist/templates/index.d.cts +4 -7
  45. package/dist/templates/index.d.ts +4 -7
  46. package/dist/templates/index.js +840 -1282
  47. package/dist/templates/modifiers/index.cjs +840 -1279
  48. package/dist/templates/modifiers/index.d.cts +11 -38
  49. package/dist/templates/modifiers/index.d.ts +11 -38
  50. package/dist/templates/modifiers/index.js +842 -1282
  51. package/dist/templates/output/index.cjs +838 -1275
  52. package/dist/templates/output/index.d.cts +4 -14
  53. package/dist/templates/output/index.d.ts +4 -14
  54. package/dist/templates/output/index.js +841 -1280
  55. package/dist/templates/selectors/index.cjs +838 -1275
  56. package/dist/templates/selectors/index.d.cts +3 -9
  57. package/dist/templates/selectors/index.d.ts +3 -9
  58. package/dist/templates/selectors/index.js +841 -1280
  59. package/dist/templates/transformers/index.cjs +838 -1275
  60. package/dist/templates/transformers/index.d.cts +3 -36
  61. package/dist/templates/transformers/index.d.ts +3 -36
  62. package/dist/templates/transformers/index.js +841 -1280
  63. package/package.json +3 -3
  64. package/dist/abstract/index.cjs.map +0 -1
  65. package/dist/abstract/index.js.map +0 -1
  66. package/dist/handle-types-D-v5S53h.d.cts +0 -22
  67. package/dist/handle-types-D-v5S53h.d.ts +0 -22
  68. package/dist/layout/index.cjs +0 -164
  69. package/dist/layout/index.cjs.map +0 -1
  70. package/dist/layout/index.d.cts +0 -26
  71. package/dist/layout/index.d.ts +0 -26
  72. package/dist/layout/index.js +0 -136
  73. package/dist/layout/index.js.map +0 -1
  74. package/dist/modules/index.cjs.map +0 -1
  75. package/dist/modules/index.js.map +0 -1
  76. package/dist/nodes/generators/index.cjs.map +0 -1
  77. package/dist/nodes/generators/index.js.map +0 -1
  78. package/dist/nodes/groups/index.cjs.map +0 -1
  79. package/dist/nodes/groups/index.js.map +0 -1
  80. package/dist/nodes/index.cjs.map +0 -1
  81. package/dist/nodes/index.js.map +0 -1
  82. package/dist/nodes/modifiers/index.cjs.map +0 -1
  83. package/dist/nodes/modifiers/index.js.map +0 -1
  84. package/dist/nodes/output/index.cjs.map +0 -1
  85. package/dist/nodes/output/index.js.map +0 -1
  86. package/dist/nodes/selectors/index.cjs.map +0 -1
  87. package/dist/nodes/selectors/index.js.map +0 -1
  88. package/dist/nodes/transformers/index.cjs.map +0 -1
  89. package/dist/nodes/transformers/index.js.map +0 -1
  90. package/dist/properties-BxwtU6i9.d.cts +0 -9
  91. package/dist/properties-BxwtU6i9.d.ts +0 -9
  92. package/dist/templates/generators/index.cjs.map +0 -1
  93. package/dist/templates/generators/index.js.map +0 -1
  94. package/dist/templates/groups/index.cjs.map +0 -1
  95. package/dist/templates/groups/index.js.map +0 -1
  96. package/dist/templates/index.cjs.map +0 -1
  97. package/dist/templates/index.js.map +0 -1
  98. package/dist/templates/modifiers/index.cjs.map +0 -1
  99. package/dist/templates/modifiers/index.js.map +0 -1
  100. package/dist/templates/output/index.cjs.map +0 -1
  101. package/dist/templates/output/index.js.map +0 -1
  102. package/dist/templates/selectors/index.cjs.map +0 -1
  103. package/dist/templates/selectors/index.js.map +0 -1
  104. package/dist/templates/transformers/index.cjs.map +0 -1
  105. package/dist/templates/transformers/index.js.map +0 -1
@@ -1,149 +1,14 @@
1
1
  // src/nodes/generators/noise-billow-node.tsx
2
2
  import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
3
- import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
3
+ import { useCallback, useMemo } from "react";
4
4
  import { Billow } from "libnoise-ts/module/generator";
5
5
  import { useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
6
- import { nodeDataPropertyExcept as nodeDataPropertyExcept2 } from "@awesome-flow/core/abstract";
7
-
8
- // src/layout/node-property-variables.tsx
9
- import { useIncomingNodeData, useUpdateNodeData } from "@awesome-flow/core/hooks";
10
- import { useCallback, useEffect, useMemo, useState } from "react";
11
- import { Group, Stack } from "@mantine/core";
12
- import { getObjectKeys } from "@awesome-flow/core/utils";
13
- import { nodeDataPropertyExcept } from "@awesome-flow/core/abstract";
14
-
15
- // src/layout/node-value-input.tsx
16
- import { Input, NumberInput, Switch } from "@mantine/core";
17
- import { Fragment, jsx } from "react/jsx-runtime";
18
- function NodeValueInput({ value, disabled, step, onChange }) {
19
- if (value === void 0 || value === null) {
20
- return /* @__PURE__ */ jsx(Fragment, {});
21
- }
22
- switch (typeof value) {
23
- case "boolean": {
24
- return /* @__PURE__ */ jsx(
25
- Switch,
26
- {
27
- checked: value,
28
- disabled,
29
- onChange: (e) => onChange(e.currentTarget.checked)
30
- }
31
- );
32
- }
33
- case "number": {
34
- return /* @__PURE__ */ jsx(NumberInput, { value, disabled, step, onChange: (e) => onChange(e) });
35
- }
36
- case "string": {
37
- return /* @__PURE__ */ jsx(
38
- Input,
39
- {
40
- value,
41
- disabled,
42
- onChange: (e) => onChange(e.currentTarget.value)
43
- }
44
- );
45
- }
46
- default:
47
- throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);
48
- }
49
- }
50
- var node_value_input_default = NodeValueInput;
51
-
52
- // src/layout/node-property-input.tsx
53
- import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
54
- function NodePropertyInput({ property, onChange }) {
55
- if (!property) {
56
- return /* @__PURE__ */ jsx2(Fragment2, {});
57
- }
58
- return /* @__PURE__ */ jsx2(
59
- node_value_input_default,
60
- {
61
- value: property.value,
62
- disabled: property.disabled,
63
- step: property.step,
64
- onChange: (value) => onChange(property.name, value)
65
- }
66
- );
67
- }
68
- var node_property_input_default = NodePropertyInput;
69
-
70
- // src/layout/node-property-variables.tsx
71
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
72
- function NodePropertyVariables({
73
- data,
74
- nodeId,
75
- onPropertiesChange,
76
- except = nodeDataPropertyExcept
77
- }) {
78
- const [properties, setProperties] = useState(() => {
79
- const keys = getObjectKeys(data, except);
80
- const dataProps = {};
81
- for (const key of keys) {
82
- dataProps[key] = {
83
- name: key,
84
- value: data[key]
85
- };
86
- }
87
- return dataProps;
88
- });
89
- const updateNodeData = useUpdateNodeData();
90
- const incoming = useIncomingNodeData(nodeId);
91
- const resetAllDisabled = useCallback(() => {
92
- const keys = Object.keys(properties);
93
- keys.forEach((k) => {
94
- properties[k].disabled = false;
95
- });
96
- setProperties(properties);
97
- }, []);
98
- const updatePropertyValue = useCallback((name, value, disabled) => {
99
- let property = properties[name];
100
- if (property) {
101
- property.value = value;
102
- } else {
103
- property = {
104
- name,
105
- value
106
- };
107
- }
108
- property.disabled = disabled;
109
- setProperties({ ...properties, [name]: property });
110
- updateNodeData(nodeId, { [name]: value });
111
- }, []);
112
- useEffect(() => {
113
- resetAllDisabled();
114
- if (incoming?.length) {
115
- for (const connection of incoming) {
116
- if (connection.property && properties[connection.property.name] !== void 0) {
117
- updatePropertyValue(connection.property.name, connection.property.value, true);
118
- }
119
- }
120
- }
121
- }, [incoming]);
122
- useEffect(() => {
123
- if (onPropertiesChange) {
124
- onPropertiesChange(properties);
125
- }
126
- }, [onPropertiesChange, properties]);
127
- const nodes = useMemo(() => {
128
- return Object.keys(properties).map((key) => {
129
- const property = properties[key];
130
- return /* @__PURE__ */ jsxs(Group, { children: [
131
- property.name,
132
- ":",
133
- /* @__PURE__ */ jsx3(node_property_input_default, { property, onChange: updatePropertyValue })
134
- ] }, key);
135
- });
136
- }, [properties, updatePropertyValue]);
137
- return /* @__PURE__ */ jsx3(Stack, { children: nodes });
138
- }
139
- var node_property_variables_default = NodePropertyVariables;
140
-
141
- // src/nodes/generators/noise-billow-node.tsx
142
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
6
+ import { NodePropertyVariables } from "@awesome-flow/core/components";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
143
8
  function NoiseBillowNode({ id, selected, data, type }) {
144
9
  const updateComputedData = useUpdateNodeComputedData();
145
- const module = useMemo2(() => new Billow(), []);
146
- const onPropertiesChange = useCallback2(
10
+ const module = useMemo(() => new Billow(), []);
11
+ const onPropertiesChange = useCallback(
147
12
  (properties) => {
148
13
  Object.keys(properties).forEach((k) => {
149
14
  module[k] = properties[k].value;
@@ -152,65 +17,57 @@ function NoiseBillowNode({ id, selected, data, type }) {
152
17
  },
153
18
  [id, module, updateComputedData]
154
19
  );
155
- return /* @__PURE__ */ jsxs2(NodeContainer, { id, selected, data, type, children: [
156
- /* @__PURE__ */ jsx4(
157
- node_property_variables_default,
158
- {
159
- data,
160
- except: nodeDataPropertyExcept2,
161
- nodeId: id,
162
- onPropertiesChange
163
- }
164
- ),
165
- /* @__PURE__ */ jsx4(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
20
+ return /* @__PURE__ */ jsxs(NodeContainer, { id, selected, data, type, children: [
21
+ /* @__PURE__ */ jsx(NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
22
+ /* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
166
23
  ] });
167
24
  }
168
25
  var noise_billow_node_default = NoiseBillowNode;
169
26
 
170
27
  // src/nodes/generators/noise-checkerboard-node.tsx
171
28
  import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
172
- import { useEffect as useEffect2, useMemo as useMemo3 } from "react";
29
+ import { useEffect, useMemo as useMemo2 } from "react";
173
30
  import { Checkerboard } from "libnoise-ts/module/generator";
174
31
  import { useUpdateNodeComputedData as useUpdateNodeComputedData2 } from "@awesome-flow/core/hooks";
175
- import { jsx as jsx5 } from "react/jsx-runtime";
32
+ import { jsx as jsx2 } from "react/jsx-runtime";
176
33
  function NoiseCheckerboardNode({ id, selected, data, type }) {
177
34
  const updateComputedData = useUpdateNodeComputedData2();
178
- const module = useMemo3(() => new Checkerboard(), []);
179
- useEffect2(() => {
35
+ const module = useMemo2(() => new Checkerboard(), []);
36
+ useEffect(() => {
180
37
  updateComputedData(id, { module });
181
38
  }, [id, module, updateComputedData]);
182
- return /* @__PURE__ */ jsx5(NodeContainer2, { id, selected, data, type });
39
+ return /* @__PURE__ */ jsx2(NodeContainer2, { id, selected, data, type });
183
40
  }
184
41
  var noise_checkerboard_node_default = NoiseCheckerboardNode;
185
42
 
186
43
  // src/nodes/generators/noise-const-node.tsx
187
44
  import { NodeContainer as NodeContainer3 } from "@awesome-flow/core/layout";
188
- import { useEffect as useEffect3, useMemo as useMemo4, useState as useState2 } from "react";
189
- import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
190
- import { useUpdateNodeComputedData as useUpdateNodeComputedData3, useUpdateNodeData as useUpdateNodeData2 } from "@awesome-flow/core/hooks";
45
+ import { useEffect as useEffect2, useMemo as useMemo3, useState } from "react";
46
+ import { Group, NumberInput, Stack } from "@mantine/core";
47
+ import { useUpdateNodeComputedData as useUpdateNodeComputedData3, useUpdateNodeData } from "@awesome-flow/core/hooks";
191
48
  import { Const } from "libnoise-ts/module/generator";
192
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
49
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
193
50
  function NoiseConstNode({ id, selected, data, type }) {
194
- const [min, setMin] = useState2(data.min);
195
- const [max, setMax] = useState2(data.max);
196
- const [noise, setNoise] = useState2(data.noise);
197
- const updateNodeData = useUpdateNodeData2();
51
+ const [min, setMin] = useState(data.min);
52
+ const [max, setMax] = useState(data.max);
53
+ const [noise, setNoise] = useState(data.noise);
54
+ const updateNodeData = useUpdateNodeData();
198
55
  const updateComputedData = useUpdateNodeComputedData3();
199
- const module = useMemo4(() => new Const(), []);
200
- useEffect3(() => {
56
+ const module = useMemo3(() => new Const(), []);
57
+ useEffect2(() => {
201
58
  module.value = noise;
202
59
  updateNodeData(id, { noise, min, max });
203
60
  updateComputedData(id, { module });
204
61
  }, [noise, min, max, module, updateNodeData, id, updateComputedData]);
205
- return /* @__PURE__ */ jsx6(NodeContainer3, { id, selected, data, type, children: /* @__PURE__ */ jsxs3(Stack2, { children: [
206
- /* @__PURE__ */ jsxs3(Group2, { children: [
207
- /* @__PURE__ */ jsx6(NumberInput2, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
208
- /* @__PURE__ */ jsx6(NumberInput2, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
62
+ return /* @__PURE__ */ jsx3(NodeContainer3, { id, selected, data, type, children: /* @__PURE__ */ jsxs2(Stack, { children: [
63
+ /* @__PURE__ */ jsxs2(Group, { children: [
64
+ /* @__PURE__ */ jsx3(NumberInput, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
65
+ /* @__PURE__ */ jsx3(NumberInput, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
209
66
  ] }),
210
- /* @__PURE__ */ jsxs3(Group2, { children: [
67
+ /* @__PURE__ */ jsxs2(Group, { children: [
211
68
  "noise:",
212
- /* @__PURE__ */ jsx6(
213
- NumberInput2,
69
+ /* @__PURE__ */ jsx3(
70
+ NumberInput,
214
71
  {
215
72
  size: "xs",
216
73
  value: noise,
@@ -227,14 +84,15 @@ var noise_const_node_default = NoiseConstNode;
227
84
 
228
85
  // src/nodes/generators/noise-cylinders-node.tsx
229
86
  import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
230
- import { useCallback as useCallback3, useMemo as useMemo5 } from "react";
87
+ import { useCallback as useCallback2, useMemo as useMemo4 } from "react";
231
88
  import { Cylinders } from "libnoise-ts/module/generator";
232
89
  import { useUpdateNodeComputedData as useUpdateNodeComputedData4 } from "@awesome-flow/core/hooks";
233
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
90
+ import { NodePropertyVariables as NodePropertyVariables2 } from "@awesome-flow/core/components";
91
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
234
92
  function NoiseCylindersNode({ id, selected, data, type }) {
235
93
  const updateComputedData = useUpdateNodeComputedData4();
236
- const module = useMemo5(() => new Cylinders(), []);
237
- const onPropertiesChange = useCallback3(
94
+ const module = useMemo4(() => new Cylinders(), []);
95
+ const onPropertiesChange = useCallback2(
238
96
  (properties) => {
239
97
  Object.keys(properties).forEach((k) => {
240
98
  module[k] = properties[k].value;
@@ -243,23 +101,24 @@ function NoiseCylindersNode({ id, selected, data, type }) {
243
101
  },
244
102
  [id, module, updateComputedData]
245
103
  );
246
- return /* @__PURE__ */ jsxs4(NodeContainer4, { id, selected, data, type, children: [
247
- /* @__PURE__ */ jsx7(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
248
- /* @__PURE__ */ jsx7(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
104
+ return /* @__PURE__ */ jsxs3(NodeContainer4, { id, selected, data, type, children: [
105
+ /* @__PURE__ */ jsx4(NodePropertyVariables2, { data, nodeId: id, onPropertiesChange }),
106
+ /* @__PURE__ */ jsx4(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
249
107
  ] });
250
108
  }
251
109
  var noise_cylinders_node_default = NoiseCylindersNode;
252
110
 
253
111
  // src/nodes/generators/noise-perlin-node.tsx
254
112
  import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
255
- import { useCallback as useCallback4, useMemo as useMemo6 } from "react";
113
+ import { useCallback as useCallback3, useMemo as useMemo5 } from "react";
256
114
  import { Perlin } from "libnoise-ts/module/generator";
257
115
  import { useUpdateNodeComputedData as useUpdateNodeComputedData5 } from "@awesome-flow/core/hooks";
258
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
116
+ import { NodePropertyVariables as NodePropertyVariables3 } from "@awesome-flow/core/components";
117
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
259
118
  function NoisePerlinNode({ id, selected, data, type }) {
260
119
  const updateComputedData = useUpdateNodeComputedData5();
261
- const module = useMemo6(() => new Perlin(), []);
262
- const onPropertiesChange = useCallback4(
120
+ const module = useMemo5(() => new Perlin(), []);
121
+ const onPropertiesChange = useCallback3(
263
122
  (properties) => {
264
123
  Object.keys(properties).forEach((k) => {
265
124
  module[k] = properties[k].value;
@@ -268,36 +127,37 @@ function NoisePerlinNode({ id, selected, data, type }) {
268
127
  },
269
128
  [id, module, updateComputedData]
270
129
  );
271
- return /* @__PURE__ */ jsxs5(NodeContainer5, { id, selected, data, type, children: [
272
- /* @__PURE__ */ jsx8(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
273
- /* @__PURE__ */ jsx8(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
130
+ return /* @__PURE__ */ jsxs4(NodeContainer5, { id, selected, data, type, children: [
131
+ /* @__PURE__ */ jsx5(NodePropertyVariables3, { data, nodeId: id, onPropertiesChange }),
132
+ /* @__PURE__ */ jsx5(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
274
133
  ] });
275
134
  }
276
135
  var noise_perlin_node_default = NoisePerlinNode;
277
136
 
278
137
  // src/nodes/generators/noise-ridgedmulti-node.tsx
279
138
  import { NodeContainer as NodeContainer6, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
280
- import { useCallback as useCallback5, useMemo as useMemo7 } from "react";
139
+ import { useCallback as useCallback4, useMemo as useMemo6 } from "react";
281
140
  import { RidgedMulti } from "libnoise-ts/module/generator";
282
141
  import { useUpdateNodeComputedData as useUpdateNodeComputedData6 } from "@awesome-flow/core/hooks";
283
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
142
+ import { NodePropertyVariables as NodePropertyVariables4 } from "@awesome-flow/core/components";
143
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
284
144
  function NoiseRidgedMultiNode({ id, selected, data, type }) {
285
145
  const updateComputedData = useUpdateNodeComputedData6();
286
- const module = useMemo7(() => new RidgedMulti(), []);
287
- const onPropertiesChange = useCallback5((properties) => {
146
+ const module = useMemo6(() => new RidgedMulti(), []);
147
+ const onPropertiesChange = useCallback4((properties) => {
288
148
  Object.keys(properties).forEach((k) => module[k] = properties[k].value);
289
149
  updateComputedData(id, { module });
290
150
  }, []);
291
- return /* @__PURE__ */ jsxs6(NodeContainer6, { id, selected, data, type, children: [
292
- /* @__PURE__ */ jsx9(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
293
- /* @__PURE__ */ jsx9(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
151
+ return /* @__PURE__ */ jsxs5(NodeContainer6, { id, selected, data, type, children: [
152
+ /* @__PURE__ */ jsx6(NodePropertyVariables4, { data, nodeId: id, onPropertiesChange }),
153
+ /* @__PURE__ */ jsx6(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
294
154
  ] });
295
155
  }
296
156
  var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
297
157
 
298
158
  // src/nodes/generators/noise-simplex-node.tsx
299
159
  import { NodeContainer as NodeContainer7 } from "@awesome-flow/core/layout";
300
- import { useEffect as useEffect4, useMemo as useMemo8 } from "react";
160
+ import { useEffect as useEffect3, useMemo as useMemo7 } from "react";
301
161
  import { useUpdateNodeComputedData as useUpdateNodeComputedData7 } from "@awesome-flow/core/hooks";
302
162
 
303
163
  // src/modules/simplex-module.ts
@@ -315,46 +175,48 @@ var SimplexModule = class extends Module {
315
175
  };
316
176
 
317
177
  // src/nodes/generators/noise-simplex-node.tsx
318
- import { jsx as jsx10 } from "react/jsx-runtime";
178
+ import { jsx as jsx7 } from "react/jsx-runtime";
319
179
  function NoiseSimplexNode({ id, selected, data, type }) {
320
180
  const updateComputedData = useUpdateNodeComputedData7();
321
- const module = useMemo8(() => new SimplexModule(), []);
322
- useEffect4(() => {
181
+ const module = useMemo7(() => new SimplexModule(), []);
182
+ useEffect3(() => {
323
183
  updateComputedData(id, { module });
324
184
  }, []);
325
- return /* @__PURE__ */ jsx10(NodeContainer7, { id, selected, data, type });
185
+ return /* @__PURE__ */ jsx7(NodeContainer7, { id, selected, data, type });
326
186
  }
327
187
  var noise_simplex_node_default = NoiseSimplexNode;
328
188
 
329
189
  // src/nodes/generators/noise-spheres-node.tsx
330
190
  import { NodeContainer as NodeContainer8, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
331
- import { useCallback as useCallback6, useMemo as useMemo9 } from "react";
191
+ import { useCallback as useCallback5, useMemo as useMemo8 } from "react";
332
192
  import { Spheres } from "libnoise-ts/module/generator";
333
193
  import { useUpdateNodeComputedData as useUpdateNodeComputedData8 } from "@awesome-flow/core/hooks";
334
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
194
+ import { NodePropertyVariables as NodePropertyVariables5 } from "@awesome-flow/core/components";
195
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
335
196
  function NoiseSpheresNode({ id, selected, data, type }) {
336
197
  const updateComputedData = useUpdateNodeComputedData8();
337
- const module = useMemo9(() => new Spheres(), []);
338
- const onPropertiesChange = useCallback6((properties) => {
198
+ const module = useMemo8(() => new Spheres(), []);
199
+ const onPropertiesChange = useCallback5((properties) => {
339
200
  Object.keys(properties).forEach((k) => module[k] = properties[k].value);
340
201
  updateComputedData(id, { module });
341
202
  }, []);
342
- return /* @__PURE__ */ jsxs7(NodeContainer8, { id, selected, data, type, children: [
343
- /* @__PURE__ */ jsx11(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
344
- /* @__PURE__ */ jsx11(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
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" })
345
206
  ] });
346
207
  }
347
208
  var noise_spheres_node_default = NoiseSpheresNode;
348
209
 
349
210
  // src/nodes/generators/noise-voronoi-node.tsx
350
211
  import { NodeContainer as NodeContainer9, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
351
- import { useCallback as useCallback7 } from "react";
212
+ import { useCallback as useCallback6 } from "react";
352
213
  import { Voronoi } from "libnoise-ts/module/generator";
353
214
  import { useUpdateNodeComputedData as useUpdateNodeComputedData9 } from "@awesome-flow/core/hooks";
354
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
215
+ import { NodePropertyVariables as NodePropertyVariables6 } from "@awesome-flow/core/components";
216
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
355
217
  function NoiseVoronoiNode({ id, selected, data, type }) {
356
218
  const updateComputedData = useUpdateNodeComputedData9();
357
- const onPropertiesChange = useCallback7(
219
+ const onPropertiesChange = useCallback6(
358
220
  (properties) => {
359
221
  const module = new Voronoi(
360
222
  properties.frequency.value,
@@ -366,27 +228,27 @@ function NoiseVoronoiNode({ id, selected, data, type }) {
366
228
  },
367
229
  []
368
230
  );
369
- return /* @__PURE__ */ jsxs8(NodeContainer9, { id, selected, data, type, children: [
370
- /* @__PURE__ */ jsx12(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
371
- /* @__PURE__ */ jsx12(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" })
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" })
372
234
  ] });
373
235
  }
374
236
  var noise_voronoi_node_default = NoiseVoronoiNode;
375
237
 
376
238
  // src/nodes/generators/position-const-node.tsx
377
239
  import { NodeContainer as NodeContainer10 } from "@awesome-flow/core/layout";
378
- import { useEffect as useEffect5, useState as useState3 } from "react";
379
- import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
380
- import { useUpdateNodeComputedData as useUpdateNodeComputedData10, useUpdateNodeData as useUpdateNodeData3 } from "@awesome-flow/core/hooks";
381
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
240
+ import { useEffect as useEffect4, useState as useState2 } from "react";
241
+ 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";
382
244
  function PositionConstNode({ id, selected, data, type }) {
383
245
  const position = data.position ?? { x: 0, y: 0, z: 0 };
384
- const [x, setX] = useState3(position.x);
385
- const [y, setY] = useState3(position.y);
386
- const [z, setZ] = useState3(position.z);
387
- const updateNodeData = useUpdateNodeData3();
246
+ const [x, setX] = useState2(position.x);
247
+ const [y, setY] = useState2(position.y);
248
+ const [z, setZ] = useState2(position.z);
249
+ const updateNodeData = useUpdateNodeData2();
388
250
  const updateComputedData = useUpdateNodeComputedData10();
389
- useEffect5(() => {
251
+ useEffect4(() => {
390
252
  const position2 = { x, y, z };
391
253
  updateNodeData(id, {
392
254
  position: position2
@@ -395,18 +257,18 @@ function PositionConstNode({ id, selected, data, type }) {
395
257
  positions: [position2]
396
258
  });
397
259
  }, [x, y, z]);
398
- return /* @__PURE__ */ jsx13(NodeContainer10, { id, selected, data, type, children: /* @__PURE__ */ jsxs9(Stack3, { children: [
399
- /* @__PURE__ */ jsxs9(Group3, { children: [
260
+ return /* @__PURE__ */ jsx10(NodeContainer10, { id, selected, data, type, children: /* @__PURE__ */ jsxs8(Stack2, { children: [
261
+ /* @__PURE__ */ jsxs8(Group2, { children: [
400
262
  "x: ",
401
- /* @__PURE__ */ jsx13(NumberInput3, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
263
+ /* @__PURE__ */ jsx10(NumberInput2, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
402
264
  ] }),
403
- /* @__PURE__ */ jsxs9(Group3, { children: [
265
+ /* @__PURE__ */ jsxs8(Group2, { children: [
404
266
  "y: ",
405
- /* @__PURE__ */ jsx13(NumberInput3, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
267
+ /* @__PURE__ */ jsx10(NumberInput2, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
406
268
  ] }),
407
- /* @__PURE__ */ jsxs9(Group3, { children: [
269
+ /* @__PURE__ */ jsxs8(Group2, { children: [
408
270
  "z: ",
409
- /* @__PURE__ */ jsx13(NumberInput3, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
271
+ /* @__PURE__ */ jsx10(NumberInput2, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
410
272
  ] })
411
273
  ] }) });
412
274
  }
@@ -414,28 +276,28 @@ var position_const_node_default = PositionConstNode;
414
276
 
415
277
  // src/nodes/generators/position-grid-node.tsx
416
278
  import { NodeContainer as NodeContainer11 } from "@awesome-flow/core/layout";
417
- import { useEffect as useEffect6, useState as useState4 } from "react";
418
- import { Group as Group4, NumberInput as NumberInput4, Stack as Stack4 } from "@mantine/core";
419
- import { useUpdateNodeComputedData as useUpdateNodeComputedData11, useUpdateNodeData as useUpdateNodeData4 } from "@awesome-flow/core/hooks";
420
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
279
+ import { useEffect as useEffect5, useState as useState3 } from "react";
280
+ 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";
421
283
  function PositionGridNode({ id, selected, data, type }) {
422
- const [x, setX] = useState4(data.center?.x);
423
- const [y, setY] = useState4(data.center?.y);
424
- const [z, setZ] = useState4(data.center?.z);
425
- const [radius, setRadius] = useState4(data.radius);
426
- const updateNodeData = useUpdateNodeData4();
284
+ const [x, setX] = useState3(data.center?.x);
285
+ const [y, setY] = useState3(data.center?.y);
286
+ const [z, setZ] = useState3(data.center?.z);
287
+ const [radius, setRadius] = useState3(data.radius);
288
+ const updateNodeData = useUpdateNodeData3();
427
289
  const updateComputedData = useUpdateNodeComputedData11();
428
- useEffect6(() => {
290
+ useEffect5(() => {
429
291
  updateNodeData(id, {
430
292
  center: { x, y, z }
431
293
  });
432
294
  }, [x, y, z]);
433
- useEffect6(() => {
295
+ useEffect5(() => {
434
296
  updateNodeData(id, {
435
297
  radius
436
298
  });
437
299
  }, [radius]);
438
- useEffect6(() => {
300
+ useEffect5(() => {
439
301
  const positions = [];
440
302
  for (let i = -radius; i < radius; i++) {
441
303
  for (let j = -radius; j < radius; j++) {
@@ -446,134 +308,26 @@ function PositionGridNode({ id, selected, data, type }) {
446
308
  positions
447
309
  });
448
310
  }, [x, y, z, radius]);
449
- return /* @__PURE__ */ jsx14(NodeContainer11, { id, selected, data, type, children: /* @__PURE__ */ jsxs10(Stack4, { children: [
450
- /* @__PURE__ */ jsxs10(Group4, { children: [
311
+ return /* @__PURE__ */ jsx11(NodeContainer11, { id, selected, data, type, children: /* @__PURE__ */ jsxs9(Stack3, { children: [
312
+ /* @__PURE__ */ jsxs9(Group3, { children: [
451
313
  "x: ",
452
- /* @__PURE__ */ jsx14(NumberInput4, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
314
+ /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
453
315
  ] }),
454
- /* @__PURE__ */ jsxs10(Group4, { children: [
316
+ /* @__PURE__ */ jsxs9(Group3, { children: [
455
317
  "y: ",
456
- /* @__PURE__ */ jsx14(NumberInput4, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
318
+ /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
457
319
  ] }),
458
- /* @__PURE__ */ jsxs10(Group4, { children: [
320
+ /* @__PURE__ */ jsxs9(Group3, { children: [
459
321
  "z: ",
460
- /* @__PURE__ */ jsx14(NumberInput4, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
322
+ /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
461
323
  ] }),
462
- /* @__PURE__ */ jsxs10(Group4, { children: [
324
+ /* @__PURE__ */ jsxs9(Group3, { children: [
463
325
  "r: ",
464
- /* @__PURE__ */ jsx14(NumberInput4, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
326
+ /* @__PURE__ */ jsx11(NumberInput3, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
465
327
  ] })
466
328
  ] }) });
467
329
  }
468
330
  var position_grid_node_default = PositionGridNode;
469
-
470
- // src/nodes/generators/variable-property-node.tsx
471
- import { NodeCombobox, NodeContainer as NodeContainer12, NodeTrackConnections as NodeTrackConnections7 } from "@awesome-flow/core/layout";
472
- import { useCallback as useCallback8, useEffect as useEffect7, useState as useState5 } from "react";
473
- import { Stack as Stack5 } from "@mantine/core";
474
- import { useIncomingNodeData as useIncomingNodeData2, useOutgoingNodes, useUpdateNodeData as useUpdateNodeData5 } from "@awesome-flow/core/hooks";
475
- import { getObjectPropertyMap } from "@awesome-flow/core/utils";
476
- import { nodeDataPropertyExcept as nodeDataPropertyExcept3 } from "@awesome-flow/core/abstract";
477
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
478
- function VariablePropertyNode({
479
- id,
480
- selected,
481
- data,
482
- type
483
- }) {
484
- const [options, setOptions] = useState5({});
485
- const [selectedProperty, setSelectedProperty] = useState5(data.property);
486
- const updateNodeData = useUpdateNodeData5();
487
- const outgoing = useOutgoingNodes(id);
488
- const incoming = useIncomingNodeData2(id);
489
- useEffect7(() => {
490
- if (outgoing?.length) {
491
- const { data: data2 } = outgoing[0];
492
- const properties = getObjectPropertyMap(data2, nodeDataPropertyExcept3);
493
- setOptions(properties);
494
- if (!selectedProperty) {
495
- const keys = Object.keys(properties);
496
- if (keys.length) {
497
- setSelectedProperty({
498
- name: keys[0],
499
- value: properties[keys[0]]
500
- });
501
- }
502
- }
503
- } else {
504
- setSelectedProperty(null);
505
- }
506
- }, [outgoing]);
507
- useEffect7(() => {
508
- if (!incoming?.length && selectedProperty?.disabled) {
509
- setSelectedProperty({ ...selectedProperty, disabled: false });
510
- } else if (incoming?.length && selectedProperty) {
511
- const incomingValue = incoming[0].value;
512
- if (incomingValue !== void 0 && incomingValue !== null) {
513
- setSelectedProperty({
514
- name: selectedProperty.name,
515
- value: incomingValue,
516
- disabled: true
517
- });
518
- }
519
- }
520
- }, [incoming]);
521
- useEffect7(() => {
522
- if (selectedProperty) {
523
- updateNodeData(id, { property: selectedProperty });
524
- }
525
- }, [selectedProperty]);
526
- const onPropertyChange = useCallback8(
527
- (selected2) => {
528
- setSelectedProperty({
529
- name: selected2,
530
- value: options[selected2]
531
- });
532
- },
533
- [options]
534
- );
535
- const onValueChange = useCallback8((name, value) => {
536
- setSelectedProperty({
537
- name,
538
- value
539
- });
540
- }, []);
541
- return /* @__PURE__ */ jsxs11(NodeContainer12, { id, selected, data, type, children: [
542
- /* @__PURE__ */ jsxs11(Stack5, { align: "center", children: [
543
- /* @__PURE__ */ jsx15(
544
- NodeCombobox,
545
- {
546
- options,
547
- onChange: onPropertyChange,
548
- selected: selectedProperty?.name,
549
- hideListValues: true
550
- }
551
- ),
552
- /* @__PURE__ */ jsx15(node_property_input_default, { property: selectedProperty, onChange: onValueChange })
553
- ] }),
554
- /* @__PURE__ */ jsx15(NodeTrackConnections7, { handles: data.handles, nodeId: id })
555
- ] });
556
- }
557
- var variable_property_node_default = VariablePropertyNode;
558
-
559
- // src/nodes/generators/variable-value-node.tsx
560
- import { NodeContainer as NodeContainer13, NodeTrackConnections as NodeTrackConnections8 } from "@awesome-flow/core/layout";
561
- import { useCallback as useCallback9, useState as useState6 } from "react";
562
- import { useUpdateNodeData as useUpdateNodeData6 } from "@awesome-flow/core/hooks";
563
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
564
- function VariableValueNode({ id, selected, data, type }) {
565
- const [value, setValue] = useState6(data.value || 0);
566
- const updateNodeData = useUpdateNodeData6();
567
- const onValueChange = useCallback9((newValue) => {
568
- updateNodeData(id, { value: newValue });
569
- setValue(newValue);
570
- }, []);
571
- return /* @__PURE__ */ jsxs12(NodeContainer13, { id, selected, data, type, children: [
572
- /* @__PURE__ */ jsx16(node_value_input_default, { value, onChange: onValueChange }),
573
- /* @__PURE__ */ jsx16(NodeTrackConnections8, { handles: data.handles, nodeId: id, type: "source" })
574
- ] });
575
- }
576
- var variable_value_node_default = VariableValueNode;
577
331
  export {
578
332
  noise_billow_node_default as NoiseBillowNode,
579
333
  noise_checkerboard_node_default as NoiseCheckerboardNode,
@@ -585,8 +339,5 @@ export {
585
339
  noise_spheres_node_default as NoiseSpheresNode,
586
340
  noise_voronoi_node_default as NoiseVoronoiNode,
587
341
  position_const_node_default as PositionConstNode,
588
- position_grid_node_default as PositionGridNode,
589
- variable_property_node_default as VariablePropertyNode,
590
- variable_value_node_default as VariableValueNode
342
+ position_grid_node_default as PositionGridNode
591
343
  };
592
- //# sourceMappingURL=index.js.map