@octaviaflow/core 3.1.0-beta.104 → 3.1.0-beta.105

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
@@ -34711,8 +34711,18 @@ function ExpressionField({
34711
34711
  } else {
34712
34712
  el.className = CHIP;
34713
34713
  el.setAttribute("data-call", segment.name);
34714
- el.textContent = chipText(segment.name, segment.args);
34715
34714
  el.title = segment.raw;
34715
+ const text = document.createElement("span");
34716
+ text.className = "ods-expression-field__chip-text";
34717
+ text.textContent = chipText(segment.name, segment.args);
34718
+ el.appendChild(text);
34719
+ const open = document.createElement("span");
34720
+ open.className = "ods-expression-field__chip-open";
34721
+ open.setAttribute("data-open", "true");
34722
+ open.setAttribute("role", "button");
34723
+ open.setAttribute("aria-label", "Edit arguments");
34724
+ open.textContent = "\u2304";
34725
+ el.appendChild(open);
34716
34726
  }
34717
34727
  return el;
34718
34728
  },
@@ -34837,7 +34847,9 @@ function ExpressionField({
34837
34847
  const call = parseCall(raw);
34838
34848
  if (!call) return;
34839
34849
  editing.el.setAttribute("data-value", raw);
34840
- editing.el.textContent = chipText(call.name, call.args);
34850
+ const text = editing.el.querySelector(".ods-expression-field__chip-text");
34851
+ if (text) text.textContent = chipText(call.name, call.args);
34852
+ else editing.el.textContent = chipText(call.name, call.args);
34841
34853
  editing.el.title = raw;
34842
34854
  setEditing(null);
34843
34855
  commit();
@@ -34847,12 +34859,13 @@ function ExpressionField({
34847
34859
  );
34848
34860
  const handleClick = useCallback50(
34849
34861
  (e) => {
34850
- const target = e.target.closest(`.${PILL}, .${CHIP}`);
34862
+ const node = e.target;
34863
+ const target = node.closest(`.${PILL}, .${CHIP}`);
34851
34864
  if (!target) return;
34852
- selectToken(target);
34853
- if (!disabled && target.classList.contains(CHIP) && e.detail >= 2) {
34854
- openEditor(target);
34855
- }
34865
+ const chipEl = target;
34866
+ const wantsEditor = chipEl.classList.contains(CHIP) && (!!node.closest("[data-open]") || e.detail >= 2);
34867
+ selectToken(chipEl);
34868
+ if (!disabled && wantsEditor) openEditor(chipEl);
34856
34869
  },
34857
34870
  [disabled, openEditor, selectToken]
34858
34871
  );