@antv/g6 5.0.0-beta.32 → 5.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +2 -2
- package/dist/lib/behaviors/brush-select.d.ts +103 -0
- package/dist/lib/behaviors/click-element.d.ts +77 -0
- package/dist/lib/behaviors/collapse-expand.d.ts +1 -2
- package/dist/lib/behaviors/create-edge.d.ts +1 -2
- package/dist/lib/behaviors/drag-element-force.d.ts +13 -0
- package/dist/lib/behaviors/drag-element.d.ts +12 -12
- package/dist/lib/behaviors/index.d.ts +8 -0
- package/dist/lib/behaviors/lasso-select.d.ts +19 -0
- package/dist/lib/behaviors/types.d.ts +1 -0
- package/dist/lib/constants/change.d.ts +1 -1
- package/dist/lib/constants/events/animation.d.ts +1 -4
- package/dist/lib/constants/events/graph.d.ts +9 -7
- package/dist/lib/constants/registry.d.ts +3 -1
- package/dist/lib/elements/combos/base-combo.d.ts +43 -6
- package/dist/lib/elements/combos/circle.d.ts +8 -12
- package/dist/lib/elements/combos/rect.d.ts +5 -9
- package/dist/lib/elements/edges/base-edge.d.ts +64 -10
- package/dist/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/dist/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/dist/lib/elements/edges/cubic.d.ts +2 -2
- package/dist/lib/elements/edges/polyline.d.ts +2 -2
- package/dist/lib/elements/edges/quadratic.d.ts +2 -2
- package/dist/lib/elements/nodes/base-node.d.ts +104 -14
- package/dist/lib/elements/nodes/circle.d.ts +5 -8
- package/dist/lib/elements/nodes/diamond.d.ts +2 -4
- package/dist/lib/elements/nodes/donut.d.ts +45 -0
- package/dist/lib/elements/nodes/ellipse.d.ts +5 -8
- package/dist/lib/elements/nodes/hexagon.d.ts +6 -9
- package/dist/lib/elements/nodes/html.d.ts +27 -0
- package/dist/lib/elements/nodes/image.d.ts +9 -11
- package/dist/lib/elements/nodes/index.d.ts +4 -0
- package/dist/lib/elements/nodes/polygon.d.ts +9 -8
- package/dist/lib/elements/nodes/rect.d.ts +2 -3
- package/dist/lib/elements/nodes/star.d.ts +7 -10
- package/dist/lib/elements/nodes/triangle.d.ts +7 -10
- package/dist/lib/exports.d.ts +8 -5
- package/dist/lib/layouts/index.d.ts +1 -1
- package/dist/lib/layouts/types.d.ts +6 -6
- package/dist/lib/palettes/index.d.ts +1 -0
- package/dist/lib/plugins/history/events.d.ts +21 -0
- package/dist/lib/plugins/history/index.d.ts +82 -0
- package/dist/lib/plugins/history/utils.d.ts +31 -0
- package/dist/lib/plugins/hull/index.d.ts +58 -0
- package/dist/lib/plugins/hull/shape.d.ts +49 -0
- package/dist/lib/plugins/hull/util.d.ts +12 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/registry/extension/index.d.ts +1 -1
- package/dist/lib/registry/types.d.ts +4 -0
- package/dist/lib/runtime/batch.d.ts +11 -0
- package/dist/lib/runtime/behavior.d.ts +1 -1
- package/dist/lib/runtime/canvas.d.ts +13 -3
- package/dist/lib/runtime/data.d.ts +8 -8
- package/dist/lib/runtime/element.d.ts +6 -22
- package/dist/lib/runtime/graph.d.ts +42 -5
- package/dist/lib/runtime/layout.d.ts +5 -11
- package/dist/lib/runtime/plugin.d.ts +1 -1
- package/dist/lib/runtime/transform.d.ts +11 -0
- package/dist/lib/runtime/types.d.ts +14 -0
- package/dist/lib/runtime/viewport.d.ts +1 -2
- package/dist/lib/spec/data.d.ts +74 -1
- package/dist/lib/spec/element/combo.d.ts +17 -6
- package/dist/lib/spec/element/edge.d.ts +14 -2
- package/dist/lib/spec/element/node.d.ts +19 -3
- package/dist/lib/spec/index.d.ts +1 -0
- package/dist/lib/spec/spec.d.ts +7 -0
- package/dist/lib/spec/transform.d.ts +12 -0
- package/dist/lib/themes/base.d.ts +1 -0
- package/dist/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/dist/lib/transforms/base-transform.d.ts +7 -0
- package/dist/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/dist/lib/transforms/index.d.ts +6 -0
- package/dist/lib/transforms/process-parallel-edges.d.ts +83 -0
- package/dist/lib/transforms/types.d.ts +20 -0
- package/dist/lib/transforms/update-related-edge.d.ts +9 -0
- package/dist/lib/types/callable.d.ts +2 -2
- package/dist/lib/types/canvas.d.ts +1 -1
- package/dist/lib/types/change.d.ts +27 -10
- package/dist/lib/types/data.d.ts +1 -1
- package/dist/lib/types/element.d.ts +6 -140
- package/dist/lib/types/id.d.ts +1 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/node.d.ts +3 -3
- package/dist/lib/types/point.d.ts +1 -0
- package/dist/lib/types/style.d.ts +1 -3
- package/dist/lib/utils/animation.d.ts +2 -2
- package/dist/lib/utils/behaviors/brush.d.ts +18 -0
- package/dist/lib/utils/behaviors/lasso.d.ts +12 -0
- package/dist/lib/utils/behaviors/utils.d.ts +21 -0
- package/dist/lib/utils/change.d.ts +9 -1
- package/dist/lib/utils/combo.d.ts +5 -4
- package/dist/lib/utils/edge.d.ts +12 -2
- package/dist/lib/utils/event/events.d.ts +1 -1
- package/dist/lib/utils/extension.d.ts +1 -1
- package/dist/lib/utils/id.d.ts +4 -10
- package/dist/lib/utils/line.d.ts +21 -0
- package/dist/lib/utils/palette.d.ts +1 -2
- package/dist/lib/utils/path.d.ts +35 -0
- package/dist/lib/utils/point.d.ts +74 -20
- package/dist/lib/utils/polygon.d.ts +17 -0
- package/dist/lib/utils/position.d.ts +14 -1
- package/dist/lib/utils/prefix.d.ts +1 -1
- package/dist/lib/utils/relation.d.ts +1 -2
- package/dist/lib/utils/shortcut.d.ts +1 -0
- package/dist/lib/utils/vector.d.ts +3 -2
- package/esm/behaviors/brush-select.d.ts +103 -0
- package/esm/behaviors/brush-select.js +199 -0
- package/esm/behaviors/brush-select.js.map +1 -0
- package/esm/behaviors/click-element.d.ts +77 -0
- package/esm/behaviors/click-element.js +108 -0
- package/esm/behaviors/click-element.js.map +1 -0
- package/esm/behaviors/collapse-expand.d.ts +1 -2
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/create-edge.d.ts +1 -2
- package/esm/behaviors/create-edge.js.map +1 -1
- package/esm/behaviors/drag-element-force.d.ts +13 -0
- package/esm/behaviors/drag-element-force.js +55 -0
- package/esm/behaviors/drag-element-force.js.map +1 -0
- package/esm/behaviors/drag-element.d.ts +12 -12
- package/esm/behaviors/drag-element.js +17 -9
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/focus-element.js.map +1 -1
- package/esm/behaviors/hover-element.js +2 -2
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/index.d.ts +8 -0
- package/esm/behaviors/index.js +4 -0
- package/esm/behaviors/index.js.map +1 -1
- package/esm/behaviors/lasso-select.d.ts +19 -0
- package/esm/behaviors/lasso-select.js +79 -0
- package/esm/behaviors/lasso-select.js.map +1 -0
- package/esm/behaviors/types.d.ts +1 -0
- package/esm/constants/change.d.ts +1 -1
- package/esm/constants/change.js +12 -12
- package/esm/constants/change.js.map +1 -1
- package/esm/constants/events/animation.d.ts +1 -4
- package/esm/constants/events/animation.js +0 -4
- package/esm/constants/events/animation.js.map +1 -1
- package/esm/constants/events/graph.d.ts +9 -7
- package/esm/constants/events/graph.js +8 -8
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/constants/registry.d.ts +3 -1
- package/esm/constants/registry.js +2 -0
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/combos/base-combo.d.ts +43 -6
- package/esm/elements/combos/base-combo.js.map +1 -1
- package/esm/elements/combos/circle.d.ts +8 -12
- package/esm/elements/combos/circle.js.map +1 -1
- package/esm/elements/combos/rect.d.ts +5 -9
- package/esm/elements/combos/rect.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +64 -10
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/cubic-horizontal.d.ts +2 -2
- package/esm/elements/edges/cubic-vertical.d.ts +2 -2
- package/esm/elements/edges/cubic.d.ts +2 -2
- package/esm/elements/edges/polyline.d.ts +2 -2
- package/esm/elements/edges/quadratic.d.ts +2 -2
- package/esm/elements/nodes/base-node.d.ts +104 -14
- package/esm/elements/nodes/base-node.js +4 -1
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/circle.d.ts +5 -8
- package/esm/elements/nodes/circle.js.map +1 -1
- package/esm/elements/nodes/diamond.d.ts +2 -4
- package/esm/elements/nodes/diamond.js +2 -2
- package/esm/elements/nodes/diamond.js.map +1 -1
- package/esm/elements/nodes/donut.d.ts +45 -0
- package/esm/elements/nodes/donut.js +81 -0
- package/esm/elements/nodes/donut.js.map +1 -0
- package/esm/elements/nodes/ellipse.d.ts +5 -8
- package/esm/elements/nodes/ellipse.js +1 -1
- package/esm/elements/nodes/ellipse.js.map +1 -1
- package/esm/elements/nodes/hexagon.d.ts +6 -9
- package/esm/elements/nodes/hexagon.js.map +1 -1
- package/esm/elements/nodes/html.d.ts +27 -0
- package/esm/elements/nodes/html.js +209 -0
- package/esm/elements/nodes/html.js.map +1 -0
- package/esm/elements/nodes/image.d.ts +9 -11
- package/esm/elements/nodes/image.js.map +1 -1
- package/esm/elements/nodes/index.d.ts +4 -0
- package/esm/elements/nodes/index.js +2 -0
- package/esm/elements/nodes/index.js.map +1 -1
- package/esm/elements/nodes/polygon.d.ts +9 -8
- package/esm/elements/nodes/polygon.js +4 -1
- package/esm/elements/nodes/polygon.js.map +1 -1
- package/esm/elements/nodes/rect.d.ts +2 -3
- package/esm/elements/nodes/rect.js.map +1 -1
- package/esm/elements/nodes/star.d.ts +7 -10
- package/esm/elements/nodes/star.js.map +1 -1
- package/esm/elements/nodes/triangle.d.ts +7 -10
- package/esm/elements/nodes/triangle.js.map +1 -1
- package/esm/exports.d.ts +8 -5
- package/esm/exports.js +4 -2
- package/esm/exports.js.map +1 -1
- package/esm/layouts/index.d.ts +1 -1
- package/esm/layouts/index.js +1 -1
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/types.d.ts +6 -6
- package/esm/palettes/index.d.ts +1 -0
- package/esm/palettes/index.js +12 -0
- package/esm/palettes/index.js.map +1 -1
- package/esm/plugins/history/events.d.ts +21 -0
- package/esm/plugins/history/events.js +16 -0
- package/esm/plugins/history/events.js.map +1 -0
- package/esm/plugins/history/index.d.ts +82 -0
- package/esm/plugins/history/index.js +168 -0
- package/esm/plugins/history/index.js.map +1 -0
- package/esm/plugins/history/utils.d.ts +31 -0
- package/esm/plugins/history/utils.js +79 -0
- package/esm/plugins/history/utils.js.map +1 -0
- package/esm/plugins/hull/index.d.ts +58 -0
- package/esm/plugins/hull/index.js +107 -0
- package/esm/plugins/hull/index.js.map +1 -0
- package/esm/plugins/hull/shape.d.ts +49 -0
- package/esm/plugins/hull/shape.js +35 -0
- package/esm/plugins/hull/shape.js.map +1 -0
- package/esm/plugins/hull/util.d.ts +12 -0
- package/esm/plugins/hull/util.js +203 -0
- package/esm/plugins/hull/util.js.map +1 -0
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +2 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/legend.js +3 -2
- package/esm/plugins/legend.js.map +1 -1
- package/esm/registry/build-in.js +24 -7
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/extension/index.d.ts +1 -1
- package/esm/registry/index.js +1 -0
- package/esm/registry/index.js.map +1 -1
- package/esm/registry/types.d.ts +4 -0
- package/esm/runtime/batch.d.ts +11 -0
- package/esm/runtime/batch.js +31 -0
- package/esm/runtime/batch.js.map +1 -0
- package/esm/runtime/behavior.d.ts +1 -1
- package/esm/runtime/behavior.js.map +1 -1
- package/esm/runtime/canvas.d.ts +13 -3
- package/esm/runtime/canvas.js +40 -13
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +8 -8
- package/esm/runtime/data.js +23 -25
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +6 -22
- package/esm/runtime/element.js +73 -177
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +42 -5
- package/esm/runtime/graph.js +68 -10
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +5 -11
- package/esm/runtime/layout.js +31 -77
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plugin.d.ts +1 -1
- package/esm/runtime/plugin.js.map +1 -1
- package/esm/runtime/transform.d.ts +11 -0
- package/esm/runtime/transform.js +20 -0
- package/esm/runtime/transform.js.map +1 -0
- package/esm/runtime/types.d.ts +14 -0
- package/esm/runtime/viewport.d.ts +1 -2
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/spec/data.d.ts +74 -1
- package/esm/spec/element/combo.d.ts +17 -6
- package/esm/spec/element/edge.d.ts +14 -2
- package/esm/spec/element/node.d.ts +19 -3
- package/esm/spec/index.d.ts +1 -0
- package/esm/spec/spec.d.ts +7 -0
- package/esm/spec/transform.d.ts +12 -0
- package/esm/spec/transform.js +2 -0
- package/esm/spec/transform.js.map +1 -0
- package/esm/themes/base.d.ts +1 -0
- package/esm/themes/base.js +11 -1
- package/esm/themes/base.js.map +1 -1
- package/esm/transforms/arrange-draw-order.d.ts +10 -0
- package/esm/transforms/arrange-draw-order.js +27 -0
- package/esm/transforms/arrange-draw-order.js.map +1 -0
- package/esm/transforms/base-transform.d.ts +7 -0
- package/esm/transforms/base-transform.js +7 -0
- package/esm/transforms/base-transform.js.map +1 -0
- package/esm/transforms/collapse-expand-combo.d.ts +10 -0
- package/esm/transforms/collapse-expand-combo.js +82 -0
- package/esm/transforms/collapse-expand-combo.js.map +1 -0
- package/esm/transforms/index.d.ts +6 -0
- package/esm/transforms/index.js +6 -0
- package/esm/transforms/index.js.map +1 -0
- package/esm/transforms/process-parallel-edges.d.ts +83 -0
- package/esm/transforms/process-parallel-edges.js +213 -0
- package/esm/transforms/process-parallel-edges.js.map +1 -0
- package/esm/transforms/types.d.ts +20 -0
- package/esm/transforms/types.js +11 -0
- package/esm/transforms/types.js.map +1 -0
- package/esm/transforms/update-related-edge.d.ts +9 -0
- package/esm/transforms/update-related-edge.js +20 -0
- package/esm/transforms/update-related-edge.js.map +1 -0
- package/esm/types/callable.d.ts +2 -2
- package/esm/types/canvas.d.ts +1 -1
- package/esm/types/change.d.ts +27 -10
- package/esm/types/data.d.ts +1 -1
- package/esm/types/element.d.ts +6 -140
- package/esm/types/id.d.ts +1 -0
- package/esm/types/id.js +2 -0
- package/esm/types/id.js.map +1 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/node.d.ts +3 -3
- package/esm/types/point.d.ts +1 -0
- package/esm/types/style.d.ts +1 -3
- package/esm/utils/animation.d.ts +2 -2
- package/esm/utils/animation.js +7 -1
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/behaviors/brush.d.ts +18 -0
- package/esm/utils/behaviors/brush.js +25 -0
- package/esm/utils/behaviors/brush.js.map +1 -0
- package/esm/utils/behaviors/lasso.d.ts +12 -0
- package/esm/utils/behaviors/lasso.js +112 -0
- package/esm/utils/behaviors/lasso.js.map +1 -0
- package/esm/utils/behaviors/utils.d.ts +21 -0
- package/esm/utils/behaviors/utils.js +42 -0
- package/esm/utils/behaviors/utils.js.map +1 -0
- package/esm/utils/change.d.ts +9 -1
- package/esm/utils/change.js +28 -0
- package/esm/utils/change.js.map +1 -1
- package/esm/utils/combo.d.ts +5 -4
- package/esm/utils/combo.js.map +1 -1
- package/esm/utils/edge.d.ts +12 -2
- package/esm/utils/edge.js +1 -1
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/event/events.d.ts +1 -1
- package/esm/utils/event/events.js.map +1 -1
- package/esm/utils/extension.d.ts +1 -1
- package/esm/utils/extension.js.map +1 -1
- package/esm/utils/id.d.ts +4 -10
- package/esm/utils/id.js +8 -2
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/line.d.ts +21 -0
- package/esm/utils/line.js +41 -0
- package/esm/utils/line.js.map +1 -0
- package/esm/utils/palette.d.ts +1 -2
- package/esm/utils/palette.js.map +1 -1
- package/esm/utils/path.d.ts +35 -0
- package/esm/utils/path.js +143 -0
- package/esm/utils/path.js.map +1 -0
- package/esm/utils/point.d.ts +74 -20
- package/esm/utils/point.js +168 -44
- package/esm/utils/point.js.map +1 -1
- package/esm/utils/polygon.d.ts +17 -0
- package/esm/utils/polygon.js +62 -0
- package/esm/utils/polygon.js.map +1 -0
- package/esm/utils/position.d.ts +14 -1
- package/esm/utils/position.js +16 -0
- package/esm/utils/position.js.map +1 -1
- package/esm/utils/prefix.d.ts +1 -1
- package/esm/utils/prefix.js.map +1 -1
- package/esm/utils/relation.d.ts +1 -2
- package/esm/utils/relation.js.map +1 -1
- package/esm/utils/shortcut.d.ts +1 -0
- package/esm/utils/shortcut.js +13 -2
- package/esm/utils/shortcut.js.map +1 -1
- package/esm/utils/style.js +3 -3
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/vector.d.ts +3 -2
- package/esm/utils/vector.js +10 -3
- package/esm/utils/vector.js.map +1 -1
- package/lib/behaviors/brush-select.d.ts +103 -0
- package/lib/behaviors/brush-select.js +203 -0
- package/lib/behaviors/brush-select.js.map +1 -0
- package/lib/behaviors/click-element.d.ts +77 -0
- package/lib/behaviors/click-element.js +112 -0
- package/lib/behaviors/click-element.js.map +1 -0
- package/lib/behaviors/collapse-expand.d.ts +1 -2
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/create-edge.d.ts +1 -2
- package/lib/behaviors/create-edge.js.map +1 -1
- package/lib/behaviors/drag-element-force.d.ts +13 -0
- package/lib/behaviors/drag-element-force.js +59 -0
- package/lib/behaviors/drag-element-force.js.map +1 -0
- package/lib/behaviors/drag-element.d.ts +12 -12
- package/lib/behaviors/drag-element.js +17 -9
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/focus-element.js.map +1 -1
- package/lib/behaviors/hover-element.js +1 -1
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/index.d.ts +8 -0
- package/lib/behaviors/index.js +9 -1
- package/lib/behaviors/index.js.map +1 -1
- package/lib/behaviors/lasso-select.d.ts +19 -0
- package/lib/behaviors/lasso-select.js +83 -0
- package/lib/behaviors/lasso-select.js.map +1 -0
- package/lib/behaviors/types.d.ts +1 -0
- package/lib/constants/change.d.ts +1 -1
- package/lib/constants/change.js +13 -13
- package/lib/constants/change.js.map +1 -1
- package/lib/constants/events/animation.d.ts +1 -4
- package/lib/constants/events/animation.js +0 -4
- package/lib/constants/events/animation.js.map +1 -1
- package/lib/constants/events/graph.d.ts +9 -7
- package/lib/constants/events/graph.js +9 -9
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/constants/registry.d.ts +3 -1
- package/lib/constants/registry.js +2 -0
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/combos/base-combo.d.ts +43 -6
- package/lib/elements/combos/base-combo.js.map +1 -1
- package/lib/elements/combos/circle.d.ts +8 -12
- package/lib/elements/combos/circle.js.map +1 -1
- package/lib/elements/combos/rect.d.ts +5 -9
- package/lib/elements/combos/rect.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +64 -10
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/lib/elements/edges/cubic.d.ts +2 -2
- package/lib/elements/edges/polyline.d.ts +2 -2
- package/lib/elements/edges/quadratic.d.ts +2 -2
- package/lib/elements/nodes/base-node.d.ts +104 -14
- package/lib/elements/nodes/base-node.js +4 -1
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/circle.d.ts +5 -8
- package/lib/elements/nodes/circle.js.map +1 -1
- package/lib/elements/nodes/diamond.d.ts +2 -4
- package/lib/elements/nodes/diamond.js +2 -2
- package/lib/elements/nodes/diamond.js.map +1 -1
- package/lib/elements/nodes/donut.d.ts +45 -0
- package/lib/elements/nodes/donut.js +85 -0
- package/lib/elements/nodes/donut.js.map +1 -0
- package/lib/elements/nodes/ellipse.d.ts +5 -8
- package/lib/elements/nodes/ellipse.js +1 -1
- package/lib/elements/nodes/ellipse.js.map +1 -1
- package/lib/elements/nodes/hexagon.d.ts +6 -9
- package/lib/elements/nodes/hexagon.js.map +1 -1
- package/lib/elements/nodes/html.d.ts +27 -0
- package/lib/elements/nodes/html.js +213 -0
- package/lib/elements/nodes/html.js.map +1 -0
- package/lib/elements/nodes/image.d.ts +9 -11
- package/lib/elements/nodes/image.js.map +1 -1
- package/lib/elements/nodes/index.d.ts +4 -0
- package/lib/elements/nodes/index.js +5 -1
- package/lib/elements/nodes/index.js.map +1 -1
- package/lib/elements/nodes/polygon.d.ts +9 -8
- package/lib/elements/nodes/polygon.js +4 -1
- package/lib/elements/nodes/polygon.js.map +1 -1
- package/lib/elements/nodes/rect.d.ts +2 -3
- package/lib/elements/nodes/rect.js.map +1 -1
- package/lib/elements/nodes/star.d.ts +7 -10
- package/lib/elements/nodes/star.js.map +1 -1
- package/lib/elements/nodes/triangle.d.ts +7 -10
- package/lib/elements/nodes/triangle.js.map +1 -1
- package/lib/exports.d.ts +8 -5
- package/lib/exports.js +8 -1
- package/lib/exports.js.map +1 -1
- package/lib/layouts/index.d.ts +1 -1
- package/lib/layouts/index.js +2 -1
- package/lib/layouts/index.js.map +1 -1
- package/lib/layouts/types.d.ts +6 -6
- package/lib/palettes/index.d.ts +1 -0
- package/lib/palettes/index.js +13 -1
- package/lib/palettes/index.js.map +1 -1
- package/lib/plugins/history/events.d.ts +21 -0
- package/lib/plugins/history/events.js +19 -0
- package/lib/plugins/history/events.js.map +1 -0
- package/lib/plugins/history/index.d.ts +82 -0
- package/lib/plugins/history/index.js +175 -0
- package/lib/plugins/history/index.js.map +1 -0
- package/lib/plugins/history/utils.d.ts +31 -0
- package/lib/plugins/history/utils.js +84 -0
- package/lib/plugins/history/utils.js.map +1 -0
- package/lib/plugins/hull/index.d.ts +58 -0
- package/lib/plugins/hull/index.js +114 -0
- package/lib/plugins/hull/index.js.map +1 -0
- package/lib/plugins/hull/shape.d.ts +49 -0
- package/lib/plugins/hull/shape.js +39 -0
- package/lib/plugins/hull/shape.js.map +1 -0
- package/lib/plugins/hull/util.d.ts +12 -0
- package/lib/plugins/hull/util.js +207 -0
- package/lib/plugins/hull/util.js.map +1 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/legend.js +3 -2
- package/lib/plugins/legend.js.map +1 -1
- package/lib/registry/build-in.js +19 -2
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/extension/index.d.ts +1 -1
- package/lib/registry/index.js +1 -0
- package/lib/registry/index.js.map +1 -1
- package/lib/registry/types.d.ts +4 -0
- package/lib/runtime/batch.d.ts +11 -0
- package/lib/runtime/batch.js +35 -0
- package/lib/runtime/batch.js.map +1 -0
- package/lib/runtime/behavior.d.ts +1 -1
- package/lib/runtime/behavior.js.map +1 -1
- package/lib/runtime/canvas.d.ts +13 -3
- package/lib/runtime/canvas.js +38 -11
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +8 -8
- package/lib/runtime/data.js +22 -24
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +6 -22
- package/lib/runtime/element.js +72 -176
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +42 -5
- package/lib/runtime/graph.js +67 -9
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +5 -11
- package/lib/runtime/layout.js +29 -75
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plugin.d.ts +1 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/runtime/transform.d.ts +11 -0
- package/lib/runtime/transform.js +24 -0
- package/lib/runtime/transform.js.map +1 -0
- package/lib/runtime/types.d.ts +14 -0
- package/lib/runtime/viewport.d.ts +1 -2
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/spec/data.d.ts +74 -1
- package/lib/spec/element/combo.d.ts +17 -6
- package/lib/spec/element/edge.d.ts +14 -2
- package/lib/spec/element/node.d.ts +19 -3
- package/lib/spec/index.d.ts +1 -0
- package/lib/spec/spec.d.ts +7 -0
- package/lib/spec/transform.d.ts +12 -0
- package/lib/spec/transform.js +3 -0
- package/lib/spec/transform.js.map +1 -0
- package/lib/themes/base.d.ts +1 -0
- package/lib/themes/base.js +11 -1
- package/lib/themes/base.js.map +1 -1
- package/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/lib/transforms/arrange-draw-order.js +31 -0
- package/lib/transforms/arrange-draw-order.js.map +1 -0
- package/lib/transforms/base-transform.d.ts +7 -0
- package/lib/transforms/base-transform.js +11 -0
- package/lib/transforms/base-transform.js.map +1 -0
- package/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/lib/transforms/collapse-expand-combo.js +86 -0
- package/lib/transforms/collapse-expand-combo.js.map +1 -0
- package/lib/transforms/index.d.ts +6 -0
- package/lib/transforms/index.js +14 -0
- package/lib/transforms/index.js.map +1 -0
- package/lib/transforms/process-parallel-edges.d.ts +83 -0
- package/lib/transforms/process-parallel-edges.js +220 -0
- package/lib/transforms/process-parallel-edges.js.map +1 -0
- package/lib/transforms/types.d.ts +20 -0
- package/lib/transforms/types.js +15 -0
- package/lib/transforms/types.js.map +1 -0
- package/lib/transforms/update-related-edge.d.ts +9 -0
- package/lib/transforms/update-related-edge.js +24 -0
- package/lib/transforms/update-related-edge.js.map +1 -0
- package/lib/types/callable.d.ts +2 -2
- package/lib/types/canvas.d.ts +1 -1
- package/lib/types/change.d.ts +27 -10
- package/lib/types/data.d.ts +1 -1
- package/lib/types/element.d.ts +6 -140
- package/lib/types/id.d.ts +1 -0
- package/lib/{spec/element/base.js → types/id.js} +1 -1
- package/lib/types/id.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/node.d.ts +3 -3
- package/lib/types/point.d.ts +1 -0
- package/lib/types/style.d.ts +1 -3
- package/lib/utils/animation.d.ts +2 -2
- package/lib/utils/animation.js +7 -1
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/behaviors/brush.d.ts +18 -0
- package/lib/utils/behaviors/brush.js +30 -0
- package/lib/utils/behaviors/brush.js.map +1 -0
- package/lib/utils/behaviors/lasso.d.ts +12 -0
- package/lib/utils/behaviors/lasso.js +116 -0
- package/lib/utils/behaviors/lasso.js.map +1 -0
- package/lib/utils/behaviors/utils.d.ts +21 -0
- package/lib/utils/behaviors/utils.js +47 -0
- package/lib/utils/behaviors/utils.js.map +1 -0
- package/lib/utils/change.d.ts +9 -1
- package/lib/utils/change.js +30 -1
- package/lib/utils/change.js.map +1 -1
- package/lib/utils/combo.d.ts +5 -4
- package/lib/utils/combo.js.map +1 -1
- package/lib/utils/edge.d.ts +12 -2
- package/lib/utils/edge.js +2 -1
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/event/events.d.ts +1 -1
- package/lib/utils/event/events.js.map +1 -1
- package/lib/utils/extension.d.ts +1 -1
- package/lib/utils/extension.js.map +1 -1
- package/lib/utils/id.d.ts +4 -10
- package/lib/utils/id.js +10 -4
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/line.d.ts +21 -0
- package/lib/utils/line.js +46 -0
- package/lib/utils/line.js.map +1 -0
- package/lib/utils/palette.d.ts +1 -2
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/path.d.ts +35 -0
- package/lib/utils/path.js +150 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/point.d.ts +74 -20
- package/lib/utils/point.js +178 -48
- package/lib/utils/point.js.map +1 -1
- package/lib/utils/polygon.d.ts +17 -0
- package/lib/utils/polygon.js +66 -0
- package/lib/utils/polygon.js.map +1 -0
- package/lib/utils/position.d.ts +14 -1
- package/lib/utils/position.js +18 -1
- package/lib/utils/position.js.map +1 -1
- package/lib/utils/prefix.d.ts +1 -1
- package/lib/utils/prefix.js.map +1 -1
- package/lib/utils/relation.d.ts +1 -2
- package/lib/utils/relation.js.map +1 -1
- package/lib/utils/shortcut.d.ts +1 -0
- package/lib/utils/shortcut.js +12 -1
- package/lib/utils/shortcut.js.map +1 -1
- package/lib/utils/style.js +3 -3
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/vector.d.ts +3 -2
- package/lib/utils/vector.js +10 -3
- package/lib/utils/vector.js.map +1 -1
- package/package.json +5 -6
- package/src/behaviors/brush-select.ts +305 -0
- package/src/behaviors/click-element.ts +181 -0
- package/src/behaviors/collapse-expand.ts +1 -2
- package/src/behaviors/create-edge.ts +1 -2
- package/src/behaviors/drag-element-force.ts +69 -0
- package/src/behaviors/drag-element.ts +27 -18
- package/src/behaviors/focus-element.ts +1 -2
- package/src/behaviors/hover-element.ts +3 -5
- package/src/behaviors/index.ts +8 -0
- package/src/behaviors/lasso-select.ts +102 -0
- package/src/behaviors/types.ts +2 -0
- package/src/constants/change.ts +1 -1
- package/src/constants/events/animation.ts +0 -4
- package/src/constants/events/graph.ts +8 -8
- package/src/constants/registry.ts +2 -0
- package/src/elements/combos/base-combo.ts +59 -10
- package/src/elements/combos/circle.ts +8 -11
- package/src/elements/combos/rect.ts +5 -8
- package/src/elements/edges/base-edge.ts +70 -13
- package/src/elements/edges/cubic-horizontal.ts +2 -2
- package/src/elements/edges/cubic-vertical.ts +2 -2
- package/src/elements/edges/cubic.ts +2 -2
- package/src/elements/edges/polyline.ts +2 -2
- package/src/elements/edges/quadratic.ts +2 -2
- package/src/elements/nodes/base-node.ts +117 -21
- package/src/elements/nodes/circle.ts +5 -7
- package/src/elements/nodes/diamond.ts +4 -6
- package/src/elements/nodes/donut.ts +137 -0
- package/src/elements/nodes/ellipse.ts +6 -8
- package/src/elements/nodes/hexagon.ts +7 -9
- package/src/elements/nodes/html.ts +230 -0
- package/src/elements/nodes/image.ts +12 -13
- package/src/elements/nodes/index.ts +4 -0
- package/src/elements/nodes/polygon.ts +17 -11
- package/src/elements/nodes/rect.ts +3 -4
- package/src/elements/nodes/star.ts +9 -11
- package/src/elements/nodes/triangle.ts +7 -9
- package/src/exports.ts +24 -3
- package/src/layouts/index.ts +1 -0
- package/src/layouts/types.ts +7 -5
- package/src/palettes/index.ts +13 -0
- package/src/plugins/history/events.ts +25 -0
- package/src/plugins/history/index.ts +222 -0
- package/src/plugins/history/utils.ts +98 -0
- package/src/plugins/hull/index.ts +148 -0
- package/src/plugins/hull/shape.ts +96 -0
- package/src/plugins/hull/util.ts +222 -0
- package/src/plugins/index.ts +4 -0
- package/src/plugins/legend.ts +5 -5
- package/src/registry/build-in.ts +28 -4
- package/src/registry/extension/index.ts +1 -1
- package/src/registry/index.ts +1 -0
- package/src/registry/types.ts +2 -0
- package/src/runtime/batch.ts +38 -0
- package/src/runtime/behavior.ts +1 -1
- package/src/runtime/canvas.ts +55 -14
- package/src/runtime/data.ts +33 -37
- package/src/runtime/element.ts +90 -203
- package/src/runtime/graph.ts +78 -13
- package/src/runtime/layout.ts +50 -81
- package/src/runtime/plugin.ts +1 -1
- package/src/runtime/transform.ts +27 -0
- package/src/runtime/types.ts +14 -0
- package/src/runtime/viewport.ts +1 -2
- package/src/spec/data.ts +74 -1
- package/src/spec/element/combo.ts +17 -6
- package/src/spec/element/edge.ts +14 -2
- package/src/spec/element/node.ts +19 -3
- package/src/spec/index.ts +1 -0
- package/src/spec/spec.ts +7 -0
- package/src/spec/transform.ts +15 -0
- package/src/themes/base.ts +12 -1
- package/src/transforms/arrange-draw-order.ts +36 -0
- package/src/transforms/base-transform.ts +11 -0
- package/src/transforms/collapse-expand-combo.ts +87 -0
- package/src/transforms/index.ts +7 -0
- package/src/transforms/process-parallel-edges.ts +284 -0
- package/src/transforms/types.ts +23 -0
- package/src/transforms/update-related-edge.ts +27 -0
- package/src/types/callable.ts +2 -2
- package/src/types/canvas.ts +1 -1
- package/src/types/change.ts +28 -10
- package/src/types/data.ts +1 -1
- package/src/types/element.ts +6 -147
- package/src/types/id.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/node.ts +3 -3
- package/src/types/point.ts +1 -0
- package/src/types/style.ts +1 -3
- package/src/utils/animation.ts +8 -2
- package/src/utils/behaviors/brush.ts +28 -0
- package/src/utils/behaviors/lasso.ts +126 -0
- package/src/utils/behaviors/utils.ts +47 -0
- package/src/utils/change.ts +42 -2
- package/src/utils/combo.ts +6 -5
- package/src/utils/edge.ts +7 -2
- package/src/utils/event/events.ts +3 -1
- package/src/utils/extension.ts +1 -1
- package/src/utils/id.ts +11 -3
- package/src/utils/line.ts +50 -0
- package/src/utils/palette.ts +1 -1
- package/src/utils/path.ts +153 -0
- package/src/utils/point.ts +190 -51
- package/src/utils/polygon.ts +72 -0
- package/src/utils/position.ts +18 -1
- package/src/utils/prefix.ts +1 -1
- package/src/utils/relation.ts +1 -2
- package/src/utils/shortcut.ts +13 -2
- package/src/utils/style.ts +4 -4
- package/src/utils/vector.ts +10 -3
- package/dist/lib/runtime/index.d.ts +0 -6
- package/dist/lib/spec/element/base.d.ts +0 -6
- package/esm/elements/types.d.ts +0 -0
- package/esm/elements/types.js +0 -15
- package/esm/elements/types.js.map +0 -1
- package/esm/runtime/index.d.ts +0 -6
- package/esm/runtime/index.js +0 -7
- package/esm/runtime/index.js.map +0 -1
- package/esm/spec/element/base.d.ts +0 -6
- package/esm/spec/element/base.js +0 -2
- package/esm/spec/element/base.js.map +0 -1
- package/lib/elements/types.d.ts +0 -0
- package/lib/elements/types.js +0 -15
- package/lib/elements/types.js.map +0 -1
- package/lib/runtime/index.d.ts +0 -6
- package/lib/runtime/index.js +0 -8
- package/lib/runtime/index.js.map +0 -1
- package/lib/spec/element/base.d.ts +0 -6
- package/lib/spec/element/base.js.map +0 -1
- package/src/elements/types.ts +0 -21
- package/src/runtime/index.ts +0 -7
- package/src/spec/element/base.ts +0 -6
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DisplayObjectConfig,
|
|
3
|
+
FederatedMouseEvent,
|
|
4
|
+
HTMLStyleProps as GHTMLStyleProps,
|
|
5
|
+
Group,
|
|
6
|
+
ICanvas,
|
|
7
|
+
IEventTarget,
|
|
8
|
+
} from '@antv/g';
|
|
9
|
+
import { FederatedPointerEvent, HTML as GHTML } from '@antv/g';
|
|
10
|
+
import { isNil, isUndefined, pick } from '@antv/util';
|
|
11
|
+
import { NodeEvent } from '../../constants';
|
|
12
|
+
import type { BaseNodeStyleProps } from './base-node';
|
|
13
|
+
import { BaseNode } from './base-node';
|
|
14
|
+
|
|
15
|
+
export type HTMLStyleProps = BaseNodeStyleProps<{
|
|
16
|
+
innerHTML: string | HTMLElement;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @see https://github.com/antvis/G/blob/next/packages/g-lite/src/plugins/EventPlugin.ts
|
|
21
|
+
*/
|
|
22
|
+
export class HTML extends BaseNode<HTMLStyleProps> {
|
|
23
|
+
static defaultStyleProps: Partial<HTMLStyleProps> = {
|
|
24
|
+
size: [160, 80],
|
|
25
|
+
halo: false,
|
|
26
|
+
icon: false,
|
|
27
|
+
label: false,
|
|
28
|
+
pointerEvents: 'auto',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
constructor(options: DisplayObjectConfig<HTMLStyleProps>) {
|
|
32
|
+
super({ ...options, style: Object.assign({}, HTML.defaultStyleProps, options.style) });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private rootPointerEvent = new FederatedPointerEvent(null);
|
|
36
|
+
|
|
37
|
+
private get eventService() {
|
|
38
|
+
return this.attributes.context!.canvas.context.eventService;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private get events() {
|
|
42
|
+
return [
|
|
43
|
+
NodeEvent.CLICK,
|
|
44
|
+
NodeEvent.POINTER_DOWN,
|
|
45
|
+
NodeEvent.POINTER_MOVE,
|
|
46
|
+
NodeEvent.POINTER_UP,
|
|
47
|
+
NodeEvent.POINTER_OVER,
|
|
48
|
+
NodeEvent.POINTER_LEAVE,
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
protected getDomElement() {
|
|
53
|
+
return this.getKey<GHTML>().getDomElement();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected getKeyStyle(attributes: Required<HTMLStyleProps>): GHTMLStyleProps {
|
|
57
|
+
const style = pick(attributes, ['innerHTML', 'pointerEvents', 'cursor']) as unknown as HTMLStyleProps;
|
|
58
|
+
const [width, height] = this.getSize(attributes);
|
|
59
|
+
return { ...style, width, height };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected drawKeyShape(attributes: Required<HTMLStyleProps>, container: Group) {
|
|
63
|
+
return this.upsert('key', GHTML, this.getKeyStyle(attributes), container);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public connectedCallback() {
|
|
67
|
+
const element = this.getDomElement();
|
|
68
|
+
this.events.forEach((eventName) => {
|
|
69
|
+
// @ts-expect-error assert event is PointerEvent
|
|
70
|
+
element.addEventListener(eventName, this.forwardEvents);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public attributeChangedCallback(name: any, oldValue: any, newValue: any) {
|
|
75
|
+
if (name === 'zIndex' && oldValue !== newValue) {
|
|
76
|
+
this.getDomElement().style.zIndex = newValue;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public onDestroy() {
|
|
81
|
+
const element = this.getDomElement();
|
|
82
|
+
this.events.forEach((eventName) => {
|
|
83
|
+
// @ts-expect-error assert event is PointerEvent
|
|
84
|
+
element.removeEventListener(eventName, this.forwardEvents);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private forwardEvents = (nativeEvent: PointerEvent) => {
|
|
89
|
+
const canvas = this.attributes.context!.canvas.main;
|
|
90
|
+
const iCanvas = canvas.context.renderingContext.root!.ownerDocument!.defaultView!;
|
|
91
|
+
|
|
92
|
+
const normalizedEvents = this.normalizeToPointerEvent(nativeEvent, iCanvas);
|
|
93
|
+
|
|
94
|
+
normalizedEvents.forEach((normalizedEvent) => {
|
|
95
|
+
const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvent, iCanvas, nativeEvent);
|
|
96
|
+
canvas.context.eventService.mapEvent(event);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
private normalizeToPointerEvent(event: PointerEvent, canvas: ICanvas): PointerEvent[] {
|
|
101
|
+
const normalizedEvents = [];
|
|
102
|
+
if (canvas.isTouchEvent(event)) {
|
|
103
|
+
for (let i = 0; i < event.changedTouches.length; i++) {
|
|
104
|
+
const touch = event.changedTouches[i] as any;
|
|
105
|
+
|
|
106
|
+
// use changedTouches instead of touches since touchend has no touches
|
|
107
|
+
// @see https://stackoverflow.com/a/10079076
|
|
108
|
+
if (isUndefined(touch.button)) touch.button = 0;
|
|
109
|
+
if (isUndefined(touch.buttons)) touch.buttons = 1;
|
|
110
|
+
if (isUndefined(touch.isPrimary)) {
|
|
111
|
+
touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';
|
|
112
|
+
}
|
|
113
|
+
if (isUndefined(touch.width)) touch.width = touch.radiusX || 1;
|
|
114
|
+
if (isUndefined(touch.height)) touch.height = touch.radiusY || 1;
|
|
115
|
+
if (isUndefined(touch.tiltX)) touch.tiltX = 0;
|
|
116
|
+
if (isUndefined(touch.tiltY)) touch.tiltY = 0;
|
|
117
|
+
if (isUndefined(touch.pointerType)) touch.pointerType = 'touch';
|
|
118
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Touch/identifier
|
|
119
|
+
if (isUndefined(touch.pointerId)) touch.pointerId = touch.identifier || 0;
|
|
120
|
+
if (isUndefined(touch.pressure)) touch.pressure = touch.force || 0.5;
|
|
121
|
+
if (isUndefined(touch.twist)) touch.twist = 0;
|
|
122
|
+
if (isUndefined(touch.tangentialPressure)) touch.tangentialPressure = 0;
|
|
123
|
+
touch.isNormalized = true;
|
|
124
|
+
touch.type = event.type;
|
|
125
|
+
|
|
126
|
+
normalizedEvents.push(touch);
|
|
127
|
+
}
|
|
128
|
+
} else if (canvas.isMouseEvent(event)) {
|
|
129
|
+
const tempEvent = event as any;
|
|
130
|
+
if (isUndefined(tempEvent.isPrimary)) tempEvent.isPrimary = true;
|
|
131
|
+
if (isUndefined(tempEvent.width)) tempEvent.width = 1;
|
|
132
|
+
if (isUndefined(tempEvent.height)) tempEvent.height = 1;
|
|
133
|
+
if (isUndefined(tempEvent.tiltX)) tempEvent.tiltX = 0;
|
|
134
|
+
if (isUndefined(tempEvent.tiltY)) tempEvent.tiltY = 0;
|
|
135
|
+
if (isUndefined(tempEvent.pointerType)) tempEvent.pointerType = 'mouse';
|
|
136
|
+
if (isUndefined(tempEvent.pointerId)) tempEvent.pointerId = 1;
|
|
137
|
+
if (isUndefined(tempEvent.pressure)) tempEvent.pressure = 0.5;
|
|
138
|
+
if (isUndefined(tempEvent.twist)) tempEvent.twist = 0;
|
|
139
|
+
if (isUndefined(tempEvent.tangentialPressure)) tempEvent.tangentialPressure = 0;
|
|
140
|
+
tempEvent.isNormalized = true;
|
|
141
|
+
|
|
142
|
+
normalizedEvents.push(tempEvent);
|
|
143
|
+
} else {
|
|
144
|
+
normalizedEvents.push(event);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return normalizedEvents as PointerEvent[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private transferMouseData(event: FederatedMouseEvent, nativeEvent: MouseEvent): void {
|
|
151
|
+
event.isTrusted = nativeEvent.isTrusted;
|
|
152
|
+
event.srcElement = nativeEvent.srcElement as IEventTarget;
|
|
153
|
+
event.timeStamp = performance.now();
|
|
154
|
+
event.type = nativeEvent.type;
|
|
155
|
+
|
|
156
|
+
event.altKey = nativeEvent.altKey;
|
|
157
|
+
event.metaKey = nativeEvent.metaKey;
|
|
158
|
+
event.shiftKey = nativeEvent.shiftKey;
|
|
159
|
+
event.ctrlKey = nativeEvent.ctrlKey;
|
|
160
|
+
event.button = nativeEvent.button;
|
|
161
|
+
event.buttons = nativeEvent.buttons;
|
|
162
|
+
event.client.x = nativeEvent.clientX;
|
|
163
|
+
event.client.y = nativeEvent.clientY;
|
|
164
|
+
event.movement.x = nativeEvent.movementX;
|
|
165
|
+
event.movement.y = nativeEvent.movementY;
|
|
166
|
+
event.page.x = nativeEvent.pageX;
|
|
167
|
+
event.page.y = nativeEvent.pageY;
|
|
168
|
+
event.screen.x = nativeEvent.screenX;
|
|
169
|
+
event.screen.y = nativeEvent.screenY;
|
|
170
|
+
event.relatedTarget = null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private bootstrapEvent(
|
|
174
|
+
event: FederatedPointerEvent,
|
|
175
|
+
normalizedEvent: PointerEvent,
|
|
176
|
+
view: ICanvas,
|
|
177
|
+
nativeEvent: PointerEvent | MouseEvent | TouchEvent,
|
|
178
|
+
): FederatedPointerEvent {
|
|
179
|
+
event.view = view;
|
|
180
|
+
// @ts-ignore
|
|
181
|
+
event.originalEvent = null;
|
|
182
|
+
event.nativeEvent = nativeEvent;
|
|
183
|
+
|
|
184
|
+
event.pointerId = normalizedEvent.pointerId;
|
|
185
|
+
event.width = normalizedEvent.width;
|
|
186
|
+
event.height = normalizedEvent.height;
|
|
187
|
+
event.isPrimary = normalizedEvent.isPrimary;
|
|
188
|
+
event.pointerType = normalizedEvent.pointerType;
|
|
189
|
+
event.pressure = normalizedEvent.pressure;
|
|
190
|
+
event.tangentialPressure = normalizedEvent.tangentialPressure;
|
|
191
|
+
event.tiltX = normalizedEvent.tiltX;
|
|
192
|
+
event.tiltY = normalizedEvent.tiltY;
|
|
193
|
+
event.twist = normalizedEvent.twist;
|
|
194
|
+
this.transferMouseData(event, normalizedEvent);
|
|
195
|
+
|
|
196
|
+
const { x, y } = this.getViewportXY(normalizedEvent);
|
|
197
|
+
event.viewport.x = x;
|
|
198
|
+
event.viewport.y = y;
|
|
199
|
+
const { x: canvasX, y: canvasY } = this.attributes.context!.canvas.viewport2Canvas(event.viewport);
|
|
200
|
+
event.canvas.x = canvasX;
|
|
201
|
+
event.canvas.y = canvasY;
|
|
202
|
+
event.global.copyFrom(event.canvas);
|
|
203
|
+
event.offset.copyFrom(event.canvas);
|
|
204
|
+
|
|
205
|
+
event.isTrusted = nativeEvent.isTrusted;
|
|
206
|
+
if (event.type === 'pointerleave') {
|
|
207
|
+
event.type = 'pointerout';
|
|
208
|
+
}
|
|
209
|
+
return event;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
private getViewportXY(nativeEvent: PointerEvent | WheelEvent) {
|
|
213
|
+
let x: number;
|
|
214
|
+
let y: number;
|
|
215
|
+
const { offsetX, offsetY, clientX, clientY } = nativeEvent;
|
|
216
|
+
if (
|
|
217
|
+
this.attributes.context?.canvas.main.context.config.supportsCSSTransform &&
|
|
218
|
+
!isNil(offsetX) &&
|
|
219
|
+
!isNil(offsetY)
|
|
220
|
+
) {
|
|
221
|
+
x = offsetX;
|
|
222
|
+
y = offsetY;
|
|
223
|
+
} else {
|
|
224
|
+
const point = this.eventService.client2Viewport({ x: clientX, y: clientY });
|
|
225
|
+
x = point.x;
|
|
226
|
+
y = point.y;
|
|
227
|
+
}
|
|
228
|
+
return { x, y };
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -2,17 +2,16 @@ import type { DisplayObjectConfig, RectStyleProps as GRectStyleProps, Group } fr
|
|
|
2
2
|
import { Image as GImage, ImageStyleProps as GImageStyleProps, Rect as GRect } from '@antv/g';
|
|
3
3
|
import { deepMix } from '@antv/util';
|
|
4
4
|
import { ICON_SIZE_RATIO } from '../../constants/element';
|
|
5
|
-
import type { PrefixObject } from '../../types';
|
|
6
5
|
import { subStyleProps } from '../../utils/prefix';
|
|
7
6
|
import { add } from '../../utils/vector';
|
|
8
7
|
import type { IconStyleProps } from '../shapes';
|
|
9
8
|
import type { BaseNodeStyleProps } from './base-node';
|
|
10
9
|
import { BaseNode } from './base-node';
|
|
11
10
|
|
|
12
|
-
export type ImageStyleProps = BaseNodeStyleProps<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export type ImageStyleProps = BaseNodeStyleProps<{
|
|
12
|
+
img?: string | HTMLImageElement;
|
|
13
|
+
src?: string | HTMLImageElement;
|
|
14
|
+
}>;
|
|
16
15
|
|
|
17
16
|
export class Image extends BaseNode<ImageStyleProps> {
|
|
18
17
|
static defaultStyleProps: Partial<ImageStyleProps> = {
|
|
@@ -23,9 +22,9 @@ export class Image extends BaseNode<ImageStyleProps> {
|
|
|
23
22
|
super(deepMix({}, { style: Image.defaultStyleProps }, options));
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
protected getKeyStyle(attributes:
|
|
25
|
+
protected getKeyStyle(attributes: Required<ImageStyleProps>): GImageStyleProps {
|
|
27
26
|
const [width, height] = this.getSize(attributes);
|
|
28
|
-
const keyStyle = super.getKeyStyle(attributes)
|
|
27
|
+
const keyStyle = super.getKeyStyle(attributes);
|
|
29
28
|
return {
|
|
30
29
|
...keyStyle,
|
|
31
30
|
width,
|
|
@@ -34,18 +33,18 @@ export class Image extends BaseNode<ImageStyleProps> {
|
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
protected getHaloStyle(attributes:
|
|
36
|
+
protected getHaloStyle(attributes: Required<ImageStyleProps>): false | GRectStyleProps {
|
|
38
37
|
if (attributes.halo === false) return false;
|
|
39
38
|
const { fill: keyStyleFill, stroke: keyStyleStroke, ...keyStyle } = this.getKeyStyle(attributes);
|
|
40
|
-
const haloStyle = subStyleProps
|
|
39
|
+
const haloStyle = subStyleProps(this.getGraphicStyle(attributes), 'halo');
|
|
41
40
|
const haloLineWidth = Number(haloStyle.lineWidth);
|
|
42
41
|
const [width, height] = add(this.getSize(attributes), [haloLineWidth, haloLineWidth]);
|
|
43
42
|
const fill = 'transparent';
|
|
44
43
|
|
|
45
|
-
return { ...keyStyle, ...haloStyle, width, height, fill }
|
|
44
|
+
return { ...keyStyle, ...haloStyle, width, height, fill };
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
protected getIconStyle(attributes:
|
|
47
|
+
protected getIconStyle(attributes: Required<ImageStyleProps>): false | IconStyleProps {
|
|
49
48
|
const style = super.getIconStyle(attributes);
|
|
50
49
|
const [width, height] = this.getSize(attributes);
|
|
51
50
|
|
|
@@ -58,11 +57,11 @@ export class Image extends BaseNode<ImageStyleProps> {
|
|
|
58
57
|
: false;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
protected drawKeyShape(attributes:
|
|
60
|
+
protected drawKeyShape(attributes: Required<ImageStyleProps>, container: Group): GImage | undefined {
|
|
62
61
|
return this.upsert('key', GImage, this.getKeyStyle(attributes), container);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
protected drawHaloShape(attributes:
|
|
64
|
+
protected drawHaloShape(attributes: Required<ImageStyleProps>, container: Group): void {
|
|
66
65
|
this.upsert('halo', GRect, this.getHaloStyle(attributes), container);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { BaseNode } from './base-node';
|
|
2
2
|
export { Circle } from './circle';
|
|
3
3
|
export { Diamond } from './diamond';
|
|
4
|
+
export { Donut } from './donut';
|
|
4
5
|
export { Ellipse } from './ellipse';
|
|
5
6
|
export { Hexagon } from './hexagon';
|
|
7
|
+
export { HTML } from './html';
|
|
6
8
|
export { Image } from './image';
|
|
7
9
|
export { Rect } from './rect';
|
|
8
10
|
export { Star } from './star';
|
|
@@ -11,8 +13,10 @@ export { Triangle } from './triangle';
|
|
|
11
13
|
export type { BaseNodeStyleProps } from './base-node';
|
|
12
14
|
export type { CircleStyleProps } from './circle';
|
|
13
15
|
export type { DiamondStyleProps } from './diamond';
|
|
16
|
+
export type { DonutStyleProps } from './donut';
|
|
14
17
|
export type { EllipseStyleProps } from './ellipse';
|
|
15
18
|
export type { HexagonStyleProps } from './hexagon';
|
|
19
|
+
export type { HTMLStyleProps } from './html';
|
|
16
20
|
export type { ImageStyleProps } from './image';
|
|
17
21
|
export type { RectStyleProps } from './rect';
|
|
18
22
|
export type { StarStyleProps } from './star';
|
|
@@ -5,32 +5,38 @@ import { getPolygonIntersectPoint } from '../../utils/point';
|
|
|
5
5
|
import type { BaseNodeStyleProps } from './base-node';
|
|
6
6
|
import { BaseNode } from './base-node';
|
|
7
7
|
|
|
8
|
-
export type PolygonStyleProps = BaseNodeStyleProps<
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export type PolygonStyleProps<T extends Record<string, unknown> = Record<string, any>> = BaseNodeStyleProps<
|
|
9
|
+
T & {
|
|
10
|
+
points: ([number, number] | [number, number, number])[];
|
|
11
|
+
}
|
|
12
|
+
>;
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Abstract class for polygon nodes,i.e triangle, diamond, hexagon, etc.
|
|
14
16
|
*/
|
|
15
|
-
export abstract class Polygon extends BaseNode<
|
|
16
|
-
constructor(options: DisplayObjectConfig<PolygonStyleProps
|
|
17
|
+
export abstract class Polygon<T extends PolygonStyleProps = PolygonStyleProps> extends BaseNode<T> {
|
|
18
|
+
constructor(options: DisplayObjectConfig<PolygonStyleProps<T>>) {
|
|
17
19
|
super(options);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
public get parsedAttributes() {
|
|
23
|
+
return this.attributes as unknown as Required<PolygonStyleProps<T>>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected drawKeyShape(attributes: Required<PolygonStyleProps<T>>, container: Group) {
|
|
21
27
|
return this.upsert('key', GPolygon, this.getKeyStyle(attributes), container);
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
protected getKeyStyle(attributes:
|
|
30
|
+
protected getKeyStyle(attributes: Required<PolygonStyleProps<T>>): GPolygonStyleProps {
|
|
25
31
|
const keyStyle = super.getKeyStyle(attributes);
|
|
26
|
-
return { ...keyStyle, points: this.getPoints(attributes) }
|
|
32
|
+
return { ...keyStyle, points: this.getPoints(attributes) };
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
protected abstract getPoints(attributes:
|
|
35
|
+
protected abstract getPoints(attributes: Required<PolygonStyleProps<T>>): Point[];
|
|
30
36
|
|
|
31
37
|
public getIntersectPoint(point: Point): Point {
|
|
32
|
-
const { points } = this.getKeyStyle(this.parsedAttributes as
|
|
38
|
+
const { points } = this.getKeyStyle(this.parsedAttributes as Required<PolygonStyleProps<T>>);
|
|
33
39
|
const center: Point = [+(this.attributes?.x || 0), +(this.attributes?.y || 0)];
|
|
34
|
-
return getPolygonIntersectPoint(point, center, points!);
|
|
40
|
+
return getPolygonIntersectPoint(point, center, points!).point;
|
|
35
41
|
}
|
|
36
42
|
}
|
|
@@ -6,9 +6,8 @@ import type { IconStyleProps } from '../shapes';
|
|
|
6
6
|
import type { BaseNodeStyleProps } from './base-node';
|
|
7
7
|
import { BaseNode } from './base-node';
|
|
8
8
|
|
|
9
|
-
export type RectStyleProps = BaseNodeStyleProps
|
|
9
|
+
export type RectStyleProps = BaseNodeStyleProps;
|
|
10
10
|
type ParsedRectStyleProps = Required<RectStyleProps>;
|
|
11
|
-
type KeyStyleProps = GRectStyleProps;
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Draw Rect based on BaseNode, override drawKeyShape.
|
|
@@ -23,10 +22,10 @@ export class Rect extends BaseNode<RectStyleProps> {
|
|
|
23
22
|
super(deepMix({}, { style: Rect.defaultStyleProps }, options));
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
protected getKeyStyle(attributes: ParsedRectStyleProps):
|
|
25
|
+
protected getKeyStyle(attributes: ParsedRectStyleProps): GRectStyleProps {
|
|
27
26
|
const [width, height] = this.getSize(attributes);
|
|
28
27
|
return {
|
|
29
|
-
...
|
|
28
|
+
...super.getKeyStyle(attributes),
|
|
30
29
|
width,
|
|
31
30
|
height,
|
|
32
31
|
};
|
|
@@ -4,43 +4,41 @@ import type { Point, StarPortPlacement } from '../../types';
|
|
|
4
4
|
import { getPortXYByPlacement, getStarPoints, getStarPorts } from '../../utils/element';
|
|
5
5
|
import type { IconStyleProps } from '../shapes';
|
|
6
6
|
import { NodePortStyleProps } from './base-node';
|
|
7
|
-
import type {
|
|
7
|
+
import type { PolygonStyleProps } from './polygon';
|
|
8
8
|
import { Polygon } from './polygon';
|
|
9
9
|
|
|
10
|
-
export type StarStyleProps = PolygonStyleProps
|
|
11
|
-
type ParsedStarStyleProps = ParsedPolygonStyleProps & Required<ExtendsStyleProps>;
|
|
12
|
-
type ExtendsStyleProps = {
|
|
10
|
+
export type StarStyleProps = PolygonStyleProps<{
|
|
13
11
|
/**
|
|
14
12
|
* <zh/> 内半径
|
|
15
13
|
* <en/> Inner radius
|
|
16
14
|
*/
|
|
17
15
|
innerR?: number;
|
|
18
|
-
}
|
|
16
|
+
}>;
|
|
19
17
|
|
|
20
|
-
export class Star extends Polygon {
|
|
18
|
+
export class Star extends Polygon<StarStyleProps> {
|
|
21
19
|
constructor(options: DisplayObjectConfig<StarStyleProps>) {
|
|
22
20
|
super(options);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
private getInnerR(attributes:
|
|
23
|
+
private getInnerR(attributes: Required<StarStyleProps>): number {
|
|
26
24
|
return attributes.innerR || (this.getOuterR(attributes) * 3) / 8;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
private getOuterR(attributes:
|
|
27
|
+
private getOuterR(attributes: Required<StarStyleProps>): number {
|
|
30
28
|
return Math.min(...this.getSize(attributes)) / 2;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
protected getPoints(attributes:
|
|
31
|
+
protected getPoints(attributes: Required<StarStyleProps>): Point[] {
|
|
34
32
|
return getStarPoints(this.getOuterR(attributes), this.getInnerR(attributes));
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
protected getIconStyle(attributes:
|
|
35
|
+
protected getIconStyle(attributes: Required<StarStyleProps>): false | IconStyleProps {
|
|
38
36
|
const style = super.getIconStyle(attributes);
|
|
39
37
|
const size = this.getInnerR(attributes) * 2 * ICON_SIZE_RATIO;
|
|
40
38
|
return style ? ({ width: size, height: size, ...style } as IconStyleProps) : false;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
protected getPortXY(attributes:
|
|
41
|
+
protected getPortXY(attributes: Required<StarStyleProps>, style: NodePortStyleProps): Point {
|
|
44
42
|
const { placement = 'top' } = style;
|
|
45
43
|
const bbox = this.getKey().getLocalBounds();
|
|
46
44
|
const ports = getStarPorts(this.getOuterR(attributes), this.getInnerR(attributes));
|
|
@@ -7,21 +7,19 @@ import { getPortXYByPlacement, getTrianglePoints, getTrianglePorts } from '../..
|
|
|
7
7
|
import { subStyleProps } from '../../utils/prefix';
|
|
8
8
|
import { IconStyleProps } from '../shapes';
|
|
9
9
|
import type { NodePortStyleProps } from './base-node';
|
|
10
|
-
import type {
|
|
10
|
+
import type { PolygonStyleProps } from './polygon';
|
|
11
11
|
import { Polygon } from './polygon';
|
|
12
12
|
|
|
13
|
-
export type TriangleStyleProps = PolygonStyleProps
|
|
14
|
-
type ParsedTriangleStyleProps = ParsedPolygonStyleProps & Required<ExtendsStyleProps>;
|
|
15
|
-
type ExtendsStyleProps = {
|
|
13
|
+
export type TriangleStyleProps = PolygonStyleProps<{
|
|
16
14
|
/**
|
|
17
15
|
* <zh/> 三角形的方向
|
|
18
16
|
* <en/> The direction of the triangle
|
|
19
17
|
*/
|
|
20
18
|
direction?: TriangleDirection;
|
|
21
|
-
}
|
|
19
|
+
}>;
|
|
22
20
|
export type TriangleDirection = 'up' | 'left' | 'right' | 'down';
|
|
23
21
|
|
|
24
|
-
export class Triangle extends Polygon {
|
|
22
|
+
export class Triangle extends Polygon<TriangleStyleProps> {
|
|
25
23
|
static defaultStyleProps: Partial<TriangleStyleProps> = {
|
|
26
24
|
size: 40,
|
|
27
25
|
direction: 'up',
|
|
@@ -31,13 +29,13 @@ export class Triangle extends Polygon {
|
|
|
31
29
|
super(deepMix({}, { style: Triangle.defaultStyleProps }, options));
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
protected getPoints(attributes:
|
|
32
|
+
protected getPoints(attributes: Required<TriangleStyleProps>): Point[] {
|
|
35
33
|
const { direction } = attributes;
|
|
36
34
|
const [width, height] = this.getSize(attributes);
|
|
37
35
|
return getTrianglePoints(width, height, direction);
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
protected getPortXY(attributes:
|
|
38
|
+
protected getPortXY(attributes: Required<TriangleStyleProps>, style: NodePortStyleProps): Point {
|
|
41
39
|
const { direction } = attributes;
|
|
42
40
|
const { placement = 'top' } = style;
|
|
43
41
|
const bbox = this.getKey().getLocalBounds();
|
|
@@ -48,7 +46,7 @@ export class Triangle extends Polygon {
|
|
|
48
46
|
|
|
49
47
|
// icon 处于内切三角形的重心
|
|
50
48
|
// icon is at the centroid of the triangle
|
|
51
|
-
protected getIconStyle(attributes:
|
|
49
|
+
protected getIconStyle(attributes: Required<TriangleStyleProps>): false | IconStyleProps {
|
|
52
50
|
const { icon, iconText, iconSrc, direction } = attributes;
|
|
53
51
|
|
|
54
52
|
if (icon === false || isEmpty(iconText || iconSrc)) return false;
|
package/src/exports.ts
CHANGED
|
@@ -16,12 +16,26 @@ export {
|
|
|
16
16
|
} from './constants';
|
|
17
17
|
export { BaseCombo, CircleCombo, RectCombo } from './elements/combos';
|
|
18
18
|
export { BaseEdge, Cubic, CubicHorizontal, CubicVertical, Line, Polyline, Quadratic } from './elements/edges';
|
|
19
|
-
export {
|
|
19
|
+
export {
|
|
20
|
+
BaseNode,
|
|
21
|
+
Circle,
|
|
22
|
+
Diamond,
|
|
23
|
+
Donut,
|
|
24
|
+
Ellipse,
|
|
25
|
+
HTML,
|
|
26
|
+
Hexagon,
|
|
27
|
+
Image,
|
|
28
|
+
Rect,
|
|
29
|
+
Star,
|
|
30
|
+
Triangle,
|
|
31
|
+
} from './elements/nodes';
|
|
20
32
|
export { BaseShape } from './elements/shapes';
|
|
21
|
-
export { BasePlugin, CameraSetting } from './plugins';
|
|
33
|
+
export { BasePlugin, CameraSetting, History } from './plugins';
|
|
22
34
|
export { getExtension, getExtensions, register } from './registry';
|
|
23
35
|
export { Graph } from './runtime/graph';
|
|
36
|
+
export { BaseTransform } from './transforms';
|
|
24
37
|
export { Shortcut } from './utils/shortcut';
|
|
38
|
+
export { parseSize } from './utils/size';
|
|
25
39
|
|
|
26
40
|
export type { BaseBehaviorOptions, DragCanvasOptions, ZoomCanvasOptions } from './behaviors';
|
|
27
41
|
export type { BaseComboStyleProps, CircleComboStyleProps, RectComboStyleProps } from './elements/combos';
|
|
@@ -39,6 +53,7 @@ export type {
|
|
|
39
53
|
CircleStyleProps,
|
|
40
54
|
DiamondStyleProps,
|
|
41
55
|
EllipseStyleProps,
|
|
56
|
+
HTMLStyleProps,
|
|
42
57
|
HexagonStyleProps,
|
|
43
58
|
ImageStyleProps,
|
|
44
59
|
RectStyleProps,
|
|
@@ -46,7 +61,7 @@ export type {
|
|
|
46
61
|
TriangleStyleProps,
|
|
47
62
|
} from './elements/nodes';
|
|
48
63
|
export type { BaseShapeStyleProps } from './elements/shapes';
|
|
49
|
-
export type { BasePluginOptions, CameraSettingOptions } from './plugins';
|
|
64
|
+
export type { BasePluginOptions, CameraSettingOptions, Hull } from './plugins';
|
|
50
65
|
export type { RuntimeContext } from './runtime/types';
|
|
51
66
|
export type {
|
|
52
67
|
BehaviorOptions,
|
|
@@ -64,8 +79,13 @@ export type {
|
|
|
64
79
|
ThemeOptions,
|
|
65
80
|
ViewportOptions,
|
|
66
81
|
} from './spec';
|
|
82
|
+
export type { BaseTransformOptions } from './transforms';
|
|
67
83
|
export type {
|
|
84
|
+
Combo,
|
|
85
|
+
Edge,
|
|
86
|
+
Element,
|
|
68
87
|
IAnimateEvent,
|
|
88
|
+
ID,
|
|
69
89
|
IDragEvent,
|
|
70
90
|
IElementLifeCycleEvent,
|
|
71
91
|
IEvent,
|
|
@@ -74,6 +94,7 @@ export type {
|
|
|
74
94
|
IPointerEvent,
|
|
75
95
|
IViewportEvent,
|
|
76
96
|
IWheelEvent,
|
|
97
|
+
Node,
|
|
77
98
|
Point,
|
|
78
99
|
Vector2,
|
|
79
100
|
Vector3,
|
package/src/layouts/index.ts
CHANGED
package/src/layouts/types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
AntVDagreLayoutOptions,
|
|
3
3
|
CircularLayoutOptions,
|
|
4
4
|
ConcentricLayoutOptions,
|
|
5
|
+
D3Force3DLayoutOptions,
|
|
5
6
|
D3ForceLayoutOptions,
|
|
6
7
|
DagreLayoutOptions,
|
|
7
8
|
ForceAtlas2LayoutOptions,
|
|
@@ -19,6 +20,7 @@ export type BuiltInLayoutOptions =
|
|
|
19
20
|
| CircularLayout
|
|
20
21
|
| ConcentricLayout
|
|
21
22
|
| D3ForceLayout
|
|
23
|
+
| D3Force3DLayout
|
|
22
24
|
| DagreLayout
|
|
23
25
|
| ForceAtlas2
|
|
24
26
|
| ForceLayout
|
|
@@ -28,7 +30,7 @@ export type BuiltInLayoutOptions =
|
|
|
28
30
|
| RadialLayout
|
|
29
31
|
| RandomLayout;
|
|
30
32
|
|
|
31
|
-
export interface BaseLayoutOptions extends AnimationOptions, WebWorkerLayoutOptions
|
|
33
|
+
export interface BaseLayoutOptions extends AnimationOptions, WebWorkerLayoutOptions {
|
|
32
34
|
type: string;
|
|
33
35
|
/**
|
|
34
36
|
* <zh/> 参与该布局的节点
|
|
@@ -73,6 +75,10 @@ interface D3ForceLayout extends BaseLayoutOptions, D3ForceLayoutOptions {
|
|
|
73
75
|
type: 'd3force';
|
|
74
76
|
}
|
|
75
77
|
|
|
78
|
+
interface D3Force3DLayout extends BaseLayoutOptions, D3Force3DLayoutOptions {
|
|
79
|
+
type: 'd3force3d';
|
|
80
|
+
}
|
|
81
|
+
|
|
76
82
|
interface ForceLayout extends BaseLayoutOptions, ForceLayoutOptions {
|
|
77
83
|
type: 'force' | 'gforce';
|
|
78
84
|
}
|
|
@@ -89,10 +95,6 @@ interface DagreLayout extends BaseLayoutOptions, DagreLayoutOptions {
|
|
|
89
95
|
type: 'dagre';
|
|
90
96
|
}
|
|
91
97
|
|
|
92
|
-
export interface PresetLayoutOptions {
|
|
93
|
-
presetLayout?: BaseLayoutOptions;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
98
|
export interface AnimationOptions {
|
|
97
99
|
/**
|
|
98
100
|
* <zh/> 启用布局动画,对于迭代布局,会在两次迭代之间进行动画过渡
|
package/src/palettes/index.ts
CHANGED
|
@@ -17,6 +17,19 @@ export const spectral = [
|
|
|
17
17
|
'rgb(94, 79, 162)',
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
+
export const tableau = [
|
|
21
|
+
'rgb(78, 121, 167)',
|
|
22
|
+
'rgb(242, 142, 44)',
|
|
23
|
+
'rgb(225, 87, 89)',
|
|
24
|
+
'rgb(118, 183, 178)',
|
|
25
|
+
'rgb(89, 161, 79)',
|
|
26
|
+
'rgb(237, 201, 73)',
|
|
27
|
+
'rgb(175, 122, 161)',
|
|
28
|
+
'rgb(255, 157, 167)',
|
|
29
|
+
'rgb(156, 117, 95)',
|
|
30
|
+
'rgb(186, 176, 171)',
|
|
31
|
+
];
|
|
32
|
+
|
|
20
33
|
export const oranges = [
|
|
21
34
|
'rgb(255, 245, 235)',
|
|
22
35
|
'rgb(254, 230, 206)',
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Loosen } from '../../types';
|
|
2
|
+
import type { Command } from './utils';
|
|
3
|
+
|
|
4
|
+
export interface IHistoryEvent {
|
|
5
|
+
cmd?: Command | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type HistoryEventHandler = (e: IHistoryEvent) => void;
|
|
9
|
+
|
|
10
|
+
export enum HistoryEvent {
|
|
11
|
+
/** <zh/> 当命令被撤销时 | <en/> When the command is undone */
|
|
12
|
+
UNDO = 'undo',
|
|
13
|
+
/** <zh/> 当命令被重做时 | <en/> When the command is redone */
|
|
14
|
+
REDO = 'redo',
|
|
15
|
+
/** <zh/> 当命令被取消时 | <en/> When the command is canceled */
|
|
16
|
+
CANCEL = 'cancel',
|
|
17
|
+
/** <zh/> 当命令被添加到队列时 | <en/> When the command is added */
|
|
18
|
+
ADD = 'add',
|
|
19
|
+
/** <zh/> 当历史队列被清空时 | <en/> When the command queue is cleared */
|
|
20
|
+
CLEAR = 'clear',
|
|
21
|
+
/** <zh/> 当历史队列发生变化时 | <en/> When the command queue changes */
|
|
22
|
+
CHANGE = 'change',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type HistoryEventName = Loosen<HistoryEvent>;
|