@visuallyjs/browser-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/visuallyjs-theme.css +148 -0
- package/css/visuallyjs.css +1879 -0
- package/js/visuallyjs.browser-ui.cjs.js +143 -0
- package/js/visuallyjs.browser-ui.esm.js +143 -0
- package/package.json +16 -0
- package/types/browser-ui/base-dom-ui-layout-adapter.d.ts +14 -0
- package/types/browser-ui/browser-ui.d.ts +95 -0
- package/types/browser-ui/browser-util.d.ts +233 -0
- package/types/browser-ui/browser-visuallyjs-instance.d.ts +881 -0
- package/types/browser-ui/canvas-layout-adapter.d.ts +15 -0
- package/types/browser-ui/collicat.d.ts +245 -0
- package/types/browser-ui/components/controls/controls-component.d.ts +137 -0
- package/types/browser-ui/components/controls/copy-paste-controls-component.d.ts +9 -0
- package/types/browser-ui/components/controls/css-classes.d.ts +79 -0
- package/types/browser-ui/components/controls/index.d.ts +4 -0
- package/types/browser-ui/components/controls/svg-export-component.d.ts +60 -0
- package/types/browser-ui/components/edge-type-picker/edge-type-picker.d.ts +37 -0
- package/types/browser-ui/components/edge-type-picker/index.d.ts +1 -0
- package/types/browser-ui/components/index.d.ts +4 -0
- package/types/browser-ui/components/inspector/color-picker-tag.d.ts +32 -0
- package/types/browser-ui/components/inspector/definitions.d.ts +114 -0
- package/types/browser-ui/components/inspector/edge-type-tag.d.ts +15 -0
- package/types/browser-ui/components/inspector/index.d.ts +6 -0
- package/types/browser-ui/components/inspector/inspector.d.ts +138 -0
- package/types/browser-ui/components/inspector/shape-type-inspector.d.ts +43 -0
- package/types/browser-ui/components/inspector/vanilla-inspector.d.ts +39 -0
- package/types/browser-ui/components/palette/index.d.ts +2 -0
- package/types/browser-ui/components/palette/palette-content-generator.d.ts +14 -0
- package/types/browser-ui/components/palette/palette-options.d.ts +159 -0
- package/types/browser-ui/components/palette/palette.d.ts +126 -0
- package/types/browser-ui/connector-editor.d.ts +65 -0
- package/types/browser-ui/connector-editors/anchors.d.ts +31 -0
- package/types/browser-ui/connector-editors/css-constants.d.ts +33 -0
- package/types/browser-ui/connector-editors/definitions.d.ts +74 -0
- package/types/browser-ui/connector-editors/editor-base.d.ts +177 -0
- package/types/browser-ui/connector-editors/index.d.ts +52 -0
- package/types/browser-ui/connector-editors/util.d.ts +33 -0
- package/types/browser-ui/connector-editors-bezier/bezier-editor.d.ts +82 -0
- package/types/browser-ui/connector-editors-bezier/css-constants.d.ts +42 -0
- package/types/browser-ui/connector-editors-bezier/index.d.ts +9 -0
- package/types/browser-ui/connector-editors-orthogonal/css-constants.d.ts +28 -0
- package/types/browser-ui/connector-editors-orthogonal/index.d.ts +9 -0
- package/types/browser-ui/connector-editors-orthogonal/orthogonal-editor.d.ts +86 -0
- package/types/browser-ui/connector-editors-straight/auto-split-mode.d.ts +24 -0
- package/types/browser-ui/connector-editors-straight/click-split-mode.d.ts +20 -0
- package/types/browser-ui/connector-editors-straight/css-constants.d.ts +30 -0
- package/types/browser-ui/connector-editors-straight/definitions.d.ts +69 -0
- package/types/browser-ui/connector-editors-straight/index.d.ts +11 -0
- package/types/browser-ui/connector-editors-straight/straight-editor.d.ts +42 -0
- package/types/browser-ui/constants.d.ts +79 -0
- package/types/browser-ui/copy-paste/clipboard.d.ts +34 -0
- package/types/browser-ui/copy-paste/index.d.ts +2 -0
- package/types/browser-ui/copy-paste/transformer.d.ts +14 -0
- package/types/browser-ui/css-constants.d.ts +436 -0
- package/types/browser-ui/d.d.ts +2 -0
- package/types/browser-ui/definitions.d.ts +442 -0
- package/types/browser-ui/dialogs/binder.d.ts +49 -0
- package/types/browser-ui/dialogs/constants.d.ts +51 -0
- package/types/browser-ui/dialogs/dialogs.d.ts +30 -0
- package/types/browser-ui/dialogs/index.d.ts +3 -0
- package/types/browser-ui/drag-manager-2.d.ts +54 -0
- package/types/browser-ui/edge-handler-base.d.ts +168 -0
- package/types/browser-ui/edge-input-handler.d.ts +116 -0
- package/types/browser-ui/edge-mappings/flowchart-basic.d.ts +22 -0
- package/types/browser-ui/edge-mappings/index.d.ts +1 -0
- package/types/browser-ui/edge-relocate-handler.d.ts +51 -0
- package/types/browser-ui/element-drag-handler-2.d.ts +254 -0
- package/types/browser-ui/element-dragger.d.ts +45 -0
- package/types/browser-ui/element-facade.d.ts +11 -0
- package/types/browser-ui/event-manager.d.ts +50 -0
- package/types/browser-ui/fixed-layer.d.ts +107 -0
- package/types/browser-ui/group-layout-adapter.d.ts +19 -0
- package/types/browser-ui/html-element-overlay.d.ts +32 -0
- package/types/browser-ui/icons/definitions.d.ts +59 -0
- package/types/browser-ui/icons/icon-renderer.d.ts +43 -0
- package/types/browser-ui/icons/index.d.ts +2 -0
- package/types/browser-ui/index.d.ts +48 -0
- package/types/browser-ui/pan-zoom-options.d.ts +262 -0
- package/types/browser-ui/pan-zoom.d.ts +674 -0
- package/types/browser-ui/paper-renderer/definitions.d.ts +83 -0
- package/types/browser-ui/paper-renderer/index.d.ts +2 -0
- package/types/browser-ui/paper-renderer/paper.d.ts +50 -0
- package/types/browser-ui/pinch-listener.d.ts +33 -0
- package/types/browser-ui/plugins/background/available-backgrounds.d.ts +12 -0
- package/types/browser-ui/plugins/background/background-options.d.ts +62 -0
- package/types/browser-ui/plugins/background/background-plugin.d.ts +62 -0
- package/types/browser-ui/plugins/background/generated-grid-background.d.ts +230 -0
- package/types/browser-ui/plugins/background/index.d.ts +6 -0
- package/types/browser-ui/plugins/background/simple-background.d.ts +33 -0
- package/types/browser-ui/plugins/background/tiled-background.d.ts +118 -0
- package/types/browser-ui/plugins/browser-ui-plugin.d.ts +90 -0
- package/types/browser-ui/plugins/edge-routing/index.d.ts +66 -0
- package/types/browser-ui/plugins/index.d.ts +5 -0
- package/types/browser-ui/plugins/selected-edge-highlight/index.d.ts +1 -0
- package/types/browser-ui/plugins/selected-edge-highlight/selected-edge-highlight-plugin.d.ts +36 -0
- package/types/browser-ui/plugins/ui-states/index.d.ts +2 -0
- package/types/browser-ui/plugins/ui-states/ui-state.d.ts +14 -0
- package/types/browser-ui/plugins/ui-states/ui-states-plugin.d.ts +69 -0
- package/types/browser-ui/positioning-and-sizing-utils.d.ts +103 -0
- package/types/browser-ui/shape-library/index.d.ts +4 -0
- package/types/browser-ui/shape-library/shape-library-definitions.d.ts +243 -0
- package/types/browser-ui/shape-library/shape-library.d.ts +266 -0
- package/types/browser-ui/shape-library/shapes-basic.d.ts +7 -0
- package/types/browser-ui/shape-library/shapes-flowchart.d.ts +7 -0
- package/types/browser-ui/storage.d.ts +8 -0
- package/types/browser-ui/surface-renderer/anim/anim.d.ts +64 -0
- package/types/browser-ui/surface-renderer/anim/constants.d.ts +74 -0
- package/types/browser-ui/surface-renderer/anim/definitions.d.ts +134 -0
- package/types/browser-ui/surface-renderer/anim/index.d.ts +4 -0
- package/types/browser-ui/surface-renderer/anim/path-transport.d.ts +23 -0
- package/types/browser-ui/surface-renderer/css-classes.d.ts +64 -0
- package/types/browser-ui/surface-renderer/decorators.d.ts +162 -0
- package/types/browser-ui/surface-renderer/definitions.d.ts +83 -0
- package/types/browser-ui/surface-renderer/diagrams/constants.d.ts +28 -0
- package/types/browser-ui/surface-renderer/diagrams/definitions.d.ts +528 -0
- package/types/browser-ui/surface-renderer/diagrams/diagram-cell.d.ts +123 -0
- package/types/browser-ui/surface-renderer/diagrams/diagram-link.d.ts +116 -0
- package/types/browser-ui/surface-renderer/diagrams/diagram-palette.d.ts +11 -0
- package/types/browser-ui/surface-renderer/diagrams/diagram-tools.d.ts +112 -0
- package/types/browser-ui/surface-renderer/diagrams/diagram.d.ts +221 -0
- package/types/browser-ui/surface-renderer/diagrams/index.d.ts +25 -0
- package/types/browser-ui/surface-renderer/diagrams/mediator.d.ts +59 -0
- package/types/browser-ui/surface-renderer/diagrams/util.d.ts +15 -0
- package/types/browser-ui/surface-renderer/elastic-group-manager.d.ts +102 -0
- package/types/browser-ui/surface-renderer/index.d.ts +34 -0
- package/types/browser-ui/surface-renderer/params.d.ts +175 -0
- package/types/browser-ui/surface-renderer/plugins/controls/controls-plugin.d.ts +26 -0
- package/types/browser-ui/surface-renderer/plugins/controls/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/drag-groups/drag-groups-plugin.d.ts +78 -0
- package/types/browser-ui/surface-renderer/plugins/drag-groups/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/export-controls/export-controls-plugin.d.ts +25 -0
- package/types/browser-ui/surface-renderer/plugins/export-controls/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/index.d.ts +10 -0
- package/types/browser-ui/surface-renderer/plugins/lasso/index.d.ts +2 -0
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso-plugin.d.ts +78 -0
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso.d.ts +74 -0
- package/types/browser-ui/surface-renderer/plugins/miniview/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/miniview/miniview-plugin.d.ts +235 -0
- package/types/browser-ui/surface-renderer/plugins/palette/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/palette/palette-plugin.d.ts +17 -0
- package/types/browser-ui/surface-renderer/plugins/pan-buttons/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/pan-buttons/pan-buttons-plugin.d.ts +55 -0
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/border-drag-handlers.d.ts +3 -0
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/definitions.d.ts +411 -0
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/drag-handlers.d.ts +3 -0
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/handle-gen.d.ts +15 -0
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/index.d.ts +4 -0
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/resizing-tools-plugin.d.ts +185 -0
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/util.d.ts +16 -0
- package/types/browser-ui/surface-renderer/plugins/snaplines/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/snaplines/snaplines-plugin.d.ts +128 -0
- package/types/browser-ui/surface-renderer/plugins/vertex-drawing/definitions.d.ts +90 -0
- package/types/browser-ui/surface-renderer/plugins/vertex-drawing/index.d.ts +2 -0
- package/types/browser-ui/surface-renderer/plugins/vertex-drawing/vertex-drawing-plugin.d.ts +64 -0
- package/types/browser-ui/surface-renderer/shape-palette-options.d.ts +127 -0
- package/types/browser-ui/surface-renderer/shape-palette.d.ts +55 -0
- package/types/browser-ui/surface-renderer/surface-decorator.d.ts +35 -0
- package/types/browser-ui/surface-renderer/surface-events.d.ts +9 -0
- package/types/browser-ui/surface-renderer/surface-render-options.d.ts +125 -0
- package/types/browser-ui/surface-renderer/surface.d.ts +665 -0
- package/types/browser-ui/svg-component.d.ts +6 -0
- package/types/browser-ui/svg-element-connector.d.ts +16 -0
- package/types/browser-ui/svg-element-overlay.d.ts +55 -0
- package/types/browser-ui/svg-export/definitions.d.ts +153 -0
- package/types/browser-ui/svg-export/image-export-ui.d.ts +20 -0
- package/types/browser-ui/svg-export/image-exporter.d.ts +15 -0
- package/types/browser-ui/svg-export/index.d.ts +6 -0
- package/types/browser-ui/svg-export/svg-export-ui.d.ts +11 -0
- package/types/browser-ui/svg-export/svg-exporter.d.ts +8 -0
- package/types/browser-ui/svg-export/util.d.ts +23 -0
- package/types/browser-ui/svg-util.d.ts +27 -0
- package/types/browser-ui/templating/browser-ui-recado.d.ts +48 -0
- package/types/browser-ui/templating/custom-tag-definition.d.ts +32 -0
- package/types/browser-ui/templating/index.d.ts +11 -0
- package/types/browser-ui/templating/recado-template-renderer.d.ts +69 -0
- package/types/browser-ui/ui-path.d.ts +57 -0
- package/types/browser-ui/util.d.ts +4 -0
- package/types/browser-ui/wheel-listener.d.ts +2 -0
- package/types/charts/area/area-chart.d.ts +85 -0
- package/types/charts/area/index.d.ts +1 -0
- package/types/charts/bar-and-column/bar-chart.d.ts +34 -0
- package/types/charts/bar-and-column/bar-plot.d.ts +90 -0
- package/types/charts/bar-and-column/column-chart.d.ts +35 -0
- package/types/charts/bar-and-column/index.d.ts +3 -0
- package/types/charts/base-chart.d.ts +395 -0
- package/types/charts/base-xy-chart.d.ts +224 -0
- package/types/charts/bubble/bubble-chart.d.ts +30 -0
- package/types/charts/bubble/definitions.d.ts +32 -0
- package/types/charts/bubble/index.d.ts +2 -0
- package/types/charts/category-value-chart.d.ts +146 -0
- package/types/charts/chart-exporter.d.ts +38 -0
- package/types/charts/chart-zoom-controls.d.ts +23 -0
- package/types/charts/constants.d.ts +16 -0
- package/types/charts/css-classes.d.ts +312 -0
- package/types/charts/datasource.d.ts +61 -0
- package/types/charts/definitions.d.ts +261 -0
- package/types/charts/domain_scale_utilities.d.ts +72 -0
- package/types/charts/dual-value-chart.d.ts +60 -0
- package/types/charts/gauge/definitions.d.ts +108 -0
- package/types/charts/gauge/gauge-chart.d.ts +91 -0
- package/types/charts/gauge/index.d.ts +2 -0
- package/types/charts/index.d.ts +25 -0
- package/types/charts/legend.d.ts +120 -0
- package/types/charts/line/index.d.ts +1 -0
- package/types/charts/line/line-chart.d.ts +79 -0
- package/types/charts/markers.d.ts +13 -0
- package/types/charts/pie/index.d.ts +1 -0
- package/types/charts/pie/pie-chart.d.ts +146 -0
- package/types/charts/plot.d.ts +75 -0
- package/types/charts/sankey/index.d.ts +1 -0
- package/types/charts/sankey/preprocessor.d.ts +37 -0
- package/types/charts/sankey/sankey.d.ts +208 -0
- package/types/charts/scatter/definitions.d.ts +6 -0
- package/types/charts/scatter/index.d.ts +2 -0
- package/types/charts/scatter/scatter-chart.d.ts +16 -0
- package/types/charts/series/array-based-series.d.ts +95 -0
- package/types/charts/series/collation-series.d.ts +24 -0
- package/types/charts/series/definitions.d.ts +52 -0
- package/types/charts/series/dual-value-chart-series.d.ts +26 -0
- package/types/charts/series/index.d.ts +7 -0
- package/types/charts/series/record-based-series.d.ts +58 -0
- package/types/charts/series/series.d.ts +66 -0
- package/types/charts/series/summing-collation-series.d.ts +31 -0
- package/types/charts/series/summing-series.d.ts +19 -0
- package/types/charts/series-based-chart.d.ts +59 -0
- package/types/charts/tooltip.d.ts +167 -0
- package/types/charts/util.d.ts +149 -0
- package/types/core/astar/astar-path-finder.d.ts +37 -0
- package/types/core/astar/astar-util.d.ts +100 -0
- package/types/core/astar/candidate-finder.d.ts +16 -0
- package/types/core/astar/candidate-sorter.d.ts +10 -0
- package/types/core/astar/definitions.d.ts +185 -0
- package/types/core/astar/index.d.ts +3 -0
- package/types/core/astar/path-to-segments.d.ts +45 -0
- package/types/core/autosaver.d.ts +67 -0
- package/types/core/color-generator.d.ts +66 -0
- package/types/core/constants.d.ts +181 -0
- package/types/core/csv-loader.d.ts +84 -0
- package/types/core/datamodel/data-model.d.ts +23 -0
- package/types/core/datamodel/vertex-definition.d.ts +40 -0
- package/types/core/datasource.d.ts +87 -0
- package/types/core/event-constants.d.ts +308 -0
- package/types/core/event-generator.d.ts +102 -0
- package/types/core/filterable-dataset.d.ts +38 -0
- package/types/core/geom.d.ts +278 -0
- package/types/core/index.d.ts +39 -0
- package/types/core/io.d.ts +106 -0
- package/types/core/layout/absolute-layout.d.ts +91 -0
- package/types/core/layout/abstract-layout-adapter.d.ts +17 -0
- package/types/core/layout/abstract-layout.d.ts +192 -0
- package/types/core/layout/circular/circular-layout.d.ts +31 -0
- package/types/core/layout/circular/index.d.ts +1 -0
- package/types/core/layout/empty-layout.d.ts +17 -0
- package/types/core/layout/force-directed/force-directed-layout.d.ts +148 -0
- package/types/core/layout/force-directed/index.d.ts +1 -0
- package/types/core/layout/grid/definitions.d.ts +81 -0
- package/types/core/layout/grid/grid-layout.d.ts +60 -0
- package/types/core/layout/grid/index.d.ts +2 -0
- package/types/core/layout/hierarchical/abstract-hierarchical-layout.d.ts +90 -0
- package/types/core/layout/hierarchical/balloon-layout.d.ts +62 -0
- package/types/core/layout/hierarchical/definitions.d.ts +45 -0
- package/types/core/layout/hierarchical/hierarchical-layout.d.ts +102 -0
- package/types/core/layout/hierarchical/index.d.ts +5 -0
- package/types/core/layout/hierarchical/parent-relative-placement.d.ts +96 -0
- package/types/core/layout/hierarchy/assign-layers-stage.d.ts +26 -0
- package/types/core/layout/hierarchy/crossing-stage.d.ts +78 -0
- package/types/core/layout/hierarchy/definitions.d.ts +261 -0
- package/types/core/layout/hierarchy/edge-routing.d.ts +25 -0
- package/types/core/layout/hierarchy/hierarchy-layout-stage.d.ts +9 -0
- package/types/core/layout/hierarchy/hierarchy-layout.d.ts +87 -0
- package/types/core/layout/hierarchy/index.d.ts +11 -0
- package/types/core/layout/hierarchy/model.d.ts +167 -0
- package/types/core/layout/hierarchy/parent-relative-placement.d.ts +69 -0
- package/types/core/layout/hierarchy/placement-stage.d.ts +82 -0
- package/types/core/layout/hierarchy/util.d.ts +13 -0
- package/types/core/layout/hierarchy/vertex-set.d.ts +45 -0
- package/types/core/layout/index.d.ts +10 -0
- package/types/core/layout/layouts.d.ts +10 -0
- package/types/core/magnetizer.d.ts +232 -0
- package/types/core/model/anchor.d.ts +38 -0
- package/types/core/model/cluster.d.ts +19 -0
- package/types/core/model/defs.d.ts +8 -0
- package/types/core/model/djikstra.d.ts +26 -0
- package/types/core/model/floyd-warshall.d.ts +15 -0
- package/types/core/model/graph.d.ts +1166 -0
- package/types/core/model/path.d.ts +227 -0
- package/types/core/params.d.ts +476 -0
- package/types/core/renderer.d.ts +74 -0
- package/types/core/router/common.d.ts +104 -0
- package/types/core/router/direct-router.d.ts +12 -0
- package/types/core/router/index.d.ts +3 -0
- package/types/core/router/orthogonal-router.d.ts +46 -0
- package/types/core/rtree/definitions.d.ts +24 -0
- package/types/core/rtree/hilbert.d.ts +9 -0
- package/types/core/rtree/index.d.ts +4 -0
- package/types/core/rtree/rtree.d.ts +102 -0
- package/types/core/rtree/util.d.ts +55 -0
- package/types/core/search/index.d.ts +1 -0
- package/types/core/search/visuallyjs-search.d.ts +167 -0
- package/types/core/selection.d.ts +394 -0
- package/types/core/templates/abstract-entry.d.ts +19 -0
- package/types/core/templates/comment-entry.d.ts +11 -0
- package/types/core/templates/core.d.ts +162 -0
- package/types/core/templates/custom-tag.d.ts +74 -0
- package/types/core/templates/defs.d.ts +123 -0
- package/types/core/templates/each-entry.d.ts +23 -0
- package/types/core/templates/element-entry.d.ts +18 -0
- package/types/core/templates/elements.d.ts +14 -0
- package/types/core/templates/executions.d.ts +100 -0
- package/types/core/templates/expressions.d.ts +47 -0
- package/types/core/templates/fake-dom.d.ts +42 -0
- package/types/core/templates/headless.d.ts +15 -0
- package/types/core/templates/if-entry.d.ts +25 -0
- package/types/core/templates/index.d.ts +14 -0
- package/types/core/templates/parser.d.ts +84 -0
- package/types/core/templates/text-entry.d.ts +17 -0
- package/types/core/templates/tmpl-entry.d.ts +13 -0
- package/types/core/toolkit.d.ts +1314 -0
- package/types/core/undo-redo/compound-action.d.ts +19 -0
- package/types/core/undo-redo/edge-action.d.ts +62 -0
- package/types/core/undo-redo/group-action.d.ts +60 -0
- package/types/core/undo-redo/move-action.d.ts +18 -0
- package/types/core/undo-redo/node-group-action.d.ts +62 -0
- package/types/core/undo-redo/port-action.d.ts +29 -0
- package/types/core/undo-redo/renderer-vertex-removed-action.d.ts +17 -0
- package/types/core/undo-redo/set-type-action.d.ts +14 -0
- package/types/core/undo-redo/undo-redo.d.ts +203 -0
- package/types/core/undo-redo/update-action.d.ts +20 -0
- package/types/core/undo-redo/vertex-update-action.d.ts +12 -0
- package/types/core/util.d.ts +661 -0
- package/types/index.d.ts +16 -0
- package/types/l.d.ts +2 -0
- package/types/test-support/index.d.ts +1 -0
- package/types/test-support/test-support.d.ts +833 -0
- package/types/ui/common/abstract-segment.d.ts +88 -0
- package/types/ui/common/anchor.d.ts +280 -0
- package/types/ui/common/connector.d.ts +106 -0
- package/types/ui/common/index.d.ts +5 -0
- package/types/ui/common/overlay.d.ts +117 -0
- package/types/ui/common/paint-style.d.ts +33 -0
- package/types/ui/connector-bezier/abstract-bezier-connector.d.ts +68 -0
- package/types/ui/connector-bezier/bezier-connector.d.ts +34 -0
- package/types/ui/connector-bezier/bezier-segment.d.ts +31 -0
- package/types/ui/connector-bezier/bezier.d.ts +129 -0
- package/types/ui/connector-bezier/index.d.ts +6 -0
- package/types/ui/connector-bezier/operations.d.ts +18 -0
- package/types/ui/connector-bezier/quadratic-bezier-connector.d.ts +35 -0
- package/types/ui/connector-orthogonal/default-orthogonal-path-compute.d.ts +11 -0
- package/types/ui/connector-orthogonal/definitions.d.ts +120 -0
- package/types/ui/connector-orthogonal/index.d.ts +7 -0
- package/types/ui/connector-orthogonal/modern-source-target-relocator.d.ts +37 -0
- package/types/ui/connector-orthogonal/operations.d.ts +49 -0
- package/types/ui/connector-orthogonal/stub-calculators.d.ts +12 -0
- package/types/ui/connector-orthogonal/utils.d.ts +134 -0
- package/types/ui/connector-orthogonal/vertex-avoidance.d.ts +29 -0
- package/types/ui/connector-straight/index.d.ts +2 -0
- package/types/ui/connector-straight/operations.d.ts +55 -0
- package/types/ui/connector-straight/straight-connector.d.ts +121 -0
- package/types/ui/copy-paste/clipboard.d.ts +45 -0
- package/types/ui/copy-paste/copy-data.d.ts +93 -0
- package/types/ui/copy-paste/index.d.ts +2 -0
- package/types/ui/core/callbacks.d.ts +48 -0
- package/types/ui/core/component/component.d.ts +115 -0
- package/types/ui/core/connector/abstract-connector.d.ts +66 -0
- package/types/ui/core/connector/arc-segment.d.ts +39 -0
- package/types/ui/core/connector/connection-impl.d.ts +81 -0
- package/types/ui/core/connector/connections.d.ts +113 -0
- package/types/ui/core/connector/connectors.d.ts +205 -0
- package/types/ui/core/connector/operations.d.ts +0 -0
- package/types/ui/core/connector/segments.d.ts +24 -0
- package/types/ui/core/connector/straight-segment.d.ts +32 -0
- package/types/ui/core/constants.d.ts +181 -0
- package/types/ui/core/context.d.ts +26 -0
- package/types/ui/core/core-events.d.ts +7 -0
- package/types/ui/core/core.d.ts +1734 -0
- package/types/ui/core/css-constants.d.ts +149 -0
- package/types/ui/core/defaults.d.ts +242 -0
- package/types/ui/core/definitions.d.ts +540 -0
- package/types/ui/core/event-constants.d.ts +510 -0
- package/types/ui/core/factory/anchor-record-factory.d.ts +17 -0
- package/types/ui/core/factory/continuous-anchors.d.ts +27 -0
- package/types/ui/core/factory/overlay-factory.d.ts +8 -0
- package/types/ui/core/grid-profile.d.ts +28 -0
- package/types/ui/core/group-collapse-expand.d.ts +23 -0
- package/types/ui/core/group-sizer.d.ts +9 -0
- package/types/ui/core/index.d.ts +45 -0
- package/types/ui/core/magnetize-profile.d.ts +82 -0
- package/types/ui/core/overlay/arrow-overlay.d.ts +34 -0
- package/types/ui/core/overlay/custom-overlay.d.ts +38 -0
- package/types/ui/core/overlay/diamond-overlay.d.ts +14 -0
- package/types/ui/core/overlay/dot-overlay.d.ts +54 -0
- package/types/ui/core/overlay/ellipse-overlay.d.ts +60 -0
- package/types/ui/core/overlay/label-overlay.d.ts +37 -0
- package/types/ui/core/overlay/overlay.d.ts +131 -0
- package/types/ui/core/overlay/plain-arrow-overlay.d.ts +15 -0
- package/types/ui/core/overlay/rectangle-overlay.d.ts +66 -0
- package/types/ui/core/params.d.ts +223 -0
- package/types/ui/core/router/astar-path-finder.d.ts +29 -0
- package/types/ui/core/router/base-router.d.ts +100 -0
- package/types/ui/core/router/default-router.d.ts +38 -0
- package/types/ui/core/router/index.d.ts +5 -0
- package/types/ui/core/router/router-utils.d.ts +118 -0
- package/types/ui/core/router/router.d.ts +30 -0
- package/types/ui/core/type-descriptors.d.ts +83 -0
- package/types/ui/core/ui-model.d.ts +65 -0
- package/types/ui/core/view/common-options.d.ts +15 -0
- package/types/ui/core/view/edge-options.d.ts +126 -0
- package/types/ui/core/view/events.d.ts +159 -0
- package/types/ui/core/view/group-options.d.ts +75 -0
- package/types/ui/core/view/index.d.ts +35 -0
- package/types/ui/core/view/node-options.d.ts +20 -0
- package/types/ui/core/view/node-or-port-options.d.ts +28 -0
- package/types/ui/core/view/port-options.d.ts +51 -0
- package/types/ui/core/view/vertex-options.d.ts +28 -0
- package/types/ui/core/viewport.d.ts +297 -0
- package/types/ui/index.d.ts +9 -0
- package/types/ui/plugins/definitions.d.ts +118 -0
- package/types/ui/plugins/index.d.ts +2 -0
- package/types/ui/plugins/plugins.d.ts +7 -0
- package/types/ui/property-mappings/definitions.d.ts +28 -0
- package/types/ui/property-mappings/index.d.ts +2 -0
- package/types/ui/property-mappings/property-mapper.d.ts +16 -0
- package/types/ui/util/index.d.ts +3 -0
- package/types/ui/util/property-tracker.d.ts +8 -0
- package/types/ui/util/svg-constants.d.ts +111 -0
- package/types/ui/util/util.d.ts +69 -0
- package/types/version.d.ts +1 -0
|
@@ -0,0 +1,1314 @@
|
|
|
1
|
+
import { Graph, IdFunction, TypeFunction, ObjectData, Base, Node, Port, Group, Vertex, Edge } from "./model/graph";
|
|
2
|
+
import { AutoSaveOptions, AutoSaver } from "./autosaver";
|
|
3
|
+
import { Cluster } from "./model/cluster";
|
|
4
|
+
import { Path, PathOptions } from "./model/path";
|
|
5
|
+
import { VisuallyJsSelection } from "./selection";
|
|
6
|
+
import { VisuallyJsRenderer } from "./renderer";
|
|
7
|
+
import { ObjectInfo, WriteableDatasource } from "./datasource";
|
|
8
|
+
import { EVENT_DATA_APPEND_END, EVENT_DATA_APPEND_START, EVENT_DATA_LOAD_END, EVENT_DATA_LOAD_START, EVENT_DESELECT, EVENT_EDGE_ADDED, EVENT_EDGE_REMOVED, EVENT_EDGE_SOURCE_CHANGED, EVENT_EDGE_TARGET_CHANGED, EVENT_EDGE_TYPE_CHANGED, EVENT_EDGE_UPDATED, EVENT_GRAPH_CLEAR_START, EVENT_GRAPH_CLEARED, EVENT_GROUP_TYPE_CHANGED, EVENT_GROUP_UPDATED, EVENT_NODE_ADDED, EVENT_NODE_REMOVED, EVENT_NODE_TYPE_CHANGED, EVENT_NODE_UPDATED, EVENT_PORT_ADDED, EVENT_PORT_REMOVED, EVENT_PORT_TYPE_CHANGED, EVENT_PORT_UPDATED, EVENT_RENDERER_ADDED, EVENT_SELECT, EVENT_SELECTION_CLEARED, EVENT_UNDOREDO_UPDATE, EVENT_EDGE_PATH_EDITED, EVENT_DATA_UPDATED, EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO, EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO, EVENT_INTERNAL_GROUP_SIZE_CHANGED } from "./event-constants";
|
|
9
|
+
import { UrlFetchOptions } from "./io";
|
|
10
|
+
import { DataModel, DataModelDefinition } from "./datamodel/data-model";
|
|
11
|
+
import { SelectionMode } from './selection';
|
|
12
|
+
import { AddEdgeOptions, ConnectReason, EdgeSelectionParams, LoadOptions } from "./params";
|
|
13
|
+
import { TransactionCleanupAction, UndoRedoManager } from "./undo-redo/undo-redo";
|
|
14
|
+
import { EVENT_GROUP_ADDED, EVENT_GROUP_MEMBER_ADDED, EVENT_GROUP_MEMBER_REMOVED, EVENT_GROUP_REMOVED, EVENT_UNDO, EVENT_REDO } from './event-constants';
|
|
15
|
+
import { PointXY, Geometry } from "./util";
|
|
16
|
+
import { OptimisticEventGenerator } from "./event-generator";
|
|
17
|
+
import { ProxyLocation } from "./constants";
|
|
18
|
+
/**
|
|
19
|
+
* Definition of a function to use as a beforeConnect interceptor.
|
|
20
|
+
* @param source The source vertex for the new edge
|
|
21
|
+
* @param target The target vertex for the new edge
|
|
22
|
+
* @param payload optional initial data for the edge, which would have
|
|
23
|
+
* @param userInstigated If true, the new edge came from user activity, with a pointer device or touch input. This will be
|
|
24
|
+
* false whenever the edge is added programmatically, either during a data load or via the `addEdge` method of the model.
|
|
25
|
+
* @group Model
|
|
26
|
+
*/
|
|
27
|
+
export type BeforeConnectInterceptor = (source: Vertex, target: Vertex, payload?: ObjectData, userInstigated?: boolean) => any;
|
|
28
|
+
/**
|
|
29
|
+
* A function to run before an edge of the given type is relocated from its current source or target to a new source or target. Returning false from this method will abort the move.
|
|
30
|
+
* @param source Candidate source. May be the edge's current source, or may be a new source.
|
|
31
|
+
* @param target Candidate target. May be the edge's current target, or may be a new target.
|
|
32
|
+
* @param edge The edge that is being moved.
|
|
33
|
+
* @group Model
|
|
34
|
+
*/
|
|
35
|
+
export type BeforeMoveConnectionInterceptor = (source: Vertex, target: Vertex, edge: Edge) => any;
|
|
36
|
+
/**
|
|
37
|
+
* A function to run before an edge of the given type is dragged from the given source. Returning false from this method will abort the connection.
|
|
38
|
+
* @param source
|
|
39
|
+
* @param type
|
|
40
|
+
* @returns If you return boolean false from this method the connection is aborted. If you return an object from this method it will be used as the initial data for the resulting edge.
|
|
41
|
+
* @group Model
|
|
42
|
+
*/
|
|
43
|
+
export type BeforeStartConnectInterceptor = (source: Vertex, type: string) => boolean | Record<string, any>;
|
|
44
|
+
/**
|
|
45
|
+
* A function to run before the given edge is detached from the given source vertex. If this method returns false, the detach will be aborted.
|
|
46
|
+
* @param source Edge's source.
|
|
47
|
+
* @param target Candidate target for the edge
|
|
48
|
+
* @param edge The edge that is being detached.
|
|
49
|
+
* @group Model
|
|
50
|
+
*/
|
|
51
|
+
export type BeforeDetachInterceptor = (source: Vertex, target: Vertex, edge: Edge) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A function to run before the given edge is detached from the given source vertex. If this method returns false, the detach will be aborted. The difference between this and `beforeDetach` is that this method is fired as soon as a user tries to detach an edge in the UI, whereas `beforeDetach` allows a user to detach the edge in the UI.
|
|
54
|
+
* @param source
|
|
55
|
+
* @param edge
|
|
56
|
+
* @group Model
|
|
57
|
+
*/
|
|
58
|
+
export type BeforeStartDetachInterceptor = (source: Vertex, edge: Edge) => Record<string, any> | boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Constructor options for a VisuallyJs model instance.
|
|
61
|
+
* @group Model
|
|
62
|
+
*/
|
|
63
|
+
export interface ModelOptions {
|
|
64
|
+
/**
|
|
65
|
+
* The name of a property that will exist inside the backing data for nodes/group, and which represents a list of ports pertaining to that node/group. When a node/group is rendered, if this property is set, VisuallyJs will consider the value of this property to be a list of port data object. So this property's value should be of type `Array<ObjectData>`
|
|
66
|
+
*/
|
|
67
|
+
portDataProperty?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The name of a property inside of each port's data that can be used to order the ports. For instance, you might have ports that have a `rank` property, which is a number. VisuallyJs will sort the ports according to the natural ordering of this property.
|
|
70
|
+
*/
|
|
71
|
+
portOrderProperty?: string;
|
|
72
|
+
model?: DataModelDefinition;
|
|
73
|
+
/**
|
|
74
|
+
* The name of the property inside a vertex's data that identifies its location in the x axis. Defaults to `left`.
|
|
75
|
+
*/
|
|
76
|
+
modelTopAttribute?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The name of the property inside a vertex's data that identifies its location in the y axis. Defaults to `top`.
|
|
79
|
+
*/
|
|
80
|
+
modelLeftAttribute?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The name of the property inside a vertex's data that identifies its width. Defaults to `width`.
|
|
83
|
+
*/
|
|
84
|
+
modelWidthAttribute?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The name of the property inside a vertex's data that identifies its height. Defaults to `height`.
|
|
87
|
+
*/
|
|
88
|
+
modelHeightAttribute?: string;
|
|
89
|
+
/**
|
|
90
|
+
* The name of the property inside a vertex's data that identifies its rotation. Defaults to `rotation`.
|
|
91
|
+
*/
|
|
92
|
+
modelRotationAttribute?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Optional factory method used when creating nodes via the addFactoryNode method.
|
|
95
|
+
*/
|
|
96
|
+
nodeFactory?: ObjectFactory;
|
|
97
|
+
/**
|
|
98
|
+
* Optional factory method used when creating edges via the addFactoryEdge method.
|
|
99
|
+
*/
|
|
100
|
+
edgeFactory?: ObjectFactory;
|
|
101
|
+
/**
|
|
102
|
+
* Optional factory method used when creating ports via the addFactoryPort method.
|
|
103
|
+
*/
|
|
104
|
+
portFactory?: ObjectFactory;
|
|
105
|
+
/**
|
|
106
|
+
* Optional factory method used when creating groups via the addFactoryGroup method.
|
|
107
|
+
*/
|
|
108
|
+
groupFactory?: ObjectFactory;
|
|
109
|
+
autoSave?: AutoSaveOptions;
|
|
110
|
+
/**
|
|
111
|
+
* The character to use in port identifiers. Defaults to `.`, eg. someVertex.somePort.
|
|
112
|
+
*/
|
|
113
|
+
portSeparator?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The default cost for an edge. Default value is 1.
|
|
116
|
+
*/
|
|
117
|
+
defaultCost?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Whether edges are directed by default. The default value for this is `true` - edges are directed by default.
|
|
120
|
+
*/
|
|
121
|
+
defaultDirected?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
enableSubgraphs?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Definition of a function to use as a beforeConnect interceptor.
|
|
128
|
+
* @param source - The source vertex for the new edge
|
|
129
|
+
* @param target - The target vertex for the new edge
|
|
130
|
+
* @param userInstigated - If true, the new edge came from user activity, with a pointer device or touch input. This will be
|
|
131
|
+
* false whenever the edge is added programmatically, either during a data load or via the `addEdge` method of VisuallyJsModel.
|
|
132
|
+
*/
|
|
133
|
+
beforeConnect?: BeforeConnectInterceptor;
|
|
134
|
+
/**
|
|
135
|
+
* A function to run before an edge of the given type is relocated from its current source or target to a new source or target. Returning false from this method will abort the move.
|
|
136
|
+
* @param source Candidate source. May be the edge's current source, or may be a new source.
|
|
137
|
+
* @param target Candidate target. May be the edge's current target, or may be a new target.
|
|
138
|
+
* @param edge The edge that is being moved.
|
|
139
|
+
*/
|
|
140
|
+
beforeMoveConnection?: BeforeMoveConnectionInterceptor;
|
|
141
|
+
/**
|
|
142
|
+
* A function to run before an edge of the given type is dragged from the given source. Returning false from this method will abort the connection.
|
|
143
|
+
* @param source
|
|
144
|
+
* @param type
|
|
145
|
+
*/
|
|
146
|
+
beforeStartConnect?: BeforeStartConnectInterceptor;
|
|
147
|
+
/**
|
|
148
|
+
* A function to run before the given edge is detached from the given source vertex. If this method returns false, the
|
|
149
|
+
* detach will be aborted.
|
|
150
|
+
* @param source Edge's source.
|
|
151
|
+
* @param target Candidate target for the edge
|
|
152
|
+
* @param edge The edge that is being detached.
|
|
153
|
+
*/
|
|
154
|
+
beforeDetach?: BeforeDetachInterceptor;
|
|
155
|
+
/**
|
|
156
|
+
* A function to run before the given edge is detached from the given source vertex. If this method returns false, the detach will be aborted. The difference between this and `beforeDetach` is that this method is fired as soon as a user tries to detach an edge from an endpoint in the UI, whereas `beforeDetach` allows a user to detach the edge in the UI.
|
|
157
|
+
* @param source
|
|
158
|
+
* @param edge
|
|
159
|
+
*/
|
|
160
|
+
beforeStartDetach?: BeforeStartDetachInterceptor;
|
|
161
|
+
/**
|
|
162
|
+
* Optional mode for VisuallyJs's current selection. Defaults to the Selection default - `SelectionModes.mixed`.
|
|
163
|
+
*/
|
|
164
|
+
selectionMode?: SelectionMode;
|
|
165
|
+
/**
|
|
166
|
+
* The maximum number of nodes that can be selected at any one time. Defaults to Infinity.
|
|
167
|
+
*/
|
|
168
|
+
maxSelectedNodes?: number;
|
|
169
|
+
/**
|
|
170
|
+
* The maximum number of edges that can be selected at any one time. Defaults to Infinity.
|
|
171
|
+
*/
|
|
172
|
+
maxSelectedEdges?: number;
|
|
173
|
+
/**
|
|
174
|
+
* The maximum number of groups that can be selected at any one time. Defaults to Infinity.
|
|
175
|
+
*/
|
|
176
|
+
maxSelectedGroups?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Defines the action taken when appending an object that would take the selection above its limit for the given object type. This can be either Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW.
|
|
179
|
+
*/
|
|
180
|
+
selectionCapacityPolicy?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Data to load directly after Toolkit has been created.
|
|
183
|
+
*/
|
|
184
|
+
data?: any;
|
|
185
|
+
/**
|
|
186
|
+
* Configuration for undo/redo
|
|
187
|
+
*/
|
|
188
|
+
undoRedo?: {
|
|
189
|
+
/**
|
|
190
|
+
* Whether or not undo/redo is enabled. Defaults to true.
|
|
191
|
+
*/
|
|
192
|
+
enabled?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Maximum size of the undo stack. Defaults to 50.
|
|
195
|
+
*/
|
|
196
|
+
maximumSize?: number;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* A function to use to determine the ID of some data object. By default VisuallyJs uses the value of the object's `id` property.
|
|
200
|
+
*/
|
|
201
|
+
idFunction?: IdFunction;
|
|
202
|
+
/**
|
|
203
|
+
* The name of the property that identifies a given object's `type`. By default this is the `type` property.
|
|
204
|
+
*/
|
|
205
|
+
typeProperty?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The name of the property that identifies a given edge's `type`. By default this is the `type` property. If you do not set this but you do set `typeProperty`, that value will be used.
|
|
208
|
+
*/
|
|
209
|
+
edgeTypeProperty?: string;
|
|
210
|
+
/**
|
|
211
|
+
* The name of the property that identifies a given port's `type`. By default this is the `type` property. If you do not set this but you do set `typeProperty`, that value will be used.
|
|
212
|
+
*/
|
|
213
|
+
portTypeProperty?: string;
|
|
214
|
+
/**
|
|
215
|
+
* A function to use to determine the type of some data object. By default VisuallyJs uses the value of the object's `type` property.
|
|
216
|
+
*/
|
|
217
|
+
typeFunction?: TypeFunction;
|
|
218
|
+
/**
|
|
219
|
+
* A function to use to determine the ID of some edge from its data. By default VisuallyJs uses the value of the object's `id` property.
|
|
220
|
+
*/
|
|
221
|
+
edgeIdFunction?: IdFunction;
|
|
222
|
+
/**
|
|
223
|
+
* A function to use to determine the type of some edge from its data object. By default VisuallyJs uses the value of the object's `type` property.
|
|
224
|
+
*/
|
|
225
|
+
edgeTypeFunction?: TypeFunction;
|
|
226
|
+
/**
|
|
227
|
+
* A function to use to determine the ID of some port from its data. By default VisuallyJs uses the value of the object's `id` property.
|
|
228
|
+
*/
|
|
229
|
+
portIdFunction?: IdFunction;
|
|
230
|
+
/**
|
|
231
|
+
* A function to use to determine the type of some port from its data object. By default VisuallyJs uses the value of the object's `type` property.
|
|
232
|
+
*/
|
|
233
|
+
portTypeFunction?: TypeFunction;
|
|
234
|
+
/**
|
|
235
|
+
* A function to use to extract an array of ports from the data representing some node/group. Whenever a node/group is rendered, VisuallyJs will use this method, if provided, to determine a list of ports for that node/group. If you use this you probably also want to define a `portUpdater`. Note that if you provide the `portDataProperty` then you do not need to set this.
|
|
236
|
+
*/
|
|
237
|
+
portExtractor?: (o: ObjectData) => Array<ObjectData>;
|
|
238
|
+
/**
|
|
239
|
+
* A function to use to update a given node/group's list of ports. Note that if you provide the `portDataProperty` then you do not need to set this.
|
|
240
|
+
*/
|
|
241
|
+
portUpdater?: Function;
|
|
242
|
+
/**
|
|
243
|
+
* Optional model event mappings to bind
|
|
244
|
+
*/
|
|
245
|
+
events?: ModelEventsOptions;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Definition of a model event callback.
|
|
249
|
+
*/
|
|
250
|
+
export type EventCallback<T = any> = (payload: T, evt?: any) => any;
|
|
251
|
+
/**
|
|
252
|
+
* Model event mappings - a record whose keys are valid {@link ModelEvent}s.
|
|
253
|
+
*/
|
|
254
|
+
export type ModelEventsOptions = {
|
|
255
|
+
[K in ModelEvent]?: EventCallback;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Options for data export.
|
|
259
|
+
* @group Model
|
|
260
|
+
* @category Input and Output
|
|
261
|
+
*/
|
|
262
|
+
export interface ExportOptions {
|
|
263
|
+
/**
|
|
264
|
+
* Specifies the data type in which to format the data. Defaults to `"json"`. This must match the name of an exporter registered with the given instance of VisuallyJs.
|
|
265
|
+
*/
|
|
266
|
+
type?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Optional parameters to pass to the exporter. If you write a custom exporter you may wish to use this.
|
|
269
|
+
*/
|
|
270
|
+
parameters?: Record<string, any>;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Options for a save via ajax.
|
|
274
|
+
* @group Model
|
|
275
|
+
* @category Input and Output
|
|
276
|
+
*/
|
|
277
|
+
export interface SaveOptions extends ExportOptions {
|
|
278
|
+
/**
|
|
279
|
+
* URL to POST data to. Required.
|
|
280
|
+
*/
|
|
281
|
+
url: string;
|
|
282
|
+
/**
|
|
283
|
+
* Optional callback to execute once the data has saved successfully.
|
|
284
|
+
* @param r
|
|
285
|
+
*/
|
|
286
|
+
success?: (r: any) => any;
|
|
287
|
+
/**
|
|
288
|
+
* Optional callback to execute if there was an error saving the data.
|
|
289
|
+
* @param e
|
|
290
|
+
* @param status
|
|
291
|
+
*/
|
|
292
|
+
error?: (e: any, status?: any) => any;
|
|
293
|
+
/**
|
|
294
|
+
* Optional headers to set on the ajax request. By default, VisuallyJs will send a `Content-Type:"application/json"` header. If you provide your own headers this header will continue to be sent, unless of course you override it.
|
|
295
|
+
*/
|
|
296
|
+
headers?: Record<string, string>;
|
|
297
|
+
/**
|
|
298
|
+
* optional data to save. If not provided we use the return value of `exportData()`.
|
|
299
|
+
*/
|
|
300
|
+
data?: any;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Options for a `connect` call.
|
|
304
|
+
* @group Model
|
|
305
|
+
*/
|
|
306
|
+
export interface ConnectOptions {
|
|
307
|
+
source: any;
|
|
308
|
+
target: any;
|
|
309
|
+
geometry?: any;
|
|
310
|
+
data?: Record<string, any>;
|
|
311
|
+
cost?: number;
|
|
312
|
+
directed?: boolean;
|
|
313
|
+
doNotCreateMissingNodes?: boolean;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Definition of a function that can act as a factory for model objects.
|
|
317
|
+
*/
|
|
318
|
+
export type ObjectFactory = (model: VisuallyJsModel, type: string, data: ObjectData, continueCallback: (o: ObjectData) => any, abortCallback: () => any, params?: any) => boolean;
|
|
319
|
+
/** @internal */
|
|
320
|
+
export declare const VERTEX_UPDATE_REASON_GROUP_RESIZED = "groupResized";
|
|
321
|
+
/** @internal */
|
|
322
|
+
export declare const VERTEX_UPDATE_REASON_ADD_PORT = "addPort";
|
|
323
|
+
/** @internal */
|
|
324
|
+
export declare const VERTEX_UPDATE_REASON_ADD_NEW_PORT = "addNewPort";
|
|
325
|
+
/** @internal */
|
|
326
|
+
export declare const VERTEX_UPDATE_REASON_REMOVE_PORT = "removePort";
|
|
327
|
+
/** @internal */
|
|
328
|
+
export declare const VERTEX_UPDATE_REASON_UPDATE_PORT = "updatePort";
|
|
329
|
+
/** @internal */
|
|
330
|
+
export declare const VERTEX_UPDATE_REASON_MOVED = "moved";
|
|
331
|
+
/** @internal */
|
|
332
|
+
export declare const VERTEX_UPDATE_REASON_LAYOUT = "layout";
|
|
333
|
+
/** @internal */
|
|
334
|
+
export declare const VERTEX_UPDATE_REASON_UPDATE_VERTEX = "updateVertex";
|
|
335
|
+
/** @internal */
|
|
336
|
+
export declare const VERTEX_UPDATE_REASON_UPDATE_NODE = "updateNode";
|
|
337
|
+
/** @internal */
|
|
338
|
+
export declare const VERTEX_UPDATE_REASON_UPDATE_GROUP = "updateGroup";
|
|
339
|
+
/** @internal */
|
|
340
|
+
export declare const VERTEX_UPDATE_REASON_MAGNETIZER = "magnetizer";
|
|
341
|
+
/** @internal */
|
|
342
|
+
export declare const VERTEX_UPDATE_REASON_SET_POSITION = "setPosition";
|
|
343
|
+
/** @internal */
|
|
344
|
+
export declare const VERTEX_UPDATE_REASON_SNAP_TO_GRID = "snapToGrid";
|
|
345
|
+
/** @internal */
|
|
346
|
+
export declare const VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT = "sizeGroupToFit";
|
|
347
|
+
/** @internal */
|
|
348
|
+
export declare const VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE = "drawingToolsResize";
|
|
349
|
+
/** @internal */
|
|
350
|
+
export declare const VERTEX_UPDATE_REASON_ROTATION = "rotation";
|
|
351
|
+
/** @internal */
|
|
352
|
+
export declare const VERTEX_UPDATE_REASON_RESIZED = "resized";
|
|
353
|
+
/**
|
|
354
|
+
* Reasons that a vertex has been updated.
|
|
355
|
+
* @internal
|
|
356
|
+
*/
|
|
357
|
+
export type VertexUpdatedReason = typeof VERTEX_UPDATE_REASON_ADD_NEW_PORT | typeof VERTEX_UPDATE_REASON_ADD_PORT | typeof VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE | typeof VERTEX_UPDATE_REASON_GROUP_RESIZED | typeof VERTEX_UPDATE_REASON_REMOVE_PORT | typeof VERTEX_UPDATE_REASON_UPDATE_PORT | typeof VERTEX_UPDATE_REASON_MOVED | typeof VERTEX_UPDATE_REASON_LAYOUT | typeof VERTEX_UPDATE_REASON_UPDATE_VERTEX | typeof VERTEX_UPDATE_REASON_UPDATE_NODE | typeof VERTEX_UPDATE_REASON_UPDATE_GROUP | typeof VERTEX_UPDATE_REASON_MAGNETIZER | typeof VERTEX_UPDATE_REASON_SET_POSITION | typeof VERTEX_UPDATE_REASON_SNAP_TO_GRID | typeof VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT | typeof VERTEX_UPDATE_REASON_ROTATION | typeof VERTEX_UPDATE_REASON_RESIZED;
|
|
358
|
+
/** @internal */
|
|
359
|
+
export declare const EDGE_UPDATE_REASON_UPDATED = "updated";
|
|
360
|
+
/**
|
|
361
|
+
* Reasons that en edge has been updated.
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
export type EdgeUpdatedReason = typeof EDGE_UPDATE_REASON_UPDATED;
|
|
365
|
+
/**
|
|
366
|
+
* Names of internal events that can be fired by the VisuallyJsModel
|
|
367
|
+
* @group Events
|
|
368
|
+
* @internal
|
|
369
|
+
*/
|
|
370
|
+
export type InternalModelEvent = typeof EVENT_INTERNAL_GROUP_SIZE_CHANGED | typeof EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO | typeof EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO | typeof EVENT_RENDERER_ADDED;
|
|
371
|
+
/**
|
|
372
|
+
* Names of events that can be fired by the VisuallyJsModel.
|
|
373
|
+
* @group Events
|
|
374
|
+
*/
|
|
375
|
+
export type ModelEvent = typeof EVENT_NODE_ADDED | typeof EVENT_DATA_UPDATED | typeof EVENT_GROUP_ADDED | typeof EVENT_GROUP_MEMBER_ADDED | typeof EVENT_GROUP_MEMBER_REMOVED | typeof EVENT_EDGE_REMOVED | typeof EVENT_EDGE_SOURCE_CHANGED | typeof EVENT_EDGE_TARGET_CHANGED | typeof EVENT_PORT_ADDED | typeof EVENT_NODE_REMOVED | typeof EVENT_GROUP_REMOVED | typeof EVENT_EDGE_ADDED | typeof EVENT_GRAPH_CLEARED | typeof EVENT_PORT_REMOVED | typeof EVENT_SELECT | typeof EVENT_SELECTION_CLEARED | typeof EVENT_NODE_UPDATED | typeof EVENT_GROUP_UPDATED | typeof EVENT_EDGE_UPDATED | typeof EVENT_EDGE_PATH_EDITED | typeof EVENT_GRAPH_CLEAR_START | typeof EVENT_NODE_TYPE_CHANGED | typeof EVENT_PORT_TYPE_CHANGED | typeof EVENT_GROUP_TYPE_CHANGED | typeof EVENT_EDGE_TYPE_CHANGED | typeof EVENT_PORT_UPDATED | typeof EVENT_DESELECT | typeof EVENT_DATA_LOAD_START | typeof EVENT_DATA_LOAD_END | typeof EVENT_UNDOREDO_UPDATE | typeof EVENT_UNDO | typeof EVENT_REDO | typeof EVENT_DATA_APPEND_START | typeof EVENT_DATA_APPEND_END;
|
|
376
|
+
/**
|
|
377
|
+
* Core VisuallyJs model functionality. This class provides the basic data model of an directed/undirected graph, and offers methods to add/update/remove nodes, groups, edges and ports. Multiple renderers can share one instance of the model.
|
|
378
|
+
* @group Model
|
|
379
|
+
*/
|
|
380
|
+
export declare abstract class VisuallyJsModel extends OptimisticEventGenerator implements WriteableDatasource {
|
|
381
|
+
graph: Graph;
|
|
382
|
+
autoSaver: AutoSaver;
|
|
383
|
+
idFunction: IdFunction;
|
|
384
|
+
typeProperty: string;
|
|
385
|
+
edgeTypeProperty: string;
|
|
386
|
+
portTypeProperty: string;
|
|
387
|
+
typeFunction: TypeFunction;
|
|
388
|
+
edgeIdFunction: IdFunction;
|
|
389
|
+
edgeTypeFunction: TypeFunction;
|
|
390
|
+
portIdFunction: IdFunction;
|
|
391
|
+
portTypeFunction: TypeFunction;
|
|
392
|
+
portExtractor: Function;
|
|
393
|
+
portUpdater: Function;
|
|
394
|
+
portDataProperty: string;
|
|
395
|
+
portOrderProperty: string;
|
|
396
|
+
modelTopAttribute: string;
|
|
397
|
+
modelLeftAttribute: string;
|
|
398
|
+
modelWidthAttribute: string;
|
|
399
|
+
modelHeightAttribute: string;
|
|
400
|
+
modelRotationAttribute: string;
|
|
401
|
+
model: DataModel;
|
|
402
|
+
private _$_dataLoading;
|
|
403
|
+
private _autoSave;
|
|
404
|
+
debugEnabled: boolean;
|
|
405
|
+
defaultObjectFactory: ObjectFactory;
|
|
406
|
+
nodeFactory: ObjectFactory;
|
|
407
|
+
edgeFactory: ObjectFactory;
|
|
408
|
+
portFactory: ObjectFactory;
|
|
409
|
+
groupFactory: ObjectFactory;
|
|
410
|
+
portSeparator: string;
|
|
411
|
+
undoRedo: UndoRedoManager;
|
|
412
|
+
private _graphParams;
|
|
413
|
+
beforeConnect: BeforeConnectInterceptor;
|
|
414
|
+
beforeMoveConnection: BeforeMoveConnectionInterceptor;
|
|
415
|
+
beforeStartConnect: BeforeStartConnectInterceptor;
|
|
416
|
+
beforeDetach: BeforeDetachInterceptor;
|
|
417
|
+
beforeStartDetach: BeforeStartDetachInterceptor;
|
|
418
|
+
private readonly _$_currentSelection;
|
|
419
|
+
private _$_renderersById;
|
|
420
|
+
constructor(params?: ModelOptions);
|
|
421
|
+
private _prepareDummyVertexPayload;
|
|
422
|
+
private _deriveVertex;
|
|
423
|
+
private _$_createSelection;
|
|
424
|
+
/**
|
|
425
|
+
* Filter the dataset and return a Selection containing matches. You can optionally provide a type parameter to indicate the type of objects you expect back in the Selection.
|
|
426
|
+
* @param spec Either a function which is passed every object in the dataset and expected to return `true` to indicate inclusion, or an object containing key:value pairs to match in the backing data of each object in the dataset
|
|
427
|
+
* @param includePartials If true, objects whose data matches one or more, but not all, of the pairs in `spec` will be included in the result. By default objects have to match all the pairs in `spec` to be included in the result.
|
|
428
|
+
*/
|
|
429
|
+
filter<T = any>(spec: (o: Base) => boolean | ObjectData, includePartials?: boolean): VisuallyJsSelection;
|
|
430
|
+
/**
|
|
431
|
+
* Gets the model registered with this VisuallyJs instance, if any. Use VisuallyJs's model to map data model event handlers and other data model considerations such as the maximum number of connections a Port allows
|
|
432
|
+
* @returns Current model. May be null.
|
|
433
|
+
*/
|
|
434
|
+
getModel(): DataModel;
|
|
435
|
+
/**
|
|
436
|
+
* Sets options for the auto save mechanism.
|
|
437
|
+
* @param autoSaveOptions
|
|
438
|
+
*
|
|
439
|
+
*/
|
|
440
|
+
setAutoSave(autoSaveOptions: AutoSaveOptions): void;
|
|
441
|
+
/**
|
|
442
|
+
* Connects two nodes/ports (or a combination of the two), by ID. By default, this method will create nodes that are missing. Port ids are specified with a dotted syntax, eg `foo.bar` refers to the port "bar" on the node "foo".
|
|
443
|
+
* @param params Connect parameters.
|
|
444
|
+
* @returns The new Edge.
|
|
445
|
+
*
|
|
446
|
+
*/
|
|
447
|
+
connect(params: ConnectOptions): Edge;
|
|
448
|
+
/**
|
|
449
|
+
* Fires a 'graphClearStart' event, clears the graph, then fires a `graphClearEnd` event.
|
|
450
|
+
* @returns The current Toolkit instance.
|
|
451
|
+
*
|
|
452
|
+
*/
|
|
453
|
+
clear(): VisuallyJsModel;
|
|
454
|
+
destroy(): void;
|
|
455
|
+
/**
|
|
456
|
+
* Returns the current Graph.
|
|
457
|
+
* @returns The underlying Graph.
|
|
458
|
+
*
|
|
459
|
+
*/
|
|
460
|
+
getGraph(): Graph;
|
|
461
|
+
/**
|
|
462
|
+
* Returns the count of nodes in the Graph.
|
|
463
|
+
* @returns The count of Nodes in the Graph.
|
|
464
|
+
*
|
|
465
|
+
*/
|
|
466
|
+
getNodeCount(): number;
|
|
467
|
+
/**
|
|
468
|
+
* Returns the Node at the given index.
|
|
469
|
+
* @returns The Node at the given index, null if not found.
|
|
470
|
+
*
|
|
471
|
+
*/
|
|
472
|
+
getNodeAt(idx: number): Node;
|
|
473
|
+
/**
|
|
474
|
+
* Returns all the nodes in the Graph.
|
|
475
|
+
* @returns All the Nodes in the graph.
|
|
476
|
+
*
|
|
477
|
+
*/
|
|
478
|
+
getNodes(): Array<Node>;
|
|
479
|
+
/**
|
|
480
|
+
* Iterates through all Nodes in the model one at a time. You should not perform destructive editing of the dataset inside one of these loops.
|
|
481
|
+
* @param fn A function that takes (index, node) as arguments and is applied for every Node in the VisuallyJs instance.
|
|
482
|
+
*
|
|
483
|
+
*/
|
|
484
|
+
eachNode(fn: (idx: number, node: Node) => void): void;
|
|
485
|
+
/**
|
|
486
|
+
* Iterates through all Groups in the model one at a time. You should not perform destructive editing of the dataset inside one of these loops.
|
|
487
|
+
* @param fn A function that takes (index, node) as arguments and is applied for every Group in the VisuallyJs instance.
|
|
488
|
+
*
|
|
489
|
+
*/
|
|
490
|
+
eachGroup(fn: (idx: number, group: Group) => void): void;
|
|
491
|
+
/**
|
|
492
|
+
* Combines eachNode and eachGroup into one method.
|
|
493
|
+
* @param fn
|
|
494
|
+
*
|
|
495
|
+
*/
|
|
496
|
+
eachVertex(fn: (idx: number, vertex: Vertex) => void): void;
|
|
497
|
+
/**
|
|
498
|
+
* Iterates through all Edges in the model one at a time. You should not perform destructive editing of the dataset inside one of these loops.
|
|
499
|
+
* @param fn A function that takes (index, edge) as arguments and is applied for every Node in the VisuallyJs instance.
|
|
500
|
+
*
|
|
501
|
+
*/
|
|
502
|
+
eachEdge(fn: (idx: number, edge: Edge) => void): void;
|
|
503
|
+
/**
|
|
504
|
+
* Returns the total number of edges in the graph.
|
|
505
|
+
*/
|
|
506
|
+
getEdgeCount(): number;
|
|
507
|
+
/**
|
|
508
|
+
* Returns the total number of group in the Graph.
|
|
509
|
+
*/
|
|
510
|
+
getGroupCount(): number;
|
|
511
|
+
/**
|
|
512
|
+
* Returns the Group at the given index, null if not found.
|
|
513
|
+
* @param idx Index into group list
|
|
514
|
+
*/
|
|
515
|
+
getGroupAt(idx: number): Group;
|
|
516
|
+
/**
|
|
517
|
+
* Returns all the Groups in the Graph.
|
|
518
|
+
*/
|
|
519
|
+
getGroups(): Array<Group>;
|
|
520
|
+
/**
|
|
521
|
+
* Gets a list of nodes/groups that are descendants of the given group.
|
|
522
|
+
* @param vertex
|
|
523
|
+
*
|
|
524
|
+
*/
|
|
525
|
+
getDescendants(vertex: Group): Array<Node | Group>;
|
|
526
|
+
/**
|
|
527
|
+
* Gets a list of groups that are ancestors of the given node/group. The list of ancestors is ordered in terms of their proximity to the focus, ie. the first entry is the focus vertex's immediate parent.
|
|
528
|
+
* @param vertex
|
|
529
|
+
*
|
|
530
|
+
*/
|
|
531
|
+
getAncestors(vertex: Node | Group): Array<Group>;
|
|
532
|
+
/**
|
|
533
|
+
* Returns whether or not `possibleAncestor` is in fact an ancestor of the given focus node/group
|
|
534
|
+
* @param focus Vertex to test
|
|
535
|
+
* @param possibleAncestor Group which may be an ancestor of `focus`
|
|
536
|
+
*/
|
|
537
|
+
isAncestor(focus: Vertex, possibleAncestor: Group): boolean;
|
|
538
|
+
/**
|
|
539
|
+
* Determine whether `possibleDescendant` is in fact a descendant of the `ancestor` group
|
|
540
|
+
* @param possibleDescendant Group to test
|
|
541
|
+
* @param ancestor Ancestor group
|
|
542
|
+
*
|
|
543
|
+
*/
|
|
544
|
+
isDescendantGroup(possibleDescendant: Group, ancestor: Group): boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Calculates "clusters" of nodes (and groups), where a 'cluster' is a set of Nodes/Groups that are connected. Direction of connections is not taken into account. Nodes that are children of Groups are included in all cluster calculations, which might cause some weird situations, but this functionality is mostly intended just for Nodes anyway.
|
|
547
|
+
* @returns An array of arrays, each entry being a list of nodes in the cluster.
|
|
548
|
+
*
|
|
549
|
+
*/
|
|
550
|
+
getClusters(): Array<Cluster>;
|
|
551
|
+
/**
|
|
552
|
+
* Calculates the set of nodes and groups (and edges) that are connected to the given vertex.
|
|
553
|
+
* @param vertex a Cluster - a list of vertices and a list of edges that are connected to the given vertex.
|
|
554
|
+
*/
|
|
555
|
+
getCluster(vertex: Node | Group | string): Cluster;
|
|
556
|
+
/**
|
|
557
|
+
* Gets the id of the Node represented by the given arguments. If this is a JS object, we extract the id using the current idFunction. Otherwise we just pass it back as-is.
|
|
558
|
+
* @param node Object from which to retrieve id.
|
|
559
|
+
*
|
|
560
|
+
*/
|
|
561
|
+
getNodeId(node: ObjectData | string): string;
|
|
562
|
+
/**
|
|
563
|
+
* Gets the type of the Node represented by the given JS object. We first try for a return value from the current typeFunction, but if that returns nothing we just return 'default'.
|
|
564
|
+
* @param nodeData Node's data. Note: this is NOT a Node object, it is the backing data. You can use `getType` to get the type for some Toolkit object.
|
|
565
|
+
* @returns Either the object's type, or `default`.
|
|
566
|
+
*
|
|
567
|
+
*/
|
|
568
|
+
getNodeType(nodeData: ObjectData): string;
|
|
569
|
+
/**
|
|
570
|
+
* Gets the id of the Group represented by the given arguments. If this is a JS object, we extract the id using the current idFunction. Otherwise we just pass it back as-is.
|
|
571
|
+
* @param group Object from which to retrieve id.
|
|
572
|
+
*
|
|
573
|
+
*/
|
|
574
|
+
getGroupId(group: ObjectData | string): string;
|
|
575
|
+
/**
|
|
576
|
+
* Gets the type of the Group represented by the given JS object. We first try for a return value from the current typeFunction, but if that returns nothing we just return 'default'.
|
|
577
|
+
* @param groupData Groups's data. Note: this is NOT a Group object, it is the backing data. You can use `getType` to get the type for some model object.
|
|
578
|
+
* @returns Either the object's type, or `default`.
|
|
579
|
+
*/
|
|
580
|
+
getGroupType(groupData: ObjectData): string;
|
|
581
|
+
/**
|
|
582
|
+
* Gets the type of the Edge represented by the given JS object.
|
|
583
|
+
* @param edgeData Edge's data. Note: this is NOT an Edge object, it is the backing data. You can use `getType` to get the type for some Toolkit object.
|
|
584
|
+
* @returns Either the Edge's type, if set, or "default".
|
|
585
|
+
*
|
|
586
|
+
*/
|
|
587
|
+
getEdgeType(edgeData: ObjectData): string;
|
|
588
|
+
/**
|
|
589
|
+
* Gets the id of the Port represented by the given arguments. If this is a JS object, we extract the id using the current portIdFunction. Otherwise we just pass it back as-is.
|
|
590
|
+
* @returns Port's id, if we could resolve it, otherwise the object we were given.
|
|
591
|
+
*
|
|
592
|
+
*/
|
|
593
|
+
getPortId(port: ObjectData): string;
|
|
594
|
+
/**
|
|
595
|
+
* Gets the type of the Port represented by the given JS object
|
|
596
|
+
* @returns Either the port's type, if set, or "default".
|
|
597
|
+
*
|
|
598
|
+
*/
|
|
599
|
+
getPortType(port: ObjectData): string;
|
|
600
|
+
/**
|
|
601
|
+
* Gets the type of the given Object. This is not a type such as `Node`, `Port` or `Edge` - this is the type of the object as defined by your system to identify types; these are the types used to lookup objects in the view.
|
|
602
|
+
* @param obj Object to retrieve type for
|
|
603
|
+
* @returns The object's type.
|
|
604
|
+
*
|
|
605
|
+
*/
|
|
606
|
+
getType(obj: Base): string;
|
|
607
|
+
/**
|
|
608
|
+
* Sets the type of the given object. This will do two things - first it will update the appropriate property in the object's data to this new value. You can set what properties define types, but by default each of Node, Edge and Port use `type` as the property that indicates their type. Secondly, this method will attempt to apply a type definition for the new type, if one is found.
|
|
609
|
+
* @param obj Object to set the type for.
|
|
610
|
+
* @param newType Type to set on the object.
|
|
611
|
+
*/
|
|
612
|
+
setType(obj: Base, newType: string): void;
|
|
613
|
+
/**
|
|
614
|
+
* Dispatch an event and invoke appropriate method on renderers
|
|
615
|
+
* @internal
|
|
616
|
+
* @param obj
|
|
617
|
+
* @param previousType
|
|
618
|
+
* @param newType
|
|
619
|
+
*/
|
|
620
|
+
private $dispatchTypeChange;
|
|
621
|
+
resolveFullId(b: Base): string;
|
|
622
|
+
/**
|
|
623
|
+
* For the given vertex, resolves the node/group it pertains to. If the vertex is already a node/group, it is returned. Otherwise, if it is a port, the parent of the port is returned.
|
|
624
|
+
* @param v
|
|
625
|
+
*/
|
|
626
|
+
resolveNode(v: Vertex): Node | Group;
|
|
627
|
+
/**
|
|
628
|
+
* Adds a Node with the given data. If the data is null, VisuallyJs creates an empty object and assigns a uuid as the Node's id. If no id can be derived for the given data, VisuallyJs creates a uuid and sets it as the data object's 'id' member. This method also calls the current `portExtractor` function, if one was supplied. Its purpose is to extract any Ports from the data for some given Node.
|
|
629
|
+
* @param data The Node's backing data - from your data model.
|
|
630
|
+
* @param eventInfo Optional data member that VisuallyJs will pass into any registered event listeners. This can be used by the UI layer, for instance, to track the position on screen of any newly added elements.
|
|
631
|
+
* @returns A Node object. Your original data is available via the `data` member. The Node's id is available via the `id` member.
|
|
632
|
+
*
|
|
633
|
+
*/
|
|
634
|
+
addNode(data: ObjectData, eventInfo?: any): Node;
|
|
635
|
+
private _$_notifyNodeAdded;
|
|
636
|
+
private _$_notifyGroupAdded;
|
|
637
|
+
/**
|
|
638
|
+
* Adds a Node by type, running the data generation for the node through the current NodeFactory. This is different from `addNode` in that with `addNode` you are supplying the final data and your NodeFactory is not called. This method can be called with one, two or three arguments. A single argument is considered to be the new Node's `type`, and a backing data object will be created with this set, and no callback will occur. If you provide two arguments the second argument may be either the new Node's backing data OR a callback to hit with the newly created Node. With three arguments the second argument is the Node's backing data and the third is a callback to hit with the newly created Node.
|
|
639
|
+
* @param type Required. Type of the object to create. `type` will be passed as the first argument to your node factory.
|
|
640
|
+
* @param data Optional backing data for the Node.
|
|
641
|
+
* @param continueCallback Optional function to call with the newly created Node.
|
|
642
|
+
* @param abortCallback Optional function to call if the factory aborted the node add.
|
|
643
|
+
* @param useTransaction Whether or not to add this new factory node in a transaction.
|
|
644
|
+
*/
|
|
645
|
+
addFactoryNode(type: string, data?: ObjectData, continueCallback?: Function, abortCallback?: Function, useTransaction?: boolean): void;
|
|
646
|
+
/**
|
|
647
|
+
* Adds a list of Nodes.
|
|
648
|
+
* @param nodeList An array of objects, one for each Node to be added.
|
|
649
|
+
*/
|
|
650
|
+
addNodes(nodeList: Array<ObjectData>): VisuallyJsModel;
|
|
651
|
+
/**
|
|
652
|
+
* @internal
|
|
653
|
+
*/
|
|
654
|
+
$transientVerticesByRenderer: Record<string, Record<string, Node>>;
|
|
655
|
+
private _getTransientVerticesForRenderer;
|
|
656
|
+
/**
|
|
657
|
+
* Add a node that some renderer considers to be transient - as an example, a renderer that supports dragging new edges. A new edge will require a temporary vertex to exist as the target of the new edge. This method does not invoke the render function of any registered renderers - a transient vertex is considered to be something private to a specific renderer, with a short lifespan that the single threaded nature of javascript will ensure the vertex is not referenced by other renderers.
|
|
658
|
+
* @param renderer
|
|
659
|
+
* @param data
|
|
660
|
+
* @internal
|
|
661
|
+
*/
|
|
662
|
+
$addTransientVertex(data?: ObjectData, renderer?: VisuallyJsRenderer<any>): Node;
|
|
663
|
+
/**
|
|
664
|
+
* Adds a dummy vertex to the dataset and notifies each renderer to draw it. Not intended for use by users of the API.
|
|
665
|
+
* @param data
|
|
666
|
+
* @param renderer
|
|
667
|
+
* @internal
|
|
668
|
+
*/
|
|
669
|
+
private _addDummyVertex;
|
|
670
|
+
private _cleanupDummyVertex;
|
|
671
|
+
/**
|
|
672
|
+
* Detach an edge from either its source or target vertex, creating a dummy vertex as a placeholder. This method is not intended for use by users of the API.
|
|
673
|
+
* @param edge
|
|
674
|
+
* @param loc
|
|
675
|
+
* @param idx
|
|
676
|
+
* @internal
|
|
677
|
+
*/
|
|
678
|
+
$setEdgeDetached(edge: Edge, loc: PointXY, idx: ProxyLocation): void;
|
|
679
|
+
/**
|
|
680
|
+
* Removes a transient vertex from the underlying dataset, and from the list of transient vertices for
|
|
681
|
+
* the given renderer. Removes any edges attached to the transient node. None of these operations
|
|
682
|
+
* occur within a transaction and none are propagated to all attached renderers: only the renderer that
|
|
683
|
+
* invokes this method is notified of the deletion of edges and the node.
|
|
684
|
+
* @param renderer
|
|
685
|
+
* @param v
|
|
686
|
+
* @internal
|
|
687
|
+
*/
|
|
688
|
+
$cleanupTransientVertex(v: Node, renderer: VisuallyJsRenderer<any>): void;
|
|
689
|
+
/**
|
|
690
|
+
* Adds a transient edge to the dataset.
|
|
691
|
+
* @param renderer
|
|
692
|
+
* @param source
|
|
693
|
+
* @param target
|
|
694
|
+
* @param data
|
|
695
|
+
* @param geometry
|
|
696
|
+
* @param context
|
|
697
|
+
* @internal
|
|
698
|
+
*/
|
|
699
|
+
$addTransientEdge(renderer: VisuallyJsRenderer<any>, source: Vertex, target: Vertex, data?: ObjectData, geometry?: Geometry, context?: Record<string, any>): Edge;
|
|
700
|
+
/**
|
|
701
|
+
* Adds a Group by type, running the data generation for the node through the current GroupFactory. This is different from `addGroup` in that with `addGroup` you are supplying the final data and your GroupFactory is not called. This method can be called with one, two or three arguments. A single argument is considered to be the new Group's `type`, and a backing data object will be created with this set, and no callback will occur. If you provide two arguments the second argument may be either the new Group's backing data OR a callback to hit with the newly created Group. With three arguments the second argument is the Group's backing data and the third is a callback to hit with the newly created Group.
|
|
702
|
+
* @param type Required. Type of the object to create. `type` will be passed as the first argument to your group factory.
|
|
703
|
+
* @param data Optional backing data for the Group.
|
|
704
|
+
* @param continueCallback Optional function to call with the newly created Group.
|
|
705
|
+
* @param abortCallback Optional function to call if the group factory aborted
|
|
706
|
+
*
|
|
707
|
+
*/
|
|
708
|
+
addFactoryGroup(type: string, data?: ObjectData, continueCallback?: Function, abortCallback?: Function, useTransaction?: boolean): void;
|
|
709
|
+
/**
|
|
710
|
+
* Adds a new Group.
|
|
711
|
+
* @param data Backing data for the Group.
|
|
712
|
+
* @param eventInfo Used internally, sometimes, by VisuallyJs.
|
|
713
|
+
* @returns The Group that was added.
|
|
714
|
+
*
|
|
715
|
+
*/
|
|
716
|
+
addGroup(data: ObjectData, eventInfo?: any): Group;
|
|
717
|
+
/**
|
|
718
|
+
* Adds a Node/Group to a Group.
|
|
719
|
+
* @param node Node to add
|
|
720
|
+
* @param group Group to add the Node/Group to
|
|
721
|
+
* @returns True if added, false otherwise.
|
|
722
|
+
*
|
|
723
|
+
*/
|
|
724
|
+
addToGroup(node: Node | Group | string, group: Group | string, position?: PointXY): boolean;
|
|
725
|
+
/**
|
|
726
|
+
* Adds a Node/Group to a Group. This is an internal method that is not part of the public API.
|
|
727
|
+
* @param node Node/group to add
|
|
728
|
+
* @param group Group to add the Node/Group to
|
|
729
|
+
* @param sourceGroup Optional Group the node/group previously belonged to.
|
|
730
|
+
* @param originalPosition Optional previous position of the node/group in `sourceGroup`.
|
|
731
|
+
* @param newPosition Optional position in the new group
|
|
732
|
+
* @param source For internal use. Identifies the renderer that instigated this model change. This renderer will not subsequently respond to the model change, since it already knows about it and its UI has been changed accordingly already.
|
|
733
|
+
* @returns True if added, false otherwise.
|
|
734
|
+
* @internal
|
|
735
|
+
*/
|
|
736
|
+
$addToGroup(node: Node | Group | string, group: Group | string, sourceGroup?: Group, originalPosition?: PointXY, newPosition?: PointXY, source?: VisuallyJsRenderer<any>): boolean;
|
|
737
|
+
/**
|
|
738
|
+
* Removes a Node/Group from a Group.
|
|
739
|
+
* @param node Node/Group to remove, or its id, or the data representing it.
|
|
740
|
+
*
|
|
741
|
+
*/
|
|
742
|
+
removeFromGroup(node: Node | Group | string | ObjectData): Group;
|
|
743
|
+
/**
|
|
744
|
+
* Removes a Node/Group from a Group.
|
|
745
|
+
* @param node Node/Group to remove, or its id, or the data representing it.
|
|
746
|
+
* @param targetGroup For internal use. Group to which the Node is being moved, if that applies.
|
|
747
|
+
* @param source For internal use. The renderer in which user activity caused this method to be called. We echo that out in the event parameters, allowing renderers to not respond to events they raised.
|
|
748
|
+
* @returns The Group from which the Node was removed.
|
|
749
|
+
* @internal
|
|
750
|
+
*/
|
|
751
|
+
$removeFromGroup(node: Node | Group | string | ObjectData, targetGroup?: Group, originalPosition?: PointXY, newPosition?: PointXY, source?: VisuallyJsRenderer<any>): Group;
|
|
752
|
+
private _$_notifyGroupRemoved;
|
|
753
|
+
private _$_notifyNodeRemoved;
|
|
754
|
+
/**
|
|
755
|
+
* Removes the given Group from the dataset.
|
|
756
|
+
* @param group Group or ID of Group to remove.
|
|
757
|
+
* @param removeChildren If true, Nodes/Groups that are members of the Group will also be removed. Defaults to false.
|
|
758
|
+
* @param doNotFireEvent If true, a `group:removed` will not be fired as a result of this operation. Otherwise it will.
|
|
759
|
+
* @public
|
|
760
|
+
*/
|
|
761
|
+
removeGroup(group: string | Group, removeChildren?: boolean, doNotFireEvent?: boolean): boolean;
|
|
762
|
+
/**
|
|
763
|
+
* Gets the Node with the given id.
|
|
764
|
+
* @param nodeId
|
|
765
|
+
* @public
|
|
766
|
+
*/
|
|
767
|
+
getNode(nodeId: string): Node;
|
|
768
|
+
/**
|
|
769
|
+
* Gets an Edge by id, or if the given object is already an Edge, hands that back.
|
|
770
|
+
* @param edgeId ID of the Edge to retrieve.
|
|
771
|
+
* @returns The requested Edge, if found, otherwise null.
|
|
772
|
+
* @public
|
|
773
|
+
*/
|
|
774
|
+
getEdge(edgeId: string): Edge;
|
|
775
|
+
/**
|
|
776
|
+
* Gets a Group by its ID, or if the object is already a Group, hands that back.
|
|
777
|
+
* @param groupId
|
|
778
|
+
* @returns The requested Group, if found, otherwise null.
|
|
779
|
+
*
|
|
780
|
+
*/
|
|
781
|
+
getGroup(groupId: string): Group;
|
|
782
|
+
/**
|
|
783
|
+
* Gets the Vertex with the given id.
|
|
784
|
+
* @param id
|
|
785
|
+
*
|
|
786
|
+
*/
|
|
787
|
+
getVertex(id: string): Node | Group;
|
|
788
|
+
/**
|
|
789
|
+
* Gets a port by its full id
|
|
790
|
+
* @param portId ID of the Port to retrieve, in nodeId.portId syntax.
|
|
791
|
+
* @returns The requested port, if found, otherwise null.
|
|
792
|
+
*
|
|
793
|
+
*/
|
|
794
|
+
getPort(portId: string): Port;
|
|
795
|
+
/**
|
|
796
|
+
* Returns whether or not object(s) exist for the given id(s).
|
|
797
|
+
* @param objects List of ids to check existence for. This method takes an arbitrary number of arguments.
|
|
798
|
+
* @returns True if objects exist for all given ids, false otherwise.
|
|
799
|
+
*
|
|
800
|
+
*/
|
|
801
|
+
exists(...objects: Array<any>): boolean;
|
|
802
|
+
/**
|
|
803
|
+
* Removes the given Node, which may be passed in as the actual Node object, or its id.
|
|
804
|
+
* @param node Either a Node, or its ID.
|
|
805
|
+
* @returns True if node removed, false if not.
|
|
806
|
+
*
|
|
807
|
+
*/
|
|
808
|
+
removeNode(node: string | Vertex): boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Adds an Edge to the Graph.
|
|
811
|
+
* @param params Options for the new edge
|
|
812
|
+
* @returns The Edge that was added.
|
|
813
|
+
*
|
|
814
|
+
*/
|
|
815
|
+
addEdge(params: AddEdgeOptions): Edge;
|
|
816
|
+
/**
|
|
817
|
+
* Internal method for adding edges. Users of the API should not call this method.
|
|
818
|
+
* @internal
|
|
819
|
+
* @param params
|
|
820
|
+
* @param reason
|
|
821
|
+
* @param renderer The renderer that was the source of the action. Optional, used internally.
|
|
822
|
+
* @param doNotFireEvent Optional. Won't fire an event if this is true. For internal use only.
|
|
823
|
+
* @param doNotFireEvent
|
|
824
|
+
*/
|
|
825
|
+
$_addEdge(params: AddEdgeOptions & {
|
|
826
|
+
addedByMouse?: boolean;
|
|
827
|
+
context?: Record<string, any>;
|
|
828
|
+
}, reason: ConnectReason, renderer: VisuallyJsRenderer<any>, doNotFireEvent?: boolean): Edge;
|
|
829
|
+
/**
|
|
830
|
+
* Notify registered managers of edge removal, and fire event. used by a couple of call sites.
|
|
831
|
+
* @param edge
|
|
832
|
+
* @param source
|
|
833
|
+
* @internal
|
|
834
|
+
*/
|
|
835
|
+
private _$_notifyEdgeRemoved;
|
|
836
|
+
/**
|
|
837
|
+
* Removes an Edge from the Graph.
|
|
838
|
+
* @param edge The Edge to remove, as either an Edge object or its id.
|
|
839
|
+
* @param renderer The source for the removeEdge operation. For internal use.
|
|
840
|
+
* @returns The model instance.
|
|
841
|
+
*
|
|
842
|
+
*/
|
|
843
|
+
removeEdge(edge: string | Edge, renderer?: any): VisuallyJsModel;
|
|
844
|
+
/**
|
|
845
|
+
* @internal
|
|
846
|
+
* @param edge
|
|
847
|
+
* @param obj
|
|
848
|
+
* @param index
|
|
849
|
+
* TODO may no longer be necessary
|
|
850
|
+
*/
|
|
851
|
+
/**
|
|
852
|
+
* Sets the target for the given edge to be the given vertex.
|
|
853
|
+
* @param edge Edge to set target for.
|
|
854
|
+
* @param o ID of vertex, or vertex.
|
|
855
|
+
*/
|
|
856
|
+
setTarget(edge: Edge, o: string | Vertex | PointXY): any;
|
|
857
|
+
/**
|
|
858
|
+
* Sets the source for the given edge to be the given vertex.
|
|
859
|
+
* @param edge Edge to set source for.
|
|
860
|
+
* @param o ID of vertex, or vertex.
|
|
861
|
+
*/
|
|
862
|
+
setSource(edge: Edge, o: string | Vertex | PointXY): any;
|
|
863
|
+
/**
|
|
864
|
+
* Adds a new Port to some Node. This will call the current `portFactory` to get the data for a new Port.
|
|
865
|
+
* @param obj node/group or id of the node/group to add a new Port to.
|
|
866
|
+
* @param type Type of Port to add.
|
|
867
|
+
* @param portData Data to pass to the PortFactory.
|
|
868
|
+
*
|
|
869
|
+
*/
|
|
870
|
+
addNewPort(obj: string | Node | Group, type: string, portData?: ObjectData): void;
|
|
871
|
+
/**
|
|
872
|
+
* Adds a Port from existing data to some Node/Group. This is distinct from `addNewPort`, because in this case the data for the Port already exists.
|
|
873
|
+
* @param vertex Node/Group or id of the Node/Group to add the Port to.
|
|
874
|
+
* @param data Data for the Port.
|
|
875
|
+
* @returns The port that was added.
|
|
876
|
+
*
|
|
877
|
+
*/
|
|
878
|
+
addPort(vertex: string | Node | Group, data: ObjectData): Port;
|
|
879
|
+
/**
|
|
880
|
+
* Removes a Port from the dataset, returning true if the port existed and was removed and false otherwise.
|
|
881
|
+
* @param vertexOrId If a string is passed in here, it may represent the full ID of some port, ie in "vertex.port" notation, or it may be the ID of the vertex on which the port to be removed resides. If you do not pass a string to this argument you can pass a Port instead, or you can pass the Node/Group on which the port resides (in which case you'll also need to provide a value for `portId`)
|
|
882
|
+
* @param portId Id of the port to remove from the given node. Only required if you did not provide a full port ID, or the Port itself, to `vertexOrId`.
|
|
883
|
+
* @returns
|
|
884
|
+
*
|
|
885
|
+
*/
|
|
886
|
+
removePort(vertexOrId: string | Node | Group | Port, portId?: string): boolean;
|
|
887
|
+
/**
|
|
888
|
+
* Attempts to identify the given argument as a model object, and, if successful, removes it. If you pass in a group or group ID to this method, the group and all of its children will, by default, be removed. You can override that behaviour by setting `doNotRemoveGroupChildren` to true.
|
|
889
|
+
* @param obj A string representing the ID of some model object, or a model object of some type.
|
|
890
|
+
* @param doNotRemoveGroupChildren Whether or not to remove group children. Defaults to false, ie. group children will be removed by default.
|
|
891
|
+
*
|
|
892
|
+
*/
|
|
893
|
+
remove(obj: any, doNotRemoveGroupChildren?: boolean): void;
|
|
894
|
+
/**
|
|
895
|
+
* Suspends or re-enables rendering. This method simply round-robins all the registered renderers and calls `setSuspendRendering` on each of them.
|
|
896
|
+
* @param v True to suspend rendering, false to enable it.
|
|
897
|
+
* @param thenRefresh Defaults to false. If true, a refresh will be called on all renderers after rendering is unsuspended.
|
|
898
|
+
*
|
|
899
|
+
*/
|
|
900
|
+
setSuspendRendering(v: boolean, thenRefresh?: boolean): void;
|
|
901
|
+
/**
|
|
902
|
+
* Suspends rendering and then runs the given function, unsuspending rendering afterwards and doing a refresh. This method is just a convenience method that handles suspending and subsequent enabling of rendering. You might use this if you're bulk loading objects, or maybe you want to add a Node and one or more Edges before the layout recomputes.
|
|
903
|
+
* @param fn Function to run.
|
|
904
|
+
*/
|
|
905
|
+
batch(fn: () => any): void;
|
|
906
|
+
/**
|
|
907
|
+
* Updates the given Group, notifying any Renderers to do a redraw. If autoSave is set, this method will cause the dataset to be saved.
|
|
908
|
+
* @param group Either a Group, a Group id, or the backing data for a Group.
|
|
909
|
+
* @param updates An object with path->value pairs. Path can be in dotted notation. You do not actually have to supply this, although in most cases you will want to. But there are edge cases in which you might simply wish to kick off a repaint.
|
|
910
|
+
*
|
|
911
|
+
*/
|
|
912
|
+
updateGroup(group: Group | string | ObjectData, updates?: ObjectData): void;
|
|
913
|
+
/**
|
|
914
|
+
* @internal
|
|
915
|
+
* @param group
|
|
916
|
+
* @param updates
|
|
917
|
+
* @param reason
|
|
918
|
+
* @private
|
|
919
|
+
*/
|
|
920
|
+
$_updateGroup(group: Group | string | ObjectData, updates: ObjectData, reason: VertexUpdatedReason, blat: boolean): void;
|
|
921
|
+
/**
|
|
922
|
+
* Updates the given Node, notifying any Renderers to do a redraw. If autoSave is set, this method will cause the dataset to be saved.
|
|
923
|
+
* @param node Either a Node, a Node id, or the backing data for a Node.
|
|
924
|
+
* @param updates An object with path->value pairs. Path can be in dotted notation. You do not actually have to supply this, although in most cases you will want to. But there are edge cases in which you might simply wish to kick off a repaint.
|
|
925
|
+
*
|
|
926
|
+
*/
|
|
927
|
+
updateNode(node: string | Node | ObjectData, updates?: ObjectData): void;
|
|
928
|
+
/**
|
|
929
|
+
* @internal
|
|
930
|
+
* @param node
|
|
931
|
+
* @param updates
|
|
932
|
+
* @param reason
|
|
933
|
+
* @private
|
|
934
|
+
*/
|
|
935
|
+
$_updateNode(node: string | Node | ObjectData, updates: ObjectData, reason: VertexUpdatedReason, blat: boolean): void;
|
|
936
|
+
/**
|
|
937
|
+
* Updates the given Node/Group, notifying any Renderers to do a redraw. If autoSave is set, this method will cause the dataset to be saved.
|
|
938
|
+
* @param vertex Either a Node/Group, a Node/Group id, or the backing data for a Node/Group.
|
|
939
|
+
* @param updates An object with path->value pairs. Path can be in dotted notation. You do not actually have to supply this, although in most cases you will want to. But there are edge cases in which you might simply wish to kick off a repaint.
|
|
940
|
+
*
|
|
941
|
+
*/
|
|
942
|
+
updateVertex(vertex: string | Node | Group | Port | ObjectData, updates?: ObjectData): void;
|
|
943
|
+
/**
|
|
944
|
+
* Internal method for vertex update. DOES NOT create a transaction, and is intended for internal use.
|
|
945
|
+
* @internal
|
|
946
|
+
* @param vertex
|
|
947
|
+
* @param updates
|
|
948
|
+
* @param reason
|
|
949
|
+
* @param blat When true, this update completely replaces the existing data. This is used, for instance, during an undo/redo. When false, the updates are merged in to the existing data.
|
|
950
|
+
* @param source
|
|
951
|
+
*/
|
|
952
|
+
$_updateVertex(vertex: string | Node | Group | Port | ObjectData, updates: ObjectData, reason: VertexUpdatedReason | string, blat: boolean, source?: VisuallyJsRenderer<any>): void;
|
|
953
|
+
/**
|
|
954
|
+
* Updates the given list of vertices. This method runs in a transaction, by default appending itself to any current transaction (as updating a list of vertices is the common end result of various operations on the data model), but you can provide your own cleanup action if desired.
|
|
955
|
+
* @param updates
|
|
956
|
+
* @public
|
|
957
|
+
*/
|
|
958
|
+
updateVertices(updates: Array<{
|
|
959
|
+
id: string;
|
|
960
|
+
updates?: ObjectData;
|
|
961
|
+
}>, cleanupAction?: TransactionCleanupAction): void;
|
|
962
|
+
/**
|
|
963
|
+
* @internal
|
|
964
|
+
* @param updates
|
|
965
|
+
* @param reason
|
|
966
|
+
* @param cleanupAction
|
|
967
|
+
* @private
|
|
968
|
+
*/
|
|
969
|
+
_updateVertices(updates: Array<{
|
|
970
|
+
id: string;
|
|
971
|
+
updates?: ObjectData;
|
|
972
|
+
}>, reason: VertexUpdatedReason, blat: boolean, cleanupAction: TransactionCleanupAction): void;
|
|
973
|
+
/**
|
|
974
|
+
* Updates the given Port, notifying any Renderers to do a redraw. If autoSave is set, this method will cause the dataset to be saved.
|
|
975
|
+
* @param port Either a Port, or a full Port id
|
|
976
|
+
* @param updates An object with path->value pairs. Path can be in dotted notation. You do not actually have to supply this, although in most cases you will want to. But there are edge cases in which you might simply wish to kick off a repaint.
|
|
977
|
+
*
|
|
978
|
+
*/
|
|
979
|
+
updatePort(port: Port | string, updates?: ObjectData): void;
|
|
980
|
+
/**
|
|
981
|
+
* @internal
|
|
982
|
+
* @param port
|
|
983
|
+
* @param updates
|
|
984
|
+
* @param reason
|
|
985
|
+
* @param blat
|
|
986
|
+
*/
|
|
987
|
+
$_updatePort(port: Port | string, updates: ObjectData, reason: VertexUpdatedReason, blat: boolean): void;
|
|
988
|
+
/**
|
|
989
|
+
* Updates the given Edge, notifying any Renderers to do a redraw. If autoSave is set, this method will cause the dataset to be saved.
|
|
990
|
+
* @param obj Either an Edge, an Edge id, or the backing data for an Edge.
|
|
991
|
+
* @param updates An object with path->value pairs. Path can be in dotted notation. You do not actually have to supply this, although in most cases you will want to. But there are edge cases in which you might simply wish to kick off a repaint.
|
|
992
|
+
*
|
|
993
|
+
*/
|
|
994
|
+
updateEdge(obj: Edge | string, updates?: ObjectData): void;
|
|
995
|
+
/**
|
|
996
|
+
* @internal
|
|
997
|
+
* @param obj
|
|
998
|
+
* @param updates
|
|
999
|
+
* @param reason
|
|
1000
|
+
* @param blat
|
|
1001
|
+
*/
|
|
1002
|
+
$_updateEdge(obj: Edge | string, updates: ObjectData, reason: EdgeUpdatedReason, blat: boolean): void;
|
|
1003
|
+
/**
|
|
1004
|
+
* Updates the given object, notifying any renderers to do a repaint.
|
|
1005
|
+
* @param object Either a Node, Group, Port or Edge, or, as a string, the id of some Node, Group, Port or Edge.
|
|
1006
|
+
* @param updates An object with path->value pairs. Path can be in dotted notation. You do not actually have to supply this, although in most cases you will want to. But there are edge cases in which you might simply wish to kick off a repaint.
|
|
1007
|
+
*
|
|
1008
|
+
*/
|
|
1009
|
+
update(object: Base, updates?: ObjectData): void;
|
|
1010
|
+
/**
|
|
1011
|
+
* @internal
|
|
1012
|
+
* @param object
|
|
1013
|
+
* @param updates
|
|
1014
|
+
* @param reason
|
|
1015
|
+
* @private
|
|
1016
|
+
*/
|
|
1017
|
+
_update(object: Base, updates: ObjectData, reason: EdgeUpdatedReason | VertexUpdatedReason, blat: boolean): void;
|
|
1018
|
+
/**
|
|
1019
|
+
* Sets the geometry for the given edge. The type of `geometry` depends on the connector being used to represent the edge in the UI.
|
|
1020
|
+
* @param edge The edge to update.
|
|
1021
|
+
* @param geometry New geometry for the given edge.
|
|
1022
|
+
* @param renderer The renderer that instigated this change.
|
|
1023
|
+
* @internal
|
|
1024
|
+
*/
|
|
1025
|
+
setEdgeGeometry(edge: Edge, geometry: any, originalGeometry: any, renderer: VisuallyJsRenderer<any>): void;
|
|
1026
|
+
/**
|
|
1027
|
+
* Clears the geometry for some edge. The edge will be repainted using the default route calculation, and an entry will be added to the undo stack.
|
|
1028
|
+
* @param edge Edge to clear geometry for.
|
|
1029
|
+
*/
|
|
1030
|
+
clearEdgeGeometry(edge: Edge): void;
|
|
1031
|
+
/**
|
|
1032
|
+
* Gets a Path from some source vertex to some target vertex.
|
|
1033
|
+
* @param params Path spec params
|
|
1034
|
+
*/
|
|
1035
|
+
getPath(params: PathOptions): Path;
|
|
1036
|
+
/**
|
|
1037
|
+
* Finds the object that matches the given spec.
|
|
1038
|
+
* @param spec If a string, a Node/Port matching that id is retrieved. Otherwise if `spec` is already a Graph object (Node or Port), it is returned.
|
|
1039
|
+
*/
|
|
1040
|
+
findGraphObject(spec: string | Vertex | Edge): Vertex | Edge | Graph;
|
|
1041
|
+
/**
|
|
1042
|
+
* @param obj
|
|
1043
|
+
* @param append
|
|
1044
|
+
* @param _selection
|
|
1045
|
+
* @param fireSelectEvent
|
|
1046
|
+
* @internal
|
|
1047
|
+
*/
|
|
1048
|
+
private _$_select;
|
|
1049
|
+
/**
|
|
1050
|
+
* @param params Options for the edge selection.
|
|
1051
|
+
* @param edgeResolver
|
|
1052
|
+
* @param checkForPorts
|
|
1053
|
+
* @internal
|
|
1054
|
+
*/
|
|
1055
|
+
private _selectEdges;
|
|
1056
|
+
private _$_maybeDispatchTypeChange;
|
|
1057
|
+
/**
|
|
1058
|
+
* Updates the given vertex with the given data. For internal use.
|
|
1059
|
+
* @param obj
|
|
1060
|
+
* @param updates
|
|
1061
|
+
* @param blat when true, the new data replaces the previous. Otherwise the updates are merged in.
|
|
1062
|
+
* @param evtId
|
|
1063
|
+
* @param generator
|
|
1064
|
+
* @internal
|
|
1065
|
+
*/
|
|
1066
|
+
private _$_updateVertex;
|
|
1067
|
+
/**
|
|
1068
|
+
* After a change to a port, perhaps set the backing data for the associated node per the client app's portUpdater function. For internal use.
|
|
1069
|
+
* @param nodeOrGroup
|
|
1070
|
+
* @param reason
|
|
1071
|
+
* @internal
|
|
1072
|
+
*/
|
|
1073
|
+
private _$_updateVertexAfterPortChange;
|
|
1074
|
+
/**
|
|
1075
|
+
* Gets a set of edges.
|
|
1076
|
+
* @param params Options for the edge selection
|
|
1077
|
+
*/
|
|
1078
|
+
getEdges(params?: EdgeSelectionParams): Array<Edge>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Get all Edges in the model
|
|
1081
|
+
*/
|
|
1082
|
+
getAllEdges(): Array<Edge>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Gets all edges for the given Node, Port or Group.
|
|
1085
|
+
* @param obj Object to retrieve edges for.
|
|
1086
|
+
* @param filter Optional filter function for edge selection.
|
|
1087
|
+
*/
|
|
1088
|
+
getAllEdgesFor(obj: Vertex, filter?: (e: Edge) => boolean): Array<Edge>;
|
|
1089
|
+
/**
|
|
1090
|
+
* Gets all edges in the model as a {@link VisuallyJsSelection}.
|
|
1091
|
+
*/
|
|
1092
|
+
selectAllEdges(): VisuallyJsSelection;
|
|
1093
|
+
/**
|
|
1094
|
+
* Adds all the edges in the model to the current selection.
|
|
1095
|
+
*/
|
|
1096
|
+
addAllEdgesToSelection(): void;
|
|
1097
|
+
/**
|
|
1098
|
+
* Sets obj as the current selection for this model.
|
|
1099
|
+
* @param obj Object to select. May be a Node/Edge/Group or an array of any of these, or a Node/Group id, or a Path.
|
|
1100
|
+
*/
|
|
1101
|
+
setSelection(obj: string | Base | Array<Base> | Path): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Gets an ad-hoc selection
|
|
1104
|
+
* @param obj Object to select. May be a Node/Group/Port/Edge or an array of any one of these, or a Vertex id, a Selection, or a Path.
|
|
1105
|
+
* @param includeEdges If true, include edges between vertices
|
|
1106
|
+
*/
|
|
1107
|
+
select(obj: string | Array<string> | Base | Array<Base> | Path | VisuallyJsSelection, includeEdges?: boolean): VisuallyJsSelection;
|
|
1108
|
+
/**
|
|
1109
|
+
* @param focus
|
|
1110
|
+
* @param selection
|
|
1111
|
+
* @param includeEdges
|
|
1112
|
+
* @param touched
|
|
1113
|
+
* @internal
|
|
1114
|
+
*/
|
|
1115
|
+
private _$_descendants;
|
|
1116
|
+
/**
|
|
1117
|
+
* Selects all descendants of some Node or Group, and, optionally, the Node/Group itself.
|
|
1118
|
+
* @param obj Node/Group, or ID of Node/Group, to select
|
|
1119
|
+
* @param includeFocus Whether or not to include the focus node/group in the returned dataset. Defaults to false.
|
|
1120
|
+
* @param includeEdges Whether or not to include edges in the returned dataset. Defaults to false.
|
|
1121
|
+
* @graphQuery
|
|
1122
|
+
*/
|
|
1123
|
+
selectDescendants(obj: string | Node | Group, includeFocus?: boolean, includeEdges?: boolean): VisuallyJsSelection;
|
|
1124
|
+
/**
|
|
1125
|
+
* @param obj
|
|
1126
|
+
* @internal
|
|
1127
|
+
*/
|
|
1128
|
+
private _$_resolveObjectForSelection;
|
|
1129
|
+
/**
|
|
1130
|
+
* Appends `obj` to the current selection. If there is no current selection, `obj` becomes it.
|
|
1131
|
+
* @param obj Object to select. May be a Node/Group/Port/Edge or an array of any of these, or a Vertex id, or a Path.
|
|
1132
|
+
*/
|
|
1133
|
+
addToSelection(obj: string | Base | Path | Array<Base> | Array<string>): void;
|
|
1134
|
+
/**
|
|
1135
|
+
* @internal
|
|
1136
|
+
* @param evt
|
|
1137
|
+
* @param objects
|
|
1138
|
+
*/
|
|
1139
|
+
private _$_adhocSel;
|
|
1140
|
+
/**
|
|
1141
|
+
* Toggles whether or not the given `obj` forms part of the current selection. @param obj Object to select. May be a Node/Group/Port/Edge or an array of any of these, or a Vertex id, or a Path.
|
|
1142
|
+
*/
|
|
1143
|
+
toggleSelection(obj: string | Base | Path | Array<Base>): void;
|
|
1144
|
+
/**
|
|
1145
|
+
* Removes obj from the current selection
|
|
1146
|
+
* @param obj Object to deselect. May be a Node/Edge/Group/Port or an array of any of these, or a Vertex id, or a Path.
|
|
1147
|
+
*/
|
|
1148
|
+
removeFromSelection(obj: string | Base | Array<Base> | Path): void;
|
|
1149
|
+
/**
|
|
1150
|
+
* Appends the Path from `source` to `target` to the current selection. If there is no current selection, `obj` becomes it. If the Path does not exist, there is no selection.
|
|
1151
|
+
* @param params Path params
|
|
1152
|
+
* @param params.source ID of source, or source Node/Port
|
|
1153
|
+
* @param params.target ID of target, or target Node/Port
|
|
1154
|
+
*
|
|
1155
|
+
*/
|
|
1156
|
+
addPathToSelection(params: {
|
|
1157
|
+
source: Vertex | string;
|
|
1158
|
+
target: Vertex | string;
|
|
1159
|
+
strict?: boolean;
|
|
1160
|
+
nodeFilter?: (n: Node) => boolean;
|
|
1161
|
+
edgeFilter?: (n: Edge) => boolean;
|
|
1162
|
+
}): void;
|
|
1163
|
+
/**
|
|
1164
|
+
* Clears the current selection and fires a `selectionCleared` event.
|
|
1165
|
+
*/
|
|
1166
|
+
clearSelection(): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Gets the current Selection for this model
|
|
1169
|
+
* @returns Current Selection.
|
|
1170
|
+
*
|
|
1171
|
+
*/
|
|
1172
|
+
getSelection(): VisuallyJsSelection;
|
|
1173
|
+
/**
|
|
1174
|
+
* Sets the maximum number of nodes that may be selected at any one time. Default is Infinity.
|
|
1175
|
+
* @param maxNodes Max number of nodes allowed to be selected at once.
|
|
1176
|
+
*/
|
|
1177
|
+
setMaxSelectedNodes(maxNodes: number): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Sets the maximum number of edges that may be selected at any one time. Default is Infinity.
|
|
1180
|
+
* @param maxEdges Max number of edges allowed to be selected at once.
|
|
1181
|
+
*/
|
|
1182
|
+
setMaxSelectedEdges(maxEdges: number): void;
|
|
1183
|
+
/**
|
|
1184
|
+
* Sets The action taken when appending an edge or node that would take the selection above its limit for that given type. Depends on the current `capacityPolicy`, which can be either Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW.
|
|
1185
|
+
* @param policy One of `Selection.DISCARD_EXISTING` (which removes the 0th entry from the list before insertion of the new value) or `Selection.DISCARD_NEW`.
|
|
1186
|
+
*
|
|
1187
|
+
*/
|
|
1188
|
+
setSelectionCapacityPolicy(policy: string): void;
|
|
1189
|
+
/**
|
|
1190
|
+
* @param endEvent
|
|
1191
|
+
* @internal
|
|
1192
|
+
*/
|
|
1193
|
+
private _$_notifyDataLoaded;
|
|
1194
|
+
/**
|
|
1195
|
+
*
|
|
1196
|
+
* @param params
|
|
1197
|
+
* @param startEvent
|
|
1198
|
+
* @param endEvent
|
|
1199
|
+
* @internal
|
|
1200
|
+
*/
|
|
1201
|
+
private _$_doLoad;
|
|
1202
|
+
/**
|
|
1203
|
+
* Loads some data, either via ajax, or directly from a JS object.
|
|
1204
|
+
* @param params Load options.
|
|
1205
|
+
*
|
|
1206
|
+
*/
|
|
1207
|
+
load(params: LoadOptions): VisuallyJsModel;
|
|
1208
|
+
/**
|
|
1209
|
+
* Appends some data to the dataset, either via ajax, or directly from a JS object. The only difference between this and `load` is the events that are fired during the loading process.
|
|
1210
|
+
* @param params Append parameters.
|
|
1211
|
+
*
|
|
1212
|
+
*/
|
|
1213
|
+
append(params: LoadOptions): VisuallyJsModel;
|
|
1214
|
+
/**
|
|
1215
|
+
* Saves data via ajax POST to a given URL. By default this method sends the return value of {@link #exportData} as its payload, but you can provide your own data to save if you wish.
|
|
1216
|
+
* @param params Save parameters
|
|
1217
|
+
*/
|
|
1218
|
+
save(params: SaveOptions): VisuallyJsModel;
|
|
1219
|
+
/**
|
|
1220
|
+
* Method stub for subclasses to implement for fetching a URL
|
|
1221
|
+
*/
|
|
1222
|
+
protected abstract fetchUrl(options: UrlFetchOptions): void;
|
|
1223
|
+
/**
|
|
1224
|
+
* Exports the current data to JSON.
|
|
1225
|
+
* @param params Export parameters
|
|
1226
|
+
* @returns JSON payload.
|
|
1227
|
+
*
|
|
1228
|
+
*/
|
|
1229
|
+
exportData(params?: ExportOptions): any;
|
|
1230
|
+
/**
|
|
1231
|
+
* Helper method to allow `JSON.stringify` to be called with an instance of VisuallyJs as argument (JSON.stringify looks for a `toJSON()` method on each object it is attempting to serialise). This method generates the same output as calling `exportData()`.
|
|
1232
|
+
*/
|
|
1233
|
+
toJSON(): any;
|
|
1234
|
+
/**
|
|
1235
|
+
* Gets a renderer by the `id` parameter supplied to the `render` call (which is by default null, and only renderers for which an `id` was supplied are retrievable via this method)
|
|
1236
|
+
* @param id ID of the renderer to retrieve.
|
|
1237
|
+
* @returns Either a Renderer that was registered against the given id, or null if none found.
|
|
1238
|
+
*/
|
|
1239
|
+
getRenderer<E>(id: string): VisuallyJsRenderer<E>;
|
|
1240
|
+
/**
|
|
1241
|
+
* Gets all renderers registered on this model
|
|
1242
|
+
* @internal
|
|
1243
|
+
*/
|
|
1244
|
+
getRenderers(): Map<string, VisuallyJsRenderer<any>>;
|
|
1245
|
+
private _$_dispatchToRenderers;
|
|
1246
|
+
/**
|
|
1247
|
+
* Registers a renderer on this model instance. For internal use.
|
|
1248
|
+
* @param renderer
|
|
1249
|
+
* @param id
|
|
1250
|
+
* @internal
|
|
1251
|
+
*/
|
|
1252
|
+
$addRenderer(renderer: VisuallyJsRenderer<any>, id?: string): void;
|
|
1253
|
+
/**
|
|
1254
|
+
* Finds information related to the given object, which may be an existing model object, a Node/Group/Edge id, or the backing data for some object.
|
|
1255
|
+
* @param obj A Node/Group/Edge id, or Node, Port, Group or Edge
|
|
1256
|
+
* @returns ObjectInfo
|
|
1257
|
+
*
|
|
1258
|
+
*/
|
|
1259
|
+
getObjectInfo<T>(obj: string | Edge | Node | Port | Group | ObjectData): ObjectInfo<T>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Undo the latest operation, if there is one. Otherwise does nothing.
|
|
1262
|
+
*/
|
|
1263
|
+
undo(): void;
|
|
1264
|
+
/**
|
|
1265
|
+
* Redo the latest operation that was undone, if there is one. Otherwise does nothing.
|
|
1266
|
+
*/
|
|
1267
|
+
redo(): void;
|
|
1268
|
+
/**
|
|
1269
|
+
* Opens a transaction and runs the given function within it, then commits the transaction. If your function returns false (boolean false, not false-y), the transaction is rolled back instead of committed.
|
|
1270
|
+
* @param fn Function to run.
|
|
1271
|
+
* @param cleanupAction What to do if a transaction already exists.
|
|
1272
|
+
* @return A string providing the transaction's ID, null if no transaction was created.
|
|
1273
|
+
*/
|
|
1274
|
+
transaction(fn: () => any, cleanupAction?: TransactionCleanupAction): string | false;
|
|
1275
|
+
/**
|
|
1276
|
+
* @internal
|
|
1277
|
+
* @param fn
|
|
1278
|
+
* @param cleanupAction
|
|
1279
|
+
* @param canRunOutsideTransaction
|
|
1280
|
+
*/
|
|
1281
|
+
$transaction(fn: () => any, cleanupAction: TransactionCleanupAction, canRunOutsideTransaction: boolean): string | false;
|
|
1282
|
+
/**
|
|
1283
|
+
* Opens a transaction and runs the given function. If the function returns true, the model changes from this transaction are merged with the previous entry on the undo stack, to form a new compound action, which can then be treated atomically. If the function return false, the transaction is rolled back and nothing is merged. If an uncommitted transaction is active when this method is called, the actions in this transaction are appended to the transaction in progress. This method is useful for situations where some user activity has resulted in a model change, and you want to respond with a further set of model changes, but you want to be able to undo/redo all of the actions as one unit.
|
|
1284
|
+
* @return A string providing the associated transaction's ID, null if nothing was merged to a transaction.
|
|
1285
|
+
* @param fn
|
|
1286
|
+
*/
|
|
1287
|
+
mergeTransaction(fn: () => any): string | false;
|
|
1288
|
+
/**
|
|
1289
|
+
* Opens a transaction.
|
|
1290
|
+
* @param cleanupAction What to do if a transaction already exists. If you supply nothing, or an inappropriate value, here and there is a current transaction, then an Error is thrown.
|
|
1291
|
+
* @param cleanupAction action to perform if a transaction already exists
|
|
1292
|
+
*
|
|
1293
|
+
*/
|
|
1294
|
+
openTransaction(cleanupAction?: TransactionCleanupAction): string;
|
|
1295
|
+
/**
|
|
1296
|
+
* Rolls back the current transaction, undoing any changes to the data model made in the transaction. If there is no current transaction this method does nothing.
|
|
1297
|
+
*/
|
|
1298
|
+
rollbackTransaction(): void;
|
|
1299
|
+
/**
|
|
1300
|
+
* Commits any changes made in the current transaction to the undo stack. If there is no current transaction this method does nothing.
|
|
1301
|
+
*/
|
|
1302
|
+
commitTransaction(commitAll?: boolean): void;
|
|
1303
|
+
/**
|
|
1304
|
+
* Clears out the undo/redo stacks and discards (neither commits nor rolls back) any existing transaction.
|
|
1305
|
+
*/
|
|
1306
|
+
flushUndoRedo(): void;
|
|
1307
|
+
get version(): string;
|
|
1308
|
+
/**
|
|
1309
|
+
* Derives an appropriate ID for the given data that represents an edge. If the data is null we return a new uuid. If the data is a string we return that string. If the data has a property identifying its id (which by default is the `id` property), we return that property's value. If all else fails we return a new uuid.
|
|
1310
|
+
* @param data
|
|
1311
|
+
* @internal
|
|
1312
|
+
*/
|
|
1313
|
+
private $_deriveEdgeId;
|
|
1314
|
+
}
|