@octaviaflow/core 3.1.0-beta.106 → 3.1.0-beta.107

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/index.js CHANGED
@@ -34996,6 +34996,7 @@ function ExpressionField({
34996
34996
  CallEditor,
34997
34997
  {
34998
34998
  raw: editing.raw,
34999
+ anchor: editing.el,
34999
35000
  rect: editing.rect,
35000
35001
  nameOf: callLabel,
35001
35002
  labelFor,
@@ -35010,6 +35011,7 @@ function ExpressionField({
35010
35011
  }
35011
35012
  function CallEditor({
35012
35013
  raw,
35014
+ anchor,
35013
35015
  rect,
35014
35016
  nameOf,
35015
35017
  labelFor,
@@ -35021,13 +35023,27 @@ function CallEditor({
35021
35023
  const [path, setPath] = useState71([]);
35022
35024
  const [rawMode, setRawMode] = useState71(false);
35023
35025
  const panelRef = useRef50(null);
35026
+ const onApplyRef = useRef50(onApply);
35027
+ onApplyRef.current = onApply;
35028
+ const draftRef = useRef50(draft);
35029
+ draftRef.current = draft;
35024
35030
  useEffect56(() => {
35025
35031
  const onKey = (e) => {
35026
35032
  if (e.key === "Escape") onCancel();
35027
35033
  };
35034
+ const onPointerDown = (e) => {
35035
+ const target = e.target;
35036
+ if (panelRef.current?.contains(target)) return;
35037
+ if (anchor.contains(target)) return;
35038
+ onApplyRef.current(draftRef.current);
35039
+ };
35028
35040
  document.addEventListener("keydown", onKey);
35029
- return () => document.removeEventListener("keydown", onKey);
35030
- }, [onCancel]);
35041
+ document.addEventListener("mousedown", onPointerDown, true);
35042
+ return () => {
35043
+ document.removeEventListener("keydown", onKey);
35044
+ document.removeEventListener("mousedown", onPointerDown, true);
35045
+ };
35046
+ }, [anchor, onCancel]);
35031
35047
  const current = callAt(draft, path);
35032
35048
  const signature = current ? resolveCall?.(current.name) : void 0;
35033
35049
  const names = signature?.args ?? [];