@awesome-flow/noise 0.1.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 +4234 -0
- package/dist/abstract/index.cjs.map +1 -0
- package/dist/abstract/index.d.cts +137 -0
- package/dist/abstract/index.d.ts +137 -0
- package/dist/abstract/index.js +4271 -0
- package/dist/abstract/index.js.map +1 -0
- package/dist/handle-types-D-v5S53h.d.cts +22 -0
- package/dist/handle-types-D-v5S53h.d.ts +22 -0
- package/dist/layout/index.cjs +164 -0
- package/dist/layout/index.cjs.map +1 -0
- package/dist/layout/index.d.cts +26 -0
- package/dist/layout/index.d.ts +26 -0
- package/dist/layout/index.js +136 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/modules/index.cjs +71 -0
- package/dist/modules/index.cjs.map +1 -0
- package/dist/modules/index.d.cts +18 -0
- package/dist/modules/index.d.ts +18 -0
- package/dist/modules/index.js +34 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/node-props-CeZ8Oshz.d.ts +161 -0
- package/dist/node-props-hKW-_KOU.d.cts +161 -0
- package/dist/nodes/generators/index.cjs +640 -0
- package/dist/nodes/generators/index.cjs.map +1 -0
- package/dist/nodes/generators/index.d.cts +38 -0
- package/dist/nodes/generators/index.d.ts +38 -0
- package/dist/nodes/generators/index.js +592 -0
- package/dist/nodes/generators/index.js.map +1 -0
- package/dist/nodes/groups/index.cjs +104 -0
- package/dist/nodes/groups/index.cjs.map +1 -0
- package/dist/nodes/groups/index.d.cts +7 -0
- package/dist/nodes/groups/index.d.ts +7 -0
- package/dist/nodes/groups/index.js +78 -0
- package/dist/nodes/groups/index.js.map +1 -0
- package/dist/nodes/index.cjs +2830 -0
- package/dist/nodes/index.cjs.map +1 -0
- package/dist/nodes/index.d.cts +16 -0
- package/dist/nodes/index.d.ts +16 -0
- package/dist/nodes/index.js +2840 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/nodes/modifiers/index.cjs +1593 -0
- package/dist/nodes/modifiers/index.cjs.map +1 -0
- package/dist/nodes/modifiers/index.d.cts +32 -0
- package/dist/nodes/modifiers/index.d.ts +32 -0
- package/dist/nodes/modifiers/index.js +1612 -0
- package/dist/nodes/modifiers/index.js.map +1 -0
- package/dist/nodes/output/index.cjs +210 -0
- package/dist/nodes/output/index.cjs.map +1 -0
- package/dist/nodes/output/index.d.cts +13 -0
- package/dist/nodes/output/index.d.ts +13 -0
- package/dist/nodes/output/index.js +181 -0
- package/dist/nodes/output/index.js.map +1 -0
- package/dist/nodes/selectors/index.cjs +136 -0
- package/dist/nodes/selectors/index.cjs.map +1 -0
- package/dist/nodes/selectors/index.d.cts +16 -0
- package/dist/nodes/selectors/index.d.ts +16 -0
- package/dist/nodes/selectors/index.js +113 -0
- package/dist/nodes/selectors/index.js.map +1 -0
- package/dist/nodes/transformers/index.cjs +477 -0
- package/dist/nodes/transformers/index.cjs.map +1 -0
- package/dist/nodes/transformers/index.d.cts +22 -0
- package/dist/nodes/transformers/index.d.ts +22 -0
- package/dist/nodes/transformers/index.js +459 -0
- package/dist/nodes/transformers/index.js.map +1 -0
- package/dist/properties-BxwtU6i9.d.cts +9 -0
- package/dist/properties-BxwtU6i9.d.ts +9 -0
- package/dist/templates/generators/index.cjs +1714 -0
- package/dist/templates/generators/index.cjs.map +1 -0
- package/dist/templates/generators/index.d.cts +89 -0
- package/dist/templates/generators/index.d.ts +89 -0
- package/dist/templates/generators/index.js +1723 -0
- package/dist/templates/generators/index.js.map +1 -0
- package/dist/templates/groups/index.cjs +1690 -0
- package/dist/templates/groups/index.cjs.map +1 -0
- package/dist/templates/groups/index.d.cts +11 -0
- package/dist/templates/groups/index.d.ts +11 -0
- package/dist/templates/groups/index.js +1711 -0
- package/dist/templates/groups/index.js.map +1 -0
- package/dist/templates/index.cjs +1758 -0
- package/dist/templates/index.cjs.map +1 -0
- package/dist/templates/index.d.cts +15 -0
- package/dist/templates/index.d.ts +15 -0
- package/dist/templates/index.js +1745 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/modifiers/index.cjs +1708 -0
- package/dist/templates/modifiers/index.cjs.map +1 -0
- package/dist/templates/modifiers/index.d.cts +71 -0
- package/dist/templates/modifiers/index.d.ts +71 -0
- package/dist/templates/modifiers/index.js +1720 -0
- package/dist/templates/modifiers/index.js.map +1 -0
- package/dist/templates/output/index.cjs +1696 -0
- package/dist/templates/output/index.cjs.map +1 -0
- package/dist/templates/output/index.d.cts +29 -0
- package/dist/templates/output/index.d.ts +29 -0
- package/dist/templates/output/index.js +1714 -0
- package/dist/templates/output/index.js.map +1 -0
- package/dist/templates/selectors/index.cjs +1692 -0
- package/dist/templates/selectors/index.cjs.map +1 -0
- package/dist/templates/selectors/index.d.cts +22 -0
- package/dist/templates/selectors/index.d.ts +22 -0
- package/dist/templates/selectors/index.js +1712 -0
- package/dist/templates/selectors/index.js.map +1 -0
- package/dist/templates/transformers/index.cjs +1698 -0
- package/dist/templates/transformers/index.cjs.map +1 -0
- package/dist/templates/transformers/index.d.cts +40 -0
- package/dist/templates/transformers/index.d.ts +40 -0
- package/dist/templates/transformers/index.js +1715 -0
- package/dist/templates/transformers/index.js.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1,4234 @@
|
|
|
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 __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// ../../node_modules/fast-deep-equal/index.js
|
|
33
|
+
var require_fast_deep_equal = __commonJS({
|
|
34
|
+
"../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
|
|
35
|
+
"use strict";
|
|
36
|
+
module2.exports = function equal(a, b) {
|
|
37
|
+
if (a === b)
|
|
38
|
+
return true;
|
|
39
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
40
|
+
if (a.constructor !== b.constructor)
|
|
41
|
+
return false;
|
|
42
|
+
var length, i, keys;
|
|
43
|
+
if (Array.isArray(a)) {
|
|
44
|
+
length = a.length;
|
|
45
|
+
if (length != b.length)
|
|
46
|
+
return false;
|
|
47
|
+
for (i = length; i-- !== 0; )
|
|
48
|
+
if (!equal(a[i], b[i]))
|
|
49
|
+
return false;
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
if (a.constructor === RegExp)
|
|
53
|
+
return a.source === b.source && a.flags === b.flags;
|
|
54
|
+
if (a.valueOf !== Object.prototype.valueOf)
|
|
55
|
+
return a.valueOf() === b.valueOf();
|
|
56
|
+
if (a.toString !== Object.prototype.toString)
|
|
57
|
+
return a.toString() === b.toString();
|
|
58
|
+
keys = Object.keys(a);
|
|
59
|
+
length = keys.length;
|
|
60
|
+
if (length !== Object.keys(b).length)
|
|
61
|
+
return false;
|
|
62
|
+
for (i = length; i-- !== 0; )
|
|
63
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
64
|
+
return false;
|
|
65
|
+
for (i = length; i-- !== 0; ) {
|
|
66
|
+
var key = keys[i];
|
|
67
|
+
if (!equal(a[key], b[key]))
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return a !== a && b !== b;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// src/abstract/index.ts
|
|
78
|
+
var abstract_exports = {};
|
|
79
|
+
__export(abstract_exports, {
|
|
80
|
+
DisplacementModule: () => DisplacementModule,
|
|
81
|
+
NoiseCombineType: () => NoiseCombineType,
|
|
82
|
+
NoiseHandleFlag: () => NoiseHandleFlag,
|
|
83
|
+
NoiseNodeType: () => NoiseNodeType,
|
|
84
|
+
VariableCombineType: () => VariableCombineType,
|
|
85
|
+
noiseCombineModuleMap: () => noiseCombineModuleMap,
|
|
86
|
+
noiseNodeTemplates: () => noiseNodeTemplates,
|
|
87
|
+
noiseNodeTypes: () => noiseNodeTypes
|
|
88
|
+
});
|
|
89
|
+
module.exports = __toCommonJS(abstract_exports);
|
|
90
|
+
|
|
91
|
+
// src/abstract/handle-types.ts
|
|
92
|
+
var NoiseHandleFlag = /* @__PURE__ */ ((NoiseHandleFlag2) => {
|
|
93
|
+
NoiseHandleFlag2[NoiseHandleFlag2["texture"] = 1] = "texture";
|
|
94
|
+
NoiseHandleFlag2[NoiseHandleFlag2["noise"] = 2] = "noise";
|
|
95
|
+
NoiseHandleFlag2[NoiseHandleFlag2["position"] = 4] = "position";
|
|
96
|
+
NoiseHandleFlag2[NoiseHandleFlag2["module"] = 8] = "module";
|
|
97
|
+
NoiseHandleFlag2[NoiseHandleFlag2["variableProperty"] = 16] = "variableProperty";
|
|
98
|
+
NoiseHandleFlag2[NoiseHandleFlag2["variableValue"] = 32] = "variableValue";
|
|
99
|
+
return NoiseHandleFlag2;
|
|
100
|
+
})(NoiseHandleFlag || {});
|
|
101
|
+
var DisplacementModule = /* @__PURE__ */ ((DisplacementModule2) => {
|
|
102
|
+
DisplacementModule2["sourceModule"] = "source";
|
|
103
|
+
DisplacementModule2["xModule"] = "x-module";
|
|
104
|
+
DisplacementModule2["yModule"] = "y-module";
|
|
105
|
+
DisplacementModule2["zModule"] = "z-module";
|
|
106
|
+
DisplacementModule2["output"] = "output";
|
|
107
|
+
return DisplacementModule2;
|
|
108
|
+
})(DisplacementModule || {});
|
|
109
|
+
|
|
110
|
+
// src/nodes/generators/noise-simplex-node.tsx
|
|
111
|
+
var import_layout = require("@awesome-flow/core/layout");
|
|
112
|
+
var import_react = require("react");
|
|
113
|
+
var import_hooks = require("@awesome-flow/core/hooks");
|
|
114
|
+
|
|
115
|
+
// src/modules/simplex-module.ts
|
|
116
|
+
var import_Module = __toESM(require("libnoise-ts/module/Module"), 1);
|
|
117
|
+
var import_simplex_noise = require("simplex-noise");
|
|
118
|
+
var SimplexModule = class extends import_Module.default {
|
|
119
|
+
noise;
|
|
120
|
+
constructor(random) {
|
|
121
|
+
super();
|
|
122
|
+
this.noise = (0, import_simplex_noise.createNoise3D)(random);
|
|
123
|
+
}
|
|
124
|
+
getValue(x, y, z) {
|
|
125
|
+
return this.noise(x, y, z);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// src/nodes/generators/noise-simplex-node.tsx
|
|
130
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
131
|
+
function NoiseSimplexNode({ id, selected, data, type }) {
|
|
132
|
+
const updateComputedData = (0, import_hooks.useUpdateNodeComputedData)();
|
|
133
|
+
const module2 = (0, import_react.useMemo)(() => new SimplexModule(), []);
|
|
134
|
+
(0, import_react.useEffect)(() => {
|
|
135
|
+
updateComputedData(id, { module: module2 });
|
|
136
|
+
}, []);
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.NodeContainer, { id, selected, data, type });
|
|
138
|
+
}
|
|
139
|
+
var noise_simplex_node_default = NoiseSimplexNode;
|
|
140
|
+
|
|
141
|
+
// src/nodes/generators/position-const-node.tsx
|
|
142
|
+
var import_layout2 = require("@awesome-flow/core/layout");
|
|
143
|
+
var import_react2 = require("react");
|
|
144
|
+
var import_core = require("@mantine/core");
|
|
145
|
+
var import_hooks2 = require("@awesome-flow/core/hooks");
|
|
146
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
147
|
+
function PositionConstNode({ id, selected, data, type }) {
|
|
148
|
+
const position = data.position ?? { x: 0, y: 0, z: 0 };
|
|
149
|
+
const [x, setX] = (0, import_react2.useState)(position.x);
|
|
150
|
+
const [y, setY] = (0, import_react2.useState)(position.y);
|
|
151
|
+
const [z, setZ] = (0, import_react2.useState)(position.z);
|
|
152
|
+
const updateNodeData = (0, import_hooks2.useUpdateNodeData)();
|
|
153
|
+
const updateComputedData = (0, import_hooks2.useUpdateNodeComputedData)();
|
|
154
|
+
(0, import_react2.useEffect)(() => {
|
|
155
|
+
const position2 = { x, y, z };
|
|
156
|
+
updateNodeData(id, {
|
|
157
|
+
position: position2
|
|
158
|
+
});
|
|
159
|
+
updateComputedData(id, {
|
|
160
|
+
positions: [position2]
|
|
161
|
+
});
|
|
162
|
+
}, [x, y, z]);
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_layout2.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core.Stack, { children: [
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core.Group, { children: [
|
|
165
|
+
"x: ",
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core.NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
167
|
+
] }),
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core.Group, { children: [
|
|
169
|
+
"y: ",
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core.NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
171
|
+
] }),
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core.Group, { children: [
|
|
173
|
+
"z: ",
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core.NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
175
|
+
] })
|
|
176
|
+
] }) });
|
|
177
|
+
}
|
|
178
|
+
var position_const_node_default = PositionConstNode;
|
|
179
|
+
|
|
180
|
+
// src/nodes/generators/position-grid-node.tsx
|
|
181
|
+
var import_layout3 = require("@awesome-flow/core/layout");
|
|
182
|
+
var import_react3 = require("react");
|
|
183
|
+
var import_core2 = require("@mantine/core");
|
|
184
|
+
var import_hooks3 = require("@awesome-flow/core/hooks");
|
|
185
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
186
|
+
function PositionGridNode({ id, selected, data, type }) {
|
|
187
|
+
const [x, setX] = (0, import_react3.useState)(data.center?.x);
|
|
188
|
+
const [y, setY] = (0, import_react3.useState)(data.center?.y);
|
|
189
|
+
const [z, setZ] = (0, import_react3.useState)(data.center?.z);
|
|
190
|
+
const [radius, setRadius] = (0, import_react3.useState)(data.radius);
|
|
191
|
+
const updateNodeData = (0, import_hooks3.useUpdateNodeData)();
|
|
192
|
+
const updateComputedData = (0, import_hooks3.useUpdateNodeComputedData)();
|
|
193
|
+
(0, import_react3.useEffect)(() => {
|
|
194
|
+
updateNodeData(id, {
|
|
195
|
+
center: { x, y, z }
|
|
196
|
+
});
|
|
197
|
+
}, [x, y, z]);
|
|
198
|
+
(0, import_react3.useEffect)(() => {
|
|
199
|
+
updateNodeData(id, {
|
|
200
|
+
radius
|
|
201
|
+
});
|
|
202
|
+
}, [radius]);
|
|
203
|
+
(0, import_react3.useEffect)(() => {
|
|
204
|
+
const positions = [];
|
|
205
|
+
for (let i = -radius; i < radius; i++) {
|
|
206
|
+
for (let j = -radius; j < radius; j++) {
|
|
207
|
+
positions.push({ x: x + i, y: y + j, z });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
updateComputedData(id, {
|
|
211
|
+
positions
|
|
212
|
+
});
|
|
213
|
+
}, [x, y, z, radius]);
|
|
214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_layout3.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Stack, { children: [
|
|
215
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Group, { children: [
|
|
216
|
+
"x: ",
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
218
|
+
] }),
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Group, { children: [
|
|
220
|
+
"y: ",
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
222
|
+
] }),
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Group, { children: [
|
|
224
|
+
"z: ",
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Group, { children: [
|
|
228
|
+
"r: ",
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
|
|
230
|
+
] })
|
|
231
|
+
] }) });
|
|
232
|
+
}
|
|
233
|
+
var position_grid_node_default = PositionGridNode;
|
|
234
|
+
|
|
235
|
+
// src/nodes/modifiers/noise-normalize-node.tsx
|
|
236
|
+
var import_layout4 = require("@awesome-flow/core/layout");
|
|
237
|
+
var import_react4 = require("react");
|
|
238
|
+
var import_core3 = require("@mantine/core");
|
|
239
|
+
var import_hooks4 = require("@awesome-flow/core/hooks");
|
|
240
|
+
|
|
241
|
+
// src/modules/normalize-noise-module.ts
|
|
242
|
+
var import_modifier = __toESM(require("libnoise-ts/module/modifier"), 1);
|
|
243
|
+
var NormalizeNoiseModule = class extends import_modifier.default {
|
|
244
|
+
constructor(source, lowerBound, upperBound) {
|
|
245
|
+
super(source);
|
|
246
|
+
this.lowerBound = lowerBound;
|
|
247
|
+
this.upperBound = upperBound;
|
|
248
|
+
}
|
|
249
|
+
getValue(x, y, z) {
|
|
250
|
+
return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
function normalize(value, min, max) {
|
|
254
|
+
return (value - min) / (max - min);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// src/nodes/modifiers/noise-normalize-node.tsx
|
|
258
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
259
|
+
function NoiseNormalizeNode({ id, selected, data, type }) {
|
|
260
|
+
const [intervalStart, setIntervalStart] = (0, import_react4.useState)(data.intervalStart);
|
|
261
|
+
const [intervalEnd, setIntervalEnd] = (0, import_react4.useState)(data.intervalEnd);
|
|
262
|
+
const incoming = (0, import_hooks4.useIncomingComputedData)(id);
|
|
263
|
+
const updateNodeData = (0, import_hooks4.useUpdateNodeData)();
|
|
264
|
+
const updateComputedData = (0, import_hooks4.useUpdateNodeComputedData)();
|
|
265
|
+
(0, import_react4.useEffect)(() => {
|
|
266
|
+
if (incoming?.length) {
|
|
267
|
+
const source = incoming[0].module;
|
|
268
|
+
const module2 = new NormalizeNoiseModule(source, intervalStart, intervalEnd);
|
|
269
|
+
updateComputedData(id, { module: module2 });
|
|
270
|
+
}
|
|
271
|
+
updateNodeData(id, { intervalStart, intervalEnd });
|
|
272
|
+
}, [incoming, intervalStart, intervalEnd]);
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_layout4.NodeContainer, { id, selected, data, type, children: [
|
|
274
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core3.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core3.Group, { children: [
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
276
|
+
import_core3.NumberInput,
|
|
277
|
+
{
|
|
278
|
+
size: "xs",
|
|
279
|
+
w: 100,
|
|
280
|
+
value: intervalStart,
|
|
281
|
+
onChange: (e) => setIntervalStart(Number(e))
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
285
|
+
import_core3.NumberInput,
|
|
286
|
+
{
|
|
287
|
+
size: "xs",
|
|
288
|
+
w: 100,
|
|
289
|
+
value: intervalEnd,
|
|
290
|
+
onChange: (e) => setIntervalEnd(Number(e))
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
] }) }),
|
|
294
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_layout4.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
295
|
+
] });
|
|
296
|
+
}
|
|
297
|
+
var noise_normalize_node_default = NoiseNormalizeNode;
|
|
298
|
+
|
|
299
|
+
// src/nodes/generators/noise-const-node.tsx
|
|
300
|
+
var import_layout5 = require("@awesome-flow/core/layout");
|
|
301
|
+
var import_react5 = require("react");
|
|
302
|
+
var import_core4 = require("@mantine/core");
|
|
303
|
+
var import_hooks5 = require("@awesome-flow/core/hooks");
|
|
304
|
+
var import_generator = require("libnoise-ts/module/generator");
|
|
305
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
306
|
+
function NoiseConstNode({ id, selected, data, type }) {
|
|
307
|
+
const [min, setMin] = (0, import_react5.useState)(data.min);
|
|
308
|
+
const [max, setMax] = (0, import_react5.useState)(data.max);
|
|
309
|
+
const [noise, setNoise] = (0, import_react5.useState)(data.noise);
|
|
310
|
+
const updateNodeData = (0, import_hooks5.useUpdateNodeData)();
|
|
311
|
+
const updateComputedData = (0, import_hooks5.useUpdateNodeComputedData)();
|
|
312
|
+
const module2 = (0, import_react5.useMemo)(() => new import_generator.Const(), []);
|
|
313
|
+
(0, import_react5.useEffect)(() => {
|
|
314
|
+
module2.value = noise;
|
|
315
|
+
updateNodeData(id, { noise, min, max });
|
|
316
|
+
updateComputedData(id, { module: module2 });
|
|
317
|
+
}, [noise, min, max, module2, updateNodeData, id, updateComputedData]);
|
|
318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_layout5.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core4.Stack, { children: [
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core4.Group, { children: [
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core4.NumberInput, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core4.NumberInput, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
|
|
322
|
+
] }),
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core4.Group, { children: [
|
|
324
|
+
"noise:",
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
326
|
+
import_core4.NumberInput,
|
|
327
|
+
{
|
|
328
|
+
size: "xs",
|
|
329
|
+
value: noise,
|
|
330
|
+
onChange: (e) => setNoise(Number(e)),
|
|
331
|
+
max,
|
|
332
|
+
min,
|
|
333
|
+
step: 0.1
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
] })
|
|
337
|
+
] }) });
|
|
338
|
+
}
|
|
339
|
+
var noise_const_node_default = NoiseConstNode;
|
|
340
|
+
|
|
341
|
+
// src/nodes/generators/noise-billow-node.tsx
|
|
342
|
+
var import_layout6 = require("@awesome-flow/core/layout");
|
|
343
|
+
var import_react7 = require("react");
|
|
344
|
+
var import_generator2 = require("libnoise-ts/module/generator");
|
|
345
|
+
var import_hooks7 = require("@awesome-flow/core/hooks");
|
|
346
|
+
var import_abstract2 = require("@awesome-flow/core/abstract");
|
|
347
|
+
|
|
348
|
+
// src/layout/node-property-variables.tsx
|
|
349
|
+
var import_hooks6 = require("@awesome-flow/core/hooks");
|
|
350
|
+
var import_react6 = require("react");
|
|
351
|
+
var import_core6 = require("@mantine/core");
|
|
352
|
+
var import_utils = require("@awesome-flow/core/utils");
|
|
353
|
+
var import_abstract = require("@awesome-flow/core/abstract");
|
|
354
|
+
|
|
355
|
+
// src/layout/node-value-input.tsx
|
|
356
|
+
var import_core5 = require("@mantine/core");
|
|
357
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
358
|
+
function NodeValueInput({ value, disabled, step, onChange }) {
|
|
359
|
+
if (value === void 0 || value === null) {
|
|
360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, {});
|
|
361
|
+
}
|
|
362
|
+
switch (typeof value) {
|
|
363
|
+
case "boolean": {
|
|
364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
365
|
+
import_core5.Switch,
|
|
366
|
+
{
|
|
367
|
+
checked: value,
|
|
368
|
+
disabled,
|
|
369
|
+
onChange: (e) => onChange(e.currentTarget.checked)
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
case "number": {
|
|
374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core5.NumberInput, { value, disabled, step, onChange: (e) => onChange(e) });
|
|
375
|
+
}
|
|
376
|
+
case "string": {
|
|
377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
378
|
+
import_core5.Input,
|
|
379
|
+
{
|
|
380
|
+
value,
|
|
381
|
+
disabled,
|
|
382
|
+
onChange: (e) => onChange(e.currentTarget.value)
|
|
383
|
+
}
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
default:
|
|
387
|
+
throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
var node_value_input_default = NodeValueInput;
|
|
391
|
+
|
|
392
|
+
// src/layout/node-property-input.tsx
|
|
393
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
394
|
+
function NodePropertyInput({ property, onChange }) {
|
|
395
|
+
if (!property) {
|
|
396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, {});
|
|
397
|
+
}
|
|
398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
399
|
+
node_value_input_default,
|
|
400
|
+
{
|
|
401
|
+
value: property.value,
|
|
402
|
+
disabled: property.disabled,
|
|
403
|
+
step: property.step,
|
|
404
|
+
onChange: (value) => onChange(property.name, value)
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
var node_property_input_default = NodePropertyInput;
|
|
409
|
+
|
|
410
|
+
// src/layout/node-property-variables.tsx
|
|
411
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
412
|
+
function NodePropertyVariables({
|
|
413
|
+
data,
|
|
414
|
+
nodeId,
|
|
415
|
+
onPropertiesChange,
|
|
416
|
+
except = import_abstract.nodeDataPropertyExcept
|
|
417
|
+
}) {
|
|
418
|
+
const [properties, setProperties] = (0, import_react6.useState)(() => {
|
|
419
|
+
const keys = (0, import_utils.getObjectKeys)(data, except);
|
|
420
|
+
const dataProps = {};
|
|
421
|
+
for (const key of keys) {
|
|
422
|
+
dataProps[key] = {
|
|
423
|
+
name: key,
|
|
424
|
+
value: data[key]
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
return dataProps;
|
|
428
|
+
});
|
|
429
|
+
const updateNodeData = (0, import_hooks6.useUpdateNodeData)();
|
|
430
|
+
const incoming = (0, import_hooks6.useIncomingNodeData)(nodeId);
|
|
431
|
+
const resetAllDisabled = (0, import_react6.useCallback)(() => {
|
|
432
|
+
const keys = Object.keys(properties);
|
|
433
|
+
keys.forEach((k) => {
|
|
434
|
+
properties[k].disabled = false;
|
|
435
|
+
});
|
|
436
|
+
setProperties(properties);
|
|
437
|
+
}, []);
|
|
438
|
+
const updatePropertyValue = (0, import_react6.useCallback)((name, value, disabled) => {
|
|
439
|
+
let property = properties[name];
|
|
440
|
+
if (property) {
|
|
441
|
+
property.value = value;
|
|
442
|
+
} else {
|
|
443
|
+
property = {
|
|
444
|
+
name,
|
|
445
|
+
value
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
property.disabled = disabled;
|
|
449
|
+
setProperties({ ...properties, [name]: property });
|
|
450
|
+
updateNodeData(nodeId, { [name]: value });
|
|
451
|
+
}, []);
|
|
452
|
+
(0, import_react6.useEffect)(() => {
|
|
453
|
+
resetAllDisabled();
|
|
454
|
+
if (incoming?.length) {
|
|
455
|
+
for (const connection of incoming) {
|
|
456
|
+
if (connection.property && properties[connection.property.name] !== void 0) {
|
|
457
|
+
updatePropertyValue(connection.property.name, connection.property.value, true);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}, [incoming]);
|
|
462
|
+
(0, import_react6.useEffect)(() => {
|
|
463
|
+
if (onPropertiesChange) {
|
|
464
|
+
onPropertiesChange(properties);
|
|
465
|
+
}
|
|
466
|
+
}, [onPropertiesChange, properties]);
|
|
467
|
+
const nodes = (0, import_react6.useMemo)(() => {
|
|
468
|
+
return Object.keys(properties).map((key) => {
|
|
469
|
+
const property = properties[key];
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core6.Group, { children: [
|
|
471
|
+
property.name,
|
|
472
|
+
":",
|
|
473
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(node_property_input_default, { property, onChange: updatePropertyValue })
|
|
474
|
+
] }, key);
|
|
475
|
+
});
|
|
476
|
+
}, [properties, updatePropertyValue]);
|
|
477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core6.Stack, { children: nodes });
|
|
478
|
+
}
|
|
479
|
+
var node_property_variables_default = NodePropertyVariables;
|
|
480
|
+
|
|
481
|
+
// src/nodes/generators/noise-billow-node.tsx
|
|
482
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
483
|
+
function NoiseBillowNode({ id, selected, data, type }) {
|
|
484
|
+
const updateComputedData = (0, import_hooks7.useUpdateNodeComputedData)();
|
|
485
|
+
const module2 = (0, import_react7.useMemo)(() => new import_generator2.Billow(), []);
|
|
486
|
+
const onPropertiesChange = (0, import_react7.useCallback)(
|
|
487
|
+
(properties) => {
|
|
488
|
+
Object.keys(properties).forEach((k) => {
|
|
489
|
+
module2[k] = properties[k].value;
|
|
490
|
+
});
|
|
491
|
+
updateComputedData(id, { module: module2 });
|
|
492
|
+
},
|
|
493
|
+
[id, module2, updateComputedData]
|
|
494
|
+
);
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_layout6.NodeContainer, { id, selected, data, type, children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
497
|
+
node_property_variables_default,
|
|
498
|
+
{
|
|
499
|
+
data,
|
|
500
|
+
except: import_abstract2.nodeDataPropertyExcept,
|
|
501
|
+
nodeId: id,
|
|
502
|
+
onPropertiesChange
|
|
503
|
+
}
|
|
504
|
+
),
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_layout6.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
506
|
+
] });
|
|
507
|
+
}
|
|
508
|
+
var noise_billow_node_default = NoiseBillowNode;
|
|
509
|
+
|
|
510
|
+
// src/nodes/output/noise-logger-node.tsx
|
|
511
|
+
var import_layout7 = require("@awesome-flow/core/layout");
|
|
512
|
+
var import_react8 = require("react");
|
|
513
|
+
var import_core7 = require("@mantine/core");
|
|
514
|
+
var import_hooks8 = require("@awesome-flow/core/hooks");
|
|
515
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
516
|
+
function NoiseLoggerNode({ id, selected, data, type }) {
|
|
517
|
+
const incoming = (0, import_hooks8.useIncomingComputedData)(id);
|
|
518
|
+
const noise = (0, import_react8.useMemo)(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_layout7.NodeContainer, { id, selected, data, type, children: [
|
|
520
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_core7.Text, { children: [
|
|
521
|
+
"Size: ",
|
|
522
|
+
noise?.length || 0
|
|
523
|
+
] }),
|
|
524
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core7.Divider, { h: 5 }),
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core7.Stack, { children: noise?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_core7.Text, { children: [
|
|
526
|
+
v.position?.x,
|
|
527
|
+
":",
|
|
528
|
+
v.position?.y,
|
|
529
|
+
":",
|
|
530
|
+
v.position?.z,
|
|
531
|
+
": ",
|
|
532
|
+
v.value
|
|
533
|
+
] }, i)) }),
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_layout7.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
535
|
+
] });
|
|
536
|
+
}
|
|
537
|
+
var noise_logger_node_default = NoiseLoggerNode;
|
|
538
|
+
|
|
539
|
+
// src/nodes/output/noise-raw-texture-node.tsx
|
|
540
|
+
var import_layout8 = require("@awesome-flow/core/layout");
|
|
541
|
+
var import_react9 = require("react");
|
|
542
|
+
var import_hooks9 = require("@awesome-flow/core/hooks");
|
|
543
|
+
var import_core8 = require("@mantine/core");
|
|
544
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
545
|
+
function NoiseRawTextureNode({ id, selected, data, type }) {
|
|
546
|
+
const updateComputedData = (0, import_hooks9.useUpdateNodeComputedData)();
|
|
547
|
+
const [dataLength, setDataLength] = (0, import_react9.useState)(0);
|
|
548
|
+
const [resolution, setResolution] = (0, import_react9.useState)(0);
|
|
549
|
+
const incoming = (0, import_hooks9.useIncomingComputedData)(id);
|
|
550
|
+
const noise = (0, import_react9.useMemo)(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
551
|
+
(0, import_react9.useEffect)(() => {
|
|
552
|
+
if (noise?.length) {
|
|
553
|
+
const size = Math.ceil(Math.sqrt(noise.length));
|
|
554
|
+
const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();
|
|
555
|
+
const dataArray = new Uint8Array(size * size * 4);
|
|
556
|
+
dataArray.set(colors);
|
|
557
|
+
setResolution(size);
|
|
558
|
+
setDataLength(dataArray.length);
|
|
559
|
+
updateComputedData(id, { textureData: dataArray, textureResolution: size });
|
|
560
|
+
}
|
|
561
|
+
}, [noise]);
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_layout8.NodeContainer, { id, selected, data, type, children: [
|
|
563
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_core8.Stack, { children: [
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_core8.Group, { children: [
|
|
565
|
+
"Resolution: ",
|
|
566
|
+
resolution,
|
|
567
|
+
"x",
|
|
568
|
+
resolution
|
|
569
|
+
] }),
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_core8.Group, { children: [
|
|
571
|
+
"Input Length: ",
|
|
572
|
+
noise?.length || 0
|
|
573
|
+
] }),
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_core8.Group, { children: [
|
|
575
|
+
"Output Length (",
|
|
576
|
+
resolution,
|
|
577
|
+
"*",
|
|
578
|
+
resolution,
|
|
579
|
+
"*4): ",
|
|
580
|
+
dataLength
|
|
581
|
+
] })
|
|
582
|
+
] }),
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_layout8.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
584
|
+
] });
|
|
585
|
+
}
|
|
586
|
+
var noise_raw_texture_node_default = NoiseRawTextureNode;
|
|
587
|
+
|
|
588
|
+
// src/nodes/generators/noise-checkerboard-node.tsx
|
|
589
|
+
var import_layout9 = require("@awesome-flow/core/layout");
|
|
590
|
+
var import_react10 = require("react");
|
|
591
|
+
var import_generator3 = require("libnoise-ts/module/generator");
|
|
592
|
+
var import_hooks10 = require("@awesome-flow/core/hooks");
|
|
593
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
594
|
+
function NoiseCheckerboardNode({ id, selected, data, type }) {
|
|
595
|
+
const updateComputedData = (0, import_hooks10.useUpdateNodeComputedData)();
|
|
596
|
+
const module2 = (0, import_react10.useMemo)(() => new import_generator3.Checkerboard(), []);
|
|
597
|
+
(0, import_react10.useEffect)(() => {
|
|
598
|
+
updateComputedData(id, { module: module2 });
|
|
599
|
+
}, [id, module2, updateComputedData]);
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_layout9.NodeContainer, { id, selected, data, type });
|
|
601
|
+
}
|
|
602
|
+
var noise_checkerboard_node_default = NoiseCheckerboardNode;
|
|
603
|
+
|
|
604
|
+
// src/nodes/output/positions-logger-node.tsx
|
|
605
|
+
var import_layout10 = require("@awesome-flow/core/layout");
|
|
606
|
+
var import_react11 = require("react");
|
|
607
|
+
var import_core9 = require("@mantine/core");
|
|
608
|
+
var import_hooks11 = require("@awesome-flow/core/hooks");
|
|
609
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
610
|
+
function PositionsLoggerNode({ id, selected, data, type }) {
|
|
611
|
+
const incoming = (0, import_hooks11.useIncomingComputedData)(id);
|
|
612
|
+
const positions = (0, import_react11.useMemo)(() => {
|
|
613
|
+
return incoming?.map((p) => p.positions).flat();
|
|
614
|
+
}, [incoming]);
|
|
615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_layout10.NodeContainer, { id, selected, data, type, children: [
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core9.Text, { children: [
|
|
617
|
+
"Size: ",
|
|
618
|
+
positions?.length || 0
|
|
619
|
+
] }),
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core9.Divider, { h: 5 }),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core9.Stack, { children: positions?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core9.Text, { children: [
|
|
622
|
+
v.x,
|
|
623
|
+
":",
|
|
624
|
+
v.y,
|
|
625
|
+
":",
|
|
626
|
+
v.z
|
|
627
|
+
] }, i)) }),
|
|
628
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_layout10.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
629
|
+
] });
|
|
630
|
+
}
|
|
631
|
+
var positions_logger_node_default = PositionsLoggerNode;
|
|
632
|
+
|
|
633
|
+
// src/nodes/generators/noise-cylinders-node.tsx
|
|
634
|
+
var import_layout11 = require("@awesome-flow/core/layout");
|
|
635
|
+
var import_react12 = require("react");
|
|
636
|
+
var import_generator4 = require("libnoise-ts/module/generator");
|
|
637
|
+
var import_hooks12 = require("@awesome-flow/core/hooks");
|
|
638
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
639
|
+
function NoiseCylindersNode({ id, selected, data, type }) {
|
|
640
|
+
const updateComputedData = (0, import_hooks12.useUpdateNodeComputedData)();
|
|
641
|
+
const module2 = (0, import_react12.useMemo)(() => new import_generator4.Cylinders(), []);
|
|
642
|
+
const onPropertiesChange = (0, import_react12.useCallback)(
|
|
643
|
+
(properties) => {
|
|
644
|
+
Object.keys(properties).forEach((k) => {
|
|
645
|
+
module2[k] = properties[k].value;
|
|
646
|
+
});
|
|
647
|
+
updateComputedData(id, { module: module2 });
|
|
648
|
+
},
|
|
649
|
+
[id, module2, updateComputedData]
|
|
650
|
+
);
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_layout11.NodeContainer, { id, selected, data, type, children: [
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_layout11.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
654
|
+
] });
|
|
655
|
+
}
|
|
656
|
+
var noise_cylinders_node_default = NoiseCylindersNode;
|
|
657
|
+
|
|
658
|
+
// src/nodes/generators/noise-perlin-node.tsx
|
|
659
|
+
var import_layout12 = require("@awesome-flow/core/layout");
|
|
660
|
+
var import_react13 = require("react");
|
|
661
|
+
var import_generator5 = require("libnoise-ts/module/generator");
|
|
662
|
+
var import_hooks13 = require("@awesome-flow/core/hooks");
|
|
663
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
664
|
+
function NoisePerlinNode({ id, selected, data, type }) {
|
|
665
|
+
const updateComputedData = (0, import_hooks13.useUpdateNodeComputedData)();
|
|
666
|
+
const module2 = (0, import_react13.useMemo)(() => new import_generator5.Perlin(), []);
|
|
667
|
+
const onPropertiesChange = (0, import_react13.useCallback)(
|
|
668
|
+
(properties) => {
|
|
669
|
+
Object.keys(properties).forEach((k) => {
|
|
670
|
+
module2[k] = properties[k].value;
|
|
671
|
+
});
|
|
672
|
+
updateComputedData(id, { module: module2 });
|
|
673
|
+
},
|
|
674
|
+
[id, module2, updateComputedData]
|
|
675
|
+
);
|
|
676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_layout12.NodeContainer, { id, selected, data, type, children: [
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_layout12.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
679
|
+
] });
|
|
680
|
+
}
|
|
681
|
+
var noise_perlin_node_default = NoisePerlinNode;
|
|
682
|
+
|
|
683
|
+
// src/nodes/generators/noise-ridgedmulti-node.tsx
|
|
684
|
+
var import_layout13 = require("@awesome-flow/core/layout");
|
|
685
|
+
var import_react14 = require("react");
|
|
686
|
+
var import_generator6 = require("libnoise-ts/module/generator");
|
|
687
|
+
var import_hooks14 = require("@awesome-flow/core/hooks");
|
|
688
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
689
|
+
function NoiseRidgedMultiNode({ id, selected, data, type }) {
|
|
690
|
+
const updateComputedData = (0, import_hooks14.useUpdateNodeComputedData)();
|
|
691
|
+
const module2 = (0, import_react14.useMemo)(() => new import_generator6.RidgedMulti(), []);
|
|
692
|
+
const onPropertiesChange = (0, import_react14.useCallback)((properties) => {
|
|
693
|
+
Object.keys(properties).forEach((k) => module2[k] = properties[k].value);
|
|
694
|
+
updateComputedData(id, { module: module2 });
|
|
695
|
+
}, []);
|
|
696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_layout13.NodeContainer, { id, selected, data, type, children: [
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
|
|
698
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_layout13.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
699
|
+
] });
|
|
700
|
+
}
|
|
701
|
+
var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
|
|
702
|
+
|
|
703
|
+
// src/nodes/generators/noise-spheres-node.tsx
|
|
704
|
+
var import_layout14 = require("@awesome-flow/core/layout");
|
|
705
|
+
var import_react15 = require("react");
|
|
706
|
+
var import_generator7 = require("libnoise-ts/module/generator");
|
|
707
|
+
var import_hooks15 = require("@awesome-flow/core/hooks");
|
|
708
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
709
|
+
function NoiseSpheresNode({ id, selected, data, type }) {
|
|
710
|
+
const updateComputedData = (0, import_hooks15.useUpdateNodeComputedData)();
|
|
711
|
+
const module2 = (0, import_react15.useMemo)(() => new import_generator7.Spheres(), []);
|
|
712
|
+
const onPropertiesChange = (0, import_react15.useCallback)((properties) => {
|
|
713
|
+
Object.keys(properties).forEach((k) => module2[k] = properties[k].value);
|
|
714
|
+
updateComputedData(id, { module: module2 });
|
|
715
|
+
}, []);
|
|
716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_layout14.NodeContainer, { id, selected, data, type, children: [
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_layout14.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
719
|
+
] });
|
|
720
|
+
}
|
|
721
|
+
var noise_spheres_node_default = NoiseSpheresNode;
|
|
722
|
+
|
|
723
|
+
// src/nodes/generators/noise-voronoi-node.tsx
|
|
724
|
+
var import_layout15 = require("@awesome-flow/core/layout");
|
|
725
|
+
var import_react16 = require("react");
|
|
726
|
+
var import_generator8 = require("libnoise-ts/module/generator");
|
|
727
|
+
var import_hooks16 = require("@awesome-flow/core/hooks");
|
|
728
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
729
|
+
function NoiseVoronoiNode({ id, selected, data, type }) {
|
|
730
|
+
const updateComputedData = (0, import_hooks16.useUpdateNodeComputedData)();
|
|
731
|
+
const onPropertiesChange = (0, import_react16.useCallback)(
|
|
732
|
+
(properties) => {
|
|
733
|
+
const module2 = new import_generator8.Voronoi(
|
|
734
|
+
properties.frequency.value,
|
|
735
|
+
properties.displacement.value,
|
|
736
|
+
properties.distance.value,
|
|
737
|
+
properties.seed.value
|
|
738
|
+
);
|
|
739
|
+
updateComputedData(id, { module: module2 });
|
|
740
|
+
},
|
|
741
|
+
[]
|
|
742
|
+
);
|
|
743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_layout15.NodeContainer, { id, selected, data, type, children: [
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_layout15.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
746
|
+
] });
|
|
747
|
+
}
|
|
748
|
+
var noise_voronoi_node_default = NoiseVoronoiNode;
|
|
749
|
+
|
|
750
|
+
// src/nodes/modifiers/noise-combine-node.tsx
|
|
751
|
+
var import_layout16 = require("@awesome-flow/core/layout");
|
|
752
|
+
var import_react17 = require("react");
|
|
753
|
+
var import_hooks17 = require("@awesome-flow/core/hooks");
|
|
754
|
+
var import_icons_react = require("@tabler/icons-react");
|
|
755
|
+
|
|
756
|
+
// src/abstract/operations.ts
|
|
757
|
+
var import_combiner = require("libnoise-ts/module/combiner");
|
|
758
|
+
var NoiseCombineType = /* @__PURE__ */ ((NoiseCombineType3) => {
|
|
759
|
+
NoiseCombineType3["add"] = "add";
|
|
760
|
+
NoiseCombineType3["max"] = "max";
|
|
761
|
+
NoiseCombineType3["min"] = "min";
|
|
762
|
+
NoiseCombineType3["multiply"] = "multiply";
|
|
763
|
+
NoiseCombineType3["power"] = "power";
|
|
764
|
+
return NoiseCombineType3;
|
|
765
|
+
})(NoiseCombineType || {});
|
|
766
|
+
var VariableCombineType = /* @__PURE__ */ ((VariableCombineType2) => {
|
|
767
|
+
VariableCombineType2["add"] = "add";
|
|
768
|
+
VariableCombineType2["divide"] = "divide";
|
|
769
|
+
VariableCombineType2["max"] = "max";
|
|
770
|
+
VariableCombineType2["min"] = "min";
|
|
771
|
+
VariableCombineType2["multiply"] = "multiply";
|
|
772
|
+
VariableCombineType2["power"] = "power";
|
|
773
|
+
return VariableCombineType2;
|
|
774
|
+
})(VariableCombineType || {});
|
|
775
|
+
var noiseCombineModuleMap = {
|
|
776
|
+
["add" /* add */]: import_combiner.Add,
|
|
777
|
+
["max" /* max */]: import_combiner.Max,
|
|
778
|
+
["min" /* min */]: import_combiner.Min,
|
|
779
|
+
["multiply" /* multiply */]: import_combiner.Multiply,
|
|
780
|
+
["power" /* power */]: import_combiner.Power
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// src/nodes/modifiers/noise-combine-node.tsx
|
|
784
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
785
|
+
var options = {
|
|
786
|
+
add: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons_react.IconPlus, {}),
|
|
787
|
+
min: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons_react.IconChevronLeft, {}),
|
|
788
|
+
max: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons_react.IconChevronRight, {}),
|
|
789
|
+
multiply: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons_react.IconAsterisk, {}),
|
|
790
|
+
power: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons_react.IconChevronUp, {})
|
|
791
|
+
};
|
|
792
|
+
function NoiseCombineNode({ id, selected, data, type }) {
|
|
793
|
+
const updateNodeData = (0, import_hooks17.useUpdateNodeData)();
|
|
794
|
+
const updateComputedData = (0, import_hooks17.useUpdateNodeComputedData)();
|
|
795
|
+
const incoming = (0, import_hooks17.useIncomingComputedData)(id);
|
|
796
|
+
(0, import_react17.useEffect)(() => {
|
|
797
|
+
const ModuleFactory = noiseCombineModuleMap[data.operation];
|
|
798
|
+
if (incoming?.length > 1) {
|
|
799
|
+
const module2 = new ModuleFactory(incoming[0].module, incoming[1].module);
|
|
800
|
+
updateComputedData(id, { module: module2 });
|
|
801
|
+
}
|
|
802
|
+
}, [data.operation, incoming]);
|
|
803
|
+
const onChange = (0, import_react17.useCallback)((operation) => {
|
|
804
|
+
updateNodeData(id, { operation });
|
|
805
|
+
}, []);
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_layout16.NodeContainer, { id, selected, data, type, children: [
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_layout16.NodeCombobox, { options, selected: data.operation, onChange }),
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_layout16.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
809
|
+
] });
|
|
810
|
+
}
|
|
811
|
+
var noise_combine_node_default = NoiseCombineNode;
|
|
812
|
+
|
|
813
|
+
// src/nodes/modifiers/noise-clamp-node.tsx
|
|
814
|
+
var import_layout17 = require("@awesome-flow/core/layout");
|
|
815
|
+
var import_react18 = require("react");
|
|
816
|
+
var import_core10 = require("@mantine/core");
|
|
817
|
+
var import_hooks18 = require("@awesome-flow/core/hooks");
|
|
818
|
+
var import_modifier2 = require("libnoise-ts/module/modifier");
|
|
819
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
820
|
+
function NoiseClampNode({ id, selected, data, type }) {
|
|
821
|
+
const [lowerBound, setLowerBound] = (0, import_react18.useState)(data.lowerBound);
|
|
822
|
+
const [upperBound, setUpperBound] = (0, import_react18.useState)(data.upperBound);
|
|
823
|
+
const incoming = (0, import_hooks18.useIncomingComputedData)(id);
|
|
824
|
+
const updateNodeData = (0, import_hooks18.useUpdateNodeData)();
|
|
825
|
+
const updateComputedData = (0, import_hooks18.useUpdateNodeComputedData)();
|
|
826
|
+
(0, import_react18.useEffect)(() => {
|
|
827
|
+
if (incoming?.length) {
|
|
828
|
+
const module2 = new import_modifier2.Clamp(incoming[0].module, lowerBound, upperBound);
|
|
829
|
+
updateComputedData(id, { module: module2 });
|
|
830
|
+
}
|
|
831
|
+
updateNodeData(id, { lowerBound, upperBound });
|
|
832
|
+
}, [incoming, lowerBound, upperBound]);
|
|
833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_layout17.NodeContainer, { id, selected, data, type, children: [
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core10.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_core10.Group, { children: [
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
836
|
+
import_core10.NumberInput,
|
|
837
|
+
{
|
|
838
|
+
size: "xs",
|
|
839
|
+
w: 100,
|
|
840
|
+
value: lowerBound,
|
|
841
|
+
onChange: (e) => setLowerBound(Number(e)),
|
|
842
|
+
step: 0.1
|
|
843
|
+
}
|
|
844
|
+
),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
846
|
+
import_core10.NumberInput,
|
|
847
|
+
{
|
|
848
|
+
size: "xs",
|
|
849
|
+
w: 100,
|
|
850
|
+
value: upperBound,
|
|
851
|
+
onChange: (e) => setUpperBound(Number(e)),
|
|
852
|
+
step: 0.1
|
|
853
|
+
}
|
|
854
|
+
)
|
|
855
|
+
] }) }),
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_layout17.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
857
|
+
] });
|
|
858
|
+
}
|
|
859
|
+
var noise_clamp_node_default = NoiseClampNode;
|
|
860
|
+
|
|
861
|
+
// src/nodes/modifiers/noise-abs-node.tsx
|
|
862
|
+
var import_layout18 = require("@awesome-flow/core/layout");
|
|
863
|
+
var import_react19 = require("react");
|
|
864
|
+
var import_hooks19 = require("@awesome-flow/core/hooks");
|
|
865
|
+
var import_modifier3 = require("libnoise-ts/module/modifier");
|
|
866
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
867
|
+
function NoiseAbsNode({ id, selected, data, type }) {
|
|
868
|
+
const incoming = (0, import_hooks19.useIncomingComputedData)(id);
|
|
869
|
+
const updateComputedData = (0, import_hooks19.useUpdateNodeComputedData)();
|
|
870
|
+
(0, import_react19.useEffect)(() => {
|
|
871
|
+
if (incoming?.length > 0) {
|
|
872
|
+
const module2 = new import_modifier3.Abs(incoming[0].module);
|
|
873
|
+
updateComputedData(id, { module: module2 });
|
|
874
|
+
}
|
|
875
|
+
}, [incoming]);
|
|
876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_layout18.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_layout18.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" }) });
|
|
877
|
+
}
|
|
878
|
+
var noise_abs_node_default = NoiseAbsNode;
|
|
879
|
+
|
|
880
|
+
// src/nodes/output/noise-output-node.tsx
|
|
881
|
+
var import_layout19 = require("@awesome-flow/core/layout");
|
|
882
|
+
var import_hooks20 = require("@awesome-flow/core/hooks");
|
|
883
|
+
var import_core11 = require("@mantine/core");
|
|
884
|
+
var import_react20 = require("react");
|
|
885
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
886
|
+
function NoiseOutputNode({ id, selected, data, type }) {
|
|
887
|
+
const [generating, setGenerating] = (0, import_react20.useState)(false);
|
|
888
|
+
const updateComputedData = (0, import_hooks20.useUpdateNodeComputedData)();
|
|
889
|
+
const incomingModules = (0, import_hooks20.useIncomingComputedData)(id, 8 /* module */);
|
|
890
|
+
const incomingPositions = (0, import_hooks20.useIncomingComputedData)(
|
|
891
|
+
id,
|
|
892
|
+
4 /* position */
|
|
893
|
+
);
|
|
894
|
+
(0, import_react20.useEffect)(() => {
|
|
895
|
+
if (incomingPositions?.length && incomingModules?.length) {
|
|
896
|
+
const { module: module2 } = incomingModules[0];
|
|
897
|
+
if (module2) {
|
|
898
|
+
setGenerating(true);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}, [incomingModules, incomingPositions]);
|
|
902
|
+
(0, import_react20.useEffect)(() => {
|
|
903
|
+
if (incomingPositions?.length && incomingModules?.length) {
|
|
904
|
+
const { module: module2 } = incomingModules[0];
|
|
905
|
+
if (module2 && generating) {
|
|
906
|
+
const noise = [];
|
|
907
|
+
for (const input of incomingPositions) {
|
|
908
|
+
for (const position of input.positions) {
|
|
909
|
+
const value = module2.getValue(position.x, position.y, position.z);
|
|
910
|
+
noise.push({
|
|
911
|
+
position,
|
|
912
|
+
value
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
console.log("SET COMPUTED DATA");
|
|
917
|
+
updateComputedData(id, { noise, module: module2 });
|
|
918
|
+
setGenerating(false);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}, [generating]);
|
|
922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_layout19.NodeContainer, { id, selected, data, type, children: [
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core11.Box, { pos: "relative", children: [
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
925
|
+
import_core11.LoadingOverlay,
|
|
926
|
+
{
|
|
927
|
+
visible: generating,
|
|
928
|
+
zIndex: 1e3,
|
|
929
|
+
overlayProps: { radius: "sm", blur: 2 }
|
|
930
|
+
}
|
|
931
|
+
),
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core11.Stack, { children: [
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core11.Group, { children: [
|
|
934
|
+
"Position Inputs: ",
|
|
935
|
+
incomingPositions?.length
|
|
936
|
+
] }),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core11.Group, { children: [
|
|
938
|
+
"Module Inputs: ",
|
|
939
|
+
incomingModules?.length
|
|
940
|
+
] })
|
|
941
|
+
] })
|
|
942
|
+
] }),
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_layout19.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
944
|
+
] });
|
|
945
|
+
}
|
|
946
|
+
var noise_output_node_default = NoiseOutputNode;
|
|
947
|
+
|
|
948
|
+
// src/nodes/modifiers/noise-curve-node.tsx
|
|
949
|
+
var import_layout20 = require("@awesome-flow/core/layout");
|
|
950
|
+
var import_core12 = require("@mantine/core");
|
|
951
|
+
var import_hooks21 = require("@awesome-flow/core/hooks");
|
|
952
|
+
|
|
953
|
+
// ../../node_modules/@mantine/form/esm/use-form.mjs
|
|
954
|
+
var import_react27 = require("react");
|
|
955
|
+
|
|
956
|
+
// ../../node_modules/@mantine/form/esm/actions/actions.mjs
|
|
957
|
+
var import_react21 = require("react");
|
|
958
|
+
function validateFormName(name) {
|
|
959
|
+
if (!/^[0-9a-zA-Z-]+$/.test(name)) {
|
|
960
|
+
throw new Error(
|
|
961
|
+
`[@mantine/use-form] Form name "${name}" is invalid, it should contain only letters, numbers and dashes`
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
var useIsomorphicEffect = typeof window !== "undefined" ? import_react21.useLayoutEffect : import_react21.useEffect;
|
|
966
|
+
function useFormEvent(eventKey, handler) {
|
|
967
|
+
useIsomorphicEffect(() => {
|
|
968
|
+
if (eventKey) {
|
|
969
|
+
window.addEventListener(eventKey, handler);
|
|
970
|
+
return () => window.removeEventListener(eventKey, handler);
|
|
971
|
+
}
|
|
972
|
+
return void 0;
|
|
973
|
+
}, [eventKey]);
|
|
974
|
+
}
|
|
975
|
+
function useFormActions(name, form) {
|
|
976
|
+
if (name) {
|
|
977
|
+
validateFormName(name);
|
|
978
|
+
}
|
|
979
|
+
useFormEvent(
|
|
980
|
+
`mantine-form:${name}:set-field-value`,
|
|
981
|
+
(event) => form.setFieldValue(event.detail.path, event.detail.value)
|
|
982
|
+
);
|
|
983
|
+
useFormEvent(
|
|
984
|
+
`mantine-form:${name}:set-values`,
|
|
985
|
+
(event) => form.setValues(event.detail)
|
|
986
|
+
);
|
|
987
|
+
useFormEvent(
|
|
988
|
+
`mantine-form:${name}:set-initial-values`,
|
|
989
|
+
(event) => form.setInitialValues(event.detail)
|
|
990
|
+
);
|
|
991
|
+
useFormEvent(
|
|
992
|
+
`mantine-form:${name}:set-errors`,
|
|
993
|
+
(event) => form.setErrors(event.detail)
|
|
994
|
+
);
|
|
995
|
+
useFormEvent(
|
|
996
|
+
`mantine-form:${name}:set-field-error`,
|
|
997
|
+
(event) => form.setFieldError(event.detail.path, event.detail.error)
|
|
998
|
+
);
|
|
999
|
+
useFormEvent(
|
|
1000
|
+
`mantine-form:${name}:clear-field-error`,
|
|
1001
|
+
(event) => form.clearFieldError(event.detail)
|
|
1002
|
+
);
|
|
1003
|
+
useFormEvent(`mantine-form:${name}:clear-errors`, form.clearErrors);
|
|
1004
|
+
useFormEvent(`mantine-form:${name}:reset`, form.reset);
|
|
1005
|
+
useFormEvent(`mantine-form:${name}:validate`, form.validate);
|
|
1006
|
+
useFormEvent(
|
|
1007
|
+
`mantine-form:${name}:validate-field`,
|
|
1008
|
+
(event) => form.validateField(event.detail)
|
|
1009
|
+
);
|
|
1010
|
+
useFormEvent(
|
|
1011
|
+
`mantine-form:${name}:reorder-list-item`,
|
|
1012
|
+
(event) => form.reorderListItem(event.detail.path, event.detail.payload)
|
|
1013
|
+
);
|
|
1014
|
+
useFormEvent(
|
|
1015
|
+
`mantine-form:${name}:remove-list-item`,
|
|
1016
|
+
(event) => form.removeListItem(event.detail.path, event.detail.index)
|
|
1017
|
+
);
|
|
1018
|
+
useFormEvent(
|
|
1019
|
+
`mantine-form:${name}:insert-list-item`,
|
|
1020
|
+
(event) => form.insertListItem(event.detail.path, event.detail.item, event.detail.index)
|
|
1021
|
+
);
|
|
1022
|
+
useFormEvent(
|
|
1023
|
+
`mantine-form:${name}:set-dirty`,
|
|
1024
|
+
(event) => form.setDirty(event.detail)
|
|
1025
|
+
);
|
|
1026
|
+
useFormEvent(
|
|
1027
|
+
`mantine-form:${name}:set-touched`,
|
|
1028
|
+
(event) => form.setTouched(event.detail)
|
|
1029
|
+
);
|
|
1030
|
+
useFormEvent(
|
|
1031
|
+
`mantine-form:${name}:reset-dirty`,
|
|
1032
|
+
(event) => form.resetDirty(event.detail)
|
|
1033
|
+
);
|
|
1034
|
+
useFormEvent(`mantine-form:${name}:reset-touched`, form.resetTouched);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// ../../node_modules/@mantine/form/esm/get-input-on-change/get-input-on-change.mjs
|
|
1038
|
+
function getInputOnChange(setValue) {
|
|
1039
|
+
return (val) => {
|
|
1040
|
+
if (!val) {
|
|
1041
|
+
setValue(val);
|
|
1042
|
+
} else if (typeof val === "function") {
|
|
1043
|
+
setValue(val);
|
|
1044
|
+
} else if (typeof val === "object" && "nativeEvent" in val) {
|
|
1045
|
+
const { currentTarget } = val;
|
|
1046
|
+
if (currentTarget instanceof HTMLInputElement) {
|
|
1047
|
+
if (currentTarget.type === "checkbox") {
|
|
1048
|
+
setValue(currentTarget.checked);
|
|
1049
|
+
} else {
|
|
1050
|
+
setValue(currentTarget.value);
|
|
1051
|
+
}
|
|
1052
|
+
} else if (currentTarget instanceof HTMLTextAreaElement || currentTarget instanceof HTMLSelectElement) {
|
|
1053
|
+
setValue(currentTarget.value);
|
|
1054
|
+
}
|
|
1055
|
+
} else {
|
|
1056
|
+
setValue(val);
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
|
|
1062
|
+
var import_react22 = require("react");
|
|
1063
|
+
|
|
1064
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-errors/filter-errors/filter-errors.mjs
|
|
1065
|
+
function filterErrors(errors) {
|
|
1066
|
+
if (errors === null || typeof errors !== "object") {
|
|
1067
|
+
return {};
|
|
1068
|
+
}
|
|
1069
|
+
return Object.keys(errors).reduce((acc, key) => {
|
|
1070
|
+
const errorValue = errors[key];
|
|
1071
|
+
if (errorValue !== void 0 && errorValue !== null && errorValue !== false) {
|
|
1072
|
+
acc[key] = errorValue;
|
|
1073
|
+
}
|
|
1074
|
+
return acc;
|
|
1075
|
+
}, {});
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
|
|
1079
|
+
function useFormErrors(initialErrors) {
|
|
1080
|
+
const [errorsState, setErrorsState] = (0, import_react22.useState)(filterErrors(initialErrors));
|
|
1081
|
+
const setErrors = (0, import_react22.useCallback)((errors) => {
|
|
1082
|
+
setErrorsState(
|
|
1083
|
+
(current) => filterErrors(typeof errors === "function" ? errors(current) : errors)
|
|
1084
|
+
);
|
|
1085
|
+
}, []);
|
|
1086
|
+
const clearErrors = (0, import_react22.useCallback)(() => setErrorsState({}), []);
|
|
1087
|
+
const clearFieldError = (0, import_react22.useCallback)(
|
|
1088
|
+
(path) => {
|
|
1089
|
+
if (errorsState[path] === void 0) {
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
setErrors((current) => {
|
|
1093
|
+
const errors = { ...current };
|
|
1094
|
+
delete errors[path];
|
|
1095
|
+
return errors;
|
|
1096
|
+
});
|
|
1097
|
+
},
|
|
1098
|
+
[errorsState]
|
|
1099
|
+
);
|
|
1100
|
+
const setFieldError = (0, import_react22.useCallback)(
|
|
1101
|
+
(path, error) => {
|
|
1102
|
+
if (error == null || error === false) {
|
|
1103
|
+
clearFieldError(path);
|
|
1104
|
+
} else if (errorsState[path] !== error) {
|
|
1105
|
+
setErrors((current) => ({ ...current, [path]: error }));
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
[errorsState]
|
|
1109
|
+
);
|
|
1110
|
+
return {
|
|
1111
|
+
errorsState,
|
|
1112
|
+
setErrors,
|
|
1113
|
+
clearErrors,
|
|
1114
|
+
setFieldError,
|
|
1115
|
+
clearFieldError
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
|
|
1120
|
+
var import_react23 = require("react");
|
|
1121
|
+
|
|
1122
|
+
// ../../node_modules/@mantine/form/esm/lists/clear-list-state.mjs
|
|
1123
|
+
function clearListState(field, state) {
|
|
1124
|
+
if (state === null || typeof state !== "object") {
|
|
1125
|
+
return {};
|
|
1126
|
+
}
|
|
1127
|
+
const clone = { ...state };
|
|
1128
|
+
Object.keys(state).forEach((errorKey) => {
|
|
1129
|
+
if (errorKey.includes(`${String(field)}.`)) {
|
|
1130
|
+
delete clone[errorKey];
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
return clone;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
// ../../node_modules/@mantine/form/esm/lists/change-error-indices.mjs
|
|
1137
|
+
function getIndexFromKeyAfterPath(key, path) {
|
|
1138
|
+
const split = key.substring(path.length + 1).split(".")[0];
|
|
1139
|
+
return parseInt(split, 10);
|
|
1140
|
+
}
|
|
1141
|
+
function changeErrorIndices(path, index, errors, change) {
|
|
1142
|
+
if (index === void 0) {
|
|
1143
|
+
return errors;
|
|
1144
|
+
}
|
|
1145
|
+
const pathString = `${String(path)}`;
|
|
1146
|
+
let clearedErrors = errors;
|
|
1147
|
+
if (change === -1) {
|
|
1148
|
+
clearedErrors = clearListState(`${pathString}.${index}`, clearedErrors);
|
|
1149
|
+
}
|
|
1150
|
+
const cloned = { ...clearedErrors };
|
|
1151
|
+
const changedKeys = /* @__PURE__ */ new Set();
|
|
1152
|
+
Object.entries(clearedErrors).filter(([key]) => {
|
|
1153
|
+
if (!key.startsWith(`${pathString}.`)) {
|
|
1154
|
+
return false;
|
|
1155
|
+
}
|
|
1156
|
+
const currIndex = getIndexFromKeyAfterPath(key, pathString);
|
|
1157
|
+
if (Number.isNaN(currIndex)) {
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
return currIndex >= index;
|
|
1161
|
+
}).forEach(([key, value]) => {
|
|
1162
|
+
const currIndex = getIndexFromKeyAfterPath(key, pathString);
|
|
1163
|
+
const newKey = key.replace(
|
|
1164
|
+
`${pathString}.${currIndex}`,
|
|
1165
|
+
`${pathString}.${currIndex + change}`
|
|
1166
|
+
);
|
|
1167
|
+
cloned[newKey] = value;
|
|
1168
|
+
changedKeys.add(newKey);
|
|
1169
|
+
if (!changedKeys.has(key)) {
|
|
1170
|
+
delete cloned[key];
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
return cloned;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// ../../node_modules/@mantine/form/esm/lists/reorder-errors.mjs
|
|
1177
|
+
function reorderErrors(path, { from, to }, errors) {
|
|
1178
|
+
const oldKeyStart = `${path}.${from}`;
|
|
1179
|
+
const newKeyStart = `${path}.${to}`;
|
|
1180
|
+
const clone = { ...errors };
|
|
1181
|
+
Object.keys(errors).every((key) => {
|
|
1182
|
+
let oldKey;
|
|
1183
|
+
let newKey;
|
|
1184
|
+
if (key.startsWith(oldKeyStart)) {
|
|
1185
|
+
oldKey = key;
|
|
1186
|
+
newKey = key.replace(oldKeyStart, newKeyStart);
|
|
1187
|
+
}
|
|
1188
|
+
if (key.startsWith(newKeyStart)) {
|
|
1189
|
+
oldKey = key.replace(newKeyStart, oldKeyStart);
|
|
1190
|
+
newKey = key;
|
|
1191
|
+
}
|
|
1192
|
+
if (oldKey && newKey) {
|
|
1193
|
+
const value1 = clone[oldKey];
|
|
1194
|
+
const value2 = clone[newKey];
|
|
1195
|
+
value2 === void 0 ? delete clone[oldKey] : clone[oldKey] = value2;
|
|
1196
|
+
value1 === void 0 ? delete clone[newKey] : clone[newKey] = value1;
|
|
1197
|
+
return false;
|
|
1198
|
+
}
|
|
1199
|
+
return true;
|
|
1200
|
+
});
|
|
1201
|
+
return clone;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
// ../../node_modules/klona/full/index.mjs
|
|
1205
|
+
function set(obj, key, val) {
|
|
1206
|
+
if (typeof val.value === "object")
|
|
1207
|
+
val.value = klona(val.value);
|
|
1208
|
+
if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
|
|
1209
|
+
Object.defineProperty(obj, key, val);
|
|
1210
|
+
} else
|
|
1211
|
+
obj[key] = val.value;
|
|
1212
|
+
}
|
|
1213
|
+
function klona(x) {
|
|
1214
|
+
if (typeof x !== "object")
|
|
1215
|
+
return x;
|
|
1216
|
+
var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
|
|
1217
|
+
if (str === "[object Object]") {
|
|
1218
|
+
tmp = Object.create(x.__proto__ || null);
|
|
1219
|
+
} else if (str === "[object Array]") {
|
|
1220
|
+
tmp = Array(x.length);
|
|
1221
|
+
} else if (str === "[object Set]") {
|
|
1222
|
+
tmp = /* @__PURE__ */ new Set();
|
|
1223
|
+
x.forEach(function(val) {
|
|
1224
|
+
tmp.add(klona(val));
|
|
1225
|
+
});
|
|
1226
|
+
} else if (str === "[object Map]") {
|
|
1227
|
+
tmp = /* @__PURE__ */ new Map();
|
|
1228
|
+
x.forEach(function(val, key) {
|
|
1229
|
+
tmp.set(klona(key), klona(val));
|
|
1230
|
+
});
|
|
1231
|
+
} else if (str === "[object Date]") {
|
|
1232
|
+
tmp = /* @__PURE__ */ new Date(+x);
|
|
1233
|
+
} else if (str === "[object RegExp]") {
|
|
1234
|
+
tmp = new RegExp(x.source, x.flags);
|
|
1235
|
+
} else if (str === "[object DataView]") {
|
|
1236
|
+
tmp = new x.constructor(klona(x.buffer));
|
|
1237
|
+
} else if (str === "[object ArrayBuffer]") {
|
|
1238
|
+
tmp = x.slice(0);
|
|
1239
|
+
} else if (str.slice(-6) === "Array]") {
|
|
1240
|
+
tmp = new x.constructor(x);
|
|
1241
|
+
}
|
|
1242
|
+
if (tmp) {
|
|
1243
|
+
for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
|
|
1244
|
+
set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
|
|
1245
|
+
}
|
|
1246
|
+
for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
|
|
1247
|
+
if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k])
|
|
1248
|
+
continue;
|
|
1249
|
+
set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
return tmp || x;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
// ../../node_modules/@mantine/form/esm/paths/get-splitted-path.mjs
|
|
1256
|
+
function getSplittedPath(path) {
|
|
1257
|
+
if (typeof path !== "string") {
|
|
1258
|
+
return [];
|
|
1259
|
+
}
|
|
1260
|
+
return path.split(".");
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
// ../../node_modules/@mantine/form/esm/paths/get-path.mjs
|
|
1264
|
+
function getPath(path, values) {
|
|
1265
|
+
const splittedPath = getSplittedPath(path);
|
|
1266
|
+
if (splittedPath.length === 0 || typeof values !== "object" || values === null) {
|
|
1267
|
+
return void 0;
|
|
1268
|
+
}
|
|
1269
|
+
let value = values[splittedPath[0]];
|
|
1270
|
+
for (let i = 1; i < splittedPath.length; i += 1) {
|
|
1271
|
+
if (value === void 0) {
|
|
1272
|
+
break;
|
|
1273
|
+
}
|
|
1274
|
+
value = value[splittedPath[i]];
|
|
1275
|
+
}
|
|
1276
|
+
return value;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// ../../node_modules/@mantine/form/esm/paths/set-path.mjs
|
|
1280
|
+
function setPath(path, value, values) {
|
|
1281
|
+
const splittedPath = getSplittedPath(path);
|
|
1282
|
+
if (splittedPath.length === 0) {
|
|
1283
|
+
return values;
|
|
1284
|
+
}
|
|
1285
|
+
const cloned = klona(values);
|
|
1286
|
+
if (splittedPath.length === 1) {
|
|
1287
|
+
cloned[splittedPath[0]] = value;
|
|
1288
|
+
return cloned;
|
|
1289
|
+
}
|
|
1290
|
+
let val = cloned[splittedPath[0]];
|
|
1291
|
+
for (let i = 1; i < splittedPath.length - 1; i += 1) {
|
|
1292
|
+
if (val === void 0) {
|
|
1293
|
+
return cloned;
|
|
1294
|
+
}
|
|
1295
|
+
val = val[splittedPath[i]];
|
|
1296
|
+
}
|
|
1297
|
+
val[splittedPath[splittedPath.length - 1]] = value;
|
|
1298
|
+
return cloned;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// ../../node_modules/@mantine/form/esm/paths/reorder-path.mjs
|
|
1302
|
+
function reorderPath(path, { from, to }, values) {
|
|
1303
|
+
const currentValue = getPath(path, values);
|
|
1304
|
+
if (!Array.isArray(currentValue)) {
|
|
1305
|
+
return values;
|
|
1306
|
+
}
|
|
1307
|
+
const cloned = [...currentValue];
|
|
1308
|
+
const item = currentValue[from];
|
|
1309
|
+
cloned.splice(from, 1);
|
|
1310
|
+
cloned.splice(to, 0, item);
|
|
1311
|
+
return setPath(path, cloned, values);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
// ../../node_modules/@mantine/form/esm/paths/insert-path.mjs
|
|
1315
|
+
function insertPath(path, value, index, values) {
|
|
1316
|
+
const currentValue = getPath(path, values);
|
|
1317
|
+
if (!Array.isArray(currentValue)) {
|
|
1318
|
+
return values;
|
|
1319
|
+
}
|
|
1320
|
+
const cloned = [...currentValue];
|
|
1321
|
+
cloned.splice(typeof index === "number" ? index : cloned.length, 0, value);
|
|
1322
|
+
return setPath(path, cloned, values);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// ../../node_modules/@mantine/form/esm/paths/remove-path.mjs
|
|
1326
|
+
function removePath(path, index, values) {
|
|
1327
|
+
const currentValue = getPath(path, values);
|
|
1328
|
+
if (!Array.isArray(currentValue)) {
|
|
1329
|
+
return values;
|
|
1330
|
+
}
|
|
1331
|
+
return setPath(
|
|
1332
|
+
path,
|
|
1333
|
+
currentValue.filter((_, itemIndex) => itemIndex !== index),
|
|
1334
|
+
values
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
|
|
1339
|
+
function useFormList({
|
|
1340
|
+
$values,
|
|
1341
|
+
$errors,
|
|
1342
|
+
$status
|
|
1343
|
+
}) {
|
|
1344
|
+
const reorderListItem = (0, import_react23.useCallback)((path, payload) => {
|
|
1345
|
+
$status.clearFieldDirty(path);
|
|
1346
|
+
$errors.setErrors((errs) => reorderErrors(path, payload, errs));
|
|
1347
|
+
$values.setValues({
|
|
1348
|
+
values: reorderPath(path, payload, $values.refValues.current),
|
|
1349
|
+
updateState: true
|
|
1350
|
+
});
|
|
1351
|
+
}, []);
|
|
1352
|
+
const removeListItem = (0, import_react23.useCallback)((path, index) => {
|
|
1353
|
+
$status.clearFieldDirty(path);
|
|
1354
|
+
$errors.setErrors((errs) => changeErrorIndices(path, index, errs, -1));
|
|
1355
|
+
$values.setValues({
|
|
1356
|
+
values: removePath(path, index, $values.refValues.current),
|
|
1357
|
+
updateState: true
|
|
1358
|
+
});
|
|
1359
|
+
}, []);
|
|
1360
|
+
const insertListItem = (0, import_react23.useCallback)((path, item, index) => {
|
|
1361
|
+
$status.clearFieldDirty(path);
|
|
1362
|
+
$errors.setErrors((errs) => changeErrorIndices(path, index, errs, 1));
|
|
1363
|
+
$values.setValues({
|
|
1364
|
+
values: insertPath(path, item, index, $values.refValues.current),
|
|
1365
|
+
updateState: true
|
|
1366
|
+
});
|
|
1367
|
+
}, []);
|
|
1368
|
+
return { reorderListItem, removeListItem, insertListItem };
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
|
|
1372
|
+
var import_react24 = require("react");
|
|
1373
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
|
|
1374
|
+
|
|
1375
|
+
// ../../node_modules/@mantine/form/esm/get-status/get-status.mjs
|
|
1376
|
+
function getStatus(status, path) {
|
|
1377
|
+
const paths = Object.keys(status);
|
|
1378
|
+
if (typeof path === "string") {
|
|
1379
|
+
const nestedPaths = paths.filter((statusPath) => statusPath.startsWith(`${path}.`));
|
|
1380
|
+
return status[path] || nestedPaths.some((statusPath) => status[statusPath]) || false;
|
|
1381
|
+
}
|
|
1382
|
+
return paths.some((statusPath) => status[statusPath]);
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
|
|
1386
|
+
function useFormStatus({
|
|
1387
|
+
initialDirty,
|
|
1388
|
+
initialTouched,
|
|
1389
|
+
mode,
|
|
1390
|
+
$values
|
|
1391
|
+
}) {
|
|
1392
|
+
const [touchedState, setTouchedState] = (0, import_react24.useState)(initialTouched);
|
|
1393
|
+
const [dirtyState, setDirtyState] = (0, import_react24.useState)(initialDirty);
|
|
1394
|
+
const touchedRef = (0, import_react24.useRef)(initialTouched);
|
|
1395
|
+
const dirtyRef = (0, import_react24.useRef)(initialDirty);
|
|
1396
|
+
const setTouched = (0, import_react24.useCallback)((values) => {
|
|
1397
|
+
const resolvedValues = typeof values === "function" ? values(touchedRef.current) : values;
|
|
1398
|
+
touchedRef.current = resolvedValues;
|
|
1399
|
+
if (mode === "controlled") {
|
|
1400
|
+
setTouchedState(resolvedValues);
|
|
1401
|
+
}
|
|
1402
|
+
}, []);
|
|
1403
|
+
const setDirty = (0, import_react24.useCallback)((values) => {
|
|
1404
|
+
const resolvedValues = typeof values === "function" ? values(dirtyRef.current) : values;
|
|
1405
|
+
dirtyRef.current = resolvedValues;
|
|
1406
|
+
if (mode === "controlled") {
|
|
1407
|
+
setDirtyState(resolvedValues);
|
|
1408
|
+
}
|
|
1409
|
+
}, []);
|
|
1410
|
+
const resetTouched = (0, import_react24.useCallback)(() => setTouched({}), []);
|
|
1411
|
+
const resetDirty = (values) => {
|
|
1412
|
+
const newSnapshot = values ? { ...values, ...$values.refValues.current } : $values.refValues.current;
|
|
1413
|
+
$values.setValuesSnapshot(newSnapshot);
|
|
1414
|
+
setDirty({});
|
|
1415
|
+
};
|
|
1416
|
+
const setFieldTouched = (0, import_react24.useCallback)((path, touched) => {
|
|
1417
|
+
setTouched((currentTouched) => {
|
|
1418
|
+
if (getStatus(currentTouched, path) === touched) {
|
|
1419
|
+
return currentTouched;
|
|
1420
|
+
}
|
|
1421
|
+
return { ...currentTouched, [path]: touched };
|
|
1422
|
+
});
|
|
1423
|
+
}, []);
|
|
1424
|
+
const setFieldDirty = (0, import_react24.useCallback)((path, dirty) => {
|
|
1425
|
+
setDirty((currentDirty) => {
|
|
1426
|
+
if (getStatus(currentDirty, path) === dirty) {
|
|
1427
|
+
return currentDirty;
|
|
1428
|
+
}
|
|
1429
|
+
return { ...currentDirty, [path]: dirty };
|
|
1430
|
+
});
|
|
1431
|
+
}, []);
|
|
1432
|
+
const isTouched = (0, import_react24.useCallback)(
|
|
1433
|
+
(path) => getStatus(touchedRef.current, path),
|
|
1434
|
+
[]
|
|
1435
|
+
);
|
|
1436
|
+
const clearFieldDirty = (0, import_react24.useCallback)(
|
|
1437
|
+
(path) => setDirty((current) => {
|
|
1438
|
+
if (typeof path !== "string") {
|
|
1439
|
+
return current;
|
|
1440
|
+
}
|
|
1441
|
+
const result = clearListState(path, current);
|
|
1442
|
+
delete result[path];
|
|
1443
|
+
if ((0, import_fast_deep_equal.default)(result, current)) {
|
|
1444
|
+
return current;
|
|
1445
|
+
}
|
|
1446
|
+
return result;
|
|
1447
|
+
}),
|
|
1448
|
+
[]
|
|
1449
|
+
);
|
|
1450
|
+
const isDirty = (0, import_react24.useCallback)((path) => {
|
|
1451
|
+
if (path) {
|
|
1452
|
+
const overriddenValue = getPath(path, dirtyRef.current);
|
|
1453
|
+
if (typeof overriddenValue === "boolean") {
|
|
1454
|
+
return overriddenValue;
|
|
1455
|
+
}
|
|
1456
|
+
const sliceOfValues = getPath(path, $values.refValues.current);
|
|
1457
|
+
const sliceOfInitialValues = getPath(path, $values.valuesSnapshot.current);
|
|
1458
|
+
return !(0, import_fast_deep_equal.default)(sliceOfValues, sliceOfInitialValues);
|
|
1459
|
+
}
|
|
1460
|
+
const isOverridden = Object.keys(dirtyRef.current).length > 0;
|
|
1461
|
+
if (isOverridden) {
|
|
1462
|
+
return getStatus(dirtyRef.current);
|
|
1463
|
+
}
|
|
1464
|
+
return !(0, import_fast_deep_equal.default)($values.refValues.current, $values.valuesSnapshot.current);
|
|
1465
|
+
}, []);
|
|
1466
|
+
const getDirty = (0, import_react24.useCallback)(() => dirtyRef.current, []);
|
|
1467
|
+
const getTouched = (0, import_react24.useCallback)(() => touchedRef.current, []);
|
|
1468
|
+
return {
|
|
1469
|
+
touchedState,
|
|
1470
|
+
dirtyState,
|
|
1471
|
+
touchedRef,
|
|
1472
|
+
dirtyRef,
|
|
1473
|
+
setTouched,
|
|
1474
|
+
setDirty,
|
|
1475
|
+
resetDirty,
|
|
1476
|
+
resetTouched,
|
|
1477
|
+
isTouched,
|
|
1478
|
+
setFieldTouched,
|
|
1479
|
+
setFieldDirty,
|
|
1480
|
+
setTouchedState,
|
|
1481
|
+
setDirtyState,
|
|
1482
|
+
clearFieldDirty,
|
|
1483
|
+
isDirty,
|
|
1484
|
+
getDirty,
|
|
1485
|
+
getTouched
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-values/use-form-values.mjs
|
|
1490
|
+
var import_react25 = require("react");
|
|
1491
|
+
function useFormValues({
|
|
1492
|
+
initialValues,
|
|
1493
|
+
onValuesChange,
|
|
1494
|
+
mode
|
|
1495
|
+
}) {
|
|
1496
|
+
const initialized = (0, import_react25.useRef)(false);
|
|
1497
|
+
const [stateValues, setStateValues] = (0, import_react25.useState)(initialValues || {});
|
|
1498
|
+
const refValues = (0, import_react25.useRef)(stateValues);
|
|
1499
|
+
const valuesSnapshot = (0, import_react25.useRef)(stateValues);
|
|
1500
|
+
const setValues = (0, import_react25.useCallback)(
|
|
1501
|
+
({
|
|
1502
|
+
values,
|
|
1503
|
+
subscribers,
|
|
1504
|
+
updateState = true,
|
|
1505
|
+
mergeWithPreviousValues = true
|
|
1506
|
+
}) => {
|
|
1507
|
+
const previousValues = refValues.current;
|
|
1508
|
+
const resolvedValues = values instanceof Function ? values(refValues.current) : values;
|
|
1509
|
+
const updatedValues = mergeWithPreviousValues ? { ...previousValues, ...resolvedValues } : resolvedValues;
|
|
1510
|
+
refValues.current = updatedValues;
|
|
1511
|
+
updateState && setStateValues(updatedValues);
|
|
1512
|
+
onValuesChange?.(updatedValues, previousValues);
|
|
1513
|
+
subscribers?.filter(Boolean).forEach((subscriber) => subscriber({ updatedValues, previousValues }));
|
|
1514
|
+
},
|
|
1515
|
+
[onValuesChange]
|
|
1516
|
+
);
|
|
1517
|
+
const setFieldValue = (0, import_react25.useCallback)((payload) => {
|
|
1518
|
+
const currentValue = getPath(payload.path, refValues.current);
|
|
1519
|
+
const updatedValue = payload.value instanceof Function ? payload.value(currentValue) : payload.value;
|
|
1520
|
+
if (currentValue !== updatedValue) {
|
|
1521
|
+
const previousValues = refValues.current;
|
|
1522
|
+
const updatedValues = setPath(payload.path, updatedValue, refValues.current);
|
|
1523
|
+
setValues({ values: updatedValues, updateState: payload.updateState });
|
|
1524
|
+
payload.subscribers?.filter(Boolean).forEach(
|
|
1525
|
+
(subscriber) => subscriber({ path: payload.path, updatedValues, previousValues })
|
|
1526
|
+
);
|
|
1527
|
+
}
|
|
1528
|
+
}, []);
|
|
1529
|
+
const setValuesSnapshot = (0, import_react25.useCallback)((payload) => {
|
|
1530
|
+
valuesSnapshot.current = payload;
|
|
1531
|
+
}, []);
|
|
1532
|
+
const initialize = (0, import_react25.useCallback)((values, onInitialize) => {
|
|
1533
|
+
if (!initialized.current) {
|
|
1534
|
+
initialized.current = true;
|
|
1535
|
+
setValues({ values, updateState: mode === "controlled" });
|
|
1536
|
+
setValuesSnapshot(values);
|
|
1537
|
+
onInitialize();
|
|
1538
|
+
}
|
|
1539
|
+
}, []);
|
|
1540
|
+
const resetValues = (0, import_react25.useCallback)(() => {
|
|
1541
|
+
setValues({
|
|
1542
|
+
values: valuesSnapshot.current,
|
|
1543
|
+
updateState: true,
|
|
1544
|
+
mergeWithPreviousValues: false
|
|
1545
|
+
});
|
|
1546
|
+
}, []);
|
|
1547
|
+
const getValues = (0, import_react25.useCallback)(() => refValues.current, []);
|
|
1548
|
+
return {
|
|
1549
|
+
initialized,
|
|
1550
|
+
stateValues,
|
|
1551
|
+
refValues,
|
|
1552
|
+
valuesSnapshot,
|
|
1553
|
+
setValues,
|
|
1554
|
+
setFieldValue,
|
|
1555
|
+
resetValues,
|
|
1556
|
+
setValuesSnapshot,
|
|
1557
|
+
initialize,
|
|
1558
|
+
getValues
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
// ../../node_modules/@mantine/form/esm/hooks/use-form-watch/use-form-watch.mjs
|
|
1563
|
+
var import_react26 = require("react");
|
|
1564
|
+
function useFormWatch({
|
|
1565
|
+
$status
|
|
1566
|
+
}) {
|
|
1567
|
+
const subscribers = (0, import_react26.useRef)(
|
|
1568
|
+
{}
|
|
1569
|
+
);
|
|
1570
|
+
const watch = (0, import_react26.useCallback)((path, callback) => {
|
|
1571
|
+
(0, import_react26.useEffect)(() => {
|
|
1572
|
+
subscribers.current[path] = subscribers.current[path] || [];
|
|
1573
|
+
subscribers.current[path].push(callback);
|
|
1574
|
+
return () => {
|
|
1575
|
+
subscribers.current[path] = subscribers.current[path].filter((cb) => cb !== callback);
|
|
1576
|
+
};
|
|
1577
|
+
}, [callback]);
|
|
1578
|
+
}, []);
|
|
1579
|
+
const getFieldSubscribers = (0, import_react26.useCallback)((path) => {
|
|
1580
|
+
if (!subscribers.current[path]) {
|
|
1581
|
+
return [];
|
|
1582
|
+
}
|
|
1583
|
+
return subscribers.current[path].map(
|
|
1584
|
+
(callback) => (input) => callback({
|
|
1585
|
+
previousValue: getPath(path, input.previousValues),
|
|
1586
|
+
value: getPath(path, input.updatedValues),
|
|
1587
|
+
touched: $status.isTouched(path),
|
|
1588
|
+
dirty: $status.isDirty(path)
|
|
1589
|
+
})
|
|
1590
|
+
);
|
|
1591
|
+
}, []);
|
|
1592
|
+
return {
|
|
1593
|
+
subscribers,
|
|
1594
|
+
watch,
|
|
1595
|
+
getFieldSubscribers
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
// ../../node_modules/@mantine/form/esm/validate/validate-values.mjs
|
|
1600
|
+
function getValidationResults(errors) {
|
|
1601
|
+
const filteredErrors = filterErrors(errors);
|
|
1602
|
+
return { hasErrors: Object.keys(filteredErrors).length > 0, errors: filteredErrors };
|
|
1603
|
+
}
|
|
1604
|
+
function validateRulesRecord(rules, values, path = "", errors = {}) {
|
|
1605
|
+
if (typeof rules !== "object" || rules === null) {
|
|
1606
|
+
return errors;
|
|
1607
|
+
}
|
|
1608
|
+
return Object.keys(rules).reduce((acc, ruleKey) => {
|
|
1609
|
+
const rule = rules[ruleKey];
|
|
1610
|
+
const rulePath = `${path === "" ? "" : `${path}.`}${ruleKey}`;
|
|
1611
|
+
const value = getPath(rulePath, values);
|
|
1612
|
+
let arrayValidation = false;
|
|
1613
|
+
if (typeof rule === "function") {
|
|
1614
|
+
acc[rulePath] = rule(value, values, rulePath);
|
|
1615
|
+
}
|
|
1616
|
+
if (typeof rule === "object" && Array.isArray(value)) {
|
|
1617
|
+
arrayValidation = true;
|
|
1618
|
+
value.forEach(
|
|
1619
|
+
(_item, index) => validateRulesRecord(rule, values, `${rulePath}.${index}`, acc)
|
|
1620
|
+
);
|
|
1621
|
+
}
|
|
1622
|
+
if (typeof rule === "object" && typeof value === "object" && value !== null) {
|
|
1623
|
+
if (!arrayValidation) {
|
|
1624
|
+
validateRulesRecord(rule, values, rulePath, acc);
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
return acc;
|
|
1628
|
+
}, errors);
|
|
1629
|
+
}
|
|
1630
|
+
function validateValues(validate, values) {
|
|
1631
|
+
if (typeof validate === "function") {
|
|
1632
|
+
return getValidationResults(validate(values));
|
|
1633
|
+
}
|
|
1634
|
+
return getValidationResults(validateRulesRecord(validate, values));
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
// ../../node_modules/@mantine/form/esm/validate/validate-field-value.mjs
|
|
1638
|
+
function validateFieldValue(path, rules, values) {
|
|
1639
|
+
if (typeof path !== "string") {
|
|
1640
|
+
return { hasError: false, error: null };
|
|
1641
|
+
}
|
|
1642
|
+
const results = validateValues(rules, values);
|
|
1643
|
+
const pathInError = Object.keys(results.errors).find(
|
|
1644
|
+
(errorKey) => path.split(".").every((pathPart, i) => pathPart === errorKey.split(".")[i])
|
|
1645
|
+
);
|
|
1646
|
+
return { hasError: !!pathInError, error: pathInError ? results.errors[pathInError] : null };
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
// ../../node_modules/@mantine/form/esm/form-index.mjs
|
|
1650
|
+
var FORM_INDEX = "__MANTINE_FORM_INDEX__";
|
|
1651
|
+
|
|
1652
|
+
// ../../node_modules/@mantine/form/esm/validate/should-validate-on-change.mjs
|
|
1653
|
+
function shouldValidateOnChange(path, validateInputOnChange) {
|
|
1654
|
+
if (!validateInputOnChange) {
|
|
1655
|
+
return false;
|
|
1656
|
+
}
|
|
1657
|
+
if (typeof validateInputOnChange === "boolean") {
|
|
1658
|
+
return validateInputOnChange;
|
|
1659
|
+
}
|
|
1660
|
+
if (Array.isArray(validateInputOnChange)) {
|
|
1661
|
+
return validateInputOnChange.includes(path.replace(/[.][0-9]/g, `.${FORM_INDEX}`));
|
|
1662
|
+
}
|
|
1663
|
+
return false;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
// ../../node_modules/@mantine/form/esm/use-form.mjs
|
|
1667
|
+
function useForm({
|
|
1668
|
+
name,
|
|
1669
|
+
mode = "controlled",
|
|
1670
|
+
initialValues,
|
|
1671
|
+
initialErrors = {},
|
|
1672
|
+
initialDirty = {},
|
|
1673
|
+
initialTouched = {},
|
|
1674
|
+
clearInputErrorOnChange = true,
|
|
1675
|
+
validateInputOnChange = false,
|
|
1676
|
+
validateInputOnBlur = false,
|
|
1677
|
+
onValuesChange,
|
|
1678
|
+
transformValues = (values) => values,
|
|
1679
|
+
enhanceGetInputProps,
|
|
1680
|
+
validate: rules
|
|
1681
|
+
} = {}) {
|
|
1682
|
+
const $errors = useFormErrors(initialErrors);
|
|
1683
|
+
const $values = useFormValues({ initialValues, onValuesChange, mode });
|
|
1684
|
+
const $status = useFormStatus({ initialDirty, initialTouched, $values, mode });
|
|
1685
|
+
const $list = useFormList({ $values, $errors, $status });
|
|
1686
|
+
const $watch = useFormWatch({ $status });
|
|
1687
|
+
const [formKey, setFormKey] = (0, import_react27.useState)(0);
|
|
1688
|
+
const [fieldKeys, setFieldKeys] = (0, import_react27.useState)({});
|
|
1689
|
+
const reset = (0, import_react27.useCallback)(() => {
|
|
1690
|
+
$values.resetValues();
|
|
1691
|
+
$errors.clearErrors();
|
|
1692
|
+
$status.resetDirty();
|
|
1693
|
+
$status.resetTouched();
|
|
1694
|
+
mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
|
|
1695
|
+
}, []);
|
|
1696
|
+
const initialize = (0, import_react27.useCallback)((values) => {
|
|
1697
|
+
$values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
|
|
1698
|
+
}, []);
|
|
1699
|
+
const setFieldValue = (0, import_react27.useCallback)(
|
|
1700
|
+
(path, value, options3) => {
|
|
1701
|
+
const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
|
|
1702
|
+
$status.clearFieldDirty(path);
|
|
1703
|
+
$status.setFieldTouched(path, true);
|
|
1704
|
+
!shouldValidate && clearInputErrorOnChange && $errors.clearFieldError(path);
|
|
1705
|
+
$values.setFieldValue({
|
|
1706
|
+
path,
|
|
1707
|
+
value,
|
|
1708
|
+
updateState: mode === "controlled",
|
|
1709
|
+
subscribers: [
|
|
1710
|
+
...$watch.getFieldSubscribers(path),
|
|
1711
|
+
shouldValidate ? (payload) => {
|
|
1712
|
+
const validationResults = validateFieldValue(path, rules, payload.updatedValues);
|
|
1713
|
+
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
1714
|
+
} : null,
|
|
1715
|
+
options3?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
|
|
1716
|
+
...keys,
|
|
1717
|
+
[path]: (keys[path] || 0) + 1
|
|
1718
|
+
})) : null
|
|
1719
|
+
]
|
|
1720
|
+
});
|
|
1721
|
+
},
|
|
1722
|
+
[onValuesChange, rules]
|
|
1723
|
+
);
|
|
1724
|
+
const setValues = (0, import_react27.useCallback)(
|
|
1725
|
+
(values) => {
|
|
1726
|
+
const previousValues = $values.refValues.current;
|
|
1727
|
+
$values.setValues({ values, updateState: mode === "controlled" });
|
|
1728
|
+
clearInputErrorOnChange && $errors.clearErrors();
|
|
1729
|
+
mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
|
|
1730
|
+
Object.keys($watch.subscribers.current).forEach((path) => {
|
|
1731
|
+
const value = getPath(path, $values.refValues.current);
|
|
1732
|
+
const previousValue = getPath(path, previousValues);
|
|
1733
|
+
if (value !== previousValue) {
|
|
1734
|
+
$watch.getFieldSubscribers(path).forEach((cb) => cb({ previousValues, updatedValues: $values.refValues.current }));
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
},
|
|
1738
|
+
[onValuesChange, clearInputErrorOnChange]
|
|
1739
|
+
);
|
|
1740
|
+
const validate = (0, import_react27.useCallback)(() => {
|
|
1741
|
+
const results = validateValues(rules, $values.refValues.current);
|
|
1742
|
+
$errors.setErrors(results.errors);
|
|
1743
|
+
return results;
|
|
1744
|
+
}, [rules]);
|
|
1745
|
+
const validateField = (0, import_react27.useCallback)(
|
|
1746
|
+
(path) => {
|
|
1747
|
+
const results = validateFieldValue(path, rules, $values.refValues.current);
|
|
1748
|
+
results.hasError ? $errors.setFieldError(path, results.error) : $errors.clearFieldError(path);
|
|
1749
|
+
return results;
|
|
1750
|
+
},
|
|
1751
|
+
[rules]
|
|
1752
|
+
);
|
|
1753
|
+
const getInputProps = (path, { type = "input", withError = true, withFocus = true, ...otherOptions } = {}) => {
|
|
1754
|
+
const onChange = getInputOnChange(
|
|
1755
|
+
(value) => setFieldValue(path, value, { forceUpdate: false })
|
|
1756
|
+
);
|
|
1757
|
+
const payload = { onChange };
|
|
1758
|
+
if (withError) {
|
|
1759
|
+
payload.error = $errors.errorsState[path];
|
|
1760
|
+
}
|
|
1761
|
+
if (type === "checkbox") {
|
|
1762
|
+
payload[mode === "controlled" ? "checked" : "defaultChecked"] = getPath(
|
|
1763
|
+
path,
|
|
1764
|
+
$values.refValues.current
|
|
1765
|
+
);
|
|
1766
|
+
} else {
|
|
1767
|
+
payload[mode === "controlled" ? "value" : "defaultValue"] = getPath(
|
|
1768
|
+
path,
|
|
1769
|
+
$values.refValues.current
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
if (withFocus) {
|
|
1773
|
+
payload.onFocus = () => $status.setFieldTouched(path, true);
|
|
1774
|
+
payload.onBlur = () => {
|
|
1775
|
+
if (shouldValidateOnChange(path, validateInputOnBlur)) {
|
|
1776
|
+
const validationResults = validateFieldValue(path, rules, $values.refValues.current);
|
|
1777
|
+
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
return Object.assign(
|
|
1782
|
+
payload,
|
|
1783
|
+
enhanceGetInputProps?.({
|
|
1784
|
+
inputProps: payload,
|
|
1785
|
+
field: path,
|
|
1786
|
+
options: { type, withError, withFocus, ...otherOptions },
|
|
1787
|
+
form
|
|
1788
|
+
})
|
|
1789
|
+
);
|
|
1790
|
+
};
|
|
1791
|
+
const onSubmit = (handleSubmit, handleValidationFailure) => (event) => {
|
|
1792
|
+
event?.preventDefault();
|
|
1793
|
+
const results = validate();
|
|
1794
|
+
if (results.hasErrors) {
|
|
1795
|
+
handleValidationFailure?.(results.errors, $values.refValues.current, event);
|
|
1796
|
+
} else {
|
|
1797
|
+
handleSubmit?.(transformValues($values.refValues.current), event);
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
const getTransformedValues = (input) => transformValues(input || $values.refValues.current);
|
|
1801
|
+
const onReset = (0, import_react27.useCallback)((event) => {
|
|
1802
|
+
event.preventDefault();
|
|
1803
|
+
reset();
|
|
1804
|
+
}, []);
|
|
1805
|
+
const isValid = (0, import_react27.useCallback)(
|
|
1806
|
+
(path) => path ? !validateFieldValue(path, rules, $values.refValues.current).hasError : !validateValues(rules, $values.refValues.current).hasErrors,
|
|
1807
|
+
[rules]
|
|
1808
|
+
);
|
|
1809
|
+
const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
|
|
1810
|
+
const form = {
|
|
1811
|
+
watch: $watch.watch,
|
|
1812
|
+
initialized: $values.initialized.current,
|
|
1813
|
+
values: $values.stateValues,
|
|
1814
|
+
getValues: $values.getValues,
|
|
1815
|
+
setInitialValues: $values.setValuesSnapshot,
|
|
1816
|
+
initialize,
|
|
1817
|
+
setValues,
|
|
1818
|
+
setFieldValue,
|
|
1819
|
+
errors: $errors.errorsState,
|
|
1820
|
+
setErrors: $errors.setErrors,
|
|
1821
|
+
setFieldError: $errors.setFieldError,
|
|
1822
|
+
clearFieldError: $errors.clearFieldError,
|
|
1823
|
+
clearErrors: $errors.clearErrors,
|
|
1824
|
+
resetDirty: $status.resetDirty,
|
|
1825
|
+
setTouched: $status.setTouched,
|
|
1826
|
+
setDirty: $status.setDirty,
|
|
1827
|
+
isTouched: $status.isTouched,
|
|
1828
|
+
resetTouched: $status.resetTouched,
|
|
1829
|
+
isDirty: $status.isDirty,
|
|
1830
|
+
getTouched: $status.getTouched,
|
|
1831
|
+
getDirty: $status.getDirty,
|
|
1832
|
+
reorderListItem: $list.reorderListItem,
|
|
1833
|
+
insertListItem: $list.insertListItem,
|
|
1834
|
+
removeListItem: $list.removeListItem,
|
|
1835
|
+
reset,
|
|
1836
|
+
validate,
|
|
1837
|
+
validateField,
|
|
1838
|
+
getInputProps,
|
|
1839
|
+
onSubmit,
|
|
1840
|
+
onReset,
|
|
1841
|
+
isValid,
|
|
1842
|
+
getTransformedValues,
|
|
1843
|
+
key
|
|
1844
|
+
};
|
|
1845
|
+
useFormActions(name, form);
|
|
1846
|
+
return form;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// src/nodes/modifiers/noise-curve-node.tsx
|
|
1850
|
+
var import_react28 = require("react");
|
|
1851
|
+
var import_modifier4 = require("libnoise-ts/module/modifier");
|
|
1852
|
+
var import_util = require("libnoise-ts/util");
|
|
1853
|
+
var import_icons_react2 = require("@tabler/icons-react");
|
|
1854
|
+
var import_hooks22 = require("@mantine/hooks");
|
|
1855
|
+
var import_abstract3 = require("@awesome-flow/core/abstract");
|
|
1856
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1857
|
+
function NoiseCurveNode({ id, selected, data, type }) {
|
|
1858
|
+
const incoming = (0, import_hooks21.useIncomingComputedData)(id);
|
|
1859
|
+
const updateNodeData = (0, import_hooks21.useUpdateNodeData)();
|
|
1860
|
+
const updateComputedData = (0, import_hooks21.useUpdateNodeComputedData)();
|
|
1861
|
+
const [values, setValues] = (0, import_react28.useState)([]);
|
|
1862
|
+
const form = useForm({
|
|
1863
|
+
mode: "uncontrolled",
|
|
1864
|
+
initialValues: {
|
|
1865
|
+
points: []
|
|
1866
|
+
},
|
|
1867
|
+
validateInputOnChange: [`points.${FORM_INDEX}.input`],
|
|
1868
|
+
clearInputErrorOnChange: true,
|
|
1869
|
+
validate: {
|
|
1870
|
+
points: {
|
|
1871
|
+
input: (value, values2) => {
|
|
1872
|
+
const counts = {};
|
|
1873
|
+
values2.points.forEach((x) => {
|
|
1874
|
+
counts[x.input] = (counts[x.input] || 0) + 1;
|
|
1875
|
+
});
|
|
1876
|
+
return counts[value] > 1;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
},
|
|
1880
|
+
onValuesChange: (0, import_react28.useCallback)((values2) => {
|
|
1881
|
+
if (form.isValid()) {
|
|
1882
|
+
const points = values2.points.map((v) => ({ input: v.input, output: v.output }));
|
|
1883
|
+
setValues(points);
|
|
1884
|
+
updateNodeData(id, { points });
|
|
1885
|
+
}
|
|
1886
|
+
form.validate();
|
|
1887
|
+
}, [])
|
|
1888
|
+
});
|
|
1889
|
+
(0, import_react28.useEffect)(() => {
|
|
1890
|
+
const points = data.points?.length ? data.points.map((v) => ({ input: v.input, output: v.output, key: (0, import_hooks22.randomId)() })) : [1, 2, 3, 4].map(() => ({ input: 0, output: 0, key: (0, import_hooks22.randomId)() }));
|
|
1891
|
+
form.initialize({ points });
|
|
1892
|
+
}, []);
|
|
1893
|
+
(0, import_react28.useEffect)(() => {
|
|
1894
|
+
if (incoming?.length && values?.length >= 4) {
|
|
1895
|
+
const module2 = new import_modifier4.Curve(
|
|
1896
|
+
incoming[0].module,
|
|
1897
|
+
values.map((p) => new import_util.Tuple(p.input, p.output))
|
|
1898
|
+
);
|
|
1899
|
+
updateComputedData(id, { module: module2 });
|
|
1900
|
+
}
|
|
1901
|
+
}, [values, incoming]);
|
|
1902
|
+
const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_core12.Group, { mt: "xs", children: [
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1904
|
+
import_core12.NumberInput,
|
|
1905
|
+
{
|
|
1906
|
+
size: "xs",
|
|
1907
|
+
w: 100,
|
|
1908
|
+
placeholder: "Input Value",
|
|
1909
|
+
...form.getInputProps(`points.${index}.input`),
|
|
1910
|
+
step: 0.1
|
|
1911
|
+
},
|
|
1912
|
+
form.key(`points.${index}.input`)
|
|
1913
|
+
),
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1915
|
+
import_core12.NumberInput,
|
|
1916
|
+
{
|
|
1917
|
+
size: "xs",
|
|
1918
|
+
w: 100,
|
|
1919
|
+
placeholder: "Output Value",
|
|
1920
|
+
...form.getInputProps(`points.${index}.output`),
|
|
1921
|
+
step: 0.1
|
|
1922
|
+
},
|
|
1923
|
+
form.key(`points.${index}.output`)
|
|
1924
|
+
),
|
|
1925
|
+
data.state === import_abstract3.NodeState.edit && values.length > 4 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1926
|
+
import_core12.ActionIcon,
|
|
1927
|
+
{
|
|
1928
|
+
color: "red",
|
|
1929
|
+
variant: "outline",
|
|
1930
|
+
size: "sm",
|
|
1931
|
+
onClick: () => form.removeListItem("points", index),
|
|
1932
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_react2.IconX, { size: "1rem" })
|
|
1933
|
+
}
|
|
1934
|
+
)
|
|
1935
|
+
] }, item.key));
|
|
1936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_layout20.NodeContainer, { id, selected, type, data, children: [
|
|
1937
|
+
fields,
|
|
1938
|
+
data.state === import_abstract3.NodeState.edit && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_core12.Space, { h: 10 }),
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1941
|
+
import_core12.Button,
|
|
1942
|
+
{
|
|
1943
|
+
variant: "outline",
|
|
1944
|
+
size: "xs",
|
|
1945
|
+
fullWidth: true,
|
|
1946
|
+
onClick: () => form.insertListItem("points", { input: 0, output: 0, key: (0, import_hooks22.randomId)() }),
|
|
1947
|
+
children: "Add control point"
|
|
1948
|
+
}
|
|
1949
|
+
)
|
|
1950
|
+
] }),
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_layout20.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
1952
|
+
] });
|
|
1953
|
+
}
|
|
1954
|
+
var noise_curve_node_default = NoiseCurveNode;
|
|
1955
|
+
|
|
1956
|
+
// src/nodes/modifiers/noise-exponent-node.tsx
|
|
1957
|
+
var import_layout21 = require("@awesome-flow/core/layout");
|
|
1958
|
+
var import_react29 = require("react");
|
|
1959
|
+
var import_core13 = require("@mantine/core");
|
|
1960
|
+
var import_hooks23 = require("@awesome-flow/core/hooks");
|
|
1961
|
+
var import_modifier5 = require("libnoise-ts/module/modifier");
|
|
1962
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1963
|
+
function NoiseExponentNode({ id, selected, data, type }) {
|
|
1964
|
+
const [exponent, setExponent] = (0, import_react29.useState)(data.exponent);
|
|
1965
|
+
const incoming = (0, import_hooks23.useIncomingComputedData)(id);
|
|
1966
|
+
const updateNodeData = (0, import_hooks23.useUpdateNodeData)();
|
|
1967
|
+
const updateComputedData = (0, import_hooks23.useUpdateNodeComputedData)();
|
|
1968
|
+
(0, import_react29.useEffect)(() => {
|
|
1969
|
+
if (incoming?.length > 0) {
|
|
1970
|
+
const module2 = new import_modifier5.Exponent(incoming[0].module, exponent);
|
|
1971
|
+
updateComputedData(id, { module: module2 });
|
|
1972
|
+
}
|
|
1973
|
+
updateNodeData(id, { exponent });
|
|
1974
|
+
}, [incoming, exponent]);
|
|
1975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_layout21.NodeContainer, { id, selected, data, type, children: [
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_core13.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_core13.Group, { children: [
|
|
1977
|
+
"Exponent:",
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1979
|
+
import_core13.NumberInput,
|
|
1980
|
+
{
|
|
1981
|
+
size: "xs",
|
|
1982
|
+
value: exponent,
|
|
1983
|
+
onChange: (e) => setExponent(Number(e)),
|
|
1984
|
+
step: 0.1
|
|
1985
|
+
}
|
|
1986
|
+
)
|
|
1987
|
+
] }) }),
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_layout21.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
1989
|
+
] });
|
|
1990
|
+
}
|
|
1991
|
+
var noise_exponent_node_default = NoiseExponentNode;
|
|
1992
|
+
|
|
1993
|
+
// src/nodes/modifiers/noise-invert-node.tsx
|
|
1994
|
+
var import_layout22 = require("@awesome-flow/core/layout");
|
|
1995
|
+
var import_react30 = require("react");
|
|
1996
|
+
var import_hooks24 = require("@awesome-flow/core/hooks");
|
|
1997
|
+
var import_modifier6 = require("libnoise-ts/module/modifier");
|
|
1998
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1999
|
+
function NoiseInvertNode({ id, selected, data, type }) {
|
|
2000
|
+
const incoming = (0, import_hooks24.useIncomingComputedData)(id);
|
|
2001
|
+
const updateComputedData = (0, import_hooks24.useUpdateNodeComputedData)();
|
|
2002
|
+
(0, import_react30.useEffect)(() => {
|
|
2003
|
+
if (incoming?.length > 0) {
|
|
2004
|
+
const module2 = new import_modifier6.Invert(incoming[0].module);
|
|
2005
|
+
updateComputedData(id, { module: module2 });
|
|
2006
|
+
}
|
|
2007
|
+
}, [incoming]);
|
|
2008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_layout22.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_layout22.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" }) });
|
|
2009
|
+
}
|
|
2010
|
+
var noise_invert_node_default = NoiseInvertNode;
|
|
2011
|
+
|
|
2012
|
+
// src/nodes/modifiers/noise-scale-bias-node.tsx
|
|
2013
|
+
var import_layout23 = require("@awesome-flow/core/layout");
|
|
2014
|
+
var import_react31 = require("react");
|
|
2015
|
+
var import_core14 = require("@mantine/core");
|
|
2016
|
+
var import_hooks25 = require("@awesome-flow/core/hooks");
|
|
2017
|
+
var import_modifier7 = require("libnoise-ts/module/modifier");
|
|
2018
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2019
|
+
function NoiseScaleBiasNode({ id, selected, data, type }) {
|
|
2020
|
+
const [scale, setScale] = (0, import_react31.useState)(data.scale);
|
|
2021
|
+
const [bias, setBias] = (0, import_react31.useState)(data.bias);
|
|
2022
|
+
const incoming = (0, import_hooks25.useIncomingComputedData)(id);
|
|
2023
|
+
const updateNodeData = (0, import_hooks25.useUpdateNodeData)();
|
|
2024
|
+
const updateComputedData = (0, import_hooks25.useUpdateNodeComputedData)();
|
|
2025
|
+
(0, import_react31.useEffect)(() => {
|
|
2026
|
+
if (incoming?.length > 0) {
|
|
2027
|
+
const module2 = new import_modifier7.ScaleBias(incoming[0].module, scale, bias);
|
|
2028
|
+
updateComputedData(id, { module: module2 });
|
|
2029
|
+
}
|
|
2030
|
+
updateNodeData(id, { scale, bias });
|
|
2031
|
+
}, [incoming, scale, bias]);
|
|
2032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_layout23.NodeContainer, { id, selected, data, type, children: [
|
|
2033
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_core14.Stack, { children: [
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_core14.Group, { children: [
|
|
2035
|
+
"Scale:",
|
|
2036
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2037
|
+
import_core14.NumberInput,
|
|
2038
|
+
{
|
|
2039
|
+
size: "xs",
|
|
2040
|
+
w: 100,
|
|
2041
|
+
value: scale,
|
|
2042
|
+
onChange: (e) => setScale(Number(e)),
|
|
2043
|
+
step: 0.1
|
|
2044
|
+
}
|
|
2045
|
+
)
|
|
2046
|
+
] }),
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_core14.Group, { children: [
|
|
2048
|
+
"Bias:",
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2050
|
+
import_core14.NumberInput,
|
|
2051
|
+
{
|
|
2052
|
+
size: "xs",
|
|
2053
|
+
w: 100,
|
|
2054
|
+
value: bias,
|
|
2055
|
+
onChange: (e) => setBias(Number(e)),
|
|
2056
|
+
step: 0.1
|
|
2057
|
+
}
|
|
2058
|
+
)
|
|
2059
|
+
] })
|
|
2060
|
+
] }),
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_layout23.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2062
|
+
] });
|
|
2063
|
+
}
|
|
2064
|
+
var noise_scale_bias_node_default = NoiseScaleBiasNode;
|
|
2065
|
+
|
|
2066
|
+
// src/nodes/modifiers/noise-terrace-node.tsx
|
|
2067
|
+
var import_layout24 = require("@awesome-flow/core/layout");
|
|
2068
|
+
var import_core15 = require("@mantine/core");
|
|
2069
|
+
var import_hooks26 = require("@awesome-flow/core/hooks");
|
|
2070
|
+
var import_react32 = require("react");
|
|
2071
|
+
var import_modifier8 = require("libnoise-ts/module/modifier");
|
|
2072
|
+
var import_icons_react3 = require("@tabler/icons-react");
|
|
2073
|
+
var import_hooks27 = require("@mantine/hooks");
|
|
2074
|
+
var import_abstract4 = require("@awesome-flow/core/abstract");
|
|
2075
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2076
|
+
function NoiseTerraceNode({ id, selected, data, type }) {
|
|
2077
|
+
const incoming = (0, import_hooks26.useIncomingComputedData)(id);
|
|
2078
|
+
const updateNodeData = (0, import_hooks26.useUpdateNodeData)();
|
|
2079
|
+
const updateComputedData = (0, import_hooks26.useUpdateNodeComputedData)();
|
|
2080
|
+
const [values, setValues] = (0, import_react32.useState)([]);
|
|
2081
|
+
const form = useForm({
|
|
2082
|
+
mode: "uncontrolled",
|
|
2083
|
+
initialValues: {
|
|
2084
|
+
points: []
|
|
2085
|
+
},
|
|
2086
|
+
validateInputOnChange: [`points.${FORM_INDEX}.input`],
|
|
2087
|
+
clearInputErrorOnChange: true,
|
|
2088
|
+
onValuesChange: (0, import_react32.useCallback)((values2) => {
|
|
2089
|
+
if (form.isValid()) {
|
|
2090
|
+
const points = values2.points.map((v) => v.value);
|
|
2091
|
+
setValues(points);
|
|
2092
|
+
updateNodeData(id, { points });
|
|
2093
|
+
}
|
|
2094
|
+
form.validate();
|
|
2095
|
+
}, [])
|
|
2096
|
+
});
|
|
2097
|
+
(0, import_react32.useEffect)(() => {
|
|
2098
|
+
const points = data.points?.length ? data.points.map((v) => ({ value: v, key: (0, import_hooks27.randomId)() })) : [1, 2].map(() => ({ value: 0, key: (0, import_hooks27.randomId)() }));
|
|
2099
|
+
form.initialize({ points });
|
|
2100
|
+
}, []);
|
|
2101
|
+
(0, import_react32.useEffect)(() => {
|
|
2102
|
+
if (incoming?.length && values?.length >= 2) {
|
|
2103
|
+
const module2 = new import_modifier8.Terrace(incoming[0].module, values);
|
|
2104
|
+
updateComputedData(id, { module: module2 });
|
|
2105
|
+
}
|
|
2106
|
+
}, [values, incoming]);
|
|
2107
|
+
const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_core15.Group, { mt: "xs", children: [
|
|
2108
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2109
|
+
import_core15.NumberInput,
|
|
2110
|
+
{
|
|
2111
|
+
size: "xs",
|
|
2112
|
+
placeholder: "Input Value",
|
|
2113
|
+
...form.getInputProps(`points.${index}.value`),
|
|
2114
|
+
step: 0.1
|
|
2115
|
+
},
|
|
2116
|
+
form.key(`points.${index}.value`)
|
|
2117
|
+
),
|
|
2118
|
+
data.state === import_abstract4.NodeState.edit && values.length > 2 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2119
|
+
import_core15.ActionIcon,
|
|
2120
|
+
{
|
|
2121
|
+
color: "red",
|
|
2122
|
+
variant: "outline",
|
|
2123
|
+
size: "sm",
|
|
2124
|
+
onClick: () => form.removeListItem("points", index),
|
|
2125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons_react3.IconX, { size: "1rem" })
|
|
2126
|
+
}
|
|
2127
|
+
)
|
|
2128
|
+
] }, item.key));
|
|
2129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_layout24.NodeContainer, { id, selected, type, data, children: [
|
|
2130
|
+
fields,
|
|
2131
|
+
data.state === import_abstract4.NodeState.edit && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_core15.Space, { h: 10 }),
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2134
|
+
import_core15.Button,
|
|
2135
|
+
{
|
|
2136
|
+
variant: "outline",
|
|
2137
|
+
size: "xs",
|
|
2138
|
+
fullWidth: true,
|
|
2139
|
+
onClick: () => form.insertListItem("points", { value: 0, key: (0, import_hooks27.randomId)() }),
|
|
2140
|
+
children: "Add control point"
|
|
2141
|
+
}
|
|
2142
|
+
)
|
|
2143
|
+
] }),
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_layout24.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2145
|
+
] });
|
|
2146
|
+
}
|
|
2147
|
+
var noise_terrace_node_default = NoiseTerraceNode;
|
|
2148
|
+
|
|
2149
|
+
// src/nodes/selectors/noise-blend-node.tsx
|
|
2150
|
+
var import_layout25 = require("@awesome-flow/core/layout");
|
|
2151
|
+
var import_react33 = require("react");
|
|
2152
|
+
var import_hooks28 = require("@awesome-flow/core/hooks");
|
|
2153
|
+
var import_selector = require("libnoise-ts/module/selector");
|
|
2154
|
+
var import_core16 = require("@mantine/core");
|
|
2155
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2156
|
+
function NoiseBlendNode({ id, selected, data, type }) {
|
|
2157
|
+
const incoming = (0, import_hooks28.useIncomingComputedData)(id);
|
|
2158
|
+
const updateComputedData = (0, import_hooks28.useUpdateNodeComputedData)();
|
|
2159
|
+
(0, import_react33.useEffect)(() => {
|
|
2160
|
+
if (incoming?.length > 2) {
|
|
2161
|
+
const module2 = new import_selector.Blend(incoming[0].module, incoming[1].module, incoming[2].module);
|
|
2162
|
+
updateComputedData(id, { module: module2 });
|
|
2163
|
+
}
|
|
2164
|
+
}, [id, incoming, updateComputedData]);
|
|
2165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_layout25.NodeContainer, { id, selected, data, type, children: [
|
|
2166
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_core16.Group, { children: [
|
|
2167
|
+
"Modules: ",
|
|
2168
|
+
incoming?.length
|
|
2169
|
+
] }),
|
|
2170
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_layout25.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2171
|
+
] });
|
|
2172
|
+
}
|
|
2173
|
+
var noise_blend_node_default = NoiseBlendNode;
|
|
2174
|
+
|
|
2175
|
+
// src/nodes/selectors/noise-select-node.tsx
|
|
2176
|
+
var import_layout26 = require("@awesome-flow/core/layout");
|
|
2177
|
+
var import_react34 = require("react");
|
|
2178
|
+
var import_hooks29 = require("@awesome-flow/core/hooks");
|
|
2179
|
+
var import_selector2 = require("libnoise-ts/module/selector");
|
|
2180
|
+
var import_core17 = require("@mantine/core");
|
|
2181
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2182
|
+
function NoiseSelectNode({ id, selected, data, type }) {
|
|
2183
|
+
const [edgeFalloff, setEdgeFalloff] = (0, import_react34.useState)(data.edgeFalloff);
|
|
2184
|
+
const [lowerBound, setLowerBound] = (0, import_react34.useState)(data.lowerBound);
|
|
2185
|
+
const [upperBound, setUpperBound] = (0, import_react34.useState)(data.upperBound);
|
|
2186
|
+
const incoming = (0, import_hooks29.useIncomingComputedData)(id);
|
|
2187
|
+
const updateNodeData = (0, import_hooks29.useUpdateNodeData)();
|
|
2188
|
+
const updateComputedData = (0, import_hooks29.useUpdateNodeComputedData)();
|
|
2189
|
+
(0, import_react34.useEffect)(() => {
|
|
2190
|
+
if (incoming?.length > 2) {
|
|
2191
|
+
const module2 = new import_selector2.Select(
|
|
2192
|
+
incoming[0].module,
|
|
2193
|
+
incoming[1].module,
|
|
2194
|
+
incoming[2].module,
|
|
2195
|
+
edgeFalloff,
|
|
2196
|
+
lowerBound,
|
|
2197
|
+
upperBound
|
|
2198
|
+
);
|
|
2199
|
+
updateComputedData(id, { module: module2 });
|
|
2200
|
+
}
|
|
2201
|
+
updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
|
|
2202
|
+
}, [incoming, edgeFalloff, lowerBound, upperBound, updateNodeData, id, updateComputedData]);
|
|
2203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_layout26.NodeContainer, { id, selected, data, type, children: [
|
|
2204
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Stack, { children: [
|
|
2205
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Group, { children: [
|
|
2206
|
+
"Edge Falloff:",
|
|
2207
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2208
|
+
import_core17.NumberInput,
|
|
2209
|
+
{
|
|
2210
|
+
size: "xs",
|
|
2211
|
+
w: 100,
|
|
2212
|
+
value: edgeFalloff,
|
|
2213
|
+
onChange: (e) => setEdgeFalloff(Number(e)),
|
|
2214
|
+
step: 0.1
|
|
2215
|
+
}
|
|
2216
|
+
)
|
|
2217
|
+
] }),
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Group, { children: [
|
|
2219
|
+
"Lower Bound:",
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2221
|
+
import_core17.NumberInput,
|
|
2222
|
+
{
|
|
2223
|
+
size: "xs",
|
|
2224
|
+
w: 100,
|
|
2225
|
+
value: lowerBound,
|
|
2226
|
+
onChange: (e) => setLowerBound(Number(e)),
|
|
2227
|
+
step: 0.1
|
|
2228
|
+
}
|
|
2229
|
+
)
|
|
2230
|
+
] }),
|
|
2231
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Group, { children: [
|
|
2232
|
+
"Upper Bound:",
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2234
|
+
import_core17.NumberInput,
|
|
2235
|
+
{
|
|
2236
|
+
size: "xs",
|
|
2237
|
+
w: 100,
|
|
2238
|
+
value: upperBound,
|
|
2239
|
+
onChange: (e) => setUpperBound(Number(e)),
|
|
2240
|
+
step: 0.1
|
|
2241
|
+
}
|
|
2242
|
+
)
|
|
2243
|
+
] }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Group, { children: [
|
|
2245
|
+
"Modules: ",
|
|
2246
|
+
incoming?.length
|
|
2247
|
+
] })
|
|
2248
|
+
] }),
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_layout26.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2250
|
+
] });
|
|
2251
|
+
}
|
|
2252
|
+
var noise_select_node_default = NoiseSelectNode;
|
|
2253
|
+
|
|
2254
|
+
// src/nodes/transformers/noise-displace-node.tsx
|
|
2255
|
+
var import_layout27 = require("@awesome-flow/core/layout");
|
|
2256
|
+
var import_react35 = require("react");
|
|
2257
|
+
var import_hooks30 = require("@awesome-flow/core/hooks");
|
|
2258
|
+
var import_transformer = require("libnoise-ts/module/transformer");
|
|
2259
|
+
var import_core18 = require("@mantine/core");
|
|
2260
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2261
|
+
function NoiseDisplaceNode({ id, selected, data, type }) {
|
|
2262
|
+
const updateComputedData = (0, import_hooks30.useUpdateNodeComputedData)();
|
|
2263
|
+
const incomingHandleData = (0, import_hooks30.useIncomingHandleData)(id, data.handles);
|
|
2264
|
+
const { sourceModule, xModule, yModule, zModule } = (0, import_react35.useMemo)(() => {
|
|
2265
|
+
return {
|
|
2266
|
+
sourceModule: incomingHandleData["source" /* sourceModule */],
|
|
2267
|
+
xModule: incomingHandleData["x-module" /* xModule */],
|
|
2268
|
+
yModule: incomingHandleData["y-module" /* yModule */],
|
|
2269
|
+
zModule: incomingHandleData["z-module" /* zModule */]
|
|
2270
|
+
};
|
|
2271
|
+
}, [incomingHandleData]);
|
|
2272
|
+
(0, import_react35.useEffect)(() => {
|
|
2273
|
+
if (sourceModule && xModule && yModule && zModule) {
|
|
2274
|
+
const module2 = new import_transformer.Displace(
|
|
2275
|
+
sourceModule[0].module,
|
|
2276
|
+
xModule[0].module,
|
|
2277
|
+
yModule[0].module,
|
|
2278
|
+
zModule[0].module
|
|
2279
|
+
);
|
|
2280
|
+
updateComputedData(id, { module: module2 });
|
|
2281
|
+
}
|
|
2282
|
+
}, [id, updateComputedData, sourceModule, xModule, yModule, zModule]);
|
|
2283
|
+
const { sourceColor, xColor, yColor, zColor } = (0, import_react35.useMemo)(() => {
|
|
2284
|
+
return {
|
|
2285
|
+
sourceColor: sourceModule ? "green" : "orange",
|
|
2286
|
+
xColor: xModule ? "green" : "orange",
|
|
2287
|
+
yColor: yModule ? "green" : "orange",
|
|
2288
|
+
zColor: zModule ? "green" : "orange"
|
|
2289
|
+
};
|
|
2290
|
+
}, [sourceModule, xModule, yModule, zModule]);
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_layout27.NodeContainer, { id, selected, data, type, children: [
|
|
2292
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_core18.Stack, { align: "center", children: [
|
|
2293
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_core18.Badge, { color: sourceColor, children: "Source Module" }),
|
|
2294
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_core18.Badge, { color: xColor, children: "X Module" }),
|
|
2295
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_core18.Badge, { color: yColor, children: "Y Module" }),
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_core18.Badge, { color: zColor, children: "Z Module" })
|
|
2297
|
+
] }),
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_layout27.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2299
|
+
] });
|
|
2300
|
+
}
|
|
2301
|
+
var noise_displace_node_default = NoiseDisplaceNode;
|
|
2302
|
+
|
|
2303
|
+
// src/nodes/transformers/noise-rotate-point-node.tsx
|
|
2304
|
+
var import_layout28 = require("@awesome-flow/core/layout");
|
|
2305
|
+
var import_react36 = require("react");
|
|
2306
|
+
var import_hooks31 = require("@awesome-flow/core/hooks");
|
|
2307
|
+
var import_core19 = require("@mantine/core");
|
|
2308
|
+
var import_transformer2 = require("libnoise-ts/module/transformer");
|
|
2309
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2310
|
+
function NoiseRotatePointNode({
|
|
2311
|
+
id,
|
|
2312
|
+
selected,
|
|
2313
|
+
data,
|
|
2314
|
+
type
|
|
2315
|
+
}) {
|
|
2316
|
+
const [xAngle, setXAngle] = (0, import_react36.useState)(data.xAngle);
|
|
2317
|
+
const [yAngle, setYAngle] = (0, import_react36.useState)(data.yAngle);
|
|
2318
|
+
const [zAngle, setZAngle] = (0, import_react36.useState)(data.zAngle);
|
|
2319
|
+
const incoming = (0, import_hooks31.useIncomingComputedData)(id);
|
|
2320
|
+
const updateNodeData = (0, import_hooks31.useUpdateNodeData)();
|
|
2321
|
+
const updateComputedData = (0, import_hooks31.useUpdateNodeComputedData)();
|
|
2322
|
+
(0, import_react36.useEffect)(() => {
|
|
2323
|
+
if (incoming?.length) {
|
|
2324
|
+
const module2 = new import_transformer2.RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
|
|
2325
|
+
updateComputedData(id, { module: module2 });
|
|
2326
|
+
}
|
|
2327
|
+
updateNodeData(id, { xAngle, yAngle, zAngle });
|
|
2328
|
+
}, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
|
|
2329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_layout28.NodeContainer, { id, selected, data, type, children: [
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_core19.Stack, { children: [
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_core19.Group, { children: [
|
|
2332
|
+
"X Angle:",
|
|
2333
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2334
|
+
import_core19.NumberInput,
|
|
2335
|
+
{
|
|
2336
|
+
size: "xs",
|
|
2337
|
+
w: 100,
|
|
2338
|
+
value: xAngle,
|
|
2339
|
+
onChange: (e) => setXAngle(Number(e)),
|
|
2340
|
+
step: 0.01
|
|
2341
|
+
}
|
|
2342
|
+
)
|
|
2343
|
+
] }),
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_core19.Group, { children: [
|
|
2345
|
+
"Y Angle:",
|
|
2346
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2347
|
+
import_core19.NumberInput,
|
|
2348
|
+
{
|
|
2349
|
+
size: "xs",
|
|
2350
|
+
w: 100,
|
|
2351
|
+
value: yAngle,
|
|
2352
|
+
onChange: (e) => setYAngle(Number(e)),
|
|
2353
|
+
step: 0.01
|
|
2354
|
+
}
|
|
2355
|
+
)
|
|
2356
|
+
] }),
|
|
2357
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_core19.Group, { children: [
|
|
2358
|
+
"Z Angle:",
|
|
2359
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2360
|
+
import_core19.NumberInput,
|
|
2361
|
+
{
|
|
2362
|
+
size: "xs",
|
|
2363
|
+
w: 100,
|
|
2364
|
+
value: zAngle,
|
|
2365
|
+
onChange: (e) => setZAngle(Number(e)),
|
|
2366
|
+
step: 0.01
|
|
2367
|
+
}
|
|
2368
|
+
)
|
|
2369
|
+
] })
|
|
2370
|
+
] }),
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_layout28.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2372
|
+
] });
|
|
2373
|
+
}
|
|
2374
|
+
var noise_rotate_point_node_default = NoiseRotatePointNode;
|
|
2375
|
+
|
|
2376
|
+
// src/nodes/transformers/noise-scale-point-node.tsx
|
|
2377
|
+
var import_layout29 = require("@awesome-flow/core/layout");
|
|
2378
|
+
var import_react37 = require("react");
|
|
2379
|
+
var import_hooks32 = require("@awesome-flow/core/hooks");
|
|
2380
|
+
var import_core20 = require("@mantine/core");
|
|
2381
|
+
var import_transformer3 = require("libnoise-ts/module/transformer");
|
|
2382
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2383
|
+
function NoiseScalePointNode({
|
|
2384
|
+
id,
|
|
2385
|
+
selected,
|
|
2386
|
+
data,
|
|
2387
|
+
type
|
|
2388
|
+
}) {
|
|
2389
|
+
const [xScale, setXScale] = (0, import_react37.useState)(data.xScale);
|
|
2390
|
+
const [yScale, setYScale] = (0, import_react37.useState)(data.yScale);
|
|
2391
|
+
const [zScale, setZScale] = (0, import_react37.useState)(data.zScale);
|
|
2392
|
+
const incoming = (0, import_hooks32.useIncomingComputedData)(id);
|
|
2393
|
+
const updateNodeData = (0, import_hooks32.useUpdateNodeData)();
|
|
2394
|
+
const updateComputedData = (0, import_hooks32.useUpdateNodeComputedData)();
|
|
2395
|
+
(0, import_react37.useEffect)(() => {
|
|
2396
|
+
if (incoming?.length) {
|
|
2397
|
+
const module2 = new import_transformer3.ScalePoint(incoming[0].module, xScale, yScale, zScale);
|
|
2398
|
+
updateComputedData(id, { module: module2 });
|
|
2399
|
+
}
|
|
2400
|
+
updateNodeData(id, { xScale, yScale, zScale });
|
|
2401
|
+
}, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
|
|
2402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_layout29.NodeContainer, { id, selected, data, type, children: [
|
|
2403
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_core20.Stack, { children: [
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_core20.Group, { children: [
|
|
2405
|
+
"X Scale:",
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2407
|
+
import_core20.NumberInput,
|
|
2408
|
+
{
|
|
2409
|
+
size: "xs",
|
|
2410
|
+
w: 100,
|
|
2411
|
+
value: xScale,
|
|
2412
|
+
onChange: (e) => setXScale(Number(e)),
|
|
2413
|
+
step: 0.01
|
|
2414
|
+
}
|
|
2415
|
+
)
|
|
2416
|
+
] }),
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_core20.Group, { children: [
|
|
2418
|
+
"Y Scale:",
|
|
2419
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2420
|
+
import_core20.NumberInput,
|
|
2421
|
+
{
|
|
2422
|
+
size: "xs",
|
|
2423
|
+
w: 100,
|
|
2424
|
+
value: yScale,
|
|
2425
|
+
onChange: (e) => setYScale(Number(e)),
|
|
2426
|
+
step: 0.01
|
|
2427
|
+
}
|
|
2428
|
+
)
|
|
2429
|
+
] }),
|
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_core20.Group, { children: [
|
|
2431
|
+
"Z Scale:",
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2433
|
+
import_core20.NumberInput,
|
|
2434
|
+
{
|
|
2435
|
+
size: "xs",
|
|
2436
|
+
w: 100,
|
|
2437
|
+
value: zScale,
|
|
2438
|
+
onChange: (e) => setZScale(Number(e)),
|
|
2439
|
+
step: 0.01
|
|
2440
|
+
}
|
|
2441
|
+
)
|
|
2442
|
+
] })
|
|
2443
|
+
] }),
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_layout29.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2445
|
+
] });
|
|
2446
|
+
}
|
|
2447
|
+
var noise_scale_point_node_default = NoiseScalePointNode;
|
|
2448
|
+
|
|
2449
|
+
// src/nodes/transformers/noise-translate-point-node.tsx
|
|
2450
|
+
var import_layout30 = require("@awesome-flow/core/layout");
|
|
2451
|
+
var import_react38 = require("react");
|
|
2452
|
+
var import_hooks33 = require("@awesome-flow/core/hooks");
|
|
2453
|
+
var import_core21 = require("@mantine/core");
|
|
2454
|
+
var import_transformer4 = require("libnoise-ts/module/transformer");
|
|
2455
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2456
|
+
function NoiseTranslatePointNode({
|
|
2457
|
+
id,
|
|
2458
|
+
selected,
|
|
2459
|
+
data,
|
|
2460
|
+
type
|
|
2461
|
+
}) {
|
|
2462
|
+
const [translateX, setTranslateX] = (0, import_react38.useState)(data.translateX);
|
|
2463
|
+
const [translateY, setTranslateY] = (0, import_react38.useState)(data.translateY);
|
|
2464
|
+
const [translateZ, setTranslateZ] = (0, import_react38.useState)(data.translateZ);
|
|
2465
|
+
const incoming = (0, import_hooks33.useIncomingComputedData)(id);
|
|
2466
|
+
const updateNodeData = (0, import_hooks33.useUpdateNodeData)();
|
|
2467
|
+
const updateComputedData = (0, import_hooks33.useUpdateNodeComputedData)();
|
|
2468
|
+
(0, import_react38.useEffect)(() => {
|
|
2469
|
+
if (incoming?.length) {
|
|
2470
|
+
const module2 = new import_transformer4.TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
|
|
2471
|
+
updateComputedData(id, { module: module2 });
|
|
2472
|
+
}
|
|
2473
|
+
updateNodeData(id, { translateX, translateY, translateZ });
|
|
2474
|
+
}, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
|
|
2475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_layout30.NodeContainer, { id, selected, data, type, children: [
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core21.Stack, { children: [
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core21.Group, { children: [
|
|
2478
|
+
"Translate X:",
|
|
2479
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2480
|
+
import_core21.NumberInput,
|
|
2481
|
+
{
|
|
2482
|
+
size: "xs",
|
|
2483
|
+
w: 100,
|
|
2484
|
+
value: translateX,
|
|
2485
|
+
onChange: (e) => setTranslateX(Number(e)),
|
|
2486
|
+
step: 1
|
|
2487
|
+
}
|
|
2488
|
+
)
|
|
2489
|
+
] }),
|
|
2490
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core21.Group, { children: [
|
|
2491
|
+
"Translate Y:",
|
|
2492
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2493
|
+
import_core21.NumberInput,
|
|
2494
|
+
{
|
|
2495
|
+
size: "xs",
|
|
2496
|
+
w: 100,
|
|
2497
|
+
value: translateY,
|
|
2498
|
+
onChange: (e) => setTranslateY(Number(e)),
|
|
2499
|
+
step: 1
|
|
2500
|
+
}
|
|
2501
|
+
)
|
|
2502
|
+
] }),
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core21.Group, { children: [
|
|
2504
|
+
"Translate Z:",
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2506
|
+
import_core21.NumberInput,
|
|
2507
|
+
{
|
|
2508
|
+
size: "xs",
|
|
2509
|
+
w: 100,
|
|
2510
|
+
value: translateZ,
|
|
2511
|
+
onChange: (e) => setTranslateZ(Number(e)),
|
|
2512
|
+
step: 1
|
|
2513
|
+
}
|
|
2514
|
+
)
|
|
2515
|
+
] })
|
|
2516
|
+
] }),
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_layout30.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2518
|
+
] });
|
|
2519
|
+
}
|
|
2520
|
+
var noise_translate_point_node_default = NoiseTranslatePointNode;
|
|
2521
|
+
|
|
2522
|
+
// src/nodes/transformers/noise-turbulence-node .tsx
|
|
2523
|
+
var import_layout31 = require("@awesome-flow/core/layout");
|
|
2524
|
+
var import_react39 = require("react");
|
|
2525
|
+
var import_hooks34 = require("@awesome-flow/core/hooks");
|
|
2526
|
+
var import_transformer5 = require("libnoise-ts/module/transformer");
|
|
2527
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2528
|
+
function NoiseTurbulenceNode({
|
|
2529
|
+
id,
|
|
2530
|
+
selected,
|
|
2531
|
+
data,
|
|
2532
|
+
type
|
|
2533
|
+
}) {
|
|
2534
|
+
const [properties, setProperties] = (0, import_react39.useState)(null);
|
|
2535
|
+
const incoming = (0, import_hooks34.useIncomingComputedData)(id);
|
|
2536
|
+
const updateComputedData = (0, import_hooks34.useUpdateNodeComputedData)();
|
|
2537
|
+
const onPropertiesChange = (0, import_react39.useCallback)((props) => {
|
|
2538
|
+
setProperties(props);
|
|
2539
|
+
}, []);
|
|
2540
|
+
(0, import_react39.useEffect)(() => {
|
|
2541
|
+
if (incoming?.length) {
|
|
2542
|
+
const module2 = new import_transformer5.Turbulence(
|
|
2543
|
+
incoming[0].module,
|
|
2544
|
+
properties.frequency.value,
|
|
2545
|
+
properties.power.value,
|
|
2546
|
+
properties.roughness.value,
|
|
2547
|
+
properties.seed.value
|
|
2548
|
+
);
|
|
2549
|
+
updateComputedData(id, { module: module2 });
|
|
2550
|
+
}
|
|
2551
|
+
}, [id, incoming, properties, updateComputedData]);
|
|
2552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_layout31.NodeContainer, { id, selected, data, type, children: [
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
|
|
2554
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_layout31.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2555
|
+
] });
|
|
2556
|
+
}
|
|
2557
|
+
var noise_turbulence_node_default = NoiseTurbulenceNode;
|
|
2558
|
+
|
|
2559
|
+
// src/nodes/generators/variable-property-node.tsx
|
|
2560
|
+
var import_layout32 = require("@awesome-flow/core/layout");
|
|
2561
|
+
var import_react40 = require("react");
|
|
2562
|
+
var import_core22 = require("@mantine/core");
|
|
2563
|
+
var import_hooks35 = require("@awesome-flow/core/hooks");
|
|
2564
|
+
var import_utils2 = require("@awesome-flow/core/utils");
|
|
2565
|
+
var import_abstract5 = require("@awesome-flow/core/abstract");
|
|
2566
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2567
|
+
function VariablePropertyNode({
|
|
2568
|
+
id,
|
|
2569
|
+
selected,
|
|
2570
|
+
data,
|
|
2571
|
+
type
|
|
2572
|
+
}) {
|
|
2573
|
+
const [options3, setOptions] = (0, import_react40.useState)({});
|
|
2574
|
+
const [selectedProperty, setSelectedProperty] = (0, import_react40.useState)(data.property);
|
|
2575
|
+
const updateNodeData = (0, import_hooks35.useUpdateNodeData)();
|
|
2576
|
+
const outgoing = (0, import_hooks35.useOutgoingNodes)(id);
|
|
2577
|
+
const incoming = (0, import_hooks35.useIncomingNodeData)(id);
|
|
2578
|
+
(0, import_react40.useEffect)(() => {
|
|
2579
|
+
if (outgoing?.length) {
|
|
2580
|
+
const { data: data2 } = outgoing[0];
|
|
2581
|
+
const properties = (0, import_utils2.getObjectPropertyMap)(data2, import_abstract5.nodeDataPropertyExcept);
|
|
2582
|
+
setOptions(properties);
|
|
2583
|
+
if (!selectedProperty) {
|
|
2584
|
+
const keys = Object.keys(properties);
|
|
2585
|
+
if (keys.length) {
|
|
2586
|
+
setSelectedProperty({
|
|
2587
|
+
name: keys[0],
|
|
2588
|
+
value: properties[keys[0]]
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
} else {
|
|
2593
|
+
setSelectedProperty(null);
|
|
2594
|
+
}
|
|
2595
|
+
}, [outgoing]);
|
|
2596
|
+
(0, import_react40.useEffect)(() => {
|
|
2597
|
+
if (!incoming?.length && selectedProperty?.disabled) {
|
|
2598
|
+
setSelectedProperty({ ...selectedProperty, disabled: false });
|
|
2599
|
+
} else if (incoming?.length && selectedProperty) {
|
|
2600
|
+
const incomingValue = incoming[0].value;
|
|
2601
|
+
if (incomingValue !== void 0 && incomingValue !== null) {
|
|
2602
|
+
setSelectedProperty({
|
|
2603
|
+
name: selectedProperty.name,
|
|
2604
|
+
value: incomingValue,
|
|
2605
|
+
disabled: true
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
}, [incoming]);
|
|
2610
|
+
(0, import_react40.useEffect)(() => {
|
|
2611
|
+
if (selectedProperty) {
|
|
2612
|
+
updateNodeData(id, { property: selectedProperty });
|
|
2613
|
+
}
|
|
2614
|
+
}, [selectedProperty]);
|
|
2615
|
+
const onPropertyChange = (0, import_react40.useCallback)(
|
|
2616
|
+
(selected2) => {
|
|
2617
|
+
setSelectedProperty({
|
|
2618
|
+
name: selected2,
|
|
2619
|
+
value: options3[selected2]
|
|
2620
|
+
});
|
|
2621
|
+
},
|
|
2622
|
+
[options3]
|
|
2623
|
+
);
|
|
2624
|
+
const onValueChange = (0, import_react40.useCallback)((name, value) => {
|
|
2625
|
+
setSelectedProperty({
|
|
2626
|
+
name,
|
|
2627
|
+
value
|
|
2628
|
+
});
|
|
2629
|
+
}, []);
|
|
2630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_layout32.NodeContainer, { id, selected, data, type, children: [
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_core22.Stack, { align: "center", children: [
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2633
|
+
import_layout32.NodeCombobox,
|
|
2634
|
+
{
|
|
2635
|
+
options: options3,
|
|
2636
|
+
onChange: onPropertyChange,
|
|
2637
|
+
selected: selectedProperty?.name,
|
|
2638
|
+
hideListValues: true
|
|
2639
|
+
}
|
|
2640
|
+
),
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(node_property_input_default, { property: selectedProperty, onChange: onValueChange })
|
|
2642
|
+
] }),
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_layout32.NodeTrackConnections, { handles: data.handles, nodeId: id })
|
|
2644
|
+
] });
|
|
2645
|
+
}
|
|
2646
|
+
var variable_property_node_default = VariablePropertyNode;
|
|
2647
|
+
|
|
2648
|
+
// src/nodes/modifiers/variable-combine-node.tsx
|
|
2649
|
+
var import_layout33 = require("@awesome-flow/core/layout");
|
|
2650
|
+
var import_react41 = require("react");
|
|
2651
|
+
var import_hooks36 = require("@awesome-flow/core/hooks");
|
|
2652
|
+
var import_icons_react4 = require("@tabler/icons-react");
|
|
2653
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2654
|
+
var options2 = {
|
|
2655
|
+
add: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons_react4.IconPlus, {}),
|
|
2656
|
+
divide: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons_react4.IconDivide, {}),
|
|
2657
|
+
min: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons_react4.IconChevronLeft, {}),
|
|
2658
|
+
max: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons_react4.IconChevronRight, {}),
|
|
2659
|
+
multiply: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons_react4.IconAsterisk, {}),
|
|
2660
|
+
power: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons_react4.IconChevronUp, {})
|
|
2661
|
+
};
|
|
2662
|
+
function VariableCombineNode({
|
|
2663
|
+
id,
|
|
2664
|
+
selected,
|
|
2665
|
+
data,
|
|
2666
|
+
type
|
|
2667
|
+
}) {
|
|
2668
|
+
const [operation, setOperation] = (0, import_react41.useState)(data.operation);
|
|
2669
|
+
const [value, setValue] = (0, import_react41.useState)(data.value);
|
|
2670
|
+
const updateNodeData = (0, import_hooks36.useUpdateNodeData)();
|
|
2671
|
+
const incoming = (0, import_hooks36.useIncomingNodeData)(id);
|
|
2672
|
+
(0, import_react41.useEffect)(() => {
|
|
2673
|
+
if (incoming?.length > 1) {
|
|
2674
|
+
const result = getOperationResult(operation, incoming[0].value, incoming[1].value);
|
|
2675
|
+
setValue(result);
|
|
2676
|
+
updateNodeData(id, { value: result });
|
|
2677
|
+
}
|
|
2678
|
+
}, [operation, incoming]);
|
|
2679
|
+
const onChange = (0, import_react41.useCallback)((op) => {
|
|
2680
|
+
updateNodeData(id, { operation: op });
|
|
2681
|
+
setOperation(op);
|
|
2682
|
+
}, []);
|
|
2683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_layout33.NodeContainer, { id, selected, data, type, children: [
|
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_layout33.NodeCombobox, { options: options2, selected: operation, onChange }),
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(node_value_input_default, { value, onChange: () => {
|
|
2686
|
+
}, disabled: true }),
|
|
2687
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_layout33.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
2688
|
+
] });
|
|
2689
|
+
}
|
|
2690
|
+
function getOperationResult(operation, value1, value2) {
|
|
2691
|
+
switch (operation) {
|
|
2692
|
+
case "add" /* add */:
|
|
2693
|
+
return Number(value1) + Number(value2);
|
|
2694
|
+
case "divide" /* divide */:
|
|
2695
|
+
return Number(value1) / (Number(value2) || 1);
|
|
2696
|
+
case "max" /* max */:
|
|
2697
|
+
return Number(value1) > Number(value2) ? value1 : value2;
|
|
2698
|
+
case "min" /* min */:
|
|
2699
|
+
return Number(value1) < Number(value2) ? value1 : value2;
|
|
2700
|
+
case "multiply" /* multiply */:
|
|
2701
|
+
return Number(value1) * Number(value2);
|
|
2702
|
+
case "power" /* power */:
|
|
2703
|
+
return Number(value1) ** Number(value2);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
var variable_combine_node_default = VariableCombineNode;
|
|
2707
|
+
|
|
2708
|
+
// src/nodes/generators/variable-value-node.tsx
|
|
2709
|
+
var import_layout35 = require("@awesome-flow/core/layout");
|
|
2710
|
+
var import_react42 = require("react");
|
|
2711
|
+
var import_hooks37 = require("@awesome-flow/core/hooks");
|
|
2712
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2713
|
+
function VariableValueNode({ id, selected, data, type }) {
|
|
2714
|
+
const [value, setValue] = (0, import_react42.useState)(data.value || 0);
|
|
2715
|
+
const updateNodeData = (0, import_hooks37.useUpdateNodeData)();
|
|
2716
|
+
const onValueChange = (0, import_react42.useCallback)((newValue) => {
|
|
2717
|
+
updateNodeData(id, { value: newValue });
|
|
2718
|
+
setValue(newValue);
|
|
2719
|
+
}, []);
|
|
2720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_layout35.NodeContainer, { id, selected, data, type, children: [
|
|
2721
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(node_value_input_default, { value, onChange: onValueChange }),
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_layout35.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "source" })
|
|
2723
|
+
] });
|
|
2724
|
+
}
|
|
2725
|
+
var variable_value_node_default = VariableValueNode;
|
|
2726
|
+
|
|
2727
|
+
// src/nodes/groups/node-module-group.tsx
|
|
2728
|
+
var import_layout36 = require("@awesome-flow/core/layout");
|
|
2729
|
+
var import_react43 = require("@xyflow/react");
|
|
2730
|
+
var import_abstract6 = require("@awesome-flow/core/abstract");
|
|
2731
|
+
var import_react44 = require("react");
|
|
2732
|
+
var import_shallow = require("zustand/shallow");
|
|
2733
|
+
var import_core23 = require("@mantine/core");
|
|
2734
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2735
|
+
function ModuleGroupNode({
|
|
2736
|
+
id,
|
|
2737
|
+
selected,
|
|
2738
|
+
data,
|
|
2739
|
+
type,
|
|
2740
|
+
width,
|
|
2741
|
+
height
|
|
2742
|
+
}) {
|
|
2743
|
+
const context = (0, import_react44.useContext)(import_abstract6.FlowContext);
|
|
2744
|
+
const updateNodeInternals = (0, import_react43.useUpdateNodeInternals)();
|
|
2745
|
+
const triggerNodeChanges = (0, import_react43.useStore)((s) => s.triggerNodeChanges);
|
|
2746
|
+
const { groupNodes, setGroupCollapsed } = context.useFlowStore(
|
|
2747
|
+
(0, import_react44.useCallback)(
|
|
2748
|
+
(state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
|
|
2749
|
+
[]
|
|
2750
|
+
)
|
|
2751
|
+
);
|
|
2752
|
+
const intersectingNode = context.useInteractivityStore(
|
|
2753
|
+
(0, import_react44.useCallback)((state) => state.nodeIntersectionTargets[id], [id]),
|
|
2754
|
+
import_shallow.shallow
|
|
2755
|
+
);
|
|
2756
|
+
(0, import_react44.useEffect)(() => {
|
|
2757
|
+
updateNodeInternals(id);
|
|
2758
|
+
}, [width, height]);
|
|
2759
|
+
(0, import_react44.useEffect)(() => {
|
|
2760
|
+
triggerNodeChanges([
|
|
2761
|
+
{
|
|
2762
|
+
id,
|
|
2763
|
+
type: "select",
|
|
2764
|
+
selected: !!intersectingNode
|
|
2765
|
+
}
|
|
2766
|
+
]);
|
|
2767
|
+
}, [intersectingNode]);
|
|
2768
|
+
const onCollapsed = (0, import_react44.useCallback)((collapsed) => {
|
|
2769
|
+
setGroupCollapsed(id, collapsed);
|
|
2770
|
+
}, []);
|
|
2771
|
+
const size = (0, import_react44.useMemo)(() => {
|
|
2772
|
+
return {
|
|
2773
|
+
width: data.initialSize?.width || 100,
|
|
2774
|
+
height: data.initialSize?.height || 50
|
|
2775
|
+
};
|
|
2776
|
+
}, [data.initialSize]);
|
|
2777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2778
|
+
import_layout36.NodeContainer,
|
|
2779
|
+
{
|
|
2780
|
+
id,
|
|
2781
|
+
selected,
|
|
2782
|
+
data,
|
|
2783
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_core23.Group, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_core23.Group, { gap: "xs", children: [
|
|
2784
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_core23.Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
|
|
2785
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_layout36.NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
|
|
2786
|
+
] }) }),
|
|
2787
|
+
type,
|
|
2788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2789
|
+
import_react43.NodeResizer,
|
|
2790
|
+
{
|
|
2791
|
+
nodeId: id,
|
|
2792
|
+
minWidth: size.width,
|
|
2793
|
+
minHeight: size.height,
|
|
2794
|
+
isVisible: selected && !data.isCollapsed
|
|
2795
|
+
}
|
|
2796
|
+
)
|
|
2797
|
+
}
|
|
2798
|
+
);
|
|
2799
|
+
}
|
|
2800
|
+
var node_module_group_default = ModuleGroupNode;
|
|
2801
|
+
|
|
2802
|
+
// src/templates/generators/noise-checkerboard-template.ts
|
|
2803
|
+
var import_utils3 = require("@awesome-flow/core/utils");
|
|
2804
|
+
var import_system = require("@xyflow/system");
|
|
2805
|
+
var NoiseCheckerboardNodeTemplateFactory = class {
|
|
2806
|
+
create() {
|
|
2807
|
+
return {
|
|
2808
|
+
id: import_utils3.IDGenerator.template(),
|
|
2809
|
+
type: "noise-checkerboard" /* noiseCheckerboard */,
|
|
2810
|
+
removable: false,
|
|
2811
|
+
data: {
|
|
2812
|
+
title: "Checkerboard Noise"
|
|
2813
|
+
},
|
|
2814
|
+
handles: [
|
|
2815
|
+
{
|
|
2816
|
+
position: import_system.Position.Right,
|
|
2817
|
+
dataType: 8 /* module */,
|
|
2818
|
+
connection: "source"
|
|
2819
|
+
}
|
|
2820
|
+
]
|
|
2821
|
+
};
|
|
2822
|
+
}
|
|
2823
|
+
isHandleAllowed(type) {
|
|
2824
|
+
return type === "source";
|
|
2825
|
+
}
|
|
2826
|
+
getHandleAllowedDataType() {
|
|
2827
|
+
return 8 /* module */;
|
|
2828
|
+
}
|
|
2829
|
+
};
|
|
2830
|
+
|
|
2831
|
+
// src/templates/generators/noise-const-template.ts
|
|
2832
|
+
var import_utils4 = require("@awesome-flow/core/utils");
|
|
2833
|
+
var import_system2 = require("@xyflow/system");
|
|
2834
|
+
var NoiseConstNodeTemplateFactory = class {
|
|
2835
|
+
create() {
|
|
2836
|
+
return {
|
|
2837
|
+
id: import_utils4.IDGenerator.template(),
|
|
2838
|
+
type: "noise-constant" /* noiseConst */,
|
|
2839
|
+
removable: false,
|
|
2840
|
+
data: {
|
|
2841
|
+
title: "Const Value Noise",
|
|
2842
|
+
noise: 0,
|
|
2843
|
+
min: -1,
|
|
2844
|
+
max: 1
|
|
2845
|
+
},
|
|
2846
|
+
handles: [
|
|
2847
|
+
{
|
|
2848
|
+
position: import_system2.Position.Right,
|
|
2849
|
+
dataType: 8 /* module */,
|
|
2850
|
+
connection: "source"
|
|
2851
|
+
}
|
|
2852
|
+
]
|
|
2853
|
+
};
|
|
2854
|
+
}
|
|
2855
|
+
isHandleAllowed(type) {
|
|
2856
|
+
return type === "source";
|
|
2857
|
+
}
|
|
2858
|
+
getHandleAllowedDataType(type) {
|
|
2859
|
+
return 8 /* module */;
|
|
2860
|
+
}
|
|
2861
|
+
};
|
|
2862
|
+
|
|
2863
|
+
// src/templates/generators/noise-cylinders-template.ts
|
|
2864
|
+
var import_utils5 = require("@awesome-flow/core/utils");
|
|
2865
|
+
var import_system3 = require("@xyflow/system");
|
|
2866
|
+
var NoiseCylindersNodeTemplateFactory = class {
|
|
2867
|
+
create() {
|
|
2868
|
+
return {
|
|
2869
|
+
id: import_utils5.IDGenerator.template(),
|
|
2870
|
+
type: "noise-cylinders" /* noiseCylinders */,
|
|
2871
|
+
removable: false,
|
|
2872
|
+
data: {
|
|
2873
|
+
title: "Cylinders Noise",
|
|
2874
|
+
frequency: 0.1
|
|
2875
|
+
},
|
|
2876
|
+
handles: [
|
|
2877
|
+
{
|
|
2878
|
+
position: import_system3.Position.Left,
|
|
2879
|
+
dataType: 16 /* variableProperty */,
|
|
2880
|
+
connection: "target"
|
|
2881
|
+
},
|
|
2882
|
+
{
|
|
2883
|
+
position: import_system3.Position.Right,
|
|
2884
|
+
dataType: 8 /* module */,
|
|
2885
|
+
connection: "source"
|
|
2886
|
+
}
|
|
2887
|
+
]
|
|
2888
|
+
};
|
|
2889
|
+
}
|
|
2890
|
+
isHandleAllowed(type) {
|
|
2891
|
+
return type === "source";
|
|
2892
|
+
}
|
|
2893
|
+
getHandleAllowedDataType() {
|
|
2894
|
+
return 8 /* module */;
|
|
2895
|
+
}
|
|
2896
|
+
};
|
|
2897
|
+
|
|
2898
|
+
// src/templates/generators/noise-perlin-template.ts
|
|
2899
|
+
var import_utils6 = require("@awesome-flow/core/utils");
|
|
2900
|
+
var import_system4 = require("@xyflow/system");
|
|
2901
|
+
var NoisePerlinNodeTemplateFactory = class {
|
|
2902
|
+
create() {
|
|
2903
|
+
return {
|
|
2904
|
+
id: import_utils6.IDGenerator.template(),
|
|
2905
|
+
type: "noise-perlin" /* noisePerlin */,
|
|
2906
|
+
removable: false,
|
|
2907
|
+
data: {
|
|
2908
|
+
title: "Perlin Noise",
|
|
2909
|
+
frequency: 0.1,
|
|
2910
|
+
lacunarity: 2,
|
|
2911
|
+
octaves: 5,
|
|
2912
|
+
persistence: 0.5,
|
|
2913
|
+
seed: 0
|
|
2914
|
+
},
|
|
2915
|
+
handles: [
|
|
2916
|
+
{
|
|
2917
|
+
position: import_system4.Position.Left,
|
|
2918
|
+
dataType: 16 /* variableProperty */,
|
|
2919
|
+
connection: "target"
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
position: import_system4.Position.Right,
|
|
2923
|
+
dataType: 8 /* module */,
|
|
2924
|
+
connection: "source"
|
|
2925
|
+
}
|
|
2926
|
+
]
|
|
2927
|
+
};
|
|
2928
|
+
}
|
|
2929
|
+
isHandleAllowed(type) {
|
|
2930
|
+
return type === "source";
|
|
2931
|
+
}
|
|
2932
|
+
getHandleAllowedDataType() {
|
|
2933
|
+
return 8 /* module */;
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2936
|
+
|
|
2937
|
+
// src/templates/generators/noise-ridgedmulti-template.ts
|
|
2938
|
+
var import_utils7 = require("@awesome-flow/core/utils");
|
|
2939
|
+
var import_system5 = require("@xyflow/system");
|
|
2940
|
+
var NoiseRidgedMultiNodeTemplateFactory = class {
|
|
2941
|
+
create() {
|
|
2942
|
+
return {
|
|
2943
|
+
id: import_utils7.IDGenerator.template(),
|
|
2944
|
+
type: "noise-ridged-multi" /* noiseRidgedMulti */,
|
|
2945
|
+
removable: false,
|
|
2946
|
+
data: {
|
|
2947
|
+
title: "Ridged Multi Noise",
|
|
2948
|
+
frequency: 0.1,
|
|
2949
|
+
lacunarity: 2,
|
|
2950
|
+
octaves: 6,
|
|
2951
|
+
offset: 1,
|
|
2952
|
+
gain: 2,
|
|
2953
|
+
seed: 0
|
|
2954
|
+
},
|
|
2955
|
+
handles: [
|
|
2956
|
+
{
|
|
2957
|
+
position: import_system5.Position.Left,
|
|
2958
|
+
dataType: 16 /* variableProperty */,
|
|
2959
|
+
connection: "target"
|
|
2960
|
+
},
|
|
2961
|
+
{
|
|
2962
|
+
position: import_system5.Position.Right,
|
|
2963
|
+
dataType: 8 /* module */,
|
|
2964
|
+
connection: "source"
|
|
2965
|
+
}
|
|
2966
|
+
]
|
|
2967
|
+
};
|
|
2968
|
+
}
|
|
2969
|
+
isHandleAllowed(type) {
|
|
2970
|
+
return type === "source";
|
|
2971
|
+
}
|
|
2972
|
+
getHandleAllowedDataType() {
|
|
2973
|
+
return 8 /* module */;
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
|
|
2977
|
+
// src/templates/generators/noise-simplex-template.ts
|
|
2978
|
+
var import_utils8 = require("@awesome-flow/core/utils");
|
|
2979
|
+
var import_system6 = require("@xyflow/system");
|
|
2980
|
+
var NoiseSimplexNodeTemplateFactory = class {
|
|
2981
|
+
create() {
|
|
2982
|
+
return {
|
|
2983
|
+
id: import_utils8.IDGenerator.template(),
|
|
2984
|
+
type: "noise-simplex" /* noiseSimplex */,
|
|
2985
|
+
removable: false,
|
|
2986
|
+
data: {
|
|
2987
|
+
title: "Simplex Noise"
|
|
2988
|
+
},
|
|
2989
|
+
handles: [
|
|
2990
|
+
{
|
|
2991
|
+
position: import_system6.Position.Left,
|
|
2992
|
+
dataType: 16 /* variableProperty */,
|
|
2993
|
+
connection: "target"
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
position: import_system6.Position.Right,
|
|
2997
|
+
dataType: 8 /* module */,
|
|
2998
|
+
connection: "source"
|
|
2999
|
+
}
|
|
3000
|
+
]
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
isHandleAllowed(type) {
|
|
3004
|
+
return type === "source";
|
|
3005
|
+
}
|
|
3006
|
+
getHandleAllowedDataType() {
|
|
3007
|
+
return 8 /* module */;
|
|
3008
|
+
}
|
|
3009
|
+
};
|
|
3010
|
+
|
|
3011
|
+
// src/templates/generators/noise-spheres-template.ts
|
|
3012
|
+
var import_utils9 = require("@awesome-flow/core/utils");
|
|
3013
|
+
var import_system7 = require("@xyflow/system");
|
|
3014
|
+
var NoiseSpheresNodeTemplateFactory = class {
|
|
3015
|
+
create() {
|
|
3016
|
+
return {
|
|
3017
|
+
id: import_utils9.IDGenerator.template(),
|
|
3018
|
+
type: "noise-spheres" /* noiseSpheres */,
|
|
3019
|
+
removable: false,
|
|
3020
|
+
data: {
|
|
3021
|
+
title: "Spheres Noise",
|
|
3022
|
+
frequency: 0.1
|
|
3023
|
+
},
|
|
3024
|
+
handles: [
|
|
3025
|
+
{
|
|
3026
|
+
position: import_system7.Position.Left,
|
|
3027
|
+
dataType: 16 /* variableProperty */,
|
|
3028
|
+
connection: "target"
|
|
3029
|
+
},
|
|
3030
|
+
{
|
|
3031
|
+
position: import_system7.Position.Right,
|
|
3032
|
+
dataType: 8 /* module */,
|
|
3033
|
+
connection: "source"
|
|
3034
|
+
}
|
|
3035
|
+
]
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
isHandleAllowed(type) {
|
|
3039
|
+
return type === "source";
|
|
3040
|
+
}
|
|
3041
|
+
getHandleAllowedDataType() {
|
|
3042
|
+
return 8 /* module */;
|
|
3043
|
+
}
|
|
3044
|
+
};
|
|
3045
|
+
|
|
3046
|
+
// src/templates/generators/noise-voronoi-template.ts
|
|
3047
|
+
var import_utils10 = require("@awesome-flow/core/utils");
|
|
3048
|
+
var import_system8 = require("@xyflow/system");
|
|
3049
|
+
var NoiseVoronoiNodeTemplateFactory = class {
|
|
3050
|
+
create() {
|
|
3051
|
+
return {
|
|
3052
|
+
id: import_utils10.IDGenerator.template(),
|
|
3053
|
+
type: "noise-voronoi" /* noiseVoronoi */,
|
|
3054
|
+
removable: false,
|
|
3055
|
+
data: {
|
|
3056
|
+
title: "Voronoi Noise",
|
|
3057
|
+
frequency: 0.1,
|
|
3058
|
+
displacement: 1,
|
|
3059
|
+
distance: true,
|
|
3060
|
+
seed: 0
|
|
3061
|
+
},
|
|
3062
|
+
handles: [
|
|
3063
|
+
{
|
|
3064
|
+
position: import_system8.Position.Left,
|
|
3065
|
+
dataType: 16 /* variableProperty */,
|
|
3066
|
+
connection: "target"
|
|
3067
|
+
},
|
|
3068
|
+
{
|
|
3069
|
+
position: import_system8.Position.Right,
|
|
3070
|
+
dataType: 8 /* module */,
|
|
3071
|
+
connection: "source"
|
|
3072
|
+
}
|
|
3073
|
+
]
|
|
3074
|
+
};
|
|
3075
|
+
}
|
|
3076
|
+
isHandleAllowed(type) {
|
|
3077
|
+
return type === "source";
|
|
3078
|
+
}
|
|
3079
|
+
getHandleAllowedDataType() {
|
|
3080
|
+
return 8 /* module */;
|
|
3081
|
+
}
|
|
3082
|
+
};
|
|
3083
|
+
|
|
3084
|
+
// src/templates/generators/position-const-template.ts
|
|
3085
|
+
var import_utils11 = require("@awesome-flow/core/utils");
|
|
3086
|
+
var import_system9 = require("@xyflow/system");
|
|
3087
|
+
var PositionConstNodeTemplateFactory = class {
|
|
3088
|
+
create() {
|
|
3089
|
+
return {
|
|
3090
|
+
id: import_utils11.IDGenerator.template(),
|
|
3091
|
+
type: "position" /* position */,
|
|
3092
|
+
removable: false,
|
|
3093
|
+
data: {
|
|
3094
|
+
title: "Position Output",
|
|
3095
|
+
position: { x: 0, y: 0, z: 0 }
|
|
3096
|
+
},
|
|
3097
|
+
handles: [
|
|
3098
|
+
{
|
|
3099
|
+
position: import_system9.Position.Right,
|
|
3100
|
+
dataType: 4 /* position */,
|
|
3101
|
+
connection: "source"
|
|
3102
|
+
}
|
|
3103
|
+
]
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
isHandleAllowed(type) {
|
|
3107
|
+
return type === "source";
|
|
3108
|
+
}
|
|
3109
|
+
getHandleAllowedDataType(type) {
|
|
3110
|
+
return 4 /* position */;
|
|
3111
|
+
}
|
|
3112
|
+
};
|
|
3113
|
+
|
|
3114
|
+
// src/templates/generators/position-grid-template.ts
|
|
3115
|
+
var import_utils12 = require("@awesome-flow/core/utils");
|
|
3116
|
+
var import_system10 = require("@xyflow/system");
|
|
3117
|
+
var PositionGridNodeTemplateFactory = class {
|
|
3118
|
+
create() {
|
|
3119
|
+
return {
|
|
3120
|
+
id: import_utils12.IDGenerator.template(),
|
|
3121
|
+
type: "grid" /* grid */,
|
|
3122
|
+
removable: false,
|
|
3123
|
+
data: {
|
|
3124
|
+
title: "Grid Output",
|
|
3125
|
+
center: { x: 0, y: 0, z: 0 },
|
|
3126
|
+
radius: 1
|
|
3127
|
+
},
|
|
3128
|
+
handles: [
|
|
3129
|
+
{
|
|
3130
|
+
position: import_system10.Position.Right,
|
|
3131
|
+
dataType: 4 /* position */,
|
|
3132
|
+
connection: "source"
|
|
3133
|
+
}
|
|
3134
|
+
]
|
|
3135
|
+
};
|
|
3136
|
+
}
|
|
3137
|
+
isHandleAllowed(type) {
|
|
3138
|
+
return type === "source";
|
|
3139
|
+
}
|
|
3140
|
+
getHandleAllowedDataType(type) {
|
|
3141
|
+
return 4 /* position */;
|
|
3142
|
+
}
|
|
3143
|
+
};
|
|
3144
|
+
|
|
3145
|
+
// src/templates/modifiers/noise-normalize-template.ts
|
|
3146
|
+
var import_utils13 = require("@awesome-flow/core/utils");
|
|
3147
|
+
var import_system11 = require("@xyflow/system");
|
|
3148
|
+
var NoiseNormalizeNodeTemplateFactory = class {
|
|
3149
|
+
create() {
|
|
3150
|
+
return {
|
|
3151
|
+
id: import_utils13.IDGenerator.template(),
|
|
3152
|
+
type: "noise-normalize" /* noiseNormalize */,
|
|
3153
|
+
data: {
|
|
3154
|
+
title: "Normalize Noise",
|
|
3155
|
+
intervalStart: -1,
|
|
3156
|
+
intervalEnd: 1
|
|
3157
|
+
},
|
|
3158
|
+
handles: [
|
|
3159
|
+
{
|
|
3160
|
+
position: import_system11.Position.Left,
|
|
3161
|
+
dataType: 8 /* module */,
|
|
3162
|
+
connection: "target",
|
|
3163
|
+
maxConnections: 1
|
|
3164
|
+
},
|
|
3165
|
+
{
|
|
3166
|
+
position: import_system11.Position.Right,
|
|
3167
|
+
dataType: 8 /* module */,
|
|
3168
|
+
connection: "source"
|
|
3169
|
+
}
|
|
3170
|
+
]
|
|
3171
|
+
};
|
|
3172
|
+
}
|
|
3173
|
+
isHandleAllowed() {
|
|
3174
|
+
return true;
|
|
3175
|
+
}
|
|
3176
|
+
getHandleAllowedDataType(type) {
|
|
3177
|
+
return 8 /* module */;
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
|
|
3181
|
+
// src/templates/output/noise-logger-template.ts
|
|
3182
|
+
var import_utils14 = require("@awesome-flow/core/utils");
|
|
3183
|
+
var import_system12 = require("@xyflow/system");
|
|
3184
|
+
var NoiseLoggerNodeTemplateFactory = class {
|
|
3185
|
+
create() {
|
|
3186
|
+
return {
|
|
3187
|
+
id: import_utils14.IDGenerator.template(),
|
|
3188
|
+
type: "noise-logger" /* noiseLogger */,
|
|
3189
|
+
removable: false,
|
|
3190
|
+
data: {
|
|
3191
|
+
title: "Noise Logger"
|
|
3192
|
+
},
|
|
3193
|
+
handles: [
|
|
3194
|
+
{
|
|
3195
|
+
position: import_system12.Position.Left,
|
|
3196
|
+
dataType: 2 /* noise */,
|
|
3197
|
+
connection: "target"
|
|
3198
|
+
}
|
|
3199
|
+
]
|
|
3200
|
+
};
|
|
3201
|
+
}
|
|
3202
|
+
isHandleAllowed(type) {
|
|
3203
|
+
return type === "target";
|
|
3204
|
+
}
|
|
3205
|
+
getHandleAllowedDataType(type) {
|
|
3206
|
+
return 2 /* noise */;
|
|
3207
|
+
}
|
|
3208
|
+
};
|
|
3209
|
+
|
|
3210
|
+
// src/templates/output/noise-raw-texture-template.ts
|
|
3211
|
+
var import_utils15 = require("@awesome-flow/core/utils");
|
|
3212
|
+
var import_system13 = require("@xyflow/system");
|
|
3213
|
+
var NoiseRawTextureTemplateFactory = class {
|
|
3214
|
+
create() {
|
|
3215
|
+
return {
|
|
3216
|
+
id: import_utils15.IDGenerator.template(),
|
|
3217
|
+
type: "texture-data" /* textureData */,
|
|
3218
|
+
removable: false,
|
|
3219
|
+
data: {
|
|
3220
|
+
title: "Texture Data"
|
|
3221
|
+
},
|
|
3222
|
+
handles: [
|
|
3223
|
+
{
|
|
3224
|
+
position: import_system13.Position.Left,
|
|
3225
|
+
dataType: 2 /* noise */,
|
|
3226
|
+
connection: "target",
|
|
3227
|
+
maxConnections: 1
|
|
3228
|
+
},
|
|
3229
|
+
{
|
|
3230
|
+
position: import_system13.Position.Right,
|
|
3231
|
+
dataType: 1 /* texture */,
|
|
3232
|
+
connection: "source"
|
|
3233
|
+
}
|
|
3234
|
+
]
|
|
3235
|
+
};
|
|
3236
|
+
}
|
|
3237
|
+
isHandleAllowed() {
|
|
3238
|
+
return true;
|
|
3239
|
+
}
|
|
3240
|
+
getHandleAllowedDataType(type) {
|
|
3241
|
+
switch (type) {
|
|
3242
|
+
case "source":
|
|
3243
|
+
return 1 /* texture */;
|
|
3244
|
+
case "target":
|
|
3245
|
+
return 2 /* noise */;
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
|
|
3250
|
+
// src/templates/output/position-logger-template.ts
|
|
3251
|
+
var import_utils16 = require("@awesome-flow/core/utils");
|
|
3252
|
+
var import_system14 = require("@xyflow/system");
|
|
3253
|
+
var PositionLoggerNodeTemplateFactory = class {
|
|
3254
|
+
create() {
|
|
3255
|
+
return {
|
|
3256
|
+
id: import_utils16.IDGenerator.template(),
|
|
3257
|
+
type: "position-logger" /* positionLogger */,
|
|
3258
|
+
removable: false,
|
|
3259
|
+
data: {
|
|
3260
|
+
title: "Position Logger"
|
|
3261
|
+
},
|
|
3262
|
+
handles: [
|
|
3263
|
+
{
|
|
3264
|
+
position: import_system14.Position.Left,
|
|
3265
|
+
dataType: 4 /* position */,
|
|
3266
|
+
connection: "target"
|
|
3267
|
+
}
|
|
3268
|
+
]
|
|
3269
|
+
};
|
|
3270
|
+
}
|
|
3271
|
+
isHandleAllowed(type) {
|
|
3272
|
+
return type === "target";
|
|
3273
|
+
}
|
|
3274
|
+
getHandleAllowedDataType(type) {
|
|
3275
|
+
return 4 /* position */;
|
|
3276
|
+
}
|
|
3277
|
+
};
|
|
3278
|
+
|
|
3279
|
+
// src/templates/modifiers/noise-combine-template.ts
|
|
3280
|
+
var import_utils17 = require("@awesome-flow/core/utils");
|
|
3281
|
+
var import_system15 = require("@xyflow/system");
|
|
3282
|
+
var NoiseCombineNodeTemplateFactory = class {
|
|
3283
|
+
create() {
|
|
3284
|
+
return {
|
|
3285
|
+
id: import_utils17.IDGenerator.template(),
|
|
3286
|
+
type: "noise-combiner" /* noiseCombine */,
|
|
3287
|
+
removable: false,
|
|
3288
|
+
data: {
|
|
3289
|
+
title: "Combine Noise",
|
|
3290
|
+
operation: "add" /* add */
|
|
3291
|
+
},
|
|
3292
|
+
handles: [
|
|
3293
|
+
{
|
|
3294
|
+
position: import_system15.Position.Left,
|
|
3295
|
+
dataType: 8 /* module */,
|
|
3296
|
+
connection: "target",
|
|
3297
|
+
maxConnections: 2
|
|
3298
|
+
},
|
|
3299
|
+
{
|
|
3300
|
+
position: import_system15.Position.Right,
|
|
3301
|
+
dataType: 8 /* module */,
|
|
3302
|
+
connection: "source"
|
|
3303
|
+
}
|
|
3304
|
+
]
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
3307
|
+
isHandleAllowed() {
|
|
3308
|
+
return true;
|
|
3309
|
+
}
|
|
3310
|
+
getHandleAllowedDataType(type) {
|
|
3311
|
+
return 8 /* module */;
|
|
3312
|
+
}
|
|
3313
|
+
};
|
|
3314
|
+
|
|
3315
|
+
// src/templates/modifiers/noise-clamp-template.ts
|
|
3316
|
+
var import_utils18 = require("@awesome-flow/core/utils");
|
|
3317
|
+
var import_system16 = require("@xyflow/system");
|
|
3318
|
+
var NoiseClampNodeTemplateFactory = class {
|
|
3319
|
+
create() {
|
|
3320
|
+
return {
|
|
3321
|
+
id: import_utils18.IDGenerator.template(),
|
|
3322
|
+
type: "noise-clamp" /* noiseClamp */,
|
|
3323
|
+
removable: false,
|
|
3324
|
+
data: {
|
|
3325
|
+
title: "Clamp Noise",
|
|
3326
|
+
lowerBound: -1,
|
|
3327
|
+
upperBound: 1
|
|
3328
|
+
},
|
|
3329
|
+
handles: [
|
|
3330
|
+
{
|
|
3331
|
+
position: import_system16.Position.Left,
|
|
3332
|
+
dataType: 8 /* module */,
|
|
3333
|
+
connection: "target",
|
|
3334
|
+
maxConnections: 1
|
|
3335
|
+
},
|
|
3336
|
+
{
|
|
3337
|
+
position: import_system16.Position.Right,
|
|
3338
|
+
dataType: 8 /* module */,
|
|
3339
|
+
connection: "source"
|
|
3340
|
+
}
|
|
3341
|
+
]
|
|
3342
|
+
};
|
|
3343
|
+
}
|
|
3344
|
+
isHandleAllowed() {
|
|
3345
|
+
return true;
|
|
3346
|
+
}
|
|
3347
|
+
getHandleAllowedDataType(type) {
|
|
3348
|
+
return 8 /* module */;
|
|
3349
|
+
}
|
|
3350
|
+
};
|
|
3351
|
+
|
|
3352
|
+
// src/templates/modifiers/noise-abs-template.ts
|
|
3353
|
+
var import_utils19 = require("@awesome-flow/core/utils");
|
|
3354
|
+
var import_system17 = require("@xyflow/system");
|
|
3355
|
+
var NoiseAbsNodeTemplateFactory = class {
|
|
3356
|
+
create() {
|
|
3357
|
+
return {
|
|
3358
|
+
id: import_utils19.IDGenerator.template(),
|
|
3359
|
+
type: "noise-abs" /* noiseAbs */,
|
|
3360
|
+
removable: false,
|
|
3361
|
+
data: {
|
|
3362
|
+
title: "Abs Noise"
|
|
3363
|
+
},
|
|
3364
|
+
handles: [
|
|
3365
|
+
{
|
|
3366
|
+
position: import_system17.Position.Left,
|
|
3367
|
+
dataType: 8 /* module */,
|
|
3368
|
+
connection: "target",
|
|
3369
|
+
maxConnections: 1
|
|
3370
|
+
},
|
|
3371
|
+
{
|
|
3372
|
+
position: import_system17.Position.Right,
|
|
3373
|
+
dataType: 8 /* module */,
|
|
3374
|
+
connection: "source"
|
|
3375
|
+
}
|
|
3376
|
+
]
|
|
3377
|
+
};
|
|
3378
|
+
}
|
|
3379
|
+
isHandleAllowed() {
|
|
3380
|
+
return true;
|
|
3381
|
+
}
|
|
3382
|
+
getHandleAllowedDataType(type) {
|
|
3383
|
+
return 8 /* module */;
|
|
3384
|
+
}
|
|
3385
|
+
};
|
|
3386
|
+
|
|
3387
|
+
// src/templates/output/noise-output-template.ts
|
|
3388
|
+
var import_utils20 = require("@awesome-flow/core/utils");
|
|
3389
|
+
var import_system18 = require("@xyflow/system");
|
|
3390
|
+
var NoiseOutputNodeTemplateFactory = class {
|
|
3391
|
+
create() {
|
|
3392
|
+
return {
|
|
3393
|
+
id: import_utils20.IDGenerator.template(),
|
|
3394
|
+
type: "noise-output" /* noiseOutput */,
|
|
3395
|
+
removable: false,
|
|
3396
|
+
data: {
|
|
3397
|
+
title: "Noise Output"
|
|
3398
|
+
},
|
|
3399
|
+
handles: [
|
|
3400
|
+
{
|
|
3401
|
+
position: import_system18.Position.Left,
|
|
3402
|
+
dataType: 4 /* position */,
|
|
3403
|
+
connection: "target"
|
|
3404
|
+
},
|
|
3405
|
+
{
|
|
3406
|
+
position: import_system18.Position.Left,
|
|
3407
|
+
dataType: 8 /* module */,
|
|
3408
|
+
connection: "target",
|
|
3409
|
+
maxConnections: 1
|
|
3410
|
+
},
|
|
3411
|
+
{
|
|
3412
|
+
position: import_system18.Position.Right,
|
|
3413
|
+
dataType: 2 /* noise */,
|
|
3414
|
+
connection: "source"
|
|
3415
|
+
}
|
|
3416
|
+
]
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
isHandleAllowed() {
|
|
3420
|
+
return true;
|
|
3421
|
+
}
|
|
3422
|
+
getHandleAllowedDataType(type) {
|
|
3423
|
+
switch (type) {
|
|
3424
|
+
case "source":
|
|
3425
|
+
return 2 /* noise */;
|
|
3426
|
+
case "target":
|
|
3427
|
+
return 8 /* module */ & 4 /* position */;
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
};
|
|
3431
|
+
|
|
3432
|
+
// src/templates/modifiers/noise-curve-template.ts
|
|
3433
|
+
var import_utils21 = require("@awesome-flow/core/utils");
|
|
3434
|
+
var import_system19 = require("@xyflow/system");
|
|
3435
|
+
var NoiseCurveNodeTemplateFactory = class {
|
|
3436
|
+
create() {
|
|
3437
|
+
return {
|
|
3438
|
+
id: import_utils21.IDGenerator.template(),
|
|
3439
|
+
type: "noise-curve" /* noiseCurve */,
|
|
3440
|
+
removable: false,
|
|
3441
|
+
data: {
|
|
3442
|
+
title: "Noise Curve",
|
|
3443
|
+
points: []
|
|
3444
|
+
},
|
|
3445
|
+
handles: [
|
|
3446
|
+
{
|
|
3447
|
+
position: import_system19.Position.Left,
|
|
3448
|
+
dataType: 8 /* module */,
|
|
3449
|
+
connection: "target",
|
|
3450
|
+
maxConnections: 1
|
|
3451
|
+
},
|
|
3452
|
+
{
|
|
3453
|
+
position: import_system19.Position.Right,
|
|
3454
|
+
dataType: 8 /* module */,
|
|
3455
|
+
connection: "source"
|
|
3456
|
+
}
|
|
3457
|
+
]
|
|
3458
|
+
};
|
|
3459
|
+
}
|
|
3460
|
+
isHandleAllowed() {
|
|
3461
|
+
return true;
|
|
3462
|
+
}
|
|
3463
|
+
getHandleAllowedDataType(type) {
|
|
3464
|
+
return 8 /* module */;
|
|
3465
|
+
}
|
|
3466
|
+
};
|
|
3467
|
+
|
|
3468
|
+
// src/templates/modifiers/noise-exponent-template.ts
|
|
3469
|
+
var import_utils22 = require("@awesome-flow/core/utils");
|
|
3470
|
+
var import_system20 = require("@xyflow/system");
|
|
3471
|
+
var NoiseExponentNodeTemplateFactory = class {
|
|
3472
|
+
create() {
|
|
3473
|
+
return {
|
|
3474
|
+
id: import_utils22.IDGenerator.template(),
|
|
3475
|
+
type: "noise-exponent" /* noiseExponent */,
|
|
3476
|
+
removable: false,
|
|
3477
|
+
data: {
|
|
3478
|
+
title: "Noise Exponent",
|
|
3479
|
+
exponent: 1
|
|
3480
|
+
},
|
|
3481
|
+
handles: [
|
|
3482
|
+
{
|
|
3483
|
+
position: import_system20.Position.Left,
|
|
3484
|
+
dataType: 8 /* module */,
|
|
3485
|
+
connection: "target",
|
|
3486
|
+
maxConnections: 1
|
|
3487
|
+
},
|
|
3488
|
+
{
|
|
3489
|
+
position: import_system20.Position.Right,
|
|
3490
|
+
dataType: 8 /* module */,
|
|
3491
|
+
connection: "source"
|
|
3492
|
+
}
|
|
3493
|
+
]
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
isHandleAllowed() {
|
|
3497
|
+
return true;
|
|
3498
|
+
}
|
|
3499
|
+
getHandleAllowedDataType(type) {
|
|
3500
|
+
return 8 /* module */;
|
|
3501
|
+
}
|
|
3502
|
+
};
|
|
3503
|
+
|
|
3504
|
+
// src/templates/modifiers/noise-invert-template.ts
|
|
3505
|
+
var import_utils23 = require("@awesome-flow/core/utils");
|
|
3506
|
+
var import_system21 = require("@xyflow/system");
|
|
3507
|
+
var NoiseInvertNodeTemplateFactory = class {
|
|
3508
|
+
create() {
|
|
3509
|
+
return {
|
|
3510
|
+
id: import_utils23.IDGenerator.template(),
|
|
3511
|
+
type: "noise-invert" /* noiseInvert */,
|
|
3512
|
+
removable: false,
|
|
3513
|
+
data: {
|
|
3514
|
+
title: "Invert Noise"
|
|
3515
|
+
},
|
|
3516
|
+
handles: [
|
|
3517
|
+
{
|
|
3518
|
+
position: import_system21.Position.Left,
|
|
3519
|
+
dataType: 8 /* module */,
|
|
3520
|
+
connection: "target",
|
|
3521
|
+
maxConnections: 1
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
position: import_system21.Position.Right,
|
|
3525
|
+
dataType: 8 /* module */,
|
|
3526
|
+
connection: "source"
|
|
3527
|
+
}
|
|
3528
|
+
]
|
|
3529
|
+
};
|
|
3530
|
+
}
|
|
3531
|
+
isHandleAllowed() {
|
|
3532
|
+
return true;
|
|
3533
|
+
}
|
|
3534
|
+
getHandleAllowedDataType(type) {
|
|
3535
|
+
return 8 /* module */;
|
|
3536
|
+
}
|
|
3537
|
+
};
|
|
3538
|
+
|
|
3539
|
+
// src/templates/modifiers/noise-scalebias-template.ts
|
|
3540
|
+
var import_utils24 = require("@awesome-flow/core/utils");
|
|
3541
|
+
var import_system22 = require("@xyflow/system");
|
|
3542
|
+
var NoiseScaleBiasNodeTemplateFactory = class {
|
|
3543
|
+
create() {
|
|
3544
|
+
return {
|
|
3545
|
+
id: import_utils24.IDGenerator.template(),
|
|
3546
|
+
type: "noise-scale-bias" /* noiseScaleBias */,
|
|
3547
|
+
removable: false,
|
|
3548
|
+
data: {
|
|
3549
|
+
title: "Scale/Bias Noise",
|
|
3550
|
+
scale: 1,
|
|
3551
|
+
bias: 0
|
|
3552
|
+
},
|
|
3553
|
+
handles: [
|
|
3554
|
+
{
|
|
3555
|
+
position: import_system22.Position.Left,
|
|
3556
|
+
dataType: 8 /* module */,
|
|
3557
|
+
connection: "target",
|
|
3558
|
+
maxConnections: 1
|
|
3559
|
+
},
|
|
3560
|
+
{
|
|
3561
|
+
position: import_system22.Position.Right,
|
|
3562
|
+
dataType: 8 /* module */,
|
|
3563
|
+
connection: "source"
|
|
3564
|
+
}
|
|
3565
|
+
]
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
isHandleAllowed() {
|
|
3569
|
+
return true;
|
|
3570
|
+
}
|
|
3571
|
+
getHandleAllowedDataType(type) {
|
|
3572
|
+
return 8 /* module */;
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
|
|
3576
|
+
// src/templates/modifiers/noise-terrace-template.ts
|
|
3577
|
+
var import_utils25 = require("@awesome-flow/core/utils");
|
|
3578
|
+
var import_system23 = require("@xyflow/system");
|
|
3579
|
+
var NoiseTerraceNodeTemplateFactory = class {
|
|
3580
|
+
create() {
|
|
3581
|
+
return {
|
|
3582
|
+
id: import_utils25.IDGenerator.template(),
|
|
3583
|
+
type: "noise-terrace" /* noiseTerrace */,
|
|
3584
|
+
removable: false,
|
|
3585
|
+
data: {
|
|
3586
|
+
title: "Noise Terrace",
|
|
3587
|
+
points: []
|
|
3588
|
+
},
|
|
3589
|
+
handles: [
|
|
3590
|
+
{
|
|
3591
|
+
position: import_system23.Position.Left,
|
|
3592
|
+
dataType: 8 /* module */,
|
|
3593
|
+
connection: "target",
|
|
3594
|
+
maxConnections: 1
|
|
3595
|
+
},
|
|
3596
|
+
{
|
|
3597
|
+
position: import_system23.Position.Right,
|
|
3598
|
+
dataType: 8 /* module */,
|
|
3599
|
+
connection: "source"
|
|
3600
|
+
}
|
|
3601
|
+
]
|
|
3602
|
+
};
|
|
3603
|
+
}
|
|
3604
|
+
isHandleAllowed() {
|
|
3605
|
+
return true;
|
|
3606
|
+
}
|
|
3607
|
+
getHandleAllowedDataType(type) {
|
|
3608
|
+
return 8 /* module */;
|
|
3609
|
+
}
|
|
3610
|
+
};
|
|
3611
|
+
|
|
3612
|
+
// src/templates/selectors/noise-blend-template.ts
|
|
3613
|
+
var import_utils26 = require("@awesome-flow/core/utils");
|
|
3614
|
+
var import_system24 = require("@xyflow/system");
|
|
3615
|
+
var NoiseBlendNodeTemplateFactory = class {
|
|
3616
|
+
create() {
|
|
3617
|
+
return {
|
|
3618
|
+
id: import_utils26.IDGenerator.template(),
|
|
3619
|
+
type: "noise-blend" /* noiseBlend */,
|
|
3620
|
+
removable: false,
|
|
3621
|
+
data: {
|
|
3622
|
+
title: "Noise Blend"
|
|
3623
|
+
},
|
|
3624
|
+
handles: [
|
|
3625
|
+
{
|
|
3626
|
+
position: import_system24.Position.Left,
|
|
3627
|
+
dataType: 8 /* module */,
|
|
3628
|
+
connection: "target",
|
|
3629
|
+
label: "Source Modules",
|
|
3630
|
+
maxConnections: 2
|
|
3631
|
+
},
|
|
3632
|
+
{
|
|
3633
|
+
position: import_system24.Position.Left,
|
|
3634
|
+
dataType: 8 /* module */,
|
|
3635
|
+
connection: "target",
|
|
3636
|
+
label: "Control Module",
|
|
3637
|
+
maxConnections: 1
|
|
3638
|
+
},
|
|
3639
|
+
{
|
|
3640
|
+
position: import_system24.Position.Right,
|
|
3641
|
+
dataType: 8 /* module */,
|
|
3642
|
+
connection: "source"
|
|
3643
|
+
}
|
|
3644
|
+
]
|
|
3645
|
+
};
|
|
3646
|
+
}
|
|
3647
|
+
isHandleAllowed() {
|
|
3648
|
+
return true;
|
|
3649
|
+
}
|
|
3650
|
+
getHandleAllowedDataType() {
|
|
3651
|
+
return 8 /* module */;
|
|
3652
|
+
}
|
|
3653
|
+
};
|
|
3654
|
+
|
|
3655
|
+
// src/templates/selectors/noise-select-template.ts
|
|
3656
|
+
var import_utils27 = require("@awesome-flow/core/utils");
|
|
3657
|
+
var import_system25 = require("@xyflow/system");
|
|
3658
|
+
var NoiseSelectNodeTemplateFactory = class {
|
|
3659
|
+
create() {
|
|
3660
|
+
return {
|
|
3661
|
+
id: import_utils27.IDGenerator.template(),
|
|
3662
|
+
type: "noise-select" /* noiseSelect */,
|
|
3663
|
+
removable: false,
|
|
3664
|
+
data: {
|
|
3665
|
+
title: "Noise Select",
|
|
3666
|
+
edgeFalloff: 0,
|
|
3667
|
+
lowerBound: -1,
|
|
3668
|
+
upperBound: 1
|
|
3669
|
+
},
|
|
3670
|
+
handles: [
|
|
3671
|
+
{
|
|
3672
|
+
position: import_system25.Position.Left,
|
|
3673
|
+
dataType: 8 /* module */,
|
|
3674
|
+
connection: "target",
|
|
3675
|
+
label: "Source Modules",
|
|
3676
|
+
maxConnections: 2
|
|
3677
|
+
},
|
|
3678
|
+
{
|
|
3679
|
+
position: import_system25.Position.Left,
|
|
3680
|
+
dataType: 8 /* module */,
|
|
3681
|
+
connection: "target",
|
|
3682
|
+
label: "Control Module",
|
|
3683
|
+
maxConnections: 1
|
|
3684
|
+
},
|
|
3685
|
+
{
|
|
3686
|
+
position: import_system25.Position.Right,
|
|
3687
|
+
dataType: 8 /* module */,
|
|
3688
|
+
connection: "source"
|
|
3689
|
+
}
|
|
3690
|
+
]
|
|
3691
|
+
};
|
|
3692
|
+
}
|
|
3693
|
+
isHandleAllowed() {
|
|
3694
|
+
return true;
|
|
3695
|
+
}
|
|
3696
|
+
getHandleAllowedDataType() {
|
|
3697
|
+
return 8 /* module */;
|
|
3698
|
+
}
|
|
3699
|
+
};
|
|
3700
|
+
|
|
3701
|
+
// src/templates/transformers/noise-displace-template.ts
|
|
3702
|
+
var import_utils28 = require("@awesome-flow/core/utils");
|
|
3703
|
+
var import_system26 = require("@xyflow/system");
|
|
3704
|
+
var NoiseDisplaceNodeTemplateFactory = class {
|
|
3705
|
+
create() {
|
|
3706
|
+
return {
|
|
3707
|
+
id: import_utils28.IDGenerator.template(),
|
|
3708
|
+
type: "noise-displace" /* noiseDisplace */,
|
|
3709
|
+
data: {
|
|
3710
|
+
title: "Noise Displace"
|
|
3711
|
+
},
|
|
3712
|
+
handles: [
|
|
3713
|
+
{
|
|
3714
|
+
position: import_system26.Position.Left,
|
|
3715
|
+
connection: "target",
|
|
3716
|
+
label: "Source Module",
|
|
3717
|
+
dataType: 8 /* module */,
|
|
3718
|
+
dataId: "source" /* sourceModule */,
|
|
3719
|
+
maxConnections: 1
|
|
3720
|
+
},
|
|
3721
|
+
{
|
|
3722
|
+
position: import_system26.Position.Left,
|
|
3723
|
+
connection: "target",
|
|
3724
|
+
label: "X Module",
|
|
3725
|
+
dataType: 8 /* module */,
|
|
3726
|
+
dataId: "x-module" /* xModule */,
|
|
3727
|
+
maxConnections: 1
|
|
3728
|
+
},
|
|
3729
|
+
{
|
|
3730
|
+
position: import_system26.Position.Left,
|
|
3731
|
+
connection: "target",
|
|
3732
|
+
label: "Y Module",
|
|
3733
|
+
dataType: 8 /* module */,
|
|
3734
|
+
dataId: "y-module" /* yModule */,
|
|
3735
|
+
maxConnections: 1
|
|
3736
|
+
},
|
|
3737
|
+
{
|
|
3738
|
+
position: import_system26.Position.Left,
|
|
3739
|
+
connection: "target",
|
|
3740
|
+
label: "Z Module",
|
|
3741
|
+
dataType: 8 /* module */,
|
|
3742
|
+
dataId: "z-module" /* zModule */,
|
|
3743
|
+
maxConnections: 1
|
|
3744
|
+
},
|
|
3745
|
+
{
|
|
3746
|
+
position: import_system26.Position.Right,
|
|
3747
|
+
dataType: 8 /* module */,
|
|
3748
|
+
dataId: "output" /* output */,
|
|
3749
|
+
connection: "source"
|
|
3750
|
+
}
|
|
3751
|
+
]
|
|
3752
|
+
};
|
|
3753
|
+
}
|
|
3754
|
+
isHandleAllowed() {
|
|
3755
|
+
return true;
|
|
3756
|
+
}
|
|
3757
|
+
getHandleAllowedDataType() {
|
|
3758
|
+
return 8 /* module */;
|
|
3759
|
+
}
|
|
3760
|
+
};
|
|
3761
|
+
|
|
3762
|
+
// src/templates/transformers/noise-rotate-point-template.ts
|
|
3763
|
+
var import_utils29 = require("@awesome-flow/core/utils");
|
|
3764
|
+
var import_system27 = require("@xyflow/system");
|
|
3765
|
+
var NoiseRotatePointNodeTemplateFactory = class {
|
|
3766
|
+
create() {
|
|
3767
|
+
return {
|
|
3768
|
+
id: import_utils29.IDGenerator.template(),
|
|
3769
|
+
type: "noise-rotate-point" /* noiseRotatePoint */,
|
|
3770
|
+
removable: false,
|
|
3771
|
+
data: {
|
|
3772
|
+
title: "Noise Rotate Point",
|
|
3773
|
+
xAngle: 0,
|
|
3774
|
+
yAngle: 0,
|
|
3775
|
+
zAngle: 0
|
|
3776
|
+
},
|
|
3777
|
+
handles: [
|
|
3778
|
+
{
|
|
3779
|
+
position: import_system27.Position.Left,
|
|
3780
|
+
dataType: 8 /* module */,
|
|
3781
|
+
connection: "target",
|
|
3782
|
+
label: "Source Module",
|
|
3783
|
+
maxConnections: 1
|
|
3784
|
+
},
|
|
3785
|
+
{
|
|
3786
|
+
position: import_system27.Position.Right,
|
|
3787
|
+
dataType: 8 /* module */,
|
|
3788
|
+
connection: "source"
|
|
3789
|
+
}
|
|
3790
|
+
]
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
isHandleAllowed() {
|
|
3794
|
+
return true;
|
|
3795
|
+
}
|
|
3796
|
+
getHandleAllowedDataType() {
|
|
3797
|
+
return 8 /* module */;
|
|
3798
|
+
}
|
|
3799
|
+
};
|
|
3800
|
+
|
|
3801
|
+
// src/templates/transformers/noise-scale-point-template.ts
|
|
3802
|
+
var import_utils30 = require("@awesome-flow/core/utils");
|
|
3803
|
+
var import_system28 = require("@xyflow/system");
|
|
3804
|
+
var NoiseScalePointNodeTemplateFactory = class {
|
|
3805
|
+
create() {
|
|
3806
|
+
return {
|
|
3807
|
+
id: import_utils30.IDGenerator.template(),
|
|
3808
|
+
type: "noise-scale-point" /* noiseScalePoint */,
|
|
3809
|
+
data: {
|
|
3810
|
+
title: "Noise Scale Point",
|
|
3811
|
+
xScale: 1,
|
|
3812
|
+
yScale: 1,
|
|
3813
|
+
zScale: 1
|
|
3814
|
+
},
|
|
3815
|
+
handles: [
|
|
3816
|
+
{
|
|
3817
|
+
position: import_system28.Position.Left,
|
|
3818
|
+
dataType: 8 /* module */,
|
|
3819
|
+
connection: "target",
|
|
3820
|
+
label: "Source Module",
|
|
3821
|
+
maxConnections: 1
|
|
3822
|
+
},
|
|
3823
|
+
{
|
|
3824
|
+
position: import_system28.Position.Right,
|
|
3825
|
+
dataType: 8 /* module */,
|
|
3826
|
+
connection: "source"
|
|
3827
|
+
}
|
|
3828
|
+
]
|
|
3829
|
+
};
|
|
3830
|
+
}
|
|
3831
|
+
isHandleAllowed() {
|
|
3832
|
+
return true;
|
|
3833
|
+
}
|
|
3834
|
+
getHandleAllowedDataType() {
|
|
3835
|
+
return 8 /* module */;
|
|
3836
|
+
}
|
|
3837
|
+
};
|
|
3838
|
+
|
|
3839
|
+
// src/templates/transformers/noise-translate-point-template.ts
|
|
3840
|
+
var import_utils31 = require("@awesome-flow/core/utils");
|
|
3841
|
+
var import_system29 = require("@xyflow/system");
|
|
3842
|
+
var NoiseTranslatePointNodeTemplateFactory = class {
|
|
3843
|
+
create() {
|
|
3844
|
+
return {
|
|
3845
|
+
id: import_utils31.IDGenerator.template(),
|
|
3846
|
+
type: "noise-translate-point" /* noiseTranslatePoint */,
|
|
3847
|
+
data: {
|
|
3848
|
+
title: "Noise Translate Point",
|
|
3849
|
+
translateX: 0,
|
|
3850
|
+
translateY: 0,
|
|
3851
|
+
translateZ: 0
|
|
3852
|
+
},
|
|
3853
|
+
handles: [
|
|
3854
|
+
{
|
|
3855
|
+
position: import_system29.Position.Left,
|
|
3856
|
+
dataType: 8 /* module */,
|
|
3857
|
+
connection: "target",
|
|
3858
|
+
label: "Source Module",
|
|
3859
|
+
maxConnections: 1
|
|
3860
|
+
},
|
|
3861
|
+
{
|
|
3862
|
+
position: import_system29.Position.Right,
|
|
3863
|
+
dataType: 8 /* module */,
|
|
3864
|
+
connection: "source"
|
|
3865
|
+
}
|
|
3866
|
+
]
|
|
3867
|
+
};
|
|
3868
|
+
}
|
|
3869
|
+
isHandleAllowed() {
|
|
3870
|
+
return true;
|
|
3871
|
+
}
|
|
3872
|
+
getHandleAllowedDataType() {
|
|
3873
|
+
return 8 /* module */;
|
|
3874
|
+
}
|
|
3875
|
+
};
|
|
3876
|
+
|
|
3877
|
+
// src/templates/transformers/noise-turbulence-template.ts
|
|
3878
|
+
var import_utils32 = require("@awesome-flow/core/utils");
|
|
3879
|
+
var import_system30 = require("@xyflow/system");
|
|
3880
|
+
var NoiseTurbulenceNodeTemplateFactory = class {
|
|
3881
|
+
create() {
|
|
3882
|
+
return {
|
|
3883
|
+
id: import_utils32.IDGenerator.template(),
|
|
3884
|
+
type: "noise-turbulence" /* noiseTurbulence */,
|
|
3885
|
+
data: {
|
|
3886
|
+
title: "Noise Turbulence",
|
|
3887
|
+
frequency: 1,
|
|
3888
|
+
power: 1,
|
|
3889
|
+
roughness: 1,
|
|
3890
|
+
seed: 0
|
|
3891
|
+
},
|
|
3892
|
+
handles: [
|
|
3893
|
+
{
|
|
3894
|
+
position: import_system30.Position.Left,
|
|
3895
|
+
dataType: 8 /* module */,
|
|
3896
|
+
connection: "target",
|
|
3897
|
+
label: "Source Module",
|
|
3898
|
+
maxConnections: 1
|
|
3899
|
+
},
|
|
3900
|
+
{
|
|
3901
|
+
position: import_system30.Position.Left,
|
|
3902
|
+
dataType: 16 /* variableProperty */,
|
|
3903
|
+
label: "Variable Properties",
|
|
3904
|
+
connection: "target"
|
|
3905
|
+
},
|
|
3906
|
+
{
|
|
3907
|
+
position: import_system30.Position.Right,
|
|
3908
|
+
dataType: 8 /* module */,
|
|
3909
|
+
connection: "source"
|
|
3910
|
+
}
|
|
3911
|
+
]
|
|
3912
|
+
};
|
|
3913
|
+
}
|
|
3914
|
+
isHandleAllowed() {
|
|
3915
|
+
return true;
|
|
3916
|
+
}
|
|
3917
|
+
getHandleAllowedDataType() {
|
|
3918
|
+
return 8 /* module */;
|
|
3919
|
+
}
|
|
3920
|
+
};
|
|
3921
|
+
|
|
3922
|
+
// src/templates/generators/variable-property-template.ts
|
|
3923
|
+
var import_utils33 = require("@awesome-flow/core/utils");
|
|
3924
|
+
var import_system31 = require("@xyflow/system");
|
|
3925
|
+
var VariablePropertyNodeTemplateFactory = class {
|
|
3926
|
+
create() {
|
|
3927
|
+
return {
|
|
3928
|
+
id: import_utils33.IDGenerator.template(),
|
|
3929
|
+
type: "variable-property" /* variableProperty */,
|
|
3930
|
+
data: {
|
|
3931
|
+
title: "Variable Property",
|
|
3932
|
+
property: null
|
|
3933
|
+
},
|
|
3934
|
+
handles: [
|
|
3935
|
+
{
|
|
3936
|
+
position: import_system31.Position.Left,
|
|
3937
|
+
dataType: 32 /* variableValue */,
|
|
3938
|
+
connection: "target",
|
|
3939
|
+
maxConnections: 1
|
|
3940
|
+
},
|
|
3941
|
+
{
|
|
3942
|
+
position: import_system31.Position.Right,
|
|
3943
|
+
dataType: 16 /* variableProperty */,
|
|
3944
|
+
connection: "source"
|
|
3945
|
+
}
|
|
3946
|
+
]
|
|
3947
|
+
};
|
|
3948
|
+
}
|
|
3949
|
+
isHandleAllowed(type) {
|
|
3950
|
+
return true;
|
|
3951
|
+
}
|
|
3952
|
+
getHandleAllowedDataType(type) {
|
|
3953
|
+
switch (type) {
|
|
3954
|
+
case "source":
|
|
3955
|
+
return 16 /* variableProperty */;
|
|
3956
|
+
case "target":
|
|
3957
|
+
return 32 /* variableValue */;
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
};
|
|
3961
|
+
|
|
3962
|
+
// src/templates/modifiers/variable-combine-template.ts
|
|
3963
|
+
var import_utils34 = require("@awesome-flow/core/utils");
|
|
3964
|
+
var import_system32 = require("@xyflow/system");
|
|
3965
|
+
var VariableCombineNodeTemplateFactory = class {
|
|
3966
|
+
create() {
|
|
3967
|
+
return {
|
|
3968
|
+
id: import_utils34.IDGenerator.template(),
|
|
3969
|
+
type: "variable-combine" /* variableCombine */,
|
|
3970
|
+
removable: false,
|
|
3971
|
+
data: {
|
|
3972
|
+
title: "Combine Values",
|
|
3973
|
+
operation: "add" /* add */,
|
|
3974
|
+
value: null
|
|
3975
|
+
},
|
|
3976
|
+
handles: [
|
|
3977
|
+
{
|
|
3978
|
+
position: import_system32.Position.Left,
|
|
3979
|
+
dataType: 32 /* variableValue */,
|
|
3980
|
+
connection: "target"
|
|
3981
|
+
},
|
|
3982
|
+
{
|
|
3983
|
+
position: import_system32.Position.Right,
|
|
3984
|
+
dataType: 32 /* variableValue */,
|
|
3985
|
+
connection: "source"
|
|
3986
|
+
}
|
|
3987
|
+
]
|
|
3988
|
+
};
|
|
3989
|
+
}
|
|
3990
|
+
isHandleAllowed() {
|
|
3991
|
+
return true;
|
|
3992
|
+
}
|
|
3993
|
+
getHandleAllowedDataType(type) {
|
|
3994
|
+
return 8 /* module */;
|
|
3995
|
+
}
|
|
3996
|
+
};
|
|
3997
|
+
|
|
3998
|
+
// src/templates/generators/variable-value-template.ts
|
|
3999
|
+
var import_utils35 = require("@awesome-flow/core/utils");
|
|
4000
|
+
var import_system33 = require("@xyflow/system");
|
|
4001
|
+
var VariableValueNodeTemplateFactory = class {
|
|
4002
|
+
create() {
|
|
4003
|
+
return {
|
|
4004
|
+
id: import_utils35.IDGenerator.template(),
|
|
4005
|
+
type: "variable-value" /* variableValue */,
|
|
4006
|
+
data: {
|
|
4007
|
+
title: "Variable Value",
|
|
4008
|
+
value: null
|
|
4009
|
+
},
|
|
4010
|
+
handles: [
|
|
4011
|
+
{
|
|
4012
|
+
position: import_system33.Position.Right,
|
|
4013
|
+
dataType: 32 /* variableValue */,
|
|
4014
|
+
connection: "source"
|
|
4015
|
+
}
|
|
4016
|
+
]
|
|
4017
|
+
};
|
|
4018
|
+
}
|
|
4019
|
+
isHandleAllowed(type) {
|
|
4020
|
+
return type === "source";
|
|
4021
|
+
}
|
|
4022
|
+
getHandleAllowedDataType(type) {
|
|
4023
|
+
return 32 /* variableValue */;
|
|
4024
|
+
}
|
|
4025
|
+
};
|
|
4026
|
+
|
|
4027
|
+
// src/templates/groups/module-group-template.ts
|
|
4028
|
+
var import_utils36 = require("@awesome-flow/core/utils");
|
|
4029
|
+
var import_system34 = require("@xyflow/system");
|
|
4030
|
+
var ModuleGroupNodeTemplateFactory = class {
|
|
4031
|
+
create() {
|
|
4032
|
+
return {
|
|
4033
|
+
id: import_utils36.IDGenerator.template(),
|
|
4034
|
+
type: "group-module" /* groupModule */,
|
|
4035
|
+
data: {
|
|
4036
|
+
title: "Modules Group",
|
|
4037
|
+
isGroup: true,
|
|
4038
|
+
initialSize: {
|
|
4039
|
+
width: 300,
|
|
4040
|
+
height: 200
|
|
4041
|
+
},
|
|
4042
|
+
collapsedSize: {
|
|
4043
|
+
width: 300,
|
|
4044
|
+
height: 80
|
|
4045
|
+
}
|
|
4046
|
+
},
|
|
4047
|
+
handles: [
|
|
4048
|
+
{
|
|
4049
|
+
position: import_system34.Position.Bottom,
|
|
4050
|
+
dataType: 8 /* module */,
|
|
4051
|
+
connection: "target",
|
|
4052
|
+
maxConnections: 1,
|
|
4053
|
+
hideOnCollapse: true
|
|
4054
|
+
},
|
|
4055
|
+
{
|
|
4056
|
+
position: import_system34.Position.Right,
|
|
4057
|
+
dataType: 8 /* module */,
|
|
4058
|
+
connection: "source"
|
|
4059
|
+
}
|
|
4060
|
+
]
|
|
4061
|
+
};
|
|
4062
|
+
}
|
|
4063
|
+
isHandleAllowed(type) {
|
|
4064
|
+
return true;
|
|
4065
|
+
}
|
|
4066
|
+
getHandleAllowedDataType(type) {
|
|
4067
|
+
return 8 /* module */;
|
|
4068
|
+
}
|
|
4069
|
+
};
|
|
4070
|
+
|
|
4071
|
+
// src/templates/generators/noise-billow-template.ts
|
|
4072
|
+
var import_utils37 = require("@awesome-flow/core/utils");
|
|
4073
|
+
var import_system35 = require("@xyflow/system");
|
|
4074
|
+
var NoiseBillowNodeTemplateFactory = class {
|
|
4075
|
+
create() {
|
|
4076
|
+
return {
|
|
4077
|
+
id: import_utils37.IDGenerator.template(),
|
|
4078
|
+
type: "noise-billow" /* noiseBillow */,
|
|
4079
|
+
removable: false,
|
|
4080
|
+
data: {
|
|
4081
|
+
title: "Billow Noise",
|
|
4082
|
+
frequency: 0.1,
|
|
4083
|
+
lacunarity: 2,
|
|
4084
|
+
octaves: 5,
|
|
4085
|
+
persistence: 0.5,
|
|
4086
|
+
seed: 0
|
|
4087
|
+
},
|
|
4088
|
+
handles: [
|
|
4089
|
+
{
|
|
4090
|
+
position: import_system35.Position.Left,
|
|
4091
|
+
dataType: 16 /* variableProperty */,
|
|
4092
|
+
connection: "target"
|
|
4093
|
+
},
|
|
4094
|
+
{
|
|
4095
|
+
position: import_system35.Position.Right,
|
|
4096
|
+
dataType: 8 /* module */,
|
|
4097
|
+
connection: "source"
|
|
4098
|
+
}
|
|
4099
|
+
]
|
|
4100
|
+
};
|
|
4101
|
+
}
|
|
4102
|
+
isHandleAllowed(type) {
|
|
4103
|
+
return type === "source";
|
|
4104
|
+
}
|
|
4105
|
+
getHandleAllowedDataType() {
|
|
4106
|
+
return 8 /* module */;
|
|
4107
|
+
}
|
|
4108
|
+
};
|
|
4109
|
+
|
|
4110
|
+
// src/abstract/node-types.ts
|
|
4111
|
+
var NoiseNodeType = /* @__PURE__ */ ((NoiseNodeType2) => {
|
|
4112
|
+
NoiseNodeType2["position"] = "position";
|
|
4113
|
+
NoiseNodeType2["grid"] = "grid";
|
|
4114
|
+
NoiseNodeType2["noiseOutput"] = "noise-output";
|
|
4115
|
+
NoiseNodeType2["noiseConst"] = "noise-constant";
|
|
4116
|
+
NoiseNodeType2["noiseSimplex"] = "noise-simplex";
|
|
4117
|
+
NoiseNodeType2["noiseBillow"] = "noise-billow";
|
|
4118
|
+
NoiseNodeType2["noiseCheckerboard"] = "noise-checkerboard";
|
|
4119
|
+
NoiseNodeType2["noiseNormalize"] = "noise-normalize";
|
|
4120
|
+
NoiseNodeType2["noiseCylinders"] = "noise-cylinders";
|
|
4121
|
+
NoiseNodeType2["noisePerlin"] = "noise-perlin";
|
|
4122
|
+
NoiseNodeType2["noiseRidgedMulti"] = "noise-ridged-multi";
|
|
4123
|
+
NoiseNodeType2["noiseSpheres"] = "noise-spheres";
|
|
4124
|
+
NoiseNodeType2["noiseVoronoi"] = "noise-voronoi";
|
|
4125
|
+
NoiseNodeType2["textureData"] = "texture-data";
|
|
4126
|
+
NoiseNodeType2["noiseLogger"] = "noise-logger";
|
|
4127
|
+
NoiseNodeType2["positionLogger"] = "position-logger";
|
|
4128
|
+
NoiseNodeType2["noiseCombine"] = "noise-combiner";
|
|
4129
|
+
NoiseNodeType2["noiseClamp"] = "noise-clamp";
|
|
4130
|
+
NoiseNodeType2["noiseAbs"] = "noise-abs";
|
|
4131
|
+
NoiseNodeType2["noiseCurve"] = "noise-curve";
|
|
4132
|
+
NoiseNodeType2["noiseExponent"] = "noise-exponent";
|
|
4133
|
+
NoiseNodeType2["noiseInvert"] = "noise-invert";
|
|
4134
|
+
NoiseNodeType2["noiseScaleBias"] = "noise-scale-bias";
|
|
4135
|
+
NoiseNodeType2["noiseTerrace"] = "noise-terrace";
|
|
4136
|
+
NoiseNodeType2["noiseBlend"] = "noise-blend";
|
|
4137
|
+
NoiseNodeType2["noiseSelect"] = "noise-select";
|
|
4138
|
+
NoiseNodeType2["noiseDisplace"] = "noise-displace";
|
|
4139
|
+
NoiseNodeType2["noiseRotatePoint"] = "noise-rotate-point";
|
|
4140
|
+
NoiseNodeType2["noiseScalePoint"] = "noise-scale-point";
|
|
4141
|
+
NoiseNodeType2["noiseTranslatePoint"] = "noise-translate-point";
|
|
4142
|
+
NoiseNodeType2["noiseTurbulence"] = "noise-turbulence";
|
|
4143
|
+
NoiseNodeType2["variableProperty"] = "variable-property";
|
|
4144
|
+
NoiseNodeType2["variableValue"] = "variable-value";
|
|
4145
|
+
NoiseNodeType2["variableCombine"] = "variable-combine";
|
|
4146
|
+
NoiseNodeType2["groupModule"] = "group-module";
|
|
4147
|
+
return NoiseNodeType2;
|
|
4148
|
+
})(NoiseNodeType || {});
|
|
4149
|
+
var noiseNodeTypes = {
|
|
4150
|
+
["variable-value" /* variableValue */]: variable_value_node_default,
|
|
4151
|
+
["variable-property" /* variableProperty */]: variable_property_node_default,
|
|
4152
|
+
["variable-combine" /* variableCombine */]: variable_combine_node_default,
|
|
4153
|
+
["group-module" /* groupModule */]: node_module_group_default,
|
|
4154
|
+
["position" /* position */]: position_const_node_default,
|
|
4155
|
+
["grid" /* grid */]: position_grid_node_default,
|
|
4156
|
+
["noise-output" /* noiseOutput */]: noise_output_node_default,
|
|
4157
|
+
["texture-data" /* textureData */]: noise_raw_texture_node_default,
|
|
4158
|
+
["noise-logger" /* noiseLogger */]: noise_logger_node_default,
|
|
4159
|
+
["position-logger" /* positionLogger */]: positions_logger_node_default,
|
|
4160
|
+
["noise-constant" /* noiseConst */]: noise_const_node_default,
|
|
4161
|
+
["noise-billow" /* noiseBillow */]: noise_billow_node_default,
|
|
4162
|
+
["noise-simplex" /* noiseSimplex */]: noise_simplex_node_default,
|
|
4163
|
+
["noise-checkerboard" /* noiseCheckerboard */]: noise_checkerboard_node_default,
|
|
4164
|
+
["noise-cylinders" /* noiseCylinders */]: noise_cylinders_node_default,
|
|
4165
|
+
["noise-perlin" /* noisePerlin */]: noise_perlin_node_default,
|
|
4166
|
+
["noise-ridged-multi" /* noiseRidgedMulti */]: noise_ridgedmulti_node_default,
|
|
4167
|
+
["noise-spheres" /* noiseSpheres */]: noise_spheres_node_default,
|
|
4168
|
+
["noise-voronoi" /* noiseVoronoi */]: noise_voronoi_node_default,
|
|
4169
|
+
["noise-combiner" /* noiseCombine */]: noise_combine_node_default,
|
|
4170
|
+
["noise-clamp" /* noiseClamp */]: noise_clamp_node_default,
|
|
4171
|
+
["noise-abs" /* noiseAbs */]: noise_abs_node_default,
|
|
4172
|
+
["noise-normalize" /* noiseNormalize */]: noise_normalize_node_default,
|
|
4173
|
+
["noise-curve" /* noiseCurve */]: noise_curve_node_default,
|
|
4174
|
+
["noise-exponent" /* noiseExponent */]: noise_exponent_node_default,
|
|
4175
|
+
["noise-invert" /* noiseInvert */]: noise_invert_node_default,
|
|
4176
|
+
["noise-scale-bias" /* noiseScaleBias */]: noise_scale_bias_node_default,
|
|
4177
|
+
["noise-terrace" /* noiseTerrace */]: noise_terrace_node_default,
|
|
4178
|
+
["noise-blend" /* noiseBlend */]: noise_blend_node_default,
|
|
4179
|
+
["noise-select" /* noiseSelect */]: noise_select_node_default,
|
|
4180
|
+
["noise-displace" /* noiseDisplace */]: noise_displace_node_default,
|
|
4181
|
+
["noise-rotate-point" /* noiseRotatePoint */]: noise_rotate_point_node_default,
|
|
4182
|
+
["noise-scale-point" /* noiseScalePoint */]: noise_scale_point_node_default,
|
|
4183
|
+
["noise-translate-point" /* noiseTranslatePoint */]: noise_translate_point_node_default,
|
|
4184
|
+
["noise-turbulence" /* noiseTurbulence */]: noise_turbulence_node_default
|
|
4185
|
+
};
|
|
4186
|
+
var noiseNodeTemplates = {
|
|
4187
|
+
["noise-output" /* noiseOutput */]: new NoiseOutputNodeTemplateFactory(),
|
|
4188
|
+
["noise-simplex" /* noiseSimplex */]: new NoiseSimplexNodeTemplateFactory(),
|
|
4189
|
+
["noise-billow" /* noiseBillow */]: new NoiseBillowNodeTemplateFactory(),
|
|
4190
|
+
["noise-checkerboard" /* noiseCheckerboard */]: new NoiseCheckerboardNodeTemplateFactory(),
|
|
4191
|
+
["noise-normalize" /* noiseNormalize */]: new NoiseNormalizeNodeTemplateFactory(),
|
|
4192
|
+
["noise-logger" /* noiseLogger */]: new NoiseLoggerNodeTemplateFactory(),
|
|
4193
|
+
["noise-constant" /* noiseConst */]: new NoiseConstNodeTemplateFactory(),
|
|
4194
|
+
["position" /* position */]: new PositionConstNodeTemplateFactory(),
|
|
4195
|
+
["position-logger" /* positionLogger */]: new PositionLoggerNodeTemplateFactory(),
|
|
4196
|
+
["grid" /* grid */]: new PositionGridNodeTemplateFactory(),
|
|
4197
|
+
["texture-data" /* textureData */]: new NoiseRawTextureTemplateFactory(),
|
|
4198
|
+
["noise-cylinders" /* noiseCylinders */]: new NoiseCylindersNodeTemplateFactory(),
|
|
4199
|
+
["noise-perlin" /* noisePerlin */]: new NoisePerlinNodeTemplateFactory(),
|
|
4200
|
+
["noise-ridged-multi" /* noiseRidgedMulti */]: new NoiseRidgedMultiNodeTemplateFactory(),
|
|
4201
|
+
["noise-spheres" /* noiseSpheres */]: new NoiseSpheresNodeTemplateFactory(),
|
|
4202
|
+
["noise-voronoi" /* noiseVoronoi */]: new NoiseVoronoiNodeTemplateFactory(),
|
|
4203
|
+
["noise-combiner" /* noiseCombine */]: new NoiseCombineNodeTemplateFactory(),
|
|
4204
|
+
["noise-clamp" /* noiseClamp */]: new NoiseClampNodeTemplateFactory(),
|
|
4205
|
+
["noise-abs" /* noiseAbs */]: new NoiseAbsNodeTemplateFactory(),
|
|
4206
|
+
["noise-curve" /* noiseCurve */]: new NoiseCurveNodeTemplateFactory(),
|
|
4207
|
+
["noise-exponent" /* noiseExponent */]: new NoiseExponentNodeTemplateFactory(),
|
|
4208
|
+
["noise-invert" /* noiseInvert */]: new NoiseInvertNodeTemplateFactory(),
|
|
4209
|
+
["noise-scale-bias" /* noiseScaleBias */]: new NoiseScaleBiasNodeTemplateFactory(),
|
|
4210
|
+
["noise-terrace" /* noiseTerrace */]: new NoiseTerraceNodeTemplateFactory(),
|
|
4211
|
+
["noise-blend" /* noiseBlend */]: new NoiseBlendNodeTemplateFactory(),
|
|
4212
|
+
["noise-select" /* noiseSelect */]: new NoiseSelectNodeTemplateFactory(),
|
|
4213
|
+
["noise-displace" /* noiseDisplace */]: new NoiseDisplaceNodeTemplateFactory(),
|
|
4214
|
+
["noise-rotate-point" /* noiseRotatePoint */]: new NoiseRotatePointNodeTemplateFactory(),
|
|
4215
|
+
["noise-scale-point" /* noiseScalePoint */]: new NoiseScalePointNodeTemplateFactory(),
|
|
4216
|
+
["noise-translate-point" /* noiseTranslatePoint */]: new NoiseTranslatePointNodeTemplateFactory(),
|
|
4217
|
+
["noise-turbulence" /* noiseTurbulence */]: new NoiseTurbulenceNodeTemplateFactory(),
|
|
4218
|
+
["variable-property" /* variableProperty */]: new VariablePropertyNodeTemplateFactory(),
|
|
4219
|
+
["variable-combine" /* variableCombine */]: new VariableCombineNodeTemplateFactory(),
|
|
4220
|
+
["variable-value" /* variableValue */]: new VariableValueNodeTemplateFactory(),
|
|
4221
|
+
["group-module" /* groupModule */]: new ModuleGroupNodeTemplateFactory()
|
|
4222
|
+
};
|
|
4223
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4224
|
+
0 && (module.exports = {
|
|
4225
|
+
DisplacementModule,
|
|
4226
|
+
NoiseCombineType,
|
|
4227
|
+
NoiseHandleFlag,
|
|
4228
|
+
NoiseNodeType,
|
|
4229
|
+
VariableCombineType,
|
|
4230
|
+
noiseCombineModuleMap,
|
|
4231
|
+
noiseNodeTemplates,
|
|
4232
|
+
noiseNodeTypes
|
|
4233
|
+
});
|
|
4234
|
+
//# sourceMappingURL=index.cjs.map
|