@awesome-flow/noise 0.3.0 → 0.4.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 +1405 -2078
- package/dist/abstract/index.cjs.map +1 -1
- package/dist/abstract/index.d.cts +23 -25
- package/dist/abstract/index.d.ts +23 -25
- package/dist/abstract/index.js +1315 -1996
- package/dist/abstract/index.js.map +1 -1
- package/dist/index-BungWYrh.d.cts +49 -0
- package/dist/index-DsQSjZC5.d.ts +49 -0
- 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 -380
- package/dist/nodes/generators/index.cjs.map +1 -1
- 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 -360
- package/dist/nodes/generators/index.js.map +1 -1
- package/dist/nodes/groups/index.cjs +25 -13
- package/dist/nodes/groups/index.cjs.map +1 -1
- package/dist/nodes/groups/index.js +26 -14
- package/dist/nodes/groups/index.js.map +1 -1
- package/dist/nodes/index.cjs +1654 -988
- package/dist/nodes/index.cjs.map +1 -1
- package/dist/nodes/index.d.cts +3 -5
- package/dist/nodes/index.d.ts +3 -5
- package/dist/nodes/index.js +1622 -960
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/modifiers/index.cjs +17 -119
- package/dist/nodes/modifiers/index.cjs.map +1 -1
- 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 -124
- package/dist/nodes/modifiers/index.js.map +1 -1
- package/dist/nodes/output/index.cjs +1271 -89
- package/dist/nodes/output/index.cjs.map +1 -1
- package/dist/nodes/output/index.js +1314 -92
- package/dist/nodes/output/index.js.map +1 -1
- package/dist/nodes/selectors/index.cjs +1296 -58
- package/dist/nodes/selectors/index.cjs.map +1 -1
- package/dist/nodes/selectors/index.d.cts +1 -3
- package/dist/nodes/selectors/index.d.ts +1 -3
- package/dist/nodes/selectors/index.js +1339 -65
- package/dist/nodes/selectors/index.js.map +1 -1
- package/dist/nodes/transformers/index.cjs +67 -206
- package/dist/nodes/transformers/index.cjs.map +1 -1
- 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 -193
- package/dist/nodes/transformers/index.js.map +1 -1
- package/dist/templates/generators/index.cjs +839 -1278
- package/dist/templates/generators/index.cjs.map +1 -1
- package/dist/templates/generators/index.d.cts +13 -50
- package/dist/templates/generators/index.d.ts +13 -50
- package/dist/templates/generators/index.js +836 -1280
- package/dist/templates/generators/index.js.map +1 -1
- package/dist/templates/groups/index.cjs +837 -1272
- package/dist/templates/groups/index.cjs.map +1 -1
- package/dist/templates/groups/index.d.cts +1 -5
- package/dist/templates/groups/index.d.ts +1 -5
- package/dist/templates/groups/index.js +835 -1277
- package/dist/templates/groups/index.js.map +1 -1
- package/dist/templates/index.cjs +839 -1280
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.d.cts +4 -7
- package/dist/templates/index.d.ts +4 -7
- package/dist/templates/index.js +836 -1281
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/modifiers/index.cjs +841 -1278
- package/dist/templates/modifiers/index.cjs.map +1 -1
- package/dist/templates/modifiers/index.d.cts +11 -38
- package/dist/templates/modifiers/index.d.ts +11 -38
- package/dist/templates/modifiers/index.js +838 -1281
- package/dist/templates/modifiers/index.js.map +1 -1
- package/dist/templates/output/index.cjs +839 -1274
- package/dist/templates/output/index.cjs.map +1 -1
- package/dist/templates/output/index.d.cts +4 -14
- package/dist/templates/output/index.d.ts +4 -14
- package/dist/templates/output/index.js +837 -1279
- package/dist/templates/output/index.js.map +1 -1
- package/dist/templates/selectors/index.cjs +839 -1274
- package/dist/templates/selectors/index.cjs.map +1 -1
- package/dist/templates/selectors/index.d.cts +3 -9
- package/dist/templates/selectors/index.d.ts +3 -9
- package/dist/templates/selectors/index.js +837 -1279
- package/dist/templates/selectors/index.js.map +1 -1
- package/dist/templates/transformers/index.cjs +839 -1274
- package/dist/templates/transformers/index.cjs.map +1 -1
- package/dist/templates/transformers/index.d.cts +3 -36
- package/dist/templates/transformers/index.d.ts +3 -36
- package/dist/templates/transformers/index.js +837 -1279
- package/dist/templates/transformers/index.js.map +1 -1
- package/package.json +3 -3
- 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/properties-BxwtU6i9.d.cts +0 -9
- package/dist/properties-BxwtU6i9.d.ts +0 -9
|
@@ -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,6 @@ 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
1504
|
//# sourceMappingURL=index.js.map
|