@ottocode/web-sdk 0.1.251 → 0.1.252

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":"AAkmBA,eAAO,MAAM,eAAe,8CAmM1B,CAAC"}
@@ -1002,10 +1002,26 @@ 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
+ }
1009
1025
  function resolveInitialPreferences() {
1010
1026
  if (typeof window === "undefined") {
1011
1027
  return DEFAULT_STORED_PREFERENCES;
@@ -1016,7 +1032,8 @@ function resolveInitialPreferences() {
1016
1032
  const parsed = JSON.parse(stored);
1017
1033
  return {
1018
1034
  vimMode: typeof parsed.vimMode === "boolean" ? parsed.vimMode : DEFAULT_STORED_PREFERENCES.vimMode,
1019
- compactThread: typeof parsed.compactThread === "boolean" ? parsed.compactThread : DEFAULT_STORED_PREFERENCES.compactThread
1035
+ compactThread: typeof parsed.compactThread === "boolean" ? parsed.compactThread : DEFAULT_STORED_PREFERENCES.compactThread,
1036
+ fontFamily: typeof parsed.fontFamily === "string" && parsed.fontFamily.trim() ? parsed.fontFamily.trim() : DEFAULT_STORED_PREFERENCES.fontFamily
1020
1037
  };
1021
1038
  }
1022
1039
  } catch (error) {
@@ -1025,6 +1042,7 @@ function resolveInitialPreferences() {
1025
1042
  return DEFAULT_STORED_PREFERENCES;
1026
1043
  }
1027
1044
  var preferences = resolveInitialPreferences();
1045
+ applyFontFamily(preferences.fontFamily);
1028
1046
  var listeners = new Set;
1029
1047
  function getSnapshot() {
1030
1048
  return preferences;
@@ -1043,6 +1061,9 @@ function notifyListeners() {
1043
1061
  }
1044
1062
  function updateStore(updates) {
1045
1063
  preferences = { ...preferences, ...updates };
1064
+ if (updates.fontFamily !== undefined) {
1065
+ applyFontFamily(preferences.fontFamily);
1066
+ }
1046
1067
  if (typeof window !== "undefined") {
1047
1068
  try {
1048
1069
  window.localStorage.setItem(STORAGE_KEY, JSON.stringify(preferences));
@@ -1064,6 +1085,9 @@ function usePreferences() {
1064
1085
  if (updates.compactThread !== undefined) {
1065
1086
  localUpdates.compactThread = updates.compactThread;
1066
1087
  }
1088
+ if (updates.fontFamily !== undefined) {
1089
+ localUpdates.fontFamily = updates.fontFamily.trim() || DEFAULT_FONT_FAMILY;
1090
+ }
1067
1091
  if (Object.keys(localUpdates).length > 0) {
1068
1092
  updateStore(localUpdates);
1069
1093
  }
@@ -5163,4 +5187,4 @@ export {
5163
5187
  sessionsQueryKey
5164
5188
  };
5165
5189
 
5166
- //# debugId=AC1E195573DAB91964756E2164756E21
5190
+ //# debugId=6A34A3634A4D977664756E2164756E21