@zsherman/viz 0.0.0-stage → 0.1.1

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 (44) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +373 -0
  3. package/README.md +13 -2
  4. package/THIRD_PARTY_NOTICES.md +79 -0
  5. package/dist/dom/flow/flow.js +370 -0
  6. package/dist/dom/flow/flow.styles.js +158 -0
  7. package/dist/dom/flow/index.js +4 -0
  8. package/dist/dom/flow/layout.js +51 -0
  9. package/dist/dom/geo-map/geo-map.js +1037 -0
  10. package/dist/dom/geo-map/geo-map.styles.js +184 -0
  11. package/dist/dom/geo-map/geometry.js +231 -0
  12. package/dist/dom/geo-map/index.js +3 -0
  13. package/dist/dom/geo-map/types.js +0 -0
  14. package/dist/dom/geo-map/world.js +15 -0
  15. package/dist/dom/index.js +6 -0
  16. package/dist/solid/flow/flow.jsx +180 -0
  17. package/dist/solid/flow/flow.styles.jsx +158 -0
  18. package/dist/solid/flow/index.jsx +4 -0
  19. package/dist/solid/flow/layout.jsx +51 -0
  20. package/dist/solid/geo-map/geo-map.jsx +698 -0
  21. package/dist/solid/geo-map/geo-map.styles.jsx +184 -0
  22. package/dist/solid/geo-map/geometry.jsx +231 -0
  23. package/dist/solid/geo-map/index.jsx +3 -0
  24. package/dist/solid/geo-map/types.jsx +0 -0
  25. package/dist/solid/geo-map/world.jsx +15 -0
  26. package/dist/solid/index.jsx +6 -0
  27. package/dist/styles.css +1 -0
  28. package/dist/types/flow/flow.d.ts +92 -0
  29. package/dist/types/flow/flow.styles.d.ts +137 -0
  30. package/dist/types/flow/index.d.ts +6 -0
  31. package/dist/types/flow/layout.d.ts +47 -0
  32. package/dist/types/geo-map/geo-map.d.ts +70 -0
  33. package/dist/types/geo-map/geo-map.styles.d.ts +188 -0
  34. package/dist/types/geo-map/geometry.d.ts +116 -0
  35. package/dist/types/geo-map/index.d.ts +4 -0
  36. package/dist/types/geo-map/types.d.ts +103 -0
  37. package/dist/types/geo-map/world.d.ts +11 -0
  38. package/dist/types/index.d.ts +2 -0
  39. package/docs/api.json +297 -0
  40. package/docs/flow.md +255 -0
  41. package/docs/geo-map.md +320 -0
  42. package/docs/llms.txt +43 -0
  43. package/docs/search-index.json +64 -0
  44. package/package.json +66 -4
@@ -0,0 +1,158 @@
1
+ import "@stylexjs/stylex";
2
+ // src/flow/flow.styles.ts
3
+ const styles = {
4
+ root: {
5
+ kB7OPa: "x9f619",
6
+ kVAEAm: "x1n2onr6",
7
+ kzqmXN: "xh8yej3",
8
+ k7Eaqz: "xeuugli",
9
+ kVQacm: "xb3r6kr",
10
+ kMzoRj: "xmkeg23",
11
+ ksu8eU: "x1y0btm7",
12
+ kVAM5u: "x1wpxzwl",
13
+ kaIpWk: "x1oiwymw",
14
+ kWkggS: "xm9f0jk",
15
+ kMv6JI: "x13rcfk",
16
+ kGuDYH: "x409pna",
17
+ kMwMTN: "x1yjpjgc",
18
+ $$css: true
19
+ },
20
+ aspect: {
21
+ kOBAk4: "x186iv6y",
22
+ $$css: true
23
+ },
24
+ node: {
25
+ kB7OPa: "x9f619",
26
+ k1xSpc: "x78zum5",
27
+ kGNEyG: "x6s0dn4",
28
+ kOIVth: "x8rwxmg",
29
+ kzqmXN: "xh8yej3",
30
+ kZKoxP: "x5yr21d",
31
+ k7Eaqz: "xeuugli",
32
+ kg3NbH: "xxobuei",
33
+ k8WAf4: "xqy2vlu",
34
+ kMzoRj: "xmkeg23",
35
+ ksu8eU: "x1y0btm7",
36
+ kVAM5u: "x1vl23hm x1w1tqly",
37
+ kaIpWk: "x1ttroej",
38
+ kWkggS: "xm9f0jk",
39
+ kGVxlE: "x1ca8aof xuhup3a",
40
+ k3XXqK: "x1t137rt x1894zjx x131agne",
41
+ kMeerF: "x1de99jn",
42
+ kjBf7l: "x1g21a3s",
43
+ kMwMTN: "x1yjpjgc",
44
+ k9WMMc: "x1yc453h",
45
+ kLWn49: "xau0z5x",
46
+ k1ekBW: "xkdsq27",
47
+ kIyJzY: "xctwqe3 x12w9bfk",
48
+ $$css: true
49
+ },
50
+ pending: {
51
+ "--flow-ink": "xdzv0v4",
52
+ "--flow-node-edge": "x1w067c4",
53
+ $$css: true
54
+ },
55
+ running: {
56
+ "--flow-ink": "x1hgq7sz",
57
+ "--flow-node-edge": "x26i07e",
58
+ $$css: true
59
+ },
60
+ success: {
61
+ "--flow-ink": "xbfl7yv",
62
+ "--flow-node-edge": "x1w067c4",
63
+ $$css: true
64
+ },
65
+ warning: {
66
+ "--flow-ink": "xmdc92d",
67
+ "--flow-node-edge": "x1dbrlxx",
68
+ $$css: true
69
+ },
70
+ error: {
71
+ "--flow-ink": "x1x3owhy",
72
+ "--flow-node-edge": "x18kdt69",
73
+ $$css: true
74
+ },
75
+ plain: {
76
+ "--flow-ink": "x1lxbday",
77
+ "--flow-node-edge": "x1v79dzn",
78
+ $$css: true
79
+ },
80
+ icon: {
81
+ k1xSpc: "x3nfvp2",
82
+ kmuXW: "x2lah0s",
83
+ kGNEyG: "x6s0dn4",
84
+ kjj79g: "xl56j7k",
85
+ kzqmXN: "xcdlrvm",
86
+ kZKoxP: "x1l36t39",
87
+ kMwMTN: "x1eitvad xs5hli",
88
+ $$css: true
89
+ },
90
+ iconSvg: {
91
+ kzqmXN: "xcdlrvm",
92
+ kZKoxP: "x1l36t39",
93
+ $$css: true
94
+ },
95
+ body: {
96
+ k1xSpc: "x78zum5",
97
+ kXwgrk: "xdt5ytf",
98
+ kOIVth: "xpowot6",
99
+ kUk6DE: "x12lumcd",
100
+ k7Eaqz: "xeuugli",
101
+ $$css: true
102
+ },
103
+ title: {
104
+ kVQacm: "xb3r6kr",
105
+ kg5iWk: "xlyipyv",
106
+ khDVqt: "xuxw1ft",
107
+ k63SB2: "x1vmg6u2",
108
+ $$css: true
109
+ },
110
+ description: {
111
+ kVQacm: "xb3r6kr",
112
+ kg5iWk: "xlyipyv",
113
+ khDVqt: "xuxw1ft",
114
+ kGuDYH: "xb5fjo1",
115
+ kMwMTN: "xe2mk2a",
116
+ $$css: true
117
+ },
118
+ meta: {
119
+ kmuXW: "x2lah0s",
120
+ kGuDYH: "xb5fjo1",
121
+ kMwMTN: "xe2mk2a",
122
+ kcqcaj: "xss6m8b",
123
+ $$css: true
124
+ },
125
+ handle: {
126
+ kzqmXN: "x1xc55vz",
127
+ kZKoxP: "xdk7pt",
128
+ k7Eaqz: "x11inojt",
129
+ kAzted: "x16suv20",
130
+ kMzoRj: "xmkeg23",
131
+ ksu8eU: "x1y0btm7",
132
+ kVAM5u: "x1xfin0c",
133
+ kaIpWk: "x1dg1y8n",
134
+ kWkggS: "xm9f0jk",
135
+ $$css: true
136
+ },
137
+ handleHidden: {
138
+ kSiTet: "xg01cxk",
139
+ kfzvcC: "x47corl",
140
+ $$css: true
141
+ },
142
+ edge: {
143
+ kDwRjp: "xbh8q5q",
144
+ kjVXCG: "xbf09jc x8jos32",
145
+ kfJifR: "xhr4kjn",
146
+ kAXs8y: "x1kzknox",
147
+ $$css: true
148
+ },
149
+ flowing: {
150
+ k5rJSQ: "x1o3yjxk",
151
+ kKVMdj: "x10xa9bi x1aquc0h",
152
+ k44tkh: "xemfg65",
153
+ kyAemX: "x1esw782",
154
+ ko0y90: "xa4qsjk",
155
+ $$css: true
156
+ }
157
+ };
158
+ export { styles };
@@ -0,0 +1,4 @@
1
+ import { Flow, FlowBackground, FlowControls, FlowEdge, FlowMiniMap, FlowNode } from "./flow.jsx";
2
+ import { layoutFlow } from "./layout.jsx";
3
+ import { BaseEdge, Handle, Panel, Position, createEdgeStore, createNodeStore, getBezierPath, getSmoothStepPath, getStraightPath, useSolidFlow } from "@dschz/solid-flow";
4
+ export { BaseEdge, Flow, FlowBackground, FlowControls, FlowEdge, FlowMiniMap, FlowNode, Handle, Panel, Position, createEdgeStore, createNodeStore, getBezierPath, getSmoothStepPath, getStraightPath, layoutFlow, useSolidFlow };
@@ -0,0 +1,51 @@
1
+ import { Position } from "@dschz/solid-flow";
2
+ import { Graph, layout } from "@dagrejs/dagre";
3
+ // src/flow/layout.ts
4
+ /**
5
+ * Auto layout for flows that arrive without positions (a pipeline from an API, a service graph): dagre's
6
+ * layered layout (`@dagrejs/dagre`, MIT) ranks the nodes along the edges, left to right or top to bottom,
7
+ * and places each node so edges cross as little as they can. Pure: nodes in, nodes with positions out.
8
+ */
9
+ /**
10
+ * The nodes with `position` set by dagre (each node's top left, so a fit view frames them), and their handles
11
+ * on the sides the graph flows through (`targetPosition` left and `sourcePosition` right going `"LR"`; top
12
+ * and bottom going `"TB"`). Edges naming a node that isn't there are left out of the layout. The input isn't
13
+ * changed.
14
+ */
15
+ function layoutFlow(nodes, edges, options = {}) {
16
+ const direction = options.direction ?? "LR";
17
+ const fallbackWidth = options.nodeWidth ?? 200;
18
+ const fallbackHeight = options.nodeHeight ?? 56;
19
+ const graph = new Graph();
20
+ graph.setGraph({
21
+ rankdir: direction,
22
+ ranksep: options.rankGap ?? 72,
23
+ nodesep: options.nodeGap ?? 24,
24
+ marginx: 0,
25
+ marginy: 0
26
+ });
27
+ graph.setDefaultEdgeLabel(() => ({}));
28
+ const size = (node) => ({
29
+ width: node.width ?? node.measured?.width ?? fallbackWidth,
30
+ height: node.height ?? node.measured?.height ?? fallbackHeight
31
+ });
32
+ for (const node of nodes) graph.setNode(node.id, size(node));
33
+ const ids = new Set(nodes.map((n) => n.id));
34
+ for (const edge of edges) if (ids.has(edge.source) && ids.has(edge.target) && edge.source !== edge.target) graph.setEdge(edge.source, edge.target);
35
+ layout(graph);
36
+ const horizontal = direction === "LR";
37
+ return nodes.map((node) => {
38
+ const placed = graph.node(node.id);
39
+ const { width, height } = size(node);
40
+ return {
41
+ ...node,
42
+ position: {
43
+ x: Math.round(placed.x - width / 2),
44
+ y: Math.round(placed.y - height / 2)
45
+ },
46
+ sourcePosition: horizontal ? Position.Right : Position.Bottom,
47
+ targetPosition: horizontal ? Position.Left : Position.Top
48
+ };
49
+ });
50
+ }
51
+ export { layoutFlow };