@xenide-io/the-old-ui-theme 0.6.12 → 0.6.13

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/suite.js CHANGED
@@ -59,6 +59,54 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
59
59
  ));
60
60
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
61
61
 
62
+ // src/suite/lib/use-lock-mobile-page-zoom.ts
63
+ function preventGesture(event) {
64
+ event.preventDefault();
65
+ }
66
+ function useLockMobilePageZoom() {
67
+ (0, import_react7.useEffect)(() => {
68
+ if (typeof window.matchMedia !== "function") return;
69
+ const media = window.matchMedia(MOBILE_PAGE_ZOOM_QUERY);
70
+ const meta = document.querySelector('meta[name="viewport"]');
71
+ const original = meta == null ? void 0 : meta.getAttribute("content");
72
+ const apply = () => {
73
+ const lock = media.matches;
74
+ document.documentElement.toggleAttribute(
75
+ "data-suite-lock-page-zoom",
76
+ lock
77
+ );
78
+ document.removeEventListener("gesturestart", preventGesture);
79
+ document.removeEventListener("gesturechange", preventGesture);
80
+ if (lock) {
81
+ meta == null ? void 0 : meta.setAttribute("content", LOCKED_VIEWPORT);
82
+ document.addEventListener("gesturestart", preventGesture);
83
+ document.addEventListener("gesturechange", preventGesture);
84
+ return;
85
+ }
86
+ if (original) meta == null ? void 0 : meta.setAttribute("content", original);
87
+ };
88
+ apply();
89
+ media.addEventListener("change", apply);
90
+ return () => {
91
+ media.removeEventListener("change", apply);
92
+ document.documentElement.removeAttribute("data-suite-lock-page-zoom");
93
+ if (original) meta == null ? void 0 : meta.setAttribute("content", original);
94
+ document.removeEventListener("gesturestart", preventGesture);
95
+ document.removeEventListener("gesturechange", preventGesture);
96
+ };
97
+ }, []);
98
+ }
99
+ var import_react7, MOBILE_PAGE_ZOOM_QUERY, LOCKED_VIEWPORT;
100
+ var init_use_lock_mobile_page_zoom = __esm({
101
+ "src/suite/lib/use-lock-mobile-page-zoom.ts"() {
102
+ "use strict";
103
+ "use client";
104
+ import_react7 = require("react");
105
+ MOBILE_PAGE_ZOOM_QUERY = "(hover: none) and (pointer: coarse)";
106
+ LOCKED_VIEWPORT = "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover";
107
+ }
108
+ });
109
+
62
110
  // src/suite/components/theme-provider.tsx
63
111
  function systemTheme(fallback) {
64
112
  if (typeof window === "undefined") return fallback;
@@ -96,7 +144,8 @@ function SuiteThemeProvider({
96
144
  config,
97
145
  children
98
146
  }) {
99
- const [state, setState] = (0, import_react7.useState)(() => {
147
+ useLockMobilePageZoom();
148
+ const [state, setState] = (0, import_react8.useState)(() => {
100
149
  const theme2 = readStoredTheme(config.storageKey);
101
150
  if (typeof document === "undefined") {
102
151
  return { theme: theme2, resolvedTheme: config.fallbackTheme };
@@ -106,10 +155,10 @@ function SuiteThemeProvider({
106
155
  return { theme: theme2, resolvedTheme: resolvedTheme2 };
107
156
  });
108
157
  const { theme, resolvedTheme } = state;
109
- (0, import_react7.useEffect)(() => {
158
+ (0, import_react8.useEffect)(() => {
110
159
  applyTheme(theme, config);
111
160
  }, [theme, config]);
112
- (0, import_react7.useEffect)(() => {
161
+ (0, import_react8.useEffect)(() => {
113
162
  if (theme !== "system") return;
114
163
  const media = window.matchMedia("(prefers-color-scheme: dark)");
115
164
  const update = () => {
@@ -119,7 +168,7 @@ function SuiteThemeProvider({
119
168
  media.addEventListener("change", update);
120
169
  return () => media.removeEventListener("change", update);
121
170
  }, [theme, config]);
122
- const setTheme = (0, import_react7.useCallback)(
171
+ const setTheme = (0, import_react8.useCallback)(
123
172
  (next) => {
124
173
  const resolved = applyTheme(next, config);
125
174
  setState({ theme: next, resolvedTheme: resolved });
@@ -127,7 +176,7 @@ function SuiteThemeProvider({
127
176
  },
128
177
  [config]
129
178
  );
130
- const toggleTheme = (0, import_react7.useCallback)(() => {
179
+ const toggleTheme = (0, import_react8.useCallback)(() => {
131
180
  setState((prev) => {
132
181
  const next = resolveTheme(prev.theme, config.fallbackTheme) === "dark" ? "light" : "dark";
133
182
  const resolved = applyTheme(next, config);
@@ -135,25 +184,26 @@ function SuiteThemeProvider({
135
184
  return { theme: next, resolvedTheme: resolved };
136
185
  });
137
186
  }, [config]);
138
- const value = (0, import_react7.useMemo)(
187
+ const value = (0, import_react8.useMemo)(
139
188
  () => ({ theme, resolvedTheme, setTheme, toggleTheme }),
140
189
  [theme, resolvedTheme, setTheme, toggleTheme]
141
190
  );
142
191
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SuiteThemeContext.Provider, { value, children });
143
192
  }
144
193
  function useSuiteTheme() {
145
- const ctx = (0, import_react7.useContext)(SuiteThemeContext);
194
+ const ctx = (0, import_react8.useContext)(SuiteThemeContext);
146
195
  if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
147
196
  return ctx;
148
197
  }
149
- var import_react7, import_jsx_runtime18, SuiteThemeContext;
198
+ var import_react8, import_jsx_runtime18, SuiteThemeContext;
150
199
  var init_theme_provider = __esm({
151
200
  "src/suite/components/theme-provider.tsx"() {
152
201
  "use strict";
153
202
  "use client";
154
- import_react7 = require("react");
203
+ import_react8 = require("react");
204
+ init_use_lock_mobile_page_zoom();
155
205
  import_jsx_runtime18 = require("react/jsx-runtime");
156
- SuiteThemeContext = (0, import_react7.createContext)(null);
206
+ SuiteThemeContext = (0, import_react8.createContext)(null);
157
207
  }
158
208
  });
159
209
 
@@ -166,8 +216,8 @@ function SuiteAiBlockNoteMessage({
166
216
  markdown
167
217
  }) {
168
218
  const { resolvedTheme } = useSuiteTheme();
169
- const editor = (0, import_react10.useCreateBlockNote)({ schema: assistantSchema });
170
- (0, import_react9.useEffect)(() => {
219
+ const editor = (0, import_react11.useCreateBlockNote)({ schema: assistantSchema });
220
+ (0, import_react10.useEffect)(() => {
171
221
  try {
172
222
  const blocks = editor.tryParseMarkdownToBlocks(markdown);
173
223
  editor.replaceBlocks(
@@ -181,7 +231,7 @@ function SuiteAiBlockNoteMessage({
181
231
  }
182
232
  }, [editor, markdown]);
183
233
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
184
- import_react10.BlockNoteViewRaw,
234
+ import_react11.BlockNoteViewRaw,
185
235
  {
186
236
  editor,
187
237
  editable: false,
@@ -197,14 +247,14 @@ function SuiteAiBlockNoteMessage({
197
247
  }
198
248
  );
199
249
  }
200
- var import_react9, import_core, import_react10, import_style, import_jsx_runtime20, assistantSchema;
250
+ var import_react10, import_core, import_react11, import_style, import_jsx_runtime20, assistantSchema;
201
251
  var init_ai_message_blocknote = __esm({
202
252
  "src/suite/components/ai-message-blocknote.tsx"() {
203
253
  "use strict";
204
254
  "use client";
205
- import_react9 = require("react");
255
+ import_react10 = require("react");
206
256
  import_core = require("@blocknote/core");
207
- import_react10 = require("@blocknote/react");
257
+ import_react11 = require("@blocknote/react");
208
258
  import_style = require("@blocknote/react/style.css");
209
259
  init_theme_provider();
210
260
  import_jsx_runtime20 = require("react/jsx-runtime");
@@ -249,6 +299,8 @@ __export(suite_exports, {
249
299
  SUITE_ICON_NAMES: () => SUITE_ICON_NAMES,
250
300
  SUITE_MUTATED_EVENT: () => SUITE_MUTATED_EVENT,
251
301
  SUITE_OPEN_ASK_AI_EVENT: () => SUITE_OPEN_ASK_AI_EVENT,
302
+ SUITE_SIDEBAR_WIDTH_COOKIE: () => SUITE_SIDEBAR_WIDTH_COOKIE,
303
+ SUITE_SIDEBAR_WIDTH_KEY: () => SUITE_SIDEBAR_WIDTH_KEY,
252
304
  SUITE_SPRINGS: () => SUITE_SPRINGS,
253
305
  SourceAppGlyph: () => SourceAppGlyph,
254
306
  SuiteAiPanel: () => SuiteAiPanel,
@@ -298,11 +350,14 @@ __export(suite_exports, {
298
350
  consumePendingAskAiPrompt: () => consumePendingAskAiPrompt,
299
351
  consumeSuiteAskAiOpenFromLocation: () => consumeSuiteAskAiOpenFromLocation,
300
352
  getTodayGreeting: () => getTodayGreeting,
301
- m: () => import_react14.m,
353
+ m: () => import_react15.m,
302
354
  openSuiteAskAi: () => openSuiteAskAi,
303
355
  pathWithSuiteAskAiOpen: () => pathWithSuiteAskAiOpen,
356
+ persistSidebarWidth: () => persistSidebarWidth,
304
357
  persistSuiteAskAiOpen: () => persistSuiteAskAiOpen,
358
+ readSidebarWidth: () => readSidebarWidth,
305
359
  readSuiteAskAiOpen: () => readSuiteAskAiOpen,
360
+ resetSuiteSidebarWidth: () => resetSuiteSidebarWidth,
306
361
  resolveSuiteNotificationHref: () => resolveSuiteNotificationHref,
307
362
  sidebarColumnWidth: () => sidebarColumnWidth,
308
363
  sourceToSuiteApp: () => sourceToSuiteApp,
@@ -2609,14 +2664,14 @@ function TodayCalibrating({
2609
2664
  init_theme_provider();
2610
2665
 
2611
2666
  // src/suite/components/ai-panel.tsx
2612
- var import_react11 = require("react");
2667
+ var import_react12 = require("react");
2613
2668
  var import_iconoir_react8 = require("iconoir-react");
2614
2669
 
2615
2670
  // src/components/ui/Tooltip.tsx
2616
- var import_react8 = require("react");
2671
+ var import_react9 = require("react");
2617
2672
  var import_react_dom = require("react-dom");
2618
2673
  var import_jsx_runtime19 = require("react/jsx-runtime");
2619
- var TooltipDelayContext = (0, import_react8.createContext)(0);
2674
+ var TooltipDelayContext = (0, import_react9.createContext)(0);
2620
2675
  function tooltipPosition(trigger, side, align, offset) {
2621
2676
  const horizontal = align === "start" ? trigger.left : align === "end" ? trigger.right : trigger.left + trigger.width / 2;
2622
2677
  const vertical = align === "start" ? trigger.top : align === "end" ? trigger.bottom : trigger.top + trigger.height / 2;
@@ -2656,12 +2711,12 @@ function Tooltip({
2656
2711
  onOpenChange,
2657
2712
  delayDuration
2658
2713
  }) {
2659
- const providerDelay = (0, import_react8.useContext)(TooltipDelayContext);
2660
- const generatedId = (0, import_react8.useId)().replace(/:/g, "");
2661
- const triggerRef = (0, import_react8.useRef)(null);
2662
- const timerRef = (0, import_react8.useRef)(null);
2663
- const [internalOpen, setInternalOpen] = (0, import_react8.useState)(defaultOpen);
2664
- const [position, setPosition] = (0, import_react8.useState)(null);
2714
+ const providerDelay = (0, import_react9.useContext)(TooltipDelayContext);
2715
+ const generatedId = (0, import_react9.useId)().replace(/:/g, "");
2716
+ const triggerRef = (0, import_react9.useRef)(null);
2717
+ const timerRef = (0, import_react9.useRef)(null);
2718
+ const [internalOpen, setInternalOpen] = (0, import_react9.useState)(defaultOpen);
2719
+ const [position, setPosition] = (0, import_react9.useState)(null);
2665
2720
  const isOpen = open != null ? open : internalOpen;
2666
2721
  const triggerId = children.props.id;
2667
2722
  const tooltipId = triggerId ? `${triggerId}-tooltip` : `ph-tooltip-${generatedId}`;
@@ -2695,7 +2750,7 @@ function Tooltip({
2695
2750
  clearTimer();
2696
2751
  setOpen(false);
2697
2752
  }
2698
- (0, import_react8.useEffect)(() => {
2753
+ (0, import_react9.useEffect)(() => {
2699
2754
  if (!isOpen) return;
2700
2755
  const reposition = () => updatePosition();
2701
2756
  window.addEventListener("resize", reposition);
@@ -2705,9 +2760,9 @@ function Tooltip({
2705
2760
  window.removeEventListener("scroll", reposition, true);
2706
2761
  };
2707
2762
  });
2708
- (0, import_react8.useEffect)(() => () => clearTimer(), []);
2763
+ (0, import_react9.useEffect)(() => () => clearTimer(), []);
2709
2764
  const describedBy = [children.props["aria-describedby"], tooltipId].filter(Boolean).join(" ");
2710
- const trigger = (0, import_react8.cloneElement)(children, { "aria-describedby": describedBy });
2765
+ const trigger = (0, import_react9.cloneElement)(children, { "aria-describedby": describedBy });
2711
2766
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2712
2767
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2713
2768
  "span",
@@ -2749,7 +2804,7 @@ function Tooltip({
2749
2804
 
2750
2805
  // src/suite/components/ai-panel.tsx
2751
2806
  var import_jsx_runtime21 = require("react/jsx-runtime");
2752
- var SuiteAiBlockNoteMessage2 = (0, import_react11.lazy)(() => Promise.resolve().then(() => (init_ai_message_blocknote(), ai_message_blocknote_exports)));
2807
+ var SuiteAiBlockNoteMessage2 = (0, import_react12.lazy)(() => Promise.resolve().then(() => (init_ai_message_blocknote(), ai_message_blocknote_exports)));
2753
2808
  var SUITE_OPEN_ASK_AI_EVENT = "shellstack:open-ask-ai";
2754
2809
  var SUITE_ASK_AI_OPEN_KEY = "shellstack:shelly-open";
2755
2810
  var SUITE_ASK_AI_OPEN_QUERY = "shelly";
@@ -2833,11 +2888,11 @@ function SuiteAiPanel({
2833
2888
  onSameAppNavigate,
2834
2889
  resolveAction
2835
2890
  }) {
2836
- const inputId = (0, import_react11.useId)();
2837
- const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react11.useState)(false);
2838
- const [resolvingId, setResolvingId] = (0, import_react11.useState)("");
2891
+ const inputId = (0, import_react12.useId)();
2892
+ const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react12.useState)(false);
2893
+ const [resolvingId, setResolvingId] = (0, import_react12.useState)("");
2839
2894
  const open = openProp != null ? openProp : uncontrolledOpen;
2840
- const setOpen = (0, import_react11.useCallback)(
2895
+ const setOpen = (0, import_react12.useCallback)(
2841
2896
  (next) => {
2842
2897
  persistSuiteAskAiOpen(next);
2843
2898
  if (openProp === void 0) setUncontrolledOpen(next);
@@ -2845,17 +2900,17 @@ function SuiteAiPanel({
2845
2900
  },
2846
2901
  [onOpenChange, openProp]
2847
2902
  );
2848
- const [prompt, setPrompt] = (0, import_react11.useState)("");
2849
- const [messages, setMessages] = (0, import_react11.useState)([]);
2850
- const [loading, setLoading] = (0, import_react11.useState)(false);
2851
- const [hydrating, setHydrating] = (0, import_react11.useState)(false);
2852
- const [error, setError] = (0, import_react11.useState)("");
2853
- const [atBottom, setAtBottom] = (0, import_react11.useState)(true);
2854
- const scrollerRef = (0, import_react11.useRef)(null);
2855
- const textareaRef = (0, import_react11.useRef)(null);
2856
- const abortRef = (0, import_react11.useRef)(null);
2857
- const pendingPromptRef = (0, import_react11.useRef)(null);
2858
- (0, import_react11.useEffect)(() => {
2903
+ const [prompt, setPrompt] = (0, import_react12.useState)("");
2904
+ const [messages, setMessages] = (0, import_react12.useState)([]);
2905
+ const [loading, setLoading] = (0, import_react12.useState)(false);
2906
+ const [hydrating, setHydrating] = (0, import_react12.useState)(false);
2907
+ const [error, setError] = (0, import_react12.useState)("");
2908
+ const [atBottom, setAtBottom] = (0, import_react12.useState)(true);
2909
+ const scrollerRef = (0, import_react12.useRef)(null);
2910
+ const textareaRef = (0, import_react12.useRef)(null);
2911
+ const abortRef = (0, import_react12.useRef)(null);
2912
+ const pendingPromptRef = (0, import_react12.useRef)(null);
2913
+ (0, import_react12.useEffect)(() => {
2859
2914
  function onOpen(event) {
2860
2915
  var _a;
2861
2916
  const detail = event.detail;
@@ -2869,19 +2924,19 @@ function SuiteAiPanel({
2869
2924
  window.addEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
2870
2925
  return () => window.removeEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
2871
2926
  }, [setOpen]);
2872
- const scrollToBottom = (0, import_react11.useCallback)((behavior = "auto") => {
2927
+ const scrollToBottom = (0, import_react12.useCallback)((behavior = "auto") => {
2873
2928
  const el = scrollerRef.current;
2874
2929
  if (!el) return;
2875
2930
  el.scrollTo({ top: el.scrollHeight, behavior });
2876
2931
  setAtBottom(true);
2877
2932
  }, []);
2878
- const handleScroll = (0, import_react11.useCallback)(() => {
2933
+ const handleScroll = (0, import_react12.useCallback)(() => {
2879
2934
  const el = scrollerRef.current;
2880
2935
  if (!el) return;
2881
2936
  const distance = el.scrollHeight - el.scrollTop - el.clientHeight;
2882
2937
  setAtBottom(distance < 64);
2883
2938
  }, []);
2884
- const hydrate = (0, import_react11.useCallback)(async () => {
2939
+ const hydrate = (0, import_react12.useCallback)(async () => {
2885
2940
  var _a;
2886
2941
  setHydrating(true);
2887
2942
  setError("");
@@ -2899,7 +2954,7 @@ function SuiteAiPanel({
2899
2954
  setHydrating(false);
2900
2955
  }
2901
2956
  }, [fetchChat]);
2902
- (0, import_react11.useEffect)(() => {
2957
+ (0, import_react12.useEffect)(() => {
2903
2958
  var _a;
2904
2959
  if (!open) return;
2905
2960
  const queued = (_a = pendingPromptRef.current) != null ? _a : consumePendingAskAiPrompt();
@@ -2910,14 +2965,14 @@ function SuiteAiPanel({
2910
2965
  if (pending) setPrompt(pending);
2911
2966
  });
2912
2967
  }, [open, hydrate]);
2913
- (0, import_react11.useEffect)(() => {
2968
+ (0, import_react12.useEffect)(() => {
2914
2969
  if (open && atBottom) scrollToBottom();
2915
2970
  }, [messages, loading, open, atBottom, scrollToBottom]);
2916
- (0, import_react11.useEffect)(() => {
2971
+ (0, import_react12.useEffect)(() => {
2917
2972
  var _a;
2918
2973
  if (open && !hydrating) (_a = textareaRef.current) == null ? void 0 : _a.focus();
2919
2974
  }, [open, hydrating]);
2920
- (0, import_react11.useLayoutEffect)(() => {
2975
+ (0, import_react12.useLayoutEffect)(() => {
2921
2976
  const el = textareaRef.current;
2922
2977
  if (!el) return;
2923
2978
  el.style.height = "auto";
@@ -3132,7 +3187,7 @@ function SuiteAiPanel({
3132
3187
  ),
3133
3188
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "min-w-0 max-w-[85%] space-y-2", children: [
3134
3189
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "rounded-2xl rounded-bl-md bg-ph-muted px-3 py-2 text-sm leading-relaxed text-ph-ink", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3135
- import_react11.Suspense,
3190
+ import_react12.Suspense,
3136
3191
  {
3137
3192
  fallback: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "whitespace-pre-wrap break-words", children: message.content }),
3138
3193
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SuiteAiBlockNoteMessage2, { markdown: message.content })
@@ -3293,7 +3348,7 @@ function SuiteAiPanel({
3293
3348
  }
3294
3349
 
3295
3350
  // src/suite/components/workspace-switcher.tsx
3296
- var import_react12 = require("react");
3351
+ var import_react13 = require("react");
3297
3352
  var import_iconoir_react9 = require("iconoir-react");
3298
3353
  var import_jsx_runtime22 = require("react/jsx-runtime");
3299
3354
  function SuiteWorkspaceSwitcher({
@@ -3311,7 +3366,7 @@ function SuiteWorkspaceSwitcher({
3311
3366
  footer
3312
3367
  }) {
3313
3368
  var _a;
3314
- const [open, setOpen] = (0, import_react12.useState)(false);
3369
+ const [open, setOpen] = (0, import_react13.useState)(false);
3315
3370
  const sections = (_a = groups == null ? void 0 : groups.filter((group) => group.workspaces.length > 0)) != null ? _a : workspaces.length > 0 ? [{ id: "workspaces", label: "Switch workspace", workspaces }] : [];
3316
3371
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3317
3372
  DropdownMenu2,
@@ -3401,12 +3456,26 @@ function SuiteWorkspaceSwitcher({
3401
3456
  }
3402
3457
 
3403
3458
  // src/suite/lib/use-sidebar-width.ts
3404
- var import_react13 = require("react");
3459
+ var import_react14 = require("react");
3405
3460
  var SIDEBAR_RAIL_WIDTH = 56;
3406
3461
  var SIDEBAR_COLLAPSE_THRESHOLD = 80;
3407
3462
  var SIDEBAR_MIN_EXPANDED_WIDTH = 180;
3408
3463
  var SIDEBAR_MAX_WIDTH = 640;
3409
3464
  var SIDEBAR_DEFAULT_WIDTH = 320;
3465
+ var SUITE_SIDEBAR_WIDTH_KEY = "shellstack:sidebar-width";
3466
+ var SUITE_SIDEBAR_WIDTH_COOKIE = "shellstack_sidebar_width";
3467
+ var LEGACY_SIDEBAR_WIDTH_KEYS = [
3468
+ "tides-sidebar-width",
3469
+ "tt-sidebar-width",
3470
+ "kraken-sidebar-width",
3471
+ "shellstack-sidebar-width",
3472
+ "nakama-sidebar-width"
3473
+ ];
3474
+ function isSuiteSidebarKey(storageKey) {
3475
+ return storageKey === SUITE_SIDEBAR_WIDTH_KEY || LEGACY_SIDEBAR_WIDTH_KEYS.includes(
3476
+ storageKey
3477
+ );
3478
+ }
3410
3479
  function sidebarColumnWidth(width, collapsed, _chatOpen = false) {
3411
3480
  if (collapsed) return SIDEBAR_RAIL_WIDTH;
3412
3481
  return width;
@@ -3419,40 +3488,136 @@ function snapWidth(width) {
3419
3488
  if (width < SIDEBAR_MIN_EXPANDED_WIDTH) return SIDEBAR_MIN_EXPANDED_WIDTH;
3420
3489
  return Math.min(SIDEBAR_MAX_WIDTH, width);
3421
3490
  }
3422
- function useSidebarWidth(storageKey, defaultWidth = SIDEBAR_DEFAULT_WIDTH) {
3423
- const fallbackWidth = snapWidth(clampWidth(defaultWidth));
3424
- const [width, setWidth] = (0, import_react13.useState)(fallbackWidth);
3425
- const [narrowViewport, setNarrowViewport] = (0, import_react13.useState)(false);
3426
- const collapsed = narrowViewport || width <= SIDEBAR_COLLAPSE_THRESHOLD;
3427
- (0, import_react13.useEffect)(() => {
3428
- let stored = null;
3491
+ function parseWidth(raw) {
3492
+ if (!raw) return null;
3493
+ const parsed = Number.parseInt(raw, 10);
3494
+ return Number.isNaN(parsed) ? null : parsed;
3495
+ }
3496
+ function suiteCookieDomainAttr() {
3497
+ var _a;
3498
+ const host = window.location.hostname;
3499
+ if (host === "localhost" || /^\d{1,3}(?:\.\d{1,3}){3}$/.test(host)) {
3500
+ return "";
3501
+ }
3502
+ if (host.endsWith(".localhost")) {
3503
+ return "; Domain=.localhost";
3504
+ }
3505
+ const known = /* @__PURE__ */ new Set([
3506
+ "tides",
3507
+ "kraken",
3508
+ "turtletime",
3509
+ "time",
3510
+ "nakama",
3511
+ "app",
3512
+ "shellstack",
3513
+ "portal"
3514
+ ]);
3515
+ const parts = host.split(".");
3516
+ if (parts.length >= 3 && known.has((_a = parts[0]) != null ? _a : "")) {
3517
+ return `; Domain=.${parts.slice(1).join(".")}`;
3518
+ }
3519
+ if (parts.length >= 2) return `; Domain=.${parts.slice(1).join(".")}`;
3520
+ return "";
3521
+ }
3522
+ function readCookie(name) {
3523
+ const prefix = `${name}=`;
3524
+ for (const part of document.cookie.split(";")) {
3525
+ const trimmed = part.trim();
3526
+ if (trimmed.startsWith(prefix)) {
3527
+ return decodeURIComponent(trimmed.slice(prefix.length));
3528
+ }
3529
+ }
3530
+ return null;
3531
+ }
3532
+ function writeCookie(name, value) {
3533
+ const secure = window.location.protocol === "https:" ? "; Secure" : "";
3534
+ document.cookie = `${name}=${encodeURIComponent(value)}; Path=/; Max-Age=31536000; SameSite=Lax${suiteCookieDomainAttr()}${secure}`;
3535
+ }
3536
+ function clearCookie(name) {
3537
+ const secure = window.location.protocol === "https:" ? "; Secure" : "";
3538
+ document.cookie = `${name}=; Path=/; Max-Age=0; SameSite=Lax${suiteCookieDomainAttr()}${secure}`;
3539
+ }
3540
+ function readSidebarWidth(storageKey) {
3541
+ try {
3542
+ if (isSuiteSidebarKey(storageKey)) {
3543
+ const fromCookie = parseWidth(readCookie(SUITE_SIDEBAR_WIDTH_COOKIE));
3544
+ if (fromCookie != null) return fromCookie;
3545
+ const shared = parseWidth(localStorage.getItem(SUITE_SIDEBAR_WIDTH_KEY));
3546
+ if (shared != null) return shared;
3547
+ for (const key of LEGACY_SIDEBAR_WIDTH_KEYS) {
3548
+ const legacy = parseWidth(localStorage.getItem(key));
3549
+ if (legacy != null) return legacy;
3550
+ }
3551
+ }
3552
+ return parseWidth(localStorage.getItem(storageKey));
3553
+ } catch (e) {
3554
+ return null;
3555
+ }
3556
+ }
3557
+ function persistSidebarWidth(storageKey, value) {
3558
+ try {
3559
+ localStorage.setItem(storageKey, String(value));
3560
+ if (isSuiteSidebarKey(storageKey)) {
3561
+ localStorage.setItem(SUITE_SIDEBAR_WIDTH_KEY, String(value));
3562
+ }
3563
+ } catch (e) {
3564
+ }
3565
+ if (isSuiteSidebarKey(storageKey)) {
3429
3566
  try {
3430
- stored = localStorage.getItem(storageKey);
3567
+ writeCookie(SUITE_SIDEBAR_WIDTH_COOKIE, String(value));
3431
3568
  } catch (e) {
3432
3569
  }
3433
- if (!stored) return;
3434
- const parsed = Number.parseInt(stored, 10);
3435
- if (!Number.isNaN(parsed)) {
3436
- queueMicrotask(() => setWidth(snapWidth(clampWidth(parsed))));
3570
+ }
3571
+ }
3572
+ function resetSuiteSidebarWidth() {
3573
+ try {
3574
+ localStorage.removeItem(SUITE_SIDEBAR_WIDTH_KEY);
3575
+ for (const key of LEGACY_SIDEBAR_WIDTH_KEYS) {
3576
+ localStorage.removeItem(key);
3437
3577
  }
3578
+ localStorage.removeItem("kraken-sidebar-collapsed");
3579
+ } catch (e) {
3580
+ }
3581
+ try {
3582
+ clearCookie(SUITE_SIDEBAR_WIDTH_COOKIE);
3583
+ } catch (e) {
3584
+ }
3585
+ }
3586
+ function useSidebarWidth(storageKey = SUITE_SIDEBAR_WIDTH_KEY, defaultWidth = SIDEBAR_DEFAULT_WIDTH) {
3587
+ const fallbackWidth = snapWidth(clampWidth(defaultWidth));
3588
+ const [width, setWidth] = (0, import_react14.useState)(fallbackWidth);
3589
+ const [narrowViewport, setNarrowViewport] = (0, import_react14.useState)(false);
3590
+ const collapsed = narrowViewport || width <= SIDEBAR_COLLAPSE_THRESHOLD;
3591
+ (0, import_react14.useLayoutEffect)(() => {
3592
+ const sync = () => {
3593
+ const stored = readSidebarWidth(storageKey);
3594
+ if (stored == null) return;
3595
+ setWidth(snapWidth(clampWidth(stored)));
3596
+ };
3597
+ sync();
3598
+ window.addEventListener("pageshow", sync);
3599
+ window.addEventListener("focus", sync);
3600
+ document.addEventListener("visibilitychange", sync);
3601
+ return () => {
3602
+ window.removeEventListener("pageshow", sync);
3603
+ window.removeEventListener("focus", sync);
3604
+ document.removeEventListener("visibilitychange", sync);
3605
+ };
3438
3606
  }, [storageKey]);
3439
- (0, import_react13.useEffect)(() => {
3607
+ (0, import_react14.useLayoutEffect)(() => {
3440
3608
  const media = window.matchMedia("(max-width: 639px)");
3441
3609
  const sync = () => setNarrowViewport(media.matches);
3442
3610
  sync();
3443
3611
  media.addEventListener("change", sync);
3444
3612
  return () => media.removeEventListener("change", sync);
3445
3613
  }, []);
3446
- const persist = (0, import_react13.useCallback)(
3614
+ const persist = (0, import_react14.useCallback)(
3447
3615
  (value) => {
3448
- try {
3449
- localStorage.setItem(storageKey, String(value));
3450
- } catch (e) {
3451
- }
3616
+ persistSidebarWidth(storageKey, value);
3452
3617
  },
3453
3618
  [storageKey]
3454
3619
  );
3455
- const setCollapsed = (0, import_react13.useCallback)(
3620
+ const setCollapsed = (0, import_react14.useCallback)(
3456
3621
  (value) => {
3457
3622
  setWidth((current) => {
3458
3623
  const next = value ? SIDEBAR_RAIL_WIDTH : current <= SIDEBAR_COLLAPSE_THRESHOLD ? fallbackWidth : snapWidth(current);
@@ -3462,11 +3627,11 @@ function useSidebarWidth(storageKey, defaultWidth = SIDEBAR_DEFAULT_WIDTH) {
3462
3627
  },
3463
3628
  [fallbackWidth, persist]
3464
3629
  );
3465
- const resetWidth = (0, import_react13.useCallback)(() => {
3630
+ const resetWidth = (0, import_react14.useCallback)(() => {
3466
3631
  setWidth(fallbackWidth);
3467
3632
  persist(fallbackWidth);
3468
3633
  }, [fallbackWidth, persist]);
3469
- const startResize = (0, import_react13.useCallback)(
3634
+ const startResize = (0, import_react14.useCallback)(
3470
3635
  (event) => {
3471
3636
  event.preventDefault();
3472
3637
  const startX = event.clientX;
@@ -3488,7 +3653,7 @@ function useSidebarWidth(storageKey, defaultWidth = SIDEBAR_DEFAULT_WIDTH) {
3488
3653
  },
3489
3654
  [persist, width]
3490
3655
  );
3491
- const resizeBy = (0, import_react13.useCallback)(
3656
+ const resizeBy = (0, import_react14.useCallback)(
3492
3657
  (delta) => {
3493
3658
  setWidth((current) => {
3494
3659
  const next = clampWidth(current + delta);
@@ -3502,10 +3667,10 @@ function useSidebarWidth(storageKey, defaultWidth = SIDEBAR_DEFAULT_WIDTH) {
3502
3667
  }
3503
3668
 
3504
3669
  // src/suite/lib/motion.tsx
3505
- var import_react14 = require("motion/react");
3670
+ var import_react15 = require("motion/react");
3506
3671
  var import_jsx_runtime23 = require("react/jsx-runtime");
3507
3672
  function SuiteMotionProvider({ children }) {
3508
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react14.LazyMotion, { features: import_react14.domAnimation, strict: true, children });
3673
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react15.LazyMotion, { features: import_react15.domAnimation, strict: true, children });
3509
3674
  }
3510
3675
  var SUITE_SPRINGS = {
3511
3676
  /** Snappy panel/sheet entrances — small overshoot. */
@@ -3662,7 +3827,7 @@ function SuiteEmptyState({
3662
3827
  }
3663
3828
 
3664
3829
  // src/suite/components/suite-settings-mobile-nav.tsx
3665
- var import_react15 = require("react");
3830
+ var import_react16 = require("react");
3666
3831
  var import_jsx_runtime25 = require("react/jsx-runtime");
3667
3832
  function SuiteSettingsMobileNav({
3668
3833
  items,
@@ -3681,7 +3846,7 @@ function SuiteSettingsMobileNav({
3681
3846
  children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex snap-x gap-2 overflow-x-auto pb-3 pt-1 scrollbar-hide [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: items.map((item) => {
3682
3847
  const Icon = item.icon;
3683
3848
  const active = activeHref === item.href || activeHref.startsWith(`${item.href}/`);
3684
- const iconNode = (0, import_react15.isValidElement)(item.icon) ? item.icon : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3849
+ const iconNode = (0, import_react16.isValidElement)(item.icon) ? item.icon : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3685
3850
  Icon,
3686
3851
  {
3687
3852
  className: cn(
@@ -3719,7 +3884,7 @@ function SuiteSettingsMobileNav({
3719
3884
 
3720
3885
  // src/suite/components/suite-sidebar.tsx
3721
3886
  var import_link2 = __toESM(require("next/link"));
3722
- var import_react16 = require("react");
3887
+ var import_react17 = require("react");
3723
3888
  var import_iconoir_react10 = require("iconoir-react");
3724
3889
  var import_jsx_runtime26 = require("react/jsx-runtime");
3725
3890
  function renderNode(node, collapsed) {
@@ -3744,14 +3909,14 @@ function SuiteSidebar({
3744
3909
  }) {
3745
3910
  const showAskAi = Boolean(onAskAiOpenChange && askAi);
3746
3911
  const chatOpen = showAskAi && askAiOpen && !collapsed;
3747
- const setAskAi = (0, import_react16.useCallback)(
3912
+ const setAskAi = (0, import_react17.useCallback)(
3748
3913
  (next) => {
3749
3914
  persistSuiteAskAiOpen(next);
3750
3915
  onAskAiOpenChange == null ? void 0 : onAskAiOpenChange(next);
3751
3916
  },
3752
3917
  [onAskAiOpenChange]
3753
3918
  );
3754
- (0, import_react16.useEffect)(() => {
3919
+ (0, import_react17.useEffect)(() => {
3755
3920
  if (!onAskAiOpenChange) return;
3756
3921
  function onOpen() {
3757
3922
  onRequestExpand == null ? void 0 : onRequestExpand();
@@ -3760,7 +3925,7 @@ function SuiteSidebar({
3760
3925
  window.addEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
3761
3926
  return () => window.removeEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
3762
3927
  }, [onAskAiOpenChange, onRequestExpand, setAskAi]);
3763
- (0, import_react16.useEffect)(() => {
3928
+ (0, import_react17.useEffect)(() => {
3764
3929
  if (!chatOpen) return;
3765
3930
  function onKey(event) {
3766
3931
  if (event.key === "Escape") setAskAi(false);
@@ -3936,7 +4101,14 @@ function SuiteSidebar({
3936
4101
  );
3937
4102
  return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Tooltip, { content: item.label, side: "right", children: link }, item.label) : link;
3938
4103
  }) }) }),
3939
- secondaryNav ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "shrink-0", "data-test": "suite-sidebar-secondary-nav", children: secondaryNav }) : null
4104
+ secondaryNav ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4105
+ "div",
4106
+ {
4107
+ className: "min-h-0 flex-1",
4108
+ "data-test": "suite-sidebar-secondary-nav",
4109
+ children: secondaryNav
4110
+ }
4111
+ ) : null
3940
4112
  ] })
3941
4113
  ]
3942
4114
  }
@@ -4082,6 +4254,8 @@ function SuiteAppLayout({
4082
4254
  SUITE_ICON_NAMES,
4083
4255
  SUITE_MUTATED_EVENT,
4084
4256
  SUITE_OPEN_ASK_AI_EVENT,
4257
+ SUITE_SIDEBAR_WIDTH_COOKIE,
4258
+ SUITE_SIDEBAR_WIDTH_KEY,
4085
4259
  SUITE_SPRINGS,
4086
4260
  SourceAppGlyph,
4087
4261
  SuiteAiPanel,
@@ -4134,8 +4308,11 @@ function SuiteAppLayout({
4134
4308
  m,
4135
4309
  openSuiteAskAi,
4136
4310
  pathWithSuiteAskAiOpen,
4311
+ persistSidebarWidth,
4137
4312
  persistSuiteAskAiOpen,
4313
+ readSidebarWidth,
4138
4314
  readSuiteAskAiOpen,
4315
+ resetSuiteSidebarWidth,
4139
4316
  resolveSuiteNotificationHref,
4140
4317
  sidebarColumnWidth,
4141
4318
  sourceToSuiteApp,