@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,181 @@
|
|
|
1
|
+
// src/nodes/output/noise-logger-node.tsx
|
|
2
|
+
import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { Divider, Stack, Text } from "@mantine/core";
|
|
5
|
+
import { useIncomingComputedData } from "@awesome-flow/core/hooks";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function NoiseLoggerNode({ id, selected, data, type }) {
|
|
8
|
+
const incoming = useIncomingComputedData(id);
|
|
9
|
+
const noise = useMemo(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
10
|
+
return /* @__PURE__ */ jsxs(NodeContainer, { id, selected, data, type, children: [
|
|
11
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
12
|
+
"Size: ",
|
|
13
|
+
noise?.length || 0
|
|
14
|
+
] }),
|
|
15
|
+
/* @__PURE__ */ jsx(Divider, { h: 5 }),
|
|
16
|
+
/* @__PURE__ */ jsx(Stack, { children: noise?.map((v, i) => /* @__PURE__ */ jsxs(Text, { children: [
|
|
17
|
+
v.position?.x,
|
|
18
|
+
":",
|
|
19
|
+
v.position?.y,
|
|
20
|
+
":",
|
|
21
|
+
v.position?.z,
|
|
22
|
+
": ",
|
|
23
|
+
v.value
|
|
24
|
+
] }, i)) }),
|
|
25
|
+
/* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
var noise_logger_node_default = NoiseLoggerNode;
|
|
29
|
+
|
|
30
|
+
// src/nodes/output/noise-output-node.tsx
|
|
31
|
+
import { NodeContainer as NodeContainer2, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
|
|
32
|
+
import { useIncomingComputedData as useIncomingComputedData2, useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
|
|
33
|
+
import { Box, Group, LoadingOverlay, Stack as Stack2 } from "@mantine/core";
|
|
34
|
+
import { useEffect, useState } from "react";
|
|
35
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
36
|
+
function NoiseOutputNode({ id, selected, data, type }) {
|
|
37
|
+
const [generating, setGenerating] = useState(false);
|
|
38
|
+
const updateComputedData = useUpdateNodeComputedData();
|
|
39
|
+
const incomingModules = useIncomingComputedData2(id, 8 /* module */);
|
|
40
|
+
const incomingPositions = useIncomingComputedData2(
|
|
41
|
+
id,
|
|
42
|
+
4 /* position */
|
|
43
|
+
);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (incomingPositions?.length && incomingModules?.length) {
|
|
46
|
+
const { module } = incomingModules[0];
|
|
47
|
+
if (module) {
|
|
48
|
+
setGenerating(true);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [incomingModules, incomingPositions]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (incomingPositions?.length && incomingModules?.length) {
|
|
54
|
+
const { module } = incomingModules[0];
|
|
55
|
+
if (module && generating) {
|
|
56
|
+
const noise = [];
|
|
57
|
+
for (const input of incomingPositions) {
|
|
58
|
+
for (const position of input.positions) {
|
|
59
|
+
const value = module.getValue(position.x, position.y, position.z);
|
|
60
|
+
noise.push({
|
|
61
|
+
position,
|
|
62
|
+
value
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
console.log("SET COMPUTED DATA");
|
|
67
|
+
updateComputedData(id, { noise, module });
|
|
68
|
+
setGenerating(false);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, [generating]);
|
|
72
|
+
return /* @__PURE__ */ jsxs2(NodeContainer2, { id, selected, data, type, children: [
|
|
73
|
+
/* @__PURE__ */ jsxs2(Box, { pos: "relative", children: [
|
|
74
|
+
/* @__PURE__ */ jsx2(
|
|
75
|
+
LoadingOverlay,
|
|
76
|
+
{
|
|
77
|
+
visible: generating,
|
|
78
|
+
zIndex: 1e3,
|
|
79
|
+
overlayProps: { radius: "sm", blur: 2 }
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsxs2(Stack2, { children: [
|
|
83
|
+
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
84
|
+
"Position Inputs: ",
|
|
85
|
+
incomingPositions?.length
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
88
|
+
"Module Inputs: ",
|
|
89
|
+
incomingModules?.length
|
|
90
|
+
] })
|
|
91
|
+
] })
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ jsx2(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
var noise_output_node_default = NoiseOutputNode;
|
|
97
|
+
|
|
98
|
+
// src/nodes/output/noise-raw-texture-node.tsx
|
|
99
|
+
import { NodeContainer as NodeContainer3, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
|
|
100
|
+
import { useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
101
|
+
import { useIncomingComputedData as useIncomingComputedData3, useUpdateNodeComputedData as useUpdateNodeComputedData2 } from "@awesome-flow/core/hooks";
|
|
102
|
+
import { Group as Group2, Stack as Stack3 } from "@mantine/core";
|
|
103
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
104
|
+
function NoiseRawTextureNode({ id, selected, data, type }) {
|
|
105
|
+
const updateComputedData = useUpdateNodeComputedData2();
|
|
106
|
+
const [dataLength, setDataLength] = useState2(0);
|
|
107
|
+
const [resolution, setResolution] = useState2(0);
|
|
108
|
+
const incoming = useIncomingComputedData3(id);
|
|
109
|
+
const noise = useMemo2(() => incoming?.map((p) => p.noise).flat(), [incoming]);
|
|
110
|
+
useEffect2(() => {
|
|
111
|
+
if (noise?.length) {
|
|
112
|
+
const size = Math.ceil(Math.sqrt(noise.length));
|
|
113
|
+
const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();
|
|
114
|
+
const dataArray = new Uint8Array(size * size * 4);
|
|
115
|
+
dataArray.set(colors);
|
|
116
|
+
setResolution(size);
|
|
117
|
+
setDataLength(dataArray.length);
|
|
118
|
+
updateComputedData(id, { textureData: dataArray, textureResolution: size });
|
|
119
|
+
}
|
|
120
|
+
}, [noise]);
|
|
121
|
+
return /* @__PURE__ */ jsxs3(NodeContainer3, { id, selected, data, type, children: [
|
|
122
|
+
/* @__PURE__ */ jsxs3(Stack3, { children: [
|
|
123
|
+
/* @__PURE__ */ jsxs3(Group2, { children: [
|
|
124
|
+
"Resolution: ",
|
|
125
|
+
resolution,
|
|
126
|
+
"x",
|
|
127
|
+
resolution
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ jsxs3(Group2, { children: [
|
|
130
|
+
"Input Length: ",
|
|
131
|
+
noise?.length || 0
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ jsxs3(Group2, { children: [
|
|
134
|
+
"Output Length (",
|
|
135
|
+
resolution,
|
|
136
|
+
"*",
|
|
137
|
+
resolution,
|
|
138
|
+
"*4): ",
|
|
139
|
+
dataLength
|
|
140
|
+
] })
|
|
141
|
+
] }),
|
|
142
|
+
/* @__PURE__ */ jsx3(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
|
|
143
|
+
] });
|
|
144
|
+
}
|
|
145
|
+
var noise_raw_texture_node_default = NoiseRawTextureNode;
|
|
146
|
+
|
|
147
|
+
// src/nodes/output/positions-logger-node.tsx
|
|
148
|
+
import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
|
|
149
|
+
import { useMemo as useMemo3 } from "react";
|
|
150
|
+
import { Divider as Divider2, Stack as Stack4, Text as Text2 } from "@mantine/core";
|
|
151
|
+
import { useIncomingComputedData as useIncomingComputedData4 } from "@awesome-flow/core/hooks";
|
|
152
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
153
|
+
function PositionsLoggerNode({ id, selected, data, type }) {
|
|
154
|
+
const incoming = useIncomingComputedData4(id);
|
|
155
|
+
const positions = useMemo3(() => {
|
|
156
|
+
return incoming?.map((p) => p.positions).flat();
|
|
157
|
+
}, [incoming]);
|
|
158
|
+
return /* @__PURE__ */ jsxs4(NodeContainer4, { id, selected, data, type, children: [
|
|
159
|
+
/* @__PURE__ */ jsxs4(Text2, { children: [
|
|
160
|
+
"Size: ",
|
|
161
|
+
positions?.length || 0
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ jsx4(Divider2, { h: 5 }),
|
|
164
|
+
/* @__PURE__ */ jsx4(Stack4, { children: positions?.map((v, i) => /* @__PURE__ */ jsxs4(Text2, { children: [
|
|
165
|
+
v.x,
|
|
166
|
+
":",
|
|
167
|
+
v.y,
|
|
168
|
+
":",
|
|
169
|
+
v.z
|
|
170
|
+
] }, i)) }),
|
|
171
|
+
/* @__PURE__ */ jsx4(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
var positions_logger_node_default = PositionsLoggerNode;
|
|
175
|
+
export {
|
|
176
|
+
noise_logger_node_default as NoiseLoggerNode,
|
|
177
|
+
noise_output_node_default as NoiseOutputNode,
|
|
178
|
+
noise_raw_texture_node_default as NoiseRawTextureNode,
|
|
179
|
+
positions_logger_node_default as PositionsLoggerNode
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/nodes/output/noise-logger-node.tsx","../../../src/nodes/output/noise-output-node.tsx","../../../src/nodes/output/noise-raw-texture-node.tsx","../../../src/nodes/output/positions-logger-node.tsx"],"sourcesContent":["import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useMemo } from 'react';\nimport { Divider, Stack, Text } from '@mantine/core';\nimport { BasicNodeData } from '@awesome-flow/core/abstract';\nimport { useIncomingComputedData } from '@awesome-flow/core/hooks';\nimport { ComputedNoiseData } from '../../abstract/node-props';\n\nfunction NoiseLoggerNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>) {\n const incoming = useIncomingComputedData<ComputedNoiseData>(id);\n const noise = useMemo(() => incoming?.map((p) => p.noise).flat(), [incoming]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Text>Size: {noise?.length || 0}</Text>\n <Divider h={5} />\n <Stack>\n {noise?.map((v, i) => (\n <Text key={i}>\n {v.position?.x}:{v.position?.y}:{v.position?.z}: {v.value}\n </Text>\n ))}\n </Stack>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\n}\n\nexport default NoiseLoggerNode;\n","import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useIncomingComputedData, useUpdateNodeComputedData } from '@awesome-flow/core/hooks';\nimport { Box, Group, LoadingOverlay, Stack } from '@mantine/core';\nimport { BasicNodeData } from '@awesome-flow/core/abstract';\nimport { useEffect, useState } from 'react';\nimport { NoiseHandleFlag } from '../../abstract/handle-types';\nimport {\n ComputedModuleData,\n ComputedNoiseData,\n ComputedPositionsData,\n PositionNoiseValue,\n} from '../../abstract/node-props';\n\nfunction NoiseOutputNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>) {\n const [generating, setGenerating] = useState<boolean>(false);\n const updateComputedData = useUpdateNodeComputedData<ComputedNoiseData>();\n\n const incomingModules = useIncomingComputedData<ComputedModuleData>(id, NoiseHandleFlag.module);\n\n const incomingPositions = useIncomingComputedData<ComputedPositionsData>(\n id,\n NoiseHandleFlag.position\n );\n\n useEffect(() => {\n if (incomingPositions?.length && incomingModules?.length) {\n const { module } = incomingModules[0];\n\n if (module) {\n setGenerating(true);\n }\n }\n }, [incomingModules, incomingPositions]);\n\n useEffect(() => {\n if (incomingPositions?.length && incomingModules?.length) {\n const { module } = incomingModules[0];\n\n if (module && generating) {\n const noise: PositionNoiseValue[] = [];\n\n for (const input of incomingPositions) {\n for (const position of input.positions) {\n const value = module.getValue(position.x, position.y, position.z);\n\n noise.push({\n position,\n value,\n });\n }\n }\n\n console.log('SET COMPUTED DATA');\n updateComputedData(id, { noise, module });\n setGenerating(false);\n }\n }\n }, [generating]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Box pos=\"relative\">\n <LoadingOverlay\n visible={generating}\n zIndex={1000}\n overlayProps={{ radius: 'sm', blur: 2 }}\n />\n <Stack>\n <Group>Position Inputs: {incomingPositions?.length}</Group>\n <Group>Module Inputs: {incomingModules?.length}</Group>\n </Stack>\n </Box>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\n}\n\nexport default NoiseOutputNode;\n","import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useIncomingComputedData, useUpdateNodeComputedData } from '@awesome-flow/core/hooks';\nimport { Group, Stack } from '@mantine/core';\nimport { BasicNodeData } from '@awesome-flow/core/abstract';\nimport { ComputedNoiseData, ComputedNoiseTextureData } from '../../abstract/node-props';\n\nfunction NoiseRawTextureNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>) {\n const updateComputedData = useUpdateNodeComputedData<ComputedNoiseTextureData>();\n\n const [dataLength, setDataLength] = useState(0);\n const [resolution, setResolution] = useState(0);\n\n const incoming = useIncomingComputedData<ComputedNoiseData>(id);\n const noise = useMemo(() => incoming?.map((p) => p.noise).flat(), [incoming]);\n\n useEffect(() => {\n if (noise?.length) {\n const size = Math.ceil(Math.sqrt(noise.length));\n\n const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();\n const dataArray = new Uint8Array(size * size * 4);\n dataArray.set(colors);\n\n setResolution(size);\n setDataLength(dataArray.length);\n\n updateComputedData(id, { textureData: dataArray, textureResolution: size });\n }\n }, [noise]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Stack>\n <Group>\n Resolution: {resolution}x{resolution}\n </Group>\n <Group>Input Length: {noise?.length || 0}</Group>\n <Group>\n Output Length ({resolution}*{resolution}*4): {dataLength}\n </Group>\n </Stack>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\n}\n\nexport default NoiseRawTextureNode;\n","import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useMemo } from 'react';\nimport { Divider, Stack, Text } from '@mantine/core';\nimport { BasicNodeData } from '@awesome-flow/core/abstract';\nimport { useIncomingComputedData } from '@awesome-flow/core/hooks';\nimport { ComputedPositionsData } from '../../abstract/node-props';\n\nfunction PositionsLoggerNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>) {\n const incoming = useIncomingComputedData<ComputedPositionsData>(id);\n\n const positions = useMemo(() => {\n return incoming?.map((p) => p.positions).flat();\n }, [incoming]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Text>Size: {positions?.length || 0}</Text>\n <Divider h={5} />\n <Stack>\n {positions?.map((v, i) => (\n <Text key={i}>\n {v.x}:{v.y}:{v.z}\n </Text>\n ))}\n </Stack>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\n}\n\nexport default PositionsLoggerNode;\n"],"mappings":";AAAA,SAAS,eAAe,4BAA4B;AAEpD,SAAS,eAAe;AACxB,SAAS,SAAS,OAAO,YAAY;AAErC,SAAS,+BAA+B;AASlC,SACA,KADA;AANN,SAAS,gBAAgB,EAAE,IAAI,UAAU,MAAM,KAAK,GAAmC;AACrF,QAAM,WAAW,wBAA2C,EAAE;AAC9D,QAAM,QAAQ,QAAQ,MAAM,UAAU,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,QAAQ,CAAC;AAE5E,SACE,qBAAC,iBAAc,IAAQ,UAAoB,MAAY,MACrD;AAAA,yBAAC,QAAK;AAAA;AAAA,MAAO,OAAO,UAAU;AAAA,OAAE;AAAA,IAChC,oBAAC,WAAQ,GAAG,GAAG;AAAA,IACf,oBAAC,SACE,iBAAO,IAAI,CAAC,GAAG,MACd,qBAAC,QACE;AAAA,QAAE,UAAU;AAAA,MAAE;AAAA,MAAE,EAAE,UAAU;AAAA,MAAE;AAAA,MAAE,EAAE,UAAU;AAAA,MAAE;AAAA,MAAG,EAAE;AAAA,SAD3C,CAEX,CACD,GACH;AAAA,IACA,oBAAC,wBAAqB,SAAS,KAAK,SAAS,QAAQ,IAAI,MAAK,UAAS;AAAA,KACzE;AAEJ;A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gBAAAM,MAACR,gBAAA,EAAc,IAAQ,UAAoB,MAAY,MACrD;AAAA,oBAAAQ,MAACH,OAAA,EAAK;AAAA;AAAA,MAAO,WAAW,UAAU;AAAA,OAAE;AAAA,IACpC,gBAAAE,KAACJ,UAAA,EAAQ,GAAG,GAAG;AAAA,IACf,gBAAAI,KAACH,QAAA,EACE,qBAAW,IAAI,CAAC,GAAG,MAClB,gBAAAI,MAACH,OAAA,EACE;AAAA,QAAE;AAAA,MAAE;AAAA,MAAE,EAAE;AAAA,MAAE;AAAA,MAAE,EAAE;AAAA,SADN,CAEX,CACD,GACH;AAAA,IACA,gBAAAE,KAACN,uBAAA,EAAqB,SAAS,KAAK,SAAS,QAAQ,IAAI,MAAK,UAAS;AAAA,KACzE;AAEJ;AAEA,IAAO,gCAAQ;","names":["NodeContainer","NodeTrackConnections","useIncomingComputedData","Stack","jsx","jsxs","useIncomingComputedData","NodeContainer","Stack","NodeTrackConnections","NodeContainer","NodeTrackConnections","useEffect","useMemo","useState","useIncomingComputedData","useUpdateNodeComputedData","Group","Stack","jsx","jsxs","NodeContainer","NodeTrackConnections","useMemo","Divider","Stack","Text","useIncomingComputedData","jsx","jsxs"]}
|
|
@@ -0,0 +1,136 @@
|
|
|
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);
|
|
18
|
+
|
|
19
|
+
// src/nodes/selectors/index.ts
|
|
20
|
+
var selectors_exports = {};
|
|
21
|
+
__export(selectors_exports, {
|
|
22
|
+
NoiseBlendNode: () => noise_blend_node_default,
|
|
23
|
+
NoiseSelectNode: () => noise_select_node_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(selectors_exports);
|
|
26
|
+
|
|
27
|
+
// src/nodes/selectors/noise-blend-node.tsx
|
|
28
|
+
var import_layout = require("@awesome-flow/core/layout");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_hooks = require("@awesome-flow/core/hooks");
|
|
31
|
+
var import_selector = require("libnoise-ts/module/selector");
|
|
32
|
+
var import_core = require("@mantine/core");
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
function NoiseBlendNode({ id, selected, data, type }) {
|
|
35
|
+
const incoming = (0, import_hooks.useIncomingComputedData)(id);
|
|
36
|
+
const updateComputedData = (0, import_hooks.useUpdateNodeComputedData)();
|
|
37
|
+
(0, import_react.useEffect)(() => {
|
|
38
|
+
if (incoming?.length > 2) {
|
|
39
|
+
const module2 = new import_selector.Blend(incoming[0].module, incoming[1].module, incoming[2].module);
|
|
40
|
+
updateComputedData(id, { module: module2 });
|
|
41
|
+
}
|
|
42
|
+
}, [id, incoming, updateComputedData]);
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_layout.NodeContainer, { id, selected, data, type, children: [
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { children: [
|
|
45
|
+
"Modules: ",
|
|
46
|
+
incoming?.length
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
var noise_blend_node_default = NoiseBlendNode;
|
|
52
|
+
|
|
53
|
+
// src/nodes/selectors/noise-select-node.tsx
|
|
54
|
+
var import_layout2 = require("@awesome-flow/core/layout");
|
|
55
|
+
var import_react2 = require("react");
|
|
56
|
+
var import_hooks2 = require("@awesome-flow/core/hooks");
|
|
57
|
+
var import_selector2 = require("libnoise-ts/module/selector");
|
|
58
|
+
var import_core2 = require("@mantine/core");
|
|
59
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
60
|
+
function NoiseSelectNode({ id, selected, data, type }) {
|
|
61
|
+
const [edgeFalloff, setEdgeFalloff] = (0, import_react2.useState)(data.edgeFalloff);
|
|
62
|
+
const [lowerBound, setLowerBound] = (0, import_react2.useState)(data.lowerBound);
|
|
63
|
+
const [upperBound, setUpperBound] = (0, import_react2.useState)(data.upperBound);
|
|
64
|
+
const incoming = (0, import_hooks2.useIncomingComputedData)(id);
|
|
65
|
+
const updateNodeData = (0, import_hooks2.useUpdateNodeData)();
|
|
66
|
+
const updateComputedData = (0, import_hooks2.useUpdateNodeComputedData)();
|
|
67
|
+
(0, import_react2.useEffect)(() => {
|
|
68
|
+
if (incoming?.length > 2) {
|
|
69
|
+
const module2 = new import_selector2.Select(
|
|
70
|
+
incoming[0].module,
|
|
71
|
+
incoming[1].module,
|
|
72
|
+
incoming[2].module,
|
|
73
|
+
edgeFalloff,
|
|
74
|
+
lowerBound,
|
|
75
|
+
upperBound
|
|
76
|
+
);
|
|
77
|
+
updateComputedData(id, { module: module2 });
|
|
78
|
+
}
|
|
79
|
+
updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
|
|
80
|
+
}, [incoming, edgeFalloff, lowerBound, upperBound, updateNodeData, id, updateComputedData]);
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_layout2.NodeContainer, { id, selected, data, type, children: [
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Stack, { children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
|
|
84
|
+
"Edge Falloff:",
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
86
|
+
import_core2.NumberInput,
|
|
87
|
+
{
|
|
88
|
+
size: "xs",
|
|
89
|
+
w: 100,
|
|
90
|
+
value: edgeFalloff,
|
|
91
|
+
onChange: (e) => setEdgeFalloff(Number(e)),
|
|
92
|
+
step: 0.1
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
|
|
97
|
+
"Lower Bound:",
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
99
|
+
import_core2.NumberInput,
|
|
100
|
+
{
|
|
101
|
+
size: "xs",
|
|
102
|
+
w: 100,
|
|
103
|
+
value: lowerBound,
|
|
104
|
+
onChange: (e) => setLowerBound(Number(e)),
|
|
105
|
+
step: 0.1
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
|
|
110
|
+
"Upper Bound:",
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
112
|
+
import_core2.NumberInput,
|
|
113
|
+
{
|
|
114
|
+
size: "xs",
|
|
115
|
+
w: 100,
|
|
116
|
+
value: upperBound,
|
|
117
|
+
onChange: (e) => setUpperBound(Number(e)),
|
|
118
|
+
step: 0.1
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
|
|
123
|
+
"Modules: ",
|
|
124
|
+
incoming?.length
|
|
125
|
+
] })
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_layout2.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
128
|
+
] });
|
|
129
|
+
}
|
|
130
|
+
var noise_select_node_default = NoiseSelectNode;
|
|
131
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
132
|
+
0 && (module.exports = {
|
|
133
|
+
NoiseBlendNode,
|
|
134
|
+
NoiseSelectNode
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/nodes/selectors/index.ts","../../../src/nodes/selectors/noise-blend-node.tsx","../../../src/nodes/selectors/noise-select-node.tsx"],"sourcesContent":["export { default as NoiseBlendNode } from './noise-blend-node';\nexport { default as NoiseSelectNode } from './noise-select-node';\n","import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useEffect } from 'react';\nimport { useIncomingComputedData, useUpdateNodeComputedData } from '@awesome-flow/core/hooks';\nimport { Blend } from 'libnoise-ts/module/selector';\nimport { BasicNodeData } from '@awesome-flow/core/abstract';\nimport { Group } from '@mantine/core';\nimport { ComputedModuleData } from '../../abstract/node-props';\n\nfunction NoiseBlendNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>) {\n const incoming = useIncomingComputedData<ComputedModuleData>(id);\n const updateComputedData = useUpdateNodeComputedData<ComputedModuleData>();\n\n useEffect(() => {\n if (incoming?.length > 2) {\n const module = new Blend(incoming[0].module, incoming[1].module, incoming[2].module);\n updateComputedData(id, { module });\n }\n }, [id, incoming, updateComputedData]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Group>Modules: {incoming?.length}</Group>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\n}\n\nexport default NoiseBlendNode;\n","import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useEffect, useState } from 'react';\nimport {\n useIncomingComputedData,\n useUpdateNodeComputedData,\n useUpdateNodeData,\n} from '@awesome-flow/core/hooks';\nimport { Select } from 'libnoise-ts/module/selector';\nimport { Group, NumberInput, Stack } from '@mantine/core';\nimport { ComputedModuleData, NodeSelectNoiseData } from '../../abstract/node-props';\n\nfunction NoiseSelectNode({ id, selected, data, type }: NodeProps<Node<NodeSelectNoiseData>>) {\n const [edgeFalloff, setEdgeFalloff] = useState(data.edgeFalloff);\n const [lowerBound, setLowerBound] = useState(data.lowerBound);\n const [upperBound, setUpperBound] = useState(data.upperBound);\n\n const incoming = useIncomingComputedData<ComputedModuleData>(id);\n\n const updateNodeData = useUpdateNodeData<NodeSelectNoiseData>();\n const updateComputedData = useUpdateNodeComputedData<ComputedModuleData>();\n\n useEffect(() => {\n if (incoming?.length > 2) {\n const module = new Select(\n incoming[0].module,\n incoming[1].module,\n incoming[2].module,\n edgeFalloff,\n lowerBound,\n upperBound\n );\n\n updateComputedData(id, { module });\n }\n\n updateNodeData(id, { edgeFalloff, lowerBound, upperBound });\n }, [incoming, edgeFalloff, lowerBound, upperBound, updateNodeData, id, updateComputedData]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Stack>\n <Group>\n Edge Falloff:\n <NumberInput\n size=\"xs\"\n w={100}\n value={edgeFalloff}\n onChange={(e) => setEdgeFalloff(Number(e))}\n step={0.1}\n />\n </Group>\n <Group>\n Lower Bound:\n <NumberInput\n size=\"xs\"\n w={100}\n value={lowerBound}\n onChange={(e) => setLowerBound(Number(e))}\n step={0.1}\n />\n </Group>\n <Group>\n Upper Bound:\n <NumberInput\n size=\"xs\"\n w={100}\n value={upperBound}\n onChange={(e) => setUpperBound(Number(e))}\n step={0.1}\n />\n </Group>\n <Group>Modules: {incoming?.length}</Group>\n </Stack>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\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,UAAS;AAAA,KACzE;AAEJ;AAEA,IAAO,4BAAQ;","names":["module","import_layout","import_react","import_hooks","import_selector","import_core","import_jsx_runtime","module"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { NodeProps, Node } from '@xyflow/react';
|
|
3
|
+
import { BasicNodeData } from '@awesome-flow/core/abstract';
|
|
4
|
+
import { w as NodeSelectNoiseData } from '../../node-props-hKW-_KOU.cjs';
|
|
5
|
+
import 'libnoise-ts/module/generator';
|
|
6
|
+
import 'libnoise-ts/noisegen';
|
|
7
|
+
import 'libnoise-ts/module/Module';
|
|
8
|
+
import '../../handle-types-D-v5S53h.cjs';
|
|
9
|
+
import 'libnoise-ts/module/combiner';
|
|
10
|
+
import '../../properties-BxwtU6i9.cjs';
|
|
11
|
+
|
|
12
|
+
declare function NoiseBlendNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
declare function NoiseSelectNode({ id, selected, data, type }: NodeProps<Node<NodeSelectNoiseData>>): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { NoiseBlendNode, NoiseSelectNode };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { NodeProps, Node } from '@xyflow/react';
|
|
3
|
+
import { BasicNodeData } from '@awesome-flow/core/abstract';
|
|
4
|
+
import { w as NodeSelectNoiseData } from '../../node-props-CeZ8Oshz.js';
|
|
5
|
+
import 'libnoise-ts/module/generator';
|
|
6
|
+
import 'libnoise-ts/noisegen';
|
|
7
|
+
import 'libnoise-ts/module/Module';
|
|
8
|
+
import '../../handle-types-D-v5S53h.js';
|
|
9
|
+
import 'libnoise-ts/module/combiner';
|
|
10
|
+
import '../../properties-BxwtU6i9.js';
|
|
11
|
+
|
|
12
|
+
declare function NoiseBlendNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
declare function NoiseSelectNode({ id, selected, data, type }: NodeProps<Node<NodeSelectNoiseData>>): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { NoiseBlendNode, NoiseSelectNode };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// src/nodes/selectors/noise-blend-node.tsx
|
|
2
|
+
import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useIncomingComputedData, useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
|
|
5
|
+
import { Blend } from "libnoise-ts/module/selector";
|
|
6
|
+
import { Group } from "@mantine/core";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function NoiseBlendNode({ id, selected, data, type }) {
|
|
9
|
+
const incoming = useIncomingComputedData(id);
|
|
10
|
+
const updateComputedData = useUpdateNodeComputedData();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (incoming?.length > 2) {
|
|
13
|
+
const module = new Blend(incoming[0].module, incoming[1].module, incoming[2].module);
|
|
14
|
+
updateComputedData(id, { module });
|
|
15
|
+
}
|
|
16
|
+
}, [id, incoming, updateComputedData]);
|
|
17
|
+
return /* @__PURE__ */ jsxs(NodeContainer, { id, selected, data, type, children: [
|
|
18
|
+
/* @__PURE__ */ jsxs(Group, { children: [
|
|
19
|
+
"Modules: ",
|
|
20
|
+
incoming?.length
|
|
21
|
+
] }),
|
|
22
|
+
/* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
var noise_blend_node_default = NoiseBlendNode;
|
|
26
|
+
|
|
27
|
+
// src/nodes/selectors/noise-select-node.tsx
|
|
28
|
+
import { NodeContainer as NodeContainer2, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
|
|
29
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
30
|
+
import {
|
|
31
|
+
useIncomingComputedData as useIncomingComputedData2,
|
|
32
|
+
useUpdateNodeComputedData as useUpdateNodeComputedData2,
|
|
33
|
+
useUpdateNodeData
|
|
34
|
+
} from "@awesome-flow/core/hooks";
|
|
35
|
+
import { Select } from "libnoise-ts/module/selector";
|
|
36
|
+
import { Group as Group2, NumberInput, Stack } from "@mantine/core";
|
|
37
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
38
|
+
function NoiseSelectNode({ id, selected, data, type }) {
|
|
39
|
+
const [edgeFalloff, setEdgeFalloff] = useState(data.edgeFalloff);
|
|
40
|
+
const [lowerBound, setLowerBound] = useState(data.lowerBound);
|
|
41
|
+
const [upperBound, setUpperBound] = useState(data.upperBound);
|
|
42
|
+
const incoming = useIncomingComputedData2(id);
|
|
43
|
+
const updateNodeData = useUpdateNodeData();
|
|
44
|
+
const updateComputedData = useUpdateNodeComputedData2();
|
|
45
|
+
useEffect2(() => {
|
|
46
|
+
if (incoming?.length > 2) {
|
|
47
|
+
const module = new Select(
|
|
48
|
+
incoming[0].module,
|
|
49
|
+
incoming[1].module,
|
|
50
|
+
incoming[2].module,
|
|
51
|
+
edgeFalloff,
|
|
52
|
+
lowerBound,
|
|
53
|
+
upperBound
|
|
54
|
+
);
|
|
55
|
+
updateComputedData(id, { module });
|
|
56
|
+
}
|
|
57
|
+
updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
|
|
58
|
+
}, [incoming, edgeFalloff, lowerBound, upperBound, updateNodeData, id, updateComputedData]);
|
|
59
|
+
return /* @__PURE__ */ jsxs2(NodeContainer2, { id, selected, data, type, children: [
|
|
60
|
+
/* @__PURE__ */ jsxs2(Stack, { children: [
|
|
61
|
+
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
62
|
+
"Edge Falloff:",
|
|
63
|
+
/* @__PURE__ */ jsx2(
|
|
64
|
+
NumberInput,
|
|
65
|
+
{
|
|
66
|
+
size: "xs",
|
|
67
|
+
w: 100,
|
|
68
|
+
value: edgeFalloff,
|
|
69
|
+
onChange: (e) => setEdgeFalloff(Number(e)),
|
|
70
|
+
step: 0.1
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
75
|
+
"Lower Bound:",
|
|
76
|
+
/* @__PURE__ */ jsx2(
|
|
77
|
+
NumberInput,
|
|
78
|
+
{
|
|
79
|
+
size: "xs",
|
|
80
|
+
w: 100,
|
|
81
|
+
value: lowerBound,
|
|
82
|
+
onChange: (e) => setLowerBound(Number(e)),
|
|
83
|
+
step: 0.1
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
88
|
+
"Upper Bound:",
|
|
89
|
+
/* @__PURE__ */ jsx2(
|
|
90
|
+
NumberInput,
|
|
91
|
+
{
|
|
92
|
+
size: "xs",
|
|
93
|
+
w: 100,
|
|
94
|
+
value: upperBound,
|
|
95
|
+
onChange: (e) => setUpperBound(Number(e)),
|
|
96
|
+
step: 0.1
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ jsxs2(Group2, { children: [
|
|
101
|
+
"Modules: ",
|
|
102
|
+
incoming?.length
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ jsx2(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
var noise_select_node_default = NoiseSelectNode;
|
|
109
|
+
export {
|
|
110
|
+
noise_blend_node_default as NoiseBlendNode,
|
|
111
|
+
noise_select_node_default as NoiseSelectNode
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/nodes/selectors/noise-blend-node.tsx","../../../src/nodes/selectors/noise-select-node.tsx"],"sourcesContent":["import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useEffect } from 'react';\nimport { useIncomingComputedData, useUpdateNodeComputedData } from '@awesome-flow/core/hooks';\nimport { Blend } from 'libnoise-ts/module/selector';\nimport { BasicNodeData } from '@awesome-flow/core/abstract';\nimport { Group } from '@mantine/core';\nimport { ComputedModuleData } from '../../abstract/node-props';\n\nfunction NoiseBlendNode({ id, selected, data, type }: NodeProps<Node<BasicNodeData>>) {\n const incoming = useIncomingComputedData<ComputedModuleData>(id);\n const updateComputedData = useUpdateNodeComputedData<ComputedModuleData>();\n\n useEffect(() => {\n if (incoming?.length > 2) {\n const module = new Blend(incoming[0].module, incoming[1].module, incoming[2].module);\n updateComputedData(id, { module });\n }\n }, [id, incoming, updateComputedData]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Group>Modules: {incoming?.length}</Group>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\n}\n\nexport default NoiseBlendNode;\n","import { NodeContainer, NodeTrackConnections } from '@awesome-flow/core/layout';\nimport { Node, NodeProps } from '@xyflow/react';\nimport { useEffect, useState } from 'react';\nimport {\n useIncomingComputedData,\n useUpdateNodeComputedData,\n useUpdateNodeData,\n} from '@awesome-flow/core/hooks';\nimport { Select } from 'libnoise-ts/module/selector';\nimport { Group, NumberInput, Stack } from '@mantine/core';\nimport { ComputedModuleData, NodeSelectNoiseData } from '../../abstract/node-props';\n\nfunction NoiseSelectNode({ id, selected, data, type }: NodeProps<Node<NodeSelectNoiseData>>) {\n const [edgeFalloff, setEdgeFalloff] = useState(data.edgeFalloff);\n const [lowerBound, setLowerBound] = useState(data.lowerBound);\n const [upperBound, setUpperBound] = useState(data.upperBound);\n\n const incoming = useIncomingComputedData<ComputedModuleData>(id);\n\n const updateNodeData = useUpdateNodeData<NodeSelectNoiseData>();\n const updateComputedData = useUpdateNodeComputedData<ComputedModuleData>();\n\n useEffect(() => {\n if (incoming?.length > 2) {\n const module = new Select(\n incoming[0].module,\n incoming[1].module,\n incoming[2].module,\n edgeFalloff,\n lowerBound,\n upperBound\n );\n\n updateComputedData(id, { module });\n }\n\n updateNodeData(id, { edgeFalloff, lowerBound, upperBound });\n }, [incoming, edgeFalloff, lowerBound, upperBound, updateNodeData, id, updateComputedData]);\n\n return (\n <NodeContainer id={id} selected={selected} data={data} type={type}>\n <Stack>\n <Group>\n Edge Falloff:\n <NumberInput\n size=\"xs\"\n w={100}\n value={edgeFalloff}\n onChange={(e) => setEdgeFalloff(Number(e))}\n step={0.1}\n />\n </Group>\n <Group>\n Lower Bound:\n <NumberInput\n size=\"xs\"\n w={100}\n value={lowerBound}\n onChange={(e) => setLowerBound(Number(e))}\n step={0.1}\n />\n </Group>\n <Group>\n Upper Bound:\n <NumberInput\n size=\"xs\"\n w={100}\n value={upperBound}\n onChange={(e) => setUpperBound(Number(e))}\n step={0.1}\n />\n </Group>\n <Group>Modules: {incoming?.length}</Group>\n </Stack>\n <NodeTrackConnections handles={data.handles} nodeId={id} type=\"target\" />\n </NodeContainer>\n );\n}\n\nexport default NoiseSelectNode;\n"],"mappings":";AAAA,SAAS,eAAe,4BAA4B;AAEpD,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB,iCAAiC;AACnE,SAAS,aAAa;AAEtB,SAAS,aAAa;AAgBhB,SACA,KADA;AAbN,SAAS,eAAe,EAAE,IAAI,UAAU,MAAM,KAAK,GAAmC;AACpF,QAAM,WAAW,wBAA4C,EAAE;AAC/D,QAAM,qBAAqB,0BAA8C;AAEzE,YAAU,MAAM;AACd,QAAI,UAAU,SAAS,GAAG;AACxB,YAAM,SAAS,IAAI,MAAM,SAAS,CAAC,EAAE,QAAQ,SAAS,CAAC,EAAE,QAAQ,SAAS,CAAC,EAAE,MAAM;AACnF,yBAAmB,IAAI,EAAE,OA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,kBAAkB,CAAC;AAE1F,SACE,gBAAAK,MAACP,gBAAA,EAAc,IAAQ,UAAoB,MAAY,MACrD;AAAA,oBAAAO,MAAC,SACC;AAAA,sBAAAA,MAACF,QAAA,EAAM;AAAA;AAAA,QAEL,gBAAAC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,GAAG;AAAA,YACH,OAAO;AAAA,YACP,UAAU,CAAC,MAAM,eAAe,OAAO,CAAC,CAAC;AAAA,YACzC,MAAM;AAAA;AAAA,QACR;AAAA,SACF;AAAA,MACA,gBAAAC,MAACF,QAAA,EAAM;AAAA;AAAA,QAEL,gBAAAC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,GAAG;AAAA,YACH,OAAO;AAAA,YACP,UAAU,CAAC,MAAM,cAAc,OAAO,CAAC,CAAC;AAAA,YACxC,MAAM;AAAA;AAAA,QACR;AAAA,SACF;AAAA,MACA,gBAAAC,MAACF,QAAA,EAAM;AAAA;AAAA,QAEL,gBAAAC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,GAAG;AAAA,YACH,OAAO;AAAA,YACP,UAAU,CAAC,MAAM,cAAc,OAAO,CAAC,CAAC;AAAA,YACxC,MAAM;AAAA;AAAA,QACR;AAAA,SACF;AAAA,MACA,gBAAAC,MAACF,QAAA,EAAM;AAAA;AAAA,QAAU,UAAU;AAAA,SAAO;AAAA,OACpC;AAAA,IACA,gBAAAC,KAACL,uBAAA,EAAqB,SAAS,KAAK,SAAS,QAAQ,IAAI,MAAK,UAAS;AAAA,KACzE;AAEJ;AAEA,IAAO,4BAAQ;","names":["NodeContainer","NodeTrackConnections","useEffect","useIncomingComputedData","useUpdateNodeComputedData","Group","jsx","jsxs"]}
|