index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. "use strict";
  2. var __rest = (this && this.__rest) || function (s, e) {
  3. var t = {};
  4. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  5. t[p] = s[p];
  6. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  7. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  8. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  9. t[p[i]] = s[p[i]];
  10. }
  11. return t;
  12. };
  13. Object.defineProperty(exports, "__esModule", { value: true });
  14. exports.EdgeTool = exports.NodeTool = void 0;
  15. const registry_1 = require("../registry");
  16. const tool_1 = require("../../view/tool");
  17. const button_1 = require("./button");
  18. const boundary_1 = require("./boundary");
  19. const vertices_1 = require("./vertices");
  20. const segments_1 = require("./segments");
  21. const anchor_1 = require("./anchor");
  22. const arrowhead_1 = require("./arrowhead");
  23. const editor_1 = require("./editor");
  24. var NodeTool;
  25. (function (NodeTool) {
  26. NodeTool.presets = {
  27. boundary: boundary_1.Boundary,
  28. button: button_1.Button,
  29. 'button-remove': button_1.Button.Remove,
  30. 'node-editor': editor_1.CellEditor.NodeEditor,
  31. };
  32. NodeTool.registry = registry_1.Registry.create({
  33. type: 'node tool',
  34. process(name, options) {
  35. if (typeof options === 'function') {
  36. return options;
  37. }
  38. let parent = tool_1.ToolsView.ToolItem;
  39. const { inherit } = options, others = __rest(options, ["inherit"]);
  40. if (inherit) {
  41. const base = this.get(inherit);
  42. if (base == null) {
  43. this.onNotFound(inherit, 'inherited');
  44. }
  45. else {
  46. parent = base;
  47. }
  48. }
  49. if (others.name == null) {
  50. others.name = name;
  51. }
  52. return parent.define.call(parent, others);
  53. },
  54. });
  55. NodeTool.registry.register(NodeTool.presets, true);
  56. })(NodeTool = exports.NodeTool || (exports.NodeTool = {}));
  57. var EdgeTool;
  58. (function (EdgeTool) {
  59. EdgeTool.presets = {
  60. boundary: boundary_1.Boundary,
  61. vertices: vertices_1.Vertices,
  62. segments: segments_1.Segments,
  63. button: button_1.Button,
  64. 'button-remove': button_1.Button.Remove,
  65. 'source-anchor': anchor_1.SourceAnchor,
  66. 'target-anchor': anchor_1.TargetAnchor,
  67. 'source-arrowhead': arrowhead_1.SourceArrowhead,
  68. 'target-arrowhead': arrowhead_1.TargetArrowhead,
  69. 'edge-editor': editor_1.CellEditor.EdgeEditor,
  70. };
  71. EdgeTool.registry = registry_1.Registry.create({
  72. type: 'edge tool',
  73. process(name, options) {
  74. if (typeof options === 'function') {
  75. return options;
  76. }
  77. let parent = tool_1.ToolsView.ToolItem;
  78. const { inherit } = options, others = __rest(options, ["inherit"]);
  79. if (inherit) {
  80. const base = this.get(inherit);
  81. if (base == null) {
  82. this.onNotFound(inherit, 'inherited');
  83. }
  84. else {
  85. parent = base;
  86. }
  87. }
  88. if (others.name == null) {
  89. others.name = name;
  90. }
  91. return parent.define.call(parent, others);
  92. },
  93. });
  94. EdgeTool.registry.register(EdgeTool.presets, true);
  95. })(EdgeTool = exports.EdgeTool || (exports.EdgeTool = {}));
  96. //# sourceMappingURL=index.js.map