sunpeak 0.8.8 → 0.9.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.
- package/bin/sunpeak.js +4 -0
- package/dist/chatgpt/chatgpt-simulator.d.ts +1 -2
- package/dist/chatgpt/index.cjs +9 -0
- package/dist/chatgpt/index.cjs.map +1 -0
- package/dist/chatgpt/index.d.ts +3 -1
- package/dist/chatgpt/index.js +9 -0
- package/dist/chatgpt/index.js.map +1 -0
- package/dist/chatgpt/simulator-url.d.ts +127 -0
- package/dist/index.cjs +39 -8448
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +58 -8466
- package/dist/index.js.map +1 -1
- package/dist/mcp/entry.cjs +2 -1
- package/dist/mcp/entry.cjs.map +1 -1
- package/dist/mcp/entry.js +2 -1
- package/dist/mcp/entry.js.map +1 -1
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/types.d.ts +3 -9
- package/dist/{server-DVmTC-SF.js → server-310A1k9o.js} +2 -2
- package/dist/{server-DVmTC-SF.js.map → server-310A1k9o.js.map} +1 -1
- package/dist/{server-B9YgCQdS.cjs → server-CSybLAYo.cjs} +2 -2
- package/dist/{server-B9YgCQdS.cjs.map → server-CSybLAYo.cjs.map} +1 -1
- package/dist/simulator-url-CG8lAAC3.cjs +8545 -0
- package/dist/simulator-url-CG8lAAC3.cjs.map +1 -0
- package/dist/simulator-url-CexnaL-e.js +8529 -0
- package/dist/simulator-url-CexnaL-e.js.map +1 -0
- package/dist/style.css +5858 -5843
- package/dist/types/simulation.d.ts +6 -32
- package/package.json +7 -3
- package/template/.sunpeak/dev.tsx +12 -7
- package/template/dist/albums.js +1 -1
- package/template/dist/albums.json +1 -1
- package/template/dist/carousel.js +1 -1
- package/template/dist/carousel.json +1 -1
- package/template/dist/map.js +1 -1
- package/template/dist/map.json +1 -1
- package/template/dist/review.js +2 -2
- package/template/dist/review.json +1 -1
- package/template/node_modules/.bin/playwright +21 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js +4 -4
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +6 -6
- package/template/node_modules/.vite/deps/_metadata.json +28 -28
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/package.json +3 -1
- package/template/playwright.config.ts +26 -0
- package/template/src/resources/review-resource.test.tsx +2 -2
- package/template/src/resources/review-resource.tsx +6 -1
- package/template/src/simulations/albums-show-simulation.json +1 -1
- package/template/src/simulations/carousel-show-simulation.json +1 -1
- package/template/src/simulations/map-show-simulation.json +1 -1
- package/template/src/simulations/review-diff-simulation.json +1 -1
- package/template/src/simulations/review-post-simulation.json +1 -1
- package/template/src/simulations/review-purchase-simulation.json +1 -1
- package/template/test-results/.last-run.json +4 -0
- package/template/tests/e2e/albums.spec.ts +120 -0
- package/template/tests/e2e/carousel.spec.ts +127 -0
- package/template/tests/e2e/map.spec.ts +188 -0
- package/template/tests/e2e/review.spec.ts +245 -0
- package/template/vitest.config.ts +1 -0
- package/template/.sunpeak/vite-env.d.ts +0 -1
package/bin/sunpeak.js
CHANGED
|
@@ -192,6 +192,10 @@ async function init(projectName, resourcesArg) {
|
|
|
192
192
|
if (name.startsWith(`${resource}-`) && name.endsWith('-simulation.json')) {
|
|
193
193
|
return false;
|
|
194
194
|
}
|
|
195
|
+
// Skip e2e test files for excluded resources
|
|
196
|
+
if (src.includes('/tests/e2e/') && name === `${resource}.spec.ts`) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
195
199
|
// Skip component directories (map resource name to component dir name)
|
|
196
200
|
const componentDirName = resourceComponentMap[resource];
|
|
197
201
|
if (componentDirName && src.includes('/components/') && name === componentDirName) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Simulation } from '../types/simulation';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
type SimulationWithResource = Simulation & Required<Pick<Simulation, 'resource'>>;
|
|
4
3
|
interface ChatGPTSimulatorProps {
|
|
5
4
|
children?: React.ReactNode;
|
|
6
|
-
simulations?:
|
|
5
|
+
simulations?: Record<string, Simulation>;
|
|
7
6
|
appName?: string;
|
|
8
7
|
appIcon?: string;
|
|
9
8
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const simulatorUrl = require("../simulator-url-CG8lAAC3.cjs");
|
|
4
|
+
exports.ChatGPTSimulator = simulatorUrl.ChatGPTSimulator;
|
|
5
|
+
exports.ThemeProvider = simulatorUrl.ThemeProvider;
|
|
6
|
+
exports.createSimulatorUrl = simulatorUrl.createSimulatorUrl;
|
|
7
|
+
exports.initMockOpenAI = simulatorUrl.initMockOpenAI;
|
|
8
|
+
exports.useThemeContext = simulatorUrl.useThemeContext;
|
|
9
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/dist/chatgpt/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { ChatGPTSimulator } from './chatgpt-simulator';
|
|
2
|
-
export type { Simulation
|
|
2
|
+
export type { Simulation } from '../types/simulation';
|
|
3
3
|
export { initMockOpenAI } from './mock-openai';
|
|
4
4
|
export * from './theme-provider';
|
|
5
|
+
export { createSimulatorUrl } from './simulator-url';
|
|
6
|
+
export type { SimulatorUrlParams } from './simulator-url';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Theme, DisplayMode, DeviceType, ViewMode } from '../types/runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Strongly-typed URL parameters for the ChatGPT Simulator.
|
|
4
|
+
*
|
|
5
|
+
* Use with `createSimulatorUrl()` to generate type-safe URL paths for e2e tests.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createSimulatorUrl } from 'sunpeak/chatgpt';
|
|
10
|
+
*
|
|
11
|
+
* // In e2e tests:
|
|
12
|
+
* await page.goto(createSimulatorUrl({
|
|
13
|
+
* simulation: 'albums-show',
|
|
14
|
+
* theme: 'dark',
|
|
15
|
+
* displayMode: 'fullscreen',
|
|
16
|
+
* }));
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface SimulatorUrlParams {
|
|
20
|
+
/**
|
|
21
|
+
* The simulation name to load (e.g., 'albums-show', 'review-diff').
|
|
22
|
+
* Corresponds to the simulation JSON filename without the '-simulation.json' suffix.
|
|
23
|
+
*/
|
|
24
|
+
simulation?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The color theme for the simulator.
|
|
27
|
+
* @default 'dark'
|
|
28
|
+
*/
|
|
29
|
+
theme?: Theme;
|
|
30
|
+
/**
|
|
31
|
+
* The display mode for the widget.
|
|
32
|
+
* - 'inline': Embedded in the conversation
|
|
33
|
+
* - 'pip': Picture-in-picture mode with max height
|
|
34
|
+
* - 'fullscreen': Full screen overlay
|
|
35
|
+
* @default 'inline'
|
|
36
|
+
*/
|
|
37
|
+
displayMode?: DisplayMode;
|
|
38
|
+
/**
|
|
39
|
+
* The locale for the simulator (e.g., 'en-US', 'ja-JP').
|
|
40
|
+
* @default 'en-US'
|
|
41
|
+
*/
|
|
42
|
+
locale?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum height in pixels for PiP mode.
|
|
45
|
+
* Only applicable when displayMode is 'pip'.
|
|
46
|
+
*/
|
|
47
|
+
maxHeight?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The device type to simulate.
|
|
50
|
+
* Affects default hover/touch capabilities.
|
|
51
|
+
*/
|
|
52
|
+
deviceType?: DeviceType;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the device supports hover interactions.
|
|
55
|
+
* @default true for desktop, false for mobile/tablet
|
|
56
|
+
*/
|
|
57
|
+
hover?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the device supports touch interactions.
|
|
60
|
+
* @default false for desktop, true for mobile/tablet
|
|
61
|
+
*/
|
|
62
|
+
touch?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Safe area inset from the top of the screen (in pixels).
|
|
65
|
+
* Used for devices with notches or status bars.
|
|
66
|
+
*/
|
|
67
|
+
safeAreaTop?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Safe area inset from the bottom of the screen (in pixels).
|
|
70
|
+
* Used for devices with home indicators.
|
|
71
|
+
*/
|
|
72
|
+
safeAreaBottom?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Safe area inset from the left of the screen (in pixels).
|
|
75
|
+
*/
|
|
76
|
+
safeAreaLeft?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Safe area inset from the right of the screen (in pixels).
|
|
79
|
+
*/
|
|
80
|
+
safeAreaRight?: number;
|
|
81
|
+
/**
|
|
82
|
+
* The view mode for the widget.
|
|
83
|
+
* - 'modal': Display as a modal dialog
|
|
84
|
+
* - 'default': Normal display
|
|
85
|
+
*/
|
|
86
|
+
viewMode?: ViewMode;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Creates a URL path with query parameters for the ChatGPT Simulator.
|
|
90
|
+
*
|
|
91
|
+
* @param params - The simulator parameters to encode
|
|
92
|
+
* @param basePath - The base path for the URL (default: '/')
|
|
93
|
+
* @returns A URL path string with encoded query parameters
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* // Basic usage
|
|
98
|
+
* createSimulatorUrl({ simulation: 'albums-show', theme: 'light' })
|
|
99
|
+
* // Returns: '/?simulation=albums-show&theme=light'
|
|
100
|
+
*
|
|
101
|
+
* // With display mode
|
|
102
|
+
* createSimulatorUrl({
|
|
103
|
+
* simulation: 'review-diff',
|
|
104
|
+
* theme: 'dark',
|
|
105
|
+
* displayMode: 'fullscreen',
|
|
106
|
+
* })
|
|
107
|
+
* // Returns: '/?simulation=review-diff&theme=dark&displayMode=fullscreen'
|
|
108
|
+
*
|
|
109
|
+
* // With device simulation
|
|
110
|
+
* createSimulatorUrl({
|
|
111
|
+
* simulation: 'map-show',
|
|
112
|
+
* deviceType: 'mobile',
|
|
113
|
+
* touch: true,
|
|
114
|
+
* hover: false,
|
|
115
|
+
* })
|
|
116
|
+
* // Returns: '/?simulation=map-show&deviceType=mobile&touch=true&hover=false'
|
|
117
|
+
*
|
|
118
|
+
* // With safe area insets (for notch simulation)
|
|
119
|
+
* createSimulatorUrl({
|
|
120
|
+
* simulation: 'carousel-show',
|
|
121
|
+
* safeAreaTop: 44,
|
|
122
|
+
* safeAreaBottom: 34,
|
|
123
|
+
* })
|
|
124
|
+
* // Returns: '/?simulation=carousel-show&safeAreaTop=44&safeAreaBottom=34'
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function createSimulatorUrl(params: SimulatorUrlParams, basePath?: string): string;
|