@sampleapp.ai/sdk 1.0.44 → 1.0.46
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 +1 -10
- package/dist/components/sandbox/guardian/app-layout-no-sidebar.js +2 -2
- package/dist/components/sandbox/guardian/demo/guardian-demo.js +53 -2
- package/dist/components/sandbox/guardian/guardian-component.js +2 -31
- package/dist/components/sandbox/guardian/guardian-playground.js +2 -2
- package/dist/components/sandbox/guardian/header.js +1 -1
- package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +5 -5
- package/dist/components/sandbox/guardian/right-view/right-view.js +3 -3
- package/dist/index.d.ts +2 -17
- package/dist/index.es.js +19087 -18995
- package/dist/index.standalone.umd.js +2 -2
- package/dist/lib/generated-css.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/tailwind.css +2 -2
- package/package.json +1 -1
|
@@ -79,7 +79,7 @@ function SandboxInner({ configWithContent, apiKey, env, themeColor, theme, confi
|
|
|
79
79
|
return (React.createElement(GuardianProvider, null,
|
|
80
80
|
React.createElement(VmProvider, null,
|
|
81
81
|
React.createElement("div", { className: "h-screen w-screen bg-white dark:bg-black" },
|
|
82
|
-
React.createElement(GuardianPlayground, { sandboxConfig: currentConfig, sections: sections, onSelect: selectOption, useCase: firstUseCase.id, framework: firstFramework, isFrame: isFrame, apiKey: apiKey, env: env, chatUid: currentConfig.chatUid, theme: theme, hasNetworkView: config === null || config === void 0 ? void 0 : config.hasNetworkView
|
|
82
|
+
React.createElement(GuardianPlayground, { sandboxConfig: currentConfig, sections: sections, onSelect: selectOption, useCase: firstUseCase.id, framework: firstFramework, isFrame: isFrame, apiKey: apiKey, env: env, chatUid: currentConfig.chatUid, theme: theme, hasNetworkView: config === null || config === void 0 ? void 0 : config.hasNetworkView })))));
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* Sandbox component - simplified API for embedding sandboxes
|
|
@@ -108,15 +108,6 @@ function SandboxInner({ configWithContent, apiKey, env, themeColor, theme, confi
|
|
|
108
108
|
* />
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
* Configurations for the config param
|
|
114
|
-
* {
|
|
115
|
-
* isFrame: boolean;
|
|
116
|
-
* }
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*/
|
|
120
111
|
export default function Sandbox({ apiKey, sandboxId, env, themeColor, theme = "dark", config }) {
|
|
121
112
|
// Validate apiKey immediately
|
|
122
113
|
if (!apiKey || apiKey.trim() === "") {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { cn } from "../../../lib/utils";
|
|
3
|
-
export default function AppLayoutNoSidebar({ header, hasBodyPadding = true, children, textColorStyle
|
|
3
|
+
export default function AppLayoutNoSidebar({ header, hasBodyPadding = true, children, textColorStyle }) {
|
|
4
4
|
return (React.createElement("div", { className: "flex flex-col h-full" },
|
|
5
5
|
header && (React.createElement("header", { className: "flex h-20 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 w-full" },
|
|
6
6
|
React.createElement("div", { className: "flex items-center w-full" }, header))),
|
|
7
|
-
React.createElement("div", { className: cn("flex flex-1 flex-col pt-0 min-h-0 pr-6 pb-6", hasBodyPadding && "gap-4 p-4",
|
|
7
|
+
React.createElement("div", { className: cn("flex flex-1 flex-col pt-0 min-h-0 md:pr-6 pb-6", hasBodyPadding && "gap-4 p-4",
|
|
8
8
|
// Use CSS variable with Tailwind arbitrary value
|
|
9
9
|
textColorStyle &&
|
|
10
10
|
"text-[var(--guardian-text-color)] dark:text-[var(--guardian-text-color-dark)]"), style: textColorStyle }, children)));
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useEffect, useState, useCallback } from "react";
|
|
3
|
+
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
3
4
|
import ConsoleWithApp from "../ui/console-with-app";
|
|
4
5
|
import { useGuardianContext } from "../context/guardian-context";
|
|
5
6
|
import ConsoleWithGuide from "./left-view";
|
|
6
7
|
import RightView from "../right-view/right-view";
|
|
7
|
-
|
|
8
|
+
import RightTopDownView from "../right-view/right-top-down-view";
|
|
9
|
+
import { cn } from "../../../../lib/utils";
|
|
10
|
+
import { BookOpen, Monitor } from "lucide-react";
|
|
11
|
+
export default function GuardianDemo({ CustomConsole, GuideView, browserUrl, playgroundUid, useVm, codeZipFile, completeCodeZipFile, variant, themeColor, hasPreview, isFrame = false, isGuardian = false, gitUrl, isBrowserUrlReady = false, sandboxId, apiKey, sandboxError, hasNetworkView = false }) {
|
|
8
12
|
const { isBrowserMaximized } = useGuardianContext();
|
|
9
13
|
const { setCurrentView } = useGuardianContext();
|
|
10
14
|
const [reloadCounter, setReloadCounter] = useState(0);
|
|
@@ -19,6 +23,7 @@ export default function GuardianDemo({ CustomConsole, GuideView, browserUrl, pla
|
|
|
19
23
|
setTimeout(() => setOverlayStage("hidden"), 3000);
|
|
20
24
|
}
|
|
21
25
|
}, []);
|
|
26
|
+
const [mobileTab, setMobileTab] = useState("guide");
|
|
22
27
|
useEffect(() => {
|
|
23
28
|
setCurrentView("preview");
|
|
24
29
|
}, [setCurrentView]);
|
|
@@ -31,5 +36,51 @@ export default function GuardianDemo({ CustomConsole, GuideView, browserUrl, pla
|
|
|
31
36
|
return (React.createElement("div", { className: "w-full h-full rounded-2xl overflow-hidden" },
|
|
32
37
|
React.createElement(RightView, { reloadCounter: reloadCounter, overlayStage: overlayStage, browserUrl: browserUrl, useVm: useVm, codeZipFile: codeZipFile, hasPreview: hasPreview, variant: variant, themeColor: themeColor, completeCodeZipFile: completeCodeZipFile, isGuardian: isGuardian, isBrowserMaximized: true, isBrowserUrlReady: isBrowserUrlReady, isFrame: isFrame, sandboxId: sandboxId, apiKey: apiKey, sandboxError: sandboxError, hasNetworkView: hasNetworkView })));
|
|
33
38
|
}
|
|
34
|
-
|
|
39
|
+
const rightViewProps = {
|
|
40
|
+
reloadCounter,
|
|
41
|
+
overlayStage,
|
|
42
|
+
browserUrl,
|
|
43
|
+
useVm,
|
|
44
|
+
codeZipFile,
|
|
45
|
+
hasPreview,
|
|
46
|
+
variant,
|
|
47
|
+
themeColor,
|
|
48
|
+
completeCodeZipFile,
|
|
49
|
+
isGuardian,
|
|
50
|
+
isBrowserMaximized,
|
|
51
|
+
isBrowserUrlReady: isBrowserUrlReady !== null && isBrowserUrlReady !== void 0 ? isBrowserUrlReady : false,
|
|
52
|
+
isFrame,
|
|
53
|
+
sandboxId,
|
|
54
|
+
apiKey,
|
|
55
|
+
sandboxError,
|
|
56
|
+
hasNetworkView
|
|
57
|
+
};
|
|
58
|
+
return (React.createElement(React.Fragment, null,
|
|
59
|
+
React.createElement("div", { className: "md:hidden h-full flex flex-col min-h-0" },
|
|
60
|
+
React.createElement("div", { className: "flex-1 min-h-0 overflow-hidden relative" },
|
|
61
|
+
React.createElement("div", { className: cn("absolute inset-0", !hasPreview || mobileTab === "guide" ? "flex flex-col" : "hidden") },
|
|
62
|
+
React.createElement(PanelGroup, { direction: "vertical", className: "flex-1 min-h-0" },
|
|
63
|
+
React.createElement(Panel, { defaultSize: 50, minSize: 25, maxSize: 75, order: 1 },
|
|
64
|
+
React.createElement("div", { className: "h-full w-full overflow-y-auto overflow-x-hidden" },
|
|
65
|
+
React.createElement(ConsoleWithGuide, { CustomConsole: CustomConsole, GuideView: GuideView, playgroundUid: playgroundUid, onReloadPreview: handleReloadPreview, onStageChange: handleStageChange, codeZipFile: codeZipFile, themeColor: themeColor, browserUrl: browserUrl, gitUrl: gitUrl, sandboxId: sandboxId, apiKey: apiKey }))),
|
|
66
|
+
React.createElement(PanelResizeHandle, { className: "h-2 relative group flex-shrink-0 bg-zinc-900 dark:bg-zinc-950" },
|
|
67
|
+
React.createElement("div", { className: "absolute inset-x-0 top-1/2 -translate-y-1/2 h-1 -mt-0.5 group-active:bg-blue-400/30 transition-colors flex justify-center items-center" },
|
|
68
|
+
React.createElement("div", { className: "h-full w-12 rounded-full bg-zinc-600 dark:bg-zinc-500" }))),
|
|
69
|
+
React.createElement(Panel, { defaultSize: 50, minSize: 25, maxSize: 75, order: 2 },
|
|
70
|
+
React.createElement("div", { className: "h-full w-full min-h-0" },
|
|
71
|
+
React.createElement(RightTopDownView, Object.assign({}, rightViewProps, { hasPreview: false, codeOnly: true })))))),
|
|
72
|
+
hasPreview && (React.createElement("div", { className: cn("absolute inset-0", mobileTab === "preview" ? "" : "hidden") },
|
|
73
|
+
React.createElement(RightView, Object.assign({}, rightViewProps, { previewOnly: true }))))),
|
|
74
|
+
hasPreview && (React.createElement("div", { className: "flex-shrink-0 border-t border-zinc-800 dark:border-zinc-700 bg-zinc-900/95 dark:bg-zinc-950/95 backdrop-blur-sm px-3 py-2 flex items-center justify-center gap-1" },
|
|
75
|
+
React.createElement("button", { type: "button", onClick: () => setMobileTab("guide"), className: cn("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-colors", mobileTab === "guide"
|
|
76
|
+
? "bg-zinc-700 dark:bg-zinc-600 text-white"
|
|
77
|
+
: "text-zinc-500 hover:text-zinc-300") },
|
|
78
|
+
React.createElement(BookOpen, { className: "w-4 h-4" }),
|
|
79
|
+
"Guide"),
|
|
80
|
+
React.createElement("button", { type: "button", onClick: () => setMobileTab("preview"), className: cn("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-colors", mobileTab === "preview"
|
|
81
|
+
? "bg-zinc-700 dark:bg-zinc-600 text-white"
|
|
82
|
+
: "text-zinc-500 hover:text-zinc-300") },
|
|
83
|
+
React.createElement(Monitor, { className: "w-4 h-4" }),
|
|
84
|
+
"Preview")))),
|
|
85
|
+
React.createElement(ConsoleWithApp, { containerClassName: "hidden md:block", console: React.createElement(ConsoleWithGuide, { CustomConsole: CustomConsole, GuideView: GuideView, playgroundUid: playgroundUid, onReloadPreview: handleReloadPreview, onStageChange: handleStageChange, codeZipFile: codeZipFile, themeColor: themeColor, browserUrl: browserUrl, gitUrl: gitUrl, sandboxId: sandboxId, apiKey: apiKey }), app: React.createElement(RightView, { reloadCounter: reloadCounter, overlayStage: overlayStage, browserUrl: browserUrl, useVm: useVm, codeZipFile: codeZipFile, hasPreview: hasPreview, variant: variant, themeColor: themeColor, completeCodeZipFile: completeCodeZipFile, isGuardian: isGuardian, isBrowserMaximized: isBrowserMaximized, isBrowserUrlReady: isBrowserUrlReady, isFrame: isFrame, sandboxId: sandboxId, apiKey: apiKey, sandboxError: sandboxError, hasNetworkView: hasNetworkView }) })));
|
|
35
86
|
}
|
|
@@ -9,7 +9,7 @@ import { useFrameMessages } from "./hooks/use-frame-messages";
|
|
|
9
9
|
import { useVmContext } from "./context/vm-context";
|
|
10
10
|
import { cn } from "../../../lib/utils";
|
|
11
11
|
export default function GuardianComponent({ sections, onSelect, currentFramework, currentUseCase, CustomConsole, GuideView, playgroundLogo, playgroundUid, browserUrl, useVm, sandboxUid, codeZipFile, completeCodeZipFile, variant, themeColor, hasPreview = true, isFrame = false, apiKey, env, chatUid, hideHeader = false, // Hardcoded to true by default, not exposed in Sandbox.tsx
|
|
12
|
-
gitUrl, hasNetworkView = false
|
|
12
|
+
gitUrl, hasNetworkView = false }) {
|
|
13
13
|
const { previewUrl, setPreviewUrl } = useGuardianContext();
|
|
14
14
|
const { vmResolution } = useVmContext();
|
|
15
15
|
const [sandboxError, setSandboxError] = React.useState(null);
|
|
@@ -28,20 +28,9 @@ gitUrl, hasNetworkView = false, stationaryPublishedUrl }) {
|
|
|
28
28
|
useFrameMessages();
|
|
29
29
|
// Track which main sandbox we've loaded to prevent duplicates
|
|
30
30
|
const loadedSandboxRef = useRef("");
|
|
31
|
-
// Track initial URLs per use case for stationaryPublishedUrl feature
|
|
32
|
-
const initialUrlsByUseCaseRef = useRef(new Map());
|
|
33
31
|
useEffect(() => {
|
|
34
32
|
// Create a key for this sandbox load
|
|
35
33
|
const sandboxKey = `${sandboxUid}-${browserUrl}-${useVm}`;
|
|
36
|
-
const useCaseKey = currentUseCase || "default";
|
|
37
|
-
// If stationaryPublishedUrl is enabled and we already have a URL for this use case,
|
|
38
|
-
// use the stored URL and skip loading a new one
|
|
39
|
-
if (stationaryPublishedUrl &&
|
|
40
|
-
initialUrlsByUseCaseRef.current.has(useCaseKey)) {
|
|
41
|
-
const storedUrl = initialUrlsByUseCaseRef.current.get(useCaseKey);
|
|
42
|
-
setPreviewUrl(storedUrl);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
34
|
// Check if we've already initiated a load for this exact sandbox config
|
|
46
35
|
if (loadedSandboxRef.current === sandboxKey) {
|
|
47
36
|
return;
|
|
@@ -52,11 +41,6 @@ gitUrl, hasNetworkView = false, stationaryPublishedUrl }) {
|
|
|
52
41
|
// Found cached URL for this exact combination, use it immediately
|
|
53
42
|
setPreviewUrl(existingUrl);
|
|
54
43
|
loadedSandboxRef.current = sandboxKey;
|
|
55
|
-
// Store as initial URL for this use case if stationaryPublishedUrl is enabled
|
|
56
|
-
if (stationaryPublishedUrl &&
|
|
57
|
-
!initialUrlsByUseCaseRef.current.has(useCaseKey)) {
|
|
58
|
-
initialUrlsByUseCaseRef.current.set(useCaseKey, existingUrl);
|
|
59
|
-
}
|
|
60
44
|
return;
|
|
61
45
|
}
|
|
62
46
|
// If useVm is true, wait for resolution from context before loading
|
|
@@ -80,11 +64,6 @@ gitUrl, hasNetworkView = false, stationaryPublishedUrl }) {
|
|
|
80
64
|
apiKey
|
|
81
65
|
})
|
|
82
66
|
.then((url) => {
|
|
83
|
-
// Store as initial URL for this use case if stationaryPublishedUrl is enabled
|
|
84
|
-
if (stationaryPublishedUrl &&
|
|
85
|
-
!initialUrlsByUseCaseRef.current.has(useCaseKey)) {
|
|
86
|
-
initialUrlsByUseCaseRef.current.set(useCaseKey, url);
|
|
87
|
-
}
|
|
88
67
|
setPreviewUrl(url);
|
|
89
68
|
setSandboxError(null); // Clear error on success
|
|
90
69
|
})
|
|
@@ -97,15 +76,7 @@ gitUrl, hasNetworkView = false, stationaryPublishedUrl }) {
|
|
|
97
76
|
});
|
|
98
77
|
// Re-run when sandbox parameters change OR when resolution becomes available
|
|
99
78
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
100
|
-
}, [
|
|
101
|
-
sandboxUid,
|
|
102
|
-
browserUrl,
|
|
103
|
-
useVm,
|
|
104
|
-
vmResolution,
|
|
105
|
-
apiKey,
|
|
106
|
-
currentUseCase,
|
|
107
|
-
stationaryPublishedUrl
|
|
108
|
-
]);
|
|
79
|
+
}, [sandboxUid, browserUrl, useVm, vmResolution, apiKey]);
|
|
109
80
|
// If isFrame, just render GuardianDemo without the header/layout wrapper
|
|
110
81
|
if (isFrame) {
|
|
111
82
|
return (React.createElement("div", { className: "h-[100vh]" },
|
|
@@ -12,7 +12,7 @@ import { buildGuardianConfig } from "./utils";
|
|
|
12
12
|
* are now handled in Sandbox.tsx via the tree selector sync mechanism.
|
|
13
13
|
* This component receives the already-resolved framework from the tree selector.
|
|
14
14
|
*/
|
|
15
|
-
export default function GuardianPlayground({ sandboxConfig, sections, onSelect, useCase, framework, isFrame = false, apiKey, env, chatUid, theme = "dark", hasNetworkView = false
|
|
15
|
+
export default function GuardianPlayground({ sandboxConfig, sections, onSelect, useCase, framework, isFrame = false, apiKey, env, chatUid, theme = "dark", hasNetworkView = false }) {
|
|
16
16
|
var _a;
|
|
17
17
|
// Get frame params for iframeUrl override only
|
|
18
18
|
const frameParams = useFrameParams();
|
|
@@ -40,5 +40,5 @@ export default function GuardianPlayground({ sandboxConfig, sections, onSelect,
|
|
|
40
40
|
"\"")));
|
|
41
41
|
}
|
|
42
42
|
return (React.createElement(GuardianStyleWrapper, { themeColor: frameworkConfig.themeColor, theme: theme },
|
|
43
|
-
React.createElement(GuardianComponent, { sections: sections, onSelect: onSelect, 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, variant: frameworkConfig.variant, themeColor: frameworkConfig.themeColor, hasPreview: frameworkConfig.hasPreview, currentUseCase: useCase, isFrame: isFrame, apiKey: apiKey, env: env, chatUid: chatUid, gitUrl: frameworkConfig.gitUrl, hideHeader: false, hasNetworkView: hasNetworkView
|
|
43
|
+
React.createElement(GuardianComponent, { sections: sections, onSelect: onSelect, 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, variant: frameworkConfig.variant, themeColor: frameworkConfig.themeColor, hasPreview: frameworkConfig.hasPreview, currentUseCase: useCase, isFrame: isFrame, apiKey: apiKey, env: env, chatUid: chatUid, gitUrl: frameworkConfig.gitUrl, hideHeader: false, hasNetworkView: hasNetworkView })));
|
|
44
44
|
}
|
|
@@ -9,7 +9,7 @@ import { useSdkTheme } from "./context/theme-context";
|
|
|
9
9
|
*/
|
|
10
10
|
export default function Header({ sections, onSelect, playgroundLogo, themecolor }) {
|
|
11
11
|
const { isDark } = useSdkTheme();
|
|
12
|
-
return (React.createElement("div", { className: "w-full sticky top-0 z-50 px-
|
|
12
|
+
return (React.createElement("div", { className: "w-full sticky top-0 z-50 px-8 backdrop-blur-md" },
|
|
13
13
|
React.createElement("div", { className: "flex flex-wrap items-center justify-between py-2" },
|
|
14
14
|
React.createElement("div", { className: "flex flex-wrap items-center gap-6" }, sections.map((section) => {
|
|
15
15
|
var _a;
|
|
@@ -15,7 +15,7 @@ import { useFrameParams } from "../hooks/use-frame-params";
|
|
|
15
15
|
import { cn } from "../../../../lib/utils";
|
|
16
16
|
import { handleSandboxDownload } from "../utils";
|
|
17
17
|
import NetworkRequestsView from "./right-top-down-view/network-requests-view";
|
|
18
|
-
export default function RightView({ reloadCounter, overlayStage, browserUrl, useVm, codeZipFile, themeColor, completeCodeZipFile, hasPreview, isPreviewMinimized = false, isGuardian = false, isBrowserMaximized = false, isBrowserUrlReady = false, sandboxId, apiKey, sandboxError, hasNetworkView = false }) {
|
|
18
|
+
export default function RightView({ reloadCounter, overlayStage, browserUrl, useVm, codeZipFile, themeColor, completeCodeZipFile, hasPreview, isPreviewMinimized = false, isGuardian = false, isBrowserMaximized = false, isBrowserUrlReady = false, sandboxId, apiKey, sandboxError, hasNetworkView = false, codeOnly = false }) {
|
|
19
19
|
const { setFileTree, setGeneratedCode } = useGuardianContext();
|
|
20
20
|
const { setVmResolution } = useVmContext();
|
|
21
21
|
const frameParams = useFrameParams();
|
|
@@ -194,7 +194,7 @@ export default function RightView({ reloadCounter, overlayStage, browserUrl, use
|
|
|
194
194
|
}
|
|
195
195
|
return (React.createElement("div", { className: "h-full w-full flex flex-col" },
|
|
196
196
|
React.createElement(PanelGroup, { direction: "vertical", className: "relative h-full" },
|
|
197
|
-
hasPreview && !isPreviewMinimized && (React.createElement(React.Fragment, null,
|
|
197
|
+
hasPreview && !isPreviewMinimized && !codeOnly && (React.createElement(React.Fragment, null,
|
|
198
198
|
React.createElement(Panel, { defaultSize: 68, minSize: 20, maxSize: 80, order: 1 },
|
|
199
199
|
React.createElement("div", { ref: previewContainerRef, className: "h-full w-full relative" }, showLoader ? (React.createElement("div", { className: "h-full w-full relative overflow-hidden" },
|
|
200
200
|
React.createElement(AiLoader, { text: "Booting up...", fullScreen: false, themeColor: effectiveThemeColor }))) : (React.createElement(Browser, { previewUrl: browserUrl || "", setPreviewUrl: () => { }, containerEndpoint: browserUrl, outerContainerClassName: "h-full w-full border", reloadSignal: reloadCounter, useVm: useVm, isGuardian: isGuardian, sandboxError: sandboxError }, overlayStage !== "hidden" && (React.createElement("div", { className: "absolute inset-0 z-20 flex items-center justify-center" },
|
|
@@ -213,7 +213,7 @@ export default function RightView({ reloadCounter, overlayStage, browserUrl, use
|
|
|
213
213
|
React.createElement(PanelResizeHandle, { className: "h-0 relative group flex-shrink-0" },
|
|
214
214
|
React.createElement("div", { className: "absolute inset-x-0 top-1/2 -translate-y-1/2 h-2 -mt-0.5 group-hover:bg-blue-400/20 transition-colors flex justify-center items-center" },
|
|
215
215
|
React.createElement("div", { className: "h-full w-px group-hover:bg-blue-400 transition-colors" }))))),
|
|
216
|
-
React.createElement(Panel, { defaultSize: hasPreview ?
|
|
216
|
+
React.createElement(Panel, { defaultSize: codeOnly || !hasPreview ? 100 : 32, minSize: 20, maxSize: codeOnly || !hasPreview ? 100 : 80, order: 2 },
|
|
217
217
|
React.createElement("div", { className: "h-full w-full flex flex-col" },
|
|
218
218
|
hasNetworkView && (React.createElement("div", { className: "flex items-center justify-between border-b border-zinc-800 dark:border-zinc-700 bg-zinc-900 dark:bg-zinc-950 flex-shrink-0" },
|
|
219
219
|
React.createElement("div", { className: "flex" },
|
|
@@ -222,7 +222,7 @@ export default function RightView({ reloadCounter, overlayStage, browserUrl, use
|
|
|
222
222
|
: "border-transparent text-zinc-500 hover:text-zinc-300"), style: activeTab === "network"
|
|
223
223
|
? {
|
|
224
224
|
borderColor: effectiveThemeColor,
|
|
225
|
-
color: effectiveThemeColor
|
|
225
|
+
color: effectiveThemeColor
|
|
226
226
|
}
|
|
227
227
|
: undefined },
|
|
228
228
|
React.createElement(Globe, { className: "w-3.5 h-3.5" }),
|
|
@@ -233,7 +233,7 @@ export default function RightView({ reloadCounter, overlayStage, browserUrl, use
|
|
|
233
233
|
: "border-transparent text-zinc-500 hover:text-zinc-300"), style: activeTab === "code"
|
|
234
234
|
? {
|
|
235
235
|
borderColor: effectiveThemeColor,
|
|
236
|
-
color: effectiveThemeColor
|
|
236
|
+
color: effectiveThemeColor
|
|
237
237
|
}
|
|
238
238
|
: undefined },
|
|
239
239
|
React.createElement(Code2, { className: "w-3.5 h-3.5" }),
|
|
@@ -3,7 +3,7 @@ import React, { useState, useEffect } from "react";
|
|
|
3
3
|
import RightPanelView from "./right-panel-view";
|
|
4
4
|
import RightTopDownView from "./right-top-down-view";
|
|
5
5
|
import PreviewControlBar from "./preview-control-bar";
|
|
6
|
-
export default function RightView({ reloadCounter, overlayStage, browserUrl, useVm, codeZipFile, completeCodeZipFile, variant = "top-down", themeColor, hasPreview, isGuardian = false, isBrowserMaximized = false, isBrowserUrlReady = false, isFrame = false, sandboxId, apiKey, sandboxError, hasNetworkView = false, }) {
|
|
6
|
+
export default function RightView({ reloadCounter, overlayStage, browserUrl, useVm, codeZipFile, completeCodeZipFile, variant = "top-down", themeColor, hasPreview, isGuardian = false, isBrowserMaximized = false, isBrowserUrlReady = false, isFrame = false, sandboxId, apiKey, sandboxError, hasNetworkView = false, previewOnly = false, }) {
|
|
7
7
|
const [isPreviewMinimized, setIsPreviewMinimized] = useState(false);
|
|
8
8
|
const [reloadCounterState, setReloadCounterState] = useState(reloadCounter);
|
|
9
9
|
// Sync with external reloadCounter changes
|
|
@@ -18,9 +18,9 @@ export default function RightView({ reloadCounter, overlayStage, browserUrl, use
|
|
|
18
18
|
}
|
|
19
19
|
else if (variant === "top-down") {
|
|
20
20
|
return (React.createElement("div", { className: "h-full w-full flex flex-col" },
|
|
21
|
-
hasPreview && (React.createElement(PreviewControlBar, { isMinimized: isPreviewMinimized, onToggle: () => setIsPreviewMinimized(!isPreviewMinimized), onRefresh: handleRefresh, themeColor: themeColor, externalUrl: browserUrl, isFrame: isFrame })),
|
|
21
|
+
hasPreview && !previewOnly && (React.createElement(PreviewControlBar, { isMinimized: isPreviewMinimized, onToggle: () => setIsPreviewMinimized(!isPreviewMinimized), onRefresh: handleRefresh, themeColor: themeColor, externalUrl: browserUrl, isFrame: isFrame })),
|
|
22
22
|
React.createElement("div", { className: "flex-1 min-h-0" },
|
|
23
|
-
React.createElement(RightTopDownView, { reloadCounter: reloadCounterState, overlayStage: overlayStage, browserUrl: browserUrl, useVm: useVm, codeZipFile: codeZipFile, themeColor: themeColor, completeCodeZipFile: completeCodeZipFile, hasPreview: hasPreview, isPreviewMinimized: isPreviewMinimized, isGuardian: isGuardian, isBrowserMaximized: isBrowserMaximized, isBrowserUrlReady: isBrowserUrlReady, sandboxId: sandboxId, apiKey: apiKey, sandboxError: sandboxError, hasNetworkView: hasNetworkView }))));
|
|
23
|
+
React.createElement(RightTopDownView, { reloadCounter: reloadCounterState, overlayStage: overlayStage, browserUrl: browserUrl, useVm: useVm, codeZipFile: codeZipFile, themeColor: themeColor, completeCodeZipFile: completeCodeZipFile, hasPreview: hasPreview, isPreviewMinimized: isPreviewMinimized, isGuardian: isGuardian, isBrowserMaximized: previewOnly || isBrowserMaximized, isBrowserUrlReady: isBrowserUrlReady, sandboxId: sandboxId, apiKey: apiKey, sandboxError: sandboxError, hasNetworkView: hasNetworkView }))));
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
return null;
|
package/dist/index.d.ts
CHANGED
|
@@ -397,7 +397,7 @@ export declare const getTheme: (themeName?: ThemeName) => ThemeColors;
|
|
|
397
397
|
export declare function getUniqueFieldValues(allContent: SandboxContent[], field: keyof Pick<SandboxContent, "product" | "product_version" | "architecture" | "frontend" | "backend" | "framework">): string[];
|
|
398
398
|
|
|
399
399
|
export declare function GuardianComponent({ sections, onSelect, 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
|
|
400
|
-
gitUrl, hasNetworkView
|
|
400
|
+
gitUrl, hasNetworkView }: GuardianComponentProps): default_2.JSX.Element;
|
|
401
401
|
|
|
402
402
|
export declare interface GuardianComponentProps {
|
|
403
403
|
name: string;
|
|
@@ -447,8 +447,6 @@ export declare interface GuardianComponentProps {
|
|
|
447
447
|
gitUrl?: string;
|
|
448
448
|
/** Whether to show the network requests view tab */
|
|
449
449
|
hasNetworkView?: boolean;
|
|
450
|
-
/** When true, keeps the first browserUrl per use case (prevents URL changes when toggling options) */
|
|
451
|
-
stationaryPublishedUrl?: boolean;
|
|
452
450
|
}
|
|
453
451
|
|
|
454
452
|
/**
|
|
@@ -501,7 +499,7 @@ export declare type GuardianNestedConfig = Record<string, GuardianUseCaseConfig>
|
|
|
501
499
|
* are now handled in Sandbox.tsx via the tree selector sync mechanism.
|
|
502
500
|
* This component receives the already-resolved framework from the tree selector.
|
|
503
501
|
*/
|
|
504
|
-
export declare function GuardianPlayground({ sandboxConfig, sections, onSelect, useCase, framework, isFrame, apiKey, env, chatUid, theme, hasNetworkView
|
|
502
|
+
export declare function GuardianPlayground({ sandboxConfig, sections, onSelect, useCase, framework, isFrame, apiKey, env, chatUid, theme, hasNetworkView }: GuardianPlaygroundProps): default_2.JSX.Element;
|
|
505
503
|
|
|
506
504
|
declare interface GuardianPlaygroundProps {
|
|
507
505
|
/** Sandbox configuration */
|
|
@@ -526,8 +524,6 @@ declare interface GuardianPlaygroundProps {
|
|
|
526
524
|
theme?: ThemeMode;
|
|
527
525
|
/** Whether to show the network requests view tab */
|
|
528
526
|
hasNetworkView?: boolean;
|
|
529
|
-
/** When true, keeps the first browserUrl per use case (prevents URL changes when toggling options) */
|
|
530
|
-
stationaryPublishedUrl?: boolean;
|
|
531
527
|
}
|
|
532
528
|
|
|
533
529
|
export declare function GuardianProvider({ children }: {
|
|
@@ -674,15 +670,6 @@ declare class SampleAppSDK {
|
|
|
674
670
|
* />
|
|
675
671
|
* ```
|
|
676
672
|
*/
|
|
677
|
-
/**
|
|
678
|
-
*
|
|
679
|
-
* Configurations for the config param
|
|
680
|
-
* {
|
|
681
|
-
* isFrame: boolean;
|
|
682
|
-
* }
|
|
683
|
-
*
|
|
684
|
-
*
|
|
685
|
-
*/
|
|
686
673
|
export declare function Sandbox({ apiKey, sandboxId, env, themeColor, theme, config }: SandboxProps): default_2.JSX.Element | null;
|
|
687
674
|
|
|
688
675
|
/**
|
|
@@ -719,8 +706,6 @@ declare interface SandboxConfigOptions {
|
|
|
719
706
|
isFrame?: boolean;
|
|
720
707
|
/** Whether to show the network requests view tab. Defaults to false */
|
|
721
708
|
hasNetworkView?: boolean;
|
|
722
|
-
/** Whether to keep the first browserUrl per use case (prevents URL changes when toggling options) */
|
|
723
|
-
stationaryPublishedUrl?: boolean;
|
|
724
709
|
}
|
|
725
710
|
|
|
726
711
|
/**
|