@sampleapp.ai/sdk 1.0.35 → 1.0.36
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/components/sandbox/Sandbox.js +15 -8
- package/dist/components/sandbox/guardian/ask-ai-view.js +4 -4
- package/dist/components/sandbox/guardian/default-guide-view.js +1 -1
- package/dist/components/sandbox/guardian/demo/left-view.js +2 -2
- package/dist/components/sandbox/guardian/guardian-playground.js +2 -2
- package/dist/components/sandbox/guardian/guardian-style-wrapper.js +21 -2
- package/dist/components/sandbox/guardian/ide/browser.js +30 -30
- package/dist/components/sandbox/guardian/right-view/preview-control-bar.js +3 -3
- package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +1 -1
- package/dist/components/sandbox/guardian/ui/download-and-open-buttons.js +1 -1
- package/dist/components/sandbox/guardian/ui/markdown/code-group/code-block.js +48 -11
- package/dist/components/sandbox/guardian/ui/markdown.js +1 -1
- package/dist/components/sandbox/sandbox-home/SandboxCard.js +4 -4
- package/dist/components/sandbox/sandbox-home/SandboxHome.js +9 -9
- package/dist/components/sandbox/sandbox-home/SearchBar.js +2 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.es.js +7970 -7440
- package/dist/index.standalone.umd.js +1 -1
- package/dist/lib/generated-css.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
|
@@ -24,9 +24,16 @@ import { Skeleton } from "../ui/skeleton";
|
|
|
24
24
|
* apiKey={process.env.NEXT_PUBLIC_SAMPLEAPP_API_KEY!}
|
|
25
25
|
* sandboxId="launchdarkly-feature-flags"
|
|
26
26
|
* />
|
|
27
|
+
*
|
|
28
|
+
* // Light mode
|
|
29
|
+
* <Sandbox
|
|
30
|
+
* apiKey={process.env.NEXT_PUBLIC_SAMPLEAPP_API_KEY!}
|
|
31
|
+
* sandboxId="launchdarkly-feature-flags"
|
|
32
|
+
* theme="light"
|
|
33
|
+
* />
|
|
27
34
|
* ```
|
|
28
35
|
*/
|
|
29
|
-
export default function Sandbox({ apiKey, sandboxId, env, themeColor, }) {
|
|
36
|
+
export default function Sandbox({ apiKey, sandboxId, env, themeColor, theme = "dark", }) {
|
|
30
37
|
var _a;
|
|
31
38
|
const [config, setConfig] = useState(null);
|
|
32
39
|
const [loading, setLoading] = useState(true);
|
|
@@ -61,11 +68,11 @@ export default function Sandbox({ apiKey, sandboxId, env, themeColor, }) {
|
|
|
61
68
|
};
|
|
62
69
|
}, [apiKey, sandboxId, themeColor]);
|
|
63
70
|
if (loading) {
|
|
64
|
-
return (React.createElement("div", { className: "h-screen w-screen bg-black" },
|
|
65
|
-
React.createElement(Skeleton, { className: "w-full h-full bg-zinc-900" })));
|
|
71
|
+
return (React.createElement("div", { className: "h-screen w-screen bg-white dark:bg-black" },
|
|
72
|
+
React.createElement(Skeleton, { className: "w-full h-full bg-zinc-100 dark:bg-zinc-900" })));
|
|
66
73
|
}
|
|
67
74
|
if (error) {
|
|
68
|
-
return (React.createElement("div", { className: "flex items-center justify-center h-screen bg-black" },
|
|
75
|
+
return (React.createElement("div", { className: "flex items-center justify-center h-screen bg-white dark:bg-black" },
|
|
69
76
|
React.createElement("div", { className: "text-red-500" },
|
|
70
77
|
"Error: ",
|
|
71
78
|
error)));
|
|
@@ -76,19 +83,19 @@ export default function Sandbox({ apiKey, sandboxId, env, themeColor, }) {
|
|
|
76
83
|
// Build the nested config from use cases
|
|
77
84
|
const nestedConfig = buildGuardianConfig(config.useCases, {
|
|
78
85
|
playgroundUid: sandboxId,
|
|
79
|
-
playgroundLogo: config.playgroundLogo || (React.createElement("div", { className: "text-white font-bold text-xl" }, config.name)),
|
|
86
|
+
playgroundLogo: config.playgroundLogo || (React.createElement("div", { className: "text-zinc-900 dark:text-white font-bold text-xl" }, config.name)),
|
|
80
87
|
});
|
|
81
88
|
// Get the first use case and framework as defaults
|
|
82
89
|
const firstUseCase = config.useCases[0];
|
|
83
90
|
const firstFramework = (_a = firstUseCase === null || firstUseCase === void 0 ? void 0 : firstUseCase.frameworks[0]) === null || _a === void 0 ? void 0 : _a.key;
|
|
84
91
|
if (!firstUseCase || !firstFramework) {
|
|
85
|
-
return (React.createElement("div", { className: "flex items-center justify-center h-screen bg-black" },
|
|
92
|
+
return (React.createElement("div", { className: "flex items-center justify-center h-screen bg-white dark:bg-black" },
|
|
86
93
|
React.createElement("div", { className: "text-red-500" }, "No use cases or frameworks found")));
|
|
87
94
|
}
|
|
88
95
|
// TODO: Pass env variables to the container runtime
|
|
89
96
|
// This will be implemented when integrating with the container technology
|
|
90
97
|
return (React.createElement(GuardianProvider, null,
|
|
91
98
|
React.createElement(VmProvider, null,
|
|
92
|
-
React.createElement("div", { className: "h-screen w-screen bg-black" },
|
|
93
|
-
React.createElement(GuardianPlayground, { nestedConfig: nestedConfig, useCase: firstUseCase.id, framework: firstFramework, isFrame: false, apiKey: apiKey, env: env, chatUid: config.chatUid })))));
|
|
99
|
+
React.createElement("div", { className: "h-screen w-screen bg-white dark:bg-black" },
|
|
100
|
+
React.createElement(GuardianPlayground, { nestedConfig: nestedConfig, useCase: firstUseCase.id, framework: firstFramework, isFrame: false, apiKey: apiKey, env: env, chatUid: config.chatUid, theme: theme })))));
|
|
94
101
|
}
|
|
@@ -181,12 +181,12 @@ export default function AskAiView({ codeZipFile, playgroundUid, themeColor, }) {
|
|
|
181
181
|
React.createElement("span", { className: "text-muted-foreground text-sm" }, "Thinking...")))))) : (React.createElement("div", { className: "flex h-full items-center justify-center" },
|
|
182
182
|
React.createElement("div", { className: "flex flex-col items-start space-y-4 px-4 max-w-4xl" },
|
|
183
183
|
React.createElement("div", { className: "text-start" },
|
|
184
|
-
React.createElement("h2", { className: "mb-2 text-2xl font-semibold tracking-tight text-gray-200" }, "Hi! Ask me anything"),
|
|
184
|
+
React.createElement("h2", { className: "mb-2 text-2xl font-semibold tracking-tight text-zinc-800 dark:text-gray-200" }, "Hi! Ask me anything"),
|
|
185
185
|
React.createElement("p", { className: "text-muted-foreground text-base" }, "Try: \u201CHow does this sample app work?\u201D"))))),
|
|
186
186
|
React.createElement("div", { ref: messagesEndRef })),
|
|
187
|
-
React.createElement("div", { className: "shrink-0 border-t border-gray-800/50 bg-[#0a0b0f]/95 backdrop-blur-sm" },
|
|
187
|
+
React.createElement("div", { className: "shrink-0 border-t border-zinc-200 dark:border-gray-800/50 bg-zinc-50/95 dark:bg-[#0a0b0f]/95 backdrop-blur-sm" },
|
|
188
188
|
React.createElement("div", { className: "max-w-4xl mx-auto px-4 py-4" },
|
|
189
|
-
React.createElement("div", { className: "flex items-end gap-3 bg-[#1a1b23] rounded-2xl border border-gray-800/50 px-4 py-3 transition-all", style: {
|
|
189
|
+
React.createElement("div", { className: "flex items-end gap-3 bg-white dark:bg-[#1a1b23] rounded-2xl border border-zinc-200 dark:border-gray-800/50 px-4 py-3 transition-all", style: {
|
|
190
190
|
boxShadow: `0 0 0 1px transparent`,
|
|
191
191
|
} },
|
|
192
192
|
React.createElement("div", { className: "flex-1 min-w-0" },
|
|
@@ -195,7 +195,7 @@ export default function AskAiView({ codeZipFile, playgroundUid, themeColor, }) {
|
|
|
195
195
|
e.preventDefault();
|
|
196
196
|
handleSend();
|
|
197
197
|
}
|
|
198
|
-
}, placeholder: "Type your message...", disabled: isLoading, rows: 1, className: "w-full bg-transparent border-0 resize-none text-base text-gray-200 placeholder:text-gray-500 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed max-h-40 overflow-y-auto leading-relaxed", style: {
|
|
198
|
+
}, placeholder: "Type your message...", disabled: isLoading, rows: 1, className: "w-full bg-transparent border-0 resize-none text-base text-zinc-800 dark:text-gray-200 placeholder:text-zinc-400 dark:placeholder:text-gray-500 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed max-h-40 overflow-y-auto leading-relaxed", style: {
|
|
199
199
|
height: "auto",
|
|
200
200
|
minHeight: "32px",
|
|
201
201
|
}, onInput: (e) => {
|
|
@@ -4,7 +4,7 @@ import { Markdown } from "./ui/markdown";
|
|
|
4
4
|
export default function DefaultGuideView({ themeColor, }) {
|
|
5
5
|
return (React.createElement("div", { className: "h-full flex flex-col" },
|
|
6
6
|
React.createElement("div", { className: "flex-1 px-8 py-6" },
|
|
7
|
-
React.createElement(Markdown, { className: "text-gray-100", themeColor: themeColor }, `# Guardian Guide
|
|
7
|
+
React.createElement(Markdown, { className: "text-zinc-900 dark:text-gray-100", themeColor: themeColor }, `# Guardian Guide
|
|
8
8
|
|
|
9
9
|
Learn how to use Guardian to build and deploy your application with confidence.
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ export default function ConsoleWithGuide({ CustomConsole, GuideView, playgroundU
|
|
|
20
20
|
if (typeof CustomConsole === "string") {
|
|
21
21
|
return (React.createElement("div", { className: "h-full flex flex-col" },
|
|
22
22
|
React.createElement("div", { className: "flex-1 px-8 py-6" },
|
|
23
|
-
React.createElement(Markdown, { className: "text-gray-100", themeColor: themeColor, browserUrl: browserUrl, gitUrl: gitUrl, sandboxId: sandboxId, apiKey: apiKey }, CustomConsole))));
|
|
23
|
+
React.createElement(Markdown, { className: "text-zinc-900 dark:text-gray-100", themeColor: themeColor, browserUrl: browserUrl, gitUrl: gitUrl, sandboxId: sandboxId, apiKey: apiKey }, CustomConsole))));
|
|
24
24
|
}
|
|
25
25
|
const CustomConsoleComponent = CustomConsole;
|
|
26
26
|
return (React.createElement(CustomConsoleComponent, { onReloadPreview: onReloadPreview !== null && onReloadPreview !== void 0 ? onReloadPreview : (() => { }), onStageChange: onStageChange !== null && onStageChange !== void 0 ? onStageChange : (() => { }), themeColor: themeColor }));
|
|
@@ -64,7 +64,7 @@ export default function ConsoleWithGuide({ CustomConsole, GuideView, playgroundU
|
|
|
64
64
|
React.createElement("div", { className: "flex-1 min-h-0 overflow-y-auto" }, isConsoleView && renderCustomConsole()),
|
|
65
65
|
React.createElement("div", { className: "relative" },
|
|
66
66
|
React.createElement("div", { className: "flex flex-row w-full items-center text-xs justify-center opacity-30 mt-1 pb-2 bg-background" },
|
|
67
|
-
React.createElement("span", { className: "text-gray-300" }, "Powered by"),
|
|
67
|
+
React.createElement("span", { className: "text-zinc-600 dark:text-gray-300" }, "Powered by"),
|
|
68
68
|
React.createElement("span", { className: "hover:bg-accent rounded-sm p-1 mx-1" },
|
|
69
69
|
React.createElement(Logo, { width: 100, href: "https://sampleapp.ai" })))))));
|
|
70
70
|
}
|
|
@@ -9,7 +9,7 @@ import { GuardianStyleWrapper } from "./guardian-style-wrapper";
|
|
|
9
9
|
*
|
|
10
10
|
* When isFrame=true, reads framework from URL params client-side.
|
|
11
11
|
*/
|
|
12
|
-
export default function GuardianPlayground({ nestedConfig, useCase, framework: serverFramework, isFrame = false, apiKey, env, chatUid, }) {
|
|
12
|
+
export default function GuardianPlayground({ nestedConfig, useCase, framework: serverFramework, isFrame = false, apiKey, env, chatUid, theme = "dark", }) {
|
|
13
13
|
var _a, _b;
|
|
14
14
|
// When in frame mode, allow URL params to override framework
|
|
15
15
|
const frameParams = useFrameParams();
|
|
@@ -40,6 +40,6 @@ export default function GuardianPlayground({ nestedConfig, useCase, framework: s
|
|
|
40
40
|
firstFrameworkByUseCase[useCaseId] = firstFrameworkKey;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
return (React.createElement(GuardianStyleWrapper, { themeColor: frameworkConfig.themeColor },
|
|
43
|
+
return (React.createElement(GuardianStyleWrapper, { themeColor: frameworkConfig.themeColor, theme: theme },
|
|
44
44
|
React.createElement(GuardianComponent, { demoOptions: frameworkConfig.demoOptions, frameworkOptions: frameworkConfig.frameworkOptions, firstFrameworkByUseCase: firstFrameworkByUseCase, currentFramework: frameworkConfig.currentFramework, CustomConsole: frameworkConfig.CustomConsole, GuideView: frameworkConfig.GuideView, playgroundUid: frameworkConfig.playgroundUid, browserUrl: (_a = frameParams.iframeUrl) !== null && _a !== void 0 ? _a : frameworkConfig.browserUrl, useVm: frameworkConfig.useVm, playgroundLogo: frameworkConfig.playgroundLogo, sandboxUid: frameworkConfig.sandboxUid, name: frameworkConfig.name, description: frameworkConfig.description, codeZipFile: frameworkConfig.codeZipFile, completeCodeZipFile: frameworkConfig.completeCodeZipFile, consoleUrlConfigs: frameworkConfig.consoleUrlConfigs, variant: frameworkConfig.variant, themeColor: frameworkConfig.themeColor, hasPreview: (_b = frameworkConfig.hasPreview) !== null && _b !== void 0 ? _b : true, currentUseCase: useCase, isFrame: isFrame, apiKey: apiKey, env: env, chatUid: chatUid, gitUrl: frameworkConfig.gitUrl })));
|
|
45
45
|
}
|
|
@@ -5,9 +5,28 @@ import { TAILWIND_CSS } from "../../../lib/generated-css";
|
|
|
5
5
|
* Style wrapper for Guardian components that injects Tailwind CSS
|
|
6
6
|
* into the document without using Shadow DOM (preserves React context)
|
|
7
7
|
*/
|
|
8
|
-
export const GuardianStyleWrapper = ({ children, themeColor = "#3b82f6", }) => {
|
|
8
|
+
export const GuardianStyleWrapper = ({ children, themeColor = "#3b82f6", theme = "dark", }) => {
|
|
9
9
|
const [stylesInjected, setStylesInjected] = useState(false);
|
|
10
|
+
const [resolvedTheme, setResolvedTheme] = useState(theme === "system" ? "dark" : theme);
|
|
10
11
|
const rootRef = useRef(null);
|
|
12
|
+
// Handle system theme preference
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (theme === "system") {
|
|
15
|
+
// Check if we're in browser environment
|
|
16
|
+
if (typeof window === "undefined")
|
|
17
|
+
return;
|
|
18
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
19
|
+
setResolvedTheme(mediaQuery.matches ? "dark" : "light");
|
|
20
|
+
const handler = (e) => {
|
|
21
|
+
setResolvedTheme(e.matches ? "dark" : "light");
|
|
22
|
+
};
|
|
23
|
+
mediaQuery.addEventListener("change", handler);
|
|
24
|
+
return () => mediaQuery.removeEventListener("change", handler);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
setResolvedTheme(theme);
|
|
28
|
+
}
|
|
29
|
+
}, [theme]);
|
|
11
30
|
useEffect(() => {
|
|
12
31
|
// Only run on client side
|
|
13
32
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
@@ -39,7 +58,7 @@ export const GuardianStyleWrapper = ({ children, themeColor = "#3b82f6", }) => {
|
|
|
39
58
|
rootRef.current.style.setProperty("--colors-secondary", secondaryColor);
|
|
40
59
|
}
|
|
41
60
|
}, [themeColor]);
|
|
42
|
-
return (React.createElement("div", { ref: rootRef, className:
|
|
61
|
+
return (React.createElement("div", { ref: rootRef, className: `guardian-sdk-root bg-background text-foreground ${resolvedTheme === "dark" ? "dark" : ""}`, style: {
|
|
43
62
|
width: "100%",
|
|
44
63
|
height: "100%",
|
|
45
64
|
fontFamily: 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
@@ -494,57 +494,57 @@ export default function Browser({ previewUrl, setPreviewUrl, containerEndpoint,
|
|
|
494
494
|
} }));
|
|
495
495
|
};
|
|
496
496
|
return (React.createElement("div", { className: "flex h-full w-full flex-col" },
|
|
497
|
-
!useVm && !isGuardian && (React.createElement("div", { className: "bg-
|
|
497
|
+
!useVm && !isGuardian && (React.createElement("div", { className: "bg-black border-b border-zinc-800 flex-shrink-0" },
|
|
498
498
|
React.createElement("div", { className: "flex items-center gap-1.5 px-2 py-1.5 h-[2.38rem]" },
|
|
499
499
|
React.createElement("div", { className: "flex gap-0.5" },
|
|
500
|
-
React.createElement("button", { onClick: handleBack, disabled: historyIndex === 0, className: "p-1 hover:bg-zinc-
|
|
501
|
-
React.createElement(ChevronLeft, { size: 14, className: "text-zinc-
|
|
502
|
-
React.createElement("button", { onClick: handleForward, disabled: historyIndex === historyLength - 1, className: "p-1 hover:bg-zinc-
|
|
503
|
-
React.createElement(ChevronRight, { size: 14, className: "text-zinc-
|
|
504
|
-
React.createElement("button", { onClick: handleRefresh, className: "p-1 hover:bg-zinc-
|
|
505
|
-
React.createElement(RefreshCw, { size: 14, className: `text-zinc-
|
|
506
|
-
React.createElement("div", { className: "flex-1 flex items-center gap-1.5 px-2 py-1 bg-zinc-
|
|
507
|
-
error ? (React.createElement(AlertTriangle, { size: 12, className: "text-red-500 flex-shrink-0" })) : (React.createElement(Lock, { size: 12, className: "text-zinc-
|
|
500
|
+
React.createElement("button", { onClick: handleBack, disabled: historyIndex === 0, className: "p-1 hover:bg-zinc-900 rounded disabled:opacity-30 disabled:hover:bg-transparent transition-colors", title: "Back" },
|
|
501
|
+
React.createElement(ChevronLeft, { size: 14, className: "text-zinc-400" })),
|
|
502
|
+
React.createElement("button", { onClick: handleForward, disabled: historyIndex === historyLength - 1, className: "p-1 hover:bg-zinc-900 rounded disabled:opacity-30 disabled:hover:bg-transparent transition-colors", title: "Forward" },
|
|
503
|
+
React.createElement(ChevronRight, { size: 14, className: "text-zinc-400" })),
|
|
504
|
+
React.createElement("button", { onClick: handleRefresh, className: "p-1 hover:bg-zinc-900 rounded transition-colors", title: "Refresh" },
|
|
505
|
+
React.createElement(RefreshCw, { size: 14, className: `text-zinc-400 ${isLoading ? "animate-spin" : ""}` }))),
|
|
506
|
+
React.createElement("div", { className: "flex-1 flex items-center gap-1.5 px-2 py-1 bg-zinc-950 rounded text-zinc-400 focus-within:bg-zinc-900 transition-colors" },
|
|
507
|
+
error ? (React.createElement(AlertTriangle, { size: 12, className: "text-red-500 flex-shrink-0" })) : (React.createElement(Lock, { size: 12, className: "text-zinc-600 flex-shrink-0" })),
|
|
508
508
|
React.createElement("input", { type: "text",
|
|
509
509
|
// value={urlInput}
|
|
510
|
-
value: "/", onChange: (e) => setUrlInput(e.target.value), onKeyDown: handleUrlChange, className: "flex-1 text-xs border-none outline-none bg-transparent text-zinc-
|
|
511
|
-
isGuardian && (React.createElement("button", { onClick: () => setIsBrowserMaximized(!isBrowserMaximized), className: "p-1 hover:bg-zinc-
|
|
510
|
+
value: "/", onChange: (e) => setUrlInput(e.target.value), onKeyDown: handleUrlChange, className: "flex-1 text-xs border-none outline-none bg-transparent text-zinc-300 placeholder:text-zinc-600", placeholder: "Enter URL" }),
|
|
511
|
+
isGuardian && (React.createElement("button", { onClick: () => setIsBrowserMaximized(!isBrowserMaximized), className: "p-1 hover:bg-zinc-900 rounded transition-colors", title: isBrowserMaximized
|
|
512
512
|
? "Exit fullscreen"
|
|
513
|
-
: "Fullscreen preview" }, isBrowserMaximized ? (React.createElement(Minimize2, { size: 14, className: "text-zinc-
|
|
513
|
+
: "Fullscreen preview" }, isBrowserMaximized ? (React.createElement(Minimize2, { size: 14, className: "text-zinc-400" })) : (React.createElement(Maximize2, { size: 14, className: "text-zinc-400" })))),
|
|
514
514
|
React.createElement("button", { onClick: () => {
|
|
515
515
|
window.open(previewUrl, "_blank", "noopener,noreferrer");
|
|
516
|
-
}, className: "ml-1 p-1 hover:bg-zinc-
|
|
517
|
-
React.createElement(ExternalLink, { size: 14, className: "text-zinc-
|
|
516
|
+
}, className: "ml-1 p-1 hover:bg-zinc-900 rounded transition-colors", title: "Open in new tab", disabled: !urlInput || !!error, tabIndex: -1, type: "button" },
|
|
517
|
+
React.createElement(ExternalLink, { size: 14, className: "text-zinc-400" })),
|
|
518
518
|
React.createElement(DropdownMenu, null,
|
|
519
519
|
React.createElement(DropdownMenuTrigger, { asChild: true },
|
|
520
|
-
React.createElement("button", { className: "ml-1 p-1 hover:bg-zinc-
|
|
521
|
-
React.createElement(MoreVertical, { size: 14, className: "text-zinc-
|
|
522
|
-
React.createElement(DropdownMenuContent, { align: "end", className: "bg-
|
|
520
|
+
React.createElement("button", { className: "ml-1 p-1 hover:bg-zinc-900 rounded transition-colors", title: "More options", type: "button" },
|
|
521
|
+
React.createElement(MoreVertical, { size: 14, className: "text-zinc-400" }))),
|
|
522
|
+
React.createElement(DropdownMenuContent, { align: "end", className: "bg-zinc-900 border border-zinc-800" },
|
|
523
523
|
React.createElement(DropdownMenuItem, { onClick: () => {
|
|
524
524
|
// Restart functionality - can be implemented if needed
|
|
525
|
-
}, className: "cursor-pointer text-zinc-
|
|
526
|
-
error && (React.createElement("div", { className: "p-4 bg-red-
|
|
525
|
+
}, className: "cursor-pointer text-zinc-300 hover:bg-zinc-800" }, "Restart App"))))))),
|
|
526
|
+
error && (React.createElement("div", { className: "p-4 bg-red-950 border-b border-red-800 text-red-200 text-sm" },
|
|
527
527
|
React.createElement("div", { className: "flex items-center gap-2" },
|
|
528
528
|
React.createElement(AlertTriangle, { size: 16 }),
|
|
529
529
|
React.createElement("span", null, error)))),
|
|
530
|
-
React.createElement("div", { ref: containerRef, className: "flex-1 min-h-0 relative" }, sandboxError && sandboxError.includes("env is required") ? (React.createElement("div", { className: "h-full w-full flex items-center justify-center bg-zinc-
|
|
530
|
+
React.createElement("div", { ref: containerRef, className: "flex-1 min-h-0 relative" }, sandboxError && sandboxError.includes("env is required") ? (React.createElement("div", { className: "h-full w-full flex items-center justify-center bg-zinc-900" },
|
|
531
531
|
React.createElement("div", { className: "max-w-md mx-auto p-8 text-center" },
|
|
532
532
|
React.createElement("div", { className: "mb-4 flex justify-center" },
|
|
533
|
-
React.createElement(AlertTriangle, { size: 48, className: "text-amber-
|
|
534
|
-
React.createElement("h2", { className: "text-xl font-semibold text-zinc-
|
|
535
|
-
React.createElement("p", { className: "text-sm text-zinc-
|
|
533
|
+
React.createElement(AlertTriangle, { size: 48, className: "text-amber-400" })),
|
|
534
|
+
React.createElement("h2", { className: "text-xl font-semibold text-zinc-100 mb-2" }, "Environment Variables Required"),
|
|
535
|
+
React.createElement("p", { className: "text-sm text-zinc-400 mb-4" },
|
|
536
536
|
"This sandbox doesn't have a published URL and needs to be started dynamically. Please provide the",
|
|
537
537
|
" ",
|
|
538
|
-
React.createElement("code", { className: "px-1.5 py-0.5 bg-zinc-
|
|
538
|
+
React.createElement("code", { className: "px-1.5 py-0.5 bg-zinc-800 rounded text-xs font-mono" }, "env"),
|
|
539
539
|
" ",
|
|
540
540
|
"prop to the",
|
|
541
541
|
" ",
|
|
542
|
-
React.createElement("code", { className: "px-1.5 py-0.5 bg-zinc-
|
|
542
|
+
React.createElement("code", { className: "px-1.5 py-0.5 bg-zinc-800 rounded text-xs font-mono" }, "<Sandbox>"),
|
|
543
543
|
" ",
|
|
544
544
|
"component."),
|
|
545
|
-
React.createElement("div", { className: "mt-6 p-4 bg-zinc-
|
|
546
|
-
React.createElement("p", { className: "text-xs font-mono text-zinc-
|
|
547
|
-
React.createElement("pre", { className: "text-xs text-zinc-
|
|
545
|
+
React.createElement("div", { className: "mt-6 p-4 bg-zinc-800 rounded-lg text-left" },
|
|
546
|
+
React.createElement("p", { className: "text-xs font-mono text-zinc-300 mb-2" }, "Example:"),
|
|
547
|
+
React.createElement("pre", { className: "text-xs text-zinc-400 overflow-x-auto" }, `<Sandbox
|
|
548
548
|
apiKey="your-api-key"
|
|
549
549
|
sandboxId="sandbox-id"
|
|
550
550
|
env={{
|
|
@@ -553,8 +553,8 @@ export default function Browser({ previewUrl, setPreviewUrl, containerEndpoint,
|
|
|
553
553
|
}}
|
|
554
554
|
/>`))))) : (React.createElement(React.Fragment, null,
|
|
555
555
|
renderIframe(),
|
|
556
|
-
isLoading && (React.createElement("div", { className: "absolute inset-0 bg-zinc-
|
|
557
|
-
React.createElement("div", { className: "text-sm text-zinc-
|
|
556
|
+
isLoading && (React.createElement("div", { className: "absolute inset-0 bg-zinc-800 bg-opacity-50 flex items-center justify-center z-10" },
|
|
557
|
+
React.createElement("div", { className: "text-sm text-zinc-400 bg-black p-3 rounded-lg shadow-md" },
|
|
558
558
|
"Loading ",
|
|
559
559
|
urlInput,
|
|
560
560
|
"..."))),
|
|
@@ -16,10 +16,10 @@ export default function PreviewControlBar({ isMinimized, onToggle, onRefresh, th
|
|
|
16
16
|
React.createElement(ChevronDown, { className: "w-4 h-4" })),
|
|
17
17
|
React.createElement("span", { className: "text-sm font-medium", style: { color: effectiveThemeColor } }, "Preview")),
|
|
18
18
|
React.createElement("div", { className: "flex items-center gap-2" },
|
|
19
|
-
externalUrl && (React.createElement("a", { href: externalUrl, target: "_blank", rel: "noopener noreferrer", title: "Open in new tab", style: { color: effectiveThemeColor }, className: "p-1.5 rounded transition-colors hover:bg-zinc-800
|
|
19
|
+
externalUrl && (React.createElement("a", { href: externalUrl, target: "_blank", rel: "noopener noreferrer", title: "Open in new tab", style: { color: effectiveThemeColor }, className: "p-1.5 rounded transition-colors hover:bg-zinc-800" },
|
|
20
20
|
React.createElement(ExternalLink, { className: "w-4 h-4" }),
|
|
21
21
|
React.createElement("span", { className: "sr-only" }, "Open external link"))),
|
|
22
|
-
React.createElement("button", { onClick: onRefresh, className: "p-1.5 rounded transition-colors hover:bg-zinc-800
|
|
22
|
+
React.createElement("button", { onClick: onRefresh, className: "p-1.5 rounded transition-colors hover:bg-zinc-800", title: "Refresh preview", style: { color: effectiveThemeColor } },
|
|
23
23
|
React.createElement(RefreshCw, { className: "w-4 h-4" })),
|
|
24
|
-
React.createElement("button", { onClick: () => setIsBrowserMaximized(!isBrowserMaximized), className: "p-1.5 rounded transition-colors hover:bg-zinc-800
|
|
24
|
+
React.createElement("button", { onClick: () => setIsBrowserMaximized(!isBrowserMaximized), className: "p-1.5 rounded transition-colors hover:bg-zinc-800", title: isBrowserMaximized ? "Exit fullscreen" : "Fullscreen preview", style: { color: effectiveThemeColor } }, isBrowserMaximized ? (React.createElement(Minimize2, { className: "w-4 h-4" })) : (React.createElement(Maximize2, { className: "w-4 h-4" }))))));
|
|
25
25
|
}
|
|
@@ -217,7 +217,7 @@ export default function RightView({ reloadCounter, overlayStage, browserUrl, use
|
|
|
217
217
|
React.createElement("div", { className: "h-full w-full flex flex-col" },
|
|
218
218
|
React.createElement("div", { className: "flex-1 min-h-0 flex flex-col" },
|
|
219
219
|
React.createElement(React.Fragment, null,
|
|
220
|
-
React.createElement("div", { className: "flex items-center justify-between border-b border-zinc-800
|
|
220
|
+
React.createElement("div", { className: "flex items-center justify-between border-b border-zinc-800 bg-zinc-900" },
|
|
221
221
|
React.createElement(PillFileSelector, { themeColor: effectiveThemeColor }),
|
|
222
222
|
React.createElement("div", { className: "px-2 flex-shrink-0" },
|
|
223
223
|
React.createElement("button", { type: "button", className: "inline-flex items-center gap-1 text-[10px] font-medium transition-colors hover:opacity-80", style: { color: effectiveThemeColor }, onClick: handleDownloadAsZip },
|
|
@@ -59,7 +59,7 @@ export const DownloadAndOpenButtons = ({ downloadUrl, themeColor, gitUrl, browse
|
|
|
59
59
|
React.createElement("button", { type: "button", className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md !text-white transition-all hover:opacity-90 active:scale-[0.98]", style: { backgroundColor: themeColor }, onClick: handleDownload },
|
|
60
60
|
React.createElement(DownloadIcon, { className: "w-3.5 h-3.5 !text-white" }),
|
|
61
61
|
"Download example"),
|
|
62
|
-
React.createElement("button", { type: "button", className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border transition-all hover:opacity-90 active:scale-[0.98] bg-zinc-
|
|
62
|
+
React.createElement("button", { type: "button", className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border transition-all hover:opacity-90 active:scale-[0.98] bg-zinc-100 dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-900 dark:text-white", onClick: handleOpenInVSCode },
|
|
63
63
|
React.createElement(VSCodeLogo, { className: "w-3.5 h-3.5" }),
|
|
64
64
|
"Integrate in VS Code")),
|
|
65
65
|
React.createElement(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen },
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import React, { memo, useState } from "react";
|
|
1
|
+
import React, { memo, useState, useEffect } from "react";
|
|
2
2
|
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
3
3
|
import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
4
|
+
import { oneLight } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
4
5
|
import { cn } from "../../../../../../lib/utils";
|
|
5
6
|
import { Copy, CheckCircle2 } from "lucide-react";
|
|
6
7
|
export const CodeBlock = memo(({ language, value, title, className, children, isInsideCodeGroup = false, maxH, }) => {
|
|
7
8
|
const [copied, setCopied] = useState(false);
|
|
9
|
+
const [isDark, setIsDark] = useState(true);
|
|
10
|
+
// Detect if we're in dark mode by checking for .dark class on ancestor
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const checkTheme = () => {
|
|
13
|
+
var _a;
|
|
14
|
+
if (typeof document === "undefined")
|
|
15
|
+
return;
|
|
16
|
+
// Check if guardian-sdk-root has dark class
|
|
17
|
+
const root = document.querySelector(".guardian-sdk-root");
|
|
18
|
+
setIsDark((_a = root === null || root === void 0 ? void 0 : root.classList.contains("dark")) !== null && _a !== void 0 ? _a : true);
|
|
19
|
+
};
|
|
20
|
+
checkTheme();
|
|
21
|
+
// Also check on mount with a slight delay to ensure DOM is ready
|
|
22
|
+
const timer = setTimeout(checkTheme, 100);
|
|
23
|
+
// Watch for changes using MutationObserver
|
|
24
|
+
const observer = new MutationObserver(checkTheme);
|
|
25
|
+
const root = document.querySelector(".guardian-sdk-root");
|
|
26
|
+
if (root) {
|
|
27
|
+
observer.observe(root, {
|
|
28
|
+
attributes: true,
|
|
29
|
+
attributeFilter: ["class"],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
observer.disconnect();
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
8
37
|
let code = value;
|
|
9
38
|
if (typeof children === "string") {
|
|
10
39
|
code = children;
|
|
@@ -22,33 +51,41 @@ export const CodeBlock = memo(({ language, value, title, className, children, is
|
|
|
22
51
|
// If inside CodeGroup, render just the code content
|
|
23
52
|
if (isInsideCodeGroup) {
|
|
24
53
|
return (React.createElement("div", { className: "group relative overflow-x-auto" },
|
|
25
|
-
React.createElement("div", { className: `${maxH || "max-h-[40vh]"} rounded-b-md bg-zinc-900 px-5 py-3 overflow-y-auto [&>pre]:overflow-x-auto` },
|
|
26
|
-
React.createElement("div", { className: "min-w-0 text-[13px]" },
|
|
27
|
-
React.createElement(SyntaxHighlighter, { language: language || "javascript", style: vscDarkPlus, PreTag: "div", customStyle: {
|
|
54
|
+
React.createElement("div", { className: `${maxH || "max-h-[40vh]"} rounded-b-md bg-zinc-100 dark:bg-zinc-900 px-5 py-3 overflow-y-auto [&>pre]:overflow-x-auto` },
|
|
55
|
+
React.createElement("div", { className: "min-w-0 text-[13px] [&_*]:!bg-transparent" },
|
|
56
|
+
React.createElement(SyntaxHighlighter, { language: language || "javascript", style: isDark ? vscDarkPlus : oneLight, PreTag: "div", customStyle: {
|
|
28
57
|
margin: 0,
|
|
29
58
|
padding: 0,
|
|
30
|
-
background: "transparent",
|
|
59
|
+
background: "transparent !important",
|
|
31
60
|
fontSize: "13px",
|
|
32
61
|
width: "100%",
|
|
33
62
|
minWidth: 0,
|
|
34
63
|
maxWidth: "100%",
|
|
64
|
+
}, codeTagProps: {
|
|
65
|
+
style: {
|
|
66
|
+
background: "transparent !important",
|
|
67
|
+
},
|
|
35
68
|
}, wrapLongLines: false }, code || "")))));
|
|
36
69
|
}
|
|
37
70
|
// Standalone code block with title
|
|
38
71
|
return (React.createElement("div", { className: cn("relative w-full border rounded-lg mb-4", className) },
|
|
39
|
-
React.createElement("div", { className: "flex items-center justify-between px-4 py-2 bg-zinc-900 text-primary border-b rounded-t-md" },
|
|
72
|
+
React.createElement("div", { className: "flex items-center justify-between px-4 py-2 bg-zinc-100 dark:bg-zinc-900 text-primary border-b rounded-t-md" },
|
|
40
73
|
React.createElement("span", { className: "text-xs text-primary font-mono" }, language || title || ""),
|
|
41
|
-
React.createElement("button", { type: "button", className: "h-5 w-5 flex items-center justify-center hover:bg-transparent text-zinc-200 hover:text-zinc-300 border-none", onClick: handleCopy }, copied ? (React.createElement(CheckCircle2, { className: "h-3 w-3 text-green-500" })) : (React.createElement(Copy, { className: "h-3 w-3" })))),
|
|
42
|
-
React.createElement("div", { className: `${maxH || "max-h-[40vh]"} rounded-b-md bg-zinc-900 px-5 py-3 overflow-y-auto [&>pre]:overflow-x-auto` },
|
|
43
|
-
React.createElement("div", { className: "min-w-0 text-[13px]" },
|
|
44
|
-
React.createElement(SyntaxHighlighter, { language: language || "javascript", style: vscDarkPlus, PreTag: "div", customStyle: {
|
|
74
|
+
React.createElement("button", { type: "button", className: "h-5 w-5 flex items-center justify-center hover:bg-transparent text-zinc-700 dark:text-zinc-200 hover:text-zinc-900 dark:hover:text-zinc-300 border-none", onClick: handleCopy }, copied ? (React.createElement(CheckCircle2, { className: "h-3 w-3 text-green-500" })) : (React.createElement(Copy, { className: "h-3 w-3" })))),
|
|
75
|
+
React.createElement("div", { className: `${maxH || "max-h-[40vh]"} rounded-b-md bg-zinc-100 dark:bg-zinc-900 px-5 py-3 overflow-y-auto [&>pre]:overflow-x-auto` },
|
|
76
|
+
React.createElement("div", { className: "min-w-0 text-[13px] [&_*]:!bg-transparent" },
|
|
77
|
+
React.createElement(SyntaxHighlighter, { language: language || "javascript", style: isDark ? vscDarkPlus : oneLight, PreTag: "div", customStyle: {
|
|
45
78
|
margin: 0,
|
|
46
79
|
padding: 0,
|
|
47
|
-
background: "transparent",
|
|
80
|
+
background: "transparent !important",
|
|
48
81
|
fontSize: "13px",
|
|
49
82
|
width: "100%",
|
|
50
83
|
minWidth: 0,
|
|
51
84
|
maxWidth: "100%",
|
|
85
|
+
}, codeTagProps: {
|
|
86
|
+
style: {
|
|
87
|
+
background: "transparent !important",
|
|
88
|
+
},
|
|
52
89
|
}, wrapLongLines: false }, code || "")))));
|
|
53
90
|
});
|
|
54
91
|
CodeBlock.displayName = "CodeBlock";
|
|
@@ -229,7 +229,7 @@ export const Markdown = ({ children, className, isRestricted, showToc, themeColo
|
|
|
229
229
|
// If it's an inline code block, render it as a small block by default
|
|
230
230
|
// so it visually separates from the surrounding text instead of sitting inline.
|
|
231
231
|
if (isInline) {
|
|
232
|
-
return (React.createElement("code", Object.assign({ className: cn("inline-block text-
|
|
232
|
+
return (React.createElement("code", Object.assign({ className: cn("inline-block text-zinc-900 dark:text-zinc-100 text-sm bg-zinc-100 dark:bg-zinc-800 px-2 py-1 rounded-lg mt-2 font-mono", className) }, props), children));
|
|
233
233
|
}
|
|
234
234
|
// Extract language and title
|
|
235
235
|
const language = (match === null || match === void 0 ? void 0 : match[1]) || "";
|
|
@@ -50,14 +50,14 @@ export const SandboxCard = ({ title, description, sandboxId, basePath = "/sandbo
|
|
|
50
50
|
window.location.href = `${cleanBasePath}/${sandboxId}`;
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
return (React.createElement("div", { onClick: handleClick, className: "group relative block min-w-[240px] w-full h-[200px] border border-[#333] bg-[#0a0a0a] rounded-lg overflow-hidden transition-all duration-100 ease-out hover:border-[#444] focus-visible:outline-none cursor-pointer" },
|
|
53
|
+
return (React.createElement("div", { onClick: handleClick, className: "group relative block min-w-[240px] w-full h-[200px] border border-zinc-200 dark:border-[#333] bg-zinc-50 dark:bg-[#0a0a0a] rounded-lg overflow-hidden transition-all duration-100 ease-out hover:border-zinc-300 dark:hover:border-[#444] focus-visible:outline-none cursor-pointer" },
|
|
54
54
|
React.createElement("div", { className: "flex flex-col gap-1 px-6 py-5" },
|
|
55
55
|
React.createElement("div", { className: "flex items-center max-w-max pr-2.5" },
|
|
56
|
-
React.createElement("h3", { className: "text-[16px] font-medium m-0 w-max whitespace-nowrap overflow-hidden text-ellipsis flex-1 mr-0 text-white" }, safeTitle),
|
|
56
|
+
React.createElement("h3", { className: "text-[16px] font-medium m-0 w-max whitespace-nowrap overflow-hidden text-ellipsis flex-1 mr-0 text-zinc-900 dark:text-white" }, safeTitle),
|
|
57
57
|
React.createElement("svg", { className: "rotate-[-45deg] translate-x-[-2px] opacity-0 transition-all duration-100 ease-out origin-center group-hover:opacity-100 group-hover:translate-x-[4px] ml-1", height: "16", strokeLinejoin: "round", style: { width: 12, height: 12, color: "currentColor" }, viewBox: "0 0 16 16", width: "16" },
|
|
58
58
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.53033 2.21968L9 1.68935L7.93934 2.75001L8.46967 3.28034L12.4393 7.25001H1.75H1V8.75001H1.75H12.4393L8.46967 12.7197L7.93934 13.25L9 14.3107L9.53033 13.7803L14.6036 8.70711C14.9941 8.31659 14.9941 7.68342 14.6036 7.2929L9.53033 2.21968Z", fill: "currentColor" }))),
|
|
59
|
-
React.createElement("p", { className: "text-[14px] text-gray-400 m-0 line-clamp-2" }, safeDescription)),
|
|
60
|
-
React.createElement("div", { className: "absolute top-[110px] -right-10 w-[300px] h-[100px] rounded-lg border border-[#333] overflow-hidden shadow-lg transition-transform duration-100 ease-out rotate-[-5deg] group-hover:rotate-[-3deg] group-hover:-translate-y-1 group-hover:-translate-x-0.5" }, imageUrl ? (React.createElement("img", { src: imageUrl, alt: safeTitle, className: "w-full h-full object-cover", style: { transform: "rotate(0deg)" } })) : (React.createElement("div", { className: `w-full h-full bg-gradient-to-br ${gradient} flex items-center justify-center` },
|
|
59
|
+
React.createElement("p", { className: "text-[14px] text-zinc-500 dark:text-gray-400 m-0 line-clamp-2" }, safeDescription)),
|
|
60
|
+
React.createElement("div", { className: "absolute top-[110px] -right-10 w-[300px] h-[100px] rounded-lg border border-zinc-200 dark:border-[#333] overflow-hidden shadow-lg transition-transform duration-100 ease-out rotate-[-5deg] group-hover:rotate-[-3deg] group-hover:-translate-y-1 group-hover:-translate-x-0.5" }, imageUrl ? (React.createElement("img", { src: imageUrl, alt: safeTitle, className: "w-full h-full object-cover", style: { transform: "rotate(0deg)" } })) : (React.createElement("div", { className: `w-full h-full bg-gradient-to-br ${gradient} flex items-center justify-center` },
|
|
61
61
|
React.createElement("div", { className: "w-full px-6 space-y-2" },
|
|
62
62
|
React.createElement("div", { className: "h-2 bg-white/20 rounded w-1/2 mx-auto" }),
|
|
63
63
|
React.createElement("div", { className: "h-1.5 bg-white/10 rounded w-3/4 mx-auto" }),
|
|
@@ -90,26 +90,26 @@ export const SandboxHome = ({ apiKey, orgid, sandboxes, basePath = "/sandbox", }
|
|
|
90
90
|
return matchesTitle || matchesDescription;
|
|
91
91
|
});
|
|
92
92
|
}, [allSandboxes, searchQuery]);
|
|
93
|
-
return (React.createElement("div", { className: "min-h-screen bg-black" },
|
|
93
|
+
return (React.createElement("div", { className: "min-h-screen bg-white dark:bg-black" },
|
|
94
94
|
React.createElement("div", { className: "pt-16 pb-12 px-4 md:px-6" },
|
|
95
95
|
React.createElement("div", { className: "max-w-[1400px] mx-auto" },
|
|
96
96
|
React.createElement(SearchBar, { value: searchQuery, onChange: setSearchQuery }))),
|
|
97
97
|
React.createElement("div", { className: "px-4 md:px-6 pb-16" },
|
|
98
|
-
React.createElement("div", { className: "max-w-[1400px] mx-auto" }, loading ? (React.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4" }, [...Array(6)].map((_, i) => (React.createElement("div", { key: i, className: "relative block min-w-[240px] w-full h-[200px] border border-[#333] bg-[#0a0a0a] rounded-lg overflow-hidden" },
|
|
98
|
+
React.createElement("div", { className: "max-w-[1400px] mx-auto" }, loading ? (React.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4" }, [...Array(6)].map((_, i) => (React.createElement("div", { key: i, className: "relative block min-w-[240px] w-full h-[200px] border border-zinc-200 dark:border-[#333] bg-zinc-50 dark:bg-[#0a0a0a] rounded-lg overflow-hidden" },
|
|
99
99
|
React.createElement("div", { className: "flex flex-col gap-1 px-6 py-5" },
|
|
100
100
|
React.createElement("div", { className: "flex items-center max-w-max pr-2.5" },
|
|
101
|
-
React.createElement(Skeleton, { className: "h-5 w-32 bg-zinc-800" })),
|
|
102
|
-
React.createElement(Skeleton, { className: "h-4 w-full bg-zinc-800 mt-1" }),
|
|
103
|
-
React.createElement(Skeleton, { className: "h-4 w-3/4 bg-zinc-800 mt-1" })),
|
|
104
|
-
React.createElement("div", { className: "absolute top-[110px] -right-10 w-[300px] h-[100px] rounded-lg border border-[#333] overflow-hidden shadow-lg rotate-[-5deg]" },
|
|
105
|
-
React.createElement(Skeleton, { className: "w-full h-full bg-zinc-800" }))))))) : error && !sandboxes ? (React.createElement("div", { className: "col-span-full text-center py-16" },
|
|
101
|
+
React.createElement(Skeleton, { className: "h-5 w-32 bg-zinc-200 dark:bg-zinc-800" })),
|
|
102
|
+
React.createElement(Skeleton, { className: "h-4 w-full bg-zinc-200 dark:bg-zinc-800 mt-1" }),
|
|
103
|
+
React.createElement(Skeleton, { className: "h-4 w-3/4 bg-zinc-200 dark:bg-zinc-800 mt-1" })),
|
|
104
|
+
React.createElement("div", { className: "absolute top-[110px] -right-10 w-[300px] h-[100px] rounded-lg border border-zinc-200 dark:border-[#333] overflow-hidden shadow-lg rotate-[-5deg]" },
|
|
105
|
+
React.createElement(Skeleton, { className: "w-full h-full bg-zinc-200 dark:bg-zinc-800" }))))))) : error && !sandboxes ? (React.createElement("div", { className: "col-span-full text-center py-16" },
|
|
106
106
|
React.createElement("p", { className: "text-red-500 text-lg" },
|
|
107
107
|
"Error: ",
|
|
108
108
|
error),
|
|
109
|
-
React.createElement("p", { className: "text-gray-500 text-sm mt-2" }, "Please check your API key and try again."))) : (React.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4" }, filteredSandboxes && filteredSandboxes.length > 0 ? (filteredSandboxes
|
|
109
|
+
React.createElement("p", { className: "text-zinc-500 dark:text-gray-500 text-sm mt-2" }, "Please check your API key and try again."))) : (React.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4" }, filteredSandboxes && filteredSandboxes.length > 0 ? (filteredSandboxes
|
|
110
110
|
.filter((sandbox) => sandbox && sandbox.title && sandbox.description)
|
|
111
111
|
.map((sandbox) => (React.createElement(SandboxCard, { key: sandbox.id, title: sandbox.title || "", description: sandbox.description || "", sandboxId: sandbox.sandboxId, basePath: basePath, imageUrl: `https://sampleappassets.blob.core.windows.net/assets/${orgid}/${sandbox.id}.png` })))) : (React.createElement("div", { className: "col-span-full text-center py-16" },
|
|
112
|
-
React.createElement("p", { className: "text-gray-500 text-lg" }, searchQuery
|
|
112
|
+
React.createElement("p", { className: "text-zinc-500 dark:text-gray-500 text-lg" }, searchQuery
|
|
113
113
|
? `No sandboxes found matching "${searchQuery}".`
|
|
114
114
|
: "No sandboxes available. Provide sandboxes prop to display cards.")))))))));
|
|
115
115
|
};
|
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
export const SearchBar = ({ value, onChange, placeholder = "Search sample apps...", }) => {
|
|
7
7
|
return (React.createElement("div", { className: "relative max-w-md mx-auto" },
|
|
8
8
|
React.createElement("div", { className: "absolute inset-y-0 left-4 flex items-center pointer-events-none" },
|
|
9
|
-
React.createElement("svg", { className: "w-4 h-4 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
|
|
9
|
+
React.createElement("svg", { className: "w-4 h-4 text-zinc-400 dark:text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
|
|
10
10
|
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }))),
|
|
11
|
-
React.createElement("input", { type: "text", placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), className: "w-full bg-[#0a0a0a] border border-[#222] rounded-lg py-3 pl-11 pr-4 text-sm text-white placeholder:text-gray-500 focus:outline-none focus:border-gray-600 transition-colors" })));
|
|
11
|
+
React.createElement("input", { type: "text", placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), className: "w-full bg-white dark:bg-[#0a0a0a] border border-zinc-200 dark:border-[#222] rounded-lg py-3 pl-11 pr-4 text-sm text-zinc-900 dark:text-white placeholder:text-zinc-400 dark:placeholder:text-gray-500 focus:outline-none focus:border-zinc-400 dark:focus:border-gray-600 transition-colors" })));
|
|
12
12
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -248,7 +248,7 @@ export declare type GuardianNestedConfig = Record<string, GuardianUseCaseConfig>
|
|
|
248
248
|
*
|
|
249
249
|
* When isFrame=true, reads framework from URL params client-side.
|
|
250
250
|
*/
|
|
251
|
-
export declare function GuardianPlayground({ nestedConfig, useCase, framework: serverFramework, isFrame, apiKey, env, chatUid, }: {
|
|
251
|
+
export declare function GuardianPlayground({ nestedConfig, useCase, framework: serverFramework, isFrame, apiKey, env, chatUid, theme, }: {
|
|
252
252
|
/** Nested config structure (use case → framework → config) */
|
|
253
253
|
nestedConfig: GuardianNestedConfig;
|
|
254
254
|
/** Current use case ID */
|
|
@@ -263,6 +263,8 @@ export declare function GuardianPlayground({ nestedConfig, useCase, framework: s
|
|
|
263
263
|
env?: Record<string, string>;
|
|
264
264
|
/** Chat UID for starting sandbox */
|
|
265
265
|
chatUid?: string;
|
|
266
|
+
/** Theme mode - "light", "dark", or "system". Defaults to "dark" */
|
|
267
|
+
theme?: ThemeMode;
|
|
266
268
|
}): default_2.JSX.Element;
|
|
267
269
|
|
|
268
270
|
export declare function GuardianProvider({ children }: {
|
|
@@ -343,9 +345,16 @@ declare class SampleAppSDK {
|
|
|
343
345
|
* apiKey={process.env.NEXT_PUBLIC_SAMPLEAPP_API_KEY!}
|
|
344
346
|
* sandboxId="launchdarkly-feature-flags"
|
|
345
347
|
* />
|
|
348
|
+
*
|
|
349
|
+
* // Light mode
|
|
350
|
+
* <Sandbox
|
|
351
|
+
* apiKey={process.env.NEXT_PUBLIC_SAMPLEAPP_API_KEY!}
|
|
352
|
+
* sandboxId="launchdarkly-feature-flags"
|
|
353
|
+
* theme="light"
|
|
354
|
+
* />
|
|
346
355
|
* ```
|
|
347
356
|
*/
|
|
348
|
-
export declare function Sandbox({ apiKey, sandboxId, env, themeColor, }: SandboxProps): default_2.JSX.Element | null;
|
|
357
|
+
export declare function Sandbox({ apiKey, sandboxId, env, themeColor, theme, }: SandboxProps): default_2.JSX.Element | null;
|
|
349
358
|
|
|
350
359
|
export declare const SandboxHome: React_2.FC<SandboxHomeProps>;
|
|
351
360
|
|
|
@@ -379,6 +388,8 @@ export declare interface SandboxProps {
|
|
|
379
388
|
env?: Record<string, string>;
|
|
380
389
|
/** Optional theme color override */
|
|
381
390
|
themeColor?: string;
|
|
391
|
+
/** Theme mode - "light", "dark", or "system". Defaults to "dark" */
|
|
392
|
+
theme?: ThemeMode;
|
|
382
393
|
}
|
|
383
394
|
|
|
384
395
|
declare interface SandboxUrlConfig {
|
|
@@ -431,6 +442,14 @@ export declare interface ThemeColors {
|
|
|
431
442
|
};
|
|
432
443
|
}
|
|
433
444
|
|
|
445
|
+
/**
|
|
446
|
+
* Theme mode for the SDK
|
|
447
|
+
* - "light": Light mode
|
|
448
|
+
* - "dark": Dark mode
|
|
449
|
+
* - "system": Follows system preference
|
|
450
|
+
*/
|
|
451
|
+
export declare type ThemeMode = "light" | "dark" | "system";
|
|
452
|
+
|
|
434
453
|
export declare type ThemeName = "ocean" | "autumn" | "mint" | "sunset" | "lavender" | "forest" | "coral";
|
|
435
454
|
|
|
436
455
|
export declare const themes: Record<ThemeName, ThemeColors>;
|