@kortexya/nodus 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kortexya/nodus",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Nodus \u2014 a high-performance graph visualization engine (WebGL/WebGPU/Canvas/SVG).",
5
5
  "homepage": "https://kortexya.com",
6
6
  "author": "Kortexya <david.loiret@kortexya.com>",
@@ -19,7 +19,10 @@
19
19
  "clean:dist": "rm -f nodus.src.bundle.js nodus_wasm-*.js nodus_render_wasm-*.js __vite-plugin-wasm-helper-*.js chunk-*.js && rm -rf assets types",
20
20
  "build:types": "tsc -p tsconfig.json --declaration --emitDeclarationOnly --noEmit false --outDir types",
21
21
  "prepublishOnly": "npm run build",
22
- "release": "bash scripts/release.sh"
22
+ "release": "bash scripts/release.sh",
23
+ "docs:dev": "npm --prefix docs run dev",
24
+ "docs:build": "npm --prefix docs run build",
25
+ "docs:preview": "npm --prefix docs run preview"
23
26
  },
24
27
  "exports": {
25
28
  ".": {
@@ -25,16 +25,24 @@ export declare class WasmGraphRenderer {
25
25
  private _raf;
26
26
  private _toLinear;
27
27
  private _styleVersion;
28
+ private _styleDirty;
29
+ private _frameScheduled;
28
30
  private _radii;
29
31
  private _fill;
30
32
  private _shape;
31
33
  private _stroke;
32
34
  private _sw;
35
+ private _swMinVis;
36
+ private _layer;
37
+ private _pulses;
33
38
  private _outline;
34
39
  private _haloCol;
35
40
  private _haloW;
41
+ private _outerCol;
42
+ private _outerW;
36
43
  private _imageTile;
37
44
  private _atlasKey;
45
+ private _pieColors;
38
46
  private _pieOffset;
39
47
  private _pieCount;
40
48
  private _pieSegs;
@@ -42,14 +50,45 @@ export declare class WasmGraphRenderer {
42
50
  private _edgeColor;
43
51
  private _edgeWidth;
44
52
  private _edgeCurv;
53
+ private _edgeArrows;
54
+ private _edgeDash;
55
+ private _edgeHaloCol;
56
+ private _edgeHaloW;
57
+ private _edgeOutlineCol;
58
+ private _edgeOutlineW;
59
+ private _edgeLabel;
60
+ private _edgeLabelFont;
61
+ private _edgeLabelCol;
62
+ private _edgeLabelSize;
63
+ private _edgeLabelSec;
64
+ private _edgeLabelSecFont;
65
+ private _edgeLabelSecCol;
45
66
  private _xs;
46
67
  private _ys;
47
68
  private _nodeIds;
48
69
  private _labels;
49
70
  private _lastCam;
50
- private _fitted;
71
+ private _autoFrame;
72
+ private _selfMovingCamera;
73
+ private _lastFit;
51
74
  private _glyphs;
75
+ private _glyphKey;
76
+ private _textFonts;
77
+ private _labelCol;
78
+ private _labelMinVis;
79
+ private _labelMaxLine;
80
+ private _labelSize;
81
+ private _labelSecSize;
82
+ private _labelPos;
83
+ private _labelSecondary;
84
+ private _labelSecCol;
85
+ private _labelSecFont;
86
+ private _labelSecBg;
87
+ private _labelBgCol;
88
+ private _icons;
52
89
  private _fontPx;
90
+ private _targetAtlasPx;
91
+ private _quadScale;
53
92
  private _highlight;
54
93
  private _pieData;
55
94
  private _badgeNode;
@@ -60,13 +99,19 @@ export declare class WasmGraphRenderer {
60
99
  private _badgeStrokeCol;
61
100
  private _badgeStrokeW;
62
101
  private _badgeText;
102
+ private _badgeFont;
63
103
  private _badgeTextCol;
64
104
  private constructor();
105
+ /** Coalesce redraw requests into a single rAF-driven frame (no-op if one is already pending or the
106
+ * environment has no rAF). Keeps event-driven redraws cheap when many events fire in one tick. */
107
+ private _scheduleFrame;
65
108
  /** Create a renderer bound to `canvas`. `WasmRendererClass` is the lazy-loaded wgpu class. */
66
109
  static create(nodus: any, canvas: HTMLCanvasElement, WasmRendererClass: any, opts?: WasmGraphRendererOptions): Promise<WasmGraphRenderer>;
67
110
  /** Rasterise an ASCII glyph atlas (white, alpha=coverage) into a texture the TEXT shader samples,
68
111
  * recording each glyph's UV region. Monospace-ish layout in a fixed cell grid. */
69
112
  private _buildAtlas;
113
+ /** CELL/ATLAS_PX from `_buildAtlas` — scales a quad so the em renders at the requested font size. */
114
+ private static readonly _QUAD_SCALE;
70
115
  /** Load image URLs into a 16×16 tile grid atlas (64px tiles, 1024² sRGB) and upload it; redraw on
71
116
  * completion so node icons appear. attrEx.y (set in _buildNodeAttrs) selects each node's tile. */
72
117
  private _loadAtlas;
@@ -76,6 +121,11 @@ export declare class WasmGraphRenderer {
76
121
  private _buildText;
77
122
  private _dpr;
78
123
  private _sizeCanvas;
124
+ /** Keep the backing store (and wgpu surface) matched to the canvas's displayed CSS size × DPR.
125
+ * Called every frame — a no-op when the size is unchanged. Without it a responsive container or a
126
+ * canvas sized before layout (clientWidth 0 → 320 fallback at create) renders at a stale, smaller
127
+ * resolution that the browser upscales, which reads as a soft / non-crisp image. */
128
+ private _syncCanvasSize;
79
129
  /** getAttribute that returns null instead of throwing on an undefined attribute name. */
80
130
  private _safeAttr;
81
131
  /** A Nodus style value (false/null = off, colour string, or {color,...}) → LINEAR rgba, or null. */
@@ -98,8 +148,16 @@ export declare class WasmGraphRenderer {
98
148
  * [20..24] outerStrokeCol [24..28] outlineCol */
99
149
  private _buildNodeAttrs;
100
150
  /** Assemble the edge attr SoA the EDGE shader decodes — 2×u32 per edge: packed rgba8 colour, then
101
- * (widthU16 | dash<<16 | arrows<<20 | widthScale<<22 | curvByte<<24). The edge feature surface. */
151
+ * (width14 | dash<<14 | headShape<<16 | tailShape<<19 | widthScale<<22 | curvByte<<24). headShape/
152
+ * tailShape are 3-bit extremity shapes (0 none,1 arrow,2 square,3 circle,4 open-arrow). Feature surface. */
102
153
  private _buildEdgeAttrs;
154
+ /** Halo edges: a wider, halo-coloured copy of each haloed edge, packed like _buildEdgeAttrs so it can
155
+ * be PREPENDED (drawn behind the real edges). No dash/arrows; width = edgeWidth + 2·haloWidth. */
156
+ private _buildEdgeHalos;
157
+ /** Active pulse rings this frame → instance arrays (a transparent disk with a coloured inner-stroke
158
+ * ring). Each enabled node spawns a ring every `iv` ms; a ring lives `du` ms, growing sr→er·radius
159
+ * while its colour lerps sc→ec (→ transparent). Empty when nothing pulses. */
160
+ private _buildPulseRings;
103
161
  /** Draw one frame from the live graph. */
104
162
  renderFrame(): void;
105
163
  /** Hit-test a canvas-relative screen point (CSS px) → node id, or null. CPU point-in-radius