@awesome-flow/noise 0.7.0 → 0.7.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.
- package/dist/abstract/index.cjs +1 -3490
- package/dist/abstract/index.d.cts +2 -2
- package/dist/abstract/index.d.ts +2 -2
- package/dist/abstract/index.js +1 -3522
- package/dist/modules/index.cjs +1 -44
- package/dist/modules/index.js +1 -18
- package/dist/nodes/generators/index.cjs +1 -346
- package/dist/nodes/generators/index.d.cts +7 -7
- package/dist/nodes/generators/index.d.ts +7 -7
- package/dist/nodes/generators/index.js +1 -311
- package/dist/nodes/groups/index.cjs +1 -113
- package/dist/nodes/groups/index.d.cts +2 -2
- package/dist/nodes/groups/index.d.ts +2 -2
- package/dist/nodes/groups/index.js +1 -92
- package/dist/nodes/index.cjs +1 -3425
- package/dist/nodes/index.js +1 -3435
- package/dist/nodes/modifiers/index.cjs +1 -1478
- package/dist/nodes/modifiers/index.d.cts +6 -6
- package/dist/nodes/modifiers/index.d.ts +6 -6
- package/dist/nodes/modifiers/index.js +1 -1491
- package/dist/nodes/output/index.cjs +1 -1344
- package/dist/nodes/output/index.d.cts +3 -3
- package/dist/nodes/output/index.d.ts +3 -3
- package/dist/nodes/output/index.js +1 -1368
- package/dist/nodes/selectors/index.cjs +1 -1322
- package/dist/nodes/selectors/index.d.cts +1 -1
- package/dist/nodes/selectors/index.d.ts +1 -1
- package/dist/nodes/selectors/index.js +1 -1348
- package/dist/nodes/transformers/index.cjs +1 -337
- package/dist/nodes/transformers/index.d.cts +5 -5
- package/dist/nodes/transformers/index.d.ts +5 -5
- package/dist/nodes/transformers/index.js +1 -319
- package/dist/templates/generators/index.cjs +1 -1221
- package/dist/templates/generators/index.d.cts +5 -5
- package/dist/templates/generators/index.d.ts +5 -5
- package/dist/templates/generators/index.js +1 -1239
- package/dist/templates/groups/index.cjs +1 -1203
- package/dist/templates/groups/index.js +1 -1230
- package/dist/templates/index.cjs +1 -1263
- package/dist/templates/index.js +1 -1260
- package/dist/templates/modifiers/index.cjs +1 -1219
- package/dist/templates/modifiers/index.d.cts +9 -9
- package/dist/templates/modifiers/index.d.ts +9 -9
- package/dist/templates/modifiers/index.js +1 -1238
- package/dist/templates/output/index.cjs +1 -1209
- package/dist/templates/output/index.d.cts +3 -3
- package/dist/templates/output/index.d.ts +3 -3
- package/dist/templates/output/index.js +1 -1233
- package/dist/templates/selectors/index.cjs +1 -1205
- package/dist/templates/selectors/index.js +1 -1231
- package/dist/templates/transformers/index.cjs +1 -1211
- package/dist/templates/transformers/index.js +1 -1234
- package/package.json +9 -7
package/dist/nodes/index.js
CHANGED
|
@@ -1,3435 +1 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
28
|
-
var require_fast_deep_equal = __commonJS({
|
|
29
|
-
"../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
module.exports = function equal(a, b) {
|
|
32
|
-
if (a === b) return true;
|
|
33
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
34
|
-
if (a.constructor !== b.constructor) return false;
|
|
35
|
-
var length, i, keys;
|
|
36
|
-
if (Array.isArray(a)) {
|
|
37
|
-
length = a.length;
|
|
38
|
-
if (length != b.length) return false;
|
|
39
|
-
for (i = length; i-- !== 0; )
|
|
40
|
-
if (!equal(a[i], b[i])) return false;
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
44
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
45
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
46
|
-
keys = Object.keys(a);
|
|
47
|
-
length = keys.length;
|
|
48
|
-
if (length !== Object.keys(b).length) return false;
|
|
49
|
-
for (i = length; i-- !== 0; )
|
|
50
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
51
|
-
for (i = length; i-- !== 0; ) {
|
|
52
|
-
var key = keys[i];
|
|
53
|
-
if (!equal(a[key], b[key])) return false;
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
return a !== a && b !== b;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// src/nodes/generators/noise-billow-node.tsx
|
|
63
|
-
import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
|
|
64
|
-
import { useCallback, useMemo } from "react";
|
|
65
|
-
import { Billow } from "libnoise-simplex-ts";
|
|
66
|
-
import { useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
|
|
67
|
-
import { NodePropertyVariables } from "@awesome-flow/core/components";
|
|
68
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
69
|
-
function NoiseBillowNode({ id, selected, data, type }) {
|
|
70
|
-
const updateComputedData = useUpdateNodeComputedData();
|
|
71
|
-
const module = useMemo(() => new Billow(), []);
|
|
72
|
-
const onPropertiesChange = useCallback(
|
|
73
|
-
(properties) => {
|
|
74
|
-
Object.keys(properties).forEach((k) => {
|
|
75
|
-
module[k] = properties[k].value;
|
|
76
|
-
});
|
|
77
|
-
updateComputedData(id, { module });
|
|
78
|
-
},
|
|
79
|
-
[id, module, updateComputedData]
|
|
80
|
-
);
|
|
81
|
-
return /* @__PURE__ */ jsxs(NodeContainer, { id, selected, data, type, children: [
|
|
82
|
-
/* @__PURE__ */ jsx(NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
|
|
83
|
-
/* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
84
|
-
] });
|
|
85
|
-
}
|
|
86
|
-
var noise_billow_node_default = NoiseBillowNode;
|
|
87
|
-
|
|
88
|
-
// src/nodes/generators/noise-checkerboard-node.tsx
|
|
89
|
-
import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
|
|
90
|
-
import { useEffect, useMemo as useMemo2 } from "react";
|
|
91
|
-
import { Checkerboard } from "libnoise-simplex-ts";
|
|
92
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData2 } from "@awesome-flow/core/hooks";
|
|
93
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
94
|
-
function NoiseCheckerboardNode({ id, selected, data, type }) {
|
|
95
|
-
const updateComputedData = useUpdateNodeComputedData2();
|
|
96
|
-
const module = useMemo2(() => new Checkerboard(), []);
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
updateComputedData(id, { module });
|
|
99
|
-
}, [id, module, updateComputedData]);
|
|
100
|
-
return /* @__PURE__ */ jsx2(NodeContainer2, { id, selected, data, type });
|
|
101
|
-
}
|
|
102
|
-
var noise_checkerboard_node_default = NoiseCheckerboardNode;
|
|
103
|
-
|
|
104
|
-
// src/nodes/generators/noise-const-node.tsx
|
|
105
|
-
import { NodeContainer as NodeContainer3 } from "@awesome-flow/core/layout";
|
|
106
|
-
import { useEffect as useEffect2, useMemo as useMemo3, useState } from "react";
|
|
107
|
-
import { Group, NumberInput, Stack } from "@mantine/core";
|
|
108
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData3, useUpdateNodeData } from "@awesome-flow/core/hooks";
|
|
109
|
-
import { Const } from "libnoise-simplex-ts";
|
|
110
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
111
|
-
function NoiseConstNode({ id, selected, data, type }) {
|
|
112
|
-
const [min, setMin] = useState(data.min);
|
|
113
|
-
const [max, setMax] = useState(data.max);
|
|
114
|
-
const [noise, setNoise] = useState(data.noise);
|
|
115
|
-
const updateNodeData = useUpdateNodeData();
|
|
116
|
-
const updateComputedData = useUpdateNodeComputedData3();
|
|
117
|
-
const module = useMemo3(() => new Const(), []);
|
|
118
|
-
useEffect2(() => {
|
|
119
|
-
module.value = noise;
|
|
120
|
-
updateNodeData(id, { noise, min, max });
|
|
121
|
-
updateComputedData(id, { module });
|
|
122
|
-
}, [noise, min, max, module, updateNodeData, id, updateComputedData]);
|
|
123
|
-
return /* @__PURE__ */ jsx3(NodeContainer3, { id, selected, data, type, children: /* @__PURE__ */ jsxs2(Stack, { children: [
|
|
124
|
-
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
125
|
-
/* @__PURE__ */ jsx3(NumberInput, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
|
|
126
|
-
/* @__PURE__ */ jsx3(NumberInput, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
|
|
127
|
-
] }),
|
|
128
|
-
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
129
|
-
"noise:",
|
|
130
|
-
/* @__PURE__ */ jsx3(
|
|
131
|
-
NumberInput,
|
|
132
|
-
{
|
|
133
|
-
size: "xs",
|
|
134
|
-
value: noise,
|
|
135
|
-
onChange: (e) => setNoise(Number(e)),
|
|
136
|
-
max,
|
|
137
|
-
min,
|
|
138
|
-
step: 0.1
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
] })
|
|
142
|
-
] }) });
|
|
143
|
-
}
|
|
144
|
-
var noise_const_node_default = NoiseConstNode;
|
|
145
|
-
|
|
146
|
-
// src/nodes/generators/noise-cylinders-node.tsx
|
|
147
|
-
import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
|
|
148
|
-
import { useCallback as useCallback2, useMemo as useMemo4 } from "react";
|
|
149
|
-
import { Cylinders } from "libnoise-simplex-ts";
|
|
150
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData4 } from "@awesome-flow/core/hooks";
|
|
151
|
-
import { NodePropertyVariables as NodePropertyVariables2 } from "@awesome-flow/core/components";
|
|
152
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
153
|
-
function NoiseCylindersNode({ id, selected, data, type }) {
|
|
154
|
-
const updateComputedData = useUpdateNodeComputedData4();
|
|
155
|
-
const module = useMemo4(() => new Cylinders(), []);
|
|
156
|
-
const onPropertiesChange = useCallback2(
|
|
157
|
-
(properties) => {
|
|
158
|
-
Object.keys(properties).forEach((k) => {
|
|
159
|
-
module[k] = properties[k].value;
|
|
160
|
-
});
|
|
161
|
-
updateComputedData(id, { module });
|
|
162
|
-
},
|
|
163
|
-
[id, module, updateComputedData]
|
|
164
|
-
);
|
|
165
|
-
return /* @__PURE__ */ jsxs3(NodeContainer4, { id, selected, data, type, children: [
|
|
166
|
-
/* @__PURE__ */ jsx4(NodePropertyVariables2, { data, nodeId: id, onPropertiesChange }),
|
|
167
|
-
/* @__PURE__ */ jsx4(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
|
|
168
|
-
] });
|
|
169
|
-
}
|
|
170
|
-
var noise_cylinders_node_default = NoiseCylindersNode;
|
|
171
|
-
|
|
172
|
-
// src/nodes/generators/noise-perlin-node.tsx
|
|
173
|
-
import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
|
|
174
|
-
import { useCallback as useCallback3, useMemo as useMemo5 } from "react";
|
|
175
|
-
import { Perlin } from "libnoise-simplex-ts";
|
|
176
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData5 } from "@awesome-flow/core/hooks";
|
|
177
|
-
import { NodePropertyVariables as NodePropertyVariables3 } from "@awesome-flow/core/components";
|
|
178
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
179
|
-
function NoisePerlinNode({ id, selected, data, type }) {
|
|
180
|
-
const updateComputedData = useUpdateNodeComputedData5();
|
|
181
|
-
const module = useMemo5(() => new Perlin(), []);
|
|
182
|
-
const onPropertiesChange = useCallback3(
|
|
183
|
-
(properties) => {
|
|
184
|
-
Object.keys(properties).forEach((k) => {
|
|
185
|
-
module[k] = properties[k].value;
|
|
186
|
-
});
|
|
187
|
-
updateComputedData(id, { module });
|
|
188
|
-
},
|
|
189
|
-
[id, module, updateComputedData]
|
|
190
|
-
);
|
|
191
|
-
return /* @__PURE__ */ jsxs4(NodeContainer5, { id, selected, data, type, children: [
|
|
192
|
-
/* @__PURE__ */ jsx5(NodePropertyVariables3, { data, nodeId: id, onPropertiesChange }),
|
|
193
|
-
/* @__PURE__ */ jsx5(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
|
|
194
|
-
] });
|
|
195
|
-
}
|
|
196
|
-
var noise_perlin_node_default = NoisePerlinNode;
|
|
197
|
-
|
|
198
|
-
// src/nodes/generators/noise-ridgedmulti-node.tsx
|
|
199
|
-
import { NodeContainer as NodeContainer6, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
|
|
200
|
-
import { useCallback as useCallback4, useMemo as useMemo6 } from "react";
|
|
201
|
-
import { RidgedMulti } from "libnoise-simplex-ts";
|
|
202
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData6 } from "@awesome-flow/core/hooks";
|
|
203
|
-
import { NodePropertyVariables as NodePropertyVariables4 } from "@awesome-flow/core/components";
|
|
204
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
205
|
-
function NoiseRidgedMultiNode({ id, selected, data, type }) {
|
|
206
|
-
const updateComputedData = useUpdateNodeComputedData6();
|
|
207
|
-
const module = useMemo6(() => new RidgedMulti(), []);
|
|
208
|
-
const onPropertiesChange = useCallback4((properties) => {
|
|
209
|
-
Object.keys(properties).forEach((k) => module[k] = properties[k].value);
|
|
210
|
-
updateComputedData(id, { module });
|
|
211
|
-
}, []);
|
|
212
|
-
return /* @__PURE__ */ jsxs5(NodeContainer6, { id, selected, data, type, children: [
|
|
213
|
-
/* @__PURE__ */ jsx6(NodePropertyVariables4, { data, nodeId: id, onPropertiesChange }),
|
|
214
|
-
/* @__PURE__ */ jsx6(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
|
|
215
|
-
] });
|
|
216
|
-
}
|
|
217
|
-
var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
|
|
218
|
-
|
|
219
|
-
// src/nodes/generators/noise-spheres-node.tsx
|
|
220
|
-
import { NodeContainer as NodeContainer7, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
|
|
221
|
-
import { useCallback as useCallback5, useMemo as useMemo7 } from "react";
|
|
222
|
-
import { Spheres } from "libnoise-simplex-ts";
|
|
223
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData7 } from "@awesome-flow/core/hooks";
|
|
224
|
-
import { NodePropertyVariables as NodePropertyVariables5 } from "@awesome-flow/core/components";
|
|
225
|
-
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
226
|
-
function NoiseSpheresNode({ id, selected, data, type }) {
|
|
227
|
-
const updateComputedData = useUpdateNodeComputedData7();
|
|
228
|
-
const module = useMemo7(() => new Spheres(), []);
|
|
229
|
-
const onPropertiesChange = useCallback5((properties) => {
|
|
230
|
-
Object.keys(properties).forEach((k) => module[k] = properties[k].value);
|
|
231
|
-
updateComputedData(id, { module });
|
|
232
|
-
}, []);
|
|
233
|
-
return /* @__PURE__ */ jsxs6(NodeContainer7, { id, selected, data, type, children: [
|
|
234
|
-
/* @__PURE__ */ jsx7(NodePropertyVariables5, { data, nodeId: id, onPropertiesChange }),
|
|
235
|
-
/* @__PURE__ */ jsx7(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
|
|
236
|
-
] });
|
|
237
|
-
}
|
|
238
|
-
var noise_spheres_node_default = NoiseSpheresNode;
|
|
239
|
-
|
|
240
|
-
// src/nodes/generators/noise-voronoi-node.tsx
|
|
241
|
-
import { NodeContainer as NodeContainer8, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
|
|
242
|
-
import { useCallback as useCallback6 } from "react";
|
|
243
|
-
import { Voronoi } from "libnoise-simplex-ts";
|
|
244
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData8 } from "@awesome-flow/core/hooks";
|
|
245
|
-
import { NodePropertyVariables as NodePropertyVariables6 } from "@awesome-flow/core/components";
|
|
246
|
-
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
247
|
-
function NoiseVoronoiNode({ id, selected, data, type }) {
|
|
248
|
-
const updateComputedData = useUpdateNodeComputedData8();
|
|
249
|
-
const onPropertiesChange = useCallback6(
|
|
250
|
-
(properties) => {
|
|
251
|
-
const module = new Voronoi(
|
|
252
|
-
properties.frequency.value,
|
|
253
|
-
properties.displacement.value,
|
|
254
|
-
properties.distance.value,
|
|
255
|
-
properties.seed.value
|
|
256
|
-
);
|
|
257
|
-
updateComputedData(id, { module });
|
|
258
|
-
},
|
|
259
|
-
[]
|
|
260
|
-
);
|
|
261
|
-
return /* @__PURE__ */ jsxs7(NodeContainer8, { id, selected, data, type, children: [
|
|
262
|
-
/* @__PURE__ */ jsx8(NodePropertyVariables6, { data, nodeId: id, onPropertiesChange }),
|
|
263
|
-
/* @__PURE__ */ jsx8(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" })
|
|
264
|
-
] });
|
|
265
|
-
}
|
|
266
|
-
var noise_voronoi_node_default = NoiseVoronoiNode;
|
|
267
|
-
|
|
268
|
-
// src/nodes/generators/position-const-node.tsx
|
|
269
|
-
import { NodeContainer as NodeContainer9 } from "@awesome-flow/core/layout";
|
|
270
|
-
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
271
|
-
import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
|
|
272
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData9, useUpdateNodeData as useUpdateNodeData2 } from "@awesome-flow/core/hooks";
|
|
273
|
-
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
274
|
-
function PositionConstNode({ id, selected, data, type }) {
|
|
275
|
-
const position = data.position ?? { x: 0, y: 0, z: 0 };
|
|
276
|
-
const [x, setX] = useState2(position.x);
|
|
277
|
-
const [y, setY] = useState2(position.y);
|
|
278
|
-
const [z, setZ] = useState2(position.z);
|
|
279
|
-
const updateNodeData = useUpdateNodeData2();
|
|
280
|
-
const updateComputedData = useUpdateNodeComputedData9();
|
|
281
|
-
useEffect3(() => {
|
|
282
|
-
const position2 = { x, y, z };
|
|
283
|
-
updateNodeData(id, {
|
|
284
|
-
position: position2
|
|
285
|
-
});
|
|
286
|
-
updateComputedData(id, {
|
|
287
|
-
positions: [position2]
|
|
288
|
-
});
|
|
289
|
-
}, [x, y, z]);
|
|
290
|
-
return /* @__PURE__ */ jsx9(NodeContainer9, { id, selected, data, type, children: /* @__PURE__ */ jsxs8(Stack2, { children: [
|
|
291
|
-
/* @__PURE__ */ jsxs8(Group2, { children: [
|
|
292
|
-
"x: ",
|
|
293
|
-
/* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
294
|
-
] }),
|
|
295
|
-
/* @__PURE__ */ jsxs8(Group2, { children: [
|
|
296
|
-
"y: ",
|
|
297
|
-
/* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
298
|
-
] }),
|
|
299
|
-
/* @__PURE__ */ jsxs8(Group2, { children: [
|
|
300
|
-
"z: ",
|
|
301
|
-
/* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
302
|
-
] })
|
|
303
|
-
] }) });
|
|
304
|
-
}
|
|
305
|
-
var position_const_node_default = PositionConstNode;
|
|
306
|
-
|
|
307
|
-
// src/nodes/generators/position-grid-node.tsx
|
|
308
|
-
import { NodeContainer as NodeContainer10 } from "@awesome-flow/core/layout";
|
|
309
|
-
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
310
|
-
import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
|
|
311
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData10, useUpdateNodeData as useUpdateNodeData3 } from "@awesome-flow/core/hooks";
|
|
312
|
-
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
313
|
-
function PositionGridNode({ id, selected, data, type }) {
|
|
314
|
-
const [x, setX] = useState3(data.center?.x);
|
|
315
|
-
const [y, setY] = useState3(data.center?.y);
|
|
316
|
-
const [z, setZ] = useState3(data.center?.z);
|
|
317
|
-
const [radius, setRadius] = useState3(data.radius);
|
|
318
|
-
const updateNodeData = useUpdateNodeData3();
|
|
319
|
-
const updateComputedData = useUpdateNodeComputedData10();
|
|
320
|
-
useEffect4(() => {
|
|
321
|
-
updateNodeData(id, {
|
|
322
|
-
center: { x, y, z }
|
|
323
|
-
});
|
|
324
|
-
}, [x, y, z]);
|
|
325
|
-
useEffect4(() => {
|
|
326
|
-
updateNodeData(id, {
|
|
327
|
-
radius
|
|
328
|
-
});
|
|
329
|
-
}, [radius]);
|
|
330
|
-
useEffect4(() => {
|
|
331
|
-
const positions = [];
|
|
332
|
-
for (let i = -radius; i < radius; i++) {
|
|
333
|
-
for (let j = -radius; j < radius; j++) {
|
|
334
|
-
positions.push({ x: x + i, y: y + j, z });
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
updateComputedData(id, {
|
|
338
|
-
positions
|
|
339
|
-
});
|
|
340
|
-
}, [x, y, z, radius]);
|
|
341
|
-
return /* @__PURE__ */ jsx10(NodeContainer10, { id, selected, data, type, children: /* @__PURE__ */ jsxs9(Stack3, { children: [
|
|
342
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
343
|
-
"x: ",
|
|
344
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
345
|
-
] }),
|
|
346
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
347
|
-
"y: ",
|
|
348
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
349
|
-
] }),
|
|
350
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
351
|
-
"z: ",
|
|
352
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
353
|
-
] }),
|
|
354
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
355
|
-
"r: ",
|
|
356
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
|
|
357
|
-
] })
|
|
358
|
-
] }) });
|
|
359
|
-
}
|
|
360
|
-
var position_grid_node_default = PositionGridNode;
|
|
361
|
-
|
|
362
|
-
// src/nodes/groups/module-group-node.tsx
|
|
363
|
-
import { NodeContainer as NodeContainer11, NodeCollapse, NodeTrackConnections as NodeTrackConnections7 } from "@awesome-flow/core/layout";
|
|
364
|
-
import { NodeResizer, useStore, useUpdateNodeInternals } from "@xyflow/react";
|
|
365
|
-
import { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo8 } from "react";
|
|
366
|
-
import { shallow } from "zustand/shallow";
|
|
367
|
-
import { Badge, Group as Group4 } from "@mantine/core";
|
|
368
|
-
import {
|
|
369
|
-
useFlowStore,
|
|
370
|
-
useIncomingComputedData,
|
|
371
|
-
useInteractiveStore,
|
|
372
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData11
|
|
373
|
-
} from "@awesome-flow/core/hooks";
|
|
374
|
-
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
375
|
-
function ModuleGroupNode({
|
|
376
|
-
id,
|
|
377
|
-
selected,
|
|
378
|
-
data,
|
|
379
|
-
type,
|
|
380
|
-
width,
|
|
381
|
-
height
|
|
382
|
-
}) {
|
|
383
|
-
const updateNodeInternals = useUpdateNodeInternals();
|
|
384
|
-
const triggerNodeChanges = useStore((s) => s.triggerNodeChanges);
|
|
385
|
-
const { groupNodes, setGroupCollapsed } = useFlowStore(
|
|
386
|
-
useCallback7(
|
|
387
|
-
(state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
|
|
388
|
-
[]
|
|
389
|
-
)
|
|
390
|
-
);
|
|
391
|
-
const intersectingNode = useInteractiveStore(
|
|
392
|
-
useCallback7((state) => state.nodeIntersectionTargets[id], [id]),
|
|
393
|
-
shallow
|
|
394
|
-
);
|
|
395
|
-
useEffect5(() => {
|
|
396
|
-
updateNodeInternals(id);
|
|
397
|
-
}, [width, height]);
|
|
398
|
-
useEffect5(() => {
|
|
399
|
-
triggerNodeChanges([
|
|
400
|
-
{
|
|
401
|
-
id,
|
|
402
|
-
type: "select",
|
|
403
|
-
selected: !!intersectingNode
|
|
404
|
-
}
|
|
405
|
-
]);
|
|
406
|
-
}, [intersectingNode]);
|
|
407
|
-
const onCollapsed = useCallback7((collapsed) => {
|
|
408
|
-
setGroupCollapsed(id, collapsed);
|
|
409
|
-
}, []);
|
|
410
|
-
const size = useMemo8(() => {
|
|
411
|
-
return {
|
|
412
|
-
width: data.initialSize?.width || 100,
|
|
413
|
-
height: data.initialSize?.height || 50
|
|
414
|
-
};
|
|
415
|
-
}, [data.initialSize]);
|
|
416
|
-
const incomingModules = useIncomingComputedData(id);
|
|
417
|
-
const updateComputedData = useUpdateNodeComputedData11();
|
|
418
|
-
useEffect5(() => {
|
|
419
|
-
if (incomingModules?.length) {
|
|
420
|
-
const { module } = incomingModules[0];
|
|
421
|
-
updateComputedData(id, { module });
|
|
422
|
-
}
|
|
423
|
-
}, [incomingModules]);
|
|
424
|
-
return /* @__PURE__ */ jsxs10(
|
|
425
|
-
NodeContainer11,
|
|
426
|
-
{
|
|
427
|
-
id,
|
|
428
|
-
selected,
|
|
429
|
-
data,
|
|
430
|
-
title: /* @__PURE__ */ jsx11(Group4, { justify: "space-between", children: /* @__PURE__ */ jsxs10(Group4, { gap: "xs", children: [
|
|
431
|
-
/* @__PURE__ */ jsx11(Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
|
|
432
|
-
/* @__PURE__ */ jsx11(NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
|
|
433
|
-
] }) }),
|
|
434
|
-
type,
|
|
435
|
-
children: [
|
|
436
|
-
/* @__PURE__ */ jsx11(
|
|
437
|
-
NodeResizer,
|
|
438
|
-
{
|
|
439
|
-
nodeId: id,
|
|
440
|
-
minWidth: size.width,
|
|
441
|
-
minHeight: size.height,
|
|
442
|
-
isVisible: selected && !data.isCollapsed
|
|
443
|
-
}
|
|
444
|
-
),
|
|
445
|
-
/* @__PURE__ */ jsx11(NodeTrackConnections7, { handles: data.handles, nodeId: id, type: "target" })
|
|
446
|
-
]
|
|
447
|
-
}
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
var module_group_node_default = ModuleGroupNode;
|
|
451
|
-
|
|
452
|
-
// src/nodes/modifiers/noise-abs-node.tsx
|
|
453
|
-
import { NodeContainer as NodeContainer12, NodeTrackConnections as NodeTrackConnections8 } from "@awesome-flow/core/layout";
|
|
454
|
-
import { useEffect as useEffect6 } from "react";
|
|
455
|
-
import { useIncomingComputedData as useIncomingComputedData2, useUpdateNodeComputedData as useUpdateNodeComputedData12 } from "@awesome-flow/core/hooks";
|
|
456
|
-
import { Abs } from "libnoise-simplex-ts";
|
|
457
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
458
|
-
function NoiseAbsNode({ id, selected, data, type }) {
|
|
459
|
-
const incoming = useIncomingComputedData2(id);
|
|
460
|
-
const updateComputedData = useUpdateNodeComputedData12();
|
|
461
|
-
useEffect6(() => {
|
|
462
|
-
if (incoming?.length > 0) {
|
|
463
|
-
const module = new Abs(incoming[0].module);
|
|
464
|
-
updateComputedData(id, { module });
|
|
465
|
-
}
|
|
466
|
-
}, [incoming]);
|
|
467
|
-
return /* @__PURE__ */ jsx12(NodeContainer12, { id, selected, data, type, children: /* @__PURE__ */ jsx12(NodeTrackConnections8, { handles: data.handles, nodeId: id, type: "target" }) });
|
|
468
|
-
}
|
|
469
|
-
var noise_abs_node_default = NoiseAbsNode;
|
|
470
|
-
|
|
471
|
-
// src/nodes/modifiers/noise-clamp-node.tsx
|
|
472
|
-
import { NodeContainer as NodeContainer13, NodeTrackConnections as NodeTrackConnections9 } from "@awesome-flow/core/layout";
|
|
473
|
-
import { useEffect as useEffect7, useState as useState4 } from "react";
|
|
474
|
-
import { Group as Group5, NumberInput as NumberInput4, Stack as Stack4 } from "@mantine/core";
|
|
475
|
-
import {
|
|
476
|
-
useIncomingComputedData as useIncomingComputedData3,
|
|
477
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData13,
|
|
478
|
-
useUpdateNodeData as useUpdateNodeData4
|
|
479
|
-
} from "@awesome-flow/core/hooks";
|
|
480
|
-
import { Clamp } from "libnoise-simplex-ts";
|
|
481
|
-
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
482
|
-
function NoiseClampNode({ id, selected, data, type }) {
|
|
483
|
-
const [lowerBound, setLowerBound] = useState4(data.lowerBound);
|
|
484
|
-
const [upperBound, setUpperBound] = useState4(data.upperBound);
|
|
485
|
-
const incoming = useIncomingComputedData3(id);
|
|
486
|
-
const updateNodeData = useUpdateNodeData4();
|
|
487
|
-
const updateComputedData = useUpdateNodeComputedData13();
|
|
488
|
-
useEffect7(() => {
|
|
489
|
-
if (incoming?.length) {
|
|
490
|
-
const module = new Clamp(incoming[0].module, lowerBound, upperBound);
|
|
491
|
-
updateComputedData(id, { module });
|
|
492
|
-
}
|
|
493
|
-
updateNodeData(id, { lowerBound, upperBound });
|
|
494
|
-
}, [incoming, lowerBound, upperBound]);
|
|
495
|
-
return /* @__PURE__ */ jsxs11(NodeContainer13, { id, selected, data, type, children: [
|
|
496
|
-
/* @__PURE__ */ jsx13(Stack4, { children: /* @__PURE__ */ jsxs11(Group5, { children: [
|
|
497
|
-
/* @__PURE__ */ jsx13(
|
|
498
|
-
NumberInput4,
|
|
499
|
-
{
|
|
500
|
-
size: "xs",
|
|
501
|
-
w: 100,
|
|
502
|
-
value: lowerBound,
|
|
503
|
-
onChange: (e) => setLowerBound(Number(e)),
|
|
504
|
-
step: 0.1
|
|
505
|
-
}
|
|
506
|
-
),
|
|
507
|
-
/* @__PURE__ */ jsx13(
|
|
508
|
-
NumberInput4,
|
|
509
|
-
{
|
|
510
|
-
size: "xs",
|
|
511
|
-
w: 100,
|
|
512
|
-
value: upperBound,
|
|
513
|
-
onChange: (e) => setUpperBound(Number(e)),
|
|
514
|
-
step: 0.1
|
|
515
|
-
}
|
|
516
|
-
)
|
|
517
|
-
] }) }),
|
|
518
|
-
/* @__PURE__ */ jsx13(NodeTrackConnections9, { handles: data.handles, nodeId: id, type: "target" })
|
|
519
|
-
] });
|
|
520
|
-
}
|
|
521
|
-
var noise_clamp_node_default = NoiseClampNode;
|
|
522
|
-
|
|
523
|
-
// src/nodes/modifiers/noise-combine-node.tsx
|
|
524
|
-
import { NodeCombobox, NodeContainer as NodeContainer14, NodeTrackConnections as NodeTrackConnections10 } from "@awesome-flow/core/layout";
|
|
525
|
-
import { useCallback as useCallback8, useEffect as useEffect8 } from "react";
|
|
526
|
-
import {
|
|
527
|
-
useIncomingComputedData as useIncomingComputedData4,
|
|
528
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData14,
|
|
529
|
-
useUpdateNodeData as useUpdateNodeData5
|
|
530
|
-
} from "@awesome-flow/core/hooks";
|
|
531
|
-
import {
|
|
532
|
-
IconAsterisk,
|
|
533
|
-
IconChevronLeft,
|
|
534
|
-
IconChevronRight,
|
|
535
|
-
IconChevronUp,
|
|
536
|
-
IconPlus
|
|
537
|
-
} from "@tabler/icons-react";
|
|
538
|
-
|
|
539
|
-
// src/abstract/operations.ts
|
|
540
|
-
import { Add, Max, Min, Multiply, Power } from "libnoise-simplex-ts";
|
|
541
|
-
var noiseCombineModuleMap = {
|
|
542
|
-
["add" /* add */]: Add,
|
|
543
|
-
["max" /* max */]: Max,
|
|
544
|
-
["min" /* min */]: Min,
|
|
545
|
-
["multiply" /* multiply */]: Multiply,
|
|
546
|
-
["power" /* power */]: Power
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
// src/nodes/modifiers/noise-combine-node.tsx
|
|
550
|
-
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
551
|
-
var options = {
|
|
552
|
-
add: /* @__PURE__ */ jsx14(IconPlus, {}),
|
|
553
|
-
min: /* @__PURE__ */ jsx14(IconChevronLeft, {}),
|
|
554
|
-
max: /* @__PURE__ */ jsx14(IconChevronRight, {}),
|
|
555
|
-
multiply: /* @__PURE__ */ jsx14(IconAsterisk, {}),
|
|
556
|
-
power: /* @__PURE__ */ jsx14(IconChevronUp, {})
|
|
557
|
-
};
|
|
558
|
-
function NoiseCombineNode({ id, selected, data, type }) {
|
|
559
|
-
const updateNodeData = useUpdateNodeData5();
|
|
560
|
-
const updateComputedData = useUpdateNodeComputedData14();
|
|
561
|
-
const incoming = useIncomingComputedData4(id);
|
|
562
|
-
useEffect8(() => {
|
|
563
|
-
const ModuleFactory = noiseCombineModuleMap[data.operation];
|
|
564
|
-
if (incoming?.length > 1) {
|
|
565
|
-
const module = new ModuleFactory(incoming[0].module, incoming[1].module);
|
|
566
|
-
updateComputedData(id, { module });
|
|
567
|
-
}
|
|
568
|
-
}, [data.operation, incoming]);
|
|
569
|
-
const onChange = useCallback8((operation) => {
|
|
570
|
-
updateNodeData(id, { operation });
|
|
571
|
-
}, []);
|
|
572
|
-
return /* @__PURE__ */ jsxs12(NodeContainer14, { id, selected, data, type, children: [
|
|
573
|
-
/* @__PURE__ */ jsx14(NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
|
|
574
|
-
/* @__PURE__ */ jsx14(NodeTrackConnections10, { handles: data.handles, nodeId: id, type: "target" })
|
|
575
|
-
] });
|
|
576
|
-
}
|
|
577
|
-
var noise_combine_node_default = NoiseCombineNode;
|
|
578
|
-
|
|
579
|
-
// src/nodes/modifiers/noise-curve-node.tsx
|
|
580
|
-
import { NodeContainer as NodeContainer15, NodeTrackConnections as NodeTrackConnections11 } from "@awesome-flow/core/layout";
|
|
581
|
-
import { ActionIcon, Button, Group as Group6, NumberInput as NumberInput5, Space } from "@mantine/core";
|
|
582
|
-
import {
|
|
583
|
-
useIncomingComputedData as useIncomingComputedData5,
|
|
584
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData15,
|
|
585
|
-
useUpdateNodeData as useUpdateNodeData6
|
|
586
|
-
} from "@awesome-flow/core/hooks";
|
|
587
|
-
|
|
588
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
|
|
589
|
-
import { useState as useState8, useCallback as useCallback14 } from "react";
|
|
590
|
-
|
|
591
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/actions/actions.mjs
|
|
592
|
-
import { useLayoutEffect, useEffect as useEffect9 } from "react";
|
|
593
|
-
function validateFormName(name) {
|
|
594
|
-
if (!/^[0-9a-zA-Z-]+$/.test(name)) {
|
|
595
|
-
throw new Error(
|
|
596
|
-
`[@mantine/use-form] Form name "${name}" is invalid, it should contain only letters, numbers and dashes`
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
var useIsomorphicEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect9;
|
|
601
|
-
function useFormEvent(eventKey, handler) {
|
|
602
|
-
useIsomorphicEffect(() => {
|
|
603
|
-
if (eventKey) {
|
|
604
|
-
window.addEventListener(eventKey, handler);
|
|
605
|
-
return () => window.removeEventListener(eventKey, handler);
|
|
606
|
-
}
|
|
607
|
-
return void 0;
|
|
608
|
-
}, [eventKey]);
|
|
609
|
-
}
|
|
610
|
-
function useFormActions(name, form) {
|
|
611
|
-
if (name) {
|
|
612
|
-
validateFormName(name);
|
|
613
|
-
}
|
|
614
|
-
useFormEvent(
|
|
615
|
-
`mantine-form:${name}:set-field-value`,
|
|
616
|
-
(event) => form.setFieldValue(event.detail.path, event.detail.value)
|
|
617
|
-
);
|
|
618
|
-
useFormEvent(
|
|
619
|
-
`mantine-form:${name}:set-values`,
|
|
620
|
-
(event) => form.setValues(event.detail)
|
|
621
|
-
);
|
|
622
|
-
useFormEvent(
|
|
623
|
-
`mantine-form:${name}:set-initial-values`,
|
|
624
|
-
(event) => form.setInitialValues(event.detail)
|
|
625
|
-
);
|
|
626
|
-
useFormEvent(
|
|
627
|
-
`mantine-form:${name}:set-errors`,
|
|
628
|
-
(event) => form.setErrors(event.detail)
|
|
629
|
-
);
|
|
630
|
-
useFormEvent(
|
|
631
|
-
`mantine-form:${name}:set-field-error`,
|
|
632
|
-
(event) => form.setFieldError(event.detail.path, event.detail.error)
|
|
633
|
-
);
|
|
634
|
-
useFormEvent(
|
|
635
|
-
`mantine-form:${name}:clear-field-error`,
|
|
636
|
-
(event) => form.clearFieldError(event.detail)
|
|
637
|
-
);
|
|
638
|
-
useFormEvent(`mantine-form:${name}:clear-errors`, form.clearErrors);
|
|
639
|
-
useFormEvent(`mantine-form:${name}:reset`, form.reset);
|
|
640
|
-
useFormEvent(`mantine-form:${name}:validate`, form.validate);
|
|
641
|
-
useFormEvent(
|
|
642
|
-
`mantine-form:${name}:validate-field`,
|
|
643
|
-
(event) => form.validateField(event.detail)
|
|
644
|
-
);
|
|
645
|
-
useFormEvent(
|
|
646
|
-
`mantine-form:${name}:reorder-list-item`,
|
|
647
|
-
(event) => form.reorderListItem(event.detail.path, event.detail.payload)
|
|
648
|
-
);
|
|
649
|
-
useFormEvent(
|
|
650
|
-
`mantine-form:${name}:remove-list-item`,
|
|
651
|
-
(event) => form.removeListItem(event.detail.path, event.detail.index)
|
|
652
|
-
);
|
|
653
|
-
useFormEvent(
|
|
654
|
-
`mantine-form:${name}:insert-list-item`,
|
|
655
|
-
(event) => form.insertListItem(event.detail.path, event.detail.item, event.detail.index)
|
|
656
|
-
);
|
|
657
|
-
useFormEvent(
|
|
658
|
-
`mantine-form:${name}:set-dirty`,
|
|
659
|
-
(event) => form.setDirty(event.detail)
|
|
660
|
-
);
|
|
661
|
-
useFormEvent(
|
|
662
|
-
`mantine-form:${name}:set-touched`,
|
|
663
|
-
(event) => form.setTouched(event.detail)
|
|
664
|
-
);
|
|
665
|
-
useFormEvent(
|
|
666
|
-
`mantine-form:${name}:reset-dirty`,
|
|
667
|
-
(event) => form.resetDirty(event.detail)
|
|
668
|
-
);
|
|
669
|
-
useFormEvent(`mantine-form:${name}:reset-touched`, form.resetTouched);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/get-input-on-change/get-input-on-change.mjs
|
|
673
|
-
function getInputOnChange(setValue) {
|
|
674
|
-
return (val) => {
|
|
675
|
-
if (!val) {
|
|
676
|
-
setValue(val);
|
|
677
|
-
} else if (typeof val === "function") {
|
|
678
|
-
setValue(val);
|
|
679
|
-
} else if (typeof val === "object" && "nativeEvent" in val) {
|
|
680
|
-
const { currentTarget } = val;
|
|
681
|
-
if (currentTarget instanceof HTMLInputElement) {
|
|
682
|
-
if (currentTarget.type === "checkbox") {
|
|
683
|
-
setValue(currentTarget.checked);
|
|
684
|
-
} else {
|
|
685
|
-
setValue(currentTarget.value);
|
|
686
|
-
}
|
|
687
|
-
} else if (currentTarget instanceof HTMLTextAreaElement || currentTarget instanceof HTMLSelectElement) {
|
|
688
|
-
setValue(currentTarget.value);
|
|
689
|
-
}
|
|
690
|
-
} else {
|
|
691
|
-
setValue(val);
|
|
692
|
-
}
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
|
|
697
|
-
import { useState as useState5, useRef, useCallback as useCallback9 } from "react";
|
|
698
|
-
|
|
699
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-errors/filter-errors/filter-errors.mjs
|
|
700
|
-
function filterErrors(errors) {
|
|
701
|
-
if (errors === null || typeof errors !== "object") {
|
|
702
|
-
return {};
|
|
703
|
-
}
|
|
704
|
-
return Object.keys(errors).reduce((acc, key) => {
|
|
705
|
-
const errorValue = errors[key];
|
|
706
|
-
if (errorValue !== void 0 && errorValue !== null && errorValue !== false) {
|
|
707
|
-
acc[key] = errorValue;
|
|
708
|
-
}
|
|
709
|
-
return acc;
|
|
710
|
-
}, {});
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
|
|
714
|
-
function useFormErrors(initialErrors) {
|
|
715
|
-
const [errorsState, setErrorsState] = useState5(filterErrors(initialErrors));
|
|
716
|
-
const errorsRef = useRef(errorsState);
|
|
717
|
-
const setErrors = useCallback9((errors) => {
|
|
718
|
-
setErrorsState((current) => {
|
|
719
|
-
const newErrors = filterErrors(typeof errors === "function" ? errors(current) : errors);
|
|
720
|
-
errorsRef.current = newErrors;
|
|
721
|
-
return newErrors;
|
|
722
|
-
});
|
|
723
|
-
}, []);
|
|
724
|
-
const clearErrors = useCallback9(() => setErrors({}), []);
|
|
725
|
-
const clearFieldError = useCallback9(
|
|
726
|
-
(path) => {
|
|
727
|
-
if (errorsRef.current[path] === void 0) {
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
setErrors((current) => {
|
|
731
|
-
const errors = { ...current };
|
|
732
|
-
delete errors[path];
|
|
733
|
-
return errors;
|
|
734
|
-
});
|
|
735
|
-
},
|
|
736
|
-
[errorsState]
|
|
737
|
-
);
|
|
738
|
-
const setFieldError = useCallback9(
|
|
739
|
-
(path, error) => {
|
|
740
|
-
if (error == null || error === false) {
|
|
741
|
-
clearFieldError(path);
|
|
742
|
-
} else if (errorsRef.current[path] !== error) {
|
|
743
|
-
setErrors((current) => ({ ...current, [path]: error }));
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
[errorsState]
|
|
747
|
-
);
|
|
748
|
-
return {
|
|
749
|
-
errorsState,
|
|
750
|
-
setErrors,
|
|
751
|
-
clearErrors,
|
|
752
|
-
setFieldError,
|
|
753
|
-
clearFieldError
|
|
754
|
-
};
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
|
|
758
|
-
import { useCallback as useCallback10 } from "react";
|
|
759
|
-
|
|
760
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/clear-list-state.mjs
|
|
761
|
-
function clearListState(field, state) {
|
|
762
|
-
if (state === null || typeof state !== "object") {
|
|
763
|
-
return {};
|
|
764
|
-
}
|
|
765
|
-
const clone = { ...state };
|
|
766
|
-
Object.keys(state).forEach((errorKey) => {
|
|
767
|
-
if (errorKey.includes(`${String(field)}.`)) {
|
|
768
|
-
delete clone[errorKey];
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
return clone;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/change-error-indices.mjs
|
|
775
|
-
function getIndexFromKeyAfterPath(key, path) {
|
|
776
|
-
const split = key.substring(path.length + 1).split(".")[0];
|
|
777
|
-
return parseInt(split, 10);
|
|
778
|
-
}
|
|
779
|
-
function changeErrorIndices(path, index, errors, change) {
|
|
780
|
-
if (index === void 0) {
|
|
781
|
-
return errors;
|
|
782
|
-
}
|
|
783
|
-
const pathString = `${String(path)}`;
|
|
784
|
-
let clearedErrors = errors;
|
|
785
|
-
if (change === -1) {
|
|
786
|
-
clearedErrors = clearListState(`${pathString}.${index}`, clearedErrors);
|
|
787
|
-
}
|
|
788
|
-
const cloned = { ...clearedErrors };
|
|
789
|
-
const changedKeys = /* @__PURE__ */ new Set();
|
|
790
|
-
Object.entries(clearedErrors).filter(([key]) => {
|
|
791
|
-
if (!key.startsWith(`${pathString}.`)) {
|
|
792
|
-
return false;
|
|
793
|
-
}
|
|
794
|
-
const currIndex = getIndexFromKeyAfterPath(key, pathString);
|
|
795
|
-
if (Number.isNaN(currIndex)) {
|
|
796
|
-
return false;
|
|
797
|
-
}
|
|
798
|
-
return currIndex >= index;
|
|
799
|
-
}).forEach(([key, value]) => {
|
|
800
|
-
const currIndex = getIndexFromKeyAfterPath(key, pathString);
|
|
801
|
-
const newKey = key.replace(
|
|
802
|
-
`${pathString}.${currIndex}`,
|
|
803
|
-
`${pathString}.${currIndex + change}`
|
|
804
|
-
);
|
|
805
|
-
cloned[newKey] = value;
|
|
806
|
-
changedKeys.add(newKey);
|
|
807
|
-
if (!changedKeys.has(key)) {
|
|
808
|
-
delete cloned[key];
|
|
809
|
-
}
|
|
810
|
-
});
|
|
811
|
-
return cloned;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/reorder-errors.mjs
|
|
815
|
-
function reorderErrors(path, { from, to }, errors) {
|
|
816
|
-
const oldKeyStart = `${path}.${from}`;
|
|
817
|
-
const newKeyStart = `${path}.${to}`;
|
|
818
|
-
const clone = { ...errors };
|
|
819
|
-
Object.keys(errors).every((key) => {
|
|
820
|
-
let oldKey;
|
|
821
|
-
let newKey;
|
|
822
|
-
if (key.startsWith(oldKeyStart)) {
|
|
823
|
-
oldKey = key;
|
|
824
|
-
newKey = key.replace(oldKeyStart, newKeyStart);
|
|
825
|
-
}
|
|
826
|
-
if (key.startsWith(newKeyStart)) {
|
|
827
|
-
oldKey = key.replace(newKeyStart, oldKeyStart);
|
|
828
|
-
newKey = key;
|
|
829
|
-
}
|
|
830
|
-
if (oldKey && newKey) {
|
|
831
|
-
const value1 = clone[oldKey];
|
|
832
|
-
const value2 = clone[newKey];
|
|
833
|
-
value2 === void 0 ? delete clone[oldKey] : clone[oldKey] = value2;
|
|
834
|
-
value1 === void 0 ? delete clone[newKey] : clone[newKey] = value1;
|
|
835
|
-
return false;
|
|
836
|
-
}
|
|
837
|
-
return true;
|
|
838
|
-
});
|
|
839
|
-
return clone;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
// ../../node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.mjs
|
|
843
|
-
function set(obj, key, val) {
|
|
844
|
-
if (typeof val.value === "object") val.value = klona(val.value);
|
|
845
|
-
if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
|
|
846
|
-
Object.defineProperty(obj, key, val);
|
|
847
|
-
} else obj[key] = val.value;
|
|
848
|
-
}
|
|
849
|
-
function klona(x) {
|
|
850
|
-
if (typeof x !== "object") return x;
|
|
851
|
-
var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
|
|
852
|
-
if (str === "[object Object]") {
|
|
853
|
-
tmp = Object.create(x.__proto__ || null);
|
|
854
|
-
} else if (str === "[object Array]") {
|
|
855
|
-
tmp = Array(x.length);
|
|
856
|
-
} else if (str === "[object Set]") {
|
|
857
|
-
tmp = /* @__PURE__ */ new Set();
|
|
858
|
-
x.forEach(function(val) {
|
|
859
|
-
tmp.add(klona(val));
|
|
860
|
-
});
|
|
861
|
-
} else if (str === "[object Map]") {
|
|
862
|
-
tmp = /* @__PURE__ */ new Map();
|
|
863
|
-
x.forEach(function(val, key) {
|
|
864
|
-
tmp.set(klona(key), klona(val));
|
|
865
|
-
});
|
|
866
|
-
} else if (str === "[object Date]") {
|
|
867
|
-
tmp = /* @__PURE__ */ new Date(+x);
|
|
868
|
-
} else if (str === "[object RegExp]") {
|
|
869
|
-
tmp = new RegExp(x.source, x.flags);
|
|
870
|
-
} else if (str === "[object DataView]") {
|
|
871
|
-
tmp = new x.constructor(klona(x.buffer));
|
|
872
|
-
} else if (str === "[object ArrayBuffer]") {
|
|
873
|
-
tmp = x.slice(0);
|
|
874
|
-
} else if (str.slice(-6) === "Array]") {
|
|
875
|
-
tmp = new x.constructor(x);
|
|
876
|
-
}
|
|
877
|
-
if (tmp) {
|
|
878
|
-
for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
|
|
879
|
-
set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
|
|
880
|
-
}
|
|
881
|
-
for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
|
|
882
|
-
if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k]) continue;
|
|
883
|
-
set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
return tmp || x;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-splitted-path.mjs
|
|
890
|
-
function getSplittedPath(path) {
|
|
891
|
-
if (typeof path !== "string") {
|
|
892
|
-
return [];
|
|
893
|
-
}
|
|
894
|
-
return path.split(".");
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-path.mjs
|
|
898
|
-
function getPath(path, values) {
|
|
899
|
-
const splittedPath = getSplittedPath(path);
|
|
900
|
-
if (splittedPath.length === 0 || typeof values !== "object" || values === null) {
|
|
901
|
-
return void 0;
|
|
902
|
-
}
|
|
903
|
-
let value = values[splittedPath[0]];
|
|
904
|
-
for (let i = 1; i < splittedPath.length; i += 1) {
|
|
905
|
-
if (value === void 0) {
|
|
906
|
-
break;
|
|
907
|
-
}
|
|
908
|
-
value = value[splittedPath[i]];
|
|
909
|
-
}
|
|
910
|
-
return value;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/set-path.mjs
|
|
914
|
-
function setPath(path, value, values) {
|
|
915
|
-
const splittedPath = getSplittedPath(path);
|
|
916
|
-
if (splittedPath.length === 0) {
|
|
917
|
-
return values;
|
|
918
|
-
}
|
|
919
|
-
const cloned = klona(values);
|
|
920
|
-
if (splittedPath.length === 1) {
|
|
921
|
-
cloned[splittedPath[0]] = value;
|
|
922
|
-
return cloned;
|
|
923
|
-
}
|
|
924
|
-
let val = cloned[splittedPath[0]];
|
|
925
|
-
for (let i = 1; i < splittedPath.length - 1; i += 1) {
|
|
926
|
-
if (val === void 0) {
|
|
927
|
-
return cloned;
|
|
928
|
-
}
|
|
929
|
-
val = val[splittedPath[i]];
|
|
930
|
-
}
|
|
931
|
-
val[splittedPath[splittedPath.length - 1]] = value;
|
|
932
|
-
return cloned;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/reorder-path.mjs
|
|
936
|
-
function reorderPath(path, { from, to }, values) {
|
|
937
|
-
const currentValue = getPath(path, values);
|
|
938
|
-
if (!Array.isArray(currentValue)) {
|
|
939
|
-
return values;
|
|
940
|
-
}
|
|
941
|
-
const cloned = [...currentValue];
|
|
942
|
-
const item = currentValue[from];
|
|
943
|
-
cloned.splice(from, 1);
|
|
944
|
-
cloned.splice(to, 0, item);
|
|
945
|
-
return setPath(path, cloned, values);
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/insert-path.mjs
|
|
949
|
-
function insertPath(path, value, index, values) {
|
|
950
|
-
const currentValue = getPath(path, values);
|
|
951
|
-
if (!Array.isArray(currentValue)) {
|
|
952
|
-
return values;
|
|
953
|
-
}
|
|
954
|
-
const cloned = [...currentValue];
|
|
955
|
-
cloned.splice(typeof index === "number" ? index : cloned.length, 0, value);
|
|
956
|
-
return setPath(path, cloned, values);
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/remove-path.mjs
|
|
960
|
-
function removePath(path, index, values) {
|
|
961
|
-
const currentValue = getPath(path, values);
|
|
962
|
-
if (!Array.isArray(currentValue)) {
|
|
963
|
-
return values;
|
|
964
|
-
}
|
|
965
|
-
return setPath(
|
|
966
|
-
path,
|
|
967
|
-
currentValue.filter((_, itemIndex) => itemIndex !== index),
|
|
968
|
-
values
|
|
969
|
-
);
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
|
|
973
|
-
function useFormList({
|
|
974
|
-
$values,
|
|
975
|
-
$errors,
|
|
976
|
-
$status
|
|
977
|
-
}) {
|
|
978
|
-
const reorderListItem = useCallback10((path, payload) => {
|
|
979
|
-
$status.clearFieldDirty(path);
|
|
980
|
-
$errors.setErrors((errs) => reorderErrors(path, payload, errs));
|
|
981
|
-
$values.setValues({
|
|
982
|
-
values: reorderPath(path, payload, $values.refValues.current),
|
|
983
|
-
updateState: true
|
|
984
|
-
});
|
|
985
|
-
}, []);
|
|
986
|
-
const removeListItem = useCallback10((path, index) => {
|
|
987
|
-
$status.clearFieldDirty(path);
|
|
988
|
-
$errors.setErrors((errs) => changeErrorIndices(path, index, errs, -1));
|
|
989
|
-
$values.setValues({
|
|
990
|
-
values: removePath(path, index, $values.refValues.current),
|
|
991
|
-
updateState: true
|
|
992
|
-
});
|
|
993
|
-
}, []);
|
|
994
|
-
const insertListItem = useCallback10((path, item, index) => {
|
|
995
|
-
$status.clearFieldDirty(path);
|
|
996
|
-
$errors.setErrors((errs) => changeErrorIndices(path, index, errs, 1));
|
|
997
|
-
$values.setValues({
|
|
998
|
-
values: insertPath(path, item, index, $values.refValues.current),
|
|
999
|
-
updateState: true
|
|
1000
|
-
});
|
|
1001
|
-
}, []);
|
|
1002
|
-
return { reorderListItem, removeListItem, insertListItem };
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
|
|
1006
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
|
|
1007
|
-
import { useState as useState6, useRef as useRef2, useCallback as useCallback11 } from "react";
|
|
1008
|
-
|
|
1009
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/get-status/get-status.mjs
|
|
1010
|
-
function getStatus(status, path) {
|
|
1011
|
-
const paths = Object.keys(status);
|
|
1012
|
-
if (typeof path === "string") {
|
|
1013
|
-
const nestedPaths = paths.filter((statusPath) => statusPath.startsWith(`${path}.`));
|
|
1014
|
-
return status[path] || nestedPaths.some((statusPath) => status[statusPath]) || false;
|
|
1015
|
-
}
|
|
1016
|
-
return paths.some((statusPath) => status[statusPath]);
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
|
|
1020
|
-
function useFormStatus({
|
|
1021
|
-
initialDirty,
|
|
1022
|
-
initialTouched,
|
|
1023
|
-
mode,
|
|
1024
|
-
$values
|
|
1025
|
-
}) {
|
|
1026
|
-
const [touchedState, setTouchedState] = useState6(initialTouched);
|
|
1027
|
-
const [dirtyState, setDirtyState] = useState6(initialDirty);
|
|
1028
|
-
const touchedRef = useRef2(initialTouched);
|
|
1029
|
-
const dirtyRef = useRef2(initialDirty);
|
|
1030
|
-
const setTouched = useCallback11((values) => {
|
|
1031
|
-
const resolvedValues = typeof values === "function" ? values(touchedRef.current) : values;
|
|
1032
|
-
touchedRef.current = resolvedValues;
|
|
1033
|
-
if (mode === "controlled") {
|
|
1034
|
-
setTouchedState(resolvedValues);
|
|
1035
|
-
}
|
|
1036
|
-
}, []);
|
|
1037
|
-
const setDirty = useCallback11((values) => {
|
|
1038
|
-
const resolvedValues = typeof values === "function" ? values(dirtyRef.current) : values;
|
|
1039
|
-
dirtyRef.current = resolvedValues;
|
|
1040
|
-
if (mode === "controlled") {
|
|
1041
|
-
setDirtyState(resolvedValues);
|
|
1042
|
-
}
|
|
1043
|
-
}, []);
|
|
1044
|
-
const resetTouched = useCallback11(() => setTouched({}), []);
|
|
1045
|
-
const resetDirty = (values) => {
|
|
1046
|
-
const newSnapshot = values ? { ...values, ...$values.refValues.current } : $values.refValues.current;
|
|
1047
|
-
$values.setValuesSnapshot(newSnapshot);
|
|
1048
|
-
setDirty({});
|
|
1049
|
-
};
|
|
1050
|
-
const setFieldTouched = useCallback11((path, touched) => {
|
|
1051
|
-
setTouched((currentTouched) => {
|
|
1052
|
-
if (getStatus(currentTouched, path) === touched) {
|
|
1053
|
-
return currentTouched;
|
|
1054
|
-
}
|
|
1055
|
-
return { ...currentTouched, [path]: touched };
|
|
1056
|
-
});
|
|
1057
|
-
}, []);
|
|
1058
|
-
const setFieldDirty = useCallback11((path, dirty) => {
|
|
1059
|
-
setDirty((currentDirty) => {
|
|
1060
|
-
if (getStatus(currentDirty, path) === dirty) {
|
|
1061
|
-
return currentDirty;
|
|
1062
|
-
}
|
|
1063
|
-
return { ...currentDirty, [path]: dirty };
|
|
1064
|
-
});
|
|
1065
|
-
}, []);
|
|
1066
|
-
const isTouched = useCallback11(
|
|
1067
|
-
(path) => getStatus(touchedRef.current, path),
|
|
1068
|
-
[]
|
|
1069
|
-
);
|
|
1070
|
-
const clearFieldDirty = useCallback11(
|
|
1071
|
-
(path) => setDirty((current) => {
|
|
1072
|
-
if (typeof path !== "string") {
|
|
1073
|
-
return current;
|
|
1074
|
-
}
|
|
1075
|
-
const result = clearListState(path, current);
|
|
1076
|
-
delete result[path];
|
|
1077
|
-
if ((0, import_fast_deep_equal.default)(result, current)) {
|
|
1078
|
-
return current;
|
|
1079
|
-
}
|
|
1080
|
-
return result;
|
|
1081
|
-
}),
|
|
1082
|
-
[]
|
|
1083
|
-
);
|
|
1084
|
-
const isDirty = useCallback11((path) => {
|
|
1085
|
-
if (path) {
|
|
1086
|
-
const overriddenValue = getPath(path, dirtyRef.current);
|
|
1087
|
-
if (typeof overriddenValue === "boolean") {
|
|
1088
|
-
return overriddenValue;
|
|
1089
|
-
}
|
|
1090
|
-
const sliceOfValues = getPath(path, $values.refValues.current);
|
|
1091
|
-
const sliceOfInitialValues = getPath(path, $values.valuesSnapshot.current);
|
|
1092
|
-
return !(0, import_fast_deep_equal.default)(sliceOfValues, sliceOfInitialValues);
|
|
1093
|
-
}
|
|
1094
|
-
const isOverridden = Object.keys(dirtyRef.current).length > 0;
|
|
1095
|
-
if (isOverridden) {
|
|
1096
|
-
return getStatus(dirtyRef.current);
|
|
1097
|
-
}
|
|
1098
|
-
return !(0, import_fast_deep_equal.default)($values.refValues.current, $values.valuesSnapshot.current);
|
|
1099
|
-
}, []);
|
|
1100
|
-
const getDirty = useCallback11(() => dirtyRef.current, []);
|
|
1101
|
-
const getTouched = useCallback11(() => touchedRef.current, []);
|
|
1102
|
-
return {
|
|
1103
|
-
touchedState,
|
|
1104
|
-
dirtyState,
|
|
1105
|
-
touchedRef,
|
|
1106
|
-
dirtyRef,
|
|
1107
|
-
setTouched,
|
|
1108
|
-
setDirty,
|
|
1109
|
-
resetDirty,
|
|
1110
|
-
resetTouched,
|
|
1111
|
-
isTouched,
|
|
1112
|
-
setFieldTouched,
|
|
1113
|
-
setFieldDirty,
|
|
1114
|
-
setTouchedState,
|
|
1115
|
-
setDirtyState,
|
|
1116
|
-
clearFieldDirty,
|
|
1117
|
-
isDirty,
|
|
1118
|
-
getDirty,
|
|
1119
|
-
getTouched
|
|
1120
|
-
};
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-values/use-form-values.mjs
|
|
1124
|
-
import { useRef as useRef3, useState as useState7, useCallback as useCallback12 } from "react";
|
|
1125
|
-
function useFormValues({
|
|
1126
|
-
initialValues,
|
|
1127
|
-
onValuesChange,
|
|
1128
|
-
mode
|
|
1129
|
-
}) {
|
|
1130
|
-
const initialized = useRef3(false);
|
|
1131
|
-
const [stateValues, setStateValues] = useState7(initialValues || {});
|
|
1132
|
-
const refValues = useRef3(stateValues);
|
|
1133
|
-
const valuesSnapshot = useRef3(stateValues);
|
|
1134
|
-
const setValues = useCallback12(
|
|
1135
|
-
({
|
|
1136
|
-
values,
|
|
1137
|
-
subscribers,
|
|
1138
|
-
updateState = true,
|
|
1139
|
-
mergeWithPreviousValues = true
|
|
1140
|
-
}) => {
|
|
1141
|
-
const previousValues = refValues.current;
|
|
1142
|
-
const resolvedValues = values instanceof Function ? values(refValues.current) : values;
|
|
1143
|
-
const updatedValues = mergeWithPreviousValues ? { ...previousValues, ...resolvedValues } : resolvedValues;
|
|
1144
|
-
refValues.current = updatedValues;
|
|
1145
|
-
updateState && setStateValues(updatedValues);
|
|
1146
|
-
onValuesChange?.(updatedValues, previousValues);
|
|
1147
|
-
subscribers?.filter(Boolean).forEach((subscriber) => subscriber({ updatedValues, previousValues }));
|
|
1148
|
-
},
|
|
1149
|
-
[onValuesChange]
|
|
1150
|
-
);
|
|
1151
|
-
const setFieldValue = useCallback12((payload) => {
|
|
1152
|
-
const currentValue = getPath(payload.path, refValues.current);
|
|
1153
|
-
const updatedValue = payload.value instanceof Function ? payload.value(currentValue) : payload.value;
|
|
1154
|
-
if (currentValue !== updatedValue) {
|
|
1155
|
-
const previousValues = refValues.current;
|
|
1156
|
-
const updatedValues = setPath(payload.path, updatedValue, refValues.current);
|
|
1157
|
-
setValues({ values: updatedValues, updateState: payload.updateState });
|
|
1158
|
-
payload.subscribers?.filter(Boolean).forEach(
|
|
1159
|
-
(subscriber) => subscriber({ path: payload.path, updatedValues, previousValues })
|
|
1160
|
-
);
|
|
1161
|
-
}
|
|
1162
|
-
}, []);
|
|
1163
|
-
const setValuesSnapshot = useCallback12((payload) => {
|
|
1164
|
-
valuesSnapshot.current = payload;
|
|
1165
|
-
}, []);
|
|
1166
|
-
const initialize = useCallback12((values, onInitialize) => {
|
|
1167
|
-
if (!initialized.current) {
|
|
1168
|
-
initialized.current = true;
|
|
1169
|
-
setValues({ values, updateState: mode === "controlled" });
|
|
1170
|
-
setValuesSnapshot(values);
|
|
1171
|
-
onInitialize();
|
|
1172
|
-
}
|
|
1173
|
-
}, []);
|
|
1174
|
-
const resetValues = useCallback12(() => {
|
|
1175
|
-
setValues({
|
|
1176
|
-
values: valuesSnapshot.current,
|
|
1177
|
-
updateState: true,
|
|
1178
|
-
mergeWithPreviousValues: false
|
|
1179
|
-
});
|
|
1180
|
-
}, []);
|
|
1181
|
-
const getValues = useCallback12(() => refValues.current, []);
|
|
1182
|
-
return {
|
|
1183
|
-
initialized,
|
|
1184
|
-
stateValues,
|
|
1185
|
-
refValues,
|
|
1186
|
-
valuesSnapshot,
|
|
1187
|
-
setValues,
|
|
1188
|
-
setFieldValue,
|
|
1189
|
-
resetValues,
|
|
1190
|
-
setValuesSnapshot,
|
|
1191
|
-
initialize,
|
|
1192
|
-
getValues
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-watch/use-form-watch.mjs
|
|
1197
|
-
import { useRef as useRef4, useCallback as useCallback13, useEffect as useEffect10 } from "react";
|
|
1198
|
-
function useFormWatch({
|
|
1199
|
-
$status
|
|
1200
|
-
}) {
|
|
1201
|
-
const subscribers = useRef4(
|
|
1202
|
-
{}
|
|
1203
|
-
);
|
|
1204
|
-
const watch = useCallback13((path, callback) => {
|
|
1205
|
-
useEffect10(() => {
|
|
1206
|
-
subscribers.current[path] = subscribers.current[path] || [];
|
|
1207
|
-
subscribers.current[path].push(callback);
|
|
1208
|
-
return () => {
|
|
1209
|
-
subscribers.current[path] = subscribers.current[path].filter((cb) => cb !== callback);
|
|
1210
|
-
};
|
|
1211
|
-
}, [callback]);
|
|
1212
|
-
}, []);
|
|
1213
|
-
const getFieldSubscribers = useCallback13((path) => {
|
|
1214
|
-
if (!subscribers.current[path]) {
|
|
1215
|
-
return [];
|
|
1216
|
-
}
|
|
1217
|
-
return subscribers.current[path].map(
|
|
1218
|
-
(callback) => (input) => callback({
|
|
1219
|
-
previousValue: getPath(path, input.previousValues),
|
|
1220
|
-
value: getPath(path, input.updatedValues),
|
|
1221
|
-
touched: $status.isTouched(path),
|
|
1222
|
-
dirty: $status.isDirty(path)
|
|
1223
|
-
})
|
|
1224
|
-
);
|
|
1225
|
-
}, []);
|
|
1226
|
-
return {
|
|
1227
|
-
subscribers,
|
|
1228
|
-
watch,
|
|
1229
|
-
getFieldSubscribers
|
|
1230
|
-
};
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-data-path.mjs
|
|
1234
|
-
function getDataPath(formName, fieldPath) {
|
|
1235
|
-
return formName ? `${formName}-${fieldPath.toString()}` : fieldPath.toString();
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-values.mjs
|
|
1239
|
-
function getValidationResults(errors) {
|
|
1240
|
-
const filteredErrors = filterErrors(errors);
|
|
1241
|
-
return { hasErrors: Object.keys(filteredErrors).length > 0, errors: filteredErrors };
|
|
1242
|
-
}
|
|
1243
|
-
function validateRulesRecord(rules, values, path = "", errors = {}) {
|
|
1244
|
-
if (typeof rules !== "object" || rules === null) {
|
|
1245
|
-
return errors;
|
|
1246
|
-
}
|
|
1247
|
-
return Object.keys(rules).reduce((acc, ruleKey) => {
|
|
1248
|
-
const rule = rules[ruleKey];
|
|
1249
|
-
const rulePath = `${path === "" ? "" : `${path}.`}${ruleKey}`;
|
|
1250
|
-
const value = getPath(rulePath, values);
|
|
1251
|
-
let arrayValidation = false;
|
|
1252
|
-
if (typeof rule === "function") {
|
|
1253
|
-
acc[rulePath] = rule(value, values, rulePath);
|
|
1254
|
-
}
|
|
1255
|
-
if (typeof rule === "object" && Array.isArray(value)) {
|
|
1256
|
-
arrayValidation = true;
|
|
1257
|
-
value.forEach(
|
|
1258
|
-
(_item, index) => validateRulesRecord(rule, values, `${rulePath}.${index}`, acc)
|
|
1259
|
-
);
|
|
1260
|
-
}
|
|
1261
|
-
if (typeof rule === "object" && typeof value === "object" && value !== null) {
|
|
1262
|
-
if (!arrayValidation) {
|
|
1263
|
-
validateRulesRecord(rule, values, rulePath, acc);
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
return acc;
|
|
1267
|
-
}, errors);
|
|
1268
|
-
}
|
|
1269
|
-
function validateValues(validate, values) {
|
|
1270
|
-
if (typeof validate === "function") {
|
|
1271
|
-
return getValidationResults(validate(values));
|
|
1272
|
-
}
|
|
1273
|
-
return getValidationResults(validateRulesRecord(validate, values));
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-field-value.mjs
|
|
1277
|
-
function validateFieldValue(path, rules, values) {
|
|
1278
|
-
if (typeof path !== "string") {
|
|
1279
|
-
return { hasError: false, error: null };
|
|
1280
|
-
}
|
|
1281
|
-
const results = validateValues(rules, values);
|
|
1282
|
-
const pathInError = Object.keys(results.errors).find(
|
|
1283
|
-
(errorKey) => path.split(".").every((pathPart, i) => pathPart === errorKey.split(".")[i])
|
|
1284
|
-
);
|
|
1285
|
-
return { hasError: !!pathInError, error: pathInError ? results.errors[pathInError] : null };
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/form-index.mjs
|
|
1289
|
-
var FORM_INDEX = "__MANTINE_FORM_INDEX__";
|
|
1290
|
-
|
|
1291
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/should-validate-on-change.mjs
|
|
1292
|
-
function shouldValidateOnChange(path, validateInputOnChange) {
|
|
1293
|
-
if (!validateInputOnChange) {
|
|
1294
|
-
return false;
|
|
1295
|
-
}
|
|
1296
|
-
if (typeof validateInputOnChange === "boolean") {
|
|
1297
|
-
return validateInputOnChange;
|
|
1298
|
-
}
|
|
1299
|
-
if (Array.isArray(validateInputOnChange)) {
|
|
1300
|
-
return validateInputOnChange.includes(path.replace(/[.][0-9]/g, `.${FORM_INDEX}`));
|
|
1301
|
-
}
|
|
1302
|
-
return false;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
|
|
1306
|
-
function useForm({
|
|
1307
|
-
name,
|
|
1308
|
-
mode = "controlled",
|
|
1309
|
-
initialValues,
|
|
1310
|
-
initialErrors = {},
|
|
1311
|
-
initialDirty = {},
|
|
1312
|
-
initialTouched = {},
|
|
1313
|
-
clearInputErrorOnChange = true,
|
|
1314
|
-
validateInputOnChange = false,
|
|
1315
|
-
validateInputOnBlur = false,
|
|
1316
|
-
onValuesChange,
|
|
1317
|
-
transformValues = (values) => values,
|
|
1318
|
-
enhanceGetInputProps,
|
|
1319
|
-
validate: rules
|
|
1320
|
-
} = {}) {
|
|
1321
|
-
const $errors = useFormErrors(initialErrors);
|
|
1322
|
-
const $values = useFormValues({ initialValues, onValuesChange, mode });
|
|
1323
|
-
const $status = useFormStatus({ initialDirty, initialTouched, $values, mode });
|
|
1324
|
-
const $list = useFormList({ $values, $errors, $status });
|
|
1325
|
-
const $watch = useFormWatch({ $status });
|
|
1326
|
-
const [formKey, setFormKey] = useState8(0);
|
|
1327
|
-
const [fieldKeys, setFieldKeys] = useState8({});
|
|
1328
|
-
const reset = useCallback14(() => {
|
|
1329
|
-
$values.resetValues();
|
|
1330
|
-
$errors.clearErrors();
|
|
1331
|
-
$status.resetDirty();
|
|
1332
|
-
$status.resetTouched();
|
|
1333
|
-
mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
|
|
1334
|
-
}, []);
|
|
1335
|
-
const initialize = useCallback14((values) => {
|
|
1336
|
-
$values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
|
|
1337
|
-
}, []);
|
|
1338
|
-
const setFieldValue = useCallback14(
|
|
1339
|
-
(path, value, options2) => {
|
|
1340
|
-
const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
|
|
1341
|
-
$status.clearFieldDirty(path);
|
|
1342
|
-
$status.setFieldTouched(path, true);
|
|
1343
|
-
!shouldValidate && clearInputErrorOnChange && $errors.clearFieldError(path);
|
|
1344
|
-
$values.setFieldValue({
|
|
1345
|
-
path,
|
|
1346
|
-
value,
|
|
1347
|
-
updateState: mode === "controlled",
|
|
1348
|
-
subscribers: [
|
|
1349
|
-
...$watch.getFieldSubscribers(path),
|
|
1350
|
-
shouldValidate ? (payload) => {
|
|
1351
|
-
const validationResults = validateFieldValue(path, rules, payload.updatedValues);
|
|
1352
|
-
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
1353
|
-
} : null,
|
|
1354
|
-
options2?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
|
|
1355
|
-
...keys,
|
|
1356
|
-
[path]: (keys[path] || 0) + 1
|
|
1357
|
-
})) : null
|
|
1358
|
-
]
|
|
1359
|
-
});
|
|
1360
|
-
},
|
|
1361
|
-
[onValuesChange, rules]
|
|
1362
|
-
);
|
|
1363
|
-
const setValues = useCallback14(
|
|
1364
|
-
(values) => {
|
|
1365
|
-
const previousValues = $values.refValues.current;
|
|
1366
|
-
$values.setValues({ values, updateState: mode === "controlled" });
|
|
1367
|
-
clearInputErrorOnChange && $errors.clearErrors();
|
|
1368
|
-
mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
|
|
1369
|
-
Object.keys($watch.subscribers.current).forEach((path) => {
|
|
1370
|
-
const value = getPath(path, $values.refValues.current);
|
|
1371
|
-
const previousValue = getPath(path, previousValues);
|
|
1372
|
-
if (value !== previousValue) {
|
|
1373
|
-
$watch.getFieldSubscribers(path).forEach((cb) => cb({ previousValues, updatedValues: $values.refValues.current }));
|
|
1374
|
-
}
|
|
1375
|
-
});
|
|
1376
|
-
},
|
|
1377
|
-
[onValuesChange, clearInputErrorOnChange]
|
|
1378
|
-
);
|
|
1379
|
-
const validate = useCallback14(() => {
|
|
1380
|
-
const results = validateValues(rules, $values.refValues.current);
|
|
1381
|
-
$errors.setErrors(results.errors);
|
|
1382
|
-
return results;
|
|
1383
|
-
}, [rules]);
|
|
1384
|
-
const validateField = useCallback14(
|
|
1385
|
-
(path) => {
|
|
1386
|
-
const results = validateFieldValue(path, rules, $values.refValues.current);
|
|
1387
|
-
results.hasError ? $errors.setFieldError(path, results.error) : $errors.clearFieldError(path);
|
|
1388
|
-
return results;
|
|
1389
|
-
},
|
|
1390
|
-
[rules]
|
|
1391
|
-
);
|
|
1392
|
-
const getInputProps = (path, { type = "input", withError = true, withFocus = true, ...otherOptions } = {}) => {
|
|
1393
|
-
const onChange = getInputOnChange(
|
|
1394
|
-
(value) => setFieldValue(path, value, { forceUpdate: false })
|
|
1395
|
-
);
|
|
1396
|
-
const payload = { onChange, "data-path": getDataPath(name, path) };
|
|
1397
|
-
if (withError) {
|
|
1398
|
-
payload.error = $errors.errorsState[path];
|
|
1399
|
-
}
|
|
1400
|
-
if (type === "checkbox") {
|
|
1401
|
-
payload[mode === "controlled" ? "checked" : "defaultChecked"] = getPath(
|
|
1402
|
-
path,
|
|
1403
|
-
$values.refValues.current
|
|
1404
|
-
);
|
|
1405
|
-
} else {
|
|
1406
|
-
payload[mode === "controlled" ? "value" : "defaultValue"] = getPath(
|
|
1407
|
-
path,
|
|
1408
|
-
$values.refValues.current
|
|
1409
|
-
);
|
|
1410
|
-
}
|
|
1411
|
-
if (withFocus) {
|
|
1412
|
-
payload.onFocus = () => $status.setFieldTouched(path, true);
|
|
1413
|
-
payload.onBlur = () => {
|
|
1414
|
-
if (shouldValidateOnChange(path, validateInputOnBlur)) {
|
|
1415
|
-
const validationResults = validateFieldValue(path, rules, $values.refValues.current);
|
|
1416
|
-
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
1417
|
-
}
|
|
1418
|
-
};
|
|
1419
|
-
}
|
|
1420
|
-
return Object.assign(
|
|
1421
|
-
payload,
|
|
1422
|
-
enhanceGetInputProps?.({
|
|
1423
|
-
inputProps: payload,
|
|
1424
|
-
field: path,
|
|
1425
|
-
options: { type, withError, withFocus, ...otherOptions },
|
|
1426
|
-
form
|
|
1427
|
-
})
|
|
1428
|
-
);
|
|
1429
|
-
};
|
|
1430
|
-
const onSubmit = (handleSubmit, handleValidationFailure) => (event) => {
|
|
1431
|
-
event?.preventDefault();
|
|
1432
|
-
const results = validate();
|
|
1433
|
-
if (results.hasErrors) {
|
|
1434
|
-
handleValidationFailure?.(results.errors, $values.refValues.current, event);
|
|
1435
|
-
} else {
|
|
1436
|
-
handleSubmit?.(transformValues($values.refValues.current), event);
|
|
1437
|
-
}
|
|
1438
|
-
};
|
|
1439
|
-
const getTransformedValues = (input) => transformValues(input || $values.refValues.current);
|
|
1440
|
-
const onReset = useCallback14((event) => {
|
|
1441
|
-
event.preventDefault();
|
|
1442
|
-
reset();
|
|
1443
|
-
}, []);
|
|
1444
|
-
const isValid = useCallback14(
|
|
1445
|
-
(path) => path ? !validateFieldValue(path, rules, $values.refValues.current).hasError : !validateValues(rules, $values.refValues.current).hasErrors,
|
|
1446
|
-
[rules]
|
|
1447
|
-
);
|
|
1448
|
-
const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
|
|
1449
|
-
const getInputNode = useCallback14(
|
|
1450
|
-
(path) => document.querySelector(`[data-path="${getDataPath(name, path)}"]`),
|
|
1451
|
-
[]
|
|
1452
|
-
);
|
|
1453
|
-
const form = {
|
|
1454
|
-
watch: $watch.watch,
|
|
1455
|
-
initialized: $values.initialized.current,
|
|
1456
|
-
values: $values.stateValues,
|
|
1457
|
-
getValues: $values.getValues,
|
|
1458
|
-
setInitialValues: $values.setValuesSnapshot,
|
|
1459
|
-
initialize,
|
|
1460
|
-
setValues,
|
|
1461
|
-
setFieldValue,
|
|
1462
|
-
errors: $errors.errorsState,
|
|
1463
|
-
setErrors: $errors.setErrors,
|
|
1464
|
-
setFieldError: $errors.setFieldError,
|
|
1465
|
-
clearFieldError: $errors.clearFieldError,
|
|
1466
|
-
clearErrors: $errors.clearErrors,
|
|
1467
|
-
resetDirty: $status.resetDirty,
|
|
1468
|
-
setTouched: $status.setTouched,
|
|
1469
|
-
setDirty: $status.setDirty,
|
|
1470
|
-
isTouched: $status.isTouched,
|
|
1471
|
-
resetTouched: $status.resetTouched,
|
|
1472
|
-
isDirty: $status.isDirty,
|
|
1473
|
-
getTouched: $status.getTouched,
|
|
1474
|
-
getDirty: $status.getDirty,
|
|
1475
|
-
reorderListItem: $list.reorderListItem,
|
|
1476
|
-
insertListItem: $list.insertListItem,
|
|
1477
|
-
removeListItem: $list.removeListItem,
|
|
1478
|
-
reset,
|
|
1479
|
-
validate,
|
|
1480
|
-
validateField,
|
|
1481
|
-
getInputProps,
|
|
1482
|
-
onSubmit,
|
|
1483
|
-
onReset,
|
|
1484
|
-
isValid,
|
|
1485
|
-
getTransformedValues,
|
|
1486
|
-
key,
|
|
1487
|
-
getInputNode
|
|
1488
|
-
};
|
|
1489
|
-
useFormActions(name, form);
|
|
1490
|
-
return form;
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
// src/nodes/modifiers/noise-curve-node.tsx
|
|
1494
|
-
import { useCallback as useCallback15, useEffect as useEffect11, useState as useState9 } from "react";
|
|
1495
|
-
import { Curve, Tuple } from "libnoise-simplex-ts";
|
|
1496
|
-
import { IconX } from "@tabler/icons-react";
|
|
1497
|
-
import { randomId } from "@mantine/hooks";
|
|
1498
|
-
import { NodeState } from "@awesome-flow/core/abstract";
|
|
1499
|
-
import { Fragment, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1500
|
-
function NoiseCurveNode({ id, selected, data, type }) {
|
|
1501
|
-
const incoming = useIncomingComputedData5(id);
|
|
1502
|
-
const updateNodeData = useUpdateNodeData6();
|
|
1503
|
-
const updateComputedData = useUpdateNodeComputedData15();
|
|
1504
|
-
const [values, setValues] = useState9([]);
|
|
1505
|
-
const form = useForm({
|
|
1506
|
-
mode: "uncontrolled",
|
|
1507
|
-
initialValues: {
|
|
1508
|
-
points: []
|
|
1509
|
-
},
|
|
1510
|
-
validateInputOnChange: [`points.${FORM_INDEX}.input`],
|
|
1511
|
-
clearInputErrorOnChange: true,
|
|
1512
|
-
validate: {
|
|
1513
|
-
points: {
|
|
1514
|
-
input: (value, values2) => {
|
|
1515
|
-
const counts = {};
|
|
1516
|
-
values2.points.forEach((x) => {
|
|
1517
|
-
counts[x.input] = (counts[x.input] || 0) + 1;
|
|
1518
|
-
});
|
|
1519
|
-
return counts[value] > 1;
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
},
|
|
1523
|
-
onValuesChange: useCallback15((values2) => {
|
|
1524
|
-
if (form.isValid()) {
|
|
1525
|
-
const points = values2.points.map((v) => ({ input: v.input, output: v.output }));
|
|
1526
|
-
setValues(points);
|
|
1527
|
-
updateNodeData(id, { points });
|
|
1528
|
-
}
|
|
1529
|
-
form.validate();
|
|
1530
|
-
}, [])
|
|
1531
|
-
});
|
|
1532
|
-
useEffect11(() => {
|
|
1533
|
-
const points = data.points?.length ? data.points.map((v) => ({ input: v.input, output: v.output, key: randomId() })) : [1, 2, 3, 4].map(() => ({ input: 0, output: 0, key: randomId() }));
|
|
1534
|
-
form.initialize({ points });
|
|
1535
|
-
}, []);
|
|
1536
|
-
useEffect11(() => {
|
|
1537
|
-
if (incoming?.length && values?.length >= 4) {
|
|
1538
|
-
const module = new Curve(
|
|
1539
|
-
incoming[0].module,
|
|
1540
|
-
values.map((p) => new Tuple(p.input, p.output))
|
|
1541
|
-
);
|
|
1542
|
-
updateComputedData(id, { module });
|
|
1543
|
-
}
|
|
1544
|
-
}, [values, incoming]);
|
|
1545
|
-
const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs13(Group6, { mt: "xs", children: [
|
|
1546
|
-
/* @__PURE__ */ jsx15(
|
|
1547
|
-
NumberInput5,
|
|
1548
|
-
{
|
|
1549
|
-
size: "xs",
|
|
1550
|
-
w: 100,
|
|
1551
|
-
placeholder: "Input Value",
|
|
1552
|
-
...form.getInputProps(`points.${index}.input`),
|
|
1553
|
-
step: 0.1
|
|
1554
|
-
},
|
|
1555
|
-
form.key(`points.${index}.input`)
|
|
1556
|
-
),
|
|
1557
|
-
/* @__PURE__ */ jsx15(
|
|
1558
|
-
NumberInput5,
|
|
1559
|
-
{
|
|
1560
|
-
size: "xs",
|
|
1561
|
-
w: 100,
|
|
1562
|
-
placeholder: "Output Value",
|
|
1563
|
-
...form.getInputProps(`points.${index}.output`),
|
|
1564
|
-
step: 0.1
|
|
1565
|
-
},
|
|
1566
|
-
form.key(`points.${index}.output`)
|
|
1567
|
-
),
|
|
1568
|
-
data.state === NodeState.edit && values.length > 4 && /* @__PURE__ */ jsx15(
|
|
1569
|
-
ActionIcon,
|
|
1570
|
-
{
|
|
1571
|
-
color: "red",
|
|
1572
|
-
variant: "outline",
|
|
1573
|
-
size: "sm",
|
|
1574
|
-
onClick: () => form.removeListItem("points", index),
|
|
1575
|
-
children: /* @__PURE__ */ jsx15(IconX, { size: "1rem" })
|
|
1576
|
-
}
|
|
1577
|
-
)
|
|
1578
|
-
] }, item.key));
|
|
1579
|
-
return /* @__PURE__ */ jsxs13(NodeContainer15, { id, selected, type, data, children: [
|
|
1580
|
-
fields,
|
|
1581
|
-
data.state === NodeState.edit && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
1582
|
-
/* @__PURE__ */ jsx15(Space, { h: 10 }),
|
|
1583
|
-
/* @__PURE__ */ jsx15(
|
|
1584
|
-
Button,
|
|
1585
|
-
{
|
|
1586
|
-
variant: "outline",
|
|
1587
|
-
size: "xs",
|
|
1588
|
-
fullWidth: true,
|
|
1589
|
-
onClick: () => form.insertListItem("points", { input: 0, output: 0, key: randomId() }),
|
|
1590
|
-
children: "Add control point"
|
|
1591
|
-
}
|
|
1592
|
-
)
|
|
1593
|
-
] }),
|
|
1594
|
-
/* @__PURE__ */ jsx15(NodeTrackConnections11, { handles: data.handles, nodeId: id, type: "target" })
|
|
1595
|
-
] });
|
|
1596
|
-
}
|
|
1597
|
-
var noise_curve_node_default = NoiseCurveNode;
|
|
1598
|
-
|
|
1599
|
-
// src/nodes/modifiers/noise-exponent-node.tsx
|
|
1600
|
-
import { NodeContainer as NodeContainer16, NodeTrackConnections as NodeTrackConnections12 } from "@awesome-flow/core/layout";
|
|
1601
|
-
import { useEffect as useEffect12, useState as useState10 } from "react";
|
|
1602
|
-
import { Group as Group7, NumberInput as NumberInput6, Stack as Stack5 } from "@mantine/core";
|
|
1603
|
-
import {
|
|
1604
|
-
useIncomingComputedData as useIncomingComputedData6,
|
|
1605
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData16,
|
|
1606
|
-
useUpdateNodeData as useUpdateNodeData7
|
|
1607
|
-
} from "@awesome-flow/core/hooks";
|
|
1608
|
-
import { Exponent } from "libnoise-simplex-ts";
|
|
1609
|
-
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1610
|
-
function NoiseExponentNode({ id, selected, data, type }) {
|
|
1611
|
-
const [exponent, setExponent] = useState10(data.exponent);
|
|
1612
|
-
const incoming = useIncomingComputedData6(id);
|
|
1613
|
-
const updateNodeData = useUpdateNodeData7();
|
|
1614
|
-
const updateComputedData = useUpdateNodeComputedData16();
|
|
1615
|
-
useEffect12(() => {
|
|
1616
|
-
if (incoming?.length > 0) {
|
|
1617
|
-
const module = new Exponent(incoming[0].module, exponent);
|
|
1618
|
-
updateComputedData(id, { module });
|
|
1619
|
-
}
|
|
1620
|
-
updateNodeData(id, { exponent });
|
|
1621
|
-
}, [incoming, exponent]);
|
|
1622
|
-
return /* @__PURE__ */ jsxs14(NodeContainer16, { id, selected, data, type, children: [
|
|
1623
|
-
/* @__PURE__ */ jsx16(Stack5, { children: /* @__PURE__ */ jsxs14(Group7, { children: [
|
|
1624
|
-
"Exponent:",
|
|
1625
|
-
/* @__PURE__ */ jsx16(
|
|
1626
|
-
NumberInput6,
|
|
1627
|
-
{
|
|
1628
|
-
size: "xs",
|
|
1629
|
-
value: exponent,
|
|
1630
|
-
onChange: (e) => setExponent(Number(e)),
|
|
1631
|
-
step: 0.1
|
|
1632
|
-
}
|
|
1633
|
-
)
|
|
1634
|
-
] }) }),
|
|
1635
|
-
/* @__PURE__ */ jsx16(NodeTrackConnections12, { handles: data.handles, nodeId: id, type: "target" })
|
|
1636
|
-
] });
|
|
1637
|
-
}
|
|
1638
|
-
var noise_exponent_node_default = NoiseExponentNode;
|
|
1639
|
-
|
|
1640
|
-
// src/nodes/modifiers/noise-invert-node.tsx
|
|
1641
|
-
import { NodeContainer as NodeContainer17, NodeTrackConnections as NodeTrackConnections13 } from "@awesome-flow/core/layout";
|
|
1642
|
-
import { useEffect as useEffect13 } from "react";
|
|
1643
|
-
import { useIncomingComputedData as useIncomingComputedData7, useUpdateNodeComputedData as useUpdateNodeComputedData17 } from "@awesome-flow/core/hooks";
|
|
1644
|
-
import { Invert } from "libnoise-simplex-ts";
|
|
1645
|
-
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1646
|
-
function NoiseInvertNode({ id, selected, data, type }) {
|
|
1647
|
-
const incoming = useIncomingComputedData7(id);
|
|
1648
|
-
const updateComputedData = useUpdateNodeComputedData17();
|
|
1649
|
-
useEffect13(() => {
|
|
1650
|
-
if (incoming?.length > 0) {
|
|
1651
|
-
const module = new Invert(incoming[0].module);
|
|
1652
|
-
updateComputedData(id, { module });
|
|
1653
|
-
}
|
|
1654
|
-
}, [incoming]);
|
|
1655
|
-
return /* @__PURE__ */ jsx17(NodeContainer17, { id, selected, data, type, children: /* @__PURE__ */ jsx17(NodeTrackConnections13, { handles: data.handles, nodeId: id, type: "target" }) });
|
|
1656
|
-
}
|
|
1657
|
-
var noise_invert_node_default = NoiseInvertNode;
|
|
1658
|
-
|
|
1659
|
-
// src/nodes/modifiers/noise-normalize-node.tsx
|
|
1660
|
-
import { NodeContainer as NodeContainer18, NodeTrackConnections as NodeTrackConnections14 } from "@awesome-flow/core/layout";
|
|
1661
|
-
import { useEffect as useEffect14, useState as useState11 } from "react";
|
|
1662
|
-
import { Group as Group8, NumberInput as NumberInput7, Stack as Stack6 } from "@mantine/core";
|
|
1663
|
-
import {
|
|
1664
|
-
useIncomingComputedData as useIncomingComputedData8,
|
|
1665
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData18,
|
|
1666
|
-
useUpdateNodeData as useUpdateNodeData8
|
|
1667
|
-
} from "@awesome-flow/core/hooks";
|
|
1668
|
-
|
|
1669
|
-
// src/modules/normalize-noise-module.ts
|
|
1670
|
-
import { ModifierModule } from "libnoise-simplex-ts";
|
|
1671
|
-
var NormalizeNoiseModule = class extends ModifierModule {
|
|
1672
|
-
constructor(source, lowerBound, upperBound) {
|
|
1673
|
-
super(source);
|
|
1674
|
-
this.lowerBound = lowerBound;
|
|
1675
|
-
this.upperBound = upperBound;
|
|
1676
|
-
}
|
|
1677
|
-
getValue(x, y, z) {
|
|
1678
|
-
return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
|
|
1679
|
-
}
|
|
1680
|
-
};
|
|
1681
|
-
function normalize(value, min, max) {
|
|
1682
|
-
return (value - min) / (max - min);
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
// src/nodes/modifiers/noise-normalize-node.tsx
|
|
1686
|
-
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1687
|
-
function NoiseNormalizeNode({ id, selected, data, type }) {
|
|
1688
|
-
const [intervalStart, setIntervalStart] = useState11(data.intervalStart);
|
|
1689
|
-
const [intervalEnd, setIntervalEnd] = useState11(data.intervalEnd);
|
|
1690
|
-
const incoming = useIncomingComputedData8(id);
|
|
1691
|
-
const updateNodeData = useUpdateNodeData8();
|
|
1692
|
-
const updateComputedData = useUpdateNodeComputedData18();
|
|
1693
|
-
useEffect14(() => {
|
|
1694
|
-
if (incoming?.length) {
|
|
1695
|
-
const source = incoming[0].module;
|
|
1696
|
-
const module = new NormalizeNoiseModule(source, intervalStart, intervalEnd);
|
|
1697
|
-
updateComputedData(id, { module });
|
|
1698
|
-
}
|
|
1699
|
-
updateNodeData(id, { intervalStart, intervalEnd });
|
|
1700
|
-
}, [incoming, intervalStart, intervalEnd]);
|
|
1701
|
-
return /* @__PURE__ */ jsxs15(NodeContainer18, { id, selected, data, type, children: [
|
|
1702
|
-
/* @__PURE__ */ jsx18(Stack6, { children: /* @__PURE__ */ jsxs15(Group8, { children: [
|
|
1703
|
-
/* @__PURE__ */ jsx18(
|
|
1704
|
-
NumberInput7,
|
|
1705
|
-
{
|
|
1706
|
-
size: "xs",
|
|
1707
|
-
w: 100,
|
|
1708
|
-
value: intervalStart,
|
|
1709
|
-
onChange: (e) => setIntervalStart(Number(e))
|
|
1710
|
-
}
|
|
1711
|
-
),
|
|
1712
|
-
/* @__PURE__ */ jsx18(
|
|
1713
|
-
NumberInput7,
|
|
1714
|
-
{
|
|
1715
|
-
size: "xs",
|
|
1716
|
-
w: 100,
|
|
1717
|
-
value: intervalEnd,
|
|
1718
|
-
onChange: (e) => setIntervalEnd(Number(e))
|
|
1719
|
-
}
|
|
1720
|
-
)
|
|
1721
|
-
] }) }),
|
|
1722
|
-
/* @__PURE__ */ jsx18(NodeTrackConnections14, { handles: data.handles, nodeId: id, type: "target" })
|
|
1723
|
-
] });
|
|
1724
|
-
}
|
|
1725
|
-
var noise_normalize_node_default = NoiseNormalizeNode;
|
|
1726
|
-
|
|
1727
|
-
// src/nodes/modifiers/noise-scale-bias-node.tsx
|
|
1728
|
-
import { NodeContainer as NodeContainer19, NodeTrackConnections as NodeTrackConnections15 } from "@awesome-flow/core/layout";
|
|
1729
|
-
import { useEffect as useEffect15, useState as useState12 } from "react";
|
|
1730
|
-
import { Group as Group9, NumberInput as NumberInput8, Stack as Stack7 } from "@mantine/core";
|
|
1731
|
-
import {
|
|
1732
|
-
useIncomingComputedData as useIncomingComputedData9,
|
|
1733
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData19,
|
|
1734
|
-
useUpdateNodeData as useUpdateNodeData9
|
|
1735
|
-
} from "@awesome-flow/core/hooks";
|
|
1736
|
-
import { ScaleBias } from "libnoise-simplex-ts";
|
|
1737
|
-
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1738
|
-
function NoiseScaleBiasNode({ id, selected, data, type }) {
|
|
1739
|
-
const [scale, setScale] = useState12(data.scale);
|
|
1740
|
-
const [bias, setBias] = useState12(data.bias);
|
|
1741
|
-
const incoming = useIncomingComputedData9(id);
|
|
1742
|
-
const updateNodeData = useUpdateNodeData9();
|
|
1743
|
-
const updateComputedData = useUpdateNodeComputedData19();
|
|
1744
|
-
useEffect15(() => {
|
|
1745
|
-
if (incoming?.length > 0) {
|
|
1746
|
-
const module = new ScaleBias(incoming[0].module, scale, bias);
|
|
1747
|
-
updateComputedData(id, { module });
|
|
1748
|
-
}
|
|
1749
|
-
updateNodeData(id, { scale, bias });
|
|
1750
|
-
}, [incoming, scale, bias]);
|
|
1751
|
-
return /* @__PURE__ */ jsxs16(NodeContainer19, { id, selected, data, type, children: [
|
|
1752
|
-
/* @__PURE__ */ jsxs16(Stack7, { children: [
|
|
1753
|
-
/* @__PURE__ */ jsxs16(Group9, { children: [
|
|
1754
|
-
"Scale:",
|
|
1755
|
-
/* @__PURE__ */ jsx19(
|
|
1756
|
-
NumberInput8,
|
|
1757
|
-
{
|
|
1758
|
-
size: "xs",
|
|
1759
|
-
w: 100,
|
|
1760
|
-
value: scale,
|
|
1761
|
-
onChange: (e) => setScale(Number(e)),
|
|
1762
|
-
step: 0.1
|
|
1763
|
-
}
|
|
1764
|
-
)
|
|
1765
|
-
] }),
|
|
1766
|
-
/* @__PURE__ */ jsxs16(Group9, { children: [
|
|
1767
|
-
"Bias:",
|
|
1768
|
-
/* @__PURE__ */ jsx19(
|
|
1769
|
-
NumberInput8,
|
|
1770
|
-
{
|
|
1771
|
-
size: "xs",
|
|
1772
|
-
w: 100,
|
|
1773
|
-
value: bias,
|
|
1774
|
-
onChange: (e) => setBias(Number(e)),
|
|
1775
|
-
step: 0.1
|
|
1776
|
-
}
|
|
1777
|
-
)
|
|
1778
|
-
] })
|
|
1779
|
-
] }),
|
|
1780
|
-
/* @__PURE__ */ jsx19(NodeTrackConnections15, { handles: data.handles, nodeId: id, type: "target" })
|
|
1781
|
-
] });
|
|
1782
|
-
}
|
|
1783
|
-
var noise_scale_bias_node_default = NoiseScaleBiasNode;
|
|
1784
|
-
|
|
1785
|
-
// src/nodes/modifiers/noise-terrace-node.tsx
|
|
1786
|
-
import { NodeContainer as NodeContainer20, NodeTrackConnections as NodeTrackConnections16 } from "@awesome-flow/core/layout";
|
|
1787
|
-
import { ActionIcon as ActionIcon2, Button as Button2, Group as Group10, NumberInput as NumberInput9, Space as Space2 } from "@mantine/core";
|
|
1788
|
-
import {
|
|
1789
|
-
useIncomingComputedData as useIncomingComputedData10,
|
|
1790
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData20,
|
|
1791
|
-
useUpdateNodeData as useUpdateNodeData10
|
|
1792
|
-
} from "@awesome-flow/core/hooks";
|
|
1793
|
-
import { useCallback as useCallback16, useEffect as useEffect16, useState as useState13 } from "react";
|
|
1794
|
-
import { Terrace } from "libnoise-simplex-ts";
|
|
1795
|
-
import { IconX as IconX2 } from "@tabler/icons-react";
|
|
1796
|
-
import { randomId as randomId2 } from "@mantine/hooks";
|
|
1797
|
-
import { NodeState as NodeState2 } from "@awesome-flow/core/abstract";
|
|
1798
|
-
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1799
|
-
function NoiseTerraceNode({ id, selected, data, type }) {
|
|
1800
|
-
const incoming = useIncomingComputedData10(id);
|
|
1801
|
-
const updateNodeData = useUpdateNodeData10();
|
|
1802
|
-
const updateComputedData = useUpdateNodeComputedData20();
|
|
1803
|
-
const [values, setValues] = useState13([]);
|
|
1804
|
-
const form = useForm({
|
|
1805
|
-
mode: "uncontrolled",
|
|
1806
|
-
initialValues: {
|
|
1807
|
-
points: []
|
|
1808
|
-
},
|
|
1809
|
-
validateInputOnChange: [`points.${FORM_INDEX}.input`],
|
|
1810
|
-
clearInputErrorOnChange: true,
|
|
1811
|
-
onValuesChange: useCallback16((values2) => {
|
|
1812
|
-
if (form.isValid()) {
|
|
1813
|
-
const points = values2.points.map((v) => v.value);
|
|
1814
|
-
setValues(points);
|
|
1815
|
-
updateNodeData(id, { points });
|
|
1816
|
-
}
|
|
1817
|
-
form.validate();
|
|
1818
|
-
}, [])
|
|
1819
|
-
});
|
|
1820
|
-
useEffect16(() => {
|
|
1821
|
-
const points = data.points?.length ? data.points.map((v) => ({ value: v, key: randomId2() })) : [1, 2].map(() => ({ value: 0, key: randomId2() }));
|
|
1822
|
-
form.initialize({ points });
|
|
1823
|
-
}, []);
|
|
1824
|
-
useEffect16(() => {
|
|
1825
|
-
if (incoming?.length && values?.length >= 2) {
|
|
1826
|
-
const module = new Terrace(incoming[0].module, values);
|
|
1827
|
-
updateComputedData(id, { module });
|
|
1828
|
-
}
|
|
1829
|
-
}, [values, incoming]);
|
|
1830
|
-
const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs17(Group10, { mt: "xs", children: [
|
|
1831
|
-
/* @__PURE__ */ jsx20(
|
|
1832
|
-
NumberInput9,
|
|
1833
|
-
{
|
|
1834
|
-
size: "xs",
|
|
1835
|
-
placeholder: "Input Value",
|
|
1836
|
-
...form.getInputProps(`points.${index}.value`),
|
|
1837
|
-
step: 0.1
|
|
1838
|
-
},
|
|
1839
|
-
form.key(`points.${index}.value`)
|
|
1840
|
-
),
|
|
1841
|
-
data.state === NodeState2.edit && values.length > 2 && /* @__PURE__ */ jsx20(
|
|
1842
|
-
ActionIcon2,
|
|
1843
|
-
{
|
|
1844
|
-
color: "red",
|
|
1845
|
-
variant: "outline",
|
|
1846
|
-
size: "sm",
|
|
1847
|
-
onClick: () => form.removeListItem("points", index),
|
|
1848
|
-
children: /* @__PURE__ */ jsx20(IconX2, { size: "1rem" })
|
|
1849
|
-
}
|
|
1850
|
-
)
|
|
1851
|
-
] }, item.key));
|
|
1852
|
-
return /* @__PURE__ */ jsxs17(NodeContainer20, { id, selected, type, data, children: [
|
|
1853
|
-
fields,
|
|
1854
|
-
data.state === NodeState2.edit && /* @__PURE__ */ jsxs17(Fragment2, { children: [
|
|
1855
|
-
/* @__PURE__ */ jsx20(Space2, { h: 10 }),
|
|
1856
|
-
/* @__PURE__ */ jsx20(
|
|
1857
|
-
Button2,
|
|
1858
|
-
{
|
|
1859
|
-
variant: "outline",
|
|
1860
|
-
size: "xs",
|
|
1861
|
-
fullWidth: true,
|
|
1862
|
-
onClick: () => form.insertListItem("points", { value: 0, key: randomId2() }),
|
|
1863
|
-
children: "Add control point"
|
|
1864
|
-
}
|
|
1865
|
-
)
|
|
1866
|
-
] }),
|
|
1867
|
-
/* @__PURE__ */ jsx20(NodeTrackConnections16, { handles: data.handles, nodeId: id, type: "target" })
|
|
1868
|
-
] });
|
|
1869
|
-
}
|
|
1870
|
-
var noise_terrace_node_default = NoiseTerraceNode;
|
|
1871
|
-
|
|
1872
|
-
// src/nodes/output/noise-logger-node.tsx
|
|
1873
|
-
import { NodeContainer as NodeContainer21, NodeTrackConnections as NodeTrackConnections17 } from "@awesome-flow/core/layout";
|
|
1874
|
-
import { useMemo as useMemo9 } from "react";
|
|
1875
|
-
import { Divider, Stack as Stack8, Text } from "@mantine/core";
|
|
1876
|
-
import { useIncomingComputedData as useIncomingComputedData11 } from "@awesome-flow/core/hooks";
|
|
1877
|
-
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1878
|
-
function NoiseLoggerNode({ id, selected, data, type }) {
|
|
1879
|
-
const incoming = useIncomingComputedData11(id);
|
|
1880
|
-
const noise = useMemo9(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
1881
|
-
return /* @__PURE__ */ jsxs18(NodeContainer21, { id, selected, data, type, children: [
|
|
1882
|
-
/* @__PURE__ */ jsxs18(Text, { children: [
|
|
1883
|
-
"Size: ",
|
|
1884
|
-
noise?.length || 0
|
|
1885
|
-
] }),
|
|
1886
|
-
/* @__PURE__ */ jsx21(Divider, { h: 5 }),
|
|
1887
|
-
/* @__PURE__ */ jsx21(Stack8, { children: noise?.map((v, i) => /* @__PURE__ */ jsxs18(Text, { children: [
|
|
1888
|
-
v.position?.x,
|
|
1889
|
-
":",
|
|
1890
|
-
v.position?.y,
|
|
1891
|
-
":",
|
|
1892
|
-
v.position?.z,
|
|
1893
|
-
": ",
|
|
1894
|
-
v.value
|
|
1895
|
-
] }, i)) }),
|
|
1896
|
-
/* @__PURE__ */ jsx21(NodeTrackConnections17, { handles: data.handles, nodeId: id, type: "target" })
|
|
1897
|
-
] });
|
|
1898
|
-
}
|
|
1899
|
-
var noise_logger_node_default = NoiseLoggerNode;
|
|
1900
|
-
|
|
1901
|
-
// src/nodes/output/noise-output-node.tsx
|
|
1902
|
-
import { NodeContainer as NodeContainer31, NodeTrackConnections as NodeTrackConnections27 } from "@awesome-flow/core/layout";
|
|
1903
|
-
import { useCallback as useCallback21, useState as useState20 } from "react";
|
|
1904
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData29 } from "@awesome-flow/core/hooks";
|
|
1905
|
-
import { HandlesIncomingDataStatus as HandlesIncomingDataStatus4 } from "@awesome-flow/core/components";
|
|
1906
|
-
import { Text as Text3 } from "@mantine/core";
|
|
1907
|
-
|
|
1908
|
-
// src/nodes/output/noise-raw-texture-node.tsx
|
|
1909
|
-
import { NodeContainer as NodeContainer22, NodeTrackConnections as NodeTrackConnections18 } from "@awesome-flow/core/layout";
|
|
1910
|
-
import { useEffect as useEffect17, useMemo as useMemo10, useState as useState14 } from "react";
|
|
1911
|
-
import { useIncomingComputedData as useIncomingComputedData12, useUpdateNodeComputedData as useUpdateNodeComputedData21 } from "@awesome-flow/core/hooks";
|
|
1912
|
-
import { Group as Group11, Stack as Stack9 } from "@mantine/core";
|
|
1913
|
-
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1914
|
-
function NoiseRawTextureNode({ id, selected, data, type }) {
|
|
1915
|
-
const updateComputedData = useUpdateNodeComputedData21();
|
|
1916
|
-
const [dataLength, setDataLength] = useState14(0);
|
|
1917
|
-
const [resolution, setResolution] = useState14(0);
|
|
1918
|
-
const incoming = useIncomingComputedData12(id);
|
|
1919
|
-
const noise = useMemo10(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
1920
|
-
useEffect17(() => {
|
|
1921
|
-
if (noise?.length) {
|
|
1922
|
-
const size = Math.ceil(Math.sqrt(noise.length));
|
|
1923
|
-
const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();
|
|
1924
|
-
const dataArray = new Uint8Array(size * size * 4);
|
|
1925
|
-
dataArray.set(colors);
|
|
1926
|
-
setResolution(size);
|
|
1927
|
-
setDataLength(dataArray.length);
|
|
1928
|
-
updateComputedData(id, {
|
|
1929
|
-
textureData: dataArray,
|
|
1930
|
-
textureResolutionX: size,
|
|
1931
|
-
textureResolutionY: size
|
|
1932
|
-
});
|
|
1933
|
-
}
|
|
1934
|
-
}, [noise]);
|
|
1935
|
-
return /* @__PURE__ */ jsxs19(NodeContainer22, { id, selected, data, type, children: [
|
|
1936
|
-
/* @__PURE__ */ jsxs19(Stack9, { children: [
|
|
1937
|
-
/* @__PURE__ */ jsxs19(Group11, { children: [
|
|
1938
|
-
"Resolution: ",
|
|
1939
|
-
resolution,
|
|
1940
|
-
"x",
|
|
1941
|
-
resolution
|
|
1942
|
-
] }),
|
|
1943
|
-
/* @__PURE__ */ jsxs19(Group11, { children: [
|
|
1944
|
-
"Input Length: ",
|
|
1945
|
-
noise?.length || 0
|
|
1946
|
-
] }),
|
|
1947
|
-
/* @__PURE__ */ jsxs19(Group11, { children: [
|
|
1948
|
-
"Output Length (",
|
|
1949
|
-
resolution,
|
|
1950
|
-
"*",
|
|
1951
|
-
resolution,
|
|
1952
|
-
"*4): ",
|
|
1953
|
-
dataLength
|
|
1954
|
-
] })
|
|
1955
|
-
] }),
|
|
1956
|
-
/* @__PURE__ */ jsx22(NodeTrackConnections18, { handles: data.handles, nodeId: id, type: "target" })
|
|
1957
|
-
] });
|
|
1958
|
-
}
|
|
1959
|
-
var noise_raw_texture_node_default = NoiseRawTextureNode;
|
|
1960
|
-
|
|
1961
|
-
// src/nodes/output/positions-logger-node.tsx
|
|
1962
|
-
import { NodeContainer as NodeContainer23, NodeTrackConnections as NodeTrackConnections19 } from "@awesome-flow/core/layout";
|
|
1963
|
-
import { useMemo as useMemo11 } from "react";
|
|
1964
|
-
import { Divider as Divider2, Stack as Stack10, Text as Text2 } from "@mantine/core";
|
|
1965
|
-
import { useIncomingComputedData as useIncomingComputedData13 } from "@awesome-flow/core/hooks";
|
|
1966
|
-
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1967
|
-
function PositionsLoggerNode({ id, selected, data, type }) {
|
|
1968
|
-
const incoming = useIncomingComputedData13(id);
|
|
1969
|
-
const positions = useMemo11(() => {
|
|
1970
|
-
return incoming?.map((p) => p.positions).flat();
|
|
1971
|
-
}, [incoming]);
|
|
1972
|
-
return /* @__PURE__ */ jsxs20(NodeContainer23, { id, selected, data, type, children: [
|
|
1973
|
-
/* @__PURE__ */ jsxs20(Text2, { children: [
|
|
1974
|
-
"Size: ",
|
|
1975
|
-
positions?.length || 0
|
|
1976
|
-
] }),
|
|
1977
|
-
/* @__PURE__ */ jsx23(Divider2, { h: 5 }),
|
|
1978
|
-
/* @__PURE__ */ jsx23(Stack10, { children: positions?.map((v, i) => /* @__PURE__ */ jsxs20(Text2, { children: [
|
|
1979
|
-
v.x,
|
|
1980
|
-
":",
|
|
1981
|
-
v.y,
|
|
1982
|
-
":",
|
|
1983
|
-
v.z
|
|
1984
|
-
] }, i)) }),
|
|
1985
|
-
/* @__PURE__ */ jsx23(NodeTrackConnections19, { handles: data.handles, nodeId: id, type: "target" })
|
|
1986
|
-
] });
|
|
1987
|
-
}
|
|
1988
|
-
var positions_logger_node_default = PositionsLoggerNode;
|
|
1989
|
-
|
|
1990
|
-
// src/nodes/selectors/noise-blend-node.tsx
|
|
1991
|
-
import { NodeContainer as NodeContainer24, NodeTrackConnections as NodeTrackConnections20 } from "@awesome-flow/core/layout";
|
|
1992
|
-
import { useCallback as useCallback17 } from "react";
|
|
1993
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData22 } from "@awesome-flow/core/hooks";
|
|
1994
|
-
import { Blend } from "libnoise-simplex-ts";
|
|
1995
|
-
import { HandlesIncomingDataStatus } from "@awesome-flow/core/components";
|
|
1996
|
-
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1997
|
-
function NoiseBlendNode({ id, selected, data, type }) {
|
|
1998
|
-
const updateComputedData = useUpdateNodeComputedData22();
|
|
1999
|
-
const onDataUpdated = useCallback17(
|
|
2000
|
-
(incomingData) => {
|
|
2001
|
-
const incomingSources = incomingData["source" /* source */];
|
|
2002
|
-
const incomingControl = incomingData["control" /* control */];
|
|
2003
|
-
if (incomingSources?.length >= 2 && incomingControl?.length) {
|
|
2004
|
-
const module = new Blend(
|
|
2005
|
-
incomingSources[0].module,
|
|
2006
|
-
incomingSources[1].module,
|
|
2007
|
-
incomingControl[0].module
|
|
2008
|
-
);
|
|
2009
|
-
updateComputedData(id, { module });
|
|
2010
|
-
}
|
|
2011
|
-
},
|
|
2012
|
-
[]
|
|
2013
|
-
);
|
|
2014
|
-
return /* @__PURE__ */ jsxs21(NodeContainer24, { id, selected, data, type, children: [
|
|
2015
|
-
/* @__PURE__ */ jsx24(
|
|
2016
|
-
HandlesIncomingDataStatus,
|
|
2017
|
-
{
|
|
2018
|
-
nodeId: id,
|
|
2019
|
-
handles: data.handles,
|
|
2020
|
-
handleKey: "dataId",
|
|
2021
|
-
onDataUpdated,
|
|
2022
|
-
type: "target",
|
|
2023
|
-
resetComputedData: true
|
|
2024
|
-
}
|
|
2025
|
-
),
|
|
2026
|
-
/* @__PURE__ */ jsx24(NodeTrackConnections20, { handles: data.handles, nodeId: id, type: "target" })
|
|
2027
|
-
] });
|
|
2028
|
-
}
|
|
2029
|
-
var noise_blend_node_default = NoiseBlendNode;
|
|
2030
|
-
|
|
2031
|
-
// src/nodes/selectors/noise-select-node.tsx
|
|
2032
|
-
import { NodeContainer as NodeContainer25, NodeTrackConnections as NodeTrackConnections21 } from "@awesome-flow/core/layout";
|
|
2033
|
-
import { useCallback as useCallback18, useEffect as useEffect18, useState as useState15 } from "react";
|
|
2034
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData23, useUpdateNodeData as useUpdateNodeData11 } from "@awesome-flow/core/hooks";
|
|
2035
|
-
import { Select } from "libnoise-simplex-ts";
|
|
2036
|
-
import { Group as Group12, NumberInput as NumberInput10, Stack as Stack11 } from "@mantine/core";
|
|
2037
|
-
import { HandlesIncomingDataStatus as HandlesIncomingDataStatus2 } from "@awesome-flow/core/components";
|
|
2038
|
-
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2039
|
-
function NoiseSelectNode({ id, selected, data, type }) {
|
|
2040
|
-
const [edgeFalloff, setEdgeFalloff] = useState15(data.edgeFalloff);
|
|
2041
|
-
const [lowerBound, setLowerBound] = useState15(data.lowerBound);
|
|
2042
|
-
const [upperBound, setUpperBound] = useState15(data.upperBound);
|
|
2043
|
-
const updateNodeData = useUpdateNodeData11();
|
|
2044
|
-
const updateComputedData = useUpdateNodeComputedData23();
|
|
2045
|
-
useEffect18(() => {
|
|
2046
|
-
updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
|
|
2047
|
-
}, [edgeFalloff, lowerBound, upperBound]);
|
|
2048
|
-
const onDataUpdated = useCallback18(
|
|
2049
|
-
(incomingData) => {
|
|
2050
|
-
const incomingSources = incomingData["source" /* source */];
|
|
2051
|
-
const incomingControl = incomingData["control" /* control */];
|
|
2052
|
-
if (incomingSources?.length >= 2 && incomingControl?.length) {
|
|
2053
|
-
const module = new Select(
|
|
2054
|
-
incomingSources[0].module,
|
|
2055
|
-
incomingSources[1].module,
|
|
2056
|
-
incomingControl[0].module,
|
|
2057
|
-
edgeFalloff,
|
|
2058
|
-
lowerBound,
|
|
2059
|
-
upperBound
|
|
2060
|
-
);
|
|
2061
|
-
updateComputedData(id, { module });
|
|
2062
|
-
}
|
|
2063
|
-
},
|
|
2064
|
-
[]
|
|
2065
|
-
);
|
|
2066
|
-
return /* @__PURE__ */ jsxs22(NodeContainer25, { id, selected, data, type, children: [
|
|
2067
|
-
/* @__PURE__ */ jsxs22(Stack11, { children: [
|
|
2068
|
-
/* @__PURE__ */ jsxs22(Group12, { children: [
|
|
2069
|
-
"Edge Falloff:",
|
|
2070
|
-
/* @__PURE__ */ jsx25(
|
|
2071
|
-
NumberInput10,
|
|
2072
|
-
{
|
|
2073
|
-
size: "xs",
|
|
2074
|
-
w: 100,
|
|
2075
|
-
value: edgeFalloff,
|
|
2076
|
-
onChange: (e) => setEdgeFalloff(Number(e)),
|
|
2077
|
-
step: 0.1
|
|
2078
|
-
}
|
|
2079
|
-
)
|
|
2080
|
-
] }),
|
|
2081
|
-
/* @__PURE__ */ jsxs22(Group12, { children: [
|
|
2082
|
-
"Lower Bound:",
|
|
2083
|
-
/* @__PURE__ */ jsx25(
|
|
2084
|
-
NumberInput10,
|
|
2085
|
-
{
|
|
2086
|
-
size: "xs",
|
|
2087
|
-
w: 100,
|
|
2088
|
-
value: lowerBound,
|
|
2089
|
-
onChange: (e) => setLowerBound(Number(e)),
|
|
2090
|
-
step: 0.1
|
|
2091
|
-
}
|
|
2092
|
-
)
|
|
2093
|
-
] }),
|
|
2094
|
-
/* @__PURE__ */ jsxs22(Group12, { children: [
|
|
2095
|
-
"Upper Bound:",
|
|
2096
|
-
/* @__PURE__ */ jsx25(
|
|
2097
|
-
NumberInput10,
|
|
2098
|
-
{
|
|
2099
|
-
size: "xs",
|
|
2100
|
-
w: 100,
|
|
2101
|
-
value: upperBound,
|
|
2102
|
-
onChange: (e) => setUpperBound(Number(e)),
|
|
2103
|
-
step: 0.1
|
|
2104
|
-
}
|
|
2105
|
-
)
|
|
2106
|
-
] }),
|
|
2107
|
-
/* @__PURE__ */ jsx25(
|
|
2108
|
-
HandlesIncomingDataStatus2,
|
|
2109
|
-
{
|
|
2110
|
-
nodeId: id,
|
|
2111
|
-
handles: data.handles,
|
|
2112
|
-
handleKey: "dataId",
|
|
2113
|
-
onDataUpdated,
|
|
2114
|
-
type: "target",
|
|
2115
|
-
resetComputedData: true
|
|
2116
|
-
}
|
|
2117
|
-
)
|
|
2118
|
-
] }),
|
|
2119
|
-
/* @__PURE__ */ jsx25(NodeTrackConnections21, { handles: data.handles, nodeId: id, type: "target" })
|
|
2120
|
-
] });
|
|
2121
|
-
}
|
|
2122
|
-
var noise_select_node_default = NoiseSelectNode;
|
|
2123
|
-
|
|
2124
|
-
// src/nodes/transformers/noise-displace-node.tsx
|
|
2125
|
-
import { NodeContainer as NodeContainer26, NodeTrackConnections as NodeTrackConnections22 } from "@awesome-flow/core/layout";
|
|
2126
|
-
import { useCallback as useCallback19 } from "react";
|
|
2127
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData24 } from "@awesome-flow/core/hooks";
|
|
2128
|
-
import { Displace } from "libnoise-simplex-ts";
|
|
2129
|
-
import { HandlesIncomingDataStatus as HandlesIncomingDataStatus3 } from "@awesome-flow/core/components";
|
|
2130
|
-
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2131
|
-
function NoiseDisplaceNode({ id, selected, data, type }) {
|
|
2132
|
-
const updateComputedData = useUpdateNodeComputedData24();
|
|
2133
|
-
const onDataUpdated = useCallback19(
|
|
2134
|
-
(handleData) => {
|
|
2135
|
-
const sourceModule = handleData["source" /* sourceModule */];
|
|
2136
|
-
const xModule = handleData["x-module" /* xModule */];
|
|
2137
|
-
const yModule = handleData["y-module" /* yModule */];
|
|
2138
|
-
const zModule = handleData["z-module" /* zModule */];
|
|
2139
|
-
if (sourceModule && xModule && yModule && zModule) {
|
|
2140
|
-
const module = new Displace(
|
|
2141
|
-
sourceModule[0].module,
|
|
2142
|
-
xModule[0].module,
|
|
2143
|
-
yModule[0].module,
|
|
2144
|
-
zModule[0].module
|
|
2145
|
-
);
|
|
2146
|
-
updateComputedData(id, { module });
|
|
2147
|
-
}
|
|
2148
|
-
},
|
|
2149
|
-
[]
|
|
2150
|
-
);
|
|
2151
|
-
return /* @__PURE__ */ jsxs23(NodeContainer26, { id, selected, data, type, children: [
|
|
2152
|
-
/* @__PURE__ */ jsx26(
|
|
2153
|
-
HandlesIncomingDataStatus3,
|
|
2154
|
-
{
|
|
2155
|
-
nodeId: id,
|
|
2156
|
-
handles: data.handles,
|
|
2157
|
-
handleKey: "dataId",
|
|
2158
|
-
onDataUpdated,
|
|
2159
|
-
type: "target",
|
|
2160
|
-
resetComputedData: true
|
|
2161
|
-
}
|
|
2162
|
-
),
|
|
2163
|
-
/* @__PURE__ */ jsx26(NodeTrackConnections22, { handles: data.handles, nodeId: id, type: "target" })
|
|
2164
|
-
] });
|
|
2165
|
-
}
|
|
2166
|
-
var noise_displace_node_default = NoiseDisplaceNode;
|
|
2167
|
-
|
|
2168
|
-
// src/nodes/transformers/noise-rotate-point-node.tsx
|
|
2169
|
-
import { NodeContainer as NodeContainer27, NodeTrackConnections as NodeTrackConnections23 } from "@awesome-flow/core/layout";
|
|
2170
|
-
import { useEffect as useEffect19, useState as useState16 } from "react";
|
|
2171
|
-
import {
|
|
2172
|
-
useIncomingComputedData as useIncomingComputedData14,
|
|
2173
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData25,
|
|
2174
|
-
useUpdateNodeData as useUpdateNodeData12
|
|
2175
|
-
} from "@awesome-flow/core/hooks";
|
|
2176
|
-
import { Group as Group13, NumberInput as NumberInput11, Stack as Stack12 } from "@mantine/core";
|
|
2177
|
-
import { RotatePoint } from "libnoise-simplex-ts";
|
|
2178
|
-
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2179
|
-
function NoiseRotatePointNode({
|
|
2180
|
-
id,
|
|
2181
|
-
selected,
|
|
2182
|
-
data,
|
|
2183
|
-
type
|
|
2184
|
-
}) {
|
|
2185
|
-
const [xAngle, setXAngle] = useState16(data.xAngle);
|
|
2186
|
-
const [yAngle, setYAngle] = useState16(data.yAngle);
|
|
2187
|
-
const [zAngle, setZAngle] = useState16(data.zAngle);
|
|
2188
|
-
const incoming = useIncomingComputedData14(id);
|
|
2189
|
-
const updateNodeData = useUpdateNodeData12();
|
|
2190
|
-
const updateComputedData = useUpdateNodeComputedData25();
|
|
2191
|
-
useEffect19(() => {
|
|
2192
|
-
if (incoming?.length) {
|
|
2193
|
-
const module = new RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
|
|
2194
|
-
updateComputedData(id, { module });
|
|
2195
|
-
}
|
|
2196
|
-
updateNodeData(id, { xAngle, yAngle, zAngle });
|
|
2197
|
-
}, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
|
|
2198
|
-
return /* @__PURE__ */ jsxs24(NodeContainer27, { id, selected, data, type, children: [
|
|
2199
|
-
/* @__PURE__ */ jsxs24(Stack12, { children: [
|
|
2200
|
-
/* @__PURE__ */ jsxs24(Group13, { children: [
|
|
2201
|
-
"X Angle:",
|
|
2202
|
-
/* @__PURE__ */ jsx27(
|
|
2203
|
-
NumberInput11,
|
|
2204
|
-
{
|
|
2205
|
-
size: "xs",
|
|
2206
|
-
w: 100,
|
|
2207
|
-
value: xAngle,
|
|
2208
|
-
onChange: (e) => setXAngle(Number(e)),
|
|
2209
|
-
step: 0.01
|
|
2210
|
-
}
|
|
2211
|
-
)
|
|
2212
|
-
] }),
|
|
2213
|
-
/* @__PURE__ */ jsxs24(Group13, { children: [
|
|
2214
|
-
"Y Angle:",
|
|
2215
|
-
/* @__PURE__ */ jsx27(
|
|
2216
|
-
NumberInput11,
|
|
2217
|
-
{
|
|
2218
|
-
size: "xs",
|
|
2219
|
-
w: 100,
|
|
2220
|
-
value: yAngle,
|
|
2221
|
-
onChange: (e) => setYAngle(Number(e)),
|
|
2222
|
-
step: 0.01
|
|
2223
|
-
}
|
|
2224
|
-
)
|
|
2225
|
-
] }),
|
|
2226
|
-
/* @__PURE__ */ jsxs24(Group13, { children: [
|
|
2227
|
-
"Z Angle:",
|
|
2228
|
-
/* @__PURE__ */ jsx27(
|
|
2229
|
-
NumberInput11,
|
|
2230
|
-
{
|
|
2231
|
-
size: "xs",
|
|
2232
|
-
w: 100,
|
|
2233
|
-
value: zAngle,
|
|
2234
|
-
onChange: (e) => setZAngle(Number(e)),
|
|
2235
|
-
step: 0.01
|
|
2236
|
-
}
|
|
2237
|
-
)
|
|
2238
|
-
] })
|
|
2239
|
-
] }),
|
|
2240
|
-
/* @__PURE__ */ jsx27(NodeTrackConnections23, { handles: data.handles, nodeId: id, type: "target" })
|
|
2241
|
-
] });
|
|
2242
|
-
}
|
|
2243
|
-
var noise_rotate_point_node_default = NoiseRotatePointNode;
|
|
2244
|
-
|
|
2245
|
-
// src/nodes/transformers/noise-scale-point-node.tsx
|
|
2246
|
-
import { NodeContainer as NodeContainer28, NodeTrackConnections as NodeTrackConnections24 } from "@awesome-flow/core/layout";
|
|
2247
|
-
import { useEffect as useEffect20, useState as useState17 } from "react";
|
|
2248
|
-
import {
|
|
2249
|
-
useIncomingComputedData as useIncomingComputedData15,
|
|
2250
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData26,
|
|
2251
|
-
useUpdateNodeData as useUpdateNodeData13
|
|
2252
|
-
} from "@awesome-flow/core/hooks";
|
|
2253
|
-
import { Group as Group14, NumberInput as NumberInput12, Stack as Stack13 } from "@mantine/core";
|
|
2254
|
-
import { ScalePoint } from "libnoise-simplex-ts";
|
|
2255
|
-
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2256
|
-
function NoiseScalePointNode({
|
|
2257
|
-
id,
|
|
2258
|
-
selected,
|
|
2259
|
-
data,
|
|
2260
|
-
type
|
|
2261
|
-
}) {
|
|
2262
|
-
const [xScale, setXScale] = useState17(data.xScale);
|
|
2263
|
-
const [yScale, setYScale] = useState17(data.yScale);
|
|
2264
|
-
const [zScale, setZScale] = useState17(data.zScale);
|
|
2265
|
-
const incoming = useIncomingComputedData15(id);
|
|
2266
|
-
const updateNodeData = useUpdateNodeData13();
|
|
2267
|
-
const updateComputedData = useUpdateNodeComputedData26();
|
|
2268
|
-
useEffect20(() => {
|
|
2269
|
-
if (incoming?.length) {
|
|
2270
|
-
const module = new ScalePoint(incoming[0].module, xScale, yScale, zScale);
|
|
2271
|
-
updateComputedData(id, { module });
|
|
2272
|
-
}
|
|
2273
|
-
updateNodeData(id, { xScale, yScale, zScale });
|
|
2274
|
-
}, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
|
|
2275
|
-
return /* @__PURE__ */ jsxs25(NodeContainer28, { id, selected, data, type, children: [
|
|
2276
|
-
/* @__PURE__ */ jsxs25(Stack13, { children: [
|
|
2277
|
-
/* @__PURE__ */ jsxs25(Group14, { children: [
|
|
2278
|
-
"X Scale:",
|
|
2279
|
-
/* @__PURE__ */ jsx28(
|
|
2280
|
-
NumberInput12,
|
|
2281
|
-
{
|
|
2282
|
-
size: "xs",
|
|
2283
|
-
w: 100,
|
|
2284
|
-
value: xScale,
|
|
2285
|
-
onChange: (e) => setXScale(Number(e)),
|
|
2286
|
-
step: 0.01
|
|
2287
|
-
}
|
|
2288
|
-
)
|
|
2289
|
-
] }),
|
|
2290
|
-
/* @__PURE__ */ jsxs25(Group14, { children: [
|
|
2291
|
-
"Y Scale:",
|
|
2292
|
-
/* @__PURE__ */ jsx28(
|
|
2293
|
-
NumberInput12,
|
|
2294
|
-
{
|
|
2295
|
-
size: "xs",
|
|
2296
|
-
w: 100,
|
|
2297
|
-
value: yScale,
|
|
2298
|
-
onChange: (e) => setYScale(Number(e)),
|
|
2299
|
-
step: 0.01
|
|
2300
|
-
}
|
|
2301
|
-
)
|
|
2302
|
-
] }),
|
|
2303
|
-
/* @__PURE__ */ jsxs25(Group14, { children: [
|
|
2304
|
-
"Z Scale:",
|
|
2305
|
-
/* @__PURE__ */ jsx28(
|
|
2306
|
-
NumberInput12,
|
|
2307
|
-
{
|
|
2308
|
-
size: "xs",
|
|
2309
|
-
w: 100,
|
|
2310
|
-
value: zScale,
|
|
2311
|
-
onChange: (e) => setZScale(Number(e)),
|
|
2312
|
-
step: 0.01
|
|
2313
|
-
}
|
|
2314
|
-
)
|
|
2315
|
-
] })
|
|
2316
|
-
] }),
|
|
2317
|
-
/* @__PURE__ */ jsx28(NodeTrackConnections24, { handles: data.handles, nodeId: id, type: "target" })
|
|
2318
|
-
] });
|
|
2319
|
-
}
|
|
2320
|
-
var noise_scale_point_node_default = NoiseScalePointNode;
|
|
2321
|
-
|
|
2322
|
-
// src/nodes/transformers/noise-translate-point-node.tsx
|
|
2323
|
-
import { NodeContainer as NodeContainer29, NodeTrackConnections as NodeTrackConnections25 } from "@awesome-flow/core/layout";
|
|
2324
|
-
import { useEffect as useEffect21, useState as useState18 } from "react";
|
|
2325
|
-
import {
|
|
2326
|
-
useIncomingComputedData as useIncomingComputedData16,
|
|
2327
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData27,
|
|
2328
|
-
useUpdateNodeData as useUpdateNodeData14
|
|
2329
|
-
} from "@awesome-flow/core/hooks";
|
|
2330
|
-
import { Group as Group15, NumberInput as NumberInput13, Stack as Stack14 } from "@mantine/core";
|
|
2331
|
-
import { TranslatePoint } from "libnoise-simplex-ts";
|
|
2332
|
-
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2333
|
-
function NoiseTranslatePointNode({
|
|
2334
|
-
id,
|
|
2335
|
-
selected,
|
|
2336
|
-
data,
|
|
2337
|
-
type
|
|
2338
|
-
}) {
|
|
2339
|
-
const [translateX, setTranslateX] = useState18(data.translateX);
|
|
2340
|
-
const [translateY, setTranslateY] = useState18(data.translateY);
|
|
2341
|
-
const [translateZ, setTranslateZ] = useState18(data.translateZ);
|
|
2342
|
-
const incoming = useIncomingComputedData16(id);
|
|
2343
|
-
const updateNodeData = useUpdateNodeData14();
|
|
2344
|
-
const updateComputedData = useUpdateNodeComputedData27();
|
|
2345
|
-
useEffect21(() => {
|
|
2346
|
-
if (incoming?.length) {
|
|
2347
|
-
const module = new TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
|
|
2348
|
-
updateComputedData(id, { module });
|
|
2349
|
-
}
|
|
2350
|
-
updateNodeData(id, { translateX, translateY, translateZ });
|
|
2351
|
-
}, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
|
|
2352
|
-
return /* @__PURE__ */ jsxs26(NodeContainer29, { id, selected, data, type, children: [
|
|
2353
|
-
/* @__PURE__ */ jsxs26(Stack14, { children: [
|
|
2354
|
-
/* @__PURE__ */ jsxs26(Group15, { children: [
|
|
2355
|
-
"Translate X:",
|
|
2356
|
-
/* @__PURE__ */ jsx29(
|
|
2357
|
-
NumberInput13,
|
|
2358
|
-
{
|
|
2359
|
-
size: "xs",
|
|
2360
|
-
w: 100,
|
|
2361
|
-
value: translateX,
|
|
2362
|
-
onChange: (e) => setTranslateX(Number(e)),
|
|
2363
|
-
step: 1
|
|
2364
|
-
}
|
|
2365
|
-
)
|
|
2366
|
-
] }),
|
|
2367
|
-
/* @__PURE__ */ jsxs26(Group15, { children: [
|
|
2368
|
-
"Translate Y:",
|
|
2369
|
-
/* @__PURE__ */ jsx29(
|
|
2370
|
-
NumberInput13,
|
|
2371
|
-
{
|
|
2372
|
-
size: "xs",
|
|
2373
|
-
w: 100,
|
|
2374
|
-
value: translateY,
|
|
2375
|
-
onChange: (e) => setTranslateY(Number(e)),
|
|
2376
|
-
step: 1
|
|
2377
|
-
}
|
|
2378
|
-
)
|
|
2379
|
-
] }),
|
|
2380
|
-
/* @__PURE__ */ jsxs26(Group15, { children: [
|
|
2381
|
-
"Translate Z:",
|
|
2382
|
-
/* @__PURE__ */ jsx29(
|
|
2383
|
-
NumberInput13,
|
|
2384
|
-
{
|
|
2385
|
-
size: "xs",
|
|
2386
|
-
w: 100,
|
|
2387
|
-
value: translateZ,
|
|
2388
|
-
onChange: (e) => setTranslateZ(Number(e)),
|
|
2389
|
-
step: 1
|
|
2390
|
-
}
|
|
2391
|
-
)
|
|
2392
|
-
] })
|
|
2393
|
-
] }),
|
|
2394
|
-
/* @__PURE__ */ jsx29(NodeTrackConnections25, { handles: data.handles, nodeId: id, type: "target" })
|
|
2395
|
-
] });
|
|
2396
|
-
}
|
|
2397
|
-
var noise_translate_point_node_default = NoiseTranslatePointNode;
|
|
2398
|
-
|
|
2399
|
-
// src/nodes/transformers/noise-turbulence-node .tsx
|
|
2400
|
-
import { NodeContainer as NodeContainer30, NodeTrackConnections as NodeTrackConnections26 } from "@awesome-flow/core/layout";
|
|
2401
|
-
import { useCallback as useCallback20, useEffect as useEffect22, useState as useState19 } from "react";
|
|
2402
|
-
import { useIncomingComputedData as useIncomingComputedData17, useUpdateNodeComputedData as useUpdateNodeComputedData28 } from "@awesome-flow/core/hooks";
|
|
2403
|
-
import { Turbulence } from "libnoise-simplex-ts";
|
|
2404
|
-
import { NodePropertyVariables as NodePropertyVariables7 } from "@awesome-flow/core/components";
|
|
2405
|
-
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2406
|
-
function NoiseTurbulenceNode({
|
|
2407
|
-
id,
|
|
2408
|
-
selected,
|
|
2409
|
-
data,
|
|
2410
|
-
type
|
|
2411
|
-
}) {
|
|
2412
|
-
const [properties, setProperties] = useState19(null);
|
|
2413
|
-
const incoming = useIncomingComputedData17(id);
|
|
2414
|
-
const updateComputedData = useUpdateNodeComputedData28();
|
|
2415
|
-
const onPropertiesChange = useCallback20((props) => {
|
|
2416
|
-
setProperties(props);
|
|
2417
|
-
}, []);
|
|
2418
|
-
useEffect22(() => {
|
|
2419
|
-
if (incoming?.length && properties) {
|
|
2420
|
-
const module = new Turbulence(
|
|
2421
|
-
incoming[0].module,
|
|
2422
|
-
properties.frequency.value,
|
|
2423
|
-
properties.power.value,
|
|
2424
|
-
properties.roughness.value,
|
|
2425
|
-
properties.seed.value
|
|
2426
|
-
);
|
|
2427
|
-
updateComputedData(id, { module });
|
|
2428
|
-
}
|
|
2429
|
-
}, [id, incoming, properties]);
|
|
2430
|
-
return /* @__PURE__ */ jsxs27(NodeContainer30, { id, selected, data, type, children: [
|
|
2431
|
-
/* @__PURE__ */ jsx30(NodePropertyVariables7, { data, nodeId: id, onPropertiesChange }),
|
|
2432
|
-
/* @__PURE__ */ jsx30(NodeTrackConnections26, { handles: data.handles, nodeId: id, type: "target" })
|
|
2433
|
-
] });
|
|
2434
|
-
}
|
|
2435
|
-
var noise_turbulence_node_default = NoiseTurbulenceNode;
|
|
2436
|
-
|
|
2437
|
-
// src/templates/generators/noise-checkerboard-template.ts
|
|
2438
|
-
import { Position } from "@xyflow/system";
|
|
2439
|
-
var NoiseCheckerboardNodeTemplateFactory = class {
|
|
2440
|
-
template = {
|
|
2441
|
-
type: "noise-checkerboard" /* noiseCheckerboard */,
|
|
2442
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
2443
|
-
data: {
|
|
2444
|
-
title: "Checkerboard Noise"
|
|
2445
|
-
},
|
|
2446
|
-
handles: [
|
|
2447
|
-
{
|
|
2448
|
-
position: Position.Right,
|
|
2449
|
-
dataType: "module" /* module */,
|
|
2450
|
-
connection: "source"
|
|
2451
|
-
}
|
|
2452
|
-
]
|
|
2453
|
-
};
|
|
2454
|
-
};
|
|
2455
|
-
|
|
2456
|
-
// src/templates/generators/noise-const-template.ts
|
|
2457
|
-
import { Position as Position2 } from "@xyflow/system";
|
|
2458
|
-
var NoiseConstNodeTemplateFactory = class {
|
|
2459
|
-
template = {
|
|
2460
|
-
type: "noise-constant" /* noiseConst */,
|
|
2461
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
2462
|
-
data: {
|
|
2463
|
-
title: "Const Value Noise",
|
|
2464
|
-
noise: 0,
|
|
2465
|
-
min: -1,
|
|
2466
|
-
max: 1
|
|
2467
|
-
},
|
|
2468
|
-
handles: [
|
|
2469
|
-
{
|
|
2470
|
-
position: Position2.Right,
|
|
2471
|
-
dataType: "module" /* module */,
|
|
2472
|
-
connection: "source"
|
|
2473
|
-
}
|
|
2474
|
-
]
|
|
2475
|
-
};
|
|
2476
|
-
};
|
|
2477
|
-
|
|
2478
|
-
// src/templates/generators/noise-cylinders-template.ts
|
|
2479
|
-
import { CoreHandleType } from "@awesome-flow/core/abstract";
|
|
2480
|
-
import { Position as Position3 } from "@xyflow/system";
|
|
2481
|
-
var NoiseCylindersNodeTemplateFactory = class {
|
|
2482
|
-
template = {
|
|
2483
|
-
type: "noise-cylinders" /* noiseCylinders */,
|
|
2484
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
2485
|
-
data: {
|
|
2486
|
-
title: "Cylinders Noise",
|
|
2487
|
-
frequency: 0.1
|
|
2488
|
-
},
|
|
2489
|
-
handles: [
|
|
2490
|
-
{
|
|
2491
|
-
position: Position3.Left,
|
|
2492
|
-
dataType: CoreHandleType.variableProperty,
|
|
2493
|
-
connection: "target"
|
|
2494
|
-
},
|
|
2495
|
-
{
|
|
2496
|
-
position: Position3.Right,
|
|
2497
|
-
dataType: "module" /* module */,
|
|
2498
|
-
connection: "source"
|
|
2499
|
-
}
|
|
2500
|
-
]
|
|
2501
|
-
};
|
|
2502
|
-
};
|
|
2503
|
-
|
|
2504
|
-
// src/templates/generators/noise-perlin-template.ts
|
|
2505
|
-
import { CoreHandleType as CoreHandleType2 } from "@awesome-flow/core/abstract";
|
|
2506
|
-
import { Position as Position4 } from "@xyflow/system";
|
|
2507
|
-
var NoisePerlinNodeTemplateFactory = class {
|
|
2508
|
-
template = {
|
|
2509
|
-
type: "noise-perlin" /* noisePerlin */,
|
|
2510
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
2511
|
-
data: {
|
|
2512
|
-
title: "Perlin Noise",
|
|
2513
|
-
frequency: 0.1,
|
|
2514
|
-
lacunarity: 2,
|
|
2515
|
-
octaves: 5,
|
|
2516
|
-
persistence: 0.5,
|
|
2517
|
-
seed: 0
|
|
2518
|
-
},
|
|
2519
|
-
handles: [
|
|
2520
|
-
{
|
|
2521
|
-
position: Position4.Left,
|
|
2522
|
-
dataType: CoreHandleType2.variableProperty,
|
|
2523
|
-
connection: "target"
|
|
2524
|
-
},
|
|
2525
|
-
{
|
|
2526
|
-
position: Position4.Right,
|
|
2527
|
-
dataType: "module" /* module */,
|
|
2528
|
-
connection: "source"
|
|
2529
|
-
}
|
|
2530
|
-
]
|
|
2531
|
-
};
|
|
2532
|
-
};
|
|
2533
|
-
|
|
2534
|
-
// src/templates/generators/noise-ridgedmulti-template.ts
|
|
2535
|
-
import { CoreHandleType as CoreHandleType3 } from "@awesome-flow/core/abstract";
|
|
2536
|
-
import { Position as Position5 } from "@xyflow/system";
|
|
2537
|
-
var NoiseRidgedMultiNodeTemplateFactory = class {
|
|
2538
|
-
template = {
|
|
2539
|
-
type: "noise-ridged-multi" /* noiseRidgedMulti */,
|
|
2540
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
2541
|
-
data: {
|
|
2542
|
-
title: "Ridged Multi Noise",
|
|
2543
|
-
frequency: 0.1,
|
|
2544
|
-
lacunarity: 2,
|
|
2545
|
-
octaves: 6,
|
|
2546
|
-
offset: 1,
|
|
2547
|
-
gain: 2,
|
|
2548
|
-
seed: 0
|
|
2549
|
-
},
|
|
2550
|
-
handles: [
|
|
2551
|
-
{
|
|
2552
|
-
position: Position5.Left,
|
|
2553
|
-
dataType: CoreHandleType3.variableProperty,
|
|
2554
|
-
connection: "target"
|
|
2555
|
-
},
|
|
2556
|
-
{
|
|
2557
|
-
position: Position5.Right,
|
|
2558
|
-
dataType: "module" /* module */,
|
|
2559
|
-
connection: "source"
|
|
2560
|
-
}
|
|
2561
|
-
]
|
|
2562
|
-
};
|
|
2563
|
-
};
|
|
2564
|
-
|
|
2565
|
-
// src/templates/generators/noise-spheres-template.ts
|
|
2566
|
-
import { CoreHandleType as CoreHandleType4 } from "@awesome-flow/core/abstract";
|
|
2567
|
-
import { Position as Position6 } from "@xyflow/system";
|
|
2568
|
-
var NoiseSpheresNodeTemplateFactory = class {
|
|
2569
|
-
template = {
|
|
2570
|
-
type: "noise-spheres" /* noiseSpheres */,
|
|
2571
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
2572
|
-
data: {
|
|
2573
|
-
title: "Spheres Noise",
|
|
2574
|
-
frequency: 0.1
|
|
2575
|
-
},
|
|
2576
|
-
handles: [
|
|
2577
|
-
{
|
|
2578
|
-
position: Position6.Left,
|
|
2579
|
-
dataType: CoreHandleType4.variableProperty,
|
|
2580
|
-
connection: "target"
|
|
2581
|
-
},
|
|
2582
|
-
{
|
|
2583
|
-
position: Position6.Right,
|
|
2584
|
-
dataType: "module" /* module */,
|
|
2585
|
-
connection: "source"
|
|
2586
|
-
}
|
|
2587
|
-
]
|
|
2588
|
-
};
|
|
2589
|
-
};
|
|
2590
|
-
|
|
2591
|
-
// src/templates/generators/noise-voronoi-template.ts
|
|
2592
|
-
import { CoreHandleType as CoreHandleType5 } from "@awesome-flow/core/abstract";
|
|
2593
|
-
import { Position as Position7 } from "@xyflow/system";
|
|
2594
|
-
var NoiseVoronoiNodeTemplateFactory = class {
|
|
2595
|
-
template = {
|
|
2596
|
-
type: "noise-voronoi" /* noiseVoronoi */,
|
|
2597
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
2598
|
-
data: {
|
|
2599
|
-
title: "Voronoi Noise",
|
|
2600
|
-
frequency: 0.1,
|
|
2601
|
-
displacement: 1,
|
|
2602
|
-
distance: true,
|
|
2603
|
-
seed: 0
|
|
2604
|
-
},
|
|
2605
|
-
handles: [
|
|
2606
|
-
{
|
|
2607
|
-
position: Position7.Left,
|
|
2608
|
-
dataType: CoreHandleType5.variableProperty,
|
|
2609
|
-
connection: "target"
|
|
2610
|
-
},
|
|
2611
|
-
{
|
|
2612
|
-
position: Position7.Right,
|
|
2613
|
-
dataType: "module" /* module */,
|
|
2614
|
-
connection: "source"
|
|
2615
|
-
}
|
|
2616
|
-
]
|
|
2617
|
-
};
|
|
2618
|
-
};
|
|
2619
|
-
|
|
2620
|
-
// src/templates/generators/position-const-template.ts
|
|
2621
|
-
import { Position as Position8 } from "@xyflow/system";
|
|
2622
|
-
var PositionConstNodeTemplateFactory = class {
|
|
2623
|
-
template = {
|
|
2624
|
-
type: "position" /* position */,
|
|
2625
|
-
group: "Positions" /* positions */,
|
|
2626
|
-
data: {
|
|
2627
|
-
title: "Position Output",
|
|
2628
|
-
position: { x: 0, y: 0, z: 0 }
|
|
2629
|
-
},
|
|
2630
|
-
handles: [
|
|
2631
|
-
{
|
|
2632
|
-
position: Position8.Right,
|
|
2633
|
-
dataType: "position" /* position */,
|
|
2634
|
-
connection: "source"
|
|
2635
|
-
}
|
|
2636
|
-
]
|
|
2637
|
-
};
|
|
2638
|
-
};
|
|
2639
|
-
|
|
2640
|
-
// src/templates/generators/position-grid-template.ts
|
|
2641
|
-
import { Position as Position9 } from "@xyflow/system";
|
|
2642
|
-
var PositionGridNodeTemplateFactory = class {
|
|
2643
|
-
template = {
|
|
2644
|
-
type: "grid" /* grid */,
|
|
2645
|
-
group: "Positions" /* positions */,
|
|
2646
|
-
data: {
|
|
2647
|
-
title: "Grid Output",
|
|
2648
|
-
center: { x: 0, y: 0, z: 0 },
|
|
2649
|
-
radius: 1
|
|
2650
|
-
},
|
|
2651
|
-
handles: [
|
|
2652
|
-
{
|
|
2653
|
-
position: Position9.Right,
|
|
2654
|
-
dataType: "position" /* position */,
|
|
2655
|
-
connection: "source"
|
|
2656
|
-
}
|
|
2657
|
-
]
|
|
2658
|
-
};
|
|
2659
|
-
};
|
|
2660
|
-
|
|
2661
|
-
// src/templates/modifiers/noise-normalize-template.ts
|
|
2662
|
-
import { IDGenerator } from "@awesome-flow/core/utils";
|
|
2663
|
-
import { Position as Position10 } from "@xyflow/system";
|
|
2664
|
-
var NoiseNormalizeNodeTemplateFactory = class {
|
|
2665
|
-
template = {
|
|
2666
|
-
id: IDGenerator.template(),
|
|
2667
|
-
type: "noise-normalize" /* noiseNormalize */,
|
|
2668
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2669
|
-
data: {
|
|
2670
|
-
title: "Normalize Noise",
|
|
2671
|
-
intervalStart: -1,
|
|
2672
|
-
intervalEnd: 1
|
|
2673
|
-
},
|
|
2674
|
-
handles: [
|
|
2675
|
-
{
|
|
2676
|
-
position: Position10.Left,
|
|
2677
|
-
dataType: "module" /* module */,
|
|
2678
|
-
connection: "target",
|
|
2679
|
-
maxConnections: 1
|
|
2680
|
-
},
|
|
2681
|
-
{
|
|
2682
|
-
position: Position10.Right,
|
|
2683
|
-
dataType: "module" /* module */,
|
|
2684
|
-
connection: "source"
|
|
2685
|
-
}
|
|
2686
|
-
]
|
|
2687
|
-
};
|
|
2688
|
-
};
|
|
2689
|
-
|
|
2690
|
-
// src/templates/output/noise-logger-template.ts
|
|
2691
|
-
import { Position as Position11 } from "@xyflow/system";
|
|
2692
|
-
var NoiseLoggerNodeTemplateFactory = class {
|
|
2693
|
-
template = {
|
|
2694
|
-
type: "noise-logger" /* noiseLogger */,
|
|
2695
|
-
group: "Output" /* output */,
|
|
2696
|
-
data: {
|
|
2697
|
-
title: "Noise Logger"
|
|
2698
|
-
},
|
|
2699
|
-
handles: [
|
|
2700
|
-
{
|
|
2701
|
-
position: Position11.Left,
|
|
2702
|
-
dataType: "noise" /* noise */,
|
|
2703
|
-
connection: "target"
|
|
2704
|
-
}
|
|
2705
|
-
]
|
|
2706
|
-
};
|
|
2707
|
-
};
|
|
2708
|
-
|
|
2709
|
-
// src/templates/output/noise-raw-texture-template.ts
|
|
2710
|
-
import { Position as Position12 } from "@xyflow/system";
|
|
2711
|
-
var NoiseRawTextureTemplateFactory = class {
|
|
2712
|
-
template = {
|
|
2713
|
-
type: "texture-data" /* textureData */,
|
|
2714
|
-
group: "Output" /* output */,
|
|
2715
|
-
data: {
|
|
2716
|
-
title: "Texture Data"
|
|
2717
|
-
},
|
|
2718
|
-
handles: [
|
|
2719
|
-
{
|
|
2720
|
-
position: Position12.Left,
|
|
2721
|
-
dataType: "noise" /* noise */,
|
|
2722
|
-
connection: "target",
|
|
2723
|
-
maxConnections: 1
|
|
2724
|
-
},
|
|
2725
|
-
{
|
|
2726
|
-
position: Position12.Right,
|
|
2727
|
-
dataType: "texture" /* texture */,
|
|
2728
|
-
connection: "source"
|
|
2729
|
-
}
|
|
2730
|
-
]
|
|
2731
|
-
};
|
|
2732
|
-
};
|
|
2733
|
-
|
|
2734
|
-
// src/templates/output/position-logger-template.ts
|
|
2735
|
-
import { Position as Position13 } from "@xyflow/system";
|
|
2736
|
-
var PositionLoggerNodeTemplateFactory = class {
|
|
2737
|
-
template = {
|
|
2738
|
-
type: "position-logger" /* positionLogger */,
|
|
2739
|
-
group: "Positions" /* positions */,
|
|
2740
|
-
data: {
|
|
2741
|
-
title: "Position Logger"
|
|
2742
|
-
},
|
|
2743
|
-
handles: [
|
|
2744
|
-
{
|
|
2745
|
-
position: Position13.Left,
|
|
2746
|
-
dataType: "position" /* position */,
|
|
2747
|
-
connection: "target"
|
|
2748
|
-
}
|
|
2749
|
-
]
|
|
2750
|
-
};
|
|
2751
|
-
};
|
|
2752
|
-
|
|
2753
|
-
// src/templates/modifiers/noise-combine-template.ts
|
|
2754
|
-
import { Position as Position14 } from "@xyflow/system";
|
|
2755
|
-
var NoiseCombineNodeTemplateFactory = class {
|
|
2756
|
-
template = {
|
|
2757
|
-
type: "noise-combiner" /* noiseCombine */,
|
|
2758
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2759
|
-
data: {
|
|
2760
|
-
title: "Combine Noise",
|
|
2761
|
-
operation: "add" /* add */
|
|
2762
|
-
},
|
|
2763
|
-
handles: [
|
|
2764
|
-
{
|
|
2765
|
-
position: Position14.Left,
|
|
2766
|
-
dataType: "module" /* module */,
|
|
2767
|
-
connection: "target",
|
|
2768
|
-
maxConnections: 2
|
|
2769
|
-
},
|
|
2770
|
-
{
|
|
2771
|
-
position: Position14.Right,
|
|
2772
|
-
dataType: "module" /* module */,
|
|
2773
|
-
connection: "source"
|
|
2774
|
-
}
|
|
2775
|
-
]
|
|
2776
|
-
};
|
|
2777
|
-
};
|
|
2778
|
-
|
|
2779
|
-
// src/templates/modifiers/noise-clamp-template.ts
|
|
2780
|
-
import { Position as Position15 } from "@xyflow/system";
|
|
2781
|
-
var NoiseClampNodeTemplateFactory = class {
|
|
2782
|
-
template = {
|
|
2783
|
-
type: "noise-clamp" /* noiseClamp */,
|
|
2784
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2785
|
-
data: {
|
|
2786
|
-
title: "Clamp Noise",
|
|
2787
|
-
lowerBound: -1,
|
|
2788
|
-
upperBound: 1
|
|
2789
|
-
},
|
|
2790
|
-
handles: [
|
|
2791
|
-
{
|
|
2792
|
-
position: Position15.Left,
|
|
2793
|
-
dataType: "module" /* module */,
|
|
2794
|
-
connection: "target",
|
|
2795
|
-
maxConnections: 1
|
|
2796
|
-
},
|
|
2797
|
-
{
|
|
2798
|
-
position: Position15.Right,
|
|
2799
|
-
dataType: "module" /* module */,
|
|
2800
|
-
connection: "source"
|
|
2801
|
-
}
|
|
2802
|
-
]
|
|
2803
|
-
};
|
|
2804
|
-
};
|
|
2805
|
-
|
|
2806
|
-
// src/templates/modifiers/noise-abs-template.ts
|
|
2807
|
-
import { Position as Position16 } from "@xyflow/system";
|
|
2808
|
-
var NoiseAbsNodeTemplateFactory = class {
|
|
2809
|
-
template = {
|
|
2810
|
-
type: "noise-abs" /* noiseAbs */,
|
|
2811
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2812
|
-
data: {
|
|
2813
|
-
title: "Abs Noise"
|
|
2814
|
-
},
|
|
2815
|
-
handles: [
|
|
2816
|
-
{
|
|
2817
|
-
position: Position16.Left,
|
|
2818
|
-
dataType: "module" /* module */,
|
|
2819
|
-
connection: "target",
|
|
2820
|
-
maxConnections: 1
|
|
2821
|
-
},
|
|
2822
|
-
{
|
|
2823
|
-
position: Position16.Right,
|
|
2824
|
-
dataType: "module" /* module */,
|
|
2825
|
-
connection: "source"
|
|
2826
|
-
}
|
|
2827
|
-
]
|
|
2828
|
-
};
|
|
2829
|
-
};
|
|
2830
|
-
|
|
2831
|
-
// src/templates/output/noise-output-template.ts
|
|
2832
|
-
import { Position as Position17 } from "@xyflow/system";
|
|
2833
|
-
var NoiseOutputNodeTemplateFactory = class {
|
|
2834
|
-
template = {
|
|
2835
|
-
type: "noise-output" /* noiseOutput */,
|
|
2836
|
-
group: "Output" /* output */,
|
|
2837
|
-
data: {
|
|
2838
|
-
title: "Noise Output"
|
|
2839
|
-
},
|
|
2840
|
-
handles: [
|
|
2841
|
-
{
|
|
2842
|
-
position: Position17.Left,
|
|
2843
|
-
dataType: "position" /* position */,
|
|
2844
|
-
connection: "target"
|
|
2845
|
-
},
|
|
2846
|
-
{
|
|
2847
|
-
position: Position17.Left,
|
|
2848
|
-
dataType: "module" /* module */,
|
|
2849
|
-
connection: "target",
|
|
2850
|
-
maxConnections: 1
|
|
2851
|
-
},
|
|
2852
|
-
{
|
|
2853
|
-
position: Position17.Right,
|
|
2854
|
-
dataType: "noise" /* noise */,
|
|
2855
|
-
connection: "source"
|
|
2856
|
-
}
|
|
2857
|
-
]
|
|
2858
|
-
};
|
|
2859
|
-
};
|
|
2860
|
-
|
|
2861
|
-
// src/templates/modifiers/noise-curve-template.ts
|
|
2862
|
-
import { Position as Position18 } from "@xyflow/system";
|
|
2863
|
-
var NoiseCurveNodeTemplateFactory = class {
|
|
2864
|
-
template = {
|
|
2865
|
-
type: "noise-curve" /* noiseCurve */,
|
|
2866
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2867
|
-
data: {
|
|
2868
|
-
title: "Noise Curve",
|
|
2869
|
-
points: []
|
|
2870
|
-
},
|
|
2871
|
-
handles: [
|
|
2872
|
-
{
|
|
2873
|
-
position: Position18.Left,
|
|
2874
|
-
dataType: "module" /* module */,
|
|
2875
|
-
connection: "target",
|
|
2876
|
-
maxConnections: 1
|
|
2877
|
-
},
|
|
2878
|
-
// {
|
|
2879
|
-
// position: Position.Left,
|
|
2880
|
-
// dataType: CoreHandleType.variableProperty,
|
|
2881
|
-
// connection: 'target',
|
|
2882
|
-
// },
|
|
2883
|
-
{
|
|
2884
|
-
position: Position18.Right,
|
|
2885
|
-
dataType: "module" /* module */,
|
|
2886
|
-
connection: "source"
|
|
2887
|
-
}
|
|
2888
|
-
]
|
|
2889
|
-
};
|
|
2890
|
-
};
|
|
2891
|
-
|
|
2892
|
-
// src/templates/modifiers/noise-exponent-template.ts
|
|
2893
|
-
import { Position as Position19 } from "@xyflow/system";
|
|
2894
|
-
var NoiseExponentNodeTemplateFactory = class {
|
|
2895
|
-
template = {
|
|
2896
|
-
type: "noise-exponent" /* noiseExponent */,
|
|
2897
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2898
|
-
data: {
|
|
2899
|
-
title: "Noise Exponent",
|
|
2900
|
-
exponent: 1
|
|
2901
|
-
},
|
|
2902
|
-
handles: [
|
|
2903
|
-
{
|
|
2904
|
-
position: Position19.Left,
|
|
2905
|
-
dataType: "module" /* module */,
|
|
2906
|
-
connection: "target",
|
|
2907
|
-
maxConnections: 1
|
|
2908
|
-
},
|
|
2909
|
-
{
|
|
2910
|
-
position: Position19.Right,
|
|
2911
|
-
dataType: "module" /* module */,
|
|
2912
|
-
connection: "source"
|
|
2913
|
-
}
|
|
2914
|
-
]
|
|
2915
|
-
};
|
|
2916
|
-
};
|
|
2917
|
-
|
|
2918
|
-
// src/templates/modifiers/noise-invert-template.ts
|
|
2919
|
-
import { Position as Position20 } from "@xyflow/system";
|
|
2920
|
-
var NoiseInvertNodeTemplateFactory = class {
|
|
2921
|
-
template = {
|
|
2922
|
-
type: "noise-invert" /* noiseInvert */,
|
|
2923
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2924
|
-
data: {
|
|
2925
|
-
title: "Invert Noise"
|
|
2926
|
-
},
|
|
2927
|
-
handles: [
|
|
2928
|
-
{
|
|
2929
|
-
position: Position20.Left,
|
|
2930
|
-
dataType: "module" /* module */,
|
|
2931
|
-
connection: "target",
|
|
2932
|
-
maxConnections: 1
|
|
2933
|
-
},
|
|
2934
|
-
{
|
|
2935
|
-
position: Position20.Right,
|
|
2936
|
-
dataType: "module" /* module */,
|
|
2937
|
-
connection: "source"
|
|
2938
|
-
}
|
|
2939
|
-
]
|
|
2940
|
-
};
|
|
2941
|
-
};
|
|
2942
|
-
|
|
2943
|
-
// src/templates/modifiers/noise-scalebias-template.ts
|
|
2944
|
-
import { Position as Position21 } from "@xyflow/system";
|
|
2945
|
-
var NoiseScaleBiasNodeTemplateFactory = class {
|
|
2946
|
-
template = {
|
|
2947
|
-
type: "noise-scale-bias" /* noiseScaleBias */,
|
|
2948
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2949
|
-
data: {
|
|
2950
|
-
title: "Scale/Bias Noise",
|
|
2951
|
-
scale: 1,
|
|
2952
|
-
bias: 0
|
|
2953
|
-
},
|
|
2954
|
-
handles: [
|
|
2955
|
-
{
|
|
2956
|
-
position: Position21.Left,
|
|
2957
|
-
dataType: "module" /* module */,
|
|
2958
|
-
connection: "target",
|
|
2959
|
-
maxConnections: 1
|
|
2960
|
-
},
|
|
2961
|
-
{
|
|
2962
|
-
position: Position21.Right,
|
|
2963
|
-
dataType: "module" /* module */,
|
|
2964
|
-
connection: "source"
|
|
2965
|
-
}
|
|
2966
|
-
]
|
|
2967
|
-
};
|
|
2968
|
-
};
|
|
2969
|
-
|
|
2970
|
-
// src/templates/modifiers/noise-terrace-template.ts
|
|
2971
|
-
import { Position as Position22 } from "@xyflow/system";
|
|
2972
|
-
var NoiseTerraceNodeTemplateFactory = class {
|
|
2973
|
-
template = {
|
|
2974
|
-
type: "noise-terrace" /* noiseTerrace */,
|
|
2975
|
-
group: "Noise Modifiers" /* noiseModifiers */,
|
|
2976
|
-
data: {
|
|
2977
|
-
title: "Noise Terrace",
|
|
2978
|
-
points: []
|
|
2979
|
-
},
|
|
2980
|
-
handles: [
|
|
2981
|
-
{
|
|
2982
|
-
position: Position22.Left,
|
|
2983
|
-
dataType: "module" /* module */,
|
|
2984
|
-
connection: "target",
|
|
2985
|
-
maxConnections: 1
|
|
2986
|
-
},
|
|
2987
|
-
{
|
|
2988
|
-
position: Position22.Right,
|
|
2989
|
-
dataType: "module" /* module */,
|
|
2990
|
-
connection: "source"
|
|
2991
|
-
}
|
|
2992
|
-
]
|
|
2993
|
-
};
|
|
2994
|
-
};
|
|
2995
|
-
|
|
2996
|
-
// src/templates/selectors/noise-blend-template.ts
|
|
2997
|
-
import { Position as Position23 } from "@xyflow/system";
|
|
2998
|
-
var NoiseBlendNodeTemplateFactory = class {
|
|
2999
|
-
template = {
|
|
3000
|
-
type: "noise-blend" /* noiseBlend */,
|
|
3001
|
-
group: "Noise Selectors" /* noiseSelectors */,
|
|
3002
|
-
data: {
|
|
3003
|
-
title: "Noise Blend"
|
|
3004
|
-
},
|
|
3005
|
-
handles: [
|
|
3006
|
-
{
|
|
3007
|
-
position: Position23.Left,
|
|
3008
|
-
dataType: "module" /* module */,
|
|
3009
|
-
connection: "target",
|
|
3010
|
-
label: "Source Modules",
|
|
3011
|
-
dataId: "source" /* source */,
|
|
3012
|
-
maxConnections: 2,
|
|
3013
|
-
minConnections: 2
|
|
3014
|
-
},
|
|
3015
|
-
{
|
|
3016
|
-
position: Position23.Left,
|
|
3017
|
-
dataType: "module" /* module */,
|
|
3018
|
-
dataId: "control" /* control */,
|
|
3019
|
-
connection: "target",
|
|
3020
|
-
label: "Control Module",
|
|
3021
|
-
maxConnections: 1
|
|
3022
|
-
},
|
|
3023
|
-
{
|
|
3024
|
-
position: Position23.Right,
|
|
3025
|
-
dataType: "module" /* module */,
|
|
3026
|
-
dataId: "output" /* output */,
|
|
3027
|
-
connection: "source"
|
|
3028
|
-
}
|
|
3029
|
-
]
|
|
3030
|
-
};
|
|
3031
|
-
};
|
|
3032
|
-
|
|
3033
|
-
// src/templates/selectors/noise-select-template.ts
|
|
3034
|
-
import { Position as Position24 } from "@xyflow/system";
|
|
3035
|
-
var NoiseSelectNodeTemplateFactory = class {
|
|
3036
|
-
template = {
|
|
3037
|
-
type: "noise-select" /* noiseSelect */,
|
|
3038
|
-
group: "Noise Selectors" /* noiseSelectors */,
|
|
3039
|
-
data: {
|
|
3040
|
-
title: "Noise Select",
|
|
3041
|
-
edgeFalloff: 0,
|
|
3042
|
-
lowerBound: -1,
|
|
3043
|
-
upperBound: 1
|
|
3044
|
-
},
|
|
3045
|
-
handles: [
|
|
3046
|
-
{
|
|
3047
|
-
position: Position24.Left,
|
|
3048
|
-
dataType: "module" /* module */,
|
|
3049
|
-
dataId: "source" /* source */,
|
|
3050
|
-
connection: "target",
|
|
3051
|
-
label: "Source Modules",
|
|
3052
|
-
maxConnections: 2,
|
|
3053
|
-
minConnections: 2
|
|
3054
|
-
},
|
|
3055
|
-
{
|
|
3056
|
-
position: Position24.Left,
|
|
3057
|
-
dataType: "module" /* module */,
|
|
3058
|
-
dataId: "control" /* control */,
|
|
3059
|
-
connection: "target",
|
|
3060
|
-
label: "Control Module",
|
|
3061
|
-
maxConnections: 1
|
|
3062
|
-
},
|
|
3063
|
-
{
|
|
3064
|
-
position: Position24.Right,
|
|
3065
|
-
dataType: "module" /* module */,
|
|
3066
|
-
dataId: "output" /* output */,
|
|
3067
|
-
connection: "source"
|
|
3068
|
-
}
|
|
3069
|
-
]
|
|
3070
|
-
};
|
|
3071
|
-
};
|
|
3072
|
-
|
|
3073
|
-
// src/templates/transformers/noise-displace-template.ts
|
|
3074
|
-
import { Position as Position25 } from "@xyflow/system";
|
|
3075
|
-
var NoiseDisplaceNodeTemplateFactory = class {
|
|
3076
|
-
template = {
|
|
3077
|
-
type: "noise-displace" /* noiseDisplace */,
|
|
3078
|
-
group: "Noise Transformers" /* noiseTransformers */,
|
|
3079
|
-
data: {
|
|
3080
|
-
title: "Noise Displace"
|
|
3081
|
-
},
|
|
3082
|
-
handles: [
|
|
3083
|
-
{
|
|
3084
|
-
position: Position25.Left,
|
|
3085
|
-
connection: "target",
|
|
3086
|
-
label: "Source Module",
|
|
3087
|
-
dataType: "module" /* module */,
|
|
3088
|
-
dataId: "source" /* sourceModule */,
|
|
3089
|
-
maxConnections: 1
|
|
3090
|
-
},
|
|
3091
|
-
{
|
|
3092
|
-
position: Position25.Left,
|
|
3093
|
-
connection: "target",
|
|
3094
|
-
label: "X Module",
|
|
3095
|
-
dataType: "module" /* module */,
|
|
3096
|
-
dataId: "x-module" /* xModule */,
|
|
3097
|
-
maxConnections: 1
|
|
3098
|
-
},
|
|
3099
|
-
{
|
|
3100
|
-
position: Position25.Left,
|
|
3101
|
-
connection: "target",
|
|
3102
|
-
label: "Y Module",
|
|
3103
|
-
dataType: "module" /* module */,
|
|
3104
|
-
dataId: "y-module" /* yModule */,
|
|
3105
|
-
maxConnections: 1
|
|
3106
|
-
},
|
|
3107
|
-
{
|
|
3108
|
-
position: Position25.Left,
|
|
3109
|
-
connection: "target",
|
|
3110
|
-
label: "Z Module",
|
|
3111
|
-
dataType: "module" /* module */,
|
|
3112
|
-
dataId: "z-module" /* zModule */,
|
|
3113
|
-
maxConnections: 1
|
|
3114
|
-
},
|
|
3115
|
-
{
|
|
3116
|
-
position: Position25.Right,
|
|
3117
|
-
dataType: "module" /* module */,
|
|
3118
|
-
dataId: "output" /* output */,
|
|
3119
|
-
connection: "source"
|
|
3120
|
-
}
|
|
3121
|
-
]
|
|
3122
|
-
};
|
|
3123
|
-
};
|
|
3124
|
-
|
|
3125
|
-
// src/templates/transformers/noise-rotate-point-template.ts
|
|
3126
|
-
import { Position as Position26 } from "@xyflow/system";
|
|
3127
|
-
var NoiseRotatePointNodeTemplateFactory = class {
|
|
3128
|
-
template = {
|
|
3129
|
-
type: "noise-rotate-point" /* noiseRotatePoint */,
|
|
3130
|
-
group: "Noise Transformers" /* noiseTransformers */,
|
|
3131
|
-
data: {
|
|
3132
|
-
title: "Noise Rotate Point",
|
|
3133
|
-
xAngle: 0,
|
|
3134
|
-
yAngle: 0,
|
|
3135
|
-
zAngle: 0
|
|
3136
|
-
},
|
|
3137
|
-
handles: [
|
|
3138
|
-
{
|
|
3139
|
-
position: Position26.Left,
|
|
3140
|
-
dataType: "module" /* module */,
|
|
3141
|
-
connection: "target",
|
|
3142
|
-
label: "Source Module",
|
|
3143
|
-
maxConnections: 1
|
|
3144
|
-
},
|
|
3145
|
-
{
|
|
3146
|
-
position: Position26.Right,
|
|
3147
|
-
dataType: "module" /* module */,
|
|
3148
|
-
connection: "source"
|
|
3149
|
-
}
|
|
3150
|
-
]
|
|
3151
|
-
};
|
|
3152
|
-
};
|
|
3153
|
-
|
|
3154
|
-
// src/templates/transformers/noise-scale-point-template.ts
|
|
3155
|
-
import { Position as Position27 } from "@xyflow/system";
|
|
3156
|
-
var NoiseScalePointNodeTemplateFactory = class {
|
|
3157
|
-
template = {
|
|
3158
|
-
type: "noise-scale-point" /* noiseScalePoint */,
|
|
3159
|
-
group: "Noise Transformers" /* noiseTransformers */,
|
|
3160
|
-
data: {
|
|
3161
|
-
title: "Noise Scale Point",
|
|
3162
|
-
xScale: 1,
|
|
3163
|
-
yScale: 1,
|
|
3164
|
-
zScale: 1
|
|
3165
|
-
},
|
|
3166
|
-
handles: [
|
|
3167
|
-
{
|
|
3168
|
-
position: Position27.Left,
|
|
3169
|
-
dataType: "module" /* module */,
|
|
3170
|
-
connection: "target",
|
|
3171
|
-
label: "Source Module",
|
|
3172
|
-
maxConnections: 1
|
|
3173
|
-
},
|
|
3174
|
-
{
|
|
3175
|
-
position: Position27.Right,
|
|
3176
|
-
dataType: "module" /* module */,
|
|
3177
|
-
connection: "source"
|
|
3178
|
-
}
|
|
3179
|
-
]
|
|
3180
|
-
};
|
|
3181
|
-
};
|
|
3182
|
-
|
|
3183
|
-
// src/templates/transformers/noise-translate-point-template.ts
|
|
3184
|
-
import { Position as Position28 } from "@xyflow/system";
|
|
3185
|
-
var NoiseTranslatePointNodeTemplateFactory = class {
|
|
3186
|
-
template = {
|
|
3187
|
-
type: "noise-translate-point" /* noiseTranslatePoint */,
|
|
3188
|
-
group: "Noise Transformers" /* noiseTransformers */,
|
|
3189
|
-
data: {
|
|
3190
|
-
title: "Noise Translate Point",
|
|
3191
|
-
translateX: 0,
|
|
3192
|
-
translateY: 0,
|
|
3193
|
-
translateZ: 0
|
|
3194
|
-
},
|
|
3195
|
-
handles: [
|
|
3196
|
-
{
|
|
3197
|
-
position: Position28.Left,
|
|
3198
|
-
dataType: "module" /* module */,
|
|
3199
|
-
connection: "target",
|
|
3200
|
-
label: "Source Module",
|
|
3201
|
-
maxConnections: 1
|
|
3202
|
-
},
|
|
3203
|
-
{
|
|
3204
|
-
position: Position28.Right,
|
|
3205
|
-
dataType: "module" /* module */,
|
|
3206
|
-
connection: "source"
|
|
3207
|
-
}
|
|
3208
|
-
]
|
|
3209
|
-
};
|
|
3210
|
-
};
|
|
3211
|
-
|
|
3212
|
-
// src/templates/transformers/noise-turbulence-template.ts
|
|
3213
|
-
import { CoreHandleType as CoreHandleType6 } from "@awesome-flow/core/abstract";
|
|
3214
|
-
import { Position as Position29 } from "@xyflow/system";
|
|
3215
|
-
var NoiseTurbulenceNodeTemplateFactory = class {
|
|
3216
|
-
template = {
|
|
3217
|
-
type: "noise-turbulence" /* noiseTurbulence */,
|
|
3218
|
-
group: "Noise Transformers" /* noiseTransformers */,
|
|
3219
|
-
data: {
|
|
3220
|
-
title: "Noise Turbulence",
|
|
3221
|
-
frequency: 1,
|
|
3222
|
-
power: 1,
|
|
3223
|
-
roughness: 1,
|
|
3224
|
-
seed: 0
|
|
3225
|
-
},
|
|
3226
|
-
handles: [
|
|
3227
|
-
{
|
|
3228
|
-
position: Position29.Left,
|
|
3229
|
-
dataType: "module" /* module */,
|
|
3230
|
-
connection: "target",
|
|
3231
|
-
label: "Source Module",
|
|
3232
|
-
maxConnections: 1
|
|
3233
|
-
},
|
|
3234
|
-
{
|
|
3235
|
-
position: Position29.Left,
|
|
3236
|
-
dataType: CoreHandleType6.variableProperty,
|
|
3237
|
-
label: "Variable Properties",
|
|
3238
|
-
connection: "target"
|
|
3239
|
-
},
|
|
3240
|
-
{
|
|
3241
|
-
position: Position29.Right,
|
|
3242
|
-
dataType: "module" /* module */,
|
|
3243
|
-
connection: "source"
|
|
3244
|
-
}
|
|
3245
|
-
]
|
|
3246
|
-
};
|
|
3247
|
-
};
|
|
3248
|
-
|
|
3249
|
-
// src/templates/generators/noise-billow-template.ts
|
|
3250
|
-
import { CoreHandleType as CoreHandleType7 } from "@awesome-flow/core/abstract";
|
|
3251
|
-
import { IDGenerator as IDGenerator2 } from "@awesome-flow/core/utils";
|
|
3252
|
-
import { Position as Position30 } from "@xyflow/system";
|
|
3253
|
-
var NoiseBillowNodeTemplateFactory = class {
|
|
3254
|
-
template = {
|
|
3255
|
-
id: IDGenerator2.template(),
|
|
3256
|
-
type: "noise-billow" /* noiseBillow */,
|
|
3257
|
-
group: "Noise Generators" /* noiseGenerators */,
|
|
3258
|
-
data: {
|
|
3259
|
-
title: "Billow Noise",
|
|
3260
|
-
frequency: 0.1,
|
|
3261
|
-
lacunarity: 2,
|
|
3262
|
-
octaves: 5,
|
|
3263
|
-
persistence: 0.5,
|
|
3264
|
-
seed: 0
|
|
3265
|
-
},
|
|
3266
|
-
handles: [
|
|
3267
|
-
{
|
|
3268
|
-
position: Position30.Left,
|
|
3269
|
-
dataType: CoreHandleType7.variableProperty,
|
|
3270
|
-
connection: "target"
|
|
3271
|
-
},
|
|
3272
|
-
{
|
|
3273
|
-
position: Position30.Right,
|
|
3274
|
-
dataType: "module" /* module */,
|
|
3275
|
-
connection: "source"
|
|
3276
|
-
}
|
|
3277
|
-
]
|
|
3278
|
-
};
|
|
3279
|
-
};
|
|
3280
|
-
|
|
3281
|
-
// src/templates/groups/module-group-template.ts
|
|
3282
|
-
import {
|
|
3283
|
-
CoreTemplateGroup
|
|
3284
|
-
} from "@awesome-flow/core/abstract";
|
|
3285
|
-
import { IDGenerator as IDGenerator3 } from "@awesome-flow/core/utils";
|
|
3286
|
-
import { Position as Position31 } from "@xyflow/system";
|
|
3287
|
-
var ModuleGroupNodeTemplateFactory = class {
|
|
3288
|
-
template = {
|
|
3289
|
-
id: IDGenerator3.template(),
|
|
3290
|
-
type: "group-module" /* groupModule */,
|
|
3291
|
-
group: CoreTemplateGroup.groups,
|
|
3292
|
-
data: {
|
|
3293
|
-
title: "Modules Group",
|
|
3294
|
-
isGroup: true,
|
|
3295
|
-
initialSize: {
|
|
3296
|
-
width: 300,
|
|
3297
|
-
height: 200
|
|
3298
|
-
},
|
|
3299
|
-
collapsedSize: {
|
|
3300
|
-
width: 300,
|
|
3301
|
-
height: 80
|
|
3302
|
-
}
|
|
3303
|
-
},
|
|
3304
|
-
handles: [
|
|
3305
|
-
{
|
|
3306
|
-
position: Position31.Bottom,
|
|
3307
|
-
dataType: "module" /* module */,
|
|
3308
|
-
connection: "target",
|
|
3309
|
-
maxConnections: 1,
|
|
3310
|
-
hideOnCollapse: true
|
|
3311
|
-
},
|
|
3312
|
-
{
|
|
3313
|
-
position: Position31.Right,
|
|
3314
|
-
dataType: "module" /* module */,
|
|
3315
|
-
connection: "source"
|
|
3316
|
-
}
|
|
3317
|
-
]
|
|
3318
|
-
};
|
|
3319
|
-
};
|
|
3320
|
-
|
|
3321
|
-
// src/abstract/node-types.ts
|
|
3322
|
-
var noiseNodeTemplates = {
|
|
3323
|
-
["noise-output" /* noiseOutput */]: new NoiseOutputNodeTemplateFactory(),
|
|
3324
|
-
["noise-billow" /* noiseBillow */]: new NoiseBillowNodeTemplateFactory(),
|
|
3325
|
-
["noise-checkerboard" /* noiseCheckerboard */]: new NoiseCheckerboardNodeTemplateFactory(),
|
|
3326
|
-
["noise-normalize" /* noiseNormalize */]: new NoiseNormalizeNodeTemplateFactory(),
|
|
3327
|
-
["noise-logger" /* noiseLogger */]: new NoiseLoggerNodeTemplateFactory(),
|
|
3328
|
-
["noise-constant" /* noiseConst */]: new NoiseConstNodeTemplateFactory(),
|
|
3329
|
-
["position" /* position */]: new PositionConstNodeTemplateFactory(),
|
|
3330
|
-
["position-logger" /* positionLogger */]: new PositionLoggerNodeTemplateFactory(),
|
|
3331
|
-
["grid" /* grid */]: new PositionGridNodeTemplateFactory(),
|
|
3332
|
-
["texture-data" /* textureData */]: new NoiseRawTextureTemplateFactory(),
|
|
3333
|
-
["noise-cylinders" /* noiseCylinders */]: new NoiseCylindersNodeTemplateFactory(),
|
|
3334
|
-
["noise-perlin" /* noisePerlin */]: new NoisePerlinNodeTemplateFactory(),
|
|
3335
|
-
["noise-ridged-multi" /* noiseRidgedMulti */]: new NoiseRidgedMultiNodeTemplateFactory(),
|
|
3336
|
-
["noise-spheres" /* noiseSpheres */]: new NoiseSpheresNodeTemplateFactory(),
|
|
3337
|
-
["noise-voronoi" /* noiseVoronoi */]: new NoiseVoronoiNodeTemplateFactory(),
|
|
3338
|
-
["noise-combiner" /* noiseCombine */]: new NoiseCombineNodeTemplateFactory(),
|
|
3339
|
-
["noise-clamp" /* noiseClamp */]: new NoiseClampNodeTemplateFactory(),
|
|
3340
|
-
["noise-abs" /* noiseAbs */]: new NoiseAbsNodeTemplateFactory(),
|
|
3341
|
-
["noise-curve" /* noiseCurve */]: new NoiseCurveNodeTemplateFactory(),
|
|
3342
|
-
["noise-exponent" /* noiseExponent */]: new NoiseExponentNodeTemplateFactory(),
|
|
3343
|
-
["noise-invert" /* noiseInvert */]: new NoiseInvertNodeTemplateFactory(),
|
|
3344
|
-
["noise-scale-bias" /* noiseScaleBias */]: new NoiseScaleBiasNodeTemplateFactory(),
|
|
3345
|
-
["noise-terrace" /* noiseTerrace */]: new NoiseTerraceNodeTemplateFactory(),
|
|
3346
|
-
["noise-blend" /* noiseBlend */]: new NoiseBlendNodeTemplateFactory(),
|
|
3347
|
-
["noise-select" /* noiseSelect */]: new NoiseSelectNodeTemplateFactory(),
|
|
3348
|
-
["noise-displace" /* noiseDisplace */]: new NoiseDisplaceNodeTemplateFactory(),
|
|
3349
|
-
["noise-rotate-point" /* noiseRotatePoint */]: new NoiseRotatePointNodeTemplateFactory(),
|
|
3350
|
-
["noise-scale-point" /* noiseScalePoint */]: new NoiseScalePointNodeTemplateFactory(),
|
|
3351
|
-
["noise-translate-point" /* noiseTranslatePoint */]: new NoiseTranslatePointNodeTemplateFactory(),
|
|
3352
|
-
["noise-turbulence" /* noiseTurbulence */]: new NoiseTurbulenceNodeTemplateFactory(),
|
|
3353
|
-
["group-module" /* groupModule */]: new ModuleGroupNodeTemplateFactory()
|
|
3354
|
-
};
|
|
3355
|
-
|
|
3356
|
-
// src/nodes/output/noise-output-node.tsx
|
|
3357
|
-
import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3358
|
-
function NoiseOutputNode({ id, selected, data, type }) {
|
|
3359
|
-
const [size, setSize] = useState20(0);
|
|
3360
|
-
const updateComputedData = useUpdateNodeComputedData29();
|
|
3361
|
-
const onDataUpdated = useCallback21(
|
|
3362
|
-
(handleData) => {
|
|
3363
|
-
const incomingPositions = handleData["position" /* position */];
|
|
3364
|
-
const incomingModule = handleData["module" /* module */];
|
|
3365
|
-
if (incomingPositions?.length && incomingModule?.length && incomingModule[0]?.module) {
|
|
3366
|
-
const { module } = incomingModule[0];
|
|
3367
|
-
const noise = [];
|
|
3368
|
-
for (const input of incomingPositions) {
|
|
3369
|
-
for (const position of input.positions) {
|
|
3370
|
-
const value = module.getValue(position.x, position.y, position.z);
|
|
3371
|
-
noise.push({
|
|
3372
|
-
position,
|
|
3373
|
-
value
|
|
3374
|
-
});
|
|
3375
|
-
}
|
|
3376
|
-
}
|
|
3377
|
-
updateComputedData(id, { noise, module });
|
|
3378
|
-
setSize(noise.length);
|
|
3379
|
-
}
|
|
3380
|
-
},
|
|
3381
|
-
[]
|
|
3382
|
-
);
|
|
3383
|
-
return /* @__PURE__ */ jsxs28(NodeContainer31, { id, selected, data, type, children: [
|
|
3384
|
-
/* @__PURE__ */ jsx31(
|
|
3385
|
-
HandlesIncomingDataStatus4,
|
|
3386
|
-
{
|
|
3387
|
-
nodeId: id,
|
|
3388
|
-
handles: data.handles,
|
|
3389
|
-
handleKey: "dataType",
|
|
3390
|
-
onDataUpdated,
|
|
3391
|
-
type: "target",
|
|
3392
|
-
resetComputedData: true
|
|
3393
|
-
}
|
|
3394
|
-
),
|
|
3395
|
-
/* @__PURE__ */ jsxs28(Text3, { mt: 5, children: [
|
|
3396
|
-
"Noise points: ",
|
|
3397
|
-
size
|
|
3398
|
-
] }),
|
|
3399
|
-
/* @__PURE__ */ jsx31(NodeTrackConnections27, { handles: data.handles, nodeId: id, type: "target" })
|
|
3400
|
-
] });
|
|
3401
|
-
}
|
|
3402
|
-
var noise_output_node_default = NoiseOutputNode;
|
|
3403
|
-
export {
|
|
3404
|
-
module_group_node_default as ModuleGroupNode,
|
|
3405
|
-
noise_abs_node_default as NoiseAbsNode,
|
|
3406
|
-
noise_billow_node_default as NoiseBillowNode,
|
|
3407
|
-
noise_blend_node_default as NoiseBlendNode,
|
|
3408
|
-
noise_checkerboard_node_default as NoiseCheckerboardNode,
|
|
3409
|
-
noise_clamp_node_default as NoiseClampNode,
|
|
3410
|
-
noise_combine_node_default as NoiseCombineNode,
|
|
3411
|
-
noise_const_node_default as NoiseConstNode,
|
|
3412
|
-
noise_curve_node_default as NoiseCurveNode,
|
|
3413
|
-
noise_cylinders_node_default as NoiseCylindersNode,
|
|
3414
|
-
noise_displace_node_default as NoiseDisplaceNode,
|
|
3415
|
-
noise_exponent_node_default as NoiseExponentNode,
|
|
3416
|
-
noise_invert_node_default as NoiseInvertNode,
|
|
3417
|
-
noise_logger_node_default as NoiseLoggerNode,
|
|
3418
|
-
noise_normalize_node_default as NoiseNormalizeNode,
|
|
3419
|
-
noise_output_node_default as NoiseOutputNode,
|
|
3420
|
-
noise_perlin_node_default as NoisePerlinNode,
|
|
3421
|
-
noise_raw_texture_node_default as NoiseRawTextureNode,
|
|
3422
|
-
noise_ridgedmulti_node_default as NoiseRidgedMultiNode,
|
|
3423
|
-
noise_rotate_point_node_default as NoiseRotatePointNode,
|
|
3424
|
-
noise_scale_bias_node_default as NoiseScaleBiasNode,
|
|
3425
|
-
noise_scale_point_node_default as NoiseScalePointNode,
|
|
3426
|
-
noise_select_node_default as NoiseSelectNode,
|
|
3427
|
-
noise_spheres_node_default as NoiseSpheresNode,
|
|
3428
|
-
noise_terrace_node_default as NoiseTerraceNode,
|
|
3429
|
-
noise_translate_point_node_default as NoiseTranslatePointNode,
|
|
3430
|
-
noise_turbulence_node_default as NoiseTurbulenceNode,
|
|
3431
|
-
noise_voronoi_node_default as NoiseVoronoiNode,
|
|
3432
|
-
position_const_node_default as PositionConstNode,
|
|
3433
|
-
position_grid_node_default as PositionGridNode,
|
|
3434
|
-
positions_logger_node_default as PositionsLoggerNode
|
|
3435
|
-
};
|
|
1
|
+
import{NodePropertyVariables as Et}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Ht}from"@awesome-flow/core/hooks";import{NodeContainer as At,NodeTrackConnections as Ot}from"@awesome-flow/core/layout";import{Billow as Xt}from"libnoise-simplex-ts";import{useCallback as Yt}from"react";import{jsx as no,jsxs as qt}from"react/jsx-runtime";function Zt({id:e,selected:p,data:o,type:m}){let a=Ht(),s=Yt(t=>{let i=new Xt;Object.keys(t).forEach(r=>i[r]=t[r].value),a(e,{module:i})},[e]);return qt(At,{id:e,selected:p,data:o,type:m,children:[no(Et,{data:o,nodeId:e,onPropertiesChange:s}),no(Ot,{handles:o.handles,nodeId:e,type:"target"})]})}var po=Zt;import{useUpdateNodeComputedData as $t}from"@awesome-flow/core/hooks";import{NodeContainer as Kt}from"@awesome-flow/core/layout";import{Checkerboard as Wt}from"libnoise-simplex-ts";import{useEffect as _t}from"react";import{jsx as Qt}from"react/jsx-runtime";function Jt({id:e,selected:p,data:o,type:m}){let a=$t();return _t(()=>{let s=new Wt;a(e,{module:s})},[e]),Qt(Kt,{id:e,selected:p,data:o,type:m})}var so=Jt;import{useUpdateNodeComputedData as jt,useUpdateNodeData as ea}from"@awesome-flow/core/hooks";import{NodeContainer as oa}from"@awesome-flow/core/layout";import{Group as mo,NumberInput as xe,Stack as ta}from"@mantine/core";import{Const as aa}from"libnoise-simplex-ts";import{useEffect as ra,useState as Ie}from"react";import{jsx as z,jsxs as be}from"react/jsx-runtime";function ia({id:e,selected:p,data:o,type:m}){let[a,s]=Ie(o.min),[t,i]=Ie(o.max),[r,d]=Ie(o.noise),N=ea(),n=jt();return ra(()=>{let u=new aa(r);N(e,{noise:r,min:a,max:t}),n(e,{module:u})},[r,a,t]),z(oa,{id:e,selected:p,data:o,type:m,children:be(ta,{children:[be(mo,{children:[z(xe,{size:"xs",w:100,value:a,onChange:u=>s(Number(u))}),z(xe,{size:"xs",w:100,value:t,onChange:u=>i(Number(u))})]}),be(mo,{children:["noise:",z(xe,{size:"xs",value:r,onChange:u=>d(Number(u)),max:t,min:a,step:.1})]})]})})}var lo=ia;import{NodePropertyVariables as na}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as pa}from"@awesome-flow/core/hooks";import{NodeContainer as sa,NodeTrackConnections as ma}from"@awesome-flow/core/layout";import{Cylinders as da}from"libnoise-simplex-ts";import{useCallback as la}from"react";import{jsx as uo,jsxs as Na}from"react/jsx-runtime";function ua({id:e,selected:p,data:o,type:m}){let a=pa(),s=la(t=>{let i=new da;Object.keys(t).forEach(r=>i[r]=t[r].value),a(e,{module:i})},[e]);return Na(sa,{id:e,selected:p,data:o,type:m,children:[uo(na,{data:o,nodeId:e,onPropertiesChange:s}),uo(ma,{handles:o.handles,nodeId:e,type:"target"})]})}var No=ua;import{NodePropertyVariables as ca}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as fa}from"@awesome-flow/core/hooks";import{NodeContainer as ya,NodeTrackConnections as Ca}from"@awesome-flow/core/layout";import{Perlin as Ta}from"libnoise-simplex-ts";import{useCallback as ga}from"react";import{jsx as co,jsxs as ha}from"react/jsx-runtime";function Da({id:e,selected:p,data:o,type:m}){let a=fa(),s=ga(t=>{let i=new Ta;Object.keys(t).forEach(r=>i[r]=t[r].value),a(e,{module:i})},[e,a]);return ha(ya,{id:e,selected:p,data:o,type:m,children:[co(ca,{data:o,nodeId:e,onPropertiesChange:s}),co(Ca,{handles:o.handles,nodeId:e,type:"target"})]})}var fo=Da;import{NodePropertyVariables as Pa}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as xa}from"@awesome-flow/core/hooks";import{NodeContainer as Ia,NodeTrackConnections as ba}from"@awesome-flow/core/layout";import{RidgedMulti as Ma}from"libnoise-simplex-ts";import{useCallback as Sa}from"react";import{jsx as yo,jsxs as va}from"react/jsx-runtime";function wa({id:e,selected:p,data:o,type:m}){let a=xa(),s=Sa(t=>{let i=new Ma;Object.keys(t).forEach(r=>i[r]=t[r].value),a(e,{module:i})},[]);return va(Ia,{id:e,selected:p,data:o,type:m,children:[yo(Pa,{data:o,nodeId:e,onPropertiesChange:s}),yo(ba,{handles:o.handles,nodeId:e,type:"target"})]})}var Co=wa;import{NodePropertyVariables as Ba}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as ka}from"@awesome-flow/core/hooks";import{NodeContainer as Ga,NodeTrackConnections as za}from"@awesome-flow/core/layout";import{Spheres as Ra}from"libnoise-simplex-ts";import{useCallback as Fa}from"react";import{jsx as To,jsxs as Ua}from"react/jsx-runtime";function La({id:e,selected:p,data:o,type:m}){let a=ka(),s=Fa(t=>{let i=new Ra;Object.keys(t).forEach(r=>i[r]=t[r].value),a(e,{module:i})},[]);return Ua(Ga,{id:e,selected:p,data:o,type:m,children:[To(Ba,{data:o,nodeId:e,onPropertiesChange:s}),To(za,{handles:o.handles,nodeId:e,type:"target"})]})}var go=La;import{NodePropertyVariables as Va}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Ea}from"@awesome-flow/core/hooks";import{NodeContainer as Ha,NodeTrackConnections as Aa}from"@awesome-flow/core/layout";import{Voronoi as Oa}from"libnoise-simplex-ts";import{useCallback as Xa}from"react";import{jsx as Do,jsxs as Za}from"react/jsx-runtime";function Ya({id:e,selected:p,data:o,type:m}){let a=Ea(),s=Xa(t=>{let i=new Oa(t.frequency.value,t.displacement.value,t.distance.value,t.seed.value);a(e,{module:i})},[]);return Za(Ha,{id:e,selected:p,data:o,type:m,children:[Do(Va,{data:o,nodeId:e,onPropertiesChange:s}),Do(Aa,{handles:o.handles,nodeId:e,type:"target"})]})}var ho=Ya;import{useUpdateNodeComputedData as qa,useUpdateNodeData as $a}from"@awesome-flow/core/hooks";import{NodeContainer as Ka}from"@awesome-flow/core/layout";import{Group as Me,NumberInput as Se,Stack as Wa}from"@mantine/core";import{useEffect as _a,useState as we}from"react";import{jsx as R,jsxs as F}from"react/jsx-runtime";function Ja({id:e,selected:p,data:o,type:m}){let a=o.position??{x:0,y:0,z:0},[s,t]=we(a.x),[i,r]=we(a.y),[d,N]=we(a.z),n=$a(),u=qa();return _a(()=>{let l={x:s,y:i,z:d};n(e,{position:l}),u(e,{positions:[l]})},[s,i,d]),R(Ka,{id:e,selected:p,data:o,type:m,children:F(Wa,{children:[F(Me,{children:["x: ",R(Se,{size:"xs",w:100,value:s,onChange:l=>t(Number(l))})]}),F(Me,{children:["y: ",R(Se,{size:"xs",w:100,value:i,onChange:l=>r(Number(l))})]}),F(Me,{children:["z: ",R(Se,{size:"xs",w:100,value:d,onChange:l=>N(Number(l))})]})]})})}var Po=Ja;import{useUpdateNodeComputedData as Qa,useUpdateNodeData as ja}from"@awesome-flow/core/hooks";import{NodeContainer as er}from"@awesome-flow/core/layout";import{Group as L,NumberInput as U,Stack as or}from"@mantine/core";import{useEffect as ve,useState as V}from"react";import{jsx as x,jsxs as I}from"react/jsx-runtime";function tr({id:e,selected:p,data:o,type:m}){let[a,s]=V(o.center?.x),[t,i]=V(o.center?.y),[r,d]=V(o.center?.z),[N,n]=V(o.radius),u=ja(),l=Qa();return ve(()=>{u(e,{center:{x:a,y:t,z:r}})},[a,t,r]),ve(()=>{u(e,{radius:N})},[N]),ve(()=>{let C=[];for(let T=-N;T<N;T++)for(let P=-N;P<N;P++)C.push({x:a+T,y:t+P,z:r});l(e,{positions:C})},[a,t,r,N]),x(er,{id:e,selected:p,data:o,type:m,children:I(or,{children:[I(L,{children:["x: ",x(U,{size:"xs",w:100,value:a,onChange:C=>s(Number(C))})]}),I(L,{children:["y: ",x(U,{size:"xs",w:100,value:t,onChange:C=>i(Number(C))})]}),I(L,{children:["z: ",x(U,{size:"xs",w:100,value:r,onChange:C=>d(Number(C))})]}),I(L,{children:["r: ",x(U,{size:"xs",w:100,value:N,onChange:C=>n(Number(C))})]})]})})}var xo=tr;import{useFlowStore as ar,useIncomingComputedData as rr,useInteractiveStore as ir,useUpdateNodeComputedData as nr}from"@awesome-flow/core/hooks";import{NodeCollapse as pr,NodeContainer as sr,NodeTrackConnections as mr}from"@awesome-flow/core/layout";import{Badge as dr,Group as Io}from"@mantine/core";import{NodeResizer as lr,useStore as ur,useUpdateNodeInternals as Nr}from"@xyflow/react";import{useCallback as Be,useEffect as ke,useMemo as cr}from"react";import{shallow as fr}from"zustand/shallow";import{jsx as b,jsxs as bo}from"react/jsx-runtime";function yr({id:e,selected:p,data:o,type:m,width:a,height:s}){let t=Nr(),i=ur(T=>T.triggerNodeChanges),{groupNodes:r,setGroupCollapsed:d}=ar(Be(T=>({groupNodes:T.groups[e],setGroupCollapsed:T.setGroupCollapsed}),[])),N=ir(Be(T=>T.nodeIntersectionTargets[e],[e]),fr);ke(()=>{t(e)},[a,s]),ke(()=>{i([{id:e,type:"select",selected:!!N}])},[N]);let n=Be(T=>{d(e,T)},[]),u=cr(()=>({width:o.initialSize?.width||100,height:o.initialSize?.height||50}),[o.initialSize]),l=rr(e),C=nr();return ke(()=>{if(l?.length){let{module:T}=l[0];C(e,{module:T})}},[l]),bo(sr,{id:e,selected:p,data:o,title:b(Io,{justify:"space-between",children:bo(Io,{gap:"xs",children:[b(dr,{size:"xs",variant:"outline",radius:"xs",color:"gray",children:r?.length||0}),b(pr,{nodeId:e,isCollapsed:o.isCollapsed,onCollapsed:n})]})}),type:m,children:[b(lr,{nodeId:e,minWidth:u.width,minHeight:u.height,isVisible:p&&!o.isCollapsed}),b(mr,{handles:o.handles,nodeId:e,type:"target"})]})}var Mo=yr;import{useIncomingComputedData as Cr,useUpdateNodeComputedData as Tr}from"@awesome-flow/core/hooks";import{NodeContainer as gr,NodeTrackConnections as Dr}from"@awesome-flow/core/layout";import{Abs as hr}from"libnoise-simplex-ts";import{useEffect as Pr}from"react";import{jsx as So}from"react/jsx-runtime";function xr({id:e,selected:p,data:o,type:m}){let a=Cr(e),s=Tr();return Pr(()=>{if(a?.length>0){let t=new hr(a[0].module);s(e,{module:t})}},[a]),So(gr,{id:e,selected:p,data:o,type:m,children:So(Dr,{handles:o.handles,nodeId:e,type:"target"})})}var wo=xr;import{useIncomingComputedData as Ir,useUpdateNodeComputedData as br,useUpdateNodeData as Mr}from"@awesome-flow/core/hooks";import{NodeContainer as Sr,NodeTrackConnections as wr}from"@awesome-flow/core/layout";import{Group as vr,NumberInput as vo,Stack as Br}from"@mantine/core";import{Clamp as kr}from"libnoise-simplex-ts";import{useEffect as Gr,useState as Bo}from"react";import{jsx as E,jsxs as ko}from"react/jsx-runtime";function zr({id:e,selected:p,data:o,type:m}){let[a,s]=Bo(o.lowerBound),[t,i]=Bo(o.upperBound),r=Ir(e),d=Mr(),N=br();return Gr(()=>{if(r?.length){let n=new kr(r[0].module,a,t);N(e,{module:n})}d(e,{lowerBound:a,upperBound:t})},[r,a,t]),ko(Sr,{id:e,selected:p,data:o,type:m,children:[E(Br,{children:ko(vr,{children:[E(vo,{size:"xs",w:100,value:a,onChange:n=>s(Number(n)),step:.1}),E(vo,{size:"xs",w:100,value:t,onChange:n=>i(Number(n)),step:.1})]})}),E(wr,{handles:o.handles,nodeId:e,type:"target"})]})}var Go=zr;import{useIncomingComputedData as Er,useUpdateNodeComputedData as Hr,useUpdateNodeData as Ar}from"@awesome-flow/core/hooks";import{NodeCombobox as Or,NodeContainer as Xr,NodeTrackConnections as Yr}from"@awesome-flow/core/layout";import{IconAsterisk as Zr,IconChevronLeft as qr,IconChevronRight as $r,IconChevronUp as Kr,IconPlus as Wr}from"@tabler/icons-react";import{useCallback as _r,useEffect as Jr}from"react";import{Add as Rr,Max as Fr,Min as Lr,Multiply as Ur,Power as Vr}from"libnoise-simplex-ts";var zo={add:Rr,max:Fr,min:Lr,multiply:Ur,power:Vr};import{jsx as g,jsxs as ei}from"react/jsx-runtime";var Qr={add:g(Wr,{}),min:g(qr,{}),max:g($r,{}),multiply:g(Zr,{}),power:g(Kr,{})};function jr({id:e,selected:p,data:o,type:m}){let a=Ar(),s=Hr(),t=Er(e);Jr(()=>{let r=zo[o.operation];if(t?.length>1){let d=new r(t[0].module,t[1].module);s(e,{module:d})}},[o.operation,t]);let i=_r(r=>{a(e,{operation:r})},[]);return ei(Xr,{id:e,selected:p,data:o,type:m,children:[g(Or,{options:Qr,selected:o.operation,onChange:i,width:150}),g(Yr,{handles:o.handles,nodeId:e,type:"target"})]})}var Ro=jr;import{NodeState as Fo}from"@awesome-flow/core/abstract";import{useIncomingComputedData as oi,useUpdateNodeComputedData as ti,useUpdateNodeData as ai}from"@awesome-flow/core/hooks";import{NodeContainer as ri,NodeTrackConnections as ii}from"@awesome-flow/core/layout";import{ActionIcon as ni,Button as pi,Group as si,NumberInput as Lo,Space as mi}from"@mantine/core";import{FORM_INDEX as di,useForm as li}from"@mantine/form";import{randomId as Ge}from"@mantine/hooks";import{IconX as ui}from"@tabler/icons-react";import{Curve as Ni,Tuple as ci}from"libnoise-simplex-ts";import{useCallback as fi,useEffect as Uo,useState as yi}from"react";import{Fragment as Ti,jsx as D,jsxs as ze}from"react/jsx-runtime";function Ci({id:e,selected:p,data:o,type:m}){let a=oi(e),s=ai(),t=ti(),[i,r]=yi([]),d=li({mode:"uncontrolled",initialValues:{points:[]},validateInputOnChange:[`points.${di}.input`],clearInputErrorOnChange:!0,validate:{points:{input:(n,u)=>{let l={};return u.points.forEach(C=>{l[C.input]=(l[C.input]||0)+1}),l[n]>1}}},onValuesChange:fi(n=>{if(d.validate(),d.isValid()){let u=n.points.map(l=>({input:l.input,output:l.output}));r(u),s(e,{points:u})}},[])});Uo(()=>{let n=o.points?.length?o.points.map(u=>({input:u.input,output:u.output,key:Ge()})):[1,2,3,4].map(()=>({input:0,output:0,key:Ge()}));d.initialize({points:n})},[]),Uo(()=>{if(a?.length&&i?.length>=4){let n=new Ni(a[0].module,i.map(u=>new ci(u.input,u.output)));t(e,{module:n})}},[i,a]);let N=d.getValues().points.map((n,u)=>ze(si,{mt:"xs",children:[D(Lo,{size:"xs",w:100,placeholder:"Input Value",...d.getInputProps(`points.${u}.input`),step:.1},d.key(`points.${u}.input`)),D(Lo,{size:"xs",w:100,placeholder:"Output Value",...d.getInputProps(`points.${u}.output`),step:.1},d.key(`points.${u}.output`)),o.state===Fo.edit&&i.length>4&&D(ni,{color:"red",variant:"outline",size:"sm",onClick:()=>d.removeListItem("points",u),children:D(ui,{size:"1rem"})})]},n.key));return ze(ri,{id:e,selected:p,type:m,data:o,children:[N,o.state===Fo.edit&&ze(Ti,{children:[D(mi,{h:10}),D(pi,{variant:"outline",size:"xs",fullWidth:!0,onClick:()=>d.insertListItem("points",{input:0,output:0,key:Ge()}),children:"Add control point"})]}),D(ii,{handles:o.handles,nodeId:e,type:"target"})]})}var Vo=Ci;import{useIncomingComputedData as gi,useUpdateNodeComputedData as Di,useUpdateNodeData as hi}from"@awesome-flow/core/hooks";import{NodeContainer as Pi,NodeTrackConnections as xi}from"@awesome-flow/core/layout";import{Group as Ii,NumberInput as bi,Stack as Mi}from"@mantine/core";import{Exponent as Si}from"libnoise-simplex-ts";import{useEffect as wi,useState as vi}from"react";import{jsx as Re,jsxs as Eo}from"react/jsx-runtime";function Bi({id:e,selected:p,data:o,type:m}){let[a,s]=vi(o.exponent),t=gi(e),i=hi(),r=Di();return wi(()=>{if(t?.length>0){let d=new Si(t[0].module,a);r(e,{module:d})}i(e,{exponent:a})},[t,a]),Eo(Pi,{id:e,selected:p,data:o,type:m,children:[Re(Mi,{children:Eo(Ii,{children:["Exponent:",Re(bi,{size:"xs",value:a,onChange:d=>s(Number(d)),step:.1})]})}),Re(xi,{handles:o.handles,nodeId:e,type:"target"})]})}var Ho=Bi;import{useIncomingComputedData as ki,useUpdateNodeComputedData as Gi}from"@awesome-flow/core/hooks";import{NodeContainer as zi,NodeTrackConnections as Ri}from"@awesome-flow/core/layout";import{Invert as Fi}from"libnoise-simplex-ts";import{useEffect as Li}from"react";import{jsx as Ao}from"react/jsx-runtime";function Ui({id:e,selected:p,data:o,type:m}){let a=ki(e),s=Gi();return Li(()=>{if(a?.length>0){let t=new Fi(a[0].module);s(e,{module:t})}},[a]),Ao(zi,{id:e,selected:p,data:o,type:m,children:Ao(Ri,{handles:o.handles,nodeId:e,type:"target"})})}var Oo=Ui;import{useIncomingComputedData as Hi,useUpdateNodeComputedData as Ai,useUpdateNodeData as Oi}from"@awesome-flow/core/hooks";import{NodeContainer as Xi,NodeTrackConnections as Yi}from"@awesome-flow/core/layout";import{Group as Zi,NumberInput as Xo,Stack as qi}from"@mantine/core";import{useEffect as $i,useState as Yo}from"react";import{ModifierModule as Vi}from"libnoise-simplex-ts";var H=class extends Vi{constructor(o,m,a){super(o);this.lowerBound=m;this.upperBound=a}getValue(o,m,a){return Ei(this.sourceModule.getValue(o,m,a),this.lowerBound,this.upperBound)}};function Ei(e,p,o){return(e-p)/(o-p)}import{jsx as A,jsxs as Zo}from"react/jsx-runtime";function Ki({id:e,selected:p,data:o,type:m}){let[a,s]=Yo(o.intervalStart),[t,i]=Yo(o.intervalEnd),r=Hi(e),d=Oi(),N=Ai();return $i(()=>{if(r?.length){let n=r[0].module,u=new H(n,a,t);N(e,{module:u})}d(e,{intervalStart:a,intervalEnd:t})},[r,a,t]),Zo(Xi,{id:e,selected:p,data:o,type:m,children:[A(qi,{children:Zo(Zi,{children:[A(Xo,{size:"xs",w:100,value:a,onChange:n=>s(Number(n))}),A(Xo,{size:"xs",w:100,value:t,onChange:n=>i(Number(n))})]})}),A(Yi,{handles:o.handles,nodeId:e,type:"target"})]})}var qo=Ki;import{useIncomingComputedData as Wi,useUpdateNodeComputedData as _i,useUpdateNodeData as Ji}from"@awesome-flow/core/hooks";import{NodeContainer as Qi,NodeTrackConnections as ji}from"@awesome-flow/core/layout";import{Group as $o,NumberInput as Ko,Stack as en}from"@mantine/core";import{ScaleBias as on}from"libnoise-simplex-ts";import{useEffect as tn,useState as Wo}from"react";import{jsx as Fe,jsxs as O}from"react/jsx-runtime";function an({id:e,selected:p,data:o,type:m}){let[a,s]=Wo(o.scale),[t,i]=Wo(o.bias),r=Wi(e),d=Ji(),N=_i();return tn(()=>{if(r?.length>0){let n=new on(r[0].module,a,t);N(e,{module:n})}d(e,{scale:a,bias:t})},[r,a,t]),O(Qi,{id:e,selected:p,data:o,type:m,children:[O(en,{children:[O($o,{children:["Scale:",Fe(Ko,{size:"xs",w:100,value:a,onChange:n=>s(Number(n)),step:.1})]}),O($o,{children:["Bias:",Fe(Ko,{size:"xs",w:100,value:t,onChange:n=>i(Number(n)),step:.1})]})]}),Fe(ji,{handles:o.handles,nodeId:e,type:"target"})]})}var _o=an;import{NodeState as Jo}from"@awesome-flow/core/abstract";import{useIncomingComputedData as rn,useUpdateNodeComputedData as nn,useUpdateNodeData as pn}from"@awesome-flow/core/hooks";import{NodeContainer as sn,NodeTrackConnections as mn}from"@awesome-flow/core/layout";import{ActionIcon as dn,Button as ln,Group as un,NumberInput as Nn,Space as cn}from"@mantine/core";import{FORM_INDEX as fn,useForm as yn}from"@mantine/form";import{randomId as Le}from"@mantine/hooks";import{IconX as Cn}from"@tabler/icons-react";import{Terrace as Tn}from"libnoise-simplex-ts";import{useCallback as gn,useEffect as Qo,useState as Dn}from"react";import{Fragment as Pn,jsx as h,jsxs as Ue}from"react/jsx-runtime";function hn({id:e,selected:p,data:o,type:m}){let a=rn(e),s=pn(),t=nn(),[i,r]=Dn([]),d=yn({mode:"uncontrolled",initialValues:{points:[]},validateInputOnChange:[`points.${fn}.input`],clearInputErrorOnChange:!0,onValuesChange:gn(n=>{if(d.isValid()){let u=n.points.map(l=>l.value);r(u),s(e,{points:u})}d.validate()},[])});Qo(()=>{let n=o.points?.length?o.points.map(u=>({value:u,key:Le()})):[1,2].map(()=>({value:0,key:Le()}));d.initialize({points:n})},[]),Qo(()=>{if(a?.length&&i?.length>=2){let n=new Tn(a[0].module,i);t(e,{module:n})}},[i,a]);let N=d.getValues().points.map((n,u)=>Ue(un,{mt:"xs",children:[h(Nn,{size:"xs",placeholder:"Input Value",...d.getInputProps(`points.${u}.value`),step:.1},d.key(`points.${u}.value`)),o.state===Jo.edit&&i.length>2&&h(dn,{color:"red",variant:"outline",size:"sm",onClick:()=>d.removeListItem("points",u),children:h(Cn,{size:"1rem"})})]},n.key));return Ue(sn,{id:e,selected:p,type:m,data:o,children:[N,o.state===Jo.edit&&Ue(Pn,{children:[h(cn,{h:10}),h(ln,{variant:"outline",size:"xs",fullWidth:!0,onClick:()=>d.insertListItem("points",{value:0,key:Le()}),children:"Add control point"})]}),h(mn,{handles:o.handles,nodeId:e,type:"target"})]})}var jo=hn;import{useIncomingComputedData as xn}from"@awesome-flow/core/hooks";import{NodeContainer as In,NodeTrackConnections as bn}from"@awesome-flow/core/layout";import{Divider as Mn,Stack as Sn,Text as et}from"@mantine/core";import{useMemo as wn}from"react";import{jsx as Ee,jsxs as Ve}from"react/jsx-runtime";function vn({id:e,selected:p,data:o,type:m}){let a=xn(e),s=wn(()=>a?.map(t=>t.noise).flat(),[a]);return Ve(In,{id:e,selected:p,data:o,type:m,children:[Ve(et,{children:["Size: ",s?.length||0]}),Ee(Mn,{h:5}),Ee(Sn,{children:s?.map((t,i)=>Ve(et,{children:[t.position?.x,":",t.position?.y,":",t.position?.z,": ",t.value]},i))}),Ee(bn,{handles:o.handles,nodeId:e,type:"target"})]})}var ot=vn;import{HandlesIncomingDataStatus as Ds}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as hs}from"@awesome-flow/core/hooks";import{NodeContainer as Ps,NodeTrackConnections as xs}from"@awesome-flow/core/layout";import{Text as Is}from"@mantine/core";import{useCallback as bs,useState as Ms}from"react";import{useIncomingComputedData as Bn,useUpdateNodeComputedData as kn}from"@awesome-flow/core/hooks";import{NodeContainer as Gn,NodeTrackConnections as zn}from"@awesome-flow/core/layout";import{Group as He,Stack as Rn}from"@mantine/core";import{useEffect as Fn,useMemo as Ln,useState as tt}from"react";import{jsx as Vn,jsxs as M}from"react/jsx-runtime";function Un({id:e,selected:p,data:o,type:m}){let a=kn(),[s,t]=tt(0),[i,r]=tt(0),d=Bn(e),N=Ln(()=>d?.map(n=>n.noise).flat(),[d]);return Fn(()=>{if(N?.length){let n=Math.ceil(Math.sqrt(N.length)),u=N.map(C=>[C.value*255,C.value*255,C.value*255,255]).flat(),l=new Uint8Array(n*n*4);l.set(u),r(n),t(l.length),a(e,{textureData:l,textureResolutionX:n,textureResolutionY:n})}},[N]),M(Gn,{id:e,selected:p,data:o,type:m,children:[M(Rn,{children:[M(He,{children:["Resolution: ",i,"x",i]}),M(He,{children:["Input Length: ",N?.length||0]}),M(He,{children:["Output Length (",i,"*",i,"*4): ",s]})]}),Vn(zn,{handles:o.handles,nodeId:e,type:"target"})]})}var at=Un;import{useIncomingComputedData as En}from"@awesome-flow/core/hooks";import{NodeContainer as Hn,NodeTrackConnections as An}from"@awesome-flow/core/layout";import{Divider as On,Stack as Xn,Text as rt}from"@mantine/core";import{useMemo as Yn}from"react";import{jsx as Oe,jsxs as Ae}from"react/jsx-runtime";function Zn({id:e,selected:p,data:o,type:m}){let a=En(e),s=Yn(()=>a?.map(t=>t.positions).flat(),[a]);return Ae(Hn,{id:e,selected:p,data:o,type:m,children:[Ae(rt,{children:["Size: ",s?.length||0]}),Oe(On,{h:5}),Oe(Xn,{children:s?.map((t,i)=>Ae(rt,{children:[t.x,":",t.y,":",t.z]},i))}),Oe(An,{handles:o.handles,nodeId:e,type:"target"})]})}var it=Zn;import{HandlesIncomingDataStatus as qn}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as $n}from"@awesome-flow/core/hooks";import{NodeContainer as Kn,NodeTrackConnections as Wn}from"@awesome-flow/core/layout";import{Blend as _n}from"libnoise-simplex-ts";import{useCallback as Jn}from"react";import{jsx as nt,jsxs as jn}from"react/jsx-runtime";function Qn({id:e,selected:p,data:o,type:m}){let a=$n(),s=Jn(t=>{let i=t.source,r=t.control;if(i?.length>=2&&r?.length){let d=new _n(i[0].module,i[1].module,r[0].module);a(e,{module:d})}},[]);return jn(Kn,{id:e,selected:p,data:o,type:m,children:[nt(qn,{nodeId:e,handles:o.handles,handleKey:"dataId",onDataUpdated:s,type:"target",resetComputedData:!0}),nt(Wn,{handles:o.handles,nodeId:e,type:"target"})]})}var pt=Qn;import{HandlesIncomingDataStatus as ep}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as op,useUpdateNodeData as tp}from"@awesome-flow/core/hooks";import{NodeContainer as ap,NodeTrackConnections as rp}from"@awesome-flow/core/layout";import{Group as Ye,NumberInput as Ze,Stack as ip}from"@mantine/core";import{Select as np}from"libnoise-simplex-ts";import{useCallback as pp,useEffect as sp,useState as qe}from"react";import{jsx as S,jsxs as w}from"react/jsx-runtime";function mp({id:e,selected:p,data:o,type:m}){let[a,s]=qe(o.edgeFalloff),[t,i]=qe(o.lowerBound),[r,d]=qe(o.upperBound),N=tp(),n=op();sp(()=>{N(e,{edgeFalloff:a,lowerBound:t,upperBound:r})},[a,t,r]);let u=pp(l=>{let C=l.source,T=l.control;if(C?.length>=2&&T?.length){let P=new np(C[0].module,C[1].module,T[0].module,a,t,r);n(e,{module:P})}},[]);return w(ap,{id:e,selected:p,data:o,type:m,children:[w(ip,{children:[w(Ye,{children:["Edge Falloff:",S(Ze,{size:"xs",w:100,value:a,onChange:l=>s(Number(l)),step:.1})]}),w(Ye,{children:["Lower Bound:",S(Ze,{size:"xs",w:100,value:t,onChange:l=>i(Number(l)),step:.1})]}),w(Ye,{children:["Upper Bound:",S(Ze,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:.1})]}),S(ep,{nodeId:e,handles:o.handles,handleKey:"dataId",onDataUpdated:u,type:"target",resetComputedData:!0})]}),S(rp,{handles:o.handles,nodeId:e,type:"target"})]})}var st=mp;import{HandlesIncomingDataStatus as lp}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as up}from"@awesome-flow/core/hooks";import{NodeContainer as Np,NodeTrackConnections as cp}from"@awesome-flow/core/layout";import{Displace as fp}from"libnoise-simplex-ts";import{useCallback as yp}from"react";import{jsx as mt,jsxs as Tp}from"react/jsx-runtime";function Cp({id:e,selected:p,data:o,type:m}){let a=up(),s=yp(t=>{let i=t.source,r=t["x-module"],d=t["y-module"],N=t["z-module"];if(i&&r&&d&&N){let n=new fp(i[0].module,r[0].module,d[0].module,N[0].module);a(e,{module:n})}},[]);return Tp(Np,{id:e,selected:p,data:o,type:m,children:[mt(lp,{nodeId:e,handles:o.handles,handleKey:"dataId",onDataUpdated:s,type:"target",resetComputedData:!0}),mt(cp,{handles:o.handles,nodeId:e,type:"target"})]})}var dt=Cp;import{useIncomingComputedData as gp,useUpdateNodeComputedData as Dp,useUpdateNodeData as hp}from"@awesome-flow/core/hooks";import{NodeContainer as Pp,NodeTrackConnections as xp}from"@awesome-flow/core/layout";import{Group as $e,NumberInput as Ke,Stack as Ip}from"@mantine/core";import{RotatePoint as bp}from"libnoise-simplex-ts";import{useEffect as Mp,useState as We}from"react";import{jsx as X,jsxs as v}from"react/jsx-runtime";function Sp({id:e,selected:p,data:o,type:m}){let[a,s]=We(o.xAngle),[t,i]=We(o.yAngle),[r,d]=We(o.zAngle),N=gp(e),n=hp(),u=Dp();return Mp(()=>{if(N?.length){let l=new bp(N[0].module,a,t,r);u(e,{module:l})}n(e,{xAngle:a,yAngle:t,zAngle:r})},[e,u,n,N,a,t,r]),v(Pp,{id:e,selected:p,data:o,type:m,children:[v(Ip,{children:[v($e,{children:["X Angle:",X(Ke,{size:"xs",w:100,value:a,onChange:l=>s(Number(l)),step:.01})]}),v($e,{children:["Y Angle:",X(Ke,{size:"xs",w:100,value:t,onChange:l=>i(Number(l)),step:.01})]}),v($e,{children:["Z Angle:",X(Ke,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:.01})]})]}),X(xp,{handles:o.handles,nodeId:e,type:"target"})]})}var lt=Sp;import{useIncomingComputedData as wp,useUpdateNodeComputedData as vp,useUpdateNodeData as Bp}from"@awesome-flow/core/hooks";import{NodeContainer as kp,NodeTrackConnections as Gp}from"@awesome-flow/core/layout";import{Group as _e,NumberInput as Je,Stack as zp}from"@mantine/core";import{ScalePoint as Rp}from"libnoise-simplex-ts";import{useEffect as Fp,useState as Qe}from"react";import{jsx as Y,jsxs as B}from"react/jsx-runtime";function Lp({id:e,selected:p,data:o,type:m}){let[a,s]=Qe(o.xScale),[t,i]=Qe(o.yScale),[r,d]=Qe(o.zScale),N=wp(e),n=Bp(),u=vp();return Fp(()=>{if(N?.length){let l=new Rp(N[0].module,a,t,r);u(e,{module:l})}n(e,{xScale:a,yScale:t,zScale:r})},[e,N,u,n,a,t,r]),B(kp,{id:e,selected:p,data:o,type:m,children:[B(zp,{children:[B(_e,{children:["X Scale:",Y(Je,{size:"xs",w:100,value:a,onChange:l=>s(Number(l)),step:.01})]}),B(_e,{children:["Y Scale:",Y(Je,{size:"xs",w:100,value:t,onChange:l=>i(Number(l)),step:.01})]}),B(_e,{children:["Z Scale:",Y(Je,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:.01})]})]}),Y(Gp,{handles:o.handles,nodeId:e,type:"target"})]})}var ut=Lp;import{useIncomingComputedData as Up,useUpdateNodeComputedData as Vp,useUpdateNodeData as Ep}from"@awesome-flow/core/hooks";import{NodeContainer as Hp,NodeTrackConnections as Ap}from"@awesome-flow/core/layout";import{Group as je,NumberInput as eo,Stack as Op}from"@mantine/core";import{TranslatePoint as Xp}from"libnoise-simplex-ts";import{useEffect as Yp,useState as oo}from"react";import{jsx as Z,jsxs as k}from"react/jsx-runtime";function Zp({id:e,selected:p,data:o,type:m}){let[a,s]=oo(o.translateX),[t,i]=oo(o.translateY),[r,d]=oo(o.translateZ),N=Up(e),n=Ep(),u=Vp();return Yp(()=>{if(N?.length){let l=new Xp(N[0].module,a,t,r);u(e,{module:l})}n(e,{translateX:a,translateY:t,translateZ:r})},[e,N,a,t,r,u,n]),k(Hp,{id:e,selected:p,data:o,type:m,children:[k(Op,{children:[k(je,{children:["Translate X:",Z(eo,{size:"xs",w:100,value:a,onChange:l=>s(Number(l)),step:1})]}),k(je,{children:["Translate Y:",Z(eo,{size:"xs",w:100,value:t,onChange:l=>i(Number(l)),step:1})]}),k(je,{children:["Translate Z:",Z(eo,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:1})]})]}),Z(Ap,{handles:o.handles,nodeId:e,type:"target"})]})}var Nt=Zp;import{NodePropertyVariables as qp}from"@awesome-flow/core/components";import{useIncomingComputedData as $p,useUpdateNodeComputedData as Kp}from"@awesome-flow/core/hooks";import{NodeContainer as Wp,NodeTrackConnections as _p}from"@awesome-flow/core/layout";import{Turbulence as Jp}from"libnoise-simplex-ts";import{useCallback as Qp,useEffect as jp,useState as es}from"react";import{jsx as ct,jsxs as ts}from"react/jsx-runtime";function os({id:e,selected:p,data:o,type:m}){let[a,s]=es(null),t=$p(e),i=Kp(),r=Qp(d=>{s(d)},[]);return jp(()=>{if(t?.length&&a){let d=new Jp(t[0].module,a.frequency.value,a.power.value,a.roughness.value,a.seed.value);i(e,{module:d})}},[e,t,a]),ts(Wp,{id:e,selected:p,data:o,type:m,children:[ct(qp,{data:o,nodeId:e,onPropertiesChange:r}),ct(_p,{handles:o.handles,nodeId:e,type:"target"})]})}var ft=os;import{CoreHandleType as as}from"@awesome-flow/core/abstract";import{IDGenerator as rs}from"@awesome-flow/core/utils";import{Position as yt}from"@xyflow/system";var q=class{template={id:rs.template(),type:"noise-billow",group:"Noise Generators",data:{title:"Billow Noise",frequency:.1,lacunarity:2,octaves:5,persistence:.5,seed:0},handles:[{position:yt.Left,dataType:as.variableProperty,connection:"target"},{position:yt.Right,dataType:"module",connection:"source"}]}};import{Position as is}from"@xyflow/system";var $=class{template={type:"noise-checkerboard",group:"Noise Generators",data:{title:"Checkerboard Noise"},handles:[{position:is.Right,dataType:"module",connection:"source"}]}};import{Position as ns}from"@xyflow/system";var K=class{template={type:"noise-constant",group:"Noise Generators",data:{title:"Const Value Noise",noise:0,min:-1,max:1},handles:[{position:ns.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as ps}from"@awesome-flow/core/abstract";import{Position as Ct}from"@xyflow/system";var W=class{template={type:"noise-cylinders",group:"Noise Generators",data:{title:"Cylinders Noise",frequency:.1},handles:[{position:Ct.Left,dataType:ps.variableProperty,connection:"target"},{position:Ct.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as ss}from"@awesome-flow/core/abstract";import{Position as Tt}from"@xyflow/system";var _=class{template={type:"noise-perlin",group:"Noise Generators",data:{title:"Perlin Noise",frequency:.1,lacunarity:2,octaves:5,persistence:.5,seed:0},handles:[{position:Tt.Left,dataType:ss.variableProperty,connection:"target"},{position:Tt.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as ms}from"@awesome-flow/core/abstract";import{Position as gt}from"@xyflow/system";var J=class{template={type:"noise-ridged-multi",group:"Noise Generators",data:{title:"Ridged Multi Noise",frequency:.1,lacunarity:2,octaves:6,offset:1,gain:2,seed:0},handles:[{position:gt.Left,dataType:ms.variableProperty,connection:"target"},{position:gt.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as ds}from"@awesome-flow/core/abstract";import{Position as Dt}from"@xyflow/system";var Q=class{template={type:"noise-spheres",group:"Noise Generators",data:{title:"Spheres Noise",frequency:.1},handles:[{position:Dt.Left,dataType:ds.variableProperty,connection:"target"},{position:Dt.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as ls}from"@awesome-flow/core/abstract";import{Position as ht}from"@xyflow/system";var j=class{template={type:"noise-voronoi",group:"Noise Generators",data:{title:"Voronoi Noise",frequency:.1,displacement:1,distance:!0,seed:0},handles:[{position:ht.Left,dataType:ls.variableProperty,connection:"target"},{position:ht.Right,dataType:"module",connection:"source"}]}};import{Position as us}from"@xyflow/system";var ee=class{template={type:"position",group:"Positions",data:{title:"Position Output",position:{x:0,y:0,z:0}},handles:[{position:us.Right,dataType:"position",connection:"source"}]}};import{Position as Ns}from"@xyflow/system";var oe=class{template={type:"grid",group:"Positions",data:{title:"Grid Output",center:{x:0,y:0,z:0},radius:1},handles:[{position:Ns.Right,dataType:"position",connection:"source"}]}};import{CoreTemplateGroup as cs}from"@awesome-flow/core/abstract";import{IDGenerator as fs}from"@awesome-flow/core/utils";import{Position as Pt}from"@xyflow/system";var te=class{template={id:fs.template(),type:"group-module",group:cs.groups,data:{title:"Modules Group",isGroup:!0,initialSize:{width:300,height:200},collapsedSize:{width:300,height:80}},handles:[{position:Pt.Bottom,dataType:"module",connection:"target",maxConnections:1,hideOnCollapse:!0},{position:Pt.Right,dataType:"module",connection:"source"}]}};import{Position as xt}from"@xyflow/system";var ae=class{template={type:"noise-abs",group:"Noise Modifiers",data:{title:"Abs Noise"},handles:[{position:xt.Left,dataType:"module",connection:"target",maxConnections:1},{position:xt.Right,dataType:"module",connection:"source"}]}};import{Position as It}from"@xyflow/system";var re=class{template={type:"noise-clamp",group:"Noise Modifiers",data:{title:"Clamp Noise",lowerBound:-1,upperBound:1},handles:[{position:It.Left,dataType:"module",connection:"target",maxConnections:1},{position:It.Right,dataType:"module",connection:"source"}]}};import{Position as bt}from"@xyflow/system";var ie=class{template={type:"noise-combiner",group:"Noise Modifiers",data:{title:"Combine Noise",operation:"add"},handles:[{position:bt.Left,dataType:"module",connection:"target",maxConnections:2},{position:bt.Right,dataType:"module",connection:"source"}]}};import{Position as Mt}from"@xyflow/system";var ne=class{template={type:"noise-curve",group:"Noise Modifiers",data:{title:"Noise Curve",points:[]},handles:[{position:Mt.Left,dataType:"module",connection:"target",maxConnections:1},{position:Mt.Right,dataType:"module",connection:"source"}]}};import{Position as St}from"@xyflow/system";var pe=class{template={type:"noise-exponent",group:"Noise Modifiers",data:{title:"Noise Exponent",exponent:1},handles:[{position:St.Left,dataType:"module",connection:"target",maxConnections:1},{position:St.Right,dataType:"module",connection:"source"}]}};import{Position as wt}from"@xyflow/system";var se=class{template={type:"noise-invert",group:"Noise Modifiers",data:{title:"Invert Noise"},handles:[{position:wt.Left,dataType:"module",connection:"target",maxConnections:1},{position:wt.Right,dataType:"module",connection:"source"}]}};import{IDGenerator as ys}from"@awesome-flow/core/utils";import{Position as vt}from"@xyflow/system";var me=class{template={id:ys.template(),type:"noise-normalize",group:"Noise Modifiers",data:{title:"Normalize Noise",intervalStart:-1,intervalEnd:1},handles:[{position:vt.Left,dataType:"module",connection:"target",maxConnections:1},{position:vt.Right,dataType:"module",connection:"source"}]}};import{Position as Bt}from"@xyflow/system";var de=class{template={type:"noise-scale-bias",group:"Noise Modifiers",data:{title:"Scale/Bias Noise",scale:1,bias:0},handles:[{position:Bt.Left,dataType:"module",connection:"target",maxConnections:1},{position:Bt.Right,dataType:"module",connection:"source"}]}};import{Position as kt}from"@xyflow/system";var le=class{template={type:"noise-terrace",group:"Noise Modifiers",data:{title:"Noise Terrace",points:[]},handles:[{position:kt.Left,dataType:"module",connection:"target",maxConnections:1},{position:kt.Right,dataType:"module",connection:"source"}]}};import{Position as Cs}from"@xyflow/system";var ue=class{template={type:"noise-logger",group:"Output",data:{title:"Noise Logger"},handles:[{position:Cs.Left,dataType:"noise",connection:"target"}]}};import{Position as to}from"@xyflow/system";var Ne=class{template={type:"noise-output",group:"Output",data:{title:"Noise Output"},handles:[{position:to.Left,dataType:"position",connection:"target"},{position:to.Left,dataType:"module",connection:"target",maxConnections:1},{position:to.Right,dataType:"noise",connection:"source"}]}};import{Position as Gt}from"@xyflow/system";var ce=class{template={type:"texture-data",group:"Output",data:{title:"Texture Data"},handles:[{position:Gt.Left,dataType:"noise",connection:"target",maxConnections:1},{position:Gt.Right,dataType:"texture",connection:"source"}]}};import{Position as Ts}from"@xyflow/system";var fe=class{template={type:"position-logger",group:"Positions",data:{title:"Position Logger"},handles:[{position:Ts.Left,dataType:"position",connection:"target"}]}};import{Position as ao}from"@xyflow/system";var ye=class{template={type:"noise-blend",group:"Noise Selectors",data:{title:"Noise Blend"},handles:[{position:ao.Left,dataType:"module",connection:"target",label:"Source Modules",dataId:"source",maxConnections:2,minConnections:2},{position:ao.Left,dataType:"module",dataId:"control",connection:"target",label:"Control Module",maxConnections:1},{position:ao.Right,dataType:"module",dataId:"output",connection:"source"}]}};import{Position as ro}from"@xyflow/system";var Ce=class{template={type:"noise-select",group:"Noise Selectors",data:{title:"Noise Select",edgeFalloff:0,lowerBound:-1,upperBound:1},handles:[{position:ro.Left,dataType:"module",dataId:"source",connection:"target",label:"Source Modules",maxConnections:2,minConnections:2},{position:ro.Left,dataType:"module",dataId:"control",connection:"target",label:"Control Module",maxConnections:1},{position:ro.Right,dataType:"module",dataId:"output",connection:"source"}]}};import{Position as G}from"@xyflow/system";var Te=class{template={type:"noise-displace",group:"Noise Transformers",data:{title:"Noise Displace"},handles:[{position:G.Left,connection:"target",label:"Source Module",dataType:"module",dataId:"source",maxConnections:1},{position:G.Left,connection:"target",label:"X Module",dataType:"module",dataId:"x-module",maxConnections:1},{position:G.Left,connection:"target",label:"Y Module",dataType:"module",dataId:"y-module",maxConnections:1},{position:G.Left,connection:"target",label:"Z Module",dataType:"module",dataId:"z-module",maxConnections:1},{position:G.Right,dataType:"module",dataId:"output",connection:"source"}]}};import{Position as zt}from"@xyflow/system";var ge=class{template={type:"noise-rotate-point",group:"Noise Transformers",data:{title:"Noise Rotate Point",xAngle:0,yAngle:0,zAngle:0},handles:[{position:zt.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:zt.Right,dataType:"module",connection:"source"}]}};import{Position as Rt}from"@xyflow/system";var De=class{template={type:"noise-scale-point",group:"Noise Transformers",data:{title:"Noise Scale Point",xScale:1,yScale:1,zScale:1},handles:[{position:Rt.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:Rt.Right,dataType:"module",connection:"source"}]}};import{Position as Ft}from"@xyflow/system";var he=class{template={type:"noise-translate-point",group:"Noise Transformers",data:{title:"Noise Translate Point",translateX:0,translateY:0,translateZ:0},handles:[{position:Ft.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:Ft.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as gs}from"@awesome-flow/core/abstract";import{Position as io}from"@xyflow/system";var Pe=class{template={type:"noise-turbulence",group:"Noise Transformers",data:{title:"Noise Turbulence",frequency:1,power:1,roughness:1,seed:0},handles:[{position:io.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:io.Left,dataType:gs.variableProperty,label:"Variable Properties",connection:"target"},{position:io.Right,dataType:"module",connection:"source"}]}};var OC={"noise-output":new Ne,"noise-billow":new q,"noise-checkerboard":new $,"noise-normalize":new me,"noise-logger":new ue,"noise-constant":new K,position:new ee,"position-logger":new fe,grid:new oe,"texture-data":new ce,"noise-cylinders":new W,"noise-perlin":new _,"noise-ridged-multi":new J,"noise-spheres":new Q,"noise-voronoi":new j,"noise-combiner":new ie,"noise-clamp":new re,"noise-abs":new ae,"noise-curve":new ne,"noise-exponent":new pe,"noise-invert":new se,"noise-scale-bias":new de,"noise-terrace":new le,"noise-blend":new ye,"noise-select":new Ce,"noise-displace":new Te,"noise-rotate-point":new ge,"noise-scale-point":new De,"noise-translate-point":new he,"noise-turbulence":new Pe,"group-module":new te};import{jsx as Ut,jsxs as Vt}from"react/jsx-runtime";function Ss({id:e,selected:p,data:o,type:m}){let[a,s]=Ms(0),t=hs(),i=bs(r=>{let d=r.position,N=r.module;if(d?.length&&N?.length&&N[0]?.module){let{module:n}=N[0],u=[];for(let l of d)for(let C of l.positions){let T=n.getValue(C.x,C.y,C.z);u.push({position:C,value:T})}t(e,{noise:u,module:n}),s(u.length)}},[]);return Vt(Ps,{id:e,selected:p,data:o,type:m,children:[Ut(Ds,{nodeId:e,handles:o.handles,handleKey:"dataType",onDataUpdated:i,type:"target",resetComputedData:!0}),Vt(Is,{mt:5,children:["Noise points: ",a]}),Ut(xs,{handles:o.handles,nodeId:e,type:"target"})]})}var Lt=Ss;export{Mo as ModuleGroupNode,wo as NoiseAbsNode,po as NoiseBillowNode,pt as NoiseBlendNode,so as NoiseCheckerboardNode,Go as NoiseClampNode,Ro as NoiseCombineNode,lo as NoiseConstNode,Vo as NoiseCurveNode,No as NoiseCylindersNode,dt as NoiseDisplaceNode,Ho as NoiseExponentNode,Oo as NoiseInvertNode,ot as NoiseLoggerNode,qo as NoiseNormalizeNode,Lt as NoiseOutputNode,fo as NoisePerlinNode,at as NoiseRawTextureNode,Co as NoiseRidgedMultiNode,lt as NoiseRotatePointNode,_o as NoiseScaleBiasNode,ut as NoiseScalePointNode,st as NoiseSelectNode,go as NoiseSpheresNode,jo as NoiseTerraceNode,Nt as NoiseTranslatePointNode,ft as NoiseTurbulenceNode,ho as NoiseVoronoiNode,Po as PositionConstNode,xo as PositionGridNode,it as PositionsLoggerNode};
|