feat: Phase 1 — extract the client (web SPA + desktop) to dtoro/oikos-web
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled

Problem: the hexagonal refactor churns the backend tree for nine more
phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper,
compose/web image) must move to its own repo first so doc/layout
rewrites land once on a backend-only tree.

Change:
- New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/
  (updateURL repointed to oikos-web releases), compose/, own CI (web +
  desktop jobs), own deploy script (CI-green gate, TOCTOU guard,
  version-tagged images, prune-to-3), own webhook receiver on :9798 +
  launchd unit, own compose project publishing the same 8091:80.
- Cutover executed on mac-mini in order: oikos stack's web service
  stopped+removed, oikos-web project brought up on 8091; outer Caddy
  untouched (targets the published port) — serving + Authentik flow +
  /wails 404 quirk verified post-cutover.
- Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI
  workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install
  targets, the compose web service, oikos-web from deploy.sh's fallback
  prune list; wails + go-keyring dropped from go.mod, vendor synced.
- README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now
  point at the new repo; mbse + mascot design docs carry a path note.

Risk: production SPA serving depends on the new pipeline now; rollback
is versioned-image re-up of the old web service from a pre-split
checkout (port 8091). Desktop builds installed before the split still
check dtoro/oikos releases — one manual reinstall, noted in the
oikos-web release notes.

Verification: go vet, make test (race), make generate-check, golangci
(no new findings; baseline down 400→365); post-cutover curls —
localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
This commit is contained in:
2026-08-15 22:27:52 +02:00
parent e074f04bdf
commit d4d99a7473
18854 changed files with 2615729 additions and 173735 deletions

View File

@@ -0,0 +1,43 @@
import { CameraState, TypedEventEmitter } from "../types.js";
import { AnimateOptions } from "../utils/index.js";
export type CameraEvents = {
updated(state: CameraState): void;
};
export default class Camera extends TypedEventEmitter<CameraEvents> implements CameraState {
x: number;
y: number;
angle: number;
ratio: number;
minRatio: number | null;
maxRatio: number | null;
enabledZooming: boolean;
enabledPanning: boolean;
enabledRotation: boolean;
clean: ((state: CameraState) => CameraState) | null;
private nextFrame;
private previousState;
private enabled;
animationCallback?: () => void;
constructor();
static from(state: CameraState): Camera;
enable(): this;
disable(): this;
getState(): CameraState;
hasState(state: CameraState): boolean;
getPreviousState(): CameraState | null;
getBoundedRatio(ratio: number): number;
validateState(state: Partial<CameraState>): Partial<CameraState>;
isAnimated(): boolean;
setState(state: Partial<CameraState>): this;
updateState(updater: (state: CameraState) => Partial<CameraState>): this;
animate(state: Partial<CameraState>, opts: Partial<AnimateOptions>, callback: () => void): void;
animate(state: Partial<CameraState>, opts?: Partial<AnimateOptions>): Promise<void>;
animatedZoom(factorOrOptions?: number | (Partial<AnimateOptions> & {
factor?: number;
})): Promise<void>;
animatedUnzoom(factorOrOptions?: number | (Partial<AnimateOptions> & {
factor?: number;
})): Promise<void>;
animatedReset(options?: Partial<AnimateOptions>): Promise<void>;
copy(): Camera;
}

View File

@@ -0,0 +1,16 @@
import { Attributes } from "graphology-types";
import Sigma from "../../sigma.js";
import { Coordinates, EventsMapping, MouseCoords, TouchCoords, TypedEventEmitter, WheelCoords } from "../../types.js";
export declare function getPosition(e: MouseEvent | Touch, dom: HTMLElement): Coordinates;
export declare function getMouseCoords(e: MouseEvent, dom: HTMLElement): MouseCoords;
export declare function cleanMouseCoords(e: MouseCoords | TouchCoords): MouseCoords;
export declare function getWheelCoords(e: WheelEvent, dom: HTMLElement): WheelCoords;
export declare function getTouchesArray(touches: TouchList): Touch[];
export declare function getTouchCoords(e: TouchEvent, previousTouches: Touch[], dom: HTMLElement): TouchCoords;
export declare function getWheelDelta(e: WheelEvent): number;
export default abstract class Captor<Events extends EventsMapping, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends TypedEventEmitter<Events> {
container: HTMLElement;
renderer: Sigma<N, E, G>;
constructor(container: HTMLElement, renderer: Sigma<N, E, G>);
abstract kill(): void;
}

View File

@@ -0,0 +1,49 @@
import { Attributes } from "graphology-types";
import { Settings } from "../../settings.js";
import Sigma from "../../sigma.js";
import { CameraState, MouseCoords, WheelCoords } from "../../types.js";
import Captor from "./captor.js";
export declare const MOUSE_SETTINGS_KEYS: readonly ["doubleClickTimeout", "doubleClickZoomingDuration", "doubleClickZoomingRatio", "dragTimeout", "draggedEventsTolerance", "inertiaDuration", "inertiaRatio", "zoomDuration", "zoomingRatio"];
export type MouseSettingKey = (typeof MOUSE_SETTINGS_KEYS)[number];
export type MouseSettings = Pick<Settings, MouseSettingKey>;
export declare const DEFAULT_MOUSE_SETTINGS: MouseSettings;
export type MouseCaptorEvents = {
click(coordinates: MouseCoords): void;
rightClick(coordinates: MouseCoords): void;
doubleClick(coordinates: MouseCoords): void;
mouseup(coordinates: MouseCoords): void;
mousedown(coordinates: MouseCoords): void;
mousemove(coordinates: MouseCoords): void;
mousemovebody(coordinates: MouseCoords): void;
mouseleave(coordinates: MouseCoords): void;
mouseenter(coordinates: MouseCoords): void;
wheel(coordinates: WheelCoords): void;
};
export default class MouseCaptor<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Captor<MouseCaptorEvents, N, E, G> {
enabled: boolean;
draggedEvents: number;
downStartTime: number | null;
lastMouseX: number | null;
lastMouseY: number | null;
isMouseDown: boolean;
isMoving: boolean;
movingTimeout: number | null;
startCameraState: CameraState | null;
clicks: number;
doubleClickTimeout: number | null;
currentWheelDirection: -1 | 0 | 1;
lastWheelTriggerTime?: number;
settings: MouseSettings;
constructor(container: HTMLElement, renderer: Sigma<N, E, G>);
kill(): void;
handleClick(e: MouseEvent): void;
handleRightClick(e: MouseEvent): void;
handleDoubleClick(e: MouseEvent): void;
handleDown(e: MouseEvent): void;
handleUp(e: MouseEvent): void;
handleMove(e: MouseEvent): void;
handleLeave(e: MouseEvent): void;
handleEnter(e: MouseEvent): void;
handleWheel(e: WheelEvent): void;
setSettings(settings: MouseSettings): void;
}

View File

@@ -0,0 +1,36 @@
import { Attributes } from "graphology-types";
import { Settings } from "../../settings.js";
import Sigma from "../../sigma.js";
import { CameraState, Coordinates, Dimensions, TouchCoords } from "../../types.js";
import Captor from "./captor.js";
export declare const TOUCH_SETTINGS_KEYS: readonly ["dragTimeout", "inertiaDuration", "inertiaRatio", "doubleClickTimeout", "doubleClickZoomingRatio", "doubleClickZoomingDuration", "tapMoveTolerance"];
export type TouchSettingKey = (typeof TOUCH_SETTINGS_KEYS)[number];
export type TouchSettings = Pick<Settings, TouchSettingKey>;
export declare const DEFAULT_TOUCH_SETTINGS: TouchSettings;
export type TouchCaptorEventType = "touchdown" | "touchup" | "touchmove" | "touchmovebody" | "tap" | "doubletap";
export type TouchCaptorEvents = Record<TouchCaptorEventType, (coordinates: TouchCoords) => void>;
export default class TouchCaptor<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Captor<TouchCaptorEvents, N, E, G> {
enabled: boolean;
isMoving: boolean;
hasMoved: boolean;
startCameraState?: CameraState;
touchMode: number;
movingTimeout?: number;
startTouchesAngle?: number;
startTouchesDistance?: number;
startTouchesPositions: Coordinates[];
lastTouchesPositions?: Coordinates[];
lastTouches: Touch[];
lastTap: null | {
position: Coordinates;
time: number;
};
settings: TouchSettings;
constructor(container: HTMLElement, renderer: Sigma<N, E, G>);
kill(): void;
getDimensions(): Dimensions;
handleStart(e: TouchEvent): void;
handleLeave(e: TouchEvent): void;
handleMove(e: TouchEvent): void;
setSettings(settings: TouchSettings): void;
}

View File

@@ -0,0 +1,6 @@
import Camera from "./core/camera.js";
import MouseCaptor from "./core/captors/mouse.js";
import TouchCaptor from "./core/captors/touch.js";
import Sigma from "./sigma.js";
export default Sigma;
export { Sigma, Camera, MouseCaptor, TouchCaptor };

View File

@@ -0,0 +1,5 @@
import { Attributes } from "graphology-types";
import { Settings } from "../settings.js";
import { EdgeDisplayData, NodeDisplayData, PartialButFor } from "../types.js";
export type EdgeLabelDrawingFunction<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = (context: CanvasRenderingContext2D, edgeData: PartialButFor<EdgeDisplayData, "label" | "color" | "size">, sourceData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, targetData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, settings: Settings<N, E, G>) => void;
export declare function drawStraightEdgeLabel<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(context: CanvasRenderingContext2D, edgeData: PartialButFor<EdgeDisplayData, "label" | "color" | "size">, sourceData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, targetData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, settings: Settings<N, E, G>): void;

View File

@@ -0,0 +1,26 @@
import { Attributes } from "graphology-types";
import Sigma from "../sigma.js";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../types.js";
import { EdgeLabelDrawingFunction } from "./edge-labels.js";
import { AbstractProgram, Program } from "./program.js";
export declare abstract class AbstractEdgeProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends AbstractProgram<N, E, G> {
abstract drawLabel: EdgeLabelDrawingFunction<N, E, G> | undefined;
abstract process(edgeIndex: number, offset: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
}
export declare abstract class EdgeProgram<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Program<Uniform, N, E, G> implements AbstractEdgeProgram<N, E, G> {
drawLabel: EdgeLabelDrawingFunction<N, E, G> | undefined;
kill(): void;
process(edgeIndex: number, offset: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
abstract processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
}
declare class _EdgeProgramClass<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> implements AbstractEdgeProgram<N, E, G> {
constructor(_gl: WebGLRenderingContext, _pickingBuffer: WebGLFramebuffer | null, _renderer: Sigma<N, E, G>);
drawLabel: EdgeLabelDrawingFunction<N, E, G> | undefined;
kill(): void;
reallocate(_capacity: number): void;
process(_edgeIndex: number, _offset: number, _sourceData: NodeDisplayData, _targetData: NodeDisplayData, _data: EdgeDisplayData): void;
render(_params: RenderParams): void;
}
export type EdgeProgramType<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = typeof _EdgeProgramClass<N, E, G>;
export declare function createEdgeCompoundProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(programClasses: Array<EdgeProgramType<N, E, G>>, drawLabel?: EdgeLabelDrawingFunction<N, E, G>): EdgeProgramType<N, E, G>;
export {};

View File

@@ -0,0 +1,23 @@
export { NodeProgram, AbstractNodeProgram, createNodeCompoundProgram } from "./node.js";
export type { NodeProgramType } from "./node.js";
export { EdgeProgram, AbstractEdgeProgram, createEdgeCompoundProgram } from "./edge.js";
export type { EdgeProgramType } from "./edge.js";
export { Program, AbstractProgram } from "./program.js";
export type { ProgramType } from "./program.js";
export type { EdgeLabelDrawingFunction } from "./edge-labels.js";
export { drawStraightEdgeLabel } from "./edge-labels.js";
export type { NodeLabelDrawingFunction } from "./node-labels.js";
export { drawDiscNodeLabel } from "./node-labels.js";
export type { NodeHoverDrawingFunction } from "./node-hover.js";
export { drawDiscNodeHover } from "./node-hover.js";
export * from "./utils.js";
export { default as NodeCircleProgram } from "./programs/node-circle/index.js";
export { default as NodePointProgram } from "./programs/node-point/index.js";
export { default as EdgeArrowHeadProgram, createEdgeArrowHeadProgram, DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, type CreateEdgeArrowHeadProgramOptions, } from "./programs/edge-arrow-head/index.js";
export { default as EdgeClampedProgram, createEdgeClampedProgram, DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS, type CreateEdgeClampedProgramOptions, } from "./programs/edge-clamped/index.js";
export { default as EdgeDoubleClampedProgram, createEdgeDoubleClampedProgram, DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS, type CreateEdgeDoubleClampedProgramOptions, } from "./programs/edge-double-clamped/index.js";
export { default as EdgeArrowProgram, createEdgeArrowProgram } from "./programs/edge-arrow/index.js";
export { default as EdgeDoubleArrowProgram, createEdgeDoubleArrowProgram } from "./programs/edge-double-arrow/index.js";
export { default as EdgeLineProgram } from "./programs/edge-line/index.js";
export { default as EdgeRectangleProgram } from "./programs/edge-rectangle/index.js";
export { default as EdgeTriangleProgram } from "./programs/edge-triangle/index.js";

View File

@@ -0,0 +1,5 @@
import { Attributes } from "graphology-types";
import { Settings } from "../settings.js";
import { NodeDisplayData, PartialButFor } from "../types.js";
export type NodeHoverDrawingFunction<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = (context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>) => void;
export declare function drawDiscNodeHover<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>): void;

View File

@@ -0,0 +1,5 @@
import { Attributes } from "graphology-types";
import { Settings } from "../settings.js";
import { NodeDisplayData, PartialButFor } from "../types.js";
export type NodeLabelDrawingFunction<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = (context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>) => void;
export declare function drawDiscNodeLabel<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>): void;

View File

@@ -0,0 +1,30 @@
import { Attributes } from "graphology-types";
import Sigma from "../sigma.js";
import { NodeDisplayData, NonEmptyArray, RenderParams } from "../types.js";
import { NodeHoverDrawingFunction } from "./node-hover.js";
import { NodeLabelDrawingFunction } from "./node-labels.js";
import { AbstractProgram, Program } from "./program.js";
export declare abstract class AbstractNodeProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends AbstractProgram<N, E, G> {
abstract drawLabel: NodeLabelDrawingFunction<N, E, G> | undefined;
abstract drawHover: NodeHoverDrawingFunction<N, E, G> | undefined;
abstract process(nodeIndex: number, offset: number, data: NodeDisplayData): void;
}
export declare abstract class NodeProgram<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Program<Uniform, N, E, G> implements AbstractNodeProgram<N, E, G> {
drawLabel: NodeLabelDrawingFunction<N, E, G> | undefined;
drawHover: NodeHoverDrawingFunction<N, E, G> | undefined;
kill(): void;
process(nodeIndex: number, offset: number, data: NodeDisplayData): void;
abstract processVisibleItem(nodeIndex: number, i: number, data: NodeDisplayData): void;
}
declare class _NodeProgramClass<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> implements AbstractNodeProgram<N, E, G> {
constructor(_gl: WebGLRenderingContext, _pickingBuffer: WebGLFramebuffer | null, _renderer: Sigma<N, E, G>);
drawLabel: NodeLabelDrawingFunction<N, E, G> | undefined;
drawHover: NodeHoverDrawingFunction<N, E, G> | undefined;
kill(): void;
reallocate(_capacity: number): void;
process(_nodeIndex: number, _offset: number, _data: NodeDisplayData): void;
render(_params: RenderParams): void;
}
export type NodeProgramType<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = typeof _NodeProgramClass<N, E, G>;
export declare function createNodeCompoundProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(programClasses: NonEmptyArray<NodeProgramType<N, E, G>>, drawLabel?: NodeLabelDrawingFunction<N, E, G>, drawHover?: NodeLabelDrawingFunction<N, E, G>): NodeProgramType<N, E, G>;
export {};

View File

@@ -0,0 +1,50 @@
import { Attributes } from "graphology-types";
import type Sigma from "../sigma.js";
import type { RenderParams } from "../types.js";
import { InstancedProgramDefinition, ProgramAttributeSpecification, ProgramDefinition, ProgramInfo } from "./utils.js";
export declare abstract class AbstractProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> {
constructor(_gl: WebGLRenderingContext, _pickGl: WebGLRenderingContext, _renderer: Sigma<N, E, G>);
abstract reallocate(capacity: number): void;
abstract render(params: RenderParams): void;
abstract kill(): void;
}
export declare abstract class Program<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> implements AbstractProgram<N, E, G>, InstancedProgramDefinition {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
UNIFORMS: ReadonlyArray<Uniform>;
ATTRIBUTES: Array<ProgramAttributeSpecification>;
METHOD: number;
CONSTANT_ATTRIBUTES: Array<ProgramAttributeSpecification>;
CONSTANT_DATA: number[][];
ATTRIBUTES_ITEMS_COUNT: number;
STRIDE: number;
renderer: Sigma<N, E, G>;
array: Float32Array;
constantArray: Float32Array;
capacity: number;
verticesCount: number;
normalProgram: ProgramInfo;
pickProgram: ProgramInfo | null;
isInstanced: boolean;
abstract getDefinition(): ProgramDefinition<Uniform> | InstancedProgramDefinition<Uniform>;
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, pickingBuffer: WebGLFramebuffer | null, renderer: Sigma<N, E, G>);
kill(): void;
protected getProgramInfo(name: "normal" | "pick", gl: WebGLRenderingContext | WebGL2RenderingContext, vertexShaderSource: string, fragmentShaderSource: string, frameBuffer: WebGLFramebuffer | null): ProgramInfo;
protected bindProgram(program: ProgramInfo): void;
protected unbindProgram(program: ProgramInfo): void;
protected bindAttribute(attr: ProgramAttributeSpecification, program: ProgramInfo, offset: number, setDivisor?: boolean): number;
protected unbindAttribute(attr: ProgramAttributeSpecification, program: ProgramInfo, unsetDivisor?: boolean): void;
reallocate(capacity: number): void;
hasNothingToRender(): boolean;
abstract setUniforms(params: RenderParams, programInfo: ProgramInfo): void;
protected renderProgram(params: RenderParams, programInfo: ProgramInfo): void;
render(params: RenderParams): void;
drawWebGL(method: number, { gl, frameBuffer }: ProgramInfo): void;
}
declare class _ProgramClass<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Program<Uniform, N, E, G> {
getDefinition(): ProgramDefinition<Uniform> | InstancedProgramDefinition<Uniform>;
setUniforms(_params: RenderParams, _programInfo: ProgramInfo): undefined;
}
export type ProgramType<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = typeof _ProgramClass<Uniform, N, E, G>;
export {};

View File

@@ -0,0 +1,11 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
export type CreateEdgeArrowHeadProgramOptions = {
extremity: "source" | "target";
lengthToThicknessRatio: number;
widenessToThicknessRatio: number;
};
export declare const DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS: CreateEdgeArrowHeadProgramOptions;
export declare function createEdgeArrowHeadProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<CreateEdgeArrowHeadProgramOptions>): EdgeProgramType<N, E, G>;
declare const EdgeArrowHeadProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeArrowHeadProgram;

View File

@@ -0,0 +1,6 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export declare function createEdgeArrowProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<Omit<CreateEdgeArrowHeadProgramOptions, "extremity">>): EdgeProgramType<N, E, G>;
declare const EdgeArrowProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeArrowProgram;

View File

@@ -0,0 +1,8 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export type CreateEdgeClampedProgramOptions = Pick<CreateEdgeArrowHeadProgramOptions, "lengthToThicknessRatio">;
export declare const DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS: CreateEdgeClampedProgramOptions;
export declare function createEdgeClampedProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<CreateEdgeClampedProgramOptions>): EdgeProgramType<N, E, G>;
declare const EdgeClampedProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeClampedProgram;

View File

@@ -0,0 +1,6 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export declare function createEdgeDoubleArrowProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<Omit<CreateEdgeArrowHeadProgramOptions, "extremity">>): EdgeProgramType<N, E, G>;
declare const EdgeDoubleArrowProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeDoubleArrowProgram;

View File

@@ -0,0 +1,8 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export type CreateEdgeDoubleClampedProgramOptions = Pick<CreateEdgeArrowHeadProgramOptions, "lengthToThicknessRatio">;
export declare const DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS: CreateEdgeDoubleClampedProgramOptions;
export declare function createEdgeDoubleClampedProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<CreateEdgeDoubleClampedProgramOptions>): EdgeProgramType<N, E, G>;
declare const EdgeDoubleClampedProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeDoubleClampedProgram;

View File

@@ -0,0 +1,28 @@
import { Attributes } from "graphology-types";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../../../types.js";
import { EdgeProgram } from "../../edge.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_matrix"];
export default class EdgeLineProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends EdgeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 1;
UNIFORMS: readonly ["u_matrix"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
};
processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,34 @@
import { Attributes } from "graphology-types";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../../../types.js";
import { EdgeProgram } from "../../edge.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio", "u_pixelRatio", "u_feather", "u_minEdgeThickness"];
export default class EdgeRectangleProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends EdgeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 4;
UNIFORMS: readonly ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio", "u_pixelRatio", "u_feather", "u_minEdgeThickness"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
CONSTANT_ATTRIBUTES: {
name: string;
size: number;
type: 5126;
}[];
CONSTANT_DATA: number[][];
};
processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,34 @@
import { Attributes } from "graphology-types";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../../../types.js";
import { EdgeProgram } from "../../edge.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_matrix", "u_sizeRatio", "u_correctionRatio", "u_minEdgeThickness"];
export default class EdgeTriangleProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends EdgeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 4;
UNIFORMS: readonly ["u_matrix", "u_sizeRatio", "u_correctionRatio", "u_minEdgeThickness"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
CONSTANT_ATTRIBUTES: {
name: string;
size: number;
type: 5126;
}[];
CONSTANT_DATA: number[][];
};
processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,37 @@
import { Attributes } from "graphology-types";
import { NodeDisplayData, RenderParams } from "../../../types.js";
import { NodeProgram } from "../../node.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_sizeRatio", "u_correctionRatio", "u_matrix"];
export default class NodeCircleProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends NodeProgram<(typeof UNIFORMS)[number], N, E, G> {
static readonly ANGLE_1 = 0;
static readonly ANGLE_2: number;
static readonly ANGLE_3: number;
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 4;
UNIFORMS: readonly ["u_sizeRatio", "u_correctionRatio", "u_matrix"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
CONSTANT_ATTRIBUTES: {
name: string;
size: number;
type: 5126;
}[];
CONSTANT_DATA: number[][];
};
processVisibleItem(nodeIndex: number, startIndex: number, data: NodeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,28 @@
import { Attributes } from "graphology-types";
import { NodeDisplayData, RenderParams } from "../../../types.js";
import { NodeProgram } from "../../node.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
export default class NodePointProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends NodeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 0;
UNIFORMS: readonly ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
};
processVisibleItem(nodeIndex: number, startIndex: number, data: NodeDisplayData): void;
setUniforms({ sizeRatio, pixelRatio, matrix }: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,38 @@
export declare function getAttributeItemsCount(attr: ProgramAttributeSpecification): number;
export declare function getAttributesItemsCount(attrs: ProgramAttributeSpecification[]): number;
export interface ProgramInfo<Uniform extends string = string> {
name: string;
isPicking: boolean;
program: WebGLProgram;
gl: WebGLRenderingContext | WebGL2RenderingContext;
frameBuffer: WebGLFramebuffer | null;
buffer: WebGLBuffer;
constantBuffer: WebGLBuffer;
uniformLocations: Record<Uniform, WebGLUniformLocation>;
attributeLocations: Record<string, number>;
vertexShader: WebGLShader;
fragmentShader: WebGLShader;
}
export interface ProgramAttributeSpecification {
name: string;
size: number;
type: number;
normalized?: boolean;
}
export interface ProgramDefinition<Uniform extends string = string> {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
UNIFORMS: ReadonlyArray<Uniform>;
ATTRIBUTES: Array<ProgramAttributeSpecification>;
METHOD: number;
}
export interface InstancedProgramDefinition<Uniform extends string = string> extends ProgramDefinition<Uniform> {
CONSTANT_ATTRIBUTES: Array<ProgramAttributeSpecification>;
CONSTANT_DATA: number[][];
}
export declare function loadVertexShader(gl: WebGLRenderingContext, source: string): WebGLShader;
export declare function loadFragmentShader(gl: WebGLRenderingContext, source: string): WebGLShader;
export declare function loadProgram(gl: WebGLRenderingContext, shaders: Array<WebGLShader>): WebGLProgram;
export declare function killProgram({ gl, buffer, program, vertexShader, fragmentShader }: ProgramInfo): void;
export declare function numberToGLSLFloat(n: number): string;

View File

@@ -0,0 +1,87 @@
import { Attributes } from "graphology-types";
import { EdgeLabelDrawingFunction, EdgeProgramType, NodeHoverDrawingFunction, NodeLabelDrawingFunction, NodeProgramType } from "./rendering/index.js";
import { AtLeastOne, EdgeDisplayData, NodeDisplayData } from "./types.js";
export interface Settings<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> {
hideEdgesOnMove: boolean;
hideLabelsOnMove: boolean;
renderLabels: boolean;
renderEdgeLabels: boolean;
enableEdgeEvents: boolean;
defaultNodeColor: string;
defaultNodeType: string;
defaultEdgeColor: string;
defaultEdgeType: string;
labelFont: string;
labelSize: number;
labelWeight: string;
labelColor: {
attribute: string;
color?: string;
} | {
color: string;
attribute?: undefined;
};
edgeLabelFont: string;
edgeLabelSize: number;
edgeLabelWeight: string;
edgeLabelColor: {
attribute: string;
color?: string;
} | {
color: string;
attribute?: undefined;
};
stagePadding: number;
defaultDrawEdgeLabel: EdgeLabelDrawingFunction<N, E, G>;
defaultDrawNodeLabel: NodeLabelDrawingFunction<N, E, G>;
defaultDrawNodeHover: NodeHoverDrawingFunction<N, E, G>;
minEdgeThickness: number;
antiAliasingFeather: number;
dragTimeout: number;
draggedEventsTolerance: number;
inertiaDuration: number;
inertiaRatio: number;
zoomDuration: number;
zoomingRatio: number;
doubleClickTimeout: number;
doubleClickZoomingRatio: number;
doubleClickZoomingDuration: number;
tapMoveTolerance: number;
zoomToSizeRatioFunction: (ratio: number) => number;
itemSizesReference: "screen" | "positions";
autoRescale: boolean;
autoCenter: boolean;
labelDensity: number;
labelGridCellSize: number;
labelRenderedSizeThreshold: number;
nodeReducer: null | ((node: string, data: N) => Partial<NodeDisplayData>);
edgeReducer: null | ((edge: string, data: E) => Partial<EdgeDisplayData>);
zIndex: boolean;
minCameraRatio: null | number;
maxCameraRatio: null | number;
enableCameraZooming: boolean;
enableCameraPanning: boolean;
enableCameraRotation: boolean;
cameraPanBoundaries: null | true | AtLeastOne<{
tolerance: number;
boundaries: {
x: [number, number];
y: [number, number];
};
}>;
allowInvalidContainer: boolean;
nodeProgramClasses: {
[type: string]: NodeProgramType<N, E, G>;
};
nodeHoverProgramClasses: {
[type: string]: NodeProgramType<N, E, G>;
};
edgeProgramClasses: {
[type: string]: EdgeProgramType<N, E, G>;
};
}
export declare const DEFAULT_SETTINGS: Settings<Attributes, Attributes, Attributes>;
export declare const DEFAULT_NODE_PROGRAM_CLASSES: Record<string, NodeProgramType>;
export declare const DEFAULT_EDGE_PROGRAM_CLASSES: Record<string, EdgeProgramType>;
export declare function validateSettings<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(settings: Settings<N, E, G>): void;
export declare function resolveSettings<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(settings: Partial<Settings<N, E, G>>): Settings<N, E, G>;

187
web/node_modules/sigma/dist/declarations/src/sigma.d.ts generated vendored Normal file
View File

@@ -0,0 +1,187 @@
import Graph, { Attributes } from "graphology-types";
import Camera from "./core/camera.js";
import MouseCaptor from "./core/captors/mouse.js";
import TouchCaptor from "./core/captors/touch.js";
import { Settings } from "./settings.js";
import { CameraState, CoordinateConversionOverride, Coordinates, Dimensions, EdgeDisplayData, Extent, NodeDisplayData, PlainObject, RenderParams, SigmaEvents, TypedEventEmitter } from "./types.js";
export default class Sigma<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends TypedEventEmitter<SigmaEvents> {
private settings;
private graph;
private mouseCaptor;
private touchCaptor;
private container;
private elements;
private canvasContexts;
private webGLContexts;
private pickingLayers;
private textures;
private frameBuffers;
private activeListeners;
private labelGrid;
private nodeDataCache;
private edgeDataCache;
private nodeProgramIndex;
private edgeProgramIndex;
private nodesWithForcedLabels;
private edgesWithForcedLabels;
private nodeExtent;
private nodeZExtent;
private edgeZExtent;
private matrix;
private invMatrix;
private correctionRatio;
private customBBox;
private normalizationFunction;
private graphToViewportRatio;
private itemIDsIndex;
private nodeIndices;
private edgeIndices;
private width;
private height;
private pixelRatio;
private pickingDownSizingRatio;
private displayedNodeLabels;
private displayedEdgeLabels;
private highlightedNodes;
private hoveredNode;
private hoveredEdge;
private renderFrame;
private renderHighlightedNodesFrame;
private needToProcess;
private checkEdgesEventsFrame;
private nodePrograms;
private nodeHoverPrograms;
private edgePrograms;
private camera;
constructor(graph: Graph<N, E, G>, container: HTMLElement, settings?: Partial<Settings<N, E, G>>);
private registerNodeProgram;
private registerEdgeProgram;
private unregisterNodeProgram;
private unregisterEdgeProgram;
private resetWebGLTexture;
private bindCameraHandlers;
private unbindCameraHandlers;
private getNodeAtPosition;
private bindEventHandlers;
private bindGraphHandlers;
private unbindGraphHandlers;
private getEdgeAtPoint;
private process;
private handleSettingsUpdate;
private cleanCameraState;
private renderLabels;
private renderEdgeLabels;
private renderHighlightedNodes;
private scheduleHighlightedNodesRender;
private render;
private addNode;
private updateNode;
private removeNode;
private addEdge;
private updateEdge;
private removeEdge;
private clearNodeIndices;
private clearEdgeIndices;
private clearIndices;
private clearNodeState;
private clearEdgeState;
private clearState;
private addNodeToProgram;
private addEdgeToProgram;
getRenderParams(): RenderParams;
getStagePadding(): number;
createLayer<T extends HTMLElement>(id: string, tag: string, options?: {
style?: Partial<CSSStyleDeclaration>;
} & ({
beforeLayer?: string;
} | {
afterLayer?: string;
})): T;
createCanvas(id: string, options?: {
style?: Partial<CSSStyleDeclaration>;
} & ({
beforeLayer?: string;
} | {
afterLayer?: string;
})): HTMLCanvasElement;
createCanvasContext(id: string, options?: {
style?: Partial<CSSStyleDeclaration>;
}): this;
createWebGLContext(id: string, options?: {
preserveDrawingBuffer?: boolean;
antialias?: boolean;
hidden?: boolean;
picking?: boolean;
} & ({
canvas?: HTMLCanvasElement;
style?: undefined;
} | {
style?: CSSStyleDeclaration;
canvas?: undefined;
})): WebGLRenderingContext;
killLayer(id: string): this;
getCamera(): Camera;
setCamera(camera: Camera): void;
getContainer(): HTMLElement;
getGraph(): Graph<N, E, G>;
setGraph(graph: Graph<N, E, G>): void;
getMouseCaptor(): MouseCaptor<N, E, G>;
getTouchCaptor(): TouchCaptor<N, E, G>;
getDimensions(): Dimensions;
getGraphDimensions(): Dimensions;
getNodeDisplayData(key: unknown): NodeDisplayData | undefined;
getEdgeDisplayData(key: unknown): EdgeDisplayData | undefined;
getNodeDisplayedLabels(): Set<string>;
getEdgeDisplayedLabels(): Set<string>;
getSettings(): Settings<N, E, G>;
getSetting<K extends keyof Settings<N, E, G>>(key: K): Settings<N, E, G>[K];
setSetting<K extends keyof Settings<N, E, G>>(key: K, value: Settings<N, E, G>[K]): this;
updateSetting<K extends keyof Settings<N, E, G>>(key: K, updater: (value: Settings<N, E, G>[K]) => Settings<N, E, G>[K]): this;
setSettings(settings: Partial<Settings<N, E, G>>): this;
resize(force?: boolean): this;
clear(): this;
refresh(opts?: {
partialGraph?: {
nodes?: string[];
edges?: string[];
};
schedule?: boolean;
skipIndexation?: boolean;
}): this;
scheduleRender(): this;
scheduleRefresh(opts?: {
partialGraph?: {
nodes?: string[];
edges?: string[];
};
layoutUnchange?: boolean;
}): this;
getViewportZoomedState(viewportTarget: Coordinates, newRatio: number): CameraState;
viewRectangle(): {
x1: number;
y1: number;
x2: number;
y2: number;
height: number;
};
framedGraphToViewport(coordinates: Coordinates, override?: CoordinateConversionOverride): Coordinates;
viewportToFramedGraph(coordinates: Coordinates, override?: CoordinateConversionOverride): Coordinates;
viewportToGraph(viewportPoint: Coordinates, override?: CoordinateConversionOverride): Coordinates;
graphToViewport(graphPoint: Coordinates, override?: CoordinateConversionOverride): Coordinates;
getGraphToViewportRatio(): number;
getBBox(): {
x: Extent;
y: Extent;
};
getCustomBBox(): {
x: Extent;
y: Extent;
} | null;
setCustomBBox(customBBox: {
x: Extent;
y: Extent;
} | null): this;
kill(): void;
scaleSize(size?: number, cameraRatio?: number): number;
getCanvases(): PlainObject<HTMLCanvasElement>;
}

136
web/node_modules/sigma/dist/declarations/src/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,136 @@
import { EventEmitter } from "events";
export type PlainObject<T = any> = {
[k: string]: T;
};
export type PartialButFor<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>> & {
[others: string]: any;
};
export type AtLeastOne<T, U = {
[K in keyof T]: Pick<T, K>;
}> = Partial<T> & U[keyof U];
export type NonEmptyArray<T> = [T, ...T[]];
export interface Coordinates {
x: number;
y: number;
}
export interface CameraState extends Coordinates {
angle: number;
ratio: number;
}
export type MouseInteraction = "click" | "doubleClick" | "rightClick" | "wheel" | "down" | "up" | "leave" | "enter";
export interface MouseCoords extends Coordinates {
sigmaDefaultPrevented: boolean;
preventSigmaDefault(): void;
original: MouseEvent | TouchEvent;
}
export interface WheelCoords extends MouseCoords {
delta: number;
}
export interface TouchCoords {
touches: Coordinates[];
previousTouches: Coordinates[];
sigmaDefaultPrevented: boolean;
preventSigmaDefault(): void;
original: TouchEvent;
}
export interface Dimensions {
width: number;
height: number;
}
export type Extent = [number, number];
export interface DisplayData {
label: string | null;
size: number;
color: string;
hidden: boolean;
forceLabel: boolean;
zIndex: number;
type: string;
}
export interface NodeDisplayData extends Coordinates, DisplayData {
highlighted: boolean;
}
export type EdgeDisplayData = DisplayData;
export type CoordinateConversionOverride = {
cameraState?: CameraState;
matrix?: Float32Array;
viewportDimensions?: Dimensions;
graphDimensions?: Dimensions;
padding?: number;
};
export interface RenderParams {
width: number;
height: number;
sizeRatio: number;
zoomRatio: number;
pixelRatio: number;
cameraAngle: number;
correctionRatio: number;
matrix: Float32Array;
invMatrix: Float32Array;
downSizingRatio: number;
minEdgeThickness: number;
antiAliasingFeather: number;
}
export type Listener = (...args: any[]) => void;
export type EventsMapping = Record<string, Listener>;
interface ITypedEventEmitter<Events extends EventsMapping> {
rawEmitter: EventEmitter;
eventNames<Event extends keyof Events>(): Array<Event>;
setMaxListeners(n: number): this;
getMaxListeners(): number;
emit<Event extends keyof Events>(type: Event, ...args: Parameters<Events[Event]>): boolean;
addListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
on<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
once<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
prependListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
prependOnceListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
removeListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
off<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
removeAllListeners<Event extends keyof Events>(type?: Event): this;
listeners<Event extends keyof Events>(type: Event): Events[Event][];
listenerCount<Event extends keyof Events>(type: Event): number;
rawListeners<Event extends keyof Events>(type: Event): Events[Event][];
}
declare const TypedEventEmitter_base: {
new <T extends EventsMapping>(): ITypedEventEmitter<T>;
};
export declare class TypedEventEmitter<Events extends EventsMapping> extends TypedEventEmitter_base<Events> {
constructor();
}
export interface SigmaEventPayload {
event: MouseCoords;
preventSigmaDefault(): void;
}
export type SigmaStageEventPayload = SigmaEventPayload;
export interface SigmaNodeEventPayload extends SigmaEventPayload {
node: string;
}
export interface SigmaEdgeEventPayload extends SigmaEventPayload {
edge: string;
}
export type SigmaStageEvents = {
[E in MouseInteraction as `${E}Stage`]: (payload: SigmaStageEventPayload) => void;
};
export type SigmaNodeEvents = {
[E in MouseInteraction as `${E}Node`]: (payload: SigmaNodeEventPayload) => void;
};
export type SigmaEdgeEvents = {
[E in MouseInteraction as `${E}Edge`]: (payload: SigmaEdgeEventPayload) => void;
};
export type SigmaAdditionalEvents = {
beforeClear(): void;
afterClear(): void;
beforeProcess(): void;
afterProcess(): void;
beforeRender(): void;
afterRender(): void;
resize(): void;
kill(): void;
moveBody(payload: SigmaStageEventPayload): void;
};
export type SigmaEvents = SigmaStageEvents & SigmaNodeEvents & SigmaEdgeEvents & SigmaAdditionalEvents;
export type SigmaEventType = keyof SigmaEvents;
export type { CameraEvents } from "./core/camera.js";
export type { MouseCaptorEvents } from "./core/captors/mouse.js";
export type { TouchCaptorEvents } from "./core/captors/touch.js";

View File

@@ -0,0 +1,13 @@
import Graph from "graphology-types";
import { PlainObject } from "../types.js";
import { easings } from "./easings.js";
export type Easing = keyof typeof easings | ((k: number) => number);
export interface AnimateOptions {
easing: Easing;
duration: number;
}
export declare const ANIMATE_DEFAULTS: {
easing: string;
duration: number;
};
export declare function animateNodes(graph: Graph, targets: PlainObject<PlainObject<number>>, opts: Partial<AnimateOptions>, callback?: () => void): () => void;

View File

@@ -0,0 +1,16 @@
export declare const HTML_COLORS: Record<string, string>;
export declare function extractPixel(gl: WebGLRenderingContext, x: number, y: number, array: Uint8Array): Uint8Array;
type RGBAColor = {
r: number;
g: number;
b: number;
a: number;
};
export declare function parseColor(val: string): RGBAColor;
export declare function rgbaToFloat(r: number, g: number, b: number, a: number, masking?: boolean): number;
export declare function floatColor(val: string): number;
export declare function colorToArray(val: string, masking?: boolean): [number, number, number, number];
export declare function indexToColor(index: number): number;
export declare function colorToIndex(r: number, g: number, b: number, _a: number): number;
export declare function getPixelColor(gl: WebGLRenderingContext, frameBuffer: WebGLBuffer | null, x: number, y: number, pixelRatio: number, downSizingRatio: number): [number, number, number, number];
export {};

View File

@@ -0,0 +1,16 @@
import { CameraState, Dimensions } from "../types.js";
export declare function getCorrectionRatio(viewportDimensions: {
width: number;
height: number;
}, graphDimensions: {
width: number;
height: number;
}): number;
export declare function matrixFromCamera(state: CameraState, viewportDimensions: {
width: number;
height: number;
}, graphDimensions: {
width: number;
height: number;
}, padding: number, inverse?: boolean): Float32Array;
export declare function getMatrixImpact(matrix: Float32Array, cameraState: CameraState, viewportDimensions: Dimensions): number;

View File

@@ -0,0 +1,4 @@
export declare function extend<T>(array: T[], values: Set<T>): void;
export declare function isPlainObject(value: unknown): boolean;
export declare function assign<T>(target: Partial<T> | undefined, ...objects: Array<Partial<T | undefined>>): T;
export declare function assignDeep<T>(target: Partial<T> | undefined, ...objects: Array<Partial<T | undefined>>): T;

View File

@@ -0,0 +1,10 @@
export declare const linear: (k: number) => number;
export declare const quadraticIn: (k: number) => number;
export declare const quadraticOut: (k: number) => number;
export declare const quadraticInOut: (k: number) => number;
export declare const cubicIn: (k: number) => number;
export declare const cubicOut: (k: number) => number;
export declare const cubicInOut: (k: number) => number;
export declare const easings: {
[key: string]: (k: number) => number;
};

View File

@@ -0,0 +1,7 @@
import Graph from "graphology-types";
import { Extent } from "../types.js";
export declare function graphExtent(graph: Graph): {
x: Extent;
y: Extent;
};
export declare function validateGraph(graph: Graph): void;

View File

@@ -0,0 +1,9 @@
export * from "./animate.js";
export * from "./colors.js";
export * from "./coordinates.js";
export * from "./data.js";
export * from "./easings.js";
export * from "./graph.js";
export * from "./matrices.js";
export * from "./misc.js";
export * from "./normalization.js";

View File

@@ -0,0 +1,7 @@
import { Coordinates } from "../types.js";
export declare function identity(): Float32Array;
export declare function scale(m: Float32Array, x: number, y?: number): Float32Array;
export declare function rotate(m: Float32Array, r: number): Float32Array;
export declare function translate(m: Float32Array, x: number, y: number): Float32Array;
export declare function multiply<T extends number[] | Float32Array>(a: T, b: Float32Array | number[]): T;
export declare function multiplyVec2(a: Float32Array | number[], b: Coordinates, z?: number): Coordinates;

View File

@@ -0,0 +1,4 @@
import { Extent, PlainObject } from "../types.js";
export declare function createElement<T extends HTMLElement>(tag: string, style?: Partial<CSSStyleDeclaration>, attributes?: PlainObject<string>): T;
export declare function getPixelRatio(): number;
export declare function zIndexOrdering<T>(_extent: Extent, getter: (e: T) => number, elements: Array<T>): Array<T>;

View File

@@ -0,0 +1,11 @@
import { Coordinates, Extent } from "../types.js";
export interface NormalizationFunction {
(data: Coordinates): Coordinates;
ratio: number;
inverse(data: Coordinates): Coordinates;
applyTo(data: Coordinates): void;
}
export declare function createNormalizationFunction(extent: {
x: Extent;
y: Extent;
}): NormalizationFunction;