anywidget-graph 0.2.10__tar.gz → 0.3.0__tar.gz

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 (47) hide show
  1. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/CHANGELOG.md +18 -4
  2. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/PKG-INFO +3 -1
  3. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/README.md +2 -0
  4. anywidget_graph-0.3.0/assets/demo.png +0 -0
  5. anywidget_graph-0.3.0/assets/widget.png +0 -0
  6. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/pyproject.toml +1 -1
  7. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/index.js +40 -10
  8. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/settings.js +5 -5
  9. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/styles.css +24 -19
  10. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/uv.lock +1 -1
  11. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/.github/workflows/ci.yml +0 -0
  12. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/.github/workflows/pypi.yml +0 -0
  13. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/.gitignore +0 -0
  14. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/.python-version +0 -0
  15. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/LICENSE +0 -0
  16. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/examples/demo.py +0 -0
  17. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/examples/test_hierarchy.py +0 -0
  18. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/examples/test_large_graph.py +0 -0
  19. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/__init__.py +0 -0
  20. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/backends/__init__.py +0 -0
  21. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/backends/arango.py +0 -0
  22. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/backends/cosmosdb.py +0 -0
  23. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/backends/grafeo.py +0 -0
  24. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/backends/ladybug.py +0 -0
  25. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/backends/neo4j.py +0 -0
  26. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/__init__.py +0 -0
  27. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/base.py +0 -0
  28. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/common.py +0 -0
  29. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/cypher.py +0 -0
  30. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/gql.py +0 -0
  31. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/graphql.py +0 -0
  32. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/gremlin.py +0 -0
  33. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/converters/sparql.py +0 -0
  34. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/demo.py +0 -0
  35. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/py.typed +0 -0
  36. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/__init__.py +0 -0
  37. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/grafeo-embed.js +0 -0
  38. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/grafeo.js +0 -0
  39. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/icons.js +0 -0
  40. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/neo4j.js +0 -0
  41. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/properties.js +0 -0
  42. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/results.js +0 -0
  43. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/schema.js +0 -0
  44. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/ui/toolbar.js +0 -0
  45. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/src/anywidget_graph/widget.py +0 -0
  46. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/tests/__init__.py +0 -0
  47. {anywidget_graph-0.2.10 → anywidget_graph-0.3.0}/tests/test_graph.py +0 -0
@@ -1,16 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### New Features
6
+
7
+ - **Automatic dark mode**: Detects host theme (marimo `class="dark"`, `data-theme`, `prefers-color-scheme`) and syncs automatically via MutationObserver
8
+
9
+ ### Improvements
10
+
11
+ - Increased node spread in spring layout: stronger charge repulsion, larger link distance and collision radius for clearer hub-spoke separation
12
+ - Spring layout renamed to "Default" in the layout dropdown
13
+ - Updated color palette: blue accent and slate-based neutrals, replacing the previous indigo tint
14
+ - Theme toggle auto-hidden when running inside a themed host (e.g. marimo)
15
+ - Dark mode label colors update dynamically with theme changes
16
+
3
17
  ## 0.2.10
4
18
 
5
19
  ### New Features
6
20
 
7
- - **Spring layout (d3-force)**: New default layout using d3-force with charge, link-distance and collision forces; produces clean hub-spoke rings for hierarchical data like Neo4j browser
8
- - **Degree-based node sizing**: When no explicit `size_field` is set, nodes are sized by their connection count; hub nodes appear larger and push neighbors into natural rings
9
- - **Filter-aware layouts**: Switching layout or clicking refresh now re-runs the layout using only visible nodes, respecting type filters and search state
21
+ - **d3-force spring layout**: New default layout using d3-force with charge, link-distance and collision forces; produces clean hub-spoke rings for hierarchical data
22
+ - **Degree-based node sizing**: Nodes auto-sized by connection count when no explicit `size_field` is set; hub nodes appear larger, pushing neighbors into natural rings
23
+ - **Filter-aware layouts**: Switching layout or clicking refresh re-runs the layout using only visible nodes, respecting type filters and search state
10
24
 
11
25
  ### Improvements
12
26
 
13
- - Spring layout is the new default (renamed to "Default" in the dropdown)
27
+ - Spring layout is the new default
14
28
  - Force layout uses `linLogMode` for better community separation
15
29
  - Cluster layout filters out hidden node types before packing
16
30
  - Filter panel refresh button triggers a layout refresh
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anywidget-graph
3
- Version: 0.2.10
3
+ Version: 0.3.0
4
4
  Summary: Interactive graph visualization for Python notebooks using anywidget
5
5
  Project-URL: Homepage, https://grafeo.dev/
6
6
  Project-URL: Repository, https://github.com/GrafeoDB/anywidget-graph
@@ -45,6 +45,8 @@ Interactive graph visualization for Python notebooks.
45
45
 
46
46
  Works with Marimo, Jupyter, VS Code, Colab, anywhere [anywidget](https://anywidget.dev/) runs.
47
47
 
48
+ ![anywidget-graph demo](assets/demo.png)
49
+
48
50
  ## Features
49
51
 
50
52
  - **Universal**: One widget, every notebook environment
@@ -4,6 +4,8 @@ Interactive graph visualization for Python notebooks.
4
4
 
5
5
  Works with Marimo, Jupyter, VS Code, Colab, anywhere [anywidget](https://anywidget.dev/) runs.
6
6
 
7
+ ![anywidget-graph demo](assets/demo.png)
8
+
7
9
  ## Features
8
10
 
9
11
  - **Universal**: One widget, every notebook environment
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "anywidget-graph"
3
- version = "0.2.10"
3
+ version = "0.3.0"
4
4
  description = "Interactive graph visualization for Python notebooks using anywidget"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -283,15 +283,45 @@ function render({ model, el }) {
283
283
  wrapper.style.height = model.get("height") + "px";
284
284
  wrapper.style.maxHeight = model.get("height") + "px";
285
285
 
286
- // Apply dark mode
286
+ // Auto-detect host theme (marimo uses Tailwind class="dark" on <html>)
287
+ function detectHostDark() {
288
+ const html = document.documentElement;
289
+ if (html.classList.contains("dark")) return true;
290
+ if (html.dataset.theme === "dark") return true;
291
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) return true;
292
+ return false;
293
+ }
294
+
287
295
  function updateTheme() {
288
- wrapper.classList.toggle("awg-dark", model.get("dark_mode"));
296
+ const dark = model.get("dark_mode");
297
+ wrapper.classList.toggle("awg-dark", dark);
298
+ rendererRef?.setSetting("labelColor", { color: dark ? "#e0e0e0" : "#333" });
299
+ rendererRef?.refresh();
289
300
  }
290
- updateTheme();
301
+
302
+ // Detect if inside a themed host (marimo, etc.)
303
+ const hasHostTheme = !!el.getRootNode()?.host?.tagName?.startsWith("MARIMO-");
304
+ if (hasHostTheme) {
305
+ wrapper.classList.add("awg-auto-theme");
306
+ model.set("dark_mode", detectHostDark());
307
+ model.save_changes();
308
+ updateTheme();
309
+ const themeObserver = new MutationObserver(() => {
310
+ const dark = detectHostDark();
311
+ if (model.get("dark_mode") !== dark) {
312
+ model.set("dark_mode", dark);
313
+ model.save_changes();
314
+ updateTheme();
315
+ }
316
+ });
317
+ themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ["class", "data-theme"] });
318
+ } else {
319
+ updateTheme();
320
+ }
321
+
322
+ // Manual toggle from settings panel still works
291
323
  model.on("change:dark_mode", () => {
292
324
  updateTheme();
293
- rendererRef?.setSetting("labelColor", { color: model.get("dark_mode") ? "#e0e0e0" : "#333" });
294
- rendererRef?.refresh();
295
325
  });
296
326
 
297
327
  // Create query executor callback
@@ -690,15 +720,15 @@ function render({ model, el }) {
690
720
  }
691
721
  });
692
722
 
693
- // Configure forces
694
- const linkDistance = n < 30 ? 50 : n < 100 ? 40 : 30;
695
- const chargeStrength = n < 30 ? -200 : n < 100 ? -150 : -80;
723
+ // Configure forces: generous spacing so hub-spoke rings are clear
724
+ const linkDistance = n < 30 ? 80 : n < 100 ? 60 : 45;
725
+ const chargeStrength = n < 30 ? -400 : n < 100 ? -300 : -200;
696
726
 
697
727
  const simulation = d3Force.forceSimulation(d3Nodes)
698
- .force("link", d3Force.forceLink(d3Links).distance(linkDistance).strength(0.5))
728
+ .force("link", d3Force.forceLink(d3Links).distance(linkDistance).strength(0.4))
699
729
  .force("charge", d3Force.forceManyBody().strength(chargeStrength))
700
730
  .force("center", d3Force.forceCenter(0, 0))
701
- .force("collide", d3Force.forceCollide().radius((d) => d.size * 1.5 + 2).strength(0.7))
731
+ .force("collide", d3Force.forceCollide().radius((d) => d.size * 2 + 4).strength(0.8))
702
732
  .stop();
703
733
 
704
734
  // Run simulation synchronously
@@ -58,9 +58,8 @@ export function createSettingsPanel(model, callbacks) {
58
58
  const form = document.createElement("div");
59
59
  form.className = "awg-panel-form";
60
60
 
61
- // Dark mode toggle
62
- form.appendChild(
63
- createFormGroup("Theme", () => {
61
+ // Dark mode toggle (hidden when host provides theme)
62
+ const themeGroup = createFormGroup("Theme", () => {
64
63
  const toggle = document.createElement("label");
65
64
  toggle.className = "awg-toggle";
66
65
  const checkbox = document.createElement("input");
@@ -82,8 +81,9 @@ export function createSettingsPanel(model, callbacks) {
82
81
  toggle.appendChild(slider);
83
82
  toggle.appendChild(label);
84
83
  return toggle;
85
- })
86
- );
84
+ });
85
+ themeGroup.classList.add("awg-theme-toggle");
86
+ form.appendChild(themeGroup);
87
87
 
88
88
  // Backend selector
89
89
  const backendSelect = document.createElement("select");
@@ -2,35 +2,35 @@
2
2
  * Styles for anywidget-graph UI components.
3
3
  */
4
4
 
5
- /* === CSS VARIABLES === */
5
+ /* === CSS VARIABLES (matches marimo theme) === */
6
6
  .awg-wrapper {
7
7
  --awg-bg: #ffffff;
8
8
  --awg-bg-secondary: #f8f9fa;
9
- --awg-bg-tertiary: #f3f4f6;
10
- --awg-border: #e5e7eb;
11
- --awg-text: #111827;
9
+ --awg-bg-tertiary: #f1f5f9;
10
+ --awg-border: #e2e8f0;
11
+ --awg-text: #0f172a;
12
12
  --awg-text-secondary: #6b7280;
13
13
  --awg-text-muted: #9ca3af;
14
- --awg-accent: #6366f1;
15
- --awg-accent-hover: #4f46e5;
16
- --awg-graph-bg: #fafafa;
14
+ --awg-accent: #0880ea;
15
+ --awg-accent-hover: #0670d0;
16
+ --awg-graph-bg: #ffffff;
17
17
  --awg-input-bg: #ffffff;
18
- --awg-input-border: #d1d5db;
18
+ --awg-input-border: #e2e8f0;
19
19
  }
20
20
 
21
21
  .awg-wrapper.awg-dark {
22
- --awg-bg: #1a1a2e;
23
- --awg-bg-secondary: #252542;
24
- --awg-bg-tertiary: #3a3a5c;
25
- --awg-border: #3a3a5c;
26
- --awg-text: #e0e0e0;
22
+ --awg-bg: #181c1a;
23
+ --awg-bg-secondary: #252927;
24
+ --awg-bg-tertiary: #2f3533;
25
+ --awg-border: #3b403e;
26
+ --awg-text: #eceeed;
27
27
  --awg-text-secondary: #a0aec0;
28
- --awg-text-muted: #888;
29
- --awg-accent: #6366f1;
30
- --awg-accent-hover: #818cf8;
31
- --awg-graph-bg: #1a1a2e;
32
- --awg-input-bg: #1a1a2e;
33
- --awg-input-border: #3a3a5c;
28
+ --awg-text-muted: #9ca3af;
29
+ --awg-accent: #28879f;
30
+ --awg-accent-hover: #1d5b6a;
31
+ --awg-graph-bg: #181c1a;
32
+ --awg-input-bg: #181c1a;
33
+ --awg-input-border: #3b403e;
34
34
  }
35
35
 
36
36
  /* === BASE === */
@@ -515,6 +515,11 @@
515
515
  color: var(--awg-text);
516
516
  }
517
517
 
518
+ /* Hide dark mode toggle when host provides theme */
519
+ .awg-wrapper.awg-auto-theme .awg-theme-toggle {
520
+ display: none;
521
+ }
522
+
518
523
  /* === SCHEMA PANEL (LEFT) === */
519
524
  .awg-schema-panel {
520
525
  width: 0;
@@ -154,7 +154,7 @@ wheels = [
154
154
 
155
155
  [[package]]
156
156
  name = "anywidget-graph"
157
- version = "0.2.9"
157
+ version = "0.3.0"
158
158
  source = { editable = "." }
159
159
  dependencies = [
160
160
  { name = "anywidget" },