@tangle-network/agent-app 1.0.23 → 1.0.25

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.
@@ -202,9 +202,17 @@ function useSectionScroll(activeId, rootRef) {
202
202
  };
203
203
  if (!reveal() && !first.current) rootRef.current?.scrollIntoView({ block: "start" });
204
204
  first.current = false;
205
+ const pending = readHash();
206
+ const watch = pending && !document.getElementById(pending) ? new MutationObserver(() => {
207
+ if (readHash() === pending && reveal()) watch?.disconnect();
208
+ }) : null;
209
+ watch?.observe(document.body, { childList: true, subtree: true });
205
210
  const onHash = () => void reveal();
206
211
  window.addEventListener("hashchange", onHash);
207
- return () => window.removeEventListener("hashchange", onHash);
212
+ return () => {
213
+ watch?.disconnect();
214
+ window.removeEventListener("hashchange", onHash);
215
+ };
208
216
  }, [activeId, rootRef]);
209
217
  }
210
218
  function useDelayed(pending) {
@@ -693,6 +701,7 @@ var STICKY_GROUP = "sticky bottom-3 z-10 shadow-[var(--shadow-dropdown)]";
693
701
  function SettingsSaveBar({
694
702
  changes,
695
703
  summary,
704
+ invalid,
696
705
  onDiscard,
697
706
  onSave,
698
707
  state,
@@ -711,12 +720,13 @@ function SettingsSaveBar({
711
720
  return () => clearTimeout(timer);
712
721
  }, [state]);
713
722
  const refused = state === "failed" && error != null;
723
+ const blocked = invalid != null && changes > 0;
714
724
  const message = disabledReason != null ? /* @__PURE__ */ jsxs4("span", { className: "flex items-start gap-1.5 text-muted-foreground", children: [
715
725
  /* @__PURE__ */ jsx5(Lock, { "aria-hidden": "true", className: "mt-0.5 size-4 shrink-0" }),
716
726
  /* @__PURE__ */ jsx5("span", { className: "min-w-0", children: disabledReason })
717
- ] }) : refused ? /* @__PURE__ */ jsxs4("span", { role: "alert", className: "flex items-start gap-1.5 text-[var(--surface-danger-text)]", children: [
727
+ ] }) : refused || blocked ? /* @__PURE__ */ jsxs4("span", { role: refused ? "alert" : void 0, className: "flex items-start gap-1.5 text-[var(--surface-danger-text)]", children: [
718
728
  /* @__PURE__ */ jsx5(CircleAlert2, { "aria-hidden": "true", className: "mt-0.5 size-4 shrink-0" }),
719
- /* @__PURE__ */ jsx5("span", { className: "min-w-0 [overflow-wrap:anywhere]", children: error })
729
+ /* @__PURE__ */ jsx5("span", { className: "min-w-0 [overflow-wrap:anywhere]", children: refused ? error : invalid })
720
730
  ] }) : summary ?? (dirty ? /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: changes === 1 ? "1 unsaved change" : `${changes} unsaved changes` }) : showSaved ? /* @__PURE__ */ jsx5(SavedStatus, {}) : /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: "No unsaved changes" }));
721
731
  const reporting = dirty || refused || showSaved || state === "saved" && summary != null;
722
732
  const sticky = reporting && disabledReason == null;
@@ -732,7 +742,7 @@ function SettingsSaveBar({
732
742
  /* @__PURE__ */ jsx5("div", { "aria-live": "polite", className: "min-w-0 text-sm", children: message }),
733
743
  disabledReason == null && /* @__PURE__ */ jsxs4("div", { className: "ml-auto flex shrink-0 gap-2", children: [
734
744
  dirty && /* @__PURE__ */ jsx5(Button3, { type: "button", variant: "ghost", disabled: saving, onClick: onDiscard, children: "Discard" }),
735
- /* @__PURE__ */ jsx5(Button3, { type: "button", variant: dirty ? "default" : "outline", disabled: !dirty || saving, loading: saving, onClick: onSave, children: saveLabel })
745
+ /* @__PURE__ */ jsx5(Button3, { type: "button", variant: dirty ? "default" : "outline", disabled: !dirty || saving || invalid != null, loading: saving, onClick: onSave, children: saveLabel })
736
746
  ] })
737
747
  ]
738
748
  }