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.
- {graph_widget-0.1.10 → graph_widget-0.1.11}/PKG-INFO +1 -1
- graph_widget-0.1.11/graph_3d_example.py +59 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/pyproject.toml +1 -1
- {graph_widget-0.1.10 → graph_widget-0.1.11}/src/graph_widget/static/widget.js +8 -5
- {graph_widget-0.1.10 → graph_widget-0.1.11}/uv.lock +1 -1
- {graph_widget-0.1.10 → graph_widget-0.1.11}/.gitignore +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/.python-version +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/README.md +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/README_DEV.md +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/bug_test.py +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/data.json +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/dev.py +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/example_2.py +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/multi_mst.json +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/src/graph_widget/__init__.py +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/src/graph_widget/dev.py +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/src/graph_widget/static/widget.css +0 -0
- {graph_widget-0.1.10 → graph_widget-0.1.11}/vis-forge-marimo.py +0 -0
|
@@ -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()
|
|
@@ -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
|
-
|
|
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
|
-
(
|
|
292
|
+
(modifierKey || event.target.__data__.type !== "overlay")
|
|
290
293
|
)
|
|
291
294
|
})
|
|
292
295
|
.extent([[0, 0], [width, height]])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|