@kiberon-labs/behave-graph-flow 1.0.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 (46) hide show
  1. package/README.md +3 -0
  2. package/package.json +42 -0
  3. package/postcss.config.ts +6 -0
  4. package/src/components/AutoSizeInput.tsx +65 -0
  5. package/src/components/Controls.tsx +87 -0
  6. package/src/components/Flow.tsx +101 -0
  7. package/src/components/InputSocket.tsx +142 -0
  8. package/src/components/Node.tsx +68 -0
  9. package/src/components/NodeContainer.tsx +46 -0
  10. package/src/components/NodePicker.tsx +77 -0
  11. package/src/components/OutputSocket.tsx +58 -0
  12. package/src/components/modals/ClearModal.tsx +40 -0
  13. package/src/components/modals/HelpModal.tsx +36 -0
  14. package/src/components/modals/LoadModal.tsx +96 -0
  15. package/src/components/modals/Modal.tsx +64 -0
  16. package/src/components/modals/SaveModal.tsx +60 -0
  17. package/src/hooks/useBehaveGraphFlow.ts +75 -0
  18. package/src/hooks/useChangeNodeData.ts +24 -0
  19. package/src/hooks/useCustomNodeTypes.tsx +31 -0
  20. package/src/hooks/useFlowHandlers.ts +180 -0
  21. package/src/hooks/useGraphRunner.ts +104 -0
  22. package/src/hooks/useMergeMap.ts +14 -0
  23. package/src/hooks/useNodeSpecJson.ts +20 -0
  24. package/src/hooks/useOnPressKey.ts +16 -0
  25. package/src/hooks/useQueriableDefinitions.ts +22 -0
  26. package/src/index.ts +37 -0
  27. package/src/styles.css +8 -0
  28. package/src/transformers/behaveToFlow.ts +57 -0
  29. package/src/transformers/flowToBehave.ts +93 -0
  30. package/src/types.d.ts +4 -0
  31. package/src/util/autoLayout.ts +9 -0
  32. package/src/util/calculateNewEdge.ts +49 -0
  33. package/src/util/colors.ts +41 -0
  34. package/src/util/getPickerFilters.ts +32 -0
  35. package/src/util/getSocketsByNodeTypeAndHandleType.ts +11 -0
  36. package/src/util/hasPositionMetaData.ts +10 -0
  37. package/src/util/isHandleConnected.ts +12 -0
  38. package/src/util/isValidConnection.ts +51 -0
  39. package/src/util/sleep.ts +6 -0
  40. package/tailwind.config.ts +19 -0
  41. package/tests/flowToBehave.test.ts +25 -0
  42. package/tests/tsconfig.json +10 -0
  43. package/tsconfig.json +60 -0
  44. package/tsdown.config.ts +15 -0
  45. package/typedoc.json +8 -0
  46. package/vitest.config.ts +15 -0
package/tsconfig.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Monorepo shared library",
4
+ "compilerOptions": {
5
+ /* Base Options: */
6
+ "esModuleInterop": true,
7
+ "skipLibCheck": true,
8
+ "target": "esnext",
9
+ "allowJs": true,
10
+ "resolveJsonModule": true,
11
+ "moduleDetection": "force",
12
+ "isolatedModules": true,
13
+ "verbatimModuleSyntax": true,
14
+ /* Strictness */
15
+ "strict": true,
16
+ "noUncheckedIndexedAccess": true,
17
+ "noImplicitOverride": true,
18
+ "erasableSyntaxOnly": true,
19
+ /* Opinion */
20
+ "incremental": true,
21
+ "tsBuildInfoFile": "./tsconfig.tsbuildinfo",
22
+ "module": "preserve",
23
+ "outDir": "./dist",
24
+ "baseUrl": ".",
25
+ "rootDir": "./src",
26
+ "paths": {
27
+ "~/*": [
28
+ "./src/*"
29
+ ],
30
+ "@/*": [
31
+ "./src/*"
32
+ ]
33
+ },
34
+ /* Required for project references, which provide go-to-definition in your
35
+ IDE without first having to build the module, which is essential during development. */
36
+ "composite": true,
37
+ /* Assuming your bundler will output everything, but we can not have noEmit
38
+ enabled because it is not compatible with composite / project references. Also declaration might be required for references to work fully. Not sure yet... */
39
+ "declaration": true,
40
+ "declarationMap": true,
41
+ "jsx": "react-jsx",
42
+ "lib": [
43
+ "dom",
44
+ "dom.iterable",
45
+ "esnext"
46
+ ],
47
+ },
48
+ "include": [
49
+ "./src",
50
+ "./src/**/*.json",
51
+ ],
52
+ "exclude": [
53
+ "!./src/**"
54
+ ],
55
+ "references": [
56
+ {
57
+ "path": "../core"
58
+ }
59
+ ],
60
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from 'tsdown';
2
+
3
+ export default defineConfig({
4
+ entry: ['./src/index.ts'],
5
+ outDir: 'dist',
6
+ target: 'es2022',
7
+ sourcemap: true,
8
+ skipNodeModulesBundle: true,
9
+ external: ['@kiberon-labs/behave-graph'],
10
+ format: ['esm'],
11
+ dts: true,
12
+ logLevel: 'warn',
13
+ unbundle: true,
14
+ platform: 'neutral'
15
+ });
package/typedoc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": [
3
+ "../../typedoc.base.jsonc"
4
+ ],
5
+ "entryPoints": [
6
+ "src/index.ts"
7
+ ]
8
+ }
@@ -0,0 +1,15 @@
1
+ import path from 'node:path';
2
+ import { configDefaults, defineConfig } from 'vitest/config';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ exclude: [...configDefaults.exclude],
7
+ watch: false
8
+ },
9
+ resolve: {
10
+ alias: {
11
+ '~': path.resolve(__dirname, './src'),
12
+ '@': path.resolve(__dirname, './src')
13
+ }
14
+ }
15
+ });