sunpeak 0.9.8 → 0.9.12
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/dist/chatgpt/index.cjs +1 -1
- package/dist/chatgpt/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{simulator-url-q5tHLc4-.js → simulator-url-BZBcq5tc.js} +83 -55
- package/dist/{simulator-url-q5tHLc4-.js.map → simulator-url-BZBcq5tc.js.map} +1 -1
- package/dist/{simulator-url-BpCa95pE.cjs → simulator-url-D4tFBjeu.cjs} +84 -56
- package/dist/{simulator-url-BpCa95pE.cjs.map → simulator-url-D4tFBjeu.cjs.map} +1 -1
- package/dist/style.css +28 -4
- package/package.json +1 -1
- 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 +1 -1
- package/template/dist/review.json +1 -1
- package/template/node_modules/.vite/deps/_metadata.json +19 -19
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
|
@@ -5653,7 +5653,7 @@ const useEscCloseStack = (listening, cb) => {
|
|
|
5653
5653
|
}, [id, listening, latestCallback]);
|
|
5654
5654
|
};
|
|
5655
5655
|
const __vite_import_meta_env__ = { "DEV": false, "MODE": "production" };
|
|
5656
|
-
const META_ENV = typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("simulator-url-
|
|
5656
|
+
const META_ENV = typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("simulator-url-D4tFBjeu.cjs", document.baseURI).href } !== "undefined" ? __vite_import_meta_env__ : void 0;
|
|
5657
5657
|
const NODE_ENV = typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) ? (_b = process.env) == null ? void 0 : _b.NODE_ENV : "production";
|
|
5658
5658
|
const isDev = NODE_ENV === "development" || !!(META_ENV == null ? void 0 : META_ENV.DEV);
|
|
5659
5659
|
const isJSDomLike = typeof navigator !== "undefined" && /(jsdom|happy-dom)/i.test(navigator.userAgent) || typeof globalThis.happyDOM === "object";
|
|
@@ -7397,9 +7397,34 @@ const Segment = ({ children, ...restProps }) => {
|
|
|
7397
7397
|
return jsxRuntime.jsx(Item2, { className: s.SegmentedControlOption, ...restProps, onPointerEnter: handlePressableMouseEnter, children: jsxRuntime.jsx("span", { className: "relative", children }) });
|
|
7398
7398
|
};
|
|
7399
7399
|
SegmentedControl.Option = Segment;
|
|
7400
|
+
const DEFAULT_SIDEBAR_WIDTH = 224;
|
|
7400
7401
|
function SimpleSidebar({ children, controls }) {
|
|
7401
7402
|
const [isDrawerOpen, setIsDrawerOpen] = React__namespace.useState(false);
|
|
7403
|
+
const [sidebarWidth, setSidebarWidth] = React__namespace.useState(DEFAULT_SIDEBAR_WIDTH);
|
|
7404
|
+
const [isResizing, setIsResizing] = React__namespace.useState(false);
|
|
7405
|
+
const handleMouseDown = React__namespace.useCallback((e) => {
|
|
7406
|
+
e.preventDefault();
|
|
7407
|
+
setIsResizing(true);
|
|
7408
|
+
}, []);
|
|
7409
|
+
React__namespace.useEffect(() => {
|
|
7410
|
+
if (!isResizing) return;
|
|
7411
|
+
const handleMouseMove = (e) => {
|
|
7412
|
+
const maxWidth = Math.floor(window.innerWidth / 3);
|
|
7413
|
+
const newWidth = Math.min(maxWidth, Math.max(DEFAULT_SIDEBAR_WIDTH, e.clientX));
|
|
7414
|
+
setSidebarWidth(newWidth);
|
|
7415
|
+
};
|
|
7416
|
+
const handleMouseUp = () => {
|
|
7417
|
+
setIsResizing(false);
|
|
7418
|
+
};
|
|
7419
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
7420
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
7421
|
+
return () => {
|
|
7422
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
7423
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
7424
|
+
};
|
|
7425
|
+
}, [isResizing]);
|
|
7402
7426
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sunpeak-simulator-root flex h-screen w-full overflow-hidden relative", children: [
|
|
7427
|
+
isResizing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed inset-0 z-50 cursor-col-resize" }),
|
|
7403
7428
|
isDrawerOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7404
7429
|
"div",
|
|
7405
7430
|
{
|
|
@@ -7411,50 +7436,60 @@ function SimpleSidebar({ children, controls }) {
|
|
|
7411
7436
|
}
|
|
7412
7437
|
}
|
|
7413
7438
|
),
|
|
7414
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7439
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7415
7440
|
"aside",
|
|
7416
7441
|
{
|
|
7417
7442
|
className: `
|
|
7418
|
-
|
|
7419
|
-
md:
|
|
7443
|
+
relative flex flex-col border-r border-subtle bg-sidebar
|
|
7444
|
+
md:z-auto
|
|
7420
7445
|
max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:z-[100]
|
|
7421
|
-
max-md:transition-transform max-md:duration-300
|
|
7446
|
+
max-md:transition-transform max-md:duration-300 max-md:!w-2/3
|
|
7422
7447
|
${isDrawerOpen ? "max-md:translate-x-0" : "max-md:-translate-x-full"}
|
|
7423
7448
|
`,
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7428
|
-
"
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
"
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
"
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7449
|
+
style: { width: sidebarWidth },
|
|
7450
|
+
children: [
|
|
7451
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto min-h-0 px-3 pb-3 pt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7452
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between sticky top-0 bg-sidebar z-10 py-2", children: [
|
|
7453
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xs font-semibold", children: "Controls" }),
|
|
7454
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7455
|
+
"button",
|
|
7456
|
+
{
|
|
7457
|
+
onClick: () => setIsDrawerOpen(false),
|
|
7458
|
+
className: "md:hidden text-secondary hover:text-primary transition-colors p-1",
|
|
7459
|
+
type: "button",
|
|
7460
|
+
"aria-label": "Close sidebar",
|
|
7461
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7462
|
+
"svg",
|
|
7463
|
+
{
|
|
7464
|
+
width: "16",
|
|
7465
|
+
height: "16",
|
|
7466
|
+
viewBox: "0 0 16 16",
|
|
7467
|
+
fill: "none",
|
|
7468
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7469
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7470
|
+
"path",
|
|
7471
|
+
{
|
|
7472
|
+
d: "M12 4L4 12M4 4L12 12",
|
|
7473
|
+
stroke: "currentColor",
|
|
7474
|
+
strokeWidth: "2",
|
|
7475
|
+
strokeLinecap: "round"
|
|
7476
|
+
}
|
|
7477
|
+
)
|
|
7478
|
+
}
|
|
7479
|
+
)
|
|
7480
|
+
}
|
|
7481
|
+
)
|
|
7482
|
+
] }),
|
|
7483
|
+
controls
|
|
7484
|
+
] }) }) }),
|
|
7485
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7486
|
+
"div",
|
|
7487
|
+
{
|
|
7488
|
+
onMouseDown: handleMouseDown,
|
|
7489
|
+
className: "hidden md:block absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-primary/20 active:bg-primary/30 transition-colors"
|
|
7490
|
+
}
|
|
7491
|
+
)
|
|
7492
|
+
]
|
|
7458
7493
|
}
|
|
7459
7494
|
),
|
|
7460
7495
|
/* @__PURE__ */ jsxRuntime.jsxs("main", { className: "flex-1 overflow-auto relative", children: [
|
|
@@ -7564,7 +7599,7 @@ function SidebarTextarea({
|
|
|
7564
7599
|
placeholder,
|
|
7565
7600
|
rows,
|
|
7566
7601
|
size: "2xs",
|
|
7567
|
-
className: "text-[10px] font-mono resize-y",
|
|
7602
|
+
className: "text-[10px] font-mono resize-y [&>textarea]:!h-full [&>textarea]:!max-h-none [&>textarea]:!min-h-0",
|
|
7568
7603
|
style: { whiteSpace: "pre", overflowX: "auto", overflowWrap: "normal" },
|
|
7569
7604
|
invalid: !!error
|
|
7570
7605
|
}
|
|
@@ -7592,14 +7627,14 @@ const SCREEN_WIDTHS = {
|
|
|
7592
7627
|
full: 1024
|
|
7593
7628
|
};
|
|
7594
7629
|
const ALLOWED_SCRIPT_ORIGINS = [
|
|
7595
|
-
"https://
|
|
7630
|
+
"https://sunpeak-prod-app-storage.s3.us-east-2.amazonaws.com",
|
|
7596
7631
|
"http://localhost",
|
|
7597
7632
|
"https://localhost",
|
|
7598
7633
|
"http://127.0.0.1",
|
|
7599
7634
|
"https://127.0.0.1"
|
|
7600
7635
|
];
|
|
7601
7636
|
const ALLOWED_PARENT_ORIGINS = [
|
|
7602
|
-
"https://
|
|
7637
|
+
"https://sandbox.sunpeakai.com",
|
|
7603
7638
|
"http://localhost",
|
|
7604
7639
|
"https://localhost",
|
|
7605
7640
|
"http://127.0.0.1",
|
|
@@ -8132,31 +8167,24 @@ function IframeResource({ scriptSrc, className, style, csp }) {
|
|
|
8132
8167
|
sendUpdate("openai:update");
|
|
8133
8168
|
}, [sendUpdate]);
|
|
8134
8169
|
const isValidScriptSrc = React.useMemo(() => isAllowedScriptSrc(scriptSrc), [scriptSrc]);
|
|
8135
|
-
const
|
|
8170
|
+
const htmlContent = React.useMemo(() => {
|
|
8136
8171
|
if (!isValidScriptSrc) {
|
|
8137
8172
|
console.error("[IframeResource] Script source not allowed:", scriptSrc);
|
|
8138
|
-
|
|
8139
|
-
const blob2 = new Blob([errorHtml], { type: "text/html" });
|
|
8140
|
-
return URL.createObjectURL(blob2);
|
|
8173
|
+
return `<!DOCTYPE html><html><body><h1>Error</h1><p>Script source not allowed.</p></body></html>`;
|
|
8141
8174
|
}
|
|
8142
8175
|
const absoluteScriptSrc = scriptSrc.startsWith("/") ? `${window.location.origin}${scriptSrc}` : scriptSrc;
|
|
8143
8176
|
const cspPolicy = generateCSP(csp, absoluteScriptSrc);
|
|
8144
8177
|
const bridgeScript = generateBridgeScript(ALLOWED_PARENT_ORIGINS);
|
|
8145
|
-
|
|
8178
|
+
return injectBridgeScript(
|
|
8146
8179
|
generateScriptHtml(absoluteScriptSrc, theme ?? "dark", cspPolicy),
|
|
8147
8180
|
bridgeScript
|
|
8148
8181
|
);
|
|
8149
|
-
const blob = new Blob([html], { type: "text/html" });
|
|
8150
|
-
return URL.createObjectURL(blob);
|
|
8151
8182
|
}, [scriptSrc, theme, isValidScriptSrc, csp]);
|
|
8152
|
-
React.useEffect(() => {
|
|
8153
|
-
return () => URL.revokeObjectURL(blobUrl);
|
|
8154
|
-
}, [blobUrl]);
|
|
8155
8183
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8156
8184
|
"iframe",
|
|
8157
8185
|
{
|
|
8158
8186
|
ref: iframeRef,
|
|
8159
|
-
|
|
8187
|
+
srcDoc: htmlContent,
|
|
8160
8188
|
className,
|
|
8161
8189
|
style: {
|
|
8162
8190
|
border: "none",
|
|
@@ -8168,8 +8196,8 @@ function IframeResource({ scriptSrc, className, style, csp }) {
|
|
|
8168
8196
|
...style
|
|
8169
8197
|
},
|
|
8170
8198
|
title: "Resource Preview",
|
|
8171
|
-
sandbox: "allow-scripts",
|
|
8172
|
-
allow: "accelerometer 'none'; autoplay 'none'; camera 'none'; display-capture 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none';
|
|
8199
|
+
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox",
|
|
8200
|
+
allow: "local-network-access *; microphone *; midi *; accelerometer 'none'; autoplay 'none'; camera 'none'; display-capture 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; payment 'none'; publickey-credentials-get 'none'; usb 'none'; xr-spatial-tracking 'none'"
|
|
8173
8201
|
}
|
|
8174
8202
|
);
|
|
8175
8203
|
}
|
|
@@ -9167,4 +9195,4 @@ exports.useWidgetAPI = useWidgetAPI;
|
|
|
9167
9195
|
exports.useWidgetGlobal = useWidgetGlobal;
|
|
9168
9196
|
exports.useWidgetProps = useWidgetProps;
|
|
9169
9197
|
exports.useWidgetState = useWidgetState;
|
|
9170
|
-
//# sourceMappingURL=simulator-url-
|
|
9198
|
+
//# sourceMappingURL=simulator-url-D4tFBjeu.cjs.map
|