@multiplatform.one/node-graph 9.0.11 → 9.2.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/cjs/graphLayout/GraphDots.cjs +60 -0
- package/dist/cjs/graphLayout/GraphDots.native.js +66 -0
- package/dist/cjs/graphLayout/GraphDots.native.js.map +1 -0
- package/dist/cjs/graphLayout/GraphLayout.cjs +153 -0
- package/dist/cjs/graphLayout/GraphLayout.native.js +163 -0
- package/dist/cjs/graphLayout/GraphLayout.native.js.map +1 -0
- package/dist/cjs/graphLayout/GraphSvg.cjs +68 -0
- package/dist/cjs/graphLayout/GraphSvg.native.js +73 -0
- package/dist/cjs/graphLayout/GraphSvg.native.js.map +1 -0
- package/dist/cjs/graphLayout/GraphViewport.cjs +264 -0
- package/dist/cjs/graphLayout/GraphViewport.native.js +280 -0
- package/dist/cjs/graphLayout/GraphViewport.native.js.map +1 -0
- package/dist/cjs/graphLayout/index.cjs +51 -0
- package/dist/cjs/graphLayout/index.native.js +54 -0
- package/dist/cjs/graphLayout/index.native.js.map +1 -0
- package/dist/cjs/graphLayout/ogden.fixture.cjs +30 -0
- package/dist/cjs/graphLayout/ogden.fixture.native.js +33 -0
- package/dist/cjs/graphLayout/ogden.fixture.native.js.map +1 -0
- package/dist/cjs/graphLayout/plan.cjs +263 -0
- package/dist/cjs/graphLayout/plan.native.js +372 -0
- package/dist/cjs/graphLayout/plan.native.js.map +1 -0
- package/dist/cjs/graphLayout/viewMath.cjs +142 -0
- package/dist/cjs/graphLayout/viewMath.native.js +147 -0
- package/dist/cjs/graphLayout/viewMath.native.js.map +1 -0
- package/dist/esm/NodeGraph.native.js.map +1 -1
- package/dist/esm/bench/frameSampler.native.js.map +1 -1
- package/dist/esm/bench/generateGraph.native.js.map +1 -1
- package/dist/esm/diagnostics/GraphDiagnostics.native.js.map +1 -1
- package/dist/esm/diagnostics/LiveGraphDiagnostics.native.js.map +1 -1
- package/dist/esm/diagnostics/fromWire.native.js.map +1 -1
- package/dist/esm/diagnostics/lastError.native.js.map +1 -1
- package/dist/esm/diagnostics/types.native.js.map +1 -1
- package/dist/esm/diagnostics/useGraphDiagnostics.native.js.map +1 -1
- package/dist/esm/dom/GraphDomLayout.native.js.map +1 -1
- package/dist/esm/dom/boot.native.js.map +1 -1
- package/dist/esm/dom/wire.native.js.map +1 -1
- package/dist/esm/edges/GraphEdge.native.js.map +1 -1
- package/dist/esm/edges/edgeKinds.native.js.map +1 -1
- package/dist/esm/edges/edgePath.native.js.map +1 -1
- package/dist/esm/edges/edgeRoute.native.js.map +1 -1
- package/dist/esm/edges/edgeStyle.native.js.map +1 -1
- package/dist/esm/edges/useEdgeObstacles.native.js.map +1 -1
- package/dist/esm/graphLayout/GraphDots.mjs +35 -0
- package/dist/esm/graphLayout/GraphDots.mjs.map +1 -0
- package/dist/esm/graphLayout/GraphDots.native.js +38 -0
- package/dist/esm/graphLayout/GraphDots.native.js.map +1 -0
- package/dist/esm/graphLayout/GraphLayout.mjs +127 -0
- package/dist/esm/graphLayout/GraphLayout.mjs.map +1 -0
- package/dist/esm/graphLayout/GraphLayout.native.js +134 -0
- package/dist/esm/graphLayout/GraphLayout.native.js.map +1 -0
- package/dist/esm/graphLayout/GraphSvg.mjs +42 -0
- package/dist/esm/graphLayout/GraphSvg.mjs.map +1 -0
- package/dist/esm/graphLayout/GraphSvg.native.js +44 -0
- package/dist/esm/graphLayout/GraphSvg.native.js.map +1 -0
- package/dist/esm/graphLayout/GraphViewport.mjs +239 -0
- package/dist/esm/graphLayout/GraphViewport.mjs.map +1 -0
- package/dist/esm/graphLayout/GraphViewport.native.js +252 -0
- package/dist/esm/graphLayout/GraphViewport.native.js.map +1 -0
- package/dist/esm/graphLayout/index.mjs +7 -0
- package/dist/esm/graphLayout/index.mjs.map +1 -0
- package/dist/esm/graphLayout/index.native.js +7 -0
- package/dist/esm/graphLayout/index.native.js.map +1 -0
- package/dist/esm/graphLayout/ogden.fixture.mjs +4 -0
- package/dist/esm/graphLayout/ogden.fixture.mjs.map +1 -0
- package/dist/esm/graphLayout/ogden.fixture.native.js +4 -0
- package/dist/esm/graphLayout/ogden.fixture.native.js.map +1 -0
- package/dist/esm/graphLayout/plan.mjs +235 -0
- package/dist/esm/graphLayout/plan.mjs.map +1 -0
- package/dist/esm/graphLayout/plan.native.js +341 -0
- package/dist/esm/graphLayout/plan.native.js.map +1 -0
- package/dist/esm/graphLayout/viewMath.mjs +105 -0
- package/dist/esm/graphLayout/viewMath.mjs.map +1 -0
- package/dist/esm/graphLayout/viewMath.native.js +107 -0
- package/dist/esm/graphLayout/viewMath.native.js.map +1 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/interaction/lassoIntercept.native.js.map +1 -1
- package/dist/esm/interaction/legalTargets.native.js.map +1 -1
- package/dist/esm/interaction/snapAlignment.native.js.map +1 -1
- package/dist/esm/interaction/snapChanges.native.js.map +1 -1
- package/dist/esm/interaction/spatialHash.native.js.map +1 -1
- package/dist/esm/interaction/useLassoSelect.native.js.map +1 -1
- package/dist/esm/knobs/KnobEnvelopeProvider.native.js.map +1 -1
- package/dist/esm/knobs/envelope.native.js.map +1 -1
- package/dist/esm/knobs/graphKnobs.native.js.map +1 -1
- package/dist/esm/knobs/useKnobEnvelope.native.js.map +1 -1
- package/dist/esm/layout/dagre.native.js.map +1 -1
- package/dist/esm/layout/layout.native.js.map +1 -1
- package/dist/esm/layout/runner.native.js.map +1 -1
- package/dist/esm/layout/structuredCloneShim.native.js.map +1 -1
- package/dist/esm/layout/types.native.js.map +1 -1
- package/dist/esm/layout/worker.entry.native.js.map +1 -1
- package/dist/esm/layout/worker.generated.native.js.map +1 -1
- package/dist/esm/model/commands.native.js.map +1 -1
- package/dist/esm/model/connect.native.js.map +1 -1
- package/dist/esm/model/document.native.js.map +1 -1
- package/dist/esm/model/history.native.js.map +1 -1
- package/dist/esm/model/index.native.js.map +1 -1
- package/dist/esm/model/schema.native.js.map +1 -1
- package/dist/esm/model/select.native.js.map +1 -1
- package/dist/esm/model/serialize.native.js.map +1 -1
- package/dist/esm/native/DomOnlyStory.native.js.map +1 -1
- package/dist/esm/native/GraphToolbar.native.js.map +1 -1
- package/dist/esm/native/domEntryRegistry.native.js.map +1 -1
- package/dist/esm/native/graphChildren.native.js.map +1 -1
- package/dist/esm/nodes/GraphNode.native.js.map +1 -1
- package/dist/esm/nodes/GraphPort.native.js.map +1 -1
- package/dist/esm/nodes/handleGeometry.native.js.map +1 -1
- package/dist/esm/nodes/lod.native.js.map +1 -1
- package/dist/esm/nodes/nodeMeasure.native.js.map +1 -1
- package/dist/esm/nodes/overviewNode.native.js.map +1 -1
- package/dist/esm/react-flow/ConnectionPuck.native.js.map +1 -1
- package/dist/esm/react-flow/GraphActions.native.js.map +1 -1
- package/dist/esm/react-flow/GraphCommandBridge.native.js.map +1 -1
- package/dist/esm/react-flow/GraphNodeHost.native.js.map +1 -1
- package/dist/esm/react-flow/GraphPaintProbe.native.js.map +1 -1
- package/dist/esm/react-flow/GraphZoomVar.native.js.map +1 -1
- package/dist/esm/react-flow/LassoOverlay.native.js.map +1 -1
- package/dist/esm/react-flow/NodeGraphWeb.native.js.map +1 -1
- package/dist/esm/react-flow/SnapGuides.native.js.map +1 -1
- package/dist/esm/react-flow/demoControlBody.native.js.map +1 -1
- package/dist/esm/react-flow/demoNodeBody.native.js.map +1 -1
- package/dist/esm/react-flow/fixtures.native.js.map +1 -1
- package/dist/esm/react-flow/flowAdapter.native.js.map +1 -1
- package/dist/esm/react-flow/graphHandle.native.js.map +1 -1
- package/dist/esm/react-flow/nodeCensus.native.js.map +1 -1
- package/dist/esm/react-flow/useGraphController.native.js.map +1 -1
- package/dist/esm/react-flow/xy.native.js.map +1 -1
- package/dist/esm/react-flow/xyPaths.native.js.map +1 -1
- package/dist/esm/theme/GraphFaces.native.js.map +1 -1
- package/dist/esm/theme/GraphVarsStyle.native.js.map +1 -1
- package/dist/esm/theme/faces.generated.native.js.map +1 -1
- package/dist/esm/theme/faces.native.js.map +1 -1
- package/dist/esm/theme/graphVars.native.js.map +1 -1
- package/dist/jsx/graphLayout/GraphDots.mjs +35 -0
- package/dist/jsx/graphLayout/GraphDots.mjs.map +1 -0
- package/dist/jsx/graphLayout/GraphDots.native.js +66 -0
- package/dist/jsx/graphLayout/GraphDots.native.js.map +1 -0
- package/dist/jsx/graphLayout/GraphLayout.mjs +127 -0
- package/dist/jsx/graphLayout/GraphLayout.mjs.map +1 -0
- package/dist/jsx/graphLayout/GraphLayout.native.js +163 -0
- package/dist/jsx/graphLayout/GraphLayout.native.js.map +1 -0
- package/dist/jsx/graphLayout/GraphSvg.mjs +42 -0
- package/dist/jsx/graphLayout/GraphSvg.mjs.map +1 -0
- package/dist/jsx/graphLayout/GraphSvg.native.js +73 -0
- package/dist/jsx/graphLayout/GraphSvg.native.js.map +1 -0
- package/dist/jsx/graphLayout/GraphViewport.mjs +239 -0
- package/dist/jsx/graphLayout/GraphViewport.mjs.map +1 -0
- package/dist/jsx/graphLayout/GraphViewport.native.js +280 -0
- package/dist/jsx/graphLayout/GraphViewport.native.js.map +1 -0
- package/dist/jsx/graphLayout/index.mjs +7 -0
- package/dist/jsx/graphLayout/index.mjs.map +1 -0
- package/dist/jsx/graphLayout/index.native.js +54 -0
- package/dist/jsx/graphLayout/index.native.js.map +1 -0
- package/dist/jsx/graphLayout/ogden.fixture.mjs +4 -0
- package/dist/jsx/graphLayout/ogden.fixture.mjs.map +1 -0
- package/dist/jsx/graphLayout/ogden.fixture.native.js +33 -0
- package/dist/jsx/graphLayout/ogden.fixture.native.js.map +1 -0
- package/dist/jsx/graphLayout/plan.mjs +235 -0
- package/dist/jsx/graphLayout/plan.mjs.map +1 -0
- package/dist/jsx/graphLayout/plan.native.js +372 -0
- package/dist/jsx/graphLayout/plan.native.js.map +1 -0
- package/dist/jsx/graphLayout/viewMath.mjs +105 -0
- package/dist/jsx/graphLayout/viewMath.mjs.map +1 -0
- package/dist/jsx/graphLayout/viewMath.native.js +147 -0
- package/dist/jsx/graphLayout/viewMath.native.js.map +1 -0
- package/graph-layout.ts +1 -0
- package/package.json +21 -6
- package/src/graphLayout/GraphDots.tsx +32 -0
- package/src/graphLayout/GraphLayout.stories.tsx +86 -0
- package/src/graphLayout/GraphLayout.tsx +152 -0
- package/src/graphLayout/GraphSvg.native.tsx +31 -0
- package/src/graphLayout/GraphSvg.tsx +45 -0
- package/src/graphLayout/GraphViewport.native.tsx +231 -0
- package/src/graphLayout/GraphViewport.tsx +247 -0
- package/src/graphLayout/index.ts +31 -0
- package/src/graphLayout/ogden.fixture.ts +120 -0
- package/src/graphLayout/plan.spec.ts +202 -0
- package/src/graphLayout/plan.ts +223 -0
- package/src/graphLayout/purity.spec.ts +67 -0
- package/src/graphLayout/viewMath.spec.ts +185 -0
- package/src/graphLayout/viewMath.ts +151 -0
- package/types/graphLayout/GraphDots.d.ts +9 -0
- package/types/graphLayout/GraphDots.d.ts.map +1 -0
- package/types/graphLayout/GraphLayout.d.ts +22 -0
- package/types/graphLayout/GraphLayout.d.ts.map +1 -0
- package/types/graphLayout/GraphSvg.d.ts +17 -0
- package/types/graphLayout/GraphSvg.d.ts.map +1 -0
- package/types/graphLayout/GraphSvg.native.d.ts +5 -0
- package/types/graphLayout/GraphSvg.native.d.ts.map +1 -0
- package/types/graphLayout/GraphViewport.d.ts +11 -0
- package/types/graphLayout/GraphViewport.d.ts.map +1 -0
- package/types/graphLayout/GraphViewport.native.d.ts +4 -0
- package/types/graphLayout/GraphViewport.native.d.ts.map +1 -0
- package/types/graphLayout/index.d.ts +11 -0
- package/types/graphLayout/index.d.ts.map +1 -0
- package/types/graphLayout/ogden.fixture.d.ts +3 -0
- package/types/graphLayout/ogden.fixture.d.ts.map +1 -0
- package/types/graphLayout/plan.d.ts +52 -0
- package/types/graphLayout/plan.d.ts.map +1 -0
- package/types/graphLayout/viewMath.d.ts +47 -0
- package/types/graphLayout/viewMath.d.ts.map +1 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { defaultKnobs, usePresetContext } from "@multiplatform.one/theme";
|
|
2
|
+
import { Fragment, useMemo, useState } from "react";
|
|
3
|
+
import { getTokenValue, useTheme, View } from "tamagui";
|
|
4
|
+
import { edgeStrokeWidth, themeTokenName } from "../edges/edgeStyle.mjs";
|
|
5
|
+
import { GraphPath, GraphSvg } from "./GraphSvg.mjs";
|
|
6
|
+
import { GraphViewport } from "./GraphViewport.mjs";
|
|
7
|
+
import { planGraphLayout } from "./plan.mjs";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
function resolveGraphDirection(direction, viewport) {
|
|
10
|
+
if (direction !== "auto") return direction;
|
|
11
|
+
return viewport.height > viewport.width ? "LR" : "TB";
|
|
12
|
+
}
|
|
13
|
+
function space(token) {
|
|
14
|
+
const value = getTokenValue(token, "space");
|
|
15
|
+
return typeof value === "number" ? value : 0;
|
|
16
|
+
}
|
|
17
|
+
function useStrokeWidth() {
|
|
18
|
+
const preset = usePresetContext();
|
|
19
|
+
const knobs = preset ? {
|
|
20
|
+
...preset.preset.knobs,
|
|
21
|
+
...preset.overrides
|
|
22
|
+
} : defaultKnobs;
|
|
23
|
+
return edgeStrokeWidth(knobs.borderWidth);
|
|
24
|
+
}
|
|
25
|
+
function useColour() {
|
|
26
|
+
const theme = useTheme();
|
|
27
|
+
return token => {
|
|
28
|
+
const value = theme[themeTokenName(token)]?.get?.();
|
|
29
|
+
return typeof value === "string" ? value : "currentColor";
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function GraphLayout({
|
|
33
|
+
nodes,
|
|
34
|
+
edges,
|
|
35
|
+
renderNode,
|
|
36
|
+
direction = "auto",
|
|
37
|
+
positions,
|
|
38
|
+
spacing,
|
|
39
|
+
dots = true,
|
|
40
|
+
frozen,
|
|
41
|
+
testID = "graph-layout"
|
|
42
|
+
}) {
|
|
43
|
+
const [viewport, setViewport] = useState({
|
|
44
|
+
width: 0,
|
|
45
|
+
height: 0
|
|
46
|
+
});
|
|
47
|
+
const strokeWidth = useStrokeWidth();
|
|
48
|
+
const colour = useColour();
|
|
49
|
+
const resolved = resolveGraphDirection(direction, viewport);
|
|
50
|
+
const nodeSpacing = space(spacing?.node ?? "$4");
|
|
51
|
+
const rankSpacing = space(spacing?.rank ?? "$8");
|
|
52
|
+
const margin = space("$4");
|
|
53
|
+
const pitch = space("$6");
|
|
54
|
+
const plan = useMemo(() => planGraphLayout({
|
|
55
|
+
nodes,
|
|
56
|
+
edges,
|
|
57
|
+
direction: resolved,
|
|
58
|
+
nodeSpacing,
|
|
59
|
+
rankSpacing,
|
|
60
|
+
margin,
|
|
61
|
+
strokeWidth,
|
|
62
|
+
wrapWidth: viewport.width > 0 ? viewport.width - margin * 2 : void 0,
|
|
63
|
+
positions
|
|
64
|
+
}), [nodes, edges, resolved, nodeSpacing, rankSpacing, margin, strokeWidth, viewport.width, positions]);
|
|
65
|
+
const onLayout = event => {
|
|
66
|
+
const {
|
|
67
|
+
width,
|
|
68
|
+
height
|
|
69
|
+
} = event.nativeEvent.layout;
|
|
70
|
+
if (width !== viewport.width || height !== viewport.height) setViewport({
|
|
71
|
+
width,
|
|
72
|
+
height
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const content = {
|
|
76
|
+
width: Math.max(plan.width, viewport.width),
|
|
77
|
+
height: Math.max(plan.height, viewport.height)
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */jsx(View, {
|
|
80
|
+
flex: 1,
|
|
81
|
+
onLayout,
|
|
82
|
+
testID,
|
|
83
|
+
"data-graph-direction": resolved,
|
|
84
|
+
children: viewport.width > 0 && viewport.height > 0 ? /* @__PURE__ */jsx(GraphViewport, {
|
|
85
|
+
content,
|
|
86
|
+
viewport,
|
|
87
|
+
dots: dots ? {
|
|
88
|
+
pitch,
|
|
89
|
+
dot: strokeWidth,
|
|
90
|
+
color: colour("$color6")
|
|
91
|
+
} : void 0,
|
|
92
|
+
frozen,
|
|
93
|
+
children: /* @__PURE__ */jsxs(View, {
|
|
94
|
+
width: content.width,
|
|
95
|
+
height: content.height,
|
|
96
|
+
children: [/* @__PURE__ */jsx(GraphSvg, {
|
|
97
|
+
width: plan.width,
|
|
98
|
+
height: plan.height,
|
|
99
|
+
children: plan.edges.map(edge => {
|
|
100
|
+
const paint = colour(edge.stroke);
|
|
101
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
102
|
+
children: [/* @__PURE__ */jsx(GraphPath, {
|
|
103
|
+
d: edge.d,
|
|
104
|
+
stroke: paint,
|
|
105
|
+
strokeWidth: edge.emphasis ? strokeWidth * 2 : strokeWidth,
|
|
106
|
+
dash: edge.dash
|
|
107
|
+
}), /* @__PURE__ */jsx(GraphPath, {
|
|
108
|
+
d: edge.head,
|
|
109
|
+
fill: paint
|
|
110
|
+
})]
|
|
111
|
+
}, edge.id);
|
|
112
|
+
})
|
|
113
|
+
}), plan.nodes.map(node => /* @__PURE__ */jsx(View, {
|
|
114
|
+
position: "absolute",
|
|
115
|
+
left: node.x,
|
|
116
|
+
top: node.y,
|
|
117
|
+
width: node.width,
|
|
118
|
+
height: node.height,
|
|
119
|
+
testID: `graph-node-${node.id}`,
|
|
120
|
+
children: renderNode(node.id)
|
|
121
|
+
}, node.id))]
|
|
122
|
+
})
|
|
123
|
+
}) : null
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export { GraphLayout, resolveGraphDirection };
|
|
127
|
+
//# sourceMappingURL=GraphLayout.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultKnobs","usePresetContext","Fragment","useMemo","useState","getTokenValue","useTheme","View","edgeStrokeWidth","themeTokenName","GraphPath","GraphSvg","GraphViewport","planGraphLayout","jsx","jsxs","resolveGraphDirection","direction","viewport","height","width","space","token","value","useStrokeWidth","preset","knobs","overrides","borderWidth","useColour","theme","get","GraphLayout","nodes","edges","renderNode","positions","spacing","dots","frozen","testID","setViewport","strokeWidth","colour","resolved","nodeSpacing","node","rankSpacing","rank","margin","pitch","plan","wrapWidth","onLayout","event","nativeEvent","layout","content","Math","max","flex","children","dot","color","map","edge","paint","stroke","d","emphasis","dash","head","fill","id","position","left","x","top","y"],"sources":["../../../src/graphLayout/GraphLayout.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,YAAA,EAAcC,gBAAA,QAAwB;AAC/C,SAASC,QAAA,EAAUC,OAAA,EAASC,QAAA,QAAgB;AAG5C,SAASC,aAAA,EAAeC,QAAA,EAAUC,IAAA,QAAY;AAC9C,SAASC,eAAA,EAAiBC,cAAA,QAAsB;AAEhD,SAASC,SAAA,EAAWC,QAAA,QAAgB;AACpC,SAASC,aAAA,QAAqB;AAC9B,SAASC,eAAA,QAAuB;AAgHd,SACEC,GAAA,EADFC,IAAA;AA9FX,SAASC,sBACdC,SAAA,EACAC,QAAA,EACgB;EAChB,IAAID,SAAA,KAAc,QAAQ,OAAOA,SAAA;EACjC,OAAOC,QAAA,CAASC,MAAA,GAASD,QAAA,CAASE,KAAA,GAAQ,OAAO;AACnD;AAEA,SAASC,MAAMC,KAAA,EAAgC;EAC7C,MAAMC,KAAA,GAAQlB,aAAA,CAAciB,KAAA,EAA8C,OAAO;EACjF,OAAO,OAAOC,KAAA,KAAU,WAAWA,KAAA,GAAQ;AAC7C;AAEA,SAASC,eAAA,EAAyB;EAChC,MAAMC,MAAA,GAASxB,gBAAA,CAAiB;EAChC,MAAMyB,KAAA,GAAQD,MAAA,GAAS;IAAE,GAAGA,MAAA,CAAOA,MAAA,CAAOC,KAAA;IAAO,GAAGD,MAAA,CAAOE;EAAU,IAAI3B,YAAA;EACzE,OAAOQ,eAAA,CAAgBkB,KAAA,CAAME,WAAW;AAC1C;AAEA,SAASC,UAAA,EAAuC;EAC9C,MAAMC,KAAA,GAAQxB,QAAA,CAAS;EACvB,OAAQgB,KAAA,IAAU;IAChB,MAAMC,KAAA,GAAQO,KAAA,CAAMrB,cAAA,CAAea,KAAK,CAAC,GAAGS,GAAA,GAAM;IAClD,OAAO,OAAOR,KA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CAAA,EAAGH,IAAA,CAAKG,CAAA;gBACRD,MAAA,EAAQD,KAAA;gBACRxB,WAAA,EAAauB,IAAA,CAAKI,QAAA,GAAW3B,WAAA,GAAc,IAAIA,WAAA;gBAC/C4B,IAAA,EAAML,IAAA,CAAKK;cAAA,CACb,GACA,eAAAxD,GAAA,CAACJ,SAAA;gBAAU0D,CAAA,EAAGH,IAAA,CAAKM,IAAA;gBAAMC,IAAA,EAAMN;cAAA,CAAO;YAAA,GAPzBD,IAAA,CAAKQ,EAQpB;UAEJ,CAAC;QAAA,CACH,GACCtB,IAAA,CAAKlB,KAAA,CAAM+B,GAAA,CAAKlB,IAAA,IACf,eAAAhC,GAAA,CAACP,IAAA;UAECmE,QAAA,EAAS;UACTC,IAAA,EAAM7B,IAAA,CAAK8B,CAAA;UACXC,GAAA,EAAK/B,IAAA,CAAKgC,CAAA;UACV1D,KAAA,EAAO0B,IAAA,CAAK1B,KAAA;UACZD,MAAA,EAAQ2B,IAAA,CAAK3B,MAAA;UACbqB,MAAA,EAAQ,cAAcM,IAAA,CAAK2B,EAAE;UAE5BZ,QAAA,EAAA1B,UAAA,CAAWW,IAAA,CAAK2B,EAAE;QAAA,GARd3B,IAAA,CAAK2B,EASZ,CACD;MAAA,CACH;IAAA,CACF,IACE;EAAA,CACN;AAEJ","ignoreList":[]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var GraphLayout_exports = {};
|
|
26
|
+
__export(GraphLayout_exports, {
|
|
27
|
+
GraphLayout: () => GraphLayout,
|
|
28
|
+
resolveGraphDirection: () => resolveGraphDirection
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(GraphLayout_exports);
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_theme = require("@multiplatform.one/theme");
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_tamagui = require("tamagui");
|
|
35
|
+
var import_edgeStyle = require("../edges/edgeStyle.native.js");
|
|
36
|
+
var import_GraphSvg = require("./GraphSvg.native.js");
|
|
37
|
+
var import_GraphViewport = require("./GraphViewport.native.js");
|
|
38
|
+
var import_plan = require("./plan.native.js");
|
|
39
|
+
function resolveGraphDirection(direction, viewport) {
|
|
40
|
+
if (direction !== "auto") return direction;
|
|
41
|
+
return viewport.height > viewport.width ? "LR" : "TB";
|
|
42
|
+
}
|
|
43
|
+
function space(token) {
|
|
44
|
+
var value = (0, import_tamagui.getTokenValue)(token, "space");
|
|
45
|
+
return typeof value === "number" ? value : 0;
|
|
46
|
+
}
|
|
47
|
+
function useStrokeWidth() {
|
|
48
|
+
var preset = (0, import_theme.usePresetContext)();
|
|
49
|
+
var knobs = preset ? {
|
|
50
|
+
...preset.preset.knobs,
|
|
51
|
+
...preset.overrides
|
|
52
|
+
} : import_theme.defaultKnobs;
|
|
53
|
+
return (0, import_edgeStyle.edgeStrokeWidth)(knobs.borderWidth);
|
|
54
|
+
}
|
|
55
|
+
function useColour() {
|
|
56
|
+
var theme = (0, import_tamagui.useTheme)();
|
|
57
|
+
return function (token) {
|
|
58
|
+
var _theme_themeTokenName_get, _theme_themeTokenName;
|
|
59
|
+
var value = (_theme_themeTokenName = theme[(0, import_edgeStyle.themeTokenName)(token)]) === null || _theme_themeTokenName === void 0 ? void 0 : (_theme_themeTokenName_get = _theme_themeTokenName.get) === null || _theme_themeTokenName_get === void 0 ? void 0 : _theme_themeTokenName_get.call(_theme_themeTokenName);
|
|
60
|
+
return typeof value === "string" ? value : "currentColor";
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function GraphLayout(param) {
|
|
64
|
+
var {
|
|
65
|
+
nodes,
|
|
66
|
+
edges,
|
|
67
|
+
renderNode,
|
|
68
|
+
direction = "auto",
|
|
69
|
+
positions,
|
|
70
|
+
spacing,
|
|
71
|
+
dots = true,
|
|
72
|
+
frozen,
|
|
73
|
+
testID = "graph-layout"
|
|
74
|
+
} = param;
|
|
75
|
+
var _ref, _ref1;
|
|
76
|
+
var [viewport, setViewport] = (0, import_react.useState)({
|
|
77
|
+
width: 0,
|
|
78
|
+
height: 0
|
|
79
|
+
});
|
|
80
|
+
var strokeWidth = useStrokeWidth();
|
|
81
|
+
var colour = useColour();
|
|
82
|
+
var resolved = resolveGraphDirection(direction, viewport);
|
|
83
|
+
var nodeSpacing = space((_ref = spacing === null || spacing === void 0 ? void 0 : spacing.node) !== null && _ref !== void 0 ? _ref : "$4");
|
|
84
|
+
var rankSpacing = space((_ref1 = spacing === null || spacing === void 0 ? void 0 : spacing.rank) !== null && _ref1 !== void 0 ? _ref1 : "$8");
|
|
85
|
+
var margin = space("$4");
|
|
86
|
+
var pitch = space("$6");
|
|
87
|
+
var plan = (0, import_react.useMemo)(function () {
|
|
88
|
+
return (0, import_plan.planGraphLayout)({
|
|
89
|
+
nodes,
|
|
90
|
+
edges,
|
|
91
|
+
direction: resolved,
|
|
92
|
+
nodeSpacing,
|
|
93
|
+
rankSpacing,
|
|
94
|
+
margin,
|
|
95
|
+
strokeWidth,
|
|
96
|
+
wrapWidth: viewport.width > 0 ? viewport.width - margin * 2 : void 0,
|
|
97
|
+
positions
|
|
98
|
+
});
|
|
99
|
+
}, [nodes, edges, resolved, nodeSpacing, rankSpacing, margin, strokeWidth, viewport.width, positions]);
|
|
100
|
+
var onLayout = function onLayout2(event) {
|
|
101
|
+
var {
|
|
102
|
+
width,
|
|
103
|
+
height
|
|
104
|
+
} = event.nativeEvent.layout;
|
|
105
|
+
if (width !== viewport.width || height !== viewport.height) setViewport({
|
|
106
|
+
width,
|
|
107
|
+
height
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
var content = {
|
|
111
|
+
width: Math.max(plan.width, viewport.width),
|
|
112
|
+
height: Math.max(plan.height, viewport.height)
|
|
113
|
+
};
|
|
114
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
115
|
+
flex: 1,
|
|
116
|
+
onLayout,
|
|
117
|
+
testID,
|
|
118
|
+
"data-graph-direction": resolved,
|
|
119
|
+
children: viewport.width > 0 && viewport.height > 0 ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GraphViewport.GraphViewport, {
|
|
120
|
+
content,
|
|
121
|
+
viewport,
|
|
122
|
+
dots: dots ? {
|
|
123
|
+
pitch,
|
|
124
|
+
dot: strokeWidth,
|
|
125
|
+
color: colour("$color6")
|
|
126
|
+
} : void 0,
|
|
127
|
+
frozen,
|
|
128
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.View, {
|
|
129
|
+
width: content.width,
|
|
130
|
+
height: content.height,
|
|
131
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GraphSvg.GraphSvg, {
|
|
132
|
+
width: plan.width,
|
|
133
|
+
height: plan.height,
|
|
134
|
+
children: plan.edges.map(function (edge) {
|
|
135
|
+
var paint = colour(edge.stroke);
|
|
136
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_react.Fragment, {
|
|
137
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GraphSvg.GraphPath, {
|
|
138
|
+
d: edge.d,
|
|
139
|
+
stroke: paint,
|
|
140
|
+
strokeWidth: edge.emphasis ? strokeWidth * 2 : strokeWidth,
|
|
141
|
+
dash: edge.dash
|
|
142
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GraphSvg.GraphPath, {
|
|
143
|
+
d: edge.head,
|
|
144
|
+
fill: paint
|
|
145
|
+
})]
|
|
146
|
+
}, edge.id);
|
|
147
|
+
})
|
|
148
|
+
}), plan.nodes.map(function (node) {
|
|
149
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
150
|
+
position: "absolute",
|
|
151
|
+
left: node.x,
|
|
152
|
+
top: node.y,
|
|
153
|
+
width: node.width,
|
|
154
|
+
height: node.height,
|
|
155
|
+
testID: `graph-node-${node.id}`,
|
|
156
|
+
children: renderNode(node.id)
|
|
157
|
+
}, node.id);
|
|
158
|
+
})]
|
|
159
|
+
})
|
|
160
|
+
}) : null
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=GraphLayout.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","GraphLayout_exports","GraphLayout","resolveGraphDirection","module","exports","import_jsx_runtime","require","import_theme","import_react","import_tamagui","import_edgeStyle","import_GraphSvg","import_GraphViewport","import_plan","direction","viewport","height","width","space","token","getTokenValue","useStrokeWidth","preset","usePresetContext","knobs","overrides","defaultKnobs","edgeStrokeWidth","borderWidth","useColour","theme","useTheme","_theme_themeTokenName_get","_theme_themeTokenName","themeTokenName","param","nodes","edges","renderNode","positions","spacing","dots","frozen","testID","_ref","_ref1","setViewport","useState","strokeWidth","colour","resolved","nodeSpacing","node","rankSpacing","rank","margin","pitch","plan","useMemo","planGraphLayout","wrapWidth","onLayout","onLayout2","event","nativeEvent","layout","content","Math","max","jsx","View","flex","children","GraphViewport","dot","color","jsxs"],"sources":["../../../src/graphLayout/GraphLayout.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAU,CAAAC,cAAS;AAG5B,IAAAC,gBAAS,GAAAF,MAAe,CAAAG,wBAAsB;AAC9C,IAAAC,iBAAS,GAAAJ,MAAiB,CAAAK,mBAAsB;AAEhD,IAAAC,YAAS,GAAAN,MAAW,CAAAO,SAAA,CAAgBC,cAAA;AACpC,IAAAC,QAAS,GAAAA,CAAAC,MAAA,EAAAC,GAAA,KAAqB;EAC9B,SAASC,IAAA,IAAAD,GAAA,EAgHSZ,SACE,CADFW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AA9FX;AAIL,IAAAC,WAAI,GAAAA,CAAAC,EAAc,EAAAC,IAAQ,EAAAC,MAAO,EAAAC,IAAA;EACjC,IAAAF,IAAO,WAASA,IAAA,KAAS,QAAS,WAAQA,IAAO;IACnD,SAAAG,GAAA,IAAAhB,iBAAA,CAAAa,IAAA,GAEA,IAAS,CAAAX,YAAsC,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EACvCnB,SAAQ,CAAAiB,EAAA,EAAAI,GAAA;MAAAP,GAAc,EAAAA,CAAA,KAA8CI,IAAO,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAjB,gBAAA,CAAAe,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EACjF;EACF,OAAAE,EAAA;AAEA;AACE,IAAAM,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
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function GraphSvg({
|
|
3
|
+
width,
|
|
4
|
+
height,
|
|
5
|
+
children
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */jsx("svg", {
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
"aria-hidden": true,
|
|
11
|
+
style: {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
left: 0,
|
|
14
|
+
top: 0,
|
|
15
|
+
overflow: "visible",
|
|
16
|
+
pointerEvents: "none"
|
|
17
|
+
},
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function GraphPath({
|
|
22
|
+
d,
|
|
23
|
+
stroke,
|
|
24
|
+
strokeWidth,
|
|
25
|
+
dash,
|
|
26
|
+
fill,
|
|
27
|
+
round
|
|
28
|
+
}) {
|
|
29
|
+
return /* @__PURE__ */jsx("path", {
|
|
30
|
+
d,
|
|
31
|
+
style: {
|
|
32
|
+
fill: fill ?? "none",
|
|
33
|
+
stroke: stroke ?? "none",
|
|
34
|
+
strokeWidth,
|
|
35
|
+
strokeDasharray: dash,
|
|
36
|
+
strokeLinecap: round ? "round" : "butt",
|
|
37
|
+
strokeLinejoin: "round"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { GraphPath, GraphSvg };
|
|
42
|
+
//# sourceMappingURL=GraphSvg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["jsx","GraphSvg","width","height","children","style","position","left","top","overflow","pointerEvents","GraphPath","d","stroke","strokeWidth","dash","fill","round","strokeDasharray","strokeLinecap","strokeLinejoin"],"sources":["../../../src/graphLayout/GraphSvg.tsx"],"sourcesContent":[null],"mappings":"AAmBI,SAAAA,GAAA;AAFG,SAASC,SAAS;EAAEC,KAAA;EAAOC,MAAA;EAAQC;AAAS,GAAkB;EACnE,OACE,eAAAJ,GAAA,CAAC;IACCE,KAAA;IACAC,MAAA;IACA,eAAW;IACXE,KAAA,EAAO;MAAEC,QAAA,EAAU;MAAYC,IAAA,EAAM;MAAGC,GAAA,EAAK;MAAGC,QAAA,EAAU;MAAWC,aAAA,EAAe;IAAO;IAE1FN;EAAA,CACH;AAEJ;AAEO,SAASO,UAAU;EAAEC,CAAA;EAAGC,MAAA;EAAQC,WAAA;EAAaC,IAAA;EAAMC,IAAA;EAAMC;AAAM,GAAmB;EACvF,OACE,eAAAjB,GAAA,CAAC;IACCY,CAAA;IACAP,KAAA,EAAO;MACLW,IAAA,EAAMA,IAAA,IAAQ;MACdH,MAAA,EAAQA,MAAA,IAAU;MAClBC,WAAA;MACAI,eAAA,EAAiBH,IAAA;MACjBI,aAAA,EAAeF,KAAA,GAAQ,UAAU;MACjCG,cAAA,EAAgB;IAClB;EAAA,CACF;AAEJ","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var GraphSvg_exports = {};
|
|
26
|
+
__export(GraphSvg_exports, {
|
|
27
|
+
GraphPath: () => GraphPath,
|
|
28
|
+
GraphSvg: () => GraphSvg
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(GraphSvg_exports);
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
function GraphSvg(param) {
|
|
33
|
+
var {
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
children
|
|
37
|
+
} = param;
|
|
38
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("svg", {
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
41
|
+
"aria-hidden": true,
|
|
42
|
+
style: {
|
|
43
|
+
position: "absolute",
|
|
44
|
+
left: 0,
|
|
45
|
+
top: 0,
|
|
46
|
+
overflow: "visible",
|
|
47
|
+
pointerEvents: "none"
|
|
48
|
+
},
|
|
49
|
+
children
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function GraphPath(param) {
|
|
53
|
+
var {
|
|
54
|
+
d,
|
|
55
|
+
stroke,
|
|
56
|
+
strokeWidth,
|
|
57
|
+
dash,
|
|
58
|
+
fill,
|
|
59
|
+
round
|
|
60
|
+
} = param;
|
|
61
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("path", {
|
|
62
|
+
d,
|
|
63
|
+
style: {
|
|
64
|
+
fill: fill !== null && fill !== void 0 ? fill : "none",
|
|
65
|
+
stroke: stroke !== null && stroke !== void 0 ? stroke : "none",
|
|
66
|
+
strokeWidth,
|
|
67
|
+
strokeDasharray: dash,
|
|
68
|
+
strokeLinecap: round ? "round" : "butt",
|
|
69
|
+
strokeLinejoin: "round"
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=GraphSvg.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","GraphSvg_exports","GraphPath","GraphSvg","module","exports","import_jsx_runtime","require","param","width","height","children","jsx"],"sources":["../../../src/graphLayout/GraphSvg.tsx"],"sourcesContent":[null],"mappings":"AAmBI;;AAFG,IAAAA,SAAS,GAAAC,MAAW,CAAAC,cAAe;AACxC,IAAAC,gBACE,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IAACC,iBAAA,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IAAAC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAAA,IAAAC,QACC,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EAAA,KACA,IAAAC,IAAA,IAAAD,GAAA,EAAAZ,SACA,CAAAW,MAAA,EAAWE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;AACgF,IAAAC,WAE1F,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EAAA,IAAAF,IAAA,WAAAA,IAAA,wBAAAA,IAAA;IACH,SAAAG,GAAA,IAAAhB,iBAAA,CAAAa,IAAA,GAEJ,KAAAX,YAAA,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EAEOnB,SAAS,CAAAiB,EAAU,EAAEI,GAAG;MAAAP,GAAQ,EAAAA,CAAA,KAAAI,IAAA,CAAaG,GAAA;MAAMN,UAAM,EAAM,EAAAK,IAAmB,GAAAjB,gBAAA,CAAAe,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EACvF;EACE,OAACE,EAAA;AAAA;AAAA,IAAAM,YACC,GAAAC,GAAA,IAAAR,WAAA,CAAAhB,SAAA;EAAAyB,KAAA;AAAA,IAAAD,GAAA;AAAA,IAAAE,gBACO;AAAAhB,QACL,CAAAgB,gBAAc;EAAAC,SACd,EAAAA,CAAA,KAAQA,SAAU;EAAAC,QAClB,EAAAA,CAAA,KAAAA;AAAA;AACiBC,MAAA,CAAAC,OACjB,GAAAP,YAAe,CAAAG,gBAAkB;AAAA,IAAAK,kBACjC,GAAgBC,OAAA;AAAA,SAClBJ,SAAAK,KAAA;EAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC;EAAA,IAAAH,KAAA;EACF,0BAAAF,kBAAA,CAAAM,GAAA;IAEJH,KAAA","ignoreList":[]}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { ScrollView, View } from "tamagui";
|
|
3
|
+
import { GraphDots } from "./GraphDots.mjs";
|
|
4
|
+
import { dotArea, dotPitch, keyedView, leastScale, sameArea, toggledView, zoomAt } from "./viewMath.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
function editable(target) {
|
|
7
|
+
const element = target;
|
|
8
|
+
return Boolean(element?.isContentEditable) || ["INPUT", "TEXTAREA", "SELECT"].includes(element?.tagName ?? "");
|
|
9
|
+
}
|
|
10
|
+
function onNode(target) {
|
|
11
|
+
const element = target;
|
|
12
|
+
return Boolean(element?.closest?.("[data-testid^='graph-node-']"));
|
|
13
|
+
}
|
|
14
|
+
function GraphViewport({
|
|
15
|
+
content,
|
|
16
|
+
viewport,
|
|
17
|
+
dots,
|
|
18
|
+
frozen,
|
|
19
|
+
children
|
|
20
|
+
}) {
|
|
21
|
+
const scroller = useRef(null);
|
|
22
|
+
const [scale, setScale] = useState(1);
|
|
23
|
+
const [scroll, setScroll] = useState({
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0
|
|
26
|
+
});
|
|
27
|
+
const offset = useRef({
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0
|
|
30
|
+
});
|
|
31
|
+
const pending = useRef(void 0);
|
|
32
|
+
const shown = Math.min(1, Math.max(leastScale(content, viewport), scale));
|
|
33
|
+
const wide = content.width * shown;
|
|
34
|
+
const tall = content.height * shown;
|
|
35
|
+
const pad = {
|
|
36
|
+
x: Math.max(0, (viewport.width - wide) / 2),
|
|
37
|
+
y: Math.max(0, (viewport.height - tall) / 2)
|
|
38
|
+
};
|
|
39
|
+
const live = useRef({
|
|
40
|
+
shown,
|
|
41
|
+
pad,
|
|
42
|
+
content,
|
|
43
|
+
viewport,
|
|
44
|
+
frozen
|
|
45
|
+
});
|
|
46
|
+
live.current = {
|
|
47
|
+
shown,
|
|
48
|
+
pad,
|
|
49
|
+
content,
|
|
50
|
+
viewport,
|
|
51
|
+
frozen
|
|
52
|
+
};
|
|
53
|
+
const node = () => scroller.current?.getScrollableNode?.() ?? void 0;
|
|
54
|
+
const now = () => ({
|
|
55
|
+
scale: live.current.shown,
|
|
56
|
+
x: live.current.pad.x - offset.current.x,
|
|
57
|
+
y: live.current.pad.y - offset.current.y
|
|
58
|
+
});
|
|
59
|
+
const apply = next => {
|
|
60
|
+
const {
|
|
61
|
+
content: size,
|
|
62
|
+
viewport: view
|
|
63
|
+
} = live.current;
|
|
64
|
+
const padX = Math.max(0, (view.width - size.width * next.scale) / 2);
|
|
65
|
+
const padY = Math.max(0, (view.height - size.height * next.scale) / 2);
|
|
66
|
+
pending.current = {
|
|
67
|
+
x: Math.max(0, padX - next.x),
|
|
68
|
+
y: Math.max(0, padY - next.y)
|
|
69
|
+
};
|
|
70
|
+
setScale(next.scale);
|
|
71
|
+
};
|
|
72
|
+
const applyRef = useRef(apply);
|
|
73
|
+
applyRef.current = apply;
|
|
74
|
+
const nowRef = useRef(now);
|
|
75
|
+
nowRef.current = now;
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
|
+
const target = pending.current;
|
|
78
|
+
const element = node();
|
|
79
|
+
if (!target) return;
|
|
80
|
+
pending.current = void 0;
|
|
81
|
+
offset.current = target;
|
|
82
|
+
setScroll(target);
|
|
83
|
+
if (element) {
|
|
84
|
+
element.scrollLeft = target.x;
|
|
85
|
+
element.scrollTop = target.y;
|
|
86
|
+
}
|
|
87
|
+
}, [shown]);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const element = node();
|
|
90
|
+
if (!element || typeof element.addEventListener !== "function") return;
|
|
91
|
+
element.style.touchAction = "pan-x pan-y";
|
|
92
|
+
element.tabIndex = 0;
|
|
93
|
+
const at = (clientX, clientY) => {
|
|
94
|
+
const box = element.getBoundingClientRect();
|
|
95
|
+
return {
|
|
96
|
+
x: clientX - box.left,
|
|
97
|
+
y: clientY - box.top
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
const onWheel = event => {
|
|
101
|
+
if (live.current.frozen || !event.ctrlKey && !event.metaKey) return;
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
const current = nowRef.current();
|
|
104
|
+
const factor = 1.002 ** -event.deltaY;
|
|
105
|
+
applyRef.current(zoomAt(current, current.scale * factor, at(event.clientX, event.clientY), live.current.content, live.current.viewport));
|
|
106
|
+
};
|
|
107
|
+
const onDouble = event => {
|
|
108
|
+
if (live.current.frozen || onNode(event.target)) return;
|
|
109
|
+
applyRef.current(toggledView(nowRef.current(), at(event.clientX, event.clientY), live.current.content, live.current.viewport));
|
|
110
|
+
};
|
|
111
|
+
const onKey = event => {
|
|
112
|
+
if (live.current.frozen || event.ctrlKey || event.metaKey || event.altKey || editable(event.target)) return;
|
|
113
|
+
const next = keyedView(event.key, nowRef.current(), live.current.content, live.current.viewport);
|
|
114
|
+
if (!next) return;
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
applyRef.current(next);
|
|
117
|
+
};
|
|
118
|
+
let pinch;
|
|
119
|
+
const spread = touches => Math.hypot(touches[0].clientX - touches[1].clientX, touches[0].clientY - touches[1].clientY);
|
|
120
|
+
const middle = touches => at((touches[0].clientX + touches[1].clientX) / 2, (touches[0].clientY + touches[1].clientY) / 2);
|
|
121
|
+
const onTouchStart = event => {
|
|
122
|
+
pinch = event.touches.length === 2 ? {
|
|
123
|
+
distance: spread(event.touches),
|
|
124
|
+
scale: nowRef.current().scale
|
|
125
|
+
} : void 0;
|
|
126
|
+
};
|
|
127
|
+
const onTouchMove = event => {
|
|
128
|
+
if (live.current.frozen || !pinch || event.touches.length !== 2) return;
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
const ratio = spread(event.touches) / Math.max(1, pinch.distance);
|
|
131
|
+
applyRef.current(zoomAt(nowRef.current(), pinch.scale * ratio, middle(event.touches), live.current.content, live.current.viewport));
|
|
132
|
+
};
|
|
133
|
+
const onTouchEnd = event => {
|
|
134
|
+
if (event.touches.length < 2) pinch = void 0;
|
|
135
|
+
};
|
|
136
|
+
element.addEventListener("wheel", onWheel, {
|
|
137
|
+
passive: false
|
|
138
|
+
});
|
|
139
|
+
element.addEventListener("dblclick", onDouble);
|
|
140
|
+
element.addEventListener("keydown", onKey);
|
|
141
|
+
element.addEventListener("touchstart", onTouchStart, {
|
|
142
|
+
passive: true
|
|
143
|
+
});
|
|
144
|
+
element.addEventListener("touchmove", onTouchMove, {
|
|
145
|
+
passive: false
|
|
146
|
+
});
|
|
147
|
+
element.addEventListener("touchend", onTouchEnd);
|
|
148
|
+
return () => {
|
|
149
|
+
element.removeEventListener("wheel", onWheel);
|
|
150
|
+
element.removeEventListener("dblclick", onDouble);
|
|
151
|
+
element.removeEventListener("keydown", onKey);
|
|
152
|
+
element.removeEventListener("touchstart", onTouchStart);
|
|
153
|
+
element.removeEventListener("touchmove", onTouchMove);
|
|
154
|
+
element.removeEventListener("touchend", onTouchEnd);
|
|
155
|
+
};
|
|
156
|
+
}, []);
|
|
157
|
+
const spaced = dots ? dotPitch(dots.pitch, shown) : 1;
|
|
158
|
+
const chunk = spaced * 4;
|
|
159
|
+
const reach = {
|
|
160
|
+
width: viewport.width / shown,
|
|
161
|
+
height: viewport.height / shown
|
|
162
|
+
};
|
|
163
|
+
const area = dotArea({
|
|
164
|
+
x: scroll.x / shown,
|
|
165
|
+
y: scroll.y / shown
|
|
166
|
+
}, reach, content, chunk);
|
|
167
|
+
const follow = event => {
|
|
168
|
+
const {
|
|
169
|
+
x,
|
|
170
|
+
y
|
|
171
|
+
} = event.nativeEvent.contentOffset;
|
|
172
|
+
offset.current = {
|
|
173
|
+
x,
|
|
174
|
+
y
|
|
175
|
+
};
|
|
176
|
+
const next = dotArea({
|
|
177
|
+
x: x / shown,
|
|
178
|
+
y: y / shown
|
|
179
|
+
}, reach, content, chunk);
|
|
180
|
+
if (!sameArea(next, area)) setScroll({
|
|
181
|
+
x,
|
|
182
|
+
y
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
return /* @__PURE__ */jsx(ScrollView, {
|
|
186
|
+
ref: scroller,
|
|
187
|
+
flex: 1,
|
|
188
|
+
testID: "graph-viewport",
|
|
189
|
+
scrollEnabled: !frozen,
|
|
190
|
+
keyboardShouldPersistTaps: "handled",
|
|
191
|
+
showsVerticalScrollIndicator: false,
|
|
192
|
+
showsHorizontalScrollIndicator: false,
|
|
193
|
+
scrollEventThrottle: 16,
|
|
194
|
+
onScroll: follow,
|
|
195
|
+
contentContainerStyle: {
|
|
196
|
+
alignSelf: "flex-start"
|
|
197
|
+
},
|
|
198
|
+
...{
|
|
199
|
+
style: {
|
|
200
|
+
overflowX: frozen ? "hidden" : "auto"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
children: /* @__PURE__ */jsx(View, {
|
|
204
|
+
minWidth: viewport.width,
|
|
205
|
+
minHeight: viewport.height,
|
|
206
|
+
alignItems: "center",
|
|
207
|
+
justifyContent: "center",
|
|
208
|
+
children: /* @__PURE__ */jsx(View, {
|
|
209
|
+
width: wide,
|
|
210
|
+
height: tall,
|
|
211
|
+
overflow: "hidden",
|
|
212
|
+
testID: "graph-zoom",
|
|
213
|
+
children: /* @__PURE__ */jsxs(View, {
|
|
214
|
+
position: "absolute",
|
|
215
|
+
left: 0,
|
|
216
|
+
top: 0,
|
|
217
|
+
width: content.width,
|
|
218
|
+
height: content.height,
|
|
219
|
+
...{
|
|
220
|
+
style: {
|
|
221
|
+
transform: [{
|
|
222
|
+
scale: shown
|
|
223
|
+
}],
|
|
224
|
+
transformOrigin: "0 0"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
children: [dots ? /* @__PURE__ */jsx(GraphDots, {
|
|
228
|
+
area,
|
|
229
|
+
pitch: spaced,
|
|
230
|
+
dot: dots.dot / shown,
|
|
231
|
+
color: dots.color
|
|
232
|
+
}) : null, children]
|
|
233
|
+
})
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
export { GraphViewport };
|
|
239
|
+
//# sourceMappingURL=GraphViewport.mjs.map
|