@matdata/yasgui-graph-plugin 1.4.0 → 1.4.1

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.
@@ -51,7 +51,7 @@
51
51
  /* Graph plugin container */
52
52
  .yasgui-graph-plugin-container {
53
53
  width: 100%;
54
- height: 100%;
54
+ height: 500px; /* Initial fixed height as workaround for viz-network bug */
55
55
  position: relative;
56
56
  overflow: hidden;
57
57
  }
@@ -41,7 +41,7 @@
41
41
  }
42
42
  .yasgui-graph-plugin-container {
43
43
  width: 100%;
44
- height: 100%;
44
+ height: 500px;
45
45
  position: relative;
46
46
  overflow: hidden;
47
47
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../styles/index.css"],
4
- "sourcesContent": ["/* Color scheme variables */\r\n:root {\r\n /* Light theme colors (default) */\r\n --yasgui-graph-uri: #97C2FC;\r\n --yasgui-graph-literal: #a6c8a6ff;\r\n --yasgui-graph-blank-node: #c5c5c5ff;\r\n --yasgui-graph-type-object: #e15b13ff;\r\n --yasgui-graph-text: #000000;\r\n --yasgui-graph-edge: #cccccc;\r\n --yasgui-graph-edge-label: #666666;\r\n --yasgui-graph-edge-label-bg: rgba(255, 255, 255, 0.8);\r\n --yasgui-graph-background: #ffffff;\r\n \r\n /* Legacy variables for backward compatibility */\r\n --color-blank-node: #ffff00;\r\n --color-literal: #808080;\r\n --color-rdf-type: #00ff00;\r\n --color-uri: #0000ff;\r\n \r\n --color-blank-node-dark: #ffeb3b;\r\n --color-literal-dark: #9e9e9e;\r\n --color-rdf-type-dark: #4caf50;\r\n --color-uri-dark: #2196f3;\r\n \r\n --bg-light: #ffffff;\r\n --bg-dark: #1e1e1e;\r\n \r\n --text-light: #666666;\r\n --text-dark: #cccccc;\r\n --text-error: #f44336;\r\n \r\n --button-primary-bg: #4caf50;\r\n --button-primary-bg-hover: #45a049;\r\n --button-text: #ffffff;\r\n \r\n --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\r\n}\r\n/* Dark theme colors */\r\n[data-theme='dark'],\r\n.dark-theme {\r\n --yasgui-graph-uri: #97C2FC;\r\n --yasgui-graph-literal: #a6c8a6ff;\r\n --yasgui-graph-blank-node: #888888;\r\n --yasgui-graph-type-object: #e15b13ff;\r\n --yasgui-graph-text: #e0e0e0;\r\n --yasgui-graph-edge: #666666;\r\n --yasgui-graph-edge-label: #cccccc;\r\n --yasgui-graph-edge-label-bg: rgba(30, 30, 30, 0.8);\r\n --yasgui-graph-background: #1e1e1e;\r\n}\r\n/* Graph plugin container */\r\n.yasgui-graph-plugin-container {\r\n width: 100%;\r\n height: 100%;\r\n position: relative;\r\n overflow: hidden;\r\n}\r\n.yasgui-graph-plugin-container canvas {\r\n background-color: var(--yasgui-graph-canvas-bg, var(--bg-light));\r\n}\r\n.yasgui-graph-plugin-container[data-theme='dark'] canvas,\r\n.dark-theme .yasgui-graph-plugin-container canvas {\r\n background-color: var(--yasgui-graph-canvas-bg, var(--bg-dark));\r\n}\r\n.yasgui-graph-plugin-empty-state {\r\n padding: 20px;\r\n text-align: center;\r\n color: var(--text-light);\r\n}\r\n.dark-theme .yasgui-graph-plugin-empty-state {\r\n color: var(--text-dark);\r\n}\r\n.yasgui-graph-plugin-error {\r\n padding: 20px;\r\n color: var(--text-error);\r\n}\r\n/* Controls container */\r\n.yasgui-graph-controls {\r\n position: absolute;\r\n top: 10px;\r\n right: 10px;\r\n z-index: 10000;\r\n display: flex;\r\n gap: 10px;\r\n pointer-events: auto;\r\n}\r\n/* Button styles */\r\n.yasgui-graph-button {\r\n padding: 8px 12px;\r\n background: var(--button-primary-bg);\r\n color: var(--button-text);\r\n border: none;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n box-shadow: var(--box-shadow);\r\n transition: background 0.2s ease;\r\n}\r\n.yasgui-graph-button:hover {\r\n background: var(--button-primary-bg-hover);\r\n}\r\n.yasgui-graph-button:active {\r\n transform: translateY(1px);\r\n}\r\n/* Icon styles */\r\n.yasgui-graph-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.yasgui-graph-icon svg {\r\n width: 16px;\r\n height: 16px;\r\n fill: currentColor;\r\n}\r\n/* Main entry point for all styles */\r\n/* This file will be imported by the TypeScript code */\r\n"],
4
+ "sourcesContent": ["/* Color scheme variables */\r\n:root {\r\n /* Light theme colors (default) */\r\n --yasgui-graph-uri: #97C2FC;\r\n --yasgui-graph-literal: #a6c8a6ff;\r\n --yasgui-graph-blank-node: #c5c5c5ff;\r\n --yasgui-graph-type-object: #e15b13ff;\r\n --yasgui-graph-text: #000000;\r\n --yasgui-graph-edge: #cccccc;\r\n --yasgui-graph-edge-label: #666666;\r\n --yasgui-graph-edge-label-bg: rgba(255, 255, 255, 0.8);\r\n --yasgui-graph-background: #ffffff;\r\n \r\n /* Legacy variables for backward compatibility */\r\n --color-blank-node: #ffff00;\r\n --color-literal: #808080;\r\n --color-rdf-type: #00ff00;\r\n --color-uri: #0000ff;\r\n \r\n --color-blank-node-dark: #ffeb3b;\r\n --color-literal-dark: #9e9e9e;\r\n --color-rdf-type-dark: #4caf50;\r\n --color-uri-dark: #2196f3;\r\n \r\n --bg-light: #ffffff;\r\n --bg-dark: #1e1e1e;\r\n \r\n --text-light: #666666;\r\n --text-dark: #cccccc;\r\n --text-error: #f44336;\r\n \r\n --button-primary-bg: #4caf50;\r\n --button-primary-bg-hover: #45a049;\r\n --button-text: #ffffff;\r\n \r\n --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\r\n}\r\n/* Dark theme colors */\r\n[data-theme='dark'],\r\n.dark-theme {\r\n --yasgui-graph-uri: #97C2FC;\r\n --yasgui-graph-literal: #a6c8a6ff;\r\n --yasgui-graph-blank-node: #888888;\r\n --yasgui-graph-type-object: #e15b13ff;\r\n --yasgui-graph-text: #e0e0e0;\r\n --yasgui-graph-edge: #666666;\r\n --yasgui-graph-edge-label: #cccccc;\r\n --yasgui-graph-edge-label-bg: rgba(30, 30, 30, 0.8);\r\n --yasgui-graph-background: #1e1e1e;\r\n}\r\n/* Graph plugin container */\r\n.yasgui-graph-plugin-container {\r\n width: 100%;\r\n height: 500px; /* Initial fixed height as workaround for viz-network bug */\r\n position: relative;\r\n overflow: hidden;\r\n}\r\n.yasgui-graph-plugin-container canvas {\r\n background-color: var(--yasgui-graph-canvas-bg, var(--bg-light));\r\n}\r\n.yasgui-graph-plugin-container[data-theme='dark'] canvas,\r\n.dark-theme .yasgui-graph-plugin-container canvas {\r\n background-color: var(--yasgui-graph-canvas-bg, var(--bg-dark));\r\n}\r\n.yasgui-graph-plugin-empty-state {\r\n padding: 20px;\r\n text-align: center;\r\n color: var(--text-light);\r\n}\r\n.dark-theme .yasgui-graph-plugin-empty-state {\r\n color: var(--text-dark);\r\n}\r\n.yasgui-graph-plugin-error {\r\n padding: 20px;\r\n color: var(--text-error);\r\n}\r\n/* Controls container */\r\n.yasgui-graph-controls {\r\n position: absolute;\r\n top: 10px;\r\n right: 10px;\r\n z-index: 10000;\r\n display: flex;\r\n gap: 10px;\r\n pointer-events: auto;\r\n}\r\n/* Button styles */\r\n.yasgui-graph-button {\r\n padding: 8px 12px;\r\n background: var(--button-primary-bg);\r\n color: var(--button-text);\r\n border: none;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n box-shadow: var(--box-shadow);\r\n transition: background 0.2s ease;\r\n}\r\n.yasgui-graph-button:hover {\r\n background: var(--button-primary-bg-hover);\r\n}\r\n.yasgui-graph-button:active {\r\n transform: translateY(1px);\r\n}\r\n/* Icon styles */\r\n.yasgui-graph-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.yasgui-graph-icon svg {\r\n width: 16px;\r\n height: 16px;\r\n fill: currentColor;\r\n}\r\n/* Main entry point for all styles */\r\n/* This file will be imported by the TypeScript code */\r\n"],
5
5
  "mappings": ";AACA;AAEE,sBAAoB;AACpB,0BAAwB;AACxB,6BAA2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;AACX,cAAY,IAAI;AAChB,cAAY,WAAW,KAAK;AAC9B;AACA,CAXC,mBAWmB;AAClB,cAAY,IAAI;AAClB;AACA,CAdC,mBAcmB;AAClB,aAAW,WAAW;AACxB;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,mBAAiB;AACnB;AACA,CALC,kBAKkB;AACjB,SAAO;AACP,UAAQ;AACR,QAAM;AACR;",
6
6
  "names": []
7
7
  }
@@ -43,9 +43,6 @@ function truncateLabel(text, maxLength = 50) {
43
43
  // src/networkConfig.ts
44
44
  function getDefaultNetworkOptions(themeColors) {
45
45
  return {
46
- autoResize: true,
47
- width: "100%",
48
- height: "100%",
49
46
  // Configure canvas background color based on theme
50
47
  configure: {
51
48
  enabled: false
@@ -29714,6 +29711,7 @@ var GraphPlugin = class {
29714
29711
  this.network = null;
29715
29712
  this.currentTheme = getCurrentTheme();
29716
29713
  this.themeObserver = null;
29714
+ this.resizeObserver = null;
29717
29715
  this.nodesDataSet = null;
29718
29716
  this.edgesDataSet = null;
29719
29717
  this.triples = null;
@@ -29783,7 +29781,8 @@ var GraphPlugin = class {
29783
29781
  this.applyCanvasBackground(themeColors.background);
29784
29782
  this.network.on("stabilizationIterationsDone", () => {
29785
29783
  this.network.setOptions({ physics: { enabled: true } });
29786
- this.network.fit({ maxZoomLevel: 1e3 });
29784
+ this.network.fit({ maxZoomLevel: 3 });
29785
+ this.setupContainerResize(container);
29787
29786
  });
29788
29787
  if (!this.themeObserver) {
29789
29788
  this.themeObserver = watchThemeChanges((newTheme) => {
@@ -29838,6 +29837,29 @@ var GraphPlugin = class {
29838
29837
  this.network.body.container.style.setProperty("--yasgui-graph-canvas-bg", color);
29839
29838
  }
29840
29839
  }
29840
+ /**
29841
+ * Setup ResizeObserver to adjust container height based on parent
29842
+ * Workaround for viz-network bug: container must have fixed pixel height
29843
+ * @param container - The graph container element
29844
+ */
29845
+ setupContainerResize(container) {
29846
+ const parent2 = container.parentElement;
29847
+ if (!parent2) return;
29848
+ const updateHeight = () => {
29849
+ const parentHeight = parent2.clientHeight;
29850
+ if (parentHeight > 0) {
29851
+ container.style.height = `${parentHeight}px`;
29852
+ if (this.network) {
29853
+ this.network.fit({ maxZoomLevel: 1e3 });
29854
+ }
29855
+ }
29856
+ };
29857
+ updateHeight();
29858
+ this.resizeObserver = new ResizeObserver(() => {
29859
+ updateHeight();
29860
+ });
29861
+ this.resizeObserver.observe(parent2);
29862
+ }
29841
29863
  /**
29842
29864
  * Get icon for plugin tab
29843
29865
  * @returns Icon element
@@ -29864,6 +29886,10 @@ var GraphPlugin = class {
29864
29886
  this.themeObserver.disconnect();
29865
29887
  this.themeObserver = null;
29866
29888
  }
29889
+ if (this.resizeObserver) {
29890
+ this.resizeObserver.disconnect();
29891
+ this.resizeObserver = null;
29892
+ }
29867
29893
  if (this.network) {
29868
29894
  this.network.destroy();
29869
29895
  this.network = null;