@antv/g6 4.8.14 → 5.0.0-alpha.1
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 +19 -3
- package/esm/constant/index.d.ts +1 -0
- package/esm/constant/index.js +2 -0
- package/esm/constant/index.js.map +1 -0
- package/esm/constant/shape.d.ts +27 -0
- package/esm/constant/shape.js +26 -0
- package/esm/constant/shape.js.map +1 -0
- package/esm/index.d.ts +124 -0
- package/esm/index.js +11 -0
- package/esm/index.js.map +1 -0
- package/esm/item/combo.d.ts +4 -0
- package/esm/item/combo.js +4 -0
- package/esm/item/combo.js.map +1 -0
- package/esm/item/edge.d.ts +54 -0
- package/esm/item/edge.js +113 -0
- package/esm/item/edge.js.map +1 -0
- package/esm/item/item.d.ts +189 -0
- package/esm/item/item.js +636 -0
- package/esm/item/item.js.map +1 -0
- package/esm/item/node.d.ts +54 -0
- package/esm/item/node.js +170 -0
- package/esm/item/node.js.map +1 -0
- package/esm/runtime/controller/data.d.ts +65 -0
- package/esm/runtime/controller/data.js +489 -0
- package/esm/runtime/controller/data.js.map +1 -0
- package/esm/runtime/controller/extension.d.ts +9 -0
- package/esm/runtime/controller/extension.js +11 -0
- package/esm/runtime/controller/extension.js.map +1 -0
- package/esm/runtime/controller/index.d.ts +7 -0
- package/esm/runtime/controller/index.js +8 -0
- package/esm/runtime/controller/index.js.map +1 -0
- package/esm/runtime/controller/interaction.d.ts +51 -0
- package/esm/runtime/controller/interaction.js +259 -0
- package/esm/runtime/controller/interaction.js.map +1 -0
- package/esm/runtime/controller/item.d.ts +101 -0
- package/esm/runtime/controller/item.js +537 -0
- package/esm/runtime/controller/item.js.map +1 -0
- package/esm/runtime/controller/layout.d.ts +30 -0
- package/esm/runtime/controller/layout.js +204 -0
- package/esm/runtime/controller/layout.js.map +1 -0
- package/esm/runtime/controller/plugin.d.ts +34 -0
- package/esm/runtime/controller/plugin.js +140 -0
- package/esm/runtime/controller/plugin.js.map +1 -0
- package/esm/runtime/controller/theme.d.ts +29 -0
- package/esm/runtime/controller/theme.js +54 -0
- package/esm/runtime/controller/theme.js.map +1 -0
- package/esm/runtime/controller/viewport.d.ts +11 -0
- package/esm/runtime/controller/viewport.js +102 -0
- package/esm/runtime/controller/viewport.js.map +1 -0
- package/esm/runtime/graph.d.ts +462 -0
- package/esm/runtime/graph.js +1077 -0
- package/esm/runtime/graph.js.map +1 -0
- package/esm/runtime/hooks.d.ts +33 -0
- package/esm/runtime/hooks.js +74 -0
- package/esm/runtime/hooks.js.map +1 -0
- package/esm/stdlib/behavior/activate-relations.d.ts +62 -0
- package/esm/stdlib/behavior/activate-relations.js +81 -0
- package/esm/stdlib/behavior/activate-relations.js.map +1 -0
- package/esm/stdlib/behavior/brush-select.d.ts +110 -0
- package/esm/stdlib/behavior/brush-select.js +268 -0
- package/esm/stdlib/behavior/brush-select.js.map +1 -0
- package/esm/stdlib/behavior/click-select.d.ts +71 -0
- package/esm/stdlib/behavior/click-select.js +143 -0
- package/esm/stdlib/behavior/click-select.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +82 -0
- package/esm/stdlib/behavior/drag-canvas.js +246 -0
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -0
- package/esm/stdlib/behavior/drag-node.d.ts +80 -0
- package/esm/stdlib/behavior/drag-node.js +250 -0
- package/esm/stdlib/behavior/drag-node.js.map +1 -0
- package/esm/stdlib/behavior/hover-activate.d.ts +41 -0
- package/esm/stdlib/behavior/hover-activate.js +63 -0
- package/esm/stdlib/behavior/hover-activate.js.map +1 -0
- package/esm/stdlib/behavior/lasso-select.d.ts +27 -0
- package/esm/stdlib/behavior/lasso-select.js +79 -0
- package/esm/stdlib/behavior/lasso-select.js.map +1 -0
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +37 -0
- package/esm/stdlib/behavior/orbit-canvas-3d.js +62 -0
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +61 -0
- package/esm/stdlib/behavior/rotate-canvas-3d.js +123 -0
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +37 -0
- package/esm/stdlib/behavior/track-canvas-3d.js +62 -0
- package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +51 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js +74 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas.d.ts +61 -0
- package/esm/stdlib/behavior/zoom-canvas.js +160 -0
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -0
- package/esm/stdlib/data/comboFromNode.d.ts +9 -0
- package/esm/stdlib/data/comboFromNode.js +28 -0
- package/esm/stdlib/data/comboFromNode.js.map +1 -0
- package/esm/stdlib/index.d.ts +80 -0
- package/esm/stdlib/index.js +82 -0
- package/esm/stdlib/index.js.map +1 -0
- package/esm/stdlib/item/edge/base.d.ts +111 -0
- package/esm/stdlib/item/edge/base.js +341 -0
- package/esm/stdlib/item/edge/base.js.map +1 -0
- package/esm/stdlib/item/edge/index.d.ts +1 -0
- package/esm/stdlib/item/edge/index.js +2 -0
- package/esm/stdlib/item/edge/index.js.map +1 -0
- package/esm/stdlib/item/edge/line.d.ts +33 -0
- package/esm/stdlib/item/edge/line.js +45 -0
- package/esm/stdlib/item/edge/line.js.map +1 -0
- package/esm/stdlib/item/node/base.d.ts +137 -0
- package/esm/stdlib/item/node/base.js +414 -0
- package/esm/stdlib/item/node/base.js.map +1 -0
- package/esm/stdlib/item/node/base3d.d.ts +72 -0
- package/esm/stdlib/item/node/base3d.js +113 -0
- package/esm/stdlib/item/node/base3d.js.map +1 -0
- package/esm/stdlib/item/node/circle.d.ts +30 -0
- package/esm/stdlib/item/node/circle.js +56 -0
- package/esm/stdlib/item/node/circle.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +2 -0
- package/esm/stdlib/item/node/index.js +3 -0
- package/esm/stdlib/item/node/index.js.map +1 -0
- package/esm/stdlib/item/node/sphere.d.ts +33 -0
- package/esm/stdlib/item/node/sphere.js +52 -0
- package/esm/stdlib/item/node/sphere.js.map +1 -0
- package/esm/stdlib/plugin/legend/index.d.ts +121 -0
- package/esm/stdlib/plugin/legend/index.js +587 -0
- package/esm/stdlib/plugin/legend/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +106 -0
- package/esm/stdlib/plugin/minimap/index.js +578 -0
- package/esm/stdlib/plugin/minimap/index.js.map +1 -0
- package/esm/stdlib/selector/lasso.d.ts +15 -0
- package/esm/stdlib/selector/lasso.js +61 -0
- package/esm/stdlib/selector/lasso.js.map +1 -0
- package/esm/stdlib/selector/rect.d.ts +16 -0
- package/esm/stdlib/selector/rect.js +54 -0
- package/esm/stdlib/selector/rect.js.map +1 -0
- package/esm/stdlib/theme/dark.d.ts +3 -0
- package/esm/stdlib/theme/dark.js +279 -0
- package/esm/stdlib/theme/dark.js.map +1 -0
- package/esm/stdlib/theme/light.d.ts +3 -0
- package/esm/stdlib/theme/light.js +274 -0
- package/esm/stdlib/theme/light.js.map +1 -0
- package/esm/stdlib/themeSolver/base.d.ts +15 -0
- package/esm/stdlib/themeSolver/base.js +11 -0
- package/esm/stdlib/themeSolver/base.js.map +1 -0
- package/esm/stdlib/themeSolver/spec.d.ts +37 -0
- package/esm/stdlib/themeSolver/spec.js +66 -0
- package/esm/stdlib/themeSolver/spec.js.map +1 -0
- package/esm/stdlib/themeSolver/subject.d.ts +43 -0
- package/esm/stdlib/themeSolver/subject.js +396 -0
- package/esm/stdlib/themeSolver/subject.js.map +1 -0
- package/esm/types/animate.d.ts +59 -0
- package/esm/types/animate.js +2 -0
- package/esm/types/animate.js.map +1 -0
- package/esm/types/behavior.d.ts +45 -0
- package/esm/types/behavior.js +14 -0
- package/esm/types/behavior.js.map +1 -0
- package/esm/types/combo.d.ts +87 -0
- package/esm/types/combo.js +2 -0
- package/esm/types/combo.js.map +1 -0
- package/esm/types/common.d.ts +6 -0
- package/esm/types/common.js +2 -0
- package/esm/types/common.js.map +1 -0
- package/esm/types/data.d.ts +21 -0
- package/esm/types/data.js +2 -0
- package/esm/types/data.js.map +1 -0
- package/esm/types/edge.d.ts +100 -0
- package/esm/types/edge.js +2 -0
- package/esm/types/edge.js.map +1 -0
- package/esm/types/event.d.ts +30 -0
- package/esm/types/event.js +31 -0
- package/esm/types/event.js.map +1 -0
- package/esm/types/graph.d.ts +445 -0
- package/esm/types/graph.js +2 -0
- package/esm/types/graph.js.map +1 -0
- package/esm/types/hook.d.ts +97 -0
- package/esm/types/hook.js +2 -0
- package/esm/types/hook.js.map +1 -0
- package/esm/types/index.d.ts +10 -0
- package/esm/types/index.js +2 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/item.d.ts +229 -0
- package/esm/types/item.js +16 -0
- package/esm/types/item.js.map +1 -0
- package/esm/types/layout.d.ts +69 -0
- package/esm/types/layout.js +20 -0
- package/esm/types/layout.js.map +1 -0
- package/esm/types/node.d.ts +134 -0
- package/esm/types/node.js +2 -0
- package/esm/types/node.js.map +1 -0
- package/esm/types/plugin.d.ts +40 -0
- package/esm/types/plugin.js +53 -0
- package/esm/types/plugin.js.map +1 -0
- package/esm/types/render.d.ts +1 -0
- package/esm/types/render.js +2 -0
- package/esm/types/render.js.map +1 -0
- package/esm/types/spec.d.ts +65 -0
- package/esm/types/spec.js +2 -0
- package/esm/types/spec.js.map +1 -0
- package/esm/types/stdlib.d.ts +13 -0
- package/esm/types/stdlib.js +2 -0
- package/esm/types/stdlib.js.map +1 -0
- package/esm/types/theme.d.ts +102 -0
- package/esm/types/theme.js +15 -0
- package/esm/types/theme.js.map +1 -0
- package/esm/types/view.d.ts +23 -0
- package/esm/types/view.js +2 -0
- package/esm/types/view.js.map +1 -0
- package/esm/util/animate.d.ts +101 -0
- package/esm/util/animate.js +350 -0
- package/esm/util/animate.js.map +1 -0
- package/esm/util/array.d.ts +20 -0
- package/esm/util/array.js +60 -0
- package/esm/util/array.js.map +1 -0
- package/esm/util/canvas.d.ts +20 -0
- package/esm/util/canvas.js +81 -0
- package/esm/util/canvas.js.map +1 -0
- package/esm/util/event.d.ts +12 -0
- package/esm/util/event.js +26 -0
- package/esm/util/event.js.map +1 -0
- package/esm/util/extend.d.ts +21 -0
- package/esm/util/extend.js +22 -0
- package/esm/util/extend.js.map +1 -0
- package/esm/util/extension.d.ts +10 -0
- package/esm/util/extension.js +24 -0
- package/esm/util/extension.js.map +1 -0
- package/esm/util/index.d.ts +14 -0
- package/esm/util/index.js +5 -0
- package/esm/util/index.js.map +1 -0
- package/esm/util/item.d.ts +14 -0
- package/esm/util/item.js +42 -0
- package/esm/util/item.js.map +1 -0
- package/esm/util/mapper.d.ts +17 -0
- package/esm/util/mapper.js +60 -0
- package/esm/util/mapper.js.map +1 -0
- package/esm/util/math.d.ts +8 -0
- package/esm/util/math.js +9 -0
- package/esm/util/math.js.map +1 -0
- package/esm/util/point.d.ts +61 -0
- package/esm/util/point.js +160 -0
- package/esm/util/point.js.map +1 -0
- package/esm/util/shape.d.ts +105 -0
- package/esm/util/shape.js +504 -0
- package/esm/util/shape.js.map +1 -0
- package/esm/util/shape3d.d.ts +23 -0
- package/esm/util/shape3d.js +147 -0
- package/esm/util/shape3d.js.map +1 -0
- package/esm/util/text.d.ts +18 -0
- package/esm/util/text.js +36 -0
- package/esm/util/text.js.map +1 -0
- package/esm/util/type.d.ts +2 -0
- package/esm/util/type.js +2 -0
- package/esm/util/type.js.map +1 -0
- package/esm/util/zoom.d.ts +17 -0
- package/esm/util/zoom.js +36 -0
- package/esm/util/zoom.js.map +1 -0
- package/lib/constant/index.d.ts +1 -0
- package/lib/constant/index.js +18 -0
- package/lib/constant/index.js.map +1 -0
- package/lib/constant/shape.d.ts +27 -0
- package/lib/constant/shape.js +29 -0
- package/lib/constant/shape.js.map +1 -0
- package/lib/index.d.ts +124 -4
- package/lib/index.js +30 -27
- package/lib/index.js.map +1 -0
- package/lib/item/combo.d.ts +4 -0
- package/lib/item/combo.js +10 -0
- package/lib/item/combo.js.map +1 -0
- package/lib/item/edge.d.ts +54 -0
- package/lib/item/edge.js +119 -0
- package/lib/item/edge.js.map +1 -0
- package/lib/item/item.d.ts +189 -0
- package/lib/item/item.js +639 -0
- package/lib/item/item.js.map +1 -0
- package/lib/item/node.d.ts +54 -0
- package/lib/item/node.js +176 -0
- package/lib/item/node.js.map +1 -0
- package/lib/runtime/controller/data.d.ts +65 -0
- package/lib/runtime/controller/data.js +493 -0
- package/lib/runtime/controller/data.js.map +1 -0
- package/lib/runtime/controller/extension.d.ts +9 -0
- package/lib/runtime/controller/extension.js +15 -0
- package/lib/runtime/controller/extension.js.map +1 -0
- package/lib/runtime/controller/index.d.ts +7 -0
- package/lib/runtime/controller/index.js +24 -0
- package/lib/runtime/controller/index.js.map +1 -0
- package/lib/runtime/controller/interaction.d.ts +51 -0
- package/lib/runtime/controller/interaction.js +263 -0
- package/lib/runtime/controller/interaction.js.map +1 -0
- package/lib/runtime/controller/item.d.ts +101 -0
- package/lib/runtime/controller/item.js +544 -0
- package/lib/runtime/controller/item.js.map +1 -0
- package/lib/runtime/controller/layout.d.ts +30 -0
- package/lib/runtime/controller/layout.js +208 -0
- package/lib/runtime/controller/layout.js.map +1 -0
- package/lib/runtime/controller/plugin.d.ts +34 -0
- package/lib/runtime/controller/plugin.js +147 -0
- package/lib/runtime/controller/plugin.js.map +1 -0
- package/lib/runtime/controller/theme.d.ts +29 -0
- package/lib/runtime/controller/theme.js +61 -0
- package/lib/runtime/controller/theme.js.map +1 -0
- package/lib/runtime/controller/viewport.d.ts +11 -0
- package/lib/runtime/controller/viewport.js +106 -0
- package/lib/runtime/controller/viewport.js.map +1 -0
- package/lib/runtime/graph.d.ts +462 -0
- package/lib/runtime/graph.js +1083 -0
- package/lib/runtime/graph.js.map +1 -0
- package/lib/runtime/hooks.d.ts +33 -0
- package/lib/runtime/hooks.js +77 -0
- package/lib/runtime/hooks.js.map +1 -0
- package/lib/stdlib/behavior/activate-relations.d.ts +62 -0
- package/lib/stdlib/behavior/activate-relations.js +84 -0
- package/lib/stdlib/behavior/activate-relations.js.map +1 -0
- package/lib/stdlib/behavior/brush-select.d.ts +110 -0
- package/lib/stdlib/behavior/brush-select.js +271 -0
- package/lib/stdlib/behavior/brush-select.js.map +1 -0
- package/lib/stdlib/behavior/click-select.d.ts +71 -0
- package/lib/stdlib/behavior/click-select.js +146 -0
- package/lib/stdlib/behavior/click-select.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +82 -0
- package/lib/stdlib/behavior/drag-canvas.js +249 -0
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -0
- package/lib/stdlib/behavior/drag-node.d.ts +80 -0
- package/lib/stdlib/behavior/drag-node.js +253 -0
- package/lib/stdlib/behavior/drag-node.js.map +1 -0
- package/lib/stdlib/behavior/hover-activate.d.ts +41 -0
- package/lib/stdlib/behavior/hover-activate.js +67 -0
- package/lib/stdlib/behavior/hover-activate.js.map +1 -0
- package/lib/stdlib/behavior/lasso-select.d.ts +27 -0
- package/lib/stdlib/behavior/lasso-select.js +85 -0
- package/lib/stdlib/behavior/lasso-select.js.map +1 -0
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +37 -0
- package/lib/stdlib/behavior/orbit-canvas-3d.js +68 -0
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +61 -0
- package/lib/stdlib/behavior/rotate-canvas-3d.js +126 -0
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +37 -0
- package/lib/stdlib/behavior/track-canvas-3d.js +68 -0
- package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +51 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js +77 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas.d.ts +61 -0
- package/lib/stdlib/behavior/zoom-canvas.js +163 -0
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -0
- package/lib/stdlib/data/comboFromNode.d.ts +9 -0
- package/lib/stdlib/data/comboFromNode.js +32 -0
- package/lib/stdlib/data/comboFromNode.js.map +1 -0
- package/lib/stdlib/index.d.ts +80 -0
- package/lib/stdlib/index.js +90 -0
- package/lib/stdlib/index.js.map +1 -0
- package/lib/stdlib/item/edge/base.d.ts +111 -0
- package/lib/stdlib/item/edge/base.js +345 -0
- package/lib/stdlib/item/edge/base.js.map +1 -0
- package/lib/stdlib/item/edge/index.d.ts +1 -0
- package/lib/stdlib/item/edge/index.js +18 -0
- package/lib/stdlib/item/edge/index.js.map +1 -0
- package/lib/stdlib/item/edge/line.d.ts +33 -0
- package/lib/stdlib/item/edge/line.js +49 -0
- package/lib/stdlib/item/edge/line.js.map +1 -0
- package/lib/stdlib/item/node/base.d.ts +137 -0
- package/lib/stdlib/item/node/base.js +418 -0
- package/lib/stdlib/item/node/base.js.map +1 -0
- package/lib/stdlib/item/node/base3d.d.ts +72 -0
- package/lib/stdlib/item/node/base3d.js +117 -0
- package/lib/stdlib/item/node/base3d.js.map +1 -0
- package/lib/stdlib/item/node/circle.d.ts +30 -0
- package/lib/stdlib/item/node/circle.js +60 -0
- package/lib/stdlib/item/node/circle.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +2 -0
- package/lib/stdlib/item/node/index.js +19 -0
- package/lib/stdlib/item/node/index.js.map +1 -0
- package/lib/stdlib/item/node/sphere.d.ts +33 -0
- package/lib/stdlib/item/node/sphere.js +56 -0
- package/lib/stdlib/item/node/sphere.js.map +1 -0
- package/lib/stdlib/plugin/legend/index.d.ts +121 -0
- package/lib/stdlib/plugin/legend/index.js +590 -0
- package/lib/stdlib/plugin/legend/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +106 -0
- package/lib/stdlib/plugin/minimap/index.js +581 -0
- package/lib/stdlib/plugin/minimap/index.js.map +1 -0
- package/lib/stdlib/selector/lasso.d.ts +15 -0
- package/lib/stdlib/selector/lasso.js +63 -0
- package/lib/stdlib/selector/lasso.js.map +1 -0
- package/lib/stdlib/selector/rect.d.ts +16 -0
- package/lib/stdlib/selector/rect.js +56 -0
- package/lib/stdlib/selector/rect.js.map +1 -0
- package/lib/stdlib/theme/dark.d.ts +3 -0
- package/lib/stdlib/theme/dark.js +281 -0
- package/lib/stdlib/theme/dark.js.map +1 -0
- package/lib/stdlib/theme/light.d.ts +3 -0
- package/lib/stdlib/theme/light.js +276 -0
- package/lib/stdlib/theme/light.js.map +1 -0
- package/lib/stdlib/themeSolver/base.d.ts +15 -0
- package/lib/stdlib/themeSolver/base.js +14 -0
- package/lib/stdlib/themeSolver/base.js.map +1 -0
- package/lib/stdlib/themeSolver/spec.d.ts +37 -0
- package/lib/stdlib/themeSolver/spec.js +72 -0
- package/lib/stdlib/themeSolver/spec.js.map +1 -0
- package/lib/stdlib/themeSolver/subject.d.ts +43 -0
- package/lib/stdlib/themeSolver/subject.js +404 -0
- package/lib/stdlib/themeSolver/subject.js.map +1 -0
- package/lib/types/animate.d.ts +59 -0
- package/lib/types/animate.js +3 -0
- package/lib/types/animate.js.map +1 -0
- package/lib/types/behavior.d.ts +45 -0
- package/lib/types/behavior.js +18 -0
- package/lib/types/behavior.js.map +1 -0
- package/lib/types/combo.d.ts +87 -0
- package/lib/types/combo.js +3 -0
- package/lib/types/combo.js.map +1 -0
- package/lib/types/common.d.ts +6 -0
- package/lib/types/common.js +3 -0
- package/lib/types/common.js.map +1 -0
- package/lib/types/data.d.ts +21 -0
- package/lib/types/data.js +3 -0
- package/lib/types/data.js.map +1 -0
- package/lib/types/edge.d.ts +100 -0
- package/lib/types/edge.js +3 -0
- package/lib/types/edge.js.map +1 -0
- package/lib/types/event.d.ts +30 -0
- package/lib/types/event.js +34 -0
- package/lib/types/event.js.map +1 -0
- package/lib/types/graph.d.ts +445 -0
- package/lib/types/graph.js +3 -0
- package/lib/types/graph.js.map +1 -0
- package/lib/types/hook.d.ts +97 -0
- package/lib/types/hook.js +3 -0
- package/lib/types/hook.js.map +1 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.js +7 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/item.d.ts +229 -0
- package/lib/types/item.js +19 -0
- package/lib/types/item.js.map +1 -0
- package/lib/types/layout.d.ts +69 -0
- package/lib/types/layout.js +25 -0
- package/lib/types/layout.js.map +1 -0
- package/lib/types/node.d.ts +134 -0
- package/lib/types/node.js +3 -0
- package/lib/types/node.js.map +1 -0
- package/lib/types/plugin.d.ts +40 -0
- package/lib/types/plugin.js +57 -0
- package/lib/types/plugin.js.map +1 -0
- package/lib/types/render.d.ts +1 -0
- package/lib/types/render.js +3 -0
- package/lib/types/render.js.map +1 -0
- package/lib/types/spec.d.ts +65 -0
- package/lib/types/spec.js +3 -0
- package/lib/types/spec.js.map +1 -0
- package/lib/types/stdlib.d.ts +13 -0
- package/lib/types/stdlib.js +3 -0
- package/lib/types/stdlib.js.map +1 -0
- package/lib/types/theme.d.ts +102 -0
- package/lib/types/theme.js +19 -0
- package/lib/types/theme.js.map +1 -0
- package/lib/types/view.d.ts +23 -0
- package/lib/types/view.js +3 -0
- package/lib/types/view.js.map +1 -0
- package/lib/util/animate.d.ts +101 -0
- package/lib/util/animate.js +358 -0
- package/lib/util/animate.js.map +1 -0
- package/lib/util/array.d.ts +20 -0
- package/lib/util/array.js +68 -0
- package/lib/util/array.js.map +1 -0
- package/lib/util/canvas.d.ts +20 -0
- package/lib/util/canvas.js +86 -0
- package/lib/util/canvas.js.map +1 -0
- package/lib/util/event.d.ts +12 -0
- package/lib/util/event.js +30 -0
- package/lib/util/event.js.map +1 -0
- package/lib/util/extend.d.ts +21 -0
- package/lib/util/extend.js +29 -0
- package/lib/util/extend.js.map +1 -0
- package/lib/util/extension.d.ts +10 -0
- package/lib/util/extension.js +29 -0
- package/lib/util/extension.js.map +1 -0
- package/lib/util/index.d.ts +14 -0
- package/lib/util/index.js +7 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/item.d.ts +14 -0
- package/lib/util/item.js +47 -0
- package/lib/util/item.js.map +1 -0
- package/lib/util/mapper.d.ts +17 -0
- package/lib/util/mapper.js +63 -0
- package/lib/util/mapper.js.map +1 -0
- package/lib/util/math.d.ts +8 -0
- package/lib/util/math.js +13 -0
- package/lib/util/math.js.map +1 -0
- package/lib/util/point.d.ts +61 -0
- package/lib/util/point.js +169 -0
- package/lib/util/point.js.map +1 -0
- package/lib/util/shape.d.ts +105 -0
- package/lib/util/shape.js +519 -0
- package/lib/util/shape.js.map +1 -0
- package/lib/util/shape3d.d.ts +23 -0
- package/lib/util/shape3d.js +153 -0
- package/lib/util/shape3d.js.map +1 -0
- package/lib/util/text.d.ts +18 -0
- package/lib/util/text.js +41 -0
- package/lib/util/text.js.map +1 -0
- package/lib/util/type.d.ts +2 -0
- package/lib/util/type.js +6 -0
- package/lib/util/type.js.map +1 -0
- package/lib/util/zoom.d.ts +17 -0
- package/lib/util/zoom.js +41 -0
- package/lib/util/zoom.js.map +1 -0
- package/package.json +82 -50
- package/src/constant/index.ts +1 -0
- package/src/constant/shape.ts +33 -0
- package/src/index.ts +13 -0
- package/src/item/combo.ts +5 -0
- package/src/item/edge.ts +177 -0
- package/src/item/item.ts +812 -0
- package/src/item/node.ts +275 -0
- package/src/runtime/controller/data.ts +575 -0
- package/src/runtime/controller/extension.ts +14 -0
- package/src/runtime/controller/index.ts +7 -0
- package/src/runtime/controller/interaction.ts +343 -0
- package/src/runtime/controller/item.ts +780 -0
- package/src/runtime/controller/layout.ts +251 -0
- package/src/runtime/controller/plugin.ts +171 -0
- package/src/runtime/controller/theme.ts +69 -0
- package/src/runtime/controller/viewport.ts +131 -0
- package/src/runtime/graph.ts +1439 -0
- package/src/runtime/hooks.ts +64 -0
- package/src/stdlib/behavior/activate-relations.ts +139 -0
- package/src/stdlib/behavior/brush-select.ts +386 -0
- package/src/stdlib/behavior/click-select.ts +201 -0
- package/src/stdlib/behavior/drag-canvas.ts +333 -0
- package/src/stdlib/behavior/drag-node.ts +402 -0
- package/src/stdlib/behavior/hover-activate.ts +106 -0
- package/src/stdlib/behavior/lasso-select.ts +94 -0
- package/src/stdlib/behavior/orbit-canvas-3d.ts +104 -0
- package/src/stdlib/behavior/rotate-canvas-3d.ts +172 -0
- package/src/stdlib/behavior/track-canvas-3d.ts +104 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +127 -0
- package/src/stdlib/behavior/zoom-canvas.ts +244 -0
- package/src/stdlib/data/comboFromNode.ts +28 -0
- package/src/stdlib/index.ts +87 -0
- package/src/stdlib/item/edge/base.ts +571 -0
- package/src/stdlib/item/edge/index.ts +1 -0
- package/src/stdlib/item/edge/line.ts +98 -0
- package/src/stdlib/item/node/base.ts +726 -0
- package/src/stdlib/item/node/base3d.ts +192 -0
- package/src/stdlib/item/node/circle.ts +113 -0
- package/src/stdlib/item/node/index.ts +2 -0
- package/src/stdlib/item/node/sphere.ts +99 -0
- package/src/stdlib/plugin/legend/index.ts +733 -0
- package/src/stdlib/plugin/minimap/index.ts +689 -0
- package/src/stdlib/selector/lasso.ts +75 -0
- package/src/stdlib/selector/rect.ts +78 -0
- package/src/stdlib/theme/dark.ts +340 -0
- package/src/stdlib/theme/light.ts +333 -0
- package/src/stdlib/themeSolver/base.ts +22 -0
- package/src/stdlib/themeSolver/spec.ts +110 -0
- package/src/stdlib/themeSolver/subject.ts +502 -0
- package/src/types/animate.ts +71 -0
- package/src/types/behavior.ts +49 -0
- package/src/types/combo.ts +120 -0
- package/src/types/common.ts +7 -0
- package/src/types/data.ts +35 -0
- package/src/types/edge.ts +119 -0
- package/src/types/event.ts +47 -0
- package/src/types/graph.ts +573 -0
- package/src/types/hook.ts +98 -0
- package/src/types/index.ts +29 -0
- package/src/types/item.ts +324 -0
- package/src/types/layout.ts +138 -0
- package/src/types/node.ts +162 -0
- package/src/types/plugin.ts +77 -0
- package/src/types/render.ts +1 -0
- package/src/types/spec.ts +116 -0
- package/src/types/stdlib.ts +25 -0
- package/src/types/theme.ts +101 -0
- package/src/types/view.ts +31 -0
- package/src/util/animate.ts +430 -0
- package/src/util/array.ts +57 -0
- package/src/util/canvas.ts +95 -0
- package/src/util/event.ts +34 -0
- package/src/util/extend.ts +42 -0
- package/src/util/extension.ts +29 -0
- package/src/util/index.ts +4 -0
- package/src/util/item.ts +70 -0
- package/src/util/mapper.ts +61 -0
- package/src/util/math.ts +9 -0
- package/src/util/point.ts +195 -0
- package/src/util/shape.ts +609 -0
- package/src/util/shape3d.ts +198 -0
- package/src/util/text.ts +49 -0
- package/src/util/type.ts +4 -0
- package/src/util/zoom.ts +39 -0
- package/README.en-US.md +0 -170
- package/README.md +0 -177
- package/dist/g6.min.js.map +0 -1
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -5
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { AnimateCfg } from './animate';
|
|
2
|
+
import { Point } from './common';
|
|
3
|
+
import {
|
|
4
|
+
FetchDataConfig,
|
|
5
|
+
GraphData,
|
|
6
|
+
InlineDataConfig,
|
|
7
|
+
TransformerFn,
|
|
8
|
+
} from './data';
|
|
9
|
+
import {
|
|
10
|
+
EdgeDisplayModel,
|
|
11
|
+
EdgeEncode,
|
|
12
|
+
EdgeModel,
|
|
13
|
+
EdgeShapesEncode,
|
|
14
|
+
} from './edge';
|
|
15
|
+
import {
|
|
16
|
+
NodeDisplayModel,
|
|
17
|
+
NodeEncode,
|
|
18
|
+
NodeModel,
|
|
19
|
+
NodeShapesEncode,
|
|
20
|
+
} from './node';
|
|
21
|
+
import { GraphAlignment } from './view';
|
|
22
|
+
import {
|
|
23
|
+
ComboDisplayModel,
|
|
24
|
+
ComboEncode,
|
|
25
|
+
ComboModel,
|
|
26
|
+
ComboShapesEncode,
|
|
27
|
+
} from './combo';
|
|
28
|
+
import { BehaviorOptionsOf, BehaviorRegistry } from './behavior';
|
|
29
|
+
import { LayoutOptions } from './layout';
|
|
30
|
+
import { ThemeOptionsOf, ThemeRegistry } from './theme';
|
|
31
|
+
|
|
32
|
+
import { RendererName } from './render';
|
|
33
|
+
|
|
34
|
+
export interface Specification<
|
|
35
|
+
B extends BehaviorRegistry,
|
|
36
|
+
T extends ThemeRegistry,
|
|
37
|
+
> {
|
|
38
|
+
type: 'graph' | 'tree';
|
|
39
|
+
container: string | HTMLElement;
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
renderer?:
|
|
43
|
+
| RendererName
|
|
44
|
+
| {
|
|
45
|
+
type: RendererName;
|
|
46
|
+
pixelRatio: number;
|
|
47
|
+
headless: boolean;
|
|
48
|
+
};
|
|
49
|
+
zoom?: number;
|
|
50
|
+
autoFit?:
|
|
51
|
+
| 'view'
|
|
52
|
+
| 'center'
|
|
53
|
+
| {
|
|
54
|
+
position: Point;
|
|
55
|
+
alignment: GraphAlignment;
|
|
56
|
+
};
|
|
57
|
+
optimizeThreshold?: number;
|
|
58
|
+
|
|
59
|
+
/** data */
|
|
60
|
+
data: GraphData | InlineDataConfig | FetchDataConfig; // TODO: more
|
|
61
|
+
transform?:
|
|
62
|
+
| string[]
|
|
63
|
+
| {
|
|
64
|
+
type: string;
|
|
65
|
+
[param: string]: unknown; // TODO: generate by plugins
|
|
66
|
+
}[]
|
|
67
|
+
| TransformerFn[];
|
|
68
|
+
|
|
69
|
+
/** item */
|
|
70
|
+
node?: ((data: NodeModel) => NodeDisplayModel) | NodeEncode;
|
|
71
|
+
edge?: ((data: EdgeModel) => EdgeDisplayModel) | EdgeEncode;
|
|
72
|
+
combo?: ((data: ComboModel) => ComboDisplayModel) | ComboEncode;
|
|
73
|
+
|
|
74
|
+
/** item state styles */
|
|
75
|
+
nodeState?: {
|
|
76
|
+
[stateName: string]:
|
|
77
|
+
| ((data: NodeModel) => NodeDisplayModel)
|
|
78
|
+
| NodeShapesEncode;
|
|
79
|
+
};
|
|
80
|
+
edgeState?: {
|
|
81
|
+
[stateName: string]:
|
|
82
|
+
| ((data: EdgeModel) => EdgeDisplayModel)
|
|
83
|
+
| EdgeShapesEncode;
|
|
84
|
+
};
|
|
85
|
+
comboState?: {
|
|
86
|
+
[stateName: string]:
|
|
87
|
+
| ((data: ComboModel) => ComboDisplayModel)
|
|
88
|
+
| ComboShapesEncode;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** layout */
|
|
92
|
+
layout?: LayoutOptions | LayoutOptions[];
|
|
93
|
+
|
|
94
|
+
/** interaction */
|
|
95
|
+
modes?: {
|
|
96
|
+
// default: BehaviorOptionsOf<B>[]; // TODO: behavior config comes from behaviors; TODO: interaction specs
|
|
97
|
+
[mode: string]: BehaviorOptionsOf<B>[]; // TODO: behavior config comes from behaviors; TODO: interaction specs
|
|
98
|
+
};
|
|
99
|
+
mode?: 'default' | string;
|
|
100
|
+
|
|
101
|
+
/** global animate */
|
|
102
|
+
animate?: AnimateCfg;
|
|
103
|
+
|
|
104
|
+
/** free plugins */
|
|
105
|
+
plugins?: (
|
|
106
|
+
| string
|
|
107
|
+
| {
|
|
108
|
+
key: string;
|
|
109
|
+
type: string;
|
|
110
|
+
[cfgName: string]: unknown; // TODO: configs from plugins
|
|
111
|
+
}
|
|
112
|
+
)[];
|
|
113
|
+
|
|
114
|
+
/** theme */
|
|
115
|
+
theme?: ThemeOptionsOf<T>;
|
|
116
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BehaviorRegistry } from './behavior';
|
|
2
|
+
import { ThemeRegistry } from './theme';
|
|
3
|
+
|
|
4
|
+
export type StdLibCategory =
|
|
5
|
+
| 'transform'
|
|
6
|
+
| 'behavior'
|
|
7
|
+
| 'layout'
|
|
8
|
+
| 'node'
|
|
9
|
+
| 'edge'
|
|
10
|
+
| 'combo'
|
|
11
|
+
| 'theme'
|
|
12
|
+
| 'themeSolver'
|
|
13
|
+
| 'plugin';
|
|
14
|
+
|
|
15
|
+
export interface Lib {
|
|
16
|
+
behaviors?: BehaviorRegistry;
|
|
17
|
+
themes?: ThemeRegistry;
|
|
18
|
+
// TODO: type templates
|
|
19
|
+
transforms?: Record<string, unknown>;
|
|
20
|
+
layouts?: Record<string, unknown>;
|
|
21
|
+
nodes?: Record<string, unknown>;
|
|
22
|
+
edges?: Record<string, unknown>;
|
|
23
|
+
combos?: Record<string, unknown>;
|
|
24
|
+
plugins?: Record<string, unknown>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import BaseThemeSolver from 'stdlib/themeSolver/base';
|
|
2
|
+
import { ComboShapeStyles } from './combo';
|
|
3
|
+
import { EdgeShapeStyles } from './edge';
|
|
4
|
+
import { LodStrategy } from './item';
|
|
5
|
+
import { NodeShapeStyles } from './node';
|
|
6
|
+
|
|
7
|
+
export interface ThemeOption {}
|
|
8
|
+
/**
|
|
9
|
+
* Base behavior.
|
|
10
|
+
* Two implementing ways: getSpec or getEvents
|
|
11
|
+
*/
|
|
12
|
+
export abstract class Theme {
|
|
13
|
+
options: any = {};
|
|
14
|
+
constructor(options: any) {
|
|
15
|
+
this.options = options;
|
|
16
|
+
}
|
|
17
|
+
updateConfig = (options: any) => {
|
|
18
|
+
this.options = Object.assign(this.options, options);
|
|
19
|
+
};
|
|
20
|
+
destroy() {}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Theme regisry table.
|
|
24
|
+
* @example { 'drag-node': DragNodeBehavior, 'my-drag-node': MyDragNodeBehavior }
|
|
25
|
+
*/
|
|
26
|
+
export interface ThemeRegistry {
|
|
27
|
+
[type: string]: typeof BaseThemeSolver;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Type gymnastics, input registry table, output configure type.
|
|
32
|
+
* @example ThemeOptionsOf<{ 'drag-node': typeof DragNodeBehavior }> // 'drag-node' | { type: 'drag-node', key?: 'ctrl' | 'shift' }
|
|
33
|
+
*/
|
|
34
|
+
export type ThemeOptionsOf<T extends ThemeRegistry = {}> =
|
|
35
|
+
| Extract<keyof T, string>
|
|
36
|
+
| {
|
|
37
|
+
[K in keyof T]: T[K] extends { new (options: infer O): any }
|
|
38
|
+
? O & { type: K }
|
|
39
|
+
: { type: K };
|
|
40
|
+
}[Extract<keyof T, string>];
|
|
41
|
+
|
|
42
|
+
export type ThemeObjectOptionsOf<T extends ThemeRegistry = {}> = {
|
|
43
|
+
[K in keyof T]: T[K] extends { new (options: infer O): any }
|
|
44
|
+
? O & { type: K; key: string }
|
|
45
|
+
: never;
|
|
46
|
+
}[Extract<keyof T, string>];
|
|
47
|
+
|
|
48
|
+
/** Default and stateStyle for an item */
|
|
49
|
+
export type NodeStyleSet = {
|
|
50
|
+
default?: NodeShapeStyles;
|
|
51
|
+
seledted?: NodeShapeStyles;
|
|
52
|
+
[stateName: string]: NodeShapeStyles;
|
|
53
|
+
};
|
|
54
|
+
export type EdgeStyleSet = {
|
|
55
|
+
default?: EdgeShapeStyles;
|
|
56
|
+
[stateName: string]: EdgeShapeStyles;
|
|
57
|
+
};
|
|
58
|
+
export type ComboStyleSet = {
|
|
59
|
+
default?: ComboShapeStyles;
|
|
60
|
+
[stateName: string]: ComboShapeStyles;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type NodeStyleSets =
|
|
64
|
+
| NodeStyleSet[]
|
|
65
|
+
| { [dataTypeValue: string]: NodeStyleSet };
|
|
66
|
+
export type EdgeStyleSets =
|
|
67
|
+
| EdgeStyleSet[]
|
|
68
|
+
| { [dataTypeValue: string]: EdgeStyleSet };
|
|
69
|
+
export type ComboStyleSets =
|
|
70
|
+
| ComboStyleSet[]
|
|
71
|
+
| { [dataTypeValue: string]: ComboStyleSet };
|
|
72
|
+
|
|
73
|
+
export interface NodeThemeSpecifications {
|
|
74
|
+
dataTypeField?: string;
|
|
75
|
+
palette?: string[] | { [dataTypeValue: string]: string };
|
|
76
|
+
styles?: NodeStyleSets;
|
|
77
|
+
lodStrategy?: LodStrategy;
|
|
78
|
+
}
|
|
79
|
+
export interface EdgeThemeSpecifications {
|
|
80
|
+
dataTypeField?: string;
|
|
81
|
+
palette?: string[] | { [dataTypeValue: string]: string };
|
|
82
|
+
styles?: EdgeStyleSets;
|
|
83
|
+
lodStrategy?: LodStrategy;
|
|
84
|
+
}
|
|
85
|
+
export interface ComboThemeSpecifications {
|
|
86
|
+
dataTypeField?: string;
|
|
87
|
+
palette?: string[] | { [dataTypeValue: string]: string };
|
|
88
|
+
styles?: ComboStyleSets;
|
|
89
|
+
lodStrategy?: LodStrategy;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Theme specification
|
|
93
|
+
*/
|
|
94
|
+
export interface ThemeSpecification {
|
|
95
|
+
node?: NodeThemeSpecifications;
|
|
96
|
+
edge?: EdgeThemeSpecifications;
|
|
97
|
+
combo?: ComboThemeSpecifications;
|
|
98
|
+
canvas?: {
|
|
99
|
+
[cssName: string]: unknown;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface FitViewRules {
|
|
2
|
+
onlyOutOfViewPort?: boolean; // Whehter fit it only when the graph is out of the view.
|
|
3
|
+
direction?: 'x' | 'y' | 'both'; // Axis to fit.
|
|
4
|
+
ratioRule?: 'max' | 'min'; // Ratio rule to fit.
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type GraphAlignment =
|
|
8
|
+
| 'left-top'
|
|
9
|
+
| 'right-top'
|
|
10
|
+
| 'left-bottom'
|
|
11
|
+
| 'right-bottom'
|
|
12
|
+
| 'center'
|
|
13
|
+
| [number, number];
|
|
14
|
+
|
|
15
|
+
export type GraphTransformOptions = {
|
|
16
|
+
translate?: Partial<{
|
|
17
|
+
dx: number;
|
|
18
|
+
dy: number;
|
|
19
|
+
dz: number;
|
|
20
|
+
}>;
|
|
21
|
+
rotate?: {
|
|
22
|
+
angle: number;
|
|
23
|
+
};
|
|
24
|
+
zoom?: {
|
|
25
|
+
ratio: number;
|
|
26
|
+
};
|
|
27
|
+
origin?: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DisplayObject,
|
|
3
|
+
Group,
|
|
4
|
+
IAnimation,
|
|
5
|
+
Line,
|
|
6
|
+
Path,
|
|
7
|
+
Polyline,
|
|
8
|
+
} from '@antv/g';
|
|
9
|
+
import {
|
|
10
|
+
AnimateTiming,
|
|
11
|
+
IAnimate,
|
|
12
|
+
IAnimates,
|
|
13
|
+
IStateAnimate,
|
|
14
|
+
} from '../types/animate';
|
|
15
|
+
import { ItemShapeStyles, ShapeStyle } from '../types/item';
|
|
16
|
+
import { isArrayOverlap, replaceElements } from './array';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Initial(timing = show) shape animation start from init shape styles, and end to the shape's style config.
|
|
20
|
+
*/
|
|
21
|
+
export const getShapeAnimateBeginStyles = (shape) => {
|
|
22
|
+
if (!shape) return {};
|
|
23
|
+
const shapeType = shape.nodeName;
|
|
24
|
+
const commonStyles = {
|
|
25
|
+
opacity: 0,
|
|
26
|
+
strokeOpacity: 0,
|
|
27
|
+
lineWidth: 1,
|
|
28
|
+
offsetDistance: 0,
|
|
29
|
+
};
|
|
30
|
+
if (['line', 'polyline', 'path'].includes(shapeType)) {
|
|
31
|
+
const totalLength = shape.getTotalLength();
|
|
32
|
+
return {
|
|
33
|
+
lineDash: [0, totalLength],
|
|
34
|
+
...commonStyles,
|
|
35
|
+
};
|
|
36
|
+
} else if (shapeType === 'circle') {
|
|
37
|
+
return {
|
|
38
|
+
r: 0,
|
|
39
|
+
...commonStyles,
|
|
40
|
+
};
|
|
41
|
+
} else if (shapeType === 'ellipse') {
|
|
42
|
+
return {
|
|
43
|
+
rx: 0,
|
|
44
|
+
ry: 0,
|
|
45
|
+
...commonStyles,
|
|
46
|
+
};
|
|
47
|
+
} else if (shapeType === 'text') {
|
|
48
|
+
return {
|
|
49
|
+
fontSize: 0,
|
|
50
|
+
opacity: 0,
|
|
51
|
+
strokeOpacity: 0,
|
|
52
|
+
offsetDistance: 0,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
width: 0,
|
|
57
|
+
height: 0,
|
|
58
|
+
...commonStyles,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Initial(timing = show) group animation start from GROUP_ANIMATE_STYLES[0], and end to GROUP_ANIMATE_STYLES[1].
|
|
63
|
+
*/
|
|
64
|
+
export const GROUP_ANIMATE_STYLES = [
|
|
65
|
+
{
|
|
66
|
+
opacity: 0,
|
|
67
|
+
transform: 'scale(0)',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
opacity: 1,
|
|
71
|
+
transform: 'scale(1)',
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Default animate options for different timing.
|
|
77
|
+
*/
|
|
78
|
+
export const DEFAULT_ANIMATE_CFG = {
|
|
79
|
+
buildIn: {
|
|
80
|
+
duration: 500,
|
|
81
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
82
|
+
iterations: 1,
|
|
83
|
+
delay: 1000,
|
|
84
|
+
fill: 'both',
|
|
85
|
+
},
|
|
86
|
+
show: {
|
|
87
|
+
duration: 500,
|
|
88
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
89
|
+
iterations: 1,
|
|
90
|
+
fill: 'both',
|
|
91
|
+
},
|
|
92
|
+
update: {
|
|
93
|
+
duration: 500,
|
|
94
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
95
|
+
iterations: 1,
|
|
96
|
+
fill: 'both',
|
|
97
|
+
},
|
|
98
|
+
zoom: {
|
|
99
|
+
duration: 200,
|
|
100
|
+
easing: 'linear',
|
|
101
|
+
iterations: 1,
|
|
102
|
+
delay: 0,
|
|
103
|
+
fill: 'both',
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get different key value map between style1 and style2.
|
|
109
|
+
* @param style1
|
|
110
|
+
* @param style2
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
const getStyleDiff = (style1: ShapeStyle, style2: ShapeStyle) => {
|
|
114
|
+
const diff = [{}, {}];
|
|
115
|
+
Object.keys(style1).forEach((key) => {
|
|
116
|
+
if (style2[key] !== style1[key]) {
|
|
117
|
+
diff[0][key] = style1[key];
|
|
118
|
+
diff[1][key] = style2[key];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return diff;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Grouping the animates at a timing by order.
|
|
126
|
+
* @param animates
|
|
127
|
+
* @param timing
|
|
128
|
+
* @returns
|
|
129
|
+
*/
|
|
130
|
+
const groupTimingAnimates = (
|
|
131
|
+
animates: IAnimates,
|
|
132
|
+
segmentedTiming: AnimateTiming | 'stateUpdate',
|
|
133
|
+
changedStates: string[],
|
|
134
|
+
) => {
|
|
135
|
+
const timingAnimateGroups = {};
|
|
136
|
+
const isStateUpdate = segmentedTiming === 'stateUpdate';
|
|
137
|
+
animates[isStateUpdate ? 'update' : segmentedTiming].forEach((item: any) => {
|
|
138
|
+
const { order = 0, states } = item;
|
|
139
|
+
if (
|
|
140
|
+
!isStateUpdate ||
|
|
141
|
+
(isStateUpdate && isArrayOverlap(states, changedStates))
|
|
142
|
+
) {
|
|
143
|
+
timingAnimateGroups[order] = timingAnimateGroups[order] || [];
|
|
144
|
+
timingAnimateGroups[order].push(item);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return timingAnimateGroups;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Execute animations in order at a timing.
|
|
152
|
+
* @param shapeMap
|
|
153
|
+
* @param group
|
|
154
|
+
* @param timingAnimates
|
|
155
|
+
* @param targetStylesMap
|
|
156
|
+
* @param timing
|
|
157
|
+
* @param onfinish
|
|
158
|
+
*/
|
|
159
|
+
const runAnimateGroupOnShapes = (
|
|
160
|
+
shapeMap: { [shapeId: string]: DisplayObject },
|
|
161
|
+
group: Group,
|
|
162
|
+
timingAnimates: IAnimate[],
|
|
163
|
+
targetStylesMap: ItemShapeStyles,
|
|
164
|
+
timing: AnimateTiming,
|
|
165
|
+
onfinish: Function,
|
|
166
|
+
cancelAnimations: Function,
|
|
167
|
+
canceled: Boolean,
|
|
168
|
+
) => {
|
|
169
|
+
let maxDuration = -Infinity;
|
|
170
|
+
let maxDurationIdx = -1;
|
|
171
|
+
let hasCanceled = canceled;
|
|
172
|
+
const isOut = timing === 'buildOut' || timing === 'hide';
|
|
173
|
+
const animations = timingAnimates.map((animate: any, i) => {
|
|
174
|
+
const { fields, shapeId, order, states, ...animateCfg } = animate;
|
|
175
|
+
const animateConfig = {
|
|
176
|
+
...DEFAULT_ANIMATE_CFG[timing],
|
|
177
|
+
...animateCfg,
|
|
178
|
+
};
|
|
179
|
+
const { duration } = animateConfig;
|
|
180
|
+
|
|
181
|
+
let animation;
|
|
182
|
+
if (!shapeId || shapeId === 'group') {
|
|
183
|
+
// animate on group
|
|
184
|
+
const usingFields = [];
|
|
185
|
+
let hasOpacity = false;
|
|
186
|
+
fields?.forEach((field) => {
|
|
187
|
+
if (field === 'size') usingFields.push('transform');
|
|
188
|
+
else if (field !== 'opacity') usingFields.push(field);
|
|
189
|
+
else hasOpacity = true;
|
|
190
|
+
});
|
|
191
|
+
const targetStyle =
|
|
192
|
+
targetStylesMap.group || GROUP_ANIMATE_STYLES[isOut ? 0 : 1];
|
|
193
|
+
if (hasCanceled) {
|
|
194
|
+
Object.keys(targetStyle).forEach((key) => {
|
|
195
|
+
group.style[key] = targetStyle[key];
|
|
196
|
+
});
|
|
197
|
+
} else {
|
|
198
|
+
if (hasOpacity) {
|
|
199
|
+
// opacity on group, animate on all shapes
|
|
200
|
+
Object.keys(shapeMap).forEach((shapeId) => {
|
|
201
|
+
const { opacity: targetOpaicty = 1 } =
|
|
202
|
+
targetStylesMap[shapeId] ||
|
|
203
|
+
targetStylesMap.otherShapes?.[shapeId] ||
|
|
204
|
+
{};
|
|
205
|
+
animation = runAnimateOnShape(
|
|
206
|
+
shapeMap[shapeId],
|
|
207
|
+
['opacity'],
|
|
208
|
+
{ opacity: targetOpaicty },
|
|
209
|
+
getShapeAnimateBeginStyles(shapeMap[shapeId]),
|
|
210
|
+
animateConfig,
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
if (usingFields.length) {
|
|
215
|
+
animation = runAnimateOnShape(
|
|
216
|
+
group,
|
|
217
|
+
usingFields,
|
|
218
|
+
targetStyle,
|
|
219
|
+
GROUP_ANIMATE_STYLES[isOut ? 1 : 0],
|
|
220
|
+
animateConfig,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
const shape = shapeMap[shapeId];
|
|
226
|
+
if (shape && shape.style.display !== 'none') {
|
|
227
|
+
const targetStyle =
|
|
228
|
+
targetStylesMap[shapeId] ||
|
|
229
|
+
targetStylesMap.otherShapes?.[shapeId] ||
|
|
230
|
+
{};
|
|
231
|
+
if (hasCanceled) {
|
|
232
|
+
Object.keys(targetStyle).forEach((key) => {
|
|
233
|
+
shape.style[key] = targetStyle[key];
|
|
234
|
+
});
|
|
235
|
+
} else {
|
|
236
|
+
animation = runAnimateOnShape(
|
|
237
|
+
shape,
|
|
238
|
+
fields,
|
|
239
|
+
targetStyle,
|
|
240
|
+
getShapeAnimateBeginStyles(shape),
|
|
241
|
+
animateConfig,
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (maxDuration < duration && animation) {
|
|
247
|
+
maxDuration = duration;
|
|
248
|
+
maxDurationIdx = i;
|
|
249
|
+
}
|
|
250
|
+
if (animation) {
|
|
251
|
+
animation.oncancel = () => {
|
|
252
|
+
hasCanceled = true;
|
|
253
|
+
cancelAnimations();
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
return animation;
|
|
257
|
+
});
|
|
258
|
+
if (maxDurationIdx > -1) animations[maxDurationIdx].onfinish = onfinish;
|
|
259
|
+
return animations;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Execute one animation.
|
|
264
|
+
* @param shape
|
|
265
|
+
* @param fields
|
|
266
|
+
* @param targetStyle
|
|
267
|
+
* @param beginStyle
|
|
268
|
+
* @param animateConfig
|
|
269
|
+
* @returns
|
|
270
|
+
*/
|
|
271
|
+
const runAnimateOnShape = (
|
|
272
|
+
shape: DisplayObject,
|
|
273
|
+
fields: string[],
|
|
274
|
+
targetStyle: ShapeStyle,
|
|
275
|
+
beginStyle: ShapeStyle,
|
|
276
|
+
animateConfig,
|
|
277
|
+
) => {
|
|
278
|
+
if (!shape.isVisible()) return;
|
|
279
|
+
let animateArr;
|
|
280
|
+
if (!fields?.length) {
|
|
281
|
+
animateArr = getStyleDiff(shape.attributes, targetStyle);
|
|
282
|
+
} else {
|
|
283
|
+
animateArr = [{}, {}];
|
|
284
|
+
fields.forEach((key) => {
|
|
285
|
+
animateArr[0][key] = shape.attributes.hasOwnProperty(key)
|
|
286
|
+
? shape.style[key]
|
|
287
|
+
: beginStyle[key];
|
|
288
|
+
animateArr[1][key] =
|
|
289
|
+
targetStyle[key] === undefined ? animateArr[0][key] : targetStyle[key];
|
|
290
|
+
if (key === 'lineDash' && animateArr[1][key].includes('100%')) {
|
|
291
|
+
const totalLength = (shape as Line | Polyline | Path).getTotalLength();
|
|
292
|
+
replaceElements(animateArr[1][key], '100%', totalLength);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
if (JSON.stringify(animateArr[0]) === JSON.stringify(animateArr[1])) return;
|
|
297
|
+
return shape.animate(animateArr, animateConfig);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Handle shape and group animations.
|
|
302
|
+
* Should be called after canvas ready and shape appended.
|
|
303
|
+
* @param animates
|
|
304
|
+
* @param mergedStyles
|
|
305
|
+
* @param shapeMap
|
|
306
|
+
* @param group
|
|
307
|
+
* @param timing timing to match 'when' in the animate config in style
|
|
308
|
+
* @returns
|
|
309
|
+
*/
|
|
310
|
+
export const animateShapes = (
|
|
311
|
+
animates: IAnimates,
|
|
312
|
+
mergedStyles: ItemShapeStyles,
|
|
313
|
+
shapeMap: { [shapeId: string]: DisplayObject },
|
|
314
|
+
group: Group,
|
|
315
|
+
timing: AnimateTiming = 'buildIn',
|
|
316
|
+
changedStates: string[] = [],
|
|
317
|
+
onAnimatesFrame: Function = () => {},
|
|
318
|
+
onAnimatesEnd: Function = () => {},
|
|
319
|
+
): IAnimation[] => {
|
|
320
|
+
if (!animates?.[timing]) {
|
|
321
|
+
onAnimatesEnd();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const segmentedTiming =
|
|
325
|
+
timing === 'update' && changedStates?.length ? 'stateUpdate' : timing;
|
|
326
|
+
const timingAnimateGroups = groupTimingAnimates(
|
|
327
|
+
animates,
|
|
328
|
+
segmentedTiming,
|
|
329
|
+
changedStates,
|
|
330
|
+
);
|
|
331
|
+
let i = 0;
|
|
332
|
+
const groupKeys = Object.keys(timingAnimateGroups);
|
|
333
|
+
if (!groupKeys.length) return;
|
|
334
|
+
let animations = [];
|
|
335
|
+
let canceled = false;
|
|
336
|
+
const onfinish = () => {
|
|
337
|
+
if (i >= groupKeys.length) {
|
|
338
|
+
onAnimatesEnd();
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const groupAnimations = runAnimateGroupOnShapes(
|
|
342
|
+
shapeMap,
|
|
343
|
+
group,
|
|
344
|
+
timingAnimateGroups[groupKeys[i]],
|
|
345
|
+
mergedStyles,
|
|
346
|
+
timing,
|
|
347
|
+
onfinish, // execute next order group
|
|
348
|
+
() => (canceled = true),
|
|
349
|
+
canceled,
|
|
350
|
+
).filter(Boolean);
|
|
351
|
+
groupAnimations.forEach((animation) => {
|
|
352
|
+
animation.onframe = onAnimatesFrame;
|
|
353
|
+
});
|
|
354
|
+
if (i === 0) {
|
|
355
|
+
// collect the first group animations
|
|
356
|
+
animations = groupAnimations;
|
|
357
|
+
}
|
|
358
|
+
i++;
|
|
359
|
+
};
|
|
360
|
+
onfinish();
|
|
361
|
+
// only animations with order 0 will be returned
|
|
362
|
+
return animations;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
export const getAnimatesExcludePosition = (animates) => {
|
|
366
|
+
if (!animates.update) return animates;
|
|
367
|
+
const isGroupId = (id) => !id || id === 'group';
|
|
368
|
+
// const groupUpdateAnimates = animates.update.filter(
|
|
369
|
+
// ({ shapeId }) => isGroupId(shapeId),
|
|
370
|
+
// );
|
|
371
|
+
const excludedAnimates = [];
|
|
372
|
+
animates.update.forEach((animate) => {
|
|
373
|
+
const { shapeId, fields } = animate;
|
|
374
|
+
if (!isGroupId(shapeId)) {
|
|
375
|
+
excludedAnimates.push(animate);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const newFields = fields;
|
|
379
|
+
let isGroupPosition = false;
|
|
380
|
+
if (fields.includes('x')) {
|
|
381
|
+
const xFieldIdx = newFields.indexOf('x');
|
|
382
|
+
newFields.splice(xFieldIdx, 1);
|
|
383
|
+
isGroupPosition = true;
|
|
384
|
+
}
|
|
385
|
+
if (fields.includes('y')) {
|
|
386
|
+
const yFieldIdx = newFields.indexOf('y');
|
|
387
|
+
newFields.splice(yFieldIdx, 1);
|
|
388
|
+
isGroupPosition = true;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (isGroupPosition) {
|
|
392
|
+
if (newFields.length !== 0) {
|
|
393
|
+
// group animation but not on x and y
|
|
394
|
+
excludedAnimates.push({
|
|
395
|
+
...animate,
|
|
396
|
+
fields: newFields,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
excludedAnimates.push(animate);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
...animates,
|
|
406
|
+
update: excludedAnimates,
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
export const fadeIn = (id, shape, style, hiddenShape, animateConfig) => {
|
|
411
|
+
// omit inexist shape and the shape which is not hidden by zoom changing
|
|
412
|
+
if (!shape || !hiddenShape[id]) return;
|
|
413
|
+
if (!shape?.isVisible()) {
|
|
414
|
+
shape.style.opacity = 0;
|
|
415
|
+
shape.show();
|
|
416
|
+
}
|
|
417
|
+
const { opacity: oriOpacity = 1 } = shape.attributes;
|
|
418
|
+
if (oriOpacity === 1) return;
|
|
419
|
+
const { opacity = 1 } = style;
|
|
420
|
+
shape.animate([{ opacity: 0 }, { opacity }], animateConfig);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
export const fadeOut = (id, shape, hiddenShape, animateConfig) => {
|
|
424
|
+
if (!shape?.isVisible()) return;
|
|
425
|
+
hiddenShape[id] = true;
|
|
426
|
+
const { opacity = 1 } = shape.attributes;
|
|
427
|
+
if (opacity === 0) return;
|
|
428
|
+
const animation = shape.animate([{ opacity }, { opacity: 0 }], animateConfig);
|
|
429
|
+
animation.onfinish = () => shape.hide();
|
|
430
|
+
};
|