@auser/workflow-graph-web 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,186 @@
1
+ /**
2
+ * workflow-graph — Interactive workflow DAG visualizer
3
+ *
4
+ * TypeScript wrapper around the WASM module.
5
+ */
6
+ export interface Workflow {
7
+ id: string;
8
+ name: string;
9
+ trigger: string;
10
+ jobs: Job[];
11
+ }
12
+ export interface Job {
13
+ id: string;
14
+ name: string;
15
+ status: 'queued' | 'running' | 'success' | 'failure' | 'skipped' | 'cancelled';
16
+ command: string;
17
+ duration_secs?: number;
18
+ started_at?: number;
19
+ depends_on: string[];
20
+ output?: string;
21
+ required_labels?: string[];
22
+ max_retries?: number;
23
+ attempt?: number;
24
+ }
25
+ export interface ThemeColors {
26
+ success?: string;
27
+ failure?: string;
28
+ running?: string;
29
+ queued?: string;
30
+ skipped?: string;
31
+ cancelled?: string;
32
+ node_bg?: string;
33
+ node_border?: string;
34
+ text?: string;
35
+ text_secondary?: string;
36
+ bg?: string;
37
+ graph_bg?: string;
38
+ edge?: string;
39
+ junction?: string;
40
+ highlight?: string;
41
+ selected?: string;
42
+ header_text?: string;
43
+ header_trigger?: string;
44
+ }
45
+ export interface ThemeFonts {
46
+ family?: string;
47
+ size_name?: number;
48
+ size_duration?: number;
49
+ size_header?: number;
50
+ }
51
+ export interface ThemeLayout {
52
+ node_width?: number;
53
+ node_height?: number;
54
+ node_radius?: number;
55
+ h_gap?: number;
56
+ v_gap?: number;
57
+ header_height?: number;
58
+ padding?: number;
59
+ junction_dot_radius?: number;
60
+ status_icon_radius?: number;
61
+ status_icon_margin?: number;
62
+ }
63
+ export type LayoutDirection = 'LeftToRight' | 'TopToBottom';
64
+ /** Per-edge style override. */
65
+ export interface EdgeStyle {
66
+ /** CSS color for this edge (overrides theme default). */
67
+ color?: string;
68
+ /** Line width in px. */
69
+ width?: number;
70
+ /** Dash pattern array (e.g., [5, 3] for dashed). Empty = solid. */
71
+ dash?: number[];
72
+ }
73
+ /** Internationalization labels for status text and duration formatting. */
74
+ export interface Labels {
75
+ queued?: string;
76
+ running?: string;
77
+ success?: string;
78
+ failure?: string;
79
+ skipped?: string;
80
+ cancelled?: string;
81
+ /** Duration format for minutes+seconds. Use {m} and {s} placeholders. Default: "{m}m {s}s" */
82
+ duration_minutes?: string;
83
+ /** Duration format for seconds only. Use {s} placeholder. Default: "{s}s" */
84
+ duration_seconds?: string;
85
+ }
86
+ /** Theme configuration. All fields are optional — omitted fields use light-theme defaults. */
87
+ export interface ThemeConfig {
88
+ colors?: ThemeColors;
89
+ fonts?: ThemeFonts;
90
+ layout?: ThemeLayout;
91
+ direction?: LayoutDirection;
92
+ labels?: Labels;
93
+ /** Per-edge style overrides keyed by "from_id->to_id". */
94
+ edge_styles?: Record<string, EdgeStyle>;
95
+ /** Show the minimap overlay. Default: false. */
96
+ minimap?: boolean;
97
+ }
98
+ /**
99
+ * Custom node render callback.
100
+ * Called for each node during rendering.
101
+ * @param x - Node x position
102
+ * @param y - Node y position
103
+ * @param w - Node width
104
+ * @param h - Node height
105
+ * @param job - The job data object
106
+ * @returns `true` to skip default node rendering, `false` to render default on top.
107
+ */
108
+ export type OnRenderNode = (x: number, y: number, w: number, h: number, job: Job) => boolean;
109
+ export interface GraphOptions {
110
+ onNodeClick?: (jobId: string) => void;
111
+ onNodeHover?: (jobId: string | null) => void;
112
+ onCanvasClick?: () => void;
113
+ onSelectionChange?: (selectedIds: string[]) => void;
114
+ onNodeDragEnd?: (jobId: string, x: number, y: number) => void;
115
+ /** Called when an edge is clicked. Requires bezier hit testing. */
116
+ onEdgeClick?: (fromId: string, toId: string) => void;
117
+ /** Custom node rendering callback. */
118
+ onRenderNode?: OnRenderNode;
119
+ /** Custom theme configuration. */
120
+ theme?: ThemeConfig;
121
+ /** Automatically resize the canvas when the container resizes. */
122
+ autoResize?: boolean;
123
+ }
124
+ /**
125
+ * Configure the URL to the WASM binary. Call this before creating any WorkflowGraph instances.
126
+ * Only needed if the default resolution doesn't work in your environment.
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * setWasmUrl('/assets/workflow_graph_web_bg.wasm');
131
+ * // or from a CDN:
132
+ * setWasmUrl('https://cdn.example.com/wasm/workflow_graph_web_bg.wasm');
133
+ * ```
134
+ */
135
+ export declare function setWasmUrl(url: string | URL): void;
136
+ /**
137
+ * Interactive workflow DAG graph component.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * const graph = new WorkflowGraph(document.getElementById('container')!, {
142
+ * onNodeClick: (jobId) => console.log('clicked', jobId),
143
+ * theme: darkTheme,
144
+ * autoResize: true,
145
+ * });
146
+ * graph.setWorkflow(workflowData);
147
+ * ```
148
+ */
149
+ export declare class WorkflowGraph {
150
+ private canvasId;
151
+ private canvas;
152
+ private options;
153
+ private initialized;
154
+ constructor(container: HTMLElement, options?: GraphOptions);
155
+ /** Render a workflow. Call this on initial load. */
156
+ setWorkflow(workflow: Workflow): Promise<void>;
157
+ /** Update workflow data without resetting positions or zoom. */
158
+ updateStatus(workflow: Workflow): Promise<void>;
159
+ /** Update the theme at runtime. Triggers re-layout if dimensions or direction changed. */
160
+ setTheme(theme: ThemeConfig): Promise<void>;
161
+ /** Enable or disable auto-resize via ResizeObserver. */
162
+ setAutoResize(enabled: boolean): Promise<void>;
163
+ /** Programmatically select a node. */
164
+ selectNode(jobId: string): Promise<void>;
165
+ /** Deselect all nodes. */
166
+ deselectAll(): Promise<void>;
167
+ /** Reset node positions to auto-layout. */
168
+ resetLayout(): Promise<void>;
169
+ /** Zoom to fit the entire graph. */
170
+ zoomToFit(): Promise<void>;
171
+ /** Set zoom level (0.25 to 4.0). */
172
+ setZoom(level: number): Promise<void>;
173
+ /** Get current node positions for persistence. */
174
+ getNodePositions(): Promise<Record<string, [number, number]>>;
175
+ /** Restore previously saved node positions. */
176
+ setNodePositions(positions: Record<string, [number, number]>): Promise<void>;
177
+ /** Clean up event listeners, resize observer, and remove the canvas. */
178
+ destroy(): Promise<void>;
179
+ }
180
+ /** GitHub Actions dark mode theme preset. */
181
+ export declare const darkTheme: ThemeConfig;
182
+ /** Default GitHub Actions light theme (no-op, but useful for toggling back). */
183
+ export declare const lightTheme: ThemeConfig;
184
+ /** WCAG AA high-contrast theme for accessibility. */
185
+ export declare const highContrastTheme: ThemeConfig;
186
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;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OAAO,CAAC,IAAI,CAAC;IAKhC,oCAAoC;IAC9B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3C,kDAAkD;IAC5C,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAKnE,+CAA+C;IACzC,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF,wEAAwE;IAClE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAM/B;AAID,6CAA6C;AAC7C,eAAO,MAAM,SAAS,EAAE,WAqBvB,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,UAAU,EAAE,WAAgB,CAAC;AAE1C,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,EAAE,WAqB/B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,190 @@
1
+ /**
2
+ * workflow-graph — Interactive workflow DAG visualizer
3
+ *
4
+ * TypeScript wrapper around the WASM module.
5
+ */
6
+ let wasmModule = null;
7
+ let customWasmUrl;
8
+ /**
9
+ * Configure the URL to the WASM binary. Call this before creating any WorkflowGraph instances.
10
+ * Only needed if the default resolution doesn't work in your environment.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * setWasmUrl('/assets/workflow_graph_web_bg.wasm');
15
+ * // or from a CDN:
16
+ * setWasmUrl('https://cdn.example.com/wasm/workflow_graph_web_bg.wasm');
17
+ * ```
18
+ */
19
+ export function setWasmUrl(url) {
20
+ customWasmUrl = url;
21
+ }
22
+ async function ensureWasm() {
23
+ if (wasmModule)
24
+ return wasmModule;
25
+ // Dynamic import of the WASM glue code bundled in wasm/
26
+ // @ts-expect-error — external wasm-pack artifact, not a TS module
27
+ const mod = await import('../wasm/workflow_graph_web.js');
28
+ await mod.default(customWasmUrl);
29
+ wasmModule = mod;
30
+ return wasmModule;
31
+ }
32
+ /**
33
+ * Interactive workflow DAG graph component.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const graph = new WorkflowGraph(document.getElementById('container')!, {
38
+ * onNodeClick: (jobId) => console.log('clicked', jobId),
39
+ * theme: darkTheme,
40
+ * autoResize: true,
41
+ * });
42
+ * graph.setWorkflow(workflowData);
43
+ * ```
44
+ */
45
+ export class WorkflowGraph {
46
+ constructor(container, options = {}) {
47
+ this.initialized = false;
48
+ this.canvasId = `gg-${Math.random().toString(36).slice(2, 9)}`;
49
+ this.canvas = document.createElement('canvas');
50
+ this.canvas.id = this.canvasId;
51
+ this.canvas.style.display = 'block';
52
+ this.canvas.setAttribute('role', 'img');
53
+ this.canvas.setAttribute('aria-label', 'Workflow DAG visualization');
54
+ this.canvas.tabIndex = 0;
55
+ container.appendChild(this.canvas);
56
+ this.options = options;
57
+ }
58
+ /** Render a workflow. Call this on initial load. */
59
+ async setWorkflow(workflow) {
60
+ const wasm = await ensureWasm();
61
+ const json = JSON.stringify(workflow);
62
+ const themeJson = this.options.theme ? JSON.stringify(this.options.theme) : null;
63
+ wasm.render_workflow(this.canvasId, json, this.options.onNodeClick || null, this.options.onNodeHover || null, this.options.onCanvasClick || null, this.options.onSelectionChange || null, this.options.onNodeDragEnd || null, themeJson);
64
+ this.initialized = true;
65
+ // Wire up optional callbacks that use separate WASM functions
66
+ if (this.options.onEdgeClick) {
67
+ wasm.set_on_edge_click(this.canvasId, this.options.onEdgeClick);
68
+ }
69
+ if (this.options.onRenderNode) {
70
+ wasm.set_on_render_node(this.canvasId, this.options.onRenderNode);
71
+ }
72
+ if (this.options.autoResize) {
73
+ wasm.set_auto_resize(this.canvasId, true);
74
+ }
75
+ }
76
+ /** Update workflow data without resetting positions or zoom. */
77
+ async updateStatus(workflow) {
78
+ const wasm = await ensureWasm();
79
+ if (this.initialized) {
80
+ wasm.update_workflow_data(this.canvasId, JSON.stringify(workflow));
81
+ }
82
+ else {
83
+ await this.setWorkflow(workflow);
84
+ }
85
+ }
86
+ /** Update the theme at runtime. Triggers re-layout if dimensions or direction changed. */
87
+ async setTheme(theme) {
88
+ const wasm = await ensureWasm();
89
+ wasm.set_theme(this.canvasId, JSON.stringify(theme));
90
+ this.options.theme = theme;
91
+ }
92
+ /** Enable or disable auto-resize via ResizeObserver. */
93
+ async setAutoResize(enabled) {
94
+ const wasm = await ensureWasm();
95
+ wasm.set_auto_resize(this.canvasId, enabled);
96
+ this.options.autoResize = enabled;
97
+ }
98
+ /** Programmatically select a node. */
99
+ async selectNode(jobId) {
100
+ const wasm = await ensureWasm();
101
+ wasm.select_node(this.canvasId, jobId);
102
+ }
103
+ /** Deselect all nodes. */
104
+ async deselectAll() {
105
+ const wasm = await ensureWasm();
106
+ wasm.deselect_all(this.canvasId);
107
+ }
108
+ /** Reset node positions to auto-layout. */
109
+ async resetLayout() {
110
+ const wasm = await ensureWasm();
111
+ wasm.reset_layout(this.canvasId);
112
+ }
113
+ /** Zoom to fit the entire graph. */
114
+ async zoomToFit() {
115
+ const wasm = await ensureWasm();
116
+ wasm.zoom_to_fit(this.canvasId);
117
+ }
118
+ /** Set zoom level (0.25 to 4.0). */
119
+ async setZoom(level) {
120
+ const wasm = await ensureWasm();
121
+ wasm.set_zoom(this.canvasId, level);
122
+ }
123
+ /** Get current node positions for persistence. */
124
+ async getNodePositions() {
125
+ const wasm = await ensureWasm();
126
+ return wasm.get_node_positions(this.canvasId);
127
+ }
128
+ /** Restore previously saved node positions. */
129
+ async setNodePositions(positions) {
130
+ const wasm = await ensureWasm();
131
+ wasm.set_node_positions(this.canvasId, JSON.stringify(positions));
132
+ }
133
+ /** Clean up event listeners, resize observer, and remove the canvas. */
134
+ async destroy() {
135
+ const wasm = await ensureWasm();
136
+ wasm.destroy(this.canvasId);
137
+ this.canvas.remove();
138
+ this.initialized = false;
139
+ }
140
+ }
141
+ // ─── Preset themes ───────────────────────────────────────────────────────────
142
+ /** GitHub Actions dark mode theme preset. */
143
+ export const darkTheme = {
144
+ colors: {
145
+ success: '#3fb950',
146
+ failure: '#f85149',
147
+ running: '#d29922',
148
+ queued: '#8b949e',
149
+ skipped: '#8b949e',
150
+ cancelled: '#8b949e',
151
+ node_bg: '#161b22',
152
+ node_border: '#30363d',
153
+ text: '#e6edf3',
154
+ text_secondary: '#8b949e',
155
+ bg: '#0d1117',
156
+ graph_bg: '#161b22',
157
+ edge: '#30363d',
158
+ junction: '#484f58',
159
+ highlight: '#58a6ff',
160
+ selected: '#58a6ff',
161
+ header_text: '#e6edf3',
162
+ header_trigger: '#8b949e',
163
+ },
164
+ };
165
+ /** Default GitHub Actions light theme (no-op, but useful for toggling back). */
166
+ export const lightTheme = {};
167
+ /** WCAG AA high-contrast theme for accessibility. */
168
+ export const highContrastTheme = {
169
+ colors: {
170
+ success: '#008000',
171
+ failure: '#ff0000',
172
+ running: '#ff8c00',
173
+ queued: '#555555',
174
+ skipped: '#555555',
175
+ cancelled: '#555555',
176
+ node_bg: '#ffffff',
177
+ node_border: '#000000',
178
+ text: '#000000',
179
+ text_secondary: '#333333',
180
+ bg: '#ffffff',
181
+ graph_bg: '#f0f0f0',
182
+ edge: '#000000',
183
+ junction: '#000000',
184
+ highlight: '#0000ff',
185
+ selected: '#0000ff',
186
+ header_text: '#000000',
187
+ header_trigger: '#333333',
188
+ },
189
+ };
190
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsKH,IAAI,UAAU,GAAsB,IAAI,CAAC;AACzC,IAAI,aAAuC,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,GAAiB;IAC1C,aAAa,GAAG,GAAG,CAAC;AACtB,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAClC,wDAAwD;IACxD,kEAAkE;IAClE,MAAM,GAAG,G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B,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,SAAS;QACtB,cAAc,EAAE,SAAS;KAC1B;CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,UAAU,GAAgB,EAAE,CAAC;AAE1C,qDAAqD;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAgB;IAC5C,MAAM,EAAE;QACN,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,cAAc,EAAE,SAAS;QACzB,EAAE,EAAE,SAAS;QACb,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,SAAS;QACtB,cAAc,EAAE,SAAS;KAC1B;CACF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@auser/workflow-graph-web",
3
+ "version": "0.1.0",
4
+ "description": "Interactive workflow DAG visualizer (WASM + Canvas)",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": ["dist/", "wasm/", "src/", "README.md"],
9
+ "scripts": {
10
+ "copy-wasm": "mkdir -p wasm && cp ../../crates/web/pkg/workflow_graph_web.js ../../crates/web/pkg/workflow_graph_web_bg.wasm wasm/",
11
+ "build": "npm run copy-wasm && tsc",
12
+ "prepublishOnly": "npm run build"
13
+ },
14
+ "keywords": ["workflow", "dag", "graph", "wasm", "canvas", "github-actions", "visualization"],
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/auser/workflow-graph",
19
+ "directory": "packages/web"
20
+ },
21
+ "homepage": "https://auser.github.io/workflow-graph/",
22
+ "sideEffects": false,
23
+ "devDependencies": {
24
+ "typescript": "^5.0.0"
25
+ },
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./wasm/*": "./wasm/*"
36
+ }
37
+ }