@ottocode/web-sdk 0.1.251 → 0.1.253

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/settings/SettingsSidebar.tsx"],"names":[],"mappings":"AA6QA,eAAO,MAAM,eAAe,8CAoR1B,CAAC"}
1
+ {"version":3,"file":"SettingsSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/settings/SettingsSidebar.tsx"],"names":[],"mappings":"AA2pBA,eAAO,MAAM,eAAe,8CAmM1B,CAAC"}
@@ -1002,10 +1002,29 @@ function useUpdateDefaults() {
1002
1002
  // src/hooks/usePreferences.ts
1003
1003
  import { useCallback, useMemo, useSyncExternalStore } from "react";
1004
1004
  var STORAGE_KEY = "otto-preferences";
1005
+ var DEFAULT_FONT_FAMILY = "IBM Plex Mono";
1005
1006
  var DEFAULT_STORED_PREFERENCES = {
1006
1007
  vimMode: false,
1007
- compactThread: true
1008
+ compactThread: true,
1009
+ fontFamily: DEFAULT_FONT_FAMILY
1008
1010
  };
1011
+ function cssFontFamily(fontFamily) {
1012
+ const trimmed = fontFamily.trim();
1013
+ if (!trimmed || trimmed === DEFAULT_FONT_FAMILY) {
1014
+ return `"${DEFAULT_FONT_FAMILY}", monospace`;
1015
+ }
1016
+ return `"${trimmed.replaceAll('"', "\\\"")}", "${DEFAULT_FONT_FAMILY}", monospace`;
1017
+ }
1018
+ function applyFontFamily(fontFamily) {
1019
+ if (typeof document === "undefined") {
1020
+ return;
1021
+ }
1022
+ document.documentElement.style.setProperty("--otto-font-family", cssFontFamily(fontFamily));
1023
+ document.documentElement.dataset.ottoFontFamily = fontFamily;
1024
+ if (window.self !== window.top) {
1025
+ window.parent.postMessage({ type: "otto-font-family-changed", fontFamily }, "*");
1026
+ }
1027
+ }
1009
1028
  function resolveInitialPreferences() {
1010
1029
  if (typeof window === "undefined") {
1011
1030
  return DEFAULT_STORED_PREFERENCES;
@@ -1016,7 +1035,8 @@ function resolveInitialPreferences() {
1016
1035
  const parsed = JSON.parse(stored);
1017
1036
  return {
1018
1037
  vimMode: typeof parsed.vimMode === "boolean" ? parsed.vimMode : DEFAULT_STORED_PREFERENCES.vimMode,
1019
- compactThread: typeof parsed.compactThread === "boolean" ? parsed.compactThread : DEFAULT_STORED_PREFERENCES.compactThread
1038
+ compactThread: typeof parsed.compactThread === "boolean" ? parsed.compactThread : DEFAULT_STORED_PREFERENCES.compactThread,
1039
+ fontFamily: typeof parsed.fontFamily === "string" && parsed.fontFamily.trim() ? parsed.fontFamily.trim() : DEFAULT_STORED_PREFERENCES.fontFamily
1020
1040
  };
1021
1041
  }
1022
1042
  } catch (error) {
@@ -1025,6 +1045,7 @@ function resolveInitialPreferences() {
1025
1045
  return DEFAULT_STORED_PREFERENCES;
1026
1046
  }
1027
1047
  var preferences = resolveInitialPreferences();
1048
+ applyFontFamily(preferences.fontFamily);
1028
1049
  var listeners = new Set;
1029
1050
  function getSnapshot() {
1030
1051
  return preferences;
@@ -1043,6 +1064,9 @@ function notifyListeners() {
1043
1064
  }
1044
1065
  function updateStore(updates) {
1045
1066
  preferences = { ...preferences, ...updates };
1067
+ if (updates.fontFamily !== undefined) {
1068
+ applyFontFamily(preferences.fontFamily);
1069
+ }
1046
1070
  if (typeof window !== "undefined") {
1047
1071
  try {
1048
1072
  window.localStorage.setItem(STORAGE_KEY, JSON.stringify(preferences));
@@ -1064,6 +1088,9 @@ function usePreferences() {
1064
1088
  if (updates.compactThread !== undefined) {
1065
1089
  localUpdates.compactThread = updates.compactThread;
1066
1090
  }
1091
+ if (updates.fontFamily !== undefined) {
1092
+ localUpdates.fontFamily = updates.fontFamily.trim() || DEFAULT_FONT_FAMILY;
1093
+ }
1067
1094
  if (Object.keys(localUpdates).length > 0) {
1068
1095
  updateStore(localUpdates);
1069
1096
  }
@@ -5163,4 +5190,4 @@ export {
5163
5190
  sessionsQueryKey
5164
5191
  };
5165
5192
 
5166
- //# debugId=AC1E195573DAB91964756E2164756E21
5193
+ //# debugId=511FD091641EF49C64756E2164756E21