sunpeak 0.5.8 → 0.5.9
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 +12 -10
- package/bin/sunpeak.js +3 -3
- package/dist/chatgpt/theme-provider.d.ts +2 -2
- package/dist/index.cjs +5 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -14
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.cjs +80 -106
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.js +80 -106
- package/dist/mcp/index.js.map +1 -1
- package/package.json +2 -1
- package/template/README.md +1 -0
- package/template/dev/main.tsx +6 -10
- package/template/package.json +1 -0
- package/template/scripts/build-all.mjs +19 -10
- package/template/scripts/validate.mjs +6 -0
- package/template/src/components/album/album-card.test.tsx +62 -0
- package/template/src/components/album/album-card.tsx +14 -16
- package/template/src/components/album/albums.test.tsx +88 -0
- package/template/src/components/album/albums.tsx +50 -64
- package/template/src/components/album/film-strip.test.tsx +64 -0
- package/template/src/components/album/film-strip.tsx +16 -16
- package/template/src/components/album/fullscreen-viewer.test.tsx +77 -0
- package/template/src/components/album/fullscreen-viewer.tsx +45 -50
- package/template/src/components/card/card.test.tsx +1 -4
- package/template/src/components/card/card.tsx +38 -46
- package/template/src/components/carousel/carousel.tsx +57 -67
- package/template/src/components/resources/{AlbumsResource.tsx → albums-resource.tsx} +5 -5
- package/template/src/components/resources/{CarouselResource.tsx → carousel-resource.tsx} +18 -18
- package/template/src/components/resources/{CounterResource.tsx → counter-resource.tsx} +11 -31
- package/template/src/components/resources/index.ts +3 -3
- package/template/src/simulations/albums-simulation.ts +71 -71
- package/template/src/simulations/carousel-simulation.ts +34 -34
- package/template/src/simulations/counter-simulation.ts +2 -2
- package/template/vite.config.build.ts +2 -2
- package/template/vite.config.ts +1 -1
- package/template/vitest.config.ts +1 -1
- package/dist/runtime/index.d.ts +0 -7
- /package/dist/{runtime → providers}/provider-detection.d.ts +0 -0
package/README.md
CHANGED
|
@@ -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
|
|
54
|
-
import { Card } from
|
|
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:
|
|
64
|
-
button2={{ children:
|
|
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
|
-
|
|
79
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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 [
|
|
81
|
+
const [, , command, ...args] = process.argv;
|
|
82
82
|
|
|
83
83
|
if (command === 'new') {
|
|
84
84
|
init(args[0]);
|
package/dist/index.cjs
CHANGED
|
@@ -236,15 +236,11 @@ function SidebarSelect({ value, onChange, options, placeholder }) {
|
|
|
236
236
|
break;
|
|
237
237
|
case "ArrowDown":
|
|
238
238
|
event.preventDefault();
|
|
239
|
-
setHighlightedIndex(
|
|
240
|
-
(prev) => prev < options.length - 1 ? prev + 1 : 0
|
|
241
|
-
);
|
|
239
|
+
setHighlightedIndex((prev) => prev < options.length - 1 ? prev + 1 : 0);
|
|
242
240
|
break;
|
|
243
241
|
case "ArrowUp":
|
|
244
242
|
event.preventDefault();
|
|
245
|
-
setHighlightedIndex(
|
|
246
|
-
(prev) => prev > 0 ? prev - 1 : options.length - 1
|
|
247
|
-
);
|
|
243
|
+
setHighlightedIndex((prev) => prev > 0 ? prev - 1 : options.length - 1);
|
|
248
244
|
break;
|
|
249
245
|
case "Enter":
|
|
250
246
|
event.preventDefault();
|
|
@@ -3384,9 +3380,7 @@ function matchMediaQuery(query) {
|
|
|
3384
3380
|
function createMediaQueryFn(query) {
|
|
3385
3381
|
return () => matchMediaQuery(query);
|
|
3386
3382
|
}
|
|
3387
|
-
const prefersReducedMotion = createMediaQueryFn(
|
|
3388
|
-
"(prefers-reduced-motion: reduce)"
|
|
3389
|
-
);
|
|
3383
|
+
const prefersReducedMotion = createMediaQueryFn("(prefers-reduced-motion: reduce)");
|
|
3390
3384
|
const isPrimarilyTouchDevice = createMediaQueryFn("(pointer: coarse)");
|
|
3391
3385
|
const isHoverAvailable = createMediaQueryFn("(hover: hover)");
|
|
3392
3386
|
const SCREEN_WIDTHS = {
|
|
@@ -3615,9 +3609,7 @@ function applyDocumentTheme(theme) {
|
|
|
3615
3609
|
htmlTag.setAttribute("data-theme", theme);
|
|
3616
3610
|
htmlTag.style.colorScheme = theme;
|
|
3617
3611
|
}
|
|
3618
|
-
const ThemeProviderContext = React__namespace.createContext(
|
|
3619
|
-
void 0
|
|
3620
|
-
);
|
|
3612
|
+
const ThemeProviderContext = React__namespace.createContext(void 0);
|
|
3621
3613
|
function ThemeProvider({
|
|
3622
3614
|
children,
|
|
3623
3615
|
defaultTheme = "light",
|
|
@@ -3642,8 +3634,7 @@ function ThemeProvider({
|
|
|
3642
3634
|
}
|
|
3643
3635
|
const useThemeContext = () => {
|
|
3644
3636
|
const context = React__namespace.useContext(ThemeProviderContext);
|
|
3645
|
-
if (context === void 0)
|
|
3646
|
-
throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
3637
|
+
if (context === void 0) throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
3647
3638
|
return context;
|
|
3648
3639
|
};
|
|
3649
3640
|
const DEFAULT_THEME = "dark";
|