@antv/g6 5.0.0-beta.28 → 5.0.0-beta.29
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 +3 -2
- package/dist/lib/__tests__/demo/animation/animation-breathe.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/animation-fade-in.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/animation-translate.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/animation-wave.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/animation-zoom-in.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/controller-element-position.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/controller-element-state.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/controller-element.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/edge-cubic.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/edge-line.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/edge-quadratic.d.ts +2 -0
- package/dist/lib/__tests__/demo/animation/index.d.ts +12 -0
- package/dist/lib/__tests__/demo/animation/shape-label.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/behavior-drag-canvas.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/behavior-drag-element.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/behavior-zoom-canvas.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/combo-expand-collapse.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/combo.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/common-graph.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/edge-polyline.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/element-change-type.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/element-port.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/element-position-combo.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/element-position.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/element-state.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/element-visibility.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/element-z-index.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/graph-event.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/index.d.ts +47 -0
- package/dist/lib/__tests__/demo/case/layout-circular-basic.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-circular-configuration-translate.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-circular-degree.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-circular-division.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-circular-spiral.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-combo-combined.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-compact-box-basic.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-compact-box-left-align.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-compact-box-top-to-bottom.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-concentric.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-dagre-flow-combo.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-dagre-flow.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-dendrogram-basic.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-dendrogram-tb.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-force.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-fruchterman-basic.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-fruchterman-cluster.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-fruchterman-fix.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-grid.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-mds.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-mindmap-h-custom-side.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-mindmap-h-left.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-mindmap-h-right.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-mindmap-h.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-radial-basic.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-radial-configuration-translate.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-radial-prevent-overlap-unstrict.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-radial-prevent-overlap.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/layout-radial-sort.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/plugin-grid-line.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/theme.d.ts +2 -0
- package/dist/lib/__tests__/demo/case/viewport-fit.d.ts +2 -0
- package/dist/lib/__tests__/demo/index.d.ts +3 -0
- package/dist/lib/__tests__/demo/static/common.d.ts +45 -0
- package/dist/lib/__tests__/demo/static/controller-element-position.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-element-visibility.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-element-z-index.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-element.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-circular.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-compact-box.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-d3-force.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-dagre.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-dendrogram.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-force.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-forceatlas2-wasm.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-fruchterman-gpu.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-fruchterman-wasm.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-grid.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-indented.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-mindmap.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-layout-radial.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/controller-viewport.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-arrow.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-cubic-horizontal.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-cubic-vertical.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-cubic.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-custom-arrow.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-line.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-loop-curve.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-loop-polyline.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-polyline.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-port.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/edge-quadratic.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/element-label-background.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/element-label-oversized.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/graph-element.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/index.d.ts +9 -0
- package/dist/lib/__tests__/demo/static/layered-canvas.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/node-circle.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/node-diamond.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/node-ellipse.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/node-image.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/node-rect.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/node-star.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/node-triangle.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/shape-badge.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/shape-icon.d.ts +2 -0
- package/dist/lib/__tests__/demo/static/shape-label.d.ts +2 -0
- package/dist/lib/__tests__/demo/types.d.ts +33 -0
- package/dist/lib/__tests__/main.d.ts +1 -0
- package/dist/lib/__tests__/setup.d.ts +3 -0
- package/dist/lib/__tests__/unit/behaviors/behavior-collapse-expand.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/behaviors/behavior-drag-canvas.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/behaviors/behavior-drag-element-combo.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/behaviors/behavior-drag-element.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/behaviors/behavior-zoom-canvas.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/change-type.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/combo.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/edge-polyline.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/port.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/position-combo.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/position.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/state.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/visibility.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/elements/z-index.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/circular.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/combo-layout.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/compact-box.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/dagre-flow.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/dendrogram.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/fruchterman.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/grid.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/layout-concentric.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/mds.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/mindmap.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/layouts/radial-layout.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/plugins/plugin-grid-line.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/registry.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/canvas.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/data.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/element/visibility.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/element/z-index.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/element.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/graph/auto-resize.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/graph/graph.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/runtime/viewport.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/behavior.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/canvas.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/data.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/element/combo.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/element/edge.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/element/node.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/index.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/layout.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/plugin.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/theme.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/spec/viewport.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/anchor.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/animation.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/array.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/bbox.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/cache.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/change.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/combo.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/data.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/diff.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/dom.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/edge.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/element.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/event.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/extension.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/graphlib.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/id.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/is.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/layout.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/math.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/padding.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/palette.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/placement.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/point.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/position.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/prefix.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/random.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/router.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/shape.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/shortcut.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/size.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/style.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/symbol.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/text.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/traverse.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/tree.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/vector.spec.d.ts +1 -0
- package/dist/lib/__tests__/unit/utils/visibility.spec.d.ts +1 -0
- package/dist/lib/__tests__/utils/create.d.ts +15 -0
- package/dist/lib/__tests__/utils/dir.d.ts +9 -0
- package/dist/lib/__tests__/utils/get-cases.d.ts +2 -0
- package/dist/lib/__tests__/utils/index.d.ts +4 -0
- package/dist/lib/__tests__/utils/offscreen-canvas-context.d.ts +21 -0
- package/dist/lib/__tests__/utils/random.d.ts +5 -0
- package/dist/lib/__tests__/utils/sleep.d.ts +1 -0
- package/dist/lib/__tests__/utils/to-be-close-to.d.ts +10 -0
- package/dist/lib/__tests__/utils/to-match-svg-snapshot.d.ts +14 -0
- package/dist/lib/__tests__/utils/use-snapshot-matchers.d.ts +9 -0
- package/dist/lib/src/animations/executor.d.ts +12 -0
- package/dist/lib/src/animations/index.d.ts +18 -0
- package/dist/lib/src/animations/types.d.ts +56 -0
- package/dist/lib/src/behaviors/base-behavior.d.ts +5 -0
- package/dist/lib/src/behaviors/collapse-expand.d.ts +41 -0
- package/dist/lib/src/behaviors/drag-canvas.d.ts +56 -0
- package/dist/lib/src/behaviors/drag-element.d.ts +106 -0
- package/dist/lib/src/behaviors/index.d.ts +10 -0
- package/dist/lib/src/behaviors/types.d.ts +5 -0
- package/dist/lib/src/behaviors/zoom-canvas.d.ts +69 -0
- package/dist/lib/src/constants/animation.d.ts +2 -0
- package/dist/lib/src/constants/change.d.ts +15 -0
- package/dist/lib/src/constants/element.d.ts +5 -0
- package/dist/lib/src/constants/events/animation.d.ts +7 -0
- package/dist/lib/src/constants/events/canvas.d.ts +38 -0
- package/dist/lib/src/constants/events/combo.d.ts +2 -0
- package/dist/lib/src/constants/events/common.d.ts +42 -0
- package/dist/lib/src/constants/events/container.d.ts +6 -0
- package/dist/lib/src/constants/events/edge.d.ts +30 -0
- package/dist/lib/src/constants/events/graph.d.ts +60 -0
- package/dist/lib/src/constants/events/index.d.ts +8 -0
- package/dist/lib/src/constants/events/node.d.ts +36 -0
- package/dist/lib/src/constants/graphlib.d.ts +2 -0
- package/dist/lib/src/constants/index.d.ts +4 -0
- package/dist/lib/src/elements/combos/base-combo.d.ts +47 -0
- package/dist/lib/src/elements/combos/circle.d.ts +18 -0
- package/dist/lib/src/elements/combos/index.d.ts +6 -0
- package/dist/lib/src/elements/combos/rect.d.ts +15 -0
- package/dist/lib/src/elements/edges/base-edge.d.ts +58 -0
- package/dist/lib/src/elements/edges/cubic-horizontal.d.ts +21 -0
- package/dist/lib/src/elements/edges/cubic-vertical.d.ts +21 -0
- package/dist/lib/src/elements/edges/cubic.d.ts +30 -0
- package/dist/lib/src/elements/edges/index.d.ts +14 -0
- package/dist/lib/src/elements/edges/line.d.ts +15 -0
- package/dist/lib/src/elements/edges/polyline.d.ts +42 -0
- package/dist/lib/src/elements/edges/quadratic.d.ts +29 -0
- package/dist/lib/src/elements/index.d.ts +3 -0
- package/dist/lib/src/elements/nodes/base-node.d.ts +107 -0
- package/dist/lib/src/elements/nodes/circle.d.ts +20 -0
- package/dist/lib/src/elements/nodes/diamond.d.ts +15 -0
- package/dist/lib/src/elements/nodes/ellipse.d.ts +17 -0
- package/dist/lib/src/elements/nodes/image.d.ts +20 -0
- package/dist/lib/src/elements/nodes/index.d.ts +16 -0
- package/dist/lib/src/elements/nodes/polygon.d.ts +17 -0
- package/dist/lib/src/elements/nodes/rect.d.ts +19 -0
- package/dist/lib/src/elements/nodes/star.d.ts +24 -0
- package/dist/lib/src/elements/nodes/triangle.d.ts +24 -0
- package/dist/lib/src/elements/shapes/badge.d.ts +14 -0
- package/dist/lib/src/elements/shapes/base-shape.d.ts +57 -0
- package/dist/lib/src/elements/shapes/icon.d.ts +13 -0
- package/dist/lib/src/elements/shapes/index.d.ts +13 -0
- package/dist/lib/src/elements/shapes/label.d.ts +22 -0
- package/dist/lib/src/exports.d.ts +24 -0
- package/dist/lib/src/index.d.ts +3 -0
- package/dist/lib/src/layouts/index.d.ts +3 -0
- package/dist/lib/src/layouts/types.d.ts +71 -0
- package/dist/lib/src/palettes/index.d.ts +9 -0
- package/dist/lib/src/palettes/types.d.ts +5 -0
- package/dist/lib/src/plugins/base-plugin.d.ts +5 -0
- package/dist/lib/src/plugins/grid-line.d.ts +31 -0
- package/dist/lib/src/plugins/index.d.ts +4 -0
- package/dist/lib/src/plugins/types.d.ts +4 -0
- package/dist/lib/src/preset.d.ts +1 -0
- package/dist/lib/src/registry/build-in.d.ts +6 -0
- package/dist/lib/src/registry/extension/index.d.ts +33 -0
- package/dist/lib/src/registry/extension/types.d.ts +36 -0
- package/dist/lib/src/registry/index.d.ts +57 -0
- package/dist/lib/src/registry/types.d.ts +41 -0
- package/dist/lib/src/runtime/behavior.d.ts +14 -0
- package/dist/lib/src/runtime/canvas.d.ts +49 -0
- package/dist/lib/src/runtime/data.d.ts +187 -0
- package/dist/lib/src/runtime/element.d.ts +138 -0
- package/dist/lib/src/runtime/graph.d.ts +401 -0
- package/dist/lib/src/runtime/index.d.ts +6 -0
- package/dist/lib/src/runtime/layout.d.ts +49 -0
- package/dist/lib/src/runtime/plugin.d.ts +9 -0
- package/dist/lib/src/runtime/types.d.ts +69 -0
- package/dist/lib/src/runtime/viewport.d.ts +59 -0
- package/dist/lib/src/spec/behavior.d.ts +4 -0
- package/dist/lib/src/spec/canvas.d.ts +42 -0
- package/dist/lib/src/spec/data.d.ts +44 -0
- package/dist/lib/src/spec/element/animation.d.ts +12 -0
- package/dist/lib/src/spec/element/base.d.ts +6 -0
- package/dist/lib/src/spec/element/combo.d.ts +48 -0
- package/dist/lib/src/spec/element/edge.d.ts +46 -0
- package/dist/lib/src/spec/element/node.d.ts +48 -0
- package/dist/lib/src/spec/element/palette.d.ts +53 -0
- package/dist/lib/src/spec/index.d.ts +11 -0
- package/dist/lib/src/spec/layout.d.ts +4 -0
- package/dist/lib/src/spec/plugin.d.ts +4 -0
- package/dist/lib/src/spec/spec.d.ts +76 -0
- package/dist/lib/src/spec/theme.d.ts +10 -0
- package/dist/lib/src/spec/viewport.d.ts +86 -0
- package/dist/lib/src/themes/base.d.ts +27 -0
- package/dist/lib/src/themes/dark.d.ts +2 -0
- package/dist/lib/src/themes/index.d.ts +2 -0
- package/dist/lib/src/themes/light.d.ts +2 -0
- package/dist/lib/src/themes/types.d.ts +10 -0
- package/dist/lib/src/types/anchor.d.ts +3 -0
- package/dist/lib/src/types/animation.d.ts +6 -0
- package/dist/lib/src/types/behavior.d.ts +5 -0
- package/dist/lib/src/types/callable.d.ts +30 -0
- package/dist/lib/src/types/canvas.d.ts +1 -0
- package/dist/lib/src/types/change.d.ts +51 -0
- package/dist/lib/src/types/data.d.ts +44 -0
- package/dist/lib/src/types/edge.d.ts +34 -0
- package/dist/lib/src/types/element.d.ts +149 -0
- package/dist/lib/src/types/enum.d.ts +1 -0
- package/dist/lib/src/types/event.d.ts +4 -0
- package/dist/lib/src/types/graphlib.d.ts +16 -0
- package/dist/lib/src/types/index.d.ts +24 -0
- package/dist/lib/src/types/node.d.ts +16 -0
- package/dist/lib/src/types/padding.d.ts +2 -0
- package/dist/lib/src/types/placement.d.ts +5 -0
- package/dist/lib/src/types/point.d.ts +2 -0
- package/dist/lib/src/types/position.d.ts +2 -0
- package/dist/lib/src/types/prefix.d.ts +7 -0
- package/dist/lib/src/types/size.d.ts +3 -0
- package/dist/lib/src/types/state.d.ts +1 -0
- package/dist/lib/src/types/style.d.ts +11 -0
- package/dist/lib/src/types/tree.d.ts +5 -0
- package/dist/lib/src/types/vector.d.ts +2 -0
- package/dist/lib/src/types/viewport.d.ts +38 -0
- package/dist/lib/src/utils/anchor.d.ts +9 -0
- package/dist/lib/src/utils/animation.d.ts +73 -0
- package/dist/lib/src/utils/array.d.ts +9 -0
- package/dist/lib/src/utils/bbox.d.ts +109 -0
- package/dist/lib/src/utils/cache.d.ts +36 -0
- package/dist/lib/src/utils/change.d.ts +9 -0
- package/dist/lib/src/utils/combo.d.ts +33 -0
- package/dist/lib/src/utils/data.d.ts +34 -0
- package/dist/lib/src/utils/diff.d.ts +15 -0
- package/dist/lib/src/utils/dom.d.ts +6 -0
- package/dist/lib/src/utils/edge.d.ts +158 -0
- package/dist/lib/src/utils/element.d.ts +202 -0
- package/dist/lib/src/utils/event/events.d.ts +31 -0
- package/dist/lib/src/utils/event/index.d.ts +29 -0
- package/dist/lib/src/utils/extension.d.ts +10 -0
- package/dist/lib/src/utils/graphlib.d.ts +14 -0
- package/dist/lib/src/utils/id.d.ts +18 -0
- package/dist/lib/src/utils/is.d.ts +34 -0
- package/dist/lib/src/utils/layout.d.ts +25 -0
- package/dist/lib/src/utils/math.d.ts +10 -0
- package/dist/lib/src/utils/padding.d.ts +9 -0
- package/dist/lib/src/utils/palette.d.ts +33 -0
- package/dist/lib/src/utils/placement.d.ts +9 -0
- package/dist/lib/src/utils/point.d.ts +129 -0
- package/dist/lib/src/utils/position.d.ts +37 -0
- package/dist/lib/src/utils/prefix.d.ts +66 -0
- package/dist/lib/src/utils/router/orth.d.ts +103 -0
- package/dist/lib/src/utils/shape.d.ts +9 -0
- package/dist/lib/src/utils/shortcut.d.ts +20 -0
- package/dist/lib/src/utils/size.d.ts +7 -0
- package/dist/lib/src/utils/style.d.ts +20 -0
- package/dist/lib/src/utils/symbol.d.ts +30 -0
- package/dist/lib/src/utils/text.d.ts +26 -0
- package/dist/lib/src/utils/traverse.d.ts +14 -0
- package/dist/lib/src/utils/tree.d.ts +17 -0
- package/dist/lib/src/utils/vector.d.ts +142 -0
- package/dist/lib/src/utils/visibility.d.ts +13 -0
- package/esm/animations/executor.d.ts +12 -0
- package/esm/animations/executor.js +75 -0
- package/esm/animations/executor.js.map +1 -0
- package/esm/animations/index.d.ts +18 -0
- package/esm/animations/index.js +17 -0
- package/esm/animations/index.js.map +1 -0
- package/esm/animations/types.d.ts +56 -0
- package/esm/animations/types.js.map +1 -0
- package/esm/behaviors/base-behavior.d.ts +5 -0
- package/esm/behaviors/base-behavior.js +4 -0
- package/esm/behaviors/base-behavior.js.map +1 -0
- package/esm/behaviors/collapse-expand.d.ts +41 -0
- package/esm/behaviors/collapse-expand.js +54 -0
- package/esm/behaviors/collapse-expand.js.map +1 -0
- package/esm/behaviors/drag-canvas.d.ts +56 -0
- package/esm/behaviors/drag-canvas.js +61 -0
- package/esm/behaviors/drag-canvas.js.map +1 -0
- package/esm/behaviors/drag-element.d.ts +106 -0
- package/esm/behaviors/drag-element.js +205 -0
- package/esm/behaviors/drag-element.js.map +1 -0
- package/esm/behaviors/index.d.ts +10 -0
- package/esm/behaviors/index.js +6 -0
- package/esm/behaviors/index.js.map +1 -0
- package/esm/behaviors/types.d.ts +5 -0
- package/esm/behaviors/types.js.map +1 -0
- package/esm/behaviors/zoom-canvas.d.ts +69 -0
- package/esm/behaviors/zoom-canvas.js +80 -0
- package/esm/behaviors/zoom-canvas.js.map +1 -0
- package/esm/constants/animation.d.ts +2 -0
- package/esm/constants/animation.js +10 -0
- package/esm/constants/animation.js.map +1 -0
- package/esm/constants/change.d.ts +15 -0
- package/esm/constants/change.js +17 -0
- package/esm/constants/change.js.map +1 -0
- package/esm/constants/element.d.ts +5 -0
- package/esm/constants/element.js +6 -0
- package/esm/constants/element.js.map +1 -0
- package/esm/constants/events/animation.d.ts +7 -0
- package/esm/constants/events/animation.js +10 -0
- package/esm/constants/events/animation.js.map +1 -0
- package/esm/constants/events/canvas.d.ts +38 -0
- package/esm/constants/events/canvas.js +40 -0
- package/esm/constants/events/canvas.js.map +1 -0
- package/esm/constants/events/combo.d.ts +2 -0
- package/esm/constants/events/combo.js +3 -0
- package/esm/constants/events/combo.js.map +1 -0
- package/esm/constants/events/common.d.ts +42 -0
- package/esm/constants/events/common.js +44 -0
- package/esm/constants/events/common.js.map +1 -0
- package/esm/constants/events/container.d.ts +6 -0
- package/esm/constants/events/container.js +8 -0
- package/esm/constants/events/container.js.map +1 -0
- package/esm/constants/events/edge.d.ts +30 -0
- package/esm/constants/events/edge.js +32 -0
- package/esm/constants/events/edge.js.map +1 -0
- package/esm/constants/events/graph.d.ts +60 -0
- package/esm/constants/events/graph.js +64 -0
- package/esm/constants/events/graph.js.map +1 -0
- package/esm/constants/events/index.d.ts +8 -0
- package/esm/constants/events/index.js +9 -0
- package/esm/constants/events/index.js.map +1 -0
- package/esm/constants/events/node.d.ts +36 -0
- package/esm/constants/events/node.js +38 -0
- package/esm/constants/events/node.js.map +1 -0
- package/esm/constants/graphlib.d.ts +2 -0
- package/esm/constants/graphlib.js +3 -0
- package/esm/constants/graphlib.js.map +1 -0
- package/esm/constants/index.d.ts +4 -0
- package/esm/constants/index.js +5 -0
- package/esm/constants/index.js.map +1 -0
- package/esm/elements/combos/base-combo.d.ts +47 -0
- package/esm/elements/combos/base-combo.js +132 -0
- package/esm/elements/combos/base-combo.js.map +1 -0
- package/esm/elements/combos/circle.d.ts +18 -0
- package/esm/elements/combos/circle.js +46 -0
- package/esm/elements/combos/circle.js.map +1 -0
- package/esm/elements/combos/index.d.ts +6 -0
- package/esm/elements/combos/index.js +4 -0
- package/esm/elements/combos/index.js.map +1 -0
- package/esm/elements/combos/rect.d.ts +15 -0
- package/esm/elements/combos/rect.js +27 -0
- package/esm/elements/combos/rect.js.map +1 -0
- package/esm/elements/edges/base-edge.d.ts +58 -0
- package/esm/elements/edges/base-edge.js +166 -0
- package/esm/elements/edges/base-edge.js.map +1 -0
- package/esm/elements/edges/cubic-horizontal.d.ts +21 -0
- package/esm/elements/edges/cubic-horizontal.js +19 -0
- package/esm/elements/edges/cubic-horizontal.js.map +1 -0
- package/esm/elements/edges/cubic-vertical.d.ts +21 -0
- package/esm/elements/edges/cubic-vertical.js +19 -0
- package/esm/elements/edges/cubic-vertical.js.map +1 -0
- package/esm/elements/edges/cubic.d.ts +30 -0
- package/esm/elements/edges/cubic.js +27 -0
- package/esm/elements/edges/cubic.js.map +1 -0
- package/esm/elements/edges/index.d.ts +14 -0
- package/esm/elements/edges/index.js +8 -0
- package/esm/elements/edges/index.js.map +1 -0
- package/esm/elements/edges/line.d.ts +15 -0
- package/esm/elements/edges/line.js +19 -0
- package/esm/elements/edges/line.js.map +1 -0
- package/esm/elements/edges/polyline.d.ts +42 -0
- package/esm/elements/edges/polyline.js +58 -0
- package/esm/elements/edges/polyline.js.map +1 -0
- package/esm/elements/edges/quadratic.d.ts +29 -0
- package/esm/elements/edges/quadratic.js +19 -0
- package/esm/elements/edges/quadratic.js.map +1 -0
- package/esm/elements/index.d.ts +3 -0
- package/esm/elements/index.js +4 -0
- package/esm/elements/index.js.map +1 -0
- package/esm/elements/nodes/base-node.d.ts +107 -0
- package/esm/elements/nodes/base-node.js +208 -0
- package/esm/elements/nodes/base-node.js.map +1 -0
- package/esm/elements/nodes/circle.d.ts +20 -0
- package/esm/elements/nodes/circle.js +34 -0
- package/esm/elements/nodes/circle.js.map +1 -0
- package/esm/elements/nodes/diamond.d.ts +15 -0
- package/esm/elements/nodes/diamond.js +21 -0
- package/esm/elements/nodes/diamond.js.map +1 -0
- package/esm/elements/nodes/ellipse.d.ts +17 -0
- package/esm/elements/nodes/ellipse.js +36 -0
- package/esm/elements/nodes/ellipse.js.map +1 -0
- package/esm/elements/nodes/image.d.ts +20 -0
- package/esm/elements/nodes/image.js +52 -0
- package/esm/elements/nodes/image.js.map +1 -0
- package/esm/elements/nodes/index.d.ts +16 -0
- package/esm/elements/nodes/index.js +9 -0
- package/esm/elements/nodes/index.js.map +1 -0
- package/esm/elements/nodes/polygon.d.ts +17 -0
- package/esm/elements/nodes/polygon.js +24 -0
- package/esm/elements/nodes/polygon.js.map +1 -0
- package/esm/elements/nodes/rect.d.ts +19 -0
- package/esm/elements/nodes/rect.js +39 -0
- package/esm/elements/nodes/rect.js.map +1 -0
- package/esm/elements/nodes/star.d.ts +24 -0
- package/esm/elements/nodes/star.js +29 -0
- package/esm/elements/nodes/star.js.map +1 -0
- package/esm/elements/nodes/triangle.d.ts +24 -0
- package/esm/elements/nodes/triangle.js +47 -0
- package/esm/elements/nodes/triangle.js.map +1 -0
- package/esm/elements/shapes/badge.d.ts +14 -0
- package/esm/elements/shapes/badge.js +25 -0
- package/esm/elements/shapes/badge.js.map +1 -0
- package/esm/elements/shapes/base-shape.d.ts +57 -0
- package/esm/elements/shapes/base-shape.js +110 -0
- package/esm/elements/shapes/base-shape.js.map +1 -0
- package/esm/elements/shapes/icon.d.ts +13 -0
- package/esm/elements/shapes/icon.js +31 -0
- package/esm/elements/shapes/icon.js.map +1 -0
- package/esm/elements/shapes/index.d.ts +13 -0
- package/esm/elements/shapes/index.js +10 -0
- package/esm/elements/shapes/index.js.map +1 -0
- package/esm/elements/shapes/label.d.ts +22 -0
- package/esm/elements/shapes/label.js +60 -0
- package/esm/elements/shapes/label.js.map +1 -0
- package/esm/elements/types.d.ts +0 -0
- package/esm/elements/types.js +15 -0
- package/esm/elements/types.js.map +1 -0
- package/esm/exports.d.ts +24 -0
- package/esm/exports.js +20 -0
- package/esm/exports.js.map +1 -0
- package/esm/index.d.ts +3 -220
- package/esm/index.js +3 -17
- package/esm/index.js.map +1 -1
- package/esm/layouts/index.d.ts +3 -0
- package/esm/layouts/index.js +3 -0
- package/esm/layouts/index.js.map +1 -0
- package/esm/layouts/types.d.ts +71 -0
- package/esm/layouts/types.js.map +1 -0
- package/esm/palettes/index.d.ts +9 -0
- package/esm/palettes/index.js +52 -0
- package/esm/palettes/index.js.map +1 -0
- package/esm/palettes/types.d.ts +5 -0
- package/esm/palettes/types.js.map +1 -0
- package/esm/plugins/base-plugin.d.ts +5 -0
- package/esm/plugins/base-plugin.js +4 -0
- package/esm/plugins/base-plugin.js.map +1 -0
- package/esm/plugins/grid-line.d.ts +31 -0
- package/esm/plugins/grid-line.js +67 -0
- package/esm/plugins/grid-line.js.map +1 -0
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +3 -0
- package/esm/plugins/index.js.map +1 -0
- package/esm/plugins/types.d.ts +4 -0
- package/esm/plugins/types.js +2 -0
- package/esm/plugins/types.js.map +1 -0
- package/esm/preset.d.ts +1 -0
- package/esm/preset.js +8 -0
- package/esm/preset.js.map +1 -0
- package/esm/registry/build-in.d.ts +6 -0
- package/esm/registry/build-in.js +77 -0
- package/esm/registry/build-in.js.map +1 -0
- package/esm/registry/extension/index.d.ts +33 -0
- package/esm/registry/extension/index.js +86 -0
- package/esm/registry/extension/index.js.map +1 -0
- package/esm/registry/extension/types.d.ts +36 -0
- package/esm/registry/extension/types.js +2 -0
- package/esm/registry/extension/types.js.map +1 -0
- package/esm/registry/index.d.ts +57 -0
- package/esm/registry/index.js +94 -0
- package/esm/registry/index.js.map +1 -0
- package/esm/registry/types.d.ts +41 -0
- package/esm/registry/types.js +2 -0
- package/esm/registry/types.js.map +1 -0
- package/esm/runtime/behavior.d.ts +14 -0
- package/esm/runtime/behavior.js +96 -0
- package/esm/runtime/behavior.js.map +1 -0
- package/esm/runtime/canvas.d.ts +49 -0
- package/esm/runtime/canvas.js +192 -0
- package/esm/runtime/canvas.js.map +1 -0
- package/esm/runtime/data.d.ts +187 -0
- package/esm/runtime/data.js +671 -0
- package/esm/runtime/data.js.map +1 -0
- package/esm/runtime/element.d.ts +138 -0
- package/esm/runtime/element.js +581 -0
- package/esm/runtime/element.js.map +1 -0
- package/esm/runtime/graph.d.ts +334 -705
- package/esm/runtime/graph.js +561 -2134
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/index.d.ts +6 -0
- package/esm/runtime/index.js +7 -0
- package/esm/runtime/index.js.map +1 -0
- package/esm/runtime/layout.d.ts +49 -0
- package/esm/runtime/layout.js +323 -0
- package/esm/runtime/layout.js.map +1 -0
- package/esm/runtime/plugin.d.ts +9 -0
- package/esm/runtime/plugin.js +12 -0
- package/esm/runtime/plugin.js.map +1 -0
- package/esm/runtime/types.d.ts +69 -0
- package/esm/runtime/types.js +2 -0
- package/esm/runtime/types.js.map +1 -0
- package/esm/runtime/viewport.d.ts +59 -0
- package/esm/runtime/viewport.js +241 -0
- package/esm/runtime/viewport.js.map +1 -0
- package/esm/spec/behavior.d.ts +4 -0
- package/esm/spec/behavior.js +2 -0
- package/esm/spec/behavior.js.map +1 -0
- package/esm/spec/canvas.d.ts +42 -0
- package/esm/spec/canvas.js +2 -0
- package/esm/spec/canvas.js.map +1 -0
- package/esm/spec/data.d.ts +44 -0
- package/esm/spec/data.js +2 -0
- package/esm/spec/data.js.map +1 -0
- package/esm/spec/element/animation.d.ts +12 -0
- package/esm/spec/element/animation.js +2 -0
- package/esm/spec/element/animation.js.map +1 -0
- package/esm/spec/element/base.d.ts +6 -0
- package/esm/spec/element/base.js +2 -0
- package/esm/spec/element/base.js.map +1 -0
- package/esm/spec/element/combo.d.ts +48 -0
- package/esm/spec/element/combo.js.map +1 -0
- package/esm/spec/element/edge.d.ts +46 -0
- package/esm/spec/element/edge.js +2 -0
- package/esm/spec/element/edge.js.map +1 -0
- package/esm/spec/element/node.d.ts +48 -0
- package/esm/spec/element/node.js +2 -0
- package/esm/spec/element/node.js.map +1 -0
- package/esm/spec/element/palette.d.ts +53 -0
- package/esm/spec/element/palette.js +2 -0
- package/esm/spec/element/palette.js.map +1 -0
- package/esm/spec/index.d.ts +11 -0
- package/esm/spec/index.js +2 -0
- package/esm/spec/index.js.map +1 -0
- package/esm/spec/layout.d.ts +4 -0
- package/esm/spec/layout.js.map +1 -0
- package/esm/spec/plugin.d.ts +4 -0
- package/esm/spec/plugin.js +2 -0
- package/esm/spec/plugin.js.map +1 -0
- package/esm/spec/spec.d.ts +76 -0
- package/esm/spec/spec.js.map +1 -0
- package/esm/spec/theme.d.ts +10 -0
- package/esm/spec/theme.js +2 -0
- package/esm/spec/theme.js.map +1 -0
- package/esm/spec/viewport.d.ts +86 -0
- package/esm/spec/viewport.js +2 -0
- package/esm/spec/viewport.js.map +1 -0
- package/esm/themes/base.d.ts +27 -0
- package/esm/themes/base.js +197 -0
- package/esm/themes/base.js.map +1 -0
- package/esm/themes/dark.d.ts +2 -0
- package/esm/themes/dark.js +16 -0
- package/esm/themes/dark.js.map +1 -0
- package/esm/themes/index.d.ts +2 -0
- package/esm/themes/index.js +3 -0
- package/esm/themes/index.js.map +1 -0
- package/esm/themes/light.d.ts +2 -0
- package/esm/themes/light.js +16 -0
- package/esm/themes/light.js.map +1 -0
- package/esm/themes/types.d.ts +10 -0
- package/esm/themes/types.js +2 -0
- package/esm/themes/types.js.map +1 -0
- package/esm/types/anchor.d.ts +3 -0
- package/esm/types/anchor.js +2 -0
- package/esm/types/anchor.js.map +1 -0
- package/esm/types/animation.d.ts +6 -0
- package/esm/types/animation.js +2 -0
- package/esm/types/animation.js.map +1 -0
- package/esm/types/behavior.d.ts +5 -45
- package/esm/types/behavior.js +1 -13
- package/esm/types/behavior.js.map +1 -1
- package/esm/types/callable.d.ts +30 -0
- package/esm/types/callable.js +2 -0
- package/esm/types/callable.js.map +1 -0
- package/esm/types/canvas.d.ts +1 -0
- package/esm/types/canvas.js +2 -0
- package/esm/types/canvas.js.map +1 -0
- package/esm/types/change.d.ts +51 -0
- package/esm/types/change.js +2 -0
- package/esm/types/change.js.map +1 -0
- package/esm/types/data.d.ts +44 -34
- package/esm/types/edge.d.ts +24 -104
- package/esm/types/element.d.ts +149 -0
- package/esm/types/element.js +2 -0
- package/esm/types/element.js.map +1 -0
- package/esm/types/enum.d.ts +1 -0
- package/esm/types/enum.js +2 -0
- package/esm/types/enum.js.map +1 -0
- package/esm/types/event.d.ts +4 -39
- package/esm/types/event.js +1 -30
- package/esm/types/event.js.map +1 -1
- package/esm/types/graphlib.d.ts +16 -0
- package/esm/types/graphlib.js +2 -0
- package/esm/types/graphlib.js.map +1 -0
- package/esm/types/index.d.ts +24 -18
- package/esm/types/index.js +1 -3
- package/esm/types/index.js.map +1 -1
- package/esm/types/node.d.ts +15 -185
- package/esm/types/padding.d.ts +2 -0
- package/esm/types/padding.js +2 -0
- package/esm/types/padding.js.map +1 -0
- package/esm/types/placement.d.ts +5 -0
- package/esm/types/placement.js +2 -0
- package/esm/types/placement.js.map +1 -0
- package/esm/types/point.d.ts +2 -0
- package/esm/types/point.js +2 -0
- package/esm/types/point.js.map +1 -0
- package/esm/types/position.d.ts +2 -0
- package/esm/types/position.js +2 -0
- package/esm/types/position.js.map +1 -0
- package/esm/types/prefix.d.ts +7 -0
- package/esm/types/prefix.js +2 -0
- package/esm/types/prefix.js.map +1 -0
- package/esm/types/size.d.ts +3 -0
- package/esm/types/size.js +2 -0
- package/esm/types/size.js.map +1 -0
- package/esm/types/state.d.ts +1 -0
- package/esm/types/state.js +2 -0
- package/esm/types/state.js.map +1 -0
- package/esm/types/style.d.ts +11 -0
- package/esm/types/style.js +2 -0
- package/esm/types/style.js.map +1 -0
- package/esm/types/tree.d.ts +5 -0
- package/esm/types/tree.js +2 -0
- package/esm/types/tree.js.map +1 -0
- package/esm/types/vector.d.ts +2 -0
- package/esm/types/vector.js +2 -0
- package/esm/types/vector.js.map +1 -0
- package/esm/types/viewport.d.ts +38 -0
- package/esm/types/viewport.js +2 -0
- package/esm/types/viewport.js.map +1 -0
- package/esm/utils/anchor.d.ts +9 -0
- package/esm/utils/anchor.js +16 -0
- package/esm/utils/anchor.js.map +1 -0
- package/esm/utils/animation.d.ts +73 -0
- package/esm/utils/animation.js +208 -0
- package/esm/utils/animation.js.map +1 -0
- package/esm/utils/array.d.ts +9 -0
- package/esm/utils/array.js +16 -0
- package/esm/utils/array.js.map +1 -0
- package/esm/utils/bbox.d.ts +109 -0
- package/esm/utils/bbox.js +206 -0
- package/esm/utils/bbox.js.map +1 -0
- package/esm/utils/cache.d.ts +36 -0
- package/esm/utils/cache.js +53 -0
- package/esm/utils/cache.js.map +1 -0
- package/esm/utils/change.d.ts +9 -0
- package/esm/utils/change.js +56 -0
- package/esm/utils/change.js.map +1 -0
- package/esm/utils/combo.d.ts +33 -0
- package/esm/utils/combo.js +111 -0
- package/esm/utils/combo.js.map +1 -0
- package/esm/utils/data.d.ts +34 -0
- package/esm/utils/data.js +59 -0
- package/esm/utils/data.js.map +1 -0
- package/esm/utils/diff.d.ts +15 -0
- package/esm/utils/diff.js +40 -0
- package/esm/utils/diff.js.map +1 -0
- package/esm/utils/dom.d.ts +6 -0
- package/esm/utils/dom.js +36 -0
- package/esm/utils/dom.js.map +1 -0
- package/esm/utils/edge.d.ts +158 -0
- package/esm/utils/edge.js +464 -0
- package/esm/utils/edge.js.map +1 -0
- package/esm/utils/element.d.ts +202 -0
- package/esm/utils/element.js +416 -0
- package/esm/utils/element.js.map +1 -0
- package/esm/utils/event/events.d.ts +31 -0
- package/esm/utils/event/events.js +46 -0
- package/esm/utils/event/events.js.map +1 -0
- package/esm/utils/event/index.d.ts +29 -0
- package/esm/utils/event/index.js +45 -0
- package/esm/utils/event/index.js.map +1 -0
- package/esm/utils/extension.d.ts +10 -0
- package/esm/utils/extension.js +25 -0
- package/esm/utils/extension.js.map +1 -0
- package/esm/utils/graphlib.d.ts +14 -0
- package/esm/utils/graphlib.js +44 -0
- package/esm/utils/graphlib.js.map +1 -0
- package/esm/utils/id.d.ts +18 -0
- package/esm/utils/id.js +27 -0
- package/esm/utils/id.js.map +1 -0
- package/esm/utils/is.d.ts +34 -0
- package/esm/utils/is.js +48 -0
- package/esm/utils/is.js.map +1 -0
- package/esm/utils/layout.d.ts +25 -0
- package/esm/utils/layout.js +38 -0
- package/esm/utils/layout.js.map +1 -0
- package/esm/utils/math.d.ts +10 -0
- package/esm/utils/math.js +13 -0
- package/esm/utils/math.js.map +1 -0
- package/esm/utils/padding.d.ts +9 -0
- package/esm/utils/padding.js +15 -0
- package/esm/utils/padding.js.map +1 -0
- package/esm/utils/palette.d.ts +33 -0
- package/esm/utils/palette.js +103 -0
- package/esm/utils/palette.js.map +1 -0
- package/esm/utils/placement.d.ts +9 -0
- package/esm/utils/placement.js +18 -0
- package/esm/utils/placement.js.map +1 -0
- package/esm/utils/point.d.ts +129 -0
- package/esm/utils/point.js +216 -0
- package/esm/utils/point.js.map +1 -0
- package/esm/utils/position.d.ts +37 -0
- package/esm/utils/position.js +51 -0
- package/esm/utils/position.js.map +1 -0
- package/esm/utils/prefix.d.ts +66 -0
- package/esm/utils/prefix.js +117 -0
- package/esm/utils/prefix.js.map +1 -0
- package/esm/utils/router/orth.d.ts +103 -0
- package/esm/utils/router/orth.js +280 -0
- package/esm/utils/router/orth.js.map +1 -0
- package/esm/utils/shape.d.ts +9 -0
- package/esm/utils/shape.js +22 -0
- package/esm/utils/shape.js.map +1 -0
- package/esm/utils/shortcut.d.ts +20 -0
- package/esm/utils/shortcut.js +56 -0
- package/esm/utils/shortcut.js.map +1 -0
- package/esm/utils/size.d.ts +7 -0
- package/esm/utils/size.js +13 -0
- package/esm/utils/size.js.map +1 -0
- package/esm/utils/style.d.ts +20 -0
- package/esm/utils/style.js +31 -0
- package/esm/utils/style.js.map +1 -0
- package/esm/utils/symbol.d.ts +30 -0
- package/esm/utils/symbol.js +61 -0
- package/esm/utils/symbol.js.map +1 -0
- package/esm/utils/text.d.ts +26 -0
- package/esm/utils/text.js +44 -0
- package/esm/utils/text.js.map +1 -0
- package/esm/utils/traverse.d.ts +14 -0
- package/esm/utils/traverse.js +23 -0
- package/esm/utils/traverse.js.map +1 -0
- package/esm/utils/tree.d.ts +17 -0
- package/esm/utils/tree.js +28 -0
- package/esm/utils/tree.js.map +1 -0
- package/esm/utils/vector.d.ts +142 -0
- package/esm/utils/vector.js +184 -0
- package/esm/utils/vector.js.map +1 -0
- package/esm/utils/visibility.d.ts +13 -0
- package/esm/utils/visibility.js +28 -0
- package/esm/utils/visibility.js.map +1 -0
- package/lib/animations/executor.d.ts +12 -0
- package/lib/animations/executor.js +79 -0
- package/lib/animations/executor.js.map +1 -0
- package/lib/animations/index.d.ts +18 -0
- package/lib/animations/index.js +21 -0
- package/lib/animations/index.js.map +1 -0
- package/lib/animations/types.d.ts +56 -0
- package/lib/animations/types.js.map +1 -0
- package/lib/behaviors/base-behavior.d.ts +5 -0
- package/lib/behaviors/base-behavior.js +8 -0
- package/lib/behaviors/base-behavior.js.map +1 -0
- package/lib/behaviors/collapse-expand.d.ts +41 -0
- package/lib/behaviors/collapse-expand.js +58 -0
- package/lib/behaviors/collapse-expand.js.map +1 -0
- package/lib/behaviors/drag-canvas.d.ts +56 -0
- package/lib/behaviors/drag-canvas.js +65 -0
- package/lib/behaviors/drag-canvas.js.map +1 -0
- package/lib/behaviors/drag-element.d.ts +106 -0
- package/lib/behaviors/drag-element.js +209 -0
- package/lib/behaviors/drag-element.js.map +1 -0
- package/lib/behaviors/index.d.ts +10 -0
- package/lib/behaviors/index.js +14 -0
- package/lib/behaviors/index.js.map +1 -0
- package/lib/behaviors/types.d.ts +5 -0
- package/lib/behaviors/types.js.map +1 -0
- package/lib/behaviors/zoom-canvas.d.ts +69 -0
- package/lib/behaviors/zoom-canvas.js +84 -0
- package/lib/behaviors/zoom-canvas.js.map +1 -0
- package/lib/constants/animation.d.ts +2 -0
- package/lib/constants/animation.js +13 -0
- package/lib/constants/animation.js.map +1 -0
- package/lib/constants/change.d.ts +15 -0
- package/lib/constants/change.js +20 -0
- package/lib/constants/change.js.map +1 -0
- package/lib/constants/element.d.ts +5 -0
- package/lib/constants/element.js +9 -0
- package/lib/constants/element.js.map +1 -0
- package/lib/constants/events/animation.d.ts +7 -0
- package/lib/constants/events/animation.js +13 -0
- package/lib/constants/events/animation.js.map +1 -0
- package/lib/constants/events/canvas.d.ts +38 -0
- package/lib/constants/events/canvas.js +43 -0
- package/lib/constants/events/canvas.js.map +1 -0
- package/lib/constants/events/combo.d.ts +2 -0
- package/lib/constants/events/combo.js +6 -0
- package/lib/constants/events/combo.js.map +1 -0
- package/lib/constants/events/common.d.ts +42 -0
- package/lib/constants/events/common.js +47 -0
- package/lib/constants/events/common.js.map +1 -0
- package/lib/constants/events/container.d.ts +6 -0
- package/lib/constants/events/container.js +11 -0
- package/lib/constants/events/container.js.map +1 -0
- package/lib/constants/events/edge.d.ts +30 -0
- package/lib/constants/events/edge.js +35 -0
- package/lib/constants/events/edge.js.map +1 -0
- package/lib/constants/events/graph.d.ts +60 -0
- package/lib/constants/events/graph.js +67 -0
- package/lib/constants/events/graph.js.map +1 -0
- package/lib/constants/events/index.d.ts +8 -0
- package/lib/constants/events/index.js +20 -0
- package/lib/constants/events/index.js.map +1 -0
- package/lib/constants/events/node.d.ts +36 -0
- package/lib/constants/events/node.js +41 -0
- package/lib/constants/events/node.js.map +1 -0
- package/lib/constants/graphlib.d.ts +2 -0
- package/lib/constants/graphlib.js +6 -0
- package/lib/constants/graphlib.js.map +1 -0
- package/lib/constants/index.d.ts +4 -0
- package/lib/constants/index.js +21 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/elements/combos/base-combo.d.ts +47 -0
- package/lib/elements/combos/base-combo.js +136 -0
- package/lib/elements/combos/base-combo.js.map +1 -0
- package/lib/elements/combos/circle.d.ts +18 -0
- package/lib/elements/combos/circle.js +50 -0
- package/lib/elements/combos/circle.js.map +1 -0
- package/lib/elements/combos/index.d.ts +6 -0
- package/lib/elements/combos/index.js +10 -0
- package/lib/elements/combos/index.js.map +1 -0
- package/lib/elements/combos/rect.d.ts +15 -0
- package/lib/elements/combos/rect.js +31 -0
- package/lib/elements/combos/rect.js.map +1 -0
- package/lib/elements/edges/base-edge.d.ts +58 -0
- package/lib/elements/edges/base-edge.js +193 -0
- package/lib/elements/edges/base-edge.js.map +1 -0
- package/lib/elements/edges/cubic-horizontal.d.ts +21 -0
- package/lib/elements/edges/cubic-horizontal.js +23 -0
- package/lib/elements/edges/cubic-horizontal.js.map +1 -0
- package/lib/elements/edges/cubic-vertical.d.ts +21 -0
- package/lib/elements/edges/cubic-vertical.js +23 -0
- package/lib/elements/edges/cubic-vertical.js.map +1 -0
- package/lib/elements/edges/cubic.d.ts +30 -0
- package/lib/elements/edges/cubic.js +31 -0
- package/lib/elements/edges/cubic.js.map +1 -0
- package/lib/elements/edges/index.d.ts +14 -0
- package/lib/elements/edges/index.js +18 -0
- package/lib/elements/edges/index.js.map +1 -0
- package/lib/elements/edges/line.d.ts +15 -0
- package/lib/elements/edges/line.js +23 -0
- package/lib/elements/edges/line.js.map +1 -0
- package/lib/elements/edges/polyline.d.ts +42 -0
- package/lib/elements/edges/polyline.js +62 -0
- package/lib/elements/edges/polyline.js.map +1 -0
- package/lib/elements/edges/quadratic.d.ts +29 -0
- package/lib/elements/edges/quadratic.js +23 -0
- package/lib/elements/edges/quadratic.js.map +1 -0
- package/lib/elements/index.d.ts +3 -0
- package/lib/elements/index.js +20 -0
- package/lib/elements/index.js.map +1 -0
- package/lib/elements/nodes/base-node.d.ts +107 -0
- package/lib/elements/nodes/base-node.js +212 -0
- package/lib/elements/nodes/base-node.js.map +1 -0
- package/lib/elements/nodes/circle.d.ts +20 -0
- package/lib/elements/nodes/circle.js +38 -0
- package/lib/elements/nodes/circle.js.map +1 -0
- package/lib/elements/nodes/diamond.d.ts +15 -0
- package/lib/elements/nodes/diamond.js +25 -0
- package/lib/elements/nodes/diamond.js.map +1 -0
- package/lib/elements/nodes/ellipse.d.ts +17 -0
- package/lib/elements/nodes/ellipse.js +40 -0
- package/lib/elements/nodes/ellipse.js.map +1 -0
- package/lib/elements/nodes/image.d.ts +20 -0
- package/lib/elements/nodes/image.js +56 -0
- package/lib/elements/nodes/image.js.map +1 -0
- package/lib/elements/nodes/index.d.ts +16 -0
- package/lib/elements/nodes/index.js +20 -0
- package/lib/elements/nodes/index.js.map +1 -0
- package/lib/elements/nodes/polygon.d.ts +17 -0
- package/lib/elements/nodes/polygon.js +28 -0
- package/lib/elements/nodes/polygon.js.map +1 -0
- package/lib/elements/nodes/rect.d.ts +19 -0
- package/lib/elements/nodes/rect.js +43 -0
- package/lib/elements/nodes/rect.js.map +1 -0
- package/lib/elements/nodes/star.d.ts +24 -0
- package/lib/elements/nodes/star.js +33 -0
- package/lib/elements/nodes/star.js.map +1 -0
- package/lib/elements/nodes/triangle.d.ts +24 -0
- package/lib/elements/nodes/triangle.js +51 -0
- package/lib/elements/nodes/triangle.js.map +1 -0
- package/lib/elements/shapes/badge.d.ts +14 -0
- package/lib/elements/shapes/badge.js +29 -0
- package/lib/elements/shapes/badge.js.map +1 -0
- package/lib/elements/shapes/base-shape.d.ts +57 -0
- package/lib/elements/shapes/base-shape.js +114 -0
- package/lib/elements/shapes/base-shape.js.map +1 -0
- package/lib/elements/shapes/icon.d.ts +13 -0
- package/lib/elements/shapes/icon.js +35 -0
- package/lib/elements/shapes/icon.js.map +1 -0
- package/lib/elements/shapes/index.d.ts +13 -0
- package/lib/elements/shapes/index.js +17 -0
- package/lib/elements/shapes/index.js.map +1 -0
- package/lib/elements/shapes/label.d.ts +22 -0
- package/lib/elements/shapes/label.js +64 -0
- package/lib/elements/shapes/label.js.map +1 -0
- package/lib/elements/types.d.ts +0 -0
- package/lib/elements/types.js +15 -0
- package/lib/elements/types.js.map +1 -0
- package/lib/exports.d.ts +24 -0
- package/lib/exports.js +39 -0
- package/lib/exports.js.map +1 -0
- package/lib/index.d.ts +3 -220
- package/lib/index.js +4 -35
- package/lib/index.js.map +1 -1
- package/lib/layouts/index.d.ts +3 -0
- package/lib/layouts/index.js +22 -0
- package/lib/layouts/index.js.map +1 -0
- package/lib/layouts/types.d.ts +71 -0
- package/lib/layouts/types.js.map +1 -0
- package/lib/palettes/index.d.ts +9 -0
- package/lib/palettes/index.js +55 -0
- package/lib/palettes/index.js.map +1 -0
- package/lib/palettes/types.d.ts +5 -0
- package/lib/palettes/types.js.map +1 -0
- package/lib/plugins/base-plugin.d.ts +5 -0
- package/lib/plugins/base-plugin.js +8 -0
- package/lib/plugins/base-plugin.js.map +1 -0
- package/lib/plugins/grid-line.d.ts +31 -0
- package/lib/plugins/grid-line.js +71 -0
- package/lib/plugins/grid-line.js.map +1 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +8 -0
- package/lib/plugins/index.js.map +1 -0
- package/lib/plugins/types.d.ts +4 -0
- package/lib/plugins/types.js +3 -0
- package/lib/plugins/types.js.map +1 -0
- package/lib/preset.d.ts +1 -0
- package/lib/preset.js +10 -0
- package/lib/preset.js.map +1 -0
- package/lib/registry/build-in.d.ts +6 -0
- package/lib/registry/build-in.js +80 -0
- package/lib/registry/build-in.js.map +1 -0
- package/lib/registry/extension/index.d.ts +33 -0
- package/lib/registry/extension/index.js +91 -0
- package/lib/registry/extension/index.js.map +1 -0
- package/lib/registry/extension/types.d.ts +36 -0
- package/lib/registry/extension/types.js +3 -0
- package/lib/registry/extension/types.js.map +1 -0
- package/lib/registry/index.d.ts +57 -0
- package/lib/registry/index.js +101 -0
- package/lib/registry/index.js.map +1 -0
- package/lib/registry/types.d.ts +41 -0
- package/lib/registry/types.js +3 -0
- package/lib/registry/types.js.map +1 -0
- package/lib/runtime/behavior.d.ts +14 -0
- package/lib/runtime/behavior.js +100 -0
- package/lib/runtime/behavior.js.map +1 -0
- package/lib/runtime/canvas.d.ts +49 -0
- package/lib/runtime/canvas.js +196 -0
- package/lib/runtime/canvas.js.map +1 -0
- package/lib/runtime/data.d.ts +187 -0
- package/lib/runtime/data.js +675 -0
- package/lib/runtime/data.js.map +1 -0
- package/lib/runtime/element.d.ts +138 -0
- package/lib/runtime/element.js +585 -0
- package/lib/runtime/element.js.map +1 -0
- package/lib/runtime/graph.d.ts +334 -705
- package/lib/runtime/graph.js +560 -2133
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/index.d.ts +6 -0
- package/lib/runtime/index.js +8 -0
- package/lib/runtime/index.js.map +1 -0
- package/lib/runtime/layout.d.ts +49 -0
- package/lib/runtime/layout.js +327 -0
- package/lib/runtime/layout.js.map +1 -0
- package/lib/runtime/plugin.d.ts +9 -0
- package/lib/runtime/plugin.js +16 -0
- package/lib/runtime/plugin.js.map +1 -0
- package/lib/runtime/types.d.ts +69 -0
- package/lib/runtime/types.js +3 -0
- package/lib/runtime/types.js.map +1 -0
- package/lib/runtime/viewport.d.ts +59 -0
- package/lib/runtime/viewport.js +245 -0
- package/lib/runtime/viewport.js.map +1 -0
- package/lib/spec/behavior.d.ts +4 -0
- package/lib/spec/behavior.js +3 -0
- package/lib/spec/behavior.js.map +1 -0
- package/lib/spec/canvas.d.ts +42 -0
- package/lib/spec/canvas.js +3 -0
- package/lib/spec/canvas.js.map +1 -0
- package/lib/spec/data.d.ts +44 -0
- package/lib/spec/data.js +3 -0
- package/lib/spec/data.js.map +1 -0
- package/lib/spec/element/animation.d.ts +12 -0
- package/lib/spec/element/animation.js +3 -0
- package/lib/spec/element/animation.js.map +1 -0
- package/lib/spec/element/base.d.ts +6 -0
- package/lib/spec/element/base.js +3 -0
- package/lib/spec/element/base.js.map +1 -0
- package/lib/spec/element/combo.d.ts +48 -0
- package/lib/spec/element/combo.js.map +1 -0
- package/lib/spec/element/edge.d.ts +46 -0
- package/lib/spec/element/edge.js +3 -0
- package/lib/spec/element/edge.js.map +1 -0
- package/lib/spec/element/node.d.ts +48 -0
- package/lib/spec/element/node.js +3 -0
- package/lib/spec/element/node.js.map +1 -0
- package/lib/spec/element/palette.d.ts +53 -0
- package/lib/spec/element/palette.js +3 -0
- package/lib/spec/element/palette.js.map +1 -0
- package/lib/spec/index.d.ts +11 -0
- package/lib/spec/index.js +3 -0
- package/lib/spec/index.js.map +1 -0
- package/lib/spec/layout.d.ts +4 -0
- package/lib/spec/layout.js.map +1 -0
- package/lib/spec/plugin.d.ts +4 -0
- package/lib/spec/plugin.js +3 -0
- package/lib/spec/plugin.js.map +1 -0
- package/lib/spec/spec.d.ts +76 -0
- package/lib/spec/spec.js.map +1 -0
- package/lib/spec/theme.d.ts +10 -0
- package/lib/spec/theme.js +3 -0
- package/lib/spec/theme.js.map +1 -0
- package/lib/spec/viewport.d.ts +86 -0
- package/lib/spec/viewport.js +3 -0
- package/lib/spec/viewport.js.map +1 -0
- package/lib/themes/base.d.ts +27 -0
- package/lib/themes/base.js +201 -0
- package/lib/themes/base.js.map +1 -0
- package/lib/themes/dark.d.ts +2 -0
- package/lib/themes/dark.js +19 -0
- package/lib/themes/dark.js.map +1 -0
- package/lib/themes/index.d.ts +2 -0
- package/lib/themes/index.js +8 -0
- package/lib/themes/index.js.map +1 -0
- package/lib/themes/light.d.ts +2 -0
- package/lib/themes/light.js +19 -0
- package/lib/themes/light.js.map +1 -0
- package/lib/themes/types.d.ts +10 -0
- package/lib/themes/types.js +3 -0
- package/lib/themes/types.js.map +1 -0
- package/lib/types/anchor.d.ts +3 -0
- package/lib/types/anchor.js +3 -0
- package/lib/types/anchor.js.map +1 -0
- package/lib/types/animation.d.ts +6 -0
- package/lib/types/animation.js +3 -0
- package/lib/types/animation.js.map +1 -0
- package/lib/types/behavior.d.ts +5 -45
- package/lib/types/behavior.js +0 -15
- package/lib/types/behavior.js.map +1 -1
- package/lib/types/callable.d.ts +30 -0
- package/lib/types/callable.js +3 -0
- package/lib/types/callable.js.map +1 -0
- package/lib/types/canvas.d.ts +1 -0
- package/lib/types/canvas.js +3 -0
- package/lib/types/canvas.js.map +1 -0
- package/lib/types/change.d.ts +51 -0
- package/lib/types/change.js +3 -0
- package/lib/types/change.js.map +1 -0
- package/lib/types/data.d.ts +44 -34
- package/lib/types/edge.d.ts +24 -104
- package/lib/types/element.d.ts +149 -0
- package/lib/types/element.js +3 -0
- package/lib/types/element.js.map +1 -0
- package/lib/types/enum.d.ts +1 -0
- package/lib/types/enum.js +3 -0
- package/lib/types/enum.js.map +1 -0
- package/lib/types/event.d.ts +4 -39
- package/lib/types/event.js +0 -31
- package/lib/types/event.js.map +1 -1
- package/lib/types/graphlib.d.ts +16 -0
- package/lib/types/graphlib.js +3 -0
- package/lib/types/graphlib.js.map +1 -0
- package/lib/types/index.d.ts +24 -18
- package/lib/types/index.js +0 -8
- package/lib/types/index.js.map +1 -1
- package/lib/types/node.d.ts +15 -185
- package/lib/types/padding.d.ts +2 -0
- package/lib/types/padding.js +3 -0
- package/lib/types/padding.js.map +1 -0
- package/lib/types/placement.d.ts +5 -0
- package/lib/types/placement.js +3 -0
- package/lib/types/placement.js.map +1 -0
- package/lib/types/point.d.ts +2 -0
- package/lib/types/point.js +3 -0
- package/lib/types/point.js.map +1 -0
- package/lib/types/position.d.ts +2 -0
- package/lib/types/position.js +3 -0
- package/lib/types/position.js.map +1 -0
- package/lib/types/prefix.d.ts +7 -0
- package/lib/types/prefix.js +3 -0
- package/lib/types/prefix.js.map +1 -0
- package/lib/types/size.d.ts +3 -0
- package/lib/types/size.js +3 -0
- package/lib/types/size.js.map +1 -0
- package/lib/types/state.d.ts +1 -0
- package/lib/types/state.js +3 -0
- package/lib/types/state.js.map +1 -0
- package/lib/types/style.d.ts +11 -0
- package/lib/types/style.js +3 -0
- package/lib/types/style.js.map +1 -0
- package/lib/types/tree.d.ts +5 -0
- package/lib/types/tree.js +3 -0
- package/lib/types/tree.js.map +1 -0
- package/lib/types/vector.d.ts +2 -0
- package/lib/types/vector.js +3 -0
- package/lib/types/vector.js.map +1 -0
- package/lib/types/viewport.d.ts +38 -0
- package/lib/types/viewport.js +3 -0
- package/lib/types/viewport.js.map +1 -0
- package/lib/utils/anchor.d.ts +9 -0
- package/lib/utils/anchor.js +20 -0
- package/lib/utils/anchor.js.map +1 -0
- package/lib/utils/animation.d.ts +73 -0
- package/lib/utils/animation.js +218 -0
- package/lib/utils/animation.js.map +1 -0
- package/lib/utils/array.d.ts +9 -0
- package/lib/utils/array.js +20 -0
- package/lib/utils/array.js.map +1 -0
- package/lib/utils/bbox.d.ts +109 -0
- package/lib/utils/bbox.js +222 -0
- package/lib/utils/bbox.js.map +1 -0
- package/lib/utils/cache.d.ts +36 -0
- package/lib/utils/cache.js +60 -0
- package/lib/utils/cache.js.map +1 -0
- package/lib/utils/change.d.ts +9 -0
- package/lib/utils/change.js +60 -0
- package/lib/utils/change.js.map +1 -0
- package/lib/utils/combo.d.ts +33 -0
- package/lib/utils/combo.js +117 -0
- package/lib/utils/combo.js.map +1 -0
- package/lib/utils/data.d.ts +34 -0
- package/lib/utils/data.js +65 -0
- package/lib/utils/data.js.map +1 -0
- package/lib/utils/diff.d.ts +15 -0
- package/lib/utils/diff.js +44 -0
- package/lib/utils/diff.js.map +1 -0
- package/lib/utils/dom.d.ts +6 -0
- package/lib/utils/dom.js +40 -0
- package/lib/utils/dom.js.map +1 -0
- package/lib/utils/edge.d.ts +158 -0
- package/lib/utils/edge.js +481 -0
- package/lib/utils/edge.js.map +1 -0
- package/lib/utils/element.d.ts +202 -0
- package/lib/utils/element.js +441 -0
- package/lib/utils/element.js.map +1 -0
- package/lib/utils/event/events.d.ts +31 -0
- package/lib/utils/event/events.js +55 -0
- package/lib/utils/event/events.js.map +1 -0
- package/lib/utils/event/index.d.ts +29 -0
- package/lib/utils/event/index.js +64 -0
- package/lib/utils/event/index.js.map +1 -0
- package/lib/utils/extension.d.ts +10 -0
- package/lib/utils/extension.js +29 -0
- package/lib/utils/extension.js.map +1 -0
- package/lib/utils/graphlib.d.ts +14 -0
- package/lib/utils/graphlib.js +50 -0
- package/lib/utils/graphlib.js.map +1 -0
- package/lib/utils/id.d.ts +18 -0
- package/lib/utils/id.js +32 -0
- package/lib/utils/id.js.map +1 -0
- package/lib/utils/is.d.ts +34 -0
- package/lib/utils/is.js +55 -0
- package/lib/utils/is.js.map +1 -0
- package/lib/utils/layout.d.ts +25 -0
- package/lib/utils/layout.js +44 -0
- package/lib/utils/layout.js.map +1 -0
- package/lib/utils/math.d.ts +10 -0
- package/lib/utils/math.js +17 -0
- package/lib/utils/math.js.map +1 -0
- package/lib/utils/padding.d.ts +9 -0
- package/lib/utils/padding.js +19 -0
- package/lib/utils/padding.js.map +1 -0
- package/lib/utils/palette.d.ts +33 -0
- package/lib/utils/palette.js +109 -0
- package/lib/utils/palette.js.map +1 -0
- package/lib/utils/placement.d.ts +9 -0
- package/lib/utils/placement.js +22 -0
- package/lib/utils/placement.js.map +1 -0
- package/lib/utils/point.d.ts +129 -0
- package/lib/utils/point.js +233 -0
- package/lib/utils/point.js.map +1 -0
- package/lib/utils/position.d.ts +37 -0
- package/lib/utils/position.js +58 -0
- package/lib/utils/position.js.map +1 -0
- package/lib/utils/prefix.d.ts +66 -0
- package/lib/utils/prefix.js +127 -0
- package/lib/utils/prefix.js.map +1 -0
- package/lib/utils/router/orth.d.ts +103 -0
- package/lib/utils/router/orth.js +292 -0
- package/lib/utils/router/orth.js.map +1 -0
- package/lib/utils/shape.d.ts +9 -0
- package/lib/utils/shape.js +26 -0
- package/lib/utils/shape.js.map +1 -0
- package/lib/utils/shortcut.d.ts +20 -0
- package/lib/utils/shortcut.js +60 -0
- package/lib/utils/shortcut.js.map +1 -0
- package/lib/utils/size.d.ts +7 -0
- package/lib/utils/size.js +17 -0
- package/lib/utils/size.js.map +1 -0
- package/lib/utils/style.d.ts +20 -0
- package/lib/utils/style.js +36 -0
- package/lib/utils/style.js.map +1 -0
- package/lib/utils/symbol.d.ts +30 -0
- package/lib/utils/symbol.js +71 -0
- package/lib/utils/symbol.js.map +1 -0
- package/lib/utils/text.d.ts +26 -0
- package/lib/utils/text.js +50 -0
- package/lib/utils/text.js.map +1 -0
- package/lib/utils/traverse.d.ts +14 -0
- package/lib/utils/traverse.js +27 -0
- package/lib/utils/traverse.js.map +1 -0
- package/lib/utils/tree.d.ts +17 -0
- package/lib/utils/tree.js +32 -0
- package/lib/utils/tree.js.map +1 -0
- package/lib/utils/vector.d.ts +142 -0
- package/lib/utils/vector.js +203 -0
- package/lib/utils/vector.js.map +1 -0
- package/lib/utils/visibility.d.ts +13 -0
- package/lib/utils/visibility.js +32 -0
- package/lib/utils/visibility.js.map +1 -0
- package/package.json +57 -89
- package/src/animations/executor.ts +95 -0
- package/src/animations/index.ts +19 -0
- package/src/animations/types.ts +68 -0
- package/src/behaviors/base-behavior.ts +6 -0
- package/src/behaviors/collapse-expand.ts +91 -0
- package/src/behaviors/drag-canvas.ts +114 -0
- package/src/behaviors/drag-element.ts +309 -0
- package/src/behaviors/index.ts +11 -0
- package/src/behaviors/types.ts +6 -0
- package/src/behaviors/zoom-canvas.ts +143 -0
- package/src/constants/animation.ts +10 -0
- package/src/constants/change.ts +16 -0
- package/src/constants/element.ts +5 -0
- package/src/constants/events/animation.ts +8 -0
- package/src/constants/events/canvas.ts +38 -0
- package/src/constants/events/combo.ts +3 -0
- package/src/constants/events/common.ts +42 -0
- package/src/constants/events/container.ts +6 -0
- package/src/constants/events/edge.ts +30 -0
- package/src/constants/events/graph.ts +62 -0
- package/src/constants/events/index.ts +8 -0
- package/src/constants/events/node.ts +36 -0
- package/src/constants/graphlib.ts +3 -0
- package/src/constants/index.ts +4 -0
- package/src/elements/combos/base-combo.ts +186 -0
- package/src/elements/combos/circle.ts +66 -0
- package/src/elements/combos/index.ts +7 -0
- package/src/elements/combos/rect.ts +38 -0
- package/src/elements/edges/base-edge.ts +277 -0
- package/src/elements/edges/cubic-horizontal.ts +42 -0
- package/src/elements/edges/cubic-vertical.ts +42 -0
- package/src/elements/edges/cubic.ts +68 -0
- package/src/elements/edges/index.ts +15 -0
- package/src/elements/edges/line.ts +28 -0
- package/src/elements/edges/polyline.ts +118 -0
- package/src/elements/edges/quadratic.ts +46 -0
- package/src/elements/index.ts +3 -0
- package/src/elements/nodes/base-node.ts +338 -0
- package/src/elements/nodes/circle.ts +47 -0
- package/src/elements/nodes/diamond.ts +30 -0
- package/src/elements/nodes/ellipse.ts +50 -0
- package/src/elements/nodes/image.ts +68 -0
- package/src/elements/nodes/index.ts +17 -0
- package/src/elements/nodes/polygon.ts +36 -0
- package/src/elements/nodes/rect.ts +51 -0
- package/src/elements/nodes/star.ts +49 -0
- package/src/elements/nodes/triangle.ts +69 -0
- package/src/elements/shapes/badge.ts +35 -0
- package/src/elements/shapes/base-shape.ts +151 -0
- package/src/elements/shapes/icon.ts +41 -0
- package/src/elements/shapes/index.ts +15 -0
- package/src/elements/shapes/label.ts +86 -0
- package/src/elements/types.ts +21 -0
- package/src/exports.ts +45 -0
- package/src/index.ts +3 -22
- package/src/layouts/hierarchy.d.ts +10 -0
- package/src/layouts/index.ts +15 -0
- package/src/layouts/types.ts +107 -0
- package/src/palettes/index.ts +54 -0
- package/src/palettes/types.ts +9 -0
- package/src/plugins/base-plugin.ts +6 -0
- package/src/plugins/grid-line.ts +98 -0
- package/src/plugins/index.ts +5 -0
- package/src/plugins/types.ts +5 -0
- package/src/preset.ts +9 -0
- package/src/registry/build-in.ts +111 -0
- package/src/registry/extension/index.ts +114 -0
- package/src/registry/extension/types.ts +43 -0
- package/src/registry/index.ts +103 -0
- package/src/registry/types.ts +31 -0
- package/src/runtime/behavior.ts +111 -0
- package/src/runtime/canvas.ts +266 -0
- package/src/runtime/data.ts +766 -0
- package/src/runtime/element.ts +766 -0
- package/src/runtime/graph.ts +703 -2790
- package/src/runtime/index.ts +7 -0
- package/src/runtime/layout.ts +396 -0
- package/src/runtime/plugin.ts +17 -0
- package/src/runtime/types.ts +70 -0
- package/src/runtime/viewport.ts +283 -0
- package/src/spec/behavior.ts +6 -0
- package/src/spec/canvas.ts +43 -0
- package/src/spec/data.ts +48 -0
- package/src/spec/element/animation.ts +16 -0
- package/src/spec/element/base.ts +6 -0
- package/src/spec/element/combo.ts +51 -0
- package/src/spec/element/edge.ts +49 -0
- package/src/spec/element/node.ts +51 -0
- package/src/spec/element/palette.ts +57 -0
- package/src/spec/index.ts +11 -0
- package/src/spec/layout.ts +7 -0
- package/src/spec/plugin.ts +6 -0
- package/src/spec/spec.ts +78 -0
- package/src/spec/theme.ts +11 -0
- package/src/spec/viewport.ts +85 -0
- package/src/themes/base.ts +236 -0
- package/src/themes/dark.ts +18 -0
- package/src/themes/index.ts +2 -0
- package/src/themes/light.ts +18 -0
- package/src/themes/types.ts +12 -0
- package/src/types/anchor.ts +5 -0
- package/src/types/animation.ts +9 -0
- package/src/types/behavior.ts +5 -47
- package/src/types/callable.ts +33 -0
- package/src/types/canvas.ts +1 -0
- package/src/types/change.ts +64 -0
- package/src/types/data.ts +53 -66
- package/src/types/edge.ts +27 -131
- package/src/types/element.ts +163 -0
- package/src/types/enum.ts +1 -0
- package/src/types/event.ts +4 -46
- package/src/types/graphlib.ts +28 -0
- package/src/types/index.ts +24 -56
- package/src/types/node.ts +14 -209
- package/src/types/padding.ts +3 -0
- package/src/types/placement.ts +17 -0
- package/src/types/point.ts +3 -0
- package/src/types/position.ts +3 -0
- package/src/types/prefix.ts +9 -0
- package/src/types/size.ts +5 -0
- package/src/types/state.ts +1 -0
- package/src/types/style.ts +12 -0
- package/src/types/tree.ts +5 -0
- package/src/types/vector.ts +3 -0
- package/src/types/viewport.ts +43 -0
- package/src/utils/anchor.ts +19 -0
- package/src/utils/animation.ts +236 -0
- package/src/utils/array.ts +15 -0
- package/src/utils/bbox.ts +229 -0
- package/src/utils/cache.ts +58 -0
- package/src/utils/change.ts +56 -0
- package/src/utils/combo.ts +133 -0
- package/src/utils/data.ts +64 -0
- package/src/utils/diff.ts +43 -0
- package/src/utils/dom.ts +44 -0
- package/src/utils/edge.ts +548 -0
- package/src/utils/element.ts +463 -0
- package/src/utils/event/events.ts +70 -0
- package/src/utils/event/index.ts +50 -0
- package/src/utils/extension.ts +26 -0
- package/src/utils/graphlib.ts +54 -0
- package/src/utils/id.ts +29 -0
- package/src/utils/is.ts +53 -0
- package/src/utils/layout.ts +39 -0
- package/src/utils/math.ts +12 -0
- package/src/utils/padding.ts +16 -0
- package/src/utils/palette.ts +118 -0
- package/src/utils/placement.ts +19 -0
- package/src/utils/point.ts +238 -0
- package/src/utils/position.ts +56 -0
- package/src/utils/prefix.ts +126 -0
- package/src/utils/router/orth.ts +323 -0
- package/src/utils/shape.ts +26 -0
- package/src/utils/shortcut.ts +77 -0
- package/src/utils/size.ts +13 -0
- package/src/utils/style.ts +38 -0
- package/src/utils/symbol.ts +72 -0
- package/src/utils/text.ts +51 -0
- package/src/utils/traverse.ts +33 -0
- package/src/utils/tree.ts +47 -0
- package/src/utils/vector.ts +201 -0
- package/src/utils/visibility.ts +31 -0
- package/LICENSE +0 -21
- package/esm/api-doc/behaviors.d.ts +0 -2
- package/esm/api-doc/behaviors.js +0 -2
- package/esm/api-doc/behaviors.js.map +0 -1
- package/esm/api-doc/graph.d.ts +0 -4
- package/esm/api-doc/graph.js +0 -4
- package/esm/api-doc/graph.js.map +0 -1
- package/esm/api-doc/item.d.ts +0 -11
- package/esm/api-doc/item.js +0 -5
- package/esm/api-doc/item.js.map +0 -1
- package/esm/api-doc/layout.d.ts +0 -1
- package/esm/api-doc/layout.js.map +0 -1
- package/esm/api-doc/plugins.d.ts +0 -1
- package/esm/api-doc/plugins.js +0 -2
- package/esm/api-doc/plugins.js.map +0 -1
- package/esm/api-doc/types.js.map +0 -1
- package/esm/api-doc/util.d.ts +0 -3
- package/esm/api-doc/util.js +0 -4
- package/esm/api-doc/util.js.map +0 -1
- package/esm/constant/index.d.ts +0 -1
- package/esm/constant/index.js +0 -2
- package/esm/constant/index.js.map +0 -1
- package/esm/constant/shape.d.ts +0 -23
- package/esm/constant/shape.js +0 -27
- package/esm/constant/shape.js.map +0 -1
- package/esm/item/combo.d.ts +0 -83
- package/esm/item/combo.js +0 -202
- package/esm/item/combo.js.map +0 -1
- package/esm/item/edge.d.ts +0 -82
- package/esm/item/edge.js +0 -287
- package/esm/item/edge.js.map +0 -1
- package/esm/item/item.d.ts +0 -202
- package/esm/item/item.js +0 -785
- package/esm/item/item.js.map +0 -1
- package/esm/item/node.d.ts +0 -64
- package/esm/item/node.js +0 -296
- package/esm/item/node.js.map +0 -1
- package/esm/runtime/controller/data.d.ts +0 -107
- package/esm/runtime/controller/data.js +0 -788
- package/esm/runtime/controller/data.js.map +0 -1
- package/esm/runtime/controller/index.d.ts +0 -7
- package/esm/runtime/controller/index.js +0 -8
- package/esm/runtime/controller/index.js.map +0 -1
- package/esm/runtime/controller/interaction.d.ts +0 -52
- package/esm/runtime/controller/interaction.js +0 -280
- package/esm/runtime/controller/interaction.js.map +0 -1
- package/esm/runtime/controller/item.d.ts +0 -156
- package/esm/runtime/controller/item.js +0 -1446
- package/esm/runtime/controller/item.js.map +0 -1
- package/esm/runtime/controller/layout.d.ts +0 -37
- package/esm/runtime/controller/layout.js +0 -422
- package/esm/runtime/controller/layout.js.map +0 -1
- package/esm/runtime/controller/plugin.d.ts +0 -48
- package/esm/runtime/controller/plugin.js +0 -219
- package/esm/runtime/controller/plugin.js.map +0 -1
- package/esm/runtime/controller/theme.d.ts +0 -29
- package/esm/runtime/controller/theme.js +0 -58
- package/esm/runtime/controller/theme.js.map +0 -1
- package/esm/runtime/controller/viewport.d.ts +0 -11
- package/esm/runtime/controller/viewport.js +0 -125
- package/esm/runtime/controller/viewport.js.map +0 -1
- package/esm/runtime/hooks.d.ts +0 -33
- package/esm/runtime/hooks.js +0 -74
- package/esm/runtime/hooks.js.map +0 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +0 -61
- package/esm/stdlib/behavior/activate-relations.js +0 -85
- package/esm/stdlib/behavior/activate-relations.js.map +0 -1
- package/esm/stdlib/behavior/brush-select.d.ts +0 -115
- package/esm/stdlib/behavior/brush-select.js +0 -266
- package/esm/stdlib/behavior/brush-select.js.map +0 -1
- package/esm/stdlib/behavior/click-select.d.ts +0 -73
- package/esm/stdlib/behavior/click-select.js +0 -165
- package/esm/stdlib/behavior/click-select.js.map +0 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +0 -28
- package/esm/stdlib/behavior/collapse-expand-combo.js +0 -35
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +0 -1
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +0 -44
- package/esm/stdlib/behavior/collapse-expand-tree.js +0 -69
- package/esm/stdlib/behavior/collapse-expand-tree.js.map +0 -1
- package/esm/stdlib/behavior/create-edge.d.ts +0 -57
- package/esm/stdlib/behavior/create-edge.js +0 -215
- package/esm/stdlib/behavior/create-edge.js.map +0 -1
- package/esm/stdlib/behavior/drag-canvas.d.ts +0 -83
- package/esm/stdlib/behavior/drag-canvas.js +0 -298
- package/esm/stdlib/behavior/drag-canvas.js.map +0 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +0 -111
- package/esm/stdlib/behavior/drag-combo.js +0 -391
- package/esm/stdlib/behavior/drag-combo.js.map +0 -1
- package/esm/stdlib/behavior/drag-node.d.ts +0 -104
- package/esm/stdlib/behavior/drag-node.js +0 -550
- package/esm/stdlib/behavior/drag-node.js.map +0 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +0 -42
- package/esm/stdlib/behavior/hover-activate.js +0 -64
- package/esm/stdlib/behavior/hover-activate.js.map +0 -1
- package/esm/stdlib/behavior/index.d.ts +0 -18
- package/esm/stdlib/behavior/index.js +0 -19
- package/esm/stdlib/behavior/index.js.map +0 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +0 -31
- package/esm/stdlib/behavior/lasso-select.js +0 -78
- package/esm/stdlib/behavior/lasso-select.js.map +0 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +0 -36
- package/esm/stdlib/behavior/orbit-canvas-3d.js +0 -62
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +0 -60
- package/esm/stdlib/behavior/rotate-canvas-3d.js +0 -123
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +0 -67
- package/esm/stdlib/behavior/scroll-canvas.js +0 -266
- package/esm/stdlib/behavior/scroll-canvas.js.map +0 -1
- package/esm/stdlib/behavior/shortcuts-call.d.ts +0 -38
- package/esm/stdlib/behavior/shortcuts-call.js +0 -87
- package/esm/stdlib/behavior/shortcuts-call.js.map +0 -1
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +0 -36
- package/esm/stdlib/behavior/track-canvas-3d.js +0 -62
- package/esm/stdlib/behavior/track-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/types.d.ts +0 -13
- package/esm/stdlib/behavior/types.js.map +0 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +0 -58
- package/esm/stdlib/behavior/zoom-canvas-3d.js +0 -101
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +0 -86
- package/esm/stdlib/behavior/zoom-canvas.js +0 -315
- package/esm/stdlib/behavior/zoom-canvas.js.map +0 -1
- package/esm/stdlib/data/index.d.ts +0 -4
- package/esm/stdlib/data/index.js +0 -5
- package/esm/stdlib/data/index.js.map +0 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +0 -11
- package/esm/stdlib/data/mapNodeSize.js +0 -53
- package/esm/stdlib/data/mapNodeSize.js.map +0 -1
- package/esm/stdlib/data/processParallelEdges.d.ts +0 -21
- package/esm/stdlib/data/processParallelEdges.js +0 -127
- package/esm/stdlib/data/processParallelEdges.js.map +0 -1
- package/esm/stdlib/data/transformV4Data.d.ts +0 -8
- package/esm/stdlib/data/transformV4Data.js +0 -156
- package/esm/stdlib/data/transformV4Data.js.map +0 -1
- package/esm/stdlib/data/validateData.d.ts +0 -8
- package/esm/stdlib/data/validateData.js +0 -112
- package/esm/stdlib/data/validateData.js.map +0 -1
- package/esm/stdlib/index.d.ts +0 -172
- package/esm/stdlib/index.js +0 -221
- package/esm/stdlib/index.js.map +0 -1
- package/esm/stdlib/item/combo/circle.d.ts +0 -29
- package/esm/stdlib/item/combo/circle.js +0 -61
- package/esm/stdlib/item/combo/circle.js.map +0 -1
- package/esm/stdlib/item/combo/index.d.ts +0 -2
- package/esm/stdlib/item/combo/index.js +0 -3
- package/esm/stdlib/item/combo/index.js.map +0 -1
- package/esm/stdlib/item/combo/rect.d.ts +0 -31
- package/esm/stdlib/item/combo/rect.js +0 -70
- package/esm/stdlib/item/combo/rect.js.map +0 -1
- package/esm/stdlib/item/edge/base.d.ts +0 -216
- package/esm/stdlib/item/edge/base.js +0 -384
- package/esm/stdlib/item/edge/base.js.map +0 -1
- package/esm/stdlib/item/edge/cubic-horizontal.d.ts +0 -36
- package/esm/stdlib/item/edge/cubic-horizontal.js +0 -56
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +0 -1
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +0 -36
- package/esm/stdlib/item/edge/cubic-vertical.js +0 -56
- package/esm/stdlib/item/edge/cubic-vertical.js.map +0 -1
- package/esm/stdlib/item/edge/cubic.d.ts +0 -59
- package/esm/stdlib/item/edge/cubic.js +0 -121
- package/esm/stdlib/item/edge/cubic.js.map +0 -1
- package/esm/stdlib/item/edge/index.d.ts +0 -7
- package/esm/stdlib/item/edge/index.js +0 -8
- package/esm/stdlib/item/edge/index.js.map +0 -1
- package/esm/stdlib/item/edge/line.d.ts +0 -33
- package/esm/stdlib/item/edge/line.js +0 -68
- package/esm/stdlib/item/edge/line.js.map +0 -1
- package/esm/stdlib/item/edge/loop.d.ts +0 -32
- package/esm/stdlib/item/edge/loop.js +0 -120
- package/esm/stdlib/item/edge/loop.js.map +0 -1
- package/esm/stdlib/item/edge/polyline.d.ts +0 -45
- package/esm/stdlib/item/edge/polyline.js +0 -97
- package/esm/stdlib/item/edge/polyline.js.map +0 -1
- package/esm/stdlib/item/edge/quadratic.d.ts +0 -40
- package/esm/stdlib/item/edge/quadratic.js +0 -83
- package/esm/stdlib/item/edge/quadratic.js.map +0 -1
- package/esm/stdlib/item/node/base.d.ts +0 -246
- package/esm/stdlib/item/node/base.js +0 -475
- package/esm/stdlib/item/node/base.js.map +0 -1
- package/esm/stdlib/item/node/base3d.d.ts +0 -106
- package/esm/stdlib/item/node/base3d.js +0 -141
- package/esm/stdlib/item/node/base3d.js.map +0 -1
- package/esm/stdlib/item/node/circle.d.ts +0 -30
- package/esm/stdlib/item/node/circle.js +0 -62
- package/esm/stdlib/item/node/circle.js.map +0 -1
- package/esm/stdlib/item/node/cube.d.ts +0 -33
- package/esm/stdlib/item/node/cube.js +0 -57
- package/esm/stdlib/item/node/cube.js.map +0 -1
- package/esm/stdlib/item/node/diamond.d.ts +0 -32
- package/esm/stdlib/item/node/diamond.js +0 -88
- package/esm/stdlib/item/node/diamond.js.map +0 -1
- package/esm/stdlib/item/node/donut.d.ts +0 -70
- package/esm/stdlib/item/node/donut.js +0 -217
- package/esm/stdlib/item/node/donut.js.map +0 -1
- package/esm/stdlib/item/node/ellipse.d.ts +0 -32
- package/esm/stdlib/item/node/ellipse.js +0 -76
- package/esm/stdlib/item/node/ellipse.js.map +0 -1
- package/esm/stdlib/item/node/hexagon.d.ts +0 -33
- package/esm/stdlib/item/node/hexagon.js +0 -114
- package/esm/stdlib/item/node/hexagon.js.map +0 -1
- package/esm/stdlib/item/node/image.d.ts +0 -40
- package/esm/stdlib/item/node/image.js +0 -120
- package/esm/stdlib/item/node/image.js.map +0 -1
- package/esm/stdlib/item/node/index.d.ts +0 -15
- package/esm/stdlib/item/node/index.js +0 -16
- package/esm/stdlib/item/node/index.js.map +0 -1
- package/esm/stdlib/item/node/modelRect.d.ts +0 -93
- package/esm/stdlib/item/node/modelRect.js +0 -243
- package/esm/stdlib/item/node/modelRect.js.map +0 -1
- package/esm/stdlib/item/node/plane.d.ts +0 -38
- package/esm/stdlib/item/node/plane.js +0 -62
- package/esm/stdlib/item/node/plane.js.map +0 -1
- package/esm/stdlib/item/node/rect.d.ts +0 -32
- package/esm/stdlib/item/node/rect.js +0 -80
- package/esm/stdlib/item/node/rect.js.map +0 -1
- package/esm/stdlib/item/node/sphere.d.ts +0 -33
- package/esm/stdlib/item/node/sphere.js +0 -57
- package/esm/stdlib/item/node/sphere.js.map +0 -1
- package/esm/stdlib/item/node/star.d.ts +0 -32
- package/esm/stdlib/item/node/star.js +0 -121
- package/esm/stdlib/item/node/star.js.map +0 -1
- package/esm/stdlib/item/node/triangle.d.ts +0 -44
- package/esm/stdlib/item/node/triangle.js +0 -187
- package/esm/stdlib/item/node/triangle.js.map +0 -1
- package/esm/stdlib/plugin/edgeBundling/index.d.ts +0 -75
- package/esm/stdlib/plugin/edgeBundling/index.js +0 -364
- package/esm/stdlib/plugin/edgeBundling/index.js.map +0 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +0 -66
- package/esm/stdlib/plugin/edgeFilterLens/index.js +0 -309
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +0 -1
- package/esm/stdlib/plugin/fisheye/index.d.ts +0 -130
- package/esm/stdlib/plugin/fisheye/index.js +0 -489
- package/esm/stdlib/plugin/fisheye/index.js.map +0 -1
- package/esm/stdlib/plugin/grid/index.d.ts +0 -36
- package/esm/stdlib/plugin/grid/index.js +0 -80
- package/esm/stdlib/plugin/grid/index.js.map +0 -1
- package/esm/stdlib/plugin/history/combo-command.d.ts +0 -9
- package/esm/stdlib/plugin/history/combo-command.js +0 -21
- package/esm/stdlib/plugin/history/combo-command.js.map +0 -1
- package/esm/stdlib/plugin/history/command.d.ts +0 -18
- package/esm/stdlib/plugin/history/command.js +0 -51
- package/esm/stdlib/plugin/history/command.js.map +0 -1
- package/esm/stdlib/plugin/history/index.d.ts +0 -112
- package/esm/stdlib/plugin/history/index.js +0 -275
- package/esm/stdlib/plugin/history/index.js.map +0 -1
- package/esm/stdlib/plugin/history/item-data-command.d.ts +0 -14
- package/esm/stdlib/plugin/history/item-data-command.js +0 -72
- package/esm/stdlib/plugin/history/item-data-command.js.map +0 -1
- package/esm/stdlib/plugin/history/layer-updated-command.d.ts +0 -9
- package/esm/stdlib/plugin/history/layer-updated-command.js +0 -21
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +0 -1
- package/esm/stdlib/plugin/history/state-updated-command.d.ts +0 -9
- package/esm/stdlib/plugin/history/state-updated-command.js +0 -20
- package/esm/stdlib/plugin/history/state-updated-command.js.map +0 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +0 -10
- package/esm/stdlib/plugin/history/visibility-updated-command.js +0 -23
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +0 -1
- package/esm/stdlib/plugin/hull/bubbleset.d.ts +0 -9
- package/esm/stdlib/plugin/hull/bubbleset.js +0 -592
- package/esm/stdlib/plugin/hull/bubbleset.js.map +0 -1
- package/esm/stdlib/plugin/hull/convexHull.d.ts +0 -14
- package/esm/stdlib/plugin/hull/convexHull.js +0 -56
- package/esm/stdlib/plugin/hull/convexHull.js.map +0 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +0 -87
- package/esm/stdlib/plugin/hull/hullComponent.js +0 -378
- package/esm/stdlib/plugin/hull/hullComponent.js.map +0 -1
- package/esm/stdlib/plugin/hull/index.d.ts +0 -59
- package/esm/stdlib/plugin/hull/index.js +0 -161
- package/esm/stdlib/plugin/hull/index.js.map +0 -1
- package/esm/stdlib/plugin/hull/types.d.ts +0 -15
- package/esm/stdlib/plugin/hull/types.js.map +0 -1
- package/esm/stdlib/plugin/hull/util.d.ts +0 -77
- package/esm/stdlib/plugin/hull/util.js +0 -405
- package/esm/stdlib/plugin/hull/util.js.map +0 -1
- package/esm/stdlib/plugin/index.d.ts +0 -13
- package/esm/stdlib/plugin/index.js +0 -14
- package/esm/stdlib/plugin/index.js.map +0 -1
- package/esm/stdlib/plugin/legend/index.d.ts +0 -164
- package/esm/stdlib/plugin/legend/index.js +0 -596
- package/esm/stdlib/plugin/legend/index.js.map +0 -1
- package/esm/stdlib/plugin/lodController/index.d.ts +0 -73
- package/esm/stdlib/plugin/lodController/index.js +0 -558
- package/esm/stdlib/plugin/lodController/index.js.map +0 -1
- package/esm/stdlib/plugin/menu/index.d.ts +0 -55
- package/esm/stdlib/plugin/menu/index.js +0 -238
- package/esm/stdlib/plugin/menu/index.js.map +0 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +0 -118
- package/esm/stdlib/plugin/minimap/index.js +0 -681
- package/esm/stdlib/plugin/minimap/index.js.map +0 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +0 -167
- package/esm/stdlib/plugin/snapline/index.js +0 -1063
- package/esm/stdlib/plugin/snapline/index.js.map +0 -1
- package/esm/stdlib/plugin/timebar/index.d.ts +0 -98
- package/esm/stdlib/plugin/timebar/index.js +0 -303
- package/esm/stdlib/plugin/timebar/index.js.map +0 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +0 -59
- package/esm/stdlib/plugin/toolbar/index.js +0 -213
- package/esm/stdlib/plugin/toolbar/index.js.map +0 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +0 -96
- package/esm/stdlib/plugin/tooltip/index.js +0 -377
- package/esm/stdlib/plugin/tooltip/index.js.map +0 -1
- package/esm/stdlib/plugin/types.d.ts +0 -11
- package/esm/stdlib/plugin/types.js.map +0 -1
- package/esm/stdlib/plugin/watermarker/index.d.ts +0 -78
- package/esm/stdlib/plugin/watermarker/index.js +0 -243
- package/esm/stdlib/plugin/watermarker/index.js.map +0 -1
- package/esm/stdlib/selector/lasso.d.ts +0 -15
- package/esm/stdlib/selector/lasso.js +0 -61
- package/esm/stdlib/selector/lasso.js.map +0 -1
- package/esm/stdlib/selector/rect.d.ts +0 -16
- package/esm/stdlib/selector/rect.js +0 -54
- package/esm/stdlib/selector/rect.js.map +0 -1
- package/esm/stdlib/theme/dark.d.ts +0 -2
- package/esm/stdlib/theme/dark.js +0 -329
- package/esm/stdlib/theme/dark.js.map +0 -1
- package/esm/stdlib/theme/index.d.ts +0 -2
- package/esm/stdlib/theme/index.js +0 -3
- package/esm/stdlib/theme/index.js.map +0 -1
- package/esm/stdlib/theme/light.d.ts +0 -2
- package/esm/stdlib/theme/light.js +0 -330
- package/esm/stdlib/theme/light.js.map +0 -1
- package/esm/stdlib/themeSolver/base.d.ts +0 -15
- package/esm/stdlib/themeSolver/base.js +0 -11
- package/esm/stdlib/themeSolver/base.js.map +0 -1
- package/esm/stdlib/themeSolver/index.d.ts +0 -3
- package/esm/stdlib/themeSolver/index.js +0 -4
- package/esm/stdlib/themeSolver/index.js.map +0 -1
- package/esm/stdlib/themeSolver/spec.d.ts +0 -35
- package/esm/stdlib/themeSolver/spec.js +0 -81
- package/esm/stdlib/themeSolver/spec.js.map +0 -1
- package/esm/stdlib/themeSolver/subject.d.ts +0 -41
- package/esm/stdlib/themeSolver/subject.js +0 -396
- package/esm/stdlib/themeSolver/subject.js.map +0 -1
- package/esm/types/animate.d.ts +0 -59
- package/esm/types/animate.js +0 -2
- package/esm/types/animate.js.map +0 -1
- package/esm/types/combo.d.ts +0 -135
- package/esm/types/combo.js.map +0 -1
- package/esm/types/common.d.ts +0 -17
- package/esm/types/common.js +0 -2
- package/esm/types/common.js.map +0 -1
- package/esm/types/graph.d.ts +0 -688
- package/esm/types/graph.js +0 -2
- package/esm/types/graph.js.map +0 -1
- package/esm/types/history.d.ts +0 -28
- package/esm/types/history.js +0 -6
- package/esm/types/history.js.map +0 -1
- package/esm/types/hook.d.ts +0 -159
- package/esm/types/hook.js +0 -2
- package/esm/types/hook.js.map +0 -1
- package/esm/types/item.d.ts +0 -233
- package/esm/types/item.js +0 -16
- package/esm/types/item.js.map +0 -1
- package/esm/types/layout.d.ts +0 -77
- package/esm/types/layout.js +0 -20
- package/esm/types/layout.js.map +0 -1
- package/esm/types/loop.d.ts +0 -21
- package/esm/types/loop.js +0 -12
- package/esm/types/loop.js.map +0 -1
- package/esm/types/plugin.d.ts +0 -45
- package/esm/types/plugin.js +0 -54
- package/esm/types/plugin.js.map +0 -1
- package/esm/types/render.d.ts +0 -1
- package/esm/types/render.js +0 -2
- package/esm/types/render.js.map +0 -1
- package/esm/types/spec.d.ts +0 -100
- package/esm/types/spec.js.map +0 -1
- package/esm/types/stdlib.d.ts +0 -13
- package/esm/types/stdlib.js +0 -2
- package/esm/types/stdlib.js.map +0 -1
- package/esm/types/theme.d.ts +0 -168
- package/esm/types/theme.js +0 -14
- package/esm/types/theme.js.map +0 -1
- package/esm/types/view.d.ts +0 -33
- package/esm/types/view.js +0 -2
- package/esm/types/view.js.map +0 -1
- package/esm/util/animate.d.ts +0 -111
- package/esm/util/animate.js +0 -436
- package/esm/util/animate.js.map +0 -1
- package/esm/util/array.d.ts +0 -29
- package/esm/util/array.js +0 -73
- package/esm/util/array.js.map +0 -1
- package/esm/util/arrow.d.ts +0 -17
- package/esm/util/arrow.js +0 -56
- package/esm/util/arrow.js.map +0 -1
- package/esm/util/bbox.d.ts +0 -127
- package/esm/util/bbox.js +0 -299
- package/esm/util/bbox.js.map +0 -1
- package/esm/util/behavior.d.ts +0 -2
- package/esm/util/behavior.js +0 -12
- package/esm/util/behavior.js.map +0 -1
- package/esm/util/canvas.d.ts +0 -19
- package/esm/util/canvas.js +0 -72
- package/esm/util/canvas.js.map +0 -1
- package/esm/util/data.d.ts +0 -112
- package/esm/util/data.js +0 -311
- package/esm/util/data.js.map +0 -1
- package/esm/util/dom.d.ts +0 -15
- package/esm/util/dom.js +0 -29
- package/esm/util/dom.js.map +0 -1
- package/esm/util/event.d.ts +0 -42
- package/esm/util/event.js +0 -103
- package/esm/util/event.js.map +0 -1
- package/esm/util/extend.d.ts +0 -27
- package/esm/util/extend.js +0 -21
- package/esm/util/extend.js.map +0 -1
- package/esm/util/extension.d.ts +0 -10
- package/esm/util/extension.js +0 -24
- package/esm/util/extension.js.map +0 -1
- package/esm/util/index.d.ts +0 -7
- package/esm/util/index.js +0 -8
- package/esm/util/index.js.map +0 -1
- package/esm/util/item.d.ts +0 -30
- package/esm/util/item.js +0 -90
- package/esm/util/item.js.map +0 -1
- package/esm/util/layout.d.ts +0 -51
- package/esm/util/layout.js +0 -205
- package/esm/util/layout.js.map +0 -1
- package/esm/util/loop.d.ts +0 -38
- package/esm/util/loop.js +0 -118
- package/esm/util/loop.js.map +0 -1
- package/esm/util/mapper.d.ts +0 -17
- package/esm/util/mapper.js +0 -55
- package/esm/util/mapper.js.map +0 -1
- package/esm/util/math.d.ts +0 -23
- package/esm/util/math.js +0 -23
- package/esm/util/math.js.map +0 -1
- package/esm/util/matrix.d.ts +0 -6
- package/esm/util/matrix.js +0 -48
- package/esm/util/matrix.js.map +0 -1
- package/esm/util/mock.d.ts +0 -30
- package/esm/util/mock.js +0 -69
- package/esm/util/mock.js.map +0 -1
- package/esm/util/path.d.ts +0 -16
- package/esm/util/path.js +0 -115
- package/esm/util/path.js.map +0 -1
- package/esm/util/point.d.ts +0 -83
- package/esm/util/point.js +0 -192
- package/esm/util/point.js.map +0 -1
- package/esm/util/polyline.d.ts +0 -124
- package/esm/util/polyline.js +0 -511
- package/esm/util/polyline.js.map +0 -1
- package/esm/util/router.d.ts +0 -32
- package/esm/util/router.js +0 -384
- package/esm/util/router.js.map +0 -1
- package/esm/util/shape.d.ts +0 -154
- package/esm/util/shape.js +0 -642
- package/esm/util/shape.js.map +0 -1
- package/esm/util/shape3d.d.ts +0 -23
- package/esm/util/shape3d.js +0 -149
- package/esm/util/shape3d.js.map +0 -1
- package/esm/util/text.d.ts +0 -18
- package/esm/util/text.js +0 -37
- package/esm/util/text.js.map +0 -1
- package/esm/util/type.d.ts +0 -8
- package/esm/util/type.js +0 -8
- package/esm/util/type.js.map +0 -1
- package/esm/util/warn.d.ts +0 -14
- package/esm/util/warn.js +0 -4
- package/esm/util/warn.js.map +0 -1
- package/esm/util/zoom.d.ts +0 -14
- package/esm/util/zoom.js +0 -35
- package/esm/util/zoom.js.map +0 -1
- package/lib/api-doc/behaviors.d.ts +0 -2
- package/lib/api-doc/behaviors.js +0 -18
- package/lib/api-doc/behaviors.js.map +0 -1
- package/lib/api-doc/graph.d.ts +0 -4
- package/lib/api-doc/graph.js +0 -31
- package/lib/api-doc/graph.js.map +0 -1
- package/lib/api-doc/item.d.ts +0 -11
- package/lib/api-doc/item.js +0 -25
- package/lib/api-doc/item.js.map +0 -1
- package/lib/api-doc/layout.d.ts +0 -1
- package/lib/api-doc/layout.js.map +0 -1
- package/lib/api-doc/plugins.d.ts +0 -1
- package/lib/api-doc/plugins.js +0 -18
- package/lib/api-doc/plugins.js.map +0 -1
- package/lib/api-doc/types.js.map +0 -1
- package/lib/api-doc/util.d.ts +0 -3
- package/lib/api-doc/util.js +0 -10
- package/lib/api-doc/util.js.map +0 -1
- package/lib/constant/index.d.ts +0 -1
- package/lib/constant/index.js +0 -18
- package/lib/constant/index.js.map +0 -1
- package/lib/constant/shape.d.ts +0 -23
- package/lib/constant/shape.js +0 -30
- package/lib/constant/shape.js.map +0 -1
- package/lib/item/combo.d.ts +0 -83
- package/lib/item/combo.js +0 -208
- package/lib/item/combo.js.map +0 -1
- package/lib/item/edge.d.ts +0 -82
- package/lib/item/edge.js +0 -293
- package/lib/item/edge.js.map +0 -1
- package/lib/item/item.d.ts +0 -202
- package/lib/item/item.js +0 -788
- package/lib/item/item.js.map +0 -1
- package/lib/item/node.d.ts +0 -64
- package/lib/item/node.js +0 -302
- package/lib/item/node.js.map +0 -1
- package/lib/runtime/controller/data.d.ts +0 -107
- package/lib/runtime/controller/data.js +0 -792
- package/lib/runtime/controller/data.js.map +0 -1
- package/lib/runtime/controller/index.d.ts +0 -7
- package/lib/runtime/controller/index.js +0 -24
- package/lib/runtime/controller/index.js.map +0 -1
- package/lib/runtime/controller/interaction.d.ts +0 -52
- package/lib/runtime/controller/interaction.js +0 -284
- package/lib/runtime/controller/interaction.js.map +0 -1
- package/lib/runtime/controller/item.d.ts +0 -156
- package/lib/runtime/controller/item.js +0 -1453
- package/lib/runtime/controller/item.js.map +0 -1
- package/lib/runtime/controller/layout.d.ts +0 -37
- package/lib/runtime/controller/layout.js +0 -426
- package/lib/runtime/controller/layout.js.map +0 -1
- package/lib/runtime/controller/plugin.d.ts +0 -48
- package/lib/runtime/controller/plugin.js +0 -226
- package/lib/runtime/controller/plugin.js.map +0 -1
- package/lib/runtime/controller/theme.d.ts +0 -29
- package/lib/runtime/controller/theme.js +0 -65
- package/lib/runtime/controller/theme.js.map +0 -1
- package/lib/runtime/controller/viewport.d.ts +0 -11
- package/lib/runtime/controller/viewport.js +0 -129
- package/lib/runtime/controller/viewport.js.map +0 -1
- package/lib/runtime/hooks.d.ts +0 -33
- package/lib/runtime/hooks.js +0 -77
- package/lib/runtime/hooks.js.map +0 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +0 -61
- package/lib/stdlib/behavior/activate-relations.js +0 -89
- package/lib/stdlib/behavior/activate-relations.js.map +0 -1
- package/lib/stdlib/behavior/brush-select.d.ts +0 -115
- package/lib/stdlib/behavior/brush-select.js +0 -273
- package/lib/stdlib/behavior/brush-select.js.map +0 -1
- package/lib/stdlib/behavior/click-select.d.ts +0 -73
- package/lib/stdlib/behavior/click-select.js +0 -169
- package/lib/stdlib/behavior/click-select.js.map +0 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +0 -28
- package/lib/stdlib/behavior/collapse-expand-combo.js +0 -39
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +0 -1
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +0 -44
- package/lib/stdlib/behavior/collapse-expand-tree.js +0 -73
- package/lib/stdlib/behavior/collapse-expand-tree.js.map +0 -1
- package/lib/stdlib/behavior/create-edge.d.ts +0 -57
- package/lib/stdlib/behavior/create-edge.js +0 -219
- package/lib/stdlib/behavior/create-edge.js.map +0 -1
- package/lib/stdlib/behavior/drag-canvas.d.ts +0 -83
- package/lib/stdlib/behavior/drag-canvas.js +0 -302
- package/lib/stdlib/behavior/drag-canvas.js.map +0 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +0 -111
- package/lib/stdlib/behavior/drag-combo.js +0 -395
- package/lib/stdlib/behavior/drag-combo.js.map +0 -1
- package/lib/stdlib/behavior/drag-node.d.ts +0 -104
- package/lib/stdlib/behavior/drag-node.js +0 -554
- package/lib/stdlib/behavior/drag-node.js.map +0 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +0 -42
- package/lib/stdlib/behavior/hover-activate.js +0 -68
- package/lib/stdlib/behavior/hover-activate.js.map +0 -1
- package/lib/stdlib/behavior/index.d.ts +0 -18
- package/lib/stdlib/behavior/index.js +0 -35
- package/lib/stdlib/behavior/index.js.map +0 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +0 -31
- package/lib/stdlib/behavior/lasso-select.js +0 -85
- package/lib/stdlib/behavior/lasso-select.js.map +0 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +0 -36
- package/lib/stdlib/behavior/orbit-canvas-3d.js +0 -66
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +0 -60
- package/lib/stdlib/behavior/rotate-canvas-3d.js +0 -127
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +0 -67
- package/lib/stdlib/behavior/scroll-canvas.js +0 -270
- package/lib/stdlib/behavior/scroll-canvas.js.map +0 -1
- package/lib/stdlib/behavior/shortcuts-call.d.ts +0 -38
- package/lib/stdlib/behavior/shortcuts-call.js +0 -91
- package/lib/stdlib/behavior/shortcuts-call.js.map +0 -1
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +0 -36
- package/lib/stdlib/behavior/track-canvas-3d.js +0 -66
- package/lib/stdlib/behavior/track-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/types.d.ts +0 -13
- package/lib/stdlib/behavior/types.js.map +0 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +0 -58
- package/lib/stdlib/behavior/zoom-canvas-3d.js +0 -105
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +0 -86
- package/lib/stdlib/behavior/zoom-canvas.js +0 -319
- package/lib/stdlib/behavior/zoom-canvas.js.map +0 -1
- package/lib/stdlib/data/index.d.ts +0 -4
- package/lib/stdlib/data/index.js +0 -21
- package/lib/stdlib/data/index.js.map +0 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +0 -11
- package/lib/stdlib/data/mapNodeSize.js +0 -57
- package/lib/stdlib/data/mapNodeSize.js.map +0 -1
- package/lib/stdlib/data/processParallelEdges.d.ts +0 -21
- package/lib/stdlib/data/processParallelEdges.js +0 -131
- package/lib/stdlib/data/processParallelEdges.js.map +0 -1
- package/lib/stdlib/data/transformV4Data.d.ts +0 -8
- package/lib/stdlib/data/transformV4Data.js +0 -160
- package/lib/stdlib/data/transformV4Data.js.map +0 -1
- package/lib/stdlib/data/validateData.d.ts +0 -8
- package/lib/stdlib/data/validateData.js +0 -116
- package/lib/stdlib/data/validateData.js.map +0 -1
- package/lib/stdlib/index.d.ts +0 -172
- package/lib/stdlib/index.js +0 -253
- package/lib/stdlib/index.js.map +0 -1
- package/lib/stdlib/item/combo/circle.d.ts +0 -29
- package/lib/stdlib/item/combo/circle.js +0 -65
- package/lib/stdlib/item/combo/circle.js.map +0 -1
- package/lib/stdlib/item/combo/index.d.ts +0 -2
- package/lib/stdlib/item/combo/index.js +0 -19
- package/lib/stdlib/item/combo/index.js.map +0 -1
- package/lib/stdlib/item/combo/rect.d.ts +0 -31
- package/lib/stdlib/item/combo/rect.js +0 -74
- package/lib/stdlib/item/combo/rect.js.map +0 -1
- package/lib/stdlib/item/edge/base.d.ts +0 -216
- package/lib/stdlib/item/edge/base.js +0 -388
- package/lib/stdlib/item/edge/base.js.map +0 -1
- package/lib/stdlib/item/edge/cubic-horizontal.d.ts +0 -36
- package/lib/stdlib/item/edge/cubic-horizontal.js +0 -60
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +0 -1
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +0 -36
- package/lib/stdlib/item/edge/cubic-vertical.js +0 -60
- package/lib/stdlib/item/edge/cubic-vertical.js.map +0 -1
- package/lib/stdlib/item/edge/cubic.d.ts +0 -59
- package/lib/stdlib/item/edge/cubic.js +0 -125
- package/lib/stdlib/item/edge/cubic.js.map +0 -1
- package/lib/stdlib/item/edge/index.d.ts +0 -7
- package/lib/stdlib/item/edge/index.js +0 -24
- package/lib/stdlib/item/edge/index.js.map +0 -1
- package/lib/stdlib/item/edge/line.d.ts +0 -33
- package/lib/stdlib/item/edge/line.js +0 -72
- package/lib/stdlib/item/edge/line.js.map +0 -1
- package/lib/stdlib/item/edge/loop.d.ts +0 -32
- package/lib/stdlib/item/edge/loop.js +0 -124
- package/lib/stdlib/item/edge/loop.js.map +0 -1
- package/lib/stdlib/item/edge/polyline.d.ts +0 -45
- package/lib/stdlib/item/edge/polyline.js +0 -101
- package/lib/stdlib/item/edge/polyline.js.map +0 -1
- package/lib/stdlib/item/edge/quadratic.d.ts +0 -40
- package/lib/stdlib/item/edge/quadratic.js +0 -87
- package/lib/stdlib/item/edge/quadratic.js.map +0 -1
- package/lib/stdlib/item/node/base.d.ts +0 -246
- package/lib/stdlib/item/node/base.js +0 -479
- package/lib/stdlib/item/node/base.js.map +0 -1
- package/lib/stdlib/item/node/base3d.d.ts +0 -106
- package/lib/stdlib/item/node/base3d.js +0 -145
- package/lib/stdlib/item/node/base3d.js.map +0 -1
- package/lib/stdlib/item/node/circle.d.ts +0 -30
- package/lib/stdlib/item/node/circle.js +0 -66
- package/lib/stdlib/item/node/circle.js.map +0 -1
- package/lib/stdlib/item/node/cube.d.ts +0 -33
- package/lib/stdlib/item/node/cube.js +0 -61
- package/lib/stdlib/item/node/cube.js.map +0 -1
- package/lib/stdlib/item/node/diamond.d.ts +0 -32
- package/lib/stdlib/item/node/diamond.js +0 -92
- package/lib/stdlib/item/node/diamond.js.map +0 -1
- package/lib/stdlib/item/node/donut.d.ts +0 -70
- package/lib/stdlib/item/node/donut.js +0 -221
- package/lib/stdlib/item/node/donut.js.map +0 -1
- package/lib/stdlib/item/node/ellipse.d.ts +0 -32
- package/lib/stdlib/item/node/ellipse.js +0 -80
- package/lib/stdlib/item/node/ellipse.js.map +0 -1
- package/lib/stdlib/item/node/hexagon.d.ts +0 -33
- package/lib/stdlib/item/node/hexagon.js +0 -118
- package/lib/stdlib/item/node/hexagon.js.map +0 -1
- package/lib/stdlib/item/node/image.d.ts +0 -40
- package/lib/stdlib/item/node/image.js +0 -124
- package/lib/stdlib/item/node/image.js.map +0 -1
- package/lib/stdlib/item/node/index.d.ts +0 -15
- package/lib/stdlib/item/node/index.js +0 -32
- package/lib/stdlib/item/node/index.js.map +0 -1
- package/lib/stdlib/item/node/modelRect.d.ts +0 -93
- package/lib/stdlib/item/node/modelRect.js +0 -247
- package/lib/stdlib/item/node/modelRect.js.map +0 -1
- package/lib/stdlib/item/node/plane.d.ts +0 -38
- package/lib/stdlib/item/node/plane.js +0 -66
- package/lib/stdlib/item/node/plane.js.map +0 -1
- package/lib/stdlib/item/node/rect.d.ts +0 -32
- package/lib/stdlib/item/node/rect.js +0 -84
- package/lib/stdlib/item/node/rect.js.map +0 -1
- package/lib/stdlib/item/node/sphere.d.ts +0 -33
- package/lib/stdlib/item/node/sphere.js +0 -61
- package/lib/stdlib/item/node/sphere.js.map +0 -1
- package/lib/stdlib/item/node/star.d.ts +0 -32
- package/lib/stdlib/item/node/star.js +0 -125
- package/lib/stdlib/item/node/star.js.map +0 -1
- package/lib/stdlib/item/node/triangle.d.ts +0 -44
- package/lib/stdlib/item/node/triangle.js +0 -191
- package/lib/stdlib/item/node/triangle.js.map +0 -1
- package/lib/stdlib/plugin/edgeBundling/index.d.ts +0 -75
- package/lib/stdlib/plugin/edgeBundling/index.js +0 -368
- package/lib/stdlib/plugin/edgeBundling/index.js.map +0 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +0 -66
- package/lib/stdlib/plugin/edgeFilterLens/index.js +0 -313
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +0 -1
- package/lib/stdlib/plugin/fisheye/index.d.ts +0 -130
- package/lib/stdlib/plugin/fisheye/index.js +0 -493
- package/lib/stdlib/plugin/fisheye/index.js.map +0 -1
- package/lib/stdlib/plugin/grid/index.d.ts +0 -36
- package/lib/stdlib/plugin/grid/index.js +0 -84
- package/lib/stdlib/plugin/grid/index.js.map +0 -1
- package/lib/stdlib/plugin/history/combo-command.d.ts +0 -9
- package/lib/stdlib/plugin/history/combo-command.js +0 -25
- package/lib/stdlib/plugin/history/combo-command.js.map +0 -1
- package/lib/stdlib/plugin/history/command.d.ts +0 -18
- package/lib/stdlib/plugin/history/command.js +0 -54
- package/lib/stdlib/plugin/history/command.js.map +0 -1
- package/lib/stdlib/plugin/history/index.d.ts +0 -112
- package/lib/stdlib/plugin/history/index.js +0 -283
- package/lib/stdlib/plugin/history/index.js.map +0 -1
- package/lib/stdlib/plugin/history/item-data-command.d.ts +0 -14
- package/lib/stdlib/plugin/history/item-data-command.js +0 -76
- package/lib/stdlib/plugin/history/item-data-command.js.map +0 -1
- package/lib/stdlib/plugin/history/layer-updated-command.d.ts +0 -9
- package/lib/stdlib/plugin/history/layer-updated-command.js +0 -25
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +0 -1
- package/lib/stdlib/plugin/history/state-updated-command.d.ts +0 -9
- package/lib/stdlib/plugin/history/state-updated-command.js +0 -24
- package/lib/stdlib/plugin/history/state-updated-command.js.map +0 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +0 -10
- package/lib/stdlib/plugin/history/visibility-updated-command.js +0 -27
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +0 -1
- package/lib/stdlib/plugin/hull/bubbleset.d.ts +0 -9
- package/lib/stdlib/plugin/hull/bubbleset.js +0 -596
- package/lib/stdlib/plugin/hull/bubbleset.js.map +0 -1
- package/lib/stdlib/plugin/hull/convexHull.d.ts +0 -14
- package/lib/stdlib/plugin/hull/convexHull.js +0 -61
- package/lib/stdlib/plugin/hull/convexHull.js.map +0 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +0 -87
- package/lib/stdlib/plugin/hull/hullComponent.js +0 -381
- package/lib/stdlib/plugin/hull/hullComponent.js.map +0 -1
- package/lib/stdlib/plugin/hull/index.d.ts +0 -59
- package/lib/stdlib/plugin/hull/index.js +0 -167
- package/lib/stdlib/plugin/hull/index.js.map +0 -1
- package/lib/stdlib/plugin/hull/types.d.ts +0 -15
- package/lib/stdlib/plugin/hull/types.js.map +0 -1
- package/lib/stdlib/plugin/hull/util.d.ts +0 -77
- package/lib/stdlib/plugin/hull/util.js +0 -423
- package/lib/stdlib/plugin/hull/util.js.map +0 -1
- package/lib/stdlib/plugin/index.d.ts +0 -13
- package/lib/stdlib/plugin/index.js +0 -30
- package/lib/stdlib/plugin/index.js.map +0 -1
- package/lib/stdlib/plugin/legend/index.d.ts +0 -164
- package/lib/stdlib/plugin/legend/index.js +0 -600
- package/lib/stdlib/plugin/legend/index.js.map +0 -1
- package/lib/stdlib/plugin/lodController/index.d.ts +0 -73
- package/lib/stdlib/plugin/lodController/index.js +0 -562
- package/lib/stdlib/plugin/lodController/index.js.map +0 -1
- package/lib/stdlib/plugin/menu/index.d.ts +0 -55
- package/lib/stdlib/plugin/menu/index.js +0 -245
- package/lib/stdlib/plugin/menu/index.js.map +0 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +0 -118
- package/lib/stdlib/plugin/minimap/index.js +0 -685
- package/lib/stdlib/plugin/minimap/index.js.map +0 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +0 -167
- package/lib/stdlib/plugin/snapline/index.js +0 -1067
- package/lib/stdlib/plugin/snapline/index.js.map +0 -1
- package/lib/stdlib/plugin/timebar/index.d.ts +0 -98
- package/lib/stdlib/plugin/timebar/index.js +0 -307
- package/lib/stdlib/plugin/timebar/index.js.map +0 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +0 -59
- package/lib/stdlib/plugin/toolbar/index.js +0 -220
- package/lib/stdlib/plugin/toolbar/index.js.map +0 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +0 -96
- package/lib/stdlib/plugin/tooltip/index.js +0 -384
- package/lib/stdlib/plugin/tooltip/index.js.map +0 -1
- package/lib/stdlib/plugin/types.d.ts +0 -11
- package/lib/stdlib/plugin/types.js.map +0 -1
- package/lib/stdlib/plugin/watermarker/index.d.ts +0 -78
- package/lib/stdlib/plugin/watermarker/index.js +0 -247
- package/lib/stdlib/plugin/watermarker/index.js.map +0 -1
- package/lib/stdlib/selector/lasso.d.ts +0 -15
- package/lib/stdlib/selector/lasso.js +0 -63
- package/lib/stdlib/selector/lasso.js.map +0 -1
- package/lib/stdlib/selector/rect.d.ts +0 -16
- package/lib/stdlib/selector/rect.js +0 -56
- package/lib/stdlib/selector/rect.js.map +0 -1
- package/lib/stdlib/theme/dark.d.ts +0 -2
- package/lib/stdlib/theme/dark.js +0 -332
- package/lib/stdlib/theme/dark.js.map +0 -1
- package/lib/stdlib/theme/index.d.ts +0 -2
- package/lib/stdlib/theme/index.js +0 -19
- package/lib/stdlib/theme/index.js.map +0 -1
- package/lib/stdlib/theme/light.d.ts +0 -2
- package/lib/stdlib/theme/light.js +0 -333
- package/lib/stdlib/theme/light.js.map +0 -1
- package/lib/stdlib/themeSolver/base.d.ts +0 -15
- package/lib/stdlib/themeSolver/base.js +0 -15
- package/lib/stdlib/themeSolver/base.js.map +0 -1
- package/lib/stdlib/themeSolver/index.d.ts +0 -3
- package/lib/stdlib/themeSolver/index.js +0 -20
- package/lib/stdlib/themeSolver/index.js.map +0 -1
- package/lib/stdlib/themeSolver/spec.d.ts +0 -35
- package/lib/stdlib/themeSolver/spec.js +0 -85
- package/lib/stdlib/themeSolver/spec.js.map +0 -1
- package/lib/stdlib/themeSolver/subject.d.ts +0 -41
- package/lib/stdlib/themeSolver/subject.js +0 -404
- package/lib/stdlib/themeSolver/subject.js.map +0 -1
- package/lib/types/animate.d.ts +0 -59
- package/lib/types/animate.js +0 -3
- package/lib/types/animate.js.map +0 -1
- package/lib/types/combo.d.ts +0 -135
- package/lib/types/combo.js.map +0 -1
- package/lib/types/common.d.ts +0 -17
- package/lib/types/common.js +0 -3
- package/lib/types/common.js.map +0 -1
- package/lib/types/graph.d.ts +0 -688
- package/lib/types/graph.js +0 -3
- package/lib/types/graph.js.map +0 -1
- package/lib/types/history.d.ts +0 -28
- package/lib/types/history.js +0 -9
- package/lib/types/history.js.map +0 -1
- package/lib/types/hook.d.ts +0 -159
- package/lib/types/hook.js +0 -3
- package/lib/types/hook.js.map +0 -1
- package/lib/types/item.d.ts +0 -233
- package/lib/types/item.js +0 -19
- package/lib/types/item.js.map +0 -1
- package/lib/types/layout.d.ts +0 -77
- package/lib/types/layout.js +0 -25
- package/lib/types/layout.js.map +0 -1
- package/lib/types/loop.d.ts +0 -21
- package/lib/types/loop.js +0 -15
- package/lib/types/loop.js.map +0 -1
- package/lib/types/plugin.d.ts +0 -45
- package/lib/types/plugin.js +0 -58
- package/lib/types/plugin.js.map +0 -1
- package/lib/types/render.d.ts +0 -1
- package/lib/types/render.js +0 -3
- package/lib/types/render.js.map +0 -1
- package/lib/types/spec.d.ts +0 -100
- package/lib/types/spec.js.map +0 -1
- package/lib/types/stdlib.d.ts +0 -13
- package/lib/types/stdlib.js +0 -3
- package/lib/types/stdlib.js.map +0 -1
- package/lib/types/theme.d.ts +0 -168
- package/lib/types/theme.js +0 -18
- package/lib/types/theme.js.map +0 -1
- package/lib/types/view.d.ts +0 -33
- package/lib/types/view.js +0 -3
- package/lib/types/view.js.map +0 -1
- package/lib/util/animate.d.ts +0 -111
- package/lib/util/animate.js +0 -445
- package/lib/util/animate.js.map +0 -1
- package/lib/util/array.d.ts +0 -29
- package/lib/util/array.js +0 -83
- package/lib/util/array.js.map +0 -1
- package/lib/util/arrow.d.ts +0 -17
- package/lib/util/arrow.js +0 -60
- package/lib/util/arrow.js.map +0 -1
- package/lib/util/bbox.d.ts +0 -127
- package/lib/util/bbox.js +0 -320
- package/lib/util/bbox.js.map +0 -1
- package/lib/util/behavior.d.ts +0 -2
- package/lib/util/behavior.js +0 -16
- package/lib/util/behavior.js.map +0 -1
- package/lib/util/canvas.d.ts +0 -19
- package/lib/util/canvas.js +0 -77
- package/lib/util/canvas.js.map +0 -1
- package/lib/util/data.d.ts +0 -112
- package/lib/util/data.js +0 -327
- package/lib/util/data.js.map +0 -1
- package/lib/util/dom.d.ts +0 -15
- package/lib/util/dom.js +0 -34
- package/lib/util/dom.js.map +0 -1
- package/lib/util/event.d.ts +0 -42
- package/lib/util/event.js +0 -109
- package/lib/util/event.js.map +0 -1
- package/lib/util/extend.d.ts +0 -27
- package/lib/util/extend.js +0 -25
- package/lib/util/extend.js.map +0 -1
- package/lib/util/extension.d.ts +0 -10
- package/lib/util/extension.js +0 -29
- package/lib/util/extension.js.map +0 -1
- package/lib/util/index.d.ts +0 -7
- package/lib/util/index.js +0 -26
- package/lib/util/index.js.map +0 -1
- package/lib/util/item.d.ts +0 -30
- package/lib/util/item.js +0 -96
- package/lib/util/item.js.map +0 -1
- package/lib/util/layout.d.ts +0 -51
- package/lib/util/layout.js +0 -218
- package/lib/util/layout.js.map +0 -1
- package/lib/util/loop.d.ts +0 -38
- package/lib/util/loop.js +0 -125
- package/lib/util/loop.js.map +0 -1
- package/lib/util/mapper.d.ts +0 -17
- package/lib/util/mapper.js +0 -58
- package/lib/util/mapper.js.map +0 -1
- package/lib/util/math.d.ts +0 -23
- package/lib/util/math.js +0 -29
- package/lib/util/math.js.map +0 -1
- package/lib/util/matrix.d.ts +0 -6
- package/lib/util/matrix.js +0 -52
- package/lib/util/matrix.js.map +0 -1
- package/lib/util/mock.d.ts +0 -30
- package/lib/util/mock.js +0 -73
- package/lib/util/mock.js.map +0 -1
- package/lib/util/path.d.ts +0 -16
- package/lib/util/path.js +0 -120
- package/lib/util/path.js.map +0 -1
- package/lib/util/point.d.ts +0 -83
- package/lib/util/point.js +0 -204
- package/lib/util/point.js.map +0 -1
- package/lib/util/polyline.d.ts +0 -124
- package/lib/util/polyline.js +0 -532
- package/lib/util/polyline.js.map +0 -1
- package/lib/util/router.d.ts +0 -32
- package/lib/util/router.js +0 -388
- package/lib/util/router.js.map +0 -1
- package/lib/util/shape.d.ts +0 -154
- package/lib/util/shape.js +0 -660
- package/lib/util/shape.js.map +0 -1
- package/lib/util/shape3d.d.ts +0 -23
- package/lib/util/shape3d.js +0 -155
- package/lib/util/shape3d.js.map +0 -1
- package/lib/util/text.d.ts +0 -18
- package/lib/util/text.js +0 -42
- package/lib/util/text.js.map +0 -1
- package/lib/util/type.d.ts +0 -8
- package/lib/util/type.js +0 -13
- package/lib/util/type.js.map +0 -1
- package/lib/util/warn.d.ts +0 -14
- package/lib/util/warn.js +0 -8
- package/lib/util/warn.js.map +0 -1
- package/lib/util/zoom.d.ts +0 -14
- package/lib/util/zoom.js +0 -40
- package/lib/util/zoom.js.map +0 -1
- package/src/api-doc/behaviors.ts +0 -2
- package/src/api-doc/graph.ts +0 -5
- package/src/api-doc/item.ts +0 -45
- package/src/api-doc/layout.ts +0 -13
- package/src/api-doc/plugins.ts +0 -1
- package/src/api-doc/types.ts +0 -3
- package/src/api-doc/util.ts +0 -3
- package/src/constant/index.ts +0 -1
- package/src/constant/shape.ts +0 -37
- package/src/item/combo.ts +0 -321
- package/src/item/edge.ts +0 -422
- package/src/item/item.ts +0 -1022
- package/src/item/node.ts +0 -442
- package/src/runtime/controller/data.ts +0 -993
- package/src/runtime/controller/index.ts +0 -7
- package/src/runtime/controller/interaction.ts +0 -374
- package/src/runtime/controller/item.ts +0 -2024
- package/src/runtime/controller/layout.ts +0 -589
- package/src/runtime/controller/plugin.ts +0 -284
- package/src/runtime/controller/theme.ts +0 -73
- package/src/runtime/controller/viewport.ts +0 -161
- package/src/runtime/hooks.ts +0 -64
- package/src/stdlib/behavior/activate-relations.ts +0 -142
- package/src/stdlib/behavior/brush-select.ts +0 -386
- package/src/stdlib/behavior/click-select.ts +0 -223
- package/src/stdlib/behavior/collapse-expand-combo.ts +0 -57
- package/src/stdlib/behavior/collapse-expand-tree.ts +0 -106
- package/src/stdlib/behavior/create-edge.ts +0 -305
- package/src/stdlib/behavior/drag-canvas.ts +0 -410
- package/src/stdlib/behavior/drag-combo.ts +0 -589
- package/src/stdlib/behavior/drag-node.ts +0 -800
- package/src/stdlib/behavior/hover-activate.ts +0 -102
- package/src/stdlib/behavior/index.ts +0 -18
- package/src/stdlib/behavior/lasso-select.ts +0 -100
- package/src/stdlib/behavior/orbit-canvas-3d.ts +0 -102
- package/src/stdlib/behavior/rotate-canvas-3d.ts +0 -170
- package/src/stdlib/behavior/scroll-canvas.ts +0 -348
- package/src/stdlib/behavior/shortcuts-call.ts +0 -129
- package/src/stdlib/behavior/track-canvas-3d.ts +0 -102
- package/src/stdlib/behavior/types.ts +0 -15
- package/src/stdlib/behavior/zoom-canvas-3d.ts +0 -171
- package/src/stdlib/behavior/zoom-canvas.ts +0 -451
- package/src/stdlib/data/index.ts +0 -4
- package/src/stdlib/data/mapNodeSize.ts +0 -86
- package/src/stdlib/data/processParallelEdges.ts +0 -203
- package/src/stdlib/data/transformV4Data.ts +0 -244
- package/src/stdlib/data/validateData.ts +0 -165
- package/src/stdlib/index.ts +0 -313
- package/src/stdlib/item/combo/circle.ts +0 -128
- package/src/stdlib/item/combo/index.ts +0 -2
- package/src/stdlib/item/combo/rect.ts +0 -138
- package/src/stdlib/item/edge/base.ts +0 -619
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -85
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -84
- package/src/stdlib/item/edge/cubic.ts +0 -220
- package/src/stdlib/item/edge/index.ts +0 -7
- package/src/stdlib/item/edge/line.ts +0 -125
- package/src/stdlib/item/edge/loop.ts +0 -167
- package/src/stdlib/item/edge/polyline.ts +0 -185
- package/src/stdlib/item/edge/quadratic.ts +0 -155
- package/src/stdlib/item/node/base.ts +0 -805
- package/src/stdlib/item/node/base3d.ts +0 -227
- package/src/stdlib/item/node/circle.ts +0 -134
- package/src/stdlib/item/node/cube.ts +0 -116
- package/src/stdlib/item/node/diamond.ts +0 -168
- package/src/stdlib/item/node/donut.ts +0 -382
- package/src/stdlib/item/node/ellipse.ts +0 -142
- package/src/stdlib/item/node/hexagon.ts +0 -196
- package/src/stdlib/item/node/image.ts +0 -198
- package/src/stdlib/item/node/index.ts +0 -15
- package/src/stdlib/item/node/modelRect.ts +0 -499
- package/src/stdlib/item/node/plane.ts +0 -121
- package/src/stdlib/item/node/rect.ts +0 -161
- package/src/stdlib/item/node/sphere.ts +0 -115
- package/src/stdlib/item/node/star.ts +0 -202
- package/src/stdlib/item/node/triangle.ts +0 -288
- package/src/stdlib/plugin/edgeBundling/index.ts +0 -529
- package/src/stdlib/plugin/edgeFilterLens/index.ts +0 -387
- package/src/stdlib/plugin/fisheye/index.ts +0 -608
- package/src/stdlib/plugin/grid/index.ts +0 -125
- package/src/stdlib/plugin/history/combo-command.ts +0 -28
- package/src/stdlib/plugin/history/command.ts +0 -81
- package/src/stdlib/plugin/history/index.ts +0 -347
- package/src/stdlib/plugin/history/item-data-command.ts +0 -114
- package/src/stdlib/plugin/history/layer-updated-command.ts +0 -28
- package/src/stdlib/plugin/history/state-updated-command.ts +0 -36
- package/src/stdlib/plugin/history/visibility-updated-command.ts +0 -41
- package/src/stdlib/plugin/hull/bubbleset.ts +0 -828
- package/src/stdlib/plugin/hull/convexHull.ts +0 -68
- package/src/stdlib/plugin/hull/hullComponent.ts +0 -503
- package/src/stdlib/plugin/hull/index.ts +0 -234
- package/src/stdlib/plugin/hull/types.ts +0 -15
- package/src/stdlib/plugin/hull/util.ts +0 -515
- package/src/stdlib/plugin/index.ts +0 -13
- package/src/stdlib/plugin/legend/index.ts +0 -796
- package/src/stdlib/plugin/lodController/index.ts +0 -603
- package/src/stdlib/plugin/menu/index.ts +0 -275
- package/src/stdlib/plugin/minimap/index.ts +0 -806
- package/src/stdlib/plugin/snapline/index.ts +0 -1297
- package/src/stdlib/plugin/timebar/index.ts +0 -473
- package/src/stdlib/plugin/toolbar/index.ts +0 -255
- package/src/stdlib/plugin/tooltip/index.ts +0 -444
- package/src/stdlib/plugin/types.ts +0 -11
- package/src/stdlib/plugin/watermarker/index.ts +0 -302
- package/src/stdlib/selector/lasso.ts +0 -75
- package/src/stdlib/selector/rect.ts +0 -78
- package/src/stdlib/theme/dark.ts +0 -415
- package/src/stdlib/theme/index.ts +0 -2
- package/src/stdlib/theme/light.ts +0 -413
- package/src/stdlib/themeSolver/base.ts +0 -22
- package/src/stdlib/themeSolver/index.ts +0 -3
- package/src/stdlib/themeSolver/spec.ts +0 -123
- package/src/stdlib/themeSolver/subject.ts +0 -499
- package/src/types/animate.ts +0 -71
- package/src/types/combo.ts +0 -177
- package/src/types/common.ts +0 -21
- package/src/types/graph.ts +0 -906
- package/src/types/history.ts +0 -30
- package/src/types/hook.ts +0 -182
- package/src/types/item.ts +0 -342
- package/src/types/layout.ts +0 -147
- package/src/types/loop.ts +0 -23
- package/src/types/plugin.ts +0 -85
- package/src/types/render.ts +0 -1
- package/src/types/spec.ts +0 -154
- package/src/types/stdlib.ts +0 -25
- package/src/types/theme.ts +0 -171
- package/src/types/view.ts +0 -41
- package/src/util/animate.ts +0 -543
- package/src/util/array.ts +0 -80
- package/src/util/arrow.ts +0 -62
- package/src/util/bbox.ts +0 -359
- package/src/util/behavior.ts +0 -14
- package/src/util/canvas.ts +0 -95
- package/src/util/data.ts +0 -362
- package/src/util/dom.ts +0 -33
- package/src/util/event.ts +0 -160
- package/src/util/extend.ts +0 -47
- package/src/util/extension.ts +0 -29
- package/src/util/index.ts +0 -17
- package/src/util/item.ts +0 -187
- package/src/util/layout.ts +0 -211
- package/src/util/loop.ts +0 -160
- package/src/util/mapper.ts +0 -62
- package/src/util/math.ts +0 -33
- package/src/util/matrix.ts +0 -66
- package/src/util/mock.ts +0 -72
- package/src/util/path.ts +0 -122
- package/src/util/point.ts +0 -231
- package/src/util/polyline.ts +0 -684
- package/src/util/router.ts +0 -563
- package/src/util/shape.ts +0 -825
- package/src/util/shape3d.ts +0 -209
- package/src/util/text.ts +0 -51
- package/src/util/type.ts +0 -11
- package/src/util/warn.ts +0 -20
- package/src/util/zoom.ts +0 -37
- /package/{esm/api-doc/types.d.ts → dist/lib/__tests__/integration/animation.spec.d.ts} +0 -0
- /package/{lib/api-doc/types.d.ts → dist/lib/__tests__/integration/static.spec.d.ts} +0 -0
- /package/esm/{api-doc → animations}/types.js +0 -0
- /package/esm/{stdlib/behavior → behaviors}/types.js +0 -0
- /package/esm/{stdlib/plugin/hull → layouts}/types.js +0 -0
- /package/esm/{stdlib/plugin → palettes}/types.js +0 -0
- /package/esm/{types → spec/element}/combo.js +0 -0
- /package/esm/{api-doc → spec}/layout.js +0 -0
- /package/esm/{types → spec}/spec.js +0 -0
- /package/lib/{api-doc → animations}/types.js +0 -0
- /package/lib/{stdlib/behavior → behaviors}/types.js +0 -0
- /package/lib/{stdlib/plugin/hull → layouts}/types.js +0 -0
- /package/lib/{stdlib/plugin → palettes}/types.js +0 -0
- /package/lib/{types → spec/element}/combo.js +0 -0
- /package/lib/{api-doc → spec}/layout.js +0 -0
- /package/lib/{types → spec}/spec.js +0 -0
package/src/runtime/graph.ts
CHANGED
|
@@ -1,3053 +1,966 @@
|
|
|
1
1
|
import EventEmitter from '@antv/event-emitter';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
DisplayObject,
|
|
8
|
-
PointLike,
|
|
9
|
-
Rect,
|
|
10
|
-
} from '@antv/g';
|
|
11
|
-
import { GraphChange, ID } from '@antv/graphlib';
|
|
12
|
-
import {
|
|
13
|
-
clone,
|
|
14
|
-
groupBy,
|
|
15
|
-
isArray,
|
|
16
|
-
isEmpty,
|
|
17
|
-
isEqual,
|
|
18
|
-
isNil,
|
|
19
|
-
isNumber,
|
|
20
|
-
isObject,
|
|
21
|
-
isString,
|
|
22
|
-
map,
|
|
23
|
-
} from '@antv/util';
|
|
24
|
-
import { History } from '../stdlib/plugin/history';
|
|
25
|
-
import { Command } from '../stdlib/plugin/history/command';
|
|
2
|
+
import type { AABB, BaseStyleProps, DataURLOptions } from '@antv/g';
|
|
3
|
+
import type { ID } from '@antv/graphlib';
|
|
4
|
+
import { debounce, isEqual, isFunction, isNumber, isObject, isString, omit } from '@antv/util';
|
|
5
|
+
import { COMBO_KEY, GraphEvent } from '../constants';
|
|
6
|
+
import { getExtension } from '../registry';
|
|
26
7
|
import type {
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
BehaviorOptions,
|
|
9
|
+
ComboData,
|
|
10
|
+
ComboOptions,
|
|
11
|
+
EdgeData,
|
|
12
|
+
EdgeOptions,
|
|
13
|
+
G6Spec,
|
|
29
14
|
GraphData,
|
|
30
|
-
IGraph,
|
|
31
|
-
NodeUserModel,
|
|
32
|
-
Specification,
|
|
33
|
-
} from '../types';
|
|
34
|
-
import type { CameraAnimationOptions } from '../types/animate';
|
|
35
|
-
import type { BehaviorOptionsOf, BehaviorRegistry } from '../types/behavior';
|
|
36
|
-
import type {
|
|
37
|
-
ComboDisplayModel,
|
|
38
|
-
ComboModel,
|
|
39
|
-
ComboShapesEncode,
|
|
40
|
-
} from '../types/combo';
|
|
41
|
-
import type { Bounds, Padding, Point } from '../types/common';
|
|
42
|
-
import type { DataChangeType, DataConfig, GraphCore } from '../types/data';
|
|
43
|
-
import type {
|
|
44
|
-
EdgeDisplayModel,
|
|
45
|
-
EdgeModel,
|
|
46
|
-
EdgeModelData,
|
|
47
|
-
EdgeShapesEncode,
|
|
48
|
-
} from '../types/edge';
|
|
49
|
-
import type { StackType } from '../types/history';
|
|
50
|
-
import type { Hooks, ViewportChangeHookParams } from '../types/hook';
|
|
51
|
-
import type { ITEM_TYPE, SHAPE_TYPE, ShapeStyle } from '../types/item';
|
|
52
|
-
import type {
|
|
53
|
-
ImmediatelyInvokedLayoutOptions,
|
|
54
15
|
LayoutOptions,
|
|
55
|
-
|
|
56
|
-
|
|
16
|
+
NodeData,
|
|
17
|
+
NodeOptions,
|
|
18
|
+
PluginOptions,
|
|
19
|
+
ThemeOptions,
|
|
20
|
+
} from '../spec';
|
|
57
21
|
import type {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
} from './
|
|
88
|
-
import
|
|
89
|
-
|
|
90
|
-
export class Graph
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// the tag to indicate whether the graph instance is destroyed
|
|
102
|
-
public destroyed: boolean = false;
|
|
103
|
-
// the renderer type of current graph
|
|
104
|
-
public rendererType: RendererName;
|
|
105
|
-
// for transient shapes for interactions, e.g. transient node and related edges while draging, delegates
|
|
106
|
-
public transientCanvas: Canvas;
|
|
107
|
-
// for transient items' label shapes
|
|
108
|
-
public transientLabelCanvas: Canvas;
|
|
109
|
-
// for background shapes, e.g. grid, pipe indices
|
|
110
|
-
public backgroundCanvas: Canvas;
|
|
111
|
-
// the tag indicates all the three canvases are all ready
|
|
112
|
-
private canvasReady: boolean;
|
|
113
|
-
private specification: Specification<B, T>;
|
|
114
|
-
|
|
115
|
-
private dataController: DataController;
|
|
116
|
-
private interactionController: InteractionController;
|
|
117
|
-
private layoutController: LayoutController;
|
|
118
|
-
private viewportController: ViewportController;
|
|
119
|
-
private itemController: ItemController;
|
|
120
|
-
private themeController: ThemeController;
|
|
121
|
-
private pluginController: PluginController;
|
|
122
|
-
|
|
123
|
-
private defaultSpecification = {
|
|
124
|
-
theme: {
|
|
125
|
-
type: 'spec',
|
|
126
|
-
base: 'light',
|
|
127
|
-
},
|
|
128
|
-
enableStack: true,
|
|
22
|
+
CallableValue,
|
|
23
|
+
DataID,
|
|
24
|
+
EdgeDirection,
|
|
25
|
+
ElementDatum,
|
|
26
|
+
ElementType,
|
|
27
|
+
FitViewOptions,
|
|
28
|
+
NodeLikeData,
|
|
29
|
+
PartialEdgeData,
|
|
30
|
+
PartialGraphData,
|
|
31
|
+
PartialNodeLikeData,
|
|
32
|
+
Point,
|
|
33
|
+
Position,
|
|
34
|
+
State,
|
|
35
|
+
Vector2,
|
|
36
|
+
ViewportAnimationEffectTiming,
|
|
37
|
+
} from '../types';
|
|
38
|
+
import { sizeOf } from '../utils/dom';
|
|
39
|
+
import { ElementStateChangeEvent, GraphLifeCycleEvent, emit } from '../utils/event';
|
|
40
|
+
import { idOf } from '../utils/id';
|
|
41
|
+
import { parsePoint, toPointObject } from '../utils/point';
|
|
42
|
+
import { zIndexOf } from '../utils/style';
|
|
43
|
+
import { subtract } from '../utils/vector';
|
|
44
|
+
import { BehaviorController } from './behavior';
|
|
45
|
+
import { Canvas } from './canvas';
|
|
46
|
+
import type { HierarchyKey } from './data';
|
|
47
|
+
import { DataController } from './data';
|
|
48
|
+
import { ElementController } from './element';
|
|
49
|
+
import { LayoutController } from './layout';
|
|
50
|
+
import { PluginController } from './plugin';
|
|
51
|
+
import { RuntimeContext } from './types';
|
|
52
|
+
import { ViewportController } from './viewport';
|
|
53
|
+
|
|
54
|
+
export class Graph extends EventEmitter {
|
|
55
|
+
private options: G6Spec;
|
|
56
|
+
|
|
57
|
+
static defaultOptions: G6Spec = {
|
|
58
|
+
autoResize: false,
|
|
59
|
+
width: 800,
|
|
60
|
+
height: 600,
|
|
61
|
+
theme: 'light',
|
|
62
|
+
rotation: 0,
|
|
63
|
+
zoom: 1,
|
|
64
|
+
zoomRange: [0.01, 10],
|
|
129
65
|
};
|
|
130
66
|
|
|
131
|
-
|
|
132
|
-
super();
|
|
67
|
+
public destroyed = false;
|
|
133
68
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
);
|
|
139
|
-
this.initHooks();
|
|
140
|
-
this.initCanvas();
|
|
141
|
-
this.initControllers();
|
|
142
|
-
this.initHistory();
|
|
143
|
-
|
|
144
|
-
this.hooks.init.emit({
|
|
145
|
-
canvases: {
|
|
146
|
-
background: this.backgroundCanvas,
|
|
147
|
-
main: this.canvas,
|
|
148
|
-
label: this.labelCanvas,
|
|
149
|
-
transient: this.transientCanvas,
|
|
150
|
-
transientLabel: this.transientLabelCanvas,
|
|
151
|
-
},
|
|
152
|
-
});
|
|
69
|
+
// @ts-expect-error will be initialized in createRuntime
|
|
70
|
+
private context: RuntimeContext = {
|
|
71
|
+
model: new DataController(),
|
|
72
|
+
};
|
|
153
73
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
74
|
+
constructor(options: G6Spec) {
|
|
75
|
+
super();
|
|
76
|
+
this.options = Object.assign({}, Graph.defaultOptions, options);
|
|
77
|
+
this.setOptions(this.options);
|
|
78
|
+
this.context.graph = this;
|
|
79
|
+
|
|
80
|
+
// Listening window.resize to autoResize.
|
|
81
|
+
this.options.autoResize && window.addEventListener('resize', this.onResize);
|
|
159
82
|
}
|
|
160
83
|
|
|
161
84
|
/**
|
|
162
|
-
*
|
|
85
|
+
* <zh/> 获取配置项
|
|
86
|
+
*
|
|
87
|
+
* <en/> Get options
|
|
88
|
+
* @returns <zh/> 配置项 | <en/> options
|
|
163
89
|
*/
|
|
164
|
-
|
|
165
|
-
this.
|
|
166
|
-
|
|
167
|
-
this.layoutController = new LayoutController(this);
|
|
168
|
-
this.themeController = new ThemeController(this);
|
|
169
|
-
this.viewportController = new ViewportController(this);
|
|
170
|
-
this.itemController = new ItemController(this);
|
|
171
|
-
this.pluginController = new PluginController(this);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private initCanvas() {
|
|
175
|
-
const { renderer, container, width, height } = this.specification;
|
|
176
|
-
|
|
177
|
-
let pixelRatio: number;
|
|
178
|
-
if (renderer && !isString(renderer)) {
|
|
179
|
-
// @ts-ignore
|
|
180
|
-
this.rendererType = renderer.type || 'canvas';
|
|
181
|
-
// @ts-ignore
|
|
182
|
-
pixelRatio = renderer.pixelRatio;
|
|
183
|
-
} else {
|
|
184
|
-
// @ts-ignore
|
|
185
|
-
this.rendererType = renderer || 'canvas';
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (container) {
|
|
189
|
-
this.container = container as HTMLElement;
|
|
190
|
-
} else {
|
|
191
|
-
const containerDOM = isString(container)
|
|
192
|
-
? document.getElementById(container as string)
|
|
193
|
-
: (container as HTMLElement);
|
|
90
|
+
public getOptions(): G6Spec {
|
|
91
|
+
return this.options;
|
|
92
|
+
}
|
|
194
93
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
94
|
+
/**
|
|
95
|
+
* <zh/> 设置配置项
|
|
96
|
+
*
|
|
97
|
+
* <en/> Set options
|
|
98
|
+
* @param options - <zh/> 配置项 | <en/> options
|
|
99
|
+
* @description
|
|
100
|
+
* <zh/> 要更新 devicePixelRatio、container 属性请销毁后重新创建实例
|
|
101
|
+
*
|
|
102
|
+
* <en/> To update devicePixelRatio and container properties, please destroy and recreate the instance
|
|
103
|
+
*/
|
|
104
|
+
public setOptions(options: G6Spec): void {
|
|
105
|
+
const {
|
|
106
|
+
animation,
|
|
107
|
+
background,
|
|
108
|
+
behaviors,
|
|
109
|
+
combo,
|
|
110
|
+
container,
|
|
111
|
+
data,
|
|
112
|
+
edge,
|
|
113
|
+
height,
|
|
114
|
+
layout,
|
|
115
|
+
node,
|
|
116
|
+
padding,
|
|
117
|
+
theme,
|
|
118
|
+
plugins,
|
|
119
|
+
width,
|
|
120
|
+
zoomRange,
|
|
121
|
+
zoom,
|
|
122
|
+
} = options;
|
|
204
123
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
? 'canvas'
|
|
217
|
-
: this.rendererType,
|
|
218
|
-
this.container,
|
|
219
|
-
width ?? this.container.scrollWidth,
|
|
220
|
-
height ?? this.container.scrollHeight,
|
|
221
|
-
pixelRatio,
|
|
222
|
-
undefined,
|
|
223
|
-
// enable dom interaction only for main canvas
|
|
224
|
-
name === 'canvas' ? [] : ['dom-interaction'],
|
|
225
|
-
);
|
|
226
|
-
});
|
|
124
|
+
if (background) this.setBackground(background);
|
|
125
|
+
if (behaviors) this.setBehaviors(behaviors);
|
|
126
|
+
if (combo) this.setCombo(combo);
|
|
127
|
+
if (data) this.setData(data);
|
|
128
|
+
if (edge) this.setEdge(edge);
|
|
129
|
+
if (layout) this.setLayout(layout);
|
|
130
|
+
if (node) this.setNode(node);
|
|
131
|
+
if (theme) this.setTheme(theme);
|
|
132
|
+
if (plugins) this.setPlugins(plugins);
|
|
133
|
+
if (isNumber(width) || isNumber(height))
|
|
134
|
+
this.setSize(width ?? this.options.width ?? 0, height ?? this.options.height ?? 0);
|
|
227
135
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
this.labelCanvas,
|
|
233
|
-
this.transientCanvas,
|
|
234
|
-
this.transientLabelCanvas,
|
|
235
|
-
].map((canvas) => canvas.ready),
|
|
236
|
-
).then(() => {
|
|
237
|
-
[
|
|
238
|
-
this.backgroundCanvas,
|
|
239
|
-
this.canvas,
|
|
240
|
-
this.labelCanvas,
|
|
241
|
-
this.transientCanvas,
|
|
242
|
-
this.transientLabelCanvas,
|
|
243
|
-
].forEach((canvas, i) => {
|
|
244
|
-
const $domElement = canvas
|
|
245
|
-
.getContextService()
|
|
246
|
-
.getDomElement() as unknown as HTMLElement;
|
|
247
|
-
if ($domElement && $domElement.style) {
|
|
248
|
-
// Make all these 3 canvas doms overlap each other. The container already has `position: relative` style.
|
|
249
|
-
$domElement.style.position = 'absolute';
|
|
250
|
-
$domElement.style.outline = 'none';
|
|
251
|
-
$domElement.tabIndex = 1; // Enable keyboard events
|
|
252
|
-
// Transient canvas should let interactive events go through.
|
|
253
|
-
if (i !== 1) {
|
|
254
|
-
$domElement.style.pointerEvents = 'none';
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
136
|
+
if (zoomRange) this.options.zoomRange = zoomRange;
|
|
137
|
+
if (isNumber(zoom)) this.options.zoom = zoom;
|
|
138
|
+
if (isNumber(padding)) this.options.padding = padding;
|
|
139
|
+
}
|
|
258
140
|
|
|
259
|
-
|
|
260
|
-
|
|
141
|
+
public setBackground(background: G6Spec['background']): void {
|
|
142
|
+
this.options.background = background;
|
|
143
|
+
this.context.canvas?.setBackground(background);
|
|
261
144
|
}
|
|
262
145
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (enableStack) {
|
|
266
|
-
const history = {
|
|
267
|
-
type: 'history',
|
|
268
|
-
key: 'history',
|
|
269
|
-
enableStack,
|
|
270
|
-
stackCfg,
|
|
271
|
-
};
|
|
272
|
-
if (!this.specification.plugins) {
|
|
273
|
-
this.specification.plugins = [];
|
|
274
|
-
}
|
|
275
|
-
this.specification.plugins.push(history);
|
|
276
|
-
}
|
|
146
|
+
public getBackground(): G6Spec['background'] {
|
|
147
|
+
return this.options.background;
|
|
277
148
|
}
|
|
278
149
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
* @returns
|
|
283
|
-
*/
|
|
284
|
-
public changeRenderer(type) {
|
|
285
|
-
this.rendererType = type || 'canvas';
|
|
286
|
-
changeRenderer(this.rendererType, this.canvas);
|
|
150
|
+
public getSize(): [number, number] {
|
|
151
|
+
if (this.context.canvas) return this.context.canvas.getSize();
|
|
152
|
+
return [this.options.width || 0, this.options.height || 0];
|
|
287
153
|
}
|
|
288
154
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
private initHooks() {
|
|
293
|
-
this.hooks = {
|
|
294
|
-
init: new Hook<{
|
|
295
|
-
canvases: {
|
|
296
|
-
background: Canvas;
|
|
297
|
-
label: Canvas;
|
|
298
|
-
main: Canvas;
|
|
299
|
-
transient: Canvas;
|
|
300
|
-
transientLabel: Canvas;
|
|
301
|
-
};
|
|
302
|
-
}>({ name: 'init' }),
|
|
303
|
-
datachange: new Hook<{ data: GraphData; type: DataChangeType }>({
|
|
304
|
-
name: 'datachange',
|
|
305
|
-
}),
|
|
306
|
-
itemchange: new Hook<{
|
|
307
|
-
type: ITEM_TYPE;
|
|
308
|
-
changes: GraphChange<NodeModelData, EdgeModelData>[];
|
|
309
|
-
graphCore: GraphCore;
|
|
310
|
-
theme: ThemeSpecification;
|
|
311
|
-
animate?: boolean;
|
|
312
|
-
upsertAncestors?: boolean;
|
|
313
|
-
}>({ name: 'itemchange' }),
|
|
314
|
-
render: new Hook<{
|
|
315
|
-
graphCore: GraphCore;
|
|
316
|
-
theme: ThemeSpecification;
|
|
317
|
-
transientCanvas: Canvas;
|
|
318
|
-
transientLabelCanvas: Canvas;
|
|
319
|
-
}>({
|
|
320
|
-
name: 'render',
|
|
321
|
-
}),
|
|
322
|
-
layout: new Hook<{
|
|
323
|
-
graphCore: GraphCore;
|
|
324
|
-
options?: LayoutOptions;
|
|
325
|
-
animate?: boolean;
|
|
326
|
-
}>({ name: 'layout' }),
|
|
327
|
-
viewportchange: new Hook<ViewportChangeHookParams>({ name: 'viewport' }),
|
|
328
|
-
modechange: new Hook<{ mode: string }>({ name: 'modechange' }),
|
|
329
|
-
behaviorchange: new Hook<{
|
|
330
|
-
action: 'update' | 'add' | 'remove';
|
|
331
|
-
modes: string[];
|
|
332
|
-
behaviors: (string | BehaviorOptionsOf<{}>)[];
|
|
333
|
-
}>({ name: 'behaviorchange' }),
|
|
334
|
-
itemstatechange: new Hook<{
|
|
335
|
-
ids: ID[];
|
|
336
|
-
states?: string[];
|
|
337
|
-
value?: boolean;
|
|
338
|
-
}>({
|
|
339
|
-
name: 'itemstatechange',
|
|
340
|
-
}),
|
|
341
|
-
itemstateconfigchange: new Hook<{
|
|
342
|
-
itemType: ITEM_TYPE;
|
|
343
|
-
stateConfig:
|
|
344
|
-
| {
|
|
345
|
-
[stateName: string]:
|
|
346
|
-
| ((data: NodeModel) => NodeDisplayModel)
|
|
347
|
-
| NodeShapesEncode;
|
|
348
|
-
}
|
|
349
|
-
| {
|
|
350
|
-
[stateName: string]:
|
|
351
|
-
| ((data: EdgeModel) => EdgeDisplayModel)
|
|
352
|
-
| EdgeShapesEncode;
|
|
353
|
-
}
|
|
354
|
-
| {
|
|
355
|
-
[stateName: string]:
|
|
356
|
-
| ((data: ComboModel) => ComboDisplayModel)
|
|
357
|
-
| ComboShapesEncode;
|
|
358
|
-
};
|
|
359
|
-
}>({
|
|
360
|
-
name: 'itemstateconfigchange',
|
|
361
|
-
}),
|
|
362
|
-
itemvisibilitychange: new Hook<{ ids: ID[]; value: boolean }>({
|
|
363
|
-
name: 'itemvisibilitychange',
|
|
364
|
-
}),
|
|
365
|
-
itemzindexchange: new Hook<{
|
|
366
|
-
ids: ID[];
|
|
367
|
-
action: 'front' | 'back';
|
|
368
|
-
graphCore: GraphCore;
|
|
369
|
-
}>({
|
|
370
|
-
name: 'itemzindexchange',
|
|
371
|
-
}),
|
|
372
|
-
transientupdate: new Hook<{
|
|
373
|
-
type: ITEM_TYPE | SHAPE_TYPE;
|
|
374
|
-
id: ID;
|
|
375
|
-
config: {
|
|
376
|
-
style: ShapeStyle;
|
|
377
|
-
action: 'remove' | 'add' | 'update' | undefined;
|
|
378
|
-
};
|
|
379
|
-
canvas: Canvas;
|
|
380
|
-
graphCore: GraphCore;
|
|
381
|
-
}>({ name: 'transientupdate' }),
|
|
382
|
-
pluginchange: new Hook<{
|
|
383
|
-
action: 'update' | 'add' | 'remove';
|
|
384
|
-
plugins: (
|
|
385
|
-
| string
|
|
386
|
-
| { key: string; type: string; [cfgName: string]: unknown }
|
|
387
|
-
)[];
|
|
388
|
-
}>({ name: 'pluginchange' }),
|
|
389
|
-
themechange: new Hook<{
|
|
390
|
-
theme: ThemeSpecification;
|
|
391
|
-
canvases: {
|
|
392
|
-
background: Canvas;
|
|
393
|
-
main: Canvas;
|
|
394
|
-
transient: Canvas;
|
|
395
|
-
};
|
|
396
|
-
}>({ name: 'themechange' }),
|
|
397
|
-
mapperchange: new Hook<{
|
|
398
|
-
type: ITEM_TYPE;
|
|
399
|
-
mapper: NodeMapper | EdgeMapper | ComboMapper;
|
|
400
|
-
}>({ name: 'mapperchange' }),
|
|
401
|
-
treecollapseexpand: new Hook<{
|
|
402
|
-
ids: ID[];
|
|
403
|
-
animate: boolean;
|
|
404
|
-
action: 'collapse' | 'expand';
|
|
405
|
-
graphCore: GraphCore;
|
|
406
|
-
}>({ name: 'treecollapseexpand' }),
|
|
407
|
-
destroy: new Hook<{}>({ name: 'destroy' }),
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
private formatSpecification(spec: Specification<B, T>) {
|
|
412
|
-
return {
|
|
413
|
-
...this.specification,
|
|
414
|
-
...spec,
|
|
415
|
-
optimize: {
|
|
416
|
-
tileBehavior: 2000,
|
|
417
|
-
tileBehaviorSize: 1000,
|
|
418
|
-
tileFirstRender: 10000,
|
|
419
|
-
tileFirstRenderSize: 1000,
|
|
420
|
-
...this.specification?.optimize,
|
|
421
|
-
...spec.optimize,
|
|
422
|
-
},
|
|
423
|
-
};
|
|
155
|
+
public setSize(width: number, height: number): void {
|
|
156
|
+
this.options.width = width;
|
|
157
|
+
this.options.height = height;
|
|
424
158
|
}
|
|
425
159
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
*/
|
|
429
|
-
public updateSpecification(spec: Specification<B, T>): Specification<B, T> {
|
|
430
|
-
const {
|
|
431
|
-
node,
|
|
432
|
-
edge,
|
|
433
|
-
combo,
|
|
434
|
-
theme,
|
|
435
|
-
nodeState,
|
|
436
|
-
edgeState,
|
|
437
|
-
comboState,
|
|
438
|
-
...others
|
|
439
|
-
} = spec;
|
|
440
|
-
if (node) this.updateMapper('node', node);
|
|
441
|
-
if (edge) this.updateMapper('edge', edge);
|
|
442
|
-
if (combo) this.updateMapper('combo', combo);
|
|
443
|
-
if (theme) this.updateTheme(theme);
|
|
444
|
-
if (nodeState) this.updateStateConfig('node', nodeState, 'replace');
|
|
445
|
-
if (edgeState) this.updateStateConfig('edge', edgeState, 'replace');
|
|
446
|
-
if (comboState) this.updateStateConfig('combo', comboState, 'replace');
|
|
447
|
-
|
|
448
|
-
const newSpec = Object.assign(
|
|
449
|
-
this.specification,
|
|
450
|
-
this.formatSpecification(others),
|
|
451
|
-
);
|
|
452
|
-
return newSpec;
|
|
160
|
+
public setZoomRange(zoomRange: G6Spec['zoomRange']): void {
|
|
161
|
+
this.options.zoomRange = zoomRange;
|
|
453
162
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
public updateTheme(theme: ThemeOptionsOf<T>) {
|
|
458
|
-
this.specification.theme = theme;
|
|
459
|
-
// const { specification } = this.themeController;
|
|
460
|
-
// notifiying the themeController
|
|
461
|
-
this.hooks.themechange.emit({
|
|
462
|
-
canvases: {
|
|
463
|
-
background: this.backgroundCanvas,
|
|
464
|
-
main: this.canvas,
|
|
465
|
-
transient: this.transientCanvas,
|
|
466
|
-
},
|
|
467
|
-
});
|
|
468
|
-
// theme is formatted by themeController, notify the item controller to update the items
|
|
469
|
-
this.hooks.themechange.emit({
|
|
470
|
-
theme: this.themeController.specification,
|
|
471
|
-
});
|
|
163
|
+
|
|
164
|
+
public getZoomRange(): G6Spec['zoomRange'] {
|
|
165
|
+
return this.options.zoomRange;
|
|
472
166
|
}
|
|
473
167
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
* @param {ITEM_TYPE} type - The type of item (node, edge, or combo).
|
|
477
|
-
* @param {NodeMapper | EdgeMapper | ComboMapper} mapper - The mapper to be updated.
|
|
478
|
-
* */
|
|
479
|
-
public updateMapper(
|
|
480
|
-
type: ITEM_TYPE,
|
|
481
|
-
mapper: NodeMapper | EdgeMapper | ComboMapper,
|
|
482
|
-
) {
|
|
483
|
-
switch (type) {
|
|
484
|
-
case 'node':
|
|
485
|
-
this.specification.node = mapper as NodeMapper;
|
|
486
|
-
break;
|
|
487
|
-
case 'edge':
|
|
488
|
-
this.specification.edge = mapper as EdgeMapper;
|
|
489
|
-
break;
|
|
490
|
-
case 'combo':
|
|
491
|
-
this.specification.combo = mapper as ComboMapper;
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
this.hooks.mapperchange.emit({
|
|
495
|
-
type,
|
|
496
|
-
mapper,
|
|
497
|
-
});
|
|
168
|
+
public setNode(node: NodeOptions): void {
|
|
169
|
+
this.options.node = node;
|
|
498
170
|
}
|
|
499
171
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
* @param {string} itemType - The type of item (node, edge, or combo).
|
|
503
|
-
* @param {object} stateConfig - The state configuration to update.
|
|
504
|
-
* @param {string} updateType - The type of update ('mergeReplace' or 'replace'). Default is 'mergeReplace'.
|
|
505
|
-
**/
|
|
506
|
-
public updateStateConfig(
|
|
507
|
-
itemType: ITEM_TYPE,
|
|
508
|
-
stateConfig:
|
|
509
|
-
| {
|
|
510
|
-
[stateName: string]:
|
|
511
|
-
| ((data: NodeModel) => NodeDisplayModel)
|
|
512
|
-
| NodeShapesEncode;
|
|
513
|
-
}
|
|
514
|
-
| {
|
|
515
|
-
[stateName: string]:
|
|
516
|
-
| ((data: EdgeModel) => EdgeDisplayModel)
|
|
517
|
-
| EdgeShapesEncode;
|
|
518
|
-
}
|
|
519
|
-
| {
|
|
520
|
-
[stateName: string]:
|
|
521
|
-
| ((data: ComboModel) => ComboDisplayModel)
|
|
522
|
-
| ComboShapesEncode;
|
|
523
|
-
},
|
|
524
|
-
updateType: 'mergeReplace' | 'replace' = 'mergeReplace',
|
|
525
|
-
) {
|
|
526
|
-
if (isEmpty(stateConfig)) return;
|
|
527
|
-
const stateField = `${itemType}State`;
|
|
528
|
-
if (updateType === 'mergeReplace') {
|
|
529
|
-
const config = {
|
|
530
|
-
...this.specification[stateField],
|
|
531
|
-
...stateConfig,
|
|
532
|
-
};
|
|
533
|
-
this.specification[itemType] = config;
|
|
534
|
-
this.hooks.itemstateconfigchange.emit({ itemType, stateConfig: config });
|
|
535
|
-
} else {
|
|
536
|
-
this.specification[itemType] = stateConfig;
|
|
537
|
-
this.hooks.itemstateconfigchange.emit({ itemType, stateConfig });
|
|
538
|
-
}
|
|
172
|
+
public setEdge(edge: EdgeOptions): void {
|
|
173
|
+
this.options.edge = edge;
|
|
539
174
|
}
|
|
540
175
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
* @returns graph specs
|
|
544
|
-
*/
|
|
545
|
-
public getSpecification(): Specification<B, T> {
|
|
546
|
-
return this.specification;
|
|
176
|
+
public setCombo(combo: ComboOptions): void {
|
|
177
|
+
this.options.combo = combo;
|
|
547
178
|
}
|
|
548
179
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
* If there is old data, diffs and changes it.
|
|
552
|
-
* @param data
|
|
553
|
-
* @returns
|
|
554
|
-
* @group Data
|
|
555
|
-
*/
|
|
556
|
-
public async read(data: DataConfig) {
|
|
557
|
-
const { tileFirstRender, tileFirstRenderSize } =
|
|
558
|
-
this.specification.optimize || {};
|
|
559
|
-
this.hooks.datachange.emit({ data, type: 'replace' });
|
|
560
|
-
const emitRender = async () => {
|
|
561
|
-
await this.hooks.render.emitLinearAsync({
|
|
562
|
-
graphCore: this.dataController.graphCore,
|
|
563
|
-
theme: this.themeController.specification,
|
|
564
|
-
transientCanvas: this.transientCanvas,
|
|
565
|
-
transientLabelCanvas: this.transientLabelCanvas,
|
|
566
|
-
tileOptimize: {
|
|
567
|
-
tileFirstRender,
|
|
568
|
-
tileFirstRenderSize,
|
|
569
|
-
},
|
|
570
|
-
});
|
|
571
|
-
this.emit('afterrender');
|
|
572
|
-
|
|
573
|
-
this.once('afterlayout', async () => {
|
|
574
|
-
const { autoFit } = this.specification;
|
|
575
|
-
if (!autoFit) return;
|
|
576
|
-
if (autoFit === 'view') {
|
|
577
|
-
await this.fitView({ rules: { boundsType: 'layout' } });
|
|
578
|
-
} else if (autoFit === 'center') {
|
|
579
|
-
await this.fitCenter('layout');
|
|
580
|
-
} else {
|
|
581
|
-
const { type, effectTiming, ...others } = autoFit;
|
|
582
|
-
if (type === 'view') {
|
|
583
|
-
const { padding, rules } = others as {
|
|
584
|
-
padding: Padding;
|
|
585
|
-
rules: FitViewRules;
|
|
586
|
-
};
|
|
587
|
-
await this.fitView(
|
|
588
|
-
{
|
|
589
|
-
padding,
|
|
590
|
-
rules: {
|
|
591
|
-
...rules,
|
|
592
|
-
boundsType: 'layout',
|
|
593
|
-
},
|
|
594
|
-
},
|
|
595
|
-
effectTiming,
|
|
596
|
-
);
|
|
597
|
-
} else if (type === 'center') {
|
|
598
|
-
await this.fitCenter('layout', effectTiming);
|
|
599
|
-
} else if (type === 'position') {
|
|
600
|
-
// TODO: align
|
|
601
|
-
await this.translateTo((others as any).position, effectTiming);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
await this.layout();
|
|
606
|
-
};
|
|
607
|
-
if (this.canvasReady) {
|
|
608
|
-
await emitRender();
|
|
609
|
-
} else {
|
|
610
|
-
await Promise.all(
|
|
611
|
-
[
|
|
612
|
-
this.backgroundCanvas,
|
|
613
|
-
this.canvas,
|
|
614
|
-
this.labelCanvas,
|
|
615
|
-
this.transientCanvas,
|
|
616
|
-
this.transientLabelCanvas,
|
|
617
|
-
].map((canvas) => canvas.ready),
|
|
618
|
-
);
|
|
619
|
-
await emitRender();
|
|
620
|
-
}
|
|
180
|
+
public getTheme(): ThemeOptions {
|
|
181
|
+
return this.options.theme!;
|
|
621
182
|
}
|
|
622
183
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
* @param data new data
|
|
626
|
-
* @param type the way to change data, 'replace' means discard the old data and use the new one; 'mergeReplace' means merge the common part, remove (old - new), add (new - old)
|
|
627
|
-
* @param relayout whether relayout the nodes after data changing
|
|
628
|
-
* @returns
|
|
629
|
-
* @group Data
|
|
630
|
-
*/
|
|
631
|
-
public async changeData(
|
|
632
|
-
data: DataConfig,
|
|
633
|
-
type: 'replace' | 'mergeReplace' = 'mergeReplace',
|
|
634
|
-
relayout: boolean = true,
|
|
635
|
-
) {
|
|
636
|
-
const { tileFirstRender, tileFirstRenderSize } =
|
|
637
|
-
this.specification.optimize || {};
|
|
638
|
-
this.hooks.datachange.emit({ data, type });
|
|
639
|
-
this.hooks.render.emit({
|
|
640
|
-
graphCore: this.dataController.graphCore,
|
|
641
|
-
theme: this.themeController.specification,
|
|
642
|
-
transientCanvas: this.transientCanvas,
|
|
643
|
-
transientLabelCanvas: this.transientLabelCanvas,
|
|
644
|
-
tileOptimize: {
|
|
645
|
-
tileFirstRender,
|
|
646
|
-
tileFirstRenderSize,
|
|
647
|
-
},
|
|
648
|
-
});
|
|
649
|
-
this.emit('afterrender');
|
|
184
|
+
public setTheme(theme: CallableValue<ThemeOptions>): void {
|
|
185
|
+
this.options.theme = isFunction(theme) ? theme(this.getTheme()) : theme;
|
|
650
186
|
|
|
651
|
-
|
|
652
|
-
|
|
187
|
+
const { background } = getExtension('theme', this.options.theme) || {};
|
|
188
|
+
if (background && !this.options.background) {
|
|
189
|
+
this.setBackground(background);
|
|
653
190
|
}
|
|
654
191
|
}
|
|
655
192
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
* @returns
|
|
659
|
-
*/
|
|
660
|
-
public clear() {
|
|
661
|
-
this.startHistoryBatch();
|
|
662
|
-
this.removeData(
|
|
663
|
-
'edge',
|
|
664
|
-
this.getAllEdgesData().map((edge) => edge.id),
|
|
665
|
-
);
|
|
666
|
-
this.removeData(
|
|
667
|
-
'node',
|
|
668
|
-
this.getAllNodesData().map((node) => node.id),
|
|
669
|
-
);
|
|
670
|
-
this.removeData(
|
|
671
|
-
'combo',
|
|
672
|
-
this.getAllCombosData().map((combo) => combo.id),
|
|
673
|
-
);
|
|
674
|
-
this.stopHistoryBatch();
|
|
193
|
+
public setLayout(layout: CallableValue<LayoutOptions>): void {
|
|
194
|
+
this.options.layout = isFunction(layout) ? layout(this.getLayout()) : layout;
|
|
675
195
|
}
|
|
676
196
|
|
|
677
|
-
public
|
|
678
|
-
|
|
679
|
-
return { x: width! / 2, y: height! / 2 };
|
|
680
|
-
}
|
|
681
|
-
public async transform(
|
|
682
|
-
options: GraphTransformOptions,
|
|
683
|
-
effectTiming?: CameraAnimationOptions,
|
|
684
|
-
): Promise<void> {
|
|
685
|
-
if (isEmptyGraph(this, true)) return;
|
|
686
|
-
const { tileLodSize } = this.specification.optimize || {};
|
|
687
|
-
await this.hooks.viewportchange.emitLinearAsync({
|
|
688
|
-
transform: options,
|
|
689
|
-
effectTiming,
|
|
690
|
-
tileLodSize,
|
|
691
|
-
});
|
|
692
|
-
this.emit('viewportchange', options);
|
|
197
|
+
public getLayout(): LayoutOptions {
|
|
198
|
+
return this.options.layout!;
|
|
693
199
|
}
|
|
694
200
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
public stopTransformTransition() {
|
|
699
|
-
this.canvas.getCamera().cancelLandmarkAnimation();
|
|
201
|
+
public setBehaviors(behaviors: CallableValue<BehaviorOptions>): void {
|
|
202
|
+
this.options.behaviors = isFunction(behaviors) ? behaviors(this.getBehaviors()) : behaviors;
|
|
203
|
+
this.context.behavior?.setBehaviors(this.options.behaviors);
|
|
700
204
|
}
|
|
701
205
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
* @param dx x of the relative distance
|
|
705
|
-
* @param dy y of the relative distance
|
|
706
|
-
* @param effectTiming animation configurations
|
|
707
|
-
*/
|
|
708
|
-
public async translate(
|
|
709
|
-
distance: Partial<{
|
|
710
|
-
dx: number;
|
|
711
|
-
dy: number;
|
|
712
|
-
dz: number;
|
|
713
|
-
}>,
|
|
714
|
-
effectTiming?: CameraAnimationOptions,
|
|
715
|
-
) {
|
|
716
|
-
const { x: cx, y: cy } = this.getViewportCenter();
|
|
717
|
-
const { dx, dy, dz } = distance;
|
|
718
|
-
await this.transform(
|
|
719
|
-
{
|
|
720
|
-
translate: {
|
|
721
|
-
dx,
|
|
722
|
-
dy,
|
|
723
|
-
dz,
|
|
724
|
-
targetX: cx - dx,
|
|
725
|
-
targetY: cy - dy,
|
|
726
|
-
},
|
|
727
|
-
},
|
|
728
|
-
effectTiming,
|
|
729
|
-
);
|
|
206
|
+
public getBehaviors(): BehaviorOptions {
|
|
207
|
+
return this.options.behaviors || [];
|
|
730
208
|
}
|
|
731
209
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
* @param effectTiming animation configurations
|
|
736
|
-
*/
|
|
737
|
-
public async translateTo(
|
|
738
|
-
{ x, y }: Point,
|
|
739
|
-
effectTiming?: CameraAnimationOptions,
|
|
740
|
-
) {
|
|
741
|
-
const { x: cx, y: cy } = this.getViewportCenter();
|
|
742
|
-
const canvasPoint = this.canvas.viewport2Canvas({ x, y });
|
|
743
|
-
|
|
744
|
-
await this.transform(
|
|
745
|
-
{
|
|
746
|
-
translate: {
|
|
747
|
-
dx: cx - x,
|
|
748
|
-
dy: cy - y,
|
|
749
|
-
targetX: canvasPoint.x,
|
|
750
|
-
targetY: canvasPoint.y,
|
|
751
|
-
},
|
|
752
|
-
},
|
|
753
|
-
effectTiming,
|
|
754
|
-
);
|
|
210
|
+
public setPlugins(plugins: CallableValue<PluginOptions>): void {
|
|
211
|
+
this.options.plugins = isFunction(plugins) ? plugins(this.getPlugins()) : plugins;
|
|
212
|
+
this.context.plugin?.setPlugins(this.options.plugins);
|
|
755
213
|
}
|
|
756
214
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
* @param ratio relative ratio to zoom
|
|
760
|
-
* @param origin origin under viewport coordinates.
|
|
761
|
-
* @param effectTiming animation configurations
|
|
762
|
-
*/
|
|
763
|
-
public async zoom(
|
|
764
|
-
ratio: number,
|
|
765
|
-
origin?: Point,
|
|
766
|
-
effectTiming?: CameraAnimationOptions,
|
|
767
|
-
) {
|
|
768
|
-
await this.transform(
|
|
769
|
-
{
|
|
770
|
-
zoom: {
|
|
771
|
-
ratio,
|
|
772
|
-
},
|
|
773
|
-
origin,
|
|
774
|
-
},
|
|
775
|
-
effectTiming,
|
|
776
|
-
);
|
|
215
|
+
public getPlugins(): PluginOptions {
|
|
216
|
+
return this.options.plugins || [];
|
|
777
217
|
}
|
|
778
218
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
* @param zoom specified ratio
|
|
782
|
-
* @param origin zoom center
|
|
783
|
-
* @param effectTiming animation configurations
|
|
784
|
-
*/
|
|
785
|
-
public async zoomTo(
|
|
786
|
-
zoom: number,
|
|
787
|
-
origin?: PointLike,
|
|
788
|
-
effectTiming?: CameraAnimationOptions,
|
|
789
|
-
) {
|
|
790
|
-
await this.zoom(
|
|
791
|
-
zoom / this.canvas.getCamera().getZoom(),
|
|
792
|
-
origin,
|
|
793
|
-
effectTiming,
|
|
794
|
-
);
|
|
219
|
+
public getData(): GraphData {
|
|
220
|
+
return this.context.model.getData();
|
|
795
221
|
}
|
|
796
222
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
return this.
|
|
223
|
+
public getNodeData(): NodeData[];
|
|
224
|
+
public getNodeData(id: ID): NodeData;
|
|
225
|
+
public getNodeData(ids: ID[]): NodeData[];
|
|
226
|
+
public getNodeData(id?: ID | ID[]): NodeData | NodeData[] {
|
|
227
|
+
if (id === undefined) return this.context.model.getNodeData();
|
|
228
|
+
if (Array.isArray(id)) return this.context.model.getNodeData(id);
|
|
229
|
+
return this.context.model.getNodeData([id])?.[0];
|
|
803
230
|
}
|
|
804
231
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
angle: number,
|
|
813
|
-
origin?: PointLike,
|
|
814
|
-
effectTiming?: CameraAnimationOptions,
|
|
815
|
-
) {
|
|
816
|
-
await this.transform(
|
|
817
|
-
{
|
|
818
|
-
rotate: {
|
|
819
|
-
angle,
|
|
820
|
-
},
|
|
821
|
-
origin,
|
|
822
|
-
},
|
|
823
|
-
effectTiming,
|
|
824
|
-
);
|
|
232
|
+
public getEdgeData(): EdgeData[];
|
|
233
|
+
public getEdgeData(id: ID): EdgeData;
|
|
234
|
+
public getEdgeData(ids: ID[]): EdgeData[];
|
|
235
|
+
public getEdgeData(id?: ID | ID[]): EdgeData | EdgeData[] {
|
|
236
|
+
if (id === undefined) return this.context.model.getEdgeData();
|
|
237
|
+
if (Array.isArray(id)) return this.context.model.getEdgeData(id);
|
|
238
|
+
return this.context.model.getEdgeData([id])?.[0];
|
|
825
239
|
}
|
|
826
240
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
angle: number,
|
|
835
|
-
origin?: PointLike,
|
|
836
|
-
effectTiming?: CameraAnimationOptions,
|
|
837
|
-
) {
|
|
838
|
-
await this.rotate(
|
|
839
|
-
angle - this.canvas.getCamera().getRoll(),
|
|
840
|
-
origin,
|
|
841
|
-
effectTiming,
|
|
842
|
-
);
|
|
241
|
+
public getComboData(): ComboData[];
|
|
242
|
+
public getComboData(id: ID): ComboData;
|
|
243
|
+
public getComboData(ids: ID[]): ComboData[];
|
|
244
|
+
public getComboData(id?: ID | ID[]): ComboData | ComboData[] {
|
|
245
|
+
if (id === undefined) return this.context.model.getComboData();
|
|
246
|
+
if (Array.isArray(id)) return this.context.model.getComboData(id);
|
|
247
|
+
return this.context.model.getComboData([id])?.[0];
|
|
843
248
|
}
|
|
844
249
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
* @param options.padding padding while fitting
|
|
848
|
-
* @param options.rules rules for fitting
|
|
849
|
-
* @param effectTiming animation configurations
|
|
850
|
-
*/
|
|
851
|
-
public async fitView(
|
|
852
|
-
options?: {
|
|
853
|
-
padding?: Padding;
|
|
854
|
-
rules?: FitViewRules;
|
|
855
|
-
},
|
|
856
|
-
effectTiming?: CameraAnimationOptions,
|
|
857
|
-
) {
|
|
858
|
-
const { padding, rules } = options || {};
|
|
859
|
-
const [top, right, bottom, left] = padding
|
|
860
|
-
? formatPadding(padding)
|
|
861
|
-
: [0, 0, 0, 0];
|
|
862
|
-
const {
|
|
863
|
-
direction = 'both',
|
|
864
|
-
ratioRule = 'min',
|
|
865
|
-
boundsType = 'render',
|
|
866
|
-
onlyOutOfViewport = false,
|
|
867
|
-
onlyZoomAtLargerThanViewport = false,
|
|
868
|
-
} = rules || {};
|
|
869
|
-
|
|
870
|
-
const {
|
|
871
|
-
min,
|
|
872
|
-
max,
|
|
873
|
-
center: [graphCenterX, graphCenterY],
|
|
874
|
-
halfExtents,
|
|
875
|
-
} = boundsType === 'render'
|
|
876
|
-
? // Get the bounds of the whole graph content.
|
|
877
|
-
getCombinedCanvasesBounds([this.canvas, this.labelCanvas])
|
|
878
|
-
: // Get the b ounds of the nodes positions while the graph content is not ready.
|
|
879
|
-
getLayoutBounds(this);
|
|
880
|
-
const origin = this.canvas.canvas2Viewport({
|
|
881
|
-
x: graphCenterX,
|
|
882
|
-
y: graphCenterY,
|
|
883
|
-
});
|
|
884
|
-
const { width: viewportWidth, height: viewportHeight } =
|
|
885
|
-
this.canvas.getConfig();
|
|
886
|
-
|
|
887
|
-
const graphWidth = halfExtents[0] * 2;
|
|
888
|
-
const graphHeight = halfExtents[1] * 2;
|
|
889
|
-
const tlInCanvas = this.canvas.viewport2Canvas({ x: left, y: top });
|
|
890
|
-
const brInCanvas = this.canvas.viewport2Canvas({
|
|
891
|
-
x: viewportWidth! - right,
|
|
892
|
-
y: viewportHeight! - bottom,
|
|
893
|
-
});
|
|
894
|
-
|
|
895
|
-
const isOutOfView =
|
|
896
|
-
min[0] < tlInCanvas.x ||
|
|
897
|
-
min[1] < tlInCanvas.y ||
|
|
898
|
-
max[0] > brInCanvas.x ||
|
|
899
|
-
max[1] > brInCanvas.y;
|
|
900
|
-
if (onlyOutOfViewport && !isOutOfView) return;
|
|
901
|
-
|
|
902
|
-
const targetViewWidth = brInCanvas.x - tlInCanvas.x;
|
|
903
|
-
const targetViewHeight = brInCanvas.y - tlInCanvas.y;
|
|
904
|
-
|
|
905
|
-
const wRatio = targetViewWidth / graphWidth;
|
|
906
|
-
const hRatio = targetViewHeight / graphHeight;
|
|
907
|
-
|
|
908
|
-
let ratio: number;
|
|
909
|
-
if (direction === 'x') {
|
|
910
|
-
ratio = wRatio;
|
|
911
|
-
} else if (direction === 'y') {
|
|
912
|
-
ratio = hRatio;
|
|
913
|
-
} else {
|
|
914
|
-
ratio =
|
|
915
|
-
ratioRule === 'max'
|
|
916
|
-
? Math.max(wRatio, hRatio)
|
|
917
|
-
: Math.min(wRatio, hRatio);
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
if (onlyZoomAtLargerThanViewport && ratio > 1) ratio = 1;
|
|
921
|
-
|
|
922
|
-
await this.transform(
|
|
923
|
-
{
|
|
924
|
-
translate: {
|
|
925
|
-
dx: viewportWidth! / 2 - origin.x,
|
|
926
|
-
dy: viewportHeight! / 2 - origin.y,
|
|
927
|
-
targetX: graphCenterX,
|
|
928
|
-
targetY: graphCenterY,
|
|
929
|
-
},
|
|
930
|
-
zoom: {
|
|
931
|
-
ratio,
|
|
932
|
-
},
|
|
933
|
-
},
|
|
934
|
-
effectTiming,
|
|
935
|
-
);
|
|
936
|
-
}
|
|
937
|
-
/**
|
|
938
|
-
* Fit the graph center to the view center.
|
|
939
|
-
* @param effectTiming animation configurations
|
|
940
|
-
*/
|
|
941
|
-
public async fitCenter(
|
|
942
|
-
boundsType: 'render' | 'layout' = 'render',
|
|
943
|
-
effectTiming?: CameraAnimationOptions,
|
|
944
|
-
) {
|
|
945
|
-
const {
|
|
946
|
-
center: [graphCenterX, graphCenterY],
|
|
947
|
-
} =
|
|
948
|
-
boundsType === 'render'
|
|
949
|
-
? // Get the bounds of the whole graph content.
|
|
950
|
-
getCombinedCanvasesBounds([this.canvas, this.labelCanvas])
|
|
951
|
-
: // Get the bounds of the nodes positions while the graph content is not ready.
|
|
952
|
-
getLayoutBounds(this);
|
|
953
|
-
await this.translateTo(
|
|
954
|
-
this.canvas.canvas2Viewport({ x: graphCenterX, y: graphCenterY }),
|
|
955
|
-
effectTiming,
|
|
956
|
-
);
|
|
250
|
+
public setData(data: CallableValue<GraphData>): void {
|
|
251
|
+
this.context.model.setData(isFunction(data) ? data(this.getData()) : data);
|
|
957
252
|
}
|
|
958
|
-
/**
|
|
959
|
-
* Move the graph to make the item align the view center.
|
|
960
|
-
* @param item node/edge/combo item or its id
|
|
961
|
-
* @param effectTiming animation configurations
|
|
962
|
-
*/
|
|
963
|
-
public async focusItem(id: ID | ID[], effectTiming?: CameraAnimationOptions) {
|
|
964
|
-
let bounds: AABB | null = null;
|
|
965
|
-
for (const itemId of !isArray(id) ? [id] : id) {
|
|
966
|
-
const item = this.getItemById(itemId);
|
|
967
|
-
if (item) {
|
|
968
|
-
const itemBounds = item.group.getBounds();
|
|
969
|
-
if (!bounds) {
|
|
970
|
-
bounds = itemBounds;
|
|
971
|
-
} else {
|
|
972
|
-
bounds.add(itemBounds);
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
253
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
center: [itemCenterX, itemCenterY],
|
|
980
|
-
} = bounds;
|
|
981
|
-
await this.translateTo(
|
|
982
|
-
this.canvas.canvas2Viewport({ x: itemCenterX, y: itemCenterY }),
|
|
983
|
-
effectTiming,
|
|
984
|
-
);
|
|
985
|
-
}
|
|
254
|
+
public addData(data: CallableValue<GraphData>): void {
|
|
255
|
+
this.context.model.addData(isFunction(data) ? data(this.getData()) : data);
|
|
986
256
|
}
|
|
987
257
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
* @param id
|
|
991
|
-
* @returns Node | Edge | Combo
|
|
992
|
-
*/
|
|
993
|
-
private getItemById(id: ID) {
|
|
994
|
-
return this.itemController.getItemById(id);
|
|
258
|
+
public addNodeData(data: CallableValue<NodeData[]>): void {
|
|
259
|
+
this.context.model.addNodeData(isFunction(data) ? data(this.getNodeData()) : data);
|
|
995
260
|
}
|
|
996
261
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
* @returns [width, height]
|
|
1000
|
-
* @group View
|
|
1001
|
-
*/
|
|
1002
|
-
public getSize(): number[] {
|
|
1003
|
-
const { width = 500, height = 500 } = this.specification;
|
|
1004
|
-
return [width, height];
|
|
262
|
+
public addEdgeData(data: CallableValue<EdgeData[]>): void {
|
|
263
|
+
this.context.model.addEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
|
|
1005
264
|
}
|
|
1006
265
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
* @param number[] [width, height]
|
|
1010
|
-
* @group View
|
|
1011
|
-
*/
|
|
1012
|
-
public setSize(size: number[]) {
|
|
1013
|
-
if (!isArray(size) || size.length < 2) {
|
|
1014
|
-
console.warn(
|
|
1015
|
-
`Failed to setSize. The parameter size: ${size} is invalid. It must be an array with 2 number elements.`,
|
|
1016
|
-
);
|
|
1017
|
-
return;
|
|
1018
|
-
}
|
|
1019
|
-
const oldSize = [this.specification.width, this.specification.height];
|
|
1020
|
-
this.emit('beforesetsize', { oldSize, size: size });
|
|
1021
|
-
this.specification.width = size[0];
|
|
1022
|
-
this.specification.height = size[1];
|
|
1023
|
-
[
|
|
1024
|
-
this.canvas,
|
|
1025
|
-
this.labelCanvas,
|
|
1026
|
-
this.transientCanvas,
|
|
1027
|
-
this.transientLabelCanvas,
|
|
1028
|
-
this.backgroundCanvas,
|
|
1029
|
-
].forEach((canvas) => {
|
|
1030
|
-
canvas.resize(size[0], size[1]);
|
|
1031
|
-
});
|
|
1032
|
-
this.emit('aftersetsize', { oldSize, size: size });
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
public getCanvasRange(): Bounds {
|
|
1036
|
-
const [width, height] = this.getSize();
|
|
1037
|
-
const leftTop = this.getCanvasByViewport({ x: 0, y: 0 });
|
|
1038
|
-
const rightBottom = this.getCanvasByViewport({ x: width, y: height });
|
|
1039
|
-
return {
|
|
1040
|
-
min: [leftTop.x, leftTop.y, leftTop.z],
|
|
1041
|
-
max: [rightBottom.x, rightBottom.y, rightBottom.z],
|
|
1042
|
-
center: [
|
|
1043
|
-
(leftTop.x + rightBottom.x) / 2,
|
|
1044
|
-
(leftTop.y + rightBottom.y) / 2,
|
|
1045
|
-
(leftTop.z + rightBottom.z) / 2,
|
|
1046
|
-
],
|
|
1047
|
-
halfExtents: [
|
|
1048
|
-
(rightBottom.x - leftTop.x) / 2,
|
|
1049
|
-
(rightBottom.y - leftTop.y) / 2,
|
|
1050
|
-
(rightBottom.z - leftTop.z) / 2,
|
|
1051
|
-
],
|
|
1052
|
-
};
|
|
266
|
+
public addComboData(data: CallableValue<ComboData[]>): void {
|
|
267
|
+
this.context.model.addComboData(isFunction(data) ? data(this.getComboData()) : data);
|
|
1053
268
|
}
|
|
1054
269
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
* @param Point rendering coordinate
|
|
1058
|
-
* @returns canvas dom (viewport) coordinate
|
|
1059
|
-
* @group View
|
|
1060
|
-
*/
|
|
1061
|
-
public getCanvasByViewport(viewportPoint: Point): Point {
|
|
1062
|
-
return this.canvas.viewport2Canvas(viewportPoint);
|
|
270
|
+
public updateData(data: CallableValue<PartialGraphData>): void {
|
|
271
|
+
this.context.model.updateData(isFunction(data) ? data(this.getData()) : data);
|
|
1063
272
|
}
|
|
1064
273
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
* @param Point canvas dom (viewport) coordinate
|
|
1068
|
-
* @returns rendering coordinate
|
|
1069
|
-
* @group View
|
|
1070
|
-
*/
|
|
1071
|
-
public getViewportByCanvas(canvasPoint: Point): Point {
|
|
1072
|
-
return this.canvas.canvas2Viewport(canvasPoint);
|
|
274
|
+
public updateNodeData(data: CallableValue<PartialNodeLikeData<NodeData>[]>): void {
|
|
275
|
+
this.context.model.updateNodeData(isFunction(data) ? data(this.getNodeData()) : data);
|
|
1073
276
|
}
|
|
1074
277
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
* @param Point rendering coordinate
|
|
1078
|
-
* @returns browser coordinate
|
|
1079
|
-
* @group View
|
|
1080
|
-
*/
|
|
1081
|
-
public getClientByCanvas(canvasPoint: Point): Point {
|
|
1082
|
-
const viewportPoint = this.canvas.canvas2Viewport(canvasPoint);
|
|
1083
|
-
return this.canvas.viewport2Client(viewportPoint as any);
|
|
278
|
+
public updateEdgeData(data: CallableValue<PartialEdgeData<EdgeData>[]>): void {
|
|
279
|
+
this.context.model.updateEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
|
|
1084
280
|
}
|
|
1085
281
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
* @param Point browser coordinate
|
|
1089
|
-
* @returns rendering coordinate
|
|
1090
|
-
* @group View
|
|
1091
|
-
*/
|
|
1092
|
-
public getCanvasByClient(clientPoint: Point): Point {
|
|
1093
|
-
const viewportPoint = this.canvas.client2Viewport(clientPoint);
|
|
1094
|
-
return this.canvas.viewport2Canvas(viewportPoint as any);
|
|
282
|
+
public updateComboData(data: CallableValue<PartialNodeLikeData<ComboData>[]>): void {
|
|
283
|
+
this.context.model.updateComboData(isFunction(data) ? data(this.getComboData()) : data);
|
|
1095
284
|
}
|
|
1096
285
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
* Find a node's inner data according to id or function.
|
|
1100
|
-
* @param { ID | Function } condition id or condition function
|
|
1101
|
-
* @returns result node's inner data
|
|
1102
|
-
* @group Data
|
|
1103
|
-
*/
|
|
1104
|
-
public getNodeData(condition: ID | Function): NodeModel | undefined {
|
|
1105
|
-
const conds =
|
|
1106
|
-
isString(condition) || isNumber(condition) ? [condition] : condition;
|
|
1107
|
-
return this.dataController.findData('node', conds)?.[0] as NodeModel;
|
|
1108
|
-
}
|
|
1109
|
-
/**
|
|
1110
|
-
* Find an edge's inner data according to id or function.
|
|
1111
|
-
* @param { ID | Function } condition id or condition function
|
|
1112
|
-
* @returns result edge's inner data
|
|
1113
|
-
* @group Data
|
|
1114
|
-
*/
|
|
1115
|
-
public getEdgeData(condition: ID | Function): EdgeModel | undefined {
|
|
1116
|
-
const conds =
|
|
1117
|
-
isString(condition) || isNumber(condition) || isNumber(condition)
|
|
1118
|
-
? [condition]
|
|
1119
|
-
: condition;
|
|
1120
|
-
return this.dataController.findData('edge', conds)?.[0] as EdgeModel;
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Find an combo's inner data according to id or function.
|
|
1124
|
-
* @param { ID | Function } condition id or condition function
|
|
1125
|
-
* @returns result combo's inner data
|
|
1126
|
-
* @group Data
|
|
1127
|
-
*/
|
|
1128
|
-
public getComboData(condition: ID | Function): ComboModel | undefined {
|
|
1129
|
-
const conds =
|
|
1130
|
-
isString(condition) || isNumber(condition) ? [condition] : condition;
|
|
1131
|
-
return this.dataController.findData('combo', conds)?.[0] as ComboModel;
|
|
1132
|
-
}
|
|
1133
|
-
/**
|
|
1134
|
-
* Get all the nodes' inner data
|
|
1135
|
-
* @returns all nodes' inner data on the graph
|
|
1136
|
-
* @group Data
|
|
1137
|
-
*/
|
|
1138
|
-
public getAllNodesData(): NodeModel[] {
|
|
1139
|
-
return this.dataController.findAllData('node') as NodeModel[];
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Get all the edges' inner data
|
|
1143
|
-
* @returns all edges' inner data on the graph
|
|
1144
|
-
* @group Data
|
|
1145
|
-
*/
|
|
1146
|
-
public getAllEdgesData(): EdgeModel[] {
|
|
1147
|
-
return this.dataController.findAllData('edge') as EdgeModel[];
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Get all the combos' inner data
|
|
1151
|
-
* @returns all combos' inner data on the graph
|
|
1152
|
-
* @group Data
|
|
1153
|
-
*/
|
|
1154
|
-
public getAllCombosData(): ComboModel[] {
|
|
1155
|
-
return this.dataController.findAllData('combo') as ComboModel[];
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Get one-hop edge ids from a start node.
|
|
1159
|
-
* @param nodeId id of the start node
|
|
1160
|
-
* @returns one-hop edges' data array
|
|
1161
|
-
* @group Data
|
|
1162
|
-
*/
|
|
1163
|
-
public getRelatedEdgesData(
|
|
1164
|
-
nodeId: ID,
|
|
1165
|
-
direction: 'in' | 'out' | 'both' = 'both',
|
|
1166
|
-
): EdgeModel[] {
|
|
1167
|
-
return this.dataController.findRelatedEdges(nodeId, direction);
|
|
1168
|
-
}
|
|
1169
|
-
/**
|
|
1170
|
-
* Get nearby edges from a start node using quad-tree collision detection.
|
|
1171
|
-
* @param nodeId id of the start node
|
|
1172
|
-
* @returns nearby edges' data array
|
|
1173
|
-
*/
|
|
1174
|
-
public getNearEdgesData(
|
|
1175
|
-
nodeId: ID,
|
|
1176
|
-
shouldBegin?: (edge: EdgeDisplayModel) => boolean,
|
|
1177
|
-
): EdgeModel[] {
|
|
1178
|
-
const transientItem = this.itemController.getTransientItem(
|
|
1179
|
-
nodeId,
|
|
1180
|
-
) as unknown as Node;
|
|
1181
|
-
const itemMap = this.itemController.getItemMap();
|
|
1182
|
-
return this.dataController.findNearEdges(
|
|
1183
|
-
nodeId,
|
|
1184
|
-
itemMap,
|
|
1185
|
-
transientItem,
|
|
1186
|
-
shouldBegin,
|
|
1187
|
-
);
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Get one-hop node ids from a start node.
|
|
1191
|
-
* @param nodeId id of the start node
|
|
1192
|
-
* @returns one-hop nodes' data array
|
|
1193
|
-
* @group Data
|
|
1194
|
-
*/
|
|
1195
|
-
public getNeighborNodesData(
|
|
1196
|
-
nodeId: ID,
|
|
1197
|
-
direction: 'in' | 'out' | 'both' = 'both',
|
|
1198
|
-
): NodeModel[] {
|
|
1199
|
-
return this.dataController.findNeighborNodes(nodeId, direction);
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Get the children's data of a combo.
|
|
1203
|
-
* @param comboId combo id
|
|
1204
|
-
* @returns children's data array
|
|
1205
|
-
* @group Data
|
|
1206
|
-
*/
|
|
1207
|
-
public getComboChildrenData(comboId: ID): (ComboModel | NodeModel)[] {
|
|
1208
|
-
return this.dataController.findChildren(comboId, 'combo');
|
|
286
|
+
public removeData(id: DataID | ((data: GraphData) => DataID)): void {
|
|
287
|
+
this.context.model.removeData(isFunction(id) ? id(this.getData()) : id);
|
|
1209
288
|
}
|
|
1210
289
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
* @param id
|
|
1214
|
-
* @returns 'node' | 'edge' | 'combo'
|
|
1215
|
-
* @group Data
|
|
1216
|
-
*/
|
|
1217
|
-
public getTypeById(id: ID) {
|
|
1218
|
-
return this.itemController.getItemById(id)?.getType();
|
|
290
|
+
public removeNodeData(ids: ID[] | ((data: NodeData[]) => ID[])): void {
|
|
291
|
+
this.context.model.removeNodeData(isFunction(ids) ? ids(this.getNodeData()) : ids);
|
|
1219
292
|
}
|
|
1220
293
|
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
* @param id item id
|
|
1224
|
-
* @returns display model
|
|
1225
|
-
* @group Data
|
|
1226
|
-
*/
|
|
1227
|
-
protected getDisplayModel(
|
|
1228
|
-
id: ID,
|
|
1229
|
-
): NodeDisplayModel | EdgeDisplayModel | ComboDisplayModel {
|
|
1230
|
-
return this.itemController.findDisplayModel(id);
|
|
294
|
+
public removeEdgeData(ids: ID[] | ((data: EdgeData[]) => ID[])): void {
|
|
295
|
+
this.context.model.removeEdgeData(isFunction(ids) ? ids(this.getEdgeData()) : ids);
|
|
1231
296
|
}
|
|
1232
297
|
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
* @param itemType item type
|
|
1236
|
-
* @param state state name
|
|
1237
|
-
* @param additionalFilter additional filter function
|
|
1238
|
-
* @returns items that is the type and has the state
|
|
1239
|
-
* @group Item
|
|
1240
|
-
*/
|
|
1241
|
-
public findIdByState(
|
|
1242
|
-
itemType: ITEM_TYPE,
|
|
1243
|
-
state: string,
|
|
1244
|
-
value: string | boolean = true,
|
|
1245
|
-
additionalFilter?: (item: NodeModel | EdgeModel | ComboModel) => boolean,
|
|
1246
|
-
): ID[] {
|
|
1247
|
-
let ids = this.itemController.findIdByState(itemType, state, value);
|
|
1248
|
-
if (additionalFilter) {
|
|
1249
|
-
let getDataFunc: any = this.getEdgeData;
|
|
1250
|
-
if (itemType === 'node') getDataFunc = this.getNodeData;
|
|
1251
|
-
else if (itemType === 'combo') getDataFunc = this.getComboData;
|
|
1252
|
-
ids = ids.filter((id) => additionalFilter(getDataFunc(id)));
|
|
1253
|
-
}
|
|
1254
|
-
return ids;
|
|
298
|
+
public removeComboData(ids: ID[] | ((data: ComboData[]) => ID[])): void {
|
|
299
|
+
this.context.model.removeComboData(isFunction(ids) ? ids(this.getComboData()) : ids);
|
|
1255
300
|
}
|
|
1256
|
-
/**
|
|
1257
|
-
* Add one or more node/edge/combo data to the graph.
|
|
1258
|
-
* @param itemType item type
|
|
1259
|
-
* @param model user data
|
|
1260
|
-
* @returns whether success
|
|
1261
|
-
* @group Data
|
|
1262
|
-
*/
|
|
1263
|
-
public addData(
|
|
1264
|
-
itemType: ITEM_TYPE,
|
|
1265
|
-
models:
|
|
1266
|
-
| NodeUserModel
|
|
1267
|
-
| EdgeUserModel
|
|
1268
|
-
| ComboUserModel
|
|
1269
|
-
| NodeUserModel[]
|
|
1270
|
-
| EdgeUserModel[]
|
|
1271
|
-
| ComboUserModel[],
|
|
1272
|
-
):
|
|
1273
|
-
| NodeModel
|
|
1274
|
-
| EdgeModel
|
|
1275
|
-
| ComboModel
|
|
1276
|
-
| NodeModel[]
|
|
1277
|
-
| EdgeModel[]
|
|
1278
|
-
| ComboModel[] {
|
|
1279
|
-
// data controller and item controller subscribe additem in order
|
|
1280
|
-
|
|
1281
|
-
const { graphCore } = this.dataController;
|
|
1282
|
-
const { specification } = this.themeController;
|
|
1283
|
-
const modelArr = isArray(models) ? models : [models];
|
|
1284
|
-
graphCore.once('changed', (event) => {
|
|
1285
|
-
if (!event.changes.length) return;
|
|
1286
|
-
const changes = event.changes;
|
|
1287
|
-
const timingParameters = {
|
|
1288
|
-
type: itemType,
|
|
1289
|
-
action: 'add',
|
|
1290
|
-
models: modelArr,
|
|
1291
|
-
apiName: 'addData',
|
|
1292
|
-
changes,
|
|
1293
|
-
};
|
|
1294
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1295
|
-
this.hooks.itemchange.emit({
|
|
1296
|
-
type: itemType,
|
|
1297
|
-
changes: graphCore.reduceChanges(event.changes),
|
|
1298
|
-
graphCore,
|
|
1299
|
-
theme: specification,
|
|
1300
|
-
});
|
|
1301
|
-
this.emit('afteritemchange', timingParameters);
|
|
1302
|
-
});
|
|
1303
301
|
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
this.hooks.datachange.emit({
|
|
1307
|
-
data,
|
|
1308
|
-
type: 'union',
|
|
1309
|
-
});
|
|
1310
|
-
const dataList = this.dataController.findData(
|
|
1311
|
-
itemType,
|
|
1312
|
-
modelArr.map((model) => model.id),
|
|
1313
|
-
);
|
|
1314
|
-
return isArray(models) ? dataList : dataList[0];
|
|
1315
|
-
}
|
|
1316
|
-
/**
|
|
1317
|
-
* Remove one or more node/edge/combo data from the graph.
|
|
1318
|
-
* @param itemType the type the item(s) to be removed.
|
|
1319
|
-
* @param id the id or the ids' array of the items to be removed.
|
|
1320
|
-
* @returns whether success
|
|
1321
|
-
* @group Data
|
|
1322
|
-
*/
|
|
1323
|
-
public removeData(itemType: ITEM_TYPE, ids: ID | ID[]) {
|
|
1324
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1325
|
-
const data = { nodes: [], edges: [], combos: [] };
|
|
1326
|
-
const { graphCore } = this.dataController;
|
|
1327
|
-
const { specification } = this.themeController;
|
|
1328
|
-
const getItem = itemType === 'edge' ? graphCore.getEdge : graphCore.getNode;
|
|
1329
|
-
const hasItem = itemType === 'edge' ? graphCore.hasEdge : graphCore.hasNode;
|
|
1330
|
-
data[`${itemType}s`] = idArr
|
|
1331
|
-
.map((id) => {
|
|
1332
|
-
if (!hasItem.bind(graphCore)(id)) {
|
|
1333
|
-
console.warn(
|
|
1334
|
-
`The ${itemType} data with id ${id} does not exist. It will be ignored`,
|
|
1335
|
-
);
|
|
1336
|
-
return;
|
|
1337
|
-
}
|
|
1338
|
-
return getItem.bind(graphCore)(id);
|
|
1339
|
-
})
|
|
1340
|
-
.filter(Boolean);
|
|
1341
|
-
graphCore.once('changed', (event) => {
|
|
1342
|
-
if (!event.changes.length) return;
|
|
1343
|
-
const changes = event.changes;
|
|
1344
|
-
const timingParameters = {
|
|
1345
|
-
type: itemType,
|
|
1346
|
-
action: 'remove',
|
|
1347
|
-
ids: idArr,
|
|
1348
|
-
apiName: 'removeData',
|
|
1349
|
-
changes,
|
|
1350
|
-
};
|
|
1351
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1352
|
-
this.hooks.itemchange.emit({
|
|
1353
|
-
type: itemType,
|
|
1354
|
-
changes: event.changes,
|
|
1355
|
-
graphCore,
|
|
1356
|
-
theme: specification,
|
|
1357
|
-
});
|
|
1358
|
-
this.emit('afteritemchange', timingParameters);
|
|
1359
|
-
});
|
|
1360
|
-
this.hooks.datachange.emit({
|
|
1361
|
-
data,
|
|
1362
|
-
type: 'remove',
|
|
1363
|
-
});
|
|
302
|
+
public getElementType(id: ID): ElementType {
|
|
303
|
+
return this.context.model.getElementType(id);
|
|
1364
304
|
}
|
|
1365
|
-
/**
|
|
1366
|
-
* Extends the fields of oldValue and newValue
|
|
1367
|
-
* to make sure they both contain the union set of their original fields.
|
|
1368
|
-
* The missing fields' values are filled using data from displayModel data.
|
|
1369
|
-
* @param changes
|
|
1370
|
-
* @returns
|
|
1371
|
-
*/
|
|
1372
|
-
private extendChanges(changes) {
|
|
1373
|
-
return changes
|
|
1374
|
-
.map((change) => {
|
|
1375
|
-
const { id, propertyName, oldValue, newValue } = change;
|
|
1376
|
-
if (!oldValue || !newValue) return change;
|
|
1377
|
-
if (propertyName) {
|
|
1378
|
-
if (oldValue !== newValue) return change;
|
|
1379
|
-
return false;
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
const displayData = this.getItemById(id).displayModel.data;
|
|
1383
|
-
const oldFields = Object.keys(oldValue);
|
|
1384
|
-
const newFields = Object.keys(newValue);
|
|
1385
|
-
const commonFields = [...new Set([...oldFields, ...newFields])];
|
|
1386
|
-
|
|
1387
|
-
commonFields.forEach((field) => {
|
|
1388
|
-
if (!Object.prototype.hasOwnProperty.call(oldValue, field)) {
|
|
1389
|
-
oldValue[field] = displayData[field];
|
|
1390
|
-
}
|
|
1391
|
-
if (!Object.prototype.hasOwnProperty.call(newValue, field)) {
|
|
1392
|
-
newValue[field] = displayData[field];
|
|
1393
|
-
}
|
|
1394
|
-
});
|
|
1395
305
|
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
!oldValue._isCombo
|
|
1399
|
-
)
|
|
1400
|
-
oldValue.x = 0;
|
|
1401
|
-
if (
|
|
1402
|
-
(oldValue.y === undefined || Number.isNaN(oldValue.x)) &&
|
|
1403
|
-
!oldValue._isCombo
|
|
1404
|
-
)
|
|
1405
|
-
oldValue.y = 0;
|
|
1406
|
-
if (Number.isNaN(newValue.x)) delete newValue.x;
|
|
1407
|
-
if (Number.isNaN(newValue.y)) delete newValue.y;
|
|
1408
|
-
|
|
1409
|
-
if (isEqual(newValue, oldValue)) return false;
|
|
1410
|
-
|
|
1411
|
-
return {
|
|
1412
|
-
...change,
|
|
1413
|
-
newValue,
|
|
1414
|
-
oldValue,
|
|
1415
|
-
};
|
|
1416
|
-
})
|
|
1417
|
-
.filter(Boolean);
|
|
306
|
+
public getRelatedEdgesData(id: ID, direction: EdgeDirection = 'both'): EdgeData[] {
|
|
307
|
+
return this.context.model.getRelatedEdgesData(id, direction);
|
|
1418
308
|
}
|
|
1419
|
-
/**
|
|
1420
|
-
* Update one or more node/edge/combo data on the graph.
|
|
1421
|
-
* @param {ITEM_TYPE} itemType the type the item(s) to be udated.
|
|
1422
|
-
* @param models update configs.
|
|
1423
|
-
* @group Data
|
|
1424
|
-
*/
|
|
1425
|
-
public updateData(
|
|
1426
|
-
itemType: ITEM_TYPE,
|
|
1427
|
-
models:
|
|
1428
|
-
| Partial<NodeUserModel>
|
|
1429
|
-
| Partial<EdgeUserModel>
|
|
1430
|
-
| Partial<
|
|
1431
|
-
| ComboUserModel
|
|
1432
|
-
| Partial<NodeUserModel>[]
|
|
1433
|
-
| Partial<EdgeUserModel>[]
|
|
1434
|
-
| Partial<ComboUserModel>[]
|
|
1435
|
-
>,
|
|
1436
|
-
):
|
|
1437
|
-
| NodeModel
|
|
1438
|
-
| EdgeModel
|
|
1439
|
-
| ComboModel
|
|
1440
|
-
| NodeModel[]
|
|
1441
|
-
| EdgeModel[]
|
|
1442
|
-
| ComboModel[] {
|
|
1443
|
-
const modelArr = isArray(models) ? models : [models];
|
|
1444
|
-
const data = { nodes: [], edges: [], combos: [] };
|
|
1445
|
-
data[`${itemType}s`] = modelArr;
|
|
1446
|
-
|
|
1447
|
-
const { graphCore } = this.dataController;
|
|
1448
|
-
const { specification } = this.themeController;
|
|
1449
|
-
graphCore.once('changed', (event) => {
|
|
1450
|
-
const changes = this.extendChanges(cloneJSON(event.changes));
|
|
1451
|
-
const timingParameters = {
|
|
1452
|
-
type: itemType,
|
|
1453
|
-
action: 'update',
|
|
1454
|
-
models: modelArr,
|
|
1455
|
-
apiName: 'updateData',
|
|
1456
|
-
changes,
|
|
1457
|
-
};
|
|
1458
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1459
|
-
this.hooks.itemchange.emit({
|
|
1460
|
-
type: itemType,
|
|
1461
|
-
changes: event.changes,
|
|
1462
|
-
graphCore,
|
|
1463
|
-
theme: specification,
|
|
1464
|
-
});
|
|
1465
|
-
this.emit('afteritemchange', timingParameters);
|
|
1466
|
-
});
|
|
1467
309
|
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
type: 'update',
|
|
1471
|
-
});
|
|
1472
|
-
const dataList = this.dataController.findData(
|
|
1473
|
-
itemType,
|
|
1474
|
-
modelArr.map((model) => model.id),
|
|
1475
|
-
);
|
|
1476
|
-
return isArray(models) ? dataList : dataList[0];
|
|
310
|
+
public getNeighborNodesData(id: ID): NodeData[] {
|
|
311
|
+
return this.context.model.getNeighborNodesData(id);
|
|
1477
312
|
}
|
|
1478
313
|
|
|
1479
314
|
/**
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
1482
|
-
*
|
|
1483
|
-
* @param
|
|
1484
|
-
* @param
|
|
1485
|
-
* @
|
|
1486
|
-
* @
|
|
315
|
+
* <zh/> 获取节点或 combo 的祖先元素数据
|
|
316
|
+
*
|
|
317
|
+
* <en/> Get the ancestor element data of the node or combo
|
|
318
|
+
* @param id - <zh/> 节点或 combo ID | <en/> node or combo ID
|
|
319
|
+
* @param hierarchy - <zh/> 指定树图层级关系还是 combo 层级关系 | <en/> specify tree or combo hierarchy relationship
|
|
320
|
+
* @returns <zh/> 祖先元素数据 | <en/> ancestor element data
|
|
321
|
+
* @description
|
|
322
|
+
* <zh/> 数组中的顺序是从父节点到祖先节点
|
|
323
|
+
*
|
|
324
|
+
* <en/> The order in the array is from the parent node to the ancestor node
|
|
1487
325
|
*/
|
|
1488
|
-
public
|
|
1489
|
-
|
|
1490
|
-
| Partial<NodeUserModel>
|
|
1491
|
-
| Partial<
|
|
1492
|
-
ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
|
|
1493
|
-
>,
|
|
1494
|
-
upsertAncestors?: boolean,
|
|
1495
|
-
disableAnimate = false,
|
|
1496
|
-
callback?: (
|
|
1497
|
-
model: NodeModel | EdgeModel | ComboModel,
|
|
1498
|
-
canceled?: boolean,
|
|
1499
|
-
) => void,
|
|
1500
|
-
) {
|
|
1501
|
-
return this.updatePosition(
|
|
1502
|
-
'node',
|
|
1503
|
-
models,
|
|
1504
|
-
upsertAncestors,
|
|
1505
|
-
disableAnimate,
|
|
1506
|
-
callback,
|
|
1507
|
-
);
|
|
326
|
+
public getAncestorsData(id: ID, hierarchy: HierarchyKey): NodeLikeData[] {
|
|
327
|
+
return this.context.model.getAncestorsData(id, hierarchy);
|
|
1508
328
|
}
|
|
1509
329
|
|
|
1510
330
|
/**
|
|
1511
|
-
*
|
|
1512
|
-
*
|
|
1513
|
-
*
|
|
1514
|
-
* @param
|
|
1515
|
-
* @param
|
|
1516
|
-
* @
|
|
1517
|
-
* @param callback callback function after update combos done.
|
|
1518
|
-
* @group Data
|
|
331
|
+
* <zh/> 获取节点或 combo 的父元素数据
|
|
332
|
+
*
|
|
333
|
+
* <en/> Get the parent element data of the node or combo
|
|
334
|
+
* @param id - <zh/> 节点或 combo ID | <en/> node or combo ID
|
|
335
|
+
* @param hierarchy - <zh/> 指定树图层级关系还是 combo 层级关系 | <en/> specify tree or combo hierarchy relationship
|
|
336
|
+
* @returns <zh/> 父元素数据 | <en/> parent element data
|
|
1519
337
|
*/
|
|
1520
|
-
public
|
|
1521
|
-
|
|
1522
|
-
| Partial<NodeUserModel>
|
|
1523
|
-
| Partial<
|
|
1524
|
-
ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
|
|
1525
|
-
>,
|
|
1526
|
-
upsertAncestors?: boolean,
|
|
1527
|
-
disableAnimate = false,
|
|
1528
|
-
callback?: (model: NodeModel | EdgeModel | ComboModel) => void,
|
|
1529
|
-
) {
|
|
1530
|
-
return this.updatePosition(
|
|
1531
|
-
'combo',
|
|
1532
|
-
models,
|
|
1533
|
-
upsertAncestors,
|
|
1534
|
-
disableAnimate,
|
|
1535
|
-
callback,
|
|
1536
|
-
);
|
|
338
|
+
public getParentData(id: ID, hierarchy: HierarchyKey): NodeLikeData | undefined {
|
|
339
|
+
return this.context.model.getParentData(id, hierarchy);
|
|
1537
340
|
}
|
|
1538
341
|
|
|
1539
342
|
/**
|
|
1540
|
-
*
|
|
343
|
+
* <zh/> 获取节点或 combo 的子元素数据
|
|
344
|
+
*
|
|
345
|
+
* <en/> Get the child element data of the node or combo
|
|
346
|
+
* @param id - <zh/> 节点或 combo ID | <en/> node or combo ID
|
|
347
|
+
* @returns <zh/> 子元素数据 | <en/> child element data
|
|
1541
348
|
*/
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
!this.pluginController.hasPlugin('history')
|
|
1546
|
-
) {
|
|
1547
|
-
console.error('The history plugin is not loaded or initialized.');
|
|
1548
|
-
return;
|
|
1549
|
-
}
|
|
1550
|
-
return this.pluginController.getPlugin('history') as History;
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
private updatePosition(
|
|
1554
|
-
type: 'node' | 'combo',
|
|
1555
|
-
models:
|
|
1556
|
-
| Partial<NodeUserModel>
|
|
1557
|
-
| Partial<
|
|
1558
|
-
ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
|
|
1559
|
-
>,
|
|
1560
|
-
upsertAncestors?: boolean,
|
|
1561
|
-
disableAnimate = false,
|
|
1562
|
-
callback?: (
|
|
1563
|
-
model: NodeModel | EdgeModel | ComboModel,
|
|
1564
|
-
canceled?: boolean,
|
|
1565
|
-
) => void,
|
|
1566
|
-
) {
|
|
1567
|
-
const modelArr = isArray(models) ? models : [models];
|
|
1568
|
-
const { graphCore } = this.dataController;
|
|
1569
|
-
const { specification } = this.themeController;
|
|
1570
|
-
graphCore?.once('changed', (event) => {
|
|
1571
|
-
if (!event.changes.length) return;
|
|
1572
|
-
const changes = event.changes.filter(
|
|
1573
|
-
(change) => !isEqual(change.newValue, change.oldValue),
|
|
1574
|
-
);
|
|
1575
|
-
const timingParameters = {
|
|
1576
|
-
type,
|
|
1577
|
-
action: 'updatePosition',
|
|
1578
|
-
upsertAncestors,
|
|
1579
|
-
models: modelArr,
|
|
1580
|
-
apiName: 'updatePosition',
|
|
1581
|
-
changes,
|
|
1582
|
-
};
|
|
1583
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1584
|
-
this.hooks.itemchange.emit({
|
|
1585
|
-
type,
|
|
1586
|
-
changes: event.changes,
|
|
1587
|
-
graphCore,
|
|
1588
|
-
theme: specification,
|
|
1589
|
-
upsertAncestors,
|
|
1590
|
-
action: 'updatePosition',
|
|
1591
|
-
animate: !disableAnimate,
|
|
1592
|
-
callback,
|
|
1593
|
-
});
|
|
1594
|
-
this.emit('afteritemchange', timingParameters);
|
|
1595
|
-
});
|
|
349
|
+
public getChildrenData(id: ID): NodeLikeData[] {
|
|
350
|
+
return this.context.model.getChildrenData(id);
|
|
351
|
+
}
|
|
1596
352
|
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
},
|
|
1603
|
-
type: 'updatePosition',
|
|
1604
|
-
});
|
|
1605
|
-
const dataList = this.dataController.findData(
|
|
1606
|
-
type,
|
|
1607
|
-
modelArr.map((model) => model.id),
|
|
1608
|
-
);
|
|
1609
|
-
return isArray(models) ? dataList : dataList[0];
|
|
353
|
+
public getElementDataByState(elementType: 'node', state: State): NodeData[];
|
|
354
|
+
public getElementDataByState(elementType: 'edge', state: State): EdgeData[];
|
|
355
|
+
public getElementDataByState(elementType: 'combo', state: State): ComboData[];
|
|
356
|
+
public getElementDataByState(elementType: ElementType, state: State): ElementDatum[] {
|
|
357
|
+
return this.context.model.getElementDataByState(elementType, state);
|
|
1610
358
|
}
|
|
1611
359
|
|
|
1612
|
-
private
|
|
1613
|
-
|
|
1614
|
-
const groupedByVisible = groupBy(objs, 'visible');
|
|
360
|
+
private createCanvas() {
|
|
361
|
+
if (this.context.canvas) return this.context.canvas;
|
|
1615
362
|
|
|
1616
|
-
const
|
|
1617
|
-
for (const visible in groupedByVisible) {
|
|
1618
|
-
values.push({
|
|
1619
|
-
ids: map(groupedByVisible[visible], (item) => item.id),
|
|
1620
|
-
visible: visible === 'true',
|
|
1621
|
-
});
|
|
1622
|
-
}
|
|
1623
|
-
return values;
|
|
1624
|
-
}
|
|
363
|
+
const { container = 'container', width, height, renderer, background } = this.options;
|
|
1625
364
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
* @returns
|
|
1630
|
-
* @group Item
|
|
1631
|
-
*/
|
|
1632
|
-
public showItem(
|
|
1633
|
-
ids: ID | ID[],
|
|
1634
|
-
options?: {
|
|
1635
|
-
disableAnimate?: boolean;
|
|
1636
|
-
shapeIds?: string | string[];
|
|
1637
|
-
},
|
|
1638
|
-
) {
|
|
1639
|
-
const { disableAnimate = false, shapeIds } = options || {};
|
|
1640
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1641
|
-
if (isEmpty(idArr)) return;
|
|
1642
|
-
|
|
1643
|
-
let changes;
|
|
1644
|
-
if (shapeIds?.length) {
|
|
1645
|
-
const shapeIdsArr = isArray(shapeIds) ? shapeIds : [shapeIds];
|
|
1646
|
-
changes = {
|
|
1647
|
-
newValue: [{ ids: idArr, visible: true, shapeIds: shapeIdsArr }],
|
|
1648
|
-
oldValue: this.getItemPreviousVisibility(idArr),
|
|
1649
|
-
};
|
|
1650
|
-
this.hooks.itemvisibilitychange.emit({
|
|
1651
|
-
ids: idArr as ID[],
|
|
1652
|
-
value: true,
|
|
1653
|
-
graphCore: this.dataController.graphCore,
|
|
1654
|
-
animate: !disableAnimate,
|
|
1655
|
-
shapeIds: shapeIdsArr,
|
|
1656
|
-
});
|
|
365
|
+
if (container instanceof Canvas) {
|
|
366
|
+
this.context.canvas = container;
|
|
367
|
+
container.setBackground(background);
|
|
1657
368
|
} else {
|
|
1658
|
-
|
|
1659
|
-
newValue: [{ ids: idArr, visible: true }],
|
|
1660
|
-
oldValue: this.getItemPreviousVisibility(idArr),
|
|
1661
|
-
};
|
|
1662
|
-
this.hooks.itemvisibilitychange.emit({
|
|
1663
|
-
ids: idArr as ID[],
|
|
1664
|
-
value: true,
|
|
1665
|
-
graphCore: this.dataController.graphCore,
|
|
1666
|
-
animate: !disableAnimate,
|
|
1667
|
-
});
|
|
1668
|
-
}
|
|
369
|
+
const $container = isString(container) ? document.getElementById(container!) : container;
|
|
1669
370
|
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
apiName: 'showItem',
|
|
1676
|
-
changes,
|
|
1677
|
-
});
|
|
1678
|
-
}
|
|
1679
|
-
/**
|
|
1680
|
-
* Hide the item(s).
|
|
1681
|
-
* @param id the id for the item to be hidden.
|
|
1682
|
-
* @param disableAnimate whether disable the hidden animations.
|
|
1683
|
-
* @param keepKeyShape whether keep the keyShape.
|
|
1684
|
-
* @param keepRelated whether keep the related nodes for edge.
|
|
1685
|
-
* @returns
|
|
1686
|
-
* @group Item
|
|
1687
|
-
*/
|
|
1688
|
-
public hideItem(
|
|
1689
|
-
ids: ID | ID[],
|
|
1690
|
-
options?: {
|
|
1691
|
-
disableAnimate?: boolean;
|
|
1692
|
-
keepKeyShape?: boolean;
|
|
1693
|
-
keepRelated?: boolean;
|
|
1694
|
-
shapeIds?: string[];
|
|
1695
|
-
},
|
|
1696
|
-
) {
|
|
1697
|
-
const {
|
|
1698
|
-
disableAnimate = false,
|
|
1699
|
-
keepKeyShape = false,
|
|
1700
|
-
keepRelated = false,
|
|
1701
|
-
shapeIds,
|
|
1702
|
-
} = options || {};
|
|
1703
|
-
const idArr: ID[] = isArray(ids) ? ids : [ids];
|
|
1704
|
-
if (isEmpty(idArr)) return;
|
|
1705
|
-
|
|
1706
|
-
let changes;
|
|
1707
|
-
if (shapeIds?.length) {
|
|
1708
|
-
const shapeIdsArr = isArray(shapeIds) ? shapeIds : [shapeIds];
|
|
1709
|
-
changes = {
|
|
1710
|
-
newValue: [{ ids: idArr, visible: false, shapeIds: shapeIdsArr }],
|
|
1711
|
-
oldValue: this.getItemPreviousVisibility(idArr),
|
|
1712
|
-
};
|
|
1713
|
-
this.hooks.itemvisibilitychange.emit({
|
|
1714
|
-
ids: idArr,
|
|
1715
|
-
value: false,
|
|
1716
|
-
graphCore: this.dataController.graphCore,
|
|
1717
|
-
animate: !disableAnimate,
|
|
1718
|
-
shapeIds: shapeIdsArr,
|
|
1719
|
-
});
|
|
1720
|
-
} else {
|
|
1721
|
-
changes = {
|
|
1722
|
-
newValue: [{ ids: idArr, visible: false }],
|
|
1723
|
-
oldValue: this.getItemPreviousVisibility(idArr),
|
|
1724
|
-
};
|
|
1725
|
-
this.hooks.itemvisibilitychange.emit({
|
|
1726
|
-
ids: idArr,
|
|
1727
|
-
value: false,
|
|
1728
|
-
graphCore: this.dataController.graphCore,
|
|
1729
|
-
animate: !disableAnimate,
|
|
1730
|
-
keepKeyShape,
|
|
1731
|
-
keepRelated,
|
|
371
|
+
this.context.canvas = new Canvas({
|
|
372
|
+
container: $container!,
|
|
373
|
+
width,
|
|
374
|
+
height,
|
|
375
|
+
renderer,
|
|
1732
376
|
});
|
|
1733
377
|
}
|
|
1734
378
|
|
|
1735
|
-
this.
|
|
1736
|
-
ids: idArr,
|
|
1737
|
-
value: false,
|
|
1738
|
-
animate: !disableAnimate,
|
|
1739
|
-
action: 'updateVisibility',
|
|
1740
|
-
apiName: 'hideItem',
|
|
1741
|
-
keepKeyShape,
|
|
1742
|
-
changes,
|
|
1743
|
-
});
|
|
379
|
+
return this.context.canvas;
|
|
1744
380
|
}
|
|
1745
381
|
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1754
|
-
this.hooks.itemzindexchange.emit({
|
|
1755
|
-
ids: idArr as ID[],
|
|
1756
|
-
action: 'front',
|
|
1757
|
-
graphCore: this.dataController.graphCore,
|
|
1758
|
-
});
|
|
1759
|
-
this.emit('afteritemzindexchange', {
|
|
1760
|
-
ids: idArr,
|
|
1761
|
-
action: 'front',
|
|
1762
|
-
apiName: 'frontItem',
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1765
|
-
/**
|
|
1766
|
-
* Make the item(s) to the back.
|
|
1767
|
-
* @param ids
|
|
1768
|
-
* @returns
|
|
1769
|
-
* @group Item
|
|
1770
|
-
*/
|
|
1771
|
-
public backItem(ids: ID | ID[]) {
|
|
1772
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1773
|
-
this.hooks.itemzindexchange.emit({
|
|
1774
|
-
ids: idArr as ID[],
|
|
1775
|
-
action: 'back',
|
|
1776
|
-
graphCore: this.dataController.graphCore,
|
|
1777
|
-
});
|
|
1778
|
-
this.emit('afteritemzindexchange', {
|
|
1779
|
-
ids: idArr,
|
|
1780
|
-
action: 'back',
|
|
1781
|
-
apiName: 'backItem',
|
|
1782
|
-
});
|
|
382
|
+
private createRuntime() {
|
|
383
|
+
this.context.options = this.options;
|
|
384
|
+
if (!this.context.plugin) this.context.plugin = new PluginController(this.context);
|
|
385
|
+
if (!this.context.viewport) this.context.viewport = new ViewportController(this.context);
|
|
386
|
+
if (!this.context.element) this.context.element = new ElementController(this.context);
|
|
387
|
+
if (!this.context.layout) this.context.layout = new LayoutController(this.context);
|
|
388
|
+
if (!this.context.behavior) this.context.behavior = new BehaviorController(this.context);
|
|
1783
389
|
}
|
|
1784
390
|
|
|
1785
|
-
private
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
const { ids, states } = stateOption;
|
|
1791
|
-
const idArr = Array.isArray(ids) ? ids : [ids];
|
|
1792
|
-
const stateArr = Array.isArray(states) ? states : [states];
|
|
1793
|
-
if (isEmpty(idArr)) return;
|
|
1794
|
-
return idArr.flatMap((id) => {
|
|
1795
|
-
return stateArr.map((state) => ({
|
|
1796
|
-
ids: id,
|
|
1797
|
-
states: state,
|
|
1798
|
-
value: this.getItemState(id, state),
|
|
1799
|
-
}));
|
|
1800
|
-
});
|
|
1801
|
-
}
|
|
1802
|
-
/**
|
|
1803
|
-
* Set state for the item.
|
|
1804
|
-
* @param item the item to be set
|
|
1805
|
-
* @param state the state name
|
|
1806
|
-
* @param value state value
|
|
1807
|
-
* @returns
|
|
1808
|
-
* @group Item
|
|
1809
|
-
*/
|
|
1810
|
-
public setItemState(
|
|
1811
|
-
ids: ID | ID[],
|
|
1812
|
-
states: string | string[],
|
|
1813
|
-
value: boolean,
|
|
1814
|
-
) {
|
|
1815
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1816
|
-
if (ids === undefined || !idArr.length) return;
|
|
1817
|
-
const stateArr = isArray(states) ? states : [states];
|
|
1818
|
-
const stateOption = { ids: idArr, states: stateArr, value };
|
|
1819
|
-
const changes = {
|
|
1820
|
-
newValue: [stateOption],
|
|
1821
|
-
oldValue: this.getItemPreviousStates(stateOption),
|
|
1822
|
-
};
|
|
1823
|
-
this.hooks.itemstatechange.emit({
|
|
1824
|
-
ids: idArr as ID[],
|
|
1825
|
-
states: stateArr as string[],
|
|
1826
|
-
value,
|
|
1827
|
-
});
|
|
1828
|
-
this.emit('afteritemstatechange', {
|
|
1829
|
-
ids: idArr,
|
|
1830
|
-
itemTypes: idArr.map((id) => this.getTypeById(id)),
|
|
1831
|
-
states,
|
|
1832
|
-
value,
|
|
1833
|
-
action: 'updateState',
|
|
1834
|
-
apiName: 'setItemState',
|
|
1835
|
-
changes,
|
|
1836
|
-
});
|
|
1837
|
-
}
|
|
1838
|
-
/**
|
|
1839
|
-
* Get the state value for an item.
|
|
1840
|
-
* @param id the id for the item
|
|
1841
|
-
* @param states the state name
|
|
1842
|
-
* @returns {boolean} the state value
|
|
1843
|
-
* @group Item
|
|
1844
|
-
*/
|
|
1845
|
-
public getItemState(id: ID, state: string) {
|
|
1846
|
-
return this.itemController.getItemState(id, state);
|
|
391
|
+
private async prepare(): Promise<void> {
|
|
392
|
+
if (this.destroyed) throw new Error('Graph has been destroyed');
|
|
393
|
+
|
|
394
|
+
await this.createCanvas().init();
|
|
395
|
+
this.createRuntime();
|
|
1847
396
|
}
|
|
1848
397
|
|
|
1849
398
|
/**
|
|
1850
|
-
*
|
|
1851
|
-
*
|
|
1852
|
-
*
|
|
1853
|
-
* @
|
|
399
|
+
* <zh/> 执行渲染
|
|
400
|
+
*
|
|
401
|
+
* <en/> Render
|
|
402
|
+
* @description
|
|
403
|
+
* <zh/> 此过程会执行数据更新、绘制元素、执行布局
|
|
404
|
+
*
|
|
405
|
+
* <en/> This process will execute data update, element rendering, and layout execution
|
|
1854
406
|
*/
|
|
1855
|
-
public
|
|
1856
|
-
|
|
407
|
+
public async render(): Promise<void> {
|
|
408
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_RENDER));
|
|
409
|
+
await this.prepare();
|
|
410
|
+
await Promise.all([this.context.element?.draw(), this.context.layout?.layout()]);
|
|
411
|
+
await this.autoFit();
|
|
412
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_RENDER));
|
|
1857
413
|
}
|
|
1858
414
|
|
|
1859
415
|
/**
|
|
1860
|
-
*
|
|
1861
|
-
*
|
|
1862
|
-
*
|
|
1863
|
-
* @returns
|
|
1864
|
-
* @group Item
|
|
416
|
+
* <zh/> 绘制元素
|
|
417
|
+
*
|
|
418
|
+
* <en/> Draw elements
|
|
419
|
+
* @returns <zh/> 渲染结果 | <en/> draw result
|
|
1865
420
|
*/
|
|
1866
|
-
public
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
const changes = {
|
|
1870
|
-
newValue: [stateOptions],
|
|
1871
|
-
oldValue: this.getItemPreviousStates(stateOptions),
|
|
1872
|
-
};
|
|
1873
|
-
this.hooks.itemstatechange.emit({
|
|
1874
|
-
ids: idArr as ID[],
|
|
1875
|
-
states,
|
|
1876
|
-
value: false,
|
|
1877
|
-
});
|
|
1878
|
-
this.emit('afteritemstatechange', {
|
|
1879
|
-
ids: idArr,
|
|
1880
|
-
states,
|
|
1881
|
-
value: false,
|
|
1882
|
-
action: 'updateState',
|
|
1883
|
-
apiName: 'clearItemState',
|
|
1884
|
-
changes,
|
|
1885
|
-
});
|
|
421
|
+
public async draw(): Promise<void> {
|
|
422
|
+
await this.prepare();
|
|
423
|
+
return this.context.element!.draw();
|
|
1886
424
|
}
|
|
1887
425
|
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
* @param id the id for the node / edge / combo, undefined for the whole graph
|
|
1891
|
-
* @returns rendering bounding box. returns false if the item is not exist
|
|
1892
|
-
* @group Item
|
|
1893
|
-
*/
|
|
1894
|
-
public getRenderBBox(
|
|
1895
|
-
id: ID | undefined,
|
|
1896
|
-
onlyKeyShape = false,
|
|
1897
|
-
isTransient = false,
|
|
1898
|
-
): AABB | false {
|
|
1899
|
-
if (!id) return this.canvas.getRoot().getRenderBounds();
|
|
1900
|
-
return this.itemController.getItemBBox(id, onlyKeyShape, isTransient);
|
|
426
|
+
public layout(): Promise<void> {
|
|
427
|
+
return this.context.layout!.layout();
|
|
1901
428
|
}
|
|
1902
429
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
* @param id the id for the node / edge / combo
|
|
1906
|
-
* @returns visibility for the item, false for invisible or unexistence for the item
|
|
1907
|
-
* @group Item
|
|
1908
|
-
*/
|
|
1909
|
-
public getItemVisible(id: ID) {
|
|
1910
|
-
return this.itemController.getItemVisible(id);
|
|
430
|
+
public stopLayout() {
|
|
431
|
+
return this.context.layout!.stopLayout();
|
|
1911
432
|
}
|
|
1912
433
|
|
|
1913
434
|
/**
|
|
1914
|
-
*
|
|
1915
|
-
*
|
|
1916
|
-
*
|
|
435
|
+
* <zh/> 清空画布元素
|
|
436
|
+
*
|
|
437
|
+
* <en/> Clear canvas elements
|
|
1917
438
|
*/
|
|
1918
|
-
public
|
|
1919
|
-
|
|
439
|
+
public async clear(): Promise<void> {
|
|
440
|
+
this.context.model.setData({});
|
|
441
|
+
await this.draw();
|
|
1920
442
|
}
|
|
1921
443
|
|
|
1922
|
-
|
|
444
|
+
public destroy(): void {
|
|
445
|
+
const { layout, element, model, canvas, behavior, plugin } = this.context;
|
|
446
|
+
layout?.destroy();
|
|
447
|
+
element?.destroy();
|
|
448
|
+
model.destroy();
|
|
449
|
+
canvas?.destroy();
|
|
450
|
+
behavior?.destroy();
|
|
451
|
+
plugin?.destroy();
|
|
452
|
+
this.options = {};
|
|
453
|
+
// @ts-expect-error force delete
|
|
454
|
+
delete this.context;
|
|
1923
455
|
|
|
1924
|
-
|
|
1925
|
-
* Add a new combo to the graph, and update the structure of the existed child in childrenIds to be the children of the new combo.
|
|
1926
|
-
* Different from addData with combo type, this API update the succeeds' combo tree structures in the same time.
|
|
1927
|
-
* @param model combo user data.
|
|
1928
|
-
* @param childrenIds the ids of the children nodes / combos to move into the new combo.
|
|
1929
|
-
* @returns whether success
|
|
1930
|
-
* @group Combo
|
|
1931
|
-
*/
|
|
1932
|
-
public addCombo(model: ComboUserModel, childrenIds: ID[]): ComboModel {
|
|
1933
|
-
const { graphCore } = this.dataController;
|
|
1934
|
-
const { specification } = this.themeController;
|
|
1935
|
-
graphCore.once('changed', (event) => {
|
|
1936
|
-
if (!event.changes.length) return;
|
|
1937
|
-
const changes = event.changes;
|
|
1938
|
-
const timingParameters = {
|
|
1939
|
-
type: 'combo',
|
|
1940
|
-
action: 'add',
|
|
1941
|
-
models: [model],
|
|
1942
|
-
apiName: 'addCombo',
|
|
1943
|
-
changes,
|
|
1944
|
-
};
|
|
1945
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1946
|
-
this.hooks.itemchange.emit({
|
|
1947
|
-
type: 'combo',
|
|
1948
|
-
changes: graphCore.reduceChanges(event.changes),
|
|
1949
|
-
graphCore,
|
|
1950
|
-
theme: specification,
|
|
1951
|
-
});
|
|
1952
|
-
this.emit('afteritemchange', timingParameters);
|
|
1953
|
-
});
|
|
456
|
+
window.removeEventListener('resize', this.onResize);
|
|
1954
457
|
|
|
1955
|
-
|
|
1956
|
-
nodes: [],
|
|
1957
|
-
edges: [],
|
|
1958
|
-
combos: [
|
|
1959
|
-
{
|
|
1960
|
-
...model,
|
|
1961
|
-
data: {
|
|
1962
|
-
...model.data,
|
|
1963
|
-
_children: childrenIds,
|
|
1964
|
-
},
|
|
1965
|
-
},
|
|
1966
|
-
],
|
|
1967
|
-
};
|
|
1968
|
-
this.hooks.datachange.emit({
|
|
1969
|
-
data,
|
|
1970
|
-
type: 'addCombo',
|
|
1971
|
-
});
|
|
1972
|
-
return this.dataController.findData('combo', [model.id])[0] as ComboModel;
|
|
458
|
+
this.destroyed = true;
|
|
1973
459
|
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
* @group Combo
|
|
1978
|
-
*/
|
|
1979
|
-
public collapseCombo(comboIds: ID | ID[]) {
|
|
1980
|
-
const ids = isArray(comboIds) ? comboIds : [comboIds];
|
|
1981
|
-
this.executeWithNoStack(() => {
|
|
1982
|
-
this.updateData(
|
|
1983
|
-
'combo',
|
|
1984
|
-
ids.map((id) => ({ id, data: { collapsed: true } })),
|
|
1985
|
-
);
|
|
1986
|
-
});
|
|
1987
|
-
this.emit('aftercollapsecombo', {
|
|
1988
|
-
type: 'combo',
|
|
1989
|
-
action: 'collapseCombo',
|
|
1990
|
-
ids: comboIds,
|
|
1991
|
-
apiName: 'collapseCombo',
|
|
1992
|
-
});
|
|
460
|
+
|
|
461
|
+
public getCanvas(): Canvas {
|
|
462
|
+
return this.context.canvas;
|
|
1993
463
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
this.
|
|
2002
|
-
|
|
2003
|
-
'combo',
|
|
2004
|
-
ids.map((id) => ({ id, data: { collapsed: false } })),
|
|
2005
|
-
);
|
|
2006
|
-
});
|
|
2007
|
-
this.emit('afterexpandcombo', {
|
|
2008
|
-
type: 'combo',
|
|
2009
|
-
action: 'expandCombo',
|
|
2010
|
-
ids: comboIds,
|
|
2011
|
-
apiName: 'expandCombo',
|
|
2012
|
-
});
|
|
464
|
+
|
|
465
|
+
public resize(): void;
|
|
466
|
+
public resize(width: number, height: number): void;
|
|
467
|
+
public resize(width?: number, height?: number): void {
|
|
468
|
+
const size: Vector2 = !width || !height ? sizeOf(this.context.canvas!.getContainer()!) : [width, height];
|
|
469
|
+
if (isEqual(size, this.getSize())) return;
|
|
470
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_SIZE_CHANGE, { size }));
|
|
471
|
+
this.context.canvas.resize(...size);
|
|
472
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_SIZE_CHANGE, { size }));
|
|
2013
473
|
}
|
|
2014
474
|
|
|
2015
475
|
/**
|
|
2016
|
-
*
|
|
2017
|
-
*
|
|
2018
|
-
*
|
|
2019
|
-
* @param
|
|
2020
|
-
* @param
|
|
2021
|
-
* @param dy the distance alone y-axis to move the combo.
|
|
2022
|
-
* @param upsertAncestors whether update the ancestors in the combo tree.
|
|
2023
|
-
* @param callback callback function after move combo done.
|
|
2024
|
-
* @group Combo
|
|
476
|
+
* <zh/> 将图缩放至合适大小并平移至视口中心
|
|
477
|
+
*
|
|
478
|
+
* <en/> Zoom the graph to fit the viewport and move it to the center of the viewport
|
|
479
|
+
* @param options - <zh/> 适配配置 | <en/> fit options
|
|
480
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
2025
481
|
*/
|
|
2026
|
-
public
|
|
2027
|
-
|
|
2028
|
-
dx: number,
|
|
2029
|
-
dy: number,
|
|
2030
|
-
upsertAncestors?: boolean,
|
|
2031
|
-
callback?: (
|
|
2032
|
-
model: NodeModel | EdgeModel | ComboModel,
|
|
2033
|
-
canceled?: boolean,
|
|
2034
|
-
) => void,
|
|
2035
|
-
): ComboModel[] {
|
|
2036
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
2037
|
-
const { graphCore } = this.dataController;
|
|
2038
|
-
const { specification } = this.themeController;
|
|
2039
|
-
graphCore.once('changed', (event) => {
|
|
2040
|
-
if (!event.changes.length) return;
|
|
2041
|
-
const changes = this.extendChanges(clone(event.changes));
|
|
2042
|
-
const timingParameters = {
|
|
2043
|
-
type: 'combo',
|
|
2044
|
-
ids: idArr,
|
|
2045
|
-
dx,
|
|
2046
|
-
dy,
|
|
2047
|
-
action: 'updatePosition',
|
|
2048
|
-
upsertAncestors,
|
|
2049
|
-
apiName: 'moveCombo',
|
|
2050
|
-
changes,
|
|
2051
|
-
};
|
|
2052
|
-
this.emit('beforeitemchange', timingParameters);
|
|
2053
|
-
this.hooks.itemchange.emit({
|
|
2054
|
-
type: 'combo',
|
|
2055
|
-
changes: event.changes,
|
|
2056
|
-
graphCore,
|
|
2057
|
-
theme: specification,
|
|
2058
|
-
upsertAncestors,
|
|
2059
|
-
action: 'updatePosition',
|
|
2060
|
-
callback,
|
|
2061
|
-
});
|
|
2062
|
-
this.emit('afteritemchange', timingParameters);
|
|
2063
|
-
});
|
|
2064
|
-
|
|
2065
|
-
this.hooks.datachange.emit({
|
|
2066
|
-
data: {
|
|
2067
|
-
nodes: [],
|
|
2068
|
-
edges: [],
|
|
2069
|
-
combos: idArr.map((id) => ({ id, data: { dx, dy } })),
|
|
2070
|
-
},
|
|
2071
|
-
type: 'moveCombo',
|
|
2072
|
-
});
|
|
2073
|
-
return this.dataController.findData('combo', idArr) as ComboModel[];
|
|
482
|
+
public async fitView(options?: FitViewOptions, animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
483
|
+
await this.context.viewport?.fitView(options, animation);
|
|
2074
484
|
}
|
|
2075
485
|
|
|
2076
|
-
// ===== layout =====
|
|
2077
486
|
/**
|
|
2078
|
-
*
|
|
487
|
+
* <zh/> 将图平移至视口中心
|
|
488
|
+
*
|
|
489
|
+
* <en/> Move the graph to the center of the viewport
|
|
490
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
2079
491
|
*/
|
|
2080
|
-
public async
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
) {
|
|
2084
|
-
this.emit('beforelayout');
|
|
2085
|
-
const { graphCore } = this.dataController;
|
|
2086
|
-
const formattedOptions = {
|
|
2087
|
-
...this.getSpecification().layout,
|
|
2088
|
-
...options,
|
|
2089
|
-
} as LayoutOptions;
|
|
2090
|
-
|
|
2091
|
-
this.updateSpecification({ layout: formattedOptions });
|
|
2092
|
-
|
|
2093
|
-
const layoutUnset =
|
|
2094
|
-
(!options && !this.getSpecification().layout) ||
|
|
2095
|
-
!Object.keys(formattedOptions).length;
|
|
2096
|
-
if (layoutUnset) {
|
|
2097
|
-
const nodes = graphCore.getAllNodes();
|
|
2098
|
-
if (nodes.every((node) => isNil(node.data.x) && isNil(node.data.y))) {
|
|
2099
|
-
// Use `grid` layout as default when x/y of each node is unset.
|
|
2100
|
-
(formattedOptions as StandardLayoutOptions).type = 'grid';
|
|
2101
|
-
} else {
|
|
2102
|
-
// Use user-defined position(x/y default to 0).
|
|
2103
|
-
(formattedOptions as ImmediatelyInvokedLayoutOptions).execute = async (
|
|
2104
|
-
graph,
|
|
2105
|
-
) => {
|
|
2106
|
-
const nodes = graph.getAllNodes();
|
|
2107
|
-
return {
|
|
2108
|
-
nodes: nodes.map((node) => ({
|
|
2109
|
-
id: node.id,
|
|
2110
|
-
data: {
|
|
2111
|
-
x: Number(node.data.x) || 0,
|
|
2112
|
-
y: Number(node.data.y) || 0,
|
|
2113
|
-
},
|
|
2114
|
-
})),
|
|
2115
|
-
edges: [],
|
|
2116
|
-
};
|
|
2117
|
-
};
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
492
|
+
public async fitCenter(animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
493
|
+
await this.context.viewport?.fitCenter(animation);
|
|
494
|
+
}
|
|
2120
495
|
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
animate: !disableAnimate,
|
|
2125
|
-
});
|
|
496
|
+
private async autoFit(): Promise<void> {
|
|
497
|
+
const { autoFit } = this.context.options;
|
|
498
|
+
if (!autoFit) return;
|
|
2126
499
|
|
|
2127
|
-
|
|
500
|
+
if (isString(autoFit)) {
|
|
501
|
+
if (autoFit === 'view') await this.fitView();
|
|
502
|
+
else if (autoFit === 'center') await this.fitCenter();
|
|
503
|
+
} else {
|
|
504
|
+
const { type, animation } = autoFit;
|
|
505
|
+
if (type === 'view') await this.fitView(autoFit.options, animation);
|
|
506
|
+
else if (type === 'center') await this.fitCenter(animation);
|
|
507
|
+
}
|
|
2128
508
|
}
|
|
2129
509
|
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
*/
|
|
2133
|
-
public stopLayout() {
|
|
2134
|
-
this.layoutController.stopLayout();
|
|
510
|
+
public async focusElement(id: ID | ID[], animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
511
|
+
await this.context.viewport?.focusElements(Array.isArray(id) ? id : [id], animation);
|
|
2135
512
|
}
|
|
2136
513
|
|
|
2137
514
|
/**
|
|
515
|
+
* <zh/> 基于当前缩放比例进行缩放
|
|
2138
516
|
*
|
|
2139
|
-
*
|
|
517
|
+
* <en/> Zoom based on the current zoom ratio
|
|
518
|
+
* @param ratio - <zh/> 缩放比例 | <en/> zoom ratio
|
|
519
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
520
|
+
* @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
|
|
521
|
+
* @description
|
|
522
|
+
* <zh/>
|
|
523
|
+
* - ratio > 1 放大
|
|
524
|
+
* - ratio < 1 缩小
|
|
525
|
+
* <en/>
|
|
526
|
+
* - ratio > 1 zoom in
|
|
527
|
+
* - ratio < 1 zoom out
|
|
2140
528
|
*/
|
|
2141
|
-
public
|
|
2142
|
-
|
|
529
|
+
public async zoomBy(ratio: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
530
|
+
await this.context.viewport!.transform({ mode: 'relative', scale: ratio, origin }, animation);
|
|
2143
531
|
}
|
|
2144
532
|
|
|
2145
533
|
/**
|
|
2146
|
-
*
|
|
2147
|
-
*
|
|
2148
|
-
*
|
|
2149
|
-
* @
|
|
534
|
+
* <zh/> 缩放画布至指定比例
|
|
535
|
+
*
|
|
536
|
+
* <en/> Zoom the canvas to the specified ratio
|
|
537
|
+
* @param zoom - <zh/> 指定缩放比例 | <en/> specified zoom ratio
|
|
538
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
539
|
+
* @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
|
|
540
|
+
* @description
|
|
541
|
+
* <zh/>
|
|
542
|
+
* - zoom = 1 默认大小
|
|
543
|
+
* - zoom > 1 放大
|
|
544
|
+
* - zoom < 1 缩小
|
|
545
|
+
* <en/>
|
|
546
|
+
* - zoom = 1 default size
|
|
547
|
+
* - zoom > 1 zoom in
|
|
548
|
+
* - zoom < 1 zoom out
|
|
549
|
+
*/
|
|
550
|
+
public async zoomTo(zoom: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
551
|
+
this.context.viewport!.transform({ mode: 'absolute', scale: zoom, origin }, animation);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* <zh/> 获取当前缩放比例
|
|
556
|
+
*
|
|
557
|
+
* <en/> Get the current zoom ratio
|
|
558
|
+
* @returns <zh/> 缩放比例 | <en/> zoom ratio
|
|
2150
559
|
*/
|
|
2151
|
-
public
|
|
2152
|
-
this.
|
|
560
|
+
public getZoom(): number {
|
|
561
|
+
return this.context.viewport!.getZoom();
|
|
2153
562
|
}
|
|
2154
563
|
|
|
2155
564
|
/**
|
|
2156
|
-
*
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
565
|
+
* <zh/> 基于当前旋转角度进行旋转
|
|
566
|
+
*
|
|
567
|
+
* <en/> Rotate based on the current rotation angle
|
|
568
|
+
* @param angle - <zh/> 旋转角度 | <en/> rotation angle
|
|
569
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
570
|
+
* @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
|
|
2159
571
|
*/
|
|
2160
|
-
public
|
|
2161
|
-
|
|
572
|
+
public async rotateBy(angle: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
573
|
+
await this.context.viewport!.transform({ mode: 'relative', rotate: angle, origin }, animation);
|
|
2162
574
|
}
|
|
2163
575
|
|
|
2164
576
|
/**
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
577
|
+
* <zh/> 旋转画布至指定角度
|
|
578
|
+
*
|
|
579
|
+
* <en/> Rotate the canvas to the specified angle
|
|
580
|
+
* @param angle - <zh/> 目标角度 | <en/> target angle
|
|
581
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
582
|
+
* @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
|
|
2167
583
|
*/
|
|
2168
|
-
public
|
|
2169
|
-
this.
|
|
2170
|
-
this.labelCanvas.setCursor(cursor);
|
|
2171
|
-
this.transientCanvas.setCursor(cursor);
|
|
2172
|
-
this.transientLabelCanvas.setCursor(cursor);
|
|
584
|
+
public async rotateTo(angle: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
585
|
+
await this.context.viewport!.transform({ mode: 'absolute', rotate: angle, origin }, animation);
|
|
2173
586
|
}
|
|
2174
587
|
|
|
2175
588
|
/**
|
|
2176
|
-
*
|
|
2177
|
-
*
|
|
2178
|
-
*
|
|
2179
|
-
* @returns
|
|
2180
|
-
* @group Interaction
|
|
2181
|
-
*/
|
|
2182
|
-
public addBehaviors(
|
|
2183
|
-
behaviors: BehaviorOptionsOf<B> | BehaviorOptionsOf<B>[],
|
|
2184
|
-
modes: string | string[],
|
|
2185
|
-
) {
|
|
2186
|
-
const modesArr = isArray(modes) ? modes : [modes];
|
|
2187
|
-
const behaviorsArr = isArray(behaviors) ? behaviors : [behaviors];
|
|
2188
|
-
this.hooks.behaviorchange.emit({
|
|
2189
|
-
action: 'add',
|
|
2190
|
-
modes: modesArr,
|
|
2191
|
-
// TODO: update type define.
|
|
2192
|
-
// @ts-ignore
|
|
2193
|
-
behaviors: behaviorsArr,
|
|
2194
|
-
});
|
|
2195
|
-
// update the graph specification
|
|
2196
|
-
modesArr.forEach((mode) => {
|
|
2197
|
-
this.specification.modes[mode] = (
|
|
2198
|
-
this.specification.modes[mode] || []
|
|
2199
|
-
).concat(behaviorsArr);
|
|
2200
|
-
});
|
|
2201
|
-
}
|
|
2202
|
-
/**
|
|
2203
|
-
* Remove behavior(s) from mode(s).
|
|
2204
|
-
* @param behaviors behavior configs with unique key
|
|
2205
|
-
* @param modes mode names
|
|
2206
|
-
* @returns
|
|
2207
|
-
* @group Interaction
|
|
589
|
+
* <zh/> 获取当前旋转角度
|
|
590
|
+
*
|
|
591
|
+
* <en/> Get the current rotation angle
|
|
592
|
+
* @returns <zh/> 旋转角度 | <en/> rotation angle
|
|
2208
593
|
*/
|
|
2209
|
-
public
|
|
2210
|
-
|
|
2211
|
-
this.hooks.behaviorchange.emit({
|
|
2212
|
-
action: 'remove',
|
|
2213
|
-
modes: modesArr,
|
|
2214
|
-
behaviors: behaviorKeys,
|
|
2215
|
-
});
|
|
2216
|
-
// update the graph specification
|
|
2217
|
-
modesArr.forEach((mode) => {
|
|
2218
|
-
behaviorKeys.forEach((key) => {
|
|
2219
|
-
if (!this.specification.modes[mode]) {
|
|
2220
|
-
return;
|
|
2221
|
-
}
|
|
2222
|
-
const oldBehavior = this.specification.modes[mode].find(
|
|
2223
|
-
(behavior) => isObject(behavior) && behavior.key === key,
|
|
2224
|
-
);
|
|
2225
|
-
const indexOfOldBehavior =
|
|
2226
|
-
this.specification.modes[mode].indexOf(oldBehavior);
|
|
2227
|
-
this.specification.modes[mode].splice(indexOfOldBehavior, 1);
|
|
2228
|
-
});
|
|
2229
|
-
});
|
|
594
|
+
public getRotation(): number {
|
|
595
|
+
return this.context.viewport!.getRotation();
|
|
2230
596
|
}
|
|
2231
597
|
|
|
2232
598
|
/**
|
|
2233
|
-
*
|
|
2234
|
-
*
|
|
2235
|
-
*
|
|
2236
|
-
* @
|
|
2237
|
-
* @
|
|
599
|
+
* <zh/> 将图平移指定距离
|
|
600
|
+
*
|
|
601
|
+
* <en/> Translate the graph by the specified distance
|
|
602
|
+
* @param offset - <zh/> 偏移量 | <en/> offset
|
|
603
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
2238
604
|
*/
|
|
2239
|
-
public
|
|
2240
|
-
this.
|
|
2241
|
-
action: 'update',
|
|
2242
|
-
modes: [mode],
|
|
2243
|
-
// TODO: update type define.
|
|
2244
|
-
// @ts-ignore
|
|
2245
|
-
behaviors: [behavior],
|
|
2246
|
-
});
|
|
2247
|
-
// no need to update specification since the corresponding part is the same object as the behavior's option
|
|
2248
|
-
// this.specification.modes[mode].forEach((b, i) => {
|
|
2249
|
-
// if (isObject(b) && b.key === behavior.key) {
|
|
2250
|
-
// this.specification.modes[mode][i] = behavior;
|
|
2251
|
-
// }
|
|
2252
|
-
// });
|
|
605
|
+
public async translateBy(offset: Point, animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
606
|
+
await this.context.viewport!.transform({ mode: 'relative', translate: offset }, animation);
|
|
2253
607
|
}
|
|
2254
608
|
|
|
2255
609
|
/**
|
|
2256
|
-
*
|
|
2257
|
-
*
|
|
2258
|
-
*
|
|
2259
|
-
* @
|
|
610
|
+
* <zh/> 将图平移至指定位置
|
|
611
|
+
*
|
|
612
|
+
* <en/> Translate the graph to the specified position
|
|
613
|
+
* @param position - <zh/> 指定位置 | <en/> specified position
|
|
614
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
615
|
+
* @description
|
|
2260
616
|
*/
|
|
2261
|
-
public
|
|
2262
|
-
|
|
2263
|
-
| {
|
|
2264
|
-
key: string;
|
|
2265
|
-
type: string;
|
|
2266
|
-
[cfgName: string]: unknown; // TODO: configs from plugins
|
|
2267
|
-
}
|
|
2268
|
-
| string
|
|
2269
|
-
)[],
|
|
2270
|
-
) {
|
|
2271
|
-
const pluginsArr = isArray(pluginCfgs) ? pluginCfgs : [pluginCfgs];
|
|
2272
|
-
|
|
2273
|
-
// update the graph specification
|
|
2274
|
-
if (!this.specification.plugins) this.specification.plugins = [];
|
|
2275
|
-
const oldPlugins = this.specification.plugins;
|
|
2276
|
-
const validPlugins: (
|
|
2277
|
-
| {
|
|
2278
|
-
key: string;
|
|
2279
|
-
type: string;
|
|
2280
|
-
[cfgName: string]: unknown; // TODO: configs from plugins
|
|
2281
|
-
}
|
|
2282
|
-
| string
|
|
2283
|
-
)[] = [];
|
|
2284
|
-
pluginsArr.forEach((config) => {
|
|
2285
|
-
const oldPlugin = oldPlugins.find((oldPlugin) => {
|
|
2286
|
-
if (typeof oldPlugin === 'string' || typeof config === 'string')
|
|
2287
|
-
return false;
|
|
2288
|
-
return oldPlugin.key === config.key;
|
|
2289
|
-
});
|
|
2290
|
-
if (oldPlugin) {
|
|
2291
|
-
console.warn(
|
|
2292
|
-
`Add plugin with key ${
|
|
2293
|
-
(config as any).key
|
|
2294
|
-
} failed, the key is duplicated to the existing plugins on the graph.`,
|
|
2295
|
-
);
|
|
2296
|
-
return;
|
|
2297
|
-
}
|
|
2298
|
-
validPlugins.push(config);
|
|
2299
|
-
});
|
|
2300
|
-
this.specification.plugins = oldPlugins.concat(validPlugins);
|
|
2301
|
-
|
|
2302
|
-
this.hooks.pluginchange.emit({
|
|
2303
|
-
action: 'add',
|
|
2304
|
-
plugins: validPlugins,
|
|
2305
|
-
});
|
|
617
|
+
public async translateTo(position: Point, animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
618
|
+
await this.context.viewport!.transform({ mode: 'absolute', translate: position }, animation);
|
|
2306
619
|
}
|
|
2307
620
|
|
|
2308
621
|
/**
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2312
|
-
* @
|
|
622
|
+
* <zh/> 获取图的位置
|
|
623
|
+
*
|
|
624
|
+
* <en/> Get the position of the graph
|
|
625
|
+
* @returns <zh/> 图的位置 | <en/> position of the graph
|
|
626
|
+
* @description
|
|
627
|
+
* <zh/> 默认状态下,图的位置为 [0, 0]
|
|
628
|
+
*
|
|
629
|
+
* <en/> By default, the position of the graph is [0, 0]
|
|
2313
630
|
*/
|
|
2314
|
-
public
|
|
2315
|
-
|
|
2316
|
-
this.hooks.pluginchange.emit({
|
|
2317
|
-
action: 'remove',
|
|
2318
|
-
plugins: pluginArr,
|
|
2319
|
-
});
|
|
2320
|
-
// update the graph specification
|
|
2321
|
-
const { plugins } = this.specification;
|
|
2322
|
-
this.specification.plugins = plugins?.filter((plugin) => {
|
|
2323
|
-
if (isObject(plugin))
|
|
2324
|
-
return !(
|
|
2325
|
-
pluginArr.includes(plugin.key) ||
|
|
2326
|
-
pluginArr.includes(plugin as PluginBase)
|
|
2327
|
-
);
|
|
2328
|
-
return !pluginArr.includes(plugin);
|
|
2329
|
-
});
|
|
631
|
+
public getPosition(): Point {
|
|
632
|
+
return subtract([0, 0], this.getCanvasByViewport([0, 0]));
|
|
2330
633
|
}
|
|
2331
634
|
|
|
2332
635
|
/**
|
|
2333
|
-
*
|
|
2334
|
-
*
|
|
2335
|
-
*
|
|
2336
|
-
* @
|
|
636
|
+
* <zh/> 将元素平移指定距离
|
|
637
|
+
*
|
|
638
|
+
* <en/> Translate the element by the specified distance
|
|
639
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
640
|
+
* @param offset - <zh/> 偏移量 | <en/> offset
|
|
641
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
2337
642
|
*/
|
|
2338
|
-
public
|
|
2339
|
-
plugin:
|
|
2340
|
-
| {
|
|
2341
|
-
key: string;
|
|
2342
|
-
type: string;
|
|
2343
|
-
[cfg: string]: unknown;
|
|
2344
|
-
}
|
|
2345
|
-
| PluginBase,
|
|
2346
|
-
) {
|
|
2347
|
-
const { plugins } = this.specification;
|
|
2348
|
-
const { key, type } = plugin as {
|
|
2349
|
-
key: string;
|
|
2350
|
-
type: string;
|
|
2351
|
-
[cfg: string]: unknown;
|
|
2352
|
-
};
|
|
2353
|
-
if (!key) {
|
|
2354
|
-
console.warn(
|
|
2355
|
-
`The key for the plugin is not found. G6 will update the first plugin with type ${type}`,
|
|
2356
|
-
);
|
|
2357
|
-
}
|
|
2358
|
-
if (!plugins) {
|
|
2359
|
-
console.warn(
|
|
2360
|
-
'Update plugin failed, the plugin to be updated does not exist.',
|
|
2361
|
-
);
|
|
2362
|
-
return;
|
|
2363
|
-
}
|
|
2364
|
-
const oldPlugin = plugins?.find((p) => {
|
|
2365
|
-
if (typeof p === 'string') return p === key || p === type;
|
|
2366
|
-
return (
|
|
2367
|
-
p.key === key ||
|
|
2368
|
-
(
|
|
2369
|
-
p as {
|
|
2370
|
-
key: string;
|
|
2371
|
-
type: string;
|
|
2372
|
-
[cfg: string]: unknown;
|
|
2373
|
-
}
|
|
2374
|
-
).type === type
|
|
2375
|
-
);
|
|
2376
|
-
});
|
|
2377
|
-
if (!oldPlugin) {
|
|
2378
|
-
console.warn(
|
|
2379
|
-
`Update plugin failed, the plugin with key ${key} or type ${type} is not found.`,
|
|
2380
|
-
);
|
|
2381
|
-
return;
|
|
2382
|
-
}
|
|
2383
|
-
const idx = plugins.indexOf(oldPlugin);
|
|
2384
|
-
plugins[idx] = {
|
|
2385
|
-
// TODO: update type define.
|
|
2386
|
-
// @ts-ignore
|
|
2387
|
-
...oldPlugin,
|
|
2388
|
-
...plugin,
|
|
2389
|
-
};
|
|
2390
|
-
|
|
2391
|
-
this.hooks.pluginchange.emit({
|
|
2392
|
-
action: 'update',
|
|
2393
|
-
plugins: [plugin],
|
|
2394
|
-
});
|
|
2395
|
-
}
|
|
2396
|
-
|
|
643
|
+
public async translateElementBy(id: ID, offset: Position, animation?: boolean): Promise<void>;
|
|
2397
644
|
/**
|
|
2398
|
-
*
|
|
2399
|
-
*
|
|
2400
|
-
*
|
|
2401
|
-
* @
|
|
2402
|
-
* @
|
|
2403
|
-
*/
|
|
2404
|
-
public
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
drawTarget?: boolean;
|
|
2417
|
-
/** Only shape with id in shapeIds will be cloned while type is ITEM_TYPE. If shapeIds is not assigned, the whole item will be cloned. */
|
|
2418
|
-
shapeIds?: string[];
|
|
2419
|
-
/** Whether show the shapes in shapeIds. True by default. */
|
|
2420
|
-
visible?: boolean;
|
|
2421
|
-
upsertAncestors?: boolean;
|
|
2422
|
-
},
|
|
2423
|
-
canvas?: Canvas,
|
|
2424
|
-
): DisplayObject {
|
|
2425
|
-
this.hooks.transientupdate.emit({
|
|
2426
|
-
type,
|
|
2427
|
-
id,
|
|
2428
|
-
config,
|
|
2429
|
-
canvas: canvas || this.transientCanvas,
|
|
2430
|
-
graphCore: this.dataController.graphCore,
|
|
2431
|
-
});
|
|
2432
|
-
return this.itemController.getTransient(String(id));
|
|
645
|
+
* <zh/> 批量将元素平移指定距离
|
|
646
|
+
*
|
|
647
|
+
* <en/> Batch translate elements by the specified distance
|
|
648
|
+
* @param offsets - <zh/> 偏移量配置 | <en/> offset configuration
|
|
649
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
650
|
+
*/
|
|
651
|
+
public async translateElementBy(offsets: Record<ID, Position>, animation?: boolean): Promise<void>;
|
|
652
|
+
public async translateElementBy(
|
|
653
|
+
args1: ID | Record<ID, Position>,
|
|
654
|
+
args2?: Position | boolean,
|
|
655
|
+
args3: boolean = true,
|
|
656
|
+
): Promise<void> {
|
|
657
|
+
const [config, animation] = isObject(args1)
|
|
658
|
+
? [args1, (args2 as boolean) ?? true]
|
|
659
|
+
: [{ [args1 as ID]: args2 as Position }, args3];
|
|
660
|
+
|
|
661
|
+
Object.entries(config).forEach(([id, offset]) => this.context.model.translateNodeBy(id, offset));
|
|
662
|
+
await this.context.element!.draw({ animation });
|
|
2433
663
|
}
|
|
2434
664
|
|
|
2435
|
-
// ===== download operations =====
|
|
2436
665
|
/**
|
|
2437
|
-
*
|
|
2438
|
-
*
|
|
2439
|
-
*
|
|
2440
|
-
* @
|
|
666
|
+
* <zh/> 将元素平移至指定位置
|
|
667
|
+
*
|
|
668
|
+
* <en/> Translate the element to the specified position
|
|
669
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
670
|
+
* @param position - <zh/> 指定位置 | <en/> specified position
|
|
671
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
2441
672
|
*/
|
|
2442
|
-
public async
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
673
|
+
public async translateElementTo(id: ID, position: Position, animation?: boolean): Promise<void>;
|
|
674
|
+
/**
|
|
675
|
+
* <zh/> 批量将元素平移至指定位置
|
|
676
|
+
*
|
|
677
|
+
* <en/> Batch translate elements to the specified position
|
|
678
|
+
* @param positions - <zh/> 位置配置 | <en/> position configuration
|
|
679
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
680
|
+
*/
|
|
681
|
+
public async translateElementTo(positions: Record<ID, Position>, animation?: boolean): Promise<void>;
|
|
682
|
+
public async translateElementTo(
|
|
683
|
+
args1: ID | Record<ID, Position>,
|
|
684
|
+
args2?: boolean | Position,
|
|
685
|
+
args3: boolean = true,
|
|
686
|
+
): Promise<void> {
|
|
687
|
+
const [config, animation] = isObject(args1)
|
|
688
|
+
? [args1, (args2 as boolean) ?? true]
|
|
689
|
+
: [{ [args1 as ID]: args2 as Position }, args3];
|
|
2458
690
|
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
vContainerDOM,
|
|
2463
|
-
width,
|
|
2464
|
-
height,
|
|
2465
|
-
pixelRatio,
|
|
2466
|
-
);
|
|
2467
|
-
await vCanvas.ready;
|
|
2468
|
-
|
|
2469
|
-
const backgroundClonedGroup = backgroundCanvas.getRoot().cloneNode(true);
|
|
2470
|
-
const clonedGroup = canvas.getRoot().cloneNode(true);
|
|
2471
|
-
const transientClonedGroup = transientCanvas.getRoot().cloneNode(true);
|
|
2472
|
-
const labelClonedGroup = labelCanvas.getRoot().cloneNode(true);
|
|
2473
|
-
|
|
2474
|
-
const originViewportLTCanvas = vCanvas.viewport2Canvas({ x: 0, y: 0 });
|
|
2475
|
-
const currentViewportLTCanvas = canvas.viewport2Canvas({ x: 0, y: 0 });
|
|
2476
|
-
labelClonedGroup.translate([
|
|
2477
|
-
currentViewportLTCanvas.x - originViewportLTCanvas.x,
|
|
2478
|
-
currentViewportLTCanvas.y - originViewportLTCanvas.y,
|
|
2479
|
-
]);
|
|
2480
|
-
labelClonedGroup.scale(1 / canvas.getCamera().getZoom());
|
|
2481
|
-
// TODO: after cloning, label background with rotation take a wrong place, remove it to temporary solve.
|
|
2482
|
-
labelClonedGroup.children[0].children.forEach((childGroup) => {
|
|
2483
|
-
childGroup.children.forEach((shape) => {
|
|
2484
|
-
if (
|
|
2485
|
-
shape.getAttribute('data-is-label-background') &&
|
|
2486
|
-
shape.style.transform
|
|
2487
|
-
)
|
|
2488
|
-
shape.remove();
|
|
2489
|
-
});
|
|
2490
|
-
});
|
|
691
|
+
Object.entries(config).forEach(([id, position]) => this.context.model.translateNodeTo(id, position));
|
|
692
|
+
await this.context.element!.draw({ animation });
|
|
693
|
+
}
|
|
2491
694
|
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
vCanvas.appendChild(transientClonedGroup);
|
|
2496
|
-
|
|
2497
|
-
const vCamera = vCanvas.getCamera();
|
|
2498
|
-
vCamera.setZoom(camera.getZoom());
|
|
2499
|
-
vCamera.setPosition(camera.getPosition());
|
|
2500
|
-
vCamera.setFocalPoint(camera.getFocalPoint());
|
|
2501
|
-
|
|
2502
|
-
const vCanvasContextService = vCanvas.getContextService();
|
|
2503
|
-
let bgRect;
|
|
2504
|
-
if (rendererType !== 'svg') {
|
|
2505
|
-
const backPositionCanvas = canvas.viewport2Canvas({ x: 0, y: 0 });
|
|
2506
|
-
bgRect = new Rect({
|
|
2507
|
-
style: {
|
|
2508
|
-
...backPositionCanvas,
|
|
2509
|
-
z: -1,
|
|
2510
|
-
width: vCanvasContextService.getDomElement().width,
|
|
2511
|
-
height: vCanvasContextService.getDomElement().height,
|
|
2512
|
-
//@ts-ignore
|
|
2513
|
-
fill: backgroundCanvas.getContextService().getDomElement().style[
|
|
2514
|
-
'background-color'
|
|
2515
|
-
],
|
|
2516
|
-
zIndex: -10,
|
|
2517
|
-
},
|
|
2518
|
-
});
|
|
2519
|
-
vCanvas.appendChild(bgRect);
|
|
2520
|
-
}
|
|
695
|
+
public getElementPosition(id: ID): Position {
|
|
696
|
+
return this.context.model.getElementPosition(id);
|
|
697
|
+
}
|
|
2521
698
|
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
return new Promise((resolve) => {
|
|
2525
|
-
setTimeout(() => {
|
|
2526
|
-
vCanvasContextService.toDataURL({ type }).then((url) => {
|
|
2527
|
-
dataURL = url;
|
|
2528
|
-
resolve(dataURL);
|
|
2529
|
-
});
|
|
2530
|
-
}, 50);
|
|
2531
|
-
});
|
|
699
|
+
public getElementRenderStyle(id: ID) {
|
|
700
|
+
return omit(this.context.element!.getElement(id)!.attributes, ['context']);
|
|
2532
701
|
}
|
|
2533
702
|
|
|
2534
703
|
/**
|
|
2535
|
-
*
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
* @param
|
|
2539
|
-
* @
|
|
704
|
+
* <zh/> 设置元素可见性
|
|
705
|
+
*
|
|
706
|
+
* <en/> Set element visibility
|
|
707
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
708
|
+
* @param visibility - <zh/> 可见性 | <en/> visibility
|
|
709
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
2540
710
|
*/
|
|
2541
|
-
public async
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
} else if (isNumber(padding)) {
|
|
2566
|
-
padding = [padding, padding, padding, padding];
|
|
2567
|
-
}
|
|
711
|
+
public async setElementVisibility(
|
|
712
|
+
id: ID,
|
|
713
|
+
visibility: BaseStyleProps['visibility'],
|
|
714
|
+
animation?: boolean,
|
|
715
|
+
): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* <zh/> 批量设置元素可见性
|
|
718
|
+
*
|
|
719
|
+
* <en/> Batch set element visibility
|
|
720
|
+
* @param visibility - <zh/> 可见性配置 | <en/> visibility configuration
|
|
721
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
722
|
+
*/
|
|
723
|
+
public async setElementVisibility(
|
|
724
|
+
visibility: Record<ID, BaseStyleProps['visibility']>,
|
|
725
|
+
animation?: boolean,
|
|
726
|
+
): Promise<void>;
|
|
727
|
+
public async setElementVisibility(
|
|
728
|
+
args1: ID | Record<ID, BaseStyleProps['visibility']>,
|
|
729
|
+
args2?: boolean | BaseStyleProps['visibility'],
|
|
730
|
+
args3: boolean = true,
|
|
731
|
+
): Promise<void> {
|
|
732
|
+
const [config, animation] = isObject(args1)
|
|
733
|
+
? [args1, (args2 as boolean) ?? true]
|
|
734
|
+
: [{ [args1]: args2 as BaseStyleProps['visibility'] }, args3];
|
|
2568
735
|
|
|
2569
|
-
const
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
transientBBox.min[0] || Infinity,
|
|
2574
|
-
labelBBox.min[0] || Infinity,
|
|
2575
|
-
) - padding[3];
|
|
2576
|
-
const right =
|
|
2577
|
-
Math.max(
|
|
2578
|
-
backgroundBBox.max[0] || -Infinity,
|
|
2579
|
-
BBox.max[0] || -Infinity,
|
|
2580
|
-
transientBBox.max[0] || -Infinity,
|
|
2581
|
-
labelBBox.max[0] || -Infinity,
|
|
2582
|
-
) - padding[1];
|
|
2583
|
-
const top =
|
|
2584
|
-
Math.min(
|
|
2585
|
-
backgroundBBox.min[1] || Infinity,
|
|
2586
|
-
BBox.min[1] || Infinity,
|
|
2587
|
-
transientBBox.min[1] || Infinity,
|
|
2588
|
-
labelBBox.min[1] || Infinity,
|
|
2589
|
-
) - padding[0];
|
|
2590
|
-
const bottom =
|
|
2591
|
-
Math.max(
|
|
2592
|
-
backgroundBBox.max[1] || -Infinity,
|
|
2593
|
-
BBox.max[1] || -Infinity,
|
|
2594
|
-
transientBBox.max[1] || -Infinity,
|
|
2595
|
-
labelBBox.max[1] || -Infinity,
|
|
2596
|
-
) - padding[2];
|
|
2597
|
-
|
|
2598
|
-
const graphCenterX = (left + right) / 2;
|
|
2599
|
-
const graphCenterY = (top + bottom) / 2;
|
|
2600
|
-
const halfX = (right - left) / 2;
|
|
2601
|
-
const halfY = (bottom - top) / 2;
|
|
2602
|
-
|
|
2603
|
-
const pixelRatio =
|
|
2604
|
-
typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
2605
|
-
const vWidth = halfX * 2;
|
|
2606
|
-
const vHeight = halfY * 2;
|
|
2607
|
-
const vContainerDOM: HTMLElement = createDOM(
|
|
2608
|
-
'<div id="virtual-image"></div>',
|
|
2609
|
-
);
|
|
2610
|
-
const vCanvas = createCanvas(
|
|
2611
|
-
rendererType,
|
|
2612
|
-
vContainerDOM,
|
|
2613
|
-
vWidth,
|
|
2614
|
-
vHeight,
|
|
2615
|
-
pixelRatio,
|
|
2616
|
-
);
|
|
2617
|
-
await vCanvas.ready;
|
|
2618
|
-
const vCanvasContextService = vCanvas.getContextService();
|
|
2619
|
-
if (rendererType !== 'svg') {
|
|
2620
|
-
const bgRect = new Rect({
|
|
2621
|
-
style: {
|
|
2622
|
-
x: 0,
|
|
2623
|
-
y: 0,
|
|
2624
|
-
z: -1,
|
|
2625
|
-
width: vCanvasContextService.getDomElement().width,
|
|
2626
|
-
height: vCanvasContextService.getDomElement().height,
|
|
2627
|
-
//@ts-ignore
|
|
2628
|
-
fill: backgroundCanvas.getContextService().getDomElement().style[
|
|
2629
|
-
'background-color'
|
|
2630
|
-
],
|
|
2631
|
-
},
|
|
2632
|
-
});
|
|
2633
|
-
vCanvas.appendChild(bgRect);
|
|
2634
|
-
}
|
|
2635
|
-
const backgroundClonedGroup = backgroundRoot.cloneNode(true);
|
|
2636
|
-
const clonedGroup = root.cloneNode(true);
|
|
2637
|
-
const transientClonedGroup = transientRoot.cloneNode(true);
|
|
2638
|
-
const labelClonedGroup = labelRoot.cloneNode(true);
|
|
2639
|
-
const transPosition: [number, number] = [
|
|
2640
|
-
-graphCenterX + halfX,
|
|
2641
|
-
-graphCenterY + halfY,
|
|
2642
|
-
];
|
|
2643
|
-
backgroundClonedGroup.setPosition(transPosition);
|
|
2644
|
-
clonedGroup.setPosition(transPosition);
|
|
2645
|
-
transientClonedGroup.setPosition(transPosition);
|
|
2646
|
-
|
|
2647
|
-
const currentViewportLTCanvas = canvas.viewport2Canvas({ x: 0, y: 0 });
|
|
2648
|
-
const labelTransPosition: [number, number] = [
|
|
2649
|
-
transPosition[0] + currentViewportLTCanvas.x,
|
|
2650
|
-
transPosition[1] + currentViewportLTCanvas.y,
|
|
2651
|
-
];
|
|
2652
|
-
labelClonedGroup.setPosition(labelTransPosition);
|
|
2653
|
-
labelClonedGroup.scale(1 / canvas.getCamera().getZoom());
|
|
2654
|
-
// TODO: after cloning, label background with rotation take a wrong place, remove it to temporary solve.
|
|
2655
|
-
labelClonedGroup.children[0].children.forEach((childGroup) => {
|
|
2656
|
-
childGroup.children.forEach((shape) => {
|
|
2657
|
-
if (
|
|
2658
|
-
shape.getAttribute('data-is-label-background') &&
|
|
2659
|
-
shape.style.transform
|
|
2660
|
-
)
|
|
2661
|
-
shape.remove();
|
|
2662
|
-
});
|
|
736
|
+
const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
|
|
737
|
+
Object.entries(config).forEach(([id, value]) => {
|
|
738
|
+
const elementType = this.getElementType(id);
|
|
739
|
+
dataToUpdate[`${elementType}s`].push({ id, style: { visibility: value } });
|
|
2663
740
|
});
|
|
741
|
+
this.updateData(dataToUpdate);
|
|
2664
742
|
|
|
2665
|
-
|
|
2666
|
-
vCanvas.appendChild(clonedGroup);
|
|
2667
|
-
vCanvas.appendChild(labelClonedGroup);
|
|
2668
|
-
vCanvas.appendChild(transientClonedGroup);
|
|
2669
|
-
|
|
2670
|
-
if (!type) type = 'image/png';
|
|
2671
|
-
let dataURL = '';
|
|
2672
|
-
return new Promise((resolve) => {
|
|
2673
|
-
setTimeout(() => {
|
|
2674
|
-
vCanvasContextService.toDataURL({ type }).then((url) => {
|
|
2675
|
-
dataURL = url;
|
|
2676
|
-
resolve(dataURL);
|
|
2677
|
-
});
|
|
2678
|
-
}, 50);
|
|
2679
|
-
});
|
|
743
|
+
await this.context.element!.draw({ animation, stage: 'visibility' });
|
|
2680
744
|
}
|
|
2681
745
|
|
|
2682
746
|
/**
|
|
2683
|
-
*
|
|
2684
|
-
*
|
|
2685
|
-
*
|
|
2686
|
-
* @param
|
|
2687
|
-
* @param
|
|
2688
|
-
*/
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
}
|
|
2696
|
-
|
|
2697
|
-
if (typeof window !== 'undefined') {
|
|
2698
|
-
if (window.Blob && window.URL && renderer !== 'svg') {
|
|
2699
|
-
const arr = dataURL.split(',');
|
|
2700
|
-
let mime = '';
|
|
2701
|
-
if (arr && arr.length > 0) {
|
|
2702
|
-
const match = arr[0].match(/:(.*?);/);
|
|
2703
|
-
// eslint-disable-next-line prefer-destructuring
|
|
2704
|
-
if (match && match.length >= 2) mime = match[1];
|
|
2705
|
-
}
|
|
2706
|
-
|
|
2707
|
-
const bstr = atob(arr[1]);
|
|
2708
|
-
let n = bstr.length;
|
|
2709
|
-
const u8arr = new Uint8Array(n);
|
|
2710
|
-
|
|
2711
|
-
while (n--) {
|
|
2712
|
-
u8arr[n] = bstr.charCodeAt(n);
|
|
2713
|
-
}
|
|
2714
|
-
|
|
2715
|
-
const blobObj = new Blob([u8arr], { type: mime });
|
|
2716
|
-
|
|
2717
|
-
if ((window.navigator as any).msSaveBlob) {
|
|
2718
|
-
(window.navigator as any).msSaveBlob(blobObj, fileName);
|
|
2719
|
-
} else {
|
|
2720
|
-
link.addEventListener('click', () => {
|
|
2721
|
-
link.download = fileName;
|
|
2722
|
-
link.href = window.URL.createObjectURL(blobObj);
|
|
2723
|
-
});
|
|
2724
|
-
}
|
|
2725
|
-
} else {
|
|
2726
|
-
link.addEventListener('click', () => {
|
|
2727
|
-
link.download = fileName;
|
|
2728
|
-
link.href = dataURL;
|
|
2729
|
-
});
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
747
|
+
* <zh/> 显示元素
|
|
748
|
+
*
|
|
749
|
+
* <en/> Show element
|
|
750
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
751
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
752
|
+
*/
|
|
753
|
+
public async showElement(id: ID | ID[], animation?: boolean): Promise<void> {
|
|
754
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
755
|
+
await this.setElementVisibility(
|
|
756
|
+
Object.fromEntries(ids.map((_id) => [_id, 'visible'] as [ID, BaseStyleProps['visibility']])),
|
|
757
|
+
animation,
|
|
758
|
+
);
|
|
2732
759
|
}
|
|
2733
760
|
|
|
2734
761
|
/**
|
|
2735
|
-
*
|
|
2736
|
-
*
|
|
2737
|
-
*
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
(name || 'graph') +
|
|
2748
|
-
(rendererType === 'svg' ? '.svg' : type.split('/')[1]);
|
|
2749
|
-
|
|
2750
|
-
const link: HTMLAnchorElement = document.createElement('a');
|
|
2751
|
-
|
|
2752
|
-
self.asyncToDataUrl(type, (dataURL) => {
|
|
2753
|
-
this.dataURLToImage(dataURL, rendererType, link, fileName);
|
|
2754
|
-
const e = document.createEvent('MouseEvents');
|
|
2755
|
-
e.initEvent('click', false, false);
|
|
2756
|
-
link.dispatchEvent(e);
|
|
2757
|
-
});
|
|
762
|
+
* <zh/> 隐藏元素
|
|
763
|
+
*
|
|
764
|
+
* <en/> Hide element
|
|
765
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
766
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
767
|
+
*/
|
|
768
|
+
public async hideElement(id: ID | ID[], animation?: boolean): Promise<void> {
|
|
769
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
770
|
+
await this.setElementVisibility(
|
|
771
|
+
Object.fromEntries(ids.map((_id) => [_id, 'hidden'] as [ID, BaseStyleProps['visibility']])),
|
|
772
|
+
animation,
|
|
773
|
+
);
|
|
2758
774
|
}
|
|
2759
775
|
|
|
2760
776
|
/**
|
|
2761
|
-
*
|
|
2762
|
-
*
|
|
2763
|
-
*
|
|
2764
|
-
* @param
|
|
777
|
+
* <zh/> 获取元素可见性
|
|
778
|
+
*
|
|
779
|
+
* <en/> Get element visibility
|
|
780
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
781
|
+
* @returns <zh/> 元素可见性 | <en/> element visibility
|
|
2765
782
|
*/
|
|
2766
|
-
public
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
imageConfig?: { padding?: number | number[] },
|
|
2770
|
-
): void {
|
|
2771
|
-
const self = this;
|
|
2772
|
-
|
|
2773
|
-
const rendererType = this.rendererType;
|
|
2774
|
-
if (!type) type = 'image/png';
|
|
2775
|
-
const fileName: string =
|
|
2776
|
-
(name || 'graph') +
|
|
2777
|
-
(rendererType === 'svg' ? '.svg' : type.split('/')[1]);
|
|
2778
|
-
const link: HTMLAnchorElement = document.createElement('a');
|
|
2779
|
-
|
|
2780
|
-
self.asyncToFullDataUrl(type, imageConfig, (dataURL) => {
|
|
2781
|
-
this.dataURLToImage(dataURL, rendererType, link, fileName);
|
|
2782
|
-
const e = document.createEvent('MouseEvents');
|
|
2783
|
-
e.initEvent('click', false, false);
|
|
2784
|
-
link.dispatchEvent(e);
|
|
2785
|
-
});
|
|
783
|
+
public getElementVisibility(id: ID): BaseStyleProps['visibility'] {
|
|
784
|
+
const element = this.context.element!.getElement(id)!;
|
|
785
|
+
return element?.style?.visibility ?? 'visible';
|
|
2786
786
|
}
|
|
2787
787
|
|
|
2788
788
|
/**
|
|
2789
|
-
*
|
|
2790
|
-
*
|
|
2791
|
-
*
|
|
789
|
+
* <zh/> 设置元素层级
|
|
790
|
+
*
|
|
791
|
+
* <en/> Set element z-index
|
|
792
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
793
|
+
* @param zIndex - <zh/> 层级 | <en/> z-index
|
|
2792
794
|
*/
|
|
2793
|
-
|
|
2794
|
-
let dataURL = '';
|
|
2795
|
-
if (!type) type = 'image/png';
|
|
2796
|
-
|
|
2797
|
-
setTimeout(async () => {
|
|
2798
|
-
await this.toDataURL(type).then((url) => {
|
|
2799
|
-
dataURL = url;
|
|
2800
|
-
});
|
|
2801
|
-
if (callback) callback(dataURL);
|
|
2802
|
-
}, 16);
|
|
2803
|
-
}
|
|
2804
|
-
|
|
795
|
+
public async setElementZIndex(id: ID, zIndex: number): Promise<void>;
|
|
2805
796
|
/**
|
|
2806
|
-
*
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
* @param
|
|
2810
|
-
* @param callback A callback function to handle the Data URL (optional).
|
|
797
|
+
* <zh/> 批量设置元素层级
|
|
798
|
+
*
|
|
799
|
+
* <en/> Batch set element z-index
|
|
800
|
+
* @param zIndex - <zh/> 层级配置 | <en/> z-index configuration
|
|
2811
801
|
*/
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
): void {
|
|
2817
|
-
let dataURL = '';
|
|
2818
|
-
if (!type) type = 'image/png';
|
|
2819
|
-
|
|
2820
|
-
setTimeout(async () => {
|
|
2821
|
-
await this.toFullDataURL(type, imageConfig).then((url) => {
|
|
2822
|
-
dataURL = url as string;
|
|
2823
|
-
});
|
|
2824
|
-
if (callback) callback(dataURL);
|
|
2825
|
-
}, 16);
|
|
2826
|
-
}
|
|
802
|
+
public async setElementZIndex(zIndex: Record<ID, number>): Promise<void>;
|
|
803
|
+
public async setElementZIndex(args1: ID | Record<ID, number>, args2?: number): Promise<void> {
|
|
804
|
+
const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
|
|
805
|
+
const config = isObject(args1) ? args1 : { [args1 as ID]: args2 as number };
|
|
2827
806
|
|
|
2828
|
-
|
|
807
|
+
Object.entries(config).forEach(([id, value]) => {
|
|
808
|
+
const elementType = this.getElementType(id);
|
|
809
|
+
dataToUpdate[`${elementType}s`].push({ id, style: { zIndex: value } });
|
|
810
|
+
});
|
|
2829
811
|
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
public isHistoryEnabled() {
|
|
2834
|
-
const history = this.getHistoryPlugin();
|
|
2835
|
-
return history?.isEnable();
|
|
812
|
+
const { model, element } = this.context;
|
|
813
|
+
model.preventUpdateNodeLikeHierarchy(() => model.updateData(dataToUpdate));
|
|
814
|
+
await element!.draw({ animation: false });
|
|
2836
815
|
}
|
|
2837
816
|
|
|
2838
817
|
/**
|
|
2839
|
-
*
|
|
2840
|
-
*
|
|
2841
|
-
*
|
|
2842
|
-
* @param
|
|
2843
|
-
*/
|
|
2844
|
-
public
|
|
2845
|
-
const
|
|
2846
|
-
|
|
2847
|
-
|
|
818
|
+
* <zh/> 将元素置于最顶层
|
|
819
|
+
*
|
|
820
|
+
* <en/> Bring the element to the front
|
|
821
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
822
|
+
*/
|
|
823
|
+
public async frontElement(id: ID | ID[]): Promise<void> {
|
|
824
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
825
|
+
const { model } = this.context;
|
|
826
|
+
const config: Record<ID, number> = {};
|
|
827
|
+
|
|
828
|
+
ids.map((_id) => {
|
|
829
|
+
const zIndex = model.getFrontZIndex(_id);
|
|
830
|
+
const elementType = model.getElementType(_id);
|
|
831
|
+
if (elementType === 'combo') {
|
|
832
|
+
const ancestor = model.getAncestorsData(_id, COMBO_KEY).at(-1) || this.getComboData(_id);
|
|
833
|
+
const combos = [ancestor, ...model.getDescendantsData(idOf(ancestor))].filter((datum) =>
|
|
834
|
+
model.isCombo(idOf(datum)),
|
|
835
|
+
);
|
|
836
|
+
const delta = zIndex - zIndexOf(ancestor);
|
|
837
|
+
combos.forEach((combo) => {
|
|
838
|
+
config[idOf(combo)] = zIndexOf(combo) + delta;
|
|
839
|
+
});
|
|
840
|
+
} else config[_id] = zIndex;
|
|
841
|
+
});
|
|
2848
842
|
|
|
2849
|
-
|
|
2850
|
-
* Pause stacking operation.
|
|
2851
|
-
*/
|
|
2852
|
-
public pauseStack(): void {
|
|
2853
|
-
const history = this.getHistoryPlugin();
|
|
2854
|
-
return history?.pauseStack();
|
|
843
|
+
await this.setElementZIndex(config);
|
|
2855
844
|
}
|
|
2856
845
|
|
|
2857
846
|
/**
|
|
2858
|
-
*
|
|
847
|
+
* <zh/> 获取元素层级
|
|
848
|
+
*
|
|
849
|
+
* <en/> Get element z-index
|
|
850
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
851
|
+
* @returns <zh/> 元素层级 | <en/> element z-index
|
|
2859
852
|
*/
|
|
2860
|
-
public
|
|
2861
|
-
|
|
2862
|
-
return history?.resumeStack();
|
|
853
|
+
public getElementZIndex(id: ID): number {
|
|
854
|
+
return zIndexOf(this.context.model.getElementsData([id])[0]);
|
|
2863
855
|
}
|
|
2864
856
|
|
|
2865
857
|
/**
|
|
2866
|
-
*
|
|
2867
|
-
*
|
|
858
|
+
* <zh/> 设置元素状态
|
|
859
|
+
*
|
|
860
|
+
* <en/> Set element state
|
|
861
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
862
|
+
* @param state - <zh/> 状态 | <en/> state
|
|
863
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
2868
864
|
*/
|
|
2869
|
-
public
|
|
2870
|
-
const history = this.getHistoryPlugin();
|
|
2871
|
-
history?.pauseStack();
|
|
2872
|
-
try {
|
|
2873
|
-
callback();
|
|
2874
|
-
} finally {
|
|
2875
|
-
history?.resumeStack();
|
|
2876
|
-
}
|
|
2877
|
-
};
|
|
2878
|
-
|
|
865
|
+
public async setElementState(id: ID, state: State | State[], animation?: boolean): Promise<void>;
|
|
2879
866
|
/**
|
|
2880
|
-
*
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
867
|
+
* <zh/> 批量设置元素状态
|
|
868
|
+
*
|
|
869
|
+
* <en/> Batch set element state
|
|
870
|
+
* @param state - <zh/> 状态配置 | <en/> state configuration
|
|
871
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
872
|
+
*/
|
|
873
|
+
public async setElementState(state: Record<ID, State | State[]>, animation?: boolean): Promise<void>;
|
|
874
|
+
public async setElementState(
|
|
875
|
+
args1: ID | Record<ID, State | State[]>,
|
|
876
|
+
args2?: boolean | State | State[],
|
|
877
|
+
args3: boolean = true,
|
|
878
|
+
): Promise<void> {
|
|
879
|
+
const [config, animation] = isObject(args1)
|
|
880
|
+
? [args1, (args2 as boolean) ?? true]
|
|
881
|
+
: [{ [args1]: args2 as State | State[] }, args3];
|
|
2886
882
|
|
|
2887
|
-
|
|
2888
|
-
* Retrieve the current undo stack which consists of operations that were undone
|
|
2889
|
-
*/
|
|
2890
|
-
public getRedoStack() {
|
|
2891
|
-
const history = this.getHistoryPlugin();
|
|
2892
|
-
return history?.getRedoStack();
|
|
2893
|
-
}
|
|
883
|
+
emit(this, new ElementStateChangeEvent(GraphEvent.BEFORE_ELEMENT_STATE_CHANGE, config));
|
|
2894
884
|
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
885
|
+
const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
|
|
886
|
+
Object.entries(config).forEach(([id, value]) => {
|
|
887
|
+
const elementType = this.getElementType(id);
|
|
888
|
+
dataToUpdate[`${elementType}s`].push({ id, style: { states: Array.isArray(value) ? value : [value] } });
|
|
889
|
+
});
|
|
890
|
+
this.updateData(dataToUpdate);
|
|
891
|
+
|
|
892
|
+
await this.context.element!.draw({ animation });
|
|
893
|
+
emit(this, new ElementStateChangeEvent(GraphEvent.AFTER_ELEMENT_STATE_CHANGE, config));
|
|
2902
894
|
}
|
|
2903
895
|
|
|
2904
896
|
/**
|
|
2905
|
-
*
|
|
2906
|
-
*
|
|
2907
|
-
*
|
|
897
|
+
* <zh/> 获取元素状态
|
|
898
|
+
*
|
|
899
|
+
* <en/> Get element state
|
|
900
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
901
|
+
* @returns <zh/> 元素状态 | <en/> element state
|
|
2908
902
|
*/
|
|
2909
|
-
public
|
|
2910
|
-
|
|
2911
|
-
history?.undo();
|
|
903
|
+
public getElementState(id: ID): State[] {
|
|
904
|
+
return this.context.model.getElementState(id);
|
|
2912
905
|
}
|
|
2913
906
|
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
* @param steps The number of operations to redo. Default to 1.
|
|
2917
|
-
* @returns
|
|
2918
|
-
*/
|
|
2919
|
-
public redo() {
|
|
2920
|
-
const history = this.getHistoryPlugin();
|
|
2921
|
-
history?.redo();
|
|
907
|
+
public getElementRenderBounds(id: ID): AABB {
|
|
908
|
+
return this.context.element!.getElement(id)!.getRenderBounds();
|
|
2922
909
|
}
|
|
2923
910
|
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
public canUndo() {
|
|
2928
|
-
const history = this.getHistoryPlugin();
|
|
2929
|
-
return history?.canUndo();
|
|
911
|
+
public async collapse(id: ID, animation: boolean = true): Promise<void> {
|
|
912
|
+
this.setElementCollapsibility(id, true);
|
|
913
|
+
await this.context.element!.draw({ animation, stage: 'collapse' });
|
|
2930
914
|
}
|
|
2931
915
|
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
public canRedo() {
|
|
2936
|
-
const history = this.getHistoryPlugin();
|
|
2937
|
-
return history?.canRedo();
|
|
916
|
+
public async expand(id: ID, animation: boolean = true): Promise<void> {
|
|
917
|
+
this.setElementCollapsibility(id, false);
|
|
918
|
+
await this.context.element!.draw({ animation, stage: 'expand' });
|
|
2938
919
|
}
|
|
2939
920
|
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
*/
|
|
2945
|
-
public startHistoryBatch() {
|
|
2946
|
-
const history = this.getHistoryPlugin();
|
|
2947
|
-
history?.startHistoryBatch();
|
|
921
|
+
private setElementCollapsibility(id: ID, collapsed: boolean) {
|
|
922
|
+
const elementType = this.getElementType(id);
|
|
923
|
+
if (elementType === 'node') this.updateNodeData([{ id, style: { collapsed } }]);
|
|
924
|
+
else if (elementType === 'combo') this.updateComboData([{ id, style: { collapsed } }]);
|
|
2948
925
|
}
|
|
2949
926
|
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
2953
|
-
* treated as a single operation when undoing or redoing.
|
|
2954
|
-
*/
|
|
2955
|
-
public stopHistoryBatch() {
|
|
2956
|
-
const history = this.getHistoryPlugin();
|
|
2957
|
-
history?.stopHistoryBatch();
|
|
927
|
+
public async toDataURL(options: Partial<DataURLOptions> = {}): Promise<string> {
|
|
928
|
+
return this.context.canvas!.toDataURL(options);
|
|
2958
929
|
}
|
|
2959
930
|
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
* All operations performed inside callback will be treated as a composite operation
|
|
2963
|
-
* more convenient way without manually invoking `startHistoryBatch` and `stopHistoryBatch`.
|
|
2964
|
-
* @param callback The func containing operations to be batched together.
|
|
2965
|
-
*/
|
|
2966
|
-
public historyBatch(callback: () => void) {
|
|
2967
|
-
const history = this.getHistoryPlugin();
|
|
2968
|
-
history?.historyBatch(callback);
|
|
931
|
+
public getCanvasByViewport(point: Point): Point {
|
|
932
|
+
return parsePoint(this.context.canvas!.viewport2Canvas(toPointObject(point)));
|
|
2969
933
|
}
|
|
2970
934
|
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
* @param {StackType} stackType undo/redo stack
|
|
2974
|
-
*/
|
|
2975
|
-
public cleanHistory(stackType?: StackType) {
|
|
2976
|
-
const history = this.getHistoryPlugin();
|
|
2977
|
-
if (!stackType) return history?.clear();
|
|
2978
|
-
return stackType === 'undo'
|
|
2979
|
-
? history?.clearUndoStack()
|
|
2980
|
-
: history?.clearRedoStack();
|
|
935
|
+
public getViewportByCanvas(point: Point): Point {
|
|
936
|
+
return parsePoint(this.context.canvas.canvas2Viewport(toPointObject(point)));
|
|
2981
937
|
}
|
|
2982
938
|
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
* @param disableAnimate Whether disable the animations for this operation.
|
|
2987
|
-
* @param stack Whether push this operation to stack.
|
|
2988
|
-
* @returns
|
|
2989
|
-
* @group Tree
|
|
2990
|
-
*/
|
|
2991
|
-
public collapse(ids: ID | ID[], disableAnimate = false) {
|
|
2992
|
-
this.hooks.treecollapseexpand.emit({
|
|
2993
|
-
ids: isArray(ids) ? ids : [ids],
|
|
2994
|
-
action: 'collapse',
|
|
2995
|
-
animate: !disableAnimate,
|
|
2996
|
-
graphCore: this.dataController.graphCore,
|
|
2997
|
-
});
|
|
939
|
+
public getClientByCanvas(point: Point): Point {
|
|
940
|
+
const viewportPoint = this.context.canvas.canvas2Viewport(toPointObject(point));
|
|
941
|
+
return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
|
|
2998
942
|
}
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
* @param stack Whether push this operation to stack.
|
|
3004
|
-
* @returns
|
|
3005
|
-
* @group Tree
|
|
3006
|
-
*/
|
|
3007
|
-
public expand(ids: ID | ID[], disableAnimate = false) {
|
|
3008
|
-
this.hooks.treecollapseexpand.emit({
|
|
3009
|
-
ids: isArray(ids) ? ids : [ids],
|
|
3010
|
-
action: 'expand',
|
|
3011
|
-
animate: !disableAnimate,
|
|
3012
|
-
graphCore: this.dataController.graphCore,
|
|
3013
|
-
});
|
|
943
|
+
|
|
944
|
+
public getCanvasByClient(point: Point): Point {
|
|
945
|
+
const viewportPoint = this.context.canvas.client2Viewport(toPointObject(point));
|
|
946
|
+
return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
|
|
3014
947
|
}
|
|
3015
948
|
|
|
3016
949
|
/**
|
|
3017
|
-
*
|
|
3018
|
-
*
|
|
3019
|
-
*
|
|
950
|
+
* <zh/> 获取视口中心的画布坐标
|
|
951
|
+
*
|
|
952
|
+
* <en/> Get the canvas coordinates of the viewport center
|
|
953
|
+
* @returns <zh/> 视口中心的画布坐标 | <en/> Canvas coordinates of the viewport center
|
|
3020
954
|
*/
|
|
3021
|
-
public
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
// @ts-ignore
|
|
3025
|
-
if (camera.landmarks?.length) {
|
|
3026
|
-
camera.cancelLandmarkAnimation();
|
|
3027
|
-
transientCamera.cancelLandmarkAnimation();
|
|
3028
|
-
this.emit('cancelviewportanimation');
|
|
3029
|
-
}
|
|
3030
|
-
|
|
3031
|
-
this.canvas.destroy();
|
|
3032
|
-
this.labelCanvas.destroy();
|
|
3033
|
-
this.backgroundCanvas.destroy();
|
|
3034
|
-
this.transientCanvas.destroy();
|
|
3035
|
-
this.transientLabelCanvas.destroy();
|
|
3036
|
-
|
|
3037
|
-
// clear history stack
|
|
3038
|
-
this.cleanHistory();
|
|
3039
|
-
|
|
3040
|
-
callback?.();
|
|
3041
|
-
|
|
3042
|
-
this.hooks.destroy.emit({});
|
|
3043
|
-
|
|
3044
|
-
// TODO: destroy controllers and off the listeners
|
|
3045
|
-
// this.dataController.destroy();
|
|
3046
|
-
// this.interactionController.destroy();
|
|
3047
|
-
// this.layoutController.destroy();
|
|
3048
|
-
// this.themeController.destroy();
|
|
3049
|
-
// this.itemController.destroy();
|
|
955
|
+
public getViewportCenter(): Point {
|
|
956
|
+
return this.context.viewport!.getViewportCenter();
|
|
957
|
+
}
|
|
3050
958
|
|
|
3051
|
-
|
|
959
|
+
public getCanvasCenter(): Point {
|
|
960
|
+
return this.context.viewport!.getCanvasCenter();
|
|
3052
961
|
}
|
|
962
|
+
|
|
963
|
+
private onResize = debounce(() => {
|
|
964
|
+
this.resize();
|
|
965
|
+
}, 300);
|
|
3053
966
|
}
|