@xenide-io/the-old-ui-theme 0.4.8 → 0.4.9
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/ai-message-blocknote-4Q4U2T2W.mjs +63 -0
- package/dist/chunk-IAH7Z46I.mjs +104 -0
- package/dist/suite.js +327 -238
- package/dist/suite.mjs +110 -190
- package/package.json +3 -1
- package/src/styles/suite-skin.css +22 -0
- package/src/suite/components/ai-message-blocknote.test.tsx +40 -0
- package/src/suite/components/ai-message-blocknote.tsx +61 -0
- package/src/suite/components/ai-panel.tsx +19 -1
package/dist/suite.mjs
CHANGED
|
@@ -3,6 +3,10 @@ import {
|
|
|
3
3
|
DropdownMenu,
|
|
4
4
|
Tooltip
|
|
5
5
|
} from "./chunk-G53YLHVE.mjs";
|
|
6
|
+
import {
|
|
7
|
+
SuiteThemeProvider,
|
|
8
|
+
useSuiteTheme
|
|
9
|
+
} from "./chunk-IAH7Z46I.mjs";
|
|
6
10
|
import {
|
|
7
11
|
__spreadProps,
|
|
8
12
|
__spreadValues
|
|
@@ -1979,110 +1983,20 @@ function TodayCalibrating({
|
|
|
1979
1983
|
);
|
|
1980
1984
|
}
|
|
1981
1985
|
|
|
1982
|
-
// src/suite/components/
|
|
1986
|
+
// src/suite/components/ai-panel.tsx
|
|
1983
1987
|
import {
|
|
1984
|
-
|
|
1988
|
+
lazy,
|
|
1989
|
+
Suspense,
|
|
1985
1990
|
useCallback as useCallback2,
|
|
1986
|
-
useContext,
|
|
1987
1991
|
useEffect as useEffect6,
|
|
1988
|
-
useMemo,
|
|
1989
|
-
useState as useState7
|
|
1990
|
-
} from "react";
|
|
1991
|
-
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1992
|
-
var SuiteThemeContext = createContext(null);
|
|
1993
|
-
function systemTheme(fallback) {
|
|
1994
|
-
if (typeof window === "undefined") return fallback;
|
|
1995
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1996
|
-
}
|
|
1997
|
-
function resolveTheme(theme, fallback) {
|
|
1998
|
-
return theme === "system" ? systemTheme(fallback) : theme;
|
|
1999
|
-
}
|
|
2000
|
-
function applyTheme(theme, config) {
|
|
2001
|
-
const resolved = resolveTheme(theme, config.fallbackTheme);
|
|
2002
|
-
if (typeof document === "undefined") return resolved;
|
|
2003
|
-
document.documentElement.setAttribute(
|
|
2004
|
-
"data-theme",
|
|
2005
|
-
resolved === "dark" ? config.darkThemeId : config.lightThemeId
|
|
2006
|
-
);
|
|
2007
|
-
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
2008
|
-
if (config.themeColorLight && config.themeColorDark) {
|
|
2009
|
-
const meta = document.getElementById(
|
|
2010
|
-
"theme-color-meta"
|
|
2011
|
-
);
|
|
2012
|
-
if (meta) {
|
|
2013
|
-
meta.content = resolved === "light" ? config.themeColorLight : config.themeColorDark;
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
return resolved;
|
|
2017
|
-
}
|
|
2018
|
-
function readStoredTheme(storageKey) {
|
|
2019
|
-
if (typeof window === "undefined") return "system";
|
|
2020
|
-
const stored = localStorage.getItem(storageKey);
|
|
2021
|
-
if (stored === "light" || stored === "dark" || stored === "system")
|
|
2022
|
-
return stored;
|
|
2023
|
-
return "system";
|
|
2024
|
-
}
|
|
2025
|
-
function SuiteThemeProvider({
|
|
2026
|
-
config,
|
|
2027
|
-
children
|
|
2028
|
-
}) {
|
|
2029
|
-
const [state, setState] = useState7(() => {
|
|
2030
|
-
const theme2 = readStoredTheme(config.storageKey);
|
|
2031
|
-
if (typeof document === "undefined") {
|
|
2032
|
-
return { theme: theme2, resolvedTheme: config.fallbackTheme };
|
|
2033
|
-
}
|
|
2034
|
-
const domTheme = document.documentElement.getAttribute("data-theme");
|
|
2035
|
-
const resolvedTheme2 = domTheme === config.darkThemeId ? "dark" : domTheme === config.lightThemeId ? "light" : resolveTheme(theme2, config.fallbackTheme);
|
|
2036
|
-
return { theme: theme2, resolvedTheme: resolvedTheme2 };
|
|
2037
|
-
});
|
|
2038
|
-
const { theme, resolvedTheme } = state;
|
|
2039
|
-
useEffect6(() => {
|
|
2040
|
-
if (theme !== "system") return;
|
|
2041
|
-
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2042
|
-
const update = () => {
|
|
2043
|
-
const resolved = applyTheme("system", config);
|
|
2044
|
-
setState((current) => __spreadProps(__spreadValues({}, current), { resolvedTheme: resolved }));
|
|
2045
|
-
};
|
|
2046
|
-
media.addEventListener("change", update);
|
|
2047
|
-
return () => media.removeEventListener("change", update);
|
|
2048
|
-
}, [theme, config]);
|
|
2049
|
-
const setTheme = useCallback2(
|
|
2050
|
-
(next) => {
|
|
2051
|
-
const resolved = applyTheme(next, config);
|
|
2052
|
-
setState({ theme: next, resolvedTheme: resolved });
|
|
2053
|
-
localStorage.setItem(config.storageKey, next);
|
|
2054
|
-
},
|
|
2055
|
-
[config]
|
|
2056
|
-
);
|
|
2057
|
-
const toggleTheme = useCallback2(() => {
|
|
2058
|
-
setState((prev) => {
|
|
2059
|
-
const next = resolveTheme(prev.theme, config.fallbackTheme) === "dark" ? "light" : "dark";
|
|
2060
|
-
const resolved = applyTheme(next, config);
|
|
2061
|
-
localStorage.setItem(config.storageKey, next);
|
|
2062
|
-
return { theme: next, resolvedTheme: resolved };
|
|
2063
|
-
});
|
|
2064
|
-
}, [config]);
|
|
2065
|
-
const value = useMemo(
|
|
2066
|
-
() => ({ theme, resolvedTheme, setTheme, toggleTheme }),
|
|
2067
|
-
[theme, resolvedTheme, setTheme, toggleTheme]
|
|
2068
|
-
);
|
|
2069
|
-
return /* @__PURE__ */ jsx17(SuiteThemeContext.Provider, { value, children });
|
|
2070
|
-
}
|
|
2071
|
-
function useSuiteTheme() {
|
|
2072
|
-
const ctx = useContext(SuiteThemeContext);
|
|
2073
|
-
if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
|
|
2074
|
-
return ctx;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
// src/suite/components/ai-panel.tsx
|
|
2078
|
-
import {
|
|
2079
|
-
useCallback as useCallback3,
|
|
2080
|
-
useEffect as useEffect7,
|
|
2081
1992
|
useRef as useRef3,
|
|
2082
|
-
useState as
|
|
1993
|
+
useState as useState7
|
|
2083
1994
|
} from "react";
|
|
2084
1995
|
import { Check as Check2, Copy, Sparks, Xmark as X2 } from "iconoir-react";
|
|
2085
|
-
import { Fragment as Fragment5, jsx as
|
|
1996
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1997
|
+
var SuiteAiBlockNoteMessage = lazy(
|
|
1998
|
+
() => import("./ai-message-blocknote-4Q4U2T2W.mjs")
|
|
1999
|
+
);
|
|
2086
2000
|
var SUITE_OPEN_ASK_AI_EVENT = "shellstack:open-ask-ai";
|
|
2087
2001
|
function openSuiteAskAi(detail) {
|
|
2088
2002
|
if (typeof window === "undefined") return;
|
|
@@ -2119,16 +2033,16 @@ function SuiteAiPanel({
|
|
|
2119
2033
|
spinner: Spinner,
|
|
2120
2034
|
hideLauncher = false
|
|
2121
2035
|
}) {
|
|
2122
|
-
const [open, setOpen] =
|
|
2123
|
-
const [prompt, setPrompt] =
|
|
2124
|
-
const [messages, setMessages] =
|
|
2125
|
-
const [loading, setLoading] =
|
|
2126
|
-
const [hydrating, setHydrating] =
|
|
2127
|
-
const [error, setError] =
|
|
2128
|
-
const [copiedId, setCopiedId] =
|
|
2129
|
-
const [launcherSide, setLauncherSide] =
|
|
2130
|
-
const [launcherPosition, setLauncherPosition] =
|
|
2131
|
-
const [draggingLauncher, setDraggingLauncher] =
|
|
2036
|
+
const [open, setOpen] = useState7(false);
|
|
2037
|
+
const [prompt, setPrompt] = useState7("");
|
|
2038
|
+
const [messages, setMessages] = useState7([]);
|
|
2039
|
+
const [loading, setLoading] = useState7(false);
|
|
2040
|
+
const [hydrating, setHydrating] = useState7(false);
|
|
2041
|
+
const [error, setError] = useState7("");
|
|
2042
|
+
const [copiedId, setCopiedId] = useState7(null);
|
|
2043
|
+
const [launcherSide, setLauncherSide] = useState7("right");
|
|
2044
|
+
const [launcherPosition, setLauncherPosition] = useState7(null);
|
|
2045
|
+
const [draggingLauncher, setDraggingLauncher] = useState7(false);
|
|
2132
2046
|
const scrollerRef = useRef3(null);
|
|
2133
2047
|
const launcherRef = useRef3(null);
|
|
2134
2048
|
const launcherSideRef = useRef3("right");
|
|
@@ -2136,7 +2050,7 @@ function SuiteAiPanel({
|
|
|
2136
2050
|
const launcherDragRef = useRef3(null);
|
|
2137
2051
|
const suppressLauncherClickRef = useRef3(false);
|
|
2138
2052
|
const pendingPromptRef = useRef3(null);
|
|
2139
|
-
|
|
2053
|
+
useEffect6(() => {
|
|
2140
2054
|
const launcher = launcherRef.current;
|
|
2141
2055
|
if (!launcher) return;
|
|
2142
2056
|
let side = "right";
|
|
@@ -2171,12 +2085,12 @@ function SuiteAiPanel({
|
|
|
2171
2085
|
window.addEventListener("resize", placeLauncher);
|
|
2172
2086
|
return () => window.removeEventListener("resize", placeLauncher);
|
|
2173
2087
|
}, []);
|
|
2174
|
-
const scrollToBottom =
|
|
2088
|
+
const scrollToBottom = useCallback2(() => {
|
|
2175
2089
|
const el = scrollerRef.current;
|
|
2176
2090
|
if (!el) return;
|
|
2177
2091
|
el.scrollTop = el.scrollHeight;
|
|
2178
2092
|
}, []);
|
|
2179
|
-
const hydrate =
|
|
2093
|
+
const hydrate = useCallback2(async () => {
|
|
2180
2094
|
var _a;
|
|
2181
2095
|
setHydrating(true);
|
|
2182
2096
|
setError("");
|
|
@@ -2194,7 +2108,7 @@ function SuiteAiPanel({
|
|
|
2194
2108
|
setHydrating(false);
|
|
2195
2109
|
}
|
|
2196
2110
|
}, [fetchChat]);
|
|
2197
|
-
|
|
2111
|
+
useEffect6(() => {
|
|
2198
2112
|
function onOpen(event) {
|
|
2199
2113
|
var _a;
|
|
2200
2114
|
const detail = event.detail;
|
|
@@ -2207,7 +2121,7 @@ function SuiteAiPanel({
|
|
|
2207
2121
|
window.addEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
2208
2122
|
return () => window.removeEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
2209
2123
|
}, []);
|
|
2210
|
-
|
|
2124
|
+
useEffect6(() => {
|
|
2211
2125
|
if (!open) return;
|
|
2212
2126
|
void hydrate().then(() => {
|
|
2213
2127
|
const pending = pendingPromptRef.current;
|
|
@@ -2217,7 +2131,7 @@ function SuiteAiPanel({
|
|
|
2217
2131
|
}
|
|
2218
2132
|
});
|
|
2219
2133
|
}, [open, hydrate]);
|
|
2220
|
-
|
|
2134
|
+
useEffect6(() => {
|
|
2221
2135
|
if (open) scrollToBottom();
|
|
2222
2136
|
}, [messages, loading, open, scrollToBottom]);
|
|
2223
2137
|
async function ask(text) {
|
|
@@ -2388,15 +2302,15 @@ function SuiteAiPanel({
|
|
|
2388
2302
|
"aria-label": "Open Ask AI",
|
|
2389
2303
|
"aria-describedby": "suite-ask-ai-launcher-help",
|
|
2390
2304
|
children: [
|
|
2391
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ jsx17(Icon, { className: "h-4 w-4 text-ph-brand" }),
|
|
2392
2306
|
"Ask AI"
|
|
2393
2307
|
]
|
|
2394
2308
|
}
|
|
2395
2309
|
),
|
|
2396
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ jsx17("span", { id: "suite-ask-ai-launcher-help", className: "sr-only", children: "Drag to reposition, or use arrow keys. The launcher docks to the nearest screen edge." })
|
|
2397
2311
|
] }) : null,
|
|
2398
2312
|
open ? /* @__PURE__ */ jsxs15("div", { className: "fixed inset-0 z-40", role: "dialog", "aria-modal": "true", children: [
|
|
2399
|
-
/* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsx17(
|
|
2400
2314
|
"button",
|
|
2401
2315
|
{
|
|
2402
2316
|
type: "button",
|
|
@@ -2414,13 +2328,13 @@ function SuiteAiPanel({
|
|
|
2414
2328
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between border-b border-ph-border px-4 py-3", children: [
|
|
2415
2329
|
/* @__PURE__ */ jsxs15("div", { className: "min-w-0", children: [
|
|
2416
2330
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
2417
|
-
/* @__PURE__ */
|
|
2418
|
-
/* @__PURE__ */
|
|
2331
|
+
/* @__PURE__ */ jsx17(Icon, { className: "h-4 w-4 shrink-0 text-ph-brand" }),
|
|
2332
|
+
/* @__PURE__ */ jsx17("span", { className: "text-sm font-semibold text-ph-ink", children: title })
|
|
2419
2333
|
] }),
|
|
2420
|
-
/* @__PURE__ */
|
|
2334
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-0.5 text-[11px] text-ph-mutedtext", children: "Shared across your suite \xB7 same chat in every app" })
|
|
2421
2335
|
] }),
|
|
2422
2336
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
2423
|
-
messages.length > 0 ? /* @__PURE__ */
|
|
2337
|
+
messages.length > 0 ? /* @__PURE__ */ jsx17(
|
|
2424
2338
|
"button",
|
|
2425
2339
|
{
|
|
2426
2340
|
type: "button",
|
|
@@ -2431,19 +2345,19 @@ function SuiteAiPanel({
|
|
|
2431
2345
|
children: "Clear"
|
|
2432
2346
|
}
|
|
2433
2347
|
) : null,
|
|
2434
|
-
/* @__PURE__ */
|
|
2348
|
+
/* @__PURE__ */ jsx17(
|
|
2435
2349
|
"button",
|
|
2436
2350
|
{
|
|
2437
2351
|
type: "button",
|
|
2438
2352
|
onClick: () => setOpen(false),
|
|
2439
2353
|
className: "rounded p-1 hover:bg-ph-muted",
|
|
2440
2354
|
"aria-label": "Close",
|
|
2441
|
-
children: /* @__PURE__ */
|
|
2355
|
+
children: /* @__PURE__ */ jsx17(X2, { className: "h-4 w-4" })
|
|
2442
2356
|
}
|
|
2443
2357
|
)
|
|
2444
2358
|
] })
|
|
2445
2359
|
] }),
|
|
2446
|
-
presets.length > 0 && messages.length === 0 ? /* @__PURE__ */
|
|
2360
|
+
presets.length > 0 && messages.length === 0 ? /* @__PURE__ */ jsx17("div", { className: "flex flex-wrap gap-1.5 border-b border-ph-border px-4 py-2", children: presets.map((preset) => /* @__PURE__ */ jsx17(
|
|
2447
2361
|
"button",
|
|
2448
2362
|
{
|
|
2449
2363
|
type: "button",
|
|
@@ -2460,14 +2374,14 @@ function SuiteAiPanel({
|
|
|
2460
2374
|
ref: scrollerRef,
|
|
2461
2375
|
className: "flex-1 space-y-3 overflow-y-auto p-4",
|
|
2462
2376
|
children: [
|
|
2463
|
-
error ? /* @__PURE__ */
|
|
2377
|
+
error ? /* @__PURE__ */ jsx17("p", { className: "bg-ph-danger/10 rounded-lg px-3 py-2 text-sm text-ph-danger", children: error }) : null,
|
|
2464
2378
|
hydrating && messages.length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 text-sm text-ph-mutedtext", children: [
|
|
2465
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ jsx17(Spinner, { className: "h-4 w-4 animate-spin" }),
|
|
2466
2380
|
"Loading chat\u2026"
|
|
2467
2381
|
] }) : null,
|
|
2468
2382
|
!hydrating && messages.length === 0 && !error ? /* @__PURE__ */ jsxs15("div", { className: "mt-10 px-2 text-center", children: [
|
|
2469
|
-
/* @__PURE__ */
|
|
2470
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ jsx17("p", { className: "font-display text-base font-semibold text-ph-ink", children: "How can I help?" }),
|
|
2384
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-2 text-sm leading-relaxed text-ph-subtle", children: emptyState })
|
|
2471
2385
|
] }) : null,
|
|
2472
2386
|
messages.map((message, index) => {
|
|
2473
2387
|
const isUser = message.role === "user";
|
|
@@ -2477,7 +2391,13 @@ function SuiteAiPanel({
|
|
|
2477
2391
|
className: isUser ? "ml-8 rounded-2xl bg-ph-brand/10 px-3.5 py-2.5 text-sm text-ph-ink" : "mr-4 rounded-2xl bg-ph-muted px-3.5 py-2.5 text-sm text-ph-ink",
|
|
2478
2392
|
"data-test": isUser ? "ask-ai-user" : "ask-ai-assistant",
|
|
2479
2393
|
children: [
|
|
2480
|
-
/* @__PURE__ */
|
|
2394
|
+
isUser ? /* @__PURE__ */ jsx17("p", { className: "whitespace-pre-wrap", children: message.content }) : /* @__PURE__ */ jsx17(
|
|
2395
|
+
Suspense,
|
|
2396
|
+
{
|
|
2397
|
+
fallback: /* @__PURE__ */ jsx17("p", { className: "whitespace-pre-wrap", children: message.content }),
|
|
2398
|
+
children: /* @__PURE__ */ jsx17(SuiteAiBlockNoteMessage, { markdown: message.content })
|
|
2399
|
+
}
|
|
2400
|
+
),
|
|
2481
2401
|
!isUser ? /* @__PURE__ */ jsxs15(
|
|
2482
2402
|
"button",
|
|
2483
2403
|
{
|
|
@@ -2485,7 +2405,7 @@ function SuiteAiPanel({
|
|
|
2485
2405
|
onClick: () => void copyMessage(index, message.content),
|
|
2486
2406
|
className: "mt-2 inline-flex items-center gap-1 text-xs text-ph-mutedtext hover:text-ph-ink",
|
|
2487
2407
|
children: [
|
|
2488
|
-
copiedId === index ? /* @__PURE__ */
|
|
2408
|
+
copiedId === index ? /* @__PURE__ */ jsx17(Check2, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx17(Copy, { className: "h-3 w-3" }),
|
|
2489
2409
|
copiedId === index ? "Copied" : "Copy"
|
|
2490
2410
|
]
|
|
2491
2411
|
}
|
|
@@ -2496,14 +2416,14 @@ function SuiteAiPanel({
|
|
|
2496
2416
|
);
|
|
2497
2417
|
}),
|
|
2498
2418
|
loading ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 text-sm text-ph-mutedtext", children: [
|
|
2499
|
-
/* @__PURE__ */
|
|
2419
|
+
/* @__PURE__ */ jsx17(Spinner, { className: "h-4 w-4 animate-spin" }),
|
|
2500
2420
|
"Thinking\u2026"
|
|
2501
2421
|
] }) : null
|
|
2502
2422
|
]
|
|
2503
2423
|
}
|
|
2504
2424
|
),
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
2425
|
+
/* @__PURE__ */ jsx17("div", { className: "border-t border-ph-border p-3", children: /* @__PURE__ */ jsxs15("div", { className: "flex gap-2", children: [
|
|
2426
|
+
/* @__PURE__ */ jsx17(
|
|
2507
2427
|
"textarea",
|
|
2508
2428
|
{
|
|
2509
2429
|
value: prompt,
|
|
@@ -2521,7 +2441,7 @@ function SuiteAiPanel({
|
|
|
2521
2441
|
className: "flex-1 resize-none rounded-xl border border-ph-border bg-ph-canvas p-2.5 text-sm text-ph-ink outline-none focus:ring-1 focus:ring-ph-brand"
|
|
2522
2442
|
}
|
|
2523
2443
|
),
|
|
2524
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx17(
|
|
2525
2445
|
"button",
|
|
2526
2446
|
{
|
|
2527
2447
|
type: "button",
|
|
@@ -2542,9 +2462,9 @@ function SuiteAiPanel({
|
|
|
2542
2462
|
|
|
2543
2463
|
// src/suite/lib/use-sidebar-width.ts
|
|
2544
2464
|
import {
|
|
2545
|
-
useCallback as
|
|
2546
|
-
useEffect as
|
|
2547
|
-
useState as
|
|
2465
|
+
useCallback as useCallback3,
|
|
2466
|
+
useEffect as useEffect7,
|
|
2467
|
+
useState as useState8
|
|
2548
2468
|
} from "react";
|
|
2549
2469
|
var SIDEBAR_RAIL_WIDTH = 56;
|
|
2550
2470
|
var SIDEBAR_COLLAPSE_THRESHOLD = 80;
|
|
@@ -2560,10 +2480,10 @@ function snapWidth(width) {
|
|
|
2560
2480
|
return Math.min(SIDEBAR_MAX_WIDTH, width);
|
|
2561
2481
|
}
|
|
2562
2482
|
function useSidebarWidth(storageKey) {
|
|
2563
|
-
const [width, setWidth] =
|
|
2564
|
-
const [narrowViewport, setNarrowViewport] =
|
|
2483
|
+
const [width, setWidth] = useState8(SIDEBAR_DEFAULT_WIDTH);
|
|
2484
|
+
const [narrowViewport, setNarrowViewport] = useState8(false);
|
|
2565
2485
|
const collapsed = narrowViewport || width <= SIDEBAR_COLLAPSE_THRESHOLD;
|
|
2566
|
-
|
|
2486
|
+
useEffect7(() => {
|
|
2567
2487
|
let stored = null;
|
|
2568
2488
|
try {
|
|
2569
2489
|
stored = localStorage.getItem(storageKey);
|
|
@@ -2575,14 +2495,14 @@ function useSidebarWidth(storageKey) {
|
|
|
2575
2495
|
queueMicrotask(() => setWidth(snapWidth(clampWidth(parsed))));
|
|
2576
2496
|
}
|
|
2577
2497
|
}, [storageKey]);
|
|
2578
|
-
|
|
2498
|
+
useEffect7(() => {
|
|
2579
2499
|
const media = window.matchMedia("(max-width: 639px)");
|
|
2580
2500
|
const sync = () => setNarrowViewport(media.matches);
|
|
2581
2501
|
sync();
|
|
2582
2502
|
media.addEventListener("change", sync);
|
|
2583
2503
|
return () => media.removeEventListener("change", sync);
|
|
2584
2504
|
}, []);
|
|
2585
|
-
const persist =
|
|
2505
|
+
const persist = useCallback3(
|
|
2586
2506
|
(value) => {
|
|
2587
2507
|
try {
|
|
2588
2508
|
localStorage.setItem(storageKey, String(value));
|
|
@@ -2591,7 +2511,7 @@ function useSidebarWidth(storageKey) {
|
|
|
2591
2511
|
},
|
|
2592
2512
|
[storageKey]
|
|
2593
2513
|
);
|
|
2594
|
-
const setCollapsed =
|
|
2514
|
+
const setCollapsed = useCallback3(
|
|
2595
2515
|
(value) => {
|
|
2596
2516
|
setWidth((current) => {
|
|
2597
2517
|
const next = value ? SIDEBAR_RAIL_WIDTH : current <= SIDEBAR_COLLAPSE_THRESHOLD ? SIDEBAR_DEFAULT_WIDTH : snapWidth(current);
|
|
@@ -2601,11 +2521,11 @@ function useSidebarWidth(storageKey) {
|
|
|
2601
2521
|
},
|
|
2602
2522
|
[persist]
|
|
2603
2523
|
);
|
|
2604
|
-
const resetWidth =
|
|
2524
|
+
const resetWidth = useCallback3(() => {
|
|
2605
2525
|
setWidth(SIDEBAR_DEFAULT_WIDTH);
|
|
2606
2526
|
persist(SIDEBAR_DEFAULT_WIDTH);
|
|
2607
2527
|
}, [persist]);
|
|
2608
|
-
const startResize =
|
|
2528
|
+
const startResize = useCallback3(
|
|
2609
2529
|
(event) => {
|
|
2610
2530
|
event.preventDefault();
|
|
2611
2531
|
const startX = event.clientX;
|
|
@@ -2632,9 +2552,9 @@ function useSidebarWidth(storageKey) {
|
|
|
2632
2552
|
|
|
2633
2553
|
// src/suite/lib/motion.tsx
|
|
2634
2554
|
import { LazyMotion, domAnimation, m } from "motion/react";
|
|
2635
|
-
import { jsx as
|
|
2555
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2636
2556
|
function SuiteMotionProvider({ children }) {
|
|
2637
|
-
return /* @__PURE__ */
|
|
2557
|
+
return /* @__PURE__ */ jsx18(LazyMotion, { features: domAnimation, strict: true, children });
|
|
2638
2558
|
}
|
|
2639
2559
|
var SUITE_SPRINGS = {
|
|
2640
2560
|
/** Snappy panel/sheet entrances — small overshoot. */
|
|
@@ -2646,24 +2566,24 @@ var SUITE_SPRINGS = {
|
|
|
2646
2566
|
};
|
|
2647
2567
|
|
|
2648
2568
|
// src/suite/components/suite-skeleton.tsx
|
|
2649
|
-
import { jsx as
|
|
2569
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2650
2570
|
function SuiteSkeleton({
|
|
2651
2571
|
className,
|
|
2652
2572
|
lines = 1,
|
|
2653
2573
|
circle,
|
|
2654
2574
|
width
|
|
2655
2575
|
}) {
|
|
2656
|
-
return /* @__PURE__ */
|
|
2576
|
+
return /* @__PURE__ */ jsx19(
|
|
2657
2577
|
"div",
|
|
2658
2578
|
{
|
|
2659
2579
|
className: cn("space-y-2", circle ? "flex flex-col items-center" : ""),
|
|
2660
2580
|
"aria-hidden": true,
|
|
2661
|
-
children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */
|
|
2581
|
+
children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ jsx19(
|
|
2662
2582
|
"div",
|
|
2663
2583
|
{
|
|
2664
2584
|
className: "animate-[skeleton-stagger_0.6s_ease-out_both]",
|
|
2665
2585
|
style: { animationDelay: `${index * 80}ms` },
|
|
2666
|
-
children: /* @__PURE__ */
|
|
2586
|
+
children: /* @__PURE__ */ jsx19(
|
|
2667
2587
|
"div",
|
|
2668
2588
|
{
|
|
2669
2589
|
className: cn(
|
|
@@ -2702,20 +2622,20 @@ function SuiteSkeletonCard({
|
|
|
2702
2622
|
className: "mb-5 flex items-center gap-3 animate-[skeleton-stagger_0.5s_ease-out_both]",
|
|
2703
2623
|
style: { animationDelay: "100ms" },
|
|
2704
2624
|
children: [
|
|
2705
|
-
/* @__PURE__ */
|
|
2625
|
+
/* @__PURE__ */ jsx19("div", { className: "ph-skeleton h-10 w-10 rounded-xl" }),
|
|
2706
2626
|
/* @__PURE__ */ jsxs16("div", { className: "flex-1 space-y-2", children: [
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2627
|
+
/* @__PURE__ */ jsx19("div", { className: "ph-skeleton h-4 w-1/3" }),
|
|
2628
|
+
/* @__PURE__ */ jsx19("div", { className: "ph-skeleton h-3 w-1/2" })
|
|
2709
2629
|
] })
|
|
2710
2630
|
]
|
|
2711
2631
|
}
|
|
2712
2632
|
) : null,
|
|
2713
|
-
/* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ jsx19("div", { className: "space-y-3", children: Array.from({ length: rows }).map((_, index) => /* @__PURE__ */ jsx19(
|
|
2714
2634
|
"div",
|
|
2715
2635
|
{
|
|
2716
2636
|
className: "animate-[skeleton-stagger_0.5s_ease-out_both]",
|
|
2717
2637
|
style: { animationDelay: `${200 + index * 80}ms` },
|
|
2718
|
-
children: /* @__PURE__ */
|
|
2638
|
+
children: /* @__PURE__ */ jsx19(
|
|
2719
2639
|
"div",
|
|
2720
2640
|
{
|
|
2721
2641
|
className: "ph-skeleton h-3",
|
|
@@ -2733,16 +2653,16 @@ function SuiteSkeletonList({
|
|
|
2733
2653
|
className,
|
|
2734
2654
|
items = 4
|
|
2735
2655
|
}) {
|
|
2736
|
-
return /* @__PURE__ */
|
|
2656
|
+
return /* @__PURE__ */ jsx19("div", { className: cn("space-y-3", className), "aria-hidden": true, children: Array.from({ length: items }).map((_, index) => /* @__PURE__ */ jsx19(
|
|
2737
2657
|
"div",
|
|
2738
2658
|
{
|
|
2739
2659
|
className: "animate-[skeleton-stagger_0.6s_ease-out_both]",
|
|
2740
2660
|
style: { animationDelay: `${index * 100}ms` },
|
|
2741
2661
|
children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-3 rounded-xl border border-ph-border bg-ph-surface p-4", children: [
|
|
2742
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ jsx19("div", { className: "ph-skeleton h-10 w-10 rounded-lg" }),
|
|
2743
2663
|
/* @__PURE__ */ jsxs16("div", { className: "min-w-0 flex-1 space-y-2", children: [
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2664
|
+
/* @__PURE__ */ jsx19("div", { className: "ph-skeleton h-3.5 w-3/4" }),
|
|
2665
|
+
/* @__PURE__ */ jsx19("div", { className: "ph-skeleton h-3 w-1/2" })
|
|
2746
2666
|
] })
|
|
2747
2667
|
] })
|
|
2748
2668
|
},
|
|
@@ -2767,12 +2687,12 @@ function SuiteEmptyState({
|
|
|
2767
2687
|
),
|
|
2768
2688
|
children: [
|
|
2769
2689
|
/* @__PURE__ */ jsxs16("div", { className: "pointer-events-none absolute inset-0 overflow-hidden opacity-60", "aria-hidden": true, children: [
|
|
2770
|
-
/* @__PURE__ */
|
|
2771
|
-
/* @__PURE__ */
|
|
2690
|
+
/* @__PURE__ */ jsx19("div", { className: "absolute -left-10 -top-10 h-40 w-40 rounded-full bg-ph-brand/10 blur-3xl" }),
|
|
2691
|
+
/* @__PURE__ */ jsx19("div", { className: "absolute -bottom-10 -right-10 h-40 w-40 rounded-full bg-ph-accent/10 blur-3xl" })
|
|
2772
2692
|
] }),
|
|
2773
2693
|
/* @__PURE__ */ jsxs16("div", { className: "relative", children: [
|
|
2774
|
-
icon ? /* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2694
|
+
icon ? /* @__PURE__ */ jsx19("div", { className: "mx-auto mb-4 inline-flex items-center justify-center rounded-2xl bg-ph-muted p-3 shadow-sm ring-1 ring-black/[0.06]", children: icon }) : null,
|
|
2695
|
+
/* @__PURE__ */ jsx19(
|
|
2776
2696
|
"h3",
|
|
2777
2697
|
{
|
|
2778
2698
|
className: cn(
|
|
@@ -2782,8 +2702,8 @@ function SuiteEmptyState({
|
|
|
2782
2702
|
children: title
|
|
2783
2703
|
}
|
|
2784
2704
|
),
|
|
2785
|
-
description ? /* @__PURE__ */
|
|
2786
|
-
action ? /* @__PURE__ */
|
|
2705
|
+
description ? /* @__PURE__ */ jsx19("p", { className: "mx-auto mt-2 max-w-sm text-sm leading-relaxed text-ph-subtle", children: description }) : null,
|
|
2706
|
+
action ? /* @__PURE__ */ jsx19("div", { className: "mt-5 flex flex-wrap items-center justify-center gap-2", children: action }) : null
|
|
2787
2707
|
] })
|
|
2788
2708
|
]
|
|
2789
2709
|
}
|
|
@@ -2792,7 +2712,7 @@ function SuiteEmptyState({
|
|
|
2792
2712
|
|
|
2793
2713
|
// src/suite/components/suite-settings-mobile-nav.tsx
|
|
2794
2714
|
import { isValidElement } from "react";
|
|
2795
|
-
import { jsx as
|
|
2715
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2796
2716
|
function SuiteSettingsMobileNav({
|
|
2797
2717
|
items,
|
|
2798
2718
|
activeHref,
|
|
@@ -2801,16 +2721,16 @@ function SuiteSettingsMobileNav({
|
|
|
2801
2721
|
ariaLabel = "Settings sections",
|
|
2802
2722
|
className
|
|
2803
2723
|
}) {
|
|
2804
|
-
return /* @__PURE__ */
|
|
2724
|
+
return /* @__PURE__ */ jsx20(
|
|
2805
2725
|
"nav",
|
|
2806
2726
|
{
|
|
2807
2727
|
"data-test": dataTest,
|
|
2808
2728
|
"aria-label": ariaLabel,
|
|
2809
2729
|
className: cn("suite-settings-mobile-nav lg:hidden", className),
|
|
2810
|
-
children: /* @__PURE__ */
|
|
2730
|
+
children: /* @__PURE__ */ jsx20("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) => {
|
|
2811
2731
|
const Icon = item.icon;
|
|
2812
2732
|
const active = activeHref === item.href || activeHref.startsWith(`${item.href}/`);
|
|
2813
|
-
const iconNode = isValidElement(item.icon) ? item.icon : /* @__PURE__ */
|
|
2733
|
+
const iconNode = isValidElement(item.icon) ? item.icon : /* @__PURE__ */ jsx20(
|
|
2814
2734
|
Icon,
|
|
2815
2735
|
{
|
|
2816
2736
|
className: cn(
|
|
@@ -2834,8 +2754,8 @@ function SuiteSettingsMobileNav({
|
|
|
2834
2754
|
),
|
|
2835
2755
|
children: [
|
|
2836
2756
|
iconNode,
|
|
2837
|
-
/* @__PURE__ */
|
|
2838
|
-
active ? /* @__PURE__ */
|
|
2757
|
+
/* @__PURE__ */ jsx20("span", { className: "whitespace-nowrap", children: item.label }),
|
|
2758
|
+
active ? /* @__PURE__ */ jsx20("span", { className: "absolute inset-x-0 -bottom-3 h-0.5 rounded-full bg-ph-ink lg:hidden" }) : null
|
|
2839
2759
|
]
|
|
2840
2760
|
},
|
|
2841
2761
|
item.href
|
|
@@ -2847,7 +2767,7 @@ function SuiteSettingsMobileNav({
|
|
|
2847
2767
|
|
|
2848
2768
|
// src/suite/components/suite-sidebar.tsx
|
|
2849
2769
|
import Link2 from "next/link";
|
|
2850
|
-
import { jsx as
|
|
2770
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2851
2771
|
function renderNode(node, collapsed) {
|
|
2852
2772
|
if (typeof node === "function") return node(collapsed);
|
|
2853
2773
|
return node;
|
|
@@ -2882,8 +2802,8 @@ function SuiteSidebar({
|
|
|
2882
2802
|
collapsed ? "flex-col items-center gap-1 px-1 py-2" : "h-14 items-center justify-between gap-2 px-3"
|
|
2883
2803
|
),
|
|
2884
2804
|
children: [
|
|
2885
|
-
/* @__PURE__ */
|
|
2886
|
-
collapsed ? null : /* @__PURE__ */
|
|
2805
|
+
/* @__PURE__ */ jsx21("div", { className: cn("min-w-0", collapsed ? "shrink-0" : "flex-1"), children: renderNode(appSwitcher, collapsed) }),
|
|
2806
|
+
collapsed ? null : /* @__PURE__ */ jsx21("div", { className: "shrink-0", children: renderNode(notificationBell, collapsed) })
|
|
2887
2807
|
]
|
|
2888
2808
|
}
|
|
2889
2809
|
),
|
|
@@ -2902,8 +2822,8 @@ function SuiteSidebar({
|
|
|
2902
2822
|
"aria-label": "Pages",
|
|
2903
2823
|
className: "shrink-0 space-y-0.5",
|
|
2904
2824
|
children: [
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ jsx21("div", { className: cn("mb-3", collapsed && "flex justify-center"), children: renderNode(contextSwitcher, collapsed) }),
|
|
2826
|
+
/* @__PURE__ */ jsx21("div", { className: "space-y-0.5", children: navItems.map((item) => {
|
|
2907
2827
|
const Icon = item.icon;
|
|
2908
2828
|
const active = Boolean(item.active);
|
|
2909
2829
|
const link = /* @__PURE__ */ jsxs18(
|
|
@@ -2919,7 +2839,7 @@ function SuiteSidebar({
|
|
|
2919
2839
|
collapsed ? "mx-auto size-10 shrink-0 justify-center gap-0 px-0 py-0" : "w-full px-2.5 py-2"
|
|
2920
2840
|
),
|
|
2921
2841
|
children: [
|
|
2922
|
-
/* @__PURE__ */
|
|
2842
|
+
/* @__PURE__ */ jsx21(
|
|
2923
2843
|
"span",
|
|
2924
2844
|
{
|
|
2925
2845
|
className: cn(
|
|
@@ -2927,7 +2847,7 @@ function SuiteSidebar({
|
|
|
2927
2847
|
item.iconClassName
|
|
2928
2848
|
),
|
|
2929
2849
|
"aria-hidden": true,
|
|
2930
|
-
children: /* @__PURE__ */
|
|
2850
|
+
children: /* @__PURE__ */ jsx21(
|
|
2931
2851
|
Icon,
|
|
2932
2852
|
{
|
|
2933
2853
|
className: "h-full w-full",
|
|
@@ -2936,7 +2856,7 @@ function SuiteSidebar({
|
|
|
2936
2856
|
)
|
|
2937
2857
|
}
|
|
2938
2858
|
),
|
|
2939
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsx21(
|
|
2940
2860
|
"span",
|
|
2941
2861
|
{
|
|
2942
2862
|
className: cn(
|
|
@@ -2947,17 +2867,17 @@ function SuiteSidebar({
|
|
|
2947
2867
|
children: item.label
|
|
2948
2868
|
}
|
|
2949
2869
|
),
|
|
2950
|
-
!collapsed && item.badge ? /* @__PURE__ */
|
|
2870
|
+
!collapsed && item.badge ? /* @__PURE__ */ jsx21("span", { className: "relative ml-auto shrink-0", children: item.badge }) : null
|
|
2951
2871
|
]
|
|
2952
2872
|
},
|
|
2953
2873
|
item.label
|
|
2954
2874
|
);
|
|
2955
|
-
return collapsed ? /* @__PURE__ */
|
|
2875
|
+
return collapsed ? /* @__PURE__ */ jsx21(Tooltip, { content: item.label, side: "right", children: link }, item.label) : link;
|
|
2956
2876
|
}) })
|
|
2957
2877
|
]
|
|
2958
2878
|
}
|
|
2959
2879
|
),
|
|
2960
|
-
secondaryNav ? /* @__PURE__ */
|
|
2880
|
+
secondaryNav ? /* @__PURE__ */ jsx21(
|
|
2961
2881
|
"div",
|
|
2962
2882
|
{
|
|
2963
2883
|
className: "min-h-0 flex-1",
|
|
@@ -2968,7 +2888,7 @@ function SuiteSidebar({
|
|
|
2968
2888
|
]
|
|
2969
2889
|
}
|
|
2970
2890
|
),
|
|
2971
|
-
/* @__PURE__ */
|
|
2891
|
+
/* @__PURE__ */ jsx21(
|
|
2972
2892
|
"div",
|
|
2973
2893
|
{
|
|
2974
2894
|
className: cn(
|
|
@@ -2985,7 +2905,7 @@ function SuiteSidebar({
|
|
|
2985
2905
|
),
|
|
2986
2906
|
children: [
|
|
2987
2907
|
renderNode(userMenu, collapsed),
|
|
2988
|
-
!collapsed && footerExtras ? /* @__PURE__ */
|
|
2908
|
+
!collapsed && footerExtras ? /* @__PURE__ */ jsx21("div", { className: "ml-auto shrink-0", children: renderNode(footerExtras, collapsed) }) : null
|
|
2989
2909
|
]
|
|
2990
2910
|
}
|
|
2991
2911
|
)
|
|
@@ -2997,7 +2917,7 @@ function SuiteSidebar({
|
|
|
2997
2917
|
}
|
|
2998
2918
|
|
|
2999
2919
|
// src/suite/components/suite-app-layout.tsx
|
|
3000
|
-
import { jsx as
|
|
2920
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3001
2921
|
function SuiteAppLayout({
|
|
3002
2922
|
sidebar,
|
|
3003
2923
|
children,
|
|
@@ -3024,7 +2944,7 @@ function SuiteAppLayout({
|
|
|
3024
2944
|
"data-collapsed": collapsed ? "true" : "false",
|
|
3025
2945
|
children: [
|
|
3026
2946
|
sidebar,
|
|
3027
|
-
onStartResize ? /* @__PURE__ */
|
|
2947
|
+
onStartResize ? /* @__PURE__ */ jsx22(
|
|
3028
2948
|
"div",
|
|
3029
2949
|
{
|
|
3030
2950
|
role: "separator",
|
|
@@ -3039,8 +2959,8 @@ function SuiteAppLayout({
|
|
|
3039
2959
|
}
|
|
3040
2960
|
),
|
|
3041
2961
|
/* @__PURE__ */ jsxs19("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
3042
|
-
mobileHeader ? /* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
2962
|
+
mobileHeader ? /* @__PURE__ */ jsx22("div", { className: "shrink-0 lg:hidden", children: mobileHeader }) : null,
|
|
2963
|
+
/* @__PURE__ */ jsx22(
|
|
3044
2964
|
"main",
|
|
3045
2965
|
{
|
|
3046
2966
|
id: "main-content",
|
|
@@ -3053,7 +2973,7 @@ function SuiteAppLayout({
|
|
|
3053
2973
|
children
|
|
3054
2974
|
}
|
|
3055
2975
|
),
|
|
3056
|
-
bottomNav ? /* @__PURE__ */
|
|
2976
|
+
bottomNav ? /* @__PURE__ */ jsx22("div", { className: "shrink-0 lg:hidden", children: bottomNav }) : null
|
|
3057
2977
|
] })
|
|
3058
2978
|
]
|
|
3059
2979
|
}
|