@flowgram.ai/renderer 0.4.6 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { ConfigEntity, EntityOpts, PlaygroundDragEvent, PositionSchema, SizeSche
|
|
|
3
3
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
4
4
|
import { Rectangle, Disposable, CacheOriginItem, ScrollSchema } from '@flowgram.ai/utils';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import { throttle } from 'lodash-es';
|
|
7
7
|
import { ContainerModule } from 'inversify';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -276,6 +276,11 @@ declare class FlowNodesContentLayer extends Layer {
|
|
|
276
276
|
render(): React.JSX.Element;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
281
|
+
* SPDX-License-Identifier: MIT
|
|
282
|
+
*/
|
|
283
|
+
|
|
279
284
|
declare class FlowLinesLayer extends Layer {
|
|
280
285
|
readonly document: FlowDocument;
|
|
281
286
|
protected readonly dragService: FlowDragService;
|
|
@@ -291,13 +296,18 @@ declare class FlowLinesLayer extends Layer {
|
|
|
291
296
|
/**
|
|
292
297
|
* 可视区域变化
|
|
293
298
|
*/
|
|
294
|
-
onViewportChange:
|
|
299
|
+
onViewportChange: ReturnType<typeof throttle>;
|
|
295
300
|
onZoom(): void;
|
|
296
301
|
onReady(): void;
|
|
297
302
|
get viewBox(): string;
|
|
298
303
|
render(): JSX.Element;
|
|
299
304
|
}
|
|
300
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
308
|
+
* SPDX-License-Identifier: MIT
|
|
309
|
+
*/
|
|
310
|
+
|
|
301
311
|
declare class FlowLabelsLayer extends Layer {
|
|
302
312
|
readonly document: FlowDocument;
|
|
303
313
|
readonly rendererRegistry: FlowRendererRegistry;
|
|
@@ -317,7 +327,7 @@ declare class FlowLabelsLayer extends Layer {
|
|
|
317
327
|
/**
|
|
318
328
|
* 可视区域变化
|
|
319
329
|
*/
|
|
320
|
-
onViewportChange:
|
|
330
|
+
onViewportChange: ReturnType<typeof throttle>;
|
|
321
331
|
onReady(): void;
|
|
322
332
|
/**
|
|
323
333
|
* 监听readonly和 disabled 状态 并刷新layer, 并刷新
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ConfigEntity, EntityOpts, PlaygroundDragEvent, PositionSchema, SizeSche
|
|
|
3
3
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
4
4
|
import { Rectangle, Disposable, CacheOriginItem, ScrollSchema } from '@flowgram.ai/utils';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import { throttle } from 'lodash-es';
|
|
7
7
|
import { ContainerModule } from 'inversify';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -276,6 +276,11 @@ declare class FlowNodesContentLayer extends Layer {
|
|
|
276
276
|
render(): React.JSX.Element;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
281
|
+
* SPDX-License-Identifier: MIT
|
|
282
|
+
*/
|
|
283
|
+
|
|
279
284
|
declare class FlowLinesLayer extends Layer {
|
|
280
285
|
readonly document: FlowDocument;
|
|
281
286
|
protected readonly dragService: FlowDragService;
|
|
@@ -291,13 +296,18 @@ declare class FlowLinesLayer extends Layer {
|
|
|
291
296
|
/**
|
|
292
297
|
* 可视区域变化
|
|
293
298
|
*/
|
|
294
|
-
onViewportChange:
|
|
299
|
+
onViewportChange: ReturnType<typeof throttle>;
|
|
295
300
|
onZoom(): void;
|
|
296
301
|
onReady(): void;
|
|
297
302
|
get viewBox(): string;
|
|
298
303
|
render(): JSX.Element;
|
|
299
304
|
}
|
|
300
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
308
|
+
* SPDX-License-Identifier: MIT
|
|
309
|
+
*/
|
|
310
|
+
|
|
301
311
|
declare class FlowLabelsLayer extends Layer {
|
|
302
312
|
readonly document: FlowDocument;
|
|
303
313
|
readonly rendererRegistry: FlowRendererRegistry;
|
|
@@ -317,7 +327,7 @@ declare class FlowLabelsLayer extends Layer {
|
|
|
317
327
|
/**
|
|
318
328
|
* 可视区域变化
|
|
319
329
|
*/
|
|
320
|
-
onViewportChange:
|
|
330
|
+
onViewportChange: ReturnType<typeof throttle>;
|
|
321
331
|
onReady(): void;
|
|
322
332
|
/**
|
|
323
333
|
* 监听readonly和 disabled 状态 并刷新layer, 并刷新
|
package/dist/index.js
CHANGED
|
@@ -480,7 +480,7 @@ var import_core3 = require("@flowgram.ai/core");
|
|
|
480
480
|
var import_utils3 = require("@flowgram.ai/utils");
|
|
481
481
|
|
|
482
482
|
// src/utils/find-selected-nodes.ts
|
|
483
|
-
var
|
|
483
|
+
var import_lodash_es = require("lodash-es");
|
|
484
484
|
function getNodePath(node) {
|
|
485
485
|
const path = [node];
|
|
486
486
|
node = node.parent;
|
|
@@ -503,13 +503,13 @@ function findSelectedNodes(nodes) {
|
|
|
503
503
|
let index = 0;
|
|
504
504
|
let selectedItems = [];
|
|
505
505
|
while (index < minLength) {
|
|
506
|
-
selectedItems = (0,
|
|
506
|
+
selectedItems = (0, import_lodash_es.uniq)(nodePathList.map((p) => p[index]));
|
|
507
507
|
if (selectedItems.length > 1) {
|
|
508
508
|
break;
|
|
509
509
|
}
|
|
510
510
|
index += 1;
|
|
511
511
|
}
|
|
512
|
-
return (0,
|
|
512
|
+
return (0, import_lodash_es.uniq)(selectedItems.map((item) => findRealEntity(item)));
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
// src/entities/flow-select-config-entity.tsx
|
|
@@ -666,9 +666,9 @@ var import_inversify = require("inversify");
|
|
|
666
666
|
var import_utils5 = require("@flowgram.ai/utils");
|
|
667
667
|
|
|
668
668
|
// src/utils/element.ts
|
|
669
|
-
var
|
|
669
|
+
var import_lodash_es2 = require("lodash-es");
|
|
670
670
|
var isHidden = (dom) => {
|
|
671
|
-
if (!dom || (0,
|
|
671
|
+
if (!dom || (0, import_lodash_es2.isNil)(dom?.offsetParent)) {
|
|
672
672
|
return true;
|
|
673
673
|
}
|
|
674
674
|
const style = window.getComputedStyle(dom);
|
|
@@ -1071,7 +1071,7 @@ FlowNodesContentLayer = __decorateClass([
|
|
|
1071
1071
|
|
|
1072
1072
|
// src/layers/flow-lines-layer.tsx
|
|
1073
1073
|
var import_react8 = __toESM(require("react"));
|
|
1074
|
-
var
|
|
1074
|
+
var import_lodash_es4 = require("lodash-es");
|
|
1075
1075
|
var import_inversify5 = require("inversify");
|
|
1076
1076
|
var import_utils12 = require("@flowgram.ai/utils");
|
|
1077
1077
|
var import_document9 = require("@flowgram.ai/document");
|
|
@@ -1103,7 +1103,7 @@ var StraightLine_default = StraightLine;
|
|
|
1103
1103
|
|
|
1104
1104
|
// src/components/RoundedTurningLine.tsx
|
|
1105
1105
|
var import_react5 = __toESM(require("react"));
|
|
1106
|
-
var
|
|
1106
|
+
var import_lodash_es3 = require("lodash-es");
|
|
1107
1107
|
var import_utils9 = require("@flowgram.ai/utils");
|
|
1108
1108
|
var import_core8 = require("@flowgram.ai/core");
|
|
1109
1109
|
|
|
@@ -1194,24 +1194,24 @@ function RoundedTurningLine(props) {
|
|
|
1194
1194
|
}
|
|
1195
1195
|
const inPoint = new import_utils9.Point().copyFrom(point);
|
|
1196
1196
|
const outPoint = new import_utils9.Point().copyFrom(point);
|
|
1197
|
-
const radiusX = (0,
|
|
1198
|
-
const radiusY = (0,
|
|
1197
|
+
const radiusX = (0, import_lodash_es3.isNil)(point.radiusX) ? radius : point.radiusX;
|
|
1198
|
+
const radiusY = (0, import_lodash_es3.isNil)(point.radiusY) ? radius : point.radiusY;
|
|
1199
1199
|
let rx = radiusX;
|
|
1200
1200
|
let ry = radiusY;
|
|
1201
1201
|
if (isRightAngleX) {
|
|
1202
1202
|
ry = Math.min(prevDelta.y, radiusY);
|
|
1203
|
-
const moveY = (0,
|
|
1203
|
+
const moveY = (0, import_lodash_es3.isNil)(point.moveY) ? ry : point.moveY;
|
|
1204
1204
|
inPoint.y += from.y < point.y ? -moveY : +moveY;
|
|
1205
1205
|
rx = Math.min(nextDelta.x, radiusX);
|
|
1206
|
-
const moveX = (0,
|
|
1206
|
+
const moveX = (0, import_lodash_es3.isNil)(point.moveX) ? rx : point.moveX;
|
|
1207
1207
|
outPoint.x += to.x < point.x ? -moveX : +moveX;
|
|
1208
1208
|
}
|
|
1209
1209
|
if (isRightAngleY) {
|
|
1210
1210
|
rx = Math.min(prevDelta.x, radiusX);
|
|
1211
|
-
const moveX = (0,
|
|
1211
|
+
const moveX = (0, import_lodash_es3.isNil)(point.moveX) ? rx : point.moveX;
|
|
1212
1212
|
inPoint.x += from.x < point.x ? -moveX : +moveX;
|
|
1213
1213
|
ry = Math.min(nextDelta.y, radiusY);
|
|
1214
|
-
const moveY = (0,
|
|
1214
|
+
const moveY = (0, import_lodash_es3.isNil)(point.moveY) ? ry : point.moveY;
|
|
1215
1215
|
outPoint.y += to.y < point.y ? -moveY : +moveY;
|
|
1216
1216
|
}
|
|
1217
1217
|
if (point.radiusOverflow === "truncate") {
|
|
@@ -1333,7 +1333,7 @@ var FlowLinesLayer = class extends import_core9.Layer {
|
|
|
1333
1333
|
/**
|
|
1334
1334
|
* 可视区域变化
|
|
1335
1335
|
*/
|
|
1336
|
-
this.onViewportChange = (0,
|
|
1336
|
+
this.onViewportChange = (0, import_lodash_es4.throttle)(() => {
|
|
1337
1337
|
this.render();
|
|
1338
1338
|
}, 100);
|
|
1339
1339
|
}
|
|
@@ -1365,7 +1365,7 @@ var FlowLinesLayer = class extends import_core9.Layer {
|
|
|
1365
1365
|
dragService: this.dragService
|
|
1366
1366
|
});
|
|
1367
1367
|
});
|
|
1368
|
-
const { activateLines = [], normalLines = [] } = (0,
|
|
1368
|
+
const { activateLines = [], normalLines = [] } = (0, import_lodash_es4.groupBy)(
|
|
1369
1369
|
allLines,
|
|
1370
1370
|
(line) => line.props.activated ? "activateLines" : "normalLines"
|
|
1371
1371
|
);
|
|
@@ -1408,7 +1408,7 @@ FlowLinesLayer = __decorateClass([
|
|
|
1408
1408
|
|
|
1409
1409
|
// src/layers/flow-labels-layer.tsx
|
|
1410
1410
|
var import_react14 = __toESM(require("react"));
|
|
1411
|
-
var
|
|
1411
|
+
var import_lodash_es5 = require("lodash-es");
|
|
1412
1412
|
var import_inversify6 = require("inversify");
|
|
1413
1413
|
var import_utils16 = require("@flowgram.ai/utils");
|
|
1414
1414
|
var import_document15 = require("@flowgram.ai/document");
|
|
@@ -1792,7 +1792,7 @@ var FlowLabelsLayer = class extends import_core12.Layer {
|
|
|
1792
1792
|
/**
|
|
1793
1793
|
* 可视区域变化
|
|
1794
1794
|
*/
|
|
1795
|
-
this.onViewportChange = (0,
|
|
1795
|
+
this.onViewportChange = (0, import_lodash_es5.throttle)(() => {
|
|
1796
1796
|
this.render();
|
|
1797
1797
|
}, 100);
|
|
1798
1798
|
}
|