@fusion.dev/helix-graph 0.139.0 → 0.140.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.
@@ -1,4 +1,4 @@
1
- import { HelixGraphPanEvent, HelixGraphPartChangeEvent, HelixGraphSignalEvent, HelixGraphZoomEvent, isRtl, watchTheme, } from '@fusion.dev/helix-core';
1
+ import { HelixGraphPanEvent, HelixGraphPartChangeEvent, HelixGraphSignalEvent, HelixGraphZoomEvent, isRtl, reportRuntime, watchTheme, } from '@fusion.dev/helix-core';
2
2
  import { arrangeByGroup, hubsOf } from './arrange.js';
3
3
  import { diffGraph, isEmpty, linkKey, } from './diff.js';
4
4
  import { graphColorsFrom, looksOf, toneColor, } from './looks.js';
@@ -18,7 +18,12 @@ const still = () => typeof matchMedia === 'function' && matchMedia('(prefers-red
18
18
  export const connectGraph = (frame, driver, options = {}) => {
19
19
  const graph = frame;
20
20
  if (!('nodes' in frame) || typeof graph.requestActive !== 'function') {
21
- console.warn('connectGraph: the element given is not a Graph frame (helix-graph or helix-headless-graph), so nothing will be drawn.', frame);
21
+ reportRuntime({
22
+ detail: frame,
23
+ kind: 'not-a-graph',
24
+ message: 'connectGraph: the element given is not a Graph frame (helix-graph or helix-headless-graph), so nothing will be drawn.',
25
+ tag: frame.localName,
26
+ });
22
27
  }
23
28
  let known = new Map();
24
29
  let framed;
@@ -154,7 +159,12 @@ export const connectGraph = (frame, driver, options = {}) => {
154
159
  shapeFrame = fit.frame;
155
160
  }
156
161
  else if (shaping) {
157
- console.warn('connectGraph: the stencil has no inside to place the notes in, so the graph is laid out instead.', options.stencil);
162
+ reportRuntime({
163
+ detail: options.stencil,
164
+ kind: 'stencil-without-inside',
165
+ message: 'connectGraph: the stencil has no inside to place the notes in, so the graph is laid out instead.',
166
+ tag: frame.localName,
167
+ });
158
168
  positions = seedPositions(nodes.map(({ id }) => ({ id })), linkList, new Map()).positions;
159
169
  unplaced = new Set(ids);
160
170
  }
@@ -1,3 +1,4 @@
1
+ import { reportRuntime } from '@fusion.dev/helix-core';
1
2
  import { fieldFromInside, fieldFromPath } from '../shapes/shape-field.js';
2
3
  import { surfaceWeb } from './surface-web.js';
3
4
  const PROBE = { flat: 64, solid: 32 };
@@ -181,12 +182,18 @@ export const fitInStencil = (positions, stencil, { clustersOf, } = {}) => {
181
182
  ? placesByRegion(field, asked, options)
182
183
  : undefined;
183
184
  if (regional && regional.missing.length > 0) {
184
- console.warn(`fitInStencil: the shape has no part named ${regional.missing.map((part) => `"${part}"`).join(', ')}, so the notes sent there are placed with the rest. Its parts: ${[...regional.found].join(', ') || 'none'}.`);
185
+ reportRuntime({
186
+ kind: 'missing-stencil-parts',
187
+ message: `fitInStencil: the shape has no part named ${regional.missing.map((part) => `"${part}"`).join(', ')}, so the notes sent there are placed with the rest. Its parts: ${[...regional.found].join(', ') || 'none'}.`,
188
+ });
185
189
  }
186
190
  else if (!regional && [...asked.keys()].some((region) => region !== undefined)) {
187
- console.warn(field.regionOf
188
- ? 'fitInStencil: the parts named in regions are too small for the notes sent to them, so the notes are placed over the whole shape.'
189
- : 'fitInStencil: the shape has no named parts, so regions is not used and the notes are placed over the whole shape.');
191
+ reportRuntime({
192
+ kind: 'stencil-regions-unused',
193
+ message: field.regionOf
194
+ ? 'fitInStencil: the parts named in regions are too small for the notes sent to them, so the notes are placed over the whole shape.'
195
+ : 'fitInStencil: the shape has no named parts, so regions is not used and the notes are placed over the whole shape.',
196
+ });
190
197
  }
191
198
  for (const [id, region] of noteRegion) {
192
199
  if (region !== undefined && !regional?.found.has(region)) {
@@ -1,3 +1,4 @@
1
+ import { reportRuntime } from '@fusion.dev/helix-core';
1
2
  import { AdditiveBlending, BoxGeometry, BufferAttribute, BufferGeometry, DoubleSide, Euler, InstancedBufferAttribute, InstancedMesh, Matrix4, Mesh, NormalBlending, OctahedronGeometry, PerspectiveCamera, Points, Quaternion, Raycaster, Scene, ShaderMaterial, TOUCH, Vector2, Vector3, WebGLRenderer, } from 'three';
2
3
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
4
  import { LineMaterial } from 'three/addons/lines/LineMaterial.js';
@@ -1319,7 +1320,12 @@ export const threeDriver = (container, options = {}) => {
1319
1320
  wake();
1320
1321
  })
1321
1322
  .catch((cause) => {
1322
- console.error(new Error('The three.js driver could not load d3-force-3d to lay out the notes. Install d3-force-3d alongside @fusion.dev/helix-graph.', { cause }));
1323
+ reportRuntime({
1324
+ detail: cause,
1325
+ kind: 'missing-layout',
1326
+ level: 'error',
1327
+ message: 'The three.js driver could not load d3-force-3d to lay out the notes. Install d3-force-3d alongside @fusion.dev/helix-graph.',
1328
+ });
1323
1329
  if (!done && !stopped) {
1324
1330
  done = true;
1325
1331
  placed(new Map(nodes.map((node) => [node.id, { x: node.x, y: node.y, z: node.z }])));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-graph",
3
3
  "description": "Connects the Helix Graph frame to a graph renderer: Sigma.js, cosmos.gl, three.js, or a driver of your own.",
4
- "version": "0.139.0",
4
+ "version": "0.140.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -55,12 +55,12 @@
55
55
  },
56
56
  "bugs": "https://github.com/project-fusion/fusion/issues",
57
57
  "dependencies": {
58
- "@fusion.dev/helix-core": "0.139.0"
58
+ "@fusion.dev/helix-core": "0.140.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@cosmos.gl/graph": "^3.4.2",
62
- "@fusion.dev/helix-headless": "0.139.0",
63
- "@fusion.dev/helix-testing": "0.139.0",
62
+ "@fusion.dev/helix-headless": "0.140.0",
63
+ "@fusion.dev/helix-testing": "0.140.0",
64
64
  "@types/bun": "^1.3.0",
65
65
  "@types/three": "^0.186.0",
66
66
  "d3-force-3d": "^3.0.6",