sunpeak 0.3.7 → 0.4.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 +28 -36
- package/dist/chatgpt/chatgpt-simulator.d.ts +13 -3
- package/dist/chatgpt/index.d.ts +1 -0
- package/dist/index.cjs +24 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/dist/style.css +179 -7
- package/package.json +1 -1
- package/template/README.md +2 -14
- package/template/data/albums.json +112 -0
- package/template/data/places.json +49 -0
- package/template/dev/main.tsx +2 -59
- package/template/index.html +1 -1
- package/template/mcp/server.ts +4 -50
- package/template/src/App.tsx +86 -37
- package/template/src/components/album/album-card.tsx +45 -0
- package/template/src/components/album/albums.tsx +77 -0
- package/template/src/components/album/film-strip.tsx +50 -0
- package/template/src/components/album/fullscreen-viewer.tsx +60 -0
- package/template/src/components/album/index.ts +4 -0
- package/template/src/components/{openai-card.test.tsx → card/card.test.tsx} +12 -12
- package/template/src/components/{openai-card.tsx → card/card.tsx} +8 -8
- package/template/src/components/card/index.ts +1 -0
- package/template/src/components/{openai-carousel.test.tsx → carousel/carousel.test.tsx} +10 -10
- package/template/src/components/{openai-carousel.tsx → carousel/carousel.tsx} +7 -7
- package/template/src/components/carousel/index.ts +1 -0
- package/template/src/components/index.ts +4 -2
- package/template/src/components/simulations/albums-simulation.tsx +20 -0
- package/template/src/components/simulations/app-simulation.tsx +13 -0
- package/template/src/components/simulations/carousel-simulation.tsx +63 -0
- package/template/src/components/simulations/index.tsx +14 -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
|
+
]
|