graph_widget 0.1.10__tar.gz → 0.1.11__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_widget
3
- Version: 0.1.10
3
+ Version: 0.1.11
4
4
  Requires-Dist: anywidget
5
5
  Requires-Dist: marimo
6
6
  Description-Content-Type: text/markdown
@@ -0,0 +1,59 @@
1
+ import marimo
2
+
3
+ __generated_with = "0.11.6"
4
+ app = marimo.App(width="full")
5
+
6
+
7
+ @app.cell
8
+ def _():
9
+ import anywidget
10
+ import traitlets
11
+ return anywidget, traitlets
12
+
13
+
14
+ @app.cell
15
+ def _(anywidget, traitlets):
16
+ class CounterWidget(anywidget.AnyWidget):
17
+ _esm = """
18
+ import ForceGraph3D from "https://esm.sh/3d-force-graph";
19
+ const N = 300;
20
+ const gData = {
21
+ nodes: [...Array(N).keys()].map(i => ({ id: i })),
22
+ links: [...Array(N).keys()]
23
+ .filter(id => id)
24
+ .map(id => ({
25
+ source: id,
26
+ target: Math.round(Math.random() * (id-1))
27
+ }))
28
+ };
29
+
30
+ function render({ model, el }) {
31
+ const create_plot = () => {
32
+ return ForceGraph3D()(el)
33
+ .graphData(gData)
34
+ }
35
+ create_plot()
36
+ }
37
+ export default { render };
38
+ """
39
+ _css = """
40
+ .counter-widget button { color: white; font-size: 1.75rem; background-color: #ea580c; padding: 0.5rem 1rem; border: none; border-radius: 0.25rem; }
41
+ .counter-widget button:hover { background-color: #9a3412; }
42
+ """
43
+ value = traitlets.Int(0).tag(sync=True)
44
+ return (CounterWidget,)
45
+
46
+
47
+ @app.cell
48
+ def _(CounterWidget):
49
+ CounterWidget()
50
+ return
51
+
52
+
53
+ @app.cell
54
+ def _():
55
+ return
56
+
57
+
58
+ if __name__ == "__main__":
59
+ app.run()
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "graph_widget"
7
- version = "0.1.10"
7
+ version = "0.1.11"
8
8
  dependencies = ["anywidget","marimo"]
9
9
  readme = "README.md"
10
10
 
@@ -45,6 +45,12 @@ const get_feature_type = (value) => {
45
45
  return 'categorical'; // Default to categorical if not numeric or hash_string
46
46
  }
47
47
 
48
+ const ua = navigator.userAgent.toLowerCase();
49
+
50
+ const isMac = ua.includes('macintosh');
51
+ const isWindows = ua.includes('windows');
52
+ const isLinux = ua.includes('linux');
53
+
48
54
  function render({ model, el }) {
49
55
  const debouncedSaveChanges = debounce(() => model.save_changes(), 300);
50
56
 
@@ -280,13 +286,10 @@ function render({ model, el }) {
280
286
 
281
287
  let my_brush = brush()
282
288
  .filter((event) => {
283
- // Prevent contextual menu on Ctrl-click (macOS)
284
- if (event.ctrlKey && event.button === 0) {
285
- event.preventDefault();
286
- }
289
+ const modifierKey = isMac ? event.metaKey : event.ctrlKey;
287
290
  return (
288
291
  !event.button && // Ignore mouse buttons other than left-click
289
- (event.metaKey || event.ctrlKey || event.target.__data__.type !== "overlay")
292
+ (modifierKey || event.target.__data__.type !== "overlay")
290
293
  )
291
294
  })
292
295
  .extent([[0, 0], [width, height]])
@@ -99,7 +99,7 @@ wheels = [
99
99
 
100
100
  [[package]]
101
101
  name = "graph-widget"
102
- version = "0.1.8"
102
+ version = "0.1.10"
103
103
  source = { editable = "." }
104
104
  dependencies = [
105
105
  { name = "anywidget" },
File without changes
File without changes
File without changes
File without changes
File without changes