@awesome-flow/noise 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/index.cjs +8 -3469
- package/dist/abstract/index.d.cts +2 -2
- package/dist/abstract/index.d.ts +2 -2
- package/dist/abstract/index.js +15 -3508
- package/dist/chunk-2Y22M2Y4.js +0 -0
- package/dist/chunk-4PQ4USYV.cjs +1 -0
- package/dist/chunk-5ELMFIRV.js +0 -0
- package/dist/chunk-ACWBUUZ7.cjs +1376 -0
- package/dist/chunk-BG6U3TYO.js +1376 -0
- package/dist/chunk-D5JM4EYQ.cjs +305 -0
- package/dist/chunk-DWSACR65.js +305 -0
- package/dist/chunk-FFQRP23R.cjs +1 -0
- package/dist/chunk-JACBT4MS.cjs +1 -0
- package/dist/chunk-KHIIB5TH.js +93 -0
- package/dist/chunk-M67JHEU2.cjs +93 -0
- package/dist/chunk-N6YNJKLS.cjs +1 -0
- package/dist/chunk-PS5VUND5.js +348 -0
- package/dist/chunk-Q5FVGKKM.cjs +1 -0
- package/dist/chunk-RDQ4BOOV.js +522 -0
- package/dist/chunk-RKTZQUWR.cjs +348 -0
- package/dist/chunk-RVWCBH7K.js +0 -0
- package/dist/chunk-SD3T3LFY.js +0 -0
- package/dist/chunk-SGHEOOLW.js +19 -0
- package/dist/chunk-TOYKGWYO.js +0 -0
- package/dist/chunk-TZCT2GZV.cjs +522 -0
- package/dist/chunk-UNMRBZ5X.cjs +19 -0
- package/dist/chunk-WOJTKQKO.cjs +1 -0
- package/dist/chunk-XZQQ6N3L.js +0 -0
- package/dist/modules/index.cjs +4 -42
- package/dist/modules/index.js +3 -15
- package/dist/nodes/generators/index.cjs +13 -335
- package/dist/nodes/generators/index.d.cts +7 -7
- package/dist/nodes/generators/index.d.ts +7 -7
- package/dist/nodes/generators/index.js +12 -299
- package/dist/nodes/groups/index.cjs +4 -111
- package/dist/nodes/groups/index.d.cts +2 -2
- package/dist/nodes/groups/index.d.ts +2 -2
- package/dist/nodes/groups/index.js +2 -88
- package/dist/nodes/index.cjs +75 -3425
- package/dist/nodes/index.js +37 -3397
- package/dist/nodes/modifiers/index.cjs +4 -1459
- package/dist/nodes/modifiers/index.d.cts +6 -6
- package/dist/nodes/modifiers/index.d.ts +6 -6
- package/dist/nodes/modifiers/index.js +11 -1479
- package/dist/nodes/output/index.cjs +8 -1335
- package/dist/nodes/output/index.d.cts +3 -3
- package/dist/nodes/output/index.d.ts +3 -3
- package/dist/nodes/output/index.js +10 -1361
- package/dist/nodes/selectors/index.cjs +8 -1317
- package/dist/nodes/selectors/index.d.cts +1 -1
- package/dist/nodes/selectors/index.d.ts +1 -1
- package/dist/nodes/selectors/index.js +8 -1343
- package/dist/nodes/transformers/index.cjs +8 -331
- package/dist/nodes/transformers/index.d.cts +5 -5
- package/dist/nodes/transformers/index.d.ts +5 -5
- package/dist/nodes/transformers/index.js +6 -311
- package/dist/templates/generators/index.cjs +8 -1199
- package/dist/templates/generators/index.d.cts +5 -5
- package/dist/templates/generators/index.d.ts +5 -5
- package/dist/templates/generators/index.js +17 -1226
- package/dist/templates/groups/index.cjs +8 -1199
- package/dist/templates/groups/index.js +8 -1226
- package/dist/templates/index.cjs +77 -1263
- package/dist/templates/index.js +43 -1226
- package/dist/templates/modifiers/index.cjs +8 -1199
- package/dist/templates/modifiers/index.d.cts +9 -9
- package/dist/templates/modifiers/index.d.ts +9 -9
- package/dist/templates/modifiers/index.js +16 -1226
- package/dist/templates/output/index.cjs +8 -1199
- package/dist/templates/output/index.d.cts +3 -3
- package/dist/templates/output/index.d.ts +3 -3
- package/dist/templates/output/index.js +11 -1226
- package/dist/templates/selectors/index.cjs +8 -1199
- package/dist/templates/selectors/index.js +9 -1226
- package/dist/templates/transformers/index.cjs +8 -1199
- package/dist/templates/transformers/index.js +12 -1226
- package/package.json +30 -20
package/dist/abstract/index.js
CHANGED
|
@@ -1,3514 +1,21 @@
|
|
|
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/abstract/handle-types.ts
|
|
63
|
-
var NoiseHandleType = /* @__PURE__ */ ((NoiseHandleType2) => {
|
|
64
|
-
NoiseHandleType2["texture"] = "texture";
|
|
65
|
-
NoiseHandleType2["noise"] = "noise";
|
|
66
|
-
NoiseHandleType2["position"] = "position";
|
|
67
|
-
NoiseHandleType2["module"] = "module";
|
|
68
|
-
return NoiseHandleType2;
|
|
69
|
-
})(NoiseHandleType || {});
|
|
70
|
-
var DisplacementHandle = /* @__PURE__ */ ((DisplacementHandle2) => {
|
|
71
|
-
DisplacementHandle2["sourceModule"] = "source";
|
|
72
|
-
DisplacementHandle2["xModule"] = "x-module";
|
|
73
|
-
DisplacementHandle2["yModule"] = "y-module";
|
|
74
|
-
DisplacementHandle2["zModule"] = "z-module";
|
|
75
|
-
DisplacementHandle2["output"] = "output";
|
|
76
|
-
return DisplacementHandle2;
|
|
77
|
-
})(DisplacementHandle || {});
|
|
78
|
-
var NoiseSourceControlHandle = /* @__PURE__ */ ((NoiseSourceControlHandle2) => {
|
|
79
|
-
NoiseSourceControlHandle2["source"] = "source";
|
|
80
|
-
NoiseSourceControlHandle2["control"] = "control";
|
|
81
|
-
NoiseSourceControlHandle2["output"] = "output";
|
|
82
|
-
return NoiseSourceControlHandle2;
|
|
83
|
-
})(NoiseSourceControlHandle || {});
|
|
84
|
-
|
|
85
|
-
// src/nodes/generators/position-const-node.tsx
|
|
86
|
-
import { NodeContainer } from "@awesome-flow/core/layout";
|
|
87
|
-
import { useEffect, useState } from "react";
|
|
88
|
-
import { Group, NumberInput, Stack } from "@mantine/core";
|
|
89
|
-
import { useUpdateNodeComputedData, useUpdateNodeData } from "@awesome-flow/core/hooks";
|
|
90
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
91
|
-
function PositionConstNode({ id, selected, data, type }) {
|
|
92
|
-
const position = data.position ?? { x: 0, y: 0, z: 0 };
|
|
93
|
-
const [x, setX] = useState(position.x);
|
|
94
|
-
const [y, setY] = useState(position.y);
|
|
95
|
-
const [z, setZ] = useState(position.z);
|
|
96
|
-
const updateNodeData = useUpdateNodeData();
|
|
97
|
-
const updateComputedData = useUpdateNodeComputedData();
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
const position2 = { x, y, z };
|
|
100
|
-
updateNodeData(id, {
|
|
101
|
-
position: position2
|
|
102
|
-
});
|
|
103
|
-
updateComputedData(id, {
|
|
104
|
-
positions: [position2]
|
|
105
|
-
});
|
|
106
|
-
}, [x, y, z]);
|
|
107
|
-
return /* @__PURE__ */ jsx(NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
108
|
-
/* @__PURE__ */ jsxs(Group, { children: [
|
|
109
|
-
"x: ",
|
|
110
|
-
/* @__PURE__ */ jsx(NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
111
|
-
] }),
|
|
112
|
-
/* @__PURE__ */ jsxs(Group, { children: [
|
|
113
|
-
"y: ",
|
|
114
|
-
/* @__PURE__ */ jsx(NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
115
|
-
] }),
|
|
116
|
-
/* @__PURE__ */ jsxs(Group, { children: [
|
|
117
|
-
"z: ",
|
|
118
|
-
/* @__PURE__ */ jsx(NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
119
|
-
] })
|
|
120
|
-
] }) });
|
|
121
|
-
}
|
|
122
|
-
var position_const_node_default = PositionConstNode;
|
|
123
|
-
|
|
124
|
-
// src/nodes/generators/position-grid-node.tsx
|
|
125
|
-
import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
|
|
126
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
127
|
-
import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
|
|
128
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData2, useUpdateNodeData as useUpdateNodeData2 } from "@awesome-flow/core/hooks";
|
|
129
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
130
|
-
function PositionGridNode({ id, selected, data, type }) {
|
|
131
|
-
const [x, setX] = useState2(data.center?.x);
|
|
132
|
-
const [y, setY] = useState2(data.center?.y);
|
|
133
|
-
const [z, setZ] = useState2(data.center?.z);
|
|
134
|
-
const [radius, setRadius] = useState2(data.radius);
|
|
135
|
-
const updateNodeData = useUpdateNodeData2();
|
|
136
|
-
const updateComputedData = useUpdateNodeComputedData2();
|
|
137
|
-
useEffect2(() => {
|
|
138
|
-
updateNodeData(id, {
|
|
139
|
-
center: { x, y, z }
|
|
140
|
-
});
|
|
141
|
-
}, [x, y, z]);
|
|
142
|
-
useEffect2(() => {
|
|
143
|
-
updateNodeData(id, {
|
|
144
|
-
radius
|
|
145
|
-
});
|
|
146
|
-
}, [radius]);
|
|
147
|
-
useEffect2(() => {
|
|
148
|
-
const positions = [];
|
|
149
|
-
for (let i = -radius; i < radius; i++) {
|
|
150
|
-
for (let j = -radius; j < radius; j++) {
|
|
151
|
-
positions.push({ x: x + i, y: y + j, z });
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
updateComputedData(id, {
|
|
155
|
-
positions
|
|
156
|
-
});
|
|
157
|
-
}, [x, y, z, radius]);
|
|
158
|
-
return /* @__PURE__ */ jsx2(NodeContainer2, { id, selected, data, type, children: /* @__PURE__ */ jsxs2(Stack2, { children: [
|
|
159
|
-
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
160
|
-
"x: ",
|
|
161
|
-
/* @__PURE__ */ jsx2(NumberInput2, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
162
|
-
] }),
|
|
163
|
-
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
164
|
-
"y: ",
|
|
165
|
-
/* @__PURE__ */ jsx2(NumberInput2, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
166
|
-
] }),
|
|
167
|
-
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
168
|
-
"z: ",
|
|
169
|
-
/* @__PURE__ */ jsx2(NumberInput2, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
170
|
-
] }),
|
|
171
|
-
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
172
|
-
"r: ",
|
|
173
|
-
/* @__PURE__ */ jsx2(NumberInput2, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
|
|
174
|
-
] })
|
|
175
|
-
] }) });
|
|
176
|
-
}
|
|
177
|
-
var position_grid_node_default = PositionGridNode;
|
|
178
|
-
|
|
179
|
-
// src/nodes/modifiers/noise-normalize-node.tsx
|
|
180
|
-
import { NodeContainer as NodeContainer3, NodeTrackConnections } from "@awesome-flow/core/layout";
|
|
181
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
182
|
-
import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
|
|
183
|
-
import {
|
|
184
|
-
useIncomingComputedData,
|
|
185
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData3,
|
|
186
|
-
useUpdateNodeData as useUpdateNodeData3
|
|
187
|
-
} from "@awesome-flow/core/hooks";
|
|
188
|
-
|
|
189
|
-
// src/modules/normalize-noise-module.ts
|
|
190
|
-
import { ModifierModule } from "libnoise-simplex-ts";
|
|
191
|
-
var NormalizeNoiseModule = class extends ModifierModule {
|
|
192
|
-
constructor(source, lowerBound, upperBound) {
|
|
193
|
-
super(source);
|
|
194
|
-
this.lowerBound = lowerBound;
|
|
195
|
-
this.upperBound = upperBound;
|
|
196
|
-
}
|
|
197
|
-
getValue(x, y, z) {
|
|
198
|
-
return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
function normalize(value, min, max) {
|
|
202
|
-
return (value - min) / (max - min);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// src/nodes/modifiers/noise-normalize-node.tsx
|
|
206
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
207
|
-
function NoiseNormalizeNode({ id, selected, data, type }) {
|
|
208
|
-
const [intervalStart, setIntervalStart] = useState3(data.intervalStart);
|
|
209
|
-
const [intervalEnd, setIntervalEnd] = useState3(data.intervalEnd);
|
|
210
|
-
const incoming = useIncomingComputedData(id);
|
|
211
|
-
const updateNodeData = useUpdateNodeData3();
|
|
212
|
-
const updateComputedData = useUpdateNodeComputedData3();
|
|
213
|
-
useEffect3(() => {
|
|
214
|
-
if (incoming?.length) {
|
|
215
|
-
const source = incoming[0].module;
|
|
216
|
-
const module = new NormalizeNoiseModule(source, intervalStart, intervalEnd);
|
|
217
|
-
updateComputedData(id, { module });
|
|
218
|
-
}
|
|
219
|
-
updateNodeData(id, { intervalStart, intervalEnd });
|
|
220
|
-
}, [incoming, intervalStart, intervalEnd]);
|
|
221
|
-
return /* @__PURE__ */ jsxs3(NodeContainer3, { id, selected, data, type, children: [
|
|
222
|
-
/* @__PURE__ */ jsx3(Stack3, { children: /* @__PURE__ */ jsxs3(Group3, { children: [
|
|
223
|
-
/* @__PURE__ */ jsx3(
|
|
224
|
-
NumberInput3,
|
|
225
|
-
{
|
|
226
|
-
size: "xs",
|
|
227
|
-
w: 100,
|
|
228
|
-
value: intervalStart,
|
|
229
|
-
onChange: (e) => setIntervalStart(Number(e))
|
|
230
|
-
}
|
|
231
|
-
),
|
|
232
|
-
/* @__PURE__ */ jsx3(
|
|
233
|
-
NumberInput3,
|
|
234
|
-
{
|
|
235
|
-
size: "xs",
|
|
236
|
-
w: 100,
|
|
237
|
-
value: intervalEnd,
|
|
238
|
-
onChange: (e) => setIntervalEnd(Number(e))
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
] }) }),
|
|
242
|
-
/* @__PURE__ */ jsx3(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
243
|
-
] });
|
|
244
|
-
}
|
|
245
|
-
var noise_normalize_node_default = NoiseNormalizeNode;
|
|
246
|
-
|
|
247
|
-
// src/nodes/generators/noise-const-node.tsx
|
|
248
|
-
import { NodeContainer as NodeContainer4 } from "@awesome-flow/core/layout";
|
|
249
|
-
import { useEffect as useEffect4, useMemo, useState as useState4 } from "react";
|
|
250
|
-
import { Group as Group4, NumberInput as NumberInput4, Stack as Stack4 } from "@mantine/core";
|
|
251
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData4, useUpdateNodeData as useUpdateNodeData4 } from "@awesome-flow/core/hooks";
|
|
252
|
-
import { Const } from "libnoise-simplex-ts";
|
|
253
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
254
|
-
function NoiseConstNode({ id, selected, data, type }) {
|
|
255
|
-
const [min, setMin] = useState4(data.min);
|
|
256
|
-
const [max, setMax] = useState4(data.max);
|
|
257
|
-
const [noise, setNoise] = useState4(data.noise);
|
|
258
|
-
const updateNodeData = useUpdateNodeData4();
|
|
259
|
-
const updateComputedData = useUpdateNodeComputedData4();
|
|
260
|
-
const module = useMemo(() => new Const(), []);
|
|
261
|
-
useEffect4(() => {
|
|
262
|
-
module.value = noise;
|
|
263
|
-
updateNodeData(id, { noise, min, max });
|
|
264
|
-
updateComputedData(id, { module });
|
|
265
|
-
}, [noise, min, max, module, updateNodeData, id, updateComputedData]);
|
|
266
|
-
return /* @__PURE__ */ jsx4(NodeContainer4, { id, selected, data, type, children: /* @__PURE__ */ jsxs4(Stack4, { children: [
|
|
267
|
-
/* @__PURE__ */ jsxs4(Group4, { children: [
|
|
268
|
-
/* @__PURE__ */ jsx4(NumberInput4, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
|
|
269
|
-
/* @__PURE__ */ jsx4(NumberInput4, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
|
|
270
|
-
] }),
|
|
271
|
-
/* @__PURE__ */ jsxs4(Group4, { children: [
|
|
272
|
-
"noise:",
|
|
273
|
-
/* @__PURE__ */ jsx4(
|
|
274
|
-
NumberInput4,
|
|
275
|
-
{
|
|
276
|
-
size: "xs",
|
|
277
|
-
value: noise,
|
|
278
|
-
onChange: (e) => setNoise(Number(e)),
|
|
279
|
-
max,
|
|
280
|
-
min,
|
|
281
|
-
step: 0.1
|
|
282
|
-
}
|
|
283
|
-
)
|
|
284
|
-
] })
|
|
285
|
-
] }) });
|
|
286
|
-
}
|
|
287
|
-
var noise_const_node_default = NoiseConstNode;
|
|
288
|
-
|
|
289
|
-
// src/nodes/generators/noise-billow-node.tsx
|
|
290
|
-
import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
|
|
291
|
-
import { useCallback, useMemo as useMemo2 } from "react";
|
|
292
|
-
import { Billow } from "libnoise-simplex-ts";
|
|
293
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData5 } from "@awesome-flow/core/hooks";
|
|
294
|
-
import { NodePropertyVariables } from "@awesome-flow/core/components";
|
|
295
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
296
|
-
function NoiseBillowNode({ id, selected, data, type }) {
|
|
297
|
-
const updateComputedData = useUpdateNodeComputedData5();
|
|
298
|
-
const module = useMemo2(() => new Billow(), []);
|
|
299
|
-
const onPropertiesChange = useCallback(
|
|
300
|
-
(properties) => {
|
|
301
|
-
Object.keys(properties).forEach((k) => {
|
|
302
|
-
module[k] = properties[k].value;
|
|
303
|
-
});
|
|
304
|
-
updateComputedData(id, { module });
|
|
305
|
-
},
|
|
306
|
-
[id, module, updateComputedData]
|
|
307
|
-
);
|
|
308
|
-
return /* @__PURE__ */ jsxs5(NodeContainer5, { id, selected, data, type, children: [
|
|
309
|
-
/* @__PURE__ */ jsx5(NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
|
|
310
|
-
/* @__PURE__ */ jsx5(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
|
|
311
|
-
] });
|
|
312
|
-
}
|
|
313
|
-
var noise_billow_node_default = NoiseBillowNode;
|
|
314
|
-
|
|
315
|
-
// src/nodes/output/noise-logger-node.tsx
|
|
316
|
-
import { NodeContainer as NodeContainer6, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
|
|
317
|
-
import { useMemo as useMemo3 } from "react";
|
|
318
|
-
import { Divider, Stack as Stack5, Text } from "@mantine/core";
|
|
319
|
-
import { useIncomingComputedData as useIncomingComputedData2 } from "@awesome-flow/core/hooks";
|
|
320
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
321
|
-
function NoiseLoggerNode({ id, selected, data, type }) {
|
|
322
|
-
const incoming = useIncomingComputedData2(id);
|
|
323
|
-
const noise = useMemo3(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
324
|
-
return /* @__PURE__ */ jsxs6(NodeContainer6, { id, selected, data, type, children: [
|
|
325
|
-
/* @__PURE__ */ jsxs6(Text, { children: [
|
|
326
|
-
"Size: ",
|
|
327
|
-
noise?.length || 0
|
|
328
|
-
] }),
|
|
329
|
-
/* @__PURE__ */ jsx6(Divider, { h: 5 }),
|
|
330
|
-
/* @__PURE__ */ jsx6(Stack5, { children: noise?.map((v, i) => /* @__PURE__ */ jsxs6(Text, { children: [
|
|
331
|
-
v.position?.x,
|
|
332
|
-
":",
|
|
333
|
-
v.position?.y,
|
|
334
|
-
":",
|
|
335
|
-
v.position?.z,
|
|
336
|
-
": ",
|
|
337
|
-
v.value
|
|
338
|
-
] }, i)) }),
|
|
339
|
-
/* @__PURE__ */ jsx6(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
|
|
340
|
-
] });
|
|
341
|
-
}
|
|
342
|
-
var noise_logger_node_default = NoiseLoggerNode;
|
|
343
|
-
|
|
344
|
-
// src/nodes/output/noise-raw-texture-node.tsx
|
|
345
|
-
import { NodeContainer as NodeContainer7, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
|
|
346
|
-
import { useEffect as useEffect5, useMemo as useMemo4, useState as useState5 } from "react";
|
|
347
|
-
import { useIncomingComputedData as useIncomingComputedData3, useUpdateNodeComputedData as useUpdateNodeComputedData6 } from "@awesome-flow/core/hooks";
|
|
348
|
-
import { Group as Group5, Stack as Stack6 } from "@mantine/core";
|
|
349
|
-
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
350
|
-
function NoiseRawTextureNode({ id, selected, data, type }) {
|
|
351
|
-
const updateComputedData = useUpdateNodeComputedData6();
|
|
352
|
-
const [dataLength, setDataLength] = useState5(0);
|
|
353
|
-
const [resolution, setResolution] = useState5(0);
|
|
354
|
-
const incoming = useIncomingComputedData3(id);
|
|
355
|
-
const noise = useMemo4(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
356
|
-
useEffect5(() => {
|
|
357
|
-
if (noise?.length) {
|
|
358
|
-
const size = Math.ceil(Math.sqrt(noise.length));
|
|
359
|
-
const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();
|
|
360
|
-
const dataArray = new Uint8Array(size * size * 4);
|
|
361
|
-
dataArray.set(colors);
|
|
362
|
-
setResolution(size);
|
|
363
|
-
setDataLength(dataArray.length);
|
|
364
|
-
updateComputedData(id, {
|
|
365
|
-
textureData: dataArray,
|
|
366
|
-
textureResolutionX: size,
|
|
367
|
-
textureResolutionY: size
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
}, [noise]);
|
|
371
|
-
return /* @__PURE__ */ jsxs7(NodeContainer7, { id, selected, data, type, children: [
|
|
372
|
-
/* @__PURE__ */ jsxs7(Stack6, { children: [
|
|
373
|
-
/* @__PURE__ */ jsxs7(Group5, { children: [
|
|
374
|
-
"Resolution: ",
|
|
375
|
-
resolution,
|
|
376
|
-
"x",
|
|
377
|
-
resolution
|
|
378
|
-
] }),
|
|
379
|
-
/* @__PURE__ */ jsxs7(Group5, { children: [
|
|
380
|
-
"Input Length: ",
|
|
381
|
-
noise?.length || 0
|
|
382
|
-
] }),
|
|
383
|
-
/* @__PURE__ */ jsxs7(Group5, { children: [
|
|
384
|
-
"Output Length (",
|
|
385
|
-
resolution,
|
|
386
|
-
"*",
|
|
387
|
-
resolution,
|
|
388
|
-
"*4): ",
|
|
389
|
-
dataLength
|
|
390
|
-
] })
|
|
391
|
-
] }),
|
|
392
|
-
/* @__PURE__ */ jsx7(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
|
|
393
|
-
] });
|
|
394
|
-
}
|
|
395
|
-
var noise_raw_texture_node_default = NoiseRawTextureNode;
|
|
396
|
-
|
|
397
|
-
// src/nodes/generators/noise-checkerboard-node.tsx
|
|
398
|
-
import { NodeContainer as NodeContainer8 } from "@awesome-flow/core/layout";
|
|
399
|
-
import { useEffect as useEffect6, useMemo as useMemo5 } from "react";
|
|
400
|
-
import { Checkerboard } from "libnoise-simplex-ts";
|
|
401
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData7 } from "@awesome-flow/core/hooks";
|
|
402
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
403
|
-
function NoiseCheckerboardNode({ id, selected, data, type }) {
|
|
404
|
-
const updateComputedData = useUpdateNodeComputedData7();
|
|
405
|
-
const module = useMemo5(() => new Checkerboard(), []);
|
|
406
|
-
useEffect6(() => {
|
|
407
|
-
updateComputedData(id, { module });
|
|
408
|
-
}, [id, module, updateComputedData]);
|
|
409
|
-
return /* @__PURE__ */ jsx8(NodeContainer8, { id, selected, data, type });
|
|
410
|
-
}
|
|
411
|
-
var noise_checkerboard_node_default = NoiseCheckerboardNode;
|
|
412
|
-
|
|
413
|
-
// src/nodes/output/positions-logger-node.tsx
|
|
414
|
-
import { NodeContainer as NodeContainer9, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
|
|
415
|
-
import { useMemo as useMemo6 } from "react";
|
|
416
|
-
import { Divider as Divider2, Stack as Stack7, Text as Text2 } from "@mantine/core";
|
|
417
|
-
import { useIncomingComputedData as useIncomingComputedData4 } from "@awesome-flow/core/hooks";
|
|
418
|
-
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
419
|
-
function PositionsLoggerNode({ id, selected, data, type }) {
|
|
420
|
-
const incoming = useIncomingComputedData4(id);
|
|
421
|
-
const positions = useMemo6(() => {
|
|
422
|
-
return incoming?.map((p) => p.positions).flat();
|
|
423
|
-
}, [incoming]);
|
|
424
|
-
return /* @__PURE__ */ jsxs8(NodeContainer9, { id, selected, data, type, children: [
|
|
425
|
-
/* @__PURE__ */ jsxs8(Text2, { children: [
|
|
426
|
-
"Size: ",
|
|
427
|
-
positions?.length || 0
|
|
428
|
-
] }),
|
|
429
|
-
/* @__PURE__ */ jsx9(Divider2, { h: 5 }),
|
|
430
|
-
/* @__PURE__ */ jsx9(Stack7, { children: positions?.map((v, i) => /* @__PURE__ */ jsxs8(Text2, { children: [
|
|
431
|
-
v.x,
|
|
432
|
-
":",
|
|
433
|
-
v.y,
|
|
434
|
-
":",
|
|
435
|
-
v.z
|
|
436
|
-
] }, i)) }),
|
|
437
|
-
/* @__PURE__ */ jsx9(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
|
|
438
|
-
] });
|
|
439
|
-
}
|
|
440
|
-
var positions_logger_node_default = PositionsLoggerNode;
|
|
441
|
-
|
|
442
|
-
// src/nodes/generators/noise-cylinders-node.tsx
|
|
443
|
-
import { NodeContainer as NodeContainer10, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
|
|
444
|
-
import { useCallback as useCallback2, useMemo as useMemo7 } from "react";
|
|
445
|
-
import { Cylinders } from "libnoise-simplex-ts";
|
|
446
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData8 } from "@awesome-flow/core/hooks";
|
|
447
|
-
import { NodePropertyVariables as NodePropertyVariables2 } from "@awesome-flow/core/components";
|
|
448
|
-
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
449
|
-
function NoiseCylindersNode({ id, selected, data, type }) {
|
|
450
|
-
const updateComputedData = useUpdateNodeComputedData8();
|
|
451
|
-
const module = useMemo7(() => new Cylinders(), []);
|
|
452
|
-
const onPropertiesChange = useCallback2(
|
|
453
|
-
(properties) => {
|
|
454
|
-
Object.keys(properties).forEach((k) => {
|
|
455
|
-
module[k] = properties[k].value;
|
|
456
|
-
});
|
|
457
|
-
updateComputedData(id, { module });
|
|
458
|
-
},
|
|
459
|
-
[id, module, updateComputedData]
|
|
460
|
-
);
|
|
461
|
-
return /* @__PURE__ */ jsxs9(NodeContainer10, { id, selected, data, type, children: [
|
|
462
|
-
/* @__PURE__ */ jsx10(NodePropertyVariables2, { data, nodeId: id, onPropertiesChange }),
|
|
463
|
-
/* @__PURE__ */ jsx10(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" })
|
|
464
|
-
] });
|
|
465
|
-
}
|
|
466
|
-
var noise_cylinders_node_default = NoiseCylindersNode;
|
|
467
|
-
|
|
468
|
-
// src/nodes/generators/noise-perlin-node.tsx
|
|
469
|
-
import { NodeContainer as NodeContainer11, NodeTrackConnections as NodeTrackConnections7 } from "@awesome-flow/core/layout";
|
|
470
|
-
import { useCallback as useCallback3, useMemo as useMemo8 } from "react";
|
|
471
|
-
import { Perlin } from "libnoise-simplex-ts";
|
|
472
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData9 } from "@awesome-flow/core/hooks";
|
|
473
|
-
import { NodePropertyVariables as NodePropertyVariables3 } from "@awesome-flow/core/components";
|
|
474
|
-
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
475
|
-
function NoisePerlinNode({ id, selected, data, type }) {
|
|
476
|
-
const updateComputedData = useUpdateNodeComputedData9();
|
|
477
|
-
const module = useMemo8(() => new Perlin(), []);
|
|
478
|
-
const onPropertiesChange = useCallback3(
|
|
479
|
-
(properties) => {
|
|
480
|
-
Object.keys(properties).forEach((k) => {
|
|
481
|
-
module[k] = properties[k].value;
|
|
482
|
-
});
|
|
483
|
-
updateComputedData(id, { module });
|
|
484
|
-
},
|
|
485
|
-
[id, module, updateComputedData]
|
|
486
|
-
);
|
|
487
|
-
return /* @__PURE__ */ jsxs10(NodeContainer11, { id, selected, data, type, children: [
|
|
488
|
-
/* @__PURE__ */ jsx11(NodePropertyVariables3, { data, nodeId: id, onPropertiesChange }),
|
|
489
|
-
/* @__PURE__ */ jsx11(NodeTrackConnections7, { handles: data.handles, nodeId: id, type: "target" })
|
|
490
|
-
] });
|
|
491
|
-
}
|
|
492
|
-
var noise_perlin_node_default = NoisePerlinNode;
|
|
493
|
-
|
|
494
|
-
// src/nodes/generators/noise-ridgedmulti-node.tsx
|
|
495
|
-
import { NodeContainer as NodeContainer12, NodeTrackConnections as NodeTrackConnections8 } from "@awesome-flow/core/layout";
|
|
496
|
-
import { useCallback as useCallback4, useMemo as useMemo9 } from "react";
|
|
497
|
-
import { RidgedMulti } from "libnoise-simplex-ts";
|
|
498
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData10 } from "@awesome-flow/core/hooks";
|
|
499
|
-
import { NodePropertyVariables as NodePropertyVariables4 } from "@awesome-flow/core/components";
|
|
500
|
-
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
501
|
-
function NoiseRidgedMultiNode({ id, selected, data, type }) {
|
|
502
|
-
const updateComputedData = useUpdateNodeComputedData10();
|
|
503
|
-
const module = useMemo9(() => new RidgedMulti(), []);
|
|
504
|
-
const onPropertiesChange = useCallback4((properties) => {
|
|
505
|
-
Object.keys(properties).forEach((k) => module[k] = properties[k].value);
|
|
506
|
-
updateComputedData(id, { module });
|
|
507
|
-
}, []);
|
|
508
|
-
return /* @__PURE__ */ jsxs11(NodeContainer12, { id, selected, data, type, children: [
|
|
509
|
-
/* @__PURE__ */ jsx12(NodePropertyVariables4, { data, nodeId: id, onPropertiesChange }),
|
|
510
|
-
/* @__PURE__ */ jsx12(NodeTrackConnections8, { handles: data.handles, nodeId: id, type: "target" })
|
|
511
|
-
] });
|
|
512
|
-
}
|
|
513
|
-
var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
|
|
514
|
-
|
|
515
|
-
// src/nodes/generators/noise-spheres-node.tsx
|
|
516
|
-
import { NodeContainer as NodeContainer13, NodeTrackConnections as NodeTrackConnections9 } from "@awesome-flow/core/layout";
|
|
517
|
-
import { useCallback as useCallback5, useMemo as useMemo10 } from "react";
|
|
518
|
-
import { Spheres } from "libnoise-simplex-ts";
|
|
519
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData11 } from "@awesome-flow/core/hooks";
|
|
520
|
-
import { NodePropertyVariables as NodePropertyVariables5 } from "@awesome-flow/core/components";
|
|
521
|
-
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
522
|
-
function NoiseSpheresNode({ id, selected, data, type }) {
|
|
523
|
-
const updateComputedData = useUpdateNodeComputedData11();
|
|
524
|
-
const module = useMemo10(() => new Spheres(), []);
|
|
525
|
-
const onPropertiesChange = useCallback5((properties) => {
|
|
526
|
-
Object.keys(properties).forEach((k) => module[k] = properties[k].value);
|
|
527
|
-
updateComputedData(id, { module });
|
|
528
|
-
}, []);
|
|
529
|
-
return /* @__PURE__ */ jsxs12(NodeContainer13, { id, selected, data, type, children: [
|
|
530
|
-
/* @__PURE__ */ jsx13(NodePropertyVariables5, { data, nodeId: id, onPropertiesChange }),
|
|
531
|
-
/* @__PURE__ */ jsx13(NodeTrackConnections9, { handles: data.handles, nodeId: id, type: "target" })
|
|
532
|
-
] });
|
|
533
|
-
}
|
|
534
|
-
var noise_spheres_node_default = NoiseSpheresNode;
|
|
535
|
-
|
|
536
|
-
// src/nodes/generators/noise-voronoi-node.tsx
|
|
537
|
-
import { NodeContainer as NodeContainer14, NodeTrackConnections as NodeTrackConnections10 } from "@awesome-flow/core/layout";
|
|
538
|
-
import { useCallback as useCallback6 } from "react";
|
|
539
|
-
import { Voronoi } from "libnoise-simplex-ts";
|
|
540
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData12 } from "@awesome-flow/core/hooks";
|
|
541
|
-
import { NodePropertyVariables as NodePropertyVariables6 } from "@awesome-flow/core/components";
|
|
542
|
-
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
543
|
-
function NoiseVoronoiNode({ id, selected, data, type }) {
|
|
544
|
-
const updateComputedData = useUpdateNodeComputedData12();
|
|
545
|
-
const onPropertiesChange = useCallback6(
|
|
546
|
-
(properties) => {
|
|
547
|
-
const module = new Voronoi(
|
|
548
|
-
properties.frequency.value,
|
|
549
|
-
properties.displacement.value,
|
|
550
|
-
properties.distance.value,
|
|
551
|
-
properties.seed.value
|
|
552
|
-
);
|
|
553
|
-
updateComputedData(id, { module });
|
|
554
|
-
},
|
|
555
|
-
[]
|
|
556
|
-
);
|
|
557
|
-
return /* @__PURE__ */ jsxs13(NodeContainer14, { id, selected, data, type, children: [
|
|
558
|
-
/* @__PURE__ */ jsx14(NodePropertyVariables6, { data, nodeId: id, onPropertiesChange }),
|
|
559
|
-
/* @__PURE__ */ jsx14(NodeTrackConnections10, { handles: data.handles, nodeId: id, type: "target" })
|
|
560
|
-
] });
|
|
561
|
-
}
|
|
562
|
-
var noise_voronoi_node_default = NoiseVoronoiNode;
|
|
563
|
-
|
|
564
|
-
// src/nodes/modifiers/noise-combine-node.tsx
|
|
565
|
-
import { NodeCombobox, NodeContainer as NodeContainer15, NodeTrackConnections as NodeTrackConnections11 } from "@awesome-flow/core/layout";
|
|
566
|
-
import { useCallback as useCallback7, useEffect as useEffect7 } from "react";
|
|
567
|
-
import {
|
|
568
|
-
useIncomingComputedData as useIncomingComputedData5,
|
|
569
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData13,
|
|
570
|
-
useUpdateNodeData as useUpdateNodeData5
|
|
571
|
-
} from "@awesome-flow/core/hooks";
|
|
572
|
-
import {
|
|
573
|
-
IconAsterisk,
|
|
574
|
-
IconChevronLeft,
|
|
575
|
-
IconChevronRight,
|
|
576
|
-
IconChevronUp,
|
|
577
|
-
IconPlus
|
|
578
|
-
} from "@tabler/icons-react";
|
|
579
|
-
|
|
580
|
-
// src/abstract/operations.ts
|
|
581
|
-
import { Add, Max, Min, Multiply, Power } from "libnoise-simplex-ts";
|
|
582
|
-
var NoiseCombineType = /* @__PURE__ */ ((NoiseCombineType3) => {
|
|
583
|
-
NoiseCombineType3["add"] = "add";
|
|
584
|
-
NoiseCombineType3["max"] = "max";
|
|
585
|
-
NoiseCombineType3["min"] = "min";
|
|
586
|
-
NoiseCombineType3["multiply"] = "multiply";
|
|
587
|
-
NoiseCombineType3["power"] = "power";
|
|
588
|
-
return NoiseCombineType3;
|
|
589
|
-
})(NoiseCombineType || {});
|
|
590
|
-
var noiseCombineModuleMap = {
|
|
591
|
-
["add" /* add */]: Add,
|
|
592
|
-
["max" /* max */]: Max,
|
|
593
|
-
["min" /* min */]: Min,
|
|
594
|
-
["multiply" /* multiply */]: Multiply,
|
|
595
|
-
["power" /* power */]: Power
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
// src/nodes/modifiers/noise-combine-node.tsx
|
|
599
|
-
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
600
|
-
var options = {
|
|
601
|
-
add: /* @__PURE__ */ jsx15(IconPlus, {}),
|
|
602
|
-
min: /* @__PURE__ */ jsx15(IconChevronLeft, {}),
|
|
603
|
-
max: /* @__PURE__ */ jsx15(IconChevronRight, {}),
|
|
604
|
-
multiply: /* @__PURE__ */ jsx15(IconAsterisk, {}),
|
|
605
|
-
power: /* @__PURE__ */ jsx15(IconChevronUp, {})
|
|
606
|
-
};
|
|
607
|
-
function NoiseCombineNode({ id, selected, data, type }) {
|
|
608
|
-
const updateNodeData = useUpdateNodeData5();
|
|
609
|
-
const updateComputedData = useUpdateNodeComputedData13();
|
|
610
|
-
const incoming = useIncomingComputedData5(id);
|
|
611
|
-
useEffect7(() => {
|
|
612
|
-
const ModuleFactory = noiseCombineModuleMap[data.operation];
|
|
613
|
-
if (incoming?.length > 1) {
|
|
614
|
-
const module = new ModuleFactory(incoming[0].module, incoming[1].module);
|
|
615
|
-
updateComputedData(id, { module });
|
|
616
|
-
}
|
|
617
|
-
}, [data.operation, incoming]);
|
|
618
|
-
const onChange = useCallback7((operation) => {
|
|
619
|
-
updateNodeData(id, { operation });
|
|
620
|
-
}, []);
|
|
621
|
-
return /* @__PURE__ */ jsxs14(NodeContainer15, { id, selected, data, type, children: [
|
|
622
|
-
/* @__PURE__ */ jsx15(NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
|
|
623
|
-
/* @__PURE__ */ jsx15(NodeTrackConnections11, { handles: data.handles, nodeId: id, type: "target" })
|
|
624
|
-
] });
|
|
625
|
-
}
|
|
626
|
-
var noise_combine_node_default = NoiseCombineNode;
|
|
627
|
-
|
|
628
|
-
// src/nodes/modifiers/noise-clamp-node.tsx
|
|
629
|
-
import { NodeContainer as NodeContainer16, NodeTrackConnections as NodeTrackConnections12 } from "@awesome-flow/core/layout";
|
|
630
|
-
import { useEffect as useEffect8, useState as useState6 } from "react";
|
|
631
|
-
import { Group as Group6, NumberInput as NumberInput5, Stack as Stack8 } from "@mantine/core";
|
|
632
|
-
import {
|
|
633
|
-
useIncomingComputedData as useIncomingComputedData6,
|
|
634
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData14,
|
|
635
|
-
useUpdateNodeData as useUpdateNodeData6
|
|
636
|
-
} from "@awesome-flow/core/hooks";
|
|
637
|
-
import { Clamp } from "libnoise-simplex-ts";
|
|
638
|
-
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
639
|
-
function NoiseClampNode({ id, selected, data, type }) {
|
|
640
|
-
const [lowerBound, setLowerBound] = useState6(data.lowerBound);
|
|
641
|
-
const [upperBound, setUpperBound] = useState6(data.upperBound);
|
|
642
|
-
const incoming = useIncomingComputedData6(id);
|
|
643
|
-
const updateNodeData = useUpdateNodeData6();
|
|
644
|
-
const updateComputedData = useUpdateNodeComputedData14();
|
|
645
|
-
useEffect8(() => {
|
|
646
|
-
if (incoming?.length) {
|
|
647
|
-
const module = new Clamp(incoming[0].module, lowerBound, upperBound);
|
|
648
|
-
updateComputedData(id, { module });
|
|
649
|
-
}
|
|
650
|
-
updateNodeData(id, { lowerBound, upperBound });
|
|
651
|
-
}, [incoming, lowerBound, upperBound]);
|
|
652
|
-
return /* @__PURE__ */ jsxs15(NodeContainer16, { id, selected, data, type, children: [
|
|
653
|
-
/* @__PURE__ */ jsx16(Stack8, { children: /* @__PURE__ */ jsxs15(Group6, { children: [
|
|
654
|
-
/* @__PURE__ */ jsx16(
|
|
655
|
-
NumberInput5,
|
|
656
|
-
{
|
|
657
|
-
size: "xs",
|
|
658
|
-
w: 100,
|
|
659
|
-
value: lowerBound,
|
|
660
|
-
onChange: (e) => setLowerBound(Number(e)),
|
|
661
|
-
step: 0.1
|
|
662
|
-
}
|
|
663
|
-
),
|
|
664
|
-
/* @__PURE__ */ jsx16(
|
|
665
|
-
NumberInput5,
|
|
666
|
-
{
|
|
667
|
-
size: "xs",
|
|
668
|
-
w: 100,
|
|
669
|
-
value: upperBound,
|
|
670
|
-
onChange: (e) => setUpperBound(Number(e)),
|
|
671
|
-
step: 0.1
|
|
672
|
-
}
|
|
673
|
-
)
|
|
674
|
-
] }) }),
|
|
675
|
-
/* @__PURE__ */ jsx16(NodeTrackConnections12, { handles: data.handles, nodeId: id, type: "target" })
|
|
676
|
-
] });
|
|
677
|
-
}
|
|
678
|
-
var noise_clamp_node_default = NoiseClampNode;
|
|
679
|
-
|
|
680
|
-
// src/nodes/modifiers/noise-abs-node.tsx
|
|
681
|
-
import { NodeContainer as NodeContainer17, NodeTrackConnections as NodeTrackConnections13 } from "@awesome-flow/core/layout";
|
|
682
|
-
import { useEffect as useEffect9 } from "react";
|
|
683
|
-
import { useIncomingComputedData as useIncomingComputedData7, useUpdateNodeComputedData as useUpdateNodeComputedData15 } from "@awesome-flow/core/hooks";
|
|
684
|
-
import { Abs } from "libnoise-simplex-ts";
|
|
685
|
-
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
686
|
-
function NoiseAbsNode({ id, selected, data, type }) {
|
|
687
|
-
const incoming = useIncomingComputedData7(id);
|
|
688
|
-
const updateComputedData = useUpdateNodeComputedData15();
|
|
689
|
-
useEffect9(() => {
|
|
690
|
-
if (incoming?.length > 0) {
|
|
691
|
-
const module = new Abs(incoming[0].module);
|
|
692
|
-
updateComputedData(id, { module });
|
|
693
|
-
}
|
|
694
|
-
}, [incoming]);
|
|
695
|
-
return /* @__PURE__ */ jsx17(NodeContainer17, { id, selected, data, type, children: /* @__PURE__ */ jsx17(NodeTrackConnections13, { handles: data.handles, nodeId: id, type: "target" }) });
|
|
696
|
-
}
|
|
697
|
-
var noise_abs_node_default = NoiseAbsNode;
|
|
698
|
-
|
|
699
|
-
// src/nodes/output/noise-output-node.tsx
|
|
700
|
-
import { NodeContainer as NodeContainer18, NodeTrackConnections as NodeTrackConnections14 } from "@awesome-flow/core/layout";
|
|
701
|
-
import { useCallback as useCallback8, useState as useState7 } from "react";
|
|
702
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData16 } from "@awesome-flow/core/hooks";
|
|
703
|
-
import { HandlesIncomingDataStatus } from "@awesome-flow/core/components";
|
|
704
|
-
import { Text as Text3 } from "@mantine/core";
|
|
705
|
-
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
706
|
-
function NoiseOutputNode({ id, selected, data, type }) {
|
|
707
|
-
const [size, setSize] = useState7(0);
|
|
708
|
-
const updateComputedData = useUpdateNodeComputedData16();
|
|
709
|
-
const onDataUpdated = useCallback8(
|
|
710
|
-
(handleData) => {
|
|
711
|
-
const incomingPositions = handleData["position" /* position */];
|
|
712
|
-
const incomingModule = handleData["module" /* module */];
|
|
713
|
-
if (incomingPositions?.length && incomingModule?.length && incomingModule[0]?.module) {
|
|
714
|
-
const { module } = incomingModule[0];
|
|
715
|
-
const noise = [];
|
|
716
|
-
for (const input of incomingPositions) {
|
|
717
|
-
for (const position of input.positions) {
|
|
718
|
-
const value = module.getValue(position.x, position.y, position.z);
|
|
719
|
-
noise.push({
|
|
720
|
-
position,
|
|
721
|
-
value
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
updateComputedData(id, { noise, module });
|
|
726
|
-
setSize(noise.length);
|
|
727
|
-
}
|
|
728
|
-
},
|
|
729
|
-
[]
|
|
730
|
-
);
|
|
731
|
-
return /* @__PURE__ */ jsxs16(NodeContainer18, { id, selected, data, type, children: [
|
|
732
|
-
/* @__PURE__ */ jsx18(
|
|
733
|
-
HandlesIncomingDataStatus,
|
|
734
|
-
{
|
|
735
|
-
nodeId: id,
|
|
736
|
-
handles: data.handles,
|
|
737
|
-
handleKey: "dataType",
|
|
738
|
-
onDataUpdated,
|
|
739
|
-
type: "target",
|
|
740
|
-
resetComputedData: true
|
|
741
|
-
}
|
|
742
|
-
),
|
|
743
|
-
/* @__PURE__ */ jsxs16(Text3, { mt: 5, children: [
|
|
744
|
-
"Noise points: ",
|
|
745
|
-
size
|
|
746
|
-
] }),
|
|
747
|
-
/* @__PURE__ */ jsx18(NodeTrackConnections14, { handles: data.handles, nodeId: id, type: "target" })
|
|
748
|
-
] });
|
|
749
|
-
}
|
|
750
|
-
var noise_output_node_default = NoiseOutputNode;
|
|
751
|
-
|
|
752
|
-
// src/nodes/modifiers/noise-curve-node.tsx
|
|
753
|
-
import { NodeContainer as NodeContainer19, NodeTrackConnections as NodeTrackConnections15 } from "@awesome-flow/core/layout";
|
|
754
|
-
import { ActionIcon, Button, Group as Group7, NumberInput as NumberInput6, Space } from "@mantine/core";
|
|
755
|
-
import {
|
|
756
|
-
useIncomingComputedData as useIncomingComputedData8,
|
|
757
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData17,
|
|
758
|
-
useUpdateNodeData as useUpdateNodeData7
|
|
759
|
-
} from "@awesome-flow/core/hooks";
|
|
760
|
-
|
|
761
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
|
|
762
|
-
import { useState as useState11, useCallback as useCallback14 } from "react";
|
|
763
|
-
|
|
764
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/actions/actions.mjs
|
|
765
|
-
import { useLayoutEffect, useEffect as useEffect10 } from "react";
|
|
766
|
-
function validateFormName(name) {
|
|
767
|
-
if (!/^[0-9a-zA-Z-]+$/.test(name)) {
|
|
768
|
-
throw new Error(
|
|
769
|
-
`[@mantine/use-form] Form name "${name}" is invalid, it should contain only letters, numbers and dashes`
|
|
770
|
-
);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
var useIsomorphicEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect10;
|
|
774
|
-
function useFormEvent(eventKey, handler) {
|
|
775
|
-
useIsomorphicEffect(() => {
|
|
776
|
-
if (eventKey) {
|
|
777
|
-
window.addEventListener(eventKey, handler);
|
|
778
|
-
return () => window.removeEventListener(eventKey, handler);
|
|
779
|
-
}
|
|
780
|
-
return void 0;
|
|
781
|
-
}, [eventKey]);
|
|
782
|
-
}
|
|
783
|
-
function useFormActions(name, form) {
|
|
784
|
-
if (name) {
|
|
785
|
-
validateFormName(name);
|
|
786
|
-
}
|
|
787
|
-
useFormEvent(
|
|
788
|
-
`mantine-form:${name}:set-field-value`,
|
|
789
|
-
(event) => form.setFieldValue(event.detail.path, event.detail.value)
|
|
790
|
-
);
|
|
791
|
-
useFormEvent(
|
|
792
|
-
`mantine-form:${name}:set-values`,
|
|
793
|
-
(event) => form.setValues(event.detail)
|
|
794
|
-
);
|
|
795
|
-
useFormEvent(
|
|
796
|
-
`mantine-form:${name}:set-initial-values`,
|
|
797
|
-
(event) => form.setInitialValues(event.detail)
|
|
798
|
-
);
|
|
799
|
-
useFormEvent(
|
|
800
|
-
`mantine-form:${name}:set-errors`,
|
|
801
|
-
(event) => form.setErrors(event.detail)
|
|
802
|
-
);
|
|
803
|
-
useFormEvent(
|
|
804
|
-
`mantine-form:${name}:set-field-error`,
|
|
805
|
-
(event) => form.setFieldError(event.detail.path, event.detail.error)
|
|
806
|
-
);
|
|
807
|
-
useFormEvent(
|
|
808
|
-
`mantine-form:${name}:clear-field-error`,
|
|
809
|
-
(event) => form.clearFieldError(event.detail)
|
|
810
|
-
);
|
|
811
|
-
useFormEvent(`mantine-form:${name}:clear-errors`, form.clearErrors);
|
|
812
|
-
useFormEvent(`mantine-form:${name}:reset`, form.reset);
|
|
813
|
-
useFormEvent(`mantine-form:${name}:validate`, form.validate);
|
|
814
|
-
useFormEvent(
|
|
815
|
-
`mantine-form:${name}:validate-field`,
|
|
816
|
-
(event) => form.validateField(event.detail)
|
|
817
|
-
);
|
|
818
|
-
useFormEvent(
|
|
819
|
-
`mantine-form:${name}:reorder-list-item`,
|
|
820
|
-
(event) => form.reorderListItem(event.detail.path, event.detail.payload)
|
|
821
|
-
);
|
|
822
|
-
useFormEvent(
|
|
823
|
-
`mantine-form:${name}:remove-list-item`,
|
|
824
|
-
(event) => form.removeListItem(event.detail.path, event.detail.index)
|
|
825
|
-
);
|
|
826
|
-
useFormEvent(
|
|
827
|
-
`mantine-form:${name}:insert-list-item`,
|
|
828
|
-
(event) => form.insertListItem(event.detail.path, event.detail.item, event.detail.index)
|
|
829
|
-
);
|
|
830
|
-
useFormEvent(
|
|
831
|
-
`mantine-form:${name}:set-dirty`,
|
|
832
|
-
(event) => form.setDirty(event.detail)
|
|
833
|
-
);
|
|
834
|
-
useFormEvent(
|
|
835
|
-
`mantine-form:${name}:set-touched`,
|
|
836
|
-
(event) => form.setTouched(event.detail)
|
|
837
|
-
);
|
|
838
|
-
useFormEvent(
|
|
839
|
-
`mantine-form:${name}:reset-dirty`,
|
|
840
|
-
(event) => form.resetDirty(event.detail)
|
|
841
|
-
);
|
|
842
|
-
useFormEvent(`mantine-form:${name}:reset-touched`, form.resetTouched);
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
// ../../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
|
|
846
|
-
function getInputOnChange(setValue) {
|
|
847
|
-
return (val) => {
|
|
848
|
-
if (!val) {
|
|
849
|
-
setValue(val);
|
|
850
|
-
} else if (typeof val === "function") {
|
|
851
|
-
setValue(val);
|
|
852
|
-
} else if (typeof val === "object" && "nativeEvent" in val) {
|
|
853
|
-
const { currentTarget } = val;
|
|
854
|
-
if (currentTarget instanceof HTMLInputElement) {
|
|
855
|
-
if (currentTarget.type === "checkbox") {
|
|
856
|
-
setValue(currentTarget.checked);
|
|
857
|
-
} else {
|
|
858
|
-
setValue(currentTarget.value);
|
|
859
|
-
}
|
|
860
|
-
} else if (currentTarget instanceof HTMLTextAreaElement || currentTarget instanceof HTMLSelectElement) {
|
|
861
|
-
setValue(currentTarget.value);
|
|
862
|
-
}
|
|
863
|
-
} else {
|
|
864
|
-
setValue(val);
|
|
865
|
-
}
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
// ../../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
|
|
870
|
-
import { useState as useState8, useRef, useCallback as useCallback9 } from "react";
|
|
871
|
-
|
|
872
|
-
// ../../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
|
|
873
|
-
function filterErrors(errors) {
|
|
874
|
-
if (errors === null || typeof errors !== "object") {
|
|
875
|
-
return {};
|
|
876
|
-
}
|
|
877
|
-
return Object.keys(errors).reduce((acc, key) => {
|
|
878
|
-
const errorValue = errors[key];
|
|
879
|
-
if (errorValue !== void 0 && errorValue !== null && errorValue !== false) {
|
|
880
|
-
acc[key] = errorValue;
|
|
881
|
-
}
|
|
882
|
-
return acc;
|
|
883
|
-
}, {});
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
// ../../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
|
|
887
|
-
function useFormErrors(initialErrors) {
|
|
888
|
-
const [errorsState, setErrorsState] = useState8(filterErrors(initialErrors));
|
|
889
|
-
const errorsRef = useRef(errorsState);
|
|
890
|
-
const setErrors = useCallback9((errors) => {
|
|
891
|
-
setErrorsState((current) => {
|
|
892
|
-
const newErrors = filterErrors(typeof errors === "function" ? errors(current) : errors);
|
|
893
|
-
errorsRef.current = newErrors;
|
|
894
|
-
return newErrors;
|
|
895
|
-
});
|
|
896
|
-
}, []);
|
|
897
|
-
const clearErrors = useCallback9(() => setErrors({}), []);
|
|
898
|
-
const clearFieldError = useCallback9(
|
|
899
|
-
(path) => {
|
|
900
|
-
if (errorsRef.current[path] === void 0) {
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
setErrors((current) => {
|
|
904
|
-
const errors = { ...current };
|
|
905
|
-
delete errors[path];
|
|
906
|
-
return errors;
|
|
907
|
-
});
|
|
908
|
-
},
|
|
909
|
-
[errorsState]
|
|
910
|
-
);
|
|
911
|
-
const setFieldError = useCallback9(
|
|
912
|
-
(path, error) => {
|
|
913
|
-
if (error == null || error === false) {
|
|
914
|
-
clearFieldError(path);
|
|
915
|
-
} else if (errorsRef.current[path] !== error) {
|
|
916
|
-
setErrors((current) => ({ ...current, [path]: error }));
|
|
917
|
-
}
|
|
918
|
-
},
|
|
919
|
-
[errorsState]
|
|
920
|
-
);
|
|
921
|
-
return {
|
|
922
|
-
errorsState,
|
|
923
|
-
setErrors,
|
|
924
|
-
clearErrors,
|
|
925
|
-
setFieldError,
|
|
926
|
-
clearFieldError
|
|
927
|
-
};
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
// ../../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
|
|
931
|
-
import { useCallback as useCallback10 } from "react";
|
|
932
|
-
|
|
933
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/clear-list-state.mjs
|
|
934
|
-
function clearListState(field, state) {
|
|
935
|
-
if (state === null || typeof state !== "object") {
|
|
936
|
-
return {};
|
|
937
|
-
}
|
|
938
|
-
const clone = { ...state };
|
|
939
|
-
Object.keys(state).forEach((errorKey) => {
|
|
940
|
-
if (errorKey.includes(`${String(field)}.`)) {
|
|
941
|
-
delete clone[errorKey];
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
return clone;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/change-error-indices.mjs
|
|
948
|
-
function getIndexFromKeyAfterPath(key, path) {
|
|
949
|
-
const split = key.substring(path.length + 1).split(".")[0];
|
|
950
|
-
return parseInt(split, 10);
|
|
951
|
-
}
|
|
952
|
-
function changeErrorIndices(path, index, errors, change) {
|
|
953
|
-
if (index === void 0) {
|
|
954
|
-
return errors;
|
|
955
|
-
}
|
|
956
|
-
const pathString = `${String(path)}`;
|
|
957
|
-
let clearedErrors = errors;
|
|
958
|
-
if (change === -1) {
|
|
959
|
-
clearedErrors = clearListState(`${pathString}.${index}`, clearedErrors);
|
|
960
|
-
}
|
|
961
|
-
const cloned = { ...clearedErrors };
|
|
962
|
-
const changedKeys = /* @__PURE__ */ new Set();
|
|
963
|
-
Object.entries(clearedErrors).filter(([key]) => {
|
|
964
|
-
if (!key.startsWith(`${pathString}.`)) {
|
|
965
|
-
return false;
|
|
966
|
-
}
|
|
967
|
-
const currIndex = getIndexFromKeyAfterPath(key, pathString);
|
|
968
|
-
if (Number.isNaN(currIndex)) {
|
|
969
|
-
return false;
|
|
970
|
-
}
|
|
971
|
-
return currIndex >= index;
|
|
972
|
-
}).forEach(([key, value]) => {
|
|
973
|
-
const currIndex = getIndexFromKeyAfterPath(key, pathString);
|
|
974
|
-
const newKey = key.replace(
|
|
975
|
-
`${pathString}.${currIndex}`,
|
|
976
|
-
`${pathString}.${currIndex + change}`
|
|
977
|
-
);
|
|
978
|
-
cloned[newKey] = value;
|
|
979
|
-
changedKeys.add(newKey);
|
|
980
|
-
if (!changedKeys.has(key)) {
|
|
981
|
-
delete cloned[key];
|
|
982
|
-
}
|
|
983
|
-
});
|
|
984
|
-
return cloned;
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/reorder-errors.mjs
|
|
988
|
-
function reorderErrors(path, { from, to }, errors) {
|
|
989
|
-
const oldKeyStart = `${path}.${from}`;
|
|
990
|
-
const newKeyStart = `${path}.${to}`;
|
|
991
|
-
const clone = { ...errors };
|
|
992
|
-
Object.keys(errors).every((key) => {
|
|
993
|
-
let oldKey;
|
|
994
|
-
let newKey;
|
|
995
|
-
if (key.startsWith(oldKeyStart)) {
|
|
996
|
-
oldKey = key;
|
|
997
|
-
newKey = key.replace(oldKeyStart, newKeyStart);
|
|
998
|
-
}
|
|
999
|
-
if (key.startsWith(newKeyStart)) {
|
|
1000
|
-
oldKey = key.replace(newKeyStart, oldKeyStart);
|
|
1001
|
-
newKey = key;
|
|
1002
|
-
}
|
|
1003
|
-
if (oldKey && newKey) {
|
|
1004
|
-
const value1 = clone[oldKey];
|
|
1005
|
-
const value2 = clone[newKey];
|
|
1006
|
-
value2 === void 0 ? delete clone[oldKey] : clone[oldKey] = value2;
|
|
1007
|
-
value1 === void 0 ? delete clone[newKey] : clone[newKey] = value1;
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
return true;
|
|
1011
|
-
});
|
|
1012
|
-
return clone;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
// ../../node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.mjs
|
|
1016
|
-
function set(obj, key, val) {
|
|
1017
|
-
if (typeof val.value === "object") val.value = klona(val.value);
|
|
1018
|
-
if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
|
|
1019
|
-
Object.defineProperty(obj, key, val);
|
|
1020
|
-
} else obj[key] = val.value;
|
|
1021
|
-
}
|
|
1022
|
-
function klona(x) {
|
|
1023
|
-
if (typeof x !== "object") return x;
|
|
1024
|
-
var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
|
|
1025
|
-
if (str === "[object Object]") {
|
|
1026
|
-
tmp = Object.create(x.__proto__ || null);
|
|
1027
|
-
} else if (str === "[object Array]") {
|
|
1028
|
-
tmp = Array(x.length);
|
|
1029
|
-
} else if (str === "[object Set]") {
|
|
1030
|
-
tmp = /* @__PURE__ */ new Set();
|
|
1031
|
-
x.forEach(function(val) {
|
|
1032
|
-
tmp.add(klona(val));
|
|
1033
|
-
});
|
|
1034
|
-
} else if (str === "[object Map]") {
|
|
1035
|
-
tmp = /* @__PURE__ */ new Map();
|
|
1036
|
-
x.forEach(function(val, key) {
|
|
1037
|
-
tmp.set(klona(key), klona(val));
|
|
1038
|
-
});
|
|
1039
|
-
} else if (str === "[object Date]") {
|
|
1040
|
-
tmp = /* @__PURE__ */ new Date(+x);
|
|
1041
|
-
} else if (str === "[object RegExp]") {
|
|
1042
|
-
tmp = new RegExp(x.source, x.flags);
|
|
1043
|
-
} else if (str === "[object DataView]") {
|
|
1044
|
-
tmp = new x.constructor(klona(x.buffer));
|
|
1045
|
-
} else if (str === "[object ArrayBuffer]") {
|
|
1046
|
-
tmp = x.slice(0);
|
|
1047
|
-
} else if (str.slice(-6) === "Array]") {
|
|
1048
|
-
tmp = new x.constructor(x);
|
|
1049
|
-
}
|
|
1050
|
-
if (tmp) {
|
|
1051
|
-
for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
|
|
1052
|
-
set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
|
|
1053
|
-
}
|
|
1054
|
-
for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
|
|
1055
|
-
if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k]) continue;
|
|
1056
|
-
set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
return tmp || x;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-splitted-path.mjs
|
|
1063
|
-
function getSplittedPath(path) {
|
|
1064
|
-
if (typeof path !== "string") {
|
|
1065
|
-
return [];
|
|
1066
|
-
}
|
|
1067
|
-
return path.split(".");
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-path.mjs
|
|
1071
|
-
function getPath(path, values) {
|
|
1072
|
-
const splittedPath = getSplittedPath(path);
|
|
1073
|
-
if (splittedPath.length === 0 || typeof values !== "object" || values === null) {
|
|
1074
|
-
return void 0;
|
|
1075
|
-
}
|
|
1076
|
-
let value = values[splittedPath[0]];
|
|
1077
|
-
for (let i = 1; i < splittedPath.length; i += 1) {
|
|
1078
|
-
if (value === void 0) {
|
|
1079
|
-
break;
|
|
1080
|
-
}
|
|
1081
|
-
value = value[splittedPath[i]];
|
|
1082
|
-
}
|
|
1083
|
-
return value;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/set-path.mjs
|
|
1087
|
-
function setPath(path, value, values) {
|
|
1088
|
-
const splittedPath = getSplittedPath(path);
|
|
1089
|
-
if (splittedPath.length === 0) {
|
|
1090
|
-
return values;
|
|
1091
|
-
}
|
|
1092
|
-
const cloned = klona(values);
|
|
1093
|
-
if (splittedPath.length === 1) {
|
|
1094
|
-
cloned[splittedPath[0]] = value;
|
|
1095
|
-
return cloned;
|
|
1096
|
-
}
|
|
1097
|
-
let val = cloned[splittedPath[0]];
|
|
1098
|
-
for (let i = 1; i < splittedPath.length - 1; i += 1) {
|
|
1099
|
-
if (val === void 0) {
|
|
1100
|
-
return cloned;
|
|
1101
|
-
}
|
|
1102
|
-
val = val[splittedPath[i]];
|
|
1103
|
-
}
|
|
1104
|
-
val[splittedPath[splittedPath.length - 1]] = value;
|
|
1105
|
-
return cloned;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/reorder-path.mjs
|
|
1109
|
-
function reorderPath(path, { from, to }, values) {
|
|
1110
|
-
const currentValue = getPath(path, values);
|
|
1111
|
-
if (!Array.isArray(currentValue)) {
|
|
1112
|
-
return values;
|
|
1113
|
-
}
|
|
1114
|
-
const cloned = [...currentValue];
|
|
1115
|
-
const item = currentValue[from];
|
|
1116
|
-
cloned.splice(from, 1);
|
|
1117
|
-
cloned.splice(to, 0, item);
|
|
1118
|
-
return setPath(path, cloned, values);
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/insert-path.mjs
|
|
1122
|
-
function insertPath(path, value, index, values) {
|
|
1123
|
-
const currentValue = getPath(path, values);
|
|
1124
|
-
if (!Array.isArray(currentValue)) {
|
|
1125
|
-
return values;
|
|
1126
|
-
}
|
|
1127
|
-
const cloned = [...currentValue];
|
|
1128
|
-
cloned.splice(typeof index === "number" ? index : cloned.length, 0, value);
|
|
1129
|
-
return setPath(path, cloned, values);
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/remove-path.mjs
|
|
1133
|
-
function removePath(path, index, values) {
|
|
1134
|
-
const currentValue = getPath(path, values);
|
|
1135
|
-
if (!Array.isArray(currentValue)) {
|
|
1136
|
-
return values;
|
|
1137
|
-
}
|
|
1138
|
-
return setPath(
|
|
1139
|
-
path,
|
|
1140
|
-
currentValue.filter((_, itemIndex) => itemIndex !== index),
|
|
1141
|
-
values
|
|
1142
|
-
);
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
// ../../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
|
|
1146
|
-
function useFormList({
|
|
1147
|
-
$values,
|
|
1148
|
-
$errors,
|
|
1149
|
-
$status
|
|
1150
|
-
}) {
|
|
1151
|
-
const reorderListItem = useCallback10((path, payload) => {
|
|
1152
|
-
$status.clearFieldDirty(path);
|
|
1153
|
-
$errors.setErrors((errs) => reorderErrors(path, payload, errs));
|
|
1154
|
-
$values.setValues({
|
|
1155
|
-
values: reorderPath(path, payload, $values.refValues.current),
|
|
1156
|
-
updateState: true
|
|
1157
|
-
});
|
|
1158
|
-
}, []);
|
|
1159
|
-
const removeListItem = useCallback10((path, index) => {
|
|
1160
|
-
$status.clearFieldDirty(path);
|
|
1161
|
-
$errors.setErrors((errs) => changeErrorIndices(path, index, errs, -1));
|
|
1162
|
-
$values.setValues({
|
|
1163
|
-
values: removePath(path, index, $values.refValues.current),
|
|
1164
|
-
updateState: true
|
|
1165
|
-
});
|
|
1166
|
-
}, []);
|
|
1167
|
-
const insertListItem = useCallback10((path, item, index) => {
|
|
1168
|
-
$status.clearFieldDirty(path);
|
|
1169
|
-
$errors.setErrors((errs) => changeErrorIndices(path, index, errs, 1));
|
|
1170
|
-
$values.setValues({
|
|
1171
|
-
values: insertPath(path, item, index, $values.refValues.current),
|
|
1172
|
-
updateState: true
|
|
1173
|
-
});
|
|
1174
|
-
}, []);
|
|
1175
|
-
return { reorderListItem, removeListItem, insertListItem };
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
// ../../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
|
|
1179
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
|
|
1180
|
-
import { useState as useState9, useRef as useRef2, useCallback as useCallback11 } from "react";
|
|
1181
|
-
|
|
1182
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/get-status/get-status.mjs
|
|
1183
|
-
function getStatus(status, path) {
|
|
1184
|
-
const paths = Object.keys(status);
|
|
1185
|
-
if (typeof path === "string") {
|
|
1186
|
-
const nestedPaths = paths.filter((statusPath) => statusPath.startsWith(`${path}.`));
|
|
1187
|
-
return status[path] || nestedPaths.some((statusPath) => status[statusPath]) || false;
|
|
1188
|
-
}
|
|
1189
|
-
return paths.some((statusPath) => status[statusPath]);
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
// ../../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
|
|
1193
|
-
function useFormStatus({
|
|
1194
|
-
initialDirty,
|
|
1195
|
-
initialTouched,
|
|
1196
|
-
mode,
|
|
1197
|
-
$values
|
|
1198
|
-
}) {
|
|
1199
|
-
const [touchedState, setTouchedState] = useState9(initialTouched);
|
|
1200
|
-
const [dirtyState, setDirtyState] = useState9(initialDirty);
|
|
1201
|
-
const touchedRef = useRef2(initialTouched);
|
|
1202
|
-
const dirtyRef = useRef2(initialDirty);
|
|
1203
|
-
const setTouched = useCallback11((values) => {
|
|
1204
|
-
const resolvedValues = typeof values === "function" ? values(touchedRef.current) : values;
|
|
1205
|
-
touchedRef.current = resolvedValues;
|
|
1206
|
-
if (mode === "controlled") {
|
|
1207
|
-
setTouchedState(resolvedValues);
|
|
1208
|
-
}
|
|
1209
|
-
}, []);
|
|
1210
|
-
const setDirty = useCallback11((values) => {
|
|
1211
|
-
const resolvedValues = typeof values === "function" ? values(dirtyRef.current) : values;
|
|
1212
|
-
dirtyRef.current = resolvedValues;
|
|
1213
|
-
if (mode === "controlled") {
|
|
1214
|
-
setDirtyState(resolvedValues);
|
|
1215
|
-
}
|
|
1216
|
-
}, []);
|
|
1217
|
-
const resetTouched = useCallback11(() => setTouched({}), []);
|
|
1218
|
-
const resetDirty = (values) => {
|
|
1219
|
-
const newSnapshot = values ? { ...values, ...$values.refValues.current } : $values.refValues.current;
|
|
1220
|
-
$values.setValuesSnapshot(newSnapshot);
|
|
1221
|
-
setDirty({});
|
|
1222
|
-
};
|
|
1223
|
-
const setFieldTouched = useCallback11((path, touched) => {
|
|
1224
|
-
setTouched((currentTouched) => {
|
|
1225
|
-
if (getStatus(currentTouched, path) === touched) {
|
|
1226
|
-
return currentTouched;
|
|
1227
|
-
}
|
|
1228
|
-
return { ...currentTouched, [path]: touched };
|
|
1229
|
-
});
|
|
1230
|
-
}, []);
|
|
1231
|
-
const setFieldDirty = useCallback11((path, dirty) => {
|
|
1232
|
-
setDirty((currentDirty) => {
|
|
1233
|
-
if (getStatus(currentDirty, path) === dirty) {
|
|
1234
|
-
return currentDirty;
|
|
1235
|
-
}
|
|
1236
|
-
return { ...currentDirty, [path]: dirty };
|
|
1237
|
-
});
|
|
1238
|
-
}, []);
|
|
1239
|
-
const isTouched = useCallback11(
|
|
1240
|
-
(path) => getStatus(touchedRef.current, path),
|
|
1241
|
-
[]
|
|
1242
|
-
);
|
|
1243
|
-
const clearFieldDirty = useCallback11(
|
|
1244
|
-
(path) => setDirty((current) => {
|
|
1245
|
-
if (typeof path !== "string") {
|
|
1246
|
-
return current;
|
|
1247
|
-
}
|
|
1248
|
-
const result = clearListState(path, current);
|
|
1249
|
-
delete result[path];
|
|
1250
|
-
if ((0, import_fast_deep_equal.default)(result, current)) {
|
|
1251
|
-
return current;
|
|
1252
|
-
}
|
|
1253
|
-
return result;
|
|
1254
|
-
}),
|
|
1255
|
-
[]
|
|
1256
|
-
);
|
|
1257
|
-
const isDirty = useCallback11((path) => {
|
|
1258
|
-
if (path) {
|
|
1259
|
-
const overriddenValue = getPath(path, dirtyRef.current);
|
|
1260
|
-
if (typeof overriddenValue === "boolean") {
|
|
1261
|
-
return overriddenValue;
|
|
1262
|
-
}
|
|
1263
|
-
const sliceOfValues = getPath(path, $values.refValues.current);
|
|
1264
|
-
const sliceOfInitialValues = getPath(path, $values.valuesSnapshot.current);
|
|
1265
|
-
return !(0, import_fast_deep_equal.default)(sliceOfValues, sliceOfInitialValues);
|
|
1266
|
-
}
|
|
1267
|
-
const isOverridden = Object.keys(dirtyRef.current).length > 0;
|
|
1268
|
-
if (isOverridden) {
|
|
1269
|
-
return getStatus(dirtyRef.current);
|
|
1270
|
-
}
|
|
1271
|
-
return !(0, import_fast_deep_equal.default)($values.refValues.current, $values.valuesSnapshot.current);
|
|
1272
|
-
}, []);
|
|
1273
|
-
const getDirty = useCallback11(() => dirtyRef.current, []);
|
|
1274
|
-
const getTouched = useCallback11(() => touchedRef.current, []);
|
|
1275
|
-
return {
|
|
1276
|
-
touchedState,
|
|
1277
|
-
dirtyState,
|
|
1278
|
-
touchedRef,
|
|
1279
|
-
dirtyRef,
|
|
1280
|
-
setTouched,
|
|
1281
|
-
setDirty,
|
|
1282
|
-
resetDirty,
|
|
1283
|
-
resetTouched,
|
|
1284
|
-
isTouched,
|
|
1285
|
-
setFieldTouched,
|
|
1286
|
-
setFieldDirty,
|
|
1287
|
-
setTouchedState,
|
|
1288
|
-
setDirtyState,
|
|
1289
|
-
clearFieldDirty,
|
|
1290
|
-
isDirty,
|
|
1291
|
-
getDirty,
|
|
1292
|
-
getTouched
|
|
1293
|
-
};
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
// ../../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
|
|
1297
|
-
import { useRef as useRef3, useState as useState10, useCallback as useCallback12 } from "react";
|
|
1298
|
-
function useFormValues({
|
|
1299
|
-
initialValues,
|
|
1300
|
-
onValuesChange,
|
|
1301
|
-
mode
|
|
1302
|
-
}) {
|
|
1303
|
-
const initialized = useRef3(false);
|
|
1304
|
-
const [stateValues, setStateValues] = useState10(initialValues || {});
|
|
1305
|
-
const refValues = useRef3(stateValues);
|
|
1306
|
-
const valuesSnapshot = useRef3(stateValues);
|
|
1307
|
-
const setValues = useCallback12(
|
|
1308
|
-
({
|
|
1309
|
-
values,
|
|
1310
|
-
subscribers,
|
|
1311
|
-
updateState = true,
|
|
1312
|
-
mergeWithPreviousValues = true
|
|
1313
|
-
}) => {
|
|
1314
|
-
const previousValues = refValues.current;
|
|
1315
|
-
const resolvedValues = values instanceof Function ? values(refValues.current) : values;
|
|
1316
|
-
const updatedValues = mergeWithPreviousValues ? { ...previousValues, ...resolvedValues } : resolvedValues;
|
|
1317
|
-
refValues.current = updatedValues;
|
|
1318
|
-
updateState && setStateValues(updatedValues);
|
|
1319
|
-
onValuesChange?.(updatedValues, previousValues);
|
|
1320
|
-
subscribers?.filter(Boolean).forEach((subscriber) => subscriber({ updatedValues, previousValues }));
|
|
1321
|
-
},
|
|
1322
|
-
[onValuesChange]
|
|
1323
|
-
);
|
|
1324
|
-
const setFieldValue = useCallback12((payload) => {
|
|
1325
|
-
const currentValue = getPath(payload.path, refValues.current);
|
|
1326
|
-
const updatedValue = payload.value instanceof Function ? payload.value(currentValue) : payload.value;
|
|
1327
|
-
if (currentValue !== updatedValue) {
|
|
1328
|
-
const previousValues = refValues.current;
|
|
1329
|
-
const updatedValues = setPath(payload.path, updatedValue, refValues.current);
|
|
1330
|
-
setValues({ values: updatedValues, updateState: payload.updateState });
|
|
1331
|
-
payload.subscribers?.filter(Boolean).forEach(
|
|
1332
|
-
(subscriber) => subscriber({ path: payload.path, updatedValues, previousValues })
|
|
1333
|
-
);
|
|
1334
|
-
}
|
|
1335
|
-
}, []);
|
|
1336
|
-
const setValuesSnapshot = useCallback12((payload) => {
|
|
1337
|
-
valuesSnapshot.current = payload;
|
|
1338
|
-
}, []);
|
|
1339
|
-
const initialize = useCallback12((values, onInitialize) => {
|
|
1340
|
-
if (!initialized.current) {
|
|
1341
|
-
initialized.current = true;
|
|
1342
|
-
setValues({ values, updateState: mode === "controlled" });
|
|
1343
|
-
setValuesSnapshot(values);
|
|
1344
|
-
onInitialize();
|
|
1345
|
-
}
|
|
1346
|
-
}, []);
|
|
1347
|
-
const resetValues = useCallback12(() => {
|
|
1348
|
-
setValues({
|
|
1349
|
-
values: valuesSnapshot.current,
|
|
1350
|
-
updateState: true,
|
|
1351
|
-
mergeWithPreviousValues: false
|
|
1352
|
-
});
|
|
1353
|
-
}, []);
|
|
1354
|
-
const getValues = useCallback12(() => refValues.current, []);
|
|
1355
|
-
return {
|
|
1356
|
-
initialized,
|
|
1357
|
-
stateValues,
|
|
1358
|
-
refValues,
|
|
1359
|
-
valuesSnapshot,
|
|
1360
|
-
setValues,
|
|
1361
|
-
setFieldValue,
|
|
1362
|
-
resetValues,
|
|
1363
|
-
setValuesSnapshot,
|
|
1364
|
-
initialize,
|
|
1365
|
-
getValues
|
|
1366
|
-
};
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
// ../../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
|
|
1370
|
-
import { useRef as useRef4, useCallback as useCallback13, useEffect as useEffect11 } from "react";
|
|
1371
|
-
function useFormWatch({
|
|
1372
|
-
$status
|
|
1373
|
-
}) {
|
|
1374
|
-
const subscribers = useRef4(
|
|
1375
|
-
{}
|
|
1376
|
-
);
|
|
1377
|
-
const watch = useCallback13((path, callback) => {
|
|
1378
|
-
useEffect11(() => {
|
|
1379
|
-
subscribers.current[path] = subscribers.current[path] || [];
|
|
1380
|
-
subscribers.current[path].push(callback);
|
|
1381
|
-
return () => {
|
|
1382
|
-
subscribers.current[path] = subscribers.current[path].filter((cb) => cb !== callback);
|
|
1383
|
-
};
|
|
1384
|
-
}, [callback]);
|
|
1385
|
-
}, []);
|
|
1386
|
-
const getFieldSubscribers = useCallback13((path) => {
|
|
1387
|
-
if (!subscribers.current[path]) {
|
|
1388
|
-
return [];
|
|
1389
|
-
}
|
|
1390
|
-
return subscribers.current[path].map(
|
|
1391
|
-
(callback) => (input) => callback({
|
|
1392
|
-
previousValue: getPath(path, input.previousValues),
|
|
1393
|
-
value: getPath(path, input.updatedValues),
|
|
1394
|
-
touched: $status.isTouched(path),
|
|
1395
|
-
dirty: $status.isDirty(path)
|
|
1396
|
-
})
|
|
1397
|
-
);
|
|
1398
|
-
}, []);
|
|
1399
|
-
return {
|
|
1400
|
-
subscribers,
|
|
1401
|
-
watch,
|
|
1402
|
-
getFieldSubscribers
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-data-path.mjs
|
|
1407
|
-
function getDataPath(formName, fieldPath) {
|
|
1408
|
-
return formName ? `${formName}-${fieldPath.toString()}` : fieldPath.toString();
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-values.mjs
|
|
1412
|
-
function getValidationResults(errors) {
|
|
1413
|
-
const filteredErrors = filterErrors(errors);
|
|
1414
|
-
return { hasErrors: Object.keys(filteredErrors).length > 0, errors: filteredErrors };
|
|
1415
|
-
}
|
|
1416
|
-
function validateRulesRecord(rules, values, path = "", errors = {}) {
|
|
1417
|
-
if (typeof rules !== "object" || rules === null) {
|
|
1418
|
-
return errors;
|
|
1419
|
-
}
|
|
1420
|
-
return Object.keys(rules).reduce((acc, ruleKey) => {
|
|
1421
|
-
const rule = rules[ruleKey];
|
|
1422
|
-
const rulePath = `${path === "" ? "" : `${path}.`}${ruleKey}`;
|
|
1423
|
-
const value = getPath(rulePath, values);
|
|
1424
|
-
let arrayValidation = false;
|
|
1425
|
-
if (typeof rule === "function") {
|
|
1426
|
-
acc[rulePath] = rule(value, values, rulePath);
|
|
1427
|
-
}
|
|
1428
|
-
if (typeof rule === "object" && Array.isArray(value)) {
|
|
1429
|
-
arrayValidation = true;
|
|
1430
|
-
value.forEach(
|
|
1431
|
-
(_item, index) => validateRulesRecord(rule, values, `${rulePath}.${index}`, acc)
|
|
1432
|
-
);
|
|
1433
|
-
}
|
|
1434
|
-
if (typeof rule === "object" && typeof value === "object" && value !== null) {
|
|
1435
|
-
if (!arrayValidation) {
|
|
1436
|
-
validateRulesRecord(rule, values, rulePath, acc);
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
return acc;
|
|
1440
|
-
}, errors);
|
|
1441
|
-
}
|
|
1442
|
-
function validateValues(validate, values) {
|
|
1443
|
-
if (typeof validate === "function") {
|
|
1444
|
-
return getValidationResults(validate(values));
|
|
1445
|
-
}
|
|
1446
|
-
return getValidationResults(validateRulesRecord(validate, values));
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-field-value.mjs
|
|
1450
|
-
function validateFieldValue(path, rules, values) {
|
|
1451
|
-
if (typeof path !== "string") {
|
|
1452
|
-
return { hasError: false, error: null };
|
|
1453
|
-
}
|
|
1454
|
-
const results = validateValues(rules, values);
|
|
1455
|
-
const pathInError = Object.keys(results.errors).find(
|
|
1456
|
-
(errorKey) => path.split(".").every((pathPart, i) => pathPart === errorKey.split(".")[i])
|
|
1457
|
-
);
|
|
1458
|
-
return { hasError: !!pathInError, error: pathInError ? results.errors[pathInError] : null };
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/form-index.mjs
|
|
1462
|
-
var FORM_INDEX = "__MANTINE_FORM_INDEX__";
|
|
1463
|
-
|
|
1464
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/should-validate-on-change.mjs
|
|
1465
|
-
function shouldValidateOnChange(path, validateInputOnChange) {
|
|
1466
|
-
if (!validateInputOnChange) {
|
|
1467
|
-
return false;
|
|
1468
|
-
}
|
|
1469
|
-
if (typeof validateInputOnChange === "boolean") {
|
|
1470
|
-
return validateInputOnChange;
|
|
1471
|
-
}
|
|
1472
|
-
if (Array.isArray(validateInputOnChange)) {
|
|
1473
|
-
return validateInputOnChange.includes(path.replace(/[.][0-9]/g, `.${FORM_INDEX}`));
|
|
1474
|
-
}
|
|
1475
|
-
return false;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
// ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
|
|
1479
|
-
function useForm({
|
|
1480
|
-
name,
|
|
1481
|
-
mode = "controlled",
|
|
1482
|
-
initialValues,
|
|
1483
|
-
initialErrors = {},
|
|
1484
|
-
initialDirty = {},
|
|
1485
|
-
initialTouched = {},
|
|
1486
|
-
clearInputErrorOnChange = true,
|
|
1487
|
-
validateInputOnChange = false,
|
|
1488
|
-
validateInputOnBlur = false,
|
|
1489
|
-
onValuesChange,
|
|
1490
|
-
transformValues = (values) => values,
|
|
1491
|
-
enhanceGetInputProps,
|
|
1492
|
-
validate: rules
|
|
1493
|
-
} = {}) {
|
|
1494
|
-
const $errors = useFormErrors(initialErrors);
|
|
1495
|
-
const $values = useFormValues({ initialValues, onValuesChange, mode });
|
|
1496
|
-
const $status = useFormStatus({ initialDirty, initialTouched, $values, mode });
|
|
1497
|
-
const $list = useFormList({ $values, $errors, $status });
|
|
1498
|
-
const $watch = useFormWatch({ $status });
|
|
1499
|
-
const [formKey, setFormKey] = useState11(0);
|
|
1500
|
-
const [fieldKeys, setFieldKeys] = useState11({});
|
|
1501
|
-
const reset = useCallback14(() => {
|
|
1502
|
-
$values.resetValues();
|
|
1503
|
-
$errors.clearErrors();
|
|
1504
|
-
$status.resetDirty();
|
|
1505
|
-
$status.resetTouched();
|
|
1506
|
-
mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
|
|
1507
|
-
}, []);
|
|
1508
|
-
const initialize = useCallback14((values) => {
|
|
1509
|
-
$values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
|
|
1510
|
-
}, []);
|
|
1511
|
-
const setFieldValue = useCallback14(
|
|
1512
|
-
(path, value, options2) => {
|
|
1513
|
-
const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
|
|
1514
|
-
$status.clearFieldDirty(path);
|
|
1515
|
-
$status.setFieldTouched(path, true);
|
|
1516
|
-
!shouldValidate && clearInputErrorOnChange && $errors.clearFieldError(path);
|
|
1517
|
-
$values.setFieldValue({
|
|
1518
|
-
path,
|
|
1519
|
-
value,
|
|
1520
|
-
updateState: mode === "controlled",
|
|
1521
|
-
subscribers: [
|
|
1522
|
-
...$watch.getFieldSubscribers(path),
|
|
1523
|
-
shouldValidate ? (payload) => {
|
|
1524
|
-
const validationResults = validateFieldValue(path, rules, payload.updatedValues);
|
|
1525
|
-
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
1526
|
-
} : null,
|
|
1527
|
-
options2?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
|
|
1528
|
-
...keys,
|
|
1529
|
-
[path]: (keys[path] || 0) + 1
|
|
1530
|
-
})) : null
|
|
1531
|
-
]
|
|
1532
|
-
});
|
|
1533
|
-
},
|
|
1534
|
-
[onValuesChange, rules]
|
|
1535
|
-
);
|
|
1536
|
-
const setValues = useCallback14(
|
|
1537
|
-
(values) => {
|
|
1538
|
-
const previousValues = $values.refValues.current;
|
|
1539
|
-
$values.setValues({ values, updateState: mode === "controlled" });
|
|
1540
|
-
clearInputErrorOnChange && $errors.clearErrors();
|
|
1541
|
-
mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
|
|
1542
|
-
Object.keys($watch.subscribers.current).forEach((path) => {
|
|
1543
|
-
const value = getPath(path, $values.refValues.current);
|
|
1544
|
-
const previousValue = getPath(path, previousValues);
|
|
1545
|
-
if (value !== previousValue) {
|
|
1546
|
-
$watch.getFieldSubscribers(path).forEach((cb) => cb({ previousValues, updatedValues: $values.refValues.current }));
|
|
1547
|
-
}
|
|
1548
|
-
});
|
|
1549
|
-
},
|
|
1550
|
-
[onValuesChange, clearInputErrorOnChange]
|
|
1551
|
-
);
|
|
1552
|
-
const validate = useCallback14(() => {
|
|
1553
|
-
const results = validateValues(rules, $values.refValues.current);
|
|
1554
|
-
$errors.setErrors(results.errors);
|
|
1555
|
-
return results;
|
|
1556
|
-
}, [rules]);
|
|
1557
|
-
const validateField = useCallback14(
|
|
1558
|
-
(path) => {
|
|
1559
|
-
const results = validateFieldValue(path, rules, $values.refValues.current);
|
|
1560
|
-
results.hasError ? $errors.setFieldError(path, results.error) : $errors.clearFieldError(path);
|
|
1561
|
-
return results;
|
|
1562
|
-
},
|
|
1563
|
-
[rules]
|
|
1564
|
-
);
|
|
1565
|
-
const getInputProps = (path, { type = "input", withError = true, withFocus = true, ...otherOptions } = {}) => {
|
|
1566
|
-
const onChange = getInputOnChange(
|
|
1567
|
-
(value) => setFieldValue(path, value, { forceUpdate: false })
|
|
1568
|
-
);
|
|
1569
|
-
const payload = { onChange, "data-path": getDataPath(name, path) };
|
|
1570
|
-
if (withError) {
|
|
1571
|
-
payload.error = $errors.errorsState[path];
|
|
1572
|
-
}
|
|
1573
|
-
if (type === "checkbox") {
|
|
1574
|
-
payload[mode === "controlled" ? "checked" : "defaultChecked"] = getPath(
|
|
1575
|
-
path,
|
|
1576
|
-
$values.refValues.current
|
|
1577
|
-
);
|
|
1578
|
-
} else {
|
|
1579
|
-
payload[mode === "controlled" ? "value" : "defaultValue"] = getPath(
|
|
1580
|
-
path,
|
|
1581
|
-
$values.refValues.current
|
|
1582
|
-
);
|
|
1583
|
-
}
|
|
1584
|
-
if (withFocus) {
|
|
1585
|
-
payload.onFocus = () => $status.setFieldTouched(path, true);
|
|
1586
|
-
payload.onBlur = () => {
|
|
1587
|
-
if (shouldValidateOnChange(path, validateInputOnBlur)) {
|
|
1588
|
-
const validationResults = validateFieldValue(path, rules, $values.refValues.current);
|
|
1589
|
-
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
return Object.assign(
|
|
1594
|
-
payload,
|
|
1595
|
-
enhanceGetInputProps?.({
|
|
1596
|
-
inputProps: payload,
|
|
1597
|
-
field: path,
|
|
1598
|
-
options: { type, withError, withFocus, ...otherOptions },
|
|
1599
|
-
form
|
|
1600
|
-
})
|
|
1601
|
-
);
|
|
1602
|
-
};
|
|
1603
|
-
const onSubmit = (handleSubmit, handleValidationFailure) => (event) => {
|
|
1604
|
-
event?.preventDefault();
|
|
1605
|
-
const results = validate();
|
|
1606
|
-
if (results.hasErrors) {
|
|
1607
|
-
handleValidationFailure?.(results.errors, $values.refValues.current, event);
|
|
1608
|
-
} else {
|
|
1609
|
-
handleSubmit?.(transformValues($values.refValues.current), event);
|
|
1610
|
-
}
|
|
1611
|
-
};
|
|
1612
|
-
const getTransformedValues = (input) => transformValues(input || $values.refValues.current);
|
|
1613
|
-
const onReset = useCallback14((event) => {
|
|
1614
|
-
event.preventDefault();
|
|
1615
|
-
reset();
|
|
1616
|
-
}, []);
|
|
1617
|
-
const isValid = useCallback14(
|
|
1618
|
-
(path) => path ? !validateFieldValue(path, rules, $values.refValues.current).hasError : !validateValues(rules, $values.refValues.current).hasErrors,
|
|
1619
|
-
[rules]
|
|
1620
|
-
);
|
|
1621
|
-
const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
|
|
1622
|
-
const getInputNode = useCallback14(
|
|
1623
|
-
(path) => document.querySelector(`[data-path="${getDataPath(name, path)}"]`),
|
|
1624
|
-
[]
|
|
1625
|
-
);
|
|
1626
|
-
const form = {
|
|
1627
|
-
watch: $watch.watch,
|
|
1628
|
-
initialized: $values.initialized.current,
|
|
1629
|
-
values: $values.stateValues,
|
|
1630
|
-
getValues: $values.getValues,
|
|
1631
|
-
setInitialValues: $values.setValuesSnapshot,
|
|
1632
|
-
initialize,
|
|
1633
|
-
setValues,
|
|
1634
|
-
setFieldValue,
|
|
1635
|
-
errors: $errors.errorsState,
|
|
1636
|
-
setErrors: $errors.setErrors,
|
|
1637
|
-
setFieldError: $errors.setFieldError,
|
|
1638
|
-
clearFieldError: $errors.clearFieldError,
|
|
1639
|
-
clearErrors: $errors.clearErrors,
|
|
1640
|
-
resetDirty: $status.resetDirty,
|
|
1641
|
-
setTouched: $status.setTouched,
|
|
1642
|
-
setDirty: $status.setDirty,
|
|
1643
|
-
isTouched: $status.isTouched,
|
|
1644
|
-
resetTouched: $status.resetTouched,
|
|
1645
|
-
isDirty: $status.isDirty,
|
|
1646
|
-
getTouched: $status.getTouched,
|
|
1647
|
-
getDirty: $status.getDirty,
|
|
1648
|
-
reorderListItem: $list.reorderListItem,
|
|
1649
|
-
insertListItem: $list.insertListItem,
|
|
1650
|
-
removeListItem: $list.removeListItem,
|
|
1651
|
-
reset,
|
|
1652
|
-
validate,
|
|
1653
|
-
validateField,
|
|
1654
|
-
getInputProps,
|
|
1655
|
-
onSubmit,
|
|
1656
|
-
onReset,
|
|
1657
|
-
isValid,
|
|
1658
|
-
getTransformedValues,
|
|
1659
|
-
key,
|
|
1660
|
-
getInputNode
|
|
1661
|
-
};
|
|
1662
|
-
useFormActions(name, form);
|
|
1663
|
-
return form;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
// src/nodes/modifiers/noise-curve-node.tsx
|
|
1667
|
-
import { useCallback as useCallback15, useEffect as useEffect12, useState as useState12 } from "react";
|
|
1668
|
-
import { Curve, Tuple } from "libnoise-simplex-ts";
|
|
1669
|
-
import { IconX } from "@tabler/icons-react";
|
|
1670
|
-
import { randomId } from "@mantine/hooks";
|
|
1671
|
-
import { NodeState } from "@awesome-flow/core/abstract";
|
|
1672
|
-
import { Fragment, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1673
|
-
function NoiseCurveNode({ id, selected, data, type }) {
|
|
1674
|
-
const incoming = useIncomingComputedData8(id);
|
|
1675
|
-
const updateNodeData = useUpdateNodeData7();
|
|
1676
|
-
const updateComputedData = useUpdateNodeComputedData17();
|
|
1677
|
-
const [values, setValues] = useState12([]);
|
|
1678
|
-
const form = useForm({
|
|
1679
|
-
mode: "uncontrolled",
|
|
1680
|
-
initialValues: {
|
|
1681
|
-
points: []
|
|
1682
|
-
},
|
|
1683
|
-
validateInputOnChange: [`points.${FORM_INDEX}.input`],
|
|
1684
|
-
clearInputErrorOnChange: true,
|
|
1685
|
-
validate: {
|
|
1686
|
-
points: {
|
|
1687
|
-
input: (value, values2) => {
|
|
1688
|
-
const counts = {};
|
|
1689
|
-
values2.points.forEach((x) => {
|
|
1690
|
-
counts[x.input] = (counts[x.input] || 0) + 1;
|
|
1691
|
-
});
|
|
1692
|
-
return counts[value] > 1;
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
},
|
|
1696
|
-
onValuesChange: useCallback15((values2) => {
|
|
1697
|
-
if (form.isValid()) {
|
|
1698
|
-
const points = values2.points.map((v) => ({ input: v.input, output: v.output }));
|
|
1699
|
-
setValues(points);
|
|
1700
|
-
updateNodeData(id, { points });
|
|
1701
|
-
}
|
|
1702
|
-
form.validate();
|
|
1703
|
-
}, [])
|
|
1704
|
-
});
|
|
1705
|
-
useEffect12(() => {
|
|
1706
|
-
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() }));
|
|
1707
|
-
form.initialize({ points });
|
|
1708
|
-
}, []);
|
|
1709
|
-
useEffect12(() => {
|
|
1710
|
-
if (incoming?.length && values?.length >= 4) {
|
|
1711
|
-
const module = new Curve(
|
|
1712
|
-
incoming[0].module,
|
|
1713
|
-
values.map((p) => new Tuple(p.input, p.output))
|
|
1714
|
-
);
|
|
1715
|
-
updateComputedData(id, { module });
|
|
1716
|
-
}
|
|
1717
|
-
}, [values, incoming]);
|
|
1718
|
-
const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs17(Group7, { mt: "xs", children: [
|
|
1719
|
-
/* @__PURE__ */ jsx19(
|
|
1720
|
-
NumberInput6,
|
|
1721
|
-
{
|
|
1722
|
-
size: "xs",
|
|
1723
|
-
w: 100,
|
|
1724
|
-
placeholder: "Input Value",
|
|
1725
|
-
...form.getInputProps(`points.${index}.input`),
|
|
1726
|
-
step: 0.1
|
|
1727
|
-
},
|
|
1728
|
-
form.key(`points.${index}.input`)
|
|
1729
|
-
),
|
|
1730
|
-
/* @__PURE__ */ jsx19(
|
|
1731
|
-
NumberInput6,
|
|
1732
|
-
{
|
|
1733
|
-
size: "xs",
|
|
1734
|
-
w: 100,
|
|
1735
|
-
placeholder: "Output Value",
|
|
1736
|
-
...form.getInputProps(`points.${index}.output`),
|
|
1737
|
-
step: 0.1
|
|
1738
|
-
},
|
|
1739
|
-
form.key(`points.${index}.output`)
|
|
1740
|
-
),
|
|
1741
|
-
data.state === NodeState.edit && values.length > 4 && /* @__PURE__ */ jsx19(
|
|
1742
|
-
ActionIcon,
|
|
1743
|
-
{
|
|
1744
|
-
color: "red",
|
|
1745
|
-
variant: "outline",
|
|
1746
|
-
size: "sm",
|
|
1747
|
-
onClick: () => form.removeListItem("points", index),
|
|
1748
|
-
children: /* @__PURE__ */ jsx19(IconX, { size: "1rem" })
|
|
1749
|
-
}
|
|
1750
|
-
)
|
|
1751
|
-
] }, item.key));
|
|
1752
|
-
return /* @__PURE__ */ jsxs17(NodeContainer19, { id, selected, type, data, children: [
|
|
1753
|
-
fields,
|
|
1754
|
-
data.state === NodeState.edit && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
1755
|
-
/* @__PURE__ */ jsx19(Space, { h: 10 }),
|
|
1756
|
-
/* @__PURE__ */ jsx19(
|
|
1757
|
-
Button,
|
|
1758
|
-
{
|
|
1759
|
-
variant: "outline",
|
|
1760
|
-
size: "xs",
|
|
1761
|
-
fullWidth: true,
|
|
1762
|
-
onClick: () => form.insertListItem("points", { input: 0, output: 0, key: randomId() }),
|
|
1763
|
-
children: "Add control point"
|
|
1764
|
-
}
|
|
1765
|
-
)
|
|
1766
|
-
] }),
|
|
1767
|
-
/* @__PURE__ */ jsx19(NodeTrackConnections15, { handles: data.handles, nodeId: id, type: "target" })
|
|
1768
|
-
] });
|
|
1769
|
-
}
|
|
1770
|
-
var noise_curve_node_default = NoiseCurveNode;
|
|
1771
|
-
|
|
1772
|
-
// src/nodes/modifiers/noise-exponent-node.tsx
|
|
1773
|
-
import { NodeContainer as NodeContainer20, NodeTrackConnections as NodeTrackConnections16 } from "@awesome-flow/core/layout";
|
|
1774
|
-
import { useEffect as useEffect13, useState as useState13 } from "react";
|
|
1775
|
-
import { Group as Group8, NumberInput as NumberInput7, Stack as Stack9 } from "@mantine/core";
|
|
1776
|
-
import {
|
|
1777
|
-
useIncomingComputedData as useIncomingComputedData9,
|
|
1778
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData18,
|
|
1779
|
-
useUpdateNodeData as useUpdateNodeData8
|
|
1780
|
-
} from "@awesome-flow/core/hooks";
|
|
1781
|
-
import { Exponent } from "libnoise-simplex-ts";
|
|
1782
|
-
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1783
|
-
function NoiseExponentNode({ id, selected, data, type }) {
|
|
1784
|
-
const [exponent, setExponent] = useState13(data.exponent);
|
|
1785
|
-
const incoming = useIncomingComputedData9(id);
|
|
1786
|
-
const updateNodeData = useUpdateNodeData8();
|
|
1787
|
-
const updateComputedData = useUpdateNodeComputedData18();
|
|
1788
|
-
useEffect13(() => {
|
|
1789
|
-
if (incoming?.length > 0) {
|
|
1790
|
-
const module = new Exponent(incoming[0].module, exponent);
|
|
1791
|
-
updateComputedData(id, { module });
|
|
1792
|
-
}
|
|
1793
|
-
updateNodeData(id, { exponent });
|
|
1794
|
-
}, [incoming, exponent]);
|
|
1795
|
-
return /* @__PURE__ */ jsxs18(NodeContainer20, { id, selected, data, type, children: [
|
|
1796
|
-
/* @__PURE__ */ jsx20(Stack9, { children: /* @__PURE__ */ jsxs18(Group8, { children: [
|
|
1797
|
-
"Exponent:",
|
|
1798
|
-
/* @__PURE__ */ jsx20(
|
|
1799
|
-
NumberInput7,
|
|
1800
|
-
{
|
|
1801
|
-
size: "xs",
|
|
1802
|
-
value: exponent,
|
|
1803
|
-
onChange: (e) => setExponent(Number(e)),
|
|
1804
|
-
step: 0.1
|
|
1805
|
-
}
|
|
1806
|
-
)
|
|
1807
|
-
] }) }),
|
|
1808
|
-
/* @__PURE__ */ jsx20(NodeTrackConnections16, { handles: data.handles, nodeId: id, type: "target" })
|
|
1809
|
-
] });
|
|
1810
|
-
}
|
|
1811
|
-
var noise_exponent_node_default = NoiseExponentNode;
|
|
1812
|
-
|
|
1813
|
-
// src/nodes/modifiers/noise-invert-node.tsx
|
|
1814
|
-
import { NodeContainer as NodeContainer21, NodeTrackConnections as NodeTrackConnections17 } from "@awesome-flow/core/layout";
|
|
1815
|
-
import { useEffect as useEffect14 } from "react";
|
|
1816
|
-
import { useIncomingComputedData as useIncomingComputedData10, useUpdateNodeComputedData as useUpdateNodeComputedData19 } from "@awesome-flow/core/hooks";
|
|
1817
|
-
import { Invert } from "libnoise-simplex-ts";
|
|
1818
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1819
|
-
function NoiseInvertNode({ id, selected, data, type }) {
|
|
1820
|
-
const incoming = useIncomingComputedData10(id);
|
|
1821
|
-
const updateComputedData = useUpdateNodeComputedData19();
|
|
1822
|
-
useEffect14(() => {
|
|
1823
|
-
if (incoming?.length > 0) {
|
|
1824
|
-
const module = new Invert(incoming[0].module);
|
|
1825
|
-
updateComputedData(id, { module });
|
|
1826
|
-
}
|
|
1827
|
-
}, [incoming]);
|
|
1828
|
-
return /* @__PURE__ */ jsx21(NodeContainer21, { id, selected, data, type, children: /* @__PURE__ */ jsx21(NodeTrackConnections17, { handles: data.handles, nodeId: id, type: "target" }) });
|
|
1829
|
-
}
|
|
1830
|
-
var noise_invert_node_default = NoiseInvertNode;
|
|
1831
|
-
|
|
1832
|
-
// src/nodes/modifiers/noise-scale-bias-node.tsx
|
|
1833
|
-
import { NodeContainer as NodeContainer22, NodeTrackConnections as NodeTrackConnections18 } from "@awesome-flow/core/layout";
|
|
1834
|
-
import { useEffect as useEffect15, useState as useState14 } from "react";
|
|
1835
|
-
import { Group as Group9, NumberInput as NumberInput8, Stack as Stack10 } from "@mantine/core";
|
|
1836
|
-
import {
|
|
1837
|
-
useIncomingComputedData as useIncomingComputedData11,
|
|
1838
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData20,
|
|
1839
|
-
useUpdateNodeData as useUpdateNodeData9
|
|
1840
|
-
} from "@awesome-flow/core/hooks";
|
|
1841
|
-
import { ScaleBias } from "libnoise-simplex-ts";
|
|
1842
|
-
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1843
|
-
function NoiseScaleBiasNode({ id, selected, data, type }) {
|
|
1844
|
-
const [scale, setScale] = useState14(data.scale);
|
|
1845
|
-
const [bias, setBias] = useState14(data.bias);
|
|
1846
|
-
const incoming = useIncomingComputedData11(id);
|
|
1847
|
-
const updateNodeData = useUpdateNodeData9();
|
|
1848
|
-
const updateComputedData = useUpdateNodeComputedData20();
|
|
1849
|
-
useEffect15(() => {
|
|
1850
|
-
if (incoming?.length > 0) {
|
|
1851
|
-
const module = new ScaleBias(incoming[0].module, scale, bias);
|
|
1852
|
-
updateComputedData(id, { module });
|
|
1853
|
-
}
|
|
1854
|
-
updateNodeData(id, { scale, bias });
|
|
1855
|
-
}, [incoming, scale, bias]);
|
|
1856
|
-
return /* @__PURE__ */ jsxs19(NodeContainer22, { id, selected, data, type, children: [
|
|
1857
|
-
/* @__PURE__ */ jsxs19(Stack10, { children: [
|
|
1858
|
-
/* @__PURE__ */ jsxs19(Group9, { children: [
|
|
1859
|
-
"Scale:",
|
|
1860
|
-
/* @__PURE__ */ jsx22(
|
|
1861
|
-
NumberInput8,
|
|
1862
|
-
{
|
|
1863
|
-
size: "xs",
|
|
1864
|
-
w: 100,
|
|
1865
|
-
value: scale,
|
|
1866
|
-
onChange: (e) => setScale(Number(e)),
|
|
1867
|
-
step: 0.1
|
|
1868
|
-
}
|
|
1869
|
-
)
|
|
1870
|
-
] }),
|
|
1871
|
-
/* @__PURE__ */ jsxs19(Group9, { children: [
|
|
1872
|
-
"Bias:",
|
|
1873
|
-
/* @__PURE__ */ jsx22(
|
|
1874
|
-
NumberInput8,
|
|
1875
|
-
{
|
|
1876
|
-
size: "xs",
|
|
1877
|
-
w: 100,
|
|
1878
|
-
value: bias,
|
|
1879
|
-
onChange: (e) => setBias(Number(e)),
|
|
1880
|
-
step: 0.1
|
|
1881
|
-
}
|
|
1882
|
-
)
|
|
1883
|
-
] })
|
|
1884
|
-
] }),
|
|
1885
|
-
/* @__PURE__ */ jsx22(NodeTrackConnections18, { handles: data.handles, nodeId: id, type: "target" })
|
|
1886
|
-
] });
|
|
1887
|
-
}
|
|
1888
|
-
var noise_scale_bias_node_default = NoiseScaleBiasNode;
|
|
1889
|
-
|
|
1890
|
-
// src/nodes/modifiers/noise-terrace-node.tsx
|
|
1891
|
-
import { NodeContainer as NodeContainer23, NodeTrackConnections as NodeTrackConnections19 } from "@awesome-flow/core/layout";
|
|
1892
|
-
import { ActionIcon as ActionIcon2, Button as Button2, Group as Group10, NumberInput as NumberInput9, Space as Space2 } from "@mantine/core";
|
|
1893
|
-
import {
|
|
1894
|
-
useIncomingComputedData as useIncomingComputedData12,
|
|
1895
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData21,
|
|
1896
|
-
useUpdateNodeData as useUpdateNodeData10
|
|
1897
|
-
} from "@awesome-flow/core/hooks";
|
|
1898
|
-
import { useCallback as useCallback16, useEffect as useEffect16, useState as useState15 } from "react";
|
|
1899
|
-
import { Terrace } from "libnoise-simplex-ts";
|
|
1900
|
-
import { IconX as IconX2 } from "@tabler/icons-react";
|
|
1901
|
-
import { randomId as randomId2 } from "@mantine/hooks";
|
|
1902
|
-
import { NodeState as NodeState2 } from "@awesome-flow/core/abstract";
|
|
1903
|
-
import { Fragment as Fragment2, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1904
|
-
function NoiseTerraceNode({ id, selected, data, type }) {
|
|
1905
|
-
const incoming = useIncomingComputedData12(id);
|
|
1906
|
-
const updateNodeData = useUpdateNodeData10();
|
|
1907
|
-
const updateComputedData = useUpdateNodeComputedData21();
|
|
1908
|
-
const [values, setValues] = useState15([]);
|
|
1909
|
-
const form = useForm({
|
|
1910
|
-
mode: "uncontrolled",
|
|
1911
|
-
initialValues: {
|
|
1912
|
-
points: []
|
|
1913
|
-
},
|
|
1914
|
-
validateInputOnChange: [`points.${FORM_INDEX}.input`],
|
|
1915
|
-
clearInputErrorOnChange: true,
|
|
1916
|
-
onValuesChange: useCallback16((values2) => {
|
|
1917
|
-
if (form.isValid()) {
|
|
1918
|
-
const points = values2.points.map((v) => v.value);
|
|
1919
|
-
setValues(points);
|
|
1920
|
-
updateNodeData(id, { points });
|
|
1921
|
-
}
|
|
1922
|
-
form.validate();
|
|
1923
|
-
}, [])
|
|
1924
|
-
});
|
|
1925
|
-
useEffect16(() => {
|
|
1926
|
-
const points = data.points?.length ? data.points.map((v) => ({ value: v, key: randomId2() })) : [1, 2].map(() => ({ value: 0, key: randomId2() }));
|
|
1927
|
-
form.initialize({ points });
|
|
1928
|
-
}, []);
|
|
1929
|
-
useEffect16(() => {
|
|
1930
|
-
if (incoming?.length && values?.length >= 2) {
|
|
1931
|
-
const module = new Terrace(incoming[0].module, values);
|
|
1932
|
-
updateComputedData(id, { module });
|
|
1933
|
-
}
|
|
1934
|
-
}, [values, incoming]);
|
|
1935
|
-
const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs20(Group10, { mt: "xs", children: [
|
|
1936
|
-
/* @__PURE__ */ jsx23(
|
|
1937
|
-
NumberInput9,
|
|
1938
|
-
{
|
|
1939
|
-
size: "xs",
|
|
1940
|
-
placeholder: "Input Value",
|
|
1941
|
-
...form.getInputProps(`points.${index}.value`),
|
|
1942
|
-
step: 0.1
|
|
1943
|
-
},
|
|
1944
|
-
form.key(`points.${index}.value`)
|
|
1945
|
-
),
|
|
1946
|
-
data.state === NodeState2.edit && values.length > 2 && /* @__PURE__ */ jsx23(
|
|
1947
|
-
ActionIcon2,
|
|
1948
|
-
{
|
|
1949
|
-
color: "red",
|
|
1950
|
-
variant: "outline",
|
|
1951
|
-
size: "sm",
|
|
1952
|
-
onClick: () => form.removeListItem("points", index),
|
|
1953
|
-
children: /* @__PURE__ */ jsx23(IconX2, { size: "1rem" })
|
|
1954
|
-
}
|
|
1955
|
-
)
|
|
1956
|
-
] }, item.key));
|
|
1957
|
-
return /* @__PURE__ */ jsxs20(NodeContainer23, { id, selected, type, data, children: [
|
|
1958
|
-
fields,
|
|
1959
|
-
data.state === NodeState2.edit && /* @__PURE__ */ jsxs20(Fragment2, { children: [
|
|
1960
|
-
/* @__PURE__ */ jsx23(Space2, { h: 10 }),
|
|
1961
|
-
/* @__PURE__ */ jsx23(
|
|
1962
|
-
Button2,
|
|
1963
|
-
{
|
|
1964
|
-
variant: "outline",
|
|
1965
|
-
size: "xs",
|
|
1966
|
-
fullWidth: true,
|
|
1967
|
-
onClick: () => form.insertListItem("points", { value: 0, key: randomId2() }),
|
|
1968
|
-
children: "Add control point"
|
|
1969
|
-
}
|
|
1970
|
-
)
|
|
1971
|
-
] }),
|
|
1972
|
-
/* @__PURE__ */ jsx23(NodeTrackConnections19, { handles: data.handles, nodeId: id, type: "target" })
|
|
1973
|
-
] });
|
|
1974
|
-
}
|
|
1975
|
-
var noise_terrace_node_default = NoiseTerraceNode;
|
|
1976
|
-
|
|
1977
|
-
// src/nodes/selectors/noise-blend-node.tsx
|
|
1978
|
-
import { NodeContainer as NodeContainer24, NodeTrackConnections as NodeTrackConnections20 } from "@awesome-flow/core/layout";
|
|
1979
|
-
import { useCallback as useCallback17 } from "react";
|
|
1980
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData22 } from "@awesome-flow/core/hooks";
|
|
1981
|
-
import { Blend } from "libnoise-simplex-ts";
|
|
1982
|
-
import { HandlesIncomingDataStatus as HandlesIncomingDataStatus2 } from "@awesome-flow/core/components";
|
|
1983
|
-
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1984
|
-
function NoiseBlendNode({ id, selected, data, type }) {
|
|
1985
|
-
const updateComputedData = useUpdateNodeComputedData22();
|
|
1986
|
-
const onDataUpdated = useCallback17(
|
|
1987
|
-
(incomingData) => {
|
|
1988
|
-
const incomingSources = incomingData["source" /* source */];
|
|
1989
|
-
const incomingControl = incomingData["control" /* control */];
|
|
1990
|
-
if (incomingSources?.length >= 2 && incomingControl?.length) {
|
|
1991
|
-
const module = new Blend(
|
|
1992
|
-
incomingSources[0].module,
|
|
1993
|
-
incomingSources[1].module,
|
|
1994
|
-
incomingControl[0].module
|
|
1995
|
-
);
|
|
1996
|
-
updateComputedData(id, { module });
|
|
1997
|
-
}
|
|
1998
|
-
},
|
|
1999
|
-
[]
|
|
2000
|
-
);
|
|
2001
|
-
return /* @__PURE__ */ jsxs21(NodeContainer24, { id, selected, data, type, children: [
|
|
2002
|
-
/* @__PURE__ */ jsx24(
|
|
2003
|
-
HandlesIncomingDataStatus2,
|
|
2004
|
-
{
|
|
2005
|
-
nodeId: id,
|
|
2006
|
-
handles: data.handles,
|
|
2007
|
-
handleKey: "dataId",
|
|
2008
|
-
onDataUpdated,
|
|
2009
|
-
type: "target",
|
|
2010
|
-
resetComputedData: true
|
|
2011
|
-
}
|
|
2012
|
-
),
|
|
2013
|
-
/* @__PURE__ */ jsx24(NodeTrackConnections20, { handles: data.handles, nodeId: id, type: "target" })
|
|
2014
|
-
] });
|
|
2015
|
-
}
|
|
2016
|
-
var noise_blend_node_default = NoiseBlendNode;
|
|
2017
|
-
|
|
2018
|
-
// src/nodes/selectors/noise-select-node.tsx
|
|
2019
|
-
import { NodeContainer as NodeContainer25, NodeTrackConnections as NodeTrackConnections21 } from "@awesome-flow/core/layout";
|
|
2020
|
-
import { useCallback as useCallback18, useEffect as useEffect17, useState as useState16 } from "react";
|
|
2021
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData23, useUpdateNodeData as useUpdateNodeData11 } from "@awesome-flow/core/hooks";
|
|
2022
|
-
import { Select } from "libnoise-simplex-ts";
|
|
2023
|
-
import { Group as Group11, NumberInput as NumberInput10, Stack as Stack11 } from "@mantine/core";
|
|
2024
|
-
import { HandlesIncomingDataStatus as HandlesIncomingDataStatus3 } from "@awesome-flow/core/components";
|
|
2025
|
-
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2026
|
-
function NoiseSelectNode({ id, selected, data, type }) {
|
|
2027
|
-
const [edgeFalloff, setEdgeFalloff] = useState16(data.edgeFalloff);
|
|
2028
|
-
const [lowerBound, setLowerBound] = useState16(data.lowerBound);
|
|
2029
|
-
const [upperBound, setUpperBound] = useState16(data.upperBound);
|
|
2030
|
-
const updateNodeData = useUpdateNodeData11();
|
|
2031
|
-
const updateComputedData = useUpdateNodeComputedData23();
|
|
2032
|
-
useEffect17(() => {
|
|
2033
|
-
updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
|
|
2034
|
-
}, [edgeFalloff, lowerBound, upperBound]);
|
|
2035
|
-
const onDataUpdated = useCallback18(
|
|
2036
|
-
(incomingData) => {
|
|
2037
|
-
const incomingSources = incomingData["source" /* source */];
|
|
2038
|
-
const incomingControl = incomingData["control" /* control */];
|
|
2039
|
-
if (incomingSources?.length >= 2 && incomingControl?.length) {
|
|
2040
|
-
const module = new Select(
|
|
2041
|
-
incomingSources[0].module,
|
|
2042
|
-
incomingSources[1].module,
|
|
2043
|
-
incomingControl[0].module,
|
|
2044
|
-
edgeFalloff,
|
|
2045
|
-
lowerBound,
|
|
2046
|
-
upperBound
|
|
2047
|
-
);
|
|
2048
|
-
updateComputedData(id, { module });
|
|
2049
|
-
}
|
|
2050
|
-
},
|
|
2051
|
-
[]
|
|
2052
|
-
);
|
|
2053
|
-
return /* @__PURE__ */ jsxs22(NodeContainer25, { id, selected, data, type, children: [
|
|
2054
|
-
/* @__PURE__ */ jsxs22(Stack11, { children: [
|
|
2055
|
-
/* @__PURE__ */ jsxs22(Group11, { children: [
|
|
2056
|
-
"Edge Falloff:",
|
|
2057
|
-
/* @__PURE__ */ jsx25(
|
|
2058
|
-
NumberInput10,
|
|
2059
|
-
{
|
|
2060
|
-
size: "xs",
|
|
2061
|
-
w: 100,
|
|
2062
|
-
value: edgeFalloff,
|
|
2063
|
-
onChange: (e) => setEdgeFalloff(Number(e)),
|
|
2064
|
-
step: 0.1
|
|
2065
|
-
}
|
|
2066
|
-
)
|
|
2067
|
-
] }),
|
|
2068
|
-
/* @__PURE__ */ jsxs22(Group11, { children: [
|
|
2069
|
-
"Lower Bound:",
|
|
2070
|
-
/* @__PURE__ */ jsx25(
|
|
2071
|
-
NumberInput10,
|
|
2072
|
-
{
|
|
2073
|
-
size: "xs",
|
|
2074
|
-
w: 100,
|
|
2075
|
-
value: lowerBound,
|
|
2076
|
-
onChange: (e) => setLowerBound(Number(e)),
|
|
2077
|
-
step: 0.1
|
|
2078
|
-
}
|
|
2079
|
-
)
|
|
2080
|
-
] }),
|
|
2081
|
-
/* @__PURE__ */ jsxs22(Group11, { children: [
|
|
2082
|
-
"Upper Bound:",
|
|
2083
|
-
/* @__PURE__ */ jsx25(
|
|
2084
|
-
NumberInput10,
|
|
2085
|
-
{
|
|
2086
|
-
size: "xs",
|
|
2087
|
-
w: 100,
|
|
2088
|
-
value: upperBound,
|
|
2089
|
-
onChange: (e) => setUpperBound(Number(e)),
|
|
2090
|
-
step: 0.1
|
|
2091
|
-
}
|
|
2092
|
-
)
|
|
2093
|
-
] }),
|
|
2094
|
-
/* @__PURE__ */ jsx25(
|
|
2095
|
-
HandlesIncomingDataStatus3,
|
|
2096
|
-
{
|
|
2097
|
-
nodeId: id,
|
|
2098
|
-
handles: data.handles,
|
|
2099
|
-
handleKey: "dataId",
|
|
2100
|
-
onDataUpdated,
|
|
2101
|
-
type: "target",
|
|
2102
|
-
resetComputedData: true
|
|
2103
|
-
}
|
|
2104
|
-
)
|
|
2105
|
-
] }),
|
|
2106
|
-
/* @__PURE__ */ jsx25(NodeTrackConnections21, { handles: data.handles, nodeId: id, type: "target" })
|
|
2107
|
-
] });
|
|
2108
|
-
}
|
|
2109
|
-
var noise_select_node_default = NoiseSelectNode;
|
|
2110
|
-
|
|
2111
|
-
// src/nodes/transformers/noise-displace-node.tsx
|
|
2112
|
-
import { NodeContainer as NodeContainer26, NodeTrackConnections as NodeTrackConnections22 } from "@awesome-flow/core/layout";
|
|
2113
|
-
import { useCallback as useCallback19 } from "react";
|
|
2114
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData24 } from "@awesome-flow/core/hooks";
|
|
2115
|
-
import { Displace } from "libnoise-simplex-ts";
|
|
2116
|
-
import { HandlesIncomingDataStatus as HandlesIncomingDataStatus4 } from "@awesome-flow/core/components";
|
|
2117
|
-
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2118
|
-
function NoiseDisplaceNode({ id, selected, data, type }) {
|
|
2119
|
-
const updateComputedData = useUpdateNodeComputedData24();
|
|
2120
|
-
const onDataUpdated = useCallback19(
|
|
2121
|
-
(handleData) => {
|
|
2122
|
-
const sourceModule = handleData["source" /* sourceModule */];
|
|
2123
|
-
const xModule = handleData["x-module" /* xModule */];
|
|
2124
|
-
const yModule = handleData["y-module" /* yModule */];
|
|
2125
|
-
const zModule = handleData["z-module" /* zModule */];
|
|
2126
|
-
if (sourceModule && xModule && yModule && zModule) {
|
|
2127
|
-
const module = new Displace(
|
|
2128
|
-
sourceModule[0].module,
|
|
2129
|
-
xModule[0].module,
|
|
2130
|
-
yModule[0].module,
|
|
2131
|
-
zModule[0].module
|
|
2132
|
-
);
|
|
2133
|
-
updateComputedData(id, { module });
|
|
2134
|
-
}
|
|
2135
|
-
},
|
|
2136
|
-
[]
|
|
2137
|
-
);
|
|
2138
|
-
return /* @__PURE__ */ jsxs23(NodeContainer26, { id, selected, data, type, children: [
|
|
2139
|
-
/* @__PURE__ */ jsx26(
|
|
2140
|
-
HandlesIncomingDataStatus4,
|
|
2141
|
-
{
|
|
2142
|
-
nodeId: id,
|
|
2143
|
-
handles: data.handles,
|
|
2144
|
-
handleKey: "dataId",
|
|
2145
|
-
onDataUpdated,
|
|
2146
|
-
type: "target",
|
|
2147
|
-
resetComputedData: true
|
|
2148
|
-
}
|
|
2149
|
-
),
|
|
2150
|
-
/* @__PURE__ */ jsx26(NodeTrackConnections22, { handles: data.handles, nodeId: id, type: "target" })
|
|
2151
|
-
] });
|
|
2152
|
-
}
|
|
2153
|
-
var noise_displace_node_default = NoiseDisplaceNode;
|
|
2154
|
-
|
|
2155
|
-
// src/nodes/transformers/noise-rotate-point-node.tsx
|
|
2156
|
-
import { NodeContainer as NodeContainer27, NodeTrackConnections as NodeTrackConnections23 } from "@awesome-flow/core/layout";
|
|
2157
|
-
import { useEffect as useEffect18, useState as useState17 } from "react";
|
|
2158
|
-
import {
|
|
2159
|
-
useIncomingComputedData as useIncomingComputedData13,
|
|
2160
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData25,
|
|
2161
|
-
useUpdateNodeData as useUpdateNodeData12
|
|
2162
|
-
} from "@awesome-flow/core/hooks";
|
|
2163
|
-
import { Group as Group12, NumberInput as NumberInput11, Stack as Stack12 } from "@mantine/core";
|
|
2164
|
-
import { RotatePoint } from "libnoise-simplex-ts";
|
|
2165
|
-
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2166
|
-
function NoiseRotatePointNode({
|
|
2167
|
-
id,
|
|
2168
|
-
selected,
|
|
2169
|
-
data,
|
|
2170
|
-
type
|
|
2171
|
-
}) {
|
|
2172
|
-
const [xAngle, setXAngle] = useState17(data.xAngle);
|
|
2173
|
-
const [yAngle, setYAngle] = useState17(data.yAngle);
|
|
2174
|
-
const [zAngle, setZAngle] = useState17(data.zAngle);
|
|
2175
|
-
const incoming = useIncomingComputedData13(id);
|
|
2176
|
-
const updateNodeData = useUpdateNodeData12();
|
|
2177
|
-
const updateComputedData = useUpdateNodeComputedData25();
|
|
2178
|
-
useEffect18(() => {
|
|
2179
|
-
if (incoming?.length) {
|
|
2180
|
-
const module = new RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
|
|
2181
|
-
updateComputedData(id, { module });
|
|
2182
|
-
}
|
|
2183
|
-
updateNodeData(id, { xAngle, yAngle, zAngle });
|
|
2184
|
-
}, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
|
|
2185
|
-
return /* @__PURE__ */ jsxs24(NodeContainer27, { id, selected, data, type, children: [
|
|
2186
|
-
/* @__PURE__ */ jsxs24(Stack12, { children: [
|
|
2187
|
-
/* @__PURE__ */ jsxs24(Group12, { children: [
|
|
2188
|
-
"X Angle:",
|
|
2189
|
-
/* @__PURE__ */ jsx27(
|
|
2190
|
-
NumberInput11,
|
|
2191
|
-
{
|
|
2192
|
-
size: "xs",
|
|
2193
|
-
w: 100,
|
|
2194
|
-
value: xAngle,
|
|
2195
|
-
onChange: (e) => setXAngle(Number(e)),
|
|
2196
|
-
step: 0.01
|
|
2197
|
-
}
|
|
2198
|
-
)
|
|
2199
|
-
] }),
|
|
2200
|
-
/* @__PURE__ */ jsxs24(Group12, { children: [
|
|
2201
|
-
"Y Angle:",
|
|
2202
|
-
/* @__PURE__ */ jsx27(
|
|
2203
|
-
NumberInput11,
|
|
2204
|
-
{
|
|
2205
|
-
size: "xs",
|
|
2206
|
-
w: 100,
|
|
2207
|
-
value: yAngle,
|
|
2208
|
-
onChange: (e) => setYAngle(Number(e)),
|
|
2209
|
-
step: 0.01
|
|
2210
|
-
}
|
|
2211
|
-
)
|
|
2212
|
-
] }),
|
|
2213
|
-
/* @__PURE__ */ jsxs24(Group12, { children: [
|
|
2214
|
-
"Z Angle:",
|
|
2215
|
-
/* @__PURE__ */ jsx27(
|
|
2216
|
-
NumberInput11,
|
|
2217
|
-
{
|
|
2218
|
-
size: "xs",
|
|
2219
|
-
w: 100,
|
|
2220
|
-
value: zAngle,
|
|
2221
|
-
onChange: (e) => setZAngle(Number(e)),
|
|
2222
|
-
step: 0.01
|
|
2223
|
-
}
|
|
2224
|
-
)
|
|
2225
|
-
] })
|
|
2226
|
-
] }),
|
|
2227
|
-
/* @__PURE__ */ jsx27(NodeTrackConnections23, { handles: data.handles, nodeId: id, type: "target" })
|
|
2228
|
-
] });
|
|
2229
|
-
}
|
|
2230
|
-
var noise_rotate_point_node_default = NoiseRotatePointNode;
|
|
2231
|
-
|
|
2232
|
-
// src/nodes/transformers/noise-scale-point-node.tsx
|
|
2233
|
-
import { NodeContainer as NodeContainer28, NodeTrackConnections as NodeTrackConnections24 } from "@awesome-flow/core/layout";
|
|
2234
|
-
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
2235
1
|
import {
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
import { ScalePoint } from "libnoise-simplex-ts";
|
|
2242
|
-
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2243
|
-
function NoiseScalePointNode({
|
|
2244
|
-
id,
|
|
2245
|
-
selected,
|
|
2246
|
-
data,
|
|
2247
|
-
type
|
|
2248
|
-
}) {
|
|
2249
|
-
const [xScale, setXScale] = useState18(data.xScale);
|
|
2250
|
-
const [yScale, setYScale] = useState18(data.yScale);
|
|
2251
|
-
const [zScale, setZScale] = useState18(data.zScale);
|
|
2252
|
-
const incoming = useIncomingComputedData14(id);
|
|
2253
|
-
const updateNodeData = useUpdateNodeData13();
|
|
2254
|
-
const updateComputedData = useUpdateNodeComputedData26();
|
|
2255
|
-
useEffect19(() => {
|
|
2256
|
-
if (incoming?.length) {
|
|
2257
|
-
const module = new ScalePoint(incoming[0].module, xScale, yScale, zScale);
|
|
2258
|
-
updateComputedData(id, { module });
|
|
2259
|
-
}
|
|
2260
|
-
updateNodeData(id, { xScale, yScale, zScale });
|
|
2261
|
-
}, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
|
|
2262
|
-
return /* @__PURE__ */ jsxs25(NodeContainer28, { id, selected, data, type, children: [
|
|
2263
|
-
/* @__PURE__ */ jsxs25(Stack13, { children: [
|
|
2264
|
-
/* @__PURE__ */ jsxs25(Group13, { children: [
|
|
2265
|
-
"X Scale:",
|
|
2266
|
-
/* @__PURE__ */ jsx28(
|
|
2267
|
-
NumberInput12,
|
|
2268
|
-
{
|
|
2269
|
-
size: "xs",
|
|
2270
|
-
w: 100,
|
|
2271
|
-
value: xScale,
|
|
2272
|
-
onChange: (e) => setXScale(Number(e)),
|
|
2273
|
-
step: 0.01
|
|
2274
|
-
}
|
|
2275
|
-
)
|
|
2276
|
-
] }),
|
|
2277
|
-
/* @__PURE__ */ jsxs25(Group13, { children: [
|
|
2278
|
-
"Y Scale:",
|
|
2279
|
-
/* @__PURE__ */ jsx28(
|
|
2280
|
-
NumberInput12,
|
|
2281
|
-
{
|
|
2282
|
-
size: "xs",
|
|
2283
|
-
w: 100,
|
|
2284
|
-
value: yScale,
|
|
2285
|
-
onChange: (e) => setYScale(Number(e)),
|
|
2286
|
-
step: 0.01
|
|
2287
|
-
}
|
|
2288
|
-
)
|
|
2289
|
-
] }),
|
|
2290
|
-
/* @__PURE__ */ jsxs25(Group13, { children: [
|
|
2291
|
-
"Z Scale:",
|
|
2292
|
-
/* @__PURE__ */ jsx28(
|
|
2293
|
-
NumberInput12,
|
|
2294
|
-
{
|
|
2295
|
-
size: "xs",
|
|
2296
|
-
w: 100,
|
|
2297
|
-
value: zScale,
|
|
2298
|
-
onChange: (e) => setZScale(Number(e)),
|
|
2299
|
-
step: 0.01
|
|
2300
|
-
}
|
|
2301
|
-
)
|
|
2302
|
-
] })
|
|
2303
|
-
] }),
|
|
2304
|
-
/* @__PURE__ */ jsx28(NodeTrackConnections24, { handles: data.handles, nodeId: id, type: "target" })
|
|
2305
|
-
] });
|
|
2306
|
-
}
|
|
2307
|
-
var noise_scale_point_node_default = NoiseScalePointNode;
|
|
2308
|
-
|
|
2309
|
-
// src/nodes/transformers/noise-translate-point-node.tsx
|
|
2310
|
-
import { NodeContainer as NodeContainer29, NodeTrackConnections as NodeTrackConnections25 } from "@awesome-flow/core/layout";
|
|
2311
|
-
import { useEffect as useEffect20, useState as useState19 } from "react";
|
|
2312
|
-
import {
|
|
2313
|
-
useIncomingComputedData as useIncomingComputedData15,
|
|
2314
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData27,
|
|
2315
|
-
useUpdateNodeData as useUpdateNodeData14
|
|
2316
|
-
} from "@awesome-flow/core/hooks";
|
|
2317
|
-
import { Group as Group14, NumberInput as NumberInput13, Stack as Stack14 } from "@mantine/core";
|
|
2318
|
-
import { TranslatePoint } from "libnoise-simplex-ts";
|
|
2319
|
-
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2320
|
-
function NoiseTranslatePointNode({
|
|
2321
|
-
id,
|
|
2322
|
-
selected,
|
|
2323
|
-
data,
|
|
2324
|
-
type
|
|
2325
|
-
}) {
|
|
2326
|
-
const [translateX, setTranslateX] = useState19(data.translateX);
|
|
2327
|
-
const [translateY, setTranslateY] = useState19(data.translateY);
|
|
2328
|
-
const [translateZ, setTranslateZ] = useState19(data.translateZ);
|
|
2329
|
-
const incoming = useIncomingComputedData15(id);
|
|
2330
|
-
const updateNodeData = useUpdateNodeData14();
|
|
2331
|
-
const updateComputedData = useUpdateNodeComputedData27();
|
|
2332
|
-
useEffect20(() => {
|
|
2333
|
-
if (incoming?.length) {
|
|
2334
|
-
const module = new TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
|
|
2335
|
-
updateComputedData(id, { module });
|
|
2336
|
-
}
|
|
2337
|
-
updateNodeData(id, { translateX, translateY, translateZ });
|
|
2338
|
-
}, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
|
|
2339
|
-
return /* @__PURE__ */ jsxs26(NodeContainer29, { id, selected, data, type, children: [
|
|
2340
|
-
/* @__PURE__ */ jsxs26(Stack14, { children: [
|
|
2341
|
-
/* @__PURE__ */ jsxs26(Group14, { children: [
|
|
2342
|
-
"Translate X:",
|
|
2343
|
-
/* @__PURE__ */ jsx29(
|
|
2344
|
-
NumberInput13,
|
|
2345
|
-
{
|
|
2346
|
-
size: "xs",
|
|
2347
|
-
w: 100,
|
|
2348
|
-
value: translateX,
|
|
2349
|
-
onChange: (e) => setTranslateX(Number(e)),
|
|
2350
|
-
step: 1
|
|
2351
|
-
}
|
|
2352
|
-
)
|
|
2353
|
-
] }),
|
|
2354
|
-
/* @__PURE__ */ jsxs26(Group14, { children: [
|
|
2355
|
-
"Translate Y:",
|
|
2356
|
-
/* @__PURE__ */ jsx29(
|
|
2357
|
-
NumberInput13,
|
|
2358
|
-
{
|
|
2359
|
-
size: "xs",
|
|
2360
|
-
w: 100,
|
|
2361
|
-
value: translateY,
|
|
2362
|
-
onChange: (e) => setTranslateY(Number(e)),
|
|
2363
|
-
step: 1
|
|
2364
|
-
}
|
|
2365
|
-
)
|
|
2366
|
-
] }),
|
|
2367
|
-
/* @__PURE__ */ jsxs26(Group14, { children: [
|
|
2368
|
-
"Translate Z:",
|
|
2369
|
-
/* @__PURE__ */ jsx29(
|
|
2370
|
-
NumberInput13,
|
|
2371
|
-
{
|
|
2372
|
-
size: "xs",
|
|
2373
|
-
w: 100,
|
|
2374
|
-
value: translateZ,
|
|
2375
|
-
onChange: (e) => setTranslateZ(Number(e)),
|
|
2376
|
-
step: 1
|
|
2377
|
-
}
|
|
2378
|
-
)
|
|
2379
|
-
] })
|
|
2380
|
-
] }),
|
|
2381
|
-
/* @__PURE__ */ jsx29(NodeTrackConnections25, { handles: data.handles, nodeId: id, type: "target" })
|
|
2382
|
-
] });
|
|
2383
|
-
}
|
|
2384
|
-
var noise_translate_point_node_default = NoiseTranslatePointNode;
|
|
2385
|
-
|
|
2386
|
-
// src/nodes/transformers/noise-turbulence-node .tsx
|
|
2387
|
-
import { NodeContainer as NodeContainer30, NodeTrackConnections as NodeTrackConnections26 } from "@awesome-flow/core/layout";
|
|
2388
|
-
import { useCallback as useCallback20, useEffect as useEffect21, useState as useState20 } from "react";
|
|
2389
|
-
import { useIncomingComputedData as useIncomingComputedData16, useUpdateNodeComputedData as useUpdateNodeComputedData28 } from "@awesome-flow/core/hooks";
|
|
2390
|
-
import { Turbulence } from "libnoise-simplex-ts";
|
|
2391
|
-
import { NodePropertyVariables as NodePropertyVariables7 } from "@awesome-flow/core/components";
|
|
2392
|
-
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2393
|
-
function NoiseTurbulenceNode({
|
|
2394
|
-
id,
|
|
2395
|
-
selected,
|
|
2396
|
-
data,
|
|
2397
|
-
type
|
|
2398
|
-
}) {
|
|
2399
|
-
const [properties, setProperties] = useState20(null);
|
|
2400
|
-
const incoming = useIncomingComputedData16(id);
|
|
2401
|
-
const updateComputedData = useUpdateNodeComputedData28();
|
|
2402
|
-
const onPropertiesChange = useCallback20((props) => {
|
|
2403
|
-
setProperties(props);
|
|
2404
|
-
}, []);
|
|
2405
|
-
useEffect21(() => {
|
|
2406
|
-
if (incoming?.length && properties) {
|
|
2407
|
-
const module = new Turbulence(
|
|
2408
|
-
incoming[0].module,
|
|
2409
|
-
properties.frequency.value,
|
|
2410
|
-
properties.power.value,
|
|
2411
|
-
properties.roughness.value,
|
|
2412
|
-
properties.seed.value
|
|
2413
|
-
);
|
|
2414
|
-
updateComputedData(id, { module });
|
|
2415
|
-
}
|
|
2416
|
-
}, [id, incoming, properties]);
|
|
2417
|
-
return /* @__PURE__ */ jsxs27(NodeContainer30, { id, selected, data, type, children: [
|
|
2418
|
-
/* @__PURE__ */ jsx30(NodePropertyVariables7, { data, nodeId: id, onPropertiesChange }),
|
|
2419
|
-
/* @__PURE__ */ jsx30(NodeTrackConnections26, { handles: data.handles, nodeId: id, type: "target" })
|
|
2420
|
-
] });
|
|
2421
|
-
}
|
|
2422
|
-
var noise_turbulence_node_default = NoiseTurbulenceNode;
|
|
2423
|
-
|
|
2424
|
-
// src/templates/generators/noise-checkerboard-template.ts
|
|
2425
|
-
import { Position } from "@xyflow/system";
|
|
2426
|
-
|
|
2427
|
-
// src/abstract/templates.ts
|
|
2428
|
-
var NoiseTemplateGroup = /* @__PURE__ */ ((NoiseTemplateGroup2) => {
|
|
2429
|
-
NoiseTemplateGroup2["positions"] = "Positions";
|
|
2430
|
-
NoiseTemplateGroup2["output"] = "Output";
|
|
2431
|
-
NoiseTemplateGroup2["noiseGenerators"] = "Noise Generators";
|
|
2432
|
-
NoiseTemplateGroup2["noiseModifiers"] = "Noise Modifiers";
|
|
2433
|
-
NoiseTemplateGroup2["noiseSelectors"] = "Noise Selectors";
|
|
2434
|
-
NoiseTemplateGroup2["noiseTransformers"] = "Noise Transformers";
|
|
2435
|
-
return NoiseTemplateGroup2;
|
|
2436
|
-
})(NoiseTemplateGroup || {});
|
|
2437
|
-
|
|
2438
|
-
// src/templates/generators/noise-checkerboard-template.ts
|
|
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
|
|
2
|
+
NoiseNodeType,
|
|
3
|
+
NoiseTemplateGroup,
|
|
4
|
+
noiseNodeTemplates,
|
|
5
|
+
noiseNodeTypes
|
|
6
|
+
} from "../chunk-BG6U3TYO.js";
|
|
3282
7
|
import {
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
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/nodes/groups/module-group-node.tsx
|
|
3322
|
-
import { NodeContainer as NodeContainer31, NodeCollapse, NodeTrackConnections as NodeTrackConnections27 } from "@awesome-flow/core/layout";
|
|
3323
|
-
import { NodeResizer, useStore, useUpdateNodeInternals } from "@xyflow/react";
|
|
3324
|
-
import { useCallback as useCallback21, useEffect as useEffect22, useMemo as useMemo11 } from "react";
|
|
3325
|
-
import { shallow } from "zustand/shallow";
|
|
3326
|
-
import { Badge, Group as Group15 } from "@mantine/core";
|
|
8
|
+
DisplacementHandle,
|
|
9
|
+
NoiseHandleType,
|
|
10
|
+
NoiseSourceControlHandle
|
|
11
|
+
} from "../chunk-PS5VUND5.js";
|
|
12
|
+
import "../chunk-DWSACR65.js";
|
|
13
|
+
import "../chunk-KHIIB5TH.js";
|
|
3327
14
|
import {
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
} from "@awesome-flow/core/hooks";
|
|
3333
|
-
import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3334
|
-
function ModuleGroupNode({
|
|
3335
|
-
id,
|
|
3336
|
-
selected,
|
|
3337
|
-
data,
|
|
3338
|
-
type,
|
|
3339
|
-
width,
|
|
3340
|
-
height
|
|
3341
|
-
}) {
|
|
3342
|
-
const updateNodeInternals = useUpdateNodeInternals();
|
|
3343
|
-
const triggerNodeChanges = useStore((s) => s.triggerNodeChanges);
|
|
3344
|
-
const { groupNodes, setGroupCollapsed } = useFlowStore(
|
|
3345
|
-
useCallback21(
|
|
3346
|
-
(state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
|
|
3347
|
-
[]
|
|
3348
|
-
)
|
|
3349
|
-
);
|
|
3350
|
-
const intersectingNode = useInteractiveStore(
|
|
3351
|
-
useCallback21((state) => state.nodeIntersectionTargets[id], [id]),
|
|
3352
|
-
shallow
|
|
3353
|
-
);
|
|
3354
|
-
useEffect22(() => {
|
|
3355
|
-
updateNodeInternals(id);
|
|
3356
|
-
}, [width, height]);
|
|
3357
|
-
useEffect22(() => {
|
|
3358
|
-
triggerNodeChanges([
|
|
3359
|
-
{
|
|
3360
|
-
id,
|
|
3361
|
-
type: "select",
|
|
3362
|
-
selected: !!intersectingNode
|
|
3363
|
-
}
|
|
3364
|
-
]);
|
|
3365
|
-
}, [intersectingNode]);
|
|
3366
|
-
const onCollapsed = useCallback21((collapsed) => {
|
|
3367
|
-
setGroupCollapsed(id, collapsed);
|
|
3368
|
-
}, []);
|
|
3369
|
-
const size = useMemo11(() => {
|
|
3370
|
-
return {
|
|
3371
|
-
width: data.initialSize?.width || 100,
|
|
3372
|
-
height: data.initialSize?.height || 50
|
|
3373
|
-
};
|
|
3374
|
-
}, [data.initialSize]);
|
|
3375
|
-
const incomingModules = useIncomingComputedData17(id);
|
|
3376
|
-
const updateComputedData = useUpdateNodeComputedData29();
|
|
3377
|
-
useEffect22(() => {
|
|
3378
|
-
if (incomingModules?.length) {
|
|
3379
|
-
const { module } = incomingModules[0];
|
|
3380
|
-
updateComputedData(id, { module });
|
|
3381
|
-
}
|
|
3382
|
-
}, [incomingModules]);
|
|
3383
|
-
return /* @__PURE__ */ jsxs28(
|
|
3384
|
-
NodeContainer31,
|
|
3385
|
-
{
|
|
3386
|
-
id,
|
|
3387
|
-
selected,
|
|
3388
|
-
data,
|
|
3389
|
-
title: /* @__PURE__ */ jsx31(Group15, { justify: "space-between", children: /* @__PURE__ */ jsxs28(Group15, { gap: "xs", children: [
|
|
3390
|
-
/* @__PURE__ */ jsx31(Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
|
|
3391
|
-
/* @__PURE__ */ jsx31(NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
|
|
3392
|
-
] }) }),
|
|
3393
|
-
type,
|
|
3394
|
-
children: [
|
|
3395
|
-
/* @__PURE__ */ jsx31(
|
|
3396
|
-
NodeResizer,
|
|
3397
|
-
{
|
|
3398
|
-
nodeId: id,
|
|
3399
|
-
minWidth: size.width,
|
|
3400
|
-
minHeight: size.height,
|
|
3401
|
-
isVisible: selected && !data.isCollapsed
|
|
3402
|
-
}
|
|
3403
|
-
),
|
|
3404
|
-
/* @__PURE__ */ jsx31(NodeTrackConnections27, { handles: data.handles, nodeId: id, type: "target" })
|
|
3405
|
-
]
|
|
3406
|
-
}
|
|
3407
|
-
);
|
|
3408
|
-
}
|
|
3409
|
-
var module_group_node_default = ModuleGroupNode;
|
|
3410
|
-
|
|
3411
|
-
// src/abstract/node-types.ts
|
|
3412
|
-
var NoiseNodeType = /* @__PURE__ */ ((NoiseNodeType2) => {
|
|
3413
|
-
NoiseNodeType2["position"] = "position";
|
|
3414
|
-
NoiseNodeType2["grid"] = "grid";
|
|
3415
|
-
NoiseNodeType2["textureData"] = "texture-data";
|
|
3416
|
-
NoiseNodeType2["groupModule"] = "group-module";
|
|
3417
|
-
NoiseNodeType2["positionLogger"] = "position-logger";
|
|
3418
|
-
NoiseNodeType2["noiseLogger"] = "noise-logger";
|
|
3419
|
-
NoiseNodeType2["noiseOutput"] = "noise-output";
|
|
3420
|
-
NoiseNodeType2["noiseConst"] = "noise-constant";
|
|
3421
|
-
NoiseNodeType2["noiseBillow"] = "noise-billow";
|
|
3422
|
-
NoiseNodeType2["noiseCheckerboard"] = "noise-checkerboard";
|
|
3423
|
-
NoiseNodeType2["noiseNormalize"] = "noise-normalize";
|
|
3424
|
-
NoiseNodeType2["noiseCylinders"] = "noise-cylinders";
|
|
3425
|
-
NoiseNodeType2["noisePerlin"] = "noise-perlin";
|
|
3426
|
-
NoiseNodeType2["noiseRidgedMulti"] = "noise-ridged-multi";
|
|
3427
|
-
NoiseNodeType2["noiseSpheres"] = "noise-spheres";
|
|
3428
|
-
NoiseNodeType2["noiseVoronoi"] = "noise-voronoi";
|
|
3429
|
-
NoiseNodeType2["noiseCombine"] = "noise-combiner";
|
|
3430
|
-
NoiseNodeType2["noiseClamp"] = "noise-clamp";
|
|
3431
|
-
NoiseNodeType2["noiseAbs"] = "noise-abs";
|
|
3432
|
-
NoiseNodeType2["noiseCurve"] = "noise-curve";
|
|
3433
|
-
NoiseNodeType2["noiseExponent"] = "noise-exponent";
|
|
3434
|
-
NoiseNodeType2["noiseInvert"] = "noise-invert";
|
|
3435
|
-
NoiseNodeType2["noiseScaleBias"] = "noise-scale-bias";
|
|
3436
|
-
NoiseNodeType2["noiseTerrace"] = "noise-terrace";
|
|
3437
|
-
NoiseNodeType2["noiseBlend"] = "noise-blend";
|
|
3438
|
-
NoiseNodeType2["noiseSelect"] = "noise-select";
|
|
3439
|
-
NoiseNodeType2["noiseDisplace"] = "noise-displace";
|
|
3440
|
-
NoiseNodeType2["noiseRotatePoint"] = "noise-rotate-point";
|
|
3441
|
-
NoiseNodeType2["noiseScalePoint"] = "noise-scale-point";
|
|
3442
|
-
NoiseNodeType2["noiseTranslatePoint"] = "noise-translate-point";
|
|
3443
|
-
NoiseNodeType2["noiseTurbulence"] = "noise-turbulence";
|
|
3444
|
-
return NoiseNodeType2;
|
|
3445
|
-
})(NoiseNodeType || {});
|
|
3446
|
-
var noiseNodeTypes = {
|
|
3447
|
-
["group-module" /* groupModule */]: module_group_node_default,
|
|
3448
|
-
["position" /* position */]: position_const_node_default,
|
|
3449
|
-
["grid" /* grid */]: position_grid_node_default,
|
|
3450
|
-
["noise-output" /* noiseOutput */]: noise_output_node_default,
|
|
3451
|
-
["texture-data" /* textureData */]: noise_raw_texture_node_default,
|
|
3452
|
-
["noise-logger" /* noiseLogger */]: noise_logger_node_default,
|
|
3453
|
-
["position-logger" /* positionLogger */]: positions_logger_node_default,
|
|
3454
|
-
["noise-constant" /* noiseConst */]: noise_const_node_default,
|
|
3455
|
-
["noise-billow" /* noiseBillow */]: noise_billow_node_default,
|
|
3456
|
-
["noise-checkerboard" /* noiseCheckerboard */]: noise_checkerboard_node_default,
|
|
3457
|
-
["noise-cylinders" /* noiseCylinders */]: noise_cylinders_node_default,
|
|
3458
|
-
["noise-perlin" /* noisePerlin */]: noise_perlin_node_default,
|
|
3459
|
-
["noise-ridged-multi" /* noiseRidgedMulti */]: noise_ridgedmulti_node_default,
|
|
3460
|
-
["noise-spheres" /* noiseSpheres */]: noise_spheres_node_default,
|
|
3461
|
-
["noise-voronoi" /* noiseVoronoi */]: noise_voronoi_node_default,
|
|
3462
|
-
["noise-combiner" /* noiseCombine */]: noise_combine_node_default,
|
|
3463
|
-
["noise-clamp" /* noiseClamp */]: noise_clamp_node_default,
|
|
3464
|
-
["noise-abs" /* noiseAbs */]: noise_abs_node_default,
|
|
3465
|
-
["noise-normalize" /* noiseNormalize */]: noise_normalize_node_default,
|
|
3466
|
-
["noise-curve" /* noiseCurve */]: noise_curve_node_default,
|
|
3467
|
-
["noise-exponent" /* noiseExponent */]: noise_exponent_node_default,
|
|
3468
|
-
["noise-invert" /* noiseInvert */]: noise_invert_node_default,
|
|
3469
|
-
["noise-scale-bias" /* noiseScaleBias */]: noise_scale_bias_node_default,
|
|
3470
|
-
["noise-terrace" /* noiseTerrace */]: noise_terrace_node_default,
|
|
3471
|
-
["noise-blend" /* noiseBlend */]: noise_blend_node_default,
|
|
3472
|
-
["noise-select" /* noiseSelect */]: noise_select_node_default,
|
|
3473
|
-
["noise-displace" /* noiseDisplace */]: noise_displace_node_default,
|
|
3474
|
-
["noise-rotate-point" /* noiseRotatePoint */]: noise_rotate_point_node_default,
|
|
3475
|
-
["noise-scale-point" /* noiseScalePoint */]: noise_scale_point_node_default,
|
|
3476
|
-
["noise-translate-point" /* noiseTranslatePoint */]: noise_translate_point_node_default,
|
|
3477
|
-
["noise-turbulence" /* noiseTurbulence */]: noise_turbulence_node_default
|
|
3478
|
-
};
|
|
3479
|
-
var noiseNodeTemplates = {
|
|
3480
|
-
["noise-output" /* noiseOutput */]: new NoiseOutputNodeTemplateFactory(),
|
|
3481
|
-
["noise-billow" /* noiseBillow */]: new NoiseBillowNodeTemplateFactory(),
|
|
3482
|
-
["noise-checkerboard" /* noiseCheckerboard */]: new NoiseCheckerboardNodeTemplateFactory(),
|
|
3483
|
-
["noise-normalize" /* noiseNormalize */]: new NoiseNormalizeNodeTemplateFactory(),
|
|
3484
|
-
["noise-logger" /* noiseLogger */]: new NoiseLoggerNodeTemplateFactory(),
|
|
3485
|
-
["noise-constant" /* noiseConst */]: new NoiseConstNodeTemplateFactory(),
|
|
3486
|
-
["position" /* position */]: new PositionConstNodeTemplateFactory(),
|
|
3487
|
-
["position-logger" /* positionLogger */]: new PositionLoggerNodeTemplateFactory(),
|
|
3488
|
-
["grid" /* grid */]: new PositionGridNodeTemplateFactory(),
|
|
3489
|
-
["texture-data" /* textureData */]: new NoiseRawTextureTemplateFactory(),
|
|
3490
|
-
["noise-cylinders" /* noiseCylinders */]: new NoiseCylindersNodeTemplateFactory(),
|
|
3491
|
-
["noise-perlin" /* noisePerlin */]: new NoisePerlinNodeTemplateFactory(),
|
|
3492
|
-
["noise-ridged-multi" /* noiseRidgedMulti */]: new NoiseRidgedMultiNodeTemplateFactory(),
|
|
3493
|
-
["noise-spheres" /* noiseSpheres */]: new NoiseSpheresNodeTemplateFactory(),
|
|
3494
|
-
["noise-voronoi" /* noiseVoronoi */]: new NoiseVoronoiNodeTemplateFactory(),
|
|
3495
|
-
["noise-combiner" /* noiseCombine */]: new NoiseCombineNodeTemplateFactory(),
|
|
3496
|
-
["noise-clamp" /* noiseClamp */]: new NoiseClampNodeTemplateFactory(),
|
|
3497
|
-
["noise-abs" /* noiseAbs */]: new NoiseAbsNodeTemplateFactory(),
|
|
3498
|
-
["noise-curve" /* noiseCurve */]: new NoiseCurveNodeTemplateFactory(),
|
|
3499
|
-
["noise-exponent" /* noiseExponent */]: new NoiseExponentNodeTemplateFactory(),
|
|
3500
|
-
["noise-invert" /* noiseInvert */]: new NoiseInvertNodeTemplateFactory(),
|
|
3501
|
-
["noise-scale-bias" /* noiseScaleBias */]: new NoiseScaleBiasNodeTemplateFactory(),
|
|
3502
|
-
["noise-terrace" /* noiseTerrace */]: new NoiseTerraceNodeTemplateFactory(),
|
|
3503
|
-
["noise-blend" /* noiseBlend */]: new NoiseBlendNodeTemplateFactory(),
|
|
3504
|
-
["noise-select" /* noiseSelect */]: new NoiseSelectNodeTemplateFactory(),
|
|
3505
|
-
["noise-displace" /* noiseDisplace */]: new NoiseDisplaceNodeTemplateFactory(),
|
|
3506
|
-
["noise-rotate-point" /* noiseRotatePoint */]: new NoiseRotatePointNodeTemplateFactory(),
|
|
3507
|
-
["noise-scale-point" /* noiseScalePoint */]: new NoiseScalePointNodeTemplateFactory(),
|
|
3508
|
-
["noise-translate-point" /* noiseTranslatePoint */]: new NoiseTranslatePointNodeTemplateFactory(),
|
|
3509
|
-
["noise-turbulence" /* noiseTurbulence */]: new NoiseTurbulenceNodeTemplateFactory(),
|
|
3510
|
-
["group-module" /* groupModule */]: new ModuleGroupNodeTemplateFactory()
|
|
3511
|
-
};
|
|
15
|
+
NoiseCombineType,
|
|
16
|
+
noiseCombineModuleMap
|
|
17
|
+
} from "../chunk-RDQ4BOOV.js";
|
|
18
|
+
import "../chunk-SGHEOOLW.js";
|
|
3512
19
|
export {
|
|
3513
20
|
DisplacementHandle,
|
|
3514
21
|
NoiseCombineType,
|