@octaviaflow/core 3.0.18-beta.24 → 3.0.18-beta.26

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/workflow.js CHANGED
@@ -619,18 +619,15 @@ function ConfigPanel({
619
619
 
620
620
  // src/workflow/components/FxPanel/FxPanel.tsx
621
621
  import {
622
- useEffect as useEffect3,
623
622
  useMemo as useMemo2,
624
623
  useRef as useRef4,
625
624
  useState as useState4
626
625
  } from "react";
627
626
  import {
628
- CheckmarkIcon,
629
627
  ChevronDownIcon,
630
628
  ChevronRightIcon,
631
629
  CloseIcon,
632
630
  CollapseAllIcon,
633
- CopyIcon,
634
631
  DraggableIcon,
635
632
  ExpandAllIcon,
636
633
  SearchIcon
@@ -747,15 +744,7 @@ function FxPanel({
747
744
  });
748
745
  };
749
746
  const [draggingId, setDraggingId] = useState4(null);
750
- const [copiedId, setCopiedId] = useState4(null);
751
747
  const [focusedId, setFocusedId] = useState4(null);
752
- const copyTimer = useRef4(null);
753
- useEffect3(
754
- () => () => {
755
- if (copyTimer.current) clearTimeout(copyTimer.current);
756
- },
757
- []
758
- );
759
748
  const hits = useMemo2(() => {
760
749
  if (!query) return null;
761
750
  const all = [];
@@ -780,13 +769,6 @@ function FxPanel({
780
769
  e.dataTransfer.effectAllowed = "copy";
781
770
  }
782
771
  };
783
- const handleCopy = (item) => {
784
- if (!item.insertValue || typeof navigator === "undefined") return;
785
- void navigator.clipboard?.writeText(item.insertValue);
786
- setCopiedId(item.id);
787
- if (copyTimer.current) clearTimeout(copyTimer.current);
788
- copyTimer.current = setTimeout(() => setCopiedId(null), 1400);
789
- };
790
772
  const listRef = useRef4(null);
791
773
  const focusRow = (id) => {
792
774
  setFocusedId(id);
@@ -794,7 +776,7 @@ function FxPanel({
794
776
  listRef.current?.querySelector(`[data-fx-row="${CSS.escape(id)}"]`)?.focus();
795
777
  });
796
778
  };
797
- const onRowKeyDown = (e, rows, row) => {
779
+ const onRowKeyDown = (e, rows, row, category) => {
798
780
  const idx = rows.findIndex((r) => r.item.id === row.item.id);
799
781
  if (idx < 0) return;
800
782
  switch (e.key) {
@@ -839,16 +821,22 @@ function FxPanel({
839
821
  case " ":
840
822
  e.preventDefault();
841
823
  if (row.hasChildren) toggleItem(row.item.id);
842
- else {
843
- const cat = visibleCategories.find((c) => c.id === openCategoryId);
844
- if (cat) onItemSelect?.(row.item, cat);
845
- }
824
+ else onItemSelect?.(row.item, category);
846
825
  break;
847
826
  default:
848
827
  break;
849
828
  }
850
829
  };
851
- const renderRow = (row, category, rows, opts = {}) => {
830
+ const searchRows = useMemo2(
831
+ () => hits ? hits.map(({ hit }) => ({
832
+ item: hit.item,
833
+ depth: 0,
834
+ hasChildren: false,
835
+ expanded: false
836
+ })) : [],
837
+ [hits]
838
+ );
839
+ const renderRow = (row, category, rows, crumb) => {
852
840
  const { item, depth, hasChildren, expanded } = row;
853
841
  const mono = category.kind === "function";
854
842
  const draggable = !!item.insertValue;
@@ -871,7 +859,7 @@ function FxPanel({
871
859
  onDragStart: draggable ? handleDragStart(item, category) : void 0,
872
860
  onDragEnd: () => setDraggingId(null),
873
861
  onFocus: () => setFocusedId(item.id),
874
- onKeyDown: opts.searching ? void 0 : (e) => onRowKeyDown(e, rows, row),
862
+ onKeyDown: (e) => onRowKeyDown(e, rows, row, category),
875
863
  onClick: () => {
876
864
  if (hasChildren) toggleItem(item.id);
877
865
  else onItemSelect?.(item, category);
@@ -892,27 +880,13 @@ function FxPanel({
892
880
  ),
893
881
  children: item.valueType
894
882
  }
895
- ),
896
- item.preview !== void 0 && /* @__PURE__ */ jsx2("span", { className: "ods-flow-fx-panel__preview", title: item.preview, children: item.preview })
883
+ )
897
884
  ] }),
898
- (item.description || opts.crumb) && /* @__PURE__ */ jsxs2("span", { className: "ods-flow-fx-panel__row-sub", children: [
899
- opts.crumb && /* @__PURE__ */ jsx2("span", { className: "ods-flow-fx-panel__crumb", children: opts.crumb }),
885
+ (item.description || crumb) && /* @__PURE__ */ jsxs2("span", { className: "ods-flow-fx-panel__row-sub", children: [
886
+ crumb && /* @__PURE__ */ jsx2("span", { className: "ods-flow-fx-panel__crumb", children: crumb }),
900
887
  item.description
901
888
  ] })
902
- ] }),
903
- item.insertValue && /* @__PURE__ */ jsx2(
904
- "button",
905
- {
906
- type: "button",
907
- className: "ods-flow-fx-panel__copy",
908
- "aria-label": `Copy ${item.label}`,
909
- onClick: (e) => {
910
- e.stopPropagation();
911
- handleCopy(item);
912
- },
913
- children: copiedId === item.id ? /* @__PURE__ */ jsx2(CheckmarkIcon, { size: "sm" }) : /* @__PURE__ */ jsx2(CopyIcon, { size: "sm" })
914
- }
915
- )
889
+ ] })
916
890
  ]
917
891
  },
918
892
  item.id
@@ -971,19 +945,11 @@ function FxPanel({
971
945
  hits.length === 1 ? "match" : "matches"
972
946
  ] }),
973
947
  hits.map(
974
- ({ category, hit }) => renderRow(
975
- { item: hit.item, depth: 0, hasChildren: false, expanded: false },
948
+ ({ category, hit }, i) => renderRow(
949
+ searchRows[i],
976
950
  category,
977
- hits.map((h) => ({
978
- item: h.hit.item,
979
- depth: 0,
980
- hasChildren: false,
981
- expanded: false
982
- })),
983
- {
984
- searching: true,
985
- crumb: hit.ancestors.length ? hit.ancestors.join(" / ") : category.label
986
- }
951
+ searchRows,
952
+ hit.ancestors.length ? hit.ancestors.join(" / ") : category.label
987
953
  )
988
954
  )
989
955
  ] }) : /* @__PURE__ */ jsx2("div", { className: "ods-flow-fx-panel__empty", children: emptyLabel })),