@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.
Files changed (101) hide show
  1. package/dist/abstract/index.cjs +1405 -2078
  2. package/dist/abstract/index.cjs.map +1 -1
  3. package/dist/abstract/index.d.cts +23 -25
  4. package/dist/abstract/index.d.ts +23 -25
  5. package/dist/abstract/index.js +1315 -1996
  6. package/dist/abstract/index.js.map +1 -1
  7. package/dist/index-BungWYrh.d.cts +49 -0
  8. package/dist/index-DsQSjZC5.d.ts +49 -0
  9. package/dist/{node-props-CeZ8Oshz.d.ts → node-props-BbqbXDXn.d.cts} +2 -22
  10. package/dist/{node-props-hKW-_KOU.d.cts → node-props-BbqbXDXn.d.ts} +2 -22
  11. package/dist/nodes/generators/index.cjs +130 -380
  12. package/dist/nodes/generators/index.cjs.map +1 -1
  13. package/dist/nodes/generators/index.d.cts +2 -8
  14. package/dist/nodes/generators/index.d.ts +2 -8
  15. package/dist/nodes/generators/index.js +112 -360
  16. package/dist/nodes/generators/index.js.map +1 -1
  17. package/dist/nodes/groups/index.cjs +25 -13
  18. package/dist/nodes/groups/index.cjs.map +1 -1
  19. package/dist/nodes/groups/index.js +26 -14
  20. package/dist/nodes/groups/index.js.map +1 -1
  21. package/dist/nodes/index.cjs +1654 -988
  22. package/dist/nodes/index.cjs.map +1 -1
  23. package/dist/nodes/index.d.cts +3 -5
  24. package/dist/nodes/index.d.ts +3 -5
  25. package/dist/nodes/index.js +1622 -960
  26. package/dist/nodes/index.js.map +1 -1
  27. package/dist/nodes/modifiers/index.cjs +17 -119
  28. package/dist/nodes/modifiers/index.cjs.map +1 -1
  29. package/dist/nodes/modifiers/index.d.cts +2 -6
  30. package/dist/nodes/modifiers/index.d.ts +2 -6
  31. package/dist/nodes/modifiers/index.js +16 -124
  32. package/dist/nodes/modifiers/index.js.map +1 -1
  33. package/dist/nodes/output/index.cjs +1271 -89
  34. package/dist/nodes/output/index.cjs.map +1 -1
  35. package/dist/nodes/output/index.js +1314 -92
  36. package/dist/nodes/output/index.js.map +1 -1
  37. package/dist/nodes/selectors/index.cjs +1296 -58
  38. package/dist/nodes/selectors/index.cjs.map +1 -1
  39. package/dist/nodes/selectors/index.d.cts +1 -3
  40. package/dist/nodes/selectors/index.d.ts +1 -3
  41. package/dist/nodes/selectors/index.js +1339 -65
  42. package/dist/nodes/selectors/index.js.map +1 -1
  43. package/dist/nodes/transformers/index.cjs +67 -206
  44. package/dist/nodes/transformers/index.cjs.map +1 -1
  45. package/dist/nodes/transformers/index.d.cts +3 -5
  46. package/dist/nodes/transformers/index.d.ts +3 -5
  47. package/dist/nodes/transformers/index.js +54 -193
  48. package/dist/nodes/transformers/index.js.map +1 -1
  49. package/dist/templates/generators/index.cjs +839 -1278
  50. package/dist/templates/generators/index.cjs.map +1 -1
  51. package/dist/templates/generators/index.d.cts +13 -50
  52. package/dist/templates/generators/index.d.ts +13 -50
  53. package/dist/templates/generators/index.js +836 -1280
  54. package/dist/templates/generators/index.js.map +1 -1
  55. package/dist/templates/groups/index.cjs +837 -1272
  56. package/dist/templates/groups/index.cjs.map +1 -1
  57. package/dist/templates/groups/index.d.cts +1 -5
  58. package/dist/templates/groups/index.d.ts +1 -5
  59. package/dist/templates/groups/index.js +835 -1277
  60. package/dist/templates/groups/index.js.map +1 -1
  61. package/dist/templates/index.cjs +839 -1280
  62. package/dist/templates/index.cjs.map +1 -1
  63. package/dist/templates/index.d.cts +4 -7
  64. package/dist/templates/index.d.ts +4 -7
  65. package/dist/templates/index.js +836 -1281
  66. package/dist/templates/index.js.map +1 -1
  67. package/dist/templates/modifiers/index.cjs +841 -1278
  68. package/dist/templates/modifiers/index.cjs.map +1 -1
  69. package/dist/templates/modifiers/index.d.cts +11 -38
  70. package/dist/templates/modifiers/index.d.ts +11 -38
  71. package/dist/templates/modifiers/index.js +838 -1281
  72. package/dist/templates/modifiers/index.js.map +1 -1
  73. package/dist/templates/output/index.cjs +839 -1274
  74. package/dist/templates/output/index.cjs.map +1 -1
  75. package/dist/templates/output/index.d.cts +4 -14
  76. package/dist/templates/output/index.d.ts +4 -14
  77. package/dist/templates/output/index.js +837 -1279
  78. package/dist/templates/output/index.js.map +1 -1
  79. package/dist/templates/selectors/index.cjs +839 -1274
  80. package/dist/templates/selectors/index.cjs.map +1 -1
  81. package/dist/templates/selectors/index.d.cts +3 -9
  82. package/dist/templates/selectors/index.d.ts +3 -9
  83. package/dist/templates/selectors/index.js +837 -1279
  84. package/dist/templates/selectors/index.js.map +1 -1
  85. package/dist/templates/transformers/index.cjs +839 -1274
  86. package/dist/templates/transformers/index.cjs.map +1 -1
  87. package/dist/templates/transformers/index.d.cts +3 -36
  88. package/dist/templates/transformers/index.d.ts +3 -36
  89. package/dist/templates/transformers/index.js +837 -1279
  90. package/dist/templates/transformers/index.js.map +1 -1
  91. package/package.json +3 -3
  92. package/dist/handle-types-D-v5S53h.d.cts +0 -22
  93. package/dist/handle-types-D-v5S53h.d.ts +0 -22
  94. package/dist/layout/index.cjs +0 -164
  95. package/dist/layout/index.cjs.map +0 -1
  96. package/dist/layout/index.d.cts +0 -26
  97. package/dist/layout/index.d.ts +0 -26
  98. package/dist/layout/index.js +0 -136
  99. package/dist/layout/index.js.map +0 -1
  100. package/dist/properties-BxwtU6i9.d.cts +0 -9
  101. package/dist/properties-BxwtU6i9.d.ts +0 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesome-flow/noise",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "The Awesome Flow package for noise. Provides basic components to define noise-based flows.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  "ts:watch": "npx tsc --noEmit --incremental --watch"
13
13
  },
14
14
  "dependencies": {
15
- "@awesome-flow/core": "^0.3.0"
15
+ "@awesome-flow/core": "^0.4.0"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@mantine/core": "*",
@@ -108,5 +108,5 @@
108
108
  "url": "https://github.com/privatebytes/awesome-flow/issues"
109
109
  },
110
110
  "homepage": "https://github.com/privatebytes/awesome-flow#readme",
111
- "gitHead": "412cda9e5aeef4bdc2aa910972694710e1490829"
111
+ "gitHead": "feaae12127ff404aada827d2a744d8c3c67d3c02"
112
112
  }
@@ -1,22 +0,0 @@
1
- import { CustomNodeHandleData } from '@awesome-flow/core/abstract';
2
-
3
- declare enum NoiseHandleFlag {
4
- texture = 1,
5
- noise = 2,
6
- position = 4,
7
- module = 8,
8
- variableProperty = 16,
9
- variableValue = 32
10
- }
11
- declare enum DisplacementModule {
12
- sourceModule = "source",
13
- xModule = "x-module",
14
- yModule = "y-module",
15
- zModule = "z-module",
16
- output = "output"
17
- }
18
- type DisplacementModuleHandle = CustomNodeHandleData & {
19
- dataId: DisplacementModule;
20
- };
21
-
22
- export { DisplacementModule as D, NoiseHandleFlag as N, type DisplacementModuleHandle as a };
@@ -1,22 +0,0 @@
1
- import { CustomNodeHandleData } from '@awesome-flow/core/abstract';
2
-
3
- declare enum NoiseHandleFlag {
4
- texture = 1,
5
- noise = 2,
6
- position = 4,
7
- module = 8,
8
- variableProperty = 16,
9
- variableValue = 32
10
- }
11
- declare enum DisplacementModule {
12
- sourceModule = "source",
13
- xModule = "x-module",
14
- yModule = "y-module",
15
- zModule = "z-module",
16
- output = "output"
17
- }
18
- type DisplacementModuleHandle = CustomNodeHandleData & {
19
- dataId: DisplacementModule;
20
- };
21
-
22
- export { DisplacementModule as D, NoiseHandleFlag as N, type DisplacementModuleHandle as a };
@@ -1,164 +0,0 @@
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/layout/index.ts
20
- var layout_exports = {};
21
- __export(layout_exports, {
22
- NodePropertyInput: () => node_property_input_default,
23
- NodePropertyVariables: () => node_property_variables_default,
24
- NodeValueInput: () => node_value_input_default
25
- });
26
- module.exports = __toCommonJS(layout_exports);
27
-
28
- // src/layout/node-value-input.tsx
29
- var import_core = require("@mantine/core");
30
- var import_jsx_runtime = require("react/jsx-runtime");
31
- function NodeValueInput({ value, disabled, step, onChange }) {
32
- if (value === void 0 || value === null) {
33
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
34
- }
35
- switch (typeof value) {
36
- case "boolean": {
37
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
38
- import_core.Switch,
39
- {
40
- checked: value,
41
- disabled,
42
- onChange: (e) => onChange(e.currentTarget.checked)
43
- }
44
- );
45
- }
46
- case "number": {
47
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.NumberInput, { value, disabled, step, onChange: (e) => onChange(e) });
48
- }
49
- case "string": {
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
51
- import_core.Input,
52
- {
53
- value,
54
- disabled,
55
- onChange: (e) => onChange(e.currentTarget.value)
56
- }
57
- );
58
- }
59
- default:
60
- throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);
61
- }
62
- }
63
- var node_value_input_default = NodeValueInput;
64
-
65
- // src/layout/node-property-input.tsx
66
- var import_jsx_runtime2 = require("react/jsx-runtime");
67
- function NodePropertyInput({ property, onChange }) {
68
- if (!property) {
69
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {});
70
- }
71
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
72
- node_value_input_default,
73
- {
74
- value: property.value,
75
- disabled: property.disabled,
76
- step: property.step,
77
- onChange: (value) => onChange(property.name, value)
78
- }
79
- );
80
- }
81
- var node_property_input_default = NodePropertyInput;
82
-
83
- // src/layout/node-property-variables.tsx
84
- var import_hooks = require("@awesome-flow/core/hooks");
85
- var import_react = require("react");
86
- var import_core2 = require("@mantine/core");
87
- var import_utils = require("@awesome-flow/core/utils");
88
- var import_abstract = require("@awesome-flow/core/abstract");
89
- var import_jsx_runtime3 = require("react/jsx-runtime");
90
- function NodePropertyVariables({
91
- data,
92
- nodeId,
93
- onPropertiesChange,
94
- except = import_abstract.nodeDataPropertyExcept
95
- }) {
96
- const [properties, setProperties] = (0, import_react.useState)(() => {
97
- const keys = (0, import_utils.getObjectKeys)(data, except);
98
- const dataProps = {};
99
- for (const key of keys) {
100
- dataProps[key] = {
101
- name: key,
102
- value: data[key]
103
- };
104
- }
105
- return dataProps;
106
- });
107
- const updateNodeData = (0, import_hooks.useUpdateNodeData)();
108
- const incoming = (0, import_hooks.useIncomingNodeData)(nodeId);
109
- const resetAllDisabled = (0, import_react.useCallback)(() => {
110
- const keys = Object.keys(properties);
111
- keys.forEach((k) => {
112
- properties[k].disabled = false;
113
- });
114
- setProperties(properties);
115
- }, []);
116
- const updatePropertyValue = (0, import_react.useCallback)((name, value, disabled) => {
117
- let property = properties[name];
118
- if (property) {
119
- property.value = value;
120
- } else {
121
- property = {
122
- name,
123
- value
124
- };
125
- }
126
- property.disabled = disabled;
127
- setProperties({ ...properties, [name]: property });
128
- updateNodeData(nodeId, { [name]: value });
129
- }, []);
130
- (0, import_react.useEffect)(() => {
131
- resetAllDisabled();
132
- if (incoming?.length) {
133
- for (const connection of incoming) {
134
- if (connection.property && properties[connection.property.name] !== void 0) {
135
- updatePropertyValue(connection.property.name, connection.property.value, true);
136
- }
137
- }
138
- }
139
- }, [incoming]);
140
- (0, import_react.useEffect)(() => {
141
- if (onPropertiesChange) {
142
- onPropertiesChange(properties);
143
- }
144
- }, [onPropertiesChange, properties]);
145
- const nodes = (0, import_react.useMemo)(() => {
146
- return Object.keys(properties).map((key) => {
147
- const property = properties[key];
148
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Group, { children: [
149
- property.name,
150
- ":",
151
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(node_property_input_default, { property, onChange: updatePropertyValue })
152
- ] }, key);
153
- });
154
- }, [properties, updatePropertyValue]);
155
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.Stack, { children: nodes });
156
- }
157
- var node_property_variables_default = NodePropertyVariables;
158
- // Annotate the CommonJS export names for ESM import in node:
159
- 0 && (module.exports = {
160
- NodePropertyInput,
161
- NodePropertyVariables,
162
- NodeValueInput
163
- });
164
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/layout/index.ts","../../src/layout/node-value-input.tsx","../../src/layout/node-property-input.tsx","../../src/layout/node-property-variables.tsx"],"sourcesContent":["export * from './node-property-input';\nexport { default as NodePropertyInput } from './node-property-input';\n\nexport * from './node-property-variables';\nexport { default as NodePropertyVariables } from './node-property-variables';\n\nexport * from './node-value-input';\nexport { default as NodeValueInput } from './node-value-input';\n","import { Input, NumberInput, Switch } from '@mantine/core';\nimport { ValueType } from '../abstract/properties';\n\nexport type NodeValueInputProps = {\n value: ValueType;\n disabled?: boolean;\n step?: number;\n onChange: (value: ValueType) => void;\n};\n\nfunction NodeValueInput({ value, disabled, step, onChange }: Readonly<NodeValueInputProps>) {\n if (value === undefined || value === null) {\n return <></>;\n }\n\n switch (typeof value) {\n case 'boolean': {\n return (\n <Switch\n checked={value}\n disabled={disabled}\n onChange={(e) => onChange(e.currentTarget.checked)}\n />\n );\n }\n\n case 'number': {\n return (\n <NumberInput value={value} disabled={disabled} step={step} onChange={(e) => onChange(e)} />\n );\n }\n\n case 'string': {\n return (\n <Input\n value={value}\n disabled={disabled}\n onChange={(e) => onChange(e.currentTarget.value)}\n />\n );\n }\n\n default:\n throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);\n }\n}\n\nexport default NodeValueInput;\n","import { ValueType, PropertyValue } from '../abstract/properties';\nimport NodeValueInput from './node-value-input';\n\nexport type NodePropertyInputProps = {\n property: PropertyValue;\n onChange: (name: string, value: ValueType) => void;\n};\n\nfunction NodePropertyInput({ property, onChange }: Readonly<NodePropertyInputProps>) {\n if (!property) {\n return <></>;\n }\n\n return (\n <NodeValueInput\n value={property.value}\n disabled={property.disabled}\n step={property.step}\n onChange={(value) => onChange(property.name, value)}\n />\n );\n}\n\nexport default NodePropertyInput;\n","import { useIncomingNodeData, useUpdateNodeData } from '@awesome-flow/core/hooks';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { Group, Stack } from '@mantine/core';\nimport { getObjectKeys } from '@awesome-flow/core/utils';\nimport { nodeDataPropertyExcept } from '@awesome-flow/core/abstract';\nimport { NodeVariablePropertyData } from '../abstract/node-props';\nimport { PropertyValue, ValueType } from '../abstract/properties';\nimport NodePropertyInput from './node-property-input';\n\nexport type NodeTrackVariablesProps = {\n nodeId: string;\n data: Record<string, any>;\n except?: Set<string>;\n onPropertiesChange?: (properties: Record<string, PropertyValue>) => void;\n};\n\nfunction NodePropertyVariables({\n data,\n nodeId,\n onPropertiesChange,\n except = nodeDataPropertyExcept,\n}: Readonly<NodeTrackVariablesProps>) {\n const [properties, setProperties] = useState<Record<string, PropertyValue>>(() => {\n const keys = getObjectKeys(data, except);\n\n const dataProps = {};\n\n for (const key of keys) {\n dataProps[key] = {\n name: key,\n value: data[key],\n } satisfies PropertyValue;\n }\n\n return dataProps;\n });\n\n const updateNodeData = useUpdateNodeData();\n const incoming = useIncomingNodeData<NodeVariablePropertyData>(nodeId);\n\n const resetAllDisabled = useCallback(() => {\n const keys = Object.keys(properties);\n\n keys.forEach((k) => {\n properties[k].disabled = false;\n });\n\n setProperties(properties);\n }, []);\n\n const updatePropertyValue = useCallback((name: string, value: ValueType, disabled?: boolean) => {\n let property = properties[name];\n\n if (property) {\n property.value = value;\n } else {\n property = {\n name,\n value,\n };\n }\n\n property.disabled = disabled;\n\n setProperties({ ...properties, [name]: property });\n updateNodeData(nodeId, { [name]: value });\n }, []);\n\n useEffect(() => {\n resetAllDisabled();\n\n if (incoming?.length) {\n for (const connection of incoming) {\n if (connection.property && properties[connection.property.name] !== undefined) {\n updatePropertyValue(connection.property.name, connection.property.value, true);\n }\n }\n }\n }, [incoming]);\n\n useEffect(() => {\n if (onPropertiesChange) {\n onPropertiesChange(properties);\n }\n }, [onPropertiesChange, properties]);\n\n const nodes = useMemo(() => {\n return Object.keys(properties).map((key) => {\n const property = properties[key];\n\n return (\n <Group key={key}>\n {property.name}:<NodePropertyInput property={property} onChange={updatePropertyValue} />\n </Group>\n );\n });\n }, [properties, updatePropertyValue]);\n\n return <Stack>{nodes}</Stack>;\n}\n\nexport default NodePropertyVariables;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA2C;AAYhC;AAFX,SAAS,eAAe,EAAE,OAAO,UAAU,MAAM,SAAS,GAAkC;AAC1F,MAAI,UAAU,UAAa,UAAU,MAAM;AACzC,WAAO,2EAAE;AAAA,EACX;AAEA,UAAQ,OAAO,OAAO;AAAA,IACpB,KAAK,WAAW;AACd,aACE;AAAA,QAAC;AAAA;AAAA,UACC,SAAS;AAAA,UACT;AAAA,UACA,UAAU,CAAC,MAAM,SAAS,EAAE,cAAc,OAAO;AAAA;AAAA,MACnD;AAAA,IAEJ;AAAA,IAEA,KAAK,UAAU;AACb,aACE,4CAAC,2BAAY,OAAc,UAAoB,MAAY,UAAU,CAAC,MAAM,SAAS,CAAC,GAAG;AAAA,IAE7F;AAAA,IAEA,KAAK,UAAU;AACb,aACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA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AAM,0BAAsB,0BAAY,CAAC,MAAc,OAAkB,aAAuB;AAC9F,QAAI,WAAW,WAAW,IAAI;AAE9B,QAAI,UAAU;AACZ,eAAS,QAAQ;AAAA,IACnB,OAAO;AACL,iBAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,aAAS,WAAW;AAEpB,kBAAc,EAAE,GAAG,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;AACjD,mBAAe,QAAQ,EAAE,CAAC,IAAI,GAAG,MAAM,CAAC;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,8BAAU,MAAM;AACd,qBAAiB;AAEjB,QAAI,UAAU,QAAQ;AACpB,iBAAW,cAAc,UAAU;AACjC,YAAI,WAAW,YAAY,WAAW,WAAW,SAAS,IAAI,MAAM,QAAW;AAC7E,8BAAoB,WAAW,SAAS,MAAM,WAAW,SAAS,OAAO,IAAI;AAAA,QAC/E;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,8BAAU,MAAM;AACd,QAAI,oBAAoB;AACtB,yBAAmB,UAAU;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,oBAAoB,UAAU,CAAC;AAEnC,QAAM,YAAQ,sBAAQ,MAAM;AAC1B,WAAO,OAAO,KAAK,UAAU,EAAE,IAAI,CAAC,QAAQ;AAC1C,YAAM,WAAW,WAAW,GAAG;AAE/B,aACE,8CAAC,sBACE;AAAA,iBAAS;AAAA,QAAK;AAAA,QAAC,6CAAC,+BAAkB,UAAoB,UAAU,qBAAqB;AAAA,WAD5E,GAEZ;AAAA,IAEJ,CAAC;AAAA,EACH,GAAG,CAAC,YAAY,mBAAmB,CAAC;AAEpC,SAAO,6CAAC,sBAAO,iBAAM;AACvB;AAEA,IAAO,kCAAQ;","names":["import_jsx_runtime","import_core","import_jsx_runtime"]}
@@ -1,26 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PropertyValue, V as ValueType } from '../properties-BxwtU6i9.cjs';
3
-
4
- type NodePropertyInputProps = {
5
- property: PropertyValue;
6
- onChange: (name: string, value: ValueType) => void;
7
- };
8
- declare function NodePropertyInput({ property, onChange }: Readonly<NodePropertyInputProps>): react_jsx_runtime.JSX.Element;
9
-
10
- type NodeTrackVariablesProps = {
11
- nodeId: string;
12
- data: Record<string, any>;
13
- except?: Set<string>;
14
- onPropertiesChange?: (properties: Record<string, PropertyValue>) => void;
15
- };
16
- declare function NodePropertyVariables({ data, nodeId, onPropertiesChange, except, }: Readonly<NodeTrackVariablesProps>): react_jsx_runtime.JSX.Element;
17
-
18
- type NodeValueInputProps = {
19
- value: ValueType;
20
- disabled?: boolean;
21
- step?: number;
22
- onChange: (value: ValueType) => void;
23
- };
24
- declare function NodeValueInput({ value, disabled, step, onChange }: Readonly<NodeValueInputProps>): react_jsx_runtime.JSX.Element;
25
-
26
- export { NodePropertyInput, type NodePropertyInputProps, NodePropertyVariables, type NodeTrackVariablesProps, NodeValueInput, type NodeValueInputProps };
@@ -1,26 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PropertyValue, V as ValueType } from '../properties-BxwtU6i9.js';
3
-
4
- type NodePropertyInputProps = {
5
- property: PropertyValue;
6
- onChange: (name: string, value: ValueType) => void;
7
- };
8
- declare function NodePropertyInput({ property, onChange }: Readonly<NodePropertyInputProps>): react_jsx_runtime.JSX.Element;
9
-
10
- type NodeTrackVariablesProps = {
11
- nodeId: string;
12
- data: Record<string, any>;
13
- except?: Set<string>;
14
- onPropertiesChange?: (properties: Record<string, PropertyValue>) => void;
15
- };
16
- declare function NodePropertyVariables({ data, nodeId, onPropertiesChange, except, }: Readonly<NodeTrackVariablesProps>): react_jsx_runtime.JSX.Element;
17
-
18
- type NodeValueInputProps = {
19
- value: ValueType;
20
- disabled?: boolean;
21
- step?: number;
22
- onChange: (value: ValueType) => void;
23
- };
24
- declare function NodeValueInput({ value, disabled, step, onChange }: Readonly<NodeValueInputProps>): react_jsx_runtime.JSX.Element;
25
-
26
- export { NodePropertyInput, type NodePropertyInputProps, NodePropertyVariables, type NodeTrackVariablesProps, NodeValueInput, type NodeValueInputProps };
@@ -1,136 +0,0 @@
1
- // src/layout/node-value-input.tsx
2
- import { Input, NumberInput, Switch } from "@mantine/core";
3
- import { Fragment, jsx } from "react/jsx-runtime";
4
- function NodeValueInput({ value, disabled, step, onChange }) {
5
- if (value === void 0 || value === null) {
6
- return /* @__PURE__ */ jsx(Fragment, {});
7
- }
8
- switch (typeof value) {
9
- case "boolean": {
10
- return /* @__PURE__ */ jsx(
11
- Switch,
12
- {
13
- checked: value,
14
- disabled,
15
- onChange: (e) => onChange(e.currentTarget.checked)
16
- }
17
- );
18
- }
19
- case "number": {
20
- return /* @__PURE__ */ jsx(NumberInput, { value, disabled, step, onChange: (e) => onChange(e) });
21
- }
22
- case "string": {
23
- return /* @__PURE__ */ jsx(
24
- Input,
25
- {
26
- value,
27
- disabled,
28
- onChange: (e) => onChange(e.currentTarget.value)
29
- }
30
- );
31
- }
32
- default:
33
- throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);
34
- }
35
- }
36
- var node_value_input_default = NodeValueInput;
37
-
38
- // src/layout/node-property-input.tsx
39
- import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
40
- function NodePropertyInput({ property, onChange }) {
41
- if (!property) {
42
- return /* @__PURE__ */ jsx2(Fragment2, {});
43
- }
44
- return /* @__PURE__ */ jsx2(
45
- node_value_input_default,
46
- {
47
- value: property.value,
48
- disabled: property.disabled,
49
- step: property.step,
50
- onChange: (value) => onChange(property.name, value)
51
- }
52
- );
53
- }
54
- var node_property_input_default = NodePropertyInput;
55
-
56
- // src/layout/node-property-variables.tsx
57
- import { useIncomingNodeData, useUpdateNodeData } from "@awesome-flow/core/hooks";
58
- import { useCallback, useEffect, useMemo, useState } from "react";
59
- import { Group, Stack } from "@mantine/core";
60
- import { getObjectKeys } from "@awesome-flow/core/utils";
61
- import { nodeDataPropertyExcept } from "@awesome-flow/core/abstract";
62
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
63
- function NodePropertyVariables({
64
- data,
65
- nodeId,
66
- onPropertiesChange,
67
- except = nodeDataPropertyExcept
68
- }) {
69
- const [properties, setProperties] = useState(() => {
70
- const keys = getObjectKeys(data, except);
71
- const dataProps = {};
72
- for (const key of keys) {
73
- dataProps[key] = {
74
- name: key,
75
- value: data[key]
76
- };
77
- }
78
- return dataProps;
79
- });
80
- const updateNodeData = useUpdateNodeData();
81
- const incoming = useIncomingNodeData(nodeId);
82
- const resetAllDisabled = useCallback(() => {
83
- const keys = Object.keys(properties);
84
- keys.forEach((k) => {
85
- properties[k].disabled = false;
86
- });
87
- setProperties(properties);
88
- }, []);
89
- const updatePropertyValue = useCallback((name, value, disabled) => {
90
- let property = properties[name];
91
- if (property) {
92
- property.value = value;
93
- } else {
94
- property = {
95
- name,
96
- value
97
- };
98
- }
99
- property.disabled = disabled;
100
- setProperties({ ...properties, [name]: property });
101
- updateNodeData(nodeId, { [name]: value });
102
- }, []);
103
- useEffect(() => {
104
- resetAllDisabled();
105
- if (incoming?.length) {
106
- for (const connection of incoming) {
107
- if (connection.property && properties[connection.property.name] !== void 0) {
108
- updatePropertyValue(connection.property.name, connection.property.value, true);
109
- }
110
- }
111
- }
112
- }, [incoming]);
113
- useEffect(() => {
114
- if (onPropertiesChange) {
115
- onPropertiesChange(properties);
116
- }
117
- }, [onPropertiesChange, properties]);
118
- const nodes = useMemo(() => {
119
- return Object.keys(properties).map((key) => {
120
- const property = properties[key];
121
- return /* @__PURE__ */ jsxs(Group, { children: [
122
- property.name,
123
- ":",
124
- /* @__PURE__ */ jsx3(node_property_input_default, { property, onChange: updatePropertyValue })
125
- ] }, key);
126
- });
127
- }, [properties, updatePropertyValue]);
128
- return /* @__PURE__ */ jsx3(Stack, { children: nodes });
129
- }
130
- var node_property_variables_default = NodePropertyVariables;
131
- export {
132
- node_property_input_default as NodePropertyInput,
133
- node_property_variables_default as NodePropertyVariables,
134
- node_value_input_default as NodeValueInput
135
- };
136
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/layout/node-value-input.tsx","../../src/layout/node-property-input.tsx","../../src/layout/node-property-variables.tsx"],"sourcesContent":["import { Input, NumberInput, Switch } from '@mantine/core';\nimport { ValueType } from '../abstract/properties';\n\nexport type NodeValueInputProps = {\n value: ValueType;\n disabled?: boolean;\n step?: number;\n onChange: (value: ValueType) => void;\n};\n\nfunction NodeValueInput({ value, disabled, step, onChange }: Readonly<NodeValueInputProps>) {\n if (value === undefined || value === null) {\n return <></>;\n }\n\n switch (typeof value) {\n case 'boolean': {\n return (\n <Switch\n checked={value}\n disabled={disabled}\n onChange={(e) => onChange(e.currentTarget.checked)}\n />\n );\n }\n\n case 'number': {\n return (\n <NumberInput value={value} disabled={disabled} step={step} onChange={(e) => onChange(e)} />\n );\n }\n\n case 'string': {\n return (\n <Input\n value={value}\n disabled={disabled}\n onChange={(e) => onChange(e.currentTarget.value)}\n />\n );\n }\n\n default:\n throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);\n }\n}\n\nexport default NodeValueInput;\n","import { ValueType, PropertyValue } from '../abstract/properties';\nimport NodeValueInput from './node-value-input';\n\nexport type NodePropertyInputProps = {\n property: PropertyValue;\n onChange: (name: string, value: ValueType) => void;\n};\n\nfunction NodePropertyInput({ property, onChange }: Readonly<NodePropertyInputProps>) {\n if (!property) {\n return <></>;\n }\n\n return (\n <NodeValueInput\n value={property.value}\n disabled={property.disabled}\n step={property.step}\n onChange={(value) => onChange(property.name, value)}\n />\n );\n}\n\nexport default NodePropertyInput;\n","import { useIncomingNodeData, useUpdateNodeData } from '@awesome-flow/core/hooks';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { Group, Stack } from '@mantine/core';\nimport { getObjectKeys } from '@awesome-flow/core/utils';\nimport { nodeDataPropertyExcept } from '@awesome-flow/core/abstract';\nimport { NodeVariablePropertyData } from '../abstract/node-props';\nimport { PropertyValue, ValueType } from '../abstract/properties';\nimport NodePropertyInput from './node-property-input';\n\nexport type NodeTrackVariablesProps = {\n nodeId: string;\n data: Record<string, any>;\n except?: Set<string>;\n onPropertiesChange?: (properties: Record<string, PropertyValue>) => void;\n};\n\nfunction NodePropertyVariables({\n data,\n nodeId,\n onPropertiesChange,\n except = nodeDataPropertyExcept,\n}: Readonly<NodeTrackVariablesProps>) {\n const [properties, setProperties] = useState<Record<string, PropertyValue>>(() => {\n const keys = getObjectKeys(data, except);\n\n const dataProps = {};\n\n for (const key of keys) {\n dataProps[key] = {\n name: key,\n value: data[key],\n } satisfies PropertyValue;\n }\n\n return dataProps;\n });\n\n const updateNodeData = useUpdateNodeData();\n const incoming = useIncomingNodeData<NodeVariablePropertyData>(nodeId);\n\n const resetAllDisabled = useCallback(() => {\n const keys = Object.keys(properties);\n\n keys.forEach((k) => {\n properties[k].disabled = false;\n });\n\n setProperties(properties);\n }, []);\n\n const updatePropertyValue = useCallback((name: string, value: ValueType, disabled?: boolean) => {\n let property = properties[name];\n\n if (property) {\n property.value = value;\n } else {\n property = {\n name,\n value,\n };\n }\n\n property.disabled = disabled;\n\n setProperties({ ...properties, [name]: property });\n updateNodeData(nodeId, { [name]: value });\n }, []);\n\n useEffect(() => {\n resetAllDisabled();\n\n if (incoming?.length) {\n for (const connection of incoming) {\n if (connection.property && properties[connection.property.name] !== undefined) {\n updatePropertyValue(connection.property.name, connection.property.value, true);\n }\n }\n }\n }, [incoming]);\n\n useEffect(() => {\n if (onPropertiesChange) {\n onPropertiesChange(properties);\n }\n }, [onPropertiesChange, properties]);\n\n const nodes = useMemo(() => {\n return Object.keys(properties).map((key) => {\n const property = properties[key];\n\n return (\n <Group key={key}>\n {property.name}:<NodePropertyInput property={property} onChange={updatePropertyValue} />\n </Group>\n );\n });\n }, [properties, updatePropertyValue]);\n\n return <Stack>{nodes}</Stack>;\n}\n\nexport default NodePropertyVariables;\n"],"mappings":";AAAA,SAAS,OAAO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GAAG,CAAC,QAAQ,CAAC;AAEb,YAAU,MAAM;AACd,QAAI,oBAAoB;AACtB,yBAAmB,UAAU;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,oBAAoB,UAAU,CAAC;AAEnC,QAAM,QAAQ,QAAQ,MAAM;AAC1B,WAAO,OAAO,KAAK,UAAU,EAAE,IAAI,CAAC,QAAQ;AAC1C,YAAM,WAAW,WAAW,GAAG;AAE/B,aACE,qBAAC,SACE;AAAA,iBAAS;AAAA,QAAK;AAAA,QAAC,gBAAAA,KAAC,+BAAkB,UAAoB,UAAU,qBAAqB;AAAA,WAD5E,GAEZ;AAAA,IAEJ,CAAC;AAAA,EACH,GAAG,CAAC,YAAY,mBAAmB,CAAC;AAEpC,SAAO,gBAAAA,KAAC,SAAO,iBAAM;AACvB;AAEA,IAAO,kCAAQ;","names":["Fragment","jsx","jsx"]}
@@ -1,9 +0,0 @@
1
- type ValueType = string | number | boolean;
2
- type PropertyValue<TValue extends ValueType = ValueType> = {
3
- name: string;
4
- value: TValue;
5
- step?: number;
6
- disabled?: boolean;
7
- };
8
-
9
- export type { PropertyValue as P, ValueType as V };
@@ -1,9 +0,0 @@
1
- type ValueType = string | number | boolean;
2
- type PropertyValue<TValue extends ValueType = ValueType> = {
3
- name: string;
4
- value: TValue;
5
- step?: number;
6
- disabled?: boolean;
7
- };
8
-
9
- export type { PropertyValue as P, ValueType as V };