@weasel-js/d3 1.7.1 → 1.7.3
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 +22 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,10 +14,31 @@ npm install @weasel-js/d3
|
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
+
`d3Bind` binds an array to a scene's leaves by key. `join()` takes no
|
|
18
|
+
arguments: entering, updating and exiting are a diff it works out by key,
|
|
19
|
+
and `.exit(fn)` hands you the exit set when you want to handle it yourself.
|
|
20
|
+
|
|
17
21
|
```ts
|
|
18
|
-
import {
|
|
22
|
+
import { d3Bind } from '@weasel-js/d3';
|
|
23
|
+
|
|
24
|
+
const binding = d3Bind(scene, points, { key: (d) => d.id, animator })
|
|
25
|
+
.pose((d) => ({ x: d.x, y: d.y, width: 8, height: 8 }))
|
|
26
|
+
.data((d) => ({ label: d.name }))
|
|
27
|
+
.join();
|
|
28
|
+
|
|
29
|
+
binding.transition()
|
|
30
|
+
.duration(400)
|
|
31
|
+
.delay((_d, i) => i * 20)
|
|
32
|
+
.pose((d) => ({ x: d.x * 2, y: d.y, width: 8, height: 8 }))
|
|
33
|
+
.transition() // starts on each item once the one before finishes it
|
|
34
|
+
.remove() // deletes each node when its transition ends
|
|
35
|
+
.end(); // a promise for the whole chain
|
|
19
36
|
```
|
|
20
37
|
|
|
38
|
+
`.transition()` needs the `animator` option. Force layouts come from
|
|
39
|
+
`useSimulation` in `@weasel-js/core` rather than this package. The site's
|
|
40
|
+
`ForceGraphDemo` and `D3SortableDemo` show both.
|
|
41
|
+
|
|
21
42
|
## License
|
|
22
43
|
|
|
23
44
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/d3",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "d3 bridge for weasel: data-join + transition chain over useScene and useAnimator. d3-force already integrates via useSimulation in the main kit.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=18",
|
|
20
|
-
"@weasel-js/core": "1.7.
|
|
20
|
+
"@weasel-js/core": "1.7.3"
|
|
21
21
|
},
|
|
22
22
|
"peerDependenciesMeta": {
|
|
23
23
|
"d3-force": {
|