@sampleapp.ai/sdk 1.0.35 → 1.0.37
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 +20 -8
- package/dist/components/sandbox/api.js +3 -2
- 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-component.js +7 -38
- package/dist/components/sandbox/guardian/guardian-playground.js +3 -3
- package/dist/components/sandbox/guardian/guardian-style-wrapper.js +21 -2
- package/dist/components/sandbox/guardian/hooks/use-sandbox-url-loader.js +12 -10
- package/dist/components/sandbox/guardian/ide/browser.js +30 -30
- package/dist/components/sandbox/guardian/index.js +1 -1
- 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 +2 -2
- 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 +3 -3
- package/dist/components/sandbox/guardian/utils.js +0 -18
- package/dist/components/sandbox/index.js +1 -1
- package/dist/components/sandbox/sandbox-home/SandboxCard.js +4 -4
- package/dist/components/sandbox/sandbox-home/SandboxHome.js +14 -9
- package/dist/components/sandbox/sandbox-home/SearchBar.js +2 -2
- package/dist/index.d.ts +29 -42
- package/dist/index.es.js +8208 -7715
- package/dist/index.js +1 -1
- package/dist/index.standalone.umd.js +1 -1
- package/dist/lib/api-client.js +9 -26
- 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
- package/dist/components/guardian/app-layout-no-sidebar.js +0 -8
- package/dist/components/guardian/ask-ai-view.js +0 -249
- package/dist/components/guardian/code-focus-section.d.ts +0 -41
- package/dist/components/guardian/code-focus-section.js +0 -174
- package/dist/components/guardian/context/guardian-context.js +0 -94
- package/dist/components/guardian/context/vm-context.js +0 -28
- package/dist/components/guardian/default-guide-view.js +0 -34
- package/dist/components/guardian/demo/guardian-demo.js +0 -35
- package/dist/components/guardian/demo/left-view/toggle.js +0 -28
- package/dist/components/guardian/demo/left-view.js +0 -49
- package/dist/components/guardian/guardian-component.js +0 -79
- package/dist/components/guardian/guardian-demo.js +0 -35
- package/dist/components/guardian/guardian-home.d.ts +0 -4
- package/dist/components/guardian/guardian-home.js +0 -61
- package/dist/components/guardian/guardian-playground.js +0 -45
- package/dist/components/guardian/guardian-style-wrapper.js +0 -29
- package/dist/components/guardian/guardian-upload-spec.d.ts +0 -14
- package/dist/components/guardian/guardian-upload-spec.js +0 -160
- package/dist/components/guardian/header/glassmorphic-combobox.d.ts +0 -15
- package/dist/components/guardian/header/glassmorphic-combobox.js +0 -30
- package/dist/components/guardian/header.js +0 -61
- package/dist/components/guardian/hooks/use-frame-messages.js +0 -65
- package/dist/components/guardian/hooks/use-frame-params.js +0 -44
- package/dist/components/guardian/hooks/use-sandbox-url-loader.js +0 -101
- package/dist/components/guardian/ide/browser.js +0 -538
- package/dist/components/guardian/index.js +0 -8
- package/dist/components/guardian/layout/app-layout-no-sidebar.js +0 -8
- package/dist/components/guardian/layout/header/glassmorphic-combobox.js +0 -48
- package/dist/components/guardian/layout/header.js +0 -63
- package/dist/components/guardian/right-view/code-view.js +0 -56
- package/dist/components/guardian/right-view/pill-file-selector.js +0 -233
- package/dist/components/guardian/right-view/preview-control-bar.js +0 -25
- package/dist/components/guardian/right-view/right-panel-view.js +0 -38
- package/dist/components/guardian/right-view/right-top-down-view.js +0 -289
- package/dist/components/guardian/right-view/right-view.js +0 -28
- package/dist/components/guardian/right-view/simplified-editor.js +0 -234
- package/dist/components/guardian/types/ide-types.js +0 -162
- package/dist/components/guardian/types.js +0 -3
- package/dist/components/guardian/ui/ai-loader.js +0 -48
- package/dist/components/guardian/ui/badge.js +0 -24
- package/dist/components/guardian/ui/button.js +0 -45
- package/dist/components/guardian/ui/command.js +0 -63
- package/dist/components/guardian/ui/console-with-app.js +0 -17
- package/dist/components/guardian/ui/dialog.js +0 -57
- package/dist/components/guardian/ui/dropdown-menu.js +0 -82
- package/dist/components/guardian/ui/markdown.js +0 -57
- package/dist/components/guardian/ui/popover.js +0 -25
- package/dist/components/guardian/ui/tooltip.js +0 -25
- package/dist/components/guardian/utils.js +0 -88
- package/dist/components/guardian/zip-to-codebase.js +0 -246
- package/dist/components/guardian/zip-to-filetree.js +0 -284
- package/dist/components/sandbox/SandboxHome.js +0 -141
- package/dist/components/sandbox/guardian/guardian-demo.js +0 -35
- package/dist/components/sandbox/guardian/guardian-home.d.ts +0 -4
- package/dist/components/sandbox/guardian/guardian-home.js +0 -61
- package/dist/components/sandbox/guardian/guardian-upload-spec.d.ts +0 -14
- package/dist/components/sandbox/guardian/guardian-upload-spec.js +0 -160
- package/dist/components/sandbox/guardian/ui/theme-color-context.d.ts +0 -6
- package/dist/components/sandbox/sandbox-control-bar.js +0 -91
- package/dist/components/sandbox/sandbox-header.js +0 -52
- package/dist/components/sandbox/sandbox-left-panel.js +0 -248
- package/dist/components/sandbox/sandbox-loading.js +0 -48
- package/dist/components/sandbox/sandbox-right-panel.js +0 -247
- package/dist/components/sandbox.js +0 -32
- package/dist/lib/api-client.example.js +0 -60
- package/dist/lib/ssr-safe-decode-entity.js +0 -16
|
@@ -31,7 +31,7 @@ import { CalloutTip } from "./markdown/callout/callout-tip";
|
|
|
31
31
|
import { CalloutWarning } from "./markdown/callout/callout-warning";
|
|
32
32
|
import { CardGroup } from "./markdown/card-group";
|
|
33
33
|
import { Card } from "./markdown/card-group/card";
|
|
34
|
-
import CodeFocusSection from "
|
|
34
|
+
import CodeFocusSection from "../code-focus-section";
|
|
35
35
|
import { DownloadAndOpenButtons } from "./download-and-open-buttons";
|
|
36
36
|
// Stub components for components that don't exist in SDK
|
|
37
37
|
const ButtonFileServer = ({ title, description, filePath, feature, fileContent, color, }) => {
|
|
@@ -51,7 +51,7 @@ const createId = (text) => {
|
|
|
51
51
|
};
|
|
52
52
|
export const MemoizedReactMarkdown = memo(ReactMarkdown, (prevProps, nextProps) => prevProps.children === nextProps.children &&
|
|
53
53
|
prevProps.className === nextProps.className);
|
|
54
|
-
export const Markdown = ({ children, className, isRestricted, showToc, themeColor, browserUrl, gitUrl, sandboxId, apiKey }) => {
|
|
54
|
+
export const Markdown = ({ children, className, isRestricted, showToc, themeColor, browserUrl, gitUrl, sandboxId, apiKey, }) => {
|
|
55
55
|
const headingRenderer = (level) => {
|
|
56
56
|
return (_a) => {
|
|
57
57
|
var _b, _c;
|
|
@@ -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]) || "";
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { FrameworkLabel } from "./types/ide-types";
|
|
2
2
|
import { createApiClient } from "../../../lib/api-client";
|
|
3
|
-
/**
|
|
4
|
-
* Creates sandbox URL configs for preloading from a framework's urlsToPreload.
|
|
5
|
-
* Only includes URLs that need VM preloading (useVm: true).
|
|
6
|
-
* Uses the same sandboxUid for all configs since caching is done by sandboxUid + browserUrl.
|
|
7
|
-
*/
|
|
8
|
-
export function createSandboxUrlConfigs(sandboxUid, urlsToPreload) {
|
|
9
|
-
if (!urlsToPreload) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
return urlsToPreload
|
|
13
|
-
.filter((config) => config.useVm)
|
|
14
|
-
.map((config) => ({
|
|
15
|
-
sandboxUid: config.suffix ? `${sandboxUid}-${config.suffix}` : sandboxUid,
|
|
16
|
-
browserUrl: config.browserUrl,
|
|
17
|
-
useVm: config.useVm,
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
3
|
/**
|
|
21
4
|
* Builds a nested GuardianConfig from use cases with nested frameworks.
|
|
22
5
|
* Returns a structure where config[useCaseId].frameworks[frameworkKey] gives you the full config.
|
|
@@ -66,7 +49,6 @@ export function buildGuardianConfig(useCases, options) {
|
|
|
66
49
|
sandboxUid: fw.sandboxUid,
|
|
67
50
|
codeZipFile: fw.codeZipFile,
|
|
68
51
|
completeCodeZipFile: fw.completeCodeZipFile,
|
|
69
|
-
consoleUrlConfigs: createSandboxUrlConfigs(fw.sandboxUid, fw.urlsToPreload),
|
|
70
52
|
themeColor: (_a = fw.themeColor) !== null && _a !== void 0 ? _a : uc.themeColor,
|
|
71
53
|
variant,
|
|
72
54
|
hasPreview: uc.hasPreview,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as Sandbox } from "./Sandbox";
|
|
2
2
|
export { SandboxHome, SandboxCard } from "./sandbox-home";
|
|
3
3
|
// Re-export guardian components for advanced usage
|
|
4
|
-
export { GuardianPlayground, GuardianComponent, GuardianProvider, VmProvider, buildGuardianConfig,
|
|
4
|
+
export { GuardianPlayground, GuardianComponent, GuardianProvider, VmProvider, buildGuardianConfig, } from "./guardian";
|
|
@@ -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" }),
|
|
@@ -38,6 +38,11 @@ function transformSandboxContent(content) {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
export const SandboxHome = ({ apiKey, orgid, sandboxes, basePath = "/sandbox", }) => {
|
|
41
|
+
// Validate apiKey immediately
|
|
42
|
+
if (!apiKey || apiKey.trim() === "") {
|
|
43
|
+
return (React.createElement("div", { className: "flex items-center justify-center min-h-screen bg-white dark:bg-black" },
|
|
44
|
+
React.createElement("div", { className: "text-red-500" }, "Error: apiKey is required. Please provide a valid API key.")));
|
|
45
|
+
}
|
|
41
46
|
// Start loading as true if we need to fetch (no sandboxes prop provided)
|
|
42
47
|
const [loading, setLoading] = useState(!sandboxes);
|
|
43
48
|
const [error, setError] = useState(null);
|
|
@@ -90,26 +95,26 @@ export const SandboxHome = ({ apiKey, orgid, sandboxes, basePath = "/sandbox", }
|
|
|
90
95
|
return matchesTitle || matchesDescription;
|
|
91
96
|
});
|
|
92
97
|
}, [allSandboxes, searchQuery]);
|
|
93
|
-
return (React.createElement("div", { className: "min-h-screen bg-black" },
|
|
98
|
+
return (React.createElement("div", { className: "min-h-screen bg-white dark:bg-black" },
|
|
94
99
|
React.createElement("div", { className: "pt-16 pb-12 px-4 md:px-6" },
|
|
95
100
|
React.createElement("div", { className: "max-w-[1400px] mx-auto" },
|
|
96
101
|
React.createElement(SearchBar, { value: searchQuery, onChange: setSearchQuery }))),
|
|
97
102
|
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" },
|
|
103
|
+
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
104
|
React.createElement("div", { className: "flex flex-col gap-1 px-6 py-5" },
|
|
100
105
|
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" },
|
|
106
|
+
React.createElement(Skeleton, { className: "h-5 w-32 bg-zinc-200 dark:bg-zinc-800" })),
|
|
107
|
+
React.createElement(Skeleton, { className: "h-4 w-full bg-zinc-200 dark:bg-zinc-800 mt-1" }),
|
|
108
|
+
React.createElement(Skeleton, { className: "h-4 w-3/4 bg-zinc-200 dark:bg-zinc-800 mt-1" })),
|
|
109
|
+
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]" },
|
|
110
|
+
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
111
|
React.createElement("p", { className: "text-red-500 text-lg" },
|
|
107
112
|
"Error: ",
|
|
108
113
|
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
|
|
114
|
+
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
115
|
.filter((sandbox) => sandbox && sandbox.title && sandbox.description)
|
|
111
116
|
.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
|
|
117
|
+
React.createElement("p", { className: "text-zinc-500 dark:text-gray-500 text-lg" }, searchQuery
|
|
113
118
|
? `No sandboxes found matching "${searchQuery}".`
|
|
114
119
|
: "No sandboxes available. Provide sandboxes prop to display cards.")))))))));
|
|
115
120
|
};
|
|
@@ -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
|
@@ -117,13 +117,6 @@ declare interface CodeOutput {
|
|
|
117
117
|
full_code: string;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/**
|
|
121
|
-
* Creates sandbox URL configs for preloading from a framework's urlsToPreload.
|
|
122
|
-
* Only includes URLs that need VM preloading (useVm: true).
|
|
123
|
-
* Uses the same sandboxUid for all configs since caching is done by sandboxUid + browserUrl.
|
|
124
|
-
*/
|
|
125
|
-
export declare function createSandboxUrlConfigs(sandboxUid: string, urlsToPreload?: UrlToPreload[]): SandboxUrlConfig[];
|
|
126
|
-
|
|
127
120
|
export declare const DEFAULT_THEME: ThemeName;
|
|
128
121
|
|
|
129
122
|
export declare enum Framework {
|
|
@@ -138,7 +131,7 @@ export declare enum Framework {
|
|
|
138
131
|
|
|
139
132
|
export declare const getTheme: (themeName?: ThemeName) => ThemeColors;
|
|
140
133
|
|
|
141
|
-
export declare function GuardianComponent({ demoOptions, frameworkOptions, firstFrameworkByUseCase, currentFramework, currentUseCase, CustomConsole, GuideView, playgroundLogo, playgroundUid, browserUrl, useVm, sandboxUid, codeZipFile,
|
|
134
|
+
export declare function GuardianComponent({ demoOptions, frameworkOptions, firstFrameworkByUseCase, currentFramework, currentUseCase, CustomConsole, GuideView, playgroundLogo, playgroundUid, browserUrl, useVm, sandboxUid, codeZipFile, completeCodeZipFile, variant, themeColor, hasPreview, isFrame, apiKey, env, chatUid, hideHeader, // Hardcoded to true by default, not exposed in Sandbox.tsx
|
|
142
135
|
gitUrl, }: GuardianComponentProps): default_2.JSX.Element;
|
|
143
136
|
|
|
144
137
|
export declare interface GuardianComponentProps {
|
|
@@ -170,12 +163,7 @@ export declare interface GuardianComponentProps {
|
|
|
170
163
|
useVm: boolean;
|
|
171
164
|
sandboxUid: string;
|
|
172
165
|
codeZipFile: string | UpdateContainerCodebaseType;
|
|
173
|
-
/**
|
|
174
|
-
* Optional console URL configs to preload.
|
|
175
|
-
* These are URLs used in the CustomConsole component.
|
|
176
|
-
*/
|
|
177
166
|
completeCodeZipFile: string;
|
|
178
|
-
consoleUrlConfigs?: SandboxUrlConfig[];
|
|
179
167
|
variant?: "panel" | "top-down";
|
|
180
168
|
/**
|
|
181
169
|
* Hex color (e.g. "#3b82f6") used to theme Guardian UI elements.
|
|
@@ -189,8 +177,8 @@ export declare interface GuardianComponentProps {
|
|
|
189
177
|
* Whether to render in frame mode (just the right view, no console/header)
|
|
190
178
|
*/
|
|
191
179
|
isFrame?: boolean;
|
|
192
|
-
/** API key for starting sandbox */
|
|
193
|
-
apiKey
|
|
180
|
+
/** API key for starting sandbox - required */
|
|
181
|
+
apiKey: string;
|
|
194
182
|
/** Environment variables for sandbox */
|
|
195
183
|
env?: Record<string, string>;
|
|
196
184
|
/** Chat UID for starting sandbox */
|
|
@@ -223,17 +211,17 @@ export declare interface GuardianFramework {
|
|
|
223
211
|
GuideView?: GuardianComponentProps["GuideView"];
|
|
224
212
|
/** Optional theme color override for this framework */
|
|
225
213
|
themeColor?: string;
|
|
226
|
-
/** Optional URLs to preload for this specific framework */
|
|
227
|
-
urlsToPreload?: UrlToPreload[];
|
|
228
214
|
/** Optional Git URL for opening the project in VSCode */
|
|
229
215
|
gitUrl?: string;
|
|
230
216
|
}
|
|
231
217
|
|
|
232
218
|
/**
|
|
233
219
|
* Individual framework configuration within a use case
|
|
220
|
+
* Note: apiKey is optional here as it's passed separately at runtime to GuardianPlayground
|
|
234
221
|
*/
|
|
235
|
-
declare interface GuardianFrameworkConfig extends GuardianComponentProps {
|
|
222
|
+
declare interface GuardianFrameworkConfig extends Omit<GuardianComponentProps, 'apiKey'> {
|
|
236
223
|
frameworkKey: Framework;
|
|
224
|
+
apiKey?: string;
|
|
237
225
|
}
|
|
238
226
|
|
|
239
227
|
/**
|
|
@@ -248,7 +236,7 @@ export declare type GuardianNestedConfig = Record<string, GuardianUseCaseConfig>
|
|
|
248
236
|
*
|
|
249
237
|
* When isFrame=true, reads framework from URL params client-side.
|
|
250
238
|
*/
|
|
251
|
-
export declare function GuardianPlayground({ nestedConfig, useCase, framework: serverFramework, isFrame, apiKey, env, chatUid, }: {
|
|
239
|
+
export declare function GuardianPlayground({ nestedConfig, useCase, framework: serverFramework, isFrame, apiKey, env, chatUid, theme, }: {
|
|
252
240
|
/** Nested config structure (use case → framework → config) */
|
|
253
241
|
nestedConfig: GuardianNestedConfig;
|
|
254
242
|
/** Current use case ID */
|
|
@@ -257,12 +245,14 @@ export declare function GuardianPlayground({ nestedConfig, useCase, framework: s
|
|
|
257
245
|
framework: string;
|
|
258
246
|
/** Whether to render in frame mode (just the right view) */
|
|
259
247
|
isFrame?: boolean;
|
|
260
|
-
/** API key for starting sandbox */
|
|
261
|
-
apiKey
|
|
248
|
+
/** API key for starting sandbox - required */
|
|
249
|
+
apiKey: string;
|
|
262
250
|
/** Environment variables for sandbox */
|
|
263
251
|
env?: Record<string, string>;
|
|
264
252
|
/** Chat UID for starting sandbox */
|
|
265
253
|
chatUid?: string;
|
|
254
|
+
/** Theme mode - "light", "dark", or "system". Defaults to "dark" */
|
|
255
|
+
theme?: ThemeMode;
|
|
266
256
|
}): default_2.JSX.Element;
|
|
267
257
|
|
|
268
258
|
export declare function GuardianProvider({ children }: {
|
|
@@ -343,9 +333,16 @@ declare class SampleAppSDK {
|
|
|
343
333
|
* apiKey={process.env.NEXT_PUBLIC_SAMPLEAPP_API_KEY!}
|
|
344
334
|
* sandboxId="launchdarkly-feature-flags"
|
|
345
335
|
* />
|
|
336
|
+
*
|
|
337
|
+
* // Light mode
|
|
338
|
+
* <Sandbox
|
|
339
|
+
* apiKey={process.env.NEXT_PUBLIC_SAMPLEAPP_API_KEY!}
|
|
340
|
+
* sandboxId="launchdarkly-feature-flags"
|
|
341
|
+
* theme="light"
|
|
342
|
+
* />
|
|
346
343
|
* ```
|
|
347
344
|
*/
|
|
348
|
-
export declare function Sandbox({ apiKey, sandboxId, env, themeColor, }: SandboxProps): default_2.JSX.Element | null;
|
|
345
|
+
export declare function Sandbox({ apiKey, sandboxId, env, themeColor, theme, }: SandboxProps): default_2.JSX.Element | null;
|
|
349
346
|
|
|
350
347
|
export declare const SandboxHome: React_2.FC<SandboxHomeProps>;
|
|
351
348
|
|
|
@@ -379,14 +376,8 @@ export declare interface SandboxProps {
|
|
|
379
376
|
env?: Record<string, string>;
|
|
380
377
|
/** Optional theme color override */
|
|
381
378
|
themeColor?: string;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
declare interface SandboxUrlConfig {
|
|
385
|
-
sandboxUid: string;
|
|
386
|
-
browserUrl: string;
|
|
387
|
-
useVm: boolean;
|
|
388
|
-
resolution?: [number, number];
|
|
389
|
-
apiKey?: string;
|
|
379
|
+
/** Theme mode - "light", "dark", or "system". Defaults to "dark" */
|
|
380
|
+
theme?: ThemeMode;
|
|
390
381
|
}
|
|
391
382
|
|
|
392
383
|
declare const sdk: SampleAppSDK;
|
|
@@ -431,24 +422,20 @@ export declare interface ThemeColors {
|
|
|
431
422
|
};
|
|
432
423
|
}
|
|
433
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Theme mode for the SDK
|
|
427
|
+
* - "light": Light mode
|
|
428
|
+
* - "dark": Dark mode
|
|
429
|
+
* - "system": Follows system preference
|
|
430
|
+
*/
|
|
431
|
+
export declare type ThemeMode = "light" | "dark" | "system";
|
|
432
|
+
|
|
434
433
|
export declare type ThemeName = "ocean" | "autumn" | "mint" | "sunset" | "lavender" | "forest" | "coral";
|
|
435
434
|
|
|
436
435
|
export declare const themes: Record<ThemeName, ThemeColors>;
|
|
437
436
|
|
|
438
437
|
declare type UpdateContainerCodebaseType = Record<string, CodeOutput>;
|
|
439
438
|
|
|
440
|
-
/**
|
|
441
|
-
* Configuration for a single URL to preload in the sandbox
|
|
442
|
-
*/
|
|
443
|
-
declare interface UrlToPreload {
|
|
444
|
-
/** Browser URL to load */
|
|
445
|
-
browserUrl: string;
|
|
446
|
-
/** Whether to use VM for this URL */
|
|
447
|
-
useVm: boolean;
|
|
448
|
-
/** Suffix for the sandboxUid (e.g., "main", "abc", "def") */
|
|
449
|
-
suffix?: string;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
439
|
export declare const VmProvider: ({ children }: {
|
|
453
440
|
children: ReactNode;
|
|
454
441
|
}) => default_2.JSX.Element;
|