polly-graph 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Badal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the \"Software\"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # polly-graph
2
+
3
+ Reusable D3-based graph visualization SDK with configurable nodes, links, labels, interactions, and layout behaviors.
4
+
5
+ ## Features
6
+
7
+ * Interactive force-directed graph rendering
8
+ * Configurable nodes, links, and labels
9
+ * Hover states with tooltip support
10
+ * Node selection support
11
+ * Drag and zoom interactions
12
+ * Arrow markers and relationship visualization
13
+ * Framework-agnostic API
14
+ * Angular and React compatible
15
+
16
+ ---
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install polly-graph
22
+ ```
23
+
24
+ No separate D3 installation is required.
25
+
26
+ ---
27
+
28
+ ## Basic Usage
29
+
30
+ ### HTML
31
+
32
+ ```html
33
+ <div class="graph-wrapper">
34
+ <svg id="graph-container"></svg>
35
+ </div>
36
+ ```
37
+
38
+ ### TypeScript
39
+
40
+ ```ts
41
+ import {
42
+ createGraph,
43
+ GraphNode,
44
+ GraphLink,
45
+ } from 'polly-graph';
46
+
47
+ const container = document.getElementById(
48
+ 'graph-container',
49
+ ) as SVGSVGElement;
50
+
51
+ const nodes: GraphNode[] = [
52
+ {
53
+ id: 'users',
54
+ label: 'Users',
55
+ style: {
56
+ radius: 24,
57
+ fill: '#7c3aed',
58
+ stroke: '#6d28d9',
59
+ strokeWidth: 2,
60
+ textColor: '#ffffff',
61
+ },
62
+ },
63
+ {
64
+ id: 'orders',
65
+ label: 'Orders',
66
+ style: {
67
+ radius: 24,
68
+ fill: '#2563eb',
69
+ stroke: '#1d4ed8',
70
+ strokeWidth: 2,
71
+ textColor: '#ffffff',
72
+ },
73
+ },
74
+ ];
75
+
76
+ const links: GraphLink[] = [
77
+ {
78
+ source: 'users',
79
+ target: 'orders',
80
+ label: 'has_many',
81
+ style: {
82
+ stroke: '#94a3b8',
83
+ strokeWidth: 2,
84
+ opacity: 1,
85
+ },
86
+ },
87
+ ];
88
+
89
+ const graph = createGraph({
90
+ container,
91
+ nodes,
92
+ links,
93
+ interaction: {
94
+ drag: {
95
+ enabled: true,
96
+ },
97
+ hover: {
98
+ enabled: true,
99
+ tooltip: {
100
+ enabled: true,
101
+ },
102
+ },
103
+ selection: {
104
+ enabled: true,
105
+ },
106
+ },
107
+ });
108
+
109
+ graph.render();
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Hover + Tooltip Example
115
+
116
+ ```ts
117
+ interaction: {
118
+ hover: {
119
+ enabled: true,
120
+ tooltip: {
121
+ enabled: true,
122
+ theme: 'dark',
123
+ },
124
+ nodeStyle: {
125
+ stroke: '#16a34a',
126
+ strokeWidth: 3,
127
+ opacity: 1,
128
+ },
129
+ },
130
+ }
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Selection Example
136
+
137
+ ```ts
138
+ selection: {
139
+ enabled: true,
140
+ multiSelect: false,
141
+ nodeStyle: {
142
+ stroke: '#f59e0b',
143
+ strokeWidth: 4,
144
+ opacity: 1,
145
+ },
146
+ }
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Angular Example
152
+
153
+ ### Template
154
+
155
+ ```html
156
+ <div class="graph-wrapper">
157
+ <svg #svgRef></svg>
158
+ </div>
159
+ ```
160
+
161
+ ### Component
162
+
163
+ ```ts
164
+ this.graph = createGraph({
165
+ container: this.svgRef.nativeElement,
166
+ nodes,
167
+ links,
168
+ interaction,
169
+ });
170
+
171
+ this.graph.render();
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Public API
177
+
178
+ ### Main Exports
179
+
180
+ * `createGraph`
181
+ * `GraphInstance`
182
+ * `GraphNode`
183
+ * `GraphLink`
184
+ * `GraphConfig`
185
+ * `GraphInteractionConfig`
186
+
187
+ ---
188
+
189
+ ## Development
190
+
191
+ ```bash
192
+ npm install
193
+ npm run dev
194
+ npm run build
195
+ npm run lint
196
+ npm run typecheck
197
+ npm run test
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Publish Checklist
203
+
204
+ * Package name available on npm
205
+ * README completed
206
+ * LICENSE added
207
+ * Build succeeds
208
+ * Tests pass
209
+ * npm token configured
210
+ * GitHub workflow passes
211
+ * Repository is public
212
+
213
+ ---
214
+
215
+ ## License
216
+
217
+ MIT