@statelyai/graph 1.0.0 → 2.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.
Files changed (77) hide show
  1. package/README.md +121 -44
  2. package/dist/{adjacency-list-VsUaH9SJ.mjs → adjacency-list-DQ32Mmhx.mjs} +3 -1
  3. package/dist/algorithms-D1cgly0g.d.mts +452 -0
  4. package/dist/algorithms-DBpH74hR.mjs +3309 -0
  5. package/dist/algorithms.d.mts +2 -2
  6. package/dist/algorithms.mjs +2 -2
  7. package/dist/config-Dt5u1gSf.mjs +793 -0
  8. package/dist/{converter-udLITX36.mjs → converter-DB6Rg6Vd.mjs} +2 -2
  9. package/dist/format-support.mjs +38 -11
  10. package/dist/formats/adjacency-list/index.d.mts +1 -1
  11. package/dist/formats/adjacency-list/index.mjs +1 -1
  12. package/dist/formats/converter/index.d.mts +1 -1
  13. package/dist/formats/converter/index.mjs +1 -1
  14. package/dist/formats/cytoscape/index.d.mts +4 -4
  15. package/dist/formats/cytoscape/index.mjs +10 -4
  16. package/dist/formats/d2/index.d.mts +1 -1
  17. package/dist/formats/d2/index.mjs +26 -12
  18. package/dist/formats/d3/index.d.mts +4 -4
  19. package/dist/formats/d3/index.mjs +10 -4
  20. package/dist/formats/dot/index.d.mts +1 -1
  21. package/dist/formats/dot/index.mjs +22 -6
  22. package/dist/formats/edge-list/index.d.mts +1 -1
  23. package/dist/formats/edge-list/index.mjs +1 -1
  24. package/dist/formats/elk/index.d.mts +1 -1
  25. package/dist/formats/elk/index.mjs +63 -24
  26. package/dist/formats/gexf/index.d.mts +1 -1
  27. package/dist/formats/gexf/index.mjs +43 -16
  28. package/dist/formats/gml/index.d.mts +4 -4
  29. package/dist/formats/gml/index.mjs +28 -15
  30. package/dist/formats/graphml/index.d.mts +1 -1
  31. package/dist/formats/graphml/index.mjs +96 -23
  32. package/dist/formats/jgf/index.d.mts +4 -4
  33. package/dist/formats/jgf/index.mjs +12 -5
  34. package/dist/formats/mermaid/index.d.mts +1 -1
  35. package/dist/formats/mermaid/index.mjs +49 -12
  36. package/dist/formats/tgf/index.d.mts +4 -4
  37. package/dist/formats/tgf/index.mjs +4 -4
  38. package/dist/formats/xyflow/index.d.mts +12 -6
  39. package/dist/formats/xyflow/index.mjs +42 -10
  40. package/dist/{index-D9Kj6Fe3.d.mts → index-BlbSWUvH.d.mts} +1 -1
  41. package/dist/{index-CHoriXZD.d.mts → index-CNvqxPLJ.d.mts} +157 -30
  42. package/dist/index.d.mts +6 -6
  43. package/dist/index.mjs +290 -307
  44. package/dist/layout/cytoscape.d.mts +66 -0
  45. package/dist/layout/cytoscape.mjs +114 -0
  46. package/dist/layout/d3-force.d.mts +52 -0
  47. package/dist/layout/d3-force.mjs +127 -0
  48. package/dist/layout/d3-hierarchy.d.mts +39 -0
  49. package/dist/layout/d3-hierarchy.mjs +135 -0
  50. package/dist/layout/dagre.d.mts +32 -0
  51. package/dist/layout/dagre.mjs +99 -0
  52. package/dist/layout/elk.d.mts +47 -0
  53. package/dist/layout/elk.mjs +73 -0
  54. package/dist/layout/forceatlas2.d.mts +48 -0
  55. package/dist/layout/forceatlas2.mjs +100 -0
  56. package/dist/layout/graphviz.d.mts +50 -0
  57. package/dist/layout/graphviz.mjs +179 -0
  58. package/dist/layout/index.d.mts +185 -0
  59. package/dist/layout/index.mjs +181 -0
  60. package/dist/layout/webcola.d.mts +40 -0
  61. package/dist/layout/webcola.mjs +104 -0
  62. package/dist/{queries-BlkA1HAN.d.mts → queries-B6quF529.d.mts} +43 -12
  63. package/dist/queries-BMM0XAv_.mjs +986 -0
  64. package/dist/queries.d.mts +1 -1
  65. package/dist/queries.mjs +1 -768
  66. package/dist/schemas.d.mts +19 -1
  67. package/dist/schemas.mjs +32 -84
  68. package/dist/{types-3-FS9NV2.d.mts → types-BAEQTwK_.d.mts} +99 -7
  69. package/dist/validate-BsfSOv0S.mjs +190 -0
  70. package/package.json +59 -7
  71. package/schemas/edge.schema.json +27 -0
  72. package/schemas/graph.schema.json +27 -0
  73. package/dist/algorithms-Ba7o7niK.mjs +0 -2394
  74. package/dist/algorithms-fTqmvhzP.d.mts +0 -178
  75. package/dist/indexing-DR8M1vBy.mjs +0 -137
  76. /package/dist/{edge-list-DP4otyPU.mjs → edge-list-CA9UTvn2.mjs} +0 -0
  77. /package/dist/{mode-D8OnHFBk.mjs → mode-gu_mhKKs.mjs} +0 -0
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@statelyai/graph",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "sideEffects": false,
5
+ "version": "2.1.0",
5
6
  "description": "A TypeScript-first graph library with plain JSON-serializable objects",
6
7
  "author": "David Khourshid <david@stately.ai>",
7
8
  "license": "MIT",
@@ -40,6 +41,15 @@
40
41
  "./mermaid": "./dist/formats/mermaid/index.mjs",
41
42
  "./tgf": "./dist/formats/tgf/index.mjs",
42
43
  "./xyflow": "./dist/formats/xyflow/index.mjs",
44
+ "./layout": "./dist/layout/index.mjs",
45
+ "./layout/cytoscape": "./dist/layout/cytoscape.mjs",
46
+ "./layout/d3-force": "./dist/layout/d3-force.mjs",
47
+ "./layout/d3-hierarchy": "./dist/layout/d3-hierarchy.mjs",
48
+ "./layout/dagre": "./dist/layout/dagre.mjs",
49
+ "./layout/elk": "./dist/layout/elk.mjs",
50
+ "./layout/forceatlas2": "./dist/layout/forceatlas2.mjs",
51
+ "./layout/graphviz": "./dist/layout/graphviz.mjs",
52
+ "./layout/webcola": "./dist/layout/webcola.mjs",
43
53
  "./queries": "./dist/queries.mjs",
44
54
  "./schemas": "./dist/schemas.mjs",
45
55
  "./package.json": "./package.json"
@@ -52,42 +62,72 @@
52
62
  "schemas"
53
63
  ],
54
64
  "devDependencies": {
55
- "publint": "^0.3.15",
56
65
  "@changesets/changelog-github": "^0.5.2",
57
- "@changesets/cli": "^2.29.8",
66
+ "@changesets/cli": "^2.31.0",
67
+ "@dagrejs/dagre": "^3.0.0",
68
+ "@dagrejs/graphlib": "^4.0.1",
69
+ "@hpcc-js/wasm-graphviz": "^1.22.0",
58
70
  "@types/d3-array": "^3.2.2",
59
71
  "@types/d3-force": "^3.0.10",
72
+ "@types/d3-hierarchy": "^3.1.7",
60
73
  "@types/node": "^25.0.3",
74
+ "@vitest/coverage-v8": "^4.0.18",
61
75
  "@xyflow/system": "^0.0.75",
62
76
  "bumpp": "^10.3.2",
63
- "cytoscape": "^3.33.1",
77
+ "cytoscape": "^3.34.0",
64
78
  "d3-array": "^3.2.4",
65
79
  "d3-force": "^3.0.0",
80
+ "d3-hierarchy": "^3.1.2",
66
81
  "dotparser": "^1.1.1",
67
82
  "elkjs": "^0.11.1",
68
83
  "fast-xml-parser": "^5.3.4",
84
+ "graphology": "^0.26.0",
85
+ "graphology-components": "^1.5.4",
86
+ "graphology-layout-forceatlas2": "^0.10.1",
87
+ "graphology-metrics": "^2.4.0",
88
+ "graphology-shortest-path": "^2.1.0",
89
+ "graphology-types": "^0.24.8",
90
+ "ngraph.graph": "^20.1.2",
91
+ "ngraph.path": "^1.6.1",
92
+ "publint": "^0.3.15",
69
93
  "tsdown": "^0.18.1",
70
- "tsx": "^4.21.0",
94
+ "tsx": "^4.22.4",
71
95
  "typescript": "^5.9.3",
72
96
  "vitest": "^4.0.16",
97
+ "webcola": "^3.4.0",
73
98
  "xstate": "^5.28.0",
74
99
  "zod": "^4.3.6"
75
100
  },
76
101
  "peerDependencies": {
102
+ "@dagrejs/dagre": "^3.0.0 || ^4.0.0",
103
+ "@hpcc-js/wasm-graphviz": "^1.0.0",
77
104
  "cytoscape": "^3.0.0",
78
105
  "d3-force": "^3.0.0",
106
+ "d3-hierarchy": "^3.0.0",
79
107
  "dotparser": "^1.0.0",
80
108
  "elkjs": "^0.9.0 || ^0.10.0 || ^0.11.0",
81
109
  "fast-xml-parser": "^5.0.0",
110
+ "graphology": "^0.26.0",
111
+ "graphology-layout-forceatlas2": "^0.10.0",
112
+ "webcola": "^3.4.0",
82
113
  "zod": "^4.0.0"
83
114
  },
84
115
  "peerDependenciesMeta": {
116
+ "@dagrejs/dagre": {
117
+ "optional": true
118
+ },
119
+ "@hpcc-js/wasm-graphviz": {
120
+ "optional": true
121
+ },
85
122
  "cytoscape": {
86
123
  "optional": true
87
124
  },
88
125
  "d3-force": {
89
126
  "optional": true
90
127
  },
128
+ "d3-hierarchy": {
129
+ "optional": true
130
+ },
91
131
  "dotparser": {
92
132
  "optional": true
93
133
  },
@@ -97,6 +137,15 @@
97
137
  "fast-xml-parser": {
98
138
  "optional": true
99
139
  },
140
+ "graphology": {
141
+ "optional": true
142
+ },
143
+ "graphology-layout-forceatlas2": {
144
+ "optional": true
145
+ },
146
+ "webcola": {
147
+ "optional": true
148
+ },
100
149
  "zod": {
101
150
  "optional": true
102
151
  }
@@ -108,12 +157,15 @@
108
157
  "fix:generated": "pnpm generate-schema",
109
158
  "test": "vitest",
110
159
  "typecheck": "tsc --noEmit",
160
+ "typecheck:repo": "tsc --project tsconfig.repo.json",
111
161
  "check:generated": "tsx scripts/generate-json-schema.ts --check",
112
- "verify": "pnpm typecheck && pnpm check:generated && pnpm test -- --run && pnpm build && pnpm validate:package",
162
+ "check:conventions": "tsx scripts/check-conventions.ts",
163
+ "verify": "pnpm typecheck && pnpm typecheck:repo && pnpm check:generated && pnpm check:conventions && pnpm test -- --run && pnpm build && pnpm validate:package",
113
164
  "validate:package": "publint && tsx scripts/smoke-package.ts",
114
165
  "generate-schema": "tsx scripts/generate-json-schema.ts",
115
166
  "changeset": "changeset",
116
167
  "version": "changeset version",
117
- "release": "pnpm run build && changeset publish"
168
+ "release": "pnpm run build && changeset publish",
169
+ "bench:compare": "tsx bench/compare/run.ts"
118
170
  }
119
171
  }
@@ -42,6 +42,33 @@
42
42
  "bidirectional"
43
43
  ]
44
44
  },
45
+ "points": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "properties": {
50
+ "x": {
51
+ "type": "number"
52
+ },
53
+ "y": {
54
+ "type": "number"
55
+ }
56
+ },
57
+ "required": [
58
+ "x",
59
+ "y"
60
+ ],
61
+ "additionalProperties": false
62
+ }
63
+ },
64
+ "routing": {
65
+ "type": "string",
66
+ "enum": [
67
+ "polyline",
68
+ "orthogonal",
69
+ "splines"
70
+ ]
71
+ },
45
72
  "data": {},
46
73
  "x": {
47
74
  "type": "number"
@@ -217,6 +217,33 @@
217
217
  "bidirectional"
218
218
  ]
219
219
  },
220
+ "points": {
221
+ "type": "array",
222
+ "items": {
223
+ "type": "object",
224
+ "properties": {
225
+ "x": {
226
+ "type": "number"
227
+ },
228
+ "y": {
229
+ "type": "number"
230
+ }
231
+ },
232
+ "required": [
233
+ "x",
234
+ "y"
235
+ ],
236
+ "additionalProperties": false
237
+ }
238
+ },
239
+ "routing": {
240
+ "type": "string",
241
+ "enum": [
242
+ "polyline",
243
+ "orthogonal",
244
+ "splines"
245
+ ]
246
+ },
220
247
  "data": {},
221
248
  "x": {
222
249
  "type": "number"