@antv/g6 5.0.0-beta.0 → 5.0.0-beta.10
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/dist/g6.min.js +2 -2
- package/esm/api-doc/item.d.ts +2 -0
- package/esm/api-doc/item.js +2 -0
- package/esm/api-doc/item.js.map +1 -1
- package/esm/constant/shape.d.ts +4 -1
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +22 -7
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +16 -9
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +20 -3
- package/esm/item/edge.js +99 -43
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +21 -11
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -1
- package/esm/item/node.js +33 -16
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +127 -283
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +267 -151
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/plugin.js +3 -3
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +103 -23
- package/esm/runtime/graph.js +460 -88
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +9 -9
- package/esm/stdlib/behavior/activate-relations.js +8 -8
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.js +1 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +207 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/drag-canvas.js +57 -26
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +2 -2
- package/esm/stdlib/behavior/drag-combo.js +43 -32
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +3 -3
- package/esm/stdlib/behavior/drag-node.js +76 -63
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +3 -0
- package/esm/stdlib/behavior/index.js +3 -0
- package/esm/stdlib/behavior/index.js.map +1 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +1 -1
- package/esm/stdlib/behavior/lasso-select.js +1 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/esm/stdlib/behavior/scroll-canvas.js +266 -0
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/esm/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/esm/stdlib/behavior/shortcuts-call.js +80 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/zoom-canvas.js +55 -24
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +2 -2
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/transformV4Data.d.ts +2 -2
- package/esm/stdlib/data/transformV4Data.js +2 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +2 -2
- package/esm/stdlib/data/validateData.js +16 -11
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +16 -6
- package/esm/stdlib/index.js +20 -10
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +96 -6
- package/esm/stdlib/item/edge/base.js +92 -19
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/line.js +5 -2
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/polyline.d.ts +3 -2
- package/esm/stdlib/item/edge/polyline.js +3 -3
- package/esm/stdlib/item/edge/polyline.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +90 -16
- package/esm/stdlib/item/node/base.js +91 -41
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +24 -0
- package/esm/stdlib/item/node/base3d.js +24 -8
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +12 -5
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.d.ts +40 -0
- package/esm/stdlib/item/node/image.js +110 -0
- package/esm/stdlib/item/node/image.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/history/combo-command.js +2 -2
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
- package/esm/stdlib/plugin/history/index.d.ts +10 -10
- package/esm/stdlib/plugin/history/index.js +14 -14
- package/esm/stdlib/plugin/history/index.js.map +1 -1
- package/esm/stdlib/plugin/history/item-data-command.js +25 -16
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +3 -6
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/index.d.ts +2 -0
- package/esm/stdlib/plugin/index.js +2 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/legend/index.js +5 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/map/index.d.ts +118 -0
- package/esm/stdlib/plugin/map/index.js +683 -0
- package/esm/stdlib/plugin/map/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +5 -1
- package/esm/stdlib/plugin/minimap/index.js +116 -9
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +167 -0
- package/esm/stdlib/plugin/snapline/index.js +1063 -0
- package/esm/stdlib/plugin/snapline/index.js.map +1 -0
- package/esm/stdlib/plugin/timebar/index.d.ts +98 -0
- package/esm/stdlib/plugin/timebar/index.js +303 -0
- package/esm/stdlib/plugin/timebar/index.js.map +1 -0
- package/esm/stdlib/plugin/toolbar/index.js +1 -1
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -0
- package/esm/stdlib/theme/dark.js +42 -2
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +4 -4
- package/esm/types/common.d.ts +1 -0
- package/esm/types/event.d.ts +1 -0
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/hook.d.ts +22 -2
- package/esm/types/item.d.ts +6 -0
- package/esm/types/item.js.map +1 -1
- package/esm/types/spec.d.ts +20 -4
- package/esm/types/view.d.ts +5 -0
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +29 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/canvas.d.ts +2 -2
- package/esm/util/canvas.js +5 -11
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/event.d.ts +3 -1
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/item.d.ts +16 -1
- package/esm/util/item.js +31 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +11 -0
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/router.d.ts +4 -3
- package/esm/util/router.js +8 -5
- package/esm/util/router.js.map +1 -1
- package/esm/util/shape.d.ts +3 -3
- package/esm/util/shape.js +8 -12
- package/esm/util/shape.js.map +1 -1
- package/esm/util/warn.d.ts +14 -0
- package/esm/util/warn.js +4 -0
- package/esm/util/warn.js.map +1 -0
- package/lib/api-doc/item.d.ts +2 -0
- package/lib/api-doc/item.js +5 -1
- package/lib/api-doc/item.js.map +1 -1
- package/lib/constant/shape.d.ts +4 -1
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +22 -7
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +16 -9
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +20 -3
- package/lib/item/edge.js +98 -42
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +21 -11
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -1
- package/lib/item/node.js +33 -16
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +127 -283
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +266 -150
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/plugin.js +3 -3
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +103 -23
- package/lib/runtime/graph.js +460 -88
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +9 -9
- package/lib/stdlib/behavior/activate-relations.js +8 -8
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.js +1 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +211 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/drag-canvas.js +57 -26
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +2 -2
- package/lib/stdlib/behavior/drag-combo.js +43 -32
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +3 -3
- package/lib/stdlib/behavior/drag-node.js +76 -63
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +3 -0
- package/lib/stdlib/behavior/index.js +3 -0
- package/lib/stdlib/behavior/index.js.map +1 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +1 -1
- package/lib/stdlib/behavior/lasso-select.js +1 -2
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/lib/stdlib/behavior/scroll-canvas.js +270 -0
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/lib/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/lib/stdlib/behavior/shortcuts-call.js +84 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/zoom-canvas.js +55 -24
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +2 -2
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/transformV4Data.d.ts +2 -2
- package/lib/stdlib/data/transformV4Data.js +2 -2
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +2 -2
- package/lib/stdlib/data/validateData.js +16 -11
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +16 -6
- package/lib/stdlib/index.js +20 -10
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +96 -6
- package/lib/stdlib/item/edge/base.js +92 -19
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/line.js +5 -2
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/polyline.d.ts +3 -2
- package/lib/stdlib/item/edge/polyline.js +3 -3
- package/lib/stdlib/item/edge/polyline.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +90 -16
- package/lib/stdlib/item/node/base.js +91 -41
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +24 -0
- package/lib/stdlib/item/node/base3d.js +24 -8
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +12 -5
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.d.ts +40 -0
- package/lib/stdlib/item/node/image.js +114 -0
- package/lib/stdlib/item/node/image.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/history/combo-command.js +2 -2
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
- package/lib/stdlib/plugin/history/index.d.ts +10 -10
- package/lib/stdlib/plugin/history/index.js +14 -14
- package/lib/stdlib/plugin/history/index.js.map +1 -1
- package/lib/stdlib/plugin/history/item-data-command.js +25 -16
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +3 -6
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/index.d.ts +2 -0
- package/lib/stdlib/plugin/index.js +2 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/legend/index.js +5 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/map/index.d.ts +118 -0
- package/lib/stdlib/plugin/map/index.js +687 -0
- package/lib/stdlib/plugin/map/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +5 -1
- package/lib/stdlib/plugin/minimap/index.js +116 -9
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +167 -0
- package/lib/stdlib/plugin/snapline/index.js +1067 -0
- package/lib/stdlib/plugin/snapline/index.js.map +1 -0
- package/lib/stdlib/plugin/timebar/index.d.ts +98 -0
- package/lib/stdlib/plugin/timebar/index.js +307 -0
- package/lib/stdlib/plugin/timebar/index.js.map +1 -0
- package/lib/stdlib/plugin/toolbar/index.js +1 -1
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -0
- package/lib/stdlib/theme/dark.js +42 -2
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +4 -4
- package/lib/types/common.d.ts +1 -0
- package/lib/types/event.d.ts +1 -0
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/hook.d.ts +22 -2
- package/lib/types/item.d.ts +6 -0
- package/lib/types/item.js.map +1 -1
- package/lib/types/spec.d.ts +20 -4
- package/lib/types/view.d.ts +5 -0
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +32 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/canvas.d.ts +2 -2
- package/lib/util/canvas.js +5 -11
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/event.d.ts +3 -1
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/item.d.ts +16 -1
- package/lib/util/item.js +33 -9
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +11 -0
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/router.d.ts +4 -3
- package/lib/util/router.js +8 -5
- package/lib/util/router.js.map +1 -1
- package/lib/util/shape.d.ts +3 -3
- package/lib/util/shape.js +8 -12
- package/lib/util/shape.js.map +1 -1
- package/lib/util/warn.d.ts +14 -0
- package/lib/util/warn.js +8 -0
- package/lib/util/warn.js.map +1 -0
- package/package.json +10 -10
- package/src/api-doc/item.ts +2 -0
- package/src/constant/shape.ts +2 -1
- package/src/index.ts +4 -2
- package/src/item/combo.ts +14 -9
- package/src/item/edge.ts +131 -57
- package/src/item/item.ts +24 -15
- package/src/item/node.ts +38 -24
- package/src/runtime/controller/data.ts +142 -341
- package/src/runtime/controller/item.ts +236 -72
- package/src/runtime/controller/plugin.ts +15 -3
- package/src/runtime/graph.ts +592 -96
- package/src/stdlib/behavior/activate-relations.ts +8 -8
- package/src/stdlib/behavior/brush-select.ts +4 -2
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +296 -0
- package/src/stdlib/behavior/drag-canvas.ts +76 -27
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +18 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +5 -3
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +120 -0
- package/src/stdlib/behavior/zoom-canvas.ts +72 -25
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +16 -11
- package/src/stdlib/index.ts +33 -9
- package/src/stdlib/item/edge/base.ts +118 -19
- package/src/stdlib/item/edge/line.ts +8 -2
- package/src/stdlib/item/edge/polyline.ts +7 -5
- package/src/stdlib/item/node/base.ts +117 -46
- package/src/stdlib/item/node/base3d.ts +24 -9
- package/src/stdlib/item/node/diamond.ts +1 -1
- package/src/stdlib/item/node/ellipse.ts +2 -2
- package/src/stdlib/item/node/hexagon.ts +14 -6
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +1 -0
- package/src/stdlib/plugin/history/combo-command.ts +2 -2
- package/src/stdlib/plugin/history/index.ts +14 -14
- package/src/stdlib/plugin/history/item-data-command.ts +35 -17
- package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
- package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/hull/hullComponent.ts +8 -5
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +5 -4
- package/src/stdlib/plugin/map/index.ts +808 -0
- package/src/stdlib/plugin/minimap/index.ts +120 -10
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +473 -0
- package/src/stdlib/plugin/toolbar/index.ts +1 -1
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/common.ts +1 -0
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +59 -25
- package/src/types/hook.ts +22 -2
- package/src/types/item.ts +10 -0
- package/src/types/spec.ts +23 -4
- package/src/types/view.ts +8 -3
- package/src/util/bbox.ts +38 -1
- package/src/util/canvas.ts +5 -5
- package/src/util/event.ts +14 -1
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +45 -0
- package/src/util/point.ts +8 -3
- package/src/util/router.ts +15 -6
- package/src/util/shape.ts +16 -14
- package/src/util/warn.ts +20 -0
- package/src/api-doc/readme.md +0 -59
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import { createDom } from '@antv/dom-util';
|
|
2
|
+
import { Canvas } from '@antv/g';
|
|
3
|
+
import type { TimebarStyleProps } from '@antv/gui';
|
|
4
|
+
import { Timebar as GUITimebar } from '@antv/gui';
|
|
5
|
+
import { deepMix } from '@antv/util';
|
|
6
|
+
import type { EdgeModel, NodeModel } from '../../../types';
|
|
7
|
+
import { GraphData, IGraph } from '../../../types';
|
|
8
|
+
import type { Padding } from '../../../types/common';
|
|
9
|
+
import type { ITEM_TYPE } from '../../../types/item';
|
|
10
|
+
import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
|
|
11
|
+
import { createCanvas } from '../../../util/canvas';
|
|
12
|
+
import { formatPadding } from '../../../util/shape';
|
|
13
|
+
|
|
14
|
+
// -- start -- Adapt to GUI -- start --
|
|
15
|
+
type SubStyleProps<T, Prefix extends string> = {
|
|
16
|
+
[K in keyof T as K extends `${Prefix}${infer Rest}`
|
|
17
|
+
? Uncapitalize<Rest>
|
|
18
|
+
: never]: T[K];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const prefixStyleProps = (style: Record<string, any>, prefix: string) => {
|
|
22
|
+
const result: Record<string, any> = {};
|
|
23
|
+
Object.entries(style).forEach(([key, val]) => {
|
|
24
|
+
const newKey = `${prefix}${key[0].toUpperCase()}${key.slice(1)}`;
|
|
25
|
+
result[newKey] = val;
|
|
26
|
+
});
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
// -- end -- Adapt to GUI -- end --
|
|
30
|
+
|
|
31
|
+
type Model = NodeModel | EdgeModel;
|
|
32
|
+
type ItemType = Extract<ITEM_TYPE, 'node' | 'edge'>;
|
|
33
|
+
|
|
34
|
+
type STATE = {
|
|
35
|
+
nodes: { enter: Model[]; exit: Model[] };
|
|
36
|
+
edges: { enter: Model[]; exit: Model[] };
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type Datum = Record<string, any>;
|
|
40
|
+
|
|
41
|
+
export interface TimebarConfig
|
|
42
|
+
extends IPluginBaseConfig,
|
|
43
|
+
Pick<
|
|
44
|
+
TimebarStyleProps,
|
|
45
|
+
| 'playMode'
|
|
46
|
+
| 'values'
|
|
47
|
+
| 'labelFormatter'
|
|
48
|
+
| 'interval'
|
|
49
|
+
| 'loop'
|
|
50
|
+
| 'onChange'
|
|
51
|
+
| 'onBackward'
|
|
52
|
+
| 'onPause'
|
|
53
|
+
| 'onPlay'
|
|
54
|
+
| 'onForward'
|
|
55
|
+
| 'onSelectionTypeChange'
|
|
56
|
+
| 'onChartTypeChange'
|
|
57
|
+
> {
|
|
58
|
+
/** specific the x pos of timebar manually */
|
|
59
|
+
x?: number;
|
|
60
|
+
/** specific the y pos of timebar manually */
|
|
61
|
+
y?: number;
|
|
62
|
+
/** width of timebar */
|
|
63
|
+
width?: number;
|
|
64
|
+
/** height of timebar */
|
|
65
|
+
height?: number;
|
|
66
|
+
/** padding of timebar */
|
|
67
|
+
padding?: Padding;
|
|
68
|
+
/** data of timebar */
|
|
69
|
+
data: Datum[];
|
|
70
|
+
/**
|
|
71
|
+
* position of the timebar relative to graph
|
|
72
|
+
* @description it will be failure if x or y is specified
|
|
73
|
+
*/
|
|
74
|
+
position?: 'bottom';
|
|
75
|
+
timebarType: TimebarStyleProps['type'];
|
|
76
|
+
/**
|
|
77
|
+
* how to filter the graph data, default is modify
|
|
78
|
+
* @description modify: the graph data will be changed by addItem or removeItem
|
|
79
|
+
* @description visibility: the graph item will be hidden or shown
|
|
80
|
+
*/
|
|
81
|
+
filterType?: 'modify' | 'visibility';
|
|
82
|
+
/** filter item by specific types */
|
|
83
|
+
filterItemTypes?: ItemType[];
|
|
84
|
+
/** describe how to get time from item */
|
|
85
|
+
getTimeFromItem?: (model: Model, itemType: ItemType) => number | Date;
|
|
86
|
+
/** describe how to get time from timebar data */
|
|
87
|
+
getTimeFromData?: (datum: Datum) => number | Date;
|
|
88
|
+
/** describe how to get value from timebar data */
|
|
89
|
+
getValueFromData?: (datum: Datum) => number;
|
|
90
|
+
/** determines whether an item should be ignored during the filtering process */
|
|
91
|
+
shouldIgnore?: (
|
|
92
|
+
model: Model,
|
|
93
|
+
itemType: ItemType,
|
|
94
|
+
dateRange: number | Date | [number, number] | [Date, Date],
|
|
95
|
+
) => boolean;
|
|
96
|
+
/**
|
|
97
|
+
* manage graph manually when timebar range/value change
|
|
98
|
+
* @description if it is not specified, the graph will be filtered by default
|
|
99
|
+
*/
|
|
100
|
+
filter?: (
|
|
101
|
+
graph: IGraph,
|
|
102
|
+
values: Parameters<TimebarStyleProps['onChange']>,
|
|
103
|
+
) => void;
|
|
104
|
+
axisStyle?: SubStyleProps<TimebarStyleProps, 'axis'>;
|
|
105
|
+
chartStyle?: SubStyleProps<TimebarStyleProps, 'chart'>;
|
|
106
|
+
controllerStyle?: SubStyleProps<TimebarStyleProps, 'controller'>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const prospectiveTimeKeys = ['timestamp', 'time', 'date', 'datetime'];
|
|
110
|
+
const prospectiveValueKeys = ['value', 'date'];
|
|
111
|
+
|
|
112
|
+
const tryToGet = <T = any>(
|
|
113
|
+
datum: Datum,
|
|
114
|
+
optionsKeys: string[],
|
|
115
|
+
defaultValue?: T,
|
|
116
|
+
) => {
|
|
117
|
+
for (let i = 0; i < optionsKeys.length; i++) {
|
|
118
|
+
const key = optionsKeys[i];
|
|
119
|
+
const val = datum?.[key] as T;
|
|
120
|
+
if (val) return val;
|
|
121
|
+
}
|
|
122
|
+
return defaultValue;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export class Timebar extends Base {
|
|
126
|
+
private wrapper: HTMLDivElement;
|
|
127
|
+
private canvas: Canvas;
|
|
128
|
+
private timebar: GUITimebar;
|
|
129
|
+
private graphDataCache: GraphData;
|
|
130
|
+
private itemTypes: ItemType[] = ['node', 'edge'];
|
|
131
|
+
|
|
132
|
+
private get padding() {
|
|
133
|
+
return formatPadding(this.options.padding);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private get containerShape() {
|
|
137
|
+
const { width, height } = this.options;
|
|
138
|
+
const [top, right, bottom, left] = this.padding;
|
|
139
|
+
/** extra height for speed select to avoid being cut */
|
|
140
|
+
const extraHeightForSpeedSelect = 30;
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
x: left,
|
|
144
|
+
y: top,
|
|
145
|
+
width: width + left + right,
|
|
146
|
+
height: height + top + bottom + extraHeightForSpeedSelect,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private get data() {
|
|
151
|
+
const { graph } = this;
|
|
152
|
+
return { nodes: graph.getAllNodesData(), edges: graph.getAllEdgesData() };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
constructor(options?: TimebarConfig) {
|
|
156
|
+
super(options);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
public getDefaultCfgs(): TimebarConfig {
|
|
160
|
+
// @ts-ignore
|
|
161
|
+
const configuration: TimebarConfig = {
|
|
162
|
+
axisStyle: {},
|
|
163
|
+
className: 'g6-component-timebar',
|
|
164
|
+
controllerStyle: {},
|
|
165
|
+
data: [],
|
|
166
|
+
filterItemTypes: ['node'],
|
|
167
|
+
filterType: 'modify',
|
|
168
|
+
getTimeFromItem: (model) =>
|
|
169
|
+
tryToGet<number | Date>(model.data, prospectiveTimeKeys, undefined),
|
|
170
|
+
getTimeFromData: (datum) =>
|
|
171
|
+
tryToGet<number | Date>(datum, prospectiveTimeKeys, undefined),
|
|
172
|
+
getValueFromItem: (datum) => tryToGet(datum, prospectiveValueKeys, 0),
|
|
173
|
+
height: 60,
|
|
174
|
+
padding: 10,
|
|
175
|
+
position: 'bottom',
|
|
176
|
+
timebarType: 'time',
|
|
177
|
+
width: 200,
|
|
178
|
+
};
|
|
179
|
+
return configuration;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public getEvents() {
|
|
183
|
+
return {
|
|
184
|
+
afterrender: this.updateTimebar,
|
|
185
|
+
afterchangedata: this.handleDataChange,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public init(graph: IGraph) {
|
|
190
|
+
super.init(graph);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** reset */
|
|
194
|
+
public reset() {
|
|
195
|
+
this.timebar.reset();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** backward */
|
|
199
|
+
public backward() {
|
|
200
|
+
this.timebar.backward();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** play */
|
|
204
|
+
public play() {
|
|
205
|
+
this.timebar.play();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** pause */
|
|
209
|
+
public pause() {
|
|
210
|
+
this.timebar.pause();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** forward */
|
|
214
|
+
public forward() {
|
|
215
|
+
this.timebar.forward();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
public destroy() {
|
|
219
|
+
this.canvas.destroy();
|
|
220
|
+
super.destroy();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Get the container of timebar */
|
|
224
|
+
private get container(): HTMLElement {
|
|
225
|
+
const { container } = this.options;
|
|
226
|
+
if (container instanceof HTMLElement) return container;
|
|
227
|
+
const element = document.getElementById(container);
|
|
228
|
+
if (element) return element;
|
|
229
|
+
return this.graph.container;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Create a wrapper div for timebar */
|
|
233
|
+
private createWrapper() {
|
|
234
|
+
const { options } = this;
|
|
235
|
+
const { className } = options;
|
|
236
|
+
const { width, height } = this.containerShape;
|
|
237
|
+
|
|
238
|
+
const wrapper = (HTMLDivElement = createDom(
|
|
239
|
+
`<div class="${className}" style="width: ${width}px;height: ${height}"></div>`,
|
|
240
|
+
));
|
|
241
|
+
this.container.appendChild(wrapper);
|
|
242
|
+
return wrapper;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private createCanvas() {
|
|
246
|
+
const { width, height } = this.containerShape;
|
|
247
|
+
const canvas = createCanvas(
|
|
248
|
+
'canvas',
|
|
249
|
+
this.wrapper,
|
|
250
|
+
width,
|
|
251
|
+
height,
|
|
252
|
+
undefined,
|
|
253
|
+
{ background: '#fff' },
|
|
254
|
+
);
|
|
255
|
+
return canvas;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private updateTimebar() {
|
|
259
|
+
if (!this.wrapper) this.wrapper = this.createWrapper();
|
|
260
|
+
if (!this.canvas) this.canvas = this.createCanvas();
|
|
261
|
+
|
|
262
|
+
this.canvas.ready.then(() => {
|
|
263
|
+
this.renderTimebar();
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private updatePosition() {
|
|
268
|
+
const { graph } = this;
|
|
269
|
+
const { x, y } = this.options;
|
|
270
|
+
const { width } = this.containerShape;
|
|
271
|
+
const { position } = this.options;
|
|
272
|
+
const [graphWidth, graphHeight] = graph.getSize();
|
|
273
|
+
|
|
274
|
+
// if x or y is not specified, calculate the position
|
|
275
|
+
if (!x && !y) {
|
|
276
|
+
switch (position) {
|
|
277
|
+
case 'bottom':
|
|
278
|
+
this.wrapper.style.top = graphHeight + 'px';
|
|
279
|
+
this.wrapper.style.left = (graphWidth - width) / 2 + 'px';
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
private renderTimebar() {
|
|
286
|
+
const { x, y } = this.containerShape;
|
|
287
|
+
const {
|
|
288
|
+
x: ignoreX,
|
|
289
|
+
y: ignoreY,
|
|
290
|
+
axisStyle = {},
|
|
291
|
+
chartStyle = {},
|
|
292
|
+
className,
|
|
293
|
+
container,
|
|
294
|
+
controllerStyle = {},
|
|
295
|
+
data: userDefinedData,
|
|
296
|
+
filter,
|
|
297
|
+
filterItemTypes,
|
|
298
|
+
filterType,
|
|
299
|
+
getTimeFromData,
|
|
300
|
+
getTimeFromItem,
|
|
301
|
+
getValueFromData,
|
|
302
|
+
onChange,
|
|
303
|
+
padding,
|
|
304
|
+
position,
|
|
305
|
+
shouldIgnore,
|
|
306
|
+
timebarType,
|
|
307
|
+
type,
|
|
308
|
+
...userDefinedOptions
|
|
309
|
+
} = this.options;
|
|
310
|
+
|
|
311
|
+
const data = userDefinedData.map((datum) => ({
|
|
312
|
+
time: getTimeFromData?.(datum) || datum?.time,
|
|
313
|
+
value: getValueFromData?.(datum) || datum?.value,
|
|
314
|
+
}));
|
|
315
|
+
|
|
316
|
+
const style: TimebarStyleProps = {
|
|
317
|
+
x,
|
|
318
|
+
y,
|
|
319
|
+
data,
|
|
320
|
+
type: timebarType,
|
|
321
|
+
onChange: (values) => {
|
|
322
|
+
this.handleValuesChange(values);
|
|
323
|
+
onChange?.(values);
|
|
324
|
+
},
|
|
325
|
+
...prefixStyleProps(axisStyle, 'axis'),
|
|
326
|
+
...prefixStyleProps(controllerStyle, 'controller'),
|
|
327
|
+
...prefixStyleProps(chartStyle, 'chart'),
|
|
328
|
+
...userDefinedOptions,
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
if (!this.timebar)
|
|
332
|
+
this.timebar = this.canvas.appendChild(new GUITimebar({ style }));
|
|
333
|
+
else this.timebar.update(style);
|
|
334
|
+
this.updatePosition();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
private handleDataChange() {
|
|
338
|
+
this.graphDataCache = deepMix({}, this.data);
|
|
339
|
+
this.updateTimebar();
|
|
340
|
+
this.processValuesChange();
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
private handleValuesChange(
|
|
344
|
+
values: Parameters<TimebarStyleProps['onChange']>[0],
|
|
345
|
+
) {
|
|
346
|
+
this.processValuesChange(values);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
private processValuesChange(
|
|
350
|
+
values: Parameters<TimebarStyleProps['onChange']>[0] = this.timebar.values,
|
|
351
|
+
) {
|
|
352
|
+
const { filter } = this.options;
|
|
353
|
+
if (filter) filter(values);
|
|
354
|
+
else this.filter(values);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
private filter(values: Parameters<TimebarStyleProps['onChange']>[0]) {
|
|
358
|
+
// cache data
|
|
359
|
+
if (
|
|
360
|
+
!this.graphDataCache ||
|
|
361
|
+
(this.graphDataCache.nodes.length === 0 &&
|
|
362
|
+
this.graphDataCache.edges.length === 0)
|
|
363
|
+
) {
|
|
364
|
+
this.graphDataCache = deepMix({}, this.data);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const { filterType, filterItemTypes, shouldIgnore, getTimeFromItem } =
|
|
368
|
+
this.options;
|
|
369
|
+
|
|
370
|
+
const isTimeInValues = (time: number | Date) => {
|
|
371
|
+
if (Array.isArray(values)) {
|
|
372
|
+
return time >= values[0] && time <= values[1];
|
|
373
|
+
}
|
|
374
|
+
return time === values;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* store which items to be existed and exited
|
|
379
|
+
* if modify, enter item will be added, exit item will be removed
|
|
380
|
+
* if visibility, enter item will be shown, exit item will be hidden
|
|
381
|
+
*/
|
|
382
|
+
const state: STATE = {
|
|
383
|
+
nodes: { enter: [], exit: [] },
|
|
384
|
+
edges: { enter: [], exit: [] },
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const filterByType = (type: ItemType) => {
|
|
388
|
+
const key = `${type}s`;
|
|
389
|
+
if (!(key in this.data)) return;
|
|
390
|
+
|
|
391
|
+
const items = this.graphDataCache[key];
|
|
392
|
+
items.forEach((item) => {
|
|
393
|
+
const queryItem =
|
|
394
|
+
type === 'node'
|
|
395
|
+
? this.graph.getNodeData(item.id)
|
|
396
|
+
: this.graph.getEdgeData(item.id);
|
|
397
|
+
const time = getTimeFromItem(item, type);
|
|
398
|
+
const isItemExists = queryItem !== undefined;
|
|
399
|
+
const isItemVisible = queryItem && this.graph.getItemVisible(item.id);
|
|
400
|
+
|
|
401
|
+
const isEdgeDangling = () => {
|
|
402
|
+
if (type !== 'edge') return false;
|
|
403
|
+
const { source, target } = item as EdgeModel;
|
|
404
|
+
// enter nodes and current nodes
|
|
405
|
+
const nodes = [...state.nodes.enter, ...this.data.nodes];
|
|
406
|
+
const isSourceExists = nodes.find((n) => n.id === source);
|
|
407
|
+
const isTargetExists = nodes.find((n) => n.id === target);
|
|
408
|
+
return !isSourceExists || !isTargetExists;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
const addItem = () => {
|
|
412
|
+
if (filterType === 'modify' && !isItemExists) {
|
|
413
|
+
state[key].enter.push(item);
|
|
414
|
+
} else if (filterType === 'visibility' && !isItemVisible) {
|
|
415
|
+
state[key].enter.push(item);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
const removeItem = () => {
|
|
420
|
+
if (filterType === 'modify' && isItemExists) {
|
|
421
|
+
state[key].exit.push(item);
|
|
422
|
+
} else if (filterType === 'visibility' && isItemVisible) {
|
|
423
|
+
state[key].exit.push(item);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
if (isEdgeDangling()) return;
|
|
428
|
+
if (!filterItemTypes.includes(type)) addItem();
|
|
429
|
+
// if time is undefined, always enter
|
|
430
|
+
else if (time === undefined) addItem();
|
|
431
|
+
// ignore, push to enter
|
|
432
|
+
else if (shouldIgnore?.(item, type, values)) addItem();
|
|
433
|
+
// time in range, push to enter
|
|
434
|
+
else if (isTimeInValues(time)) addItem();
|
|
435
|
+
// push to exit
|
|
436
|
+
else if (this.data[key].find(({ id }) => id === item.id)) removeItem();
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
this.itemTypes.forEach((type) => filterByType(type));
|
|
441
|
+
|
|
442
|
+
this.mutateGraph(state);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
private mutateGraph(state: STATE) {
|
|
446
|
+
const { filterType } = this.options;
|
|
447
|
+
const mutateByType = (type: ItemType) => {
|
|
448
|
+
const { enter, exit } = state[`${type}s`];
|
|
449
|
+
|
|
450
|
+
if (filterType === 'modify') {
|
|
451
|
+
this.graph.addData(type, enter);
|
|
452
|
+
this.graph.removeData(
|
|
453
|
+
type,
|
|
454
|
+
exit.map((n) => n.id),
|
|
455
|
+
);
|
|
456
|
+
} else {
|
|
457
|
+
this.graph.showItem(enter.map((e) => e.id));
|
|
458
|
+
this.graph.hideItem(exit.map((e) => e.id));
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
const preventConsoleError = (callback: () => void) => {
|
|
463
|
+
const originError = console.error;
|
|
464
|
+
console.error = () => {};
|
|
465
|
+
callback?.();
|
|
466
|
+
console.error = originError;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
preventConsoleError(() => {
|
|
470
|
+
this.itemTypes.forEach((type) => mutateByType(type));
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
@@ -6,3 +6,5 @@ export type { MenuConfig } from './menu';
|
|
|
6
6
|
export type { MiniMapConfig } from './minimap';
|
|
7
7
|
export type { ToolbarConfig } from './toolbar';
|
|
8
8
|
export type { TooltipConfig } from './tooltip';
|
|
9
|
+
export type { TimebarConfig } from './timebar';
|
|
10
|
+
export type { SnapLineConfig } from './snapline';
|
package/src/stdlib/theme/dark.ts
CHANGED
|
@@ -7,6 +7,7 @@ const textColor = 'rgba(255,255,255,0.85)';
|
|
|
7
7
|
const nodeColor = 'rgb(34,126,255)';
|
|
8
8
|
const edgeColor = 'rgb(153, 173, 209)';
|
|
9
9
|
const comboFill = 'rgb(253, 253, 253)';
|
|
10
|
+
const comboStroke = 'rgba(153,173,209,1)';
|
|
10
11
|
const disabledFill = '#D0E4FF';
|
|
11
12
|
|
|
12
13
|
const edgeMainStroke = '#637088';
|
|
@@ -105,7 +106,7 @@ export const DarkTheme = {
|
|
|
105
106
|
},
|
|
106
107
|
haloShape: {
|
|
107
108
|
opacity: 0.45,
|
|
108
|
-
lineWidth:
|
|
109
|
+
lineWidth: 12,
|
|
109
110
|
zIndex: -1,
|
|
110
111
|
pointerEvents: 'none',
|
|
111
112
|
visible: true,
|
|
@@ -118,7 +119,7 @@ export const DarkTheme = {
|
|
|
118
119
|
},
|
|
119
120
|
haloShape: {
|
|
120
121
|
opacity: 0.25,
|
|
121
|
-
lineWidth:
|
|
122
|
+
lineWidth: 12,
|
|
122
123
|
zIndex: -1,
|
|
123
124
|
pointerEvents: 'none',
|
|
124
125
|
visible: true,
|
|
@@ -301,6 +302,23 @@ export const DarkTheme = {
|
|
|
301
302
|
height: 10,
|
|
302
303
|
padding: [25, 20, 15, 20],
|
|
303
304
|
},
|
|
305
|
+
labelShape: {
|
|
306
|
+
...DEFAULT_TEXT_STYLE,
|
|
307
|
+
fill: textColor,
|
|
308
|
+
opacity: 0.85,
|
|
309
|
+
position: 'bottom',
|
|
310
|
+
zIndex: 2,
|
|
311
|
+
lod: 0,
|
|
312
|
+
maxLines: 1,
|
|
313
|
+
},
|
|
314
|
+
labelBackgroundShape: {
|
|
315
|
+
padding: [2, 4, 2, 4],
|
|
316
|
+
lineWidth: 0,
|
|
317
|
+
fill: '#000',
|
|
318
|
+
opacity: 0.75,
|
|
319
|
+
zIndex: 1,
|
|
320
|
+
lod: 0,
|
|
321
|
+
},
|
|
304
322
|
},
|
|
305
323
|
selected: {
|
|
306
324
|
keyShape: {
|
|
@@ -311,12 +329,30 @@ export const DarkTheme = {
|
|
|
311
329
|
labelShape: {
|
|
312
330
|
fontWeight: 700,
|
|
313
331
|
},
|
|
332
|
+
haloShape: {
|
|
333
|
+
opacity: 0.25,
|
|
334
|
+
lineWidth: 12,
|
|
335
|
+
pointerEvents: 'none',
|
|
336
|
+
zIndex: -1,
|
|
337
|
+
visible: true,
|
|
338
|
+
stroke: comboStroke,
|
|
339
|
+
droppable: false,
|
|
340
|
+
},
|
|
314
341
|
},
|
|
315
342
|
active: {
|
|
316
343
|
keyShape: {
|
|
317
344
|
stroke: nodeStroke,
|
|
318
345
|
lineWidth: 1,
|
|
319
346
|
},
|
|
347
|
+
haloShape: {
|
|
348
|
+
opacity: 0.25,
|
|
349
|
+
lineWidth: 12,
|
|
350
|
+
pointerEvents: 'none',
|
|
351
|
+
zIndex: -1,
|
|
352
|
+
visible: true,
|
|
353
|
+
stroke: comboStroke,
|
|
354
|
+
droppable: false,
|
|
355
|
+
},
|
|
320
356
|
},
|
|
321
357
|
highlight: {
|
|
322
358
|
keyShape: {
|
|
@@ -334,6 +370,9 @@ export const DarkTheme = {
|
|
|
334
370
|
fill: comboFill,
|
|
335
371
|
lineWidth: 1,
|
|
336
372
|
},
|
|
373
|
+
labelShape: {
|
|
374
|
+
opacity: 0.65,
|
|
375
|
+
},
|
|
337
376
|
},
|
|
338
377
|
disable: {
|
|
339
378
|
keyShape: {
|
|
@@ -344,6 +383,31 @@ export const DarkTheme = {
|
|
|
344
383
|
fill: disabledFill,
|
|
345
384
|
opacity: 0.25,
|
|
346
385
|
},
|
|
386
|
+
labelShape: {
|
|
387
|
+
opacity: 0.25,
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
collapsed: {
|
|
391
|
+
keyShape: {
|
|
392
|
+
...DEFAULT_SHAPE_STYLE,
|
|
393
|
+
fill: comboFill,
|
|
394
|
+
lineWidth: 1,
|
|
395
|
+
stroke: comboStroke,
|
|
396
|
+
// the collapsed size
|
|
397
|
+
r: 16,
|
|
398
|
+
width: 48,
|
|
399
|
+
height: 24,
|
|
400
|
+
padding: [25, 20, 15, 20],
|
|
401
|
+
},
|
|
402
|
+
iconShape: {
|
|
403
|
+
...DEFAULT_TEXT_STYLE,
|
|
404
|
+
fill: comboStroke,
|
|
405
|
+
fontSize: 12,
|
|
406
|
+
zIndex: 1,
|
|
407
|
+
lod: -1,
|
|
408
|
+
contentType: 'childCount',
|
|
409
|
+
visible: true,
|
|
410
|
+
},
|
|
347
411
|
},
|
|
348
412
|
},
|
|
349
413
|
],
|
|
@@ -108,7 +108,7 @@ export const LightTheme = {
|
|
|
108
108
|
},
|
|
109
109
|
haloShape: {
|
|
110
110
|
opacity: 0.25,
|
|
111
|
-
lineWidth:
|
|
111
|
+
lineWidth: 12,
|
|
112
112
|
pointerEvents: 'none',
|
|
113
113
|
zIndex: -1,
|
|
114
114
|
visible: true,
|
|
@@ -121,7 +121,7 @@ export const LightTheme = {
|
|
|
121
121
|
},
|
|
122
122
|
haloShape: {
|
|
123
123
|
opacity: 0.25,
|
|
124
|
-
lineWidth:
|
|
124
|
+
lineWidth: 12,
|
|
125
125
|
pointerEvents: 'none',
|
|
126
126
|
zIndex: -1,
|
|
127
127
|
visible: true,
|
|
@@ -328,7 +328,7 @@ export const LightTheme = {
|
|
|
328
328
|
},
|
|
329
329
|
haloShape: {
|
|
330
330
|
opacity: 0.25,
|
|
331
|
-
lineWidth:
|
|
331
|
+
lineWidth: 12,
|
|
332
332
|
pointerEvents: 'none',
|
|
333
333
|
zIndex: -1,
|
|
334
334
|
visible: true,
|
|
@@ -343,7 +343,7 @@ export const LightTheme = {
|
|
|
343
343
|
},
|
|
344
344
|
haloShape: {
|
|
345
345
|
opacity: 0.25,
|
|
346
|
-
lineWidth:
|
|
346
|
+
lineWidth: 12,
|
|
347
347
|
pointerEvents: 'none',
|
|
348
348
|
zIndex: -1,
|
|
349
349
|
visible: true,
|
package/src/types/common.ts
CHANGED