@nesso-how/graph 0.1.0-alpha.39 → 0.1.0-alpha.41

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 (2) hide show
  1. package/dist/NessoEdge.js +1 -22
  2. package/package.json +2 -2
package/dist/NessoEdge.js CHANGED
@@ -16,26 +16,6 @@ function categoryColor(cat, mode, palette) {
16
16
  return `var(--cat-${cat})`;
17
17
  return PALETTES[palette]?.[cat] ?? '#666666';
18
18
  }
19
- function EdgePathElement({ d, color, lineStyle, width = 1.5, opacity = 0.78, }) {
20
- const base = {
21
- fill: 'none',
22
- stroke: color,
23
- strokeWidth: width,
24
- opacity,
25
- strokeLinecap: 'round',
26
- };
27
- if (lineStyle === 'double') {
28
- return (_jsxs("g", { children: [_jsx("path", { d: d, fill: "none", stroke: "var(--paper, #ffffff)", strokeWidth: width + 3, opacity: 1 }), _jsx("path", { d: d, ...base, strokeWidth: width * 2.6 }), _jsx("path", { d: d, fill: "none", stroke: "var(--paper, #ffffff)", strokeWidth: width * 0.7, opacity: 1 })] }));
29
- }
30
- if (lineStyle === 'wavy') {
31
- return _jsx("path", { d: d, ...base, strokeDasharray: "1 4", strokeWidth: width * 1.2 });
32
- }
33
- if (lineStyle === 'dashed')
34
- return _jsx("path", { d: d, ...base, strokeDasharray: "6 5" });
35
- if (lineStyle === 'dotted')
36
- return _jsx("path", { d: d, ...base, strokeDasharray: "0.1 5", strokeWidth: width * 1.4 });
37
- return _jsx("path", { d: d, ...base });
38
- }
39
19
  export function NessoEdge({ id, source, target, data, selected }) {
40
20
  const [hovered, setHovered] = useState(false);
41
21
  const { edgeEncoding, curveStyle, autoCurveFlip, palette, categoryColorMode, getRelationLabel, isItemSelected, } = useGraphDisplay();
@@ -46,7 +26,6 @@ export function NessoEdge({ id, source, target, data, selected }) {
46
26
  const color = edgeEncoding === 'minimal'
47
27
  ? 'var(--ink-3, #888888)'
48
28
  : categoryColor(T.cat, categoryColorMode, palette);
49
- const lineStyle = edgeEncoding === 'minimal' ? 'solid' : T.line;
50
29
  const isSelected = selected || isItemSelected?.('edge', id) === true;
51
30
  const showLabel = edgeEncoding === 'full' || (edgeEncoding !== 'minimal' && (hovered || isSelected));
52
31
  const straight = curveStyle === 'straight';
@@ -87,7 +66,7 @@ export function NessoEdge({ id, source, target, data, selected }) {
87
66
  const w = isSelected ? 2 : 1.4;
88
67
  const op = isSelected || hovered ? 1 : 0.78;
89
68
  const r = 11;
90
- return (_jsxs("g", { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), style: { cursor: 'default' }, children: [_jsx("path", { d: path, stroke: "transparent", strokeWidth: 14, fill: "none" }), _jsx(EdgePathElement, { d: path, color: color, lineStyle: lineStyle, width: w, opacity: op }), T.inverse !== 'self' && edgeEncoding !== 'minimal' && (_jsx("polygon", { points: `${b.x},${b.y} ${ax1},${ay1} ${ax2},${ay2}`, fill: color, opacity: 0.85 })), edgeEncoding !== 'minimal' && (_jsxs("g", { style: { pointerEvents: 'all' }, children: [_jsx("circle", { cx: labelX, cy: labelY, r: r, fill: "var(--paper, #ffffff)", stroke: color, strokeWidth: 1.2 }), _jsx("g", { transform: `translate(${labelX - 7}, ${labelY - 7})`, children: _jsx(GlyphSVG, { kind: T.glyph, color: color, size: 14 }) })] })), showLabel && (_jsx("foreignObject", { x: labelX - 60, y: labelY + r + 2, width: 120, height: 20, style: { overflow: 'visible', pointerEvents: 'none' }, children: _jsx("div", { style: {
69
+ return (_jsxs("g", { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), style: { cursor: 'default' }, children: [_jsx("path", { d: path, stroke: "transparent", strokeWidth: 14, fill: "none" }), _jsx("path", { d: path, fill: "none", stroke: color, strokeWidth: w, opacity: op, strokeLinecap: "round" }), T.inverse !== 'self' && edgeEncoding !== 'minimal' && (_jsx("polygon", { points: `${b.x},${b.y} ${ax1},${ay1} ${ax2},${ay2}`, fill: color, opacity: 0.85 })), edgeEncoding !== 'minimal' && (_jsxs("g", { style: { pointerEvents: 'all' }, children: [_jsx("circle", { cx: labelX, cy: labelY, r: r, fill: "var(--paper, #ffffff)", stroke: color, strokeWidth: 1.2 }), _jsx("g", { transform: `translate(${labelX - 7}, ${labelY - 7})`, children: _jsx(GlyphSVG, { kind: T.glyph, color: color, size: 14 }) })] })), showLabel && (_jsx("foreignObject", { x: labelX - 60, y: labelY + r + 2, width: 120, height: 20, style: { overflow: 'visible', pointerEvents: 'none' }, children: _jsx("div", { style: {
91
70
  display: 'inline-block',
92
71
  background: 'var(--paper, #ffffff)',
93
72
  border: '0.5px solid var(--line, #d0d0d0)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nesso-how/graph",
3
- "version": "0.1.0-alpha.39",
3
+ "version": "0.1.0-alpha.41",
4
4
  "description": "Embeddable Nesso knowledge graph React component (read-only by default)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@nesso-how/vocab-learning": "0.1.0-alpha.39"
25
+ "@nesso-how/vocab-learning": "0.1.0-alpha.41"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@xyflow/react": "^12.6.4",