sunpeak 0.5.39 → 0.6.1
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/README.md +1 -0
- package/bin/commands/build.mjs +4 -4
- package/dist/chatgpt/globals.css +7 -0
- package/dist/chatgpt/mock-openai.d.ts +2 -2
- package/dist/chatgpt/simple-sidebar.d.ts +2 -1
- package/dist/hooks/use-max-height.d.ts +1 -1
- package/dist/index.cjs +235 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +235 -150
- package/dist/index.js.map +1 -1
- package/dist/providers/openai/types.d.ts +1 -1
- package/dist/providers/types.d.ts +1 -1
- package/dist/style.css +201 -38
- package/package.json +1 -1
- package/template/.sunpeak/dev.tsx +2 -2
- package/template/README.md +3 -3
- package/template/dist/chatgpt/albums.js +11 -11
- package/template/dist/chatgpt/carousel.js +2 -2
- package/template/dist/chatgpt/counter.js +7 -7
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js +2 -2
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +9 -9
- package/template/node_modules/.vite/deps/_metadata.json +22 -22
- package/template/node_modules/.vite/deps/{chunk-EVJ3DVH5.js → chunk-DQAZDQU3.js} +5 -5
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/src/components/album/albums.test.tsx +7 -2
- package/template/src/components/album/albums.tsx +1 -1
- package/template/src/components/album/fullscreen-viewer.test.tsx +12 -24
- package/template/src/components/album/fullscreen-viewer.tsx +30 -71
- package/template/src/components/carousel/carousel.tsx +1 -1
- package/template/src/components/index.ts +0 -1
- package/template/src/{components/resources → resources}/albums-resource.test.tsx +1 -1
- package/template/src/{components/resources → resources}/albums-resource.tsx +2 -1
- package/template/src/{components/resources → resources}/carousel-resource.test.tsx +2 -2
- package/template/src/{components/resources → resources}/carousel-resource.tsx +2 -2
- package/template/src/{components/resources → resources}/counter-resource.tsx +8 -0
- package/template/src/simulations/albums-simulation.ts +5 -1
- package/template/src/simulations/carousel-simulation.ts +5 -1
- package/template/src/simulations/counter-simulation.ts +6 -1
- package/template/src/simulations/widget-config.ts +42 -0
- /package/template/node_modules/.vite/deps/{chunk-EVJ3DVH5.js.map → chunk-DQAZDQU3.js.map} +0 -0
- /package/template/src/{components/resources → resources}/counter-resource.test.tsx +0 -0
- /package/template/src/{components/resources → resources}/index.ts +0 -0
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ Quickstart, build, test, and ship your ChatGPT App locally!
|
|
|
21
21
|
|
|
22
22
|
[Demo (Hosted)](https://sunpeak.ai/#simulator) ~
|
|
23
23
|
[Demo (Video)](https://d10djik02wlf6x.cloudfront.net/sunpeak-demo-prod.mp4) ~
|
|
24
|
+
[Discord (NEW)](https://discord.gg/FB2QNXqRnw) ~
|
|
24
25
|
[Documentation](https://docs.sunpeak.ai/) ~
|
|
25
26
|
[GitHub](https://github.com/Sunpeak-AI/sunpeak)
|
|
26
27
|
|
package/bin/commands/build.mjs
CHANGED
|
@@ -26,12 +26,12 @@ export async function build(projectRoot = process.cwd()) {
|
|
|
26
26
|
const distDir = path.join(projectRoot, 'dist/chatgpt');
|
|
27
27
|
const buildDir = path.join(projectRoot, 'dist/build-output');
|
|
28
28
|
const tempDir = path.join(projectRoot, '.tmp');
|
|
29
|
-
const resourcesDir = path.join(projectRoot, 'src/
|
|
29
|
+
const resourcesDir = path.join(projectRoot, 'src/resources');
|
|
30
30
|
const templateFile = path.join(projectRoot, 'src/index-resource.tsx');
|
|
31
31
|
|
|
32
32
|
// Validate project structure
|
|
33
33
|
if (!existsSync(resourcesDir)) {
|
|
34
|
-
console.error('Error: src/
|
|
34
|
+
console.error('Error: src/resources directory not found');
|
|
35
35
|
console.error('Expected location: ' + resourcesDir);
|
|
36
36
|
console.error('\nThe build command expects the standard Sunpeak project structure.');
|
|
37
37
|
console.error('If you have customized your project structure, you may need to use');
|
|
@@ -106,7 +106,7 @@ export async function build(projectRoot = process.cwd()) {
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
if (resourceFiles.length === 0) {
|
|
109
|
-
console.error('Error: No resource files found in src/
|
|
109
|
+
console.error('Error: No resource files found in src/resources/');
|
|
110
110
|
console.error('Resource files should be named like: counter-resource.tsx');
|
|
111
111
|
process.exit(1);
|
|
112
112
|
}
|
|
@@ -144,7 +144,7 @@ export async function build(projectRoot = process.cwd()) {
|
|
|
144
144
|
|
|
145
145
|
// Create entry file from template in temp directory
|
|
146
146
|
const entryContent = template
|
|
147
|
-
.replace('// RESOURCE_IMPORT', `import { ${componentName} } from '../src/
|
|
147
|
+
.replace('// RESOURCE_IMPORT', `import { ${componentName} } from '../src/resources/${componentFile}';`)
|
|
148
148
|
.replace('// RESOURCE_MOUNT', `createRoot(root).render(<${componentName} />);`);
|
|
149
149
|
|
|
150
150
|
const entryPath = path.join(projectRoot, entry);
|
package/dist/chatgpt/globals.css
CHANGED
|
@@ -30,3 +30,10 @@
|
|
|
30
30
|
@utility bg-sidebar {
|
|
31
31
|
background-color: var(--color-surface-secondary);
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
/* Ensure Select dropdowns appear above mobile drawer overlay when simulator is present */
|
|
35
|
+
@layer components {
|
|
36
|
+
:has(.sunpeak-simulator-root) :where([role="listbox"], [data-radix-select-content], [data-radix-popper-content-wrapper]) {
|
|
37
|
+
z-index: 100 !important;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -4,7 +4,7 @@ declare class MockOpenAI implements OpenAiAPI, OpenAiGlobals {
|
|
|
4
4
|
theme: Theme;
|
|
5
5
|
userAgent: OpenAiGlobals['userAgent'];
|
|
6
6
|
locale: string;
|
|
7
|
-
maxHeight: number;
|
|
7
|
+
maxHeight: number | undefined;
|
|
8
8
|
displayMode: DisplayMode;
|
|
9
9
|
safeArea: {
|
|
10
10
|
insets: {
|
|
@@ -42,7 +42,7 @@ declare class MockOpenAI implements OpenAiAPI, OpenAiGlobals {
|
|
|
42
42
|
setTheme(theme: Theme): void;
|
|
43
43
|
setUserAgent(userAgent: OpenAiGlobals['userAgent']): void;
|
|
44
44
|
setLocale(locale: string): void;
|
|
45
|
-
setMaxHeight(maxHeight: number): void;
|
|
45
|
+
setMaxHeight(maxHeight: number | undefined): void;
|
|
46
46
|
setDisplayMode(displayMode: DisplayMode): void;
|
|
47
47
|
setSafeArea(safeArea: OpenAiGlobals['safeArea']): void;
|
|
48
48
|
setView(view: View | null): void;
|
|
@@ -30,8 +30,9 @@ interface SidebarInputProps {
|
|
|
30
30
|
onChange: (value: string) => void;
|
|
31
31
|
placeholder?: string;
|
|
32
32
|
type?: 'text' | 'number';
|
|
33
|
+
disabled?: boolean;
|
|
33
34
|
}
|
|
34
|
-
export declare function SidebarInput({ value, onChange, placeholder, type }: SidebarInputProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function SidebarInput({ value, onChange, placeholder, type, disabled, }: SidebarInputProps): import("react/jsx-runtime").JSX.Element;
|
|
35
36
|
interface SidebarCheckboxProps {
|
|
36
37
|
checked: boolean;
|
|
37
38
|
onChange: (checked: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useMaxHeight: () => number | null;
|
|
1
|
+
export declare const useMaxHeight: () => number | null | undefined;
|
package/dist/index.cjs
CHANGED
|
@@ -5706,6 +5706,7 @@ const preventDefaultHandler = (evt) => {
|
|
|
5706
5706
|
};
|
|
5707
5707
|
const Check = (props) => jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z", clipRule: "evenodd" }) });
|
|
5708
5708
|
const ChevronDownVector = (props) => jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 16 9", fill: "currentColor", ...props, children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z" }) });
|
|
5709
|
+
const ChevronRight = (props) => jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M8.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L14.586 12 8.293 5.707a1 1 0 0 1 0-1.414Z", clipRule: "evenodd" }) });
|
|
5709
5710
|
const CloseBold = (props) => jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.83071 5.83077C6.33839 5.32309 7.16151 5.32309 7.66919 5.83077L12 10.1615L16.3307 5.83077C16.8384 5.32309 17.6615 5.32309 18.1692 5.83077C18.6769 6.33845 18.6769 7.16157 18.1692 7.66925L13.8384 12L18.1692 16.3308C18.6769 16.8385 18.6769 17.6616 18.1692 18.1693C17.6615 18.6769 16.8384 18.6769 16.3307 18.1693L12 13.8385L7.66919 18.1693C7.16151 18.6769 6.33839 18.6769 5.83071 18.1693C5.32303 17.6616 5.32303 16.8385 5.83071 16.3308L10.1615 12L5.83071 7.66925C5.32303 7.16157 5.32303 6.33845 5.83071 5.83077Z", fill: "currentColor" }) });
|
|
5710
5711
|
const DropdownVector = (props) => jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 10 16", fill: "currentColor", ...props, children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z" }) });
|
|
5711
5712
|
const Info = (props) => jsxRuntime.jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: [jsxRuntime.jsx("path", { d: "M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z" }), jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z", clipRule: "evenodd" })] });
|
|
@@ -7378,12 +7379,78 @@ const Segment = ({ children, ...restProps }) => {
|
|
|
7378
7379
|
};
|
|
7379
7380
|
SegmentedControl.Option = Segment;
|
|
7380
7381
|
function SimpleSidebar({ children, controls }) {
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7382
|
+
const [isDrawerOpen, setIsDrawerOpen] = React__namespace.useState(false);
|
|
7383
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sunpeak-simulator-root flex h-screen w-full overflow-hidden relative", children: [
|
|
7384
|
+
isDrawerOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7385
|
+
"div",
|
|
7386
|
+
{
|
|
7387
|
+
className: "md:hidden fixed inset-0 bg-black/50 z-40 pointer-events-auto",
|
|
7388
|
+
onClick: (e) => {
|
|
7389
|
+
if (e.target === e.currentTarget) {
|
|
7390
|
+
setIsDrawerOpen(false);
|
|
7391
|
+
}
|
|
7392
|
+
}
|
|
7393
|
+
}
|
|
7394
|
+
),
|
|
7395
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7396
|
+
"aside",
|
|
7397
|
+
{
|
|
7398
|
+
className: `
|
|
7399
|
+
w-56 flex flex-col border-r border-subtle bg-sidebar
|
|
7400
|
+
md:relative md:z-auto
|
|
7401
|
+
max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:z-[100]
|
|
7402
|
+
max-md:transition-transform max-md:duration-300
|
|
7403
|
+
${isDrawerOpen ? "max-md:translate-x-0" : "max-md:-translate-x-full"}
|
|
7404
|
+
`,
|
|
7405
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto min-h-0 px-3 pb-3 pt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7406
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between sticky top-0 bg-sidebar z-10 py-2", children: [
|
|
7407
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xs font-semibold", children: "Controls" }),
|
|
7408
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7409
|
+
"button",
|
|
7410
|
+
{
|
|
7411
|
+
onClick: () => setIsDrawerOpen(false),
|
|
7412
|
+
className: "md:hidden text-secondary hover:text-primary transition-colors p-1",
|
|
7413
|
+
type: "button",
|
|
7414
|
+
"aria-label": "Close sidebar",
|
|
7415
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7416
|
+
"svg",
|
|
7417
|
+
{
|
|
7418
|
+
width: "16",
|
|
7419
|
+
height: "16",
|
|
7420
|
+
viewBox: "0 0 16 16",
|
|
7421
|
+
fill: "none",
|
|
7422
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7423
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7424
|
+
"path",
|
|
7425
|
+
{
|
|
7426
|
+
d: "M12 4L4 12M4 4L12 12",
|
|
7427
|
+
stroke: "currentColor",
|
|
7428
|
+
strokeWidth: "2",
|
|
7429
|
+
strokeLinecap: "round"
|
|
7430
|
+
}
|
|
7431
|
+
)
|
|
7432
|
+
}
|
|
7433
|
+
)
|
|
7434
|
+
}
|
|
7435
|
+
)
|
|
7436
|
+
] }),
|
|
7437
|
+
controls
|
|
7438
|
+
] }) }) })
|
|
7439
|
+
}
|
|
7440
|
+
),
|
|
7441
|
+
/* @__PURE__ */ jsxRuntime.jsxs("main", { className: "flex-1 overflow-auto relative", children: [
|
|
7442
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7443
|
+
"button",
|
|
7444
|
+
{
|
|
7445
|
+
onClick: () => setIsDrawerOpen(true),
|
|
7446
|
+
className: "md:hidden fixed top-18 left-0 z-30 bg-sidebar border-r border-t border-b border-subtle rounded-r-md p-2 shadow-lg hover:bg-primary/10 transition-colors",
|
|
7447
|
+
type: "button",
|
|
7448
|
+
"aria-label": "Open sidebar",
|
|
7449
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, {})
|
|
7450
|
+
}
|
|
7451
|
+
),
|
|
7452
|
+
children
|
|
7453
|
+
] })
|
|
7387
7454
|
] });
|
|
7388
7455
|
}
|
|
7389
7456
|
function SidebarControl({ label, children }) {
|
|
@@ -7427,7 +7494,13 @@ function SidebarSelect({ value, onChange, options, placeholder }) {
|
|
|
7427
7494
|
}
|
|
7428
7495
|
);
|
|
7429
7496
|
}
|
|
7430
|
-
function SidebarInput({
|
|
7497
|
+
function SidebarInput({
|
|
7498
|
+
value,
|
|
7499
|
+
onChange,
|
|
7500
|
+
placeholder,
|
|
7501
|
+
type = "text",
|
|
7502
|
+
disabled = false
|
|
7503
|
+
}) {
|
|
7431
7504
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7432
7505
|
Input,
|
|
7433
7506
|
{
|
|
@@ -7435,7 +7508,8 @@ function SidebarInput({ value, onChange, placeholder, type = "text" }) {
|
|
|
7435
7508
|
value,
|
|
7436
7509
|
onChange: (e) => onChange(e.target.value),
|
|
7437
7510
|
placeholder,
|
|
7438
|
-
size: "2xs"
|
|
7511
|
+
size: "2xs",
|
|
7512
|
+
disabled
|
|
7439
7513
|
}
|
|
7440
7514
|
);
|
|
7441
7515
|
}
|
|
@@ -7511,144 +7585,148 @@ function Conversation({
|
|
|
7511
7585
|
api.requestDisplayMode({ mode: "inline" });
|
|
7512
7586
|
}
|
|
7513
7587
|
};
|
|
7514
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
7515
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7516
|
-
"div",
|
|
7517
|
-
{
|
|
7518
|
-
className: "w-full border-subtle bg-surface z-10 grid h-12 grid-cols-[1fr_auto_1fr] border-b px-2",
|
|
7519
|
-
style: { maxWidth: containerWidth },
|
|
7520
|
-
children: [
|
|
7521
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-start gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7522
|
-
"button",
|
|
7523
|
-
{
|
|
7524
|
-
onClick: handleClose,
|
|
7525
|
-
"aria-label": "Close",
|
|
7526
|
-
className: "h-7 w-7 flex items-center justify-center hover:bg-subtle rounded-md transition-colors text-primary",
|
|
7527
|
-
type: "button",
|
|
7528
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(CloseBold, {})
|
|
7529
|
-
}
|
|
7530
|
-
) }),
|
|
7531
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-primary flex items-center justify-center text-base", children: appName }),
|
|
7532
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end" })
|
|
7533
|
-
]
|
|
7534
|
-
}
|
|
7535
|
-
),
|
|
7536
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7537
|
-
"div",
|
|
7538
|
-
{
|
|
7539
|
-
className: "relative overflow-hidden flex-1 w-full",
|
|
7540
|
-
style: { maxWidth: containerWidth },
|
|
7541
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full max-w-full overflow-auto", children })
|
|
7542
|
-
}
|
|
7543
|
-
),
|
|
7544
|
-
/* @__PURE__ */ jsxRuntime.jsx("footer", { className: "bg-surface w-full", style: { maxWidth: containerWidth }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7545
|
-
"input",
|
|
7546
|
-
{
|
|
7547
|
-
type: "text",
|
|
7548
|
-
name: "userInput",
|
|
7549
|
-
disabled: true,
|
|
7550
|
-
placeholder: "Message SimGPT",
|
|
7551
|
-
className: "w-full bg-[var(--color-background-primary)] dark:bg-[#303030] text-secondary-foreground placeholder:text-muted-foreground rounded-3xl px-5 py-3 pr-12 shadow-md light:border border-[#0000000f]"
|
|
7552
|
-
}
|
|
7553
|
-
) }) }) })
|
|
7554
|
-
] });
|
|
7555
|
-
}
|
|
7556
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col bg-surface w-full h-full flex-1 items-center", children: [
|
|
7557
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7558
|
-
"header",
|
|
7559
|
-
{
|
|
7560
|
-
className: "h-12 bg-surface flex items-center px-4 text-lg sticky top-0 z-40 w-full",
|
|
7561
|
-
style: { maxWidth: containerWidth },
|
|
7562
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary", children: "SimGPT" })
|
|
7563
|
-
}
|
|
7564
|
-
),
|
|
7565
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7588
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7566
7589
|
"div",
|
|
7567
7590
|
{
|
|
7568
|
-
className: "flex flex-col
|
|
7569
|
-
style: {
|
|
7570
|
-
children:
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7591
|
+
className: "flex flex-col bg-surface w-full h-full flex-1 items-center relative",
|
|
7592
|
+
style: { transform: "translate(0)" },
|
|
7593
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7594
|
+
"div",
|
|
7595
|
+
{
|
|
7596
|
+
className: "no-scrollbar fixed start-0 end-0 top-0 bottom-0 z-50 mx-auto flex w-auto flex-col overflow-hidden",
|
|
7597
|
+
style: { maxWidth: containerWidth },
|
|
7598
|
+
children: [
|
|
7599
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-subtle bg-token-bg-primary sm:bg-token-bg-primary z-10 grid h-[3.25rem] grid-cols-[1fr_auto_1fr] border-b px-2", children: [
|
|
7600
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-start gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7601
|
+
"button",
|
|
7602
|
+
{
|
|
7603
|
+
onClick: handleClose,
|
|
7604
|
+
"aria-label": "Close",
|
|
7605
|
+
className: "h-7 w-7 flex items-center justify-center hover:bg-subtle rounded-md transition-colors text-primary",
|
|
7606
|
+
type: "button",
|
|
7607
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CloseBold, {})
|
|
7608
|
+
}
|
|
7609
|
+
) }),
|
|
7610
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-primary flex items-center justify-center text-base", children: appName }),
|
|
7611
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end" })
|
|
7612
|
+
] }),
|
|
7613
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full max-w-full overflow-auto", children }) }),
|
|
7614
|
+
/* @__PURE__ */ jsxRuntime.jsx("footer", { className: "bg-surface", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[48rem] mx-auto px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7615
|
+
"input",
|
|
7576
7616
|
{
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7617
|
+
type: "text",
|
|
7618
|
+
name: "userInput",
|
|
7619
|
+
disabled: true,
|
|
7620
|
+
placeholder: "Message SimGPT",
|
|
7621
|
+
className: "w-full dark:bg-[#303030] text-secondary-foreground placeholder:text-muted-foreground rounded-3xl px-5 py-3 pr-12 shadow-md light:border border-[#0000000f]"
|
|
7580
7622
|
}
|
|
7581
7623
|
) }) }) })
|
|
7582
|
-
]
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7624
|
+
]
|
|
7625
|
+
}
|
|
7626
|
+
)
|
|
7627
|
+
}
|
|
7628
|
+
);
|
|
7629
|
+
}
|
|
7630
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7631
|
+
"div",
|
|
7632
|
+
{
|
|
7633
|
+
className: "flex flex-col bg-surface w-full h-full flex-1 items-center relative",
|
|
7634
|
+
style: { transform: "translate(0)" },
|
|
7635
|
+
children: [
|
|
7636
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7637
|
+
"header",
|
|
7638
|
+
{
|
|
7639
|
+
className: "h-12 bg-surface flex items-center px-4 text-lg sticky top-0 z-40 w-full",
|
|
7640
|
+
style: { maxWidth: containerWidth },
|
|
7641
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary", children: "SimGPT" })
|
|
7642
|
+
}
|
|
7643
|
+
),
|
|
7644
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7645
|
+
"div",
|
|
7646
|
+
{
|
|
7647
|
+
className: "flex flex-col flex-1 w-full transition-all duration-200 overflow-hidden",
|
|
7648
|
+
style: { maxWidth: containerWidth },
|
|
7649
|
+
children: [
|
|
7650
|
+
/* @__PURE__ */ jsxRuntime.jsxs("main", { className: "flex-1 overflow-y-auto overflow-x-hidden", children: [
|
|
7651
|
+
/* @__PURE__ */ jsxRuntime.jsxs("article", { className: "text-primary w-full focus:outline-none", dir: "auto", "data-turn": "user", children: [
|
|
7652
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sr-only", children: "You said:" }),
|
|
7653
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base my-auto mx-auto md:pt-8 px-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[48rem] mx-auto flex-1 relative flex w-full min-w-0 flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex max-w-full flex-col grow", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7654
|
+
"div",
|
|
7655
|
+
{
|
|
7656
|
+
"data-message-author-role": "user",
|
|
7657
|
+
className: "min-h-8 relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal",
|
|
7658
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-col gap-1 empty:hidden items-end", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-[var(--color-background-primary-soft)] relative rounded-[18px] px-4 py-3 max-w-[70%]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap", children: userMessage }) }) })
|
|
7659
|
+
}
|
|
7660
|
+
) }) }) })
|
|
7661
|
+
] }),
|
|
7662
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7663
|
+
"article",
|
|
7664
|
+
{
|
|
7665
|
+
className: "text-primary w-full focus:outline-none",
|
|
7666
|
+
dir: "auto",
|
|
7667
|
+
"data-turn": "assistant",
|
|
7668
|
+
children: [
|
|
7669
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h6", { className: "sr-only", children: [
|
|
7670
|
+
appName,
|
|
7671
|
+
" said:"
|
|
7672
|
+
] }),
|
|
7673
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base my-auto mx-auto pb-10 px-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[48rem] mx-auto flex-1 relative flex w-full min-w-0 flex-col", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-w-full flex-col grow", children: [
|
|
7674
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 my-3", children: [
|
|
7675
|
+
appIcon ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-6 flex items-center justify-center text-base", children: appIcon }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-6 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-medium text-xs", children: "AI" }),
|
|
7676
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-sm", children: appName })
|
|
7677
|
+
] }),
|
|
7678
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7605
7679
|
"div",
|
|
7606
7680
|
{
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7681
|
+
"data-message-author-role": "assistant",
|
|
7682
|
+
className: "min-h-8 relative flex w-full flex-col items-start gap-2 text-start break-words whitespace-normal",
|
|
7683
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-col gap-1 empty:hidden", children: displayMode === "pip" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7684
|
+
"div",
|
|
7685
|
+
{
|
|
7686
|
+
className: "no-scrollbar @w-xl/main:top-4 fixed start-4 end-4 top-12 z-50 mx-auto max-w-[40rem] lg:max-w-[48rem] sm:start-0 sm:end-0 sm:top-[3.25rem] sm:w-full overflow-visible",
|
|
7687
|
+
style: { maxHeight: "480px" },
|
|
7688
|
+
children: [
|
|
7689
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7690
|
+
"button",
|
|
7691
|
+
{
|
|
7692
|
+
onClick: () => {
|
|
7693
|
+
if (api == null ? void 0 : api.requestDisplayMode) {
|
|
7694
|
+
api.requestDisplayMode({ mode: "inline" });
|
|
7695
|
+
}
|
|
7696
|
+
},
|
|
7697
|
+
className: "absolute -start-2 -top-1.5 z-10 rounded-full bg-[#3a3a3a] p-1.5 text-white shadow-[0px_0px_0px_1px_#fff3,0px_4px_12px_rgba(0,0,0,0.12)] hover:bg-[#6a6a6a]",
|
|
7698
|
+
"aria-label": "Close picture-in-picture",
|
|
7699
|
+
type: "button",
|
|
7700
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CloseBold, { className: "h-4 w-4" })
|
|
7619
7701
|
}
|
|
7620
|
-
|
|
7621
|
-
className: "
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
}
|
|
7626
|
-
),
|
|
7627
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden h-full rounded-2xl sm:rounded-3xl shadow-[0px_0px_0px_1px_var(--border-heavy),0px_6px_20px_rgba(0,0,0,0.1)] border border-subtle", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full max-w-full overflow-auto bg-surface", children }) })
|
|
7628
|
-
]
|
|
7702
|
+
),
|
|
7703
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden h-full rounded-2xl sm:rounded-3xl shadow-[0px_0px_0px_1px_#fff3,0px_6px_20px_rgba(0,0,0,0.1)] md:-mx-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full max-w-full overflow-auto bg-white dark:bg-[#212121]", children }) })
|
|
7704
|
+
]
|
|
7705
|
+
}
|
|
7706
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "no-scrollbar relative mb-2 @w-sm/main:w-full mx-0 max-sm:-mx-[1rem] max-sm:w-[100cqw] max-sm:overflow-hidden overflow-visible", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden h-full", children }) }) })
|
|
7629
7707
|
}
|
|
7630
|
-
)
|
|
7631
|
-
}
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
}
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7708
|
+
)
|
|
7709
|
+
] }) }) })
|
|
7710
|
+
]
|
|
7711
|
+
}
|
|
7712
|
+
)
|
|
7713
|
+
] }),
|
|
7714
|
+
/* @__PURE__ */ jsxRuntime.jsx("footer", { className: "bg-surface", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[48rem] mx-auto px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7715
|
+
"input",
|
|
7716
|
+
{
|
|
7717
|
+
type: "text",
|
|
7718
|
+
name: "userInput",
|
|
7719
|
+
disabled: true,
|
|
7720
|
+
placeholder: "Message SimGPT",
|
|
7721
|
+
className: "w-full dark:bg-[#303030] text-secondary-foreground placeholder:text-muted-foreground rounded-3xl px-5 py-3 pr-12 shadow-md light:border border-[#0000000f]"
|
|
7722
|
+
}
|
|
7723
|
+
) }) }) })
|
|
7724
|
+
]
|
|
7725
|
+
}
|
|
7726
|
+
)
|
|
7727
|
+
]
|
|
7728
|
+
}
|
|
7729
|
+
);
|
|
7652
7730
|
}
|
|
7653
7731
|
class MockOpenAI {
|
|
7654
7732
|
constructor() {
|
|
@@ -7661,7 +7739,7 @@ class MockOpenAI {
|
|
|
7661
7739
|
}
|
|
7662
7740
|
});
|
|
7663
7741
|
__publicField(this, "locale", "en-US");
|
|
7664
|
-
__publicField(this, "maxHeight"
|
|
7742
|
+
__publicField(this, "maxHeight");
|
|
7665
7743
|
__publicField(this, "displayMode", "inline");
|
|
7666
7744
|
__publicField(this, "safeArea", {
|
|
7667
7745
|
insets: {
|
|
@@ -7722,7 +7800,8 @@ class MockOpenAI {
|
|
|
7722
7800
|
}
|
|
7723
7801
|
setDisplayMode(displayMode) {
|
|
7724
7802
|
this.displayMode = displayMode;
|
|
7725
|
-
this.
|
|
7803
|
+
this.maxHeight = displayMode === "pip" ? 480 : void 0;
|
|
7804
|
+
this.emitUpdate({ displayMode, maxHeight: this.maxHeight });
|
|
7726
7805
|
}
|
|
7727
7806
|
setSafeArea(safeArea) {
|
|
7728
7807
|
this.safeArea = safeArea;
|
|
@@ -7857,7 +7936,7 @@ function ChatGPTSimulator({
|
|
|
7857
7936
|
[]
|
|
7858
7937
|
);
|
|
7859
7938
|
React.useEffect(() => {
|
|
7860
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7939
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
7861
7940
|
if (selectedSim) {
|
|
7862
7941
|
if (((_a2 = selectedSim.simulationGlobals) == null ? void 0 : _a2.theme) !== void 0) {
|
|
7863
7942
|
mock.theme = selectedSim.simulationGlobals.theme;
|
|
@@ -7871,12 +7950,13 @@ function ChatGPTSimulator({
|
|
|
7871
7950
|
}
|
|
7872
7951
|
mock.userAgent = ((_c = selectedSim.simulationGlobals) == null ? void 0 : _c.userAgent) ?? mock.userAgent;
|
|
7873
7952
|
mock.locale = ((_d = selectedSim.simulationGlobals) == null ? void 0 : _d.locale) ?? "en-US";
|
|
7874
|
-
|
|
7875
|
-
mock.
|
|
7876
|
-
mock.
|
|
7877
|
-
mock.
|
|
7878
|
-
mock.
|
|
7879
|
-
mock.
|
|
7953
|
+
const currentDisplayMode = ((_e = selectedSim.simulationGlobals) == null ? void 0 : _e.displayMode) ?? DEFAULT_DISPLAY_MODE;
|
|
7954
|
+
mock.maxHeight = currentDisplayMode === "pip" ? ((_f = selectedSim.simulationGlobals) == null ? void 0 : _f.maxHeight) ?? 480 : void 0;
|
|
7955
|
+
mock.safeArea = ((_g = selectedSim.simulationGlobals) == null ? void 0 : _g.safeArea) ?? mock.safeArea;
|
|
7956
|
+
mock.view = ((_h = selectedSim.simulationGlobals) == null ? void 0 : _h.view) ?? null;
|
|
7957
|
+
mock.toolInput = ((_i = selectedSim.simulationGlobals) == null ? void 0 : _i.toolInput) ?? {};
|
|
7958
|
+
mock.widgetState = ((_j = selectedSim.simulationGlobals) == null ? void 0 : _j.widgetState) ?? null;
|
|
7959
|
+
mock.toolOutput = ((_k = selectedSim.toolCall) == null ? void 0 : _k.structuredContent) ?? null;
|
|
7880
7960
|
}
|
|
7881
7961
|
}, [selectedKey, selectedSim, mock]);
|
|
7882
7962
|
const theme = useTheme() ?? DEFAULT_THEME;
|
|
@@ -8071,13 +8151,18 @@ function ChatGPTSimulator({
|
|
|
8071
8151
|
placeholder: "e.g. en-US"
|
|
8072
8152
|
}
|
|
8073
8153
|
) }),
|
|
8074
|
-
/* @__PURE__ */ jsxRuntime.jsx(SidebarControl, { label: "Max Height", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8154
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarControl, { label: "Max Height (PiP)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8075
8155
|
SidebarInput,
|
|
8076
8156
|
{
|
|
8077
8157
|
type: "number",
|
|
8078
|
-
value: String(maxHeight),
|
|
8079
|
-
onChange: (value) =>
|
|
8080
|
-
|
|
8158
|
+
value: displayMode === "pip" && maxHeight !== void 0 ? String(maxHeight) : "",
|
|
8159
|
+
onChange: (value) => {
|
|
8160
|
+
if (displayMode === "pip") {
|
|
8161
|
+
mock.setMaxHeight(value ? Number(value) : 480);
|
|
8162
|
+
}
|
|
8163
|
+
},
|
|
8164
|
+
placeholder: displayMode === "pip" ? "480" : "-",
|
|
8165
|
+
disabled: displayMode !== "pip"
|
|
8081
8166
|
}
|
|
8082
8167
|
) })
|
|
8083
8168
|
] }),
|