@medicine-wheel/graph-viz 0.4.13 → 0.5.0
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.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interactive/DirectionQuadrant.d.ts +21 -3
- package/dist/interactive/DirectionQuadrant.d.ts.map +1 -1
- package/dist/interactive/DirectionQuadrant.js +55 -3
- package/dist/interactive/DirectionQuadrant.js.map +1 -1
- package/dist/interactive/GraphContextMenu.d.ts +61 -0
- package/dist/interactive/GraphContextMenu.d.ts.map +1 -0
- package/dist/interactive/GraphContextMenu.js +141 -0
- package/dist/interactive/GraphContextMenu.js.map +1 -0
- package/dist/interactive/MedicineWheelEdge.d.ts +17 -0
- package/dist/interactive/MedicineWheelEdge.d.ts.map +1 -0
- package/dist/interactive/MedicineWheelEdge.js +109 -0
- package/dist/interactive/MedicineWheelEdge.js.map +1 -0
- package/dist/interactive/MedicineWheelFlowGraph.d.ts +37 -1
- package/dist/interactive/MedicineWheelFlowGraph.d.ts.map +1 -1
- package/dist/interactive/MedicineWheelFlowGraph.js +410 -8
- package/dist/interactive/MedicineWheelFlowGraph.js.map +1 -1
- package/dist/interactive/MedicineWheelNode.d.ts +1 -1
- package/dist/interactive/MedicineWheelNode.d.ts.map +1 -1
- package/dist/interactive/MedicineWheelNode.js +23 -5
- package/dist/interactive/MedicineWheelNode.js.map +1 -1
- package/dist/interactive/index.d.ts +2 -0
- package/dist/interactive/index.d.ts.map +1 -1
- package/dist/interactive/index.js +9 -1
- package/dist/interactive/index.js.map +1 -1
- package/dist/layout.d.ts +22 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +63 -0
- package/dist/layout.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { MedicineWheelGraph } from './MedicineWheelGraph.js';
|
|
11
11
|
export type { MWGraphNode, MWGraphNodePosition, MWGraphNodePositions, MWGraphLink, MWGraphData, LinkStyle, LayoutMode, WheelLayoutConfig, MedicineWheelGraphProps, QuadrantGeometry, } from './types.js';
|
|
12
|
-
export { applyWheelLayout, DEFAULT_LAYOUT, getQuadrantGeometries, quadrantArcPath, curvedLinkPath, directionLabelPosition, } from './layout.js';
|
|
12
|
+
export { applyWheelLayout, DEFAULT_LAYOUT, getQuadrantGeometries, quadrantArcPath, curvedLinkPath, directionLabelPosition, directionForPoint, constrainToWheel, } from './layout.js';
|
|
13
13
|
export { nodesToGraphNodes, edgesToGraphLinks, relationsToGraphLinks, buildGraphData, } from './converters.js';
|
|
14
14
|
export type { KinshipGraphNode, KinshipGraphEdge, FlowDiagramNode, FlowDiagramLink, DirectionWheelSegment, TimelineEntry, } from './rsis-viz.js';
|
|
15
15
|
export { toKinshipGraphLayout, toReciprocityFlowDiagram, toDirectionWheelData, toCeremonyTimelineData, toMermaidDiagram, } from './rsis-viz.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.toMermaidDiagram = exports.toCeremonyTimelineData = exports.toDirectionWheelData = exports.toReciprocityFlowDiagram = exports.toKinshipGraphLayout = exports.buildGraphData = exports.relationsToGraphLinks = exports.edgesToGraphLinks = exports.nodesToGraphNodes = exports.directionLabelPosition = exports.curvedLinkPath = exports.quadrantArcPath = exports.getQuadrantGeometries = exports.DEFAULT_LAYOUT = exports.applyWheelLayout = exports.MedicineWheelGraph = void 0;
|
|
12
|
+
exports.toMermaidDiagram = exports.toCeremonyTimelineData = exports.toDirectionWheelData = exports.toReciprocityFlowDiagram = exports.toKinshipGraphLayout = exports.buildGraphData = exports.relationsToGraphLinks = exports.edgesToGraphLinks = exports.nodesToGraphNodes = exports.constrainToWheel = exports.directionForPoint = exports.directionLabelPosition = exports.curvedLinkPath = exports.quadrantArcPath = exports.getQuadrantGeometries = exports.DEFAULT_LAYOUT = exports.applyWheelLayout = exports.MedicineWheelGraph = void 0;
|
|
13
13
|
// ── Component ───────────────────────────────────────────────────────────────
|
|
14
14
|
var MedicineWheelGraph_js_1 = require("./MedicineWheelGraph.js");
|
|
15
15
|
Object.defineProperty(exports, "MedicineWheelGraph", { enumerable: true, get: function () { return MedicineWheelGraph_js_1.MedicineWheelGraph; } });
|
|
@@ -21,6 +21,8 @@ Object.defineProperty(exports, "getQuadrantGeometries", { enumerable: true, get:
|
|
|
21
21
|
Object.defineProperty(exports, "quadrantArcPath", { enumerable: true, get: function () { return layout_js_1.quadrantArcPath; } });
|
|
22
22
|
Object.defineProperty(exports, "curvedLinkPath", { enumerable: true, get: function () { return layout_js_1.curvedLinkPath; } });
|
|
23
23
|
Object.defineProperty(exports, "directionLabelPosition", { enumerable: true, get: function () { return layout_js_1.directionLabelPosition; } });
|
|
24
|
+
Object.defineProperty(exports, "directionForPoint", { enumerable: true, get: function () { return layout_js_1.directionForPoint; } });
|
|
25
|
+
Object.defineProperty(exports, "constrainToWheel", { enumerable: true, get: function () { return layout_js_1.constrainToWheel; } });
|
|
24
26
|
// ── Data Converters ─────────────────────────────────────────────────────────
|
|
25
27
|
var converters_js_1 = require("./converters.js");
|
|
26
28
|
Object.defineProperty(exports, "nodesToGraphNodes", { enumerable: true, get: function () { return converters_js_1.nodesToGraphNodes; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,+EAA+E;AAC/E,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAgB3B,+EAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,+EAA+E;AAC/E,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAgB3B,+EAA+E;AAC/E,yCASqB;AARnB,6GAAA,gBAAgB,OAAA;AAChB,2GAAA,cAAc,OAAA;AACd,kHAAA,qBAAqB,OAAA;AACrB,4GAAA,eAAe,OAAA;AACf,2GAAA,cAAc,OAAA;AACd,mHAAA,sBAAsB,OAAA;AACtB,8GAAA,iBAAiB,OAAA;AACjB,6GAAA,gBAAgB,OAAA;AAGlB,+EAA+E;AAC/E,iDAKyB;AAJvB,kHAAA,iBAAiB,OAAA;AACjB,kHAAA,iBAAiB,OAAA;AACjB,sHAAA,qBAAqB,OAAA;AACrB,+GAAA,cAAc,OAAA;AAahB,6CAMuB;AALrB,mHAAA,oBAAoB,OAAA;AACpB,uHAAA,wBAAwB,OAAA;AACxB,mHAAA,oBAAoB,OAAA;AACpB,qHAAA,sBAAsB,OAAA;AACtB,+GAAA,gBAAgB,OAAA"}
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @medicine-wheel/graph-viz — Direction quadrant backdrop
|
|
3
3
|
*
|
|
4
|
-
* Draws the four
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Draws the wheel made visible behind the nodes: four direction sectors,
|
|
5
|
+
* concentric rings, the four-direction cross, and bilingual direction
|
|
6
|
+
* labels (English + Ojibwe). Rendered in flow coordinates via
|
|
7
|
+
* `ViewportPortal` so the backdrop pans and zooms with the canvas.
|
|
8
|
+
*
|
|
9
|
+
* Colors: the canonical semantic direction colors live in ontology-core
|
|
10
|
+
* (`DIRECTION_COLORS`) and are NOT changed here. Presentation on the dark
|
|
11
|
+
* ground reads the app's `--mw-*` tokens with self-contained fallbacks —
|
|
12
|
+
* this is what makes West (semantically near-black) visible.
|
|
7
13
|
*
|
|
8
14
|
* The entire backdrop is `pointer-events: none` so it never steals drag /
|
|
9
15
|
* pan gestures from React Flow.
|
|
10
16
|
*/
|
|
11
17
|
import React from 'react';
|
|
18
|
+
import type { DirectionName } from '@medicine-wheel/ontology-core';
|
|
12
19
|
import type { WheelLayoutConfig } from '../types.js';
|
|
13
20
|
export interface DirectionQuadrantProps {
|
|
14
21
|
layout?: Partial<WheelLayoutConfig>;
|
|
15
22
|
showLabels?: boolean;
|
|
16
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Presentation tints per direction — CSS custom properties from the app's
|
|
26
|
+
* token system (`tokens.css`), with fallbacks so the package renders
|
|
27
|
+
* standalone. Direction color = information: these tints only ever mark
|
|
28
|
+
* the direction they belong to.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DIRECTION_PRESENTATION: Record<DirectionName, {
|
|
31
|
+
fill: string;
|
|
32
|
+
stroke: string;
|
|
33
|
+
ink: string;
|
|
34
|
+
}>;
|
|
17
35
|
export declare function DirectionQuadrant({ layout, showLabels, }: DirectionQuadrantProps): React.JSX.Element;
|
|
18
36
|
//# sourceMappingURL=DirectionQuadrant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionQuadrant.d.ts","sourceRoot":"","sources":["../../src/interactive/DirectionQuadrant.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"DirectionQuadrant.d.ts","sourceRoot":"","sources":["../../src/interactive/DirectionQuadrant.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAOnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,aAAa,EACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAsB9C,CAAC;AAQF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,UAAiB,GAClB,EAAE,sBAAsB,qBAiIxB"}
|
|
@@ -1,23 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DIRECTION_PRESENTATION = void 0;
|
|
3
4
|
exports.DirectionQuadrant = DirectionQuadrant;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const react_1 = require("@xyflow/react");
|
|
6
7
|
const layout_js_1 = require("../layout.js");
|
|
8
|
+
/**
|
|
9
|
+
* Presentation tints per direction — CSS custom properties from the app's
|
|
10
|
+
* token system (`tokens.css`), with fallbacks so the package renders
|
|
11
|
+
* standalone. Direction color = information: these tints only ever mark
|
|
12
|
+
* the direction they belong to.
|
|
13
|
+
*/
|
|
14
|
+
exports.DIRECTION_PRESENTATION = {
|
|
15
|
+
east: {
|
|
16
|
+
fill: 'var(--mw-east-quadrant, rgba(255, 215, 0, 0.05))',
|
|
17
|
+
stroke: 'var(--mw-east-border, rgba(255, 215, 0, 0.38))',
|
|
18
|
+
ink: 'var(--mw-east-ink, #FFD700)',
|
|
19
|
+
},
|
|
20
|
+
south: {
|
|
21
|
+
fill: 'var(--mw-south-quadrant, rgba(220, 38, 38, 0.06))',
|
|
22
|
+
stroke: 'var(--mw-south-border, rgba(220, 38, 38, 0.38))',
|
|
23
|
+
ink: 'var(--mw-south-ink, #FF7B72)',
|
|
24
|
+
},
|
|
25
|
+
west: {
|
|
26
|
+
fill: 'var(--mw-west-quadrant, rgba(107, 122, 153, 0.09))',
|
|
27
|
+
stroke: 'var(--mw-west-border, rgba(107, 122, 153, 0.44))',
|
|
28
|
+
ink: 'var(--mw-west-ink, #9FAEC9)',
|
|
29
|
+
},
|
|
30
|
+
north: {
|
|
31
|
+
fill: 'var(--mw-north-quadrant, rgba(247, 245, 240, 0.04))',
|
|
32
|
+
stroke: 'var(--mw-north-border, rgba(247, 245, 240, 0.38))',
|
|
33
|
+
ink: 'var(--mw-north-ink, #F7F5F0)',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const RING_STROKE = 'rgba(255, 255, 255, 0.07)';
|
|
37
|
+
const CROSS_STROKE = 'rgba(255, 255, 255, 0.09)';
|
|
38
|
+
/** Quadrant boundary angles (degrees): the four-direction cross. */
|
|
39
|
+
const CROSS_ANGLES = [45, 135, 225, 315];
|
|
7
40
|
function DirectionQuadrant({ layout, showLabels = true, }) {
|
|
8
41
|
const cfg = { ...layout_js_1.DEFAULT_LAYOUT, ...layout };
|
|
9
42
|
const quadrants = (0, layout_js_1.getQuadrantGeometries)(cfg);
|
|
10
43
|
const { centerX, centerY, radius, innerRadius = 60 } = cfg;
|
|
44
|
+
// Concentric rings: heart, midway breaths, and the rim.
|
|
45
|
+
const ringRadii = [
|
|
46
|
+
innerRadius,
|
|
47
|
+
innerRadius + (radius - innerRadius) / 3,
|
|
48
|
+
innerRadius + ((radius - innerRadius) * 2) / 3,
|
|
49
|
+
];
|
|
11
50
|
return ((0, jsx_runtime_1.jsx)(react_1.ViewportPortal, { children: (0, jsx_runtime_1.jsx)("svg", { style: {
|
|
12
51
|
position: 'absolute',
|
|
13
52
|
left: 0,
|
|
14
53
|
top: 0,
|
|
15
54
|
overflow: 'visible',
|
|
16
55
|
pointerEvents: 'none',
|
|
17
|
-
}, children: (0, jsx_runtime_1.jsxs)("g", { pointerEvents: "none", children: [quadrants.map((q) =>
|
|
56
|
+
}, "aria-hidden": "true", children: (0, jsx_runtime_1.jsxs)("g", { pointerEvents: "none", children: [quadrants.map((q) => {
|
|
57
|
+
const look = exports.DIRECTION_PRESENTATION[q.direction];
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)("path", { d: (0, layout_js_1.quadrantArcPath)(centerX, centerY, radius, innerRadius, q.startAngle, q.endAngle), style: { fill: look.fill, stroke: look.stroke }, strokeWidth: 1.25, pointerEvents: "none" }, q.direction));
|
|
59
|
+
}), ringRadii.map((r) => ((0, jsx_runtime_1.jsx)("circle", { cx: centerX, cy: centerY, r: r, fill: "none", stroke: RING_STROKE, strokeWidth: 1 }, `ring-${r}`))), (0, jsx_runtime_1.jsx)("circle", { cx: centerX, cy: centerY, r: radius, fill: "none", stroke: "rgba(255, 255, 255, 0.12)", strokeWidth: 1.5 }), CROSS_ANGLES.map((deg) => {
|
|
60
|
+
const rad = (deg * Math.PI) / 180;
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)("line", { x1: centerX + Math.cos(rad) * innerRadius, y1: centerY + Math.sin(rad) * innerRadius, x2: centerX + Math.cos(rad) * radius, y2: centerY + Math.sin(rad) * radius, stroke: CROSS_STROKE, strokeWidth: 1 }, `cross-${deg}`));
|
|
62
|
+
}), showLabels &&
|
|
18
63
|
quadrants.map((q) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
64
|
+
const rad = (q.centerAngle * Math.PI) / 180;
|
|
65
|
+
const labelRadius = radius - 44;
|
|
66
|
+
const x = centerX + Math.cos(rad) * labelRadius;
|
|
67
|
+
// Nudge south up so both text lines stay inside the rim.
|
|
68
|
+
const y = centerY +
|
|
69
|
+
Math.sin(rad) * labelRadius -
|
|
70
|
+
(q.direction === 'south' ? 14 : 0);
|
|
71
|
+
const ink = exports.DIRECTION_PRESENTATION[q.direction].ink;
|
|
72
|
+
return ((0, jsx_runtime_1.jsxs)("text", { x: x, y: y, textAnchor: "middle", style: { fill: ink }, fontSize: 15, fontWeight: 700, letterSpacing: "0.08em", opacity: 0.92, pointerEvents: "none", children: [q.label.toUpperCase(), (0, jsx_runtime_1.jsx)("tspan", { x: x, dy: 17, fontSize: 11.5, fontWeight: 400, letterSpacing: "0.02em", opacity: 0.85, children: q.ojibwe })] }, `label-${q.direction}`));
|
|
21
73
|
})] }) }) }));
|
|
22
74
|
}
|
|
23
75
|
//# sourceMappingURL=DirectionQuadrant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionQuadrant.js","sourceRoot":"","sources":["../../src/interactive/DirectionQuadrant.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DirectionQuadrant.js","sourceRoot":"","sources":["../../src/interactive/DirectionQuadrant.tsx"],"names":[],"mappings":";;;AAwEA,8CAoIC;;AA1LD,yCAA+C;AAI/C,4CAIsB;AAQtB;;;;;GAKG;AACU,QAAA,sBAAsB,GAG/B;IACF,IAAI,EAAE;QACJ,IAAI,EAAE,kDAAkD;QACxD,MAAM,EAAE,gDAAgD;QACxD,GAAG,EAAE,6BAA6B;KACnC;IACD,KAAK,EAAE;QACL,IAAI,EAAE,mDAAmD;QACzD,MAAM,EAAE,iDAAiD;QACzD,GAAG,EAAE,8BAA8B;KACpC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,oDAAoD;QAC1D,MAAM,EAAE,kDAAkD;QAC1D,GAAG,EAAE,6BAA6B;KACnC;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qDAAqD;QAC3D,MAAM,EAAE,mDAAmD;QAC3D,GAAG,EAAE,8BAA8B;KACpC;CACF,CAAC;AAEF,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAChD,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEjD,oEAAoE;AACpE,MAAM,YAAY,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzC,SAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,UAAU,GAAG,IAAI,GACM;IACvB,MAAM,GAAG,GAAsB,EAAE,GAAG,0BAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IAChE,MAAM,SAAS,GAAG,IAAA,iCAAqB,EAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,GAAG,CAAC;IAE3D,wDAAwD;IACxD,MAAM,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4BACpD,OAAO,CACL,kCAEE,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,UAAU,EAAC,QAAQ,EACnB,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EACpB,QAAQ,EAAE,EAAE,EACZ,UAAU,EAAE,GAAG,EACf,aAAa,EAAC,QAAQ,EACtB,OAAO,EAAE,IAAI,EACb,aAAa,EAAC,MAAM,aAEnB,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,EACtB,kCACE,CAAC,EAAE,CAAC,EACJ,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,IAAI,EACd,UAAU,EAAE,GAAG,EACf,aAAa,EAAC,QAAQ,EACtB,OAAO,EAAE,IAAI,YAEZ,CAAC,CAAC,MAAM,GACH,KArBH,SAAS,CAAC,CAAC,SAAS,EAAE,CAsBtB,CACR,CAAC;wBACJ,CAAC,CAAC,IACF,GACA,GACS,CAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/graph-viz — Graph context menus
|
|
3
|
+
*
|
|
4
|
+
* Presentational pieces for the node / edge / pane right-click menus:
|
|
5
|
+
* a positioned panel, menu items, and an inline "create node here" form
|
|
6
|
+
* (name + type, direction pre-read from the quadrant the click landed in).
|
|
7
|
+
* State and actions live in `MedicineWheelFlowGraph`.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import type { DirectionName, NodeType } from '@medicine-wheel/ontology-core';
|
|
11
|
+
/** Which menu is open, and where (pane-relative CSS px). */
|
|
12
|
+
export type GraphMenuState = {
|
|
13
|
+
kind: 'node';
|
|
14
|
+
nodeId: string;
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'edge';
|
|
19
|
+
edgeId: string;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
confirmRelease?: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'pane';
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
flowX: number;
|
|
28
|
+
flowY: number;
|
|
29
|
+
creating?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare function GraphContextMenu({ x, y, title, children, }: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
title?: React.ReactNode;
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
export declare function GraphMenuItem({ label, hint, onSelect, disabled, danger, }: {
|
|
38
|
+
label: React.ReactNode;
|
|
39
|
+
hint?: string;
|
|
40
|
+
onSelect?: () => void;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
danger?: boolean;
|
|
43
|
+
}): React.JSX.Element;
|
|
44
|
+
export declare function GraphMenuDivider(): React.JSX.Element;
|
|
45
|
+
/** Direction badge in the direction's ink. */
|
|
46
|
+
export declare function DirectionBadge({ direction }: {
|
|
47
|
+
direction: DirectionName;
|
|
48
|
+
}): React.JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* Inline "create node here" form. The direction comes from the quadrant
|
|
51
|
+
* the click landed in and travels with the request.
|
|
52
|
+
*/
|
|
53
|
+
export declare function CreateNodeInlineForm({ direction, onSubmit, onCancel, }: {
|
|
54
|
+
direction?: DirectionName;
|
|
55
|
+
onSubmit: (values: {
|
|
56
|
+
name: string;
|
|
57
|
+
type: NodeType;
|
|
58
|
+
}) => void;
|
|
59
|
+
onCancel: () => void;
|
|
60
|
+
}): React.JSX.Element;
|
|
61
|
+
//# sourceMappingURL=GraphContextMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphContextMenu.d.ts","sourceRoot":"","sources":["../../src/interactive/GraphContextMenu.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,aAAa,EAAE,QAA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aAAa,CAAA;CAAE,qBAiBzE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7D,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,qBAyFA"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphContextMenu = GraphContextMenu;
|
|
4
|
+
exports.GraphMenuItem = GraphMenuItem;
|
|
5
|
+
exports.GraphMenuDivider = GraphMenuDivider;
|
|
6
|
+
exports.DirectionBadge = DirectionBadge;
|
|
7
|
+
exports.CreateNodeInlineForm = CreateNodeInlineForm;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
/**
|
|
10
|
+
* @medicine-wheel/graph-viz — Graph context menus
|
|
11
|
+
*
|
|
12
|
+
* Presentational pieces for the node / edge / pane right-click menus:
|
|
13
|
+
* a positioned panel, menu items, and an inline "create node here" form
|
|
14
|
+
* (name + type, direction pre-read from the quadrant the click landed in).
|
|
15
|
+
* State and actions live in `MedicineWheelFlowGraph`.
|
|
16
|
+
*/
|
|
17
|
+
const react_1 = require("react");
|
|
18
|
+
const DirectionQuadrant_js_1 = require("./DirectionQuadrant.js");
|
|
19
|
+
const NODE_TYPE_OPTIONS = [
|
|
20
|
+
'human',
|
|
21
|
+
'land',
|
|
22
|
+
'spirit',
|
|
23
|
+
'ancestor',
|
|
24
|
+
'future',
|
|
25
|
+
'knowledge',
|
|
26
|
+
];
|
|
27
|
+
const panelStyle = {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
zIndex: 30,
|
|
30
|
+
minWidth: 200,
|
|
31
|
+
padding: 6,
|
|
32
|
+
borderRadius: 10,
|
|
33
|
+
background: 'var(--mw-card, #12122a)',
|
|
34
|
+
border: '1px solid var(--mw-border, rgba(255, 255, 255, 0.12))',
|
|
35
|
+
boxShadow: '0 10px 28px rgba(0, 0, 0, 0.5)',
|
|
36
|
+
fontSize: 13,
|
|
37
|
+
color: 'var(--mw-fg, #e5e7eb)',
|
|
38
|
+
};
|
|
39
|
+
const itemStyle = {
|
|
40
|
+
display: 'block',
|
|
41
|
+
width: '100%',
|
|
42
|
+
textAlign: 'left',
|
|
43
|
+
padding: '7px 10px',
|
|
44
|
+
borderRadius: 6,
|
|
45
|
+
border: 'none',
|
|
46
|
+
background: 'transparent',
|
|
47
|
+
color: 'inherit',
|
|
48
|
+
font: 'inherit',
|
|
49
|
+
cursor: 'pointer',
|
|
50
|
+
};
|
|
51
|
+
function GraphContextMenu({ x, y, title, children, }) {
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "mw-context-menu nodrag nopan", style: { ...panelStyle, left: x, top: y }, role: "menu", onContextMenu: (e) => e.preventDefault(), children: [title && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
53
|
+
padding: '5px 10px 7px',
|
|
54
|
+
fontSize: 11,
|
|
55
|
+
color: 'var(--mw-muted, #9ca3af)',
|
|
56
|
+
whiteSpace: 'nowrap',
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
textOverflow: 'ellipsis',
|
|
59
|
+
maxWidth: 240,
|
|
60
|
+
}, children: title })), children] }));
|
|
61
|
+
}
|
|
62
|
+
function GraphMenuItem({ label, hint, onSelect, disabled, danger, }) {
|
|
63
|
+
return ((0, jsx_runtime_1.jsxs)("button", { type: "button", role: "menuitem", className: "mw-context-menu-item", style: {
|
|
64
|
+
...itemStyle,
|
|
65
|
+
color: danger
|
|
66
|
+
? 'var(--mw-destructive-ink, #f87171)'
|
|
67
|
+
: disabled
|
|
68
|
+
? 'var(--mw-muted, #9ca3af)'
|
|
69
|
+
: 'inherit',
|
|
70
|
+
cursor: disabled ? 'default' : 'pointer',
|
|
71
|
+
}, onClick: disabled ? undefined : onSelect, disabled: disabled, children: [label, hint && ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
72
|
+
display: 'block',
|
|
73
|
+
fontSize: 10.5,
|
|
74
|
+
color: 'var(--mw-muted, #9ca3af)',
|
|
75
|
+
marginTop: 1,
|
|
76
|
+
}, children: hint }))] }));
|
|
77
|
+
}
|
|
78
|
+
function GraphMenuDivider() {
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
80
|
+
height: 1,
|
|
81
|
+
margin: '5px 8px',
|
|
82
|
+
background: 'var(--mw-border, rgba(255, 255, 255, 0.1))',
|
|
83
|
+
} }));
|
|
84
|
+
}
|
|
85
|
+
/** Direction badge in the direction's ink. */
|
|
86
|
+
function DirectionBadge({ direction }) {
|
|
87
|
+
const ink = DirectionQuadrant_js_1.DIRECTION_PRESENTATION[direction].ink;
|
|
88
|
+
return ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
89
|
+
display: 'inline-block',
|
|
90
|
+
padding: '1px 7px',
|
|
91
|
+
borderRadius: 999,
|
|
92
|
+
fontSize: 10.5,
|
|
93
|
+
fontWeight: 600,
|
|
94
|
+
color: ink,
|
|
95
|
+
border: `1px solid ${DirectionQuadrant_js_1.DIRECTION_PRESENTATION[direction].stroke}`,
|
|
96
|
+
}, children: direction }));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Inline "create node here" form. The direction comes from the quadrant
|
|
100
|
+
* the click landed in and travels with the request.
|
|
101
|
+
*/
|
|
102
|
+
function CreateNodeInlineForm({ direction, onSubmit, onCancel, }) {
|
|
103
|
+
const [name, setName] = (0, react_1.useState)('');
|
|
104
|
+
const [type, setType] = (0, react_1.useState)('human');
|
|
105
|
+
const fieldStyle = {
|
|
106
|
+
width: '100%',
|
|
107
|
+
padding: '6px 8px',
|
|
108
|
+
borderRadius: 6,
|
|
109
|
+
border: '1px solid var(--mw-border, rgba(255, 255, 255, 0.14))',
|
|
110
|
+
background: 'rgba(255, 255, 255, 0.05)',
|
|
111
|
+
color: 'inherit',
|
|
112
|
+
font: 'inherit',
|
|
113
|
+
fontSize: 12.5,
|
|
114
|
+
};
|
|
115
|
+
const submit = () => {
|
|
116
|
+
const trimmed = name.trim();
|
|
117
|
+
if (!trimmed)
|
|
118
|
+
return;
|
|
119
|
+
onSubmit({ name: trimmed, type });
|
|
120
|
+
};
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { padding: '4px 10px 8px', display: 'grid', gap: 6 }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
122
|
+
display: 'flex',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
justifyContent: 'space-between',
|
|
125
|
+
gap: 8,
|
|
126
|
+
fontSize: 11,
|
|
127
|
+
color: 'var(--mw-muted, #9ca3af)',
|
|
128
|
+
}, children: [(0, jsx_runtime_1.jsx)("span", { children: "New node" }), direction && (0, jsx_runtime_1.jsx)(DirectionBadge, { direction: direction })] }), (0, jsx_runtime_1.jsx)("input", { autoFocus: true, value: name, onChange: (e) => setName(e.target.value), onKeyDown: (e) => {
|
|
129
|
+
if (e.key === 'Enter')
|
|
130
|
+
submit();
|
|
131
|
+
if (e.key === 'Escape')
|
|
132
|
+
onCancel();
|
|
133
|
+
}, placeholder: "Name the being", "aria-label": "Node name", style: fieldStyle, className: "nodrag" }), (0, jsx_runtime_1.jsx)("select", { value: type, onChange: (e) => setType(e.target.value), "aria-label": "Node type", style: fieldStyle, className: "nodrag", children: NODE_TYPE_OPTIONS.map((t) => ((0, jsx_runtime_1.jsx)("option", { value: t, style: { background: '#101020' }, children: t }, t))) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 6 }, children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "mw-context-menu-item", onClick: submit, disabled: !name.trim(), style: {
|
|
134
|
+
...itemStyle,
|
|
135
|
+
flex: 1,
|
|
136
|
+
textAlign: 'center',
|
|
137
|
+
background: 'rgba(255, 255, 255, 0.1)',
|
|
138
|
+
opacity: name.trim() ? 1 : 0.5,
|
|
139
|
+
}, children: "Place node" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "mw-context-menu-item", onClick: onCancel, style: { ...itemStyle, flex: 0, textAlign: 'center' }, children: "Cancel" })] })] }));
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=GraphContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphContextMenu.js","sourceRoot":"","sources":["../../src/interactive/GraphContextMenu.tsx"],"names":[],"mappings":";;AAqEA,4CAoCC;AAED,sCA6CC;AAED,4CAUC;AAGD,wCAiBC;AAMD,oDAiGC;;AA/RD;;;;;;;GAOG;AAEH,iCAAwC;AAIxC,iEAAgE;AAqBhE,MAAM,iBAAiB,GAAe;IACpC,OAAO;IACP,MAAM;IACN,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,WAAW;CACZ,CAAC;AAEF,MAAM,UAAU,GAAwB;IACtC,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,EAAE;IAChB,UAAU,EAAE,yBAAyB;IACrC,MAAM,EAAE,uDAAuD;IAC/D,SAAS,EAAE,gCAAgC;IAC3C,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,uBAAuB;CAC/B,CAAC;AAEF,MAAM,SAAS,GAAwB;IACrC,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;IACjB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,CAAC;IACf,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,aAAa;IACzB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;CAClB,CAAC;AAEF,SAAgB,gBAAgB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,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,YACvD,CAAC,IADS,CAAC,CAEL,CACV,CAAC,GACK,EACT,iCAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,aACrC,mCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,sBAAsB,EAChC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EACtB,KAAK,EAAE;4BACL,GAAG,SAAS;4BACZ,IAAI,EAAE,CAAC;4BACP,SAAS,EAAE,QAAQ;4BACnB,UAAU,EAAE,0BAA0B;4BACtC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;yBAC/B,2BAGM,EACT,mCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,sBAAsB,EAChC,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,uBAG9C,IACL,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/graph-viz — Custom radial edge
|
|
3
|
+
*
|
|
4
|
+
* Floating edge for circular nodes: endpoints sit on each node's
|
|
5
|
+
* circumference (not its center), the path honors `MWGraphLink.curvature`
|
|
6
|
+
* as a quadratic arc around the wheel, and labels render as HTML pills via
|
|
7
|
+
* `EdgeLabelRenderer` so they stay legible over quadrant tints.
|
|
8
|
+
*
|
|
9
|
+
* Ceremony-honored links are the only elements allowed to glow gold:
|
|
10
|
+
* they get a gold→ember gradient stroke and, when animation is enabled
|
|
11
|
+
* and the user does not prefer reduced motion, a slow particle traveling
|
|
12
|
+
* the thread.
|
|
13
|
+
*/
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { type EdgeProps } from '@xyflow/react';
|
|
16
|
+
export declare function MedicineWheelEdge({ id, source, target, style, label, data, markerEnd, animated, selected, }: EdgeProps): React.JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=MedicineWheelEdge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MedicineWheelEdge.d.ts","sourceRoot":"","sources":["../../src/interactive/MedicineWheelEdge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AAwDvB,wBAAgB,iBAAiB,CAAC,EAChC,EAAE,EACF,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,EAAE,SAAS,4BAoGX"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MedicineWheelEdge = MedicineWheelEdge;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* @medicine-wheel/graph-viz — Custom radial edge
|
|
7
|
+
*
|
|
8
|
+
* Floating edge for circular nodes: endpoints sit on each node's
|
|
9
|
+
* circumference (not its center), the path honors `MWGraphLink.curvature`
|
|
10
|
+
* as a quadratic arc around the wheel, and labels render as HTML pills via
|
|
11
|
+
* `EdgeLabelRenderer` so they stay legible over quadrant tints.
|
|
12
|
+
*
|
|
13
|
+
* Ceremony-honored links are the only elements allowed to glow gold:
|
|
14
|
+
* they get a gold→ember gradient stroke and, when animation is enabled
|
|
15
|
+
* and the user does not prefer reduced motion, a slow particle traveling
|
|
16
|
+
* the thread.
|
|
17
|
+
*/
|
|
18
|
+
const react_1 = require("react");
|
|
19
|
+
const react_2 = require("@xyflow/react");
|
|
20
|
+
const layout_js_1 = require("../layout.js");
|
|
21
|
+
/** Point on a circle's circumference toward a target point. */
|
|
22
|
+
function circleEdgePoint(cx, cy, r, tx, ty) {
|
|
23
|
+
const dx = tx - cx;
|
|
24
|
+
const dy = ty - cy;
|
|
25
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
26
|
+
return { x: cx + (dx / len) * r, y: cy + (dy / len) * r };
|
|
27
|
+
}
|
|
28
|
+
/** Midpoint (t = 0.5) of the quadratic arc used by `curvedLinkPath`. */
|
|
29
|
+
function arcMidpoint(x1, y1, x2, y2, curvature) {
|
|
30
|
+
if (curvature === 0) {
|
|
31
|
+
return { x: (x1 + x2) / 2, y: (y1 + y2) / 2 };
|
|
32
|
+
}
|
|
33
|
+
const dx = x2 - x1;
|
|
34
|
+
const dy = y2 - y1;
|
|
35
|
+
const cx = (x1 + x2) / 2 - dy * curvature;
|
|
36
|
+
const cy = (y1 + y2) / 2 + dx * curvature;
|
|
37
|
+
return {
|
|
38
|
+
x: 0.25 * x1 + 0.5 * cx + 0.25 * x2,
|
|
39
|
+
y: 0.25 * y1 + 0.5 * cy + 0.25 * y2,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** SSR-safe `prefers-reduced-motion` subscription. */
|
|
43
|
+
function usePrefersReducedMotion() {
|
|
44
|
+
const [reduced, setReduced] = (0, react_1.useState)(false);
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
if (typeof window === 'undefined' || !window.matchMedia)
|
|
47
|
+
return;
|
|
48
|
+
const query = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
49
|
+
setReduced(query.matches);
|
|
50
|
+
const onChange = (event) => setReduced(event.matches);
|
|
51
|
+
query.addEventListener('change', onChange);
|
|
52
|
+
return () => query.removeEventListener('change', onChange);
|
|
53
|
+
}, []);
|
|
54
|
+
return reduced;
|
|
55
|
+
}
|
|
56
|
+
function MedicineWheelEdge({ id, source, target, style, label, data, markerEnd, animated, selected, }) {
|
|
57
|
+
const sourceNode = (0, react_2.useInternalNode)(source);
|
|
58
|
+
const targetNode = (0, react_2.useInternalNode)(target);
|
|
59
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
60
|
+
if (!sourceNode || !targetNode)
|
|
61
|
+
return null;
|
|
62
|
+
const edgeData = data;
|
|
63
|
+
const link = edgeData?.link;
|
|
64
|
+
const ceremony = link?.ceremonyHonored === true;
|
|
65
|
+
const curvature = link?.curvature ?? 0;
|
|
66
|
+
const dimmed = edgeData?.dimmed === true;
|
|
67
|
+
const sr = (sourceNode.measured.width ?? 26) / 2;
|
|
68
|
+
const tr = (targetNode.measured.width ?? 26) / 2;
|
|
69
|
+
const sc = {
|
|
70
|
+
x: sourceNode.internals.positionAbsolute.x + sr,
|
|
71
|
+
y: sourceNode.internals.positionAbsolute.y + sr,
|
|
72
|
+
};
|
|
73
|
+
const tc = {
|
|
74
|
+
x: targetNode.internals.positionAbsolute.x + tr,
|
|
75
|
+
y: targetNode.internals.positionAbsolute.y + tr,
|
|
76
|
+
};
|
|
77
|
+
const from = circleEdgePoint(sc.x, sc.y, sr, tc.x, tc.y);
|
|
78
|
+
const to = circleEdgePoint(tc.x, tc.y, tr, sc.x, sc.y);
|
|
79
|
+
const path = (0, layout_js_1.curvedLinkPath)(from.x, from.y, to.x, to.y, curvature);
|
|
80
|
+
const mid = arcMidpoint(from.x, from.y, to.x, to.y, curvature);
|
|
81
|
+
const gradientId = `mw-ceremony-${id}`;
|
|
82
|
+
const edgeStyle = {
|
|
83
|
+
...style,
|
|
84
|
+
...(ceremony ? { stroke: `url(#${gradientId})` } : undefined),
|
|
85
|
+
...(dimmed ? { opacity: 0.1 } : undefined),
|
|
86
|
+
transition: 'opacity 200ms ease',
|
|
87
|
+
};
|
|
88
|
+
const showParticle = ceremony && animated && !prefersReducedMotion && !dimmed;
|
|
89
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [ceremony && ((0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("linearGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", x1: from.x, y1: from.y, x2: to.x, y2: to.y, children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", stopColor: "#FFD700" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", stopColor: "#FF8C42" })] }) })), (0, jsx_runtime_1.jsx)(react_2.BaseEdge, { id: id, path: path, style: edgeStyle, markerEnd: markerEnd, interactionWidth: 16 }), showParticle && ((0, jsx_runtime_1.jsx)("circle", { r: 3, fill: "#FFD700", opacity: 0.9, pointerEvents: "none", children: (0, jsx_runtime_1.jsx)("animateMotion", { dur: "3.6s", repeatCount: "indefinite", path: path }) })), label && ((0, jsx_runtime_1.jsx)(react_2.EdgeLabelRenderer, { children: (0, jsx_runtime_1.jsx)("div", { className: "nodrag nopan mw-edge-label", style: {
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
transform: `translate(-50%, -50%) translate(${mid.x}px, ${mid.y}px)`,
|
|
92
|
+
background: 'var(--mw-edge-label-bg, rgba(10, 10, 26, 0.85))',
|
|
93
|
+
color: ceremony
|
|
94
|
+
? 'var(--mw-ceremony, #FFD700)'
|
|
95
|
+
: 'var(--mw-edge-label-fg, #cbd5e1)',
|
|
96
|
+
border: selected
|
|
97
|
+
? '1px solid var(--mw-north, #f7f5f0)'
|
|
98
|
+
: '1px solid rgba(255, 255, 255, 0.08)',
|
|
99
|
+
padding: '1px 6px',
|
|
100
|
+
borderRadius: 6,
|
|
101
|
+
fontSize: 10,
|
|
102
|
+
lineHeight: '14px',
|
|
103
|
+
whiteSpace: 'nowrap',
|
|
104
|
+
pointerEvents: 'all',
|
|
105
|
+
opacity: dimmed ? 0.1 : 1,
|
|
106
|
+
transition: 'opacity 200ms ease',
|
|
107
|
+
}, children: label }) }))] }));
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=MedicineWheelEdge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MedicineWheelEdge.js","sourceRoot":"","sources":["../../src/inter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AAE,aAAa,EAAC,MAAM,YAC7D,0CAAe,GAAG,EAAC,MAAM,EAAC,WAAW,EAAC,YAAY,EAAC,IAAI,EAAE,IAAI,GAAI,GAC1D,CACV,EACA,KAAK,IAAI,CACR,uBAAC,yBAAiB,cAChB,gCACE,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE;wBACL,QAAQ,EAAE,UAAU;wBACpB,SAAS,EAAE,mCAAmC,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,KAAK;wBACpE,UAAU,EAAE,iDAAiD;wBAC7D,KAAK,EAAE,QAAQ;4BACb,CAAC,CAAC,6BAA6B;4BAC/B,CAAC,CAAC,kCAAkC;wBACtC,MAAM,EAAE,QAAQ;4BACd,CAAC,CAAC,oCAAoC;4BACtC,CAAC,CAAC,qCAAqC;wBACzC,OAAO,EAAE,SAAS;wBAClB,YAAY,EAAE,CAAC;wBACf,QAAQ,EAAE,EAAE;wBACZ,UAAU,EAAE,MAAM;wBAClB,UAAU,EAAE,QAAQ;wBACpB,aAAa,EAAE,KAAK;wBACpB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;wBACzB,UAAU,EAAE,oBAAoB;qBACjC,YAEA,KAAK,GACF,GACY,CACrB,IACA,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* at the app level: `import '@xyflow/react/dist/style.css'`.
|
|
16
16
|
*/
|
|
17
17
|
import React from 'react';
|
|
18
|
-
import type {
|
|
18
|
+
import type { DirectionName, NodeType } from '@medicine-wheel/ontology-core';
|
|
19
|
+
import type { MWGraphData, MWGraphNode, MWGraphLink, MWGraphNodePositions, WheelLayoutConfig } from '../types.js';
|
|
19
20
|
export interface MedicineWheelFlowGraphProps {
|
|
20
21
|
/** Graph data (nodes + links). Re-layout happens whenever this changes. */
|
|
21
22
|
data: MWGraphData;
|
|
@@ -51,6 +52,41 @@ export interface MedicineWheelFlowGraphProps {
|
|
|
51
52
|
onNodeDoubleClick?: (node: MWGraphNode) => void;
|
|
52
53
|
/** Fired when user-dragged node positions should be persisted. */
|
|
53
54
|
onNodePositionsChange?: (positions: MWGraphNodePositions) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Enable weaving relations by dragging between nodes. Default: false.
|
|
57
|
+
* The optimistic edge appears immediately; the consumer persists it via
|
|
58
|
+
* `onRelationCreate` (and reloads `data` to canonicalize or revert).
|
|
59
|
+
*/
|
|
60
|
+
enableConnections?: boolean;
|
|
61
|
+
/** Fired when a connection gesture completes between two nodes. */
|
|
62
|
+
onRelationCreate?: (sourceId: string, targetId: string) => void;
|
|
63
|
+
/** Fired from the node menu's "Open node". Falls back to onNodeDoubleClick. */
|
|
64
|
+
onNodeOpen?: (node: MWGraphNode) => void;
|
|
65
|
+
/** Fired from the pane menu's "Create node here" inline form. */
|
|
66
|
+
onNodeCreateRequest?: (request: {
|
|
67
|
+
name: string;
|
|
68
|
+
type: NodeType;
|
|
69
|
+
direction?: DirectionName;
|
|
70
|
+
position: {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
};
|
|
74
|
+
}) => void;
|
|
75
|
+
/** Fired from the edge menu's "Honor ceremony". */
|
|
76
|
+
onEdgeCeremonyRequest?: (link: MWGraphLink) => void;
|
|
77
|
+
/** Fired from the edge menu's confirmed "Release relation". */
|
|
78
|
+
onEdgeDeleteRequest?: (link: MWGraphLink) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Ambient emphasis on one direction's beings (e.g. deep-link from the
|
|
81
|
+
* home wheel via ?direction=). Hover emphasis takes precedence.
|
|
82
|
+
*/
|
|
83
|
+
highlightDirection?: DirectionName;
|
|
84
|
+
/**
|
|
85
|
+
* Radial snapping while dragging/nudging. Default: 'off'.
|
|
86
|
+
* 'ring': beings stay in their band (direction ring / center heart).
|
|
87
|
+
* 'sector': additionally, beings stay inside their direction quadrant.
|
|
88
|
+
*/
|
|
89
|
+
radialSnap?: 'off' | 'ring' | 'sector';
|
|
54
90
|
}
|
|
55
91
|
/**
|
|
56
92
|
* Interactive Medicine Wheel graph. Self-contained: wraps its own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MedicineWheelFlowGraph.d.ts","sourceRoot":"","sources":["../../src/interactive/MedicineWheelFlowGraph.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"MedicineWheelFlowGraph.d.ts","sourceRoot":"","sources":["../../src/interactive/MedicineWheelFlowGraph.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AA6BjF,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAe7E,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAUrB,MAAM,WAAW,2BAA2B;IAC1C,2EAA2E;IAC3E,IAAI,EAAE,WAAW,CAAC;IAClB,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,4CAA4C;IAC5C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kDAAkD;IAClD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,6EAA6E;IAC7E,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,OAAO,CA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