@cosmos.gl/deck-layers 3.5.0-beta.2 → 3.5.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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/blend-parameters.ts","../src/cosmos-points-layer-uniforms.ts","../src/cosmos-points-layer.ts","../src/cosmos-links-layer-uniforms.ts","../src/cosmos-links-layer.ts","../src/cosmos-graph-layer.ts"],"sourcesContent":["/**\n * Premultiplied-style alpha blending with depth writes disabled: points and\n * links are drawn back-to-front by layer order, never by depth.\n *\n * Wire through `defaultProps.parameters`: before every draw, deck resets each\n * model's pipeline parameters from `layer.props.parameters`. Parameters given\n * only at `Model` creation last one frame.\n *\n * Declare the default with `compare: 2`, like the base layer does — a plain\n * object default would drop deep comparison, and every new-but-equal\n * `parameters` object from the caller would count as a prop change.\n */\nexport const BLEND_PARAMETERS = {\n depthWriteEnabled: false,\n depthCompare: 'always',\n blend: true,\n blendColorOperation: 'add',\n blendColorSrcFactor: 'src-alpha',\n blendColorDstFactor: 'one-minus-src-alpha',\n blendAlphaOperation: 'add',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one-minus-src-alpha',\n} as const\n","import type { ShaderModule } from '@luma.gl/shadertools'\nimport type { Texture } from '@luma.gl/core'\n\nconst uniformBlock = `\\\nlayout(std140) uniform cosmosPointsUniforms {\n float pointsTextureSize;\n highp int sizeUnits;\n} cosmosPoints;\n`\n\ntype CosmosPointsBindingProps = {\n positionsTexture: Texture;\n}\n\ntype CosmosPointsUniformProps = {\n pointsTextureSize: number;\n sizeUnits: number;\n}\n\nexport type CosmosPointsProps = CosmosPointsBindingProps & CosmosPointsUniformProps\n\nexport const cosmosPointsUniforms = {\n name: 'cosmosPoints',\n vs: uniformBlock,\n uniformTypes: {\n pointsTextureSize: 'f32',\n sizeUnits: 'i32',\n },\n} as const satisfies ShaderModule<CosmosPointsProps>\n","import { Layer, project32, picking, UNIT } from '@deck.gl/core'\nimport type { Accessor, Color, DefaultProps, LayerDataSource, LayerProps, Unit, UpdateParameters } from '@deck.gl/core'\nimport { Model, Geometry } from '@luma.gl/engine'\n\nimport { BLEND_PARAMETERS } from './blend-parameters'\nimport { cosmosPointsUniforms } from './cosmos-points-layer-uniforms'\nimport type { CosmosPointsProps } from './cosmos-points-layer-uniforms'\nimport type { PositionTextureSource } from './types'\n\nconst DEFAULT_POINT_COLOR: [number, number, number, number] = [74, 92, 191, 230]\n\nconst vs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-points-layer-vertex-shader\n\nin vec3 positions;\n\nin float instanceSizes;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\n\nuniform sampler2D positionsTexture;\n\nout vec4 vColor;\nout vec2 unitPosition;\nout float outerRadiusPixels;\n\n// Collapse the quad so it clips away: nothing rasterizes, nothing picks\nvoid collapse() {\n gl_Position = vec4(0.0);\n unitPosition = vec2(0.0);\n outerRadiusPixels = 0.0;\n vColor = vec4(0.0);\n}\n\nvoid main(void) {\n int pointIndex = gl_InstanceID;\n int textureSize = int(cosmosPoints.pointsTextureSize);\n // Point i lives at texel (i % size, i / size) as [x, y, i, unused] in space coordinates\n vec4 pointPosition = texelFetch(positionsTexture, ivec2(pointIndex % textureSize, pointIndex / textureSize), 0);\n\n // A removed (absent) point's texel is NaN — see PointPositionTexture\n if (isnan(pointPosition.x)) {\n collapse();\n return;\n }\n\n geometry.worldPosition = vec3(pointPosition.xy, 0.0);\n geometry.pickingColor = instancePickingColors;\n\n // instanceSizes is a diameter; the quad expands by radius\n outerRadiusPixels = project_size_to_pixel(instanceSizes * 0.5, cosmosPoints.sizeUnits);\n // A non-positive size hides the point — and the edge-padding divide below\n // is undefined at zero\n if (outerRadiusPixels <= 0.0) {\n collapse();\n return;\n }\n // Expand the quad so edge smoothing has room outside the circle\n float edgePadding = (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels;\n\n unitPosition = edgePadding * positions.xy;\n geometry.uv = unitPosition;\n\n vec3 offset = vec3(edgePadding * positions.xy * project_pixel_size(outerRadiusPixels), 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = project_position_to_clipspace(geometry.worldPosition, vec3(0.0), offset, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`\n\nconst fs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-points-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 unitPosition;\nin float outerRadiusPixels;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition) * outerRadiusPixels;\n float inCircle = smoothedge(distToCenter, outerRadiusPixels);\n if (inCircle == 0.0) {\n discard;\n }\n\n fragColor = vec4(vColor.rgb, vColor.a * inCircle);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`\n\nexport type CosmosPointsLayerProps<DataT = unknown> = CosmosPointsLayerOwnProps<DataT> & LayerProps\n\ntype CosmosPointsLayerOwnProps<DataT> = {\n /**\n * One entry per simulation point, in point-index order: an array to run\n * accessors over, or `{ length }` when accessors are constants. The length\n * must equal the simulation's point count.\n */\n data: LayerDataSource<DataT>;\n /** The simulation whose live position texture to sample. */\n graph: PositionTextureSource;\n /**\n * Point diameter accessor, in `pointSizeUnits`; `0` hides the point.\n * @default 4\n */\n getPointSize?: Accessor<DataT, number>;\n /**\n * Point RGBA color accessor, channels in 0..255.\n * @default [74, 92, 191, 230]\n */\n getPointColor?: Accessor<DataT, Color>;\n /**\n * The units of the point diameter, one of `'meters'`, `'common'`, `'pixels'`.\n * @default 'pixels'\n */\n pointSizeUnits?: Unit;\n}\n\nconst defaultProps: DefaultProps<CosmosPointsLayerProps> = {\n getPointSize: { type: 'accessor', value: 4 },\n getPointColor: { type: 'accessor', value: DEFAULT_POINT_COLOR },\n pointSizeUnits: 'pixels',\n parameters: { type: 'object', value: BLEND_PARAMETERS, optional: true, compare: 2 },\n}\n\n/**\n * Renders every cosmos.gl point as an instanced quad whose position comes from\n * a `texelFetch` on the simulation's live GPU position texture — no position\n * attribute, no CPU copy, no per-frame attribute updates. Color and size are\n * ordinary deck instanced attributes, and picking works out of the box: the\n * instance index is the point index.\n */\nexport class CosmosPointsLayer<DataT = unknown> extends Layer<Required<CosmosPointsLayerOwnProps<DataT>>> {\n public static layerName = 'CosmosPointsLayer'\n public static defaultProps = defaultProps\n\n declare public state: { model?: Model }\n\n public getShaders (): ReturnType<Layer['getShaders']> {\n return super.getShaders({ vs, fs, modules: [project32, picking, cosmosPointsUniforms] })\n }\n\n public initializeState (): void {\n this.getAttributeManager()!.addInstanced({\n instanceSizes: {\n size: 1,\n transition: true,\n accessor: 'getPointSize',\n defaultValue: 4,\n },\n instanceColors: {\n size: 4,\n transition: true,\n type: 'unorm8',\n accessor: 'getPointColor',\n defaultValue: [...DEFAULT_POINT_COLOR],\n },\n })\n }\n\n public updateState (params: UpdateParameters<this>): void {\n super.updateState(params)\n\n if (params.changeFlags.extensionsChanged) {\n this.state.model?.destroy()\n this.state.model = this._getModel()\n this.getAttributeManager()!.invalidateAll()\n }\n }\n\n public draw (): void {\n const positionInfo = this.props.graph.getPointPositionTexture()\n const { model } = this.state\n if (!positionInfo || !model || positionInfo.pointCount === 0) return\n\n const moduleProps: CosmosPointsProps = {\n pointsTextureSize: positionInfo.textureSize,\n sizeUnits: UNIT[this.props.pointSizeUnits],\n positionsTexture: positionInfo.texture,\n }\n model.shaderInputs.setProps({ cosmosPoints: moduleProps })\n model.draw(this.context.renderPass)\n }\n\n private _getModel (): Model {\n // A quad that minimally covers the unit circle\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n positions: { size: 3, value: new Float32Array([-1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0]) },\n },\n }),\n isInstanced: true,\n })\n }\n}\n","import type { ShaderModule } from '@luma.gl/shadertools'\nimport type { Texture } from '@luma.gl/core'\n\nconst uniformBlock = `\\\nlayout(std140) uniform cosmosLinksUniforms {\n float pointsTextureSize;\n highp int widthUnits;\n} cosmosLinks;\n`\n\ntype CosmosLinksBindingProps = {\n positionsTexture: Texture;\n}\n\ntype CosmosLinksUniformProps = {\n pointsTextureSize: number;\n widthUnits: number;\n}\n\nexport type CosmosLinksProps = CosmosLinksBindingProps & CosmosLinksUniformProps\n\nexport const cosmosLinksUniforms = {\n name: 'cosmosLinks',\n vs: uniformBlock,\n uniformTypes: {\n pointsTextureSize: 'f32',\n widthUnits: 'i32',\n },\n} as const satisfies ShaderModule<CosmosLinksProps>\n","import { Layer, project32, picking, UNIT } from '@deck.gl/core'\nimport type { Accessor, Color, DefaultProps, LayerDataSource, LayerProps, Unit, UpdateParameters } from '@deck.gl/core'\nimport { Model, Geometry } from '@luma.gl/engine'\n\nimport { BLEND_PARAMETERS } from './blend-parameters'\nimport { cosmosLinksUniforms } from './cosmos-links-layer-uniforms'\nimport type { CosmosLinksProps } from './cosmos-links-layer-uniforms'\nimport type { PositionTextureSource } from './types'\n\nconst DEFAULT_LINK_COLOR: [number, number, number, number] = [94, 115, 194, 64]\n\nconst vs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-links-layer-vertex-shader\n\nin vec3 positions;\n\nin float instanceSourceIndices;\nin float instanceTargetIndices;\nin vec4 instanceColors;\nin float instanceWidths;\nin vec3 instancePickingColors;\n\nuniform sampler2D positionsTexture;\n\nout vec4 vColor;\nout vec2 uv;\n\n// Offset the vertex by half the link width, perpendicular to the link, in\n// screen space. offsetDirection is -1 (left) or 1 (right).\nvec2 getExtrusionOffset(vec2 lineClipspace, float offsetDirection, float width) {\n vec2 dirScreenspace = normalize(lineClipspace * project.viewportSize);\n dirScreenspace = vec2(-dirScreenspace.y, dirScreenspace.x);\n return dirScreenspace * offsetDirection * width / 2.0;\n}\n\nvec4 fetchPointPosition(float index, int textureSize) {\n int pointIndex = int(index);\n // Point i lives at texel (i % size, i / size) as [x, y, i, unused] in space coordinates\n return texelFetch(positionsTexture, ivec2(pointIndex % textureSize, pointIndex / textureSize), 0);\n}\n\nvoid main(void) {\n int textureSize = int(cosmosLinks.pointsTextureSize);\n vec4 sourcePosition = fetchPointPosition(instanceSourceIndices, textureSize);\n vec4 targetPosition = fetchPointPosition(instanceTargetIndices, textureSize);\n\n // A removed (absent) endpoint's texel is NaN — see PointPositionTexture;\n // collapse the quad so it clips away\n if (isnan(sourcePosition.x) || isnan(targetPosition.x)) {\n gl_Position = vec4(0.0);\n vColor = vec4(0.0);\n uv = vec2(0.0);\n return;\n }\n\n vec3 sourceWorld = vec3(sourcePosition.xy, 0.0);\n vec3 targetWorld = vec3(targetPosition.xy, 0.0);\n geometry.worldPosition = sourceWorld;\n geometry.worldPositionAlt = targetWorld;\n\n vec4 sourceCommonspace;\n vec4 targetCommonspace;\n vec4 source = project_position_to_clipspace(sourceWorld, vec3(0.0), vec3(0.0), sourceCommonspace);\n vec4 target = project_position_to_clipspace(targetWorld, vec3(0.0), vec3(0.0), targetCommonspace);\n\n // positions.x selects the endpoint, positions.y the extrusion side\n float segmentIndex = positions.x;\n vec4 p = mix(source, target, segmentIndex);\n geometry.position = mix(sourceCommonspace, targetCommonspace, segmentIndex);\n uv = positions.xy;\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n float widthPixels = project_size_to_pixel(instanceWidths, cosmosLinks.widthUnits);\n\n vec3 offset = vec3(getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels), 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(p, geometry);\n gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`\n\nconst fs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-links-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 uv;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = uv;\n\n fragColor = vColor;\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`\n\nexport type CosmosLinksLayerProps<DataT = unknown> = CosmosLinksLayerOwnProps<DataT> & LayerProps\n\ntype CosmosLinksLayerOwnProps<DataT> = {\n /**\n * One entry per link, in link-index order: an array to run accessors over,\n * or binary form. The cosmos links array `[src0, tgt0, src1, tgt1, …]` maps\n * without a copy as two interleaved attributes over the same buffer:\n * `{ length, attributes: { getLinkSource: { value, size: 1, stride: 8 },\n * getLinkTarget: { value, size: 1, offset: 4, stride: 8 } } }`.\n */\n data: LayerDataSource<DataT>;\n /** The simulation whose live position texture to sample. */\n graph: PositionTextureSource;\n /**\n * Source point index accessor.\n * @default l => l.source\n */\n getLinkSource?: Accessor<DataT, number>;\n /**\n * Target point index accessor.\n * @default l => l.target\n */\n getLinkTarget?: Accessor<DataT, number>;\n /**\n * Link RGBA color accessor, channels in 0..255.\n * @default [94, 115, 194, 64]\n */\n getLinkColor?: Accessor<DataT, Color>;\n /**\n * Link width accessor, in `linkWidthUnits`.\n * @default 1\n */\n getLinkWidth?: Accessor<DataT, number>;\n /**\n * The units of the link width, one of `'meters'`, `'common'`, `'pixels'`.\n * @default 'pixels'\n */\n linkWidthUnits?: Unit;\n}\n\nconst defaultProps: DefaultProps<CosmosLinksLayerProps> = {\n getLinkSource: { type: 'accessor', value: (l: unknown) => (l as { source: number }).source },\n getLinkTarget: { type: 'accessor', value: (l: unknown) => (l as { target: number }).target },\n getLinkColor: { type: 'accessor', value: DEFAULT_LINK_COLOR },\n getLinkWidth: { type: 'accessor', value: 1 },\n linkWidthUnits: 'pixels',\n parameters: { type: 'object', value: BLEND_PARAMETERS, optional: true, compare: 2 },\n}\n\n/**\n * Renders every cosmos.gl link as an instanced quad stretched between its two\n * endpoints: the vertex shader `texelFetch`es both point positions from the\n * simulation's live GPU texture and extrudes the quad by half the link width\n * in screen space — no position attribute, no CPU copy, no per-frame attribute\n * updates. Endpoint indices, color and width are ordinary deck instanced\n * attributes, and picking works out of the box: the instance index is the\n * link index.\n */\nexport class CosmosLinksLayer<DataT = unknown> extends Layer<Required<CosmosLinksLayerOwnProps<DataT>>> {\n public static layerName = 'CosmosLinksLayer'\n public static defaultProps = defaultProps\n\n declare public state: { model?: Model }\n\n public getShaders (): ReturnType<Layer['getShaders']> {\n return super.getShaders({ vs, fs, modules: [project32, picking, cosmosLinksUniforms] })\n }\n\n public initializeState (): void {\n this.getAttributeManager()!.addInstanced({\n instanceSourceIndices: {\n size: 1,\n accessor: 'getLinkSource',\n },\n instanceTargetIndices: {\n size: 1,\n accessor: 'getLinkTarget',\n },\n instanceColors: {\n size: 4,\n transition: true,\n type: 'unorm8',\n accessor: 'getLinkColor',\n defaultValue: [...DEFAULT_LINK_COLOR],\n },\n instanceWidths: {\n size: 1,\n transition: true,\n accessor: 'getLinkWidth',\n defaultValue: 1,\n },\n })\n }\n\n public updateState (params: UpdateParameters<this>): void {\n super.updateState(params)\n\n if (params.changeFlags.extensionsChanged) {\n this.state.model?.destroy()\n this.state.model = this._getModel()\n this.getAttributeManager()!.invalidateAll()\n }\n }\n\n public draw (): void {\n const positionInfo = this.props.graph.getPointPositionTexture()\n const { model } = this.state\n if (!positionInfo || !model || positionInfo.pointCount === 0) return\n\n const moduleProps: CosmosLinksProps = {\n pointsTextureSize: positionInfo.textureSize,\n widthUnits: UNIT[this.props.linkWidthUnits],\n positionsTexture: positionInfo.texture,\n }\n model.shaderInputs.setProps({ cosmosLinks: moduleProps })\n model.draw(this.context.renderPass)\n }\n\n private _getModel (): Model {\n // positions.x selects source/target, positions.y the extrusion side\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n positions: { size: 3, value: new Float32Array([0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0]) },\n },\n }),\n isInstanced: true,\n })\n }\n}\n","import { CompositeLayer } from '@deck.gl/core'\nimport type {\n Accessor,\n AccessorContext,\n Color,\n DefaultProps,\n GetPickingInfoParams,\n Layer,\n LayerContext,\n LayerProps,\n PickingInfo,\n Unit,\n UpdateParameters,\n} from '@deck.gl/core'\nimport { GraphSimulation, defaultConfigValues } from '@cosmos.gl/graph'\nimport type { GraphSimulationConfig } from '@cosmos.gl/graph'\n\nimport { BLEND_PARAMETERS } from './blend-parameters'\nimport { CosmosPointsLayer } from './cosmos-points-layer'\nimport { CosmosLinksLayer } from './cosmos-links-layer'\n\n/**\n * Points input: an array to run accessors over (picking returns the original\n * objects), or the cosmos-native binary form — a point count plus optional\n * `[x0, y0, x1, y1, …]` initial positions. Points without given positions are\n * seeded randomly inside the simulation space.\n */\nexport type CosmosGraphPoints<PointDataT> = readonly PointDataT[] | {\n length: number;\n initialPositions?: Float32Array;\n /** Optional binary styling channels, keyed by accessor name (`getPointColor`, `getPointSize`). */\n attributes?: Record<string, unknown>;\n}\n\n/**\n * Links input: an array to run accessors over, or the cosmos-native\n * `[source0, target0, source1, target1, …]` array of point indices.\n * An array link whose source or target does not resolve to a point is dropped\n * from both the simulation and the rendering, with one warning per data change.\n */\nexport type CosmosGraphLinks<LinkDataT> = readonly LinkDataT[] | Float32Array\n\n/** Picking info from a CosmosGraphLayer: which kind of element was hit. */\nexport type CosmosGraphPickingInfo = PickingInfo & {\n elementType?: 'point' | 'link';\n}\n\nexport type CosmosGraphLayerProps<PointDataT = unknown, LinkDataT = unknown> =\n CosmosGraphLayerOwnProps<PointDataT, LinkDataT> & LayerProps\n\ntype CosmosGraphLayerOwnProps<PointDataT, LinkDataT> = {\n /** One entry per point — an array of your objects, or `{ length, initialPositions? }`. */\n points: CosmosGraphPoints<PointDataT>;\n /** One entry per link — an array of your objects, or a flat point-index pair array. */\n links?: CosmosGraphLinks<LinkDataT> | null;\n /**\n * Stable point id accessor. When provided (with array points), link\n * accessors may return ids instead of point indices.\n */\n getPointId?: Accessor<PointDataT, string | number> | null;\n /** Initial `[x, y]` position accessor for array points; points it leaves undefined are seeded randomly. */\n getPointPosition?: Accessor<PointDataT, readonly [number, number] | null | undefined> | null;\n /**\n * Point diameter accessor, in `pointSizeUnits`; `0` hides the point.\n * @default 4\n */\n getPointSize?: Accessor<PointDataT, number>;\n /**\n * Point RGBA color accessor, channels in 0..255.\n * @default [74, 92, 191, 230]\n */\n getPointColor?: Accessor<PointDataT, Color>;\n /**\n * The units of the point diameter.\n * @default 'pixels'\n */\n pointSizeUnits?: Unit;\n /**\n * Source accessor for array links: a point index, or a point id when\n * `getPointId` is set.\n * @default l => l.source\n */\n getLinkSource?: Accessor<LinkDataT, string | number>;\n /**\n * Target accessor for array links: a point index, or a point id when\n * `getPointId` is set.\n * @default l => l.target\n */\n getLinkTarget?: Accessor<LinkDataT, string | number>;\n /**\n * Link RGBA color accessor, channels in 0..255.\n * @default [94, 115, 194, 64]\n */\n getLinkColor?: Accessor<LinkDataT, Color>;\n /**\n * Link width accessor, in `linkWidthUnits`.\n * @default 1\n */\n getLinkWidth?: Accessor<LinkDataT, number>;\n /**\n * The units of the link width.\n * @default 'pixels'\n */\n linkWidthUnits?: Unit;\n /**\n * Lets pointer drags grab a point: pinned on drag start, moved with the\n * pointer, released per `unpinOnDragEnd`. View panning is suppressed while\n * a point is grabbed.\n * @default false\n */\n enablePointDrag?: boolean;\n /**\n * Simulation alpha to restart with when a drag starts, so the graph\n * responds to the moving point; `null` leaves the simulation untouched.\n * @default 0.1\n */\n dragReheatAlpha?: number | null;\n /**\n * Release the point on drag end; `false` keeps it pinned where dropped.\n * @default true\n */\n unpinOnDragEnd?: boolean;\n /** Called when a point drag starts. */\n onPointDragStart?: ((info: CosmosGraphPickingInfo) => void) | null;\n /** Called for every pointer move while a point is dragged. */\n onPointDrag?: ((info: CosmosGraphPickingInfo) => void) | null;\n /** Called when a point drag ends. */\n onPointDragEnd?: ((info: CosmosGraphPickingInfo) => void) | null;\n /** Simulation configuration, passed through to `GraphSimulation` (forces, spaceSize, callbacks). */\n simulationConfig?: GraphSimulationConfig;\n /**\n * Called once with the layer-owned `GraphSimulation` — the escape hatch for\n * advanced control (pause, pinning, sparse position writes).\n */\n onSimulationCreated?: ((simulation: GraphSimulation) => void) | null;\n}\n\nconst defaultProps: DefaultProps<CosmosGraphLayerProps> = {\n links: null,\n getPointId: { type: 'accessor', value: null },\n getPointPosition: { type: 'accessor', value: null },\n getPointSize: { type: 'accessor', value: 4 },\n getPointColor: { type: 'accessor', value: [74, 92, 191, 230] },\n pointSizeUnits: 'pixels',\n getLinkSource: { type: 'accessor', value: (l: unknown) => (l as { source: number }).source },\n getLinkTarget: { type: 'accessor', value: (l: unknown) => (l as { target: number }).target },\n getLinkColor: { type: 'accessor', value: [94, 115, 194, 64] },\n getLinkWidth: { type: 'accessor', value: 1 },\n linkWidthUnits: 'pixels',\n enablePointDrag: false,\n dragReheatAlpha: 0.1,\n unpinOnDragEnd: true,\n onPointDragStart: { type: 'function', value: null, optional: true },\n onPointDrag: { type: 'function', value: null, optional: true },\n onPointDragEnd: { type: 'function', value: null, optional: true },\n simulationConfig: { type: 'object', value: {}, compare: 2 },\n onSimulationCreated: { type: 'function', value: null, optional: true },\n // getSubLayerProps forwards `parameters` into every sublayer, so the\n // composite must carry the same pipeline-state default the primitives do\n parameters: { type: 'object', value: BLEND_PARAMETERS, optional: true, compare: 2 },\n}\n\n/** The slice of a deck gesture event the drag handlers need. */\ntype DragGestureEvent = {\n stopImmediatePropagation?: () => void;\n}\n\n/** The update-trigger keys the composite forwards to its sublayers. */\ntype CosmosUpdateTriggers = {\n getPointId?: unknown;\n getPointPosition?: unknown;\n getPointSize?: unknown;\n getPointColor?: unknown;\n getLinkSource?: unknown;\n getLinkTarget?: unknown;\n getLinkColor?: unknown;\n getLinkWidth?: unknown;\n}\n\n/** Resolves a deck accessor (function or constant) for one object. */\nconst resolveAccessor = <In, Out>(accessor: Accessor<In, Out>, object: In, info: AccessorContext<In>): Out =>\n typeof accessor === 'function' ? (accessor as (o: In, i: AccessorContext<In>) => Out)(object, info) : accessor\n\n/**\n * The batteries-included cosmos.gl graph layer: give it points and links, and\n * it owns the rest. The layer creates a `GraphSimulation` on deck's device,\n * ingests the data, advances the simulation once per animation frame from\n * deck's shared timeline while it runs (deck goes idle when it settles — no\n * `_animate` required), renders through `CosmosLinksLayer` + `CosmosPointsLayer`\n * (positions stay GPU-resident), and destroys the simulation when the layer is\n * removed. Picking reports `elementType: 'point' | 'link'` alongside the index\n * and, for array data, the original object.\n */\nexport class CosmosGraphLayer<PointDataT = unknown, LinkDataT = unknown> extends CompositeLayer<\n Required<CosmosGraphLayerOwnProps<PointDataT, LinkDataT>>\n> {\n public static layerName = 'CosmosGraphLayer'\n public static defaultProps = defaultProps\n\n declare public state: {\n simulation?: GraphSimulation;\n isReady: boolean;\n pointCount: number;\n pointsData: readonly PointDataT[] | { length: number; attributes?: Record<string, unknown> };\n linksData: readonly LinkDataT[] | { length: number; attributes: Record<string, unknown> } | null;\n /** Array links only: the resolved `[source, target]` point-index pairs, one per entry of `linksData`. */\n linkIndices: Float32Array | null;\n draggedPointIndex: number | null;\n animationHandle?: number;\n }\n\n public get isLoaded (): boolean {\n return super.isLoaded && Boolean(this.state?.isReady)\n }\n\n public initializeState (): void {\n const { device, timeline } = this.context\n if (device.type !== 'webgl') {\n throw new Error(\n `@cosmos.gl/deck-layers requires a WebGL 2 device — the cosmos.gl simulation is WebGL-only, got '${device.type}'`\n )\n }\n\n const simulation = new GraphSimulation(this.props.simulationConfig, Promise.resolve(device))\n this.state = {\n simulation,\n isReady: false,\n pointCount: 0,\n pointsData: { length: 0 },\n linksData: null,\n linkIndices: null,\n draggedPointIndex: null,\n // Step the simulation exactly once per animation frame, independent of\n // draw passes (draw runs per viewport and again while picking)\n animationHandle: timeline.attachAnimation({ setTime: () => this._onTimelineTick() }),\n }\n\n this.props.onSimulationCreated?.(simulation)\n\n simulation.ready.then(() => {\n // `this` may be a stale descriptor by now; state is the stable identity\n if (this.state?.simulation !== simulation) return\n const layer = this.getCurrentLayer() ?? this\n layer.setState({ isReady: true })\n }).catch((error: Error) => {\n console.error('@cosmos.gl/deck-layers: simulation failed to initialize', error)\n })\n }\n\n public updateState (params: UpdateParameters<this>): void {\n super.updateState(params)\n const { props, oldProps, changeFlags } = params\n const simulation = this.state.simulation\n if (!simulation) return\n\n if (changeFlags.propsChanged && props.simulationConfig !== oldProps.simulationConfig) {\n simulation.setConfig(props.simulationConfig)\n }\n // Link endpoints are resolved at ingest, so a change to the id map or to\n // an endpoint accessor re-ingests like a data change\n const triggers = typeof changeFlags.updateTriggersChanged === 'object'\n ? changeFlags.updateTriggersChanged as CosmosUpdateTriggers\n : undefined\n const dataChanged =\n props.points !== oldProps.points ||\n props.links !== oldProps.links ||\n Boolean(\n triggers?.getPointPosition || triggers?.getPointId || triggers?.getLinkSource || triggers?.getLinkTarget\n )\n if (dataChanged) {\n this._updateSimulationData()\n }\n }\n\n public renderLayers (): Layer[] | null {\n const { simulation, isReady, pointCount, pointsData, linksData, linkIndices } = this.state\n if (!simulation || !isReady || pointCount === 0) return null\n\n const { getPointSize, getPointColor, pointSizeUnits, getLinkColor, getLinkWidth, linkWidthUnits } = this.props\n const triggers: CosmosUpdateTriggers = this.props.updateTriggers ?? {}\n const layers: Layer[] = []\n\n if (linksData) {\n layers.push(\n new CosmosLinksLayer<LinkDataT>(\n this.getSubLayerProps({\n id: 'links',\n updateTriggers: {\n getLinkSource: triggers.getLinkSource,\n getLinkTarget: triggers.getLinkTarget,\n getLinkColor: triggers.getLinkColor,\n getLinkWidth: triggers.getLinkWidth,\n },\n }),\n {\n data: linksData as CosmosLinksLayer<LinkDataT>['props']['data'],\n graph: simulation,\n getLinkColor,\n getLinkWidth,\n linkWidthUnits,\n // getSubLayerProps does not forward `transitions`\n transitions: this.props.transitions,\n },\n Array.isArray(linksData) && linkIndices\n ? {\n // Array links read the endpoints resolved at ingest, so the\n // rendered links are exactly the simulated ones\n getLinkSource: (_: LinkDataT, { index }: AccessorContext<LinkDataT>): number => linkIndices[index * 2] as number,\n getLinkTarget: (_: LinkDataT, { index }: AccessorContext<LinkDataT>): number => linkIndices[index * 2 + 1] as number,\n }\n : {}\n )\n )\n }\n\n layers.push(\n new CosmosPointsLayer<PointDataT>(\n this.getSubLayerProps({\n id: 'points',\n updateTriggers: {\n getPointSize: triggers.getPointSize,\n getPointColor: triggers.getPointColor,\n },\n }),\n {\n data: pointsData as CosmosPointsLayer<PointDataT>['props']['data'],\n graph: simulation,\n getPointSize,\n getPointColor,\n pointSizeUnits,\n // getSubLayerProps does not forward `transitions`\n transitions: this.props.transitions,\n }\n )\n )\n\n return layers\n }\n\n public onDragStart (info: PickingInfo, event: DragGestureEvent): boolean {\n const { simulation } = this.state\n const { enablePointDrag, dragReheatAlpha } = this.props\n const picked = info as CosmosGraphPickingInfo\n if (!enablePointDrag || !simulation || picked.elementType !== 'point' || info.index < 0) return false\n\n // A direct field write: per-gesture state must not re-render sublayers\n this.state.draggedPointIndex = info.index\n simulation.setPinnedPoint(info.index, true)\n if (dragReheatAlpha !== null) simulation.start(dragReheatAlpha)\n // A grabbed point must not also pan the view\n event.stopImmediatePropagation?.()\n this.props.onPointDragStart?.(picked)\n return true\n }\n\n public onDrag (info: PickingInfo, event: DragGestureEvent): boolean {\n const { simulation, draggedPointIndex } = this.state\n if (!simulation || draggedPointIndex === null) return false\n\n const [x, y] = this._dragCoordinate(info)\n simulation.setPointPosition(draggedPointIndex, x, y)\n event.stopImmediatePropagation?.()\n // Repaint even when the simulation is settled and the ticker is idle\n ;(this.getCurrentLayer() ?? this).setNeedsRedraw()\n this.props.onPointDrag?.(info as CosmosGraphPickingInfo)\n return true\n }\n\n public onDragEnd (info: PickingInfo, event: DragGestureEvent): boolean {\n const { simulation, draggedPointIndex } = this.state\n if (!simulation || draggedPointIndex === null) return false\n\n if (this.props.unpinOnDragEnd) simulation.setPinnedPoint(draggedPointIndex, false)\n this.state.draggedPointIndex = null\n event.stopImmediatePropagation?.()\n this.props.onPointDragEnd?.(info as CosmosGraphPickingInfo)\n return true\n }\n\n public getPickingInfo (params: GetPickingInfoParams): CosmosGraphPickingInfo {\n const info: CosmosGraphPickingInfo = params.info\n if (params.sourceLayer) {\n info.elementType = params.sourceLayer.id.endsWith('-links') ? 'link' : 'point'\n }\n return info\n }\n\n /** The whole simulation space; lets deck's viewport helpers frame the graph. */\n public getBounds (): [number[], number[]] | null {\n const spaceSize = this.props.simulationConfig?.spaceSize ?? defaultConfigValues.spaceSize\n return [[0, 0, 0], [spaceSize, spaceSize, 0]]\n }\n\n public finalizeState (context: LayerContext): void {\n if (this.state?.animationHandle !== undefined) {\n this.context.timeline.detachAnimation(this.state.animationHandle)\n }\n this.state?.simulation?.destroy()\n super.finalizeState(context)\n }\n\n /**\n * Points and links have separate index spaces, so the same picking color\n * exists in both sublayers: highlight only the sublayer that was hovered\n * and clear the other, or hovering point N would also tint link N.\n */\n protected _updateAutoHighlight (info: PickingInfo): void {\n for (const layer of this.getSubLayers()) {\n if (layer.id === info.sourceLayer?.id) {\n layer.updateAutoHighlight(info)\n } else {\n layer.updateAutoHighlight({ ...info, picked: false })\n }\n }\n }\n\n private _onTimelineTick (): void {\n const { simulation, isReady } = this.state ?? {}\n if (!simulation || !isReady || !simulation.isSimulationRunning) return\n simulation.step()\n // Repaint the frame this step just computed; when the simulation settles,\n // the flag stops being set and deck goes idle on its own\n const layer = this.getCurrentLayer() ?? this\n layer.setNeedsRedraw()\n }\n\n private _dragCoordinate (info: PickingInfo): [number, number] {\n // info.coordinate is unprojected at the current pointer; it can be absent\n // when the pointer leaves the picked object's viewport\n if (info.coordinate) return [info.coordinate[0] as number, info.coordinate[1] as number]\n const unprojected = this.context.viewport.unproject([info.x, info.y])\n return [unprojected[0] as number, unprojected[1] as number]\n }\n\n private _updateSimulationData (): void {\n const simulation = this.state.simulation\n if (!simulation) return\n const { points, links, getPointId, getPointPosition } = this.props\n const spaceSize = this.props.simulationConfig?.spaceSize ?? defaultConfigValues.spaceSize\n\n // Unseeded points land in the middle half of the space, clear of the walls\n const randomCoordinate = (): number => spaceSize * (0.25 + Math.random() * 0.5)\n\n let pointCount: number\n let positions: Float32Array\n let pointsData: this['state']['pointsData']\n let idToIndex: Map<string | number, number> | null = null\n\n if (Array.isArray(points)) {\n const pointArray = points as readonly PointDataT[]\n pointCount = pointArray.length\n positions = new Float32Array(pointCount * 2)\n if (getPointId) idToIndex = new Map()\n for (let i = 0; i < pointCount; i += 1) {\n const point = pointArray[i] as PointDataT\n const info: AccessorContext<PointDataT> = { index: i, data: pointArray, target: [] }\n const position = getPointPosition ? resolveAccessor(getPointPosition, point, info) : null\n positions[i * 2] = position ? position[0] : randomCoordinate()\n positions[i * 2 + 1] = position ? position[1] : randomCoordinate()\n if (idToIndex && getPointId) idToIndex.set(resolveAccessor(getPointId, point, info), i)\n }\n pointsData = pointArray\n } else {\n const binaryPoints = points as { length: number; initialPositions?: Float32Array; attributes?: Record<string, unknown> }\n pointCount = binaryPoints.length\n if (binaryPoints.initialPositions) {\n positions = binaryPoints.initialPositions\n } else {\n positions = new Float32Array(pointCount * 2)\n for (let i = 0; i < positions.length; i += 1) positions[i] = randomCoordinate()\n }\n pointsData = binaryPoints.attributes\n ? { length: pointCount, attributes: binaryPoints.attributes }\n : { length: pointCount }\n }\n\n let linkArray: Float32Array | null = null\n let linksData: this['state']['linksData'] = null\n let linkIndices: Float32Array | null = null\n if (links instanceof Float32Array) {\n linkArray = links\n // The cosmos pair array feeds deck as two interleaved binary attributes\n linksData = {\n length: links.length / 2,\n attributes: {\n getLinkSource: { value: links, size: 1, stride: 8 },\n getLinkTarget: { value: links, size: 1, offset: 4, stride: 8 },\n },\n }\n } else if (Array.isArray(links)) {\n const linkObjects = links as readonly LinkDataT[]\n const { getLinkSource, getLinkTarget } = this.props\n // An endpoint is a point index, or a point id when the id map exists;\n // anything that does not name a point drops the whole link from both\n // the simulation and the rendering, so the two never disagree\n const resolveEndpoint = (endpoint: string | number): number | undefined => {\n const index = idToIndex ? idToIndex.get(endpoint) : endpoint\n return typeof index === 'number' && Number.isInteger(index) && index >= 0 && index < pointCount\n ? index\n : undefined\n }\n const keptLinks: LinkDataT[] = []\n const keptIndices: number[] = []\n for (let i = 0; i < linkObjects.length; i += 1) {\n const link = linkObjects[i] as LinkDataT\n const info: AccessorContext<LinkDataT> = { index: i, data: linkObjects, target: [] }\n const source = resolveEndpoint(resolveAccessor(getLinkSource, link, info))\n const target = resolveEndpoint(resolveAccessor(getLinkTarget, link, info))\n if (source === undefined || target === undefined) continue\n keptLinks.push(link)\n keptIndices.push(source, target)\n }\n const dropped = linkObjects.length - keptLinks.length\n if (dropped > 0) {\n const hint = idToIndex ? 'getLinkSource / getLinkTarget against getPointId' : 'getLinkSource / getLinkTarget'\n console.warn(\n `@cosmos.gl/deck-layers: dropped ${dropped} of ${linkObjects.length} links whose source or target is not a point — check ${hint}`\n )\n }\n linkArray = Float32Array.from(keptIndices)\n linkIndices = linkArray\n linksData = keptLinks\n }\n\n simulation.setPointPositions(positions)\n simulation.setLinks(linkArray ?? new Float32Array(0))\n simulation.applyData()\n\n this.setState({ pointCount, pointsData, linksData, linkIndices })\n }\n}\n"],"names":["BLEND_PARAMETERS","uniformBlock","cosmosPointsUniforms","DEFAULT_POINT_COLOR","vs","fs","defaultProps","_CosmosPointsLayer","Layer","project32","picking","params","_a","positionInfo","model","moduleProps","UNIT","Model","Geometry","CosmosPointsLayer","cosmosLinksUniforms","DEFAULT_LINK_COLOR","l","_CosmosLinksLayer","CosmosLinksLayer","resolveAccessor","accessor","object","info","_CosmosGraphLayer","CompositeLayer","device","timeline","simulation","GraphSimulation","_b","error","props","oldProps","changeFlags","triggers","isReady","pointCount","pointsData","linksData","linkIndices","getPointSize","getPointColor","pointSizeUnits","getLinkColor","getLinkWidth","linkWidthUnits","layers","_","index","event","enablePointDrag","dragReheatAlpha","picked","_c","draggedPointIndex","x","y","spaceSize","defaultConfigValues","context","layer","unprojected","points","links","getPointId","getPointPosition","randomCoordinate","positions","idToIndex","pointArray","i","point","position","binaryPoints","linkArray","linkObjects","getLinkSource","getLinkTarget","resolveEndpoint","endpoint","keptLinks","keptIndices","link","source","target","dropped","hint","CosmosGraphLayer"],"mappings":";;;AAYO,MAAMA,IAAmB;AAAA,EAC9B,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,OAAO;AAAA,EACP,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AACvB,GCnBMC,IAAe;AAAA;AAAA;AAAA;AAAA,GAkBRC,IAAuB;AAAA,EAClC,MAAM;AAAA,EACN,IAAID;AAAAA,EACJ,cAAc;AAAA,IACZ,mBAAmB;AAAA,IACnB,WAAW;AAAA,EAAA;AAEf,GCnBME,IAAwD,CAAC,IAAI,IAAI,KAAK,GAAG,GAEzEC;AAAAA;AAAAA,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GA+DhBC;AAAAA;AAAAA,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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L,KAAK,GAAG;AAC9C,cAAMY,IAAOP,EAAYL,CAAC,GACpBhD,IAAmC,EAAE,OAAOgD,GAAG,MAAMK,GAAa,QAAQ,GAAC,GAC3EQ,IAASL,EAAgB3D,EAAgByD,GAAeM,GAAM5D,CAAI,CAAC,GACnE8D,IAASN,EAAgB3D,EAAgB0D,GAAeK,GAAM5D,CAAI,CAAC;AACzE,QAAI6D,MAAW,UAAaC,MAAW,WACvCJ,EAAU,KAAKE,CAAI,GACnBD,EAAY,KAAKE,GAAQC,CAAM;AAAA,MACjC;AACA,YAAMC,IAAUV,EAAY,SAASK,EAAU;AAC/C,UAAIK,IAAU,GAAG;AACf,cAAMC,IAAOlB,IAAY,qDAAqD;AAC9E,gBAAQ;AAAA,UACN,mCAAmCiB,CAAO,OAAOV,EAAY,MAAM,wDAAwDW,CAAI;AAAA,QAAA;AAAA,MAEnI;AACA,MAAAZ,IAAY,aAAa,KAAKO,CAAW,GACzC1C,IAAcmC,GACdpC,IAAY0C;AAAA,IACd;AAEA,IAAArD,EAAW,kBAAkBwC,CAAS,GACtCxC,EAAW,SAAS+C,KAAa,IAAI,aAAa,CAAC,CAAC,GACpD/C,EAAW,UAAA,GAEX,KAAK,SAAS,EAAE,YAAAS,GAAY,YAAAC,GAAY,WAAAC,GAAW,aAAAC,GAAa;AAAA,EAClE;AACF;AA9UEhB,EAAc,YAAY,oBAC1BA,EAAc,eAAevB;AAJxB,IAAMuF,IAANhE;"}
1
+ {"version":3,"file":"index.js","sources":["../src/blend-parameters.ts","../src/cosmos-points-layer-uniforms.ts","../src/cosmos-points-layer.ts","../src/cosmos-links-layer-uniforms.ts","../src/cosmos-links-layer.ts","../src/cosmos-graph-layer.ts"],"sourcesContent":["/**\n * Premultiplied-style alpha blending with depth writes disabled: points and\n * links are drawn back-to-front by layer order, never by depth.\n *\n * Wire through `defaultProps.parameters`: before every draw, deck resets each\n * model's pipeline parameters from `layer.props.parameters`. Parameters given\n * only at `Model` creation last one frame.\n *\n * Declare the default with `compare: 2`, like the base layer does — a plain\n * object default would drop deep comparison, and every new-but-equal\n * `parameters` object from the caller would count as a prop change.\n */\nexport const BLEND_PARAMETERS = {\n depthWriteEnabled: false,\n depthCompare: 'always',\n blend: true,\n blendColorOperation: 'add',\n blendColorSrcFactor: 'src-alpha',\n blendColorDstFactor: 'one-minus-src-alpha',\n blendAlphaOperation: 'add',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one-minus-src-alpha',\n} as const\n","import type { ShaderModule } from '@luma.gl/shadertools'\nimport type { Texture } from '@luma.gl/core'\n\nconst uniformBlock = `\\\nlayout(std140) uniform cosmosPointsUniforms {\n float pointsTextureSize;\n highp int sizeUnits;\n} cosmosPoints;\n`\n\ntype CosmosPointsBindingProps = {\n positionsTexture: Texture;\n}\n\ntype CosmosPointsUniformProps = {\n pointsTextureSize: number;\n sizeUnits: number;\n}\n\nexport type CosmosPointsProps = CosmosPointsBindingProps & CosmosPointsUniformProps\n\nexport const cosmosPointsUniforms = {\n name: 'cosmosPoints',\n vs: uniformBlock,\n uniformTypes: {\n pointsTextureSize: 'f32',\n sizeUnits: 'i32',\n },\n} as const satisfies ShaderModule<CosmosPointsProps>\n","import { Layer, project32, picking, UNIT } from '@deck.gl/core'\nimport type { Accessor, Color, DefaultProps, LayerDataSource, LayerProps, Unit, UpdateParameters } from '@deck.gl/core'\nimport { Model, Geometry } from '@luma.gl/engine'\nimport type { PositionTextureSource } from '@cosmos.gl/graph'\n\nimport { BLEND_PARAMETERS } from './blend-parameters'\nimport { cosmosPointsUniforms } from './cosmos-points-layer-uniforms'\nimport type { CosmosPointsProps } from './cosmos-points-layer-uniforms'\n\nconst DEFAULT_POINT_COLOR: [number, number, number, number] = [74, 92, 191, 230]\n\nconst vs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-points-layer-vertex-shader\n\nin vec3 positions;\n\nin float instanceSizes;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\n\nuniform sampler2D positionsTexture;\n\nout vec4 vColor;\nout vec2 unitPosition;\nout float outerRadiusPixels;\n\n// Collapse the quad so it clips away: nothing rasterizes, nothing picks\nvoid collapse() {\n gl_Position = vec4(0.0);\n unitPosition = vec2(0.0);\n outerRadiusPixels = 0.0;\n vColor = vec4(0.0);\n}\n\nvoid main(void) {\n int pointIndex = gl_InstanceID;\n int textureSize = int(cosmosPoints.pointsTextureSize);\n // Point i lives at texel (i % size, i / size) as [x, y, i, unused] in space coordinates\n vec4 pointPosition = texelFetch(positionsTexture, ivec2(pointIndex % textureSize, pointIndex / textureSize), 0);\n\n // A removed (absent) point's texel is NaN — see PointPositionTexture\n if (isnan(pointPosition.x)) {\n collapse();\n return;\n }\n\n geometry.worldPosition = vec3(pointPosition.xy, 0.0);\n geometry.pickingColor = instancePickingColors;\n\n // instanceSizes is a diameter; the quad expands by radius\n outerRadiusPixels = project_size_to_pixel(instanceSizes * 0.5, cosmosPoints.sizeUnits);\n // A non-positive size hides the point — and the edge-padding divide below\n // is undefined at zero\n if (outerRadiusPixels <= 0.0) {\n collapse();\n return;\n }\n // Expand the quad so edge smoothing has room outside the circle\n float edgePadding = (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels;\n\n unitPosition = edgePadding * positions.xy;\n geometry.uv = unitPosition;\n\n vec3 offset = vec3(edgePadding * positions.xy * project_pixel_size(outerRadiusPixels), 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = project_position_to_clipspace(geometry.worldPosition, vec3(0.0), offset, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`\n\nconst fs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-points-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 unitPosition;\nin float outerRadiusPixels;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition) * outerRadiusPixels;\n float inCircle = smoothedge(distToCenter, outerRadiusPixels);\n if (inCircle == 0.0) {\n discard;\n }\n\n fragColor = vec4(vColor.rgb, vColor.a * inCircle);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`\n\nexport type CosmosPointsLayerProps<DataT = unknown> = CosmosPointsLayerOwnProps<DataT> & LayerProps\n\ntype CosmosPointsLayerOwnProps<DataT> = {\n /**\n * One entry per simulation point, in point-index order: an array to run\n * accessors over, or `{ length }` when accessors are constants. The length\n * must equal the simulation's point count.\n */\n data: LayerDataSource<DataT>;\n /** The simulation whose live position texture to sample. */\n graph: PositionTextureSource;\n /**\n * Point diameter accessor, in `pointSizeUnits`; `0` hides the point.\n * @default 4\n */\n getPointSize?: Accessor<DataT, number>;\n /**\n * Point RGBA color accessor, channels in 0..255.\n * @default [74, 92, 191, 230]\n */\n getPointColor?: Accessor<DataT, Color>;\n /**\n * The units of the point diameter, one of `'meters'`, `'common'`, `'pixels'`.\n * @default 'pixels'\n */\n pointSizeUnits?: Unit;\n}\n\nconst defaultProps: DefaultProps<CosmosPointsLayerProps> = {\n getPointSize: { type: 'accessor', value: 4 },\n getPointColor: { type: 'accessor', value: DEFAULT_POINT_COLOR },\n pointSizeUnits: 'pixels',\n parameters: { type: 'object', value: BLEND_PARAMETERS, optional: true, compare: 2 },\n}\n\n/**\n * Renders every cosmos.gl point as an instanced quad whose position comes from\n * a `texelFetch` on the simulation's live GPU position texture — no position\n * attribute, no CPU copy, no per-frame attribute updates. Color and size are\n * ordinary deck instanced attributes, and picking works out of the box: the\n * instance index is the point index.\n *\n * Internal: the points sublayer of `CosmosGraphLayer`, not a package export —\n * the composite keeps `data` aligned with the simulation's point index space.\n */\nexport class CosmosPointsLayer<DataT = unknown> extends Layer<Required<CosmosPointsLayerOwnProps<DataT>>> {\n public static layerName = 'CosmosPointsLayer'\n public static defaultProps = defaultProps\n\n declare public state: { model?: Model }\n\n public getShaders (): ReturnType<Layer['getShaders']> {\n return super.getShaders({ vs, fs, modules: [project32, picking, cosmosPointsUniforms] })\n }\n\n public initializeState (): void {\n this.getAttributeManager()!.addInstanced({\n instanceSizes: {\n size: 1,\n transition: true,\n accessor: 'getPointSize',\n defaultValue: 4,\n },\n instanceColors: {\n size: 4,\n transition: true,\n type: 'unorm8',\n accessor: 'getPointColor',\n defaultValue: [...DEFAULT_POINT_COLOR],\n },\n })\n }\n\n public updateState (params: UpdateParameters<this>): void {\n super.updateState(params)\n\n if (params.changeFlags.extensionsChanged) {\n this.state.model?.destroy()\n this.state.model = this._getModel()\n this.getAttributeManager()!.invalidateAll()\n }\n }\n\n public draw (): void {\n const positionInfo = this.props.graph.getPointPositionTexture()\n const { model } = this.state\n if (!positionInfo || !model || positionInfo.pointCount === 0) return\n\n const moduleProps: CosmosPointsProps = {\n pointsTextureSize: positionInfo.textureSize,\n sizeUnits: UNIT[this.props.pointSizeUnits],\n positionsTexture: positionInfo.texture,\n }\n model.shaderInputs.setProps({ cosmosPoints: moduleProps })\n model.draw(this.context.renderPass)\n }\n\n private _getModel (): Model {\n // A quad that minimally covers the unit circle\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n positions: { size: 3, value: new Float32Array([-1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0]) },\n },\n }),\n isInstanced: true,\n })\n }\n}\n","import type { ShaderModule } from '@luma.gl/shadertools'\nimport type { Texture } from '@luma.gl/core'\n\nconst uniformBlock = `\\\nlayout(std140) uniform cosmosLinksUniforms {\n float pointsTextureSize;\n highp int widthUnits;\n float pointCount;\n} cosmosLinks;\n`\n\ntype CosmosLinksBindingProps = {\n positionsTexture: Texture;\n}\n\ntype CosmosLinksUniformProps = {\n pointsTextureSize: number;\n widthUnits: number;\n pointCount: number;\n}\n\nexport type CosmosLinksProps = CosmosLinksBindingProps & CosmosLinksUniformProps\n\nexport const cosmosLinksUniforms = {\n name: 'cosmosLinks',\n vs: uniformBlock,\n uniformTypes: {\n pointsTextureSize: 'f32',\n widthUnits: 'i32',\n pointCount: 'f32',\n },\n} as const satisfies ShaderModule<CosmosLinksProps>\n","import { Layer, project32, picking, UNIT } from '@deck.gl/core'\nimport type { Accessor, Color, DefaultProps, LayerDataSource, LayerProps, Unit, UpdateParameters } from '@deck.gl/core'\nimport { Model, Geometry } from '@luma.gl/engine'\nimport type { PositionTextureSource } from '@cosmos.gl/graph'\n\nimport { BLEND_PARAMETERS } from './blend-parameters'\nimport { cosmosLinksUniforms } from './cosmos-links-layer-uniforms'\nimport type { CosmosLinksProps } from './cosmos-links-layer-uniforms'\n\nconst DEFAULT_LINK_COLOR: [number, number, number, number] = [94, 115, 194, 64]\n\nconst vs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-links-layer-vertex-shader\n\nin vec3 positions;\n\nin float instanceSourceIndices;\nin float instanceTargetIndices;\nin vec4 instanceColors;\nin float instanceWidths;\nin vec3 instancePickingColors;\n\nuniform sampler2D positionsTexture;\n\nout vec4 vColor;\nout vec2 uv;\n\n// Offset the vertex by half the link width, perpendicular to the link, in\n// screen space. offsetDirection is -1 (left) or 1 (right).\nvec2 getExtrusionOffset(vec2 lineClipspace, float offsetDirection, float width) {\n vec2 dirScreenspace = normalize(lineClipspace * project.viewportSize);\n dirScreenspace = vec2(-dirScreenspace.y, dirScreenspace.x);\n return dirScreenspace * offsetDirection * width / 2.0;\n}\n\n// The engine's isPointIndex: an integer in [0, pointCount). A fraction would\n// truncate to a neighbour, NaN would make int() undefined.\nbool namesPoint(float index, float pointCount) {\n return index >= 0.0 && index < pointCount && index == floor(index);\n}\n\nvec4 fetchPointPosition(float index, int textureSize) {\n int pointIndex = int(index);\n // Point i lives at texel (i % size, i / size) as [x, y, i, unused] in space coordinates\n return texelFetch(positionsTexture, ivec2(pointIndex % textureSize, pointIndex / textureSize), 0);\n}\n\nvoid main(void) {\n // An endpoint that names no point (an index outside the point count) is\n // skipped, never dropped, so the instance index stays the link index — the\n // rule the engine applies to the same pair in its link grouping. Its texel\n // would be outside the live data.\n float pointCount = cosmosLinks.pointCount;\n bool namesNoPoint = !namesPoint(instanceSourceIndices, pointCount) || !namesPoint(instanceTargetIndices, pointCount);\n\n int textureSize = int(cosmosLinks.pointsTextureSize);\n vec4 sourcePosition = namesNoPoint ? vec4(0.0) : fetchPointPosition(instanceSourceIndices, textureSize);\n vec4 targetPosition = namesNoPoint ? vec4(0.0) : fetchPointPosition(instanceTargetIndices, textureSize);\n\n // A removed (absent) endpoint's texel is NaN — see PointPositionTexture;\n // collapse the quad, as for an endpoint that names no point, so it clips away\n if (namesNoPoint || isnan(sourcePosition.x) || isnan(targetPosition.x)) {\n gl_Position = vec4(0.0);\n vColor = vec4(0.0);\n uv = vec2(0.0);\n return;\n }\n\n vec3 sourceWorld = vec3(sourcePosition.xy, 0.0);\n vec3 targetWorld = vec3(targetPosition.xy, 0.0);\n geometry.worldPosition = sourceWorld;\n geometry.worldPositionAlt = targetWorld;\n\n vec4 sourceCommonspace;\n vec4 targetCommonspace;\n vec4 source = project_position_to_clipspace(sourceWorld, vec3(0.0), vec3(0.0), sourceCommonspace);\n vec4 target = project_position_to_clipspace(targetWorld, vec3(0.0), vec3(0.0), targetCommonspace);\n\n // positions.x selects the endpoint, positions.y the extrusion side\n float segmentIndex = positions.x;\n vec4 p = mix(source, target, segmentIndex);\n geometry.position = mix(sourceCommonspace, targetCommonspace, segmentIndex);\n uv = positions.xy;\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n float widthPixels = project_size_to_pixel(instanceWidths, cosmosLinks.widthUnits);\n\n vec3 offset = vec3(getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels), 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(p, geometry);\n gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`\n\nconst fs = /* glsl */ `\\\n#version 300 es\n#define SHADER_NAME cosmos-links-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 uv;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = uv;\n\n fragColor = vColor;\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`\n\nexport type CosmosLinksLayerProps<DataT = unknown> = CosmosLinksLayerOwnProps<DataT> & LayerProps\n\ntype CosmosLinksLayerOwnProps<DataT> = {\n /**\n * One entry per link, in link-index order: an array to run accessors over,\n * or binary form. The cosmos links array `[src0, tgt0, src1, tgt1, …]` maps\n * without a copy as two interleaved attributes over the same buffer:\n * `{ length, attributes: { getLinkSource: { value, size: 1, stride: 8 },\n * getLinkTarget: { value, size: 1, offset: 4, stride: 8 } } }`.\n */\n data: LayerDataSource<DataT>;\n /** The simulation whose live position texture to sample. */\n graph: PositionTextureSource;\n /**\n * Source point index accessor.\n * @default l => l.source\n */\n getLinkSource?: Accessor<DataT, number>;\n /**\n * Target point index accessor.\n * @default l => l.target\n */\n getLinkTarget?: Accessor<DataT, number>;\n /**\n * Link RGBA color accessor, channels in 0..255.\n * @default [94, 115, 194, 64]\n */\n getLinkColor?: Accessor<DataT, Color>;\n /**\n * Link width accessor, in `linkWidthUnits`.\n * @default 1\n */\n getLinkWidth?: Accessor<DataT, number>;\n /**\n * The units of the link width, one of `'meters'`, `'common'`, `'pixels'`.\n * @default 'pixels'\n */\n linkWidthUnits?: Unit;\n}\n\nconst defaultProps: DefaultProps<CosmosLinksLayerProps> = {\n getLinkSource: { type: 'accessor', value: (l: unknown) => (l as { source: number }).source },\n getLinkTarget: { type: 'accessor', value: (l: unknown) => (l as { target: number }).target },\n getLinkColor: { type: 'accessor', value: DEFAULT_LINK_COLOR },\n getLinkWidth: { type: 'accessor', value: 1 },\n linkWidthUnits: 'pixels',\n parameters: { type: 'object', value: BLEND_PARAMETERS, optional: true, compare: 2 },\n}\n\n/**\n * Renders every cosmos.gl link as an instanced quad stretched between its two\n * endpoints: the vertex shader `texelFetch`es both point positions from the\n * simulation's live GPU texture and extrudes the quad by half the link width\n * in screen space — no position attribute, no CPU copy, no per-frame attribute\n * updates. Endpoint indices, color and width are ordinary deck instanced\n * attributes, and picking works out of the box: the instance index is the\n * link index.\n *\n * Internal: the links sublayer of `CosmosGraphLayer`, not a package export —\n * the composite resolves array links to point indices before they reach this\n * layer, and a pair that names no point collapses in the shader, keeping its\n * index.\n */\nexport class CosmosLinksLayer<DataT = unknown> extends Layer<Required<CosmosLinksLayerOwnProps<DataT>>> {\n public static layerName = 'CosmosLinksLayer'\n public static defaultProps = defaultProps\n\n declare public state: { model?: Model }\n\n public getShaders (): ReturnType<Layer['getShaders']> {\n return super.getShaders({ vs, fs, modules: [project32, picking, cosmosLinksUniforms] })\n }\n\n public initializeState (): void {\n this.getAttributeManager()!.addInstanced({\n instanceSourceIndices: {\n size: 1,\n accessor: 'getLinkSource',\n },\n instanceTargetIndices: {\n size: 1,\n accessor: 'getLinkTarget',\n },\n instanceColors: {\n size: 4,\n transition: true,\n type: 'unorm8',\n accessor: 'getLinkColor',\n defaultValue: [...DEFAULT_LINK_COLOR],\n },\n instanceWidths: {\n size: 1,\n transition: true,\n accessor: 'getLinkWidth',\n defaultValue: 1,\n },\n })\n }\n\n public updateState (params: UpdateParameters<this>): void {\n super.updateState(params)\n\n if (params.changeFlags.extensionsChanged) {\n this.state.model?.destroy()\n this.state.model = this._getModel()\n this.getAttributeManager()!.invalidateAll()\n }\n }\n\n public draw (): void {\n const positionInfo = this.props.graph.getPointPositionTexture()\n const { model } = this.state\n if (!positionInfo || !model || positionInfo.pointCount === 0) return\n\n const moduleProps: CosmosLinksProps = {\n pointsTextureSize: positionInfo.textureSize,\n widthUnits: UNIT[this.props.linkWidthUnits],\n pointCount: positionInfo.pointCount,\n positionsTexture: positionInfo.texture,\n }\n model.shaderInputs.setProps({ cosmosLinks: moduleProps })\n model.draw(this.context.renderPass)\n }\n\n private _getModel (): Model {\n // positions.x selects source/target, positions.y the extrusion side\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n positions: { size: 3, value: new Float32Array([0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0]) },\n },\n }),\n isInstanced: true,\n })\n }\n}\n","import { CompositeLayer } from '@deck.gl/core'\nimport type {\n Accessor,\n AccessorContext,\n BinaryAttribute,\n Color,\n DefaultProps,\n GetPickingInfoParams,\n Layer,\n LayerContext,\n LayerProps,\n PickingInfo,\n Unit,\n UpdateParameters,\n} from '@deck.gl/core'\nimport { GraphSimulation, defaultConfigValues } from '@cosmos.gl/graph'\nimport type { GraphSimulationConfig } from '@cosmos.gl/graph'\n\nimport { BLEND_PARAMETERS } from './blend-parameters'\nimport { CosmosPointsLayer } from './cosmos-points-layer'\nimport { CosmosLinksLayer } from './cosmos-links-layer'\n\n/**\n * Binary styling channels for binary points, keyed by the accessor each one\n * replaces: deck uploads the typed array as the instanced attribute instead of\n * calling the accessor per point. Colors are RGBA bytes (0..255), 4 per point;\n * sizes are one diameter per point, in `pointSizeUnits`.\n */\nexport type CosmosPointAttributes = {\n getPointColor?: BinaryAttribute;\n getPointSize?: BinaryAttribute;\n}\n\n/**\n * Points input: an array to run accessors over (picking returns the original\n * objects), or the cosmos-native binary form — a point count plus optional\n * `[x0, y0, x1, y1, …]` initial positions and binary styling channels. Points\n * without given positions are seeded randomly inside the simulation space.\n */\nexport type CosmosGraphPoints<PointDataT> = readonly PointDataT[] | {\n length: number;\n initialPositions?: Float32Array;\n attributes?: CosmosPointAttributes;\n}\n\n/**\n * Binary styling channels for binary links, keyed by the accessor each one\n * replaces. Colors are RGBA bytes (0..255), 4 per link; widths are one per\n * link, in `linkWidthUnits`.\n */\nexport type CosmosLinkAttributes = {\n getLinkColor?: BinaryAttribute;\n getLinkWidth?: BinaryAttribute;\n}\n\n/**\n * Links input: an array to run accessors over, the cosmos-native\n * `[source0, target0, source1, target1, …]` array of point indices, or that\n * array as `pairs` with binary styling channels beside it. An array link whose\n * source or target does not resolve to a point is dropped from both the\n * simulation and the rendering, with one warning per data change; a pair that\n * names no point is skipped by both and keeps its index.\n */\nexport type CosmosGraphLinks<LinkDataT> = readonly LinkDataT[] | Float32Array | {\n pairs: Float32Array;\n attributes?: CosmosLinkAttributes;\n}\n\n/** Picking info from a CosmosGraphLayer: which kind of element was hit. */\nexport type CosmosGraphPickingInfo = PickingInfo & {\n elementType?: 'point' | 'link';\n}\n\nexport type CosmosGraphLayerProps<PointDataT = unknown, LinkDataT = unknown> =\n CosmosGraphLayerOwnProps<PointDataT, LinkDataT> & LayerProps\n\ntype CosmosGraphLayerOwnProps<PointDataT, LinkDataT> = {\n /**\n * One entry per point — an array of your objects, or `{ length, initialPositions?, attributes? }`.\n * The layer loads them, with `links`, into the simulation. Omit it to draw the data the\n * simulation already holds instead: the layer then writes nothing into the simulation and\n * follows its point count and links — the mode for an application-loaded `simulation`.\n */\n points?: CosmosGraphPoints<PointDataT> | null;\n /** One entry per link — an array of your objects, or a flat point-index pair array. Ignored without `points`. */\n links?: CosmosGraphLinks<LinkDataT> | null;\n /**\n * Stable point id accessor. When provided (with array points), link\n * accessors may return ids instead of point indices.\n */\n getPointId?: Accessor<PointDataT, string | number> | null;\n /** Initial `[x, y]` position accessor for array points; points it leaves undefined are seeded randomly. */\n getPointPosition?: Accessor<PointDataT, readonly [number, number] | null | undefined> | null;\n /**\n * Point diameter accessor, in `pointSizeUnits`; `0` hides the point.\n * @default 4\n */\n getPointSize?: Accessor<PointDataT, number>;\n /**\n * Point RGBA color accessor, channels in 0..255.\n * @default [74, 92, 191, 230]\n */\n getPointColor?: Accessor<PointDataT, Color>;\n /**\n * The units of the point diameter.\n * @default 'pixels'\n */\n pointSizeUnits?: Unit;\n /**\n * Source accessor for array links: a point index, or a point id when\n * `getPointId` is set.\n * @default l => l.source\n */\n getLinkSource?: Accessor<LinkDataT, string | number>;\n /**\n * Target accessor for array links: a point index, or a point id when\n * `getPointId` is set.\n * @default l => l.target\n */\n getLinkTarget?: Accessor<LinkDataT, string | number>;\n /**\n * Link RGBA color accessor, channels in 0..255.\n * @default [94, 115, 194, 64]\n */\n getLinkColor?: Accessor<LinkDataT, Color>;\n /**\n * Link width accessor, in `linkWidthUnits`.\n * @default 1\n */\n getLinkWidth?: Accessor<LinkDataT, number>;\n /**\n * The units of the link width.\n * @default 'pixels'\n */\n linkWidthUnits?: Unit;\n /**\n * Lets pointer drags grab a point: pinned on drag start, moved with the\n * pointer, released per `unpinOnDragEnd`. View panning is suppressed while\n * a point is grabbed.\n * @default false\n */\n enablePointDrag?: boolean;\n /**\n * Simulation alpha to restart with when a drag starts, so the graph\n * responds to the moving point; `null` leaves the simulation untouched.\n * @default 0.1\n */\n dragReheatAlpha?: number | null;\n /**\n * Release the point on drag end; `false` keeps it pinned where dropped.\n * @default true\n */\n unpinOnDragEnd?: boolean;\n /** Called when a point drag starts. */\n onPointDragStart?: ((info: CosmosGraphPickingInfo) => void) | null;\n /** Called for every pointer move while a point is dragged. */\n onPointDrag?: ((info: CosmosGraphPickingInfo) => void) | null;\n /** Called when a point drag ends. */\n onPointDragEnd?: ((info: CosmosGraphPickingInfo) => void) | null;\n /**\n * An application-owned `GraphSimulation` to render instead of creating one.\n * It must run on deck's device — construct it with the device from deck's\n * `onDeviceInitialized`. The layer steps it while it runs (`pause()` it to\n * take over stepping, then `deck.redraw()` after each manual `step()`) and\n * renders it; it never configures or destroys it — `simulationConfig` and\n * `onSimulationCreated` apply only to a layer-created simulation, and\n * teardown is the application's, before `deck.finalize()`.\n *\n * `points` decides who loads the data. Given, the layer loads `points` and\n * `links` into the simulation once the device check has passed, over whatever\n * it held. Omitted, the layer draws the simulation's own data and follows its\n * changes. Several layers may draw one simulation — it steps once per frame\n * however many draw it — as long as at most one of them loads data.\n */\n simulation?: GraphSimulation | null;\n /**\n * Simulation configuration, passed through to the layer-created\n * `GraphSimulation` (forces, spaceSize, callbacks). Ignored when\n * `simulation` is provided.\n */\n simulationConfig?: GraphSimulationConfig;\n /**\n * Called once with the layer-created `GraphSimulation` — the escape hatch for\n * advanced control (pause, pinning, sparse position writes). Not called for\n * a provided `simulation`.\n */\n onSimulationCreated?: ((simulation: GraphSimulation) => void) | null;\n}\n\nconst defaultProps: DefaultProps<CosmosGraphLayerProps> = {\n points: { type: 'object', value: null, optional: true },\n links: null,\n getPointId: { type: 'accessor', value: null },\n getPointPosition: { type: 'accessor', value: null },\n getPointSize: { type: 'accessor', value: 4 },\n getPointColor: { type: 'accessor', value: [74, 92, 191, 230] },\n pointSizeUnits: 'pixels',\n getLinkSource: { type: 'accessor', value: (l: unknown) => (l as { source: number }).source },\n getLinkTarget: { type: 'accessor', value: (l: unknown) => (l as { target: number }).target },\n getLinkColor: { type: 'accessor', value: [94, 115, 194, 64] },\n getLinkWidth: { type: 'accessor', value: 1 },\n linkWidthUnits: 'pixels',\n enablePointDrag: false,\n dragReheatAlpha: 0.1,\n unpinOnDragEnd: true,\n onPointDragStart: { type: 'function', value: null, optional: true },\n onPointDrag: { type: 'function', value: null, optional: true },\n onPointDragEnd: { type: 'function', value: null, optional: true },\n simulation: { type: 'object', value: null, optional: true },\n simulationConfig: { type: 'object', value: {}, compare: 2 },\n onSimulationCreated: { type: 'function', value: null, optional: true },\n // getSubLayerProps forwards `parameters` into every sublayer, so the\n // composite must carry the same pipeline-state default the primitives do\n parameters: { type: 'object', value: BLEND_PARAMETERS, optional: true, compare: 2 },\n}\n\n/** The slice of a deck gesture event the drag handlers need. */\ntype DragGestureEvent = {\n stopImmediatePropagation?: () => void;\n}\n\n/** The update-trigger keys the composite forwards to its sublayers. */\ntype CosmosUpdateTriggers = {\n getPointId?: unknown;\n getPointPosition?: unknown;\n getPointSize?: unknown;\n getPointColor?: unknown;\n getLinkSource?: unknown;\n getLinkTarget?: unknown;\n getLinkColor?: unknown;\n getLinkWidth?: unknown;\n}\n\n/** Resolves a deck accessor (function or constant) for one object. */\nconst resolveAccessor = <In, Out>(accessor: Accessor<In, Out>, object: In, info: AccessorContext<In>): Out =>\n typeof accessor === 'function' ? (accessor as (o: In, i: AccessorContext<In>) => Out)(object, info) : accessor\n\n/**\n * When each simulation last stepped, by timeline time: layers drawing the same\n * simulation share one step per frame instead of each taking their own.\n */\nconst steppedAt = new WeakMap<GraphSimulation, number>()\n\n/** The endpoint channels of the links sublayer, read straight from the cosmos pair array. */\ntype LinkEndpointAttributes = {\n getLinkSource: BinaryAttribute;\n getLinkTarget: BinaryAttribute;\n}\n\ntype BinaryLinksData = { length: number; attributes: LinkEndpointAttributes & CosmosLinkAttributes }\n\n/**\n * The cosmos pair array as deck binary link data: two interleaved endpoint\n * attributes, no copy, plus the caller's styling channels — copied by name,\n * never spread, so nothing can replace the endpoints.\n */\nconst binaryLinksData = (pairs: Float32Array, attributes?: CosmosLinkAttributes): BinaryLinksData => ({\n length: pairs.length / 2,\n attributes: {\n getLinkSource: { value: pairs, size: 1, stride: 8 },\n getLinkTarget: { value: pairs, size: 1, offset: 4, stride: 8 },\n ...(attributes?.getLinkColor && { getLinkColor: attributes.getLinkColor }),\n ...(attributes?.getLinkWidth && { getLinkWidth: attributes.getLinkWidth }),\n },\n})\n\n/** What the layer loaded when binary points carried no `initialPositions`: a seed of its own. */\nconst SEEDED = Symbol('seeded')\nconst NO_LINKS = new Float32Array(0)\n\n/**\n * The cosmos.gl graph layer: give it points and links, and it handles the\n * rest. The layer creates a `GraphSimulation` on deck's device (or renders the\n * application's, via `simulation`), loads the data — or, without `points`,\n * follows the data the simulation holds — advances the simulation once per\n * animation frame from deck's shared timeline while it runs (deck goes idle\n * when it settles — no `_animate` required), renders through its internal\n * links and points sublayers (positions stay GPU-resident), and destroys a\n * simulation it created when the layer is removed. Picking reports\n * `elementType: 'point' | 'link'` alongside the index and, for array data, the\n * original object.\n */\nexport class CosmosGraphLayer<PointDataT = unknown, LinkDataT = unknown> extends CompositeLayer<\n Required<CosmosGraphLayerOwnProps<PointDataT, LinkDataT>>\n> {\n public static layerName = 'CosmosGraphLayer'\n public static defaultProps = defaultProps\n\n declare public state: {\n simulation?: GraphSimulation;\n /** The `simulation` prop this state was built from; `null` when the layer created its own. */\n providedSimulation: GraphSimulation | null;\n isReady: boolean;\n /** `points` changed before the simulation was ready: load them once it is. */\n isIngestPending: boolean;\n pointCount: number;\n pointsData: readonly PointDataT[] | { length: number; attributes?: CosmosPointAttributes };\n linksData: readonly LinkDataT[] | BinaryLinksData | null;\n /** Array links only: the resolved `[source, target]` point-index pairs, one per entry of `linksData`. */\n linkIndices: Float32Array | null;\n /**\n * Load mode: what the simulation holds, so a channel reloads only when its own\n * input changes and a restyle leaves the layout alone. `loadedPositions` is the\n * `initialPositions` array, `SEEDED`, or the points array; `loadedPairs` the pair\n * array sent last; `idToIndex` the id map of the loaded points.\n */\n hasLoaded: boolean;\n loadedPositions?: unknown;\n loadedPairs?: Float32Array | null;\n idToIndex?: Map<string | number, number> | null;\n /** Without `points`: the simulation's links array the render data was built from. */\n followedLinks?: Float32Array | null;\n draggedPointIndex: number | null;\n animationHandle?: number;\n }\n\n public get isLoaded (): boolean {\n return super.isLoaded && Boolean(this.state?.isReady)\n }\n\n public initializeState (): void {\n const { device, timeline } = this.context\n if (device.type !== 'webgl') {\n throw new Error(\n `@cosmos.gl/deck-layers requires a WebGL 2 device — the cosmos.gl simulation is WebGL-only, got '${device.type}'`\n )\n }\n\n this.state = {\n providedSimulation: null,\n isReady: false,\n isIngestPending: false,\n hasLoaded: false,\n pointCount: 0,\n pointsData: { length: 0 },\n linksData: null,\n linkIndices: null,\n draggedPointIndex: null,\n // Step the simulation exactly once per animation frame, independent of\n // draw passes (draw runs per viewport and again while picking)\n animationHandle: timeline.attachAnimation({ setTime: (time) => this._onTimelineTick(time) }),\n }\n this._attachSimulation(this.props.simulation ?? null)\n }\n\n public updateState (params: UpdateParameters<this>): void {\n super.updateState(params)\n const { props, oldProps, changeFlags } = params\n // Swapping simulations loads the current data into the new one, or follows it\n const providedSimulation = props.simulation ?? null\n const simulationSwapped = providedSimulation !== this.state.providedSimulation\n if (simulationSwapped) {\n this._releaseSimulation()\n this._attachSimulation(providedSimulation)\n }\n const simulation = this.state.simulation\n if (!simulation) return\n\n if (!providedSimulation && changeFlags.propsChanged && props.simulationConfig !== oldProps.simulationConfig) {\n simulation.setConfig(props.simulationConfig)\n }\n // Array links resolve against the id map and the position accessor at load,\n // so a change to either counts as a change of that channel\n const triggers = typeof changeFlags.updateTriggersChanged === 'object'\n ? changeFlags.updateTriggersChanged as CosmosUpdateTriggers\n : undefined\n const pointsChanged = simulationSwapped || props.points !== oldProps.points || Boolean(triggers?.getPointPosition)\n const idsChanged = Boolean(triggers?.getPointId)\n const linksChanged = simulationSwapped || props.links !== oldProps.links ||\n Boolean(triggers?.getLinkSource || triggers?.getLinkTarget) || idsChanged\n if (!pointsChanged && !linksChanged) return\n\n if (props.points) {\n // The layer's data goes into the simulation — once the device check has passed\n if (this.state.isReady) this._updateSimulationData(pointsChanged, linksChanged, idsChanged)\n else this.state.isIngestPending = true\n } else {\n // No data of its own: the layer draws what the simulation holds\n if (props.links) {\n console.warn('@cosmos.gl/deck-layers: `links` is ignored without `points` — load them into the simulation instead')\n }\n this.state.isIngestPending = false\n this.state.hasLoaded = false\n if (this.state.isReady) this._syncFromSimulation(true)\n }\n }\n\n public renderLayers (): Layer[] | null {\n const { simulation, isReady, pointCount, pointsData, linksData, linkIndices } = this.state\n if (!simulation || !isReady || pointCount === 0) return null\n\n const { getPointSize, getPointColor, pointSizeUnits, getLinkColor, getLinkWidth, linkWidthUnits } = this.props\n const triggers: CosmosUpdateTriggers = this.props.updateTriggers ?? {}\n const layers: Layer[] = []\n\n if (linksData) {\n layers.push(\n new CosmosLinksLayer<LinkDataT>(\n this.getSubLayerProps({\n id: 'links',\n updateTriggers: {\n getLinkSource: triggers.getLinkSource,\n getLinkTarget: triggers.getLinkTarget,\n getLinkColor: triggers.getLinkColor,\n getLinkWidth: triggers.getLinkWidth,\n },\n }),\n {\n data: linksData as CosmosLinksLayer<LinkDataT>['props']['data'],\n graph: simulation,\n getLinkColor,\n getLinkWidth,\n linkWidthUnits,\n // getSubLayerProps does not forward `transitions`\n transitions: this.props.transitions,\n },\n Array.isArray(linksData) && linkIndices\n ? {\n // Array links read the endpoints resolved at ingest, so the\n // rendered links are exactly the simulated ones\n getLinkSource: (_: LinkDataT, { index }: AccessorContext<LinkDataT>): number => linkIndices[index * 2] as number,\n getLinkTarget: (_: LinkDataT, { index }: AccessorContext<LinkDataT>): number => linkIndices[index * 2 + 1] as number,\n }\n : {}\n )\n )\n }\n\n layers.push(\n new CosmosPointsLayer<PointDataT>(\n this.getSubLayerProps({\n id: 'points',\n updateTriggers: {\n getPointSize: triggers.getPointSize,\n getPointColor: triggers.getPointColor,\n },\n }),\n {\n data: pointsData as CosmosPointsLayer<PointDataT>['props']['data'],\n graph: simulation,\n getPointSize,\n getPointColor,\n pointSizeUnits,\n // getSubLayerProps does not forward `transitions`\n transitions: this.props.transitions,\n }\n )\n )\n\n return layers\n }\n\n public onDragStart (info: PickingInfo, event: DragGestureEvent): boolean {\n const { simulation } = this.state\n const { enablePointDrag, dragReheatAlpha } = this.props\n const picked = info as CosmosGraphPickingInfo\n if (!enablePointDrag || !simulation || picked.elementType !== 'point' || info.index < 0) return false\n\n // A direct field write: per-gesture state must not re-render sublayers\n this.state.draggedPointIndex = info.index\n simulation.setPinnedPoint(info.index, true)\n if (dragReheatAlpha !== null) simulation.start(dragReheatAlpha)\n // A grabbed point must not also pan the view\n event.stopImmediatePropagation?.()\n this.props.onPointDragStart?.(picked)\n return true\n }\n\n public onDrag (info: PickingInfo, event: DragGestureEvent): boolean {\n const { simulation, draggedPointIndex } = this.state\n if (!simulation || draggedPointIndex === null) return false\n\n const [x, y] = this._dragCoordinate(info)\n simulation.setPointPosition(draggedPointIndex, x, y)\n event.stopImmediatePropagation?.()\n // Repaint even when the simulation is settled and the ticker is idle\n ;(this.getCurrentLayer() ?? this).setNeedsRedraw()\n this.props.onPointDrag?.(info as CosmosGraphPickingInfo)\n return true\n }\n\n public onDragEnd (info: PickingInfo, event: DragGestureEvent): boolean {\n const { simulation, draggedPointIndex } = this.state\n if (!simulation || draggedPointIndex === null) return false\n\n if (this.props.unpinOnDragEnd) simulation.setPinnedPoint(draggedPointIndex, false)\n this.state.draggedPointIndex = null\n event.stopImmediatePropagation?.()\n this.props.onPointDragEnd?.(info as CosmosGraphPickingInfo)\n return true\n }\n\n public getPickingInfo (params: GetPickingInfoParams): CosmosGraphPickingInfo {\n const info: CosmosGraphPickingInfo = params.info\n if (params.sourceLayer) {\n info.elementType = params.sourceLayer.id.endsWith('-links') ? 'link' : 'point'\n }\n return info\n }\n\n /** The whole simulation space; lets deck's viewport helpers frame the graph. */\n public getBounds (): [number[], number[]] | null {\n const spaceSize = this._spaceSize()\n return [[0, 0, 0], [spaceSize, spaceSize, 0]]\n }\n\n public finalizeState (context: LayerContext): void {\n if (this.state?.animationHandle !== undefined) {\n this.context.timeline.detachAnimation(this.state.animationHandle)\n }\n if (this.state) this._releaseSimulation()\n super.finalizeState(context)\n }\n\n /**\n * Points and links have separate index spaces, so the same picking color\n * exists in both sublayers: highlight only the sublayer that was hovered\n * and clear the other, or hovering point N would also tint link N.\n */\n protected _updateAutoHighlight (info: PickingInfo): void {\n for (const layer of this.getSubLayers()) {\n if (layer.id === info.sourceLayer?.id) {\n layer.updateAutoHighlight(info)\n } else {\n layer.updateAutoHighlight({ ...info, picked: false })\n }\n }\n }\n\n /** Adopts the provided simulation, or creates one on deck's device when `provided` is `null`. */\n private _attachSimulation (provided: GraphSimulation | null): void {\n const { device } = this.context\n const simulation = provided ?? new GraphSimulation(this.props.simulationConfig, Promise.resolve(device))\n this.setState({\n simulation,\n providedSimulation: provided,\n isReady: false,\n hasLoaded: false,\n loadedPositions: undefined,\n loadedPairs: null,\n idToIndex: null,\n draggedPointIndex: null,\n })\n\n if (!provided) this.props.onSimulationCreated?.(simulation)\n\n simulation.ready.then(() => {\n // `this` may be a stale descriptor by now; state is the stable identity\n if (this.state?.simulation !== simulation) return\n const layer = (this.getCurrentLayer() ?? this) as CosmosGraphLayer<PointDataT, LinkDataT>\n // Textures from another device cannot be sampled by deck's draws\n if (simulation.device !== layer.context.device) {\n console.error(\n '@cosmos.gl/deck-layers: the provided simulation runs on a different device than deck — construct it with the device from deck\\'s onDeviceInitialized'\n )\n return\n }\n // Only now may the layer touch the simulation's data\n if (layer.state.isIngestPending) {\n layer.state.isIngestPending = false\n layer._updateSimulationData(true, true, true)\n } else if (!layer.props.points) {\n layer._syncFromSimulation(true)\n }\n layer.setState({ isReady: true })\n }).catch((error: Error) => {\n console.error('@cosmos.gl/deck-layers: simulation failed to initialize', error)\n })\n }\n\n /** Destroys a layer-created simulation; a provided one is left to the application. */\n private _releaseSimulation (): void {\n const { simulation, providedSimulation } = this.state\n if (simulation && !providedSimulation) simulation.destroy()\n this.state.simulation = undefined\n }\n\n /** The simulation's space size — authoritative for a provided simulation too. */\n private _spaceSize (): number {\n return this.state?.simulation?.config.spaceSize ??\n this.props.simulationConfig?.spaceSize ??\n defaultConfigValues.spaceSize\n }\n\n private _onTimelineTick (time: number): void {\n const { simulation, isReady } = this.state ?? {}\n if (!simulation || !isReady) return\n const layer = (this.getCurrentLayer() ?? this) as CosmosGraphLayer<PointDataT, LinkDataT>\n // Without data of its own, the layer follows what the application loads\n if (!layer.props.points) layer._syncFromSimulation()\n if (!simulation.isSimulationRunning) return\n // One step per frame per simulation, however many layers draw it\n if (steppedAt.get(simulation) !== time) {\n steppedAt.set(simulation, time)\n simulation.step()\n }\n // Repaint the frame this step just computed; when the simulation settles,\n // the flag stops being set and deck goes idle on its own\n layer.setNeedsRedraw()\n }\n\n /**\n * Without `points`: builds the render data from what the simulation holds —\n * its point count and links — and rebuilds it when either changes. Runs every\n * tick, so it only compares until something differs.\n */\n private _syncFromSimulation (force = false): void {\n const { simulation } = this.state\n if (!simulation) return\n const pointCount = simulation.data.pointsNumber ?? 0\n const links = simulation.data.links ?? null\n if (!force && pointCount === this.state.pointCount && links === this.state.followedLinks) return\n this.setState({\n pointCount,\n pointsData: { length: pointCount },\n linksData: links && links.length > 0 ? binaryLinksData(links) : null,\n linkIndices: null,\n followedLinks: links,\n })\n }\n\n private _dragCoordinate (info: PickingInfo): [number, number] {\n // info.coordinate is unprojected at the current pointer; it can be absent\n // when the pointer leaves the picked object's viewport\n if (info.coordinate) return [info.coordinate[0] as number, info.coordinate[1] as number]\n const unprojected = this.context.viewport.unproject([info.x, info.y])\n return [unprojected[0] as number, unprojected[1] as number]\n }\n\n /**\n * Load mode: puts the layer's `points` and `links` into the simulation and\n * builds the render data from them. Each channel is sent only when its own\n * input changed — a new `points` or `links` object with the same positions\n * or pairs restyles in place and leaves the layout alone. A changed id map\n * re-resolves array links without touching the positions.\n */\n private _updateSimulationData (pointsChanged: boolean, linksChanged: boolean, idsChanged: boolean): void {\n const simulation = this.state.simulation\n if (!simulation) return\n const { points, links, getPointId, getPointPosition } = this.props\n if (!points) return\n const firstLoad = !this.state.hasLoaded\n const spaceSize = this._spaceSize()\n\n // Unseeded points land in the middle half of the space, clear of the walls\n const randomCoordinate = (): number => spaceSize * (0.25 + Math.random() * 0.5)\n\n let pointCount: number\n let pointsData: this['state']['pointsData']\n let positions: Float32Array | null = null // to load; null leaves the simulation's\n let loadedPositions = this.state.loadedPositions\n let idToIndex = this.state.idToIndex ?? null\n\n if (Array.isArray(points)) {\n const pointArray = points as readonly PointDataT[]\n pointCount = pointArray.length\n pointsData = pointArray\n // Object points carry positions and ids together: a change reloads both\n if (firstLoad || pointsChanged) {\n positions = new Float32Array(pointCount * 2)\n idToIndex = getPointId ? new Map() : null\n for (let i = 0; i < pointCount; i += 1) {\n const point = pointArray[i] as PointDataT\n const info: AccessorContext<PointDataT> = { index: i, data: pointArray, target: [] }\n const position = getPointPosition ? resolveAccessor(getPointPosition, point, info) : null\n positions[i * 2] = position ? position[0] : randomCoordinate()\n positions[i * 2 + 1] = position ? position[1] : randomCoordinate()\n if (idToIndex && getPointId) idToIndex.set(resolveAccessor(getPointId, point, info), i)\n }\n loadedPositions = pointArray\n } else if (idsChanged) {\n idToIndex = getPointId ? new Map() : null\n if (idToIndex && getPointId) {\n for (let i = 0; i < pointCount; i += 1) {\n const info: AccessorContext<PointDataT> = { index: i, data: pointArray, target: [] }\n idToIndex.set(resolveAccessor(getPointId, pointArray[i] as PointDataT, info), i)\n }\n }\n }\n } else {\n const binaryPoints = points as { length: number; initialPositions?: Float32Array; attributes?: CosmosPointAttributes }\n pointCount = binaryPoints.length\n pointsData = binaryPoints.attributes\n ? { length: pointCount, attributes: binaryPoints.attributes }\n : { length: pointCount }\n idToIndex = null\n // Positions reload when their input changed: another `initialPositions`\n // array, a seed the layer must draw again for a new count, or a first load\n const positionsInput: unknown = binaryPoints.initialPositions ?? SEEDED\n if (firstLoad || positionsInput !== this.state.loadedPositions || pointCount !== this.state.pointCount) {\n if (binaryPoints.initialPositions) {\n positions = binaryPoints.initialPositions\n } else {\n positions = new Float32Array(pointCount * 2)\n for (let i = 0; i < positions.length; i += 1) positions[i] = randomCoordinate()\n }\n loadedPositions = positionsInput\n }\n }\n\n let pairs: Float32Array | null = null // to load; null leaves the simulation's\n let linksData: this['state']['linksData'] = this.state.linksData\n let linkIndices: Float32Array | null = this.state.linkIndices\n if (links instanceof Float32Array || (links && !Array.isArray(links) && 'pairs' in links)) {\n const pairArray = links instanceof Float32Array ? links : links.pairs\n linksData = binaryLinksData(pairArray, links instanceof Float32Array ? undefined : links.attributes)\n linkIndices = null\n if (firstLoad || pairArray !== this.state.loadedPairs) pairs = pairArray\n } else if (Array.isArray(links)) {\n // Array links resolve against the loaded points, so they reload with them\n if (firstLoad || linksChanged || positions) {\n const linkObjects = links as readonly LinkDataT[]\n const { getLinkSource, getLinkTarget } = this.props\n // An endpoint is a point index, or a point id when the id map exists;\n // anything that does not name a point drops the whole link from both\n // the simulation and the rendering, so the two never disagree\n const resolveEndpoint = (endpoint: string | number): number | undefined => {\n const index = idToIndex ? idToIndex.get(endpoint) : endpoint\n return typeof index === 'number' && Number.isInteger(index) && index >= 0 && index < pointCount\n ? index\n : undefined\n }\n const keptLinks: LinkDataT[] = []\n const keptIndices: number[] = []\n for (let i = 0; i < linkObjects.length; i += 1) {\n const link = linkObjects[i] as LinkDataT\n const info: AccessorContext<LinkDataT> = { index: i, data: linkObjects, target: [] }\n const source = resolveEndpoint(resolveAccessor(getLinkSource, link, info))\n const target = resolveEndpoint(resolveAccessor(getLinkTarget, link, info))\n if (source === undefined || target === undefined) continue\n keptLinks.push(link)\n keptIndices.push(source, target)\n }\n const dropped = linkObjects.length - keptLinks.length\n if (dropped > 0) {\n const hint = idToIndex ? 'getLinkSource / getLinkTarget against getPointId' : 'getLinkSource / getLinkTarget'\n console.warn(\n `@cosmos.gl/deck-layers: dropped ${dropped} of ${linkObjects.length} links whose source or target is not a point — check ${hint}`\n )\n }\n pairs = Float32Array.from(keptIndices)\n linkIndices = pairs\n linksData = keptLinks\n }\n } else {\n linksData = null\n linkIndices = null\n if (firstLoad || this.state.loadedPairs !== NO_LINKS) pairs = NO_LINKS\n }\n\n if (positions) simulation.setPointPositions(positions)\n if (pairs) simulation.setLinks(pairs)\n if (positions || pairs) simulation.applyData()\n\n this.setState({\n hasLoaded: true,\n pointCount,\n pointsData,\n linksData,\n linkIndices,\n followedLinks: undefined,\n loadedPositions,\n loadedPairs: pairs ?? this.state.loadedPairs,\n idToIndex,\n })\n }\n}\n"],"names":["BLEND_PARAMETERS","uniformBlock","cosmosPointsUniforms","DEFAULT_POINT_COLOR","vs","fs","defaultProps","_CosmosPointsLayer","Layer","project32","picking","params","_a","positionInfo","model","moduleProps","UNIT","Model","Geometry","CosmosPointsLayer","cosmosLinksUniforms","DEFAULT_LINK_COLOR","l","_CosmosLinksLayer","CosmosLinksLayer","resolveAccessor","accessor","object","info","steppedAt","binaryLinksData","pairs","attributes","SEEDED","NO_LINKS","_CosmosGraphLayer","CompositeLayer","device","timeline","time","props","oldProps","changeFlags","providedSimulation","simulationSwapped","simulation","triggers","pointsChanged","idsChanged","linksChanged","isReady","pointCount","pointsData","linksData","linkIndices","getPointSize","getPointColor","pointSizeUnits","getLinkColor","getLinkWidth","linkWidthUnits","layers","_","index","event","enablePointDrag","dragReheatAlpha","picked","_c","_b","draggedPointIndex","x","y","spaceSize","context","layer","provided","GraphSimulation","error","defaultConfigValues","force","links","unprojected","points","getPointId","getPointPosition","firstLoad","randomCoordinate","positions","loadedPositions","idToIndex","pointArray","i","point","position","binaryPoints","positionsInput","pairArray","linkObjects","getLinkSource","getLinkTarget","resolveEndpoint","endpoint","keptLinks","keptIndices","link","source","target","dropped","hint","CosmosGraphLayer"],"mappings":";;;AAYO,MAAMA,IAAmB;AAAA,EAC9B,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,OAAO;AAAA,EACP,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AACvB,GCnBMC,KAAe;AAAA;AAAA;AAAA;AAAA,GAkBRC,KAAuB;AAAA,EAClC,MAAM;AAAA,EACN,IAAID;AAAAA,EACJ,cAAc;AAAA,IACZ,mBAAmB;AAAA,IACnB,WAAW;AAAA,EAAA;AAEf,GCnBME,IAAwD,CAAC,IAAI,IAAI,KAAK,GAAG,GAEzEC;AAAAA;AAAAA,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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
4
4
  "description": "deck.gl layers rendering the cosmos.gl GPU force simulation — zero-copy position sampling on a shared luma.gl device",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "@luma.gl/core": "~9.3.0",
35
35
  "@luma.gl/engine": "~9.3.0",
36
36
  "@luma.gl/shadertools": "~9.3.0",
37
- "@cosmos.gl/graph": "^3.5.0-beta.2"
37
+ "@cosmos.gl/graph": "^3.5.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@deck.gl/core": "~9.3.0",
@@ -46,7 +46,7 @@
46
46
  "typescript": "^5.9.3",
47
47
  "vite": "^6.4.3",
48
48
  "vite-plugin-dts": "^4.3.0",
49
- "@cosmos.gl/graph": "^3.5.0-beta.2"
49
+ "@cosmos.gl/graph": "^3.5.0"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "vite build",
package/dist/types.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { PointPositionTexture } from '@cosmos.gl/graph';
2
- /**
3
- * Anything that exposes a live cosmos.gl position texture — a
4
- * `GraphSimulation`, a headless `Graph`, or a future engine with the same
5
- * contract. The layers are typed against this shape, never a concrete class.
6
- */
7
- export type PositionTextureSource = {
8
- getPointPositionTexture(): PointPositionTexture | undefined;
9
- };