@awesome-flow/noise 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/index.cjs +1 -3490
- package/dist/abstract/index.d.cts +2 -2
- package/dist/abstract/index.d.ts +2 -2
- package/dist/abstract/index.js +1 -3522
- package/dist/modules/index.cjs +1 -44
- package/dist/modules/index.js +1 -18
- package/dist/nodes/generators/index.cjs +1 -346
- package/dist/nodes/generators/index.d.cts +7 -7
- package/dist/nodes/generators/index.d.ts +7 -7
- package/dist/nodes/generators/index.js +1 -311
- package/dist/nodes/groups/index.cjs +1 -113
- package/dist/nodes/groups/index.d.cts +2 -2
- package/dist/nodes/groups/index.d.ts +2 -2
- package/dist/nodes/groups/index.js +1 -92
- package/dist/nodes/index.cjs +1 -3425
- package/dist/nodes/index.js +1 -3435
- package/dist/nodes/modifiers/index.cjs +1 -1478
- package/dist/nodes/modifiers/index.d.cts +6 -6
- package/dist/nodes/modifiers/index.d.ts +6 -6
- package/dist/nodes/modifiers/index.js +1 -1491
- package/dist/nodes/output/index.cjs +1 -1344
- package/dist/nodes/output/index.d.cts +3 -3
- package/dist/nodes/output/index.d.ts +3 -3
- package/dist/nodes/output/index.js +1 -1368
- package/dist/nodes/selectors/index.cjs +1 -1322
- package/dist/nodes/selectors/index.d.cts +1 -1
- package/dist/nodes/selectors/index.d.ts +1 -1
- package/dist/nodes/selectors/index.js +1 -1348
- package/dist/nodes/transformers/index.cjs +1 -337
- package/dist/nodes/transformers/index.d.cts +5 -5
- package/dist/nodes/transformers/index.d.ts +5 -5
- package/dist/nodes/transformers/index.js +1 -319
- package/dist/templates/generators/index.cjs +1 -1221
- package/dist/templates/generators/index.d.cts +5 -5
- package/dist/templates/generators/index.d.ts +5 -5
- package/dist/templates/generators/index.js +1 -1239
- package/dist/templates/groups/index.cjs +1 -1203
- package/dist/templates/groups/index.js +1 -1230
- package/dist/templates/index.cjs +1 -1263
- package/dist/templates/index.js +1 -1260
- package/dist/templates/modifiers/index.cjs +1 -1219
- package/dist/templates/modifiers/index.d.cts +9 -9
- package/dist/templates/modifiers/index.d.ts +9 -9
- package/dist/templates/modifiers/index.js +1 -1238
- package/dist/templates/output/index.cjs +1 -1209
- package/dist/templates/output/index.d.cts +3 -3
- package/dist/templates/output/index.d.ts +3 -3
- package/dist/templates/output/index.js +1 -1233
- package/dist/templates/selectors/index.cjs +1 -1205
- package/dist/templates/selectors/index.js +1 -1231
- package/dist/templates/transformers/index.cjs +1 -1211
- package/dist/templates/transformers/index.js +1 -1234
- package/package.json +9 -7
|
@@ -1,311 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
|
|
3
|
-
import { useCallback, useMemo } from "react";
|
|
4
|
-
import { Billow } from "libnoise-simplex-ts";
|
|
5
|
-
import { useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
|
|
6
|
-
import { NodePropertyVariables } from "@awesome-flow/core/components";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
function NoiseBillowNode({ id, selected, data, type }) {
|
|
9
|
-
const updateComputedData = useUpdateNodeComputedData();
|
|
10
|
-
const module = useMemo(() => new Billow(), []);
|
|
11
|
-
const onPropertiesChange = useCallback(
|
|
12
|
-
(properties) => {
|
|
13
|
-
Object.keys(properties).forEach((k) => {
|
|
14
|
-
module[k] = properties[k].value;
|
|
15
|
-
});
|
|
16
|
-
updateComputedData(id, { module });
|
|
17
|
-
},
|
|
18
|
-
[id, module, updateComputedData]
|
|
19
|
-
);
|
|
20
|
-
return /* @__PURE__ */ jsxs(NodeContainer, { id, selected, data, type, children: [
|
|
21
|
-
/* @__PURE__ */ jsx(NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
|
|
22
|
-
/* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
23
|
-
] });
|
|
24
|
-
}
|
|
25
|
-
var noise_billow_node_default = NoiseBillowNode;
|
|
26
|
-
|
|
27
|
-
// src/nodes/generators/noise-checkerboard-node.tsx
|
|
28
|
-
import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
|
|
29
|
-
import { useEffect, useMemo as useMemo2 } from "react";
|
|
30
|
-
import { Checkerboard } from "libnoise-simplex-ts";
|
|
31
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData2 } from "@awesome-flow/core/hooks";
|
|
32
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
33
|
-
function NoiseCheckerboardNode({ id, selected, data, type }) {
|
|
34
|
-
const updateComputedData = useUpdateNodeComputedData2();
|
|
35
|
-
const module = useMemo2(() => new Checkerboard(), []);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
updateComputedData(id, { module });
|
|
38
|
-
}, [id, module, updateComputedData]);
|
|
39
|
-
return /* @__PURE__ */ jsx2(NodeContainer2, { id, selected, data, type });
|
|
40
|
-
}
|
|
41
|
-
var noise_checkerboard_node_default = NoiseCheckerboardNode;
|
|
42
|
-
|
|
43
|
-
// src/nodes/generators/noise-const-node.tsx
|
|
44
|
-
import { NodeContainer as NodeContainer3 } from "@awesome-flow/core/layout";
|
|
45
|
-
import { useEffect as useEffect2, useMemo as useMemo3, useState } from "react";
|
|
46
|
-
import { Group, NumberInput, Stack } from "@mantine/core";
|
|
47
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData3, useUpdateNodeData } from "@awesome-flow/core/hooks";
|
|
48
|
-
import { Const } from "libnoise-simplex-ts";
|
|
49
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
50
|
-
function NoiseConstNode({ id, selected, data, type }) {
|
|
51
|
-
const [min, setMin] = useState(data.min);
|
|
52
|
-
const [max, setMax] = useState(data.max);
|
|
53
|
-
const [noise, setNoise] = useState(data.noise);
|
|
54
|
-
const updateNodeData = useUpdateNodeData();
|
|
55
|
-
const updateComputedData = useUpdateNodeComputedData3();
|
|
56
|
-
const module = useMemo3(() => new Const(), []);
|
|
57
|
-
useEffect2(() => {
|
|
58
|
-
module.value = noise;
|
|
59
|
-
updateNodeData(id, { noise, min, max });
|
|
60
|
-
updateComputedData(id, { module });
|
|
61
|
-
}, [noise, min, max, module, updateNodeData, id, updateComputedData]);
|
|
62
|
-
return /* @__PURE__ */ jsx3(NodeContainer3, { id, selected, data, type, children: /* @__PURE__ */ jsxs2(Stack, { children: [
|
|
63
|
-
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
64
|
-
/* @__PURE__ */ jsx3(NumberInput, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
|
|
65
|
-
/* @__PURE__ */ jsx3(NumberInput, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
|
|
66
|
-
] }),
|
|
67
|
-
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
68
|
-
"noise:",
|
|
69
|
-
/* @__PURE__ */ jsx3(
|
|
70
|
-
NumberInput,
|
|
71
|
-
{
|
|
72
|
-
size: "xs",
|
|
73
|
-
value: noise,
|
|
74
|
-
onChange: (e) => setNoise(Number(e)),
|
|
75
|
-
max,
|
|
76
|
-
min,
|
|
77
|
-
step: 0.1
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
] })
|
|
81
|
-
] }) });
|
|
82
|
-
}
|
|
83
|
-
var noise_const_node_default = NoiseConstNode;
|
|
84
|
-
|
|
85
|
-
// src/nodes/generators/noise-cylinders-node.tsx
|
|
86
|
-
import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
|
|
87
|
-
import { useCallback as useCallback2, useMemo as useMemo4 } from "react";
|
|
88
|
-
import { Cylinders } from "libnoise-simplex-ts";
|
|
89
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData4 } from "@awesome-flow/core/hooks";
|
|
90
|
-
import { NodePropertyVariables as NodePropertyVariables2 } from "@awesome-flow/core/components";
|
|
91
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
92
|
-
function NoiseCylindersNode({ id, selected, data, type }) {
|
|
93
|
-
const updateComputedData = useUpdateNodeComputedData4();
|
|
94
|
-
const module = useMemo4(() => new Cylinders(), []);
|
|
95
|
-
const onPropertiesChange = useCallback2(
|
|
96
|
-
(properties) => {
|
|
97
|
-
Object.keys(properties).forEach((k) => {
|
|
98
|
-
module[k] = properties[k].value;
|
|
99
|
-
});
|
|
100
|
-
updateComputedData(id, { module });
|
|
101
|
-
},
|
|
102
|
-
[id, module, updateComputedData]
|
|
103
|
-
);
|
|
104
|
-
return /* @__PURE__ */ jsxs3(NodeContainer4, { id, selected, data, type, children: [
|
|
105
|
-
/* @__PURE__ */ jsx4(NodePropertyVariables2, { data, nodeId: id, onPropertiesChange }),
|
|
106
|
-
/* @__PURE__ */ jsx4(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
|
|
107
|
-
] });
|
|
108
|
-
}
|
|
109
|
-
var noise_cylinders_node_default = NoiseCylindersNode;
|
|
110
|
-
|
|
111
|
-
// src/nodes/generators/noise-perlin-node.tsx
|
|
112
|
-
import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
|
|
113
|
-
import { useCallback as useCallback3, useMemo as useMemo5 } from "react";
|
|
114
|
-
import { Perlin } from "libnoise-simplex-ts";
|
|
115
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData5 } from "@awesome-flow/core/hooks";
|
|
116
|
-
import { NodePropertyVariables as NodePropertyVariables3 } from "@awesome-flow/core/components";
|
|
117
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
118
|
-
function NoisePerlinNode({ id, selected, data, type }) {
|
|
119
|
-
const updateComputedData = useUpdateNodeComputedData5();
|
|
120
|
-
const module = useMemo5(() => new Perlin(), []);
|
|
121
|
-
const onPropertiesChange = useCallback3(
|
|
122
|
-
(properties) => {
|
|
123
|
-
Object.keys(properties).forEach((k) => {
|
|
124
|
-
module[k] = properties[k].value;
|
|
125
|
-
});
|
|
126
|
-
updateComputedData(id, { module });
|
|
127
|
-
},
|
|
128
|
-
[id, module, updateComputedData]
|
|
129
|
-
);
|
|
130
|
-
return /* @__PURE__ */ jsxs4(NodeContainer5, { id, selected, data, type, children: [
|
|
131
|
-
/* @__PURE__ */ jsx5(NodePropertyVariables3, { data, nodeId: id, onPropertiesChange }),
|
|
132
|
-
/* @__PURE__ */ jsx5(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
|
|
133
|
-
] });
|
|
134
|
-
}
|
|
135
|
-
var noise_perlin_node_default = NoisePerlinNode;
|
|
136
|
-
|
|
137
|
-
// src/nodes/generators/noise-ridgedmulti-node.tsx
|
|
138
|
-
import { NodeContainer as NodeContainer6, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
|
|
139
|
-
import { useCallback as useCallback4, useMemo as useMemo6 } from "react";
|
|
140
|
-
import { RidgedMulti } from "libnoise-simplex-ts";
|
|
141
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData6 } from "@awesome-flow/core/hooks";
|
|
142
|
-
import { NodePropertyVariables as NodePropertyVariables4 } from "@awesome-flow/core/components";
|
|
143
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
144
|
-
function NoiseRidgedMultiNode({ id, selected, data, type }) {
|
|
145
|
-
const updateComputedData = useUpdateNodeComputedData6();
|
|
146
|
-
const module = useMemo6(() => new RidgedMulti(), []);
|
|
147
|
-
const onPropertiesChange = useCallback4((properties) => {
|
|
148
|
-
Object.keys(properties).forEach((k) => module[k] = properties[k].value);
|
|
149
|
-
updateComputedData(id, { module });
|
|
150
|
-
}, []);
|
|
151
|
-
return /* @__PURE__ */ jsxs5(NodeContainer6, { id, selected, data, type, children: [
|
|
152
|
-
/* @__PURE__ */ jsx6(NodePropertyVariables4, { data, nodeId: id, onPropertiesChange }),
|
|
153
|
-
/* @__PURE__ */ jsx6(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
|
|
154
|
-
] });
|
|
155
|
-
}
|
|
156
|
-
var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
|
|
157
|
-
|
|
158
|
-
// src/nodes/generators/noise-spheres-node.tsx
|
|
159
|
-
import { NodeContainer as NodeContainer7, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
|
|
160
|
-
import { useCallback as useCallback5, useMemo as useMemo7 } from "react";
|
|
161
|
-
import { Spheres } from "libnoise-simplex-ts";
|
|
162
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData7 } from "@awesome-flow/core/hooks";
|
|
163
|
-
import { NodePropertyVariables as NodePropertyVariables5 } from "@awesome-flow/core/components";
|
|
164
|
-
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
165
|
-
function NoiseSpheresNode({ id, selected, data, type }) {
|
|
166
|
-
const updateComputedData = useUpdateNodeComputedData7();
|
|
167
|
-
const module = useMemo7(() => new Spheres(), []);
|
|
168
|
-
const onPropertiesChange = useCallback5((properties) => {
|
|
169
|
-
Object.keys(properties).forEach((k) => module[k] = properties[k].value);
|
|
170
|
-
updateComputedData(id, { module });
|
|
171
|
-
}, []);
|
|
172
|
-
return /* @__PURE__ */ jsxs6(NodeContainer7, { id, selected, data, type, children: [
|
|
173
|
-
/* @__PURE__ */ jsx7(NodePropertyVariables5, { data, nodeId: id, onPropertiesChange }),
|
|
174
|
-
/* @__PURE__ */ jsx7(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
|
|
175
|
-
] });
|
|
176
|
-
}
|
|
177
|
-
var noise_spheres_node_default = NoiseSpheresNode;
|
|
178
|
-
|
|
179
|
-
// src/nodes/generators/noise-voronoi-node.tsx
|
|
180
|
-
import { NodeContainer as NodeContainer8, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
|
|
181
|
-
import { useCallback as useCallback6 } from "react";
|
|
182
|
-
import { Voronoi } from "libnoise-simplex-ts";
|
|
183
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData8 } from "@awesome-flow/core/hooks";
|
|
184
|
-
import { NodePropertyVariables as NodePropertyVariables6 } from "@awesome-flow/core/components";
|
|
185
|
-
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
186
|
-
function NoiseVoronoiNode({ id, selected, data, type }) {
|
|
187
|
-
const updateComputedData = useUpdateNodeComputedData8();
|
|
188
|
-
const onPropertiesChange = useCallback6(
|
|
189
|
-
(properties) => {
|
|
190
|
-
const module = new Voronoi(
|
|
191
|
-
properties.frequency.value,
|
|
192
|
-
properties.displacement.value,
|
|
193
|
-
properties.distance.value,
|
|
194
|
-
properties.seed.value
|
|
195
|
-
);
|
|
196
|
-
updateComputedData(id, { module });
|
|
197
|
-
},
|
|
198
|
-
[]
|
|
199
|
-
);
|
|
200
|
-
return /* @__PURE__ */ jsxs7(NodeContainer8, { id, selected, data, type, children: [
|
|
201
|
-
/* @__PURE__ */ jsx8(NodePropertyVariables6, { data, nodeId: id, onPropertiesChange }),
|
|
202
|
-
/* @__PURE__ */ jsx8(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" })
|
|
203
|
-
] });
|
|
204
|
-
}
|
|
205
|
-
var noise_voronoi_node_default = NoiseVoronoiNode;
|
|
206
|
-
|
|
207
|
-
// src/nodes/generators/position-const-node.tsx
|
|
208
|
-
import { NodeContainer as NodeContainer9 } from "@awesome-flow/core/layout";
|
|
209
|
-
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
210
|
-
import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
|
|
211
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData9, useUpdateNodeData as useUpdateNodeData2 } from "@awesome-flow/core/hooks";
|
|
212
|
-
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
213
|
-
function PositionConstNode({ id, selected, data, type }) {
|
|
214
|
-
const position = data.position ?? { x: 0, y: 0, z: 0 };
|
|
215
|
-
const [x, setX] = useState2(position.x);
|
|
216
|
-
const [y, setY] = useState2(position.y);
|
|
217
|
-
const [z, setZ] = useState2(position.z);
|
|
218
|
-
const updateNodeData = useUpdateNodeData2();
|
|
219
|
-
const updateComputedData = useUpdateNodeComputedData9();
|
|
220
|
-
useEffect3(() => {
|
|
221
|
-
const position2 = { x, y, z };
|
|
222
|
-
updateNodeData(id, {
|
|
223
|
-
position: position2
|
|
224
|
-
});
|
|
225
|
-
updateComputedData(id, {
|
|
226
|
-
positions: [position2]
|
|
227
|
-
});
|
|
228
|
-
}, [x, y, z]);
|
|
229
|
-
return /* @__PURE__ */ jsx9(NodeContainer9, { id, selected, data, type, children: /* @__PURE__ */ jsxs8(Stack2, { children: [
|
|
230
|
-
/* @__PURE__ */ jsxs8(Group2, { children: [
|
|
231
|
-
"x: ",
|
|
232
|
-
/* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
233
|
-
] }),
|
|
234
|
-
/* @__PURE__ */ jsxs8(Group2, { children: [
|
|
235
|
-
"y: ",
|
|
236
|
-
/* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
237
|
-
] }),
|
|
238
|
-
/* @__PURE__ */ jsxs8(Group2, { children: [
|
|
239
|
-
"z: ",
|
|
240
|
-
/* @__PURE__ */ jsx9(NumberInput2, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
241
|
-
] })
|
|
242
|
-
] }) });
|
|
243
|
-
}
|
|
244
|
-
var position_const_node_default = PositionConstNode;
|
|
245
|
-
|
|
246
|
-
// src/nodes/generators/position-grid-node.tsx
|
|
247
|
-
import { NodeContainer as NodeContainer10 } from "@awesome-flow/core/layout";
|
|
248
|
-
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
249
|
-
import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
|
|
250
|
-
import { useUpdateNodeComputedData as useUpdateNodeComputedData10, useUpdateNodeData as useUpdateNodeData3 } from "@awesome-flow/core/hooks";
|
|
251
|
-
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
252
|
-
function PositionGridNode({ id, selected, data, type }) {
|
|
253
|
-
const [x, setX] = useState3(data.center?.x);
|
|
254
|
-
const [y, setY] = useState3(data.center?.y);
|
|
255
|
-
const [z, setZ] = useState3(data.center?.z);
|
|
256
|
-
const [radius, setRadius] = useState3(data.radius);
|
|
257
|
-
const updateNodeData = useUpdateNodeData3();
|
|
258
|
-
const updateComputedData = useUpdateNodeComputedData10();
|
|
259
|
-
useEffect4(() => {
|
|
260
|
-
updateNodeData(id, {
|
|
261
|
-
center: { x, y, z }
|
|
262
|
-
});
|
|
263
|
-
}, [x, y, z]);
|
|
264
|
-
useEffect4(() => {
|
|
265
|
-
updateNodeData(id, {
|
|
266
|
-
radius
|
|
267
|
-
});
|
|
268
|
-
}, [radius]);
|
|
269
|
-
useEffect4(() => {
|
|
270
|
-
const positions = [];
|
|
271
|
-
for (let i = -radius; i < radius; i++) {
|
|
272
|
-
for (let j = -radius; j < radius; j++) {
|
|
273
|
-
positions.push({ x: x + i, y: y + j, z });
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
updateComputedData(id, {
|
|
277
|
-
positions
|
|
278
|
-
});
|
|
279
|
-
}, [x, y, z, radius]);
|
|
280
|
-
return /* @__PURE__ */ jsx10(NodeContainer10, { id, selected, data, type, children: /* @__PURE__ */ jsxs9(Stack3, { children: [
|
|
281
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
282
|
-
"x: ",
|
|
283
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
|
|
284
|
-
] }),
|
|
285
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
286
|
-
"y: ",
|
|
287
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
|
|
288
|
-
] }),
|
|
289
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
290
|
-
"z: ",
|
|
291
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
|
|
292
|
-
] }),
|
|
293
|
-
/* @__PURE__ */ jsxs9(Group3, { children: [
|
|
294
|
-
"r: ",
|
|
295
|
-
/* @__PURE__ */ jsx10(NumberInput3, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
|
|
296
|
-
] })
|
|
297
|
-
] }) });
|
|
298
|
-
}
|
|
299
|
-
var position_grid_node_default = PositionGridNode;
|
|
300
|
-
export {
|
|
301
|
-
noise_billow_node_default as NoiseBillowNode,
|
|
302
|
-
noise_checkerboard_node_default as NoiseCheckerboardNode,
|
|
303
|
-
noise_const_node_default as NoiseConstNode,
|
|
304
|
-
noise_cylinders_node_default as NoiseCylindersNode,
|
|
305
|
-
noise_perlin_node_default as NoisePerlinNode,
|
|
306
|
-
noise_ridgedmulti_node_default as NoiseRidgedMultiNode,
|
|
307
|
-
noise_spheres_node_default as NoiseSpheresNode,
|
|
308
|
-
noise_voronoi_node_default as NoiseVoronoiNode,
|
|
309
|
-
position_const_node_default as PositionConstNode,
|
|
310
|
-
position_grid_node_default as PositionGridNode
|
|
311
|
-
};
|
|
1
|
+
import{NodePropertyVariables as F}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as X}from"@awesome-flow/core/hooks";import{NodeContainer as Y,NodeTrackConnections as Z}from"@awesome-flow/core/layout";import{Billow as q}from"libnoise-simplex-ts";import{useCallback as A}from"react";import{jsx as S,jsxs as K}from"react/jsx-runtime";function H({id:o,selected:s,data:e,type:p}){let r=X(),n=A(t=>{let d=new q;Object.keys(t).forEach(a=>d[a]=t[a].value),r(o,{module:d})},[o]);return K(Y,{id:o,selected:s,data:e,type:p,children:[S(F,{data:e,nodeId:o,onPropertiesChange:n}),S(Z,{handles:e.handles,nodeId:o,type:"target"})]})}var J=H;import{useUpdateNodeComputedData as L}from"@awesome-flow/core/hooks";import{NodeContainer as Q}from"@awesome-flow/core/layout";import{Checkerboard as W}from"libnoise-simplex-ts";import{useEffect as _}from"react";import{jsx as oo}from"react/jsx-runtime";function $({id:o,selected:s,data:e,type:p}){let r=L();return _(()=>{let n=new W;r(o,{module:n})},[o]),oo(Q,{id:o,selected:s,data:e,type:p})}var j=$;import{useUpdateNodeComputedData as eo,useUpdateNodeData as to}from"@awesome-flow/core/hooks";import{NodeContainer as ro}from"@awesome-flow/core/layout";import{Group as U,NumberInput as V,Stack as ao}from"@mantine/core";import{Const as no}from"libnoise-simplex-ts";import{useEffect as so,useState as k}from"react";import{jsx as D,jsxs as w}from"react/jsx-runtime";function po({id:o,selected:s,data:e,type:p}){let[r,n]=k(e.min),[t,d]=k(e.max),[a,l]=k(e.noise),m=to(),f=eo();return so(()=>{let i=new no(a);m(o,{noise:a,min:r,max:t}),f(o,{module:i})},[a,r,t]),D(ro,{id:o,selected:s,data:e,type:p,children:w(ao,{children:[w(U,{children:[D(V,{size:"xs",w:100,value:r,onChange:i=>n(Number(i))}),D(V,{size:"xs",w:100,value:t,onChange:i=>d(Number(i))})]}),w(U,{children:["noise:",D(V,{size:"xs",value:a,onChange:i=>l(Number(i)),max:t,min:r,step:.1})]})]})})}var mo=po;import{NodePropertyVariables as io}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as uo}from"@awesome-flow/core/hooks";import{NodeContainer as No,NodeTrackConnections as lo}from"@awesome-flow/core/layout";import{Cylinders as fo}from"libnoise-simplex-ts";import{useCallback as Co}from"react";import{jsx as R,jsxs as Po}from"react/jsx-runtime";function co({id:o,selected:s,data:e,type:p}){let r=uo(),n=Co(t=>{let d=new fo;Object.keys(t).forEach(a=>d[a]=t[a].value),r(o,{module:d})},[o]);return Po(No,{id:o,selected:s,data:e,type:p,children:[R(io,{data:e,nodeId:o,onPropertiesChange:n}),R(lo,{handles:e.handles,nodeId:o,type:"target"})]})}var Do=co;import{NodePropertyVariables as yo}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as ho}from"@awesome-flow/core/hooks";import{NodeContainer as go,NodeTrackConnections as bo}from"@awesome-flow/core/layout";import{Perlin as xo}from"libnoise-simplex-ts";import{useCallback as Mo}from"react";import{jsx as B,jsxs as wo}from"react/jsx-runtime";function Vo({id:o,selected:s,data:e,type:p}){let r=ho(),n=Mo(t=>{let d=new xo;Object.keys(t).forEach(a=>d[a]=t[a].value),r(o,{module:d})},[o,r]);return wo(go,{id:o,selected:s,data:e,type:p,children:[B(yo,{data:e,nodeId:o,onPropertiesChange:n}),B(bo,{handles:e.handles,nodeId:o,type:"target"})]})}var ko=Vo;import{NodePropertyVariables as vo}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as zo}from"@awesome-flow/core/hooks";import{NodeContainer as Go,NodeTrackConnections as Io}from"@awesome-flow/core/layout";import{RidgedMulti as So}from"libnoise-simplex-ts";import{useCallback as Uo}from"react";import{jsx as E,jsxs as Eo}from"react/jsx-runtime";function Ro({id:o,selected:s,data:e,type:p}){let r=zo(),n=Uo(t=>{let d=new So;Object.keys(t).forEach(a=>d[a]=t[a].value),r(o,{module:d})},[]);return Eo(Go,{id:o,selected:s,data:e,type:p,children:[E(vo,{data:e,nodeId:o,onPropertiesChange:n}),E(Io,{handles:e.handles,nodeId:o,type:"target"})]})}var Bo=Ro;import{NodePropertyVariables as To}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Oo}from"@awesome-flow/core/hooks";import{NodeContainer as Fo,NodeTrackConnections as Xo}from"@awesome-flow/core/layout";import{Spheres as Yo}from"libnoise-simplex-ts";import{useCallback as Zo}from"react";import{jsx as T,jsxs as Ho}from"react/jsx-runtime";function qo({id:o,selected:s,data:e,type:p}){let r=Oo(),n=Zo(t=>{let d=new Yo;Object.keys(t).forEach(a=>d[a]=t[a].value),r(o,{module:d})},[]);return Ho(Fo,{id:o,selected:s,data:e,type:p,children:[T(To,{data:e,nodeId:o,onPropertiesChange:n}),T(Xo,{handles:e.handles,nodeId:o,type:"target"})]})}var Ao=qo;import{NodePropertyVariables as Jo}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Ko}from"@awesome-flow/core/hooks";import{NodeContainer as Lo,NodeTrackConnections as Qo}from"@awesome-flow/core/layout";import{Voronoi as Wo}from"libnoise-simplex-ts";import{useCallback as _o}from"react";import{jsx as O,jsxs as oe}from"react/jsx-runtime";function $o({id:o,selected:s,data:e,type:p}){let r=Ko(),n=_o(t=>{let d=new Wo(t.frequency.value,t.displacement.value,t.distance.value,t.seed.value);r(o,{module:d})},[]);return oe(Lo,{id:o,selected:s,data:e,type:p,children:[O(Jo,{data:e,nodeId:o,onPropertiesChange:n}),O(Qo,{handles:e.handles,nodeId:o,type:"target"})]})}var jo=$o;import{useUpdateNodeComputedData as ee,useUpdateNodeData as te}from"@awesome-flow/core/hooks";import{NodeContainer as re}from"@awesome-flow/core/layout";import{Group as v,NumberInput as z,Stack as ae}from"@mantine/core";import{useEffect as de,useState as G}from"react";import{jsx as P,jsxs as y}from"react/jsx-runtime";function ne({id:o,selected:s,data:e,type:p}){let r=e.position??{x:0,y:0,z:0},[n,t]=G(r.x),[d,a]=G(r.y),[l,m]=G(r.z),f=te(),i=ee();return de(()=>{let u={x:n,y:d,z:l};f(o,{position:u}),i(o,{positions:[u]})},[n,d,l]),P(re,{id:o,selected:s,data:e,type:p,children:y(ae,{children:[y(v,{children:["x: ",P(z,{size:"xs",w:100,value:n,onChange:u=>t(Number(u))})]}),y(v,{children:["y: ",P(z,{size:"xs",w:100,value:d,onChange:u=>a(Number(u))})]}),y(v,{children:["z: ",P(z,{size:"xs",w:100,value:l,onChange:u=>m(Number(u))})]})]})})}var se=ne;import{useUpdateNodeComputedData as pe,useUpdateNodeData as me}from"@awesome-flow/core/hooks";import{NodeContainer as ie}from"@awesome-flow/core/layout";import{Group as h,NumberInput as g,Stack as ue}from"@mantine/core";import{useEffect as I,useState as b}from"react";import{jsx as C,jsxs as c}from"react/jsx-runtime";function Ne({id:o,selected:s,data:e,type:p}){let[r,n]=b(e.center?.x),[t,d]=b(e.center?.y),[a,l]=b(e.center?.z),[m,f]=b(e.radius),i=me(),u=pe();return I(()=>{i(o,{center:{x:r,y:t,z:a}})},[r,t,a]),I(()=>{i(o,{radius:m})},[m]),I(()=>{let N=[];for(let x=-m;x<m;x++)for(let M=-m;M<m;M++)N.push({x:r+x,y:t+M,z:a});u(o,{positions:N})},[r,t,a,m]),C(ie,{id:o,selected:s,data:e,type:p,children:c(ue,{children:[c(h,{children:["x: ",C(g,{size:"xs",w:100,value:r,onChange:N=>n(Number(N))})]}),c(h,{children:["y: ",C(g,{size:"xs",w:100,value:t,onChange:N=>d(Number(N))})]}),c(h,{children:["z: ",C(g,{size:"xs",w:100,value:a,onChange:N=>l(Number(N))})]}),c(h,{children:["r: ",C(g,{size:"xs",w:100,value:m,onChange:N=>f(Number(N))})]})]})})}var le=Ne;export{J as NoiseBillowNode,j as NoiseCheckerboardNode,mo as NoiseConstNode,Do as NoiseCylindersNode,ko as NoisePerlinNode,Bo as NoiseRidgedMultiNode,Ao as NoiseSpheresNode,jo as NoiseVoronoiNode,se as PositionConstNode,le as PositionGridNode};
|
|
@@ -1,113 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/nodes/groups/index.ts
|
|
20
|
-
var groups_exports = {};
|
|
21
|
-
__export(groups_exports, {
|
|
22
|
-
ModuleGroupNode: () => module_group_node_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(groups_exports);
|
|
25
|
-
|
|
26
|
-
// src/nodes/groups/module-group-node.tsx
|
|
27
|
-
var import_layout = require("@awesome-flow/core/layout");
|
|
28
|
-
var import_react = require("@xyflow/react");
|
|
29
|
-
var import_react2 = require("react");
|
|
30
|
-
var import_shallow = require("zustand/shallow");
|
|
31
|
-
var import_core = require("@mantine/core");
|
|
32
|
-
var import_hooks = require("@awesome-flow/core/hooks");
|
|
33
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
function ModuleGroupNode({
|
|
35
|
-
id,
|
|
36
|
-
selected,
|
|
37
|
-
data,
|
|
38
|
-
type,
|
|
39
|
-
width,
|
|
40
|
-
height
|
|
41
|
-
}) {
|
|
42
|
-
const updateNodeInternals = (0, import_react.useUpdateNodeInternals)();
|
|
43
|
-
const triggerNodeChanges = (0, import_react.useStore)((s) => s.triggerNodeChanges);
|
|
44
|
-
const { groupNodes, setGroupCollapsed } = (0, import_hooks.useFlowStore)(
|
|
45
|
-
(0, import_react2.useCallback)(
|
|
46
|
-
(state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
|
|
47
|
-
[]
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
const intersectingNode = (0, import_hooks.useInteractiveStore)(
|
|
51
|
-
(0, import_react2.useCallback)((state) => state.nodeIntersectionTargets[id], [id]),
|
|
52
|
-
import_shallow.shallow
|
|
53
|
-
);
|
|
54
|
-
(0, import_react2.useEffect)(() => {
|
|
55
|
-
updateNodeInternals(id);
|
|
56
|
-
}, [width, height]);
|
|
57
|
-
(0, import_react2.useEffect)(() => {
|
|
58
|
-
triggerNodeChanges([
|
|
59
|
-
{
|
|
60
|
-
id,
|
|
61
|
-
type: "select",
|
|
62
|
-
selected: !!intersectingNode
|
|
63
|
-
}
|
|
64
|
-
]);
|
|
65
|
-
}, [intersectingNode]);
|
|
66
|
-
const onCollapsed = (0, import_react2.useCallback)((collapsed) => {
|
|
67
|
-
setGroupCollapsed(id, collapsed);
|
|
68
|
-
}, []);
|
|
69
|
-
const size = (0, import_react2.useMemo)(() => {
|
|
70
|
-
return {
|
|
71
|
-
width: data.initialSize?.width || 100,
|
|
72
|
-
height: data.initialSize?.height || 50
|
|
73
|
-
};
|
|
74
|
-
}, [data.initialSize]);
|
|
75
|
-
const incomingModules = (0, import_hooks.useIncomingComputedData)(id);
|
|
76
|
-
const updateComputedData = (0, import_hooks.useUpdateNodeComputedData)();
|
|
77
|
-
(0, import_react2.useEffect)(() => {
|
|
78
|
-
if (incomingModules?.length) {
|
|
79
|
-
const { module: module2 } = incomingModules[0];
|
|
80
|
-
updateComputedData(id, { module: module2 });
|
|
81
|
-
}
|
|
82
|
-
}, [incomingModules]);
|
|
83
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
84
|
-
import_layout.NodeContainer,
|
|
85
|
-
{
|
|
86
|
-
id,
|
|
87
|
-
selected,
|
|
88
|
-
data,
|
|
89
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Group, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { gap: "xs", children: [
|
|
90
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
|
|
92
|
-
] }) }),
|
|
93
|
-
type,
|
|
94
|
-
children: [
|
|
95
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
-
import_react.NodeResizer,
|
|
97
|
-
{
|
|
98
|
-
nodeId: id,
|
|
99
|
-
minWidth: size.width,
|
|
100
|
-
minHeight: size.height,
|
|
101
|
-
isVisible: selected && !data.isCollapsed
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
var module_group_node_default = ModuleGroupNode;
|
|
110
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
-
0 && (module.exports = {
|
|
112
|
-
ModuleGroupNode
|
|
113
|
-
});
|
|
1
|
+
var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var x=(e,o)=>{for(var t in o)c(e,t,{get:o[t],enumerable:!0})},B=(e,o,t,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of y(o))!b.call(e,a)&&a!==t&&c(e,a,{get:()=>o[a],enumerable:!(u=S(o,a))||u.enumerable});return e};var k=e=>B(c({},"__esModule",{value:!0}),e);var P={};x(P,{ModuleGroupNode:()=>h});module.exports=k(P);var d=require("@awesome-flow/core/hooks"),i=require("@awesome-flow/core/layout"),p=require("@mantine/core"),l=require("@xyflow/react"),r=require("react"),N=require("zustand/shallow"),n=require("react/jsx-runtime");function v({id:e,selected:o,data:t,type:u,width:a,height:f}){let D=(0,l.useUpdateNodeInternals)(),G=(0,l.useStore)(s=>s.triggerNodeChanges),{groupNodes:I,setGroupCollapsed:M}=(0,d.useFlowStore)((0,r.useCallback)(s=>({groupNodes:s.groups[e],setGroupCollapsed:s.setGroupCollapsed}),[])),g=(0,d.useInteractiveStore)((0,r.useCallback)(s=>s.nodeIntersectionTargets[e],[e]),N.shallow);(0,r.useEffect)(()=>{D(e)},[a,f]),(0,r.useEffect)(()=>{G([{id:e,type:"select",selected:!!g}])},[g]);let w=(0,r.useCallback)(s=>{M(e,s)},[]),C=(0,r.useMemo)(()=>({width:t.initialSize?.width||100,height:t.initialSize?.height||50}),[t.initialSize]),m=(0,d.useIncomingComputedData)(e),z=(0,d.useUpdateNodeComputedData)();return(0,r.useEffect)(()=>{if(m?.length){let{module:s}=m[0];z(e,{module:s})}},[m]),(0,n.jsxs)(i.NodeContainer,{id:e,selected:o,data:t,title:(0,n.jsx)(p.Group,{justify:"space-between",children:(0,n.jsxs)(p.Group,{gap:"xs",children:[(0,n.jsx)(p.Badge,{size:"xs",variant:"outline",radius:"xs",color:"gray",children:I?.length||0}),(0,n.jsx)(i.NodeCollapse,{nodeId:e,isCollapsed:t.isCollapsed,onCollapsed:w})]})}),type:u,children:[(0,n.jsx)(l.NodeResizer,{nodeId:e,minWidth:C.width,minHeight:C.height,isVisible:o&&!t.isCollapsed}),(0,n.jsx)(i.NodeTrackConnections,{handles:t.handles,nodeId:e,type:"target"})]})}var h=v;0&&(module.exports={ModuleGroupNode});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { NodeProps, Node } from '@xyflow/react';
|
|
3
2
|
import { BasicNodeData } from '@awesome-flow/core/abstract';
|
|
3
|
+
import { NodeProps, Node } from '@xyflow/react';
|
|
4
4
|
|
|
5
|
-
declare function ModuleGroupNode({ id, selected, data, type, width, height
|
|
5
|
+
declare function ModuleGroupNode({ id, selected, data, type, width, height }: NodeProps<Node<BasicNodeData>>): react_jsx_runtime.JSX.Element;
|
|
6
6
|
|
|
7
7
|
export { ModuleGroupNode };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { NodeProps, Node } from '@xyflow/react';
|
|
3
2
|
import { BasicNodeData } from '@awesome-flow/core/abstract';
|
|
3
|
+
import { NodeProps, Node } from '@xyflow/react';
|
|
4
4
|
|
|
5
|
-
declare function ModuleGroupNode({ id, selected, data, type, width, height
|
|
5
|
+
declare function ModuleGroupNode({ id, selected, data, type, width, height }: NodeProps<Node<BasicNodeData>>): react_jsx_runtime.JSX.Element;
|
|
6
6
|
|
|
7
7
|
export { ModuleGroupNode };
|
|
@@ -1,92 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { NodeContainer, NodeCollapse, NodeTrackConnections } from "@awesome-flow/core/layout";
|
|
3
|
-
import { NodeResizer, useStore, useUpdateNodeInternals } from "@xyflow/react";
|
|
4
|
-
import { useCallback, useEffect, useMemo } from "react";
|
|
5
|
-
import { shallow } from "zustand/shallow";
|
|
6
|
-
import { Badge, Group } from "@mantine/core";
|
|
7
|
-
import {
|
|
8
|
-
useFlowStore,
|
|
9
|
-
useIncomingComputedData,
|
|
10
|
-
useInteractiveStore,
|
|
11
|
-
useUpdateNodeComputedData
|
|
12
|
-
} from "@awesome-flow/core/hooks";
|
|
13
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
function ModuleGroupNode({
|
|
15
|
-
id,
|
|
16
|
-
selected,
|
|
17
|
-
data,
|
|
18
|
-
type,
|
|
19
|
-
width,
|
|
20
|
-
height
|
|
21
|
-
}) {
|
|
22
|
-
const updateNodeInternals = useUpdateNodeInternals();
|
|
23
|
-
const triggerNodeChanges = useStore((s) => s.triggerNodeChanges);
|
|
24
|
-
const { groupNodes, setGroupCollapsed } = useFlowStore(
|
|
25
|
-
useCallback(
|
|
26
|
-
(state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
|
|
27
|
-
[]
|
|
28
|
-
)
|
|
29
|
-
);
|
|
30
|
-
const intersectingNode = useInteractiveStore(
|
|
31
|
-
useCallback((state) => state.nodeIntersectionTargets[id], [id]),
|
|
32
|
-
shallow
|
|
33
|
-
);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
updateNodeInternals(id);
|
|
36
|
-
}, [width, height]);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
triggerNodeChanges([
|
|
39
|
-
{
|
|
40
|
-
id,
|
|
41
|
-
type: "select",
|
|
42
|
-
selected: !!intersectingNode
|
|
43
|
-
}
|
|
44
|
-
]);
|
|
45
|
-
}, [intersectingNode]);
|
|
46
|
-
const onCollapsed = useCallback((collapsed) => {
|
|
47
|
-
setGroupCollapsed(id, collapsed);
|
|
48
|
-
}, []);
|
|
49
|
-
const size = useMemo(() => {
|
|
50
|
-
return {
|
|
51
|
-
width: data.initialSize?.width || 100,
|
|
52
|
-
height: data.initialSize?.height || 50
|
|
53
|
-
};
|
|
54
|
-
}, [data.initialSize]);
|
|
55
|
-
const incomingModules = useIncomingComputedData(id);
|
|
56
|
-
const updateComputedData = useUpdateNodeComputedData();
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (incomingModules?.length) {
|
|
59
|
-
const { module } = incomingModules[0];
|
|
60
|
-
updateComputedData(id, { module });
|
|
61
|
-
}
|
|
62
|
-
}, [incomingModules]);
|
|
63
|
-
return /* @__PURE__ */ jsxs(
|
|
64
|
-
NodeContainer,
|
|
65
|
-
{
|
|
66
|
-
id,
|
|
67
|
-
selected,
|
|
68
|
-
data,
|
|
69
|
-
title: /* @__PURE__ */ jsx(Group, { justify: "space-between", children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
70
|
-
/* @__PURE__ */ jsx(Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
|
|
71
|
-
/* @__PURE__ */ jsx(NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
|
|
72
|
-
] }) }),
|
|
73
|
-
type,
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ jsx(
|
|
76
|
-
NodeResizer,
|
|
77
|
-
{
|
|
78
|
-
nodeId: id,
|
|
79
|
-
minWidth: size.width,
|
|
80
|
-
minHeight: size.height,
|
|
81
|
-
isVisible: selected && !data.isCollapsed
|
|
82
|
-
}
|
|
83
|
-
),
|
|
84
|
-
/* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
var module_group_node_default = ModuleGroupNode;
|
|
90
|
-
export {
|
|
91
|
-
module_group_node_default as ModuleGroupNode
|
|
92
|
-
};
|
|
1
|
+
import{useFlowStore as I,useIncomingComputedData as M,useInteractiveStore as w,useUpdateNodeComputedData as z}from"@awesome-flow/core/hooks";import{NodeCollapse as S,NodeContainer as y,NodeTrackConnections as b}from"@awesome-flow/core/layout";import{Badge as x,Group as p}from"@mantine/core";import{NodeResizer as B,useStore as k,useUpdateNodeInternals as v}from"@xyflow/react";import{useCallback as n,useEffect as d,useMemo as P}from"react";import{shallow as T}from"zustand/shallow";import{jsx as s,jsxs as u}from"react/jsx-runtime";function U({id:e,selected:a,data:t,type:m,width:c,height:g}){let C=v(),N=k(o=>o.triggerNodeChanges),{groupNodes:h,setGroupCollapsed:f}=I(n(o=>({groupNodes:o.groups[e],setGroupCollapsed:o.setGroupCollapsed}),[])),i=w(n(o=>o.nodeIntersectionTargets[e],[e]),T);d(()=>{C(e)},[c,g]),d(()=>{N([{id:e,type:"select",selected:!!i}])},[i]);let D=n(o=>{f(e,o)},[]),l=P(()=>({width:t.initialSize?.width||100,height:t.initialSize?.height||50}),[t.initialSize]),r=M(e),G=z();return d(()=>{if(r?.length){let{module:o}=r[0];G(e,{module:o})}},[r]),u(y,{id:e,selected:a,data:t,title:s(p,{justify:"space-between",children:u(p,{gap:"xs",children:[s(x,{size:"xs",variant:"outline",radius:"xs",color:"gray",children:h?.length||0}),s(S,{nodeId:e,isCollapsed:t.isCollapsed,onCollapsed:D})]})}),type:m,children:[s(B,{nodeId:e,minWidth:l.width,minHeight:l.height,isVisible:a&&!t.isCollapsed}),s(b,{handles:t.handles,nodeId:e,type:"target"})]})}var E=U;export{E as ModuleGroupNode};
|