@g9tm/lynxcontrols-graph 2.11.11 → 2.11.12

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/canvas.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type G9DragPayload } from '@g9tm/lynxcontrols/pointer';
2
2
  import { type ReactNode } from '@lynx-js/react';
3
- import { type G9GraphEdge, type G9GraphGroup, type G9GraphNode, type G9GraphPoint, type G9GraphView } from './core.js';
3
+ import { type G9GraphBackground, type G9GraphEdge, type G9GraphGroup, type G9GraphLabelMode, type G9GraphNode, type G9GraphPoint, type G9GraphView } from './core.js';
4
4
  import './graph.css';
5
5
  /** What a card is told while it is drawn. */
6
6
  export interface G9GraphNodeState {
@@ -116,7 +116,26 @@ export interface G9GraphCanvasProps<N extends G9GraphNode = G9GraphNode> {
116
116
  current: G9GraphCanvasHandle | null;
117
117
  };
118
118
  readonly className?: string;
119
+ /**
120
+ * When edge labels show (2.11.12): `'always'` (default), `'hover'` (while the pointer is near the edge, or one of
121
+ * its nodes is selected) or `'none'`; an edge's own `labelMode` wins. Labels are drawn above the cards.
122
+ */
123
+ readonly edgeLabels?: G9GraphLabelMode;
124
+ /** A dot or grid pattern behind the graph in world space (2.11.12): it pans and zooms with the view. */
125
+ readonly background?: G9GraphBackground;
126
+ /**
127
+ * A card fades in from 94 % when it first appears (2.11.12): `'added'` the nodes added after the first render,
128
+ * `'all'` the first ones too. Off with reduced motion. Default `'none'`.
129
+ */
130
+ readonly nodeEnter?: 'none' | 'added' | 'all';
131
+ /** A class of the app's own on a card while it is dragged (2.11.12), beside `g9-graph__node--dragging` (a lift shadow). */
132
+ readonly draggingClassName?: string;
119
133
  }
134
+ /**
135
+ * The background pattern's style at a view (2.11.12): one tile of `gap × zoom` screen px (doubled while under 8, so a
136
+ * far zoom stays calm), placed with the pan. The main thread keeps size and position in step (applyViewMT).
137
+ */
138
+ export declare function graphBackgroundStyle(b: G9GraphBackground, view: G9GraphView): Record<string, string>;
120
139
  /** A node graph editor: app-drawn cards at app-given positions, edges between their ports, lanes behind them. */
121
140
  export declare function G9GraphCanvas<N extends G9GraphNode = G9GraphNode>(props: G9GraphCanvasProps<N>): ReactNode;
122
141
  //# sourceMappingURL=canvas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../src/canvas.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,aAAa,EAAwC,MAAM,4BAA4B,CAAC;AAGtG,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAUjB,MAAM,QAAQ,CAAC;AAEhB,OAAO,aAAa,CAAC;AAErB,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,2BAA2B;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,gCAAgC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,0CAA0C;AAC1C,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEhC,6HA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CAcpG;AAgED,iHAAiH;AACjH,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CA6zB1G"}
package/dist/canvas.jsx CHANGED
@@ -1,12 +1,12 @@
1
1
  import { measureNode, useG9Anchor } from "@g9tm/lynxcontrols/anchor";
2
- import { g9SafeId, startTimer, stopTimer } from "@g9tm/lynxcontrols/base";
2
+ import { g9OnWebHost, g9SafeId, startTimer, stopTimer } from "@g9tm/lynxcontrols/base";
3
3
  import { g9HeldModifiers, useG9Keys } from "@g9tm/lynxcontrols/commands";
4
4
  import { registerG9DropTarget, useG9DragState } from "@g9tm/lynxcontrols/pointer";
5
5
  import { useG9Direction, useG9Theme } from "@g9tm/lynxcontrols/provider";
6
6
  import { g9MotionScale, isContextMenuKey } from "@g9tm/lynxcontrols-foundation";
7
7
  import { memo, runOnBackground, runOnMainThread, useEffect, useMainThreadRef, useMemo, useRef, useState } from "@lynx-js/react";
8
- import { contentBounds, cullGraph, edgeGeometry, fitView, nextSelection, nodeAt, nodeInDirection, portPoint, snapTo, toScreen, toWorld, visibleWorld, zoomAt } from "./core.jsx";
9
- import { edgeOfTargetMT, liveEdgesSvgMT, nodeIndexAtMT, snapMT, zoomAtMT } from "./mt.jsx";
8
+ import { G9_GRAPH_FLOW_SPEED, contentBounds, cullGraph, edgeGeometry, edgeSvg, fitView, flowPeriod, nextSelection, nodeAt, nodeInDirection, portPoint, snapTo, toScreen, toWorld, visibleWorld, zoomAt } from "./core.jsx";
9
+ import { edgeNearMT, edgeOfTargetMT, edgeSvgMT, liveEdgesSvgMT, nodeIndexAtMT, snapMT, zoomAtMT } from "./mt.jsx";
10
10
  import "./graph.css";
11
11
  const IDLE_DRAG = {
12
12
  mode: 0,
@@ -31,7 +31,7 @@ const sameView = (a, b)=>Math.abs(a.zoom - b.zoom) < 1e-6 && Math.abs(a.x - b.x)
31
31
  const sameState = (a, b)=>a.selected === b.selected && a.focused === b.focused && a.dragging === b.dragging && a.dropCandidate === b.dropCandidate && a.dropOver === b.dropOver && a.zoom === b.zoom;
32
32
  const Card = memo(function(props) {
33
33
  const { node, state } = props;
34
- const cls = `g9-graph__node${state.selected ? ' g9-graph__node--selected' : ''}${state.focused ? ' g9-graph__node--focused' : ''}${state.selected && state.focused ? ' g9-graph__node--selfocus' : ''}${state.dragging ? ' g9-graph__node--dragging' : ''}${state.dropCandidate ? ' g9-graph__node--candidate' : ''}${state.dropOver ? ' g9-graph__node--over' : ''}`;
34
+ const cls = `g9-graph__node${state.selected ? ' g9-graph__node--selected' : ''}${state.focused ? ' g9-graph__node--focused' : ''}${state.selected && state.focused ? ' g9-graph__node--selfocus' : ''}${state.dragging ? ' g9-graph__node--dragging' : ''}${state.dropCandidate ? ' g9-graph__node--candidate' : ''}${state.dropOver ? ' g9-graph__node--over' : ''}${props.enter ? ' g9-graph__node--enter' : ''}${state.dragging && props.dragClass ? ` ${props.dragClass}` : ''}`;
35
35
  return <view id={props.elementId} className={cls} style={{
36
36
  left: `${node.x}px`,
37
37
  top: `${node.y}px`,
@@ -40,18 +40,20 @@ const Card = memo(function(props) {
40
40
  }} accessibility-element={false}>
41
41
  {props.render(node, state)}
42
42
  </view>;
43
- }, (a, b)=>a.node === b.node && a.render === b.render && a.elementId === b.elementId && sameState(a.state, b.state));
43
+ }, (a, b)=>a.node === b.node && a.render === b.render && a.elementId === b.elementId && a.enter === b.enter && a.dragClass === b.dragClass && sameState(a.state, b.state));
44
44
  function svgOf(paths, box) {
45
45
  const r = (v)=>Math.round(10 * v) / 10;
46
46
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${r(box.x)} ${r(box.y)} ${r(box.width)} ${r(box.height)}" width="${r(box.width)}" height="${r(box.height)}">${paths}</svg>`;
47
47
  }
48
- function pathsOf(list, color, offset) {
48
+ const dashOf = (e)=>'active' === e.style ? 2 : 'dashed' === e.style ? 1 : 0;
49
+ const speedOf = (e)=>void 0 !== e.flowSpeed && e.flowSpeed > 0 ? e.flowSpeed : G9_GRAPH_FLOW_SPEED;
50
+ function pathsOf(list, color, animate) {
49
51
  let out = '';
50
- for (const { g, edge } of list){
51
- var _edge_width;
52
- const dashed = 'dashed' === edge.style || 'active' === edge.style;
53
- out += `<path d="${g.d}" fill="none" stroke="${color(edge)}" stroke-width="${null != (_edge_width = edge.width) ? _edge_width : 1.5}"${dashed ? ` stroke-dasharray="6 4"${offset ? ` stroke-dashoffset="${offset}"` : ''}` : ''}/>`;
54
- }
52
+ list.forEach(({ g, edge }, i)=>{
53
+ var _edge_colorTo, _edge_width, _edge_glow;
54
+ const beads = 'beads' === edge.flow;
55
+ out += edgeSvg(g.d, g.from.x, g.from.y, g.to.x, g.to.y, color(edge), null != (_edge_colorTo = edge.colorTo) ? _edge_colorTo : '', null != (_edge_width = edge.width) ? _edge_width : 1.5, null != (_edge_glow = edge.glow) ? _edge_glow : 0, dashOf(edge), beads, true === edge.ends, `g9g${i}`, 0, animate && 'active' === edge.style ? flowPeriod(beads) / speedOf(edge) : 0);
56
+ });
55
57
  return out;
56
58
  }
57
59
  function boxOf(list) {
@@ -59,11 +61,13 @@ function boxOf(list) {
59
61
  let y0 = 1 / 0;
60
62
  let x1 = -1 / 0;
61
63
  let y1 = -1 / 0;
62
- for (const { g } of list){
63
- x0 = Math.min(x0, g.box.x - 4);
64
- y0 = Math.min(y0, g.box.y - 4);
65
- x1 = Math.max(x1, g.box.x + g.box.width + 4);
66
- y1 = Math.max(y1, g.box.y + g.box.height + 4);
64
+ for (const { g, edge } of list){
65
+ var _edge_glow, _edge_width;
66
+ const pad = 4 + Math.max(null != (_edge_glow = edge.glow) ? _edge_glow : 0, (null != (_edge_width = edge.width) ? _edge_width : 1.5) * 1.5, edge.ends ? 3 : 0);
67
+ x0 = Math.min(x0, g.box.x - pad);
68
+ y0 = Math.min(y0, g.box.y - pad);
69
+ x1 = Math.max(x1, g.box.x + g.box.width + pad);
70
+ y1 = Math.max(y1, g.box.y + g.box.height + pad);
67
71
  }
68
72
  return {
69
73
  x: x0,
@@ -73,29 +77,84 @@ function boxOf(list) {
73
77
  };
74
78
  }
75
79
  function ActiveEdges(props) {
76
- const [phase, setPhase] = useState(0);
80
+ const web = g9OnWebHost();
81
+ const el = useMainThreadRef(null);
82
+ const args = useMainThreadRef([]);
83
+ const box = props.list.length ? boxOf(props.list) : null;
84
+ const content = box ? svgOf(pathsOf(props.list, props.color, web && props.animate), box) : '';
85
+ const timed = !web && props.animate && props.list.length > 0;
86
+ function setArgsMT(next) {
87
+ 'main thread';
88
+ args.current = next;
89
+ }
90
+ function tickMT(ms, bx, by, bw, bh) {
91
+ 'main thread';
92
+ var _el_current;
93
+ let paths = '';
94
+ const list = args.current;
95
+ for(let i = 0; i < list.length; i++){
96
+ const a = list[i];
97
+ const period = 1 === a[9] ? 14 : 10;
98
+ const offset = -(ms / 1000 * a[11] % period);
99
+ paths += edgeSvgMT(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], 2, 1 === a[9], 1 === a[10], `g9a${i}`, offset, 0);
100
+ }
101
+ const r = (v)=>Math.round(10 * v) / 10;
102
+ null == (_el_current = el.current) || _el_current.setAttribute('content', `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${r(bx)} ${r(by)} ${r(bw)} ${r(bh)}" width="${r(bw)}" height="${r(bh)}">${paths}</svg>`);
103
+ }
77
104
  useEffect(()=>{
78
- if (!props.animate || 0 === props.list.length) return;
105
+ if (!timed || !box) return;
106
+ const next = props.list.map(({ g, edge })=>{
107
+ var _edge_colorTo, _edge_width, _edge_glow;
108
+ return [
109
+ g.d,
110
+ g.from.x,
111
+ g.from.y,
112
+ g.to.x,
113
+ g.to.y,
114
+ props.color(edge),
115
+ null != (_edge_colorTo = edge.colorTo) ? _edge_colorTo : '',
116
+ null != (_edge_width = edge.width) ? _edge_width : 1.5,
117
+ null != (_edge_glow = edge.glow) ? _edge_glow : 0,
118
+ 'beads' === edge.flow ? 1 : 0,
119
+ true === edge.ends ? 1 : 0,
120
+ speedOf(edge)
121
+ ];
122
+ });
123
+ runOnMainThread(setArgsMT)(next);
124
+ const t0 = Date.now();
79
125
  let handle = null;
80
126
  const tick = ()=>{
81
- setPhase((p)=>(p + 1) % 5);
82
- handle = startTimer(tick, 90);
127
+ runOnMainThread(tickMT)(Date.now() - t0, box.x, box.y, box.width, box.height);
128
+ handle = startTimer(tick, 33);
83
129
  };
84
- handle = startTimer(tick, 90);
130
+ handle = startTimer(tick, 33);
85
131
  return ()=>stopTimer(handle);
86
132
  }, [
87
- props.animate,
88
- props.list.length
133
+ content,
134
+ timed
89
135
  ]);
90
- if (0 === props.list.length) return null;
91
- const box = boxOf(props.list);
92
- return <svg className="g9-graph__edges g9-graph__edges--active" content={svgOf(pathsOf(props.list, props.color, 2 * -phase), box)} style={{
136
+ if (!box) return null;
137
+ return <svg className="g9-graph__edges g9-graph__edges--active" main-thread:ref={el} content={content} style={{
93
138
  left: `${box.x}px`,
94
139
  top: `${box.y}px`,
95
140
  width: `${box.width}px`,
96
141
  height: `${box.height}px`
97
142
  }}/>;
98
143
  }
144
+ function graphBackgroundStyle(b, view1) {
145
+ var _b_size;
146
+ let tile = b.gap * view1.zoom;
147
+ if (!(tile > 0)) return {};
148
+ while(tile < 8)tile *= 2;
149
+ const s = null != (_b_size = b.size) ? _b_size : 1;
150
+ const image = 'dots' === b.kind ? `radial-gradient(circle, ${b.color} ${s}px, transparent ${s + 0.5}px)` : `linear-gradient(to right, ${b.color} ${s}px, transparent ${s}px), linear-gradient(to bottom, ${b.color} ${s}px, transparent ${s}px)`;
151
+ return {
152
+ backgroundImage: image,
153
+ backgroundSize: `${tile}px ${tile}px`,
154
+ backgroundPosition: `${view1.x % tile}px ${view1.y % tile}px`
155
+ };
156
+ }
157
+ const backgroundStyle = graphBackgroundStyle;
99
158
  const ICONS = {
100
159
  plus: 'M12 5v14M5 12h14',
101
160
  minus: 'M5 12h14',
@@ -131,7 +190,7 @@ const pagePoint = (e)=>{
131
190
  return null;
132
191
  };
133
192
  function G9GraphCanvas(props) {
134
- var _props_minZoom, _props_maxZoom, _props_curvature, _props_edges, _props_groups, _props_defaultView, _ref, _props_view, _props_defaultSelection, _props_selection, _props_keyboard, _props_cullMargin, _props_labels, _props_id, _labels_zoomIn, _props_id1, _labels_zoomOut, _props_id2, _labels_fit;
193
+ var _props_minZoom, _props_maxZoom, _props_curvature, _props_edges, _props_groups, _props_defaultView, _ref, _props_view, _props_defaultSelection, _props_selection, _props_keyboard, _props_cullMargin, _props_labels, _props_nodeEnter, _props_id, _labels_zoomIn, _props_id1, _labels_zoomOut, _props_id2, _labels_fit;
135
194
  var _props_view1, _props_view2, _props_view3;
136
195
  const theme = useG9Theme();
137
196
  const rtl = 'rtl' === useG9Direction();
@@ -175,6 +234,8 @@ function G9GraphCanvas(props) {
175
234
  0,
176
235
  0
177
236
  ]);
237
+ const bg = useMainThreadRef(null);
238
+ const bgGap = useMainThreadRef(0);
178
239
  function applyViewMT(z, x, y) {
179
240
  'main thread';
180
241
  var _world_current;
@@ -184,6 +245,15 @@ function G9GraphCanvas(props) {
184
245
  y
185
246
  ];
186
247
  null == (_world_current = world.current) || _world_current.setStyleProperty('transform', `translate(${x}px, ${y}px) scale(${z})`);
248
+ const gap = bgGap.current;
249
+ if (gap > 0 && z > 0 && bg.current) {
250
+ let tile = gap * z;
251
+ while(tile < 8)tile *= 2;
252
+ bg.current.setStyleProperties({
253
+ 'background-size': `${tile}px ${tile}px`,
254
+ 'background-position': `${x % tile}px ${y % tile}px`
255
+ });
256
+ }
187
257
  }
188
258
  const fromMain = (z, x, y)=>{
189
259
  var _latest_current_onViewChange, _latest_current;
@@ -218,6 +288,18 @@ function G9GraphCanvas(props) {
218
288
  null == (_props_view2 = props.view) ? void 0 : _props_view2.x,
219
289
  null == (_props_view3 = props.view) ? void 0 : _props_view3.y
220
290
  ]);
291
+ const bgStep = props.background && props.background.gap > 0 ? props.background.gap : 0;
292
+ function setBgGapMT(gap) {
293
+ 'main thread';
294
+ bgGap.current = gap;
295
+ const v = viewMT.current;
296
+ applyViewMT(v[0], v[1], v[2]);
297
+ }
298
+ useEffect(()=>{
299
+ runOnMainThread(setBgGapMT)(bgStep);
300
+ }, [
301
+ bgStep
302
+ ]);
221
303
  const bounds = useMemo(()=>contentBounds(props.nodes, groups), [
222
304
  props.nodes,
223
305
  groups
@@ -295,6 +377,7 @@ function G9GraphCanvas(props) {
295
377
  null == (_latest_current_onSelectionChange = (_latest_current = latest.current).onSelectionChange) || _latest_current_onSelectionChange.call(_latest_current, next);
296
378
  };
297
379
  const [focus, setFocus] = useState(null);
380
+ const [hoverEdge, setHoverEdge] = useState(null);
298
381
  const [active, setActive] = useState(false);
299
382
  const keyboard = null != (_props_keyboard = props.keyboard) ? _props_keyboard : 'auto';
300
383
  const byId = useMemo(()=>new Map(props.nodes.map((n)=>[
@@ -324,6 +407,10 @@ function G9GraphCanvas(props) {
324
407
  var _e_color;
325
408
  return null != (_e_color = e.color) ? _e_color : 'active' === e.style ? primary : outline;
326
409
  };
410
+ const labelModeOf = (e)=>{
411
+ var _ref, _e_labelMode;
412
+ return null != (_ref = null != (_e_labelMode = e.labelMode) ? _e_labelMode : props.edgeLabels) ? _ref : 'always';
413
+ };
327
414
  useEffect(()=>{
328
415
  var _props_snap;
329
416
  const nodes = props.nodes.map((n)=>[
@@ -336,7 +423,7 @@ function G9GraphCanvas(props) {
336
423
  ]);
337
424
  const mtEdges = [];
338
425
  for (const e of edges){
339
- var _ref, _ref1, _e_width;
426
+ var _ref, _ref1, _e_width, _e_glow, _e_colorTo;
340
427
  var _a_ports_find, _a_ports, _b_ports_find, _b_ports;
341
428
  const a = byId.get(e.from.node);
342
429
  const b = byId.get(e.to.node);
@@ -357,7 +444,11 @@ function G9GraphCanvas(props) {
357
444
  'right' === sb ? 1 : -1,
358
445
  strokeOf(e),
359
446
  null != (_e_width = e.width) ? _e_width : 1.5,
360
- 'dashed' === e.style ? 1 : 'active' === e.style ? 2 : 0
447
+ dashOf(e),
448
+ null != (_e_glow = e.glow) ? _e_glow : 0,
449
+ null != (_e_colorTo = e.colorTo) ? _e_colorTo : '',
450
+ (e.ends ? 1 : 0) | ('beads' === e.flow ? 2 : 0) | (e.label && 'hover' === labelModeOf(e) ? 4 : 0),
451
+ speedOf(e)
361
452
  ]);
362
453
  }
363
454
  const next = {
@@ -387,7 +478,8 @@ function G9GraphCanvas(props) {
387
478
  uid,
388
479
  Boolean(props.onMove),
389
480
  outline,
390
- primary
481
+ primary,
482
+ props.edgeLabels
391
483
  ]);
392
484
  function setGeoMT(next) {
393
485
  'main thread';
@@ -554,14 +646,28 @@ function G9GraphCanvas(props) {
554
646
  d.mode = 3;
555
647
  runOnBackground(onDragStart)(d.ids.slice());
556
648
  }
649
+ const hoverMT = useMainThreadRef('');
650
+ function hoverAtMT(raw, g) {
651
+ 'main thread';
652
+ var _ref, _raw_pageX, _ref1, _raw_pageY;
653
+ if (raw.touches && raw.touches.length > 0) return;
654
+ const v = viewNowMT();
655
+ const wx = ((null != (_ref = null != (_raw_pageX = raw.pageX) ? _raw_pageX : raw.x) ? _ref : 0) - g.ox - v[1]) / v[0];
656
+ const wy = ((null != (_ref1 = null != (_raw_pageY = raw.pageY) ? _raw_pageY : raw.y) ? _ref1 : 0) - g.oy - v[2]) / v[0];
657
+ const id = edgeNearMT(g.edges, g.nodes, wx, wy, 8 / v[0], g.curvature);
658
+ if (id === hoverMT.current) return;
659
+ hoverMT.current = id;
660
+ runOnBackground(setHoverEdge)(id || null);
661
+ }
557
662
  function moveMT(e) {
558
663
  'main thread';
559
664
  var _ref, _raw_pageX, _ref1, _raw_pageY;
560
665
  var _live_current, _live_current1;
561
666
  const d = drag.current;
562
667
  const g = geo.current;
563
- if (0 === d.mode || !g) return;
668
+ if (!g) return;
564
669
  const raw = e;
670
+ if (0 === d.mode) return void hoverAtMT(raw, g);
565
671
  const touches = raw.touches;
566
672
  if (4 === d.mode) {
567
673
  if (!touches || touches.length < 2) return;
@@ -648,6 +754,14 @@ function G9GraphCanvas(props) {
648
754
  const v = viewNowMT();
649
755
  runOnBackground(fromMain)(v[0], v[1], v[2]);
650
756
  }
757
+ function leaveMT() {
758
+ 'main thread';
759
+ upMT();
760
+ if (hoverMT.current) {
761
+ hoverMT.current = '';
762
+ runOnBackground(setHoverEdge)(null);
763
+ }
764
+ }
651
765
  function touchEndMT(e) {
652
766
  'main thread';
653
767
  var _ref;
@@ -829,14 +943,32 @@ function G9GraphCanvas(props) {
829
943
  const zoomStep = Math.round(20 * view1.zoom) / 20;
830
944
  const motion = false !== props.animateActive && g9MotionScale() > 0;
831
945
  const labels = null != (_props_labels = props.labels) ? _props_labels : {};
946
+ const enterMode = null != (_props_nodeEnter = props.nodeEnter) ? _props_nodeEnter : 'none';
947
+ const seen = useRef(null);
948
+ if (null === seen.current) seen.current = new Set('all' === enterMode ? [] : props.nodes.map((n)=>n.id));
949
+ const entering = 'none' !== enterMode && g9MotionScale() > 0;
950
+ useEffect(()=>{
951
+ var _seen_current;
952
+ for (const n of props.nodes)null == (_seen_current = seen.current) || _seen_current.add(n.id);
953
+ });
954
+ const background = props.background;
955
+ const bgStyle = background && background.gap > 0 ? backgroundStyle(background, view1) : null;
956
+ const labelled = shownEdges.filter((s)=>{
957
+ if (!s.edge.label) return false;
958
+ const mode = labelModeOf(s.edge);
959
+ if ('always' === mode) return true;
960
+ if ('none' === mode) return false;
961
+ return hoverEdge === s.edge.id || selectedSet.has(s.edge.from.node) || selectedSet.has(s.edge.to.node);
962
+ });
832
963
  return <view className={`g9-graph${props.className ? ` ${props.className}` : ''}`} id={uid} ref={(r)=>{
833
964
  root.current = r;
834
965
  }} style={{
835
966
  direction: 'ltr'
836
- }} bindlayoutchange={onLayout} main-thread:bindmousedown={downMT} main-thread:bindmousemove={moveMT} main-thread:bindmouseup={upMT} main-thread:bindmouseleave={upMT} main-thread:bindtouchstart={downMT} main-thread:bindtouchmove={moveMT} main-thread:bindtouchend={touchEndMT} main-thread:bindtouchcancel={touchEndMT} main-thread:bindwheel={wheelMT} bindlongpress={(e)=>{
967
+ }} bindlayoutchange={onLayout} main-thread:bindmousedown={downMT} main-thread:bindmousemove={moveMT} main-thread:bindmouseup={upMT} main-thread:bindmouseleave={leaveMT} main-thread:bindtouchstart={downMT} main-thread:bindtouchmove={moveMT} main-thread:bindtouchend={touchEndMT} main-thread:bindtouchcancel={touchEndMT} main-thread:bindwheel={wheelMT} bindlongpress={(e)=>{
837
968
  const p = pagePoint(e);
838
969
  if (p) menuAt(p.x, p.y, 'touch', edgeOf(e));
839
970
  }}>
971
+ {bgStyle ? <view className="g9-graph__bg" main-thread:ref={bg} style={bgStyle}/> : null}
840
972
  <view className="g9-graph__world" main-thread:ref={world}>
841
973
  {groups.map((g)=><view key={g.id} className="g9-graph__group" style={{
842
974
  left: `${g.x}px`,
@@ -845,13 +977,23 @@ function G9GraphCanvas(props) {
845
977
  height: `${g.height}px`,
846
978
  ...g.color ? {
847
979
  backgroundColor: g.color
980
+ } : {},
981
+ ...g.borderColor ? {
982
+ borderColor: g.borderColor
848
983
  } : {}
849
984
  }}>
850
- {g.title ? <text className="g9-graph__group-title" text-maxline="1">
985
+ {g.accent ? <view className="g9-graph__group-accent" style={{
986
+ backgroundColor: g.accent
987
+ }}/> : null}
988
+ {g.title ? <text className="g9-graph__group-title" text-maxline="1" {...g.titleColor ? {
989
+ style: {
990
+ color: g.titleColor
991
+ }
992
+ } : {}}>
851
993
  {g.title}
852
994
  </text> : null}
853
995
  </view>)}
854
- {staticBox ? <svg className="g9-graph__edges" content={svgOf(pathsOf(staticEdges, strokeOf, 0), staticBox)} style={{
996
+ {staticBox ? <svg className="g9-graph__edges" content={svgOf(pathsOf(staticEdges, strokeOf, false), staticBox)} style={{
855
997
  left: `${staticBox.x}px`,
856
998
  top: `${staticBox.y}px`,
857
999
  width: `${staticBox.width}px`,
@@ -859,21 +1001,8 @@ function G9GraphCanvas(props) {
859
1001
  }}/> : null}
860
1002
  <ActiveEdges list={activeEdges} color={strokeOf} animate={motion}/>
861
1003
  <svg className="g9-graph__edges g9-graph__edges--live" main-thread:ref={live} content=""/>
862
- {shownEdges.filter((s)=>s.edge.label).map((s)=><view key={`l:${s.edge.id}`} className="g9-graph__edge-label" data-g9edge={s.edge.id} style={{
863
- left: `${s.g.mid.x}px`,
864
- top: `${s.g.mid.y}px`
865
- }} {...props.onEdgePress ? {
866
- bindtap: ()=>{
867
- var _latest_current_onEdgePress, _latest_current;
868
- return null == (_latest_current_onEdgePress = (_latest_current = latest.current).onEdgePress) ? void 0 : _latest_current_onEdgePress.call(_latest_current, s.edge.id);
869
- }
870
- } : {}}>
871
- <text className="g9-graph__edge-text" data-g9edge={s.edge.id} text-maxline="1">
872
- {s.edge.label}
873
- </text>
874
- </view>)}
875
1004
  {props.nodes.map((n)=>{
876
- var _n_acceptsDrop, _dropping_over;
1005
+ var _n_acceptsDrop, _dropping_over, _seen_current;
877
1006
  const isDragging = draggingSet.has(n.id);
878
1007
  if (culled && !culled.nodes.has(n.id) && !isDragging && !selectedSet.has(n.id)) return null;
879
1008
  const candidate = null !== dropping && (null == (_n_acceptsDrop = n.acceptsDrop) ? void 0 : _n_acceptsDrop.call(n, dropping.payload)) === true;
@@ -885,8 +1014,21 @@ function G9GraphCanvas(props) {
885
1014
  dropOver: candidate && (null == dropping ? void 0 : null == (_dropping_over = dropping.over) ? void 0 : _dropping_over.part) === n.id,
886
1015
  zoom: zoomStep
887
1016
  };
888
- return <Card key={n.id} node={n} state={state} render={props.renderNode} elementId={nodeElementId(n.id)}/>;
1017
+ return <Card key={n.id} node={n} state={state} render={props.renderNode} elementId={nodeElementId(n.id)} enter={entering && !(null == (_seen_current = seen.current) ? void 0 : _seen_current.has(n.id))} dragClass={props.draggingClassName}/>;
889
1018
  })}
1019
+ {labelled.map((s)=><view key={`l:${s.edge.id}`} className="g9-graph__edge-label" data-g9edge={s.edge.id} style={{
1020
+ left: `${s.g.mid.x}px`,
1021
+ top: `${s.g.mid.y}px`
1022
+ }} {...props.onEdgePress ? {
1023
+ bindtap: ()=>{
1024
+ var _latest_current_onEdgePress, _latest_current;
1025
+ return null == (_latest_current_onEdgePress = (_latest_current = latest.current).onEdgePress) ? void 0 : _latest_current_onEdgePress.call(_latest_current, s.edge.id);
1026
+ }
1027
+ } : {}}>
1028
+ <text className="g9-graph__edge-text" data-g9edge={s.edge.id} text-maxline="1">
1029
+ {s.edge.label}
1030
+ </text>
1031
+ </view>)}
890
1032
  </view>
891
1033
  {false === props.controls ? null : <view className={`g9-graph__controls g9-graph__controls--${rtl ? 'rtl' : 'ltr'}`}>
892
1034
  <ChromeButton id={`${uid}_ZoomIn`} anchorId={`${null != (_props_id = props.id) ? _props_id : uid}_ZoomIn`} icon="plus" label={null != (_labels_zoomIn = labels.zoomIn) ? _labels_zoomIn : 'Zoom in'} color={theme.palette.OnSurface} onPress={()=>zoomBy(1.25)}/>
@@ -895,4 +1037,4 @@ function G9GraphCanvas(props) {
895
1037
  </view>}
896
1038
  </view>;
897
1039
  }
898
- export { G9GraphCanvas };
1040
+ export { G9GraphCanvas, graphBackgroundStyle };
package/dist/core.d.ts CHANGED
@@ -45,6 +45,10 @@ export interface G9GraphEnd {
45
45
  }
46
46
  /** How an edge is drawn. */
47
47
  export type G9GraphEdgeStyle = 'solid' | 'dashed' | 'active';
48
+ /** What moves along an active edge (2.11.12): dashes, or small round beads. */
49
+ export type G9GraphEdgeFlow = 'dashes' | 'beads';
50
+ /** When an edge's label shows (2.11.12): never, while the pointer is near the edge, or always. */
51
+ export type G9GraphLabelMode = 'none' | 'hover' | 'always';
48
52
  /** An edge between two node ports. */
49
53
  export interface G9GraphEdge {
50
54
  readonly id: string;
@@ -56,6 +60,20 @@ export interface G9GraphEdge {
56
60
  /** A colour of the app's own (default the theme's outline; active: primary). */
57
61
  readonly color?: string;
58
62
  readonly width?: number;
63
+ /**
64
+ * A soft halo (2.11.12): a translucent under-stroke in the edge's colour (alpha 0.25), `glow` px wider on each side.
65
+ */
66
+ readonly glow?: number;
67
+ /** A gradient (2.11.12): from `color` at the source end to `colorTo` at the target end. */
68
+ readonly colorTo?: string;
69
+ /** What moves along an active edge (2.11.12). Default `'dashes'`. */
70
+ readonly flow?: G9GraphEdgeFlow;
71
+ /** How fast it moves, in world px a second (2.11.12; tie it to the traffic). Default 24. */
72
+ readonly flowSpeed?: number;
73
+ /** Small port dots at both ends (2.11.12). */
74
+ readonly ends?: boolean;
75
+ /** When its label shows (2.11.12). Default: the canvas's `edgeLabels` (`'always'`). */
76
+ readonly labelMode?: G9GraphLabelMode;
59
77
  }
60
78
  /** A titled background area (a lane, a pillar) at an app-given rect. */
61
79
  export interface G9GraphGroup {
@@ -67,6 +85,21 @@ export interface G9GraphGroup {
67
85
  readonly height: number;
68
86
  /** A colour of the app's own for its fill (default the theme's container colour). */
69
87
  readonly color?: string;
88
+ /** The title's colour (2.11.12). */
89
+ readonly titleColor?: string;
90
+ /** The border's colour (2.11.12). */
91
+ readonly borderColor?: string;
92
+ /** A 2 px line along the top in this colour (2.11.12): a lane's tone. */
93
+ readonly accent?: string;
94
+ }
95
+ /** A pattern behind the graph in world space (2.11.12): it pans and zooms with the view. */
96
+ export interface G9GraphBackground {
97
+ readonly kind: 'dots' | 'grid';
98
+ /** The pattern's step in world units. */
99
+ readonly gap: number;
100
+ readonly color: string;
101
+ /** A dot's radius or a line's width in screen px. Default 1. */
102
+ readonly size?: number;
70
103
  }
71
104
  /** The identity view. */
72
105
  export declare const G9_GRAPH_IDENTITY: G9GraphView;
@@ -109,6 +142,10 @@ export interface G9EdgeGeometry {
109
142
  readonly d: string;
110
143
  readonly mid: G9GraphPoint;
111
144
  readonly box: G9GraphRect;
145
+ /** The source port's point (2.11.12). */
146
+ readonly from: G9GraphPoint;
147
+ /** The target port's point (2.11.12). */
148
+ readonly to: G9GraphPoint;
112
149
  }
113
150
  /** Lays out an edge between its nodes. */
114
151
  export declare function edgeGeometry(edge: G9GraphEdge, byId: ReadonlyMap<string, G9GraphNode>, curvature?: number): G9EdgeGeometry | null;
@@ -148,4 +185,14 @@ export interface G9LayeredLayoutOptions {
148
185
  * deepest predecessor; cycles are broken at the edge that closes them. Answers each node's top-left; the app applies it.
149
186
  */
150
187
  export declare function layeredLayout(nodes: readonly Pick<G9GraphNode, 'id' | 'width' | 'height'>[], edges: readonly Pick<G9GraphEdge, 'from' | 'to'>[], options?: G9LayeredLayoutOptions): Map<string, G9GraphPoint>;
188
+ /** The default speed of an active edge's flow, in world px a second (2.11.12). */
189
+ export declare const G9_GRAPH_FLOW_SPEED = 24;
190
+ /** The repeat of an active edge's pattern: dashes (6 + 4) or beads (one each 14 px). */
191
+ export declare function flowPeriod(beads: boolean): number;
192
+ /**
193
+ * One edge's SVG (2.11.12): the glow under it, the stroke (a gradient with `colorTo`), the dashes or beads of an
194
+ * active edge at `offset`, moving by SMIL when `animSeconds` > 0 (the web host animates them in the browser), and
195
+ * the end dots. `dash`: 0 solid, 1 dashed, 2 active. Its twin `edgeSvgMT` (mt.ts) draws a dragged node's edges.
196
+ */
197
+ export declare function edgeSvg(d: string, ax: number, ay: number, bx: number, by: number, color: string, colorTo: string, width: number, glow: number, dash: number, beads: boolean, ends: boolean, gid: string, offset: number, animSeconds: number): string;
151
198
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAKA,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,6BAA6B;AAC7B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,8DAA8D;AAC9D,MAAM,WAAW,WA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,SAAS,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC,EAAE,EAC9D,KAAK,EAAE,SAAS,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,EAClD,OAAO,GAAE,sBAA2B,GACnC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CA0F3B;AAED,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,CAAC,EAAE,MAAM,EACT,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,MAAM,CAyBR"}
package/dist/core.js CHANGED
@@ -156,7 +156,9 @@ function edgeGeometry(edge, byId, curvature = 0.5) {
156
156
  y: y0,
157
157
  width: Math.max(...xs) - x0,
158
158
  height: Math.max(...ys) - y0
159
- }
159
+ },
160
+ from: a,
161
+ to: b
160
162
  };
161
163
  }
162
164
  function cullGraph(nodes, edges, visible) {
@@ -320,6 +322,29 @@ function layeredLayout(nodes, edges, options = {}) {
320
322
  }
321
323
  return result;
322
324
  }
323
- export { G9_GRAPH_IDENTITY, bezierPoint, clampZoom, contentBounds, cullGraph, edgeCurve, edgeGeometry, edgePathData, fitView, intersects, layeredLayout, nextSelection, nodeAt, nodeInDirection, panBy, portPoint, snapTo, toScreen, toWorld, visibleWorld, zoomAt };
325
+ const G9_GRAPH_FLOW_SPEED = 24;
326
+ function flowPeriod(beads) {
327
+ return beads ? 14 : 10;
328
+ }
329
+ function edgeSvg(d, ax, ay, bx, by, color, colorTo, width, glow, dash, beads, ends, gid, offset, animSeconds) {
330
+ let out = '';
331
+ const stroke = colorTo ? `url(#${gid})` : color;
332
+ if (colorTo) out += `<defs><linearGradient id="${gid}" gradientUnits="userSpaceOnUse" x1="${r1(ax)}" y1="${r1(ay)}" x2="${r1(bx)}" y2="${r1(by)}"><stop offset="0" stop-color="${color}"/><stop offset="1" stop-color="${colorTo}"/></linearGradient></defs>`;
333
+ if (glow > 0) out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-opacity="0.25" stroke-width="${r1(width + 2 * glow)}" stroke-linecap="round"/>`;
334
+ const period = flowPeriod(beads);
335
+ const anim = 2 === dash && animSeconds > 0 ? `<animate attributeName="stroke-dashoffset" from="0" to="-${period}" dur="${Math.round(100 * animSeconds) / 100}s" repeatCount="indefinite"/>` : '';
336
+ const off = 2 === dash && offset ? ` stroke-dashoffset="${r1(offset)}"` : '';
337
+ if (2 === dash && beads) {
338
+ out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-opacity="0.45" stroke-width="${width}"/>`;
339
+ out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-width="${r1(Math.max(4, 2.6 * width))}" stroke-linecap="round" stroke-dasharray="0 ${period}"${off}>${anim}</path>`;
340
+ } else if (0 === dash) out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-width="${width}"/>`;
341
+ else out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-width="${width}" stroke-dasharray="6 4"${off}>${anim}</path>`;
342
+ if (ends) {
343
+ const r = r1(Math.max(2.5, width + 1.5));
344
+ out += `<circle cx="${r1(ax)}" cy="${r1(ay)}" r="${r}" fill="${color}"/><circle cx="${r1(bx)}" cy="${r1(by)}" r="${r}" fill="${colorTo || color}"/>`;
345
+ }
346
+ return out;
347
+ }
348
+ export { G9_GRAPH_FLOW_SPEED, G9_GRAPH_IDENTITY, bezierPoint, clampZoom, contentBounds, cullGraph, edgeCurve, edgeGeometry, edgePathData, edgeSvg, fitView, flowPeriod, intersects, layeredLayout, nextSelection, nodeAt, nodeInDirection, panBy, portPoint, snapTo, toScreen, toWorld, visibleWorld, zoomAt };
324
349
 
325
350
  //# sourceMappingURL=core.js.map