@g9tm/lynxcontrols-graph 2.11.10 → 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/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../src/core.ts"],"sourcesContent":["// The plain-TypeScript core of G9GraphCanvas (2.9.0, G9ProxyManager): the view (pan and zoom), ports and bezier edges,\n// bounds and fit, off-screen culling, snapping, selection, keyboard navigation between nodes and a simple layered\n// auto-layout. No JSX and no runtime import, so Node tests it whole and the canvas's main-thread code mirrors it. The\n// functions named `…MT` are the main-thread twins (a worklet may only call other worklets).\n\n/** A point or a size in world units (the graph's own space, before the zoom). */\nexport interface G9GraphPoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** A rect in world units. */\nexport interface G9GraphRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** How the world is shown: screen = world × zoom + (x, y). */\nexport interface G9GraphView {\n readonly zoom: number;\n readonly x: number;\n readonly y: number;\n}\n\n/** A port on a node's side; `offset` 0..1 along the side (default spread evenly among that side's ports). */\nexport interface G9GraphPort {\n readonly id: string;\n readonly side: 'left' | 'right';\n readonly offset?: number;\n}\n\n/** A node as the canvas needs it: where, how big, its ports. The app draws its card. */\nexport interface G9GraphNode {\n readonly id: string;\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n readonly ports?: readonly G9GraphPort[];\n /** Whether it may be dragged (default true). */\n readonly draggable?: boolean;\n /** Whether it takes a drop of this external drag payload (`G9DragPayload` of `@g9tm/lynxcontrols/pointer`). */\n readonly acceptsDrop?: (payload: { readonly kind: string; readonly data: unknown }) => boolean;\n}\n\n/** An end of an edge: a node, and one of its ports (default: the right side's middle for a source, left for a target). */\nexport interface G9GraphEnd {\n readonly node: string;\n readonly port?: string;\n}\n\n/** How an edge is drawn. */\nexport type G9GraphEdgeStyle = 'solid' | 'dashed' | 'active';\n\n/** An edge between two node ports. */\nexport interface G9GraphEdge {\n readonly id: string;\n readonly from: G9GraphEnd;\n readonly to: G9GraphEnd;\n readonly label?: string;\n /** `'active'` is dashed and moving. Default `'solid'`. */\n readonly style?: G9GraphEdgeStyle;\n /** A colour of the app's own (default the theme's outline; active: primary). */\n readonly color?: string;\n readonly width?: number;\n}\n\n/** A titled background area (a lane, a pillar) at an app-given rect. */\nexport interface G9GraphGroup {\n readonly id: string;\n readonly title?: string;\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n /** A colour of the app's own for its fill (default the theme's container colour). */\n readonly color?: string;\n}\n\n/** The identity view. */\nexport const G9_GRAPH_IDENTITY: G9GraphView = Object.freeze({ zoom: 1, x: 0, y: 0 });\n\n/** Keeps `zoom` within [min, max]. */\nexport function clampZoom(zoom: number, min: number, max: number): number {\n if (!Number.isFinite(zoom)) return 1;\n return Math.min(max, Math.max(min, zoom));\n}\n\n/** The world point under a screen point (relative to the canvas). */\nexport function toWorld(view: G9GraphView, sx: number, sy: number): G9GraphPoint {\n return { x: (sx - view.x) / view.zoom, y: (sy - view.y) / view.zoom };\n}\n\n/** The screen point (relative to the canvas) of a world point. */\nexport function toScreen(view: G9GraphView, wx: number, wy: number): G9GraphPoint {\n return { x: wx * view.zoom + view.x, y: wy * view.zoom + view.y };\n}\n\n/** Zooms by `factor` keeping the world point under the screen point (sx, sy) still: wheel and pinch around the pointer. */\nexport function zoomAt(\n view: G9GraphView,\n factor: number,\n sx: number,\n sy: number,\n min: number,\n max: number,\n): G9GraphView {\n const zoom = clampZoom(view.zoom * factor, min, max);\n const k = zoom / view.zoom;\n return { zoom, x: sx - (sx - view.x) * k, y: sy - (sy - view.y) * k };\n}\n\n/** Moves the view by a screen delta. */\nexport function panBy(view: G9GraphView, dx: number, dy: number): G9GraphView {\n return { zoom: view.zoom, x: view.x + dx, y: view.y + dy };\n}\n\n/** The rect around every node and group; null when there is nothing. */\nexport function contentBounds(nodes: readonly G9GraphRect[], groups: readonly G9GraphRect[] = []): G9GraphRect | null {\n let x0 = Number.POSITIVE_INFINITY;\n let y0 = Number.POSITIVE_INFINITY;\n let x1 = Number.NEGATIVE_INFINITY;\n let y1 = Number.NEGATIVE_INFINITY;\n for (const r of nodes.concat(groups)) {\n x0 = Math.min(x0, r.x);\n y0 = Math.min(y0, r.y);\n x1 = Math.max(x1, r.x + r.width);\n y1 = Math.max(y1, r.y + r.height);\n }\n return Number.isFinite(x0) ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : null;\n}\n\n/** The view that shows `bounds` whole inside a viewport of `width` × `height`, centred, with `padding` (screen px). */\nexport function fitView(\n bounds: G9GraphRect | null,\n width: number,\n height: number,\n options: { readonly padding?: number; readonly minZoom?: number; readonly maxZoom?: number } = {},\n): G9GraphView {\n if (!bounds || width <= 0 || height <= 0) return G9_GRAPH_IDENTITY;\n const pad = options.padding ?? 32;\n const zx = (width - pad * 2) / Math.max(1, bounds.width);\n const zy = (height - pad * 2) / Math.max(1, bounds.height);\n const zoom = clampZoom(Math.min(zx, zy), options.minZoom ?? 0.1, options.maxZoom ?? 1);\n return {\n zoom,\n x: (width - bounds.width * zoom) / 2 - bounds.x * zoom,\n y: (height - bounds.height * zoom) / 2 - bounds.y * zoom,\n };\n}\n\n/** The world rect the viewport shows, grown by `margin` (a share of the viewport on each side) for culling. */\nexport function visibleWorld(view: G9GraphView, width: number, height: number, margin = 0.5): G9GraphRect {\n const tl = toWorld(view, -width * margin, -height * margin);\n return {\n x: tl.x + 0,\n y: tl.y + 0,\n width: (width * (1 + margin * 2)) / view.zoom,\n height: (height * (1 + margin * 2)) / view.zoom,\n };\n}\n\n/** True when two rects overlap (touching counts). */\nexport function intersects(a: G9GraphRect, b: G9GraphRect): boolean {\n return a.x <= b.x + b.width && b.x <= a.x + a.width && a.y <= b.y + b.height && b.y <= a.y + a.height;\n}\n\n/** Where an edge end sits: its port's point on the node's side, in world units. */\nexport function portPoint(node: G9GraphNode, end: G9GraphEnd | undefined, role: 'from' | 'to'): G9GraphPoint {\n const ports = node.ports ?? [];\n const port = end?.port !== undefined ? ports.find((p) => p.id === end.port) : undefined;\n const side = port?.side ?? (role === 'from' ? 'right' : 'left');\n let offset = port?.offset;\n if (port && offset === undefined) {\n const same = ports.filter((p) => p.side === side);\n offset = (same.indexOf(port) + 1) / (same.length + 1);\n }\n return { x: side === 'right' ? node.x + node.width : node.x, y: node.y + node.height * (offset ?? 0.5) };\n}\n\n/** The bezier of an edge leaving `a` to the right and entering `b` from the left (both sides honoured). */\nexport function edgeCurve(\n a: G9GraphPoint,\n b: G9GraphPoint,\n aSide: 'left' | 'right' = 'right',\n bSide: 'left' | 'right' = 'left',\n curvature = 0.5,\n): { readonly c1: G9GraphPoint; readonly c2: G9GraphPoint } {\n const d = Math.max(40, Math.abs(b.x - a.x) * curvature);\n return {\n c1: { x: a.x + (aSide === 'right' ? d : -d), y: a.y },\n c2: { x: b.x + (bSide === 'left' ? -d : d), y: b.y },\n };\n}\n\nconst r1 = (v: number) => Math.round(v * 10) / 10;\n\n/** The SVG path data of an edge's bezier. */\nexport function edgePathData(a: G9GraphPoint, b: G9GraphPoint, c1: G9GraphPoint, c2: G9GraphPoint): string {\n return `M${r1(a.x)} ${r1(a.y)}C${r1(c1.x)} ${r1(c1.y)} ${r1(c2.x)} ${r1(c2.y)} ${r1(b.x)} ${r1(b.y)}`;\n}\n\n/** The bezier's point at t (the label sits at t = 0.5). */\nexport function bezierPoint(\n a: G9GraphPoint,\n c1: G9GraphPoint,\n c2: G9GraphPoint,\n b: G9GraphPoint,\n t: number,\n): G9GraphPoint {\n const u = 1 - t;\n const w0 = u * u * u;\n const w1 = 3 * u * u * t;\n const w2 = 3 * u * t * t;\n const w3 = t * t * t;\n return { x: w0 * a.x + w1 * c1.x + w2 * c2.x + w3 * b.x, y: w0 * a.y + w1 * c1.y + w2 * c2.y + w3 * b.y };\n}\n\n/** An edge laid out: its path, label point and bounding rect, or null when an end's node is missing. */\nexport interface G9EdgeGeometry {\n readonly id: string;\n readonly d: string;\n readonly mid: G9GraphPoint;\n readonly box: G9GraphRect;\n}\n\n/** Lays out an edge between its nodes. */\nexport function edgeGeometry(\n edge: G9GraphEdge,\n byId: ReadonlyMap<string, G9GraphNode>,\n curvature = 0.5,\n): G9EdgeGeometry | null {\n const na = byId.get(edge.from.node);\n const nb = byId.get(edge.to.node);\n if (!na || !nb) return null;\n const a = portPoint(na, edge.from, 'from');\n const b = portPoint(nb, edge.to, 'to');\n const sideOf = (n: G9GraphNode, end: G9GraphEnd, role: 'from' | 'to') =>\n n.ports?.find((p) => p.id === end.port)?.side ?? (role === 'from' ? 'right' : 'left');\n const { c1, c2 } = edgeCurve(a, b, sideOf(na, edge.from, 'from'), sideOf(nb, edge.to, 'to'), curvature);\n const xs = [a.x, b.x, c1.x, c2.x];\n const ys = [a.y, b.y, c1.y, c2.y];\n const x0 = Math.min(...xs);\n const y0 = Math.min(...ys);\n return {\n id: edge.id,\n d: edgePathData(a, b, c1, c2),\n mid: bezierPoint(a, c1, c2, b, 0.5),\n box: { x: x0, y: y0, width: Math.max(...xs) - x0, height: Math.max(...ys) - y0 },\n };\n}\n\n/** What is drawn of the graph in the visible world: node ids and edges whose box meets it. */\nexport function cullGraph(\n nodes: readonly G9GraphNode[],\n edges: readonly G9EdgeGeometry[],\n visible: G9GraphRect,\n): { readonly nodes: ReadonlySet<string>; readonly edges: ReadonlySet<string> } {\n const n = new Set<string>();\n for (const node of nodes) if (intersects(node, visible)) n.add(node.id);\n const e = new Set<string>();\n for (const edge of edges) if (intersects(edge.box, visible)) e.add(edge.id);\n return { nodes: n, edges: e };\n}\n\n/** Rounds to the grid (no grid: unchanged). */\nexport function snapTo(v: number, grid: number | undefined): number {\n return grid && grid > 0 ? Math.round(v / grid) * grid : v;\n}\n\n/** The topmost node (the last drawn) under a world point, or null. */\nexport function nodeAt(nodes: readonly G9GraphNode[], wx: number, wy: number): G9GraphNode | null {\n for (let i = nodes.length - 1; i >= 0; i--) {\n const n = nodes[i] as G9GraphNode;\n if (wx >= n.x && wx <= n.x + n.width && wy >= n.y && wy <= n.y + n.height) return n;\n }\n return null;\n}\n\n/** The selection after a click on `id` (null: on empty space). `additive` (Shift / Ctrl / ⌘) toggles it. */\nexport function nextSelection(selection: readonly string[], id: string | null, additive: boolean): string[] {\n if (id === null) return additive ? selection.slice() : [];\n if (!additive) return [id];\n return selection.includes(id) ? selection.filter((s) => s !== id) : selection.concat(id);\n}\n\n/** An arrow key's direction. */\nexport type G9GraphDirection = 'left' | 'right' | 'up' | 'down';\n\n/** A lookup in a map that holds every id (the layout fills each map for every node first): it never misses. */\nfunction got<T>(m: ReadonlyMap<string, T>, k: string): T {\n return m.get(k) as T;\n}\n\n/**\n * The node an arrow moves the focus to: the nearest centre in that direction, weighing the sideways distance double;\n * null when there is none that way (or no node is focused and there are none).\n */\nexport function nodeInDirection(\n nodes: readonly G9GraphNode[],\n from: string | null,\n dir: G9GraphDirection,\n): string | null {\n const start = from ? nodes.find((n) => n.id === from) : undefined;\n if (!start) return nodes[0]?.id ?? null;\n const cx = start.x + start.width / 2;\n const cy = start.y + start.height / 2;\n let best: string | null = null;\n let score = Number.POSITIVE_INFINITY;\n for (const n of nodes) {\n if (n.id === start.id) continue;\n const dx = n.x + n.width / 2 - cx;\n const dy = n.y + n.height / 2 - cy;\n const along = dir === 'left' ? -dx : dir === 'right' ? dx : dir === 'up' ? -dy : dy;\n if (along <= 0) continue;\n const side = dir === 'left' || dir === 'right' ? Math.abs(dy) : Math.abs(dx);\n const s = along + side * 2;\n if (s < score) {\n score = s;\n best = n.id;\n }\n }\n return best;\n}\n\n/** Options of {@link layeredLayout}. */\nexport interface G9LayeredLayoutOptions {\n /** `'right'` (default): layers run left to right; `'down'`: top to bottom. */\n readonly direction?: 'right' | 'down';\n /** Between layers (world units). Default 80. */\n readonly layerGap?: number;\n /** Between nodes of a layer. Default 24. */\n readonly nodeGap?: number;\n /** Ordering sweeps that reduce crossings. Default 4. */\n readonly sweeps?: number;\n /** Where the first layer starts. Default (0, 0). */\n readonly origin?: G9GraphPoint;\n}\n\n/**\n * A simple layered auto-layout (longest-path layers, barycentre ordering): sources first, each node one layer past its\n * deepest predecessor; cycles are broken at the edge that closes them. Answers each node's top-left; the app applies it.\n */\nexport function layeredLayout(\n nodes: readonly Pick<G9GraphNode, 'id' | 'width' | 'height'>[],\n edges: readonly Pick<G9GraphEdge, 'from' | 'to'>[],\n options: G9LayeredLayoutOptions = {},\n): Map<string, G9GraphPoint> {\n const ids = nodes.map((n) => n.id);\n const known = new Set(ids);\n const out = new Map<string, string[]>();\n for (const id of ids) out.set(id, []);\n // drop self loops, unknown ends and the edges that close a cycle (depth-first, in the given order)\n const state = new Map<string, 0 | 1 | 2>();\n const raw = new Map<string, string[]>();\n for (const id of ids) raw.set(id, []);\n for (const e of edges)\n if (known.has(e.from.node) && known.has(e.to.node) && e.from.node !== e.to.node)\n raw.get(e.from.node)?.push(e.to.node);\n const visit = (id: string) => {\n state.set(id, 1);\n for (const t of got(raw, id)) {\n const s = state.get(t) ?? 0;\n if (s === 1) continue; // closes a cycle\n out.get(id)?.push(t);\n if (s === 0) visit(t);\n }\n state.set(id, 2);\n };\n for (const id of ids) if (!state.get(id)) visit(id);\n // longest path from the sources\n const indeg = new Map<string, number>(ids.map((id) => [id, 0]));\n for (const ts of out.values()) for (const t of ts) indeg.set(t, got(indeg, t) + 1);\n const layer = new Map<string, number>(ids.map((id) => [id, 0]));\n const queue = ids.filter((id) => indeg.get(id) === 0);\n for (let i = 0; i < queue.length; i++) {\n const id = queue[i] as string;\n for (const t of got(out, id)) {\n layer.set(t, Math.max(got(layer, t), got(layer, id) + 1));\n indeg.set(t, got(indeg, t) - 1);\n if (indeg.get(t) === 0) queue.push(t);\n }\n }\n const depth = Math.max(0, ...Array.from(layer.values()));\n const layers: string[][] = Array.from({ length: depth + 1 }, () => []);\n for (const id of ids) (layers[got(layer, id)] as string[]).push(id);\n // barycentre sweeps\n const preds = new Map<string, string[]>(ids.map((id) => [id, []]));\n for (const [s, ts] of out) for (const t of ts) preds.get(t)?.push(s);\n const posOf = new Map<string, number>();\n const index = () => {\n for (const l of layers)\n l.forEach((id, i) => {\n posOf.set(id, i);\n });\n };\n index();\n const sweeps = options.sweeps ?? 4;\n for (let s = 0; s < sweeps; s++) {\n const down = s % 2 === 0;\n const order = down ? layers.slice(1) : layers.slice(0, -1).reverse();\n for (const l of order) {\n const bary = new Map<string, number>();\n for (const id of l) {\n const ns = got(down ? preds : out, id);\n bary.set(id, ns.length ? ns.reduce((a, n) => a + got(posOf, n), 0) / ns.length : got(posOf, id));\n }\n l.sort((a, b) => got(bary, a) - got(bary, b) || got(posOf, a) - got(posOf, b));\n l.forEach((id, i) => {\n posOf.set(id, i);\n });\n }\n }\n // coordinates: layers side by side, each centred on the tallest\n const size = new Map(nodes.map((n) => [n.id, n]));\n const across = options.direction === 'down';\n const layerGap = options.layerGap ?? 80;\n const nodeGap = options.nodeGap ?? 24;\n const ox = options.origin?.x ?? 0;\n const oy = options.origin?.y ?? 0;\n const extent = (l: string[]) =>\n l.reduce((a, id) => a + (across ? got(size, id).width : got(size, id).height), 0) +\n nodeGap * Math.max(0, l.length - 1);\n const widest = Math.max(0, ...layers.map(extent));\n const result = new Map<string, G9GraphPoint>();\n let along = 0;\n for (const l of layers) {\n const thick = Math.max(0, ...l.map((id) => (across ? got(size, id).height : got(size, id).width)));\n let cross = (widest - extent(l)) / 2;\n for (const id of l) {\n const n = size.get(id) as Pick<G9GraphNode, 'width' | 'height'>;\n result.set(id, across ? { x: ox + cross, y: oy + along } : { x: ox + along, y: oy + cross });\n cross += (across ? n.width : n.height) + nodeGap;\n }\n along += thick + layerGap;\n }\n return result;\n}\n"],"names":["G9_GRAPH_IDENTITY","Object","clampZoom","zoom","min","max","Number","Math","toWorld","view","sx","sy","toScreen","wx","wy","zoomAt","factor","k","panBy","dx","dy","contentBounds","nodes","groups","x0","y0","x1","y1","r","fitView","bounds","width","height","options","_options_padding","_options_minZoom","_options_maxZoom","pad","zx","zy","visibleWorld","margin","tl","intersects","a","b","portPoint","node","end","role","_node_ports","ports","port","undefined","p","side","offset","same","edgeCurve","aSide","bSide","curvature","d","r1","v","edgePathData","c1","c2","bezierPoint","t","u","w0","w1","w2","w3","edgeGeometry","edge","byId","na","nb","sideOf","n","_n_ports_find","xs","ys","cullGraph","edges","visible","Set","e","snapTo","grid","nodeAt","i","nextSelection","selection","id","additive","s","got","m","nodeInDirection","from","dir","_nodes_","start","cx","cy","best","score","along","layeredLayout","_options_sweeps","_options_layerGap","_options_nodeGap","_raw_get","_preds_get","_options_origin","_options_origin1","ids","known","out","Map","state","raw","visit","_state_get","_out_get","indeg","ts","layer","queue","depth","Array","layers","preds","posOf","index","l","sweeps","down","order","bary","ns","size","across","layerGap","nodeGap","ox","oy","extent","widest","result","thick","cross"],"mappings":"AAkFO,MAAMA,oBAAiCC,OAAO,MAAM,CAAC;IAAE,MAAM;IAAG,GAAG;IAAG,GAAG;AAAE;AAG3E,SAASC,UAAUC,IAAY,EAAEC,GAAW,EAAEC,GAAW;IAC9D,IAAI,CAACC,OAAO,QAAQ,CAACH,OAAO,OAAO;IACnC,OAAOI,KAAK,GAAG,CAACF,KAAKE,KAAK,GAAG,CAACH,KAAKD;AACrC;AAGO,SAASK,QAAQC,IAAiB,EAAEC,EAAU,EAAEC,EAAU;IAC/D,OAAO;QAAE,GAAID,AAAAA,CAAAA,KAAKD,KAAK,CAAC,AAAD,IAAKA,KAAK,IAAI;QAAE,GAAIE,AAAAA,CAAAA,KAAKF,KAAK,CAAC,AAAD,IAAKA,KAAK,IAAI;IAAC;AACtE;AAGO,SAASG,SAASH,IAAiB,EAAEI,EAAU,EAAEC,EAAU;IAChE,OAAO;QAAE,GAAGD,KAAKJ,KAAK,IAAI,GAAGA,KAAK,CAAC;QAAE,GAAGK,KAAKL,KAAK,IAAI,GAAGA,KAAK,CAAC;IAAC;AAClE;AAGO,SAASM,OACdN,IAAiB,EACjBO,MAAc,EACdN,EAAU,EACVC,EAAU,EACV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AO,GAAGL,KAAKvC;YAAM,IAAI;gBAAE,GAAGsC,KAAKtC;gBAAO,GAAGuC,KAAKK;YAAM;YAC1FA,SAAUT,AAAAA,CAAAA,SAAShE,EAAE,KAAK,GAAGA,EAAE,MAAK,IAAKkE;QAC3C;QACArC,SAAS2C,QAAQP;IACnB;IACA,OAAOM;AACT"}
1
+ {"version":3,"file":"core.js","sources":["../src/core.ts"],"sourcesContent":["// The plain-TypeScript core of G9GraphCanvas (2.9.0, G9ProxyManager): the view (pan and zoom), ports and bezier edges,\n// bounds and fit, off-screen culling, snapping, selection, keyboard navigation between nodes and a simple layered\n// auto-layout. No JSX and no runtime import, so Node tests it whole and the canvas's main-thread code mirrors it. The\n// functions named `…MT` are the main-thread twins (a worklet may only call other worklets).\n\n/** A point or a size in world units (the graph's own space, before the zoom). */\nexport interface G9GraphPoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** A rect in world units. */\nexport interface G9GraphRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** How the world is shown: screen = world × zoom + (x, y). */\nexport interface G9GraphView {\n readonly zoom: number;\n readonly x: number;\n readonly y: number;\n}\n\n/** A port on a node's side; `offset` 0..1 along the side (default spread evenly among that side's ports). */\nexport interface G9GraphPort {\n readonly id: string;\n readonly side: 'left' | 'right';\n readonly offset?: number;\n}\n\n/** A node as the canvas needs it: where, how big, its ports. The app draws its card. */\nexport interface G9GraphNode {\n readonly id: string;\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n readonly ports?: readonly G9GraphPort[];\n /** Whether it may be dragged (default true). */\n readonly draggable?: boolean;\n /** Whether it takes a drop of this external drag payload (`G9DragPayload` of `@g9tm/lynxcontrols/pointer`). */\n readonly acceptsDrop?: (payload: { readonly kind: string; readonly data: unknown }) => boolean;\n}\n\n/** An end of an edge: a node, and one of its ports (default: the right side's middle for a source, left for a target). */\nexport interface G9GraphEnd {\n readonly node: string;\n readonly port?: string;\n}\n\n/** How an edge is drawn. */\nexport type G9GraphEdgeStyle = 'solid' | 'dashed' | 'active';\n\n/** What moves along an active edge (2.11.12): dashes, or small round beads. */\nexport type G9GraphEdgeFlow = 'dashes' | 'beads';\n\n/** When an edge's label shows (2.11.12): never, while the pointer is near the edge, or always. */\nexport type G9GraphLabelMode = 'none' | 'hover' | 'always';\n\n/** An edge between two node ports. */\nexport interface G9GraphEdge {\n readonly id: string;\n readonly from: G9GraphEnd;\n readonly to: G9GraphEnd;\n readonly label?: string;\n /** `'active'` is dashed and moving. Default `'solid'`. */\n readonly style?: G9GraphEdgeStyle;\n /** A colour of the app's own (default the theme's outline; active: primary). */\n readonly color?: string;\n readonly width?: number;\n /**\n * A soft halo (2.11.12): a translucent under-stroke in the edge's colour (alpha 0.25), `glow` px wider on each side.\n */\n readonly glow?: number;\n /** A gradient (2.11.12): from `color` at the source end to `colorTo` at the target end. */\n readonly colorTo?: string;\n /** What moves along an active edge (2.11.12). Default `'dashes'`. */\n readonly flow?: G9GraphEdgeFlow;\n /** How fast it moves, in world px a second (2.11.12; tie it to the traffic). Default 24. */\n readonly flowSpeed?: number;\n /** Small port dots at both ends (2.11.12). */\n readonly ends?: boolean;\n /** When its label shows (2.11.12). Default: the canvas's `edgeLabels` (`'always'`). */\n readonly labelMode?: G9GraphLabelMode;\n}\n\n/** A titled background area (a lane, a pillar) at an app-given rect. */\nexport interface G9GraphGroup {\n readonly id: string;\n readonly title?: string;\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n /** A colour of the app's own for its fill (default the theme's container colour). */\n readonly color?: string;\n /** The title's colour (2.11.12). */\n readonly titleColor?: string;\n /** The border's colour (2.11.12). */\n readonly borderColor?: string;\n /** A 2 px line along the top in this colour (2.11.12): a lane's tone. */\n readonly accent?: string;\n}\n\n/** A pattern behind the graph in world space (2.11.12): it pans and zooms with the view. */\nexport interface G9GraphBackground {\n readonly kind: 'dots' | 'grid';\n /** The pattern's step in world units. */\n readonly gap: number;\n readonly color: string;\n /** A dot's radius or a line's width in screen px. Default 1. */\n readonly size?: number;\n}\n\n/** The identity view. */\nexport const G9_GRAPH_IDENTITY: G9GraphView = Object.freeze({ zoom: 1, x: 0, y: 0 });\n\n/** Keeps `zoom` within [min, max]. */\nexport function clampZoom(zoom: number, min: number, max: number): number {\n if (!Number.isFinite(zoom)) return 1;\n return Math.min(max, Math.max(min, zoom));\n}\n\n/** The world point under a screen point (relative to the canvas). */\nexport function toWorld(view: G9GraphView, sx: number, sy: number): G9GraphPoint {\n return { x: (sx - view.x) / view.zoom, y: (sy - view.y) / view.zoom };\n}\n\n/** The screen point (relative to the canvas) of a world point. */\nexport function toScreen(view: G9GraphView, wx: number, wy: number): G9GraphPoint {\n return { x: wx * view.zoom + view.x, y: wy * view.zoom + view.y };\n}\n\n/** Zooms by `factor` keeping the world point under the screen point (sx, sy) still: wheel and pinch around the pointer. */\nexport function zoomAt(\n view: G9GraphView,\n factor: number,\n sx: number,\n sy: number,\n min: number,\n max: number,\n): G9GraphView {\n const zoom = clampZoom(view.zoom * factor, min, max);\n const k = zoom / view.zoom;\n return { zoom, x: sx - (sx - view.x) * k, y: sy - (sy - view.y) * k };\n}\n\n/** Moves the view by a screen delta. */\nexport function panBy(view: G9GraphView, dx: number, dy: number): G9GraphView {\n return { zoom: view.zoom, x: view.x + dx, y: view.y + dy };\n}\n\n/** The rect around every node and group; null when there is nothing. */\nexport function contentBounds(nodes: readonly G9GraphRect[], groups: readonly G9GraphRect[] = []): G9GraphRect | null {\n let x0 = Number.POSITIVE_INFINITY;\n let y0 = Number.POSITIVE_INFINITY;\n let x1 = Number.NEGATIVE_INFINITY;\n let y1 = Number.NEGATIVE_INFINITY;\n for (const r of nodes.concat(groups)) {\n x0 = Math.min(x0, r.x);\n y0 = Math.min(y0, r.y);\n x1 = Math.max(x1, r.x + r.width);\n y1 = Math.max(y1, r.y + r.height);\n }\n return Number.isFinite(x0) ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : null;\n}\n\n/** The view that shows `bounds` whole inside a viewport of `width` × `height`, centred, with `padding` (screen px). */\nexport function fitView(\n bounds: G9GraphRect | null,\n width: number,\n height: number,\n options: { readonly padding?: number; readonly minZoom?: number; readonly maxZoom?: number } = {},\n): G9GraphView {\n if (!bounds || width <= 0 || height <= 0) return G9_GRAPH_IDENTITY;\n const pad = options.padding ?? 32;\n const zx = (width - pad * 2) / Math.max(1, bounds.width);\n const zy = (height - pad * 2) / Math.max(1, bounds.height);\n const zoom = clampZoom(Math.min(zx, zy), options.minZoom ?? 0.1, options.maxZoom ?? 1);\n return {\n zoom,\n x: (width - bounds.width * zoom) / 2 - bounds.x * zoom,\n y: (height - bounds.height * zoom) / 2 - bounds.y * zoom,\n };\n}\n\n/** The world rect the viewport shows, grown by `margin` (a share of the viewport on each side) for culling. */\nexport function visibleWorld(view: G9GraphView, width: number, height: number, margin = 0.5): G9GraphRect {\n const tl = toWorld(view, -width * margin, -height * margin);\n return {\n x: tl.x + 0,\n y: tl.y + 0,\n width: (width * (1 + margin * 2)) / view.zoom,\n height: (height * (1 + margin * 2)) / view.zoom,\n };\n}\n\n/** True when two rects overlap (touching counts). */\nexport function intersects(a: G9GraphRect, b: G9GraphRect): boolean {\n return a.x <= b.x + b.width && b.x <= a.x + a.width && a.y <= b.y + b.height && b.y <= a.y + a.height;\n}\n\n/** Where an edge end sits: its port's point on the node's side, in world units. */\nexport function portPoint(node: G9GraphNode, end: G9GraphEnd | undefined, role: 'from' | 'to'): G9GraphPoint {\n const ports = node.ports ?? [];\n const port = end?.port !== undefined ? ports.find((p) => p.id === end.port) : undefined;\n const side = port?.side ?? (role === 'from' ? 'right' : 'left');\n let offset = port?.offset;\n if (port && offset === undefined) {\n const same = ports.filter((p) => p.side === side);\n offset = (same.indexOf(port) + 1) / (same.length + 1);\n }\n return { x: side === 'right' ? node.x + node.width : node.x, y: node.y + node.height * (offset ?? 0.5) };\n}\n\n/** The bezier of an edge leaving `a` to the right and entering `b` from the left (both sides honoured). */\nexport function edgeCurve(\n a: G9GraphPoint,\n b: G9GraphPoint,\n aSide: 'left' | 'right' = 'right',\n bSide: 'left' | 'right' = 'left',\n curvature = 0.5,\n): { readonly c1: G9GraphPoint; readonly c2: G9GraphPoint } {\n const d = Math.max(40, Math.abs(b.x - a.x) * curvature);\n return {\n c1: { x: a.x + (aSide === 'right' ? d : -d), y: a.y },\n c2: { x: b.x + (bSide === 'left' ? -d : d), y: b.y },\n };\n}\n\nconst r1 = (v: number) => Math.round(v * 10) / 10;\n\n/** The SVG path data of an edge's bezier. */\nexport function edgePathData(a: G9GraphPoint, b: G9GraphPoint, c1: G9GraphPoint, c2: G9GraphPoint): string {\n return `M${r1(a.x)} ${r1(a.y)}C${r1(c1.x)} ${r1(c1.y)} ${r1(c2.x)} ${r1(c2.y)} ${r1(b.x)} ${r1(b.y)}`;\n}\n\n/** The bezier's point at t (the label sits at t = 0.5). */\nexport function bezierPoint(\n a: G9GraphPoint,\n c1: G9GraphPoint,\n c2: G9GraphPoint,\n b: G9GraphPoint,\n t: number,\n): G9GraphPoint {\n const u = 1 - t;\n const w0 = u * u * u;\n const w1 = 3 * u * u * t;\n const w2 = 3 * u * t * t;\n const w3 = t * t * t;\n return { x: w0 * a.x + w1 * c1.x + w2 * c2.x + w3 * b.x, y: w0 * a.y + w1 * c1.y + w2 * c2.y + w3 * b.y };\n}\n\n/** An edge laid out: its path, label point and bounding rect, or null when an end's node is missing. */\nexport interface G9EdgeGeometry {\n readonly id: string;\n readonly d: string;\n readonly mid: G9GraphPoint;\n readonly box: G9GraphRect;\n /** The source port's point (2.11.12). */\n readonly from: G9GraphPoint;\n /** The target port's point (2.11.12). */\n readonly to: G9GraphPoint;\n}\n\n/** Lays out an edge between its nodes. */\nexport function edgeGeometry(\n edge: G9GraphEdge,\n byId: ReadonlyMap<string, G9GraphNode>,\n curvature = 0.5,\n): G9EdgeGeometry | null {\n const na = byId.get(edge.from.node);\n const nb = byId.get(edge.to.node);\n if (!na || !nb) return null;\n const a = portPoint(na, edge.from, 'from');\n const b = portPoint(nb, edge.to, 'to');\n const sideOf = (n: G9GraphNode, end: G9GraphEnd, role: 'from' | 'to') =>\n n.ports?.find((p) => p.id === end.port)?.side ?? (role === 'from' ? 'right' : 'left');\n const { c1, c2 } = edgeCurve(a, b, sideOf(na, edge.from, 'from'), sideOf(nb, edge.to, 'to'), curvature);\n const xs = [a.x, b.x, c1.x, c2.x];\n const ys = [a.y, b.y, c1.y, c2.y];\n const x0 = Math.min(...xs);\n const y0 = Math.min(...ys);\n return {\n id: edge.id,\n d: edgePathData(a, b, c1, c2),\n mid: bezierPoint(a, c1, c2, b, 0.5),\n box: { x: x0, y: y0, width: Math.max(...xs) - x0, height: Math.max(...ys) - y0 },\n from: a,\n to: b,\n };\n}\n\n/** What is drawn of the graph in the visible world: node ids and edges whose box meets it. */\nexport function cullGraph(\n nodes: readonly G9GraphNode[],\n edges: readonly G9EdgeGeometry[],\n visible: G9GraphRect,\n): { readonly nodes: ReadonlySet<string>; readonly edges: ReadonlySet<string> } {\n const n = new Set<string>();\n for (const node of nodes) if (intersects(node, visible)) n.add(node.id);\n const e = new Set<string>();\n for (const edge of edges) if (intersects(edge.box, visible)) e.add(edge.id);\n return { nodes: n, edges: e };\n}\n\n/** Rounds to the grid (no grid: unchanged). */\nexport function snapTo(v: number, grid: number | undefined): number {\n return grid && grid > 0 ? Math.round(v / grid) * grid : v;\n}\n\n/** The topmost node (the last drawn) under a world point, or null. */\nexport function nodeAt(nodes: readonly G9GraphNode[], wx: number, wy: number): G9GraphNode | null {\n for (let i = nodes.length - 1; i >= 0; i--) {\n const n = nodes[i] as G9GraphNode;\n if (wx >= n.x && wx <= n.x + n.width && wy >= n.y && wy <= n.y + n.height) return n;\n }\n return null;\n}\n\n/** The selection after a click on `id` (null: on empty space). `additive` (Shift / Ctrl / ⌘) toggles it. */\nexport function nextSelection(selection: readonly string[], id: string | null, additive: boolean): string[] {\n if (id === null) return additive ? selection.slice() : [];\n if (!additive) return [id];\n return selection.includes(id) ? selection.filter((s) => s !== id) : selection.concat(id);\n}\n\n/** An arrow key's direction. */\nexport type G9GraphDirection = 'left' | 'right' | 'up' | 'down';\n\n/** A lookup in a map that holds every id (the layout fills each map for every node first): it never misses. */\nfunction got<T>(m: ReadonlyMap<string, T>, k: string): T {\n return m.get(k) as T;\n}\n\n/**\n * The node an arrow moves the focus to: the nearest centre in that direction, weighing the sideways distance double;\n * null when there is none that way (or no node is focused and there are none).\n */\nexport function nodeInDirection(\n nodes: readonly G9GraphNode[],\n from: string | null,\n dir: G9GraphDirection,\n): string | null {\n const start = from ? nodes.find((n) => n.id === from) : undefined;\n if (!start) return nodes[0]?.id ?? null;\n const cx = start.x + start.width / 2;\n const cy = start.y + start.height / 2;\n let best: string | null = null;\n let score = Number.POSITIVE_INFINITY;\n for (const n of nodes) {\n if (n.id === start.id) continue;\n const dx = n.x + n.width / 2 - cx;\n const dy = n.y + n.height / 2 - cy;\n const along = dir === 'left' ? -dx : dir === 'right' ? dx : dir === 'up' ? -dy : dy;\n if (along <= 0) continue;\n const side = dir === 'left' || dir === 'right' ? Math.abs(dy) : Math.abs(dx);\n const s = along + side * 2;\n if (s < score) {\n score = s;\n best = n.id;\n }\n }\n return best;\n}\n\n/** Options of {@link layeredLayout}. */\nexport interface G9LayeredLayoutOptions {\n /** `'right'` (default): layers run left to right; `'down'`: top to bottom. */\n readonly direction?: 'right' | 'down';\n /** Between layers (world units). Default 80. */\n readonly layerGap?: number;\n /** Between nodes of a layer. Default 24. */\n readonly nodeGap?: number;\n /** Ordering sweeps that reduce crossings. Default 4. */\n readonly sweeps?: number;\n /** Where the first layer starts. Default (0, 0). */\n readonly origin?: G9GraphPoint;\n}\n\n/**\n * A simple layered auto-layout (longest-path layers, barycentre ordering): sources first, each node one layer past its\n * deepest predecessor; cycles are broken at the edge that closes them. Answers each node's top-left; the app applies it.\n */\nexport function layeredLayout(\n nodes: readonly Pick<G9GraphNode, 'id' | 'width' | 'height'>[],\n edges: readonly Pick<G9GraphEdge, 'from' | 'to'>[],\n options: G9LayeredLayoutOptions = {},\n): Map<string, G9GraphPoint> {\n const ids = nodes.map((n) => n.id);\n const known = new Set(ids);\n const out = new Map<string, string[]>();\n for (const id of ids) out.set(id, []);\n // drop self loops, unknown ends and the edges that close a cycle (depth-first, in the given order)\n const state = new Map<string, 0 | 1 | 2>();\n const raw = new Map<string, string[]>();\n for (const id of ids) raw.set(id, []);\n for (const e of edges)\n if (known.has(e.from.node) && known.has(e.to.node) && e.from.node !== e.to.node)\n raw.get(e.from.node)?.push(e.to.node);\n const visit = (id: string) => {\n state.set(id, 1);\n for (const t of got(raw, id)) {\n const s = state.get(t) ?? 0;\n if (s === 1) continue; // closes a cycle\n out.get(id)?.push(t);\n if (s === 0) visit(t);\n }\n state.set(id, 2);\n };\n for (const id of ids) if (!state.get(id)) visit(id);\n // longest path from the sources\n const indeg = new Map<string, number>(ids.map((id) => [id, 0]));\n for (const ts of out.values()) for (const t of ts) indeg.set(t, got(indeg, t) + 1);\n const layer = new Map<string, number>(ids.map((id) => [id, 0]));\n const queue = ids.filter((id) => indeg.get(id) === 0);\n for (let i = 0; i < queue.length; i++) {\n const id = queue[i] as string;\n for (const t of got(out, id)) {\n layer.set(t, Math.max(got(layer, t), got(layer, id) + 1));\n indeg.set(t, got(indeg, t) - 1);\n if (indeg.get(t) === 0) queue.push(t);\n }\n }\n const depth = Math.max(0, ...Array.from(layer.values()));\n const layers: string[][] = Array.from({ length: depth + 1 }, () => []);\n for (const id of ids) (layers[got(layer, id)] as string[]).push(id);\n // barycentre sweeps\n const preds = new Map<string, string[]>(ids.map((id) => [id, []]));\n for (const [s, ts] of out) for (const t of ts) preds.get(t)?.push(s);\n const posOf = new Map<string, number>();\n const index = () => {\n for (const l of layers)\n l.forEach((id, i) => {\n posOf.set(id, i);\n });\n };\n index();\n const sweeps = options.sweeps ?? 4;\n for (let s = 0; s < sweeps; s++) {\n const down = s % 2 === 0;\n const order = down ? layers.slice(1) : layers.slice(0, -1).reverse();\n for (const l of order) {\n const bary = new Map<string, number>();\n for (const id of l) {\n const ns = got(down ? preds : out, id);\n bary.set(id, ns.length ? ns.reduce((a, n) => a + got(posOf, n), 0) / ns.length : got(posOf, id));\n }\n l.sort((a, b) => got(bary, a) - got(bary, b) || got(posOf, a) - got(posOf, b));\n l.forEach((id, i) => {\n posOf.set(id, i);\n });\n }\n }\n // coordinates: layers side by side, each centred on the tallest\n const size = new Map(nodes.map((n) => [n.id, n]));\n const across = options.direction === 'down';\n const layerGap = options.layerGap ?? 80;\n const nodeGap = options.nodeGap ?? 24;\n const ox = options.origin?.x ?? 0;\n const oy = options.origin?.y ?? 0;\n const extent = (l: string[]) =>\n l.reduce((a, id) => a + (across ? got(size, id).width : got(size, id).height), 0) +\n nodeGap * Math.max(0, l.length - 1);\n const widest = Math.max(0, ...layers.map(extent));\n const result = new Map<string, G9GraphPoint>();\n let along = 0;\n for (const l of layers) {\n const thick = Math.max(0, ...l.map((id) => (across ? got(size, id).height : got(size, id).width)));\n let cross = (widest - extent(l)) / 2;\n for (const id of l) {\n const n = size.get(id) as Pick<G9GraphNode, 'width' | 'height'>;\n result.set(id, across ? { x: ox + cross, y: oy + along } : { x: ox + along, y: oy + cross });\n cross += (across ? n.width : n.height) + nodeGap;\n }\n along += thick + layerGap;\n }\n return result;\n}\n\n/** The default speed of an active edge's flow, in world px a second (2.11.12). */\nexport const G9_GRAPH_FLOW_SPEED = 24;\n\n/** The repeat of an active edge's pattern: dashes (6 + 4) or beads (one each 14 px). */\nexport function flowPeriod(beads: boolean): number {\n return beads ? 14 : 10;\n}\n\n/**\n * One edge's SVG (2.11.12): the glow under it, the stroke (a gradient with `colorTo`), the dashes or beads of an\n * active edge at `offset`, moving by SMIL when `animSeconds` > 0 (the web host animates them in the browser), and\n * the end dots. `dash`: 0 solid, 1 dashed, 2 active. Its twin `edgeSvgMT` (mt.ts) draws a dragged node's edges.\n */\nexport function edgeSvg(\n d: string,\n ax: number,\n ay: number,\n bx: number,\n by: number,\n color: string,\n colorTo: string,\n width: number,\n glow: number,\n dash: number,\n beads: boolean,\n ends: boolean,\n gid: string,\n offset: number,\n animSeconds: number,\n): string {\n let out = '';\n const stroke = colorTo ? `url(#${gid})` : color;\n if (colorTo)\n 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>`;\n if (glow > 0)\n out += `<path d=\"${d}\" fill=\"none\" stroke=\"${stroke}\" stroke-opacity=\"0.25\" stroke-width=\"${r1(width + glow * 2)}\" stroke-linecap=\"round\"/>`;\n const period = flowPeriod(beads);\n const anim =\n dash === 2 && animSeconds > 0\n ? `<animate attributeName=\"stroke-dashoffset\" from=\"0\" to=\"-${period}\" dur=\"${Math.round(animSeconds * 100) / 100}s\" repeatCount=\"indefinite\"/>`\n : '';\n const off = dash === 2 && offset ? ` stroke-dashoffset=\"${r1(offset)}\"` : '';\n if (dash === 2 && beads) {\n // the line itself, quieter, and the beads riding it\n out += `<path d=\"${d}\" fill=\"none\" stroke=\"${stroke}\" stroke-opacity=\"0.45\" stroke-width=\"${width}\"/>`;\n out += `<path d=\"${d}\" fill=\"none\" stroke=\"${stroke}\" stroke-width=\"${r1(Math.max(4, width * 2.6))}\" stroke-linecap=\"round\" stroke-dasharray=\"0 ${period}\"${off}>${anim}</path>`;\n } else if (dash === 0) out += `<path d=\"${d}\" fill=\"none\" stroke=\"${stroke}\" stroke-width=\"${width}\"/>`;\n else\n out += `<path d=\"${d}\" fill=\"none\" stroke=\"${stroke}\" stroke-width=\"${width}\" stroke-dasharray=\"6 4\"${off}>${anim}</path>`;\n if (ends) {\n const r = r1(Math.max(2.5, width + 1.5));\n out += `<circle cx=\"${r1(ax)}\" cy=\"${r1(ay)}\" r=\"${r}\" fill=\"${color}\"/><circle cx=\"${r1(bx)}\" cy=\"${r1(by)}\" r=\"${r}\" fill=\"${colorTo || color}\"/>`;\n }\n return out;\n}\n"],"names":["G9_GRAPH_IDENTITY","Object","clampZoom","zoom","min","max","Number","Math","toWorld","view","sx","sy","toScreen","wx","wy","zoomAt","factor","k","panBy","dx","dy","contentBounds","nodes","groups","x0","y0","x1","y1","r","fitView","bounds","width","height","options","_options_padding","_options_minZoom","_options_maxZoom","pad","zx","zy","visibleWorld","margin","tl","intersects","a","b","portPoint","node","end","role","_node_ports","ports","port","undefined","p","side","offset","same","edgeCurve","aSide","bSide","curvature","d","r1","v","edgePathData","c1","c2","bezierPoint","t","u","w0","w1","w2","w3","edgeGeometry","edge","byId","na","nb","sideOf","n","_n_ports_find","xs","ys","cullGraph","edges","visible","Set","e","snapTo","grid","nodeAt","i","nextSelection","selection","id","additive","s","got","m","nodeInDirection","from","dir","_nodes_","start","cx","cy","best","score","along","layeredLayout","_options_sweeps","_options_layerGap","_options_nodeGap","_raw_get","_preds_get","_options_origin","_options_origin1","ids","known","out","Map","state","raw","visit","_state_get","_out_get","indeg","ts","layer","queue","depth","Array","layers","preds","posOf","index","l","sweeps","down","order","bary","ns","size","across","layerGap","nodeGap","ox","oy","extent","widest","result","thick","cross","G9_GRAPH_FLOW_SPEED","flowPeriod","beads","edgeSvg","ax","ay","bx","by","color","colorTo","glow","dash","ends","gid","animSeconds","stroke","period","anim","off"],"mappings":"AAsHO,MAAMA,oBAAiCC,OAAO,MAAM,CAAC;IAAE,MAAM;IAAG,GAAG;IAAG,GAAG;AAAE;AAG3E,SAASC,UAAUC,IAAY,EAAEC,GAAW,EAAEC,GAAW;IAC9D,IAAI,CAACC,OAAO,QAAQ,CAACH,OAAO,OAAO;IACnC,OAAOI,KAAK,GAAG,CAACF,KAAKE,KAAK,GAAG,CAACH,KAAKD;AACrC;AAGO,SAASK,QAAQC,IAAiB,EAAEC,EAAU,EAAEC,EAAU;IAC/D,OAAO;QAAE,GAAID,AAAAA,CAAAA,KAAKD,KAAK,CAAC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,EAAEpG,GAAGkG,IAAI,MAAM,EAAElG,GAAGmG,IAAI,KAAK,EAAEtI,EAAE,QAAQ,EAAEwI,WAAWD,MAAM,GAAG,CAAC;IACtJ;IACA,OAAO1C;AACT"}
package/dist/core.jsx 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,4 +322,27 @@ 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 };
package/dist/graph.css CHANGED
@@ -6,6 +6,15 @@
6
6
  overflow: hidden;
7
7
  }
8
8
 
9
+ .g9-graph__bg {
10
+ background-repeat: repeat;
11
+ position: absolute;
12
+ top: 0;
13
+ bottom: 0;
14
+ left: 0;
15
+ right: 0;
16
+ }
17
+
9
18
  .g9-graph__world {
10
19
  transform-origin: 0 0;
11
20
  width: 1px;
@@ -28,6 +37,15 @@
28
37
  position: absolute;
29
38
  }
30
39
 
40
+ .g9-graph__group-accent {
41
+ border-radius: 1px;
42
+ height: 2px;
43
+ position: absolute;
44
+ top: 0;
45
+ left: 14px;
46
+ right: 14px;
47
+ }
48
+
31
49
  .g9-graph__group-title {
32
50
  font-size: 13px;
33
51
  font-family: var(--g9-font-text-600);
@@ -88,6 +106,23 @@
88
106
 
89
107
  .g9-graph__node--dragging {
90
108
  opacity: .92;
109
+ box-shadow: 0 10px 28px #00000052;
110
+ }
111
+
112
+ .g9-graph__node--enter {
113
+ animation: .22s ease-out g9-graph-enter;
114
+ }
115
+
116
+ @keyframes g9-graph-enter {
117
+ 0% {
118
+ opacity: 0;
119
+ transform: scale(.94);
120
+ }
121
+
122
+ 100% {
123
+ opacity: 1;
124
+ transform: scale(1);
125
+ }
91
126
  }
92
127
 
93
128
  .g9-graph__node--candidate {
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://./src/graph.css"],"names":[],"mappings":"AAEA;EADE,iDAAiD;EACjD,WAAW;EACX,aAAa;EACb,kBAAkB;EAClB,gBAAgB;AAClB;;AAMA;EAHE,qBAAqB;EACrB,UAAU;EACV,WAAW;EACX,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,iBAAiB;AACnB;;AAMA;EAHE,mBAAmB;EACnB,iBAAiB;EACjB,uCAAuC;EACvC,6CAA6C;EAC7C,mBAAmB;EACnB,sBAAsB;EACtB,kBAAkB;EAClB,aAAa;EACb,kBAAkB;AACpB;;AAMA;EAHE,eAAe;EACf,oCAAoC;EACpC,mCAAmC;EACnC,gBAAgB;AAClB;;AAMA;EAHE,oBAAoB;EACpB,kBAAkB;AACpB;;AAMA;EAHE,QAAQ;EACR,SAAS;EACT,MAAM;EACN,OAAO;AACT;;AAMA;EAHE,mCAAmC;EACnC,mBAAmB;EACnB,iBAAiB;EACjB,uCAAuC;EACvC,oBAAoB;EACpB,gBAAgB;EAChB,aAAa;EACb,kBAAkB;EAClB,gCAAgC;AAClC;;AAMA;EAHE,eAAe;EACf,gCAAgC;EAChC,mCAAmC;AACrC;;AAMA;EAHE,uBAAuB;EACvB,mBAAmB;EACnB,sBAAsB;EACtB,aAAa;EACb,kBAAkB;AACpB;;AAQA;EALE,+BAA+B;AACjC;;AAQA;EALE,+BAA+B;EAC/B,oBAAoB;AACtB;;AAQA;EALE,mBAAmB;AACrB;;AAQA;EALE,YAAY;AACd;;AAQA;EALE,gCAAgC;EAChC,oBAAoB;AACtB;;AAQA;EALE,gCAAgC;EAChC,8CAA8C;EAC9C,mBAAmB;AACrB;;AAQA;EALE,mCAAmC;EACnC,mBAAmB;EACnB,iBAAiB;EACjB,uCAAuC;EACvC,mBAAmB;EACnB,sBAAsB;EACtB,aAAa;EACb,kBAAkB;EAClB,YAAY;AACd;;AAQA;EALE,WAAW;AACb;;AAQA;EALE,UAAU;AACZ;;AAQA;EALE,uBAAuB;EACvB,mBAAmB;EACnB,WAAW;EACX,YAAY;EACZ,aAAa;AACf;;AAQA;EALE,kDAAkD;AACpD;;AAQA;EALE,WAAW;EACX,YAAY;AACd","sourcesContent":["/* G9GraphCanvas (2.9.0): the canvas clips; the world is transformed from its top-left (main thread); groups, edges,\n labels and cards are placed in world units; the zoom buttons sit at the bottom end. */\n.g9-graph {\n display: flex;\n position: relative;\n overflow: hidden;\n flex-grow: 1;\n flex-shrink: 1;\n flex-basis: 0px;\n background-color: var(--g9-surface-container-low);\n}\n\n.g9-graph__world {\n position: absolute;\n left: 0px;\n top: 0px;\n width: 1px;\n height: 1px;\n transform-origin: 0px 0px;\n overflow: visible;\n}\n\n.g9-graph__group {\n position: absolute;\n display: flex;\n flex-direction: column;\n border-radius: 16px;\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n background-color: var(--g9-surface-container);\n padding: 10px 14px;\n}\n\n.g9-graph__group-title {\n font-size: 13px;\n font-family: var(--g9-font-text-600);\n font-weight: 600;\n color: var(--g9-on-surface-variant);\n}\n\n.g9-graph__edges {\n position: absolute;\n pointer-events: none;\n}\n\n.g9-graph__edges--live {\n left: 0px;\n top: 0px;\n width: 0px;\n height: 0px;\n}\n\n.g9-graph__edge-label {\n position: absolute;\n display: flex;\n transform: translate(-50%, -50%);\n padding: 2px 8px;\n border-radius: 999px;\n background-color: var(--g9-surface);\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n}\n\n.g9-graph__edge-text {\n font-size: 11px;\n font-family: var(--g9-font-text);\n color: var(--g9-on-surface-variant);\n}\n\n.g9-graph__node {\n position: absolute;\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n border-width: 2px;\n border-style: solid;\n border-color: transparent;\n}\n\n.g9-graph__node--selected {\n border-color: var(--g9-primary);\n}\n\n.g9-graph__node--focused {\n border-color: var(--g9-primary);\n border-style: dashed;\n}\n\n.g9-graph__node--selfocus {\n border-style: solid;\n}\n\n.g9-graph__node--dragging {\n opacity: 0.92;\n}\n\n.g9-graph__node--candidate {\n border-color: var(--g9-tertiary);\n border-style: dashed;\n}\n\n.g9-graph__node--over {\n border-color: var(--g9-tertiary);\n border-style: solid;\n background-color: var(--g9-tertiary-container);\n}\n\n.g9-graph__controls {\n position: absolute;\n bottom: 12px;\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n background-color: var(--g9-surface);\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n}\n\n.g9-graph__controls--ltr {\n right: 12px;\n}\n\n.g9-graph__controls--rtl {\n left: 12px;\n}\n\n.g9-graph__button {\n display: flex;\n width: 36px;\n height: 36px;\n align-items: center;\n justify-content: center;\n}\n\n.g9-graph__button:active {\n background-color: var(--g9-surface-container-high);\n}\n\n.g9-graph__icon {\n width: 18px;\n height: 18px;\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://./src/graph.css"],"names":[],"mappings":"AAEA;EADE,iDAAiD;EACjD,WAAW;EACX,aAAa;EACb,kBAAkB;EAClB,gBAAgB;AAClB;;AAOA;EAJE,yBAAyB;EACzB,kBAAkB;EAClB,MAAM;EACN,SAAS;EACT,OAAO;EACP,QAAQ;AACV;;AAOA;EAJE,qBAAqB;EACrB,UAAU;EACV,WAAW;EACX,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,iBAAiB;AACnB;;AAOA;EAJE,mBAAmB;EACnB,iBAAiB;EACjB,uCAAuC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AACpD;;AAWA;EARE,WAAW;EACX,YAAY;AACd","sourcesContent":["/* G9GraphCanvas (2.9.0): the canvas clips; the world is transformed from its top-left (main thread); groups, edges,\n labels and cards are placed in world units; the zoom buttons sit at the bottom end. */\n.g9-graph {\n display: flex;\n position: relative;\n overflow: hidden;\n flex-grow: 1;\n flex-shrink: 1;\n flex-basis: 0px;\n background-color: var(--g9-surface-container-low);\n}\n\n/* The world-space pattern (background, 2.11.12): the canvas's size, its tile and offset follow the view. */\n.g9-graph__bg {\n position: absolute;\n left: 0px;\n top: 0px;\n right: 0px;\n bottom: 0px;\n background-repeat: repeat;\n}\n\n.g9-graph__world {\n position: absolute;\n left: 0px;\n top: 0px;\n width: 1px;\n height: 1px;\n transform-origin: 0px 0px;\n overflow: visible;\n}\n\n.g9-graph__group {\n position: absolute;\n display: flex;\n flex-direction: column;\n border-radius: 16px;\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n background-color: var(--g9-surface-container);\n padding: 10px 14px;\n}\n\n/* A lane's tone (accent, 2.11.12): a 2 px line along the top. */\n.g9-graph__group-accent {\n position: absolute;\n left: 14px;\n right: 14px;\n top: 0px;\n height: 2px;\n border-radius: 1px;\n}\n\n.g9-graph__group-title {\n font-size: 13px;\n font-family: var(--g9-font-text-600);\n font-weight: 600;\n color: var(--g9-on-surface-variant);\n}\n\n.g9-graph__edges {\n position: absolute;\n pointer-events: none;\n}\n\n.g9-graph__edges--live {\n left: 0px;\n top: 0px;\n width: 0px;\n height: 0px;\n}\n\n.g9-graph__edge-label {\n position: absolute;\n display: flex;\n transform: translate(-50%, -50%);\n padding: 2px 8px;\n border-radius: 999px;\n background-color: var(--g9-surface);\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n}\n\n.g9-graph__edge-text {\n font-size: 11px;\n font-family: var(--g9-font-text);\n color: var(--g9-on-surface-variant);\n}\n\n.g9-graph__node {\n position: absolute;\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n border-width: 2px;\n border-style: solid;\n border-color: transparent;\n}\n\n.g9-graph__node--selected {\n border-color: var(--g9-primary);\n}\n\n.g9-graph__node--focused {\n border-color: var(--g9-primary);\n border-style: dashed;\n}\n\n.g9-graph__node--selfocus {\n border-style: solid;\n}\n\n/* A dragged card lifts (2.11.12): a shadow; draggingClassName adds the app's own look. */\n.g9-graph__node--dragging {\n opacity: 0.92;\n box-shadow: 0px 10px 28px rgba(0, 0, 0, 0.32);\n}\n\n/* A card's first appearance (nodeEnter, 2.11.12): a fade from 94 %. */\n.g9-graph__node--enter {\n animation: g9-graph-enter 220ms ease-out;\n}\n\n@keyframes g9-graph-enter {\n 0% {\n opacity: 0;\n transform: scale(0.94);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.g9-graph__node--candidate {\n border-color: var(--g9-tertiary);\n border-style: dashed;\n}\n\n.g9-graph__node--over {\n border-color: var(--g9-tertiary);\n border-style: solid;\n background-color: var(--g9-tertiary-container);\n}\n\n.g9-graph__controls {\n position: absolute;\n bottom: 12px;\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n background-color: var(--g9-surface);\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n}\n\n.g9-graph__controls--ltr {\n right: 12px;\n}\n\n.g9-graph__controls--rtl {\n left: 12px;\n}\n\n.g9-graph__button {\n display: flex;\n width: 36px;\n height: 36px;\n align-items: center;\n justify-content: center;\n}\n\n.g9-graph__button:active {\n background-color: var(--g9-surface-container-high);\n}\n\n.g9-graph__icon {\n width: 18px;\n height: 18px;\n}\n"],"sourceRoot":""}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { G9GraphCanvas, type G9GraphCanvasHandle, type G9GraphCanvasProps, type G9GraphContextMenuEvent, type G9GraphDropEvent, type G9GraphLabels, type G9GraphNodeState, type G9GraphTarget, } from './canvas.js';
1
+ export { G9GraphCanvas, type G9GraphCanvasHandle, type G9GraphCanvasProps, type G9GraphContextMenuEvent, type G9GraphDropEvent, type G9GraphLabels, type G9GraphNodeState, type G9GraphTarget, graphBackgroundStyle, } from './canvas.js';
2
2
  export * from './core.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB,MAAM,UAAU,CAAC;AAClB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAClB,cAAc,QAAQ,CAAC"}
package/dist/index.jsx CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from "./core.jsx";
2
- export { G9GraphCanvas } from "./canvas.jsx";
2
+ export { G9GraphCanvas, graphBackgroundStyle } from "./canvas.jsx";
package/dist/mt.d.ts CHANGED
@@ -2,10 +2,28 @@
2
2
  export type G9MtNode = [string, number, number, number, number, number];
3
3
  /**
4
4
  * An edge as the main thread keeps it: id, from node, from dx, from dy, from side (1 right / -1 left), to node, to dx,
5
- * to dy, to side, the stroke (colour, width, dash: 0 solid / 1 dashed / 2 active). dx / dy: the port's offset from the
6
- * node's top-left.
5
+ * to dy, to side, the stroke (colour, width, dash: 0 solid / 1 dashed / 2 active), then (2.11.12) the glow, the gradient's
6
+ * end colour ('' none), flags (1 end dots, 2 beads, 4 a label shown on hover) and the flow's speed. dx / dy: the port's
7
+ * offset from the node's top-left.
7
8
  */
8
- export type G9MtEdge = [string, string, number, number, number, string, number, number, number, string, number, number];
9
+ export type G9MtEdge = [
10
+ id: string,
11
+ fromNode: string,
12
+ fromDx: number,
13
+ fromDy: number,
14
+ fromSide: number,
15
+ toNode: string,
16
+ toDx: number,
17
+ toDy: number,
18
+ toSide: number,
19
+ color: string,
20
+ width: number,
21
+ dash: number,
22
+ glow?: number,
23
+ colorTo?: string,
24
+ flags?: number,
25
+ speed?: number
26
+ ];
9
27
  /** Rounds to the grid on the main thread (0: unchanged). */
10
28
  export declare function snapMT(v: number, grid: number): number;
11
29
  /** `zoomAt` on the main thread: [zoom, x, y]. */
@@ -14,6 +32,8 @@ export declare function zoomAtMT(zoom: number, x: number, y: number, factor: num
14
32
  export declare function nodeIndexAtMT(nodes: G9MtNode[], wx: number, wy: number): number;
15
33
  /** One edge's bezier path data on the main thread (as `edgeCurve` + `edgePathData`). */
16
34
  export declare function edgePathMT(ax: number, ay: number, aSide: number, bx: number, by: number, bSide: number, curvature: number): string;
35
+ /** `edgeSvg` (core.ts) on the main thread: one edge's SVG, the same markup. */
36
+ export declare function edgeSvgMT(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;
17
37
  /**
18
38
  * The live SVG of the edges that touch moving nodes, on the main thread: `moved` maps a node id to its [x, y] now; the
19
39
  * other end stays where `nodes` has it. Answers the SVG and its world rect [x, y, width, height].
@@ -23,4 +43,9 @@ export declare function liveEdgesSvgMT(edges: G9MtEdge[], nodes: G9MtNode[], mov
23
43
  export declare function edgeOfTargetMT(target: {
24
44
  getAttribute?: (name: string) => unknown;
25
45
  } | null | undefined): string | null;
46
+ /**
47
+ * The edge whose curve passes within `tol` world px of (wx, wy) among those whose label shows on hover (flag 4), on the
48
+ * main thread (2.11.12): its id, or ''. Each curve is checked as 16 straight pieces.
49
+ */
50
+ export declare function edgeNearMT(edges: G9MtEdge[], nodes: G9MtNode[], wx: number, wy: number, tol: number, curvature: number): string;
26
51
  //# sourceMappingURL=mt.d.ts.map
package/dist/mt.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mt.d.ts","sourceRoot":"","sources":["../src/mt.ts"],"names":[],"mappings":"AAIA,oFAAoF;AACpF,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAExH,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,iDAAiD;AACjD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAK1B;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAO/E;AAOD,wFAAwF;AACxF,wBAAgB,UAAU,CACxB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,CAMR;AAED;;;GAGG;AAC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M,EAAE,MAAM,EAAE,MAAM,CAAC,CAyD1C;AAED,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,MAAM,EAAE;IAAE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAQrH;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,EAAE,EACjB,KAAK,EAAE,QAAQ,EAAE,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,MAAM,CAyCR"}
package/dist/mt.jsx CHANGED
@@ -31,6 +31,26 @@ function edgePathMT(ax, ay, aSide, bx, by, bSide, curvature) {
31
31
  const c2x = bx + bSide * d;
32
32
  return `M${r1(ax)} ${r1(ay)}C${r1(c1x)} ${r1(ay)} ${r1(c2x)} ${r1(by)} ${r1(bx)} ${r1(by)}`;
33
33
  }
34
+ function edgeSvgMT(d, ax, ay, bx, by, color, colorTo, width, glow, dash, beads, ends, gid, offset, animSeconds) {
35
+ 'main thread';
36
+ let out = '';
37
+ const stroke = colorTo ? `url(#${gid})` : color;
38
+ 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>`;
39
+ if (glow > 0) out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-opacity="0.25" stroke-width="${r1(width + 2 * glow)}" stroke-linecap="round"/>`;
40
+ const period = beads ? 14 : 10;
41
+ const anim = 2 === dash && animSeconds > 0 ? `<animate attributeName="stroke-dashoffset" from="0" to="-${period}" dur="${Math.round(100 * animSeconds) / 100}s" repeatCount="indefinite"/>` : '';
42
+ const off = 2 === dash && offset ? ` stroke-dashoffset="${r1(offset)}"` : '';
43
+ if (2 === dash && beads) {
44
+ out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-opacity="0.45" stroke-width="${width}"/>`;
45
+ 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>`;
46
+ } else if (0 === dash) out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-width="${width}"/>`;
47
+ else out += `<path d="${d}" fill="none" stroke="${stroke}" stroke-width="${width}" stroke-dasharray="6 4"${off}>${anim}</path>`;
48
+ if (ends) {
49
+ const r = r1(Math.max(2.5, width + 1.5));
50
+ out += `<circle cx="${r1(ax)}" cy="${r1(ay)}" r="${r}" fill="${color}"/><circle cx="${r1(bx)}" cy="${r1(by)}" r="${r}" fill="${colorTo || color}"/>`;
51
+ }
52
+ return out;
53
+ }
34
54
  function liveEdgesSvgMT(edges, nodes, moved, curvature) {
35
55
  'main thread';
36
56
  const pos = {};
@@ -44,7 +64,7 @@ function liveEdgesSvgMT(edges, nodes, moved, curvature) {
44
64
  let y1 = -1 / 0;
45
65
  const paths = [];
46
66
  for (const e of edges){
47
- var _moved_e_, _moved_e_1;
67
+ var _moved_e_, _moved_e_1, _e_, _e_1, _e_2, _e_3;
48
68
  if (!moved[e[1]] && !moved[e[5]]) continue;
49
69
  const a = null != (_moved_e_ = moved[e[1]]) ? _moved_e_ : pos[e[1]];
50
70
  const b = null != (_moved_e_1 = moved[e[5]]) ? _moved_e_1 : pos[e[5]];
@@ -58,8 +78,11 @@ function liveEdgesSvgMT(edges, nodes, moved, curvature) {
58
78
  y0 = Math.min(y0, ay - 8, by - 8);
59
79
  x1 = Math.max(x1, ax + pad, bx + pad);
60
80
  y1 = Math.max(y1, ay + 8, by + 8);
61
- const dash = 0 === e[11] ? '' : ' stroke-dasharray="6 4"';
62
- paths.push(`<path d="${edgePathMT(ax, ay, e[4], bx, by, e[8], curvature)}" fill="none" stroke="${e[9]}" stroke-width="${e[10]}"${dash}/>`);
81
+ const pad2 = (null != (_e_ = e[12]) ? _e_ : 0) + 8;
82
+ y0 = Math.min(y0, ay - pad2, by - pad2);
83
+ y1 = Math.max(y1, ay + pad2, by + pad2);
84
+ const flags = null != (_e_1 = e[14]) ? _e_1 : 0;
85
+ paths.push(edgeSvgMT(edgePathMT(ax, ay, e[4], bx, by, e[8], curvature), ax, ay, bx, by, e[9], null != (_e_2 = e[13]) ? _e_2 : '', e[10], null != (_e_3 = e[12]) ? _e_3 : 0, e[11], (2 & flags) !== 0, (1 & flags) !== 0, `g9gl${paths.length}`, 0, 0));
63
86
  }
64
87
  if (0 === paths.length) return [
65
88
  '',
@@ -88,4 +111,50 @@ function edgeOfTargetMT(target) {
88
111
  return null;
89
112
  }
90
113
  }
91
- export { edgeOfTargetMT, edgePathMT, liveEdgesSvgMT, nodeIndexAtMT, snapMT, zoomAtMT };
114
+ function edgeNearMT(edges, nodes, wx, wy, tol, curvature) {
115
+ 'main thread';
116
+ const pos = {};
117
+ for (const n of nodes)pos[n[0]] = [
118
+ n[1],
119
+ n[2]
120
+ ];
121
+ let best = '';
122
+ let bestD = tol;
123
+ for (const e of edges){
124
+ var _e_;
125
+ if (((null != (_e_ = e[14]) ? _e_ : 0) & 4) === 0) continue;
126
+ const a = pos[e[1]];
127
+ const b = pos[e[5]];
128
+ if (!a || !b) continue;
129
+ const ax = a[0] + e[2];
130
+ const ay = a[1] + e[3];
131
+ const bx = b[0] + e[6];
132
+ const by = b[1] + e[7];
133
+ const pad = Math.max(40, Math.abs(bx - ax) * curvature);
134
+ if (wx < Math.min(ax, bx) - pad - tol || wx > Math.max(ax, bx) + pad + tol) continue;
135
+ if (wy < Math.min(ay, by) - tol || wy > Math.max(ay, by) + tol) continue;
136
+ const c1x = ax + e[4] * pad;
137
+ const c2x = bx + e[8] * pad;
138
+ let px = ax;
139
+ let py = ay;
140
+ for(let i = 1; i <= 16; i++){
141
+ const t = i / 16;
142
+ const u = 1 - t;
143
+ const qx = u * u * u * ax + 3 * u * u * t * c1x + 3 * u * t * t * c2x + t * t * t * bx;
144
+ const qy = u * u * u * ay + 3 * u * u * t * ay + 3 * u * t * t * by + t * t * t * by;
145
+ const sx = qx - px;
146
+ const sy = qy - py;
147
+ const len = sx * sx + sy * sy;
148
+ const k = len > 0 ? Math.max(0, Math.min(1, ((wx - px) * sx + (wy - py) * sy) / len)) : 0;
149
+ const dist = Math.hypot(wx - (px + k * sx), wy - (py + k * sy));
150
+ if (dist < bestD) {
151
+ bestD = dist;
152
+ best = e[0];
153
+ }
154
+ px = qx;
155
+ py = qy;
156
+ }
157
+ }
158
+ return best;
159
+ }
160
+ export { edgeNearMT, edgeOfTargetMT, edgePathMT, edgeSvgMT, liveEdgesSvgMT, nodeIndexAtMT, snapMT, zoomAtMT };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g9tm/lynxcontrols-graph",
3
- "version": "2.11.10",
3
+ "version": "2.11.12",
4
4
  "description": "G9GraphCanvas: a node graph editor for ReactLynx — app-drawn cards at app-given positions, bezier edges between ports, lanes behind them; pan, wheel and pinch zoom, fit, main-thread node drag, selection, keyboard, context menus, external drops, culling. Its plain-TS core (view maths, edges, culling, layered auto-layout) at /core.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,10 +29,10 @@
29
29
  "build": "rslib build"
30
30
  },
31
31
  "dependencies": {
32
- "@g9tm/lynxcontrols-foundation": "2.11.10"
32
+ "@g9tm/lynxcontrols-foundation": "2.11.12"
33
33
  },
34
34
  "peerDependencies": {
35
- "@g9tm/lynxcontrols": "2.11.10",
35
+ "@g9tm/lynxcontrols": "2.11.12",
36
36
  "@lynx-js/react": ">=0.129.3 <0.130.0"
37
37
  }
38
38
  }