dsh-modellix 0.2.0 → 0.3.0

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/lib/client.js CHANGED
@@ -800,6 +800,19 @@ var SettingsController = class extends ResourceController {
800
800
  load(signal) {
801
801
  return this.perform("load", () => this.#rpc.settings(signal));
802
802
  }
803
+ async refresh(signal) {
804
+ const previous = this.store.getSnapshot();
805
+ if (previous.data === null) return this.load(signal);
806
+ if (previous.pending !== null) return false;
807
+ try {
808
+ const data = await this.#rpc.settings(signal);
809
+ if (this.store.getSnapshot() !== previous) return false;
810
+ this.publishData(data);
811
+ return true;
812
+ } catch {
813
+ return false;
814
+ }
815
+ }
803
816
  saveOnboarding(apiKey, services, expectedCredentialEpoch, signal) {
804
817
  return this.perform("save-onboarding", () => this.#rpc.saveOnboarding(apiKey, services, expectedCredentialEpoch, signal));
805
818
  }
@@ -969,10 +982,14 @@ function useExternalDialogGate(requestedOpen, externalDialogOwner) {
969
982
  }
970
983
  /** Adds the focus behavior intentionally absent from the public Modal primitive. */
971
984
  function useDialogA11y(options) {
972
- const { open, container, externalDialogOwner, initialFocusSelector, mandatory, onEscape } = options;
985
+ const { open, requestedOpen = open, container, externalDialogOwner, initialFocusSelector, mandatory, onEscape } = options;
973
986
  const onEscapeRef = (0, react.useRef)(onEscape);
974
987
  const restoreTargetRef = (0, react.useRef)(null);
975
988
  onEscapeRef.current = onEscape;
989
+ (0, react.useEffect)(() => {
990
+ if (!requestedOpen || typeof document === "undefined") return;
991
+ restoreTargetRef.current ??= document.activeElement instanceof HTMLElement ? document.activeElement : null;
992
+ }, [requestedOpen]);
976
993
  (0, react.useEffect)(() => {
977
994
  if (!open || typeof document === "undefined") return;
978
995
  const activeBeforeOpen = document.activeElement instanceof HTMLElement ? document.activeElement : null;
@@ -1306,6 +1323,7 @@ function CredentialModal(props) {
1306
1323
  }, [clear, onCancel]);
1307
1324
  useDialogA11y({
1308
1325
  open: surfaceOpen,
1326
+ requestedOpen: open,
1309
1327
  container: contentRef,
1310
1328
  externalDialogOwner,
1311
1329
  initialFocusSelector: "[data-mdlx-initial-focus]",
@@ -1786,16 +1804,20 @@ function CredentialRecoveryOverlay({ controller, t }) {
1786
1804
  recoveryToken
1787
1805
  ]);
1788
1806
  (0, react.useEffect)(() => {
1789
- if (recoveryPresented) return;
1807
+ if (recoveryPresented || dialog.activeOwner !== null) return;
1790
1808
  const refresh = () => {
1791
1809
  const current = controller.store.getSnapshot();
1792
1810
  if (current.pending !== null || current.status === "loading") return;
1793
- controller.load();
1811
+ controller.refresh();
1794
1812
  };
1795
1813
  refresh();
1796
1814
  const timer = window.setInterval(refresh, RECOVERY_REFRESH_MS);
1797
1815
  return () => window.clearInterval(timer);
1798
- }, [controller, recoveryPresented]);
1816
+ }, [
1817
+ controller,
1818
+ dialog.activeOwner,
1819
+ recoveryPresented
1820
+ ]);
1799
1821
  (0, react.useEffect)(() => () => dialogCoordinator.release(RECOVERY_CREDENTIAL_DIALOG_OWNER), [dialogCoordinator]);
1800
1822
  const dismiss = (0, react.useCallback)(() => {
1801
1823
  dialogCoordinator.dismissCredential(RECOVERY_CREDENTIAL_DIALOG_OWNER);
@@ -2835,7 +2857,6 @@ function ResultResource({ resource, dateLocale, dialogCoordinator, dialog, onAdd
2835
2857
  }), resource.kind === "image" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
2836
2858
  open: imageSurfaceOpen,
2837
2859
  title: t("imageViewerTitle"),
2838
- closeLabel: t("close"),
2839
2860
  onClose: closeImage,
2840
2861
  headless: true,
2841
2862
  className: "mdlx-modal mdlx-image-modal",
@@ -3457,7 +3478,6 @@ function ModellixMediaToolView({ block, drawer, inputActions, sessionId, t, useI
3457
3478
  }), succeeded && current?.kind === "image" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
3458
3479
  open: imageSurfaceOpen,
3459
3480
  title: t("imageViewerTitle"),
3460
- closeLabel: t("close"),
3461
3481
  onClose: closeImage,
3462
3482
  headless: true,
3463
3483
  className: "mdlx-modal mdlx-image-modal",
@@ -4241,7 +4261,6 @@ function RemoveCredentialDialog({ open, busy, errorCode, onClose, onConfirm, t,
4241
4261
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
4242
4262
  open: surfaceOpen,
4243
4263
  title: t("removeTitle"),
4244
- closeLabel: t("cancel"),
4245
4264
  onClose,
4246
4265
  headless: true,
4247
4266
  className: "mdlx-modal mdlx-modal-confirm",