@antv/g6 5.0.0-alpha.8 → 5.0.0-beta.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/dist/g6.min.js +6 -19
- package/esm/api-doc/behaviors.d.ts +2 -0
- package/esm/api-doc/behaviors.js +2 -0
- package/esm/api-doc/behaviors.js.map +1 -0
- package/esm/api-doc/graph.d.ts +4 -0
- package/esm/api-doc/graph.js +4 -0
- package/esm/api-doc/graph.js.map +1 -0
- package/esm/api-doc/item.d.ts +9 -0
- package/esm/api-doc/item.js +3 -0
- package/esm/api-doc/item.js.map +1 -0
- package/esm/api-doc/layout.d.ts +1 -0
- package/esm/api-doc/layout.js +2 -0
- package/esm/api-doc/layout.js.map +1 -0
- package/esm/api-doc/plugins.d.ts +1 -0
- package/esm/api-doc/plugins.js +2 -0
- package/esm/api-doc/plugins.js.map +1 -0
- package/esm/api-doc/types.d.ts +0 -0
- package/esm/api-doc/types.js +3 -0
- package/esm/api-doc/types.js.map +1 -0
- package/esm/api-doc/util.d.ts +3 -0
- package/esm/api-doc/util.js +4 -0
- package/esm/api-doc/util.js.map +1 -0
- package/esm/constant/shape.d.ts +7 -14
- package/esm/constant/shape.js +1 -0
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +215 -95
- package/esm/index.js +11 -4
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +79 -2
- package/esm/item/combo.js +186 -2
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +15 -12
- package/esm/item/edge.js +40 -14
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +12 -10
- package/esm/item/item.js +155 -83
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +32 -23
- package/esm/item/node.js +70 -49
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +28 -4
- package/esm/runtime/controller/data.js +562 -173
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.d.ts +1 -0
- package/esm/runtime/controller/interaction.js +23 -8
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +47 -5
- package/esm/runtime/controller/item.js +712 -122
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +4 -1
- package/esm/runtime/controller/layout.js +109 -13
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.d.ts +11 -0
- package/esm/runtime/controller/plugin.js +39 -6
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/controller/theme.js +8 -4
- package/esm/runtime/controller/theme.js.map +1 -1
- package/esm/runtime/graph.d.ts +226 -47
- package/esm/runtime/graph.js +710 -90
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +2 -3
- package/esm/stdlib/behavior/activate-relations.js +13 -9
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +3 -4
- package/esm/stdlib/behavior/brush-select.js +2 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +5 -3
- package/esm/stdlib/behavior/click-select.js +21 -7
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js +35 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js +69 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/drag-canvas.js +15 -11
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +111 -0
- package/esm/stdlib/behavior/drag-combo.js +380 -0
- package/esm/stdlib/behavior/drag-combo.js.map +1 -0
- package/esm/stdlib/behavior/drag-node.d.ts +33 -13
- package/esm/stdlib/behavior/drag-node.js +252 -67
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +2 -1
- package/esm/stdlib/behavior/hover-activate.js +2 -0
- package/esm/stdlib/behavior/hover-activate.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +15 -0
- package/esm/stdlib/behavior/index.js +16 -0
- package/esm/stdlib/behavior/index.js.map +1 -0
- package/esm/stdlib/behavior/lasso-select.d.ts +7 -3
- package/esm/stdlib/behavior/lasso-select.js +2 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/orbit-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/rotate-canvas-3d.js +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/track-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/types.d.ts +13 -0
- package/esm/stdlib/behavior/types.js +2 -0
- package/esm/stdlib/behavior/types.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas-3d.js +7 -7
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas.js +20 -18
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/index.d.ts +3 -0
- package/esm/stdlib/data/index.js +4 -0
- package/esm/stdlib/data/index.js.map +1 -0
- package/esm/stdlib/data/mapNodeSize.d.ts +12 -0
- package/esm/stdlib/data/mapNodeSize.js +43 -0
- package/esm/stdlib/data/mapNodeSize.js.map +1 -0
- package/esm/stdlib/data/transformV4Data.d.ts +9 -0
- package/esm/stdlib/data/transformV4Data.js +142 -0
- package/esm/stdlib/data/transformV4Data.js.map +1 -0
- package/esm/stdlib/data/validateData.d.ts +9 -0
- package/esm/stdlib/data/validateData.js +98 -0
- package/esm/stdlib/data/validateData.js.map +1 -0
- package/esm/stdlib/index.d.ts +115 -49
- package/esm/stdlib/index.js +156 -37
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/combo/circle.d.ts +29 -0
- package/esm/stdlib/item/combo/circle.js +56 -0
- package/esm/stdlib/item/combo/circle.js.map +1 -0
- package/esm/stdlib/item/combo/index.d.ts +2 -0
- package/esm/stdlib/item/combo/index.js +3 -0
- package/esm/stdlib/item/combo/index.js.map +1 -0
- package/esm/stdlib/item/combo/rect.d.ts +31 -0
- package/esm/stdlib/item/combo/rect.js +65 -0
- package/esm/stdlib/item/combo/rect.js.map +1 -0
- package/esm/stdlib/item/edge/base.d.ts +12 -3
- package/esm/stdlib/item/edge/base.js +39 -5
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js +56 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-vertical.js +56 -0
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/esm/stdlib/item/edge/cubic.d.ts +59 -0
- package/esm/stdlib/item/edge/cubic.js +116 -0
- package/esm/stdlib/item/edge/cubic.js.map +1 -0
- package/esm/stdlib/item/edge/index.d.ts +6 -0
- package/esm/stdlib/item/edge/index.js +6 -0
- package/esm/stdlib/item/edge/index.js.map +1 -1
- package/esm/stdlib/item/edge/line.d.ts +1 -1
- package/esm/stdlib/item/edge/line.js +16 -1
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/loop.d.ts +32 -0
- package/esm/stdlib/item/edge/loop.js +115 -0
- package/esm/stdlib/item/edge/loop.js.map +1 -0
- package/esm/stdlib/item/edge/polyline.d.ts +44 -0
- package/esm/stdlib/item/edge/polyline.js +92 -0
- package/esm/stdlib/item/edge/polyline.js.map +1 -0
- package/esm/stdlib/item/edge/quadratic.d.ts +40 -0
- package/esm/stdlib/item/edge/quadratic.js +78 -0
- package/esm/stdlib/item/edge/quadratic.js.map +1 -0
- package/esm/stdlib/item/node/base.d.ts +83 -38
- package/esm/stdlib/item/node/base.js +100 -15
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.js +1 -1
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/circle.js +5 -5
- package/esm/stdlib/item/node/circle.js.map +1 -1
- package/esm/stdlib/item/node/diamond.d.ts +32 -0
- package/esm/stdlib/item/node/diamond.js +79 -0
- package/esm/stdlib/item/node/diamond.js.map +1 -0
- package/esm/stdlib/item/node/donut.d.ts +70 -0
- package/esm/stdlib/item/node/donut.js +207 -0
- package/esm/stdlib/item/node/donut.js.map +1 -0
- package/esm/stdlib/item/node/ellipse.d.ts +32 -0
- package/esm/stdlib/item/node/ellipse.js +71 -0
- package/esm/stdlib/item/node/ellipse.js.map +1 -0
- package/esm/stdlib/item/node/hexagon.d.ts +33 -0
- package/esm/stdlib/item/node/hexagon.js +102 -0
- package/esm/stdlib/item/node/hexagon.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +8 -0
- package/esm/stdlib/item/node/index.js +8 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/item/node/modelRect.d.ts +61 -0
- package/esm/stdlib/item/node/modelRect.js +186 -0
- package/esm/stdlib/item/node/modelRect.js.map +1 -0
- package/esm/stdlib/item/node/rect.d.ts +32 -0
- package/esm/stdlib/item/node/rect.js +75 -0
- package/esm/stdlib/item/node/rect.js.map +1 -0
- package/esm/stdlib/item/node/star.d.ts +34 -0
- package/esm/stdlib/item/node/star.js +115 -0
- package/esm/stdlib/item/node/star.js.map +1 -0
- package/esm/stdlib/item/node/triangle.d.ts +44 -0
- package/esm/stdlib/item/node/triangle.js +177 -0
- package/esm/stdlib/item/node/triangle.js.map +1 -0
- package/esm/stdlib/plugin/fisheye/index.d.ts +130 -0
- package/esm/stdlib/plugin/fisheye/index.js +488 -0
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +36 -0
- package/esm/stdlib/plugin/grid/index.js +81 -0
- package/esm/stdlib/plugin/grid/index.js.map +1 -0
- package/esm/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/combo-command.js +21 -0
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -0
- package/esm/stdlib/plugin/history/command.d.ts +18 -0
- package/esm/stdlib/plugin/history/command.js +51 -0
- package/esm/stdlib/plugin/history/command.js.map +1 -0
- package/esm/stdlib/plugin/history/index.d.ts +112 -0
- package/esm/stdlib/plugin/history/index.js +275 -0
- package/esm/stdlib/plugin/history/index.js.map +1 -0
- package/esm/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/esm/stdlib/plugin/history/item-data-command.js +63 -0
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/esm/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js +21 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/state-updated-command.js +20 -0
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js +23 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/esm/stdlib/plugin/hull/bubbleset.js +592 -0
- package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/esm/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/esm/stdlib/plugin/hull/convexHull.js +56 -0
- package/esm/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/esm/stdlib/plugin/hull/hullComponent.js +382 -0
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/esm/stdlib/plugin/hull/index.d.ts +59 -0
- package/esm/stdlib/plugin/hull/index.js +161 -0
- package/esm/stdlib/plugin/hull/index.js.map +1 -0
- package/esm/stdlib/plugin/hull/types.d.ts +15 -0
- package/esm/stdlib/plugin/hull/types.js +2 -0
- package/esm/stdlib/plugin/hull/types.js.map +1 -0
- package/esm/stdlib/plugin/hull/util.d.ts +77 -0
- package/esm/stdlib/plugin/hull/util.js +401 -0
- package/esm/stdlib/plugin/hull/util.js.map +1 -0
- package/esm/stdlib/plugin/index.d.ts +8 -0
- package/esm/stdlib/plugin/index.js +9 -0
- package/esm/stdlib/plugin/index.js.map +1 -0
- package/esm/stdlib/plugin/legend/index.d.ts +45 -3
- package/esm/stdlib/plugin/legend/index.js +47 -42
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +55 -0
- package/esm/stdlib/plugin/menu/index.js +237 -0
- package/esm/stdlib/plugin/menu/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +11 -3
- package/esm/stdlib/plugin/minimap/index.js +19 -21
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/esm/stdlib/plugin/toolbar/index.js +215 -0
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -0
- package/esm/stdlib/plugin/tooltip/index.d.ts +96 -0
- package/esm/stdlib/plugin/tooltip/index.js +378 -0
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -0
- package/esm/stdlib/plugin/types.d.ts +8 -0
- package/esm/stdlib/plugin/types.js +2 -0
- package/esm/stdlib/plugin/types.js.map +1 -0
- package/esm/stdlib/theme/dark.d.ts +1 -2
- package/esm/stdlib/theme/dark.js +13 -1
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/index.d.ts +2 -0
- package/esm/stdlib/theme/index.js +3 -0
- package/esm/stdlib/theme/index.js.map +1 -0
- package/esm/stdlib/theme/light.d.ts +1 -2
- package/esm/stdlib/theme/light.js +65 -10
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/stdlib/themeSolver/base.d.ts +1 -1
- package/esm/stdlib/themeSolver/base.js +1 -1
- package/esm/stdlib/themeSolver/base.js.map +1 -1
- package/esm/stdlib/themeSolver/index.d.ts +3 -0
- package/esm/stdlib/themeSolver/index.js +4 -0
- package/esm/stdlib/themeSolver/index.js.map +1 -0
- package/esm/stdlib/themeSolver/spec.d.ts +2 -4
- package/esm/stdlib/themeSolver/spec.js +2 -2
- package/esm/stdlib/themeSolver/spec.js.map +1 -1
- package/esm/stdlib/themeSolver/subject.d.ts +2 -4
- package/esm/stdlib/themeSolver/subject.js +2 -2
- package/esm/stdlib/themeSolver/subject.js.map +1 -1
- package/esm/types/behavior.js.map +1 -1
- package/esm/types/combo.d.ts +51 -3
- package/esm/types/common.d.ts +10 -0
- package/esm/types/data.d.ts +13 -7
- package/esm/types/edge.d.ts +19 -5
- package/esm/types/event.d.ts +9 -1
- package/esm/types/event.js +8 -8
- package/esm/types/event.js.map +1 -1
- package/esm/types/graph.d.ts +169 -20
- package/esm/types/history.d.ts +28 -0
- package/esm/types/history.js +6 -0
- package/esm/types/history.js.map +1 -0
- package/esm/types/hook.d.ts +33 -6
- package/esm/types/index.d.ts +11 -5
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +14 -8
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +4 -1
- package/esm/types/loop.d.ts +21 -0
- package/esm/types/loop.js +12 -0
- package/esm/types/loop.js.map +1 -0
- package/esm/types/node.d.ts +90 -10
- package/esm/types/plugin.d.ts +4 -0
- package/esm/types/plugin.js +1 -1
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/spec.d.ts +26 -9
- package/esm/types/theme.d.ts +76 -10
- package/esm/types/theme.js +1 -2
- package/esm/types/theme.js.map +1 -1
- package/esm/util/animate.d.ts +2 -2
- package/esm/util/animate.js +52 -17
- package/esm/util/animate.js.map +1 -1
- package/esm/util/array.d.ts +8 -0
- package/esm/util/array.js +11 -1
- package/esm/util/array.js.map +1 -1
- package/esm/util/arrow.d.ts +17 -0
- package/esm/util/arrow.js +56 -0
- package/esm/util/arrow.js.map +1 -0
- package/esm/util/bbox.d.ts +106 -0
- package/esm/util/bbox.js +255 -0
- package/esm/util/bbox.js.map +1 -0
- package/esm/util/behavior.d.ts +2 -0
- package/esm/util/behavior.js +12 -0
- package/esm/util/behavior.js.map +1 -0
- package/esm/util/canvas.d.ts +1 -2
- package/esm/util/canvas.js +11 -20
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/data.d.ts +96 -0
- package/esm/util/data.js +262 -0
- package/esm/util/data.js.map +1 -0
- package/esm/util/event.d.ts +29 -1
- package/esm/util/event.js +70 -0
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +8 -2
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +41 -3
- package/esm/util/index.js +20 -1
- package/esm/util/index.js.map +1 -1
- package/esm/util/item.d.ts +2 -1
- package/esm/util/item.js +38 -13
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +40 -0
- package/esm/util/layout.js +160 -0
- package/esm/util/layout.js.map +1 -0
- package/esm/util/loop.d.ts +37 -0
- package/esm/util/loop.js +104 -0
- package/esm/util/loop.js.map +1 -0
- package/esm/util/mapper.js +4 -9
- package/esm/util/mapper.js.map +1 -1
- package/esm/util/math.d.ts +15 -0
- package/esm/util/math.js +14 -0
- package/esm/util/math.js.map +1 -1
- package/esm/util/mock.d.ts +30 -0
- package/esm/util/mock.js +69 -0
- package/esm/util/mock.js.map +1 -0
- package/esm/util/path.d.ts +11 -0
- package/esm/util/path.js +44 -0
- package/esm/util/path.js.map +1 -0
- package/esm/util/point.d.ts +24 -2
- package/esm/util/point.js +27 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +113 -0
- package/esm/util/polyline.js +505 -0
- package/esm/util/polyline.js.map +1 -0
- package/esm/util/router.d.ts +31 -0
- package/esm/util/router.js +380 -0
- package/esm/util/router.js.map +1 -0
- package/esm/util/shape.d.ts +39 -4
- package/esm/util/shape.js +118 -2
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.d.ts +1 -1
- package/esm/util/shape3d.js +12 -6
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/type.d.ts +6 -0
- package/esm/util/type.js +7 -1
- package/esm/util/type.js.map +1 -1
- package/esm/util/zoom.d.ts +2 -2
- package/esm/util/zoom.js +6 -2
- package/esm/util/zoom.js.map +1 -1
- package/lib/api-doc/behaviors.d.ts +2 -0
- package/lib/api-doc/behaviors.js +18 -0
- package/lib/api-doc/behaviors.js.map +1 -0
- package/lib/api-doc/graph.d.ts +4 -0
- package/lib/api-doc/graph.js +11 -0
- package/lib/api-doc/graph.js.map +1 -0
- package/lib/api-doc/item.d.ts +9 -0
- package/lib/api-doc/item.js +21 -0
- package/lib/api-doc/item.js.map +1 -0
- package/lib/api-doc/layout.d.ts +1 -0
- package/lib/api-doc/layout.js +3 -0
- package/lib/api-doc/layout.js.map +1 -0
- package/lib/api-doc/plugins.d.ts +1 -0
- package/lib/api-doc/plugins.js +18 -0
- package/lib/api-doc/plugins.js.map +1 -0
- package/lib/api-doc/types.d.ts +0 -0
- package/lib/api-doc/types.js +3 -0
- package/lib/api-doc/types.js.map +1 -0
- package/lib/api-doc/util.d.ts +3 -0
- package/lib/api-doc/util.js +10 -0
- package/lib/api-doc/util.js.map +1 -0
- package/lib/constant/shape.d.ts +7 -14
- package/lib/constant/shape.js +1 -0
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +215 -95
- package/lib/index.js +13 -3
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +79 -2
- package/lib/item/combo.js +186 -2
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +15 -12
- package/lib/item/edge.js +40 -14
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +12 -10
- package/lib/item/item.js +153 -81
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +32 -23
- package/lib/item/node.js +70 -49
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +28 -4
- package/lib/runtime/controller/data.js +561 -172
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.d.ts +1 -0
- package/lib/runtime/controller/interaction.js +22 -7
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +47 -5
- package/lib/runtime/controller/item.js +710 -120
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +4 -1
- package/lib/runtime/controller/layout.js +132 -13
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.d.ts +11 -0
- package/lib/runtime/controller/plugin.js +39 -6
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/controller/theme.js +8 -4
- package/lib/runtime/controller/theme.js.map +1 -1
- package/lib/runtime/graph.d.ts +226 -47
- package/lib/runtime/graph.js +709 -89
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +2 -3
- package/lib/stdlib/behavior/activate-relations.js +14 -9
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +3 -4
- package/lib/stdlib/behavior/brush-select.js +3 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +5 -3
- package/lib/stdlib/behavior/click-select.js +22 -7
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js +39 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js +73 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/drag-canvas.js +16 -11
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +111 -0
- package/lib/stdlib/behavior/drag-combo.js +384 -0
- package/lib/stdlib/behavior/drag-combo.js.map +1 -0
- package/lib/stdlib/behavior/drag-node.d.ts +33 -13
- package/lib/stdlib/behavior/drag-node.js +252 -66
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +2 -1
- package/lib/stdlib/behavior/hover-activate.js +2 -0
- package/lib/stdlib/behavior/hover-activate.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +15 -0
- package/lib/stdlib/behavior/index.js +32 -0
- package/lib/stdlib/behavior/index.js.map +1 -0
- package/lib/stdlib/behavior/lasso-select.d.ts +7 -3
- package/lib/stdlib/behavior/lasso-select.js +4 -6
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/orbit-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/rotate-canvas-3d.js +2 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/track-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/types.d.ts +13 -0
- package/lib/stdlib/behavior/types.js +3 -0
- package/lib/stdlib/behavior/types.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas-3d.js +8 -7
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas.js +21 -18
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/index.d.ts +3 -0
- package/lib/stdlib/data/index.js +20 -0
- package/lib/stdlib/data/index.js.map +1 -0
- package/lib/stdlib/data/mapNodeSize.d.ts +12 -0
- package/lib/stdlib/data/mapNodeSize.js +47 -0
- package/lib/stdlib/data/mapNodeSize.js.map +1 -0
- package/lib/stdlib/data/transformV4Data.d.ts +9 -0
- package/lib/stdlib/data/transformV4Data.js +146 -0
- package/lib/stdlib/data/transformV4Data.js.map +1 -0
- package/lib/stdlib/data/validateData.d.ts +9 -0
- package/lib/stdlib/data/validateData.js +102 -0
- package/lib/stdlib/data/validateData.js.map +1 -0
- package/lib/stdlib/index.d.ts +115 -49
- package/lib/stdlib/index.js +190 -47
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/combo/circle.d.ts +29 -0
- package/lib/stdlib/item/combo/circle.js +60 -0
- package/lib/stdlib/item/combo/circle.js.map +1 -0
- package/lib/stdlib/item/combo/index.d.ts +2 -0
- package/lib/stdlib/item/combo/index.js +19 -0
- package/lib/stdlib/item/combo/index.js.map +1 -0
- package/lib/stdlib/item/combo/rect.d.ts +31 -0
- package/lib/stdlib/item/combo/rect.js +69 -0
- package/lib/stdlib/item/combo/rect.js.map +1 -0
- package/lib/stdlib/item/edge/base.d.ts +12 -3
- package/lib/stdlib/item/edge/base.js +38 -4
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js +60 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-vertical.js +60 -0
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/lib/stdlib/item/edge/cubic.d.ts +59 -0
- package/lib/stdlib/item/edge/cubic.js +120 -0
- package/lib/stdlib/item/edge/cubic.js.map +1 -0
- package/lib/stdlib/item/edge/index.d.ts +6 -0
- package/lib/stdlib/item/edge/index.js +6 -0
- package/lib/stdlib/item/edge/index.js.map +1 -1
- package/lib/stdlib/item/edge/line.d.ts +1 -1
- package/lib/stdlib/item/edge/line.js +16 -1
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/loop.d.ts +32 -0
- package/lib/stdlib/item/edge/loop.js +119 -0
- package/lib/stdlib/item/edge/loop.js.map +1 -0
- package/lib/stdlib/item/edge/polyline.d.ts +44 -0
- package/lib/stdlib/item/edge/polyline.js +96 -0
- package/lib/stdlib/item/edge/polyline.js.map +1 -0
- package/lib/stdlib/item/edge/quadratic.d.ts +40 -0
- package/lib/stdlib/item/edge/quadratic.js +82 -0
- package/lib/stdlib/item/edge/quadratic.js.map +1 -0
- package/lib/stdlib/item/node/base.d.ts +83 -38
- package/lib/stdlib/item/node/base.js +100 -15
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.js +1 -1
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/circle.js +5 -5
- package/lib/stdlib/item/node/circle.js.map +1 -1
- package/lib/stdlib/item/node/diamond.d.ts +32 -0
- package/lib/stdlib/item/node/diamond.js +83 -0
- package/lib/stdlib/item/node/diamond.js.map +1 -0
- package/lib/stdlib/item/node/donut.d.ts +70 -0
- package/lib/stdlib/item/node/donut.js +211 -0
- package/lib/stdlib/item/node/donut.js.map +1 -0
- package/lib/stdlib/item/node/ellipse.d.ts +32 -0
- package/lib/stdlib/item/node/ellipse.js +75 -0
- package/lib/stdlib/item/node/ellipse.js.map +1 -0
- package/lib/stdlib/item/node/hexagon.d.ts +33 -0
- package/lib/stdlib/item/node/hexagon.js +106 -0
- package/lib/stdlib/item/node/hexagon.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +8 -0
- package/lib/stdlib/item/node/index.js +8 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/item/node/modelRect.d.ts +61 -0
- package/lib/stdlib/item/node/modelRect.js +190 -0
- package/lib/stdlib/item/node/modelRect.js.map +1 -0
- package/lib/stdlib/item/node/rect.d.ts +32 -0
- package/lib/stdlib/item/node/rect.js +79 -0
- package/lib/stdlib/item/node/rect.js.map +1 -0
- package/lib/stdlib/item/node/star.d.ts +34 -0
- package/lib/stdlib/item/node/star.js +119 -0
- package/lib/stdlib/item/node/star.js.map +1 -0
- package/lib/stdlib/item/node/triangle.d.ts +44 -0
- package/lib/stdlib/item/node/triangle.js +181 -0
- package/lib/stdlib/item/node/triangle.js.map +1 -0
- package/lib/stdlib/plugin/fisheye/index.d.ts +130 -0
- package/lib/stdlib/plugin/fisheye/index.js +492 -0
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +36 -0
- package/lib/stdlib/plugin/grid/index.js +85 -0
- package/lib/stdlib/plugin/grid/index.js.map +1 -0
- package/lib/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/combo-command.js +25 -0
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -0
- package/lib/stdlib/plugin/history/command.d.ts +18 -0
- package/lib/stdlib/plugin/history/command.js +54 -0
- package/lib/stdlib/plugin/history/command.js.map +1 -0
- package/lib/stdlib/plugin/history/index.d.ts +112 -0
- package/lib/stdlib/plugin/history/index.js +283 -0
- package/lib/stdlib/plugin/history/index.js.map +1 -0
- package/lib/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/lib/stdlib/plugin/history/item-data-command.js +67 -0
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/lib/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js +25 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/state-updated-command.js +24 -0
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js +27 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/lib/stdlib/plugin/hull/bubbleset.js +596 -0
- package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/lib/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/lib/stdlib/plugin/hull/convexHull.js +61 -0
- package/lib/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/lib/stdlib/plugin/hull/hullComponent.js +385 -0
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/lib/stdlib/plugin/hull/index.d.ts +59 -0
- package/lib/stdlib/plugin/hull/index.js +167 -0
- package/lib/stdlib/plugin/hull/index.js.map +1 -0
- package/lib/stdlib/plugin/hull/types.d.ts +15 -0
- package/lib/stdlib/plugin/hull/types.js +3 -0
- package/lib/stdlib/plugin/hull/types.js.map +1 -0
- package/lib/stdlib/plugin/hull/util.d.ts +77 -0
- package/lib/stdlib/plugin/hull/util.js +419 -0
- package/lib/stdlib/plugin/hull/util.js.map +1 -0
- package/lib/stdlib/plugin/index.d.ts +8 -0
- package/lib/stdlib/plugin/index.js +25 -0
- package/lib/stdlib/plugin/index.js.map +1 -0
- package/lib/stdlib/plugin/legend/index.d.ts +45 -3
- package/lib/stdlib/plugin/legend/index.js +46 -40
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +55 -0
- package/lib/stdlib/plugin/menu/index.js +244 -0
- package/lib/stdlib/plugin/menu/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +11 -3
- package/lib/stdlib/plugin/minimap/index.js +19 -20
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/lib/stdlib/plugin/toolbar/index.js +222 -0
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -0
- package/lib/stdlib/plugin/tooltip/index.d.ts +96 -0
- package/lib/stdlib/plugin/tooltip/index.js +385 -0
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -0
- package/lib/stdlib/plugin/types.d.ts +8 -0
- package/lib/stdlib/plugin/types.js +3 -0
- package/lib/stdlib/plugin/types.js.map +1 -0
- package/lib/stdlib/theme/dark.d.ts +1 -2
- package/lib/stdlib/theme/dark.js +14 -1
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/index.d.ts +2 -0
- package/lib/stdlib/theme/index.js +19 -0
- package/lib/stdlib/theme/index.js.map +1 -0
- package/lib/stdlib/theme/light.d.ts +1 -2
- package/lib/stdlib/theme/light.js +66 -10
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/stdlib/themeSolver/base.d.ts +1 -1
- package/lib/stdlib/themeSolver/base.js +2 -1
- package/lib/stdlib/themeSolver/base.js.map +1 -1
- package/lib/stdlib/themeSolver/index.d.ts +3 -0
- package/lib/stdlib/themeSolver/index.js +20 -0
- package/lib/stdlib/themeSolver/index.js.map +1 -0
- package/lib/stdlib/themeSolver/spec.d.ts +2 -4
- package/lib/stdlib/themeSolver/spec.js +4 -6
- package/lib/stdlib/themeSolver/spec.js.map +1 -1
- package/lib/stdlib/themeSolver/subject.d.ts +2 -4
- package/lib/stdlib/themeSolver/subject.js +4 -4
- package/lib/stdlib/themeSolver/subject.js.map +1 -1
- package/lib/types/behavior.js.map +1 -1
- package/lib/types/combo.d.ts +51 -3
- package/lib/types/common.d.ts +10 -0
- package/lib/types/data.d.ts +13 -7
- package/lib/types/edge.d.ts +19 -5
- package/lib/types/event.d.ts +9 -1
- package/lib/types/event.js +10 -10
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +169 -20
- package/lib/types/history.d.ts +28 -0
- package/lib/types/history.js +9 -0
- package/lib/types/history.js.map +1 -0
- package/lib/types/hook.d.ts +33 -6
- package/lib/types/index.d.ts +11 -5
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +14 -8
- package/lib/types/item.js +1 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +4 -1
- package/lib/types/loop.d.ts +21 -0
- package/lib/types/loop.js +15 -0
- package/lib/types/loop.js.map +1 -0
- package/lib/types/node.d.ts +90 -10
- package/lib/types/plugin.d.ts +4 -0
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +26 -9
- package/lib/types/theme.d.ts +76 -10
- package/lib/types/theme.js +1 -2
- package/lib/types/theme.js.map +1 -1
- package/lib/util/animate.d.ts +2 -2
- package/lib/util/animate.js +52 -17
- package/lib/util/animate.js.map +1 -1
- package/lib/util/array.d.ts +8 -0
- package/lib/util/array.js +13 -2
- package/lib/util/array.js.map +1 -1
- package/lib/util/arrow.d.ts +17 -0
- package/lib/util/arrow.js +60 -0
- package/lib/util/arrow.js.map +1 -0
- package/lib/util/bbox.d.ts +106 -0
- package/lib/util/bbox.js +273 -0
- package/lib/util/bbox.js.map +1 -0
- package/lib/util/behavior.d.ts +2 -0
- package/lib/util/behavior.js +16 -0
- package/lib/util/behavior.js.map +1 -0
- package/lib/util/canvas.d.ts +1 -2
- package/lib/util/canvas.js +11 -20
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/data.d.ts +96 -0
- package/lib/util/data.js +276 -0
- package/lib/util/data.js.map +1 -0
- package/lib/util/event.d.ts +29 -1
- package/lib/util/event.js +73 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +8 -2
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +41 -3
- package/lib/util/index.js +20 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/item.d.ts +2 -1
- package/lib/util/item.js +38 -13
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +40 -0
- package/lib/util/layout.js +172 -0
- package/lib/util/layout.js.map +1 -0
- package/lib/util/loop.d.ts +37 -0
- package/lib/util/loop.js +111 -0
- package/lib/util/loop.js.map +1 -0
- package/lib/util/mapper.js +4 -9
- package/lib/util/mapper.js.map +1 -1
- package/lib/util/math.d.ts +15 -0
- package/lib/util/math.js +17 -1
- package/lib/util/math.js.map +1 -1
- package/lib/util/mock.d.ts +30 -0
- package/lib/util/mock.js +73 -0
- package/lib/util/mock.js.map +1 -0
- package/lib/util/path.d.ts +11 -0
- package/lib/util/path.js +49 -0
- package/lib/util/path.js.map +1 -0
- package/lib/util/point.d.ts +24 -2
- package/lib/util/point.js +31 -3
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +113 -0
- package/lib/util/polyline.js +524 -0
- package/lib/util/polyline.js.map +1 -0
- package/lib/util/router.d.ts +31 -0
- package/lib/util/router.js +384 -0
- package/lib/util/router.js.map +1 -0
- package/lib/util/shape.d.ts +39 -4
- package/lib/util/shape.js +122 -3
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.d.ts +1 -1
- package/lib/util/shape3d.js +11 -5
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/type.d.ts +6 -0
- package/lib/util/type.js +9 -2
- package/lib/util/type.js.map +1 -1
- package/lib/util/zoom.d.ts +2 -2
- package/lib/util/zoom.js +6 -2
- package/lib/util/zoom.js.map +1 -1
- package/package.json +42 -22
- package/src/api-doc/behaviors.ts +2 -0
- package/src/api-doc/graph.ts +4 -0
- package/src/api-doc/item.ts +43 -0
- package/src/api-doc/layout.ts +13 -0
- package/src/api-doc/plugins.ts +1 -0
- package/src/api-doc/readme.md +59 -0
- package/src/api-doc/types.ts +2 -0
- package/src/api-doc/util.ts +3 -0
- package/src/constant/shape.ts +4 -1
- package/src/index.ts +14 -4
- package/src/item/combo.ts +307 -2
- package/src/item/edge.ts +73 -24
- package/src/item/item.ts +184 -85
- package/src/item/node.ts +138 -69
- package/src/runtime/controller/data.ts +665 -191
- package/src/runtime/controller/interaction.ts +31 -7
- package/src/runtime/controller/item.ts +990 -172
- package/src/runtime/controller/layout.ts +165 -13
- package/src/runtime/controller/plugin.ts +47 -10
- package/src/runtime/controller/theme.ts +8 -4
- package/src/runtime/graph.ts +922 -144
- package/src/stdlib/behavior/activate-relations.ts +14 -11
- package/src/stdlib/behavior/brush-select.ts +4 -5
- package/src/stdlib/behavior/click-select.ts +26 -11
- package/src/stdlib/behavior/collapse-expand-combo.ts +57 -0
- package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
- package/src/stdlib/behavior/drag-canvas.ts +15 -13
- package/src/stdlib/behavior/drag-combo.ts +589 -0
- package/src/stdlib/behavior/drag-node.ts +380 -110
- package/src/stdlib/behavior/hover-activate.ts +3 -5
- package/src/stdlib/behavior/index.ts +15 -0
- package/src/stdlib/behavior/lasso-select.ts +6 -2
- package/src/stdlib/behavior/orbit-canvas-3d.ts +3 -5
- package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
- package/src/stdlib/behavior/track-canvas-3d.ts +3 -5
- package/src/stdlib/behavior/types.ts +15 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +5 -7
- package/src/stdlib/behavior/zoom-canvas.ts +19 -19
- package/src/stdlib/data/index.ts +3 -0
- package/src/stdlib/data/mapNodeSize.ts +67 -0
- package/src/stdlib/data/transformV4Data.ts +207 -0
- package/src/stdlib/data/validateData.ts +146 -0
- package/src/stdlib/index.ts +221 -37
- package/src/stdlib/item/combo/circle.ts +113 -0
- package/src/stdlib/item/combo/index.ts +2 -0
- package/src/stdlib/item/combo/rect.ts +123 -0
- package/src/stdlib/item/edge/base.ts +71 -6
- package/src/stdlib/item/edge/cubic-horizontal.ts +86 -0
- package/src/stdlib/item/edge/cubic-vertical.ts +85 -0
- package/src/stdlib/item/edge/cubic.ts +198 -0
- package/src/stdlib/item/edge/index.ts +6 -0
- package/src/stdlib/item/edge/line.ts +14 -15
- package/src/stdlib/item/edge/loop.ts +162 -0
- package/src/stdlib/item/edge/polyline.ts +161 -0
- package/src/stdlib/item/edge/quadratic.ts +133 -0
- package/src/stdlib/item/node/base.ts +195 -53
- package/src/stdlib/item/node/base3d.ts +2 -0
- package/src/stdlib/item/node/circle.ts +5 -5
- package/src/stdlib/item/node/diamond.ts +144 -0
- package/src/stdlib/item/node/donut.ts +368 -0
- package/src/stdlib/item/node/ellipse.ts +128 -0
- package/src/stdlib/item/node/hexagon.ts +168 -0
- package/src/stdlib/item/node/index.ts +8 -0
- package/src/stdlib/item/node/modelRect.ts +405 -0
- package/src/stdlib/item/node/rect.ts +141 -0
- package/src/stdlib/item/node/star.ts +181 -0
- package/src/stdlib/item/node/triangle.ts +265 -0
- package/src/stdlib/plugin/fisheye/index.ts +607 -0
- package/src/stdlib/plugin/grid/index.ts +125 -0
- package/src/stdlib/plugin/history/combo-command.ts +28 -0
- package/src/stdlib/plugin/history/command.ts +81 -0
- package/src/stdlib/plugin/history/index.ts +347 -0
- package/src/stdlib/plugin/history/item-data-command.ts +96 -0
- package/src/stdlib/plugin/history/layer-updated-command.ts +28 -0
- package/src/stdlib/plugin/history/state-updated-command.ts +36 -0
- package/src/stdlib/plugin/history/visibility-updated-command.ts +41 -0
- package/src/stdlib/plugin/hull/bubbleset.ts +828 -0
- package/src/stdlib/plugin/hull/convexHull.ts +68 -0
- package/src/stdlib/plugin/hull/hullComponent.ts +501 -0
- package/src/stdlib/plugin/hull/index.ts +234 -0
- package/src/stdlib/plugin/hull/types.ts +15 -0
- package/src/stdlib/plugin/hull/util.ts +511 -0
- package/src/stdlib/plugin/index.ts +8 -0
- package/src/stdlib/plugin/legend/index.ts +122 -61
- package/src/stdlib/plugin/menu/index.ts +275 -0
- package/src/stdlib/plugin/minimap/index.ts +35 -26
- package/src/stdlib/plugin/toolbar/index.ts +257 -0
- package/src/stdlib/plugin/tooltip/index.ts +444 -0
- package/src/stdlib/plugin/types.ts +8 -0
- package/src/stdlib/theme/dark.ts +13 -1
- package/src/stdlib/theme/index.ts +2 -0
- package/src/stdlib/theme/light.ts +88 -10
- package/src/stdlib/themeSolver/base.ts +1 -1
- package/src/stdlib/themeSolver/index.ts +3 -0
- package/src/stdlib/themeSolver/spec.ts +2 -5
- package/src/stdlib/themeSolver/subject.ts +2 -5
- package/src/types/behavior.ts +0 -1
- package/src/types/combo.ts +61 -4
- package/src/types/common.ts +13 -0
- package/src/types/data.ts +28 -7
- package/src/types/edge.ts +30 -6
- package/src/types/event.ts +8 -8
- package/src/types/graph.ts +232 -25
- package/src/types/history.ts +30 -0
- package/src/types/hook.ts +37 -7
- package/src/types/index.ts +37 -12
- package/src/types/item.ts +25 -11
- package/src/types/layout.ts +20 -16
- package/src/types/loop.ts +23 -0
- package/src/types/node.ts +94 -14
- package/src/types/plugin.ts +7 -1
- package/src/types/spec.ts +30 -13
- package/src/types/theme.ts +80 -10
- package/src/util/animate.ts +60 -20
- package/src/util/array.ts +12 -1
- package/src/util/arrow.ts +62 -0
- package/src/util/bbox.ts +298 -0
- package/src/util/behavior.ts +14 -0
- package/src/util/canvas.ts +16 -24
- package/src/util/data.ts +307 -0
- package/src/util/event.ts +114 -1
- package/src/util/extend.ts +8 -2
- package/src/util/index.ts +31 -1
- package/src/util/item.ts +79 -13
- package/src/util/layout.ts +165 -0
- package/src/util/loop.ts +145 -0
- package/src/util/mapper.ts +10 -9
- package/src/util/math.ts +24 -0
- package/src/util/mock.ts +72 -0
- package/src/util/path.ts +52 -0
- package/src/util/point.ts +33 -2
- package/src/util/polyline.ts +676 -0
- package/src/util/router.ts +552 -0
- package/src/util/shape.ts +159 -6
- package/src/util/shape3d.ts +16 -11
- package/src/util/type.ts +8 -1
- package/src/util/zoom.ts +8 -4
- package/esm/stdlib/data/comboFromNode.d.ts +0 -9
- package/esm/stdlib/data/comboFromNode.js +0 -28
- package/esm/stdlib/data/comboFromNode.js.map +0 -1
- package/lib/stdlib/data/comboFromNode.d.ts +0 -9
- package/lib/stdlib/data/comboFromNode.js +0 -32
- package/lib/stdlib/data/comboFromNode.js.map +0 -1
- package/src/stdlib/data/comboFromNode.ts +0 -28
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// TODO: update type define.
|
|
2
|
+
import { createDom, modifyCSS } from '@antv/dom-util';
|
|
3
|
+
import { Canvas } from '@antv/g';
|
|
4
|
+
import { uniqueId } from '@antv/util';
|
|
5
|
+
import { IGraph } from '../../../types';
|
|
6
|
+
import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
|
|
7
|
+
|
|
8
|
+
const GRID_PNG =
|
|
9
|
+
'url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This is an interface named `GridConfig`, which extends the `IPluginBaseConfig` interface. It contains the following properties:
|
|
13
|
+
|
|
14
|
+
- `img`: A string representing the background image of the grid.
|
|
15
|
+
- `follow`: A boolean indicating whether the grid follows the view movement.
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
export interface GridConfig extends IPluginBaseConfig {
|
|
19
|
+
img?: string;
|
|
20
|
+
follow?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface ViewPortEventParam {
|
|
24
|
+
action: string;
|
|
25
|
+
matrix: number[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class Grid extends Base {
|
|
29
|
+
private canvas: Canvas;
|
|
30
|
+
private viewport: HTMLElement | undefined;
|
|
31
|
+
private container: HTMLDivElement;
|
|
32
|
+
constructor(options?: GridConfig) {
|
|
33
|
+
super(options);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public getDefaultCfgs(): GridConfig {
|
|
37
|
+
return {
|
|
38
|
+
key: `grid-${uniqueId()}`,
|
|
39
|
+
img: GRID_PNG,
|
|
40
|
+
follow: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public init(graph: IGraph) {
|
|
45
|
+
super.init(graph);
|
|
46
|
+
const minZoom = graph.getZoom();
|
|
47
|
+
const graphContainer = graph.container;
|
|
48
|
+
const canvas = this.canvas || graphContainer.firstChild.nextSibling;
|
|
49
|
+
const [width, height] = graph.getSize();
|
|
50
|
+
const img = this.options.img || GRID_PNG;
|
|
51
|
+
|
|
52
|
+
const container: HTMLDivElement = createDom(
|
|
53
|
+
`<div class='g6-grid-container' style="position: absolute; left:0;top:0;right:0;bottom:0;overflow: hidden;"></div>`,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const gridContainer: HTMLDivElement = createDom(
|
|
57
|
+
`<div
|
|
58
|
+
class='g6-grid'
|
|
59
|
+
style='position:absolute;
|
|
60
|
+
transform-origin: 0% 0% 0px;
|
|
61
|
+
background-image: ${img};
|
|
62
|
+
user-select: none
|
|
63
|
+
'></div>`,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
container.appendChild(gridContainer);
|
|
67
|
+
|
|
68
|
+
modifyCSS(container, {
|
|
69
|
+
width: `${width}px`,
|
|
70
|
+
height: `${height}px`,
|
|
71
|
+
left: `${graphContainer.offsetLeft}px`,
|
|
72
|
+
top: `${graphContainer.offsetTop}px`,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
modifyCSS(gridContainer, {
|
|
76
|
+
width: `${width / minZoom}px`,
|
|
77
|
+
height: `${height / minZoom}px`,
|
|
78
|
+
left: `0px`,
|
|
79
|
+
top: `0px`,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
graphContainer.insertBefore(container, canvas as Node);
|
|
83
|
+
|
|
84
|
+
this.container = container;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// class-methods-use-this
|
|
88
|
+
public getEvents() {
|
|
89
|
+
return {
|
|
90
|
+
viewportchange: this.updateGrid,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* viewport change
|
|
96
|
+
* @param param
|
|
97
|
+
*/
|
|
98
|
+
protected updateGrid(param: ViewPortEventParam) {
|
|
99
|
+
const gridContainer: HTMLDivElement = this.container;
|
|
100
|
+
let { matrix } = param;
|
|
101
|
+
if (!matrix) matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
102
|
+
|
|
103
|
+
const isFollow = this.options.follow;
|
|
104
|
+
const transform = `matrix(${matrix[0]}, ${matrix[1]}, ${matrix[3]}, ${
|
|
105
|
+
matrix[4]
|
|
106
|
+
}, ${isFollow ? matrix[6] : '0'}, ${isFollow ? matrix[7] : '0'})`;
|
|
107
|
+
|
|
108
|
+
modifyCSS(gridContainer, {
|
|
109
|
+
transform,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public getContainer(): HTMLDivElement {
|
|
114
|
+
return this.container;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public destroy() {
|
|
118
|
+
super.destroy();
|
|
119
|
+
this.canvas?.destroy();
|
|
120
|
+
|
|
121
|
+
const container = this.container;
|
|
122
|
+
|
|
123
|
+
if (container?.parentNode) container.parentNode.removeChild(container);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ID, IGraph } from '../../../types';
|
|
2
|
+
import { Command } from './command';
|
|
3
|
+
|
|
4
|
+
export class ComboCommand implements Command {
|
|
5
|
+
private action: 'expandCombo' | 'collapseCombo';
|
|
6
|
+
private ids: ID[];
|
|
7
|
+
|
|
8
|
+
constructor(action, ids) {
|
|
9
|
+
this.action = action;
|
|
10
|
+
this.ids = ids;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
undo(graph: IGraph) {
|
|
14
|
+
graph.executeWithoutStacking(() => {
|
|
15
|
+
this.action === 'expandCombo'
|
|
16
|
+
? graph.collapseCombo(this.ids)
|
|
17
|
+
: graph.expandCombo(this.ids);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
redo(graph: IGraph) {
|
|
22
|
+
graph.executeWithoutStacking(() => {
|
|
23
|
+
this.action === 'collapseCombo'
|
|
24
|
+
? graph.collapseCombo(this.ids)
|
|
25
|
+
: graph.expandCombo(this.ids);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { groupBy } from '@antv/util';
|
|
2
|
+
import { ID, IGraph } from '../../../types';
|
|
3
|
+
import type { ITEM_TYPE } from '../../../types/item';
|
|
4
|
+
import { LayerUpdatedCommand } from './layer-updated-command';
|
|
5
|
+
import { StateUpdatedCommand } from './state-updated-command';
|
|
6
|
+
import { VisibilityUpdatedCommand } from './visibility-updated-command';
|
|
7
|
+
import { ItemDataCommand } from './item-data-command';
|
|
8
|
+
import { ComboCommand } from './combo-command';
|
|
9
|
+
|
|
10
|
+
export interface Command {
|
|
11
|
+
redo: (graph: IGraph) => void;
|
|
12
|
+
undo: (graph: IGraph) => void;
|
|
13
|
+
}
|
|
14
|
+
interface CreateProps {
|
|
15
|
+
type: ITEM_TYPE;
|
|
16
|
+
ids: ID[];
|
|
17
|
+
changes: any;
|
|
18
|
+
action?:
|
|
19
|
+
| 'updatePosition'
|
|
20
|
+
| 'updateState'
|
|
21
|
+
| 'updateVisibility'
|
|
22
|
+
| 'front'
|
|
23
|
+
| 'back'
|
|
24
|
+
| 'expandCombo'
|
|
25
|
+
| 'collapseCombo';
|
|
26
|
+
upsertAncestors?: boolean;
|
|
27
|
+
disableAnimate?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default class CommandFactory {
|
|
31
|
+
static create({
|
|
32
|
+
type: itemType,
|
|
33
|
+
action,
|
|
34
|
+
changes,
|
|
35
|
+
...rest
|
|
36
|
+
}: CreateProps): Command[] {
|
|
37
|
+
const commands = [];
|
|
38
|
+
|
|
39
|
+
const groupedByType = groupBy(changes, 'type');
|
|
40
|
+
|
|
41
|
+
for (const type in groupedByType) {
|
|
42
|
+
const itemDataCommandMap = {
|
|
43
|
+
NodeDataUpdated: 'node',
|
|
44
|
+
EdgeDataUpdated: 'edge',
|
|
45
|
+
NodeAdded: 'node',
|
|
46
|
+
EdgeAdded: 'edge',
|
|
47
|
+
NodeRemoved: 'node',
|
|
48
|
+
EdgeRemoved: 'edge',
|
|
49
|
+
TreeStructureChanged: 'combo',
|
|
50
|
+
};
|
|
51
|
+
if (itemDataCommandMap[type]) {
|
|
52
|
+
commands.push(
|
|
53
|
+
new ItemDataCommand(
|
|
54
|
+
action,
|
|
55
|
+
itemType || itemDataCommandMap[type],
|
|
56
|
+
groupedByType[type],
|
|
57
|
+
type === 'NodeDataUpdated' ? rest.upsertAncestors : undefined,
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const actionCommandMap = {
|
|
64
|
+
updateState: new StateUpdatedCommand(changes),
|
|
65
|
+
updateVisibility: new VisibilityUpdatedCommand(
|
|
66
|
+
changes,
|
|
67
|
+
rest.disableAnimate,
|
|
68
|
+
),
|
|
69
|
+
front: new LayerUpdatedCommand('front', rest.ids),
|
|
70
|
+
back: new LayerUpdatedCommand('back', rest.ids),
|
|
71
|
+
expandCombo: new ComboCommand('expandCombo', rest.ids),
|
|
72
|
+
collapseCombo: new ComboCommand('collapseCombo', rest.ids),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
if (actionCommandMap[action]) {
|
|
76
|
+
commands.push(actionCommandMap[action]);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return commands;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { deepMix, each, isEmpty, upperFirst } from '@antv/util';
|
|
2
|
+
import type { IGraph } from 'types';
|
|
3
|
+
import { STACK_TYPE, StackCfg, StackType } from '../../../types/history';
|
|
4
|
+
import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
|
|
5
|
+
import CommandFactory, { Command } from './command';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `HistoryConfig` interface contains the following properties:
|
|
9
|
+
|
|
10
|
+
- `enableStack`: An optional boolean value that indicates whether to enable the stack.
|
|
11
|
+
- `stackCfg`: A required object of type `StackCfg` representing the stack configuration.
|
|
12
|
+
|
|
13
|
+
The `StackCfg` type is defined as an object with the following properties:
|
|
14
|
+
|
|
15
|
+
- `stackSize`: An optional number representing the size of the stack.
|
|
16
|
+
- `stackActive`: An optional boolean value indicating whether the stack is active. If active, operations can be pushed onto the stack; otherwise, they cannot.
|
|
17
|
+
- `excludes`: An optional array of strings representing APIs that should be excluded from being put on the stack, even if their operation type is not ignored.
|
|
18
|
+
- `includes`: An optional array of strings representing APIs that should be included in being put on the stack.
|
|
19
|
+
- `ignoreAdd`: An optional boolean value indicating whether to ignore add operations.
|
|
20
|
+
- `ignoreRemove`: An optional boolean value indicating whether to ignore remove operations.
|
|
21
|
+
- `ignoreUpdate`: An optional boolean value indicating whether to ignore update operations.
|
|
22
|
+
- `ignoreStateChange`: An optional boolean value indicating whether to ignore state change operations.
|
|
23
|
+
- `ignoreLayerChange`: An optional boolean value indicating whether to ignore layer change operations.
|
|
24
|
+
- `ignoreDisplayChange`: An optional boolean value indicating whether to ignore display change operations.
|
|
25
|
+
|
|
26
|
+
*/
|
|
27
|
+
export interface HistoryConfig extends IPluginBaseConfig {
|
|
28
|
+
enableStack?: boolean;
|
|
29
|
+
stackCfg: StackCfg;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const apiMap = {
|
|
33
|
+
add: ['addData', 'addCombo'],
|
|
34
|
+
remove: ['removeData'],
|
|
35
|
+
update: [
|
|
36
|
+
'updateData',
|
|
37
|
+
'updateNodePosition',
|
|
38
|
+
'updateComboPosition',
|
|
39
|
+
'updatePosition',
|
|
40
|
+
'moveCombo',
|
|
41
|
+
'collapseCombo',
|
|
42
|
+
'expandCombo',
|
|
43
|
+
],
|
|
44
|
+
stateChange: ['setItemState', 'clearItemState'],
|
|
45
|
+
layerChange: ['frontItem', 'backItem'],
|
|
46
|
+
displayChange: ['showItem', 'hideItem'],
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Retrieve the category of a given API based on its name.
|
|
51
|
+
* @param apiName name of API
|
|
52
|
+
*/
|
|
53
|
+
export const getCategoryByApiName = (apiName): keyof typeof apiName => {
|
|
54
|
+
for (const [categoryKey, apiList] of Object.entries(apiMap)) {
|
|
55
|
+
if (apiList.includes(apiName)) {
|
|
56
|
+
return categoryKey as keyof typeof apiName;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`Unknown apiName: ${apiName}. Unable to determine category.`);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
class HistoryStack<T> {
|
|
63
|
+
private items: T[];
|
|
64
|
+
private maxStep: number;
|
|
65
|
+
|
|
66
|
+
constructor(maxStep = 0) {
|
|
67
|
+
this.items = [];
|
|
68
|
+
this.maxStep = maxStep;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public push(item: T): void {
|
|
72
|
+
if (this.maxStep !== 0 && this.items.length === this.maxStep) {
|
|
73
|
+
this.items.shift();
|
|
74
|
+
}
|
|
75
|
+
this.items.push(item);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public pop(): T {
|
|
79
|
+
if (this.items.length !== 0) {
|
|
80
|
+
return this.items.pop();
|
|
81
|
+
}
|
|
82
|
+
throw new Error('Stack is empty');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public size(): number {
|
|
86
|
+
return this.items.length;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public clear(): void {
|
|
90
|
+
this.items = [];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public toArray(): T[] {
|
|
94
|
+
return this.items;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export class History extends Base {
|
|
99
|
+
public readonly cfg: StackCfg;
|
|
100
|
+
public readonly enableStack: boolean;
|
|
101
|
+
protected undoStack: HistoryStack<Command[]>;
|
|
102
|
+
protected redoStack: HistoryStack<Command[]>;
|
|
103
|
+
protected stackSize = 0;
|
|
104
|
+
protected stackActive = true;
|
|
105
|
+
protected withoutStackingCounter = 0;
|
|
106
|
+
protected isBatching: boolean;
|
|
107
|
+
protected batchCommands: Command[];
|
|
108
|
+
|
|
109
|
+
constructor(options?: HistoryConfig) {
|
|
110
|
+
super();
|
|
111
|
+
const { enableStack, stackCfg } = deepMix(this.getDefaultCfgs(), options);
|
|
112
|
+
this.enableStack = enableStack;
|
|
113
|
+
this.cfg = stackCfg;
|
|
114
|
+
this.isBatching = false;
|
|
115
|
+
this.undoStack = new HistoryStack(this.cfg.stackSize);
|
|
116
|
+
this.redoStack = new HistoryStack(this.cfg.stackSize);
|
|
117
|
+
this.initBatchCommands();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public getDefaultCfgs(): HistoryConfig {
|
|
121
|
+
return {
|
|
122
|
+
enableStack: true,
|
|
123
|
+
stackCfg: {
|
|
124
|
+
stackSize: 0,
|
|
125
|
+
stackActive: true,
|
|
126
|
+
includes: [],
|
|
127
|
+
excludes: [],
|
|
128
|
+
ignoreAdd: false,
|
|
129
|
+
ignoreRemove: false,
|
|
130
|
+
ignoreUpdate: false,
|
|
131
|
+
ignoreStateChange: false,
|
|
132
|
+
ignoreLayerChange: false,
|
|
133
|
+
ignoreDisplayChange: false,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
public init(graph: IGraph) {
|
|
139
|
+
super.init(graph);
|
|
140
|
+
this.clear();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public getUndoStack(): Command[][] {
|
|
144
|
+
return this.undoStack.toArray();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public getRedoStack(): Command[][] {
|
|
148
|
+
return this.redoStack.toArray();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public getStack(): Record<string, Command[][]> {
|
|
152
|
+
return {
|
|
153
|
+
redoStack: this.getRedoStack(),
|
|
154
|
+
undoStack: this.getUndoStack(),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public clear() {
|
|
159
|
+
this.clearUndoStack();
|
|
160
|
+
this.clearRedoStack();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
public clearUndoStack() {
|
|
164
|
+
this.undoStack.clear();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public clearRedoStack() {
|
|
168
|
+
this.redoStack.clear();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public isEnable() {
|
|
172
|
+
return this.enableStack;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public push(
|
|
176
|
+
cmd: Command[],
|
|
177
|
+
stackType: StackType = STACK_TYPE.undo,
|
|
178
|
+
isNew = true,
|
|
179
|
+
) {
|
|
180
|
+
if (this.stackActive) {
|
|
181
|
+
if (stackType === STACK_TYPE.undo) {
|
|
182
|
+
if (isNew) {
|
|
183
|
+
// Clear the redo stack when a new action is performed to maintain state consistency
|
|
184
|
+
this.clearRedoStack();
|
|
185
|
+
}
|
|
186
|
+
if (isEmpty(cmd)) return;
|
|
187
|
+
this.undoStack.push(cmd);
|
|
188
|
+
this.initBatchCommands();
|
|
189
|
+
} else {
|
|
190
|
+
this.redoStack.push(cmd);
|
|
191
|
+
}
|
|
192
|
+
this.graph.emit('history:change', cmd, stackType, isNew);
|
|
193
|
+
} else {
|
|
194
|
+
console.error(
|
|
195
|
+
'Stacking operations are currently paused. Unable to push to the stack.',
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Pause stacking operations.
|
|
202
|
+
*/
|
|
203
|
+
pauseStacking(): void {
|
|
204
|
+
this.withoutStackingCounter++;
|
|
205
|
+
|
|
206
|
+
if (this.withoutStackingCounter === 1) {
|
|
207
|
+
// Only disable on the first call
|
|
208
|
+
this.stackActive = false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Resume stacking operations.
|
|
214
|
+
*/
|
|
215
|
+
resumeStacking(): void {
|
|
216
|
+
if (this.withoutStackingCounter > 0) {
|
|
217
|
+
this.withoutStackingCounter--;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (this.withoutStackingCounter === 0) {
|
|
221
|
+
// Only enable when all pause requests are cleared
|
|
222
|
+
this.stackActive = true;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
public undo() {
|
|
227
|
+
if (this.isEnable()) {
|
|
228
|
+
const cmds = this.undoStack.pop();
|
|
229
|
+
if (cmds) {
|
|
230
|
+
this.push(cmds, STACK_TYPE.redo, false);
|
|
231
|
+
for (let i = cmds.length - 1; i >= 0; i--) {
|
|
232
|
+
cmds[i].undo(this.graph);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
public redo() {
|
|
240
|
+
if (this.isEnable()) {
|
|
241
|
+
const cmds = this.redoStack.pop();
|
|
242
|
+
if (cmds) {
|
|
243
|
+
this.push(cmds, STACK_TYPE.undo, false);
|
|
244
|
+
each(cmds, (cmd) => cmd.redo(this.graph));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
public canUndo() {
|
|
251
|
+
return this.isEnable() && this.undoStack.size() > 0;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
public canRedo() {
|
|
255
|
+
return this.isEnable() && this.redoStack.size() > 0;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private initBatchCommands() {
|
|
259
|
+
this.batchCommands = [];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Begin a batch operation.
|
|
264
|
+
* Any operations performed between `startBatch` and `stopBatch` are grouped together.
|
|
265
|
+
* treated as a single operation when undoing or redoing.
|
|
266
|
+
*/
|
|
267
|
+
public startBatch() {
|
|
268
|
+
if (this.isBatching) {
|
|
269
|
+
throw new Error(
|
|
270
|
+
'Ensure that batch processing is stopped before starting.',
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
this.initBatchCommands();
|
|
274
|
+
this.isBatching = true;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* End a batch operation.
|
|
279
|
+
* Any operations performed between `startBatch` and `stopBatch` are grouped together.
|
|
280
|
+
* treated as a single operation when undoing or redoing.
|
|
281
|
+
*/
|
|
282
|
+
public stopBatch() {
|
|
283
|
+
if (!this.isBatching) {
|
|
284
|
+
throw new Error(
|
|
285
|
+
'Ensure that batch processing is started before stopping.',
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
this.push(this.batchCommands);
|
|
289
|
+
this.isBatching = false;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Execute the provided function in a batch mode
|
|
294
|
+
* @param callback
|
|
295
|
+
*/
|
|
296
|
+
public batch(callback) {
|
|
297
|
+
this.startBatch();
|
|
298
|
+
callback();
|
|
299
|
+
this.stopBatch();
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
public getEvents() {
|
|
303
|
+
return {
|
|
304
|
+
afteritemchange: this.handleUpdateHistory,
|
|
305
|
+
afteritemzindexchange: this.handleUpdateHistory,
|
|
306
|
+
afteritemstatechange: this.handleUpdateHistory,
|
|
307
|
+
afteritemvisibilitychange: this.handleUpdateHistory,
|
|
308
|
+
aftercollapsecombo: this.handleUpdateHistory,
|
|
309
|
+
afterexpandcombo: this.handleUpdateHistory,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
private handleUpdateHistory(props) {
|
|
314
|
+
const { apiName, changes } = props;
|
|
315
|
+
if (changes && changes.length === 0) return;
|
|
316
|
+
if (this.shouldPushToStack(apiName)) {
|
|
317
|
+
this.batchCommands = [
|
|
318
|
+
...this.batchCommands,
|
|
319
|
+
...CommandFactory.create(props),
|
|
320
|
+
];
|
|
321
|
+
if (this.isBatching) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
this.push(this.batchCommands);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Determine if a given operation should be pushed onto the history stack based on various configurations.
|
|
330
|
+
* @param {string} apiName name of the API operation.
|
|
331
|
+
* @param {boolean} stack Optional. whether push this operation into graph's stack.
|
|
332
|
+
*/
|
|
333
|
+
private shouldPushToStack(apiName: string): boolean {
|
|
334
|
+
const { includes = [], excludes = [] } = this.cfg;
|
|
335
|
+
if (!this.enableStack || !this.stackActive) return false;
|
|
336
|
+
if (includes.includes(apiName)) return true;
|
|
337
|
+
if (excludes.includes(apiName)) return false;
|
|
338
|
+
let categoryKey: any = getCategoryByApiName(apiName);
|
|
339
|
+
if (!categoryKey) return true;
|
|
340
|
+
categoryKey = 'ignore' + upperFirst(categoryKey);
|
|
341
|
+
return !this.cfg[categoryKey];
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
public notify(graph, eventName, ...data) {
|
|
345
|
+
graph.emit(eventName, data);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ITEM_TYPE } from '../../../types/item';
|
|
2
|
+
import type { IGraph } from '../../../types';
|
|
3
|
+
import type { GroupedChanges } from '../../../util/event';
|
|
4
|
+
import { STACK_TYPE, type StackType } from '../../../types/history';
|
|
5
|
+
import { Command } from './command';
|
|
6
|
+
|
|
7
|
+
export class ItemDataCommand implements Command {
|
|
8
|
+
private action: 'add' | 'remove' | 'update' | 'updatePosition';
|
|
9
|
+
private type: ITEM_TYPE;
|
|
10
|
+
private changes: GroupedChanges[
|
|
11
|
+
| 'NodeAdded'
|
|
12
|
+
| 'EdgeAdded'
|
|
13
|
+
| 'NodeRemoved'
|
|
14
|
+
| 'EdgeRemoved'
|
|
15
|
+
| 'NodeDataUpdated'
|
|
16
|
+
| 'EdgeDataUpdated'
|
|
17
|
+
| 'TreeStructureChanged'];
|
|
18
|
+
private upsertAncestors?: boolean;
|
|
19
|
+
|
|
20
|
+
constructor(action, type, changes, upsertAncestors?) {
|
|
21
|
+
this.action = action;
|
|
22
|
+
this.type = type;
|
|
23
|
+
this.changes = changes;
|
|
24
|
+
this.upsertAncestors = upsertAncestors;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private removeChangedData(graph) {
|
|
28
|
+
const ids = this.changes.map((data) => data.value?.id).filter(Boolean);
|
|
29
|
+
graph.executeWithoutStacking(() => {
|
|
30
|
+
graph.removeData(this.type, ids);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private addChangedData(graph) {
|
|
35
|
+
const models = this.changes.map((data) => data.value).filter(Boolean);
|
|
36
|
+
graph.executeWithoutStacking(() => {
|
|
37
|
+
graph.addData(this.type, models);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private updateChangedData(
|
|
42
|
+
graph: IGraph,
|
|
43
|
+
operationType: StackType,
|
|
44
|
+
onlyMove = false,
|
|
45
|
+
) {
|
|
46
|
+
let models;
|
|
47
|
+
if (this.type === 'combo' && !onlyMove) {
|
|
48
|
+
models = this.changes.map((data) => ({
|
|
49
|
+
id: data.nodeId,
|
|
50
|
+
data: {
|
|
51
|
+
parentId: STACK_TYPE.undo ? data.oldParentId : data.newParentId,
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
} else {
|
|
55
|
+
models = this.changes.map((data) => {
|
|
56
|
+
return {
|
|
57
|
+
id: data.id,
|
|
58
|
+
data:
|
|
59
|
+
operationType === STACK_TYPE.undo ? data.oldValue : data.newValue,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
graph.pauseStacking();
|
|
65
|
+
if (onlyMove) {
|
|
66
|
+
graph.updatePosition(this.type, models, this.upsertAncestors);
|
|
67
|
+
} else {
|
|
68
|
+
graph.updateData(this.type, models);
|
|
69
|
+
}
|
|
70
|
+
graph.resumeStacking();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
undo(graph: IGraph) {
|
|
74
|
+
this.action === 'add' && this.removeChangedData(graph);
|
|
75
|
+
this.action === 'remove' && this.addChangedData(graph);
|
|
76
|
+
this.action === 'update' && this.updateChangedData(graph, STACK_TYPE.undo);
|
|
77
|
+
this.action === 'updatePosition' &&
|
|
78
|
+
this.updateChangedData(
|
|
79
|
+
graph,
|
|
80
|
+
STACK_TYPE.undo,
|
|
81
|
+
this.action === 'updatePosition',
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
redo(graph: IGraph) {
|
|
86
|
+
this.action === 'remove' && this.removeChangedData(graph);
|
|
87
|
+
this.action === 'add' && this.addChangedData(graph);
|
|
88
|
+
this.action === 'update' && this.updateChangedData(graph, STACK_TYPE.redo);
|
|
89
|
+
this.action === 'updatePosition' &&
|
|
90
|
+
this.updateChangedData(
|
|
91
|
+
graph,
|
|
92
|
+
STACK_TYPE.redo,
|
|
93
|
+
this.action === 'updatePosition',
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ID, IGraph } from '../../../types';
|
|
2
|
+
import { Command } from './command';
|
|
3
|
+
|
|
4
|
+
export class LayerUpdatedCommand implements Command {
|
|
5
|
+
private action: 'front' | 'back';
|
|
6
|
+
private ids: ID[];
|
|
7
|
+
|
|
8
|
+
constructor(action, ids) {
|
|
9
|
+
this.action = action;
|
|
10
|
+
this.ids = ids;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
undo(graph: IGraph) {
|
|
14
|
+
graph.executeWithoutStacking(() => {
|
|
15
|
+
this.action === 'front'
|
|
16
|
+
? graph.backItem(this.ids)
|
|
17
|
+
: graph.frontItem(this.ids);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
redo(graph: IGraph) {
|
|
22
|
+
graph.executeWithoutStacking(() => {
|
|
23
|
+
this.action === 'front'
|
|
24
|
+
? graph.frontItem(this.ids)
|
|
25
|
+
: graph.backItem(this.ids);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|