@simplex-viz/svg 0.1.2 → 0.2.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/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/ghackenberg/simplex-viz/main/docs/assets/logo-svg.png" width="640" alt="SimplexViz / svg — @simplex-viz/svg" />
3
+ </p>
4
+
1
5
  # @simplex-viz/svg
2
6
 
3
7
  Framework-agnostic SVG rendering engine and pluggable `SvgNodeView` architecture for `@simplex-viz/core`. Zero dependency on React—embeds cleanly into Vanilla TypeScript, Vue, Angular, Svelte, Solid, and Web Components.
@@ -6,7 +10,15 @@ Framework-agnostic SVG rendering engine and pluggable `SvgNodeView` architecture
6
10
  - **Source & Monorepo:** <https://github.com/ghackenberg/simplex-viz/tree/main/packages/svg>
7
11
  - **Companion Packages:** [`@simplex-viz/core`](https://www.npmjs.com/package/@simplex-viz/core) · [`@simplex-viz/react`](https://www.npmjs.com/package/@simplex-viz/react)
8
12
 
9
- ---
13
+ ## Visual Rendering Showcase
14
+
15
+ While `@simplex-viz/core` computes pure spatial coordinates, `@simplex-viz/svg` turns each frame into live DOM `<svg>` elements inside any browser container or UI framework. The preview below renders its built-in views together in a single viewport:
16
+
17
+ <p align="center">
18
+ <img src="https://raw.githubusercontent.com/ghackenberg/simplex-viz/main/docs/assets/preview-svg.png" width="100%" alt="@simplex-viz/svg rendering showcase showing GeometricShapeSvgView, MultiSectorGlyphSvgView, ClusterAnchorSvgView, and BadgeClusterSvgView" />
19
+ </p>
20
+
21
+ *Figure: Visual showcase of the four built-in `SvgNodeView` plugins rendered on an OKLab-tinted 60° simplex mesh. Content items mix `GeometricShapeSvgView` (circles, diamonds, hexagons, and stars that morph smoothly via 64-point paths) with `MultiSectorGlyphSvgView` (proportional donut glyphs whose sector arcs encode barycentric topic weights). Topic clusters alternate between compact `ClusterAnchorSvgView` vertex rings and auto-measured `BadgeClusterSvgView` cards sized via offscreen `getBBox()`.*
10
22
 
11
23
  ## Features
12
24
 
@@ -16,27 +28,93 @@ Framework-agnostic SVG rendering engine and pluggable `SvgNodeView` architecture
16
28
  - **Centralized root-SVG interactions**: Attaches pointer, click, right-click, wheel, drag-to-pan, and `ResizeObserver` listeners solely on the root `<svg>` element and delegates hit-testing to `@simplex-viz/core`'s exact convex geometry solver.
17
29
  - **Four built-in view plugins**: Ready-to-use views for geometric shape morphing, multi-sector topic glyphs, vertex anchors, and dynamic text badges.
18
30
 
19
- ---
20
-
21
31
  ## Installation
22
32
 
33
+ Install `@simplex-viz/svg` alone (`@simplex-viz/core` is installed automatically and key utilities and types are re-exported directly from `@simplex-viz/svg`):
34
+
23
35
  ```bash
24
- npm install @simplex-viz/core @simplex-viz/svg
36
+ npm install @simplex-viz/svg
25
37
  ```
26
38
 
27
- ---
39
+ ## Quickstart (Zero-Config)
40
+
41
+ ### One-Liner Mount (`createSimplexSvg`)
28
42
 
29
- ## Quickstart (Vanilla TypeScript)
43
+ Pass a container `HTMLElement` or CSS selector together with an array of `{ id, tags }` items to `createSimplexSvg`. Drag-to-pan, cursor wheel zoom, cluster click-focus, and floating hover tooltips are enabled automatically:
30
44
 
31
45
  ```ts
32
- import {
33
- SimplexSvgController,
34
- GeometricShapeSvgView,
35
- ClusterAnchorSvgView,
36
- type GeometricShapeVisual,
37
- type ClusterAnchorVisual,
46
+ import { createSimplexSvg } from '@simplex-viz/svg';
47
+
48
+ const items = [
49
+ { id: '1', label: 'Simplex Mesh', tags: ['geometry', 'triangulation', 'math'] },
50
+ { id: '2', label: 'OKLab Mixing', tags: ['color', 'geometry', 'perception'] },
51
+ { id: '3', label: 'SAT Solver', tags: ['collision', 'geometry'] },
52
+ ];
53
+
54
+ const controller = createSimplexSvg('#graph', items);
55
+ ```
56
+
57
+ ### Presets, Labels & Custom Domain Records (`SimplexSvgController`)
58
+
59
+ When you want to pick a built-in visual preset (`'geometric'`, `'glyphs'`, or `'badges'`), display custom labels, or connect records without `{ id, tags }`, pass an options object to `createSimplexSvg` or `new SimplexSvgController(...)`:
60
+
61
+ ```ts
62
+ import { SimplexSvgController } from '@simplex-viz/svg';
63
+
64
+ interface Article {
65
+ readonly slug: string;
66
+ readonly headline: string;
67
+ readonly topics: readonly string[];
68
+ }
69
+
70
+ const controller = new SimplexSvgController('#graph', {
71
+ items: articles,
72
+ getId: (a) => a.slug,
73
+ getTags: (a) => a.topics,
74
+ getLabel: (a) => a.headline,
75
+ preset: 'glyphs', // 'geometric' | 'glyphs' | 'badges'
76
+ tooltip: true, // Built-in hover tooltip (or custom formatter)
77
+ });
78
+ ```
79
+
80
+ You can also format hover tooltips yourself without building separate DOM overlays:
81
+
82
+ ```ts
83
+ const controller = new SimplexSvgController('#graph', {
84
+ items: articles,
85
+ getId: (a) => a.slug,
86
+ getTags: (a) => a.topics,
87
+ preset: 'badges',
88
+ tooltip: (target) =>
89
+ target.kind === 'content'
90
+ ? `${target.item.headline} (${target.layoutContext.tags.length} tags)`
91
+ : `${target.cluster.defaultLabel}: ${target.cluster.members.length} articles`,
92
+ });
93
+ ```
94
+
95
+ Switch presets or mutate data smoothly at runtime—camera pan/zoom stays intact while springs retarget mid-flight:
96
+
97
+ ```ts
98
+ controller.setPreset('badges');
99
+ controller.addItems({ slug: 'new-1', headline: 'Dual-Layer Crossfade', topics: ['svg', 'animation'] });
100
+ controller.removeItems('old-slug');
101
+ controller.camera.reset();
102
+ ```
103
+
104
+ ## Progressive Customization: Custom `VisualResolver` & `SvgNodeView`
105
+
106
+ Whenever built-in presets are not specific enough, swap in your own `VisualResolver`, view plugins, or root-SVG event handlers without rewriting the container lifecycle.
107
+
108
+ ### Step 1 — Define Your Domain Record & `VisualResolver`
109
+
110
+ Map each item and topic cluster into typed descriptors for any `SvgNodeView` plugin. Notice that `VisualResolver` and descriptor types can be imported directly from `@simplex-viz/svg`:
111
+
112
+ ```ts
113
+ import type {
114
+ ClusterAnchorVisual,
115
+ GeometricShapeVisual,
116
+ VisualResolver,
38
117
  } from '@simplex-viz/svg';
39
- import type { VisualResolver } from '@simplex-viz/core';
40
118
 
41
119
  interface Bookmark {
42
120
  readonly url: string;
@@ -69,75 +147,70 @@ const visualResolver: VisualResolver<
69
147
  ? `${visual.shape}:${visual.radius}:${visual.fillHex}`
70
148
  : `${visual.code}:${visual.memberCount}:${visual.colorHex}`,
71
149
  };
150
+ ```
72
151
 
73
- const container = document.getElementById('graph')!;
152
+ ### Step 2 — Mount `SimplexSvgController` with Custom Views
74
153
 
75
- const controller = new SimplexSvgController(container, {
154
+ Pass `visualResolver` together with `contentView` and `clusterView` plugins. You can omit `interactions` to keep default cluster click-focus and cursor zoom, or override individual handlers below:
155
+
156
+ ```ts
157
+ import {
158
+ SimplexSvgController,
159
+ GeometricShapeSvgView,
160
+ ClusterAnchorSvgView,
161
+ } from '@simplex-viz/svg';
162
+
163
+ const controller = new SimplexSvgController('#graph', {
76
164
  items: myBookmarks,
77
165
  getId: (b) => b.url,
78
166
  getTags: (b) => b.topics,
79
167
  visualResolver,
80
168
  contentView: new GeometricShapeSvgView(),
81
169
  clusterView: new ClusterAnchorSvgView(),
82
- meshOptions: {
83
- innerPadding: 48,
84
- minSideLength: 140,
85
- maxSideLength: 280,
86
- maxClusters: 10,
87
- },
88
- layoutOptions: {
89
- clusterGapPx: 14,
90
- itemGapPx: 5,
91
- },
92
- interactions: {
93
- onContentHover: (ev) => {
94
- if (ev) console.log('Hovered item:', ev.item.title, ev.screenPosition);
95
- },
96
- onLeftClick: (target) => {
97
- if (target.kind === 'content') {
98
- console.log('Clicked:', target.item.title);
99
- } else if (target.kind === 'cluster') {
100
- controller.setFocusedClusterUid(target.cluster.clusterUid);
101
- } else {
102
- controller.setFocusedClusterUid(null);
103
- }
104
- },
105
- onRightClick: (target) => {
106
- console.log('Context menu target:', target.kind);
107
- return true; // Suppress browser default context menu
108
- },
109
- onWheel: 'zoom-to-cursor',
110
- },
170
+ meshOptions: { innerPadding: 48, minSideLength: 140, maxSideLength: 280, maxClusters: 10 },
171
+ layoutOptions: { clusterGapPx: 14, itemGapPx: 5 },
111
172
  onMetricsChange: (metrics) => {
112
173
  console.log(`Clusters: ${metrics.clusterCount}, Overlaps: ${metrics.overlapCount}`);
113
174
  },
114
175
  });
176
+ ```
115
177
 
116
- // Live mutations & camera controls
117
- controller.addItems({
118
- url: 'https://example.com/oklab',
119
- title: 'Perceptual Color Mixing',
120
- topics: ['oklab', 'color-science'],
121
- minutes: 12,
122
- });
123
- controller.removeItems('https://example.com/old');
124
- controller.camera.reset();
178
+ ### Step 3 — Override Hover, Click & Wheel Interactions
179
+
180
+ Attach custom click, context-menu, and wheel policies at any time via `setInteractions`. Setting `interactions.onLeftClick` overrides the default cluster click-focus toggle:
125
181
 
126
- // Clean up DOM, ResizeObserver, and animation loop on unmount
127
- // controller.destroy();
182
+ ```ts
183
+ controller.setInteractions({
184
+ onContentHover: (ev) => {
185
+ if (ev) console.log('Hovered item:', ev.item.title, ev.screenPosition);
186
+ },
187
+ onLeftClick: (target) => {
188
+ if (target.kind === 'content') {
189
+ console.log('Clicked:', target.item.title);
190
+ } else if (target.kind === 'cluster') {
191
+ controller.setFocusedClusterUid(target.cluster.clusterUid);
192
+ } else {
193
+ controller.setFocusedClusterUid(null);
194
+ }
195
+ },
196
+ onRightClick: (target) => {
197
+ console.log('Context menu target:', target.kind);
198
+ return true; // Suppress browser default context menu
199
+ },
200
+ onWheel: 'zoom-to-cursor',
201
+ });
128
202
  ```
129
203
 
130
- ---
204
+ Always call `controller.destroy()` when tearing down your component or view to cancel animations, clean up tooltips, and disconnect `ResizeObserver`.
131
205
 
132
206
  ## Built-In `SvgNodeView` Plugins
133
207
 
134
208
  ### 1. `GeometricShapeSvgView`
135
- Renders `'circle' | 'diamond' | 'star' | 'hexagon'` with analytical convex hulls and **64-point parametric SVG path morphing** between shapes and colors.
209
+ Renders `'circle' | 'diamond' | 'star' | 'hexagon'` with analytical convex hulls and **64-point parametric SVG path morphing** between shapes and colors. Pass a `GeometricShapeVisual` descriptor from `resolveContentVisual` to control polygon kind, radius, fill, and outline stroke:
136
210
 
137
211
  ```ts
138
212
  import type { GeometricShapeVisual } from '@simplex-viz/svg';
139
213
 
140
- // Descriptor shape:
141
214
  const visual: GeometricShapeVisual = {
142
215
  shape: 'hexagon', // 'circle' | 'diamond' | 'star' | 'hexagon'
143
216
  radius: 11,
@@ -148,7 +221,7 @@ const visual: GeometricShapeVisual = {
148
221
  ```
149
222
 
150
223
  ### 2. `MultiSectorGlyphSvgView`
151
- Renders a multi-colored donut glyph whose sector arc angles match an item's exact barycentric weights across its active simplex unit (vertex, edge, or triangle).
224
+ Renders a multi-colored donut glyph whose sector arc angles match an item's exact barycentric weights across its active simplex unit (vertex, edge, or triangle). Map `ctx.unitClusters` directly into `sectors` as shown below to reflect multi-topic membership visually:
152
225
 
153
226
  ```ts
154
227
  import type { MultiSectorGlyphVisual } from '@simplex-viz/svg';
@@ -165,7 +238,7 @@ const visual: MultiSectorGlyphVisual = {
165
238
  ```
166
239
 
167
240
  ### 3. `BadgeClusterSvgView`
168
- Renders dynamic pill/card cluster badges sized to their title and metadata line. Intentionally omits `measureConvexHull` so `@simplex-viz/svg` measures the rendered SVG element via `getBBox()`.
241
+ Renders dynamic pill/card cluster badges sized to their title and metadata line. Because it intentionally omits `measureConvexHull`, `@simplex-viz/svg` measures the rendered `<svg>` elements via `getBBox()` so varying title lengths remain strictly overlap-free:
169
242
 
170
243
  ```ts
171
244
  import type { BadgeClusterVisual } from '@simplex-viz/svg';
@@ -179,7 +252,7 @@ const visual: BadgeClusterVisual = {
179
252
  ```
180
253
 
181
254
  ### 4. `ClusterAnchorSvgView`
182
- Renders calibrated double-ring vertex anchors showing the cluster code and member count.
255
+ Renders calibrated double-ring vertex anchors showing the cluster code and member count. Supply a `ClusterAnchorVisual` descriptor when you want compact circular topic anchors on mesh vertices:
183
256
 
184
257
  ```ts
185
258
  import type { ClusterAnchorVisual } from '@simplex-viz/svg';
@@ -193,33 +266,38 @@ const visual: ClusterAnchorVisual = {
193
266
  };
194
267
  ```
195
268
 
196
- ---
197
-
198
269
  ## Writing Custom `SvgNodeView` Plugins
199
270
 
200
271
  Implement `SvgNodeView<TVisual>` centered around local origin `(0, 0)`. `SvgRendererAdapter` handles world positioning `(x, y)`, solver scale `α`, opacity, and crossfading on the parent `<g>`.
201
272
 
273
+ First, define your visual descriptor and an optional analytical hull via `measureConvexHull` (re-exporting `rectToConvexPolygon` straight from `@simplex-viz/svg`, or omit `measureConvexHull` to measure automatically via offscreen `getBBox()`):
274
+
202
275
  ```ts
203
- import type { SvgNodeView } from '@simplex-viz/svg';
204
- import { rectToConvexPolygon } from '@simplex-viz/core';
276
+ import { rectToConvexPolygon, type SvgNodeView } from '@simplex-viz/svg';
205
277
 
206
278
  interface CardVisual {
207
279
  readonly title: string;
208
280
  readonly colorHex: string;
209
281
  }
210
282
 
283
+ const getCardWidth = (title: string) => Math.max(80, title.length * 7 + 20);
284
+ ```
285
+
286
+ Next, populate `mountOrUpdate` to construct pure SVG nodes inside `groupEl`, reacting to `state.interaction.isHovered` for instant border emphasis:
287
+
288
+ ```ts
211
289
  const SVG_NS = 'http://www.w3.org/2000/svg';
212
290
 
213
291
  export const CustomCardSvgView: SvgNodeView<CardVisual> = {
214
292
  // Optional: omit to measure automatically via offscreen getBBox()
215
293
  measureConvexHull: (visual) =>
216
- rectToConvexPolygon(Math.max(80, visual.title.length * 7 + 20), 28, 6),
294
+ rectToConvexPolygon(getCardWidth(visual.title), 28, 6),
217
295
 
218
296
  mountOrUpdate: (groupEl, visual, state) => {
219
297
  const doc = groupEl.ownerDocument;
220
298
  while (groupEl.firstChild) groupEl.removeChild(groupEl.firstChild);
221
299
 
222
- const width = Math.max(80, visual.title.length * 7 + 20);
300
+ const width = getCardWidth(visual.title);
223
301
  const rect = doc.createElementNS(SVG_NS, 'rect');
224
302
  rect.setAttribute('x', String(-width / 2));
225
303
  rect.setAttribute('y', '-14');
@@ -249,12 +327,15 @@ export const CustomCardSvgView: SvgNodeView<CardVisual> = {
249
327
  };
250
328
  ```
251
329
 
252
- ---
330
+ ## API Reference (`createSimplexSvg` & `SimplexSvgController`)
253
331
 
254
- ## `SimplexSvgController` API Summary
332
+ `SimplexSvgController(target, options)` accepts an `HTMLElement` or CSS selector string. `createSimplexSvg(target, itemsOrOptions)` accepts either a `{ id, tags }` array directly (with `tooltip: true`, cursor zoom, and cluster click-focus enabled) or any `SimplexSvgControllerOptions` object. `@simplex-viz/svg` also re-exports `solveSimplexSnapshot`, geometry hull helpers (`computeConvexHull`, `rectToConvexPolygon`, `regularPolygon`, `starConvexHull`), and core TypeScript types for single-import setups.
255
333
 
256
- | Method / Property | Description |
334
+ | Method / Option | Description |
257
335
  | --- | --- |
336
+ | `preset` / `setPreset(preset, getLabel?)` | Switches between `'geometric'`, `'glyphs'`, and `'badges'` with smooth transitions. |
337
+ | `tooltip` / `setTooltip(tooltip)` | Enables a floating DOM hover tooltip (`boolean` or `(target) => string` formatter). |
338
+ | `focusOnClusterClick` | Option (default `true`): toggles cluster focus on click when no custom `interactions.onLeftClick` is provided. |
258
339
  | `addItems(items)` | Appends one or more items and triggers an interruptible transition. |
259
340
  | `removeItems(ids)` | Removes items by ID and smoothly fades out exiting nodes. |
260
341
  | `setItems(items)` | Replaces the entire corpus while preserving matching clusters & items. |
@@ -264,14 +345,12 @@ export const CustomCardSvgView: SvgNodeView<CardVisual> = {
264
345
  | `setShowHulls(show)` | Toggles convex bounding hull wireframe overlays. |
265
346
  | `setPinnedIds(ids)` / `setHighlightedIds(ids)` | Controls pinned and highlighted visual emphasis states. |
266
347
  | `setFocusedClusterUid(uid \| null)` | Isolates a cluster and its members, dimming unrelated nodes. |
267
- | `setInteractions(handlers)` | Replaces pointer, click, and wheel callbacks dynamically. |
348
+ | `setInteractions(handlers)` | Replaces pointer, click, and wheel callbacks dynamically (`onWheel` defaults to `'zoom-to-cursor'`). |
268
349
  | `camera` | Exposes `CameraController` (`zoomToCursor`, `panBy`, `reset`, `getState`, `setState`). |
269
350
  | `getMetrics()` / `getClusters()` / `getItems()` | Reads live solver telemetry, clusters, and items. |
270
351
  | `getSvgElement()` | Returns the managed root `<svg>` element. |
271
352
  | `stepForTest(dtMs)` | Deterministically advances simulation time in unit/DOM tests. |
272
- | `destroy()` | Cancels `requestAnimationFrame`, disconnects `ResizeObserver`, and removes the `<svg>`. |
273
-
274
- ---
353
+ | `destroy()` | Cancels `requestAnimationFrame`, disconnects `ResizeObserver`, removes tooltips and `<svg>`. |
275
354
 
276
355
  ## License
277
356
 
@@ -1,38 +1,63 @@
1
- import { type CameraController, type ClusterDerivationContext, type ClusterDescriptor, type ClusterMetaConfig, type DefaultTaggedItem, type InteractionHandlers, type ItemIdentityConfig, type LayoutMetrics, type LayoutSolverOptions, type MeshOptions, type VisualResolver } from '@simplex-viz/core';
1
+ import { type CameraController, type ClusterDerivationContext, type ClusterDescriptor, type ClusterHoverEvent, type ClusterMetaConfig, type ContentHoverEvent, type DefaultTaggedItem, type InteractionHandlers, type ItemIdentityConfig, type LayoutMetrics, type LayoutSolverOptions, type MeshOptions, type VisualResolver } from '@simplex-viz/core';
2
+ import { type DefaultClusterPresetVisual, type DefaultContentPresetVisual, type SimplexVisualPreset } from './presets';
2
3
  import { type SvgRendererOptions } from './SvgRendererAdapter';
3
- export interface SimplexSvgControllerResolvedOptions<TItem = DefaultTaggedItem, TContentVisual = unknown, TClusterVisual = unknown, TTagMeta = undefined, TClusterMeta = undefined> {
4
+ export type SimplexTooltipFormatter<TItem = DefaultTaggedItem, TContentVisual = DefaultContentPresetVisual, TClusterVisual = DefaultClusterPresetVisual, TTagMeta = undefined, TClusterMeta = undefined> = (target: ({
5
+ readonly kind: 'content';
6
+ } & ContentHoverEvent<TItem, TContentVisual, TTagMeta, TClusterMeta>) | ({
7
+ readonly kind: 'cluster';
8
+ } & ClusterHoverEvent<TItem, TClusterVisual, TTagMeta, TClusterMeta>)) => string;
9
+ export interface SimplexSvgControllerResolvedOptions<TItem = DefaultTaggedItem, TContentVisual = DefaultContentPresetVisual, TClusterVisual = DefaultClusterPresetVisual, TTagMeta = undefined, TClusterMeta = undefined> {
4
10
  readonly items: readonly TItem[];
5
11
  readonly getId?: (item: TItem) => string;
6
12
  readonly getTags?: (item: TItem) => readonly string[];
13
+ readonly getLabel?: (item: TItem) => string;
7
14
  readonly deriveClusterMeta?: (ctx: ClusterDerivationContext<TItem, TTagMeta>) => TClusterMeta;
8
- readonly visualResolver: VisualResolver<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>;
9
- readonly contentView: SvgRendererOptions<TContentVisual, TClusterVisual>['contentView'];
10
- readonly clusterView: SvgRendererOptions<TContentVisual, TClusterVisual>['clusterView'];
15
+ /** Built-in visual preset used when `visualResolver` / views are omitted. Default: `'geometric'`. */
16
+ readonly preset?: SimplexVisualPreset;
17
+ /** Optional custom visual resolver (defaults to the active `preset` resolver). */
18
+ readonly visualResolver?: VisualResolver<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>;
19
+ /** Optional custom content `SvgNodeView` (defaults to the active `preset` view). */
20
+ readonly contentView?: SvgRendererOptions<TContentVisual, TClusterVisual>['contentView'];
21
+ /** Optional custom cluster `SvgNodeView` (defaults to the active `preset` view). */
22
+ readonly clusterView?: SvgRendererOptions<TContentVisual, TClusterVisual>['clusterView'];
11
23
  readonly normalizeTag?: (rawTag: string) => string;
12
24
  readonly resolveTagMeta?: (normalizedTag: string) => TTagMeta | undefined;
13
25
  readonly meshOptions?: MeshOptions;
14
26
  readonly layoutOptions?: LayoutSolverOptions;
15
27
  readonly showHulls?: boolean;
28
+ /**
29
+ * Automatically toggles cluster focus when clicking a topic cluster (and clears on background click)
30
+ * unless a custom `interactions.onLeftClick` handler is provided. Default: `true`.
31
+ */
32
+ readonly focusOnClusterClick?: boolean;
33
+ /** Enables a built-in floating DOM hover tooltip (or supply a custom text formatter). Default: `false`. */
34
+ readonly tooltip?: boolean | SimplexTooltipFormatter<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>;
16
35
  readonly interactions?: InteractionHandlers<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>;
17
36
  readonly onMetricsChange?: (metrics: LayoutMetrics) => void;
18
37
  readonly onClustersChange?: (clusters: readonly ClusterDescriptor<TItem, TTagMeta, TClusterMeta>[]) => void;
19
38
  readonly onFpsUpdate?: (fps: number) => void;
20
39
  }
21
- export type SimplexSvgControllerOptions<TItem = DefaultTaggedItem, TContentVisual = unknown, TClusterVisual = unknown, TTagMeta = undefined, TClusterMeta = undefined> = ItemIdentityConfig<TItem> & ClusterMetaConfig<TItem, TTagMeta, TClusterMeta> & Omit<SimplexSvgControllerResolvedOptions<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>, 'getId' | 'getTags' | 'deriveClusterMeta'>;
40
+ export type SimplexSvgControllerOptions<TItem = DefaultTaggedItem, TContentVisual = DefaultContentPresetVisual, TClusterVisual = DefaultClusterPresetVisual, TTagMeta = undefined, TClusterMeta = undefined> = ItemIdentityConfig<TItem> & ClusterMetaConfig<TItem, TTagMeta, TClusterMeta> & Omit<SimplexSvgControllerResolvedOptions<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>, 'getId' | 'getTags' | 'deriveClusterMeta'>;
22
41
  /**
23
42
  * High-level framework-agnostic SVG graph controller for Vanilla TypeScript, Vue, Angular,
24
43
  * Svelte, Web Components, and `@simplex-viz/react`.
25
44
  *
26
- * Attaches centralized pointer, click, contextmenu, wheel, and drag-pan handlers solely on the
27
- * root `<svg>` element and delegates hit-testing to `@simplex-viz/core`'s convex geometry solver.
45
+ * Works zero-config with `{ items }` via built-in presets, default zoom/pan/focus interactions,
46
+ * and optional tooltips, while remaining 100% customizable through `VisualResolver` and `SvgNodeView`.
28
47
  */
29
- export declare class SimplexSvgController<TItem = DefaultTaggedItem, TContentVisual = unknown, TClusterVisual = unknown, TTagMeta = undefined, TClusterMeta = undefined> {
48
+ export declare class SimplexSvgController<TItem = DefaultTaggedItem, TContentVisual = DefaultContentPresetVisual, TClusterVisual = DefaultClusterPresetVisual, TTagMeta = undefined, TClusterMeta = undefined> {
30
49
  private readonly containerEl;
31
50
  private readonly svgEl;
32
51
  private readonly adapter;
33
52
  private readonly engine;
34
53
  private readonly resizeObserver;
35
54
  private readonly onFpsUpdate?;
55
+ private readonly focusOnClusterClick;
56
+ private readonly getIdExtractor;
57
+ private getLabelExtractor?;
58
+ private tooltipOption;
59
+ private tooltipEl;
60
+ private focusedClusterUidState;
36
61
  private rafId;
37
62
  private lastFrameTs;
38
63
  private fpsSamples;
@@ -42,8 +67,14 @@ export declare class SimplexSvgController<TItem = DefaultTaggedItem, TContentVis
42
67
  private dragStartX;
43
68
  private dragStartY;
44
69
  private dragMoved;
45
- constructor(containerEl: HTMLElement, options: SimplexSvgControllerOptions<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>);
46
- static createFromResolved<TItem = DefaultTaggedItem, TContentVisual = unknown, TClusterVisual = unknown, TTagMeta = undefined, TClusterMeta = undefined>(containerEl: HTMLElement, options: SimplexSvgControllerResolvedOptions<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>): SimplexSvgController<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>;
70
+ constructor(containerEl: HTMLElement | string, options: SimplexSvgControllerOptions<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>);
71
+ static createFromResolved<TItem = DefaultTaggedItem, TContentVisual = DefaultContentPresetVisual, TClusterVisual = DefaultClusterPresetVisual, TTagMeta = undefined, TClusterMeta = undefined>(containerEl: HTMLElement | string, options: SimplexSvgControllerResolvedOptions<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>): SimplexSvgController<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>;
72
+ private wrapInteractions;
73
+ private formatContentTooltip;
74
+ private formatClusterTooltip;
75
+ private ensureTooltipElement;
76
+ private showTooltip;
77
+ private hideTooltip;
47
78
  get camera(): CameraController;
48
79
  getSvgElement(): SVGSVGElement;
49
80
  getMetrics(): LayoutMetrics;
@@ -52,6 +83,12 @@ export declare class SimplexSvgController<TItem = DefaultTaggedItem, TContentVis
52
83
  addItems(items: TItem | readonly TItem[]): void;
53
84
  removeItems(ids: string | readonly string[]): void;
54
85
  setItems(items: readonly TItem[]): void;
86
+ /**
87
+ * Switches between built-in presets (`'geometric'`, `'glyphs'`, `'badges'`) with smooth
88
+ * morph/crossfade transitions.
89
+ */
90
+ setPreset(preset: SimplexVisualPreset, getLabel?: (item: TItem) => string): void;
91
+ setTooltip(tooltip: boolean | SimplexTooltipFormatter<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>): void;
55
92
  setVisualResolver(resolver: VisualResolver<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>): void;
56
93
  setViews(views: Partial<SvgRendererOptions<TContentVisual, TClusterVisual>>): void;
57
94
  setSizeMultiplier(multiplier: number): void;
@@ -73,6 +110,17 @@ export declare class SimplexSvgController<TItem = DefaultTaggedItem, TContentVis
73
110
  private attachSvgListeners;
74
111
  private detachSvgListeners;
75
112
  private ensureLoopRunning;
113
+ /** Helper accessor matching `getId` when external callers inspect items. */
114
+ getItemId(item: TItem): string;
76
115
  destroy(): void;
77
116
  }
117
+ /**
118
+ * Convenience one-liner factory for mounting `@simplex-viz/svg` in Vanilla TypeScript,
119
+ * Vue, Angular, Svelte, or Web Components.
120
+ *
121
+ * Accepts either an array of `{ id, tags }` items directly (with built-in presets,
122
+ * cursor zoom, and cluster click-focus enabled) or a full options object.
123
+ */
124
+ export declare function createSimplexSvg<TItem extends DefaultTaggedItem = DefaultTaggedItem>(target: HTMLElement | string, items: readonly TItem[]): SimplexSvgController<TItem, DefaultContentPresetVisual, DefaultClusterPresetVisual>;
125
+ export declare function createSimplexSvg<TItem = DefaultTaggedItem, TContentVisual = DefaultContentPresetVisual, TClusterVisual = DefaultClusterPresetVisual, TTagMeta = undefined, TClusterMeta = undefined>(target: HTMLElement | string, options: SimplexSvgControllerOptions<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>): SimplexSvgController<TItem, TContentVisual, TClusterVisual, TTagMeta, TClusterMeta>;
78
126
  //# sourceMappingURL=SimplexSvgController.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SimplexSvgController.d.ts","sourceRoot":"","sources":["../src/SimplexSvgController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,WAAW,mCAAmC,CAClD,KAAK,GAAG,iBAAiB,EACzB,cAAc,GAAG,OAAO,EACxB,cAAc,GAAG,OAAO,EACxB,QAAQ,GAAG,SAAS,EACpB,YAAY,GAAG,SAAS;IAExB,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,SAAS,MAAM,EAAE,CAAC;IACtD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAC3B,GAAG,EAAE,wBAAwB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAC3C,YAAY,CAAC;IAClB,QAAQ,CAAC,cAAc,EAAE,cAAc,CACrC,KAAK,EACL,cAAc,EACd,cAAc,EACd,QAAQ,EACR,YAAY,CACb,CAAC;IACF,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC,cAAc,EAAE,cAAc,C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Bd;CACF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,iBAAiB,GAAG,iBAAiB,EAClF,MAAM,EAAE,WAAW,GAAG,MAAM,EAC5B,KAAK,EAAE,SAAS,KAAK,EAAE,GACtB,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,EAAE,0BAA0B,CAAC,CAAC;AACvF,wBAAgB,gBAAgB,CAC9B,KAAK,GAAG,iBAAiB,EACzB,cAAc,GAAG,0BAA0B,EAC3C,cAAc,GAAG,0BAA0B,EAC3C,QAAQ,GAAG,SAAS,EACpB,YAAY,GAAG,SAAS,EAExB,MAAM,EAAE,WAAW,GAAG,MAAM,EAC5B,OAAO,EAAE,2BAA2B,CAClC,KAAK,EACL,cAAc,EACd,cAAc,EACd,QAAQ,EACR,YAAY,CACb,GACA,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export * from './types';
2
2
  export * from './hullMeasure';
3
+ export * from './presets';
3
4
  export * from './SvgRendererAdapter';
4
5
  export * from './SimplexSvgController';
5
6
  export * from './views/GeometricShapeSvgView';
6
7
  export * from './views/MultiSectorGlyphSvgView';
7
8
  export * from './views/BadgeClusterSvgView';
8
9
  export * from './views/ClusterAnchorSvgView';
10
+ export { solveSimplexSnapshot, computeConvexHull, rectToConvexPolygon, regularPolygon, starConvexHull, type CameraController, type CameraState, type ClusterDescriptor, type ClusterHoverEvent, type ContentHoverEvent, type ContentLayoutContext, type ConvexGeometry, type DefaultTaggedItem, type HitTarget, type InteractionHandlers, type LayoutMetrics, type LayoutSolverOptions, type MeshOptions, type NodeRenderState, type SimplexLayoutSnapshot, type SimplexSnapshotOptions, type VisualResolver, } from '@simplex-viz/core';
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAG7C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC"}