cytoscape
Create a GPU-prototype cytoscape instance (issue #3486, pass 1): a columnar CPU-canonical model with a WebGPU render pipeline.
With a container, WebGPU is required — this throws synchronously when navigator.gpu is unavailable. Without a container the instance is headless (Node-friendly, never throws for a missing GPU). Adapter acquisition is asynchronous and reported separately: cy.ready rejects when no adapter can be had, which this function cannot know yet.
Beyond the constructor's work, the factory ingests options.elements through the bulk path (no per-element handles, no add events — nothing can be listening yet), runs options.layout, and attaches the renderer and pointer handler when a container is given.
This is the full build (cytoscape). Two slimmer entries carry the same core without the renderer (round 131): cytoscape/headless (no renderer, no GPU executors) and cytoscape/headless-gpu (the GPU algorithm lanes and a headless GPU force host, no renderer).
Unknown options are ignored, deliberately (decided 2026-08-04, fifth design sitting): unlike an unknown sheet key, style property or query key, a misspelled option does not throw, because strictness here resolves at the type layer — TypeScript's excess-property check rejects { motionBlur: true } against CytoscapeOptions, and v4 does not replicate at runtime what the build already checks.
Typed element data (round 140): cytoscape<NodeData, EdgeData>( … ) types the instance by the application's node and edge data shapes. data() then takes only their keys and reads their field types; the collections know their group (cy.nodes() reads NodeData, connectedEdges() reads EdgeData); events, add/patch/load/ clone payloads, queries and the stylesheet's mapper fields are checked against the same shapes. Give NodeData alone to leave the edges' keys open. The generics are never inferred from options — without them every type is exactly the untyped one.
optionsthe instance options; every field is optional, and an omitted
containeris what selects headless mode
Create a headless cytoscape instance — the cytoscape/headless build (round 131): the whole graph model, style, collection API, the CPU algorithms and every layout, with the worker pool where the platform offers workers, and neither a renderer nor any WebGPU code.
The factory ingests options.elements through the bulk path and runs options.layout, exactly as the full build's does. Unknown options are ignored, as there (the type rejects them), and the generics type the element data as there (round 140).
optionsthe instance options, without the renderer- and pointer-only fields (
HeadlessOptions)
Create a headless cytoscape instance with the GPU executors — the cytoscape/headless-gpu build (round 131): everything cytoscape/headless carries, plus the WGSL algorithm kernels and a compute-only host for an explicit executor: 'gpu' force run, and no renderer.
The factory ingests options.elements through the bulk path and runs options.layout, exactly as the full build's does. Unknown options are ignored, as there (the type rejects them), and the generics type the element data as there (round 140).
optionsthe instance options, without the renderer- and pointer-only fields (
HeadlessOptions)
the new core, usable synchronously — reads and writes do not wait on the device, and a rendered instance additionally resolves cy.ready
when
containeris given andnavigator.gpuis missingwhen a
containeris given — this build has no renderer