@logicflow/core 2.2.0-alpha.4 → 2.2.0-alpha.5

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/es/LogicFlow.js CHANGED
@@ -1217,7 +1217,6 @@ var LogicFlow = /** @class */ (function () {
1217
1217
  this.graphModel.destroy();
1218
1218
  this.tool.destroy();
1219
1219
  this.history.destroy();
1220
- clearThemeMode();
1221
1220
  for (var extensionName in this.extension) {
1222
1221
  var extensionInstance = this.extension[extensionName];
1223
1222
  if ('destroy' in extensionInstance) {
@@ -503,7 +503,7 @@ var GraphModel = /** @class */ (function () {
503
503
  edgeDragging = true;
504
504
  break;
505
505
  }
506
- else {
506
+ if (!edgeMode.virtual) {
507
507
  edges.push(edgeMode.getHistoryData());
508
508
  }
509
509
  }
@@ -54,7 +54,7 @@ var __read = (this && this.__read) || function (o, n) {
54
54
  import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
55
55
  import { Component } from 'preact/compat';
56
56
  import { reaction } from 'mobx';
57
- import { map } from 'lodash-es';
57
+ import { map, isFunction, isNil } from 'lodash-es';
58
58
  import Anchor from '../Anchor';
59
59
  import { BaseText } from '../text';
60
60
  import { ElementState, EventType, TextMode } from '../../constant';
@@ -244,8 +244,7 @@ var BaseNode = /** @class */ (function (_super) {
244
244
  graphModel.eventCenter.emit(EventType.NODE_CLICK, eventOptions);
245
245
  // 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
246
246
  var el_1 = e.currentTarget;
247
- var rAF = typeof window !== 'undefined' &&
248
- typeof window.requestAnimationFrame === 'function'
247
+ var rAF = !isNil(window) && isFunction(window.requestAnimationFrame)
249
248
  ? window.requestAnimationFrame.bind(window)
250
249
  : function (fn) { return setTimeout(fn, 0); };
251
250
  rAF(function () {
@@ -57,7 +57,7 @@ var OutlineOverlay = /** @class */ (function (_super) {
57
57
  var isHovered = element.isHovered, isSelected = element.isSelected, x = element.x, y = element.y, width = element.width, height = element.height;
58
58
  if ((nodeSelectedOutline && isSelected) ||
59
59
  (hoverOutline && isHovered)) {
60
- var style_1 = element.getOutlineStyle();
60
+ var style_1 = element.getOutlineStyle() || {};
61
61
  var attributes_1 = {};
62
62
  Object.keys(style_1).forEach(function (key) {
63
63
  if (key !== 'hover') {
package/lib/LogicFlow.js CHANGED
@@ -1246,7 +1246,6 @@ var LogicFlow = /** @class */ (function () {
1246
1246
  this.graphModel.destroy();
1247
1247
  this.tool.destroy();
1248
1248
  this.history.destroy();
1249
- (0, util_1.clearThemeMode)();
1250
1249
  for (var extensionName in this.extension) {
1251
1250
  var extensionInstance = this.extension[extensionName];
1252
1251
  if ('destroy' in extensionInstance) {
@@ -509,7 +509,7 @@ var GraphModel = /** @class */ (function () {
509
509
  edgeDragging = true;
510
510
  break;
511
511
  }
512
- else {
512
+ if (!edgeMode.virtual) {
513
513
  edges.push(edgeMode.getHistoryData());
514
514
  }
515
515
  }
@@ -248,8 +248,7 @@ var BaseNode = /** @class */ (function (_super) {
248
248
  graphModel.eventCenter.emit(constant_1.EventType.NODE_CLICK, eventOptions);
249
249
  // 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
250
250
  var el_1 = e.currentTarget;
251
- var rAF = typeof window !== 'undefined' &&
252
- typeof window.requestAnimationFrame === 'function'
251
+ var rAF = !(0, lodash_es_1.isNil)(window) && (0, lodash_es_1.isFunction)(window.requestAnimationFrame)
253
252
  ? window.requestAnimationFrame.bind(window)
254
253
  : function (fn) { return setTimeout(fn, 0); };
255
254
  rAF(function () {
@@ -60,7 +60,7 @@ var OutlineOverlay = /** @class */ (function (_super) {
60
60
  var isHovered = element.isHovered, isSelected = element.isSelected, x = element.x, y = element.y, width = element.width, height = element.height;
61
61
  if ((nodeSelectedOutline && isSelected) ||
62
62
  (hoverOutline && isHovered)) {
63
- var style_1 = element.getOutlineStyle();
63
+ var style_1 = element.getOutlineStyle() || {};
64
64
  var attributes_1 = {};
65
65
  Object.keys(style_1).forEach(function (key) {
66
66
  if (key !== 'hover') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logicflow/core",
3
- "version": "2.2.0-alpha.4",
3
+ "version": "2.2.0-alpha.5",
4
4
  "description": "LogicFlow, help you quickly create flowcharts",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
package/src/LogicFlow.tsx CHANGED
@@ -1445,7 +1445,6 @@ export class LogicFlow {
1445
1445
  this.graphModel.destroy()
1446
1446
  this.tool.destroy()
1447
1447
  this.history.destroy()
1448
- clearThemeMode()
1449
1448
  for (const extensionName in this.extension) {
1450
1449
  const extensionInstance = this.extension[extensionName]
1451
1450
  if ('destroy' in extensionInstance) {
@@ -576,7 +576,8 @@ export class GraphModel {
576
576
  if (edgeMode.isDragging) {
577
577
  edgeDragging = true
578
578
  break
579
- } else {
579
+ }
580
+ if (!edgeMode.virtual) {
580
581
  edges.push(edgeMode.getHistoryData())
581
582
  }
582
583
  }
@@ -1,6 +1,6 @@
1
1
  import { createElement as h, Component } from 'preact/compat'
2
2
  import { reaction, IReactionDisposer } from 'mobx'
3
- import { map } from 'lodash-es'
3
+ import { map, isFunction, isNil } from 'lodash-es'
4
4
  import Anchor from '../Anchor'
5
5
  import { BaseText } from '../text'
6
6
  import LogicFlow from '../../LogicFlow'
@@ -410,8 +410,7 @@ export abstract class BaseNode<P extends IProps = IProps> extends Component<
410
410
  // 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
411
411
  const el = e.currentTarget as HTMLElement
412
412
  const rAF =
413
- typeof window !== 'undefined' &&
414
- typeof window.requestAnimationFrame === 'function'
413
+ !isNil(window) && isFunction(window.requestAnimationFrame)
415
414
  ? window.requestAnimationFrame.bind(window)
416
415
  : (fn: () => void) => setTimeout(fn, 0)
417
416
  rAF(() => {
@@ -51,7 +51,7 @@ export class OutlineOverlay extends Component<IProps> {
51
51
  (nodeSelectedOutline && isSelected) ||
52
52
  (hoverOutline && isHovered)
53
53
  ) {
54
- const style = element.getOutlineStyle()
54
+ const style = element.getOutlineStyle() || {}
55
55
  let attributes = {}
56
56
  Object.keys(style).forEach((key) => {
57
57
  if (key !== 'hover') {