@awesome-flow/noise 0.3.0 → 0.5.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 +1403 -2079
- package/dist/abstract/index.d.cts +23 -25
- package/dist/abstract/index.d.ts +23 -25
- package/dist/abstract/index.js +1319 -1998
- package/dist/index-BungWYrh.d.cts +49 -0
- package/dist/index-DsQSjZC5.d.ts +49 -0
- package/dist/modules/index.cjs +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/{node-props-CeZ8Oshz.d.ts → node-props-BbqbXDXn.d.cts} +2 -22
- package/dist/{node-props-hKW-_KOU.d.cts → node-props-BbqbXDXn.d.ts} +2 -22
- package/dist/nodes/generators/index.cjs +130 -381
- package/dist/nodes/generators/index.d.cts +2 -8
- package/dist/nodes/generators/index.d.ts +2 -8
- package/dist/nodes/generators/index.js +112 -361
- package/dist/nodes/groups/index.cjs +27 -18
- package/dist/nodes/groups/index.js +34 -20
- package/dist/nodes/index.cjs +1652 -989
- package/dist/nodes/index.d.cts +3 -5
- package/dist/nodes/index.d.ts +3 -5
- package/dist/nodes/index.js +1629 -965
- package/dist/nodes/modifiers/index.cjs +17 -120
- package/dist/nodes/modifiers/index.d.cts +2 -6
- package/dist/nodes/modifiers/index.d.ts +2 -6
- package/dist/nodes/modifiers/index.js +16 -125
- package/dist/nodes/output/index.cjs +1270 -90
- package/dist/nodes/output/index.js +1318 -93
- package/dist/nodes/selectors/index.cjs +1295 -59
- package/dist/nodes/selectors/index.d.cts +1 -3
- package/dist/nodes/selectors/index.d.ts +1 -3
- package/dist/nodes/selectors/index.js +1343 -66
- package/dist/nodes/transformers/index.cjs +67 -207
- package/dist/nodes/transformers/index.d.cts +3 -5
- package/dist/nodes/transformers/index.d.ts +3 -5
- package/dist/nodes/transformers/index.js +54 -194
- package/dist/templates/generators/index.cjs +838 -1279
- package/dist/templates/generators/index.d.cts +13 -50
- package/dist/templates/generators/index.d.ts +13 -50
- package/dist/templates/generators/index.js +840 -1281
- package/dist/templates/groups/index.cjs +836 -1273
- package/dist/templates/groups/index.d.cts +1 -5
- package/dist/templates/groups/index.d.ts +1 -5
- package/dist/templates/groups/index.js +839 -1278
- package/dist/templates/index.cjs +838 -1281
- package/dist/templates/index.d.cts +4 -7
- package/dist/templates/index.d.ts +4 -7
- package/dist/templates/index.js +840 -1282
- package/dist/templates/modifiers/index.cjs +840 -1279
- package/dist/templates/modifiers/index.d.cts +11 -38
- package/dist/templates/modifiers/index.d.ts +11 -38
- package/dist/templates/modifiers/index.js +842 -1282
- package/dist/templates/output/index.cjs +838 -1275
- package/dist/templates/output/index.d.cts +4 -14
- package/dist/templates/output/index.d.ts +4 -14
- package/dist/templates/output/index.js +841 -1280
- package/dist/templates/selectors/index.cjs +838 -1275
- package/dist/templates/selectors/index.d.cts +3 -9
- package/dist/templates/selectors/index.d.ts +3 -9
- package/dist/templates/selectors/index.js +841 -1280
- package/dist/templates/transformers/index.cjs +838 -1275
- package/dist/templates/transformers/index.d.cts +3 -36
- package/dist/templates/transformers/index.d.ts +3 -36
- package/dist/templates/transformers/index.js +841 -1280
- package/package.json +3 -3
- package/dist/abstract/index.cjs.map +0 -1
- package/dist/abstract/index.js.map +0 -1
- package/dist/handle-types-D-v5S53h.d.cts +0 -22
- package/dist/handle-types-D-v5S53h.d.ts +0 -22
- package/dist/layout/index.cjs +0 -164
- package/dist/layout/index.cjs.map +0 -1
- package/dist/layout/index.d.cts +0 -26
- package/dist/layout/index.d.ts +0 -26
- package/dist/layout/index.js +0 -136
- package/dist/layout/index.js.map +0 -1
- package/dist/modules/index.cjs.map +0 -1
- package/dist/modules/index.js.map +0 -1
- package/dist/nodes/generators/index.cjs.map +0 -1
- package/dist/nodes/generators/index.js.map +0 -1
- package/dist/nodes/groups/index.cjs.map +0 -1
- package/dist/nodes/groups/index.js.map +0 -1
- package/dist/nodes/index.cjs.map +0 -1
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/modifiers/index.cjs.map +0 -1
- package/dist/nodes/modifiers/index.js.map +0 -1
- package/dist/nodes/output/index.cjs.map +0 -1
- package/dist/nodes/output/index.js.map +0 -1
- package/dist/nodes/selectors/index.cjs.map +0 -1
- package/dist/nodes/selectors/index.js.map +0 -1
- package/dist/nodes/transformers/index.cjs.map +0 -1
- package/dist/nodes/transformers/index.js.map +0 -1
- package/dist/properties-BxwtU6i9.d.cts +0 -9
- package/dist/properties-BxwtU6i9.d.ts +0 -9
- package/dist/templates/generators/index.cjs.map +0 -1
- package/dist/templates/generators/index.js.map +0 -1
- package/dist/templates/groups/index.cjs.map +0 -1
- package/dist/templates/groups/index.js.map +0 -1
- package/dist/templates/index.cjs.map +0 -1
- package/dist/templates/index.js.map +0 -1
- package/dist/templates/modifiers/index.cjs.map +0 -1
- package/dist/templates/modifiers/index.js.map +0 -1
- package/dist/templates/output/index.cjs.map +0 -1
- package/dist/templates/output/index.js.map +0 -1
- package/dist/templates/selectors/index.cjs.map +0 -1
- package/dist/templates/selectors/index.js.map +0 -1
- package/dist/templates/transformers/index.cjs.map +0 -1
- package/dist/templates/transformers/index.js.map +0 -1
|
@@ -85,8 +85,7 @@ __export(modifiers_exports, {
|
|
|
85
85
|
NoiseInvertNode: () => noise_invert_node_default,
|
|
86
86
|
NoiseNormalizeNode: () => noise_normalize_node_default,
|
|
87
87
|
NoiseScaleBiasNode: () => noise_scale_bias_node_default,
|
|
88
|
-
NoiseTerraceNode: () => noise_terrace_node_default
|
|
89
|
-
VariableCombineNode: () => variable_combine_node_default
|
|
88
|
+
NoiseTerraceNode: () => noise_terrace_node_default
|
|
90
89
|
});
|
|
91
90
|
module.exports = __toCommonJS(modifiers_exports);
|
|
92
91
|
|
|
@@ -197,7 +196,7 @@ function NoiseCombineNode({ id, selected, data, type }) {
|
|
|
197
196
|
updateNodeData(id, { operation });
|
|
198
197
|
}, []);
|
|
199
198
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_layout3.NodeContainer, { id, selected, data, type, children: [
|
|
200
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_layout3.NodeCombobox, { options, selected: data.operation, onChange }),
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_layout3.NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
|
|
201
200
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_layout3.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
202
201
|
] });
|
|
203
202
|
}
|
|
@@ -854,6 +853,11 @@ function useFormWatch({
|
|
|
854
853
|
};
|
|
855
854
|
}
|
|
856
855
|
|
|
856
|
+
// ../../node_modules/@mantine/form/esm/paths/get-data-path.mjs
|
|
857
|
+
function getDataPath(formName, fieldPath) {
|
|
858
|
+
return formName ? `${formName}-${fieldPath.toString()}` : fieldPath.toString();
|
|
859
|
+
}
|
|
860
|
+
|
|
857
861
|
// ../../node_modules/@mantine/form/esm/validate/validate-values.mjs
|
|
858
862
|
function getValidationResults(errors) {
|
|
859
863
|
const filteredErrors = filterErrors(errors);
|
|
@@ -955,7 +959,7 @@ function useForm({
|
|
|
955
959
|
$values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
|
|
956
960
|
}, []);
|
|
957
961
|
const setFieldValue = (0, import_react10.useCallback)(
|
|
958
|
-
(path, value,
|
|
962
|
+
(path, value, options2) => {
|
|
959
963
|
const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
|
|
960
964
|
$status.clearFieldDirty(path);
|
|
961
965
|
$status.setFieldTouched(path, true);
|
|
@@ -970,7 +974,7 @@ function useForm({
|
|
|
970
974
|
const validationResults = validateFieldValue(path, rules, payload.updatedValues);
|
|
971
975
|
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
972
976
|
} : null,
|
|
973
|
-
|
|
977
|
+
options2?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
|
|
974
978
|
...keys,
|
|
975
979
|
[path]: (keys[path] || 0) + 1
|
|
976
980
|
})) : null
|
|
@@ -1012,7 +1016,7 @@ function useForm({
|
|
|
1012
1016
|
const onChange = getInputOnChange(
|
|
1013
1017
|
(value) => setFieldValue(path, value, { forceUpdate: false })
|
|
1014
1018
|
);
|
|
1015
|
-
const payload = { onChange };
|
|
1019
|
+
const payload = { onChange, "data-path": getDataPath(name, path) };
|
|
1016
1020
|
if (withError) {
|
|
1017
1021
|
payload.error = $errors.errorsState[path];
|
|
1018
1022
|
}
|
|
@@ -1065,6 +1069,10 @@ function useForm({
|
|
|
1065
1069
|
[rules]
|
|
1066
1070
|
);
|
|
1067
1071
|
const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
|
|
1072
|
+
const getInputNode = (0, import_react10.useCallback)(
|
|
1073
|
+
(path) => document.querySelector(`[data-path="${getDataPath(name, path)}"]`),
|
|
1074
|
+
[]
|
|
1075
|
+
);
|
|
1068
1076
|
const form = {
|
|
1069
1077
|
watch: $watch.watch,
|
|
1070
1078
|
initialized: $values.initialized.current,
|
|
@@ -1098,7 +1106,8 @@ function useForm({
|
|
|
1098
1106
|
onReset,
|
|
1099
1107
|
isValid,
|
|
1100
1108
|
getTransformedValues,
|
|
1101
|
-
key
|
|
1109
|
+
key,
|
|
1110
|
+
getInputNode
|
|
1102
1111
|
};
|
|
1103
1112
|
useFormActions(name, form);
|
|
1104
1113
|
return form;
|
|
@@ -1467,116 +1476,6 @@ function NoiseTerraceNode({ id, selected, data, type }) {
|
|
|
1467
1476
|
] });
|
|
1468
1477
|
}
|
|
1469
1478
|
var noise_terrace_node_default = NoiseTerraceNode;
|
|
1470
|
-
|
|
1471
|
-
// src/nodes/modifiers/variable-combine-node.tsx
|
|
1472
|
-
var import_layout10 = require("@awesome-flow/core/layout");
|
|
1473
|
-
var import_react18 = require("react");
|
|
1474
|
-
var import_hooks13 = require("@awesome-flow/core/hooks");
|
|
1475
|
-
var import_icons_react4 = require("@tabler/icons-react");
|
|
1476
|
-
|
|
1477
|
-
// src/layout/node-value-input.tsx
|
|
1478
|
-
var import_core7 = require("@mantine/core");
|
|
1479
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1480
|
-
function NodeValueInput({ value, disabled, step, onChange }) {
|
|
1481
|
-
if (value === void 0 || value === null) {
|
|
1482
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, {});
|
|
1483
|
-
}
|
|
1484
|
-
switch (typeof value) {
|
|
1485
|
-
case "boolean": {
|
|
1486
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1487
|
-
import_core7.Switch,
|
|
1488
|
-
{
|
|
1489
|
-
checked: value,
|
|
1490
|
-
disabled,
|
|
1491
|
-
onChange: (e) => onChange(e.currentTarget.checked)
|
|
1492
|
-
}
|
|
1493
|
-
);
|
|
1494
|
-
}
|
|
1495
|
-
case "number": {
|
|
1496
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core7.NumberInput, { value, disabled, step, onChange: (e) => onChange(e) });
|
|
1497
|
-
}
|
|
1498
|
-
case "string": {
|
|
1499
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1500
|
-
import_core7.Input,
|
|
1501
|
-
{
|
|
1502
|
-
value,
|
|
1503
|
-
disabled,
|
|
1504
|
-
onChange: (e) => onChange(e.currentTarget.value)
|
|
1505
|
-
}
|
|
1506
|
-
);
|
|
1507
|
-
}
|
|
1508
|
-
default:
|
|
1509
|
-
throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
var node_value_input_default = NodeValueInput;
|
|
1513
|
-
|
|
1514
|
-
// src/layout/node-property-input.tsx
|
|
1515
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1516
|
-
|
|
1517
|
-
// src/layout/node-property-variables.tsx
|
|
1518
|
-
var import_hooks12 = require("@awesome-flow/core/hooks");
|
|
1519
|
-
var import_react17 = require("react");
|
|
1520
|
-
var import_core8 = require("@mantine/core");
|
|
1521
|
-
var import_utils = require("@awesome-flow/core/utils");
|
|
1522
|
-
var import_abstract3 = require("@awesome-flow/core/abstract");
|
|
1523
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1524
|
-
|
|
1525
|
-
// src/nodes/modifiers/variable-combine-node.tsx
|
|
1526
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1527
|
-
var options2 = {
|
|
1528
|
-
add: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react4.IconPlus, {}),
|
|
1529
|
-
divide: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react4.IconDivide, {}),
|
|
1530
|
-
min: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react4.IconChevronLeft, {}),
|
|
1531
|
-
max: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react4.IconChevronRight, {}),
|
|
1532
|
-
multiply: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react4.IconAsterisk, {}),
|
|
1533
|
-
power: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react4.IconChevronUp, {})
|
|
1534
|
-
};
|
|
1535
|
-
function VariableCombineNode({
|
|
1536
|
-
id,
|
|
1537
|
-
selected,
|
|
1538
|
-
data,
|
|
1539
|
-
type
|
|
1540
|
-
}) {
|
|
1541
|
-
const [operation, setOperation] = (0, import_react18.useState)(data.operation);
|
|
1542
|
-
const [value, setValue] = (0, import_react18.useState)(data.value);
|
|
1543
|
-
const updateNodeData = (0, import_hooks13.useUpdateNodeData)();
|
|
1544
|
-
const incoming = (0, import_hooks13.useIncomingNodeData)(id);
|
|
1545
|
-
(0, import_react18.useEffect)(() => {
|
|
1546
|
-
if (incoming?.length > 1) {
|
|
1547
|
-
const result = getOperationResult(operation, incoming[0].value, incoming[1].value);
|
|
1548
|
-
setValue(result);
|
|
1549
|
-
updateNodeData(id, { value: result });
|
|
1550
|
-
}
|
|
1551
|
-
}, [operation, incoming]);
|
|
1552
|
-
const onChange = (0, import_react18.useCallback)((op) => {
|
|
1553
|
-
updateNodeData(id, { operation: op });
|
|
1554
|
-
setOperation(op);
|
|
1555
|
-
}, []);
|
|
1556
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_layout10.NodeContainer, { id, selected, data, type, children: [
|
|
1557
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_layout10.NodeCombobox, { options: options2, selected: operation, onChange }),
|
|
1558
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(node_value_input_default, { value, onChange: () => {
|
|
1559
|
-
}, disabled: true }),
|
|
1560
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_layout10.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
1561
|
-
] });
|
|
1562
|
-
}
|
|
1563
|
-
function getOperationResult(operation, value1, value2) {
|
|
1564
|
-
switch (operation) {
|
|
1565
|
-
case "add" /* add */:
|
|
1566
|
-
return Number(value1) + Number(value2);
|
|
1567
|
-
case "divide" /* divide */:
|
|
1568
|
-
return Number(value1) / (Number(value2) || 1);
|
|
1569
|
-
case "max" /* max */:
|
|
1570
|
-
return Number(value1) > Number(value2) ? value1 : value2;
|
|
1571
|
-
case "min" /* min */:
|
|
1572
|
-
return Number(value1) < Number(value2) ? value1 : value2;
|
|
1573
|
-
case "multiply" /* multiply */:
|
|
1574
|
-
return Number(value1) * Number(value2);
|
|
1575
|
-
case "power" /* power */:
|
|
1576
|
-
return Number(value1) ** Number(value2);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
var variable_combine_node_default = VariableCombineNode;
|
|
1580
1479
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1581
1480
|
0 && (module.exports = {
|
|
1582
1481
|
NoiseAbsNode,
|
|
@@ -1587,7 +1486,5 @@ var variable_combine_node_default = VariableCombineNode;
|
|
|
1587
1486
|
NoiseInvertNode,
|
|
1588
1487
|
NoiseNormalizeNode,
|
|
1589
1488
|
NoiseScaleBiasNode,
|
|
1590
|
-
NoiseTerraceNode
|
|
1591
|
-
VariableCombineNode
|
|
1489
|
+
NoiseTerraceNode
|
|
1592
1490
|
});
|
|
1593
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { NodeProps, Node } from '@xyflow/react';
|
|
3
3
|
import { BasicNodeData } from '@awesome-flow/core/abstract';
|
|
4
|
-
import {
|
|
4
|
+
import { h as NodeNormalizeNoiseData, o as NodeCombineNoiseData, i as NodeClampNoiseData, p as NodeCurveNoiseData, r as NodeExponentNoiseData, s as NodeScaleBiasNoiseData, q as NodeTerraceNoiseData } from '../../node-props-BbqbXDXn.cjs';
|
|
5
5
|
import 'libnoise-ts/module/generator';
|
|
6
6
|
import 'libnoise-ts/noisegen';
|
|
7
7
|
import 'libnoise-ts/module/Module';
|
|
8
|
-
import '../../handle-types-D-v5S53h.cjs';
|
|
9
8
|
import 'libnoise-ts/module/combiner';
|
|
10
|
-
import '../../properties-BxwtU6i9.cjs';
|
|
11
9
|
|
|
12
10
|
declare function NoiseNormalizeNode({ id, selected, data, type }: NodeProps<Node<NodeNormalizeNoiseData>>): react_jsx_runtime.JSX.Element;
|
|
13
11
|
|
|
@@ -27,6 +25,4 @@ declare function NoiseScaleBiasNode({ id, selected, data, type }: NodeProps<Node
|
|
|
27
25
|
|
|
28
26
|
declare function NoiseTerraceNode({ id, selected, data, type }: NodeProps<Node<NodeTerraceNoiseData>>): react_jsx_runtime.JSX.Element;
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export { NoiseAbsNode, NoiseClampNode, NoiseCombineNode, NoiseCurveNode, NoiseExponentNode, NoiseInvertNode, NoiseNormalizeNode, NoiseScaleBiasNode, NoiseTerraceNode, VariableCombineNode };
|
|
28
|
+
export { NoiseAbsNode, NoiseClampNode, NoiseCombineNode, NoiseCurveNode, NoiseExponentNode, NoiseInvertNode, NoiseNormalizeNode, NoiseScaleBiasNode, NoiseTerraceNode };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { NodeProps, Node } from '@xyflow/react';
|
|
3
3
|
import { BasicNodeData } from '@awesome-flow/core/abstract';
|
|
4
|
-
import {
|
|
4
|
+
import { h as NodeNormalizeNoiseData, o as NodeCombineNoiseData, i as NodeClampNoiseData, p as NodeCurveNoiseData, r as NodeExponentNoiseData, s as NodeScaleBiasNoiseData, q as NodeTerraceNoiseData } from '../../node-props-BbqbXDXn.js';
|
|
5
5
|
import 'libnoise-ts/module/generator';
|
|
6
6
|
import 'libnoise-ts/noisegen';
|
|
7
7
|
import 'libnoise-ts/module/Module';
|
|
8
|
-
import '../../handle-types-D-v5S53h.js';
|
|
9
8
|
import 'libnoise-ts/module/combiner';
|
|
10
|
-
import '../../properties-BxwtU6i9.js';
|
|
11
9
|
|
|
12
10
|
declare function NoiseNormalizeNode({ id, selected, data, type }: NodeProps<Node<NodeNormalizeNoiseData>>): react_jsx_runtime.JSX.Element;
|
|
13
11
|
|
|
@@ -27,6 +25,4 @@ declare function NoiseScaleBiasNode({ id, selected, data, type }: NodeProps<Node
|
|
|
27
25
|
|
|
28
26
|
declare function NoiseTerraceNode({ id, selected, data, type }: NodeProps<Node<NodeTerraceNoiseData>>): react_jsx_runtime.JSX.Element;
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export { NoiseAbsNode, NoiseClampNode, NoiseCombineNode, NoiseCurveNode, NoiseExponentNode, NoiseInvertNode, NoiseNormalizeNode, NoiseScaleBiasNode, NoiseTerraceNode, VariableCombineNode };
|
|
28
|
+
export { NoiseAbsNode, NoiseClampNode, NoiseCombineNode, NoiseCurveNode, NoiseExponentNode, NoiseInvertNode, NoiseNormalizeNode, NoiseScaleBiasNode, NoiseTerraceNode };
|
|
@@ -190,7 +190,7 @@ function NoiseCombineNode({ id, selected, data, type }) {
|
|
|
190
190
|
updateNodeData(id, { operation });
|
|
191
191
|
}, []);
|
|
192
192
|
return /* @__PURE__ */ jsxs2(NodeContainer3, { id, selected, data, type, children: [
|
|
193
|
-
/* @__PURE__ */ jsx3(NodeCombobox, { options, selected: data.operation, onChange }),
|
|
193
|
+
/* @__PURE__ */ jsx3(NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
|
|
194
194
|
/* @__PURE__ */ jsx3(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
|
|
195
195
|
] });
|
|
196
196
|
}
|
|
@@ -851,6 +851,11 @@ function useFormWatch({
|
|
|
851
851
|
};
|
|
852
852
|
}
|
|
853
853
|
|
|
854
|
+
// ../../node_modules/@mantine/form/esm/paths/get-data-path.mjs
|
|
855
|
+
function getDataPath(formName, fieldPath) {
|
|
856
|
+
return formName ? `${formName}-${fieldPath.toString()}` : fieldPath.toString();
|
|
857
|
+
}
|
|
858
|
+
|
|
854
859
|
// ../../node_modules/@mantine/form/esm/validate/validate-values.mjs
|
|
855
860
|
function getValidationResults(errors) {
|
|
856
861
|
const filteredErrors = filterErrors(errors);
|
|
@@ -952,7 +957,7 @@ function useForm({
|
|
|
952
957
|
$values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
|
|
953
958
|
}, []);
|
|
954
959
|
const setFieldValue = useCallback7(
|
|
955
|
-
(path, value,
|
|
960
|
+
(path, value, options2) => {
|
|
956
961
|
const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
|
|
957
962
|
$status.clearFieldDirty(path);
|
|
958
963
|
$status.setFieldTouched(path, true);
|
|
@@ -967,7 +972,7 @@ function useForm({
|
|
|
967
972
|
const validationResults = validateFieldValue(path, rules, payload.updatedValues);
|
|
968
973
|
validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
|
|
969
974
|
} : null,
|
|
970
|
-
|
|
975
|
+
options2?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
|
|
971
976
|
...keys,
|
|
972
977
|
[path]: (keys[path] || 0) + 1
|
|
973
978
|
})) : null
|
|
@@ -1009,7 +1014,7 @@ function useForm({
|
|
|
1009
1014
|
const onChange = getInputOnChange(
|
|
1010
1015
|
(value) => setFieldValue(path, value, { forceUpdate: false })
|
|
1011
1016
|
);
|
|
1012
|
-
const payload = { onChange };
|
|
1017
|
+
const payload = { onChange, "data-path": getDataPath(name, path) };
|
|
1013
1018
|
if (withError) {
|
|
1014
1019
|
payload.error = $errors.errorsState[path];
|
|
1015
1020
|
}
|
|
@@ -1062,6 +1067,10 @@ function useForm({
|
|
|
1062
1067
|
[rules]
|
|
1063
1068
|
);
|
|
1064
1069
|
const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
|
|
1070
|
+
const getInputNode = useCallback7(
|
|
1071
|
+
(path) => document.querySelector(`[data-path="${getDataPath(name, path)}"]`),
|
|
1072
|
+
[]
|
|
1073
|
+
);
|
|
1065
1074
|
const form = {
|
|
1066
1075
|
watch: $watch.watch,
|
|
1067
1076
|
initialized: $values.initialized.current,
|
|
@@ -1095,7 +1104,8 @@ function useForm({
|
|
|
1095
1104
|
onReset,
|
|
1096
1105
|
isValid,
|
|
1097
1106
|
getTransformedValues,
|
|
1098
|
-
key
|
|
1107
|
+
key,
|
|
1108
|
+
getInputNode
|
|
1099
1109
|
};
|
|
1100
1110
|
useFormActions(name, form);
|
|
1101
1111
|
return form;
|
|
@@ -1480,123 +1490,6 @@ function NoiseTerraceNode({ id, selected, data, type }) {
|
|
|
1480
1490
|
] });
|
|
1481
1491
|
}
|
|
1482
1492
|
var noise_terrace_node_default = NoiseTerraceNode;
|
|
1483
|
-
|
|
1484
|
-
// src/nodes/modifiers/variable-combine-node.tsx
|
|
1485
|
-
import { NodeCombobox as NodeCombobox2, NodeContainer as NodeContainer10, NodeTrackConnections as NodeTrackConnections10 } from "@awesome-flow/core/layout";
|
|
1486
|
-
import { useCallback as useCallback11, useEffect as useEffect13, useState as useState12 } from "react";
|
|
1487
|
-
import { useIncomingNodeData as useIncomingNodeData2, useUpdateNodeData as useUpdateNodeData9 } from "@awesome-flow/core/hooks";
|
|
1488
|
-
import {
|
|
1489
|
-
IconAsterisk as IconAsterisk2,
|
|
1490
|
-
IconChevronLeft as IconChevronLeft2,
|
|
1491
|
-
IconChevronRight as IconChevronRight2,
|
|
1492
|
-
IconChevronUp as IconChevronUp2,
|
|
1493
|
-
IconDivide,
|
|
1494
|
-
IconPlus as IconPlus2
|
|
1495
|
-
} from "@tabler/icons-react";
|
|
1496
|
-
|
|
1497
|
-
// src/layout/node-value-input.tsx
|
|
1498
|
-
import { Input, NumberInput as NumberInput7, Switch } from "@mantine/core";
|
|
1499
|
-
import { Fragment as Fragment3, jsx as jsx10 } from "react/jsx-runtime";
|
|
1500
|
-
function NodeValueInput({ value, disabled, step, onChange }) {
|
|
1501
|
-
if (value === void 0 || value === null) {
|
|
1502
|
-
return /* @__PURE__ */ jsx10(Fragment3, {});
|
|
1503
|
-
}
|
|
1504
|
-
switch (typeof value) {
|
|
1505
|
-
case "boolean": {
|
|
1506
|
-
return /* @__PURE__ */ jsx10(
|
|
1507
|
-
Switch,
|
|
1508
|
-
{
|
|
1509
|
-
checked: value,
|
|
1510
|
-
disabled,
|
|
1511
|
-
onChange: (e) => onChange(e.currentTarget.checked)
|
|
1512
|
-
}
|
|
1513
|
-
);
|
|
1514
|
-
}
|
|
1515
|
-
case "number": {
|
|
1516
|
-
return /* @__PURE__ */ jsx10(NumberInput7, { value, disabled, step, onChange: (e) => onChange(e) });
|
|
1517
|
-
}
|
|
1518
|
-
case "string": {
|
|
1519
|
-
return /* @__PURE__ */ jsx10(
|
|
1520
|
-
Input,
|
|
1521
|
-
{
|
|
1522
|
-
value,
|
|
1523
|
-
disabled,
|
|
1524
|
-
onChange: (e) => onChange(e.currentTarget.value)
|
|
1525
|
-
}
|
|
1526
|
-
);
|
|
1527
|
-
}
|
|
1528
|
-
default:
|
|
1529
|
-
throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
var node_value_input_default = NodeValueInput;
|
|
1533
|
-
|
|
1534
|
-
// src/layout/node-property-input.tsx
|
|
1535
|
-
import { Fragment as Fragment4, jsx as jsx11 } from "react/jsx-runtime";
|
|
1536
|
-
|
|
1537
|
-
// src/layout/node-property-variables.tsx
|
|
1538
|
-
import { useIncomingNodeData, useUpdateNodeData as useUpdateNodeData8 } from "@awesome-flow/core/hooks";
|
|
1539
|
-
import { useCallback as useCallback10, useEffect as useEffect12, useMemo, useState as useState11 } from "react";
|
|
1540
|
-
import { Group as Group7, Stack as Stack5 } from "@mantine/core";
|
|
1541
|
-
import { getObjectKeys } from "@awesome-flow/core/utils";
|
|
1542
|
-
import { nodeDataPropertyExcept } from "@awesome-flow/core/abstract";
|
|
1543
|
-
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1544
|
-
|
|
1545
|
-
// src/nodes/modifiers/variable-combine-node.tsx
|
|
1546
|
-
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1547
|
-
var options2 = {
|
|
1548
|
-
add: /* @__PURE__ */ jsx13(IconPlus2, {}),
|
|
1549
|
-
divide: /* @__PURE__ */ jsx13(IconDivide, {}),
|
|
1550
|
-
min: /* @__PURE__ */ jsx13(IconChevronLeft2, {}),
|
|
1551
|
-
max: /* @__PURE__ */ jsx13(IconChevronRight2, {}),
|
|
1552
|
-
multiply: /* @__PURE__ */ jsx13(IconAsterisk2, {}),
|
|
1553
|
-
power: /* @__PURE__ */ jsx13(IconChevronUp2, {})
|
|
1554
|
-
};
|
|
1555
|
-
function VariableCombineNode({
|
|
1556
|
-
id,
|
|
1557
|
-
selected,
|
|
1558
|
-
data,
|
|
1559
|
-
type
|
|
1560
|
-
}) {
|
|
1561
|
-
const [operation, setOperation] = useState12(data.operation);
|
|
1562
|
-
const [value, setValue] = useState12(data.value);
|
|
1563
|
-
const updateNodeData = useUpdateNodeData9();
|
|
1564
|
-
const incoming = useIncomingNodeData2(id);
|
|
1565
|
-
useEffect13(() => {
|
|
1566
|
-
if (incoming?.length > 1) {
|
|
1567
|
-
const result = getOperationResult(operation, incoming[0].value, incoming[1].value);
|
|
1568
|
-
setValue(result);
|
|
1569
|
-
updateNodeData(id, { value: result });
|
|
1570
|
-
}
|
|
1571
|
-
}, [operation, incoming]);
|
|
1572
|
-
const onChange = useCallback11((op) => {
|
|
1573
|
-
updateNodeData(id, { operation: op });
|
|
1574
|
-
setOperation(op);
|
|
1575
|
-
}, []);
|
|
1576
|
-
return /* @__PURE__ */ jsxs9(NodeContainer10, { id, selected, data, type, children: [
|
|
1577
|
-
/* @__PURE__ */ jsx13(NodeCombobox2, { options: options2, selected: operation, onChange }),
|
|
1578
|
-
/* @__PURE__ */ jsx13(node_value_input_default, { value, onChange: () => {
|
|
1579
|
-
}, disabled: true }),
|
|
1580
|
-
/* @__PURE__ */ jsx13(NodeTrackConnections10, { handles: data.handles, nodeId: id, type: "target" })
|
|
1581
|
-
] });
|
|
1582
|
-
}
|
|
1583
|
-
function getOperationResult(operation, value1, value2) {
|
|
1584
|
-
switch (operation) {
|
|
1585
|
-
case "add" /* add */:
|
|
1586
|
-
return Number(value1) + Number(value2);
|
|
1587
|
-
case "divide" /* divide */:
|
|
1588
|
-
return Number(value1) / (Number(value2) || 1);
|
|
1589
|
-
case "max" /* max */:
|
|
1590
|
-
return Number(value1) > Number(value2) ? value1 : value2;
|
|
1591
|
-
case "min" /* min */:
|
|
1592
|
-
return Number(value1) < Number(value2) ? value1 : value2;
|
|
1593
|
-
case "multiply" /* multiply */:
|
|
1594
|
-
return Number(value1) * Number(value2);
|
|
1595
|
-
case "power" /* power */:
|
|
1596
|
-
return Number(value1) ** Number(value2);
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
var variable_combine_node_default = VariableCombineNode;
|
|
1600
1493
|
export {
|
|
1601
1494
|
noise_abs_node_default as NoiseAbsNode,
|
|
1602
1495
|
noise_clamp_node_default as NoiseClampNode,
|
|
@@ -1606,7 +1499,5 @@ export {
|
|
|
1606
1499
|
noise_invert_node_default as NoiseInvertNode,
|
|
1607
1500
|
noise_normalize_node_default as NoiseNormalizeNode,
|
|
1608
1501
|
noise_scale_bias_node_default as NoiseScaleBiasNode,
|
|
1609
|
-
noise_terrace_node_default as NoiseTerraceNode
|
|
1610
|
-
variable_combine_node_default as VariableCombineNode
|
|
1502
|
+
noise_terrace_node_default as NoiseTerraceNode
|
|
1611
1503
|
};
|
|
1612
|
-
//# sourceMappingURL=index.js.map
|