@awesome-flow/noise 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/abstract/index.cjs +8 -3469
  2. package/dist/abstract/index.d.cts +2 -2
  3. package/dist/abstract/index.d.ts +2 -2
  4. package/dist/abstract/index.js +15 -3508
  5. package/dist/chunk-2Y22M2Y4.js +0 -0
  6. package/dist/chunk-4PQ4USYV.cjs +1 -0
  7. package/dist/chunk-5ELMFIRV.js +0 -0
  8. package/dist/chunk-ACWBUUZ7.cjs +1376 -0
  9. package/dist/chunk-BG6U3TYO.js +1376 -0
  10. package/dist/chunk-D5JM4EYQ.cjs +305 -0
  11. package/dist/chunk-DWSACR65.js +305 -0
  12. package/dist/chunk-FFQRP23R.cjs +1 -0
  13. package/dist/chunk-JACBT4MS.cjs +1 -0
  14. package/dist/chunk-KHIIB5TH.js +93 -0
  15. package/dist/chunk-M67JHEU2.cjs +93 -0
  16. package/dist/chunk-N6YNJKLS.cjs +1 -0
  17. package/dist/chunk-PS5VUND5.js +348 -0
  18. package/dist/chunk-Q5FVGKKM.cjs +1 -0
  19. package/dist/chunk-RDQ4BOOV.js +522 -0
  20. package/dist/chunk-RKTZQUWR.cjs +348 -0
  21. package/dist/chunk-RVWCBH7K.js +0 -0
  22. package/dist/chunk-SD3T3LFY.js +0 -0
  23. package/dist/chunk-SGHEOOLW.js +19 -0
  24. package/dist/chunk-TOYKGWYO.js +0 -0
  25. package/dist/chunk-TZCT2GZV.cjs +522 -0
  26. package/dist/chunk-UNMRBZ5X.cjs +19 -0
  27. package/dist/chunk-WOJTKQKO.cjs +1 -0
  28. package/dist/chunk-XZQQ6N3L.js +0 -0
  29. package/dist/modules/index.cjs +4 -42
  30. package/dist/modules/index.js +3 -15
  31. package/dist/nodes/generators/index.cjs +13 -335
  32. package/dist/nodes/generators/index.d.cts +7 -7
  33. package/dist/nodes/generators/index.d.ts +7 -7
  34. package/dist/nodes/generators/index.js +12 -299
  35. package/dist/nodes/groups/index.cjs +4 -111
  36. package/dist/nodes/groups/index.d.cts +2 -2
  37. package/dist/nodes/groups/index.d.ts +2 -2
  38. package/dist/nodes/groups/index.js +2 -88
  39. package/dist/nodes/index.cjs +75 -3425
  40. package/dist/nodes/index.js +37 -3397
  41. package/dist/nodes/modifiers/index.cjs +4 -1459
  42. package/dist/nodes/modifiers/index.d.cts +6 -6
  43. package/dist/nodes/modifiers/index.d.ts +6 -6
  44. package/dist/nodes/modifiers/index.js +11 -1479
  45. package/dist/nodes/output/index.cjs +8 -1335
  46. package/dist/nodes/output/index.d.cts +3 -3
  47. package/dist/nodes/output/index.d.ts +3 -3
  48. package/dist/nodes/output/index.js +10 -1361
  49. package/dist/nodes/selectors/index.cjs +8 -1317
  50. package/dist/nodes/selectors/index.d.cts +1 -1
  51. package/dist/nodes/selectors/index.d.ts +1 -1
  52. package/dist/nodes/selectors/index.js +8 -1343
  53. package/dist/nodes/transformers/index.cjs +8 -331
  54. package/dist/nodes/transformers/index.d.cts +5 -5
  55. package/dist/nodes/transformers/index.d.ts +5 -5
  56. package/dist/nodes/transformers/index.js +6 -311
  57. package/dist/templates/generators/index.cjs +8 -1199
  58. package/dist/templates/generators/index.d.cts +5 -5
  59. package/dist/templates/generators/index.d.ts +5 -5
  60. package/dist/templates/generators/index.js +17 -1226
  61. package/dist/templates/groups/index.cjs +8 -1199
  62. package/dist/templates/groups/index.js +8 -1226
  63. package/dist/templates/index.cjs +77 -1263
  64. package/dist/templates/index.js +43 -1226
  65. package/dist/templates/modifiers/index.cjs +8 -1199
  66. package/dist/templates/modifiers/index.d.cts +9 -9
  67. package/dist/templates/modifiers/index.d.ts +9 -9
  68. package/dist/templates/modifiers/index.js +16 -1226
  69. package/dist/templates/output/index.cjs +8 -1199
  70. package/dist/templates/output/index.d.cts +3 -3
  71. package/dist/templates/output/index.d.ts +3 -3
  72. package/dist/templates/output/index.js +11 -1226
  73. package/dist/templates/selectors/index.cjs +8 -1199
  74. package/dist/templates/selectors/index.js +9 -1226
  75. package/dist/templates/transformers/index.cjs +8 -1199
  76. package/dist/templates/transformers/index.js +12 -1226
  77. package/package.json +30 -20
@@ -1,302 +1,15 @@
1
- // src/nodes/generators/noise-billow-node.tsx
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;
1
+ import {
2
+ noise_billow_node_default,
3
+ noise_checkerboard_node_default,
4
+ noise_const_node_default,
5
+ noise_cylinders_node_default,
6
+ noise_perlin_node_default,
7
+ noise_ridgedmulti_node_default,
8
+ noise_spheres_node_default,
9
+ noise_voronoi_node_default,
10
+ position_const_node_default,
11
+ position_grid_node_default
12
+ } from "../../chunk-DWSACR65.js";
300
13
  export {
301
14
  noise_billow_node_default as NoiseBillowNode,
302
15
  noise_checkerboard_node_default as NoiseCheckerboardNode,
@@ -1,113 +1,6 @@
1
- var __defProp = Object.defineProperty;
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);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
18
2
 
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);
3
+ var _chunkM67JHEU2cjs = require('../../chunk-M67JHEU2.cjs');
25
4
 
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
- });
5
+
6
+ exports.ModuleGroupNode = _chunkM67JHEU2cjs.module_group_node_default;
@@ -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, }: NodeProps<Node<BasicNodeData>>): react_jsx_runtime.JSX.Element;
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, }: NodeProps<Node<BasicNodeData>>): react_jsx_runtime.JSX.Element;
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,6 @@
1
- // src/nodes/groups/module-group-node.tsx
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
1
  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;
2
+ module_group_node_default
3
+ } from "../../chunk-KHIIB5TH.js";
90
4
  export {
91
5
  module_group_node_default as ModuleGroupNode
92
6
  };