@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,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.fadeOut = exports.fadeIn = exports.getAnimatesExcludePosition = exports.animateShapes = exports.DEFAULT_ANIMATE_CFG = exports.GROUP_ANIMATE_STYLES = exports.getShapeAnimateBeginStyles = void 0;
|
|
15
|
+
const array_1 = require("./array");
|
|
16
|
+
/**
|
|
17
|
+
* Initial(timing = show) shape animation start from init shape styles, and end to the shape's style config.
|
|
18
|
+
*/
|
|
19
|
+
const getShapeAnimateBeginStyles = (shape) => {
|
|
20
|
+
if (!shape)
|
|
21
|
+
return {};
|
|
22
|
+
const shapeType = shape.nodeName;
|
|
23
|
+
const commonStyles = {
|
|
24
|
+
opacity: 0,
|
|
25
|
+
strokeOpacity: 0,
|
|
26
|
+
lineWidth: 1,
|
|
27
|
+
offsetDistance: 0,
|
|
28
|
+
};
|
|
29
|
+
if (['line', 'polyline', 'path'].includes(shapeType)) {
|
|
30
|
+
const totalLength = shape.getTotalLength();
|
|
31
|
+
return Object.assign({ lineDash: [0, totalLength] }, commonStyles);
|
|
32
|
+
}
|
|
33
|
+
else if (shapeType === 'circle') {
|
|
34
|
+
return Object.assign({ r: 0 }, commonStyles);
|
|
35
|
+
}
|
|
36
|
+
else if (shapeType === 'ellipse') {
|
|
37
|
+
return Object.assign({ rx: 0, ry: 0 }, commonStyles);
|
|
38
|
+
}
|
|
39
|
+
else if (shapeType === 'text') {
|
|
40
|
+
return {
|
|
41
|
+
fontSize: 0,
|
|
42
|
+
opacity: 0,
|
|
43
|
+
strokeOpacity: 0,
|
|
44
|
+
offsetDistance: 0,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return Object.assign({ width: 0, height: 0 }, commonStyles);
|
|
48
|
+
};
|
|
49
|
+
exports.getShapeAnimateBeginStyles = getShapeAnimateBeginStyles;
|
|
50
|
+
/**
|
|
51
|
+
* Initial(timing = show) group animation start from GROUP_ANIMATE_STYLES[0], and end to GROUP_ANIMATE_STYLES[1].
|
|
52
|
+
*/
|
|
53
|
+
exports.GROUP_ANIMATE_STYLES = [
|
|
54
|
+
{
|
|
55
|
+
opacity: 0,
|
|
56
|
+
transform: 'scale(0)',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
opacity: 1,
|
|
60
|
+
transform: 'scale(1)',
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Default animate options for different timing.
|
|
65
|
+
*/
|
|
66
|
+
exports.DEFAULT_ANIMATE_CFG = {
|
|
67
|
+
buildIn: {
|
|
68
|
+
duration: 500,
|
|
69
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
70
|
+
iterations: 1,
|
|
71
|
+
delay: 1000,
|
|
72
|
+
fill: 'both',
|
|
73
|
+
},
|
|
74
|
+
show: {
|
|
75
|
+
duration: 500,
|
|
76
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
77
|
+
iterations: 1,
|
|
78
|
+
fill: 'both',
|
|
79
|
+
},
|
|
80
|
+
update: {
|
|
81
|
+
duration: 500,
|
|
82
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
83
|
+
iterations: 1,
|
|
84
|
+
fill: 'both',
|
|
85
|
+
},
|
|
86
|
+
zoom: {
|
|
87
|
+
duration: 200,
|
|
88
|
+
easing: 'linear',
|
|
89
|
+
iterations: 1,
|
|
90
|
+
delay: 0,
|
|
91
|
+
fill: 'both',
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Get different key value map between style1 and style2.
|
|
96
|
+
* @param style1
|
|
97
|
+
* @param style2
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
const getStyleDiff = (style1, style2) => {
|
|
101
|
+
const diff = [{}, {}];
|
|
102
|
+
Object.keys(style1).forEach((key) => {
|
|
103
|
+
if (style2[key] !== style1[key]) {
|
|
104
|
+
diff[0][key] = style1[key];
|
|
105
|
+
diff[1][key] = style2[key];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return diff;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Grouping the animates at a timing by order.
|
|
112
|
+
* @param animates
|
|
113
|
+
* @param timing
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
const groupTimingAnimates = (animates, segmentedTiming, changedStates) => {
|
|
117
|
+
const timingAnimateGroups = {};
|
|
118
|
+
const isStateUpdate = segmentedTiming === 'stateUpdate';
|
|
119
|
+
animates[isStateUpdate ? 'update' : segmentedTiming].forEach((item) => {
|
|
120
|
+
const { order = 0, states } = item;
|
|
121
|
+
if (!isStateUpdate ||
|
|
122
|
+
(isStateUpdate && (0, array_1.isArrayOverlap)(states, changedStates))) {
|
|
123
|
+
timingAnimateGroups[order] = timingAnimateGroups[order] || [];
|
|
124
|
+
timingAnimateGroups[order].push(item);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return timingAnimateGroups;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Execute animations in order at a timing.
|
|
131
|
+
* @param shapeMap
|
|
132
|
+
* @param group
|
|
133
|
+
* @param timingAnimates
|
|
134
|
+
* @param targetStylesMap
|
|
135
|
+
* @param timing
|
|
136
|
+
* @param onfinish
|
|
137
|
+
*/
|
|
138
|
+
const runAnimateGroupOnShapes = (shapeMap, group, timingAnimates, targetStylesMap, timing, onfinish, cancelAnimations, canceled) => {
|
|
139
|
+
let maxDuration = -Infinity;
|
|
140
|
+
let maxDurationIdx = -1;
|
|
141
|
+
let hasCanceled = canceled;
|
|
142
|
+
const isOut = timing === 'buildOut' || timing === 'hide';
|
|
143
|
+
const animations = timingAnimates.map((animate, i) => {
|
|
144
|
+
var _a;
|
|
145
|
+
const { fields, shapeId, order, states } = animate, animateCfg = __rest(animate, ["fields", "shapeId", "order", "states"]);
|
|
146
|
+
const animateConfig = Object.assign(Object.assign({}, exports.DEFAULT_ANIMATE_CFG[timing]), animateCfg);
|
|
147
|
+
const { duration } = animateConfig;
|
|
148
|
+
let animation;
|
|
149
|
+
if (!shapeId || shapeId === 'group') {
|
|
150
|
+
// animate on group
|
|
151
|
+
const usingFields = [];
|
|
152
|
+
let hasOpacity = false;
|
|
153
|
+
fields === null || fields === void 0 ? void 0 : fields.forEach((field) => {
|
|
154
|
+
if (field === 'size')
|
|
155
|
+
usingFields.push('transform');
|
|
156
|
+
else if (field !== 'opacity')
|
|
157
|
+
usingFields.push(field);
|
|
158
|
+
else
|
|
159
|
+
hasOpacity = true;
|
|
160
|
+
});
|
|
161
|
+
const targetStyle = targetStylesMap.group || exports.GROUP_ANIMATE_STYLES[isOut ? 0 : 1];
|
|
162
|
+
if (hasCanceled) {
|
|
163
|
+
Object.keys(targetStyle).forEach((key) => {
|
|
164
|
+
group.style[key] = targetStyle[key];
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
if (hasOpacity) {
|
|
169
|
+
// opacity on group, animate on all shapes
|
|
170
|
+
Object.keys(shapeMap).forEach((shapeId) => {
|
|
171
|
+
var _a;
|
|
172
|
+
const { opacity: targetOpaicty = 1 } = targetStylesMap[shapeId] ||
|
|
173
|
+
((_a = targetStylesMap.otherShapes) === null || _a === void 0 ? void 0 : _a[shapeId]) ||
|
|
174
|
+
{};
|
|
175
|
+
animation = runAnimateOnShape(shapeMap[shapeId], ['opacity'], { opacity: targetOpaicty }, (0, exports.getShapeAnimateBeginStyles)(shapeMap[shapeId]), animateConfig);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (usingFields.length) {
|
|
179
|
+
animation = runAnimateOnShape(group, usingFields, targetStyle, exports.GROUP_ANIMATE_STYLES[isOut ? 1 : 0], animateConfig);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
const shape = shapeMap[shapeId];
|
|
185
|
+
if (shape && shape.style.display !== 'none') {
|
|
186
|
+
const targetStyle = targetStylesMap[shapeId] ||
|
|
187
|
+
((_a = targetStylesMap.otherShapes) === null || _a === void 0 ? void 0 : _a[shapeId]) ||
|
|
188
|
+
{};
|
|
189
|
+
if (hasCanceled) {
|
|
190
|
+
Object.keys(targetStyle).forEach((key) => {
|
|
191
|
+
shape.style[key] = targetStyle[key];
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
animation = runAnimateOnShape(shape, fields, targetStyle, (0, exports.getShapeAnimateBeginStyles)(shape), animateConfig);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (maxDuration < duration && animation) {
|
|
200
|
+
maxDuration = duration;
|
|
201
|
+
maxDurationIdx = i;
|
|
202
|
+
}
|
|
203
|
+
if (animation) {
|
|
204
|
+
animation.oncancel = () => {
|
|
205
|
+
hasCanceled = true;
|
|
206
|
+
cancelAnimations();
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return animation;
|
|
210
|
+
});
|
|
211
|
+
if (maxDurationIdx > -1)
|
|
212
|
+
animations[maxDurationIdx].onfinish = onfinish;
|
|
213
|
+
return animations;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Execute one animation.
|
|
217
|
+
* @param shape
|
|
218
|
+
* @param fields
|
|
219
|
+
* @param targetStyle
|
|
220
|
+
* @param beginStyle
|
|
221
|
+
* @param animateConfig
|
|
222
|
+
* @returns
|
|
223
|
+
*/
|
|
224
|
+
const runAnimateOnShape = (shape, fields, targetStyle, beginStyle, animateConfig) => {
|
|
225
|
+
if (!shape.isVisible())
|
|
226
|
+
return;
|
|
227
|
+
let animateArr;
|
|
228
|
+
if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
|
|
229
|
+
animateArr = getStyleDiff(shape.attributes, targetStyle);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
animateArr = [{}, {}];
|
|
233
|
+
fields.forEach((key) => {
|
|
234
|
+
animateArr[0][key] = shape.attributes.hasOwnProperty(key)
|
|
235
|
+
? shape.style[key]
|
|
236
|
+
: beginStyle[key];
|
|
237
|
+
animateArr[1][key] =
|
|
238
|
+
targetStyle[key] === undefined ? animateArr[0][key] : targetStyle[key];
|
|
239
|
+
if (key === 'lineDash' && animateArr[1][key].includes('100%')) {
|
|
240
|
+
const totalLength = shape.getTotalLength();
|
|
241
|
+
(0, array_1.replaceElements)(animateArr[1][key], '100%', totalLength);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
if (JSON.stringify(animateArr[0]) === JSON.stringify(animateArr[1]))
|
|
246
|
+
return;
|
|
247
|
+
return shape.animate(animateArr, animateConfig);
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Handle shape and group animations.
|
|
251
|
+
* Should be called after canvas ready and shape appended.
|
|
252
|
+
* @param animates
|
|
253
|
+
* @param mergedStyles
|
|
254
|
+
* @param shapeMap
|
|
255
|
+
* @param group
|
|
256
|
+
* @param timing timing to match 'when' in the animate config in style
|
|
257
|
+
* @returns
|
|
258
|
+
*/
|
|
259
|
+
const animateShapes = (animates, mergedStyles, shapeMap, group, timing = 'buildIn', changedStates = [], onAnimatesFrame = () => { }, onAnimatesEnd = () => { }) => {
|
|
260
|
+
if (!(animates === null || animates === void 0 ? void 0 : animates[timing])) {
|
|
261
|
+
onAnimatesEnd();
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const segmentedTiming = timing === 'update' && (changedStates === null || changedStates === void 0 ? void 0 : changedStates.length) ? 'stateUpdate' : timing;
|
|
265
|
+
const timingAnimateGroups = groupTimingAnimates(animates, segmentedTiming, changedStates);
|
|
266
|
+
let i = 0;
|
|
267
|
+
const groupKeys = Object.keys(timingAnimateGroups);
|
|
268
|
+
if (!groupKeys.length)
|
|
269
|
+
return;
|
|
270
|
+
let animations = [];
|
|
271
|
+
let canceled = false;
|
|
272
|
+
const onfinish = () => {
|
|
273
|
+
if (i >= groupKeys.length) {
|
|
274
|
+
onAnimatesEnd();
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const groupAnimations = runAnimateGroupOnShapes(shapeMap, group, timingAnimateGroups[groupKeys[i]], mergedStyles, timing, onfinish, // execute next order group
|
|
278
|
+
() => (canceled = true), canceled).filter(Boolean);
|
|
279
|
+
groupAnimations.forEach((animation) => {
|
|
280
|
+
animation.onframe = onAnimatesFrame;
|
|
281
|
+
});
|
|
282
|
+
if (i === 0) {
|
|
283
|
+
// collect the first group animations
|
|
284
|
+
animations = groupAnimations;
|
|
285
|
+
}
|
|
286
|
+
i++;
|
|
287
|
+
};
|
|
288
|
+
onfinish();
|
|
289
|
+
// only animations with order 0 will be returned
|
|
290
|
+
return animations;
|
|
291
|
+
};
|
|
292
|
+
exports.animateShapes = animateShapes;
|
|
293
|
+
const getAnimatesExcludePosition = (animates) => {
|
|
294
|
+
if (!animates.update)
|
|
295
|
+
return animates;
|
|
296
|
+
const isGroupId = (id) => !id || id === 'group';
|
|
297
|
+
// const groupUpdateAnimates = animates.update.filter(
|
|
298
|
+
// ({ shapeId }) => isGroupId(shapeId),
|
|
299
|
+
// );
|
|
300
|
+
const excludedAnimates = [];
|
|
301
|
+
animates.update.forEach((animate) => {
|
|
302
|
+
const { shapeId, fields } = animate;
|
|
303
|
+
if (!isGroupId(shapeId)) {
|
|
304
|
+
excludedAnimates.push(animate);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const newFields = fields;
|
|
308
|
+
let isGroupPosition = false;
|
|
309
|
+
if (fields.includes('x')) {
|
|
310
|
+
const xFieldIdx = newFields.indexOf('x');
|
|
311
|
+
newFields.splice(xFieldIdx, 1);
|
|
312
|
+
isGroupPosition = true;
|
|
313
|
+
}
|
|
314
|
+
if (fields.includes('y')) {
|
|
315
|
+
const yFieldIdx = newFields.indexOf('y');
|
|
316
|
+
newFields.splice(yFieldIdx, 1);
|
|
317
|
+
isGroupPosition = true;
|
|
318
|
+
}
|
|
319
|
+
if (isGroupPosition) {
|
|
320
|
+
if (newFields.length !== 0) {
|
|
321
|
+
// group animation but not on x and y
|
|
322
|
+
excludedAnimates.push(Object.assign(Object.assign({}, animate), { fields: newFields }));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
excludedAnimates.push(animate);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
return Object.assign(Object.assign({}, animates), { update: excludedAnimates });
|
|
330
|
+
};
|
|
331
|
+
exports.getAnimatesExcludePosition = getAnimatesExcludePosition;
|
|
332
|
+
const fadeIn = (id, shape, style, hiddenShape, animateConfig) => {
|
|
333
|
+
// omit inexist shape and the shape which is not hidden by zoom changing
|
|
334
|
+
if (!shape || !hiddenShape[id])
|
|
335
|
+
return;
|
|
336
|
+
if (!(shape === null || shape === void 0 ? void 0 : shape.isVisible())) {
|
|
337
|
+
shape.style.opacity = 0;
|
|
338
|
+
shape.show();
|
|
339
|
+
}
|
|
340
|
+
const { opacity: oriOpacity = 1 } = shape.attributes;
|
|
341
|
+
if (oriOpacity === 1)
|
|
342
|
+
return;
|
|
343
|
+
const { opacity = 1 } = style;
|
|
344
|
+
shape.animate([{ opacity: 0 }, { opacity }], animateConfig);
|
|
345
|
+
};
|
|
346
|
+
exports.fadeIn = fadeIn;
|
|
347
|
+
const fadeOut = (id, shape, hiddenShape, animateConfig) => {
|
|
348
|
+
if (!(shape === null || shape === void 0 ? void 0 : shape.isVisible()))
|
|
349
|
+
return;
|
|
350
|
+
hiddenShape[id] = true;
|
|
351
|
+
const { opacity = 1 } = shape.attributes;
|
|
352
|
+
if (opacity === 0)
|
|
353
|
+
return;
|
|
354
|
+
const animation = shape.animate([{ opacity }, { opacity: 0 }], animateConfig);
|
|
355
|
+
animation.onfinish = () => shape.hide();
|
|
356
|
+
};
|
|
357
|
+
exports.fadeOut = fadeOut;
|
|
358
|
+
//# sourceMappingURL=animate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animate.js","sourceRoot":"src/","sources":["util/animate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAeA,mCAA0D;AAE1D;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,EAAE;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,SAA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C9B,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;AAC9D,CAAC,CAAC;AAXW,QAAA,MAAM,UAWjB;AAEK,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE;IAC/D,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,EAAE,CAAA;QAAE,OAAO;IAChC,WAAW,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC;IACzC,IAAI,OAAO,KAAK,CAAC;QAAE,OAAO;IAC1B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IAC9E,SAAS,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC,CAAC;AAPW,QAAA,OAAO,WAOlB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const isArrayOverlap: (arr1: any, arr2: any) => boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Get the set of a - b.
|
|
4
|
+
* @param a
|
|
5
|
+
* @param b
|
|
6
|
+
*/
|
|
7
|
+
export declare function diffSet<T>(a?: T[], b?: T[]): T[];
|
|
8
|
+
/**
|
|
9
|
+
* Get the set of a + b.
|
|
10
|
+
* @param a
|
|
11
|
+
* @param b
|
|
12
|
+
*/
|
|
13
|
+
export declare function unionSet<T>(a: T[], b: T[]): T[];
|
|
14
|
+
/**
|
|
15
|
+
* Get the intersect set of a and b.
|
|
16
|
+
* @param a
|
|
17
|
+
* @param b
|
|
18
|
+
*/
|
|
19
|
+
export declare function intersectSet<T>(a: T[], b: T[]): T[];
|
|
20
|
+
export declare function replaceElements(arr: any, target: any, replaceWith: any): any;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceElements = exports.intersectSet = exports.unionSet = exports.diffSet = exports.isArrayOverlap = void 0;
|
|
4
|
+
const isArrayOverlap = (arr1, arr2) => {
|
|
5
|
+
if (!(arr1 === null || arr1 === void 0 ? void 0 : arr1.length) || !arr2.length)
|
|
6
|
+
return false;
|
|
7
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
8
|
+
for (let j = 0; j < arr2.length; j++) {
|
|
9
|
+
if (arr1[i] === arr2[j])
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
exports.isArrayOverlap = isArrayOverlap;
|
|
16
|
+
/**
|
|
17
|
+
* Get the set of a - b.
|
|
18
|
+
* @param a
|
|
19
|
+
* @param b
|
|
20
|
+
*/
|
|
21
|
+
function diffSet(a = [], b = []) {
|
|
22
|
+
const valueMap = {};
|
|
23
|
+
b.forEach((value) => {
|
|
24
|
+
if (typeof value === 'object')
|
|
25
|
+
valueMap[JSON.stringify(value)] = true;
|
|
26
|
+
valueMap[value] = true;
|
|
27
|
+
});
|
|
28
|
+
return a.filter((value) => !valueMap[value]);
|
|
29
|
+
}
|
|
30
|
+
exports.diffSet = diffSet;
|
|
31
|
+
/**
|
|
32
|
+
* Get the set of a + b.
|
|
33
|
+
* @param a
|
|
34
|
+
* @param b
|
|
35
|
+
*/
|
|
36
|
+
function unionSet(a, b) {
|
|
37
|
+
const resultSet = new Set(a);
|
|
38
|
+
b.forEach((value) => {
|
|
39
|
+
resultSet.add(value);
|
|
40
|
+
});
|
|
41
|
+
return Array.from(resultSet);
|
|
42
|
+
}
|
|
43
|
+
exports.unionSet = unionSet;
|
|
44
|
+
/**
|
|
45
|
+
* Get the intersect set of a and b.
|
|
46
|
+
* @param a
|
|
47
|
+
* @param b
|
|
48
|
+
*/
|
|
49
|
+
function intersectSet(a, b) {
|
|
50
|
+
const aSet = new Set(a);
|
|
51
|
+
const result = [];
|
|
52
|
+
b.forEach((value) => {
|
|
53
|
+
if (aSet.has(value))
|
|
54
|
+
result.push(value);
|
|
55
|
+
});
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
exports.intersectSet = intersectSet;
|
|
59
|
+
function replaceElements(arr, target, replaceWith) {
|
|
60
|
+
for (let i = 0; i < arr.length; i++) {
|
|
61
|
+
if (arr[i] === target) {
|
|
62
|
+
arr[i] = replaceWith;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return arr;
|
|
66
|
+
}
|
|
67
|
+
exports.replaceElements = replaceElements;
|
|
68
|
+
//# sourceMappingURL=array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"src/","sources":["util/array.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAW,EAAE;IACpD,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;SACtC;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEF;;;;GAIG;AACH,SAAgB,OAAO,C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GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE;YACrB,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;SACtB;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAPD,0CAOC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Canvas } from '@antv/g';
|
|
2
|
+
import { RendererName } from '../types/render';
|
|
3
|
+
/**
|
|
4
|
+
* Create a canvas
|
|
5
|
+
* @param {RendererName} rendererType
|
|
6
|
+
* @param {string | HTMLElement} container
|
|
7
|
+
* @param {number} width
|
|
8
|
+
* @param {number} height
|
|
9
|
+
* @param {number} pixelRatio optional
|
|
10
|
+
* @param {boolean} customCanvasTag whether create a <canvas /> for multiple canvas under the container
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare const createCanvas: (rendererType: RendererName, container: HTMLElement, width: number, height: number, pixelRatio?: number, customCanvasTag?: boolean, style?: any) => Canvas;
|
|
14
|
+
/**
|
|
15
|
+
* Change renderer type for the canvas.
|
|
16
|
+
* @param rendererType renderer type
|
|
17
|
+
* @param canvas Canvas instance
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const changeRenderer: (rendererType: RendererName, canvas: Canvas) => Canvas;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changeRenderer = exports.createCanvas = void 0;
|
|
4
|
+
const g_1 = require("@antv/g");
|
|
5
|
+
const g_canvas_1 = require("@antv/g-canvas");
|
|
6
|
+
const g_svg_1 = require("@antv/g-svg");
|
|
7
|
+
const g_webgl_1 = require("@antv/g-webgl");
|
|
8
|
+
const g_plugin_3d_1 = require("@antv/g-plugin-3d");
|
|
9
|
+
/**
|
|
10
|
+
* Create a canvas
|
|
11
|
+
* @param {RendererName} rendererType
|
|
12
|
+
* @param {string | HTMLElement} container
|
|
13
|
+
* @param {number} width
|
|
14
|
+
* @param {number} height
|
|
15
|
+
* @param {number} pixelRatio optional
|
|
16
|
+
* @param {boolean} customCanvasTag whether create a <canvas /> for multiple canvas under the container
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
const createCanvas = (rendererType, container, width, height, pixelRatio, customCanvasTag = true, style = {}) => {
|
|
20
|
+
let renderer;
|
|
21
|
+
switch (rendererType.toLowerCase()) {
|
|
22
|
+
case 'svg':
|
|
23
|
+
renderer = new g_svg_1.Renderer();
|
|
24
|
+
break;
|
|
25
|
+
case 'webgl-3d':
|
|
26
|
+
case 'webgl':
|
|
27
|
+
renderer = new g_webgl_1.Renderer();
|
|
28
|
+
renderer.registerPlugin(new g_plugin_3d_1.Plugin());
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
renderer = new g_canvas_1.Renderer();
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
if (typeof document !== 'undefined' && customCanvasTag) {
|
|
35
|
+
const canvasTag = document.createElement('canvas');
|
|
36
|
+
const dpr = pixelRatio || window.devicePixelRatio;
|
|
37
|
+
canvasTag.width = dpr * width;
|
|
38
|
+
canvasTag.height = dpr * height;
|
|
39
|
+
canvasTag.style.width = `${width}px`;
|
|
40
|
+
canvasTag.style.height = `${height}px`;
|
|
41
|
+
canvasTag.style.position = 'fixed';
|
|
42
|
+
canvasTag.style.outline = 'none';
|
|
43
|
+
canvasTag.tabIndex = 1; // Enable keyboard events
|
|
44
|
+
Object.assign(canvasTag.style, style);
|
|
45
|
+
container.appendChild(canvasTag);
|
|
46
|
+
return new g_1.Canvas({
|
|
47
|
+
canvas: canvasTag,
|
|
48
|
+
devicePixelRatio: pixelRatio,
|
|
49
|
+
renderer,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return new g_1.Canvas({
|
|
53
|
+
container,
|
|
54
|
+
width,
|
|
55
|
+
height,
|
|
56
|
+
devicePixelRatio: pixelRatio,
|
|
57
|
+
renderer,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
exports.createCanvas = createCanvas;
|
|
61
|
+
/**
|
|
62
|
+
* Change renderer type for the canvas.
|
|
63
|
+
* @param rendererType renderer type
|
|
64
|
+
* @param canvas Canvas instance
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
const changeRenderer = (rendererType, canvas) => {
|
|
68
|
+
let renderer;
|
|
69
|
+
switch (rendererType.toLowerCase()) {
|
|
70
|
+
case 'svg':
|
|
71
|
+
renderer = new g_svg_1.Renderer();
|
|
72
|
+
break;
|
|
73
|
+
case 'webgl-3d':
|
|
74
|
+
case 'webgl':
|
|
75
|
+
renderer = new g_webgl_1.Renderer();
|
|
76
|
+
renderer.registerPlugin(new g_plugin_3d_1.Plugin());
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
renderer = new g_canvas_1.Renderer();
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
canvas.setRenderer(renderer);
|
|
83
|
+
return canvas;
|
|
84
|
+
};
|
|
85
|
+
exports.changeRenderer = changeRenderer;
|
|
86
|
+
//# sourceMappingURL=canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.js","sourceRoot":"src/","sources":["util/canvas.ts"],"names":[],"mappings":";;;AAAA,+BAA6C;AAC7C,6CAA4D;AAC5D,uCAAsD;AACtD,2CAA0D;AAC1D,mDAAuD;AAGvD;;;;;;;;;GASG;AACI,MAAM,YAAY,GAAG,CAC1B,YAA0B,EAC1B,SAAsB,EACtB,KAAa,EACb,MAAc,EACd,UAAmB,EACnB,eAAe,GAAG,IAAI,EACtB,QAAa,EAAE,EACP,EAAE;IACV,IAAI,QAAQ,CAAC;IACb,QAAQ,YAAY,CAAC,WAAW,EAAE,EAAE;QAClC,KAAK,KAAK;YACR,QAAQ,GAAG,IAAI,gBAAW,EA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,YAAY,gBAiDvB;AAEF;;;;;GAKG;AACI,MAAM,cAAc,GAAG,CAC5B,YAA0B,EAC1B,MAAc,EACN,EAAE;IACV,IAAI,QAAQ,CAAC;IACb,QAAQ,YAAY,CAAC,WAAW,EAAE,EAAE;QAClC,KAAK,KAAK;YACR,QAAQ,GAAG,IAAI,gBAAW,EAAE,CAAC;YAC7B,MAAM;QACR,KAAK,UAAU,CAAC;QAChB,KAAK,OAAO;YACV,QAAQ,GAAG,IAAI,kBAAa,EAAE,CAAC;YAC/B,QAAQ,CAAC,cAAc,CAAC,IAAI,oBAAQ,EAAE,CAAC,CAAC;YACxC,MAAM;QACR;YACE,QAAQ,GAAG,IAAI,mBAAc,EAAE,CAAC;YAChC,MAAM;KACT;IACD,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AApBW,QAAA,cAAc,kBAoBzB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IElement } from '@antv/g';
|
|
2
|
+
import { ID } from '@antv/graphlib';
|
|
3
|
+
export type ItemInfo = {
|
|
4
|
+
itemType: 'canvas' | 'node' | 'edge' | 'combo';
|
|
5
|
+
itemId: ID | undefined;
|
|
6
|
+
groupElement: IElement;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Given an element, which might be a child shape of a node/edge,
|
|
10
|
+
* get its belonging item.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getItemInfoFromElement: (element: IElement) => ItemInfo | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getItemInfoFromElement = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Given an element, which might be a child shape of a node/edge,
|
|
6
|
+
* get its belonging item.
|
|
7
|
+
*/
|
|
8
|
+
const getItemInfoFromElement = (element) => {
|
|
9
|
+
var _a;
|
|
10
|
+
if (element.nodeName === 'document') {
|
|
11
|
+
return {
|
|
12
|
+
itemType: 'canvas',
|
|
13
|
+
itemId: undefined,
|
|
14
|
+
groupElement: element,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
let parent = element;
|
|
18
|
+
while (parent && !((_a = parent.getAttribute) === null || _a === void 0 ? void 0 : _a.call(parent, 'data-item-type'))) {
|
|
19
|
+
parent = parent.parentElement;
|
|
20
|
+
}
|
|
21
|
+
if (!parent)
|
|
22
|
+
return null;
|
|
23
|
+
return {
|
|
24
|
+
itemType: parent.getAttribute('data-item-type'),
|
|
25
|
+
itemId: parent.getAttribute('data-item-id'),
|
|
26
|
+
groupElement: parent,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.getItemInfoFromElement = getItemInfoFromElement;
|
|
30
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"src/","sources":["util/event.ts"],"names":[],"mappings":";;;AASA;;;GAGG;AACI,MAAM,sBAAsB,GAAG,CAAC,OAAiB,EAAmB,EAAE;;IAC3E,IAAI,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE;QACnC,OAAO;YACL,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,SAAS;YACjB,YAAY,EAAE,OAAO;SACtB,CAAC;KACH;IAED,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,OAAO,MAAM,IAAI,CAAC,CAAA,MAAA,MAAM,CAAC,YAAY,uDAAG,gBAAgB,CAAC,CAAA,EAAE;QACzD,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;KAC/B;IACD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC;QAC/C,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC;QAC3C,YAAY,EAAE,MAAM;KACrB,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,sBAAsB,0BAoBjC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BehaviorRegistry } from '../types/behavior';
|
|
2
|
+
import { ThemeRegistry } from '../types/theme';
|
|
3
|
+
import Graph from '../runtime/graph';
|
|
4
|
+
/**
|
|
5
|
+
* Extend graph class with custom libs (extendLibrary), and extendLibrary will be merged into useLib.
|
|
6
|
+
* B1 is the Behavior lib from user, B2 is the Behavior lib of the graph to be extended(built-in graph)
|
|
7
|
+
* TODO: more templates, and might be merged to be two templates for the whole extendLibrary
|
|
8
|
+
* @param GraphClass graph class to be extended
|
|
9
|
+
* @param extendLibrary custom libs to extend
|
|
10
|
+
* @returns extended graph class
|
|
11
|
+
*/
|
|
12
|
+
export declare const extend: <B1 extends BehaviorRegistry, B2 extends BehaviorRegistry, T1 extends ThemeRegistry, T2 extends ThemeRegistry>(GraphClass: {
|
|
13
|
+
new (spec: import("..").Specification<B2, T2>): Graph<B2, T2>;
|
|
14
|
+
}, extendLibrary: {
|
|
15
|
+
behaviors?: B1;
|
|
16
|
+
themeSolvers?: T1;
|
|
17
|
+
nodes?: any;
|
|
18
|
+
edges?: any;
|
|
19
|
+
}) => {
|
|
20
|
+
new (spec: import("..").Specification<B1 & B2, T1 & T2>): Graph<B1 & B2, T1 & T2>;
|
|
21
|
+
};
|