sunpeak 0.3.8 → 0.4.2

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 (32) hide show
  1. package/README.md +5 -5
  2. package/dist/chatgpt/chatgpt-simulator.d.ts +13 -3
  3. package/dist/chatgpt/index.d.ts +1 -0
  4. package/dist/index.cjs +24 -6
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +24 -6
  7. package/dist/index.js.map +1 -1
  8. package/dist/style.css +179 -7
  9. package/package.json +1 -1
  10. package/template/data/albums.json +112 -0
  11. package/template/data/places.json +49 -0
  12. package/template/dev/main.tsx +4 -59
  13. package/template/index.html +1 -1
  14. package/template/mcp/server.ts +4 -50
  15. package/template/src/App.tsx +87 -39
  16. package/template/src/components/album/album-card.tsx +45 -0
  17. package/template/src/components/album/albums.tsx +77 -0
  18. package/template/src/components/album/film-strip.tsx +50 -0
  19. package/template/src/components/album/fullscreen-viewer.tsx +60 -0
  20. package/template/src/components/album/index.ts +4 -0
  21. package/template/src/components/{openai-card.test.tsx → card/card.test.tsx} +12 -12
  22. package/template/src/components/{openai-card.tsx → card/card.tsx} +8 -8
  23. package/template/src/components/card/index.ts +1 -0
  24. package/template/src/components/{openai-carousel.test.tsx → carousel/carousel.test.tsx} +10 -10
  25. package/template/src/components/{openai-carousel.tsx → carousel/carousel.tsx} +7 -7
  26. package/template/src/components/carousel/index.ts +1 -0
  27. package/template/src/components/index.ts +4 -2
  28. package/template/src/components/simulations/albums-simulation.tsx +20 -0
  29. package/template/src/components/simulations/app-simulation.tsx +13 -0
  30. package/template/src/components/simulations/carousel-simulation.tsx +63 -0
  31. package/template/src/components/simulations/index.tsx +14 -0
  32. package/template/src/styles/globals.css +2 -0
@@ -0,0 +1,20 @@
1
+ import * as React from "react"
2
+ import type { Simulation } from "sunpeak"
3
+ import { OpenAIAlbums } from ".."
4
+ import albumsData from "../../../data/albums.json"
5
+
6
+ const AlbumsComponent = React.forwardRef<HTMLDivElement>((_props, ref) => {
7
+ return <OpenAIAlbums ref={ref} />
8
+ })
9
+ AlbumsComponent.displayName = "AlbumsComponent"
10
+
11
+ export const albumsSimulation: Simulation = {
12
+ value: 'albums',
13
+ label: 'Albums',
14
+ component: AlbumsComponent,
15
+ appName: 'Pizzaz',
16
+ appIcon: '🍕',
17
+ userMessage: 'Pizza time',
18
+ toolOutput: albumsData,
19
+ widgetState: null,
20
+ }
@@ -0,0 +1,13 @@
1
+ import type { Simulation } from "sunpeak"
2
+ import { App } from "../../App"
3
+
4
+ export const appSimulation: Simulation = {
5
+ value: 'app',
6
+ label: 'My App',
7
+ component: App,
8
+ appName: 'sunpeak',
9
+ appIcon: '🏗️',
10
+ userMessage: 'What do you have for me today?',
11
+ toolOutput: null,
12
+ widgetState: null,
13
+ }
@@ -0,0 +1,63 @@
1
+ import * as React from "react"
2
+ import type { Simulation } from "sunpeak"
3
+ import { useWidgetProps } from "sunpeak"
4
+ import { Carousel, Card } from ".."
5
+ import placesData from "../../../data/places.json"
6
+
7
+ export interface Place {
8
+ id: string
9
+ name: string
10
+ rating: number
11
+ category: string
12
+ location: string
13
+ image: string
14
+ description: string
15
+ }
16
+
17
+ export interface CarouselSimulationData extends Record<string, unknown> {
18
+ places: Place[]
19
+ }
20
+
21
+ const CarouselComponent = React.forwardRef<HTMLDivElement>((_props, ref) => {
22
+ const data = useWidgetProps<CarouselSimulationData>(() => ({ places: [] }))
23
+
24
+ return (
25
+ <div ref={ref}>
26
+ <Carousel gap={16} showArrows={true} showEdgeGradients={true} cardWidth={220}>
27
+ {(data.places || []).map((place) => (
28
+ <Card
29
+ key={place.id}
30
+ image={place.image}
31
+ imageAlt={place.name}
32
+ header={place.name}
33
+ metadata={`⭐ ${place.rating} • ${place.category} • ${place.location}`}
34
+ button1={{
35
+ isPrimary: true,
36
+ onClick: () => console.log(`Visit ${place.name}`),
37
+ children: "Visit",
38
+ }}
39
+ button2={{
40
+ isPrimary: false,
41
+ onClick: () => console.log(`Learn more about ${place.name}`),
42
+ children: "Learn More",
43
+ }}
44
+ >
45
+ {place.description}
46
+ </Card>
47
+ ))}
48
+ </Carousel>
49
+ </div>
50
+ )
51
+ })
52
+ CarouselComponent.displayName = "CarouselComponent"
53
+
54
+ export const carouselSimulation: Simulation = {
55
+ value: 'carousel',
56
+ label: 'Carousel',
57
+ component: CarouselComponent,
58
+ appName: 'Splorin',
59
+ appIcon: '✈️',
60
+ userMessage: 'Show me popular places to visit in Austin Texas',
61
+ toolOutput: placesData,
62
+ widgetState: null,
63
+ }
@@ -0,0 +1,14 @@
1
+ export * from "./app-simulation"
2
+ export * from "./carousel-simulation"
3
+ export * from "./albums-simulation"
4
+
5
+ // Export all simulations as an array for convenience
6
+ import { appSimulation } from "./app-simulation"
7
+ import { carouselSimulation } from "./carousel-simulation"
8
+ import { albumsSimulation } from "./albums-simulation"
9
+
10
+ export const simulations = [
11
+ appSimulation,
12
+ carouselSimulation,
13
+ albumsSimulation,
14
+ ]
@@ -6,3 +6,5 @@
6
6
 
7
7
  /* Configure dark mode to use data-theme attribute (OpenAI SDK standard) */
8
8
  @custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
9
+
10
+ @import 'sunpeak/style.css';