@sampleapp.ai/sdk 1.0.43 → 1.0.45
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 +44 -7
- package/dist/components/sandbox/guardian/app-layout-no-sidebar.js +2 -2
- package/dist/components/sandbox/guardian/code-focus-section.js +4 -2
- package/dist/components/sandbox/guardian/context/theme-context.js +47 -0
- package/dist/components/sandbox/guardian/demo/guardian-demo.js +52 -4
- package/dist/components/sandbox/guardian/demo/left-view.js +13 -7
- package/dist/components/sandbox/guardian/guardian-component.js +4 -4
- package/dist/components/sandbox/guardian/guardian-playground.js +8 -5
- package/dist/components/sandbox/guardian/guardian-style-wrapper.js +8 -6
- package/dist/components/sandbox/guardian/header.js +15 -6
- package/dist/components/sandbox/guardian/hooks/use-frame-messages.js +24 -8
- package/dist/components/sandbox/guardian/hooks/use-frame-params.js +94 -36
- package/dist/components/sandbox/guardian/index.js +1 -0
- package/dist/components/sandbox/guardian/right-view/pill-file-selector.js +4 -4
- package/dist/components/sandbox/guardian/right-view/right-top-down-view/network-requests-view.js +117 -0
- package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +40 -141
- package/dist/components/sandbox/guardian/right-view/right-view.js +3 -3
- package/dist/components/sandbox/guardian/ui/markdown/code-group/code-block.js +7 -33
- package/dist/components/sandbox/guardian/ui/markdown.js +23 -14
- package/dist/components/sandbox/sandbox-home/SandboxCard.js +7 -5
- package/dist/components/sandbox/sandbox-home/SandboxHome.js +32 -13
- package/dist/components/sandbox/sandbox-home/SearchBar.js +5 -3
- package/dist/hooks/use-tree-selector.js +3 -3
- package/dist/index.d.ts +43 -7
- package/dist/index.es.js +23183 -22721
- package/dist/index.js +1 -0
- package/dist/index.standalone.umd.js +8 -8
- package/dist/lib/generated-css.js +1 -1
- package/dist/lib/tree-utils.js +4 -2
- package/dist/lib/types/tree-config.js +18 -0
- package/dist/sdk.css +1 -1
- package/dist/tailwind.css +2 -2
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ import { CardGroup } from "./markdown/card-group";
|
|
|
33
33
|
import { Card } from "./markdown/card-group/card";
|
|
34
34
|
import CodeFocusSection from "../code-focus-section";
|
|
35
35
|
import { DownloadAndOpenButtons } from "./download-and-open-buttons";
|
|
36
|
+
import { useSdkTheme } from "../context/theme-context";
|
|
36
37
|
// Stub components for components that don't exist in SDK
|
|
37
38
|
const ButtonFileServer = ({ title, description, filePath, feature, fileContent, color, }) => {
|
|
38
39
|
return null; // Stub - not implemented in SDK
|
|
@@ -51,7 +52,8 @@ const createId = (text) => {
|
|
|
51
52
|
};
|
|
52
53
|
export const MemoizedReactMarkdown = memo(ReactMarkdown, (prevProps, nextProps) => prevProps.children === nextProps.children &&
|
|
53
54
|
prevProps.className === nextProps.className);
|
|
54
|
-
|
|
55
|
+
/** Internal Markdown component that accepts isDark prop */
|
|
56
|
+
const MarkdownInternal = ({ children, className, isRestricted, showToc, themeColor, browserUrl, gitUrl, sandboxId, apiKey, isDark, }) => {
|
|
55
57
|
const headingRenderer = (level) => {
|
|
56
58
|
return (_a) => {
|
|
57
59
|
var _b, _c;
|
|
@@ -60,10 +62,10 @@ export const Markdown = ({ children, className, isRestricted, showToc, themeColo
|
|
|
60
62
|
const id = createId(text);
|
|
61
63
|
const isFirstElement = ((_c = (_b = node === null || node === void 0 ? void 0 : node.position) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.offset) === 0;
|
|
62
64
|
const HeadingClasses = {
|
|
63
|
-
1: cn("scroll-m-20 text-3xl font-bold tracking-tight lg:text-3xl mb-7 text-zinc-
|
|
64
|
-
2: cn("scroll-m-20 text-2xl font-bold tracking-tight mb-7 text-zinc-
|
|
65
|
-
3: cn("scroll-m-20 text-xl font-bold tracking-tight mb-6 text-zinc-
|
|
66
|
-
4: cn("scroll-m-20 text-lg font-bold tracking-tight mb-6 text-zinc-
|
|
65
|
+
1: cn("scroll-m-20 text-3xl font-bold tracking-tight lg:text-3xl mb-7", isDark ? "text-zinc-50" : "text-zinc-900", !isFirstElement && "mt-16"),
|
|
66
|
+
2: cn("scroll-m-20 text-2xl font-bold tracking-tight mb-7", isDark ? "text-zinc-50" : "text-zinc-900", !isFirstElement && "mt-14"),
|
|
67
|
+
3: cn("scroll-m-20 text-xl font-bold tracking-tight mb-6", isDark ? "text-zinc-50" : "text-zinc-900", !isFirstElement && "mt-10"),
|
|
68
|
+
4: cn("scroll-m-20 text-lg font-bold tracking-tight mb-6", isDark ? "text-zinc-50" : "text-zinc-900", !isFirstElement && "mt-10"),
|
|
67
69
|
};
|
|
68
70
|
const Tag = `h${level}`;
|
|
69
71
|
return (React.createElement(Tag, Object.assign({ id: id, className: HeadingClasses[level] }, props),
|
|
@@ -196,11 +198,11 @@ export const Markdown = ({ children, className, isRestricted, showToc, themeColo
|
|
|
196
198
|
// If there's a block-level component, don't wrap in <p>, just return a <div> or fragment
|
|
197
199
|
return React.createElement("div", Object.assign({}, props), children);
|
|
198
200
|
}
|
|
199
|
-
return (React.createElement("div", Object.assign({ className: cn("leading-6 text-
|
|
201
|
+
return (React.createElement("div", Object.assign({ className: cn("leading-6 text-sm", isDark ? "text-zinc-300" : "text-zinc-700", !isFirstElement && "mt-5") }, props), children));
|
|
200
202
|
},
|
|
201
203
|
// List
|
|
202
204
|
li({ children }) {
|
|
203
|
-
return (React.createElement("li", { className: "text-
|
|
205
|
+
return (React.createElement("li", { className: cn("leading-7 text-sm", isDark ? "text-zinc-300" : "text-zinc-700") }, children));
|
|
204
206
|
},
|
|
205
207
|
// Unordered List
|
|
206
208
|
ul({ children }) {
|
|
@@ -214,12 +216,14 @@ export const Markdown = ({ children, className, isRestricted, showToc, themeColo
|
|
|
214
216
|
var { children, href } = _a, props = __rest(_a, ["children", "href"]);
|
|
215
217
|
const isInternal = href === null || href === void 0 ? void 0 : href.startsWith("#");
|
|
216
218
|
return (React.createElement("a", Object.assign({ className: cn("font-medium transition-colors underline underline-offset-4", isInternal
|
|
217
|
-
?
|
|
219
|
+
? isDark
|
|
220
|
+
? "text-zinc-100 hover:text-zinc-300"
|
|
221
|
+
: "text-zinc-900 hover:text-zinc-700"
|
|
218
222
|
: "text-[var(--colors-primary)] hover:text-[var(--colors-primary)]"), target: isInternal ? undefined : "_blank", rel: isInternal ? undefined : "noopener noreferrer", href: href }, props), children));
|
|
219
223
|
},
|
|
220
224
|
// "> This is ÷a quote"
|
|
221
225
|
blockquote({ children }) {
|
|
222
|
-
return (React.createElement("blockquote", { className: "mt-4 border-l-4
|
|
226
|
+
return (React.createElement("blockquote", { className: cn("mt-4 border-l-4 pl-6 italic", isDark ? "border-zinc-800 text-zinc-200" : "border-zinc-200 text-zinc-800") }, children));
|
|
223
227
|
},
|
|
224
228
|
code(_a) {
|
|
225
229
|
var _b, _c;
|
|
@@ -229,7 +233,7 @@ export const Markdown = ({ children, className, isRestricted, showToc, themeColo
|
|
|
229
233
|
// If it's an inline code block, render it as a small block by default
|
|
230
234
|
// so it visually separates from the surrounding text instead of sitting inline.
|
|
231
235
|
if (isInline) {
|
|
232
|
-
return (React.createElement("code", Object.assign({ className: cn("inline-block text-
|
|
236
|
+
return (React.createElement("code", Object.assign({ className: cn("inline-block text-sm px-2 py-1 rounded-lg mt-2 font-mono", isDark ? "text-zinc-100 bg-zinc-800" : "text-zinc-900 bg-zinc-100", className) }, props), children));
|
|
233
237
|
}
|
|
234
238
|
// Extract language and title
|
|
235
239
|
const language = (match === null || match === void 0 ? void 0 : match[1]) || "";
|
|
@@ -244,7 +248,7 @@ export const Markdown = ({ children, className, isRestricted, showToc, themeColo
|
|
|
244
248
|
},
|
|
245
249
|
};
|
|
246
250
|
return (React.createElement("div", { className: "mx-auto min-w-0" },
|
|
247
|
-
React.createElement(MemoizedReactMarkdown, { className: cn("prose prose-slate
|
|
251
|
+
React.createElement(MemoizedReactMarkdown, { className: cn("prose prose-slate max-w-none", isDark && "prose-invert", "prose-headings:font-semibold prose-headings:tracking-tight", "[&>*:first-child]:mt-0", "prose-p:leading-7", "prose-li:leading-7", "prose-code:rounded-md prose-code:px-2 prose-code:py-1", isDark ? "prose-code:bg-zinc-800" : "prose-code:bg-zinc-100", "prose-pre:rounded-lg prose-pre:border", isDark ? "prose-pre:border-zinc-800" : "prose-pre:border-zinc-200", "prose-img:rounded-lg prose-img:border", isDark ? "prose-img:border-zinc-800" : "prose-img:border-zinc-200", "prose-blockquote:border-l-4", isDark ? "prose-blockquote:border-zinc-800" : "prose-blockquote:border-zinc-200", "prose-table:border", isDark ? "prose-table:border-zinc-800" : "prose-table:border-zinc-200", "prose-a:no-underline hover:prose-a:underline", className), remarkPlugins: [
|
|
248
252
|
remarkGfm,
|
|
249
253
|
remarkMath,
|
|
250
254
|
// add remarkMdx to the remarkPlugins array
|
|
@@ -253,15 +257,20 @@ export const Markdown = ({ children, className, isRestricted, showToc, themeColo
|
|
|
253
257
|
? sharedComponents
|
|
254
258
|
: Object.assign(Object.assign({}, sharedComponents), { h1: headingRenderer(1), h2: headingRenderer(2), h3: headingRenderer(3), h4: headingRenderer(4), table({ children }) {
|
|
255
259
|
return (React.createElement("div", { className: "my-6 w-full overflow-x-auto rounded-lg" },
|
|
256
|
-
React.createElement("table", { className: "w-full border-collapse border border-zinc-
|
|
260
|
+
React.createElement("table", { className: cn("w-full border-collapse border", isDark ? "border-zinc-800" : "border-zinc-200") }, children)));
|
|
257
261
|
},
|
|
258
262
|
th({ children }) {
|
|
259
|
-
return (React.createElement("th", { className: "border
|
|
263
|
+
return (React.createElement("th", { className: cn("border px-4 py-2 text-left font-semibold", isDark ? "border-zinc-800 bg-zinc-900" : "border-zinc-200 bg-zinc-50") }, children));
|
|
260
264
|
},
|
|
261
265
|
td({ children }) {
|
|
262
|
-
return (React.createElement("td", { className: "border
|
|
266
|
+
return (React.createElement("td", { className: cn("border px-4 py-2", isDark ? "border-zinc-800" : "border-zinc-200") }, children));
|
|
263
267
|
} }) }, children)));
|
|
264
268
|
};
|
|
269
|
+
/** Wrapper component that uses theme context */
|
|
270
|
+
export const Markdown = (props) => {
|
|
271
|
+
const { isDark } = useSdkTheme();
|
|
272
|
+
return React.createElement(MarkdownInternal, Object.assign({}, props, { isDark: isDark }));
|
|
273
|
+
};
|
|
265
274
|
// import React, { FC, useEffect, useState } from "react";
|
|
266
275
|
// import { cn } from "@/lib/utils";
|
|
267
276
|
// import { MDXProvider } from "@mdx-js/react";
|
|
@@ -33,7 +33,7 @@ function getGradientColors(title) {
|
|
|
33
33
|
/**
|
|
34
34
|
* SandboxCard component - displays an individual template card
|
|
35
35
|
*/
|
|
36
|
-
export const SandboxCard = ({ title, description, sandboxId, basePath = "/sandbox", imageUrl, }) => {
|
|
36
|
+
export const SandboxCard = ({ title, description, sandboxId, basePath = "/sandbox", imageUrl, isDark = true, }) => {
|
|
37
37
|
// Ensure title is always a string
|
|
38
38
|
const safeTitle = title || "";
|
|
39
39
|
const safeDescription = description || "";
|
|
@@ -50,14 +50,16 @@ 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:
|
|
53
|
+
return (React.createElement("div", { onClick: handleClick, className: `group relative block min-w-[240px] w-full h-[200px] border rounded-lg overflow-hidden transition-all duration-100 ease-out focus-visible:outline-none cursor-pointer ${isDark
|
|
54
|
+
? "border-[#333] bg-[#0a0a0a] hover:border-[#444]"
|
|
55
|
+
: "border-zinc-200 bg-zinc-50 hover:border-zinc-300"}` },
|
|
54
56
|
React.createElement("div", { className: "flex flex-col gap-1 px-6 py-5" },
|
|
55
57
|
React.createElement("div", { className: "flex items-center max-w-max pr-2.5" },
|
|
56
|
-
React.createElement("h3", { className:
|
|
58
|
+
React.createElement("h3", { className: `text-[16px] font-medium m-0 w-max whitespace-nowrap overflow-hidden text-ellipsis flex-1 mr-0 ${isDark ? "text-white" : "text-zinc-900"}` }, safeTitle),
|
|
57
59
|
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
60
|
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:
|
|
60
|
-
React.createElement("div", { className:
|
|
61
|
+
React.createElement("p", { className: `text-[14px] m-0 line-clamp-2 ${isDark ? "text-gray-400" : "text-zinc-500"}` }, safeDescription)),
|
|
62
|
+
React.createElement("div", { className: `absolute top-[110px] -right-10 w-[300px] h-[100px] rounded-lg border 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 ${isDark ? "border-[#333]" : "border-zinc-200"}` }, 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
63
|
React.createElement("div", { className: "w-full px-6 space-y-2" },
|
|
62
64
|
React.createElement("div", { className: "h-2 bg-white/20 rounded w-1/2 mx-auto" }),
|
|
63
65
|
React.createElement("div", { className: "h-1.5 bg-white/10 rounded w-3/4 mx-auto" }),
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
import React, { useState, useMemo, useEffect } from "react";
|
|
3
14
|
import { SandboxCard } from "./SandboxCard";
|
|
4
15
|
import { SearchBar } from "./SearchBar";
|
|
5
16
|
import { createApiClient } from "../../../lib/api-client";
|
|
6
17
|
import { Skeleton } from "../../ui/skeleton";
|
|
18
|
+
import { SdkThemeProvider, useSdkTheme } from "../guardian/context/theme-context";
|
|
7
19
|
/**
|
|
8
20
|
* Transform SandboxContentPublic to SandboxItem
|
|
9
21
|
*/
|
|
@@ -37,10 +49,12 @@ function transformSandboxContent(content) {
|
|
|
37
49
|
sandboxId: content.uid,
|
|
38
50
|
};
|
|
39
51
|
}
|
|
40
|
-
|
|
52
|
+
/** Internal component that uses theme context */
|
|
53
|
+
const SandboxHomeInternal = ({ apiKey, orgid, sandboxes, basePath = "/sandbox", }) => {
|
|
54
|
+
const { isDark } = useSdkTheme();
|
|
41
55
|
// Validate apiKey immediately
|
|
42
56
|
if (!apiKey || apiKey.trim() === "") {
|
|
43
|
-
return (React.createElement("div", { className:
|
|
57
|
+
return (React.createElement("div", { className: `flex items-center justify-center min-h-screen ${isDark ? "bg-black" : "bg-white"}` },
|
|
44
58
|
React.createElement("div", { className: "text-red-500" }, "Error: apiKey is required. Please provide a valid API key.")));
|
|
45
59
|
}
|
|
46
60
|
// Start loading as true if we need to fetch (no sandboxes prop provided)
|
|
@@ -95,26 +109,31 @@ export const SandboxHome = ({ apiKey, orgid, sandboxes, basePath = "/sandbox", }
|
|
|
95
109
|
return matchesTitle || matchesDescription;
|
|
96
110
|
});
|
|
97
111
|
}, [allSandboxes, searchQuery]);
|
|
98
|
-
return (React.createElement("div", { className:
|
|
112
|
+
return (React.createElement("div", { className: `min-h-screen ${isDark ? "bg-black" : "bg-white"}` },
|
|
99
113
|
React.createElement("div", { className: "pt-16 pb-12 px-4 md:px-6" },
|
|
100
114
|
React.createElement("div", { className: "max-w-[1400px] mx-auto" },
|
|
101
|
-
React.createElement(SearchBar, { value: searchQuery, onChange: setSearchQuery }))),
|
|
115
|
+
React.createElement(SearchBar, { value: searchQuery, onChange: setSearchQuery, isDark: isDark }))),
|
|
102
116
|
React.createElement("div", { className: "px-4 md:px-6 pb-16" },
|
|
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:
|
|
117
|
+
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 rounded-lg overflow-hidden ${isDark ? "border-[#333] bg-[#0a0a0a]" : "border-zinc-200 bg-zinc-50"}` },
|
|
104
118
|
React.createElement("div", { className: "flex flex-col gap-1 px-6 py-5" },
|
|
105
119
|
React.createElement("div", { className: "flex items-center max-w-max pr-2.5" },
|
|
106
|
-
React.createElement(Skeleton, { className:
|
|
107
|
-
React.createElement(Skeleton, { className:
|
|
108
|
-
React.createElement(Skeleton, { className:
|
|
109
|
-
React.createElement("div", { className:
|
|
110
|
-
React.createElement(Skeleton, { className:
|
|
120
|
+
React.createElement(Skeleton, { className: `h-5 w-32 ${isDark ? "bg-zinc-800" : "bg-zinc-200"}` })),
|
|
121
|
+
React.createElement(Skeleton, { className: `h-4 w-full mt-1 ${isDark ? "bg-zinc-800" : "bg-zinc-200"}` }),
|
|
122
|
+
React.createElement(Skeleton, { className: `h-4 w-3/4 mt-1 ${isDark ? "bg-zinc-800" : "bg-zinc-200"}` })),
|
|
123
|
+
React.createElement("div", { className: `absolute top-[110px] -right-10 w-[300px] h-[100px] rounded-lg border overflow-hidden shadow-lg rotate-[-5deg] ${isDark ? "border-[#333]" : "border-zinc-200"}` },
|
|
124
|
+
React.createElement(Skeleton, { className: `w-full h-full ${isDark ? "bg-zinc-800" : "bg-zinc-200"}` }))))))) : error && !sandboxes ? (React.createElement("div", { className: "col-span-full text-center py-16" },
|
|
111
125
|
React.createElement("p", { className: "text-red-500 text-lg" },
|
|
112
126
|
"Error: ",
|
|
113
127
|
error),
|
|
114
|
-
React.createElement("p", { className:
|
|
128
|
+
React.createElement("p", { className: `text-sm mt-2 ${isDark ? "text-gray-500" : "text-zinc-500"}` }, "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
|
|
115
129
|
.filter((sandbox) => sandbox && sandbox.title && sandbox.description)
|
|
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
|
|
117
|
-
React.createElement("p", { className: "text-
|
|
130
|
+
.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`, isDark: isDark })))) : (React.createElement("div", { className: "col-span-full text-center py-16" },
|
|
131
|
+
React.createElement("p", { className: `text-lg ${isDark ? "text-gray-500" : "text-zinc-500"}` }, searchQuery
|
|
118
132
|
? `No sandboxes found matching "${searchQuery}".`
|
|
119
133
|
: "No sandboxes available. Provide sandboxes prop to display cards.")))))))));
|
|
120
134
|
};
|
|
135
|
+
export const SandboxHome = (_a) => {
|
|
136
|
+
var { theme = "dark" } = _a, props = __rest(_a, ["theme"]);
|
|
137
|
+
return (React.createElement(SdkThemeProvider, { theme: theme },
|
|
138
|
+
React.createElement(SandboxHomeInternal, Object.assign({}, props))));
|
|
139
|
+
};
|
|
@@ -3,10 +3,12 @@ import React from "react";
|
|
|
3
3
|
/**
|
|
4
4
|
* SearchBar component - provides search input for filtering sandboxes
|
|
5
5
|
*/
|
|
6
|
-
export const SearchBar = ({ value, onChange, placeholder = "Search sample apps...", }) => {
|
|
6
|
+
export const SearchBar = ({ value, onChange, placeholder = "Search sample apps...", isDark = true, }) => {
|
|
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:
|
|
9
|
+
React.createElement("svg", { className: `w-4 h-4 ${isDark ? "text-gray-500" : "text-zinc-400"}`, 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:
|
|
11
|
+
React.createElement("input", { type: "text", placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), className: `w-full border rounded-lg py-3 pl-11 pr-4 text-sm focus:outline-none transition-colors ${isDark
|
|
12
|
+
? "bg-[#0a0a0a] border-[#222] text-white placeholder:text-gray-500 focus:border-gray-600"
|
|
13
|
+
: "bg-white border-zinc-200 text-zinc-900 placeholder:text-zinc-400 focus:border-zinc-400"}` })));
|
|
12
14
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Handles selection state and derives UI sections from the tree config
|
|
4
4
|
*/
|
|
5
5
|
import { useState, useMemo, useCallback } from "react";
|
|
6
|
-
import { getDefaultPath, getSelectableSections, updateSelectionPath, createSelection
|
|
6
|
+
import { getDefaultPath, getSelectableSections, updateSelectionPath, createSelection } from "../lib/tree-utils";
|
|
7
7
|
import { findMatchingContent, hasContentForSelection } from "../lib/content-matcher";
|
|
8
8
|
/**
|
|
9
9
|
* Hook for managing tree-based tech stack selection
|
|
@@ -33,7 +33,7 @@ import { findMatchingContent, hasContentForSelection } from "../lib/content-matc
|
|
|
33
33
|
* ))}
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
export function useTreeSelector({ config, allContent, initialPath, onSelectionChange
|
|
36
|
+
export function useTreeSelector({ config, allContent, initialPath, onSelectionChange }) {
|
|
37
37
|
// Initialize selection path
|
|
38
38
|
const [selectionPath, setSelectionPath] = useState(() => {
|
|
39
39
|
if (initialPath && initialPath.length > 0) {
|
|
@@ -92,7 +92,7 @@ export function useTreeSelector({ config, allContent, initialPath, onSelectionCh
|
|
|
92
92
|
currentContent,
|
|
93
93
|
selectOption,
|
|
94
94
|
resetToDefault,
|
|
95
|
-
setSelectionPath: setPath
|
|
95
|
+
setSelectionPath: setPath
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
export default useTreeSelector;
|
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, }: GuardianComponentProps): default_2.JSX.Element;
|
|
400
|
+
gitUrl, hasNetworkView }: GuardianComponentProps): default_2.JSX.Element;
|
|
401
401
|
|
|
402
402
|
export declare interface GuardianComponentProps {
|
|
403
403
|
name: string;
|
|
@@ -445,6 +445,8 @@ export declare interface GuardianComponentProps {
|
|
|
445
445
|
/* Excluded from this release type: hideHeader */
|
|
446
446
|
/** Optional Git URL for opening the project in VSCode */
|
|
447
447
|
gitUrl?: string;
|
|
448
|
+
/** Whether to show the network requests view tab */
|
|
449
|
+
hasNetworkView?: boolean;
|
|
448
450
|
}
|
|
449
451
|
|
|
450
452
|
/**
|
|
@@ -492,8 +494,12 @@ export declare type GuardianNestedConfig = Record<string, GuardianUseCaseConfig>
|
|
|
492
494
|
/**
|
|
493
495
|
* Guardian Playground component with tree-based tech stack selection.
|
|
494
496
|
* Uses sections from useTreeSelector for dynamic header rendering.
|
|
497
|
+
*
|
|
498
|
+
* Note: Frame param overrides for node types (architecture, frontend, backend, etc.)
|
|
499
|
+
* are now handled in Sandbox.tsx via the tree selector sync mechanism.
|
|
500
|
+
* This component receives the already-resolved framework from the tree selector.
|
|
495
501
|
*/
|
|
496
|
-
export declare function GuardianPlayground({ sandboxConfig, sections, onSelect, useCase, framework
|
|
502
|
+
export declare function GuardianPlayground({ sandboxConfig, sections, onSelect, useCase, framework, isFrame, apiKey, env, chatUid, theme, hasNetworkView }: GuardianPlaygroundProps): default_2.JSX.Element;
|
|
497
503
|
|
|
498
504
|
declare interface GuardianPlaygroundProps {
|
|
499
505
|
/** Sandbox configuration */
|
|
@@ -504,7 +510,7 @@ declare interface GuardianPlaygroundProps {
|
|
|
504
510
|
onSelect: (nodeType: string, key: string) => void;
|
|
505
511
|
/** Current use case ID */
|
|
506
512
|
useCase: string;
|
|
507
|
-
/** Current framework key (from
|
|
513
|
+
/** Current framework key (from tree selector) */
|
|
508
514
|
framework: string;
|
|
509
515
|
/** Whether to render in frame mode (just the right view) */
|
|
510
516
|
isFrame?: boolean;
|
|
@@ -516,6 +522,8 @@ declare interface GuardianPlaygroundProps {
|
|
|
516
522
|
chatUid?: string;
|
|
517
523
|
/** Theme mode - "light", "dark", or "system". Defaults to "dark" */
|
|
518
524
|
theme?: ThemeMode;
|
|
525
|
+
/** Whether to show the network requests view tab */
|
|
526
|
+
hasNetworkView?: boolean;
|
|
519
527
|
}
|
|
520
528
|
|
|
521
529
|
export declare function GuardianProvider({ children }: {
|
|
@@ -605,6 +613,16 @@ declare interface ModalSearchAndChatProps {
|
|
|
605
613
|
*/
|
|
606
614
|
export declare const NODE_TYPE_LABELS: Record<string, string>;
|
|
607
615
|
|
|
616
|
+
/**
|
|
617
|
+
* All supported node types for tech stack selection
|
|
618
|
+
*/
|
|
619
|
+
export declare const NODE_TYPES: readonly ["root", "product", "version", "architecture", "frontend", "backend", "framework", "integration", "platform"];
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Type for node types
|
|
623
|
+
*/
|
|
624
|
+
export declare type NodeType = (typeof NODE_TYPES)[number];
|
|
625
|
+
|
|
608
626
|
/**
|
|
609
627
|
* Convert a path to a byType map
|
|
610
628
|
* @param root - The root node
|
|
@@ -652,7 +670,7 @@ declare class SampleAppSDK {
|
|
|
652
670
|
* />
|
|
653
671
|
* ```
|
|
654
672
|
*/
|
|
655
|
-
export declare function Sandbox({ apiKey, sandboxId, env, themeColor, theme, config
|
|
673
|
+
export declare function Sandbox({ apiKey, sandboxId, env, themeColor, theme, config }: SandboxProps): default_2.JSX.Element | null;
|
|
656
674
|
|
|
657
675
|
/**
|
|
658
676
|
* Configuration fetched from the API for a sandbox
|
|
@@ -680,6 +698,16 @@ declare interface SandboxConfig {
|
|
|
680
698
|
useCases: GuardianUseCase[];
|
|
681
699
|
}
|
|
682
700
|
|
|
701
|
+
/**
|
|
702
|
+
* Configuration options for the Sandbox component
|
|
703
|
+
*/
|
|
704
|
+
declare interface SandboxConfigOptions {
|
|
705
|
+
/** Whether to render in frame mode (just the right view) */
|
|
706
|
+
isFrame?: boolean;
|
|
707
|
+
/** Whether to show the network requests view tab. Defaults to false */
|
|
708
|
+
hasNetworkView?: boolean;
|
|
709
|
+
}
|
|
710
|
+
|
|
683
711
|
/**
|
|
684
712
|
* Extended sandbox configuration with tree-based tech stack selection
|
|
685
713
|
*/
|
|
@@ -735,6 +763,7 @@ export declare interface SandboxHomeProps {
|
|
|
735
763
|
orgid: string;
|
|
736
764
|
sandboxes?: SandboxItem[];
|
|
737
765
|
basePath?: string;
|
|
766
|
+
theme?: ThemeMode;
|
|
738
767
|
}
|
|
739
768
|
|
|
740
769
|
export declare interface SandboxItem {
|
|
@@ -762,8 +791,8 @@ export declare interface SandboxProps {
|
|
|
762
791
|
themeColor?: string;
|
|
763
792
|
/** Theme mode - "light", "dark", or "system". Defaults to "dark" */
|
|
764
793
|
theme?: ThemeMode;
|
|
765
|
-
/** Configuration for the sandbox */
|
|
766
|
-
config?:
|
|
794
|
+
/** Configuration options for the sandbox */
|
|
795
|
+
config?: SandboxConfigOptions;
|
|
767
796
|
}
|
|
768
797
|
|
|
769
798
|
export declare interface SandboxUseCase {
|
|
@@ -787,6 +816,11 @@ export declare interface SDKSettings {
|
|
|
787
816
|
aiChatSettings?: AiChatSettings;
|
|
788
817
|
}
|
|
789
818
|
|
|
819
|
+
/**
|
|
820
|
+
* Selectable node types (excludes "root" which is not user-selectable)
|
|
821
|
+
*/
|
|
822
|
+
export declare const SELECTABLE_NODE_TYPES: Exclude<NodeType, "root">[];
|
|
823
|
+
|
|
790
824
|
/**
|
|
791
825
|
* A single option within a selector section
|
|
792
826
|
*/
|
|
@@ -799,6 +833,8 @@ export declare interface SelectorOption {
|
|
|
799
833
|
isSelected: boolean;
|
|
800
834
|
/** Whether this option has content available (for disabling unavailable options) */
|
|
801
835
|
hasContent?: boolean;
|
|
836
|
+
/** Whether this option is a leaf node (has no children) */
|
|
837
|
+
isLeaf?: boolean;
|
|
802
838
|
}
|
|
803
839
|
|
|
804
840
|
/**
|
|
@@ -967,7 +1003,7 @@ export declare function updateSelectionPath(config: TechStackConfig, currentPath
|
|
|
967
1003
|
* ))}
|
|
968
1004
|
* ```
|
|
969
1005
|
*/
|
|
970
|
-
export declare function useTreeSelector({ config, allContent, initialPath, onSelectionChange
|
|
1006
|
+
export declare function useTreeSelector({ config, allContent, initialPath, onSelectionChange }: UseTreeSelectorOptions): UseTreeSelectorReturn;
|
|
971
1007
|
|
|
972
1008
|
export declare interface UseTreeSelectorOptions {
|
|
973
1009
|
/** The tech stack configuration tree */
|