Skip to content

Commit 586ff17

Browse files
authored
Merge pull request #8 from yWorks/dev
2.0.0 - yFiles for HTML 3.0
2 parents 35b2c14 + d670960 commit 586ff17

39 files changed

+986
-1057
lines changed

doc/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
"dist": "npm run build-docs && npm run build"
1313
},
1414
"dependencies": {
15-
"@astrojs/check": "^0.4.1",
16-
"@astrojs/mdx": "^2.1.1",
17-
"@astrojs/preact": "^3.1.0",
18-
"@astrojs/rss": "^4.0.2",
19-
"preact": "^10.19.3",
20-
"sass": "^1.50.0",
21-
"typescript": "^5.3.3",
22-
"@prettier/sync": "^0.5.1"
15+
"@astrojs/check": "^0.9.4",
16+
"@astrojs/mdx": "^4.0.8",
17+
"@astrojs/preact": "^4.0.4",
18+
"@astrojs/rss": "^4.0.11",
19+
"preact": "^10.25.4",
20+
"sass": "^1.84.0",
21+
"typescript": "^5.7.3",
22+
"@prettier/sync": "^0.5.2"
2323
},
2424
"devDependencies": {
25-
"@astrojs/tailwind": "^5.1.0",
26-
"@microsoft/api-extractor": "^7.39.1",
27-
"@types/node": "^20.11.30",
28-
"astro": "^4.1.2",
29-
"fs-extra": "^11.2.0"
25+
"@astrojs/tailwind": "^6.0.0",
26+
"@microsoft/api-extractor": "^7.49.2",
27+
"@types/node": "^22.13.1",
28+
"astro": "^5.2.5",
29+
"fs-extra": "^11.3.0"
3030
}
3131
}

doc/src/components/NavigationBar.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const getLinkClasses = (link) => {
2222
const components = await getCollection('components')
2323
const introductions = await getCollection('introduction')
2424
const features = await getCollection('features')
25-
const types = await getCollection('types')
25+
const unsortedTypes = await getCollection('types')
26+
const types = unsortedTypes.sort((a, b) => a.data.title.localeCompare(b.data.title))
2627
const hooks = await getCollection('hooks')
2728
const functions = await getCollection('functions')
2829
const layouts = await getCollection('layouts')

doc/src/content/features/CustomizingLayouts.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ const initialNodes = data.nodes
4545
const initialEdges = data.edges
4646
4747
const layoutConfiguration: LayoutConfiguration = {
48-
name: "HierarchicLayout",
48+
name: "HierarchicalLayout",
4949
layoutOptions: {
50-
orthogonalRouting: true,
5150
minimumLayerDistance: 50,
52-
integratedEdgeLabeling: true
51+
edgeLabelPlacement: 'integrated'
5352
},
54-
layoutData: { sourceGroupIds: (edge) => edge.source, groupNodeInsets: () => 50 },
53+
layoutData: { sourceGroupIds: (edge) => edge.source, groupNodePadding: () => 50 },
5554
}
5655
5756
function LayoutFlow() {
@@ -114,7 +113,7 @@ function App() {
114113
"className": "large-node",
115114
"data": {
116115
"label": "Analyze Sample",
117-
"className": "node-label",
116+
"className": "node-label"
118117
},
119118
"parentNode": "0"
120119
},
@@ -242,19 +241,19 @@ function App() {
242241
"id": "7",
243242
"source": "5",
244243
"target": "10",
245-
"label": {label: "Repair not successful", "className": "edge-label" }
244+
"label": {"label": "Repair not successful", "className": "edge-label" }
246245
},
247246
{
248247
"id": "8",
249248
"source": "7",
250249
"target": "8",
251-
"label": {label: "Result plausible", "className": "edge-label" }
250+
"label": {"label": "Result plausible", "className": "edge-label" }
252251
},
253252
{
254253
"id": "9",
255254
"source": "2",
256255
"target": "5",
257-
"label": {label: "Repair successful", "className": "edge-label" }
256+
"label": {"label": "Repair successful", "className": "edge-label" }
258257
},
259258
{ "id": "10", "source": "11", "target": "12" },
260259
{ "id": "11", "source": "13", "target": "16" },

doc/src/content/features/Labeling.mdx

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Playground from '../../components/Playground.astro'
1111

1212
*yFiles Layout Algorithms for React Flow* includes support for labeling algorithms, enabling users to place labels
1313
on nodes and edges. Labels can be placed either by selecting a layout algorithm that automatically reserves
14-
space for the node/edge labels and places them there (e.g., [HierarchicLayout](../layouts/hierarchiclayout),
14+
space for the node/edge labels and places them there (e.g., [HierarchicalLayout](../layouts/hierarchicallayout),
1515
[OrganicLayout](../layouts/organiclayout)), or by applying the [GenericLabeling](../layouts/genericlabeling)
1616
algorithm directly.
1717

@@ -20,60 +20,57 @@ const { runLayout } = useLayout()
2020

2121
useEffect(() => {
2222
runLayout({
23-
name: 'HierarchicLayout',
23+
name: 'HierarchicalLayout',
2424
layoutOptions: {
25-
integratedEdgeLabeling: true,
26-
considerNodeLabels: true
25+
edgeLabelPlacement: 'integrated',
26+
nodeLabelPlacement: 'consider'
2727
}
2828
})
2929
}, runLayout)
3030

3131
useEffect(() => {
3232
runLayout({
3333
name: 'GenericLabeling',
34-
layoutOptions: {
35-
placeEdgeLabels: true,
36-
placeNodeLabels: true
37-
}
34+
layoutOptions: { scope: 'edge-labels' },
3835
})
3936
}, runLayout)
4037
```
4138

4239
Node labels can be placed either in the interior or the exterior of the nodes with the option for rotation depending on the
4340
configuration of the applied layout algorithm.
4441
Edges can have multiple labels and edge label placement information can be conveyed to the layout/labeling algorithm through a
45-
`PreferredPlacementDescriptor`, which is passed via the layout data provider.
42+
`EdgeLabelPreferredPlacement`, which is passed via the layout data provider.
4643

4744
```tsx
4845
const { runLayout } = useLayout()
4946

5047
useEffect(() => {
5148
runLayout({
52-
name: 'HierarchicLayout',
49+
name: 'HierarchicalLayout',
5350
layoutOptions: {
54-
integratedEdgeLabeling: true,
55-
considerNodeLabels: true
51+
edgeLabelPlacement: 'integrated',
52+
nodeLabelPlacement: 'consider'
5653
},
5754
layoutData: {
58-
edgeLabelPreferredPlacement: labelPreferredPlacement
55+
edgeLabelPreferredPlacements: labelPreferredPlacement
5956
}
6057
})
6158
}, runLayout)
6259

6360
const labelPreferredPlacement = useMemo(
6461
() =>
65-
(label: LabelData): PreferredPlacementDescriptor => {
62+
(label: LabelData): EdgeLabelPreferredPlacement => {
6663
if (label.labelIndex === 1) {
6764
return {
6865
sideOfEdge: 'left-of-edge',
6966
distanceToEdge: 20,
70-
placeAlongEdge: 'at-source',
67+
placementAlongEdge: 'at-source',
7168
angleReference: 'relative-to-edge-flow'
7269
}
7370
}
7471
return {
7572
sideOfEdge: 'on-edge',
76-
placeAlongEdge: 'at-center'
73+
placementAlongEdge: 'at-center'
7774
}
7875
},
7976
[]
@@ -106,17 +103,16 @@ const layoutConfiguration: LayoutConfiguration = {
106103
name: "OrganicLayout",
107104
layoutOptions: {
108105
// enable edge labeling
109-
integratedEdgeLabeling: true,
106+
edgeLabelPlacement: 'integrated',
110107
// enable node labeling
111-
considerNodeLabels: true,
108+
nodeLabelPlacement: 'consider',
112109
deterministic: true,
113-
preferredEdgeLength: 40,
114-
considerNodeSizes: true
110+
defaultPreferredEdgeLength: 40
115111
},
116112
layoutData: {
117-
edgeLabelPreferredPlacement: () => ({
118-
sideOfEdge: 'on-edge',
119-
placeAlongEdge: 'at-source',
113+
edgeLabelPreferredPlacements: () => ({
114+
edgeSide: 'on-edge',
115+
placementAlongEdge: 'at-source',
120116
angleReference: 'relative-to-edge-flow'
121117
})
122118
},
@@ -274,25 +270,25 @@ function App() {
274270
"id": "0",
275271
"source": "0",
276272
"target": "1",
277-
"label": { "label": "Where?", className: "edge-label location-label" }
273+
"label": { "label": "Where?", "className": "edge-label location-label" }
278274
},
279275
{
280276
"id": "1",
281277
"source": "0",
282278
"target": "4",
283-
"label": { "label": "What to see?", className: "edge-label attractions-label" }
279+
"label": { "label": "What to see?", "className": "edge-label attractions-label" }
284280
},
285281
{
286282
"id": "2",
287283
"source": "0",
288284
"target": "10",
289-
"label": { "label": "What to do?", className: "edge-label events-label" }
285+
"label": { "label": "What to do?", "className": "edge-label events-label" }
290286
},
291287
{
292288
"id": "3",
293289
"source": "0",
294290
"target": "14",
295-
"label": { "label": "Where to work?", className: "edge-label yworks-label" }
291+
"label": { "label": "Where to work?", "className": "edge-label yworks-label" }
296292
},
297293
{ "id": "4", "source": "1", "target": "2" },
298294
{ "id": "5", "source": "1", "target": "3" },

doc/src/content/introduction/GettingStarted.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
2424
from scratch, we recommend using vite:
2525

2626
```bash
27-
npm create vite@latest my-yfiles-layout-app -- --template react-ts
27+
npm create vite@6.1.1 my-yfiles-layout-app -- --template react-ts
2828
```
2929

3030
Install the ReactFlow:
@@ -34,7 +34,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
3434

3535
Add the yFiles dependency:
3636
```bash
37-
npm install <yFiles package path>/lib-dev/yfiles-26.0.0+dev.tgz
37+
npm install <yFiles package path>/lib/yfiles-30.0.0+dev.tgz
3838
```
3939

4040
<details>
@@ -47,7 +47,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
4747
"react": "^18.2.0",
4848
"react-dom": "^18.2.0",
4949
"reactflow": "^11.11.0",
50-
"yfiles": "./lib-dev/yfiles-26.0.0.tgz"
50+
"@yfiles/yfiles": "./lib/yfiles-30.0.0+dev.tgz"
5151
}
5252
```
5353
</details>
@@ -147,7 +147,7 @@ to yFiles is to use the [yFiles Dev Suite](https://www.npmjs.com/package/yfiles-
147147
edgeTypes={edgeTypes}
148148
>
149149
<Panel position="top-left">
150-
<button onClick={() => runLayout('HierarchicLayout')}>Run Layout</button>
150+
<button onClick={() => runLayout('HierarchicalLayout')}>Run Layout</button>
151151
</Panel>
152152
</ReactFlow>
153153
);

doc/src/content/introduction/Welcome.mdx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ const nodeTypes = {
6565
*/
6666
useNodesMeasuredEffect(() => {
6767
runLayout({
68-
name: "HierarchicLayout",
69-
layoutOptions: layoutOptionsByAlgorithm["HierarchicLayout"]
68+
name: "HierarchicalLayout",
69+
layoutOptions: layoutOptionsByAlgorithm["HierarchicalLayout"] as HierarchicalLayoutOptions
7070
})
7171
})
7272
@@ -84,13 +84,13 @@ const nodeTypes = {
8484
<Panel position="top-left">
8585
<label htmlFor="algorithm">Select an Algorithm: </label>
8686
<select id="algorithm" onChange={handleAlgorithmChange}>
87-
<option value="HierarchicLayout">Hierarchic</option>
87+
<option value="HierarchicalLayout">Hierarchical</option>
8888
<option value="OrthogonalLayout">Orthogonal</option>
8989
<option value="RadialLayout">Radial</option>
9090
<option value="CircularLayout">Circular</option>
9191
<option value="OrganicLayout">Organic</option>
9292
<option value="TreeLayout">Tree</option>
93-
<option value="BalloonLayout">Balloon</option>
93+
<option value="RadialTreeLayout">Radial Tree</option>
9494
</select>
9595
</Panel>
9696
</ReactFlow>
@@ -109,8 +109,7 @@ const nodeTypes = {
109109
Partial<LayoutName>,
110110
LayoutAlgorithmOptions
111111
> = {
112-
HierarchicLayout: {
113-
orthogonalRouting: true,
112+
HierarchicalLayout: {
114113
minimumLayerDistance: 40
115114
},
116115
OrthogonalLayout: {
@@ -121,16 +120,16 @@ const nodeTypes = {
121120
},
122121
OrganicLayout: {
123122
deterministic: true,
124-
minimumNodeDistance: 50
123+
defaultMinimumNodeDistance: 50
125124
},
126125
CircularLayout: {
127-
partitionStyle: "organic"
126+
partitionDescriptor: { style: 'organic' }
128127
},
129128
TreeLayout: {
130-
defaultNodePlacer: new yfiles.CompactNodePlacer()
129+
defaultSubtreePlacer: new yfiles.CompactSubtreePlacer()
131130
},
132-
BalloonLayout: {
133-
rootNodePolicy: "center-root"
131+
RadialTreeLayout: {
132+
rootSelectionPolicy: "center-root"
134133
},
135134
EdgeRouter: {},
136135
GenericLabeling: {}

0 commit comments

Comments
 (0)