sunpeak 0.9.10 → 0.10.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/bin/commands/build.mjs +56 -30
- package/bin/commands/deploy.mjs +17 -17
- package/bin/commands/push.mjs +115 -64
- package/bin/lib/patterns.mjs +40 -0
- package/bin/sunpeak.js +50 -106
- package/dist/chatgpt/index.cjs +1 -1
- package/dist/chatgpt/index.js +1 -1
- package/dist/index.cjs +150 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +167 -29
- package/dist/index.js.map +1 -1
- package/dist/lib/discovery.d.ts +76 -13
- package/dist/mcp/entry.cjs +24 -27
- package/dist/mcp/entry.cjs.map +1 -1
- package/dist/mcp/entry.js +25 -28
- package/dist/mcp/entry.js.map +1 -1
- package/dist/{simulator-url-wBi-pko3.js → simulator-url-BZBcq5tc.js} +9 -16
- package/dist/{simulator-url-wBi-pko3.js.map → simulator-url-BZBcq5tc.js.map} +1 -1
- package/dist/{simulator-url-oevkxbU4.cjs → simulator-url-D4tFBjeu.cjs} +10 -17
- package/dist/{simulator-url-oevkxbU4.cjs.map → simulator-url-D4tFBjeu.cjs.map} +1 -1
- package/package.json +1 -1
- package/template/.sunpeak/dev.tsx +5 -5
- package/template/README.md +54 -50
- package/template/dist/{albums.json → albums/albums.json} +1 -1
- package/template/dist/{carousel.json → carousel/carousel.json} +1 -1
- package/template/dist/{map.json → map/map.json} +1 -1
- package/template/dist/{review.json → review/review.json} +1 -1
- 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 +25 -25
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/src/resources/{albums-resource.test.tsx → albums/albums-resource.test.tsx} +1 -1
- package/template/src/resources/{albums-resource.tsx → albums/albums-resource.tsx} +1 -1
- package/template/src/resources/albums/albums-show-simulation.json +131 -0
- package/template/src/{components/album → resources/albums/components}/album-card.tsx +1 -1
- package/template/src/{components/album → resources/albums/components}/album-carousel.tsx +1 -1
- package/template/src/{components/album → resources/albums/components}/film-strip.tsx +1 -1
- package/template/src/{components/album → resources/albums/components}/fullscreen-viewer.tsx +1 -1
- package/template/src/resources/{carousel-resource.test.tsx → carousel/carousel-resource.test.tsx} +1 -1
- package/template/src/resources/{carousel-resource.tsx → carousel/carousel-resource.tsx} +1 -1
- package/template/src/resources/carousel/carousel-show-simulation.json +68 -0
- package/template/src/{components/carousel → resources/carousel/components}/card.tsx +1 -1
- package/template/src/{components/carousel → resources/carousel/components}/carousel.tsx +1 -1
- package/template/src/resources/index.ts +5 -5
- package/template/src/{components/map → resources/map/components}/map-view.tsx +1 -1
- package/template/src/{components/map → resources/map/components}/map.tsx +1 -1
- package/template/src/{components/map → resources/map/components}/place-card.tsx +1 -1
- package/template/src/{components/map → resources/map/components}/place-carousel.tsx +1 -1
- package/template/src/{components/map → resources/map/components}/place-inspector.tsx +1 -1
- package/template/src/{components/map → resources/map/components}/place-list.tsx +1 -1
- package/template/src/resources/{map-resource.test.tsx → map/map-resource.test.tsx} +1 -1
- package/template/src/resources/{map-resource.tsx → map/map-resource.tsx} +1 -1
- package/template/src/resources/map/map-show-simulation.json +123 -0
- package/template/src/resources/review/review-diff-simulation.json +80 -0
- package/template/src/resources/review/review-post-simulation.json +56 -0
- package/template/src/resources/review/review-purchase-simulation.json +88 -0
- package/dist/discovery-a4WId9PC.cjs +0 -125
- package/dist/discovery-a4WId9PC.cjs.map +0 -1
- package/dist/discovery-ft3cd2dW.js +0 -126
- package/dist/discovery-ft3cd2dW.js.map +0 -1
- package/template/src/components/index.ts +0 -3
- package/template/src/simulations/index.ts +0 -16
- /package/template/{src/simulations → dist/albums}/albums-show-simulation.json +0 -0
- /package/template/dist/{albums.js → albums/albums.js} +0 -0
- /package/template/{src/simulations → dist/carousel}/carousel-show-simulation.json +0 -0
- /package/template/dist/{carousel.js → carousel/carousel.js} +0 -0
- /package/template/{src/simulations → dist/map}/map-show-simulation.json +0 -0
- /package/template/dist/{map.js → map/map.js} +0 -0
- /package/template/{src/simulations → dist/review}/review-diff-simulation.json +0 -0
- /package/template/{src/simulations → dist/review}/review-post-simulation.json +0 -0
- /package/template/{src/simulations → dist/review}/review-purchase-simulation.json +0 -0
- /package/template/dist/{review.js → review/review.js} +0 -0
- /package/template/src/resources/{albums-resource.json → albums/albums-resource.json} +0 -0
- /package/template/src/{components/album → resources/albums/components}/album-card.test.tsx +0 -0
- /package/template/src/{components/album → resources/albums/components}/album-carousel.test.tsx +0 -0
- /package/template/src/{components/album → resources/albums/components}/albums.test.tsx +0 -0
- /package/template/src/{components/album → resources/albums/components}/albums.tsx +0 -0
- /package/template/src/{components/album → resources/albums/components}/film-strip.test.tsx +0 -0
- /package/template/src/{components/album → resources/albums/components}/fullscreen-viewer.test.tsx +0 -0
- /package/template/src/{components/album → resources/albums/components}/index.ts +0 -0
- /package/template/src/resources/{carousel-resource.json → carousel/carousel-resource.json} +0 -0
- /package/template/src/{components/carousel → resources/carousel/components}/card.test.tsx +0 -0
- /package/template/src/{components/carousel → resources/carousel/components}/carousel.test.tsx +0 -0
- /package/template/src/{components/carousel → resources/carousel/components}/index.ts +0 -0
- /package/template/src/{components/map → resources/map/components}/index.ts +0 -0
- /package/template/src/{components/map → resources/map/components}/map-view.test.tsx +0 -0
- /package/template/src/{components/map → resources/map/components}/place-card.test.tsx +0 -0
- /package/template/src/{components/map → resources/map/components}/place-carousel.test.tsx +0 -0
- /package/template/src/{components/map → resources/map/components}/place-inspector.test.tsx +0 -0
- /package/template/src/{components/map → resources/map/components}/place-list.test.tsx +0 -0
- /package/template/src/{components/map → resources/map/components}/types.ts +0 -0
- /package/template/src/resources/{map-resource.json → map/map-resource.json} +0 -0
- /package/template/src/resources/{review-resource.json → review/review-resource.json} +0 -0
- /package/template/src/resources/{review-resource.test.tsx → review/review-resource.test.tsx} +0 -0
- /package/template/src/resources/{review-resource.tsx → review/review-resource.tsx} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as clsx } from "./simulator-url-
|
|
2
|
-
import { C, I, S, T, c, v, s, q, i, r, w, t, e, f, g, h, j, u, k, l, m, n, d, b, o, p } from "./simulator-url-
|
|
1
|
+
import { a as clsx } from "./simulator-url-BZBcq5tc.js";
|
|
2
|
+
import { C, I, S, T, c, v, s, q, i, r, w, t, e, f, g, h, j, u, k, l, m, n, d, b, o, p } from "./simulator-url-BZBcq5tc.js";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { i as i2, d as d2, h as h2, c as c2, b as b2, e as e2, a, f as f2, g as g2, t as t2 } from "./discovery-ft3cd2dW.js";
|
|
5
4
|
const MOBILE_BREAKPOINT = 768;
|
|
6
5
|
function useIsMobile() {
|
|
7
6
|
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
@@ -18,11 +17,11 @@ function useIsMobile() {
|
|
|
18
17
|
}
|
|
19
18
|
const concatArrays = (array1, array2) => {
|
|
20
19
|
const combinedArray = new Array(array1.length + array2.length);
|
|
21
|
-
for (let
|
|
22
|
-
combinedArray[
|
|
20
|
+
for (let i2 = 0; i2 < array1.length; i2++) {
|
|
21
|
+
combinedArray[i2] = array1[i2];
|
|
23
22
|
}
|
|
24
|
-
for (let
|
|
25
|
-
combinedArray[array1.length +
|
|
23
|
+
for (let i2 = 0; i2 < array2.length; i2++) {
|
|
24
|
+
combinedArray[array1.length + i2] = array2[i2];
|
|
26
25
|
}
|
|
27
26
|
return combinedArray;
|
|
28
27
|
};
|
|
@@ -88,8 +87,8 @@ const getGroupRecursive = (classParts, startIndex, classPartObject) => {
|
|
|
88
87
|
}
|
|
89
88
|
const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
|
|
90
89
|
const validatorsLength = validators.length;
|
|
91
|
-
for (let
|
|
92
|
-
const validatorObj = validators[
|
|
90
|
+
for (let i2 = 0; i2 < validatorsLength; i2++) {
|
|
91
|
+
const validatorObj = validators[i2];
|
|
93
92
|
if (validatorObj.validator(classRest)) {
|
|
94
93
|
return validatorObj.classGroupId;
|
|
95
94
|
}
|
|
@@ -119,8 +118,8 @@ const processClassGroups = (classGroups, theme) => {
|
|
|
119
118
|
};
|
|
120
119
|
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
|
|
121
120
|
const len = classGroup.length;
|
|
122
|
-
for (let
|
|
123
|
-
const classDefinition = classGroup[
|
|
121
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
122
|
+
const classDefinition = classGroup[i2];
|
|
124
123
|
processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
|
|
125
124
|
}
|
|
126
125
|
};
|
|
@@ -152,8 +151,8 @@ const processFunctionDefinition = (classDefinition, classPartObject, classGroupI
|
|
|
152
151
|
const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
|
|
153
152
|
const entries = Object.entries(classDefinition);
|
|
154
153
|
const len = entries.length;
|
|
155
|
-
for (let
|
|
156
|
-
const [key, value] = entries[
|
|
154
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
155
|
+
const [key, value] = entries[i2];
|
|
157
156
|
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
|
|
158
157
|
}
|
|
159
158
|
};
|
|
@@ -161,8 +160,8 @@ const getPart = (classPartObject, path) => {
|
|
|
161
160
|
let current = classPartObject;
|
|
162
161
|
const parts = path.split(CLASS_PART_SEPARATOR);
|
|
163
162
|
const len = parts.length;
|
|
164
|
-
for (let
|
|
165
|
-
const part = parts[
|
|
163
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
164
|
+
const part = parts[i2];
|
|
166
165
|
let next = current.nextPart.get(part);
|
|
167
166
|
if (!next) {
|
|
168
167
|
next = createClassPartObject();
|
|
@@ -294,8 +293,8 @@ const createSortModifiers = (config) => {
|
|
|
294
293
|
return (modifiers) => {
|
|
295
294
|
const result = [];
|
|
296
295
|
let currentSegment = [];
|
|
297
|
-
for (let
|
|
298
|
-
const modifier = modifiers[
|
|
296
|
+
for (let i2 = 0; i2 < modifiers.length; i2++) {
|
|
297
|
+
const modifier = modifiers[i2];
|
|
299
298
|
const isArbitrary = modifier[0] === "[";
|
|
300
299
|
const isOrderSensitive = modifierWeights.has(modifier);
|
|
301
300
|
if (isArbitrary || isOrderSensitive) {
|
|
@@ -368,8 +367,8 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
368
367
|
}
|
|
369
368
|
classGroupsInConflict.push(classId);
|
|
370
369
|
const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
|
|
371
|
-
for (let
|
|
372
|
-
const group = conflictGroups[
|
|
370
|
+
for (let i2 = 0; i2 < conflictGroups.length; ++i2) {
|
|
371
|
+
const group = conflictGroups[i2];
|
|
373
372
|
classGroupsInConflict.push(modifierId + group);
|
|
374
373
|
}
|
|
375
374
|
result = originalClassName + (result.length > 0 ? " " + result : result);
|
|
@@ -3035,33 +3034,172 @@ function createMediaQueryFn(query) {
|
|
|
3035
3034
|
const prefersReducedMotion = createMediaQueryFn("(prefers-reduced-motion: reduce)");
|
|
3036
3035
|
const isPrimarilyTouchDevice = createMediaQueryFn("(pointer: coarse)");
|
|
3037
3036
|
const isHoverAvailable = createMediaQueryFn("(hover: hover)");
|
|
3037
|
+
function toPascalCase(str) {
|
|
3038
|
+
return str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
3039
|
+
}
|
|
3040
|
+
function extractResourceKey(path) {
|
|
3041
|
+
const match = path.match(/([^/]+)-resource\.(tsx|json)$/);
|
|
3042
|
+
return match == null ? void 0 : match[1];
|
|
3043
|
+
}
|
|
3044
|
+
function extractSimulationKey(path) {
|
|
3045
|
+
const match = path.match(/([^/]+)-simulation\.json$/);
|
|
3046
|
+
return match == null ? void 0 : match[1];
|
|
3047
|
+
}
|
|
3048
|
+
function findResourceKey(simulationKey, resourceKeys) {
|
|
3049
|
+
const sorted = [...resourceKeys].sort((a, b2) => b2.length - a.length);
|
|
3050
|
+
for (const resourceKey of sorted) {
|
|
3051
|
+
if (simulationKey === resourceKey || simulationKey.startsWith(resourceKey + "-")) {
|
|
3052
|
+
return resourceKey;
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
return void 0;
|
|
3056
|
+
}
|
|
3057
|
+
function getComponentName(resourceKey) {
|
|
3058
|
+
return `${toPascalCase(resourceKey)}Resource`;
|
|
3059
|
+
}
|
|
3060
|
+
function createResourceExports(modules) {
|
|
3061
|
+
const resources = {};
|
|
3062
|
+
for (const [path, module] of Object.entries(modules)) {
|
|
3063
|
+
const key = extractResourceKey(path);
|
|
3064
|
+
if (!key) continue;
|
|
3065
|
+
const exportName = getComponentName(key);
|
|
3066
|
+
const mod = module;
|
|
3067
|
+
const component = mod.default ?? mod[exportName];
|
|
3068
|
+
if (component && (typeof component === "function" || typeof component === "object")) {
|
|
3069
|
+
resources[exportName] = component;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
return resources;
|
|
3073
|
+
}
|
|
3074
|
+
function buildResourceMap(modules) {
|
|
3075
|
+
const map = /* @__PURE__ */ new Map();
|
|
3076
|
+
for (const [path, module] of Object.entries(modules)) {
|
|
3077
|
+
const key = extractResourceKey(path);
|
|
3078
|
+
if (key) {
|
|
3079
|
+
map.set(key, module.default);
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
return map;
|
|
3083
|
+
}
|
|
3084
|
+
function buildSimulations(options) {
|
|
3085
|
+
const {
|
|
3086
|
+
simulationModules,
|
|
3087
|
+
resourcesMap,
|
|
3088
|
+
resourceComponents,
|
|
3089
|
+
createSimulation,
|
|
3090
|
+
onMissingResource = (key, prefix) => console.warn(
|
|
3091
|
+
`No matching resource found for simulation "${key}". Expected a resource file like src/resources/${prefix}/${prefix}-resource.json`
|
|
3092
|
+
)
|
|
3093
|
+
} = options;
|
|
3094
|
+
const resourceKeys = Array.from(resourcesMap.keys());
|
|
3095
|
+
const simulations = {};
|
|
3096
|
+
for (const [path, module] of Object.entries(simulationModules)) {
|
|
3097
|
+
const simulationKey = extractSimulationKey(path);
|
|
3098
|
+
if (!simulationKey) continue;
|
|
3099
|
+
const simulationData = module.default;
|
|
3100
|
+
const resourceKey = findResourceKey(simulationKey, resourceKeys);
|
|
3101
|
+
if (!resourceKey) {
|
|
3102
|
+
onMissingResource(simulationKey, simulationKey.split("-")[0]);
|
|
3103
|
+
continue;
|
|
3104
|
+
}
|
|
3105
|
+
const resource = resourcesMap.get(resourceKey);
|
|
3106
|
+
const componentName = getComponentName(resourceKey);
|
|
3107
|
+
const resourceComponent = resourceComponents[componentName];
|
|
3108
|
+
if (!resourceComponent) {
|
|
3109
|
+
console.warn(
|
|
3110
|
+
`Resource component "${componentName}" not found for resource "${resourceKey}". Make sure src/resources/${resourceKey}/${resourceKey}-resource.tsx exists with a default export.`
|
|
3111
|
+
);
|
|
3112
|
+
continue;
|
|
3113
|
+
}
|
|
3114
|
+
simulations[simulationKey] = createSimulation(
|
|
3115
|
+
simulationKey,
|
|
3116
|
+
simulationData,
|
|
3117
|
+
resource,
|
|
3118
|
+
resourceComponent
|
|
3119
|
+
);
|
|
3120
|
+
}
|
|
3121
|
+
return simulations;
|
|
3122
|
+
}
|
|
3123
|
+
function buildDevSimulations(options) {
|
|
3124
|
+
const { simulationModules, resourceModules, resourceComponents } = options;
|
|
3125
|
+
const resourcesMap = buildResourceMap(resourceModules);
|
|
3126
|
+
return buildSimulations({
|
|
3127
|
+
simulationModules,
|
|
3128
|
+
resourcesMap,
|
|
3129
|
+
resourceComponents,
|
|
3130
|
+
createSimulation: (simulationKey, simulationData, resource, resourceComponent) => ({
|
|
3131
|
+
...simulationData,
|
|
3132
|
+
name: simulationKey,
|
|
3133
|
+
resource: {
|
|
3134
|
+
uri: `ui://${resource.name}`,
|
|
3135
|
+
...resource
|
|
3136
|
+
},
|
|
3137
|
+
resourceComponent
|
|
3138
|
+
})
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
function findResourceDirs(baseDir, filePattern, fs) {
|
|
3142
|
+
if (!fs.existsSync(baseDir)) {
|
|
3143
|
+
return [];
|
|
3144
|
+
}
|
|
3145
|
+
const entries = fs.readdirSync(baseDir, { withFileTypes: true });
|
|
3146
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => {
|
|
3147
|
+
const key = entry.name;
|
|
3148
|
+
const dir = `${baseDir}/${key}`;
|
|
3149
|
+
const resourcePath = `${dir}/${filePattern(key)}`;
|
|
3150
|
+
if (!fs.existsSync(resourcePath)) {
|
|
3151
|
+
return null;
|
|
3152
|
+
}
|
|
3153
|
+
return { key, dir, resourcePath };
|
|
3154
|
+
}).filter((info) => info !== null);
|
|
3155
|
+
}
|
|
3156
|
+
function isSimulationFile(filename, resourceKey) {
|
|
3157
|
+
return filename.startsWith(`${resourceKey}-`) && filename.endsWith("-simulation.json");
|
|
3158
|
+
}
|
|
3159
|
+
function extractSimulationName(filename, resourceKey) {
|
|
3160
|
+
return filename.replace(`${resourceKey}-`, "").replace("-simulation.json", "");
|
|
3161
|
+
}
|
|
3162
|
+
function findSimulationFiles(resourceDir, resourceKey, fs) {
|
|
3163
|
+
if (!fs.existsSync(resourceDir)) {
|
|
3164
|
+
return [];
|
|
3165
|
+
}
|
|
3166
|
+
const entries = fs.readdirSync(resourceDir, { withFileTypes: true });
|
|
3167
|
+
return entries.filter((entry) => !entry.isDirectory() && isSimulationFile(entry.name, resourceKey)).map((entry) => ({
|
|
3168
|
+
filename: entry.name,
|
|
3169
|
+
name: extractSimulationName(entry.name, resourceKey),
|
|
3170
|
+
path: `${resourceDir}/${entry.name}`
|
|
3171
|
+
}));
|
|
3172
|
+
}
|
|
3038
3173
|
export {
|
|
3039
3174
|
C as ChatGPTSimulator,
|
|
3040
3175
|
I as IframeResource,
|
|
3041
3176
|
S as SCREEN_WIDTHS,
|
|
3042
3177
|
T as ThemeProvider,
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3178
|
+
buildDevSimulations,
|
|
3179
|
+
buildResourceMap,
|
|
3180
|
+
buildSimulations,
|
|
3046
3181
|
cn,
|
|
3047
|
-
|
|
3048
|
-
b2 as createSimulationIndex,
|
|
3182
|
+
createResourceExports,
|
|
3049
3183
|
c as createSimulatorUrl,
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3184
|
+
extractResourceKey,
|
|
3185
|
+
extractSimulationKey,
|
|
3186
|
+
extractSimulationName,
|
|
3187
|
+
findResourceDirs,
|
|
3188
|
+
findResourceKey,
|
|
3189
|
+
findSimulationFiles,
|
|
3053
3190
|
v as getAPI,
|
|
3054
|
-
|
|
3191
|
+
getComponentName,
|
|
3055
3192
|
s as getGlobal,
|
|
3056
3193
|
q as getProvider,
|
|
3057
3194
|
i as initMockOpenAI,
|
|
3058
3195
|
isHoverAvailable,
|
|
3059
3196
|
isPrimarilyTouchDevice,
|
|
3060
3197
|
r as isProviderAvailable,
|
|
3198
|
+
isSimulationFile,
|
|
3061
3199
|
prefersReducedMotion,
|
|
3062
3200
|
w as resetProviderCache,
|
|
3063
3201
|
t as subscribeToGlobal,
|
|
3064
|
-
|
|
3202
|
+
toPascalCase,
|
|
3065
3203
|
e as useDisplayMode,
|
|
3066
3204
|
useIsMobile,
|
|
3067
3205
|
f as useLocale,
|