@fusion.dev/helix-docs 0.134.0 → 0.135.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/content/graphs.mdx +38 -0
- package/dist/sources.generated.js +38 -0
- package/package.json +9 -9
package/content/graphs.mdx
CHANGED
|
@@ -365,6 +365,44 @@ helix-graph:state(ready) > div {
|
|
|
365
365
|
}
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
+
## Draw the graph before it loads
|
|
369
|
+
|
|
370
|
+
`graphSnapshot(nodes, links, options)` draws the graph on your server as an
|
|
371
|
+
SVG, fitted to its box as Sigma.js fits it and in your theme's colors. Put it
|
|
372
|
+
in the frame after the element the renderer draws in, and the page shows a
|
|
373
|
+
graph from its first paint. `connectGraph` fades it out once the renderer has
|
|
374
|
+
drawn the graph whole.
|
|
375
|
+
|
|
376
|
+
```js
|
|
377
|
+
import { graphSnapshot } from '@fusion.dev/helix-graph/snapshot'
|
|
378
|
+
|
|
379
|
+
const snapshot = graphSnapshot(nodes, links, {
|
|
380
|
+
height: 540,
|
|
381
|
+
labels: 'all',
|
|
382
|
+
width: 1200,
|
|
383
|
+
})
|
|
384
|
+
// Inside helix-graph, after <div id="drawing"></div>, write the snapshot's markup.
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Give the snapshot the options you give the renderer, and it lines up with the
|
|
388
|
+
drawing that replaces it:
|
|
389
|
+
|
|
390
|
+
- `labels`, `groupLabels`, `shape`, and `emphasis`, as `sigmaDriver` takes them.
|
|
391
|
+
- `active` and `reach`, as the frame and `connectGraph` take them, to draw the
|
|
392
|
+
selection lit.
|
|
393
|
+
- `bounds`, the box you hand Sigma's `setCustomBBox`, where you hand it one.
|
|
394
|
+
|
|
395
|
+
`width` and `height` are the box it is drawn for, and a smaller box shows its
|
|
396
|
+
middle. Every note needs an `x` and a `y`, since only a layout run in the
|
|
397
|
+
browser could place one without. The snapshot is an empty string where a note
|
|
398
|
+
has no place, so it is whole or absent. Its colors are your theme's tokens, so
|
|
399
|
+
it is light or dark with the page and follows a theme change.
|
|
400
|
+
|
|
401
|
+
In a framework that renders the markup for you, such as React, put the snapshot
|
|
402
|
+
in an element that is a direct child of the frame and has the
|
|
403
|
+
`data-helix-graph-snapshot` attribute. `connectGraph` hides that element, and
|
|
404
|
+
leaves removing it to your framework.
|
|
405
|
+
|
|
368
406
|
## Keyboard and screen readers
|
|
369
407
|
|
|
370
408
|
- The frame is one tab stop. Arrow keys move the drawing, and the plus and
|
|
@@ -1949,6 +1949,44 @@ helix-graph:state(ready) > div {
|
|
|
1949
1949
|
}
|
|
1950
1950
|
\`\`\`
|
|
1951
1951
|
|
|
1952
|
+
## Draw the graph before it loads
|
|
1953
|
+
|
|
1954
|
+
\`graphSnapshot(nodes, links, options)\` draws the graph on your server as an
|
|
1955
|
+
SVG, fitted to its box as Sigma.js fits it and in your theme's colors. Put it
|
|
1956
|
+
in the frame after the element the renderer draws in, and the page shows a
|
|
1957
|
+
graph from its first paint. \`connectGraph\` fades it out once the renderer has
|
|
1958
|
+
drawn the graph whole.
|
|
1959
|
+
|
|
1960
|
+
\`\`\`js
|
|
1961
|
+
import { graphSnapshot } from '@fusion.dev/helix-graph/snapshot'
|
|
1962
|
+
|
|
1963
|
+
const snapshot = graphSnapshot(nodes, links, {
|
|
1964
|
+
height: 540,
|
|
1965
|
+
labels: 'all',
|
|
1966
|
+
width: 1200,
|
|
1967
|
+
})
|
|
1968
|
+
// Inside helix-graph, after <div id="drawing"></div>, write the snapshot's markup.
|
|
1969
|
+
\`\`\`
|
|
1970
|
+
|
|
1971
|
+
Give the snapshot the options you give the renderer, and it lines up with the
|
|
1972
|
+
drawing that replaces it:
|
|
1973
|
+
|
|
1974
|
+
- \`labels\`, \`groupLabels\`, \`shape\`, and \`emphasis\`, as \`sigmaDriver\` takes them.
|
|
1975
|
+
- \`active\` and \`reach\`, as the frame and \`connectGraph\` take them, to draw the
|
|
1976
|
+
selection lit.
|
|
1977
|
+
- \`bounds\`, the box you hand Sigma's \`setCustomBBox\`, where you hand it one.
|
|
1978
|
+
|
|
1979
|
+
\`width\` and \`height\` are the box it is drawn for, and a smaller box shows its
|
|
1980
|
+
middle. Every note needs an \`x\` and a \`y\`, since only a layout run in the
|
|
1981
|
+
browser could place one without. The snapshot is an empty string where a note
|
|
1982
|
+
has no place, so it is whole or absent. Its colors are your theme's tokens, so
|
|
1983
|
+
it is light or dark with the page and follows a theme change.
|
|
1984
|
+
|
|
1985
|
+
In a framework that renders the markup for you, such as React, put the snapshot
|
|
1986
|
+
in an element that is a direct child of the frame and has the
|
|
1987
|
+
\`data-helix-graph-snapshot\` attribute. \`connectGraph\` hides that element, and
|
|
1988
|
+
leaves removing it to your framework.
|
|
1989
|
+
|
|
1952
1990
|
## Keyboard and screen readers
|
|
1953
1991
|
|
|
1954
1992
|
- The frame is one tab stop. Arrow keys move the drawing, and the plus and
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-docs",
|
|
3
3
|
"description": "Versioned documentation content and registry for Helix.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.135.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
},
|
|
37
37
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@fusion.dev/helix": "0.
|
|
40
|
-
"@fusion.dev/helix-cem": "0.
|
|
41
|
-
"@fusion.dev/helix-headless": "0.
|
|
42
|
-
"@fusion.dev/helix-icons": "0.
|
|
43
|
-
"@fusion.dev/helix-map": "0.
|
|
44
|
-
"@fusion.dev/helix-styles": "0.
|
|
45
|
-
"@fusion.dev/helix-testing": "0.
|
|
46
|
-
"@fusion.dev/helix-theme": "0.
|
|
39
|
+
"@fusion.dev/helix": "0.135.0",
|
|
40
|
+
"@fusion.dev/helix-cem": "0.135.0",
|
|
41
|
+
"@fusion.dev/helix-headless": "0.135.0",
|
|
42
|
+
"@fusion.dev/helix-icons": "0.135.0",
|
|
43
|
+
"@fusion.dev/helix-map": "0.135.0",
|
|
44
|
+
"@fusion.dev/helix-styles": "0.135.0",
|
|
45
|
+
"@fusion.dev/helix-testing": "0.135.0",
|
|
46
|
+
"@fusion.dev/helix-theme": "0.135.0",
|
|
47
47
|
"@fusion.dev/scripts": "0.0.0-dev",
|
|
48
48
|
"lit": "^3.2.1",
|
|
49
49
|
"playwright": "^1.62.1"
|