sunpeak 0.5.8 → 0.5.10

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.
Files changed (43) hide show
  1. package/README.md +13 -11
  2. package/bin/sunpeak.js +3 -3
  3. package/dist/chatgpt/mock-openai.d.ts +7 -0
  4. package/dist/chatgpt/simple-sidebar.d.ts +38 -0
  5. package/dist/chatgpt/theme-provider.d.ts +2 -2
  6. package/dist/index.cjs +7733 -199
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.js +7734 -201
  9. package/dist/index.js.map +1 -1
  10. package/dist/mcp/index.cjs +80 -106
  11. package/dist/mcp/index.cjs.map +1 -1
  12. package/dist/mcp/index.js +80 -106
  13. package/dist/mcp/index.js.map +1 -1
  14. package/dist/style.css +2890 -315
  15. package/package.json +6 -5
  16. package/template/README.md +1 -0
  17. package/template/dev/main.tsx +6 -10
  18. package/template/package.json +5 -4
  19. package/template/scripts/build-all.mjs +19 -10
  20. package/template/scripts/validate.mjs +8 -2
  21. package/template/src/components/album/album-card.test.tsx +62 -0
  22. package/template/src/components/album/album-card.tsx +14 -16
  23. package/template/src/components/album/albums.test.tsx +88 -0
  24. package/template/src/components/album/albums.tsx +50 -64
  25. package/template/src/components/album/film-strip.test.tsx +64 -0
  26. package/template/src/components/album/film-strip.tsx +16 -16
  27. package/template/src/components/album/fullscreen-viewer.test.tsx +77 -0
  28. package/template/src/components/album/fullscreen-viewer.tsx +45 -50
  29. package/template/src/components/card/card.test.tsx +1 -4
  30. package/template/src/components/card/card.tsx +38 -46
  31. package/template/src/components/carousel/carousel.tsx +57 -67
  32. package/template/src/components/resources/{AlbumsResource.tsx → albums-resource.tsx} +5 -5
  33. package/template/src/components/resources/{CarouselResource.tsx → carousel-resource.tsx} +18 -18
  34. package/template/src/components/resources/{CounterResource.tsx → counter-resource.tsx} +11 -31
  35. package/template/src/components/resources/index.ts +3 -3
  36. package/template/src/simulations/albums-simulation.ts +71 -71
  37. package/template/src/simulations/carousel-simulation.ts +34 -34
  38. package/template/src/simulations/counter-simulation.ts +2 -2
  39. package/template/vite.config.build.ts +2 -2
  40. package/template/vite.config.ts +1 -1
  41. package/template/vitest.config.ts +1 -1
  42. package/dist/runtime/index.d.ts +0 -7
  43. /package/dist/{runtime → providers}/provider-detection.d.ts +0 -0
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  [![CI](https://img.shields.io/github/actions/workflow/status/Sunpeak-AI/sunpeak/ci.yml?branch=main&style=flat-square&label=CI)](https://github.com/Sunpeak-AI/sunpeak/actions)
14
14
  [![License](https://img.shields.io/npm/l/sunpeak.svg?style=flat-square)](https://github.com/Sunpeak-AI/sunpeak/blob/main/LICENSE)
15
15
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.6-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
16
- [![React](https://img.shields.io/badge/React-18%20%7C%2019-blue?style=flat-square&logo=react)](https://reactjs.org/)
16
+ [![React](https://img.shields.io/badge/React-19-blue?style=flat-square&logo=react)](https://reactjs.org/)
17
17
 
18
18
  The MCP App SDK.
19
19
 
@@ -29,7 +29,7 @@ Quickstart, build, and test your ChatGPT App locally with OpenAI apps-sdk-ui Rea
29
29
  </a>
30
30
  </div>
31
31
 
32
- ## Quickstart
32
+ ## Quickstart
33
33
 
34
34
  ### New Projects
35
35
 
@@ -42,6 +42,7 @@ pnpm dlx sunpeak new
42
42
  To add sunpeak to an existing project, refer to the [documentation](https://docs.sunpeak.ai/add-to-existing-project).
43
43
 
44
44
  ## Key Features
45
+
45
46
  - 📺 [ChatGPT simulator](https://docs.sunpeak.ai/library/chatgpt-simulator) for local UI component development.
46
47
  - 📚 [Pre-built component library](https://docs.sunpeak.ai/template/ui-components) built on [openai/apps-sdk-ui](https://github.com/openai/apps-sdk-ui).
47
48
  - 📱 [Multi-platform interface](https://docs.sunpeak.ai/library/multi-platform-apis) for portable MCP UI App development.
@@ -49,9 +50,10 @@ To add sunpeak to an existing project, refer to the [documentation](https://docs
49
50
  - 🧪 [Testing framework](https://docs.sunpeak.ai/guides/testing) that replicates advanced ChatGPT behavior locally.
50
51
 
51
52
  ## Example Component
53
+
52
54
  ```tsx
53
- import "./styles/globals.css";
54
- import { Card } from "./components/card";
55
+ import './styles/globals.css';
56
+ import { Card } from './components/card';
55
57
 
56
58
  export default function App() {
57
59
  return (
@@ -60,8 +62,8 @@ export default function App() {
60
62
  imageAlt="Lady Bird Lake"
61
63
  header="Lady Bird Lake"
62
64
  metadata="⭐ 4.5 • Austin, TX"
63
- button1={{ children: "Visit", isPrimary: true, onClick: () => {} }}
64
- button2={{ children: "Learn More", onClick: () => {} }}
65
+ button1={{ children: 'Visit', isPrimary: true, onClick: () => {} }}
66
+ button2={{ children: 'Learn More', onClick: () => {} }}
65
67
  >
66
68
  Scenic lake perfect for kayaking, paddleboarding, and trails.
67
69
  </Card>
@@ -75,12 +77,12 @@ sunpeak is an npm package consisting of:
75
77
 
76
78
  1. **A CLI utility** for working with sunpeak (`./bin`).
77
79
  2. **A templated npm package** (`./template`). This template includes:
78
- 1. Project scaffold - Complete development setup with build, test, and dev tooling.
79
- 2. Pre-built UI components - Production-ready components following ChatGPT design guidelines.
80
+ 1. Project scaffold - Complete development setup with build, test, and dev tooling.
81
+ 2. Pre-built UI components - Production-ready components following ChatGPT design guidelines.
80
82
  3. **The `sunpeak` library** (`./src`). This library contains:
81
- 1. Multi-platform APIs - Abstraction layer for future platform support (Gemini, Claude).
82
- 2. ChatGPT simulator - Local development environment replicating ChatGPT's widget runtime.
83
- 3. MCP server - View local widgets in the real ChatGPT.
83
+ 1. Multi-platform APIs - Abstraction layer for future platform support (Gemini, Claude).
84
+ 2. ChatGPT simulator - Local development environment replicating ChatGPT's widget runtime.
85
+ 3. MCP server - View local widgets in the real ChatGPT.
84
86
 
85
87
  ## Contributing
86
88
 
package/bin/sunpeak.js CHANGED
@@ -21,7 +21,7 @@ async function init(projectName) {
21
21
  if (!projectName) {
22
22
  projectName = await prompt('☀️ 🏔️ Project name [my-app]: ');
23
23
  if (!projectName) {
24
- projectName = 'my-app'
24
+ projectName = 'my-app';
25
25
  }
26
26
  }
27
27
 
@@ -48,7 +48,7 @@ async function init(projectName) {
48
48
  filter: (src) => {
49
49
  const name = basename(src);
50
50
  return name !== 'node_modules' && name !== 'pnpm-lock.yaml';
51
- }
51
+ },
52
52
  });
53
53
 
54
54
  // Read sunpeak version from root package.json
@@ -78,7 +78,7 @@ See README.md for more details.
78
78
  `);
79
79
  }
80
80
 
81
- const [,, command, ...args] = process.argv;
81
+ const [, , command, ...args] = process.argv;
82
82
 
83
83
  if (command === 'new') {
84
84
  init(args[0]);
@@ -40,8 +40,15 @@ declare class MockOpenAI implements OpenAiAPI, OpenAiGlobals {
40
40
  notifyIntrinsicHeight(height: number): void;
41
41
  setWidgetState(state: Record<string, unknown>): Promise<void>;
42
42
  setTheme(theme: Theme): void;
43
+ setUserAgent(userAgent: OpenAiGlobals['userAgent']): void;
44
+ setLocale(locale: string): void;
45
+ setMaxHeight(maxHeight: number): void;
43
46
  setDisplayMode(displayMode: DisplayMode): void;
47
+ setSafeArea(safeArea: OpenAiGlobals['safeArea']): void;
48
+ setView(view: View | null): void;
49
+ setToolInput(toolInput: Record<string, unknown>): void;
44
50
  setToolOutput(toolOutput: Record<string, unknown> | null): void;
51
+ setToolResponseMetadata(toolResponseMetadata: Record<string, unknown> | null): void;
45
52
  setWidgetStateExternal(widgetState: Record<string, unknown> | null): void;
46
53
  emitUpdate(globals: Partial<OpenAiGlobals>): void;
47
54
  }
@@ -9,6 +9,12 @@ interface SidebarControlProps {
9
9
  children: React.ReactNode;
10
10
  }
11
11
  export declare function SidebarControl({ label, children }: SidebarControlProps): import("react/jsx-runtime").JSX.Element;
12
+ interface SidebarCollapsibleControlProps {
13
+ label: string;
14
+ children: React.ReactNode;
15
+ defaultCollapsed?: boolean;
16
+ }
17
+ export declare function SidebarCollapsibleControl({ label, children, defaultCollapsed, }: SidebarCollapsibleControlProps): import("react/jsx-runtime").JSX.Element;
12
18
  interface SidebarSelectProps {
13
19
  value: string;
14
20
  onChange: (value: string) => void;
@@ -19,4 +25,36 @@ interface SidebarSelectProps {
19
25
  placeholder?: string;
20
26
  }
21
27
  export declare function SidebarSelect({ value, onChange, options, placeholder }: SidebarSelectProps): import("react/jsx-runtime").JSX.Element;
28
+ interface SidebarInputProps {
29
+ value: string;
30
+ onChange: (value: string) => void;
31
+ placeholder?: string;
32
+ type?: 'text' | 'number';
33
+ }
34
+ export declare function SidebarInput({ value, onChange, placeholder, type }: SidebarInputProps): import("react/jsx-runtime").JSX.Element;
35
+ interface SidebarCheckboxProps {
36
+ checked: boolean;
37
+ onChange: (checked: boolean) => void;
38
+ label: string;
39
+ }
40
+ export declare function SidebarCheckbox({ checked, onChange, label }: SidebarCheckboxProps): import("react/jsx-runtime").JSX.Element;
41
+ interface SidebarTextareaProps {
42
+ value: string;
43
+ onChange: (value: string) => void;
44
+ onFocus?: () => void;
45
+ onBlur?: () => void;
46
+ placeholder?: string;
47
+ rows?: number;
48
+ error?: string;
49
+ }
50
+ export declare function SidebarTextarea({ value, onChange, onFocus, onBlur, placeholder, rows, error, }: SidebarTextareaProps): import("react/jsx-runtime").JSX.Element;
51
+ interface SidebarToggleProps {
52
+ value: string;
53
+ onChange: (value: string) => void;
54
+ options: Array<{
55
+ value: string;
56
+ label: string;
57
+ }>;
58
+ }
59
+ export declare function SidebarToggle({ value, onChange, options }: SidebarToggleProps): import("react/jsx-runtime").JSX.Element;
22
60
  export {};
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- type Theme = "light" | "dark";
1
+ import * as React from 'react';
2
+ type Theme = 'light' | 'dark';
3
3
  type ThemeProviderProps = {
4
4
  children: React.ReactNode;
5
5
  defaultTheme?: Theme;