@flowgram.ai/fixed-semi-materials 0.1.0-alpha.3 → 0.1.0-alpha.31

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 CHANGED
@@ -161,11 +161,16 @@ import React3, { useState } from "react";
161
161
  import {
162
162
  FlowNodeRenderData,
163
163
  FlowNodeTransformData,
164
- Playground
164
+ useBaseColor,
165
+ FlowTextKey,
166
+ usePlayground,
167
+ FlowRendererRegistry
165
168
  } from "@flowgram.ai/fixed-layout-editor";
166
169
  import { IconChevronLeft } from "@douyinfe/semi-icons";
167
170
  function TryCatchCollapse(props) {
168
171
  const { node } = props;
172
+ const { baseColor, baseActivatedColor } = useBaseColor();
173
+ const playground = usePlayground();
169
174
  const activateData = node.getData(FlowNodeRenderData);
170
175
  const transform = node.getData(FlowNodeTransformData);
171
176
  const [hoverActivated, setHoverActivated] = useState(false);
@@ -176,7 +181,7 @@ function TryCatchCollapse(props) {
176
181
  const height = 40;
177
182
  const scrollToActivateNode = () => {
178
183
  setTimeout(() => {
179
- Playground.getLatest()?.scrollToView({
184
+ playground.config.scrollToView({
180
185
  position: node?.getData(FlowNodeTransformData)?.inputPoint,
181
186
  scrollToCenter: true
182
187
  });
@@ -218,7 +223,7 @@ function TryCatchCollapse(props) {
218
223
  cursor: "pointer",
219
224
  justifyContent: "center",
220
225
  alignItems: "center",
221
- background: hoverActivated ? "#82A7FC" : "#BBBFC4"
226
+ background: hoverActivated || activateData.lineActivated ? baseActivatedColor : baseColor
222
227
  },
223
228
  "aria-hidden": "true"
224
229
  },
@@ -240,7 +245,7 @@ function TryCatchCollapse(props) {
240
245
  cursor: "pointer",
241
246
  justifyContent: "center",
242
247
  alignItems: "center",
243
- background: "#82A7FC"
248
+ background: baseActivatedColor
244
249
  },
245
250
  "aria-hidden": "true"
246
251
  },
@@ -266,28 +271,198 @@ function TryCatchCollapse(props) {
266
271
  /* @__PURE__ */ React3.createElement(
267
272
  "div",
268
273
  {
274
+ "data-label-id": props.labelId,
269
275
  style: {
270
276
  fontSize: 12,
271
- color: "#8F959E",
277
+ color: hoverActivated || activateData.lineActivated ? baseActivatedColor : baseColor,
272
278
  textAlign: "center",
273
279
  whiteSpace: "nowrap",
274
280
  backgroundColor: "var(--g-editor-background)",
275
281
  lineHeight: "20px"
276
282
  }
277
283
  },
278
- "Something error"
284
+ node.getService(FlowRendererRegistry).getText(FlowTextKey.CATCH_TEXT)
279
285
  ),
280
286
  renderCollapse()
281
287
  );
282
288
  }
283
289
  var try_catch_collapse_default = TryCatchCollapse;
284
290
 
285
- // src/components/dragging-adder/index.tsx
291
+ // src/components/slot-collapse.tsx
292
+ import React5, { useState as useState2 } from "react";
293
+ import {
294
+ FlowNodeRenderData as FlowNodeRenderData3,
295
+ FlowNodeTransformData as FlowNodeTransformData3
296
+ } from "@flowgram.ai/fixed-layout-editor";
297
+
298
+ // src/components/collapse/index.tsx
286
299
  import React4 from "react";
300
+ import {
301
+ FlowNodeRenderData as FlowNodeRenderData2,
302
+ FlowNodeTransformData as FlowNodeTransformData2,
303
+ usePlayground as usePlayground2
304
+ } from "@flowgram.ai/fixed-layout-editor";
287
305
 
288
- // src/components/dragging-adder/styles.tsx
306
+ // src/components/collapse/styles.tsx
289
307
  import styled from "styled-components";
290
- var UIDragNodeContainer = styled.div`
308
+ var Container = styled.div`
309
+ width: 16px;
310
+ height: 16px;
311
+ font-size: 10px;
312
+ border-radius: 9px;
313
+ display: flex;
314
+ color: #fff;
315
+ cursor: pointer;
316
+ justify-content: center;
317
+ align-items: center;
318
+ background: ${(props) => props.hoverActivated ? "#82A7FC" : "#BBBFC4"};
319
+ transform: ${(props) => !props.isVertical && props.isCollapse ? "rotate(-90deg)" : ""};
320
+ `;
321
+
322
+ // src/components/collapse/index.tsx
323
+ function Collapse(props) {
324
+ const { collapseNode, activateNode, hoverActivated, style } = props;
325
+ const playground = usePlayground2();
326
+ const activateData = activateNode?.getData(FlowNodeRenderData2);
327
+ const transform = collapseNode.getData(FlowNodeTransformData2);
328
+ if (!transform) {
329
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null);
330
+ }
331
+ const scrollToActivateNode = () => {
332
+ setTimeout(() => {
333
+ playground.config.scrollToView({
334
+ position: activateNode?.getData(FlowNodeTransformData2)?.outputPoint,
335
+ scrollToCenter: true
336
+ });
337
+ }, 100);
338
+ };
339
+ const collapseBlock = () => {
340
+ transform.collapsed = true;
341
+ activateData?.toggleMouseLeave();
342
+ scrollToActivateNode();
343
+ };
344
+ const openBlock = () => {
345
+ transform.collapsed = false;
346
+ scrollToActivateNode();
347
+ };
348
+ if (transform.collapsed) {
349
+ const childCount = collapseNode.allCollapsedChildren.filter(
350
+ (child) => !child.hidden && child !== activateNode
351
+ ).length;
352
+ return /* @__PURE__ */ React4.createElement(
353
+ Container,
354
+ {
355
+ onClick: openBlock,
356
+ hoverActivated,
357
+ "aria-hidden": "true",
358
+ style
359
+ },
360
+ childCount
361
+ );
362
+ }
363
+ const circleColor = "var(--semi-color-white)";
364
+ const color = hoverActivated ? "#82A7FC" : "#BBBFC4";
365
+ return /* @__PURE__ */ React4.createElement(
366
+ Container,
367
+ {
368
+ onClick: collapseBlock,
369
+ hoverActivated,
370
+ isVertical: activateNode?.isVertical,
371
+ isCollapse: true,
372
+ style,
373
+ "aria-hidden": "true"
374
+ },
375
+ /* @__PURE__ */ React4.createElement(Arrow, { color, circleColor })
376
+ );
377
+ }
378
+ var collapse_default = Collapse;
379
+
380
+ // src/components/slot-collapse.tsx
381
+ function SlotCollapse({ node }) {
382
+ const [hoverActivated, setHoverActivated] = useState2(false);
383
+ const icon = node.firstChild;
384
+ const iconActivated = icon.getData(FlowNodeRenderData3).activated;
385
+ const iconHeight = icon.getData(FlowNodeTransformData3).size.height;
386
+ const isChildVisible = node.collapsed || hoverActivated || iconActivated;
387
+ return /* @__PURE__ */ React5.createElement(
388
+ "div",
389
+ {
390
+ style: {
391
+ width: 30,
392
+ height: iconHeight || 100,
393
+ display: "flex",
394
+ alignItems: "center",
395
+ justifyContent: "center"
396
+ },
397
+ onMouseEnter: () => setHoverActivated(true),
398
+ onMouseLeave: () => setHoverActivated(false)
399
+ },
400
+ isChildVisible && /* @__PURE__ */ React5.createElement(
401
+ collapse_default,
402
+ {
403
+ style: !node.collapsed ? {
404
+ transform: node.isVertical ? "rotate(-90deg)" : "rotate(90deg)"
405
+ } : {},
406
+ node,
407
+ activateNode: icon,
408
+ collapseNode: node,
409
+ hoverActivated
410
+ }
411
+ )
412
+ );
413
+ }
414
+
415
+ // src/components/slot-adder.tsx
416
+ import React6 from "react";
417
+ import { nanoid } from "nanoid";
418
+ import {
419
+ FlowNodeRenderData as FlowNodeRenderData4,
420
+ FlowDocument,
421
+ useService
422
+ } from "@flowgram.ai/fixed-layout-editor";
423
+ import { Button } from "@douyinfe/semi-ui";
424
+ import { IconPlus } from "@douyinfe/semi-icons";
425
+ function SlotAdder(props) {
426
+ const { node } = props;
427
+ const nodeData = node.firstChild?.getData(FlowNodeRenderData4);
428
+ const document = useService(FlowDocument);
429
+ async function addPort() {
430
+ document.addNode({
431
+ id: nanoid(5),
432
+ type: "custom",
433
+ parent: node
434
+ });
435
+ }
436
+ return /* @__PURE__ */ React6.createElement(
437
+ "div",
438
+ {
439
+ style: {
440
+ display: "flex",
441
+ background: "var(--semi-color-bg-0)"
442
+ },
443
+ onMouseEnter: () => nodeData?.toggleMouseEnter(),
444
+ onMouseLeave: () => nodeData?.toggleMouseLeave()
445
+ },
446
+ /* @__PURE__ */ React6.createElement(
447
+ Button,
448
+ {
449
+ onClick: () => {
450
+ addPort();
451
+ },
452
+ size: "small",
453
+ icon: /* @__PURE__ */ React6.createElement(IconPlus, null)
454
+ }
455
+ )
456
+ );
457
+ }
458
+
459
+ // src/components/dragging-adder/index.tsx
460
+ import React7 from "react";
461
+ import { FlowDragLayer, usePlayground as usePlayground3 } from "@flowgram.ai/fixed-layout-editor";
462
+
463
+ // src/components/dragging-adder/styles.tsx
464
+ import styled2 from "styled-components";
465
+ var UIDragNodeContainer = styled2.div`
291
466
  width: 16px;
292
467
  height: 16px;
293
468
  border-radius: 100px;
@@ -296,22 +471,32 @@ var UIDragNodeContainer = styled.div`
296
471
  `;
297
472
 
298
473
  // src/components/dragging-adder/index.tsx
299
- function DraggingAdder() {
300
- return /* @__PURE__ */ React4.createElement(UIDragNodeContainer, null);
474
+ function DraggingAdder(props) {
475
+ const playground = usePlayground3();
476
+ const layer = playground.getLayer(FlowDragLayer);
477
+ if (!layer) return /* @__PURE__ */ React7.createElement(React7.Fragment, null);
478
+ if (layer.options.canDrop && !layer.options.canDrop({
479
+ dragNodes: layer.dragEntities || [],
480
+ dropNode: props.from,
481
+ isBranch: false
482
+ })) {
483
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null);
484
+ }
485
+ return /* @__PURE__ */ React7.createElement(UIDragNodeContainer, null);
301
486
  }
302
487
 
303
488
  // src/components/drag-node/index.tsx
304
- import React5 from "react";
489
+ import React8 from "react";
305
490
 
306
491
  // src/components/drag-node/styles.tsx
307
- import styled2 from "styled-components";
492
+ import styled3 from "styled-components";
308
493
 
309
494
  // src/components/constants.tsx
310
495
  var primary = "hsl(252 62% 54.9%)";
311
496
  var primaryOpacity09 = "hsl(252deg 62% 55% / 9%)";
312
497
 
313
498
  // src/components/drag-node/styles.tsx
314
- var UIDragNodeContainer2 = styled2.div`
499
+ var UIDragNodeContainer2 = styled3.div`
315
500
  position: relative;
316
501
  height: 32px;
317
502
  border-radius: 5px;
@@ -326,7 +511,7 @@ var UIDragNodeContainer2 = styled2.div`
326
511
  color: ${primary};
327
512
  }
328
513
  `;
329
- var UIDragCounts = styled2.div`
514
+ var UIDragCounts = styled3.div`
330
515
  position: absolute;
331
516
  top: -8px;
332
517
  right: -8px;
@@ -342,11 +527,11 @@ var UIDragCounts = styled2.div`
342
527
 
343
528
  // src/components/drag-node/index.tsx
344
529
  function DragNode(props) {
345
- const { dragStart, dragNodes } = props;
530
+ const { dragStart, dragNodes, dragJSON } = props;
346
531
  const dragLength = (dragNodes || []).map(
347
532
  (_node) => _node.allCollapsedChildren.length ? _node.allCollapsedChildren.filter((_n) => !_n.hidden).length : 1
348
533
  ).reduce((acm, curr) => acm + curr, 0);
349
- return /* @__PURE__ */ React5.createElement(UIDragNodeContainer2, null, dragStart?.id, dragLength > 1 && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(UIDragCounts, null, dragLength), /* @__PURE__ */ React5.createElement(
534
+ return /* @__PURE__ */ React8.createElement(UIDragNodeContainer2, null, dragStart?.id || dragJSON?.id, dragLength > 1 && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(UIDragCounts, null, dragLength), /* @__PURE__ */ React8.createElement(
350
535
  UIDragNodeContainer2,
351
536
  {
352
537
  style: {
@@ -362,17 +547,17 @@ function DragNode(props) {
362
547
  }
363
548
 
364
549
  // src/components/drag-highlight-adder/index.tsx
365
- import React6 from "react";
366
- import { min } from "lodash";
367
- import { FlowNodeTransformData as FlowNodeTransformData2 } from "@flowgram.ai/fixed-layout-editor";
550
+ import React9 from "react";
551
+ import { min } from "lodash-es";
552
+ import { FlowNodeTransformData as FlowNodeTransformData4 } from "@flowgram.ai/fixed-layout-editor";
368
553
 
369
554
  // src/components/drag-highlight-adder/styles.tsx
370
- import styled3 from "styled-components";
371
- var UILineContainer = styled3.div`
555
+ import styled4 from "styled-components";
556
+ var UILineContainer = styled4.div`
372
557
  display: flex;
373
558
  align-items: center;
374
559
  `;
375
- var UILine = (width, height) => styled3.div`
560
+ var UILine = (width, height) => styled4.div`
376
561
  width: ${width}px;
377
562
  height: ${height}px;
378
563
  background: #3370ff;
@@ -389,104 +574,33 @@ var getMinSize = (preWidth, nextWidth) => {
389
574
  return min([preWidth, nextWidth]) || 0;
390
575
  };
391
576
  function DragHighlightAdder({ node }) {
392
- const transformBounds = node.getData(FlowNodeTransformData2)?.bounds;
577
+ const transformBounds = node.getData(FlowNodeTransformData4)?.bounds;
393
578
  const { isVertical } = node;
394
579
  if (isVertical) {
395
580
  const preWidth = (transformBounds?.width || 0) - 16;
396
- const nextNodeBounds2 = node?.next?.getData(FlowNodeTransformData2)?.bounds?.width;
581
+ const nextNodeBounds2 = node?.next?.getData(FlowNodeTransformData4)?.bounds?.width;
397
582
  const nextWidth = (nextNodeBounds2 || 0) - 16;
398
583
  const LineDom2 = UILine(getMinSize(preWidth, nextWidth), 2);
399
- return /* @__PURE__ */ React6.createElement(UILineContainer, null, /* @__PURE__ */ React6.createElement(Ellipse, null), /* @__PURE__ */ React6.createElement(LineDom2, null), /* @__PURE__ */ React6.createElement(Ellipse, null));
584
+ return /* @__PURE__ */ React9.createElement(UILineContainer, null, /* @__PURE__ */ React9.createElement(Ellipse, null), /* @__PURE__ */ React9.createElement(LineDom2, null), /* @__PURE__ */ React9.createElement(Ellipse, null));
400
585
  }
401
586
  const preHeight = (transformBounds?.height || 0) - 16;
402
- const nextNodeBounds = node?.next?.getData(FlowNodeTransformData2)?.bounds?.height;
587
+ const nextNodeBounds = node?.next?.getData(FlowNodeTransformData4)?.bounds?.height;
403
588
  const nextHeight = (nextNodeBounds || 0) - 16;
404
589
  const LineDom = UILine(2, getMinSize(preHeight, nextHeight));
405
- return /* @__PURE__ */ React6.createElement(UILineContainer, { style: { flexDirection: "column" } }, /* @__PURE__ */ React6.createElement(Ellipse, null), /* @__PURE__ */ React6.createElement(LineDom, null), /* @__PURE__ */ React6.createElement(Ellipse, null));
590
+ return /* @__PURE__ */ React9.createElement(UILineContainer, { style: { flexDirection: "column" } }, /* @__PURE__ */ React9.createElement(Ellipse, null), /* @__PURE__ */ React9.createElement(LineDom, null), /* @__PURE__ */ React9.createElement(Ellipse, null));
406
591
  }
407
592
 
408
- // src/components/collapse/index.tsx
409
- import React7 from "react";
410
- import {
411
- Playground as Playground2,
412
- FlowNodeRenderData as FlowNodeRenderData2,
413
- FlowNodeTransformData as FlowNodeTransformData3
414
- } from "@flowgram.ai/fixed-layout-editor";
415
-
416
- // src/components/collapse/styles.tsx
417
- import styled4 from "styled-components";
418
- var Container = styled4.div`
419
- width: 16px;
420
- height: 16px;
421
- font-size: 10px;
422
- border-radius: 9px;
423
- display: flex;
424
- color: #fff;
425
- cursor: pointer;
426
- justify-content: center;
427
- align-items: center;
428
- background: ${(props) => props.hoverActivated ? "#82A7FC" : "#BBBFC4"};
429
- transform: ${(props) => !props.isVertical && props.isCollapse ? "rotate(-90deg)" : ""};
430
- `;
431
-
432
- // src/components/collapse/index.tsx
433
- function Collapse(props) {
434
- const { collapseNode, activateNode, hoverActivated } = props;
435
- const activateData = activateNode?.getData(FlowNodeRenderData2);
436
- const transform = collapseNode.getData(FlowNodeTransformData3);
437
- if (!transform) {
438
- return /* @__PURE__ */ React7.createElement(React7.Fragment, null);
439
- }
440
- const scrollToActivateNode = () => {
441
- setTimeout(() => {
442
- Playground2.getLatest()?.scrollToView({
443
- position: activateNode?.getData(FlowNodeTransformData3)?.outputPoint,
444
- scrollToCenter: true
445
- });
446
- }, 100);
447
- };
448
- const collapseBlock = () => {
449
- transform.collapsed = true;
450
- activateData?.toggleMouseLeave();
451
- scrollToActivateNode();
452
- };
453
- const openBlock = () => {
454
- transform.collapsed = false;
455
- scrollToActivateNode();
456
- };
457
- if (transform.collapsed) {
458
- const childCount = collapseNode.allCollapsedChildren.filter(
459
- (child) => !child.hidden && child !== activateNode
460
- ).length;
461
- return /* @__PURE__ */ React7.createElement(Container, { onClick: openBlock, hoverActivated, "aria-hidden": "true" }, childCount);
462
- }
463
- const circleColor = "var(--semi-color-white)";
464
- const color = hoverActivated ? "#82A7FC" : "#BBBFC4";
465
- return /* @__PURE__ */ React7.createElement(
466
- Container,
467
- {
468
- onClick: collapseBlock,
469
- hoverActivated,
470
- isVertical: activateNode?.isVertical,
471
- isCollapse: true,
472
- "aria-hidden": "true"
473
- },
474
- /* @__PURE__ */ React7.createElement(Arrow, { color, circleColor })
475
- );
476
- }
477
- var collapse_default = Collapse;
478
-
479
593
  // src/components/branch-adder/index.tsx
480
- import React8 from "react";
481
- import { nanoid } from "nanoid";
594
+ import React10 from "react";
595
+ import { nanoid as nanoid2 } from "nanoid";
482
596
  import {
483
- FlowNodeRenderData as FlowNodeRenderData3,
484
- FlowNodeTransformData as FlowNodeTransformData4,
485
- usePlayground,
486
- useService,
487
- FlowOperationService
597
+ FlowNodeRenderData as FlowNodeRenderData5,
598
+ FlowNodeTransformData as FlowNodeTransformData5,
599
+ FlowOperationService,
600
+ usePlayground as usePlayground4,
601
+ useService as useService2
488
602
  } from "@flowgram.ai/fixed-layout-editor";
489
- import { IconPlus } from "@douyinfe/semi-icons";
603
+ import { IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
490
604
 
491
605
  // src/components/branch-adder/styles.tsx
492
606
  import styled5 from "styled-components";
@@ -516,77 +630,77 @@ var Container2 = styled5.div`
516
630
  // src/components/branch-adder/index.tsx
517
631
  function BranchAdder(props) {
518
632
  const { activated, node } = props;
519
- const nodeData = node.firstChild?.getData(FlowNodeRenderData3);
520
- const playground = usePlayground();
521
- const flowOperationService = useService(FlowOperationService);
633
+ const nodeData = node.firstChild?.getData(FlowNodeRenderData5);
634
+ const playground = usePlayground4();
635
+ const flowOperationService = useService2(FlowOperationService);
522
636
  const { isVertical } = node;
523
637
  function addBranch() {
524
- const block = flowOperationService.addBlock(node, { id: nanoid(5) });
638
+ const block = flowOperationService.addBlock(node, { id: nanoid2(5) });
525
639
  setTimeout(() => {
526
640
  playground.scrollToView({
527
- bounds: block.getData(FlowNodeTransformData4).bounds,
641
+ bounds: block.getData(FlowNodeTransformData5).bounds,
528
642
  scrollToCenter: true
529
643
  });
530
644
  }, 10);
531
645
  }
532
646
  if (playground.config.readonlyOrDisabled) return null;
533
- return /* @__PURE__ */ React8.createElement(
647
+ return /* @__PURE__ */ React10.createElement(
534
648
  Container2,
535
649
  {
536
650
  isVertical,
537
- activated,
651
+ activated: activated || nodeData?.hovered,
538
652
  onMouseEnter: () => nodeData?.toggleMouseEnter(),
539
653
  onMouseLeave: () => nodeData?.toggleMouseLeave()
540
654
  },
541
- /* @__PURE__ */ React8.createElement(
655
+ /* @__PURE__ */ React10.createElement(
542
656
  "div",
543
657
  {
544
658
  onClick: () => {
545
659
  addBranch();
546
660
  },
547
661
  "aria-hidden": "true",
548
- style: { flexGrow: 1, textAlign: "center" }
662
+ style: { flexGrow: 1, textAlign: "center", cursor: "pointer" }
549
663
  },
550
- /* @__PURE__ */ React8.createElement(IconPlus, null)
664
+ /* @__PURE__ */ React10.createElement(IconPlus2, null)
551
665
  )
552
666
  );
553
667
  }
554
668
 
555
669
  // src/components/adder/index.tsx
556
- import React11, { useState as useState2 } from "react";
557
- import { nanoid as nanoid3 } from "nanoid";
670
+ import React13, { useState as useState3 } from "react";
671
+ import { nanoid as nanoid4 } from "nanoid";
558
672
  import {
559
- FlowNodeTransformData as FlowNodeTransformData5,
560
- usePlayground as usePlayground2,
561
- useService as useService2,
673
+ FlowNodeTransformData as FlowNodeTransformData6,
674
+ usePlayground as usePlayground5,
675
+ useService as useService3,
562
676
  FlowOperationService as FlowOperationService2
563
677
  } from "@flowgram.ai/fixed-layout-editor";
564
678
  import { Popover } from "@douyinfe/semi-ui";
565
679
 
566
680
  // src/components/nodes/index.tsx
567
- import React10 from "react";
681
+ import React12 from "react";
568
682
 
569
683
  // src/components/metadata.tsx
570
- import React9 from "react";
571
- import { nanoid as nanoid2 } from "nanoid";
684
+ import React11 from "react";
685
+ import { nanoid as nanoid3 } from "nanoid";
572
686
  var metadata = {
573
687
  nodes: [
574
688
  {
575
689
  type: "start",
576
690
  label: "Start",
577
- icon: /* @__PURE__ */ React9.createElement(IconStyleBorder, null)
691
+ icon: /* @__PURE__ */ React11.createElement(IconStyleBorder, null)
578
692
  },
579
693
  {
580
694
  type: "dynamicSplit",
581
695
  label: "Split Branch",
582
- icon: /* @__PURE__ */ React9.createElement(IconParkRightBranch, null),
696
+ icon: /* @__PURE__ */ React11.createElement(IconParkRightBranch, null),
583
697
  blocks() {
584
698
  return [
585
699
  {
586
- id: nanoid2(5)
700
+ id: nanoid3(5)
587
701
  },
588
702
  {
589
- id: nanoid2(5)
703
+ id: nanoid3(5)
590
704
  }
591
705
  ];
592
706
  }
@@ -594,32 +708,32 @@ var metadata = {
594
708
  {
595
709
  type: "end",
596
710
  label: "Branch End",
597
- icon: /* @__PURE__ */ React9.createElement(FeAlignCenter, null),
711
+ icon: /* @__PURE__ */ React11.createElement(FeAlignCenter, null),
598
712
  branchEnd: true
599
713
  },
600
714
  {
601
715
  type: "loop",
602
716
  schemaType: "loop",
603
717
  label: "Loop",
604
- icon: /* @__PURE__ */ React9.createElement(BiBootstrapReboot, null)
718
+ icon: /* @__PURE__ */ React11.createElement(BiBootstrapReboot, null)
605
719
  },
606
720
  {
607
721
  type: "tryCatch",
608
722
  schemaType: "tryCatch",
609
723
  label: "TryCatch",
610
- icon: /* @__PURE__ */ React9.createElement(IconParkRightBranch, null),
724
+ icon: /* @__PURE__ */ React11.createElement(IconParkRightBranch, null),
611
725
  blocks() {
612
726
  return [
613
727
  {
614
- id: `try_${nanoid2(5)}`
728
+ id: `try_${nanoid3(5)}`
615
729
  // try branch
616
730
  },
617
731
  {
618
- id: `catch_${nanoid2(5)}`
732
+ id: `catch_${nanoid3(5)}`
619
733
  // catch branch 1
620
734
  },
621
735
  {
622
- id: `catch_${nanoid2(5)}`
736
+ id: `catch_${nanoid3(5)}`
623
737
  // catch branch 2
624
738
  }
625
739
  ];
@@ -628,12 +742,12 @@ var metadata = {
628
742
  {
629
743
  type: "noop",
630
744
  label: "Noop Node",
631
- icon: /* @__PURE__ */ React9.createElement(BiCloud, null)
745
+ icon: /* @__PURE__ */ React11.createElement(BiCloud, null)
632
746
  },
633
747
  {
634
748
  type: "end",
635
749
  label: "End",
636
- icon: /* @__PURE__ */ React9.createElement(PhCircleBold, null)
750
+ icon: /* @__PURE__ */ React11.createElement(PhCircleBold, null)
637
751
  }
638
752
  ],
639
753
  find: function find(type) {
@@ -672,13 +786,13 @@ var NodesWrap = styled6.div`
672
786
 
673
787
  // src/components/nodes/index.tsx
674
788
  function Node(props) {
675
- return /* @__PURE__ */ React10.createElement(NodeWrap, { onClick: props.onClick }, /* @__PURE__ */ React10.createElement("div", { style: { fontSize: 14 } }, props.icon), /* @__PURE__ */ React10.createElement(NodeLabel, null, props.label));
789
+ return /* @__PURE__ */ React12.createElement(NodeWrap, { onClick: props.onClick }, /* @__PURE__ */ React12.createElement("div", { style: { fontSize: 14 } }, props.icon), /* @__PURE__ */ React12.createElement(NodeLabel, null, props.label));
676
790
  }
677
791
  var addings = metadata_default.nodes.filter((node) => node.type !== "start");
678
792
  function Nodes(props) {
679
- return /* @__PURE__ */ React10.createElement(NodesWrap, { style: { width: 80 * 2 + 20 } }, addings.map((n, i) => (
793
+ return /* @__PURE__ */ React12.createElement(NodesWrap, { style: { width: 80 * 2 + 20 } }, addings.map((n, i) => (
680
794
  // eslint-disable-next-line react/no-array-index-key
681
- /* @__PURE__ */ React10.createElement(Node, { key: i, icon: n.icon, label: n.label, onClick: () => props.onSelect?.(n) })
795
+ /* @__PURE__ */ React12.createElement(Node, { key: i, icon: n.icon, label: n.label, onClick: () => props.onSelect?.(n) })
682
796
  )));
683
797
  }
684
798
 
@@ -696,7 +810,7 @@ var AdderWrap = styled7.div`
696
810
  justify-content: center;
697
811
  cursor: pointer;
698
812
  `;
699
- var IconPlus2 = styled7(IconPlusCircle)`
813
+ var IconPlus3 = styled7(IconPlusCircle)`
700
814
  color: #3370ff;
701
815
  background-color: #fff;
702
816
  border-radius: 15px;
@@ -705,36 +819,36 @@ var IconPlus2 = styled7(IconPlusCircle)`
705
819
  // src/components/adder/index.tsx
706
820
  function Adder(props) {
707
821
  const { from } = props;
708
- const [visible, setVisible] = useState2(false);
709
- const playground = usePlayground2();
710
- const flowOperationService = useService2(FlowOperationService2);
822
+ const [visible, setVisible] = useState3(false);
823
+ const playground = usePlayground5();
824
+ const flowOperationService = useService3(FlowOperationService2);
711
825
  const add = (addProps) => {
712
826
  const block = flowOperationService.addFromNode(from, {
713
- id: addProps.type + nanoid3(5),
827
+ id: addProps.type + nanoid4(5),
714
828
  type: addProps.type,
715
829
  blocks: addProps.blocks ? addProps.blocks() : void 0
716
830
  });
717
831
  setTimeout(() => {
718
832
  playground.scrollToView({
719
- bounds: block.getData(FlowNodeTransformData5).bounds,
833
+ bounds: block.getData(FlowNodeTransformData6).bounds,
720
834
  scrollToCenter: true
721
835
  });
722
836
  }, 10);
723
837
  };
724
838
  if (playground.config.readonlyOrDisabled) return null;
725
- return /* @__PURE__ */ React11.createElement(
839
+ return /* @__PURE__ */ React13.createElement(
726
840
  Popover,
727
841
  {
728
842
  visible,
729
843
  onVisibleChange: setVisible,
730
- content: /* @__PURE__ */ React11.createElement(Nodes, { onSelect: add }),
844
+ content: /* @__PURE__ */ React13.createElement(Nodes, { onSelect: add }),
731
845
  placement: "right",
732
846
  trigger: "click",
733
847
  overlayStyle: {
734
848
  padding: 0
735
849
  }
736
850
  },
737
- /* @__PURE__ */ React11.createElement(
851
+ /* @__PURE__ */ React13.createElement(
738
852
  AdderWrap,
739
853
  {
740
854
  hovered: props.hoverActivated,
@@ -743,7 +857,7 @@ function Adder(props) {
743
857
  setVisible(true);
744
858
  }
745
859
  },
746
- props.hoverActivated ? /* @__PURE__ */ React11.createElement(IconPlus2, null) : null
860
+ props.hoverActivated ? /* @__PURE__ */ React13.createElement(IconPlus3, null) : null
747
861
  )
748
862
  );
749
863
  }
@@ -757,18 +871,20 @@ var defaultFixedSemiMaterials = {
757
871
  [FlowRendererKey.DRAG_NODE]: DragNode,
758
872
  [FlowRendererKey.DRAGGABLE_ADDER]: DraggingAdder,
759
873
  [FlowRendererKey.DRAG_HIGHLIGHT_ADDER]: DragHighlightAdder,
760
- [FlowRendererKey.DRAG_BRANCH_HIGHLIGHT_ADDER]: Ellipse
874
+ [FlowRendererKey.DRAG_BRANCH_HIGHLIGHT_ADDER]: Ellipse,
875
+ [FlowRendererKey.SLOT_COLLAPSE]: SlotCollapse,
876
+ [FlowRendererKey.SLOT_ADDER]: SlotAdder
761
877
  };
762
878
 
763
879
  // src/components/tools.tsx
764
- import React12 from "react";
880
+ import React14 from "react";
765
881
  import { usePlaygroundTools } from "@flowgram.ai/fixed-layout-editor";
766
882
  import { Checkbox, IconButton, Space, Tooltip } from "@douyinfe/semi-ui";
767
883
  import { IconUndo, IconRedo, IconShrink, IconExpand, IconGridView } from "@douyinfe/semi-icons";
768
884
  var PlaygroundTools = ({ layoutText }) => {
769
885
  const tools = usePlaygroundTools();
770
886
  const { zoom } = tools;
771
- return /* @__PURE__ */ React12.createElement(Space, null, /* @__PURE__ */ React12.createElement(Checkbox, { onChange: () => tools.changeLayout(), checked: !tools.isVertical }, layoutText || "isHorizontal"), /* @__PURE__ */ React12.createElement(Tooltip, { content: "fit view" }, /* @__PURE__ */ React12.createElement(IconButton, { icon: /* @__PURE__ */ React12.createElement(IconGridView, null), onClick: () => tools.fitView() })), /* @__PURE__ */ React12.createElement(Tooltip, { content: "zoom out" }, /* @__PURE__ */ React12.createElement(IconButton, { icon: /* @__PURE__ */ React12.createElement(IconShrink, null), onClick: () => tools.zoomout() })), /* @__PURE__ */ React12.createElement(Tooltip, { content: "zoom in" }, /* @__PURE__ */ React12.createElement(IconButton, { icon: /* @__PURE__ */ React12.createElement(IconExpand, null), onClick: () => tools.zoomin() })), /* @__PURE__ */ React12.createElement(Tooltip, { content: "undo" }, /* @__PURE__ */ React12.createElement(IconButton, { icon: /* @__PURE__ */ React12.createElement(IconUndo, null), disabled: tools.canUndo, onClick: () => tools.undo() })), /* @__PURE__ */ React12.createElement(Tooltip, { content: "redo" }, /* @__PURE__ */ React12.createElement(IconButton, { icon: /* @__PURE__ */ React12.createElement(IconRedo, null), disabled: tools.canRedo, onClick: () => tools.redo() })), /* @__PURE__ */ React12.createElement("span", null, Math.floor(zoom * 100), "%"));
887
+ return /* @__PURE__ */ React14.createElement(Space, null, /* @__PURE__ */ React14.createElement(Checkbox, { onChange: () => tools.changeLayout(), checked: !tools.isVertical }, layoutText || "isHorizontal"), /* @__PURE__ */ React14.createElement(Tooltip, { content: "fit view" }, /* @__PURE__ */ React14.createElement(IconButton, { icon: /* @__PURE__ */ React14.createElement(IconGridView, null), onClick: () => tools.fitView() })), /* @__PURE__ */ React14.createElement(Tooltip, { content: "zoom out" }, /* @__PURE__ */ React14.createElement(IconButton, { icon: /* @__PURE__ */ React14.createElement(IconShrink, null), onClick: () => tools.zoomout() })), /* @__PURE__ */ React14.createElement(Tooltip, { content: "zoom in" }, /* @__PURE__ */ React14.createElement(IconButton, { icon: /* @__PURE__ */ React14.createElement(IconExpand, null), onClick: () => tools.zoomin() })), /* @__PURE__ */ React14.createElement(Tooltip, { content: "undo" }, /* @__PURE__ */ React14.createElement(IconButton, { icon: /* @__PURE__ */ React14.createElement(IconUndo, null), disabled: tools.canUndo, onClick: () => tools.undo() })), /* @__PURE__ */ React14.createElement(Tooltip, { content: "redo" }, /* @__PURE__ */ React14.createElement(IconButton, { icon: /* @__PURE__ */ React14.createElement(IconRedo, null), disabled: tools.canRedo, onClick: () => tools.redo() })), /* @__PURE__ */ React14.createElement("span", null, Math.floor(zoom * 100), "%"));
772
888
  };
773
889
  export {
774
890
  PlaygroundTools,