@multiplatform.one/node-graph 9.0.10 → 9.1.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.
Files changed (124) hide show
  1. package/dist/cjs/graphLayout/GraphDots.cjs +60 -0
  2. package/dist/cjs/graphLayout/GraphDots.native.js +66 -0
  3. package/dist/cjs/graphLayout/GraphDots.native.js.map +1 -0
  4. package/dist/cjs/graphLayout/GraphLayout.cjs +153 -0
  5. package/dist/cjs/graphLayout/GraphLayout.native.js +163 -0
  6. package/dist/cjs/graphLayout/GraphLayout.native.js.map +1 -0
  7. package/dist/cjs/graphLayout/GraphSvg.cjs +68 -0
  8. package/dist/cjs/graphLayout/GraphSvg.native.js +73 -0
  9. package/dist/cjs/graphLayout/GraphSvg.native.js.map +1 -0
  10. package/dist/cjs/graphLayout/GraphViewport.cjs +263 -0
  11. package/dist/cjs/graphLayout/GraphViewport.native.js +279 -0
  12. package/dist/cjs/graphLayout/GraphViewport.native.js.map +1 -0
  13. package/dist/cjs/graphLayout/index.cjs +51 -0
  14. package/dist/cjs/graphLayout/index.native.js +54 -0
  15. package/dist/cjs/graphLayout/index.native.js.map +1 -0
  16. package/dist/cjs/graphLayout/ogden.fixture.cjs +30 -0
  17. package/dist/cjs/graphLayout/ogden.fixture.native.js +33 -0
  18. package/dist/cjs/graphLayout/ogden.fixture.native.js.map +1 -0
  19. package/dist/cjs/graphLayout/plan.cjs +263 -0
  20. package/dist/cjs/graphLayout/plan.native.js +372 -0
  21. package/dist/cjs/graphLayout/plan.native.js.map +1 -0
  22. package/dist/cjs/graphLayout/viewMath.cjs +142 -0
  23. package/dist/cjs/graphLayout/viewMath.native.js +147 -0
  24. package/dist/cjs/graphLayout/viewMath.native.js.map +1 -0
  25. package/dist/esm/graphLayout/GraphDots.mjs +35 -0
  26. package/dist/esm/graphLayout/GraphDots.mjs.map +1 -0
  27. package/dist/esm/graphLayout/GraphDots.native.js +38 -0
  28. package/dist/esm/graphLayout/GraphDots.native.js.map +1 -0
  29. package/dist/esm/graphLayout/GraphLayout.mjs +127 -0
  30. package/dist/esm/graphLayout/GraphLayout.mjs.map +1 -0
  31. package/dist/esm/graphLayout/GraphLayout.native.js +134 -0
  32. package/dist/esm/graphLayout/GraphLayout.native.js.map +1 -0
  33. package/dist/esm/graphLayout/GraphSvg.mjs +42 -0
  34. package/dist/esm/graphLayout/GraphSvg.mjs.map +1 -0
  35. package/dist/esm/graphLayout/GraphSvg.native.js +44 -0
  36. package/dist/esm/graphLayout/GraphSvg.native.js.map +1 -0
  37. package/dist/esm/graphLayout/GraphViewport.mjs +238 -0
  38. package/dist/esm/graphLayout/GraphViewport.mjs.map +1 -0
  39. package/dist/esm/graphLayout/GraphViewport.native.js +251 -0
  40. package/dist/esm/graphLayout/GraphViewport.native.js.map +1 -0
  41. package/dist/esm/graphLayout/index.mjs +7 -0
  42. package/dist/esm/graphLayout/index.mjs.map +1 -0
  43. package/dist/esm/graphLayout/index.native.js +7 -0
  44. package/dist/esm/graphLayout/index.native.js.map +1 -0
  45. package/dist/esm/graphLayout/ogden.fixture.mjs +4 -0
  46. package/dist/esm/graphLayout/ogden.fixture.mjs.map +1 -0
  47. package/dist/esm/graphLayout/ogden.fixture.native.js +4 -0
  48. package/dist/esm/graphLayout/ogden.fixture.native.js.map +1 -0
  49. package/dist/esm/graphLayout/plan.mjs +235 -0
  50. package/dist/esm/graphLayout/plan.mjs.map +1 -0
  51. package/dist/esm/graphLayout/plan.native.js +341 -0
  52. package/dist/esm/graphLayout/plan.native.js.map +1 -0
  53. package/dist/esm/graphLayout/viewMath.mjs +105 -0
  54. package/dist/esm/graphLayout/viewMath.mjs.map +1 -0
  55. package/dist/esm/graphLayout/viewMath.native.js +107 -0
  56. package/dist/esm/graphLayout/viewMath.native.js.map +1 -0
  57. package/dist/jsx/graphLayout/GraphDots.mjs +35 -0
  58. package/dist/jsx/graphLayout/GraphDots.mjs.map +1 -0
  59. package/dist/jsx/graphLayout/GraphDots.native.js +66 -0
  60. package/dist/jsx/graphLayout/GraphDots.native.js.map +1 -0
  61. package/dist/jsx/graphLayout/GraphLayout.mjs +127 -0
  62. package/dist/jsx/graphLayout/GraphLayout.mjs.map +1 -0
  63. package/dist/jsx/graphLayout/GraphLayout.native.js +163 -0
  64. package/dist/jsx/graphLayout/GraphLayout.native.js.map +1 -0
  65. package/dist/jsx/graphLayout/GraphSvg.mjs +42 -0
  66. package/dist/jsx/graphLayout/GraphSvg.mjs.map +1 -0
  67. package/dist/jsx/graphLayout/GraphSvg.native.js +73 -0
  68. package/dist/jsx/graphLayout/GraphSvg.native.js.map +1 -0
  69. package/dist/jsx/graphLayout/GraphViewport.mjs +238 -0
  70. package/dist/jsx/graphLayout/GraphViewport.mjs.map +1 -0
  71. package/dist/jsx/graphLayout/GraphViewport.native.js +279 -0
  72. package/dist/jsx/graphLayout/GraphViewport.native.js.map +1 -0
  73. package/dist/jsx/graphLayout/index.mjs +7 -0
  74. package/dist/jsx/graphLayout/index.mjs.map +1 -0
  75. package/dist/jsx/graphLayout/index.native.js +54 -0
  76. package/dist/jsx/graphLayout/index.native.js.map +1 -0
  77. package/dist/jsx/graphLayout/ogden.fixture.mjs +4 -0
  78. package/dist/jsx/graphLayout/ogden.fixture.mjs.map +1 -0
  79. package/dist/jsx/graphLayout/ogden.fixture.native.js +33 -0
  80. package/dist/jsx/graphLayout/ogden.fixture.native.js.map +1 -0
  81. package/dist/jsx/graphLayout/plan.mjs +235 -0
  82. package/dist/jsx/graphLayout/plan.mjs.map +1 -0
  83. package/dist/jsx/graphLayout/plan.native.js +372 -0
  84. package/dist/jsx/graphLayout/plan.native.js.map +1 -0
  85. package/dist/jsx/graphLayout/viewMath.mjs +105 -0
  86. package/dist/jsx/graphLayout/viewMath.mjs.map +1 -0
  87. package/dist/jsx/graphLayout/viewMath.native.js +147 -0
  88. package/dist/jsx/graphLayout/viewMath.native.js.map +1 -0
  89. package/graph-layout.ts +1 -0
  90. package/package.json +21 -6
  91. package/src/graphLayout/GraphDots.tsx +32 -0
  92. package/src/graphLayout/GraphLayout.stories.tsx +86 -0
  93. package/src/graphLayout/GraphLayout.tsx +152 -0
  94. package/src/graphLayout/GraphSvg.native.tsx +31 -0
  95. package/src/graphLayout/GraphSvg.tsx +45 -0
  96. package/src/graphLayout/GraphViewport.native.tsx +231 -0
  97. package/src/graphLayout/GraphViewport.tsx +246 -0
  98. package/src/graphLayout/index.ts +31 -0
  99. package/src/graphLayout/ogden.fixture.ts +120 -0
  100. package/src/graphLayout/plan.spec.ts +202 -0
  101. package/src/graphLayout/plan.ts +223 -0
  102. package/src/graphLayout/purity.spec.ts +67 -0
  103. package/src/graphLayout/viewMath.spec.ts +185 -0
  104. package/src/graphLayout/viewMath.ts +151 -0
  105. package/types/graphLayout/GraphDots.d.ts +9 -0
  106. package/types/graphLayout/GraphDots.d.ts.map +1 -0
  107. package/types/graphLayout/GraphLayout.d.ts +22 -0
  108. package/types/graphLayout/GraphLayout.d.ts.map +1 -0
  109. package/types/graphLayout/GraphSvg.d.ts +17 -0
  110. package/types/graphLayout/GraphSvg.d.ts.map +1 -0
  111. package/types/graphLayout/GraphSvg.native.d.ts +5 -0
  112. package/types/graphLayout/GraphSvg.native.d.ts.map +1 -0
  113. package/types/graphLayout/GraphViewport.d.ts +11 -0
  114. package/types/graphLayout/GraphViewport.d.ts.map +1 -0
  115. package/types/graphLayout/GraphViewport.native.d.ts +4 -0
  116. package/types/graphLayout/GraphViewport.native.d.ts.map +1 -0
  117. package/types/graphLayout/index.d.ts +11 -0
  118. package/types/graphLayout/index.d.ts.map +1 -0
  119. package/types/graphLayout/ogden.fixture.d.ts +3 -0
  120. package/types/graphLayout/ogden.fixture.d.ts.map +1 -0
  121. package/types/graphLayout/plan.d.ts +52 -0
  122. package/types/graphLayout/plan.d.ts.map +1 -0
  123. package/types/graphLayout/viewMath.d.ts +47 -0
  124. package/types/graphLayout/viewMath.d.ts.map +1 -0
@@ -0,0 +1,263 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var GraphViewport_exports = {};
24
+ __export(GraphViewport_exports, {
25
+ GraphViewport: () => GraphViewport
26
+ });
27
+ module.exports = __toCommonJS(GraphViewport_exports);
28
+ var import_react = require("react");
29
+ var import_tamagui = require("tamagui");
30
+ var import_GraphDots = require("./GraphDots.cjs");
31
+ var import_viewMath = require("./viewMath.cjs");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ function editable(target) {
34
+ const element = target;
35
+ return Boolean(element?.isContentEditable) || ["INPUT", "TEXTAREA", "SELECT"].includes(element?.tagName ?? "");
36
+ }
37
+ function onNode(target) {
38
+ const element = target;
39
+ return Boolean(element?.closest?.("[data-testid^='graph-node-']"));
40
+ }
41
+ function GraphViewport({
42
+ content,
43
+ viewport,
44
+ dots,
45
+ frozen,
46
+ children
47
+ }) {
48
+ const scroller = (0, import_react.useRef)(null);
49
+ const [scale, setScale] = (0, import_react.useState)(1);
50
+ const [scroll, setScroll] = (0, import_react.useState)({
51
+ x: 0,
52
+ y: 0
53
+ });
54
+ const offset = (0, import_react.useRef)({
55
+ x: 0,
56
+ y: 0
57
+ });
58
+ const pending = (0, import_react.useRef)(void 0);
59
+ const shown = Math.min(1, Math.max((0, import_viewMath.leastScale)(content, viewport), scale));
60
+ const wide = content.width * shown;
61
+ const tall = content.height * shown;
62
+ const pad = {
63
+ x: Math.max(0, (viewport.width - wide) / 2),
64
+ y: Math.max(0, (viewport.height - tall) / 2)
65
+ };
66
+ const live = (0, import_react.useRef)({
67
+ shown,
68
+ pad,
69
+ content,
70
+ viewport,
71
+ frozen
72
+ });
73
+ live.current = {
74
+ shown,
75
+ pad,
76
+ content,
77
+ viewport,
78
+ frozen
79
+ };
80
+ const node = () => scroller.current?.getScrollableNode?.() ?? void 0;
81
+ const now = () => ({
82
+ scale: live.current.shown,
83
+ x: live.current.pad.x - offset.current.x,
84
+ y: live.current.pad.y - offset.current.y
85
+ });
86
+ const apply = next => {
87
+ const {
88
+ content: size,
89
+ viewport: view
90
+ } = live.current;
91
+ const padX = Math.max(0, (view.width - size.width * next.scale) / 2);
92
+ const padY = Math.max(0, (view.height - size.height * next.scale) / 2);
93
+ pending.current = {
94
+ x: Math.max(0, padX - next.x),
95
+ y: Math.max(0, padY - next.y)
96
+ };
97
+ setScale(next.scale);
98
+ };
99
+ const applyRef = (0, import_react.useRef)(apply);
100
+ applyRef.current = apply;
101
+ const nowRef = (0, import_react.useRef)(now);
102
+ nowRef.current = now;
103
+ (0, import_react.useLayoutEffect)(() => {
104
+ const target = pending.current;
105
+ const element = node();
106
+ if (!target) return;
107
+ pending.current = void 0;
108
+ offset.current = target;
109
+ setScroll(target);
110
+ if (element) {
111
+ element.scrollLeft = target.x;
112
+ element.scrollTop = target.y;
113
+ }
114
+ }, [shown]);
115
+ (0, import_react.useEffect)(() => {
116
+ const element = node();
117
+ if (!element || typeof element.addEventListener !== "function") return;
118
+ element.style.touchAction = "pan-x pan-y";
119
+ element.tabIndex = 0;
120
+ const at = (clientX, clientY) => {
121
+ const box = element.getBoundingClientRect();
122
+ return {
123
+ x: clientX - box.left,
124
+ y: clientY - box.top
125
+ };
126
+ };
127
+ const onWheel = event => {
128
+ if (live.current.frozen || !event.ctrlKey && !event.metaKey) return;
129
+ event.preventDefault();
130
+ const current = nowRef.current();
131
+ const factor = 1.002 ** -event.deltaY;
132
+ applyRef.current((0, import_viewMath.zoomAt)(current, current.scale * factor, at(event.clientX, event.clientY), live.current.content, live.current.viewport));
133
+ };
134
+ const onDouble = event => {
135
+ if (live.current.frozen || onNode(event.target)) return;
136
+ applyRef.current((0, import_viewMath.toggledView)(nowRef.current(), at(event.clientX, event.clientY), live.current.content, live.current.viewport));
137
+ };
138
+ const onKey = event => {
139
+ if (live.current.frozen || event.ctrlKey || event.metaKey || event.altKey || editable(event.target)) return;
140
+ const next = (0, import_viewMath.keyedView)(event.key, nowRef.current(), live.current.content, live.current.viewport);
141
+ if (!next) return;
142
+ event.preventDefault();
143
+ applyRef.current(next);
144
+ };
145
+ let pinch;
146
+ const spread = touches => Math.hypot(touches[0].clientX - touches[1].clientX, touches[0].clientY - touches[1].clientY);
147
+ const middle = touches => at((touches[0].clientX + touches[1].clientX) / 2, (touches[0].clientY + touches[1].clientY) / 2);
148
+ const onTouchStart = event => {
149
+ pinch = event.touches.length === 2 ? {
150
+ distance: spread(event.touches),
151
+ scale: nowRef.current().scale
152
+ } : void 0;
153
+ };
154
+ const onTouchMove = event => {
155
+ if (live.current.frozen || !pinch || event.touches.length !== 2) return;
156
+ event.preventDefault();
157
+ const ratio = spread(event.touches) / Math.max(1, pinch.distance);
158
+ applyRef.current((0, import_viewMath.zoomAt)(nowRef.current(), pinch.scale * ratio, middle(event.touches), live.current.content, live.current.viewport));
159
+ };
160
+ const onTouchEnd = event => {
161
+ if (event.touches.length < 2) pinch = void 0;
162
+ };
163
+ element.addEventListener("wheel", onWheel, {
164
+ passive: false
165
+ });
166
+ element.addEventListener("dblclick", onDouble);
167
+ element.addEventListener("keydown", onKey);
168
+ element.addEventListener("touchstart", onTouchStart, {
169
+ passive: true
170
+ });
171
+ element.addEventListener("touchmove", onTouchMove, {
172
+ passive: false
173
+ });
174
+ element.addEventListener("touchend", onTouchEnd);
175
+ return () => {
176
+ element.removeEventListener("wheel", onWheel);
177
+ element.removeEventListener("dblclick", onDouble);
178
+ element.removeEventListener("keydown", onKey);
179
+ element.removeEventListener("touchstart", onTouchStart);
180
+ element.removeEventListener("touchmove", onTouchMove);
181
+ element.removeEventListener("touchend", onTouchEnd);
182
+ };
183
+ }, []);
184
+ const spaced = dots ? (0, import_viewMath.dotPitch)(dots.pitch, shown) : 1;
185
+ const chunk = spaced * 4;
186
+ const reach = {
187
+ width: viewport.width / shown,
188
+ height: viewport.height / shown
189
+ };
190
+ const area = (0, import_viewMath.dotArea)({
191
+ x: scroll.x / shown,
192
+ y: scroll.y / shown
193
+ }, reach, content, chunk);
194
+ const follow = event => {
195
+ const {
196
+ x,
197
+ y
198
+ } = event.nativeEvent.contentOffset;
199
+ offset.current = {
200
+ x,
201
+ y
202
+ };
203
+ const next = (0, import_viewMath.dotArea)({
204
+ x: x / shown,
205
+ y: y / shown
206
+ }, reach, content, chunk);
207
+ if (!(0, import_viewMath.sameArea)(next, area)) setScroll({
208
+ x,
209
+ y
210
+ });
211
+ };
212
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.ScrollView, {
213
+ ref: scroller,
214
+ flex: 1,
215
+ testID: "graph-viewport",
216
+ scrollEnabled: !frozen,
217
+ showsVerticalScrollIndicator: false,
218
+ showsHorizontalScrollIndicator: false,
219
+ scrollEventThrottle: 16,
220
+ onScroll: follow,
221
+ contentContainerStyle: {
222
+ alignSelf: "flex-start"
223
+ },
224
+ ...{
225
+ style: {
226
+ overflowX: frozen ? "hidden" : "auto"
227
+ }
228
+ },
229
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
230
+ minWidth: viewport.width,
231
+ minHeight: viewport.height,
232
+ alignItems: "center",
233
+ justifyContent: "center",
234
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
235
+ width: wide,
236
+ height: tall,
237
+ overflow: "hidden",
238
+ testID: "graph-zoom",
239
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.View, {
240
+ position: "absolute",
241
+ left: 0,
242
+ top: 0,
243
+ width: content.width,
244
+ height: content.height,
245
+ ...{
246
+ style: {
247
+ transform: [{
248
+ scale: shown
249
+ }],
250
+ transformOrigin: "0 0"
251
+ }
252
+ },
253
+ children: [dots ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GraphDots.GraphDots, {
254
+ area,
255
+ pitch: spaced,
256
+ dot: dots.dot / shown,
257
+ color: dots.color
258
+ }) : null, children]
259
+ })
260
+ })
261
+ })
262
+ });
263
+ }
@@ -0,0 +1,279 @@
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 GraphViewport_exports = {};
26
+ __export(GraphViewport_exports, {
27
+ GraphViewport: () => GraphViewport
28
+ });
29
+ module.exports = __toCommonJS(GraphViewport_exports);
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_react = require("react");
32
+ var import_tamagui = require("tamagui");
33
+ var import_GraphDots = require("./GraphDots.native.js");
34
+ var import_viewMath = require("./viewMath.native.js");
35
+ function editable(target) {
36
+ var _ref;
37
+ var element = target;
38
+ return Boolean(element === null || element === void 0 ? void 0 : element.isContentEditable) || ["INPUT", "TEXTAREA", "SELECT"].includes((_ref = element === null || element === void 0 ? void 0 : element.tagName) !== null && _ref !== void 0 ? _ref : "");
39
+ }
40
+ function onNode(target) {
41
+ var _element_closest;
42
+ var element = target;
43
+ return Boolean(element === null || element === void 0 ? void 0 : (_element_closest = element.closest) === null || _element_closest === void 0 ? void 0 : _element_closest.call(element, "[data-testid^='graph-node-']"));
44
+ }
45
+ function GraphViewport(param) {
46
+ var {
47
+ content,
48
+ viewport,
49
+ dots,
50
+ frozen,
51
+ children
52
+ } = param;
53
+ var scroller = (0, import_react.useRef)(null);
54
+ var [scale, setScale] = (0, import_react.useState)(1);
55
+ var [scroll, setScroll] = (0, import_react.useState)({
56
+ x: 0,
57
+ y: 0
58
+ });
59
+ var offset = (0, import_react.useRef)({
60
+ x: 0,
61
+ y: 0
62
+ });
63
+ var pending = (0, import_react.useRef)(void 0);
64
+ var shown = Math.min(1, Math.max((0, import_viewMath.leastScale)(content, viewport), scale));
65
+ var wide = content.width * shown;
66
+ var tall = content.height * shown;
67
+ var pad = {
68
+ x: Math.max(0, (viewport.width - wide) / 2),
69
+ y: Math.max(0, (viewport.height - tall) / 2)
70
+ };
71
+ var live = (0, import_react.useRef)({
72
+ shown,
73
+ pad,
74
+ content,
75
+ viewport,
76
+ frozen
77
+ });
78
+ live.current = {
79
+ shown,
80
+ pad,
81
+ content,
82
+ viewport,
83
+ frozen
84
+ };
85
+ var node = function node2() {
86
+ var _ref;
87
+ var _scroller_current_getScrollableNode, _scroller_current;
88
+ return (_ref = (_scroller_current = scroller.current) === null || _scroller_current === void 0 ? void 0 : (_scroller_current_getScrollableNode = _scroller_current.getScrollableNode) === null || _scroller_current_getScrollableNode === void 0 ? void 0 : _scroller_current_getScrollableNode.call(_scroller_current)) !== null && _ref !== void 0 ? _ref : void 0;
89
+ };
90
+ var now = function now2() {
91
+ return {
92
+ scale: live.current.shown,
93
+ x: live.current.pad.x - offset.current.x,
94
+ y: live.current.pad.y - offset.current.y
95
+ };
96
+ };
97
+ var apply = function apply2(next) {
98
+ var {
99
+ content: size,
100
+ viewport: view
101
+ } = live.current;
102
+ var padX = Math.max(0, (view.width - size.width * next.scale) / 2);
103
+ var padY = Math.max(0, (view.height - size.height * next.scale) / 2);
104
+ pending.current = {
105
+ x: Math.max(0, padX - next.x),
106
+ y: Math.max(0, padY - next.y)
107
+ };
108
+ setScale(next.scale);
109
+ };
110
+ var applyRef = (0, import_react.useRef)(apply);
111
+ applyRef.current = apply;
112
+ var nowRef = (0, import_react.useRef)(now);
113
+ nowRef.current = now;
114
+ (0, import_react.useLayoutEffect)(function () {
115
+ var target = pending.current;
116
+ var element = node();
117
+ if (!target) return;
118
+ pending.current = void 0;
119
+ offset.current = target;
120
+ setScroll(target);
121
+ if (element) {
122
+ element.scrollLeft = target.x;
123
+ element.scrollTop = target.y;
124
+ }
125
+ }, [shown]);
126
+ (0, import_react.useEffect)(function () {
127
+ var element = node();
128
+ if (!element || typeof element.addEventListener !== "function") return;
129
+ element.style.touchAction = "pan-x pan-y";
130
+ element.tabIndex = 0;
131
+ var at = function at2(clientX, clientY) {
132
+ var box = element.getBoundingClientRect();
133
+ return {
134
+ x: clientX - box.left,
135
+ y: clientY - box.top
136
+ };
137
+ };
138
+ var onWheel = function onWheel2(event) {
139
+ if (live.current.frozen || !event.ctrlKey && !event.metaKey) return;
140
+ event.preventDefault();
141
+ var current = nowRef.current();
142
+ var factor = Math.pow(1.002, -event.deltaY);
143
+ applyRef.current((0, import_viewMath.zoomAt)(current, current.scale * factor, at(event.clientX, event.clientY), live.current.content, live.current.viewport));
144
+ };
145
+ var onDouble = function onDouble2(event) {
146
+ if (live.current.frozen || onNode(event.target)) return;
147
+ applyRef.current((0, import_viewMath.toggledView)(nowRef.current(), at(event.clientX, event.clientY), live.current.content, live.current.viewport));
148
+ };
149
+ var onKey = function onKey2(event) {
150
+ if (live.current.frozen || event.ctrlKey || event.metaKey || event.altKey || editable(event.target)) return;
151
+ var next = (0, import_viewMath.keyedView)(event.key, nowRef.current(), live.current.content, live.current.viewport);
152
+ if (!next) return;
153
+ event.preventDefault();
154
+ applyRef.current(next);
155
+ };
156
+ var pinch;
157
+ var spread = function spread2(touches) {
158
+ return Math.hypot(touches[0].clientX - touches[1].clientX, touches[0].clientY - touches[1].clientY);
159
+ };
160
+ var middle = function middle2(touches) {
161
+ return at((touches[0].clientX + touches[1].clientX) / 2, (touches[0].clientY + touches[1].clientY) / 2);
162
+ };
163
+ var onTouchStart = function onTouchStart2(event) {
164
+ pinch = event.touches.length === 2 ? {
165
+ distance: spread(event.touches),
166
+ scale: nowRef.current().scale
167
+ } : void 0;
168
+ };
169
+ var onTouchMove = function onTouchMove2(event) {
170
+ if (live.current.frozen || !pinch || event.touches.length !== 2) return;
171
+ event.preventDefault();
172
+ var ratio = spread(event.touches) / Math.max(1, pinch.distance);
173
+ applyRef.current((0, import_viewMath.zoomAt)(nowRef.current(), pinch.scale * ratio, middle(event.touches), live.current.content, live.current.viewport));
174
+ };
175
+ var onTouchEnd = function onTouchEnd2(event) {
176
+ if (event.touches.length < 2) pinch = void 0;
177
+ };
178
+ element.addEventListener("wheel", onWheel, {
179
+ passive: false
180
+ });
181
+ element.addEventListener("dblclick", onDouble);
182
+ element.addEventListener("keydown", onKey);
183
+ element.addEventListener("touchstart", onTouchStart, {
184
+ passive: true
185
+ });
186
+ element.addEventListener("touchmove", onTouchMove, {
187
+ passive: false
188
+ });
189
+ element.addEventListener("touchend", onTouchEnd);
190
+ return function () {
191
+ element.removeEventListener("wheel", onWheel);
192
+ element.removeEventListener("dblclick", onDouble);
193
+ element.removeEventListener("keydown", onKey);
194
+ element.removeEventListener("touchstart", onTouchStart);
195
+ element.removeEventListener("touchmove", onTouchMove);
196
+ element.removeEventListener("touchend", onTouchEnd);
197
+ };
198
+ }, []);
199
+ var spaced = dots ? (0, import_viewMath.dotPitch)(dots.pitch, shown) : 1;
200
+ var chunk = spaced * 4;
201
+ var reach = {
202
+ width: viewport.width / shown,
203
+ height: viewport.height / shown
204
+ };
205
+ var area = (0, import_viewMath.dotArea)({
206
+ x: scroll.x / shown,
207
+ y: scroll.y / shown
208
+ }, reach, content, chunk);
209
+ var follow = function follow2(event) {
210
+ var {
211
+ x,
212
+ y
213
+ } = event.nativeEvent.contentOffset;
214
+ offset.current = {
215
+ x,
216
+ y
217
+ };
218
+ var next = (0, import_viewMath.dotArea)({
219
+ x: x / shown,
220
+ y: y / shown
221
+ }, reach, content, chunk);
222
+ if (!(0, import_viewMath.sameArea)(next, area)) setScroll({
223
+ x,
224
+ y
225
+ });
226
+ };
227
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.ScrollView, {
228
+ ref: scroller,
229
+ flex: 1,
230
+ testID: "graph-viewport",
231
+ scrollEnabled: !frozen,
232
+ showsVerticalScrollIndicator: false,
233
+ showsHorizontalScrollIndicator: false,
234
+ scrollEventThrottle: 16,
235
+ onScroll: follow,
236
+ contentContainerStyle: {
237
+ alignSelf: "flex-start"
238
+ },
239
+ ...{
240
+ style: {
241
+ overflowX: frozen ? "hidden" : "auto"
242
+ }
243
+ },
244
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
245
+ minWidth: viewport.width,
246
+ minHeight: viewport.height,
247
+ alignItems: "center",
248
+ justifyContent: "center",
249
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
250
+ width: wide,
251
+ height: tall,
252
+ overflow: "hidden",
253
+ testID: "graph-zoom",
254
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.View, {
255
+ position: "absolute",
256
+ left: 0,
257
+ top: 0,
258
+ width: content.width,
259
+ height: content.height,
260
+ ...{
261
+ style: {
262
+ transform: [{
263
+ scale: shown
264
+ }],
265
+ transformOrigin: "0 0"
266
+ }
267
+ },
268
+ children: [dots ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GraphDots.GraphDots, {
269
+ area,
270
+ pitch: spaced,
271
+ dot: dots.dot / shown,
272
+ color: dots.color
273
+ }) : null, children]
274
+ })
275
+ })
276
+ })
277
+ });
278
+ }
279
+ //# sourceMappingURL=GraphViewport.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","GraphViewport_exports","__export","GraphViewport","module","exports","import_jsx_runtime","require","import_react","import_tamagui","import_GraphDots","import_viewMath","editable","target","_ref","element","Boolean","isContentEditable","includes","tagName","onNode","_element_closest","closest","call","param","content","viewport","dots","frozen","children","scroller","useRef","scale","setScale","useState","scroll","setScroll","x","y","offset","pending","shown","Math","min","max","leastScale","wide","width","tall","height","pad","live","current","node","node2","_scroller_current_getScrollableNode","_scroller_current","getScrollableNode","now","now2","apply","apply2","next","size","view","padX","padY","applyRef","nowRef","useLayoutEffect","scrollLeft","scrollTop","useEffect","addEventListener","style","touchAction","tabIndex","at","at2","clientX","clientY","box","getBoundingClientRect","left","top","onWheel","onWheel2","event","ctrlKey","metaKey","preventDefault","factor","pow","deltaY","zoomAt","onDouble","onDouble2","toggledView","onKey","onKey2","altKey","keyedView","key","pinch","spread","spread2","touches","hypot","middle","middle2","onTouchStart","onTouchStart2","length","distance","onTouchMove","onTouchMove2","ratio","onTouchEnd","onTouchEnd2","passive","removeEventListener","spaced","dotPitch","pitch","chunk","reach","area","dotArea","follow","follow2","nativeEvent","contentOffset","sameArea","jsx","ScrollView","ref","flex","testID","scrollEnabled","showsVerticalScrollIndicator","showsHorizontalScrollIndicator"],"sources":["../../../src/graphLayout/GraphViewport.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA6D,CAAAK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,SAAU;MAAyBC,CAAA;MAKvEC;IAEG;EACH;EAAA,0BAAAhC,kBAAA,CAAA+H,GAAA,EAAA5H,cAAA,CAAA6H,UAAA;IAAAC,GAAA,EAAAzG,QAEL;IAAA0G,IAAA;IAAAC,MACF;IAAAC,aAAA,GAAA9G,MAAA;IACF+G,4BAAA;IAEJC,8BAAA","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var graphLayout_exports = {};
24
+ __export(graphLayout_exports, {
25
+ GraphDots: () => import_GraphDots.GraphDots,
26
+ GraphLayout: () => import_GraphLayout.GraphLayout,
27
+ GraphViewport: () => import_GraphViewport.GraphViewport,
28
+ arrowHead: () => import_plan.arrowHead,
29
+ clampOffset: () => import_viewMath.clampOffset,
30
+ clampView: () => import_viewMath.clampView,
31
+ dotArea: () => import_viewMath.dotArea,
32
+ dotPath: () => import_viewMath.dotPath,
33
+ dotPhase: () => import_viewMath.dotPhase,
34
+ dotPitch: () => import_viewMath.dotPitch,
35
+ fittedView: () => import_viewMath.fittedView,
36
+ graphEdgeId: () => import_plan.graphEdgeId,
37
+ graphZoom: () => import_viewMath.graphZoom,
38
+ keyedView: () => import_viewMath.keyedView,
39
+ leastScale: () => import_viewMath.leastScale,
40
+ planGraphLayout: () => import_plan.planGraphLayout,
41
+ resolveGraphDirection: () => import_GraphLayout.resolveGraphDirection,
42
+ toggledView: () => import_viewMath.toggledView,
43
+ usableEdges: () => import_plan.usableEdges,
44
+ zoomAt: () => import_viewMath.zoomAt
45
+ });
46
+ module.exports = __toCommonJS(graphLayout_exports);
47
+ var import_GraphLayout = require("./GraphLayout.cjs");
48
+ var import_GraphViewport = require("./GraphViewport.cjs");
49
+ var import_GraphDots = require("./GraphDots.cjs");
50
+ var import_plan = require("./plan.cjs");
51
+ var import_viewMath = require("./viewMath.cjs");
@@ -0,0 +1,54 @@
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
+ GraphDots: () => import_GraphDots.GraphDots,
28
+ GraphLayout: () => import_GraphLayout.GraphLayout,
29
+ GraphViewport: () => import_GraphViewport.GraphViewport,
30
+ arrowHead: () => import_plan.arrowHead,
31
+ clampOffset: () => import_viewMath.clampOffset,
32
+ clampView: () => import_viewMath.clampView,
33
+ dotArea: () => import_viewMath.dotArea,
34
+ dotPath: () => import_viewMath.dotPath,
35
+ dotPhase: () => import_viewMath.dotPhase,
36
+ dotPitch: () => import_viewMath.dotPitch,
37
+ fittedView: () => import_viewMath.fittedView,
38
+ graphEdgeId: () => import_plan.graphEdgeId,
39
+ graphZoom: () => import_viewMath.graphZoom,
40
+ keyedView: () => import_viewMath.keyedView,
41
+ leastScale: () => import_viewMath.leastScale,
42
+ planGraphLayout: () => import_plan.planGraphLayout,
43
+ resolveGraphDirection: () => import_GraphLayout.resolveGraphDirection,
44
+ toggledView: () => import_viewMath.toggledView,
45
+ usableEdges: () => import_plan.usableEdges,
46
+ zoomAt: () => import_viewMath.zoomAt
47
+ });
48
+ module.exports = __toCommonJS(graphLayout_exports);
49
+ var import_GraphLayout = require("./GraphLayout.native.js");
50
+ var import_GraphViewport = require("./GraphViewport.native.js");
51
+ var import_GraphDots = require("./GraphDots.native.js");
52
+ var import_plan = require("./plan.native.js");
53
+ var import_viewMath = require("./viewMath.native.js");
54
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","graphLayout_exports","__export","GraphDots","import_GraphDots","GraphLayout","import_GraphLayout","GraphViewport","import_GraphViewport","arrowHead","import_plan","clampOffset","import_viewMath","clampView","dotArea","dotPath","dotPhase","dotPitch","fittedView","graphEdgeId","graphZoom","keyedView","leastScale","planGraphLayout","resolveGraphDirection","toggledView","usableEdges","zoomAt","module","exports","require"],"sources":["../../../src/graphLayout/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAC,gBAAA,CAAAD,SAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAC,kBAAA,CAAAD,WAAA;EAAAE,aAAA,EAAAA,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