graphgarden-web 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 Bruits
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,68 @@
1
+ # GraphGarden Web Component
2
+
3
+ Drop-in `<graph-garden>` custom element that renders an interactive node graph from a site's [`graphgarden.json`](../../crates/graphgarden-protocol/README.md) file.
4
+
5
+ The component fetches the site's protocol file, merges friend graphs, computes a force-directed layout via ForceAtlas2, and renders an interactive visualisation with [Sigma.js](https://www.sigmajs.org/). Local nodes are shown in indigo, friend nodes in amber, with matching edge colours to distinguish internal links from cross-site friendships.
6
+
7
+ ## Usage
8
+
9
+ ### Script tag (module)
10
+
11
+ ```html
12
+ <script type="module" src="https://unpkg.com/graphgarden-web"></script>
13
+ <graph-garden style="width: 600px; height: 400px;"></graph-garden>
14
+ ```
15
+
16
+ ### Script tag (classic)
17
+
18
+ ```html
19
+ <script src="https://unpkg.com/graphgarden-web/iife"></script>
20
+ <graph-garden style="width: 600px; height: 400px;"></graph-garden>
21
+ ```
22
+
23
+ ### npm
24
+
25
+ ```sh
26
+ npm install graphgarden-web
27
+ ```
28
+
29
+ ```js
30
+ import "graphgarden-web";
31
+ ```
32
+
33
+ ```html
34
+ <graph-garden style="width: 600px; height: 400px;"></graph-garden>
35
+ ```
36
+
37
+ ### Customization
38
+
39
+ #### Colors (CSS custom properties)
40
+
41
+ Override colors via CSS custom properties on the `<graph-garden>` element or any ancestor:
42
+
43
+ | Property | Default | Description |
44
+ | -------------------------- | --------- | ---------------------------------- |
45
+ | `--gg-local-node-color` | `#6366f1` | Color of nodes from the local site |
46
+ | `--gg-friend-node-color` | `#f59e0b` | Color of nodes from friend sites |
47
+ | `--gg-internal-edge-color` | `#94a3b8` | Color of edges between local pages |
48
+ | `--gg-friend-edge-color` | `#fbbf24` | Color of edges to friend sites |
49
+ | `--gg-label-color` | `#334155` | Color of node labels |
50
+
51
+ > Colors can be any format supported by Sigma.js: hex (`#rrggbb`, `#rgb`), `rgb()`, `rgba()`, or named CSS colors (e.g. `red`, `darkgreen`).
52
+
53
+ #### Layout and sizing (HTML attributes)
54
+
55
+ | Attribute | Default | Description |
56
+ | ------------ | ------- | --------------------------------------- |
57
+ | `node-size` | `4` | Radius of graph nodes |
58
+ | `edge-size` | `0.5` | Thickness of graph edges |
59
+ | `label-size` | `12` | Font size of node labels |
60
+ | `iterations` | `200` | Number of ForceAtlas2 layout iterations |
61
+
62
+ ```html
63
+ <graph-garden node-size="6" label-size="14" iterations="500"></graph-garden>
64
+ ```
65
+
66
+ ## Development
67
+
68
+ Refer to [CONTRIBUTING.md](../../CONTRIBUTING.md#graphgarden-web-component) for development setup and workflow details.