@modernrelay/orbit-engine-cosmos 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/restoreDeadline.ts","../src/CosmosEngine.ts"],"names":[],"mappings":";AAOO,IAAM,kBAAN,MAAsB;AAAA,EAgB3B,WAAA,CACmB,GAAA,EACjB,EAAA,EACiB,QAAA,EACjB;AAHiB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAEA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAEjB,IAAA,IAAA,CAAK,SAAA,GAAY,EAAA;AAAA,EACnB;AAAA,EALmB,GAAA;AAAA,EAEA,QAAA;AAAA,EAlBX,KAAA,GAA8C,IAAA;AAAA;AAAA,EAE9C,SAAA;AAAA;AAAA,EAEA,OAAA,GAAU,CAAA;AAAA,EACV,OAAA,GAAU,KAAA;AAAA;AAAA,EAEV,IAAA,GAAO,KAAA;AAAA,EAEE,yBAAyB,MAAY;AACpD,IAAA,IAAI,KAAK,IAAA,EAAM;AACf,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,eAAA,KAAoB,SAAA,OAAgB,GAAA,EAAI;AAAA,cAC3C,MAAA,EAAO;AAAA,EACnB,CAAA;AAAA,EAUA,KAAA,GAAc;AACZ,IAAA,IAAI,IAAA,CAAK,IAAA,IAAQ,IAAA,CAAK,OAAA,EAAS;AAC/B,IAAA,IAAA,CAAK,OAAA,GAAU,IAAA;AACf,IAAA,IAAA,CAAK,GAAA,CAAI,gBAAA,CAAiB,kBAAA,EAAoB,IAAA,CAAK,sBAAsB,CAAA;AACzE,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,eAAA,KAAoB,SAAA,OAAgB,GAAA,EAAI;AAAA,EACvD;AAAA,EAEA,MAAA,GAAe;AACb,IAAA,IAAI,KAAK,IAAA,EAAM;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IA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MAAA,OAAA,CAAQ,OAAO,IAAI,CAAA;AAAA,IACrB;AACA,IAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,CAAM,WAAA,IAAe,EAAC,EAAG;AAC1C,MAAA,YAAA,CAAa,OAAO,IAAI,CAAA;AACxB,MAAA,OAAA,CAAQ,IAAI,IAAI,CAAA;AAAA,IAClB;AAAA,EACF;AACA,EAAA,MAAM,SAA0B,EAAC;AACjC,EAAA,IAAI,YAAA,CAAa,IAAA,GAAO,CAAA,IAAK,OAAA,CAAQ,OAAO,CAAA,EAAG;AAC7C,IAAA,MAAM,aAAyD,EAAC;AAChE,IAAA,IAAI,YAAA,CAAa,OAAO,CAAA,EAAG;AACzB,MAAA,UAAA,CAAW,OAAA,GAAU,KAAA,CAAM,IAAA,CAAK,YAAA,EAAc,CAAC,CAAC,IAAA,EAAM,MAAM,CAAA,MAAO,EAAE,IAAA,EAAM,MAAA,EAAO,CAAE,CAAA;AAAA,IACtF;AACA,IAAA,IAAI,QAAQ,IAAA,GAAO,CAAA,aAAc,WAAA,GAAc,KAAA,CAAM,KAAK,OAAO,CAAA;AACjE,IAAA,MAAA,CAAO,UAAA,GAAa,UAAA;AAAA,EACtB;AACA,EAAA,MAAM,eAAA,GAAkB,MAAA,EAAQ,eAAA,IAAmB,QAAA,EAAU,eAAA;AAC7D,EAAA,IAAI,eAAA,KAAoB,MAAA,EAAW,MAAA,CAAO,eAAA,GAAkB,eAAA;AAC5D,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["/**\n * RestoreDeadline — a visibility-aware countdown used while a WebGL context is\n * lost. Browsers routinely defer `webglcontextrestored` for backgrounded tabs,\n * so the budget must only burn while the document is visible: hidden time is\n * banked (timer cleared, remaining ms kept) and the countdown re-arms from the\n * remainder when the tab becomes visible again.\n */\nexport class RestoreDeadline {\n private timer: ReturnType<typeof setTimeout> | null = null;\n /** Unspent budget in ms; recomputed each time the timer is disarmed. */\n private remaining: number;\n /** Timestamp when the current timer was armed (for banking on hide). */\n private armedAt = 0;\n private started = false;\n /** Terminal: set on expiry or cancel; guarantees onExpire fires at most once. */\n private done = false;\n\n private readonly handleVisibilityChange = (): void => {\n if (this.done) return;\n if (this.doc.visibilityState === 'visible') this.arm();\n else this.disarm();\n };\n\n constructor(\n private readonly doc: Document,\n ms: number,\n private readonly onExpire: () => void,\n ) {\n this.remaining = ms;\n }\n\n start(): void {\n if (this.done || this.started) return;\n this.started = true;\n this.doc.addEventListener('visibilitychange', this.handleVisibilityChange);\n if (this.doc.visibilityState === 'visible') this.arm();\n }\n\n cancel(): void {\n if (this.done) return;\n this.done = true;\n if (this.timer !== null) {\n globalThis.clearTimeout(this.timer);\n this.timer = null;\n }\n if (this.started) {\n this.doc.removeEventListener('visibilitychange', this.handleVisibilityChange);\n }\n }\n\n private arm(): void {\n if (this.timer !== null) return;\n this.armedAt = Date.now();\n this.timer = globalThis.setTimeout(() => {\n this.timer = null;\n this.done = true;\n this.doc.removeEventListener('visibilitychange', this.handleVisibilityChange);\n this.onExpire();\n }, this.remaining);\n }\n\n private disarm(): void {\n if (this.timer === null) return;\n globalThis.clearTimeout(this.timer);\n this.timer = null;\n this.remaining = Math.max(0, this.remaining - (Date.now() - this.armedAt));\n }\n}\n","/**\n * CosmosEngine — GraphEngine adapter over @cosmos.gl/graph (spec §13).\n *\n * Node-safe module: cosmos is loaded lazily via `await import()` inside\n * `mount()` (§18); module scope carries only type-only imports (erased at\n * runtime) and never touches the DOM.\n *\n * Color scale note: the EngineCommit contract carries RGBA floats in [0,1],\n * which is exactly cosmos' native scale (verified against the 3.3.0 dist:\n * hex config colors are parsed via /255 into 0–1 floats and setPointColors\n * input is fed to GPU buffers untouched) — so color buffers pass through.\n *\n * Interaction notes (verified against the 3.3.0 dist):\n * - Link picking is native: setting any onLink* config callback flips\n * cosmos' internal `isLinkHoveringEnabled` on, so wiring the callbacks in\n * `buildInitialConfig` is sufficient (no extra config flag exists).\n * - `findPointsInPolygon` takes SCREEN coordinates (\"from 0 to the\n * width/height of the canvas\" per dist/index.d.ts), so `pointsInPolygon`\n * passes the host's screen polygon through without conversion.\n * - `findPointsInRect` uses the SAME screen space and expects ordered\n * corners `[[left, top], [right, bottom]]` (the dist flips Y assuming that\n * ordering), so `pointsInRect` normalizes the host's [x0,y0,x1,y1] rect to\n * min/max corners and passes it through without conversion.\n * - Camera pan (S11 — the zoom-only limitation is LIFTED): cosmos 3.3 has no\n * pan-to API, but `setZoomTransformByPointPositions(positions, duration,\n * scale, padding)` (dist/index.d.ts) is an exact center+zoom when `scale`\n * is explicit. Derivation from the dist (`zoomInstance.getTransform`):\n * space→screen-at-k=1 goes through `store.scaleX/scaleY`, which are LINEAR\n * with slope ±1 (scaleX(x) = x + (w−S)/2; scaleY(y) = (S−y) + (h−S)/2,\n * S = adjustedSpaceSize, w/h = canvas size); a single-point bbox is widened\n * ±0.5 SYMMETRICALLY (center preserved); an explicit `scale` bypasses the\n * fit math and `padding` entirely — k = clamp(scale, d3 scaleExtent) and\n * the result is translate(w/2 − scaleX(x)·k, h/2 − scaleY(y)·k).scale(k),\n * i.e. space point (x, y) lands exactly at the screen center with\n * eventTransform.k = scale. Since `getZoomLevel()` returns eventTransform.k\n * and `getViewport()` reads screenToSpacePosition(screen center),\n * `setViewport({x, y, zoom})` → setZoomTransformByPointPositions(\n * Float32Array.of(x, y), durationMs ?? 0, zoom ?? getZoomLevel()) makes a\n * follow-up `getViewport()` return exactly {x, y, zoom} (modulo the\n * scaleExtent clamp). This also completes §13.1 recovery: the core replays\n * the full stored {x, y, zoom} through setViewport, so viewport restore is\n * no longer zoom-only.\n * - Context menu: cosmos fires the unified config `onContextMenu(index |\n * undefined, pos, event)` exactly ONCE per gesture — desktop right-click\n * (dist `onContextMenu(e)`) and touch/pen long-press (dist long-press timer\n * → `fireContextMenu`) both route through it — while the per-target\n * `onPointContextMenu`/`onLinkContextMenu`/`onBackgroundContextMenu`\n * callbacks fire ADDITIONALLY for the same gesture. Wiring only the unified\n * callback therefore avoids a double-report (same shape as the\n * onClick/onBackgroundClick dedupe). A context menu over a LINK arrives\n * with index undefined and is reported as background (the host event\n * carries node-or-background only).\n *\n * Overlay/activity clock (M0 evidence, docs/m0-conformance.md): cosmos exposes\n * no draw/render-phase hook (`postDrawFrames: false`), so the adapter owns a\n * single requestAnimationFrame loop that reports `onFrame(timeMs)` to the host\n * — an ACTIVITY clock, not a post-draw hook: overlays may lag the canvas by\n * one sample. That degradation is reported once at mount via the\n * `engine:overlay-activity-clock` info diagnostic. The loop is started at\n * mount, stopped on context loss/destroy, resumed on recovery, and skips the\n * callback while `document.hidden` (stop-at-rest quiescence is S13 scope).\n *\n * Screenshots use the M0 same-tick capture method (apps/spike/src/instrument.ts):\n * cosmos renders with preserveDrawingBuffer:false, so the WebGL buffer is only\n * readable via a synchronous drawImage inside the same rAF tick it was drawn —\n * `captureScreenshot` schedules one rAF, draws the cosmos canvas onto an\n * offscreen 2D canvas inside that tick, and resolves the Blob (null on any\n * failure or unusable lifecycle state).\n * - The D3 drag events carry NO point index (the drag subject is a bare\n * `{x, y}`); cosmos assigns `store.draggingPointIndex` immediately before\n * invoking `onDragStart`, so the adapter reads it there (see\n * `readDraggingIndex` for the public-callback fallback).\n * - During a drag, cosmos' drag shader hard-pins the dragged point's\n * position texture entry to the mouse's SPACE position every frame\n * (dist `drag()`: `pointPosition.rg = mousePos` where `mousePos` =\n * screenToSpace(pointer)). So the point's final space position equals\n * `screenToSpacePosition([event.x, event.y])` at drag end — an O(1) CPU\n * transform, chosen over `getPointPositions()` (full GPU readback).\n */\n\nimport type { Graph as CosmosGraph, GraphConfig } from '@cosmos.gl/graph';\nimport type {\n EngineCapabilities,\n EngineCommit,\n EngineHostEvents,\n FitViewOptions,\n GraphEngine,\n} from '@modernrelay/orbit-core/engine';\nimport { RestoreDeadline } from './restoreDeadline';\n\n/** Derived from the contract to avoid importing the core root barrel. */\ntype ViewportState = NonNullable<ReturnType<GraphEngine['getViewport']>>;\n\n/**\n * Structural view of cosmos' `graph.store` — private in the 3.3.0 d.ts but a\n * stable runtime field. `draggingPointIndex` is assigned right before cosmos\n * invokes `onDragStart` (verified in the dist), making it the authoritative\n * dragged-point source; `hoveredPoint` mirrors the public onPointMouseOver\n * payload.\n */\ninterface CosmosStoreLike {\n hoveredPoint?: { index: number; position: [number, number] };\n draggingPointIndex?: number;\n}\n\n/**\n * Extracts click modifiers from a cosmos-forwarded event. Duck-typed rather\n * than `instanceof MouseEvent`: node-safe and cross-realm-safe. Returns\n * undefined when the event carries no modifier state.\n */\nfunction clickModifiers(event: unknown): { metaKey: boolean; shiftKey: boolean } | undefined {\n const e = event as { metaKey?: unknown; shiftKey?: unknown } | null | undefined;\n if (e && typeof e.metaKey === 'boolean' && typeof e.shiftKey === 'boolean') {\n return { metaKey: e.metaKey, shiftKey: e.shiftKey };\n }\n return undefined;\n}\n\nexport interface CosmosEngineOptions {\n /** Simulation space size passed to cosmos (cosmos default: 4096). */\n spaceSize?: number;\n /** Ring radius for seeding unknown (NaN) positions. Default: spaceSize/4. */\n seedRadius?: number;\n /** Whether cosmos auto-fits the view on init. Default: false (the core drives the camera). */\n fitViewOnInit?: boolean;\n /** Native point dragging (cosmos `enableDrag`). Default: true. */\n enableDrag?: boolean;\n /** Escape hatch: shallow-merged last into the cosmos constructor config. */\n initialConfig?: Record<string, unknown>;\n /**\n * Visible-time budget (ms) for the browser to restore a lost WebGL context\n * before an `engine:context-restore-deadline` diagnostic is emitted. The\n * deadline is observability only — a later restore still recovers.\n * Default: 10_000.\n */\n restoreDeadlineMs?: number;\n}\n\n/** cosmos' own default `spaceSize` (see @cosmos.gl/graph config defaults). */\nconst DEFAULT_SPACE_SIZE = 4096;\n\n/** Default visible-time budget before the restore-deadline diagnostic. */\nconst DEFAULT_RESTORE_DEADLINE_MS = 10_000;\n\n/** §8 image-atlas channel of an EngineCommit (adapter-local alias). */\ntype EngineResources = NonNullable<EngineCommit['resources']>;\n\nexport class CosmosEngine implements GraphEngine {\n readonly capabilities: EngineCapabilities = {\n // Evidence-backed S6 flip: the M0 probe measured native onLinkClick/\n // onLinkMouseOver delivering correct link indices with ~4px perpendicular\n // tolerance (docs/m0-conformance.json, `link-picking`).\n linkPicking: true,\n rangeUpdates: [],\n trackedPositions: true,\n simulation: true,\n // §16.12: cosmos 3.3.0 exposes the `linkDefaultArrows` config key\n // (config.d.ts) — instanced arrowheads toggle atomically via setConfigPartial.\n edgeArrows: true,\n // §8: cosmos 3.3.0 exposes setImageData(ImageData[]) +\n // setPointImageIndices(Float32Array) (index.d.ts) — per-point sprites via\n // an adapter-maintained slot→ImageData atlas.\n pointImages: true,\n // §16.3 stage 4: cosmos 3.3.0 ships a real GPU cluster force —\n // `setPointClusters((number|undefined)[])`, `setClusterPositions(\n // (number|undefined)[])`, `setPointClusterStrength(Float32Array)`\n // (index.d.ts) plus the `simulationCluster` coefficient (config.d.ts,\n // default 0.1) and the `Clusters` core module (dist/modules/Clusters).\n // `undefined` is cosmos' documented \"not in any cluster\" value, which the\n // adapter maps from the contract's NaN.\n clusterForce: true,\n };\n\n private readonly options: CosmosEngineOptions;\n private graph: CosmosGraph | null = null;\n private innerDiv: HTMLDivElement | null = null;\n private events: EngineHostEvents | null = null;\n /**\n * Pre-mount/lost-context commits collapse per channel and are applied as one\n * atomic commit once a usable graph exists.\n */\n private pendingCommit: EngineCommit | null = null;\n private applied: number | null = null;\n private destroyed = false;\n private mounting = false;\n /** Constructed graph whose `ready` promise has not settled yet. */\n private graphAwaitingReady: CosmosGraph | null = null;\n /** Guards every graph teardown, including async init/recovery races. */\n private readonly destroyedGraphs = new WeakSet<CosmosGraph>();\n /** Sticky override from EngineConfigUpdate.seedRadius. */\n private seedRadiusOverride: number | undefined;\n /** Point count of the last structure-bearing commit — the roster length a\n * `cluster: null` clear must write an all-unclustered array for (§16.3). */\n private lastPointCount = 0;\n /**\n * cosmos fires `onClick` (index undefined) AND `onBackgroundClick` for the\n * same background click; remembering the MouseEvent dedupes the null emit.\n */\n private lastNullClickEvent: unknown = null;\n /** Point latched at cosmos onDragStart; cleared when the gesture ends. */\n private dragIndex: number | null = null;\n /** Last hover reported by cosmos — fallback dragged-point source. */\n private lastHoverIndex: number | null = null;\n\n // --- adapter-owned overlay/activity clock (see module header) ---\n\n /** rAF id of the pending activity-clock tick; null = clock not running. */\n private frameHandle: number | null = null;\n /** Window driving the clock, cached so stop works after the div detaches. */\n private frameWindow: Window | null = null;\n\n // --- WebGL context-loss recovery state (§13.1) ---\n\n /** cosmos' canvas (queried post-mount) carrying the webglcontext* listeners. */\n private canvas: HTMLCanvasElement | null = null;\n private contextLost = false;\n /** Terminal: GL reinitialization failed; commits stash inertly forever. */\n private failed = false;\n private deadline: RestoreDeadline | null = null;\n /** Graph constructor cached at mount so recovery never re-imports cosmos. */\n private cosmosCtor: (new (div: HTMLDivElement, config?: GraphConfig) => CosmosGraph) | null =\n null;\n\n // --- §8 image atlas (capability pointImages) ---\n\n /**\n * slot → ImageData mirror of the cosmos image atlas. ImageData is CPU-side,\n * so the mirror survives context loss — any post-restore atlas commit\n * re-uploads the FULL array to the fresh graph. `null` = removed (blank).\n */\n private imageSlots: (ImageData | null)[] = [];\n /** Lazily created 1×1 transparent entry filling removed/hole slots. */\n private blankImage: ImageData | null = null;\n /** One-shot guard for the `engine:image-channel-unavailable` diagnostic. */\n private imageChannelUnavailable = false;\n\n constructor(options: CosmosEngineOptions = {}) {\n this.options = options;\n }\n\n async mount(container: HTMLElement, events: EngineHostEvents): Promise<void> {\n if (this.destroyed) throw new Error('CosmosEngine: mount() after destroy()');\n if (this.mounting || this.graph) throw new Error('CosmosEngine: mount() may only be called once');\n this.mounting = true;\n this.events = events;\n\n // cosmos wants a dedicated HTMLDivElement filling the host container.\n const div = container.ownerDocument.createElement('div');\n div.style.width = '100%';\n div.style.height = '100%';\n container.appendChild(div);\n this.innerDiv = div;\n\n let graph: CosmosGraph | null = null;\n try {\n // §18: cosmos (and its WebGL dependencies) load only at mount time.\n const { Graph } = await import('@cosmos.gl/graph');\n // destroy() may have landed while the dynamic import was pending.\n if (this.destroyed) {\n div.remove();\n return;\n }\n graph = new Graph(div, this.buildInitialConfig());\n this.graphAwaitingReady = graph;\n await graph.ready;\n if (this.graphAwaitingReady === graph) this.graphAwaitingReady = null;\n if (this.destroyed) {\n // destroy() raced the async init; tear the graph down immediately.\n this.destroyGraphOnce(graph);\n div.remove();\n return;\n }\n this.graph = graph;\n this.cosmosCtor = Graph;\n this.attachContextListeners();\n // Documented degradation (M0): overlays ride an activity clock because\n // cosmos has no draw-phase hook. Emitted once, at mount only.\n events.onDiagnostic?.({\n code: 'engine:overlay-activity-clock',\n severity: 'info',\n message:\n 'CosmosEngine: cosmos exposes no draw-phase hook (postDrawFrames:false); ' +\n 'overlays ride an adapter-owned requestAnimationFrame activity clock and ' +\n 'may lag the canvas by one frame.',\n });\n this.startFrameLoop();\n const pending = this.pendingCommit;\n this.pendingCommit = null;\n if (pending) this.applyCommit(graph, pending);\n } catch (err) {\n if (graph !== null) {\n if (this.graph === graph) {\n this.stopFrameLoop();\n this.detachContextListeners();\n this.graph = null;\n }\n if (this.graphAwaitingReady === graph) this.graphAwaitingReady = null;\n this.destroyGraphOnce(graph);\n }\n div.remove();\n if (this.innerDiv === div) this.innerDiv = null;\n // destroy() is terminal and already cleaned up the constructed graph;\n // a later ready rejection must not escape or notify stale hosts.\n if (this.destroyed) return;\n const error = err instanceof Error ? err : new Error(String(err));\n events.onError?.(error);\n throw error;\n }\n }\n\n commit(update: EngineCommit): void {\n if (this.destroyed) throw new Error('CosmosEngine: commit() after destroy()');\n const graph = this.activeGraph;\n if (!graph) {\n // Pre-mount, context-lost, or failed: retain the latest value of every\n // independently replaceable channel. The merged commit is flushed on\n // mount/restore (or remains inert forever after terminal failure).\n this.queueCommit(update);\n return;\n }\n this.applyCommit(graph, update);\n }\n\n appliedRevision(): number | null {\n return this.applied;\n }\n\n // --- camera ---\n\n fitView(opts?: FitViewOptions): void {\n this.activeGraph?.fitView(opts?.durationMs, opts?.padding);\n }\n\n zoom(factor: number, durationMs?: number): void {\n const graph = this.activeGraph;\n if (!graph) return;\n graph.setZoomLevel(graph.getZoomLevel() * factor, durationMs);\n }\n\n /**\n * REAL pan (the former zoom-only limitation is lifted — see module header):\n * when a target center is provided, one `setZoomTransformByPointPositions`\n * call centers space point (x, y) at EXACTLY the requested (or current)\n * zoom — `setViewport(p)` then `getViewport()` returns p, modulo cosmos'\n * d3 scaleExtent clamp. A missing x or y is filled from the current\n * viewport; zoom-only calls keep the `setZoomLevel` path (d3's scaleTo\n * preserves the current center). Instant unless `durationMs` is given —\n * cosmos' own default duration is 250 ms, which would animate context-\n * recovery replays.\n */\n setViewport(v: Partial<ViewportState>, opts?: { durationMs?: number }): void {\n const graph = this.activeGraph;\n if (!graph) return;\n if (v.x !== undefined || v.y !== undefined) {\n const current = v.x === undefined || v.y === undefined ? this.getViewport() : null;\n const x = v.x ?? current?.x;\n const y = v.y ?? current?.y;\n if (x !== undefined && y !== undefined) {\n graph.setZoomTransformByPointPositions(\n Float32Array.of(x, y),\n opts?.durationMs ?? 0,\n v.zoom ?? graph.getZoomLevel(),\n );\n return;\n }\n // No usable center (detached container): degrade to zoom-only below.\n }\n if (v.zoom !== undefined) graph.setZoomLevel(v.zoom, opts?.durationMs ?? 0);\n }\n\n getViewport(): ViewportState | null {\n const graph = this.activeGraph;\n const div = this.innerDiv;\n if (!graph || !div) return null;\n const [x, y] = graph.screenToSpacePosition([div.clientWidth / 2, div.clientHeight / 2]);\n return { x, y, zoom: graph.getZoomLevel() };\n }\n\n zoomToIndex(index: number, durationMs?: number): void {\n this.activeGraph?.zoomToPointByIndex(index, durationMs);\n }\n\n // --- simulation ---\n\n start(alpha?: number): void {\n this.activeGraph?.start(alpha);\n }\n\n pause(): void {\n this.activeGraph?.pause();\n }\n\n // --- built-in interaction visuals ---\n\n setSelectedIndices(indices: readonly number[] | null): void {\n const graph = this.activeGraph;\n if (!graph) return;\n // cosmos 3.3 has no imperative select/unselect API; selection visuals are\n // config-driven — points NOT in `highlightedPointIndices` grey out, and an\n // explicit `undefined` resets the key (clears highlighting) per\n // setConfigPartial semantics.\n graph.setConfigPartial({\n highlightedPointIndices: indices === null ? undefined : Array.from(indices),\n } as unknown as GraphConfig);\n }\n\n setFocusedIndex(index: number | null): void {\n const graph = this.activeGraph;\n if (!graph) return;\n graph.setConfigPartial({\n focusedPointIndex: index === null ? undefined : index,\n } as unknown as GraphConfig);\n }\n\n // --- spatial queries & pinning (§13/§15) ---\n\n pointsInPolygon(screenPolygon: readonly [number, number][]): number[] {\n const graph = this.activeGraph;\n if (!graph) return [];\n // cosmos' findPointsInPolygon already expects SCREEN coordinates (0 to\n // canvas width/height per the 3.3.0 d.ts) — no conversion; copy the pairs\n // only to satisfy cosmos' mutable-signature and shield the caller's input.\n return graph.findPointsInPolygon(screenPolygon.map(([x, y]): [number, number] => [x, y]));\n }\n\n pointsInRect(screenRect: readonly [number, number, number, number]): number[] {\n const graph = this.activeGraph;\n if (!graph) return [];\n // cosmos' findPointsInRect expects SCREEN coordinates (0 to canvas\n // width/height — the same space as findPointsInPolygon per the 3.3.0\n // d.ts) as ordered corners [[left, top], [right, bottom]] (the dist flips\n // Y assuming that ordering) — normalize so any opposite-corner pair works.\n const [x0, y0, x1, y1] = screenRect;\n return graph.findPointsInRect([\n [Math.min(x0, x1), Math.min(y0, y1)],\n [Math.max(x0, x1), Math.max(y0, y1)],\n ]);\n }\n\n neighborIndices(index: number): number[] {\n const graph = this.activeGraph;\n if (!graph) return [];\n // cosmos dedupes but a self-loop can report the point as its own neighbor.\n return graph.getNeighboringPointIndices(index).filter((i) => i !== index);\n }\n\n screenToSpace(p: readonly [number, number]): [number, number] | null {\n const graph = this.activeGraph;\n return graph ? graph.screenToSpacePosition([p[0], p[1]]) : null;\n }\n\n spaceToScreen(p: readonly [number, number]): [number, number] | null {\n const graph = this.activeGraph;\n return graph ? graph.spaceToScreenPosition([p[0], p[1]]) : null;\n }\n\n setPinnedIndices(indices: readonly number[] | null): void {\n // Full-set replace, idempotent; null and [] both unpin all (cosmos treats\n // them identically). Pin re-application after recovery is core-owned.\n this.activeGraph?.setPinnedPoints(indices === null ? null : Array.from(indices));\n }\n\n // --- readback ---\n\n getPositions(): Float32Array | null {\n const graph = this.activeGraph;\n return graph ? Float32Array.from(graph.getPointPositions()) : null;\n }\n\n /**\n * Captures the cosmos canvas via the M0 same-tick method (see module\n * header): one rAF is scheduled and, inside that tick, the WebGL canvas is\n * drawn synchronously onto an offscreen 2D canvas (cosmos renders with\n * preserveDrawingBuffer:false, so the buffer is only readable same-tick).\n * Resolves null on any failure or unusable lifecycle state (pre-mount,\n * context lost/failed, destroyed, no 2D context, toBlob failure).\n */\n captureScreenshot(): Promise<Blob | null> {\n const canvas = this.activeGraph ? this.canvas : null;\n const win = canvas?.ownerDocument.defaultView ?? null;\n if (!canvas || !win || typeof win.requestAnimationFrame !== 'function') {\n return Promise.resolve(null);\n }\n return new Promise((resolve) => {\n win.requestAnimationFrame(() => {\n // Re-check: loss/destroy (or a restore swapping in a new canvas) may\n // have landed between scheduling and this tick.\n if (this.destroyed || !this.activeGraph || this.canvas !== canvas) {\n resolve(null);\n return;\n }\n try {\n const off = canvas.ownerDocument.createElement('canvas');\n off.width = canvas.width;\n off.height = canvas.height;\n const ctx = off.getContext('2d');\n if (!ctx) {\n resolve(null);\n return;\n }\n ctx.drawImage(canvas, 0, 0);\n off.toBlob((blob) => {\n resolve(blob);\n });\n } catch {\n resolve(null);\n }\n });\n });\n }\n\n destroy(): void {\n if (this.destroyed) return;\n // Set first: if a context-restore reinit is mid-await, it observes the\n // flag, destroys the graph it just built, and emits nothing.\n this.destroyed = true;\n this.stopFrameLoop();\n this.deadline?.cancel();\n this.deadline = null;\n this.detachContextListeners();\n const graph = this.graph;\n this.graph = null;\n this.destroyGraphOnce(graph);\n const awaiting = this.graphAwaitingReady;\n this.graphAwaitingReady = null;\n this.destroyGraphOnce(awaiting);\n this.innerDiv?.remove();\n this.innerDiv = null;\n this.events = null;\n this.pendingCommit = null;\n this.imageSlots = [];\n this.blankImage = null;\n }\n\n // --- overlay/activity clock (see module header) ---\n\n /**\n * One rAF tick of the activity clock. Reschedules FIRST so a throwing host\n * callback can never kill the clock; skips the callback (but keeps ticking)\n * while the document is hidden. Deliberately cheap: a single callback\n * invocation — the core skips all work when nothing subscribes.\n */\n private readonly frameTick = (timeMs: number): void => {\n const win = this.frameWindow;\n if (!win || this.frameHandle === null) return;\n this.frameHandle = win.requestAnimationFrame(this.frameTick);\n if (!win.document.hidden) this.events?.onFrame?.(timeMs);\n };\n\n private startFrameLoop(): void {\n if (this.destroyed || this.frameHandle !== null) return;\n const win = this.innerDiv?.ownerDocument.defaultView ?? null;\n // No window / no rAF (detached document, exotic embedder): no clock — the\n // engine keeps working, overlays simply get no ticks.\n if (!win || typeof win.requestAnimationFrame !== 'function') return;\n this.frameWindow = win;\n this.frameHandle = win.requestAnimationFrame(this.frameTick);\n }\n\n private stopFrameLoop(): void {\n if (this.frameHandle !== null) {\n this.frameWindow?.cancelAnimationFrame(this.frameHandle);\n this.frameHandle = null;\n }\n this.frameWindow = null;\n }\n\n // --- WebGL context-loss recovery (§13.1) ---\n\n /** The graph, unless it is unusable (context lost / terminally failed). */\n private get activeGraph(): CosmosGraph | null {\n return this.contextLost || this.failed ? null : this.graph;\n }\n\n /**\n * cosmos owns its canvas; we can only wire webglcontext* listeners after\n * init by querying it. A missing canvas downgrades to an info diagnostic —\n * the engine keeps working, just without context-loss recovery.\n */\n private attachContextListeners(): void {\n const canvas = this.innerDiv?.querySelector('canvas') ?? null;\n if (!canvas) {\n this.events?.onDiagnostic?.({\n code: 'engine:context-listeners-unavailable',\n severity: 'info',\n message:\n 'CosmosEngine: no <canvas> found in the cosmos container; WebGL context-loss recovery is disabled.',\n });\n return;\n }\n this.canvas = canvas;\n canvas.addEventListener('webglcontextlost', this.handleContextLost);\n canvas.addEventListener('webglcontextrestored', this.handleContextRestored);\n }\n\n private detachContextListeners(): void {\n const canvas = this.canvas;\n if (!canvas) return;\n canvas.removeEventListener('webglcontextlost', this.handleContextLost);\n canvas.removeEventListener('webglcontextrestored', this.handleContextRestored);\n this.canvas = null;\n }\n\n /** DOM listener: nothing may throw out of it. */\n private readonly handleContextLost = (event: Event): void => {\n try {\n // preventDefault signals the browser that restoration is wanted; it must\n // run even on states we otherwise ignore.\n event.preventDefault();\n if (this.destroyed || this.failed || this.contextLost) return;\n this.contextLost = true;\n // The GL machine is dead: pause the activity clock until recovery.\n this.stopFrameLoop();\n // Any in-flight gesture died with the context; drop its latched state.\n this.dragIndex = null;\n this.lastHoverIndex = null;\n try {\n this.graph?.pause();\n } catch {\n // pausing a dead-context graph is best-effort only\n }\n this.startRestoreDeadline();\n this.events?.onContextEvent?.({ type: 'lost' });\n } catch {\n // swallow: DOM listeners must never throw\n }\n };\n\n /** DOM listener: nothing may throw out of it (async work is caught below). */\n private readonly handleContextRestored = (): void => {\n if (this.destroyed || this.failed || !this.contextLost) return;\n this.reinitializeAfterRestore().catch((err: unknown) => {\n if (this.destroyed) return;\n this.failed = true;\n const error = err instanceof Error ? err : new Error(String(err));\n try {\n this.events?.onContextEvent?.({ type: 'failed', error });\n } catch {\n // swallow: host callback errors must not become unhandled rejections\n }\n });\n };\n\n /**\n * cosmos cannot reuse a restored context (its GPU resources are gone), so\n * recovery = tear down the old Graph and build a fresh one in the same div,\n * flush the stashed commit, and only then report `restored` — the core\n * re-commits the full scene in response.\n */\n private async reinitializeAfterRestore(): Promise<void> {\n this.deadline?.cancel();\n this.deadline = null;\n this.detachContextListeners();\n const oldGraph = this.graph;\n this.graph = null;\n this.destroyGraphOnce(oldGraph);\n const div = this.innerDiv;\n const Ctor = this.cosmosCtor;\n if (!div || !Ctor) return; // destroy() raced ahead of us\n const graph = new Ctor(div, this.buildInitialConfig());\n this.graphAwaitingReady = graph;\n try {\n await graph.ready;\n if (this.graphAwaitingReady === graph) this.graphAwaitingReady = null;\n if (this.destroyed) {\n // destroy() landed mid-reinit: tear down the new graph, emit nothing.\n this.destroyGraphOnce(graph);\n return;\n }\n\n // Activation is one failure boundary. If listener wiring, frame-loop\n // startup, pending-channel upload, or restored delivery throws, the\n // replacement must not survive as an inert failed graph.\n this.graph = graph;\n this.attachContextListeners(); // the new Graph made a new canvas\n this.contextLost = false;\n this.startFrameLoop(); // resume the activity clock (no re-diagnostic)\n const pending = this.pendingCommit;\n this.pendingCommit = null;\n if (pending) this.applyCommit(graph, pending);\n // Emit only after the stashed commit is visible: `restored` promises a\n // commit-ready engine whose applied revision is consistent.\n this.events?.onContextEvent?.({ type: 'restored' });\n } catch (err) {\n if (this.graphAwaitingReady === graph) this.graphAwaitingReady = null;\n this.stopFrameLoop();\n if (this.graph === graph) {\n this.detachContextListeners();\n this.graph = null;\n }\n this.destroyGraphOnce(graph);\n throw err;\n }\n }\n\n private startRestoreDeadline(): void {\n const doc = this.canvas?.ownerDocument;\n if (!doc) return;\n const ms = this.options.restoreDeadlineMs ?? DEFAULT_RESTORE_DEADLINE_MS;\n const deadline = new RestoreDeadline(doc, ms, () => {\n // Observability only: listeners stay mounted, state is unchanged, and a\n // late restore still recovers.\n this.deadline = null;\n this.events?.onDiagnostic?.({\n code: 'engine:context-restore-deadline',\n severity: 'warning',\n message: `CosmosEngine: WebGL context was not restored within ${ms}ms of visible time.`,\n });\n });\n this.deadline = deadline;\n deadline.start();\n }\n\n // -------------------------------------------------------------------------\n\n /**\n * Coalesces partial commits without discarding independent channels. The\n * newest call supplies the visible revision; structure is one atomic\n * channel, buffers/config merge per field, and restart persists until a\n * later explicit directive (including `false`) replaces it.\n */\n private queueCommit(update: EngineCommit): void {\n const previous = this.pendingCommit;\n if (previous === null) {\n this.pendingCommit = update;\n return;\n }\n\n const merged: EngineCommit = { revision: update.revision };\n\n const structure = update.structure ?? previous.structure;\n if (structure !== undefined) merged.structure = structure;\n\n if (previous.buffers !== undefined || update.buffers !== undefined) {\n merged.buffers = { ...previous.buffers, ...update.buffers };\n }\n\n if (previous.config !== undefined || update.config !== undefined) {\n const config = { ...previous.config, ...update.config };\n if (\n previous.config?.simulation !== undefined ||\n update.config?.simulation !== undefined\n ) {\n config.simulation = {\n ...previous.config?.simulation,\n ...update.config?.simulation,\n };\n }\n merged.config = config;\n }\n\n if (previous.resources !== undefined || update.resources !== undefined) {\n merged.resources = mergeResources(previous.resources, update.resources);\n }\n\n // Contract (§13 EngineCommit): `restart: false` and an ABSENT restart are\n // equivalent no-ops (\"false/absent = keep state\") — so neither cancels a\n // pending queued restart directive; only a new {alpha} replaces it\n // (PR #8 follow-up: explicit false previously cancelled while queued).\n const restart =\n update.restart !== undefined && update.restart !== false\n ? update.restart\n : previous.restart;\n if (restart !== undefined) merged.restart = restart;\n\n this.pendingCommit = merged;\n }\n\n /** Invokes a graph's destructor at most once, even across async races. */\n private destroyGraphOnce(graph: CosmosGraph | null): void {\n if (graph === null || this.destroyedGraphs.has(graph)) return;\n this.destroyedGraphs.add(graph);\n try {\n graph.destroy();\n } catch {\n // Teardown is best-effort, but no later path may invoke it again.\n }\n }\n\n private get spaceSize(): number {\n // The escape hatch is applied last in the constructor config, so a\n // spaceSize there is what cosmos actually uses — mirror it for seeding.\n const fromInitial = this.options.initialConfig?.['spaceSize'];\n if (typeof fromInitial === 'number') return fromInitial;\n return this.options.spaceSize ?? DEFAULT_SPACE_SIZE;\n }\n\n private get seedRadius(): number {\n return this.seedRadiusOverride ?? this.options.seedRadius ?? this.spaceSize / 4;\n }\n\n private buildInitialConfig(): GraphConfig {\n const base: GraphConfig = {\n // Default false: the core owns the camera (fitView is driven explicitly).\n fitViewOnInit: this.options.fitViewOnInit ?? false,\n // Native point dragging; the core owns pin semantics on top (§16.3).\n enableDrag: this.options.enableDrag ?? true,\n onPointClick: (index, _position, event) => {\n this.events?.onPointClick?.(index, clickModifiers(event));\n },\n onBackgroundClick: (event) => {\n this.emitNullPointClick(event);\n },\n // onClick fires for every canvas click; an undefined index means no\n // point was hit (background clicks — link clicks arrive via onLinkClick).\n onClick: (index, _position, event) => {\n if (index === undefined) this.emitNullPointClick(event);\n },\n // Unified context-menu channel: fires exactly once per gesture (desktop\n // right-click AND touch long-press — cosmos synthesizes the latter);\n // the per-target onPoint/onLink/onBackgroundContextMenu callbacks fire\n // ADDITIONALLY for the same gesture, so only this one is wired (see\n // module header). index undefined = background (or a link).\n onContextMenu: (index, _position, event) => {\n this.handleContextMenu(index, event);\n },\n onPointMouseOver: (index) => {\n this.lastHoverIndex = index;\n this.events?.onPointHover?.(index);\n },\n onPointMouseOut: () => {\n this.lastHoverIndex = null;\n this.events?.onPointHover?.(null);\n },\n // Setting any onLink* callback enables cosmos' native link hit-testing.\n onLinkClick: (linkIndex) => {\n this.events?.onLinkClick?.(linkIndex);\n },\n onLinkMouseOver: (linkIndex) => {\n this.events?.onLinkHover?.(linkIndex);\n },\n onLinkMouseOut: () => {\n this.events?.onLinkHover?.(null);\n },\n onDragStart: () => {\n this.handleDragStart();\n },\n onDragEnd: (e) => {\n this.handleDragEnd(e);\n },\n onZoom: () => {\n this.emitViewportChange();\n },\n onZoomEnd: () => {\n this.emitViewportChange();\n },\n onSimulationEnd: () => {\n this.events?.onSimulationEnd?.();\n },\n };\n if (this.options.spaceSize !== undefined) base.spaceSize = this.options.spaceSize;\n // Escape hatch: shallow-merged last so callers can override anything above.\n return { ...base, ...(this.options.initialConfig as GraphConfig | undefined) };\n }\n\n /**\n * Maps cosmos' unified context-menu callback to the host event: index\n * undefined → null (background), MouseEvent client coords → container-\n * relative CSS px (the inner div fills the host container exactly). The\n * native event is preventDefault-ed so the browser menu never opens — but\n * only when the host actually registered onContextMenu (it always does in\n * Orbit: the core owns the typed 'contextMenu' event channel). cosmos'\n * desktop `contextmenu` handler already prevents the event itself; repeating\n * it is an idempotent no-op that also covers the touch long-press path\n * (where cosmos forwards the originating pointerdown event instead).\n */\n private handleContextMenu(index: number | undefined, event: MouseEvent): void {\n const events = this.events;\n if (!events?.onContextMenu) return;\n if (typeof event.preventDefault === 'function') event.preventDefault();\n const div = this.innerDiv;\n if (!div) return;\n const rect = div.getBoundingClientRect();\n events.onContextMenu(index ?? null, [event.clientX - rect.left, event.clientY - rect.top]);\n }\n\n /** Emits onPointClick(null) once per originating click event. */\n private emitNullPointClick(event: unknown): void {\n if (event != null && event === this.lastNullClickEvent) return;\n this.lastNullClickEvent = event ?? null;\n this.events?.onPointClick?.(null, clickModifiers(event));\n }\n\n /**\n * The D3 drag event carries no point index; cosmos assigns\n * `store.draggingPointIndex` right before invoking onDragStart (see module\n * header). The public onPointMouseOver stream is the fallback — cosmos only\n * starts a drag while a point is hovered.\n */\n private readDraggingIndex(): number | null {\n const store = (this.graph as unknown as { store?: CosmosStoreLike } | null)?.store;\n return store?.draggingPointIndex ?? store?.hoveredPoint?.index ?? this.lastHoverIndex;\n }\n\n private handleDragStart(): void {\n const index = this.readDraggingIndex();\n if (index === null) return;\n this.dragIndex = index;\n this.events?.onDragStart?.(index);\n }\n\n /**\n * Reports the dragged point's final SPACE position. cosmos' drag shader\n * pins the point to the mouse's space position every frame, so converting\n * the event's screen coords is exact and O(1) (see module header).\n */\n private handleDragEnd(e: { x: number; y: number }): void {\n const index = this.dragIndex;\n this.dragIndex = null;\n if (index === null) return;\n const graph = this.activeGraph;\n if (!graph) return; // context died mid-gesture; the drag is dropped\n const [x, y] = graph.screenToSpacePosition([e.x, e.y]);\n this.events?.onDragEnd?.(index, x, y);\n }\n\n private emitViewportChange(): void {\n const viewport = this.getViewport();\n if (viewport) this.events?.onViewportChange?.(viewport);\n }\n\n /**\n * One visibly atomic update (§13): all channels and config are staged, then\n * exactly one render() draws them; restart reheats after the render.\n */\n private applyCommit(graph: CosmosGraph, update: EngineCommit): void {\n const { config, structure, buffers, resources, restart } = update;\n\n if (config) {\n if (config.seedRadius !== undefined) this.seedRadiusOverride = config.seedRadius;\n const partial: GraphConfig = {};\n if (config.backgroundColor !== undefined) partial.backgroundColor = config.backgroundColor;\n // §16.12 arrowheads: cosmos' `linkDefaultArrows` config key (3.3.0\n // config.d.ts) — a pure config toggle, no per-link buffer involved.\n if (config.linkArrows !== undefined) partial.linkDefaultArrows = config.linkArrows;\n // §16.13 link visibility: cosmos 3.3.0 has a first-class `renderLinks`\n // config key (config.d.ts, default true) — config-only, never a buffer\n // rebuild (no linkOpacity workaround needed).\n if (config.renderLinks !== undefined) partial.renderLinks = config.renderLinks;\n // §8 theme tokens: cosmos accepts CSS color strings natively.\n if (config.defaultPointColor !== undefined) {\n partial.pointDefaultColor = config.defaultPointColor;\n }\n if (config.defaultLinkColor !== undefined) {\n partial.linkDefaultColor = config.defaultLinkColor;\n }\n const sim = config.simulation;\n if (sim) {\n if (sim.gravity !== undefined) partial.simulationGravity = sim.gravity;\n if (sim.repulsion !== undefined) partial.simulationRepulsion = sim.repulsion;\n if (sim.friction !== undefined) partial.simulationFriction = sim.friction;\n if (sim.linkDistance !== undefined) partial.simulationLinkDistance = sim.linkDistance;\n if (sim.linkSpring !== undefined) partial.simulationLinkSpring = sim.linkSpring;\n // §10 tunables added in v0.10.2 — each maps 1:1 onto a cosmos config\n // key; an omitted field is never written, so cosmos' own default\n // stands (config.d.ts `defaultConfigValues`).\n if (sim.decay !== undefined) partial.simulationDecay = sim.decay;\n if (sim.collision !== undefined) partial.simulationCollision = sim.collision;\n if (sim.collisionRadius !== undefined) {\n partial.simulationCollisionRadius = sim.collisionRadius;\n }\n if (sim.collisionPadding !== undefined) {\n partial.simulationCollisionPadding = sim.collisionPadding;\n }\n if (sim.repulsionTheta !== undefined) {\n partial.simulationRepulsionTheta = sim.repulsionTheta;\n }\n if (sim.center !== undefined) partial.simulationCenter = sim.center;\n if (sim.repulsionFromMouse !== undefined) {\n partial.simulationRepulsionFromMouse = sim.repulsionFromMouse;\n }\n }\n // §16.3 stage-4 cluster force: the scene-wide coefficient is cosmos'\n // `simulationCluster` config key (config.d.ts, default 0.1); membership\n // and centers are buffer-shaped and staged below.\n if (config.cluster != null && config.cluster.strength !== undefined) {\n partial.simulationCluster = config.cluster.strength;\n }\n if (Object.keys(partial).length > 0) graph.setConfigPartial(partial);\n }\n\n if (structure) {\n this.lastPointCount = structure.pointCount;\n graph.setPointPositions(this.withSeededPositions(structure.positions));\n // cosmos takes link endpoint indices as Float32Array; exact for < 2^24 points.\n graph.setLinks(Float32Array.from(structure.links));\n }\n\n // Staged AFTER the roster so cosmos sees a membership array matching the\n // point count of this same commit (I2), and before the single render().\n if (config && config.cluster !== undefined) this.applyClusterForce(graph, config.cluster);\n\n if (buffers) {\n // [0,1] RGBA floats — cosmos' native scale; pass through (see header note).\n if (buffers.pointColor) graph.setPointColors(buffers.pointColor);\n if (buffers.pointSize) graph.setPointSizes(buffers.pointSize);\n if (buffers.linkColor) graph.setLinkColors(buffers.linkColor);\n if (buffers.linkWidth) graph.setLinkWidths(buffers.linkWidth);\n }\n\n // §8 atlas resources are staged before the SAME render() as every other\n // channel, keeping the commit visibly atomic.\n if (resources) this.applyResources(graph, resources);\n\n graph.render();\n this.applied = update.revision;\n\n if (restart) graph.start(restart.alpha);\n }\n\n /**\n * Applies the §16.3 stage-4 cluster force (capability `clusterForce`).\n *\n * Contract mapping, verified against the 3.3.0 dist (`index.d.ts`):\n * - `pointClusters` (Float32Array, NaN = unclustered) →\n * `setPointClusters((number | undefined)[])`, where cosmos' documented\n * \"does not belong to any cluster\" value is `undefined`;\n * - `centers` (Float32Array, `[x0,y0,x1,y1,…]`) →\n * `setClusterPositions((number | undefined)[])`; a non-finite entry means\n * \"no position\" and cosmos falls back to that cluster's centermass;\n * - `null` clears: an all-`undefined` array of the CURRENT roster length\n * (length must track the roster) plus empty cluster positions.\n * `strength` is the scene-wide `simulationCluster` config coefficient\n * applied in the config block, not the per-point\n * `setPointClusterStrength` buffer (Orbit's strength is scene-wide).\n */\n private applyClusterForce(\n graph: CosmosGraph,\n cluster: NonNullable<EngineCommit['config']>['cluster'],\n ): void {\n if (cluster == null) {\n graph.setPointClusters(new Array<number | undefined>(this.lastPointCount).fill(undefined));\n graph.setClusterPositions([]);\n return;\n }\n const source = cluster.pointClusters;\n const assignments = new Array<number | undefined>(source.length);\n for (let i = 0; i < source.length; i++) {\n const value = source[i]!;\n assignments[i] = Number.isFinite(value) ? value : undefined;\n }\n graph.setPointClusters(assignments);\n const centers = cluster.centers;\n if (centers !== undefined) {\n const positions = new Array<number | undefined>(centers.length);\n for (let i = 0; i < centers.length; i++) {\n const value = centers[i]!;\n positions[i] = Number.isFinite(value) ? value : undefined;\n }\n graph.setClusterPositions(positions);\n }\n }\n\n /**\n * Applies the §8 image-atlas channel: upserts convert ImageBitmap →\n * ImageData through an offscreen 2D canvas into the slot mirror, removals\n * blank their slot, and any atlas change re-uploads the FULL ImageData\n * array (cosmos' setImageData is whole-array only, matching\n * `rangeUpdates: []`). Environments without a usable 2D context (jsdom)\n * no-op the channel and report `engine:image-channel-unavailable` once —\n * never throw.\n */\n private applyResources(graph: CosmosGraph, resources: EngineResources): void {\n const atlas = resources.imageAtlas;\n if (atlas) {\n let dirty = false;\n let conversionFailed = false;\n if (atlas.upserts) {\n for (const { slot, bitmap } of atlas.upserts) {\n if (!Number.isInteger(slot) || slot < 0) continue;\n const data = this.canvasImageData(bitmap.width, bitmap.height, bitmap);\n if (data === null) {\n conversionFailed = true;\n continue;\n }\n while (this.imageSlots.length <= slot) this.imageSlots.push(null);\n this.imageSlots[slot] = data;\n dirty = true;\n }\n }\n if (atlas.removeSlots) {\n for (const slot of atlas.removeSlots) {\n // Only slots that currently hold an image need blanking.\n if (slot >= 0 && slot < this.imageSlots.length && this.imageSlots[slot] != null) {\n this.imageSlots[slot] = null;\n dirty = true;\n }\n }\n }\n if (conversionFailed) this.reportImageChannelUnavailable();\n if (dirty) {\n const blank = this.blankImage ?? (this.blankImage = this.canvasImageData(1, 1));\n if (blank === null) {\n this.reportImageChannelUnavailable();\n } else {\n // Array.from (not .map) so sparse holes also materialize as blanks.\n graph.setImageData(Array.from(this.imageSlots, (d) => d ?? blank));\n }\n }\n }\n // Indices into an atlas that can never be populated are meaningless —\n // once the channel is known-unavailable the whole channel no-ops.\n if (resources.pointImageIndex && !this.imageChannelUnavailable) {\n graph.setPointImageIndices(resources.pointImageIndex);\n }\n }\n\n /**\n * Reads an ImageData of the given size off an offscreen 2D canvas, drawing\n * `bitmap` onto it first when provided (ImageBitmap → ImageData transcode;\n * without a bitmap: a transparent blank). Returns null — never throws —\n * where no 2D context exists (jsdom without the canvas package).\n */\n private canvasImageData(width: number, height: number, bitmap?: ImageBitmap): ImageData | null {\n const doc = this.innerDiv?.ownerDocument;\n if (!doc || !(width > 0) || !(height > 0)) return null;\n try {\n const canvas = doc.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) return null;\n if (bitmap) ctx.drawImage(bitmap, 0, 0);\n return ctx.getImageData(0, 0, width, height);\n } catch {\n return null;\n }\n }\n\n /** Documented degradation, reported at most once per engine instance. */\n private reportImageChannelUnavailable(): void {\n if (this.imageChannelUnavailable) return;\n this.imageChannelUnavailable = true;\n this.events?.onDiagnostic?.({\n code: 'engine:image-channel-unavailable',\n severity: 'warning',\n message:\n 'CosmosEngine: no 2D canvas context is available to convert ImageBitmap ' +\n 'atlas entries to ImageData; point images are disabled in this environment.',\n });\n }\n\n /**\n * Replaces NaN pairs (= \"no known position\", §7.3) with random points on a\n * ring of radius seedRadius around the space center. cosmos treats NaN\n * positions as *absent* points, so they must never reach setPointPositions.\n * Known positions pass through verbatim (same array when nothing to seed).\n */\n private withSeededPositions(positions: Float32Array): Float32Array {\n let needsSeeding = false;\n for (let i = 0; i < positions.length; i += 2) {\n if (Number.isNaN(positions[i]!) || Number.isNaN(positions[i + 1]!)) {\n needsSeeding = true;\n break;\n }\n }\n if (!needsSeeding) return positions;\n\n const out = Float32Array.from(positions);\n const center = this.spaceSize / 2;\n const radius = this.seedRadius;\n for (let i = 0; i < out.length; i += 2) {\n if (Number.isNaN(out[i]!) || Number.isNaN(out[i + 1]!)) {\n const angle = Math.random() * Math.PI * 2;\n out[i] = center + radius * Math.cos(angle);\n out[i + 1] = center + radius * Math.sin(angle);\n }\n }\n return out;\n }\n}\n\n/**\n * Per-channel merge for queued §8 resources (pre-mount / context-lost):\n * upserts union per slot (latest bitmap wins), a later remove drops an\n * earlier pending upsert of the same slot (and vice versa — folding order\n * mirrors applyResources: upserts before removes within each commit), and\n * the latest pointImageIndex replaces wholesale.\n */\nfunction mergeResources(\n previous: EngineCommit['resources'],\n update: EngineCommit['resources'],\n): EngineResources {\n const upsertBySlot = new Map<number, ImageBitmap>();\n const removes = new Set<number>();\n for (const atlas of [previous?.imageAtlas, update?.imageAtlas]) {\n if (!atlas) continue;\n for (const { slot, bitmap } of atlas.upserts ?? []) {\n upsertBySlot.set(slot, bitmap);\n removes.delete(slot);\n }\n for (const slot of atlas.removeSlots ?? []) {\n upsertBySlot.delete(slot);\n removes.add(slot);\n }\n }\n const merged: EngineResources = {};\n if (upsertBySlot.size > 0 || removes.size > 0) {\n const imageAtlas: NonNullable<EngineResources['imageAtlas']> = {};\n if (upsertBySlot.size > 0) {\n imageAtlas.upserts = Array.from(upsertBySlot, ([slot, bitmap]) => ({ slot, bitmap }));\n }\n if (removes.size > 0) imageAtlas.removeSlots = Array.from(removes);\n merged.imageAtlas = imageAtlas;\n }\n const pointImageIndex = update?.pointImageIndex ?? previous?.pointImageIndex;\n if (pointImageIndex !== undefined) merged.pointImageIndex = pointImageIndex;\n return merged;\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@modernrelay/orbit-engine-cosmos",
3
+ "version": "0.2.0",
4
+ "description": "cosmos.gl engine adapter for Orbit: GPU force layout, native picking, context-loss recovery.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ModernRelay/orbit.git",
9
+ "directory": "packages/engine-cosmos"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": false,
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "dependencies": {
26
+ "@cosmos.gl/graph": "3.3.0",
27
+ "@modernrelay/orbit-core": "0.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "^5.6.0",
31
+ "vitest": "^3.0.0"
32
+ },
33
+ "scripts": {
34
+ "build": "tsup",
35
+ "test": "vitest run",
36
+ "typecheck": "tsc --noEmit"
37
+ }
38
+ }