sunpeak 0.9.8 → 0.9.10

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const simulatorUrl = require("../simulator-url-BpCa95pE.cjs");
3
+ const simulatorUrl = require("../simulator-url-oevkxbU4.cjs");
4
4
  exports.ChatGPTSimulator = simulatorUrl.ChatGPTSimulator;
5
5
  exports.IframeResource = simulatorUrl.IframeResource;
6
6
  exports.ThemeProvider = simulatorUrl.ThemeProvider;
@@ -1,4 +1,4 @@
1
- import { C, I, T, c, i, u } from "../simulator-url-q5tHLc4-.js";
1
+ import { C, I, T, c, i, u } from "../simulator-url-wBi-pko3.js";
2
2
  export {
3
3
  C as ChatGPTSimulator,
4
4
  I as IframeResource,
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const simulatorUrl = require("./simulator-url-BpCa95pE.cjs");
3
+ const simulatorUrl = require("./simulator-url-oevkxbU4.cjs");
4
4
  const React = require("react");
5
5
  const discovery = require("./discovery-a4WId9PC.cjs");
6
6
  function _interopNamespaceDefault(e) {
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as clsx } from "./simulator-url-q5tHLc4-.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-q5tHLc4-.js";
1
+ import { a as clsx } from "./simulator-url-wBi-pko3.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-wBi-pko3.js";
3
3
  import * as React from "react";
4
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
5
  const MOBILE_BREAKPOINT = 768;
@@ -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-BpCa95pE.cjs", document.baseURI).href } !== "undefined" ? __vite_import_meta_env__ : void 0;
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-oevkxbU4.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.jsx(
7439
+ /* @__PURE__ */ jsxRuntime.jsxs(
7415
7440
  "aside",
7416
7441
  {
7417
7442
  className: `
7418
- w-56 flex flex-col border-r border-subtle bg-sidebar
7419
- md:relative md:z-auto
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
- children: /* @__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: [
7425
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between sticky top-0 bg-sidebar z-10 py-2", children: [
7426
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xs font-semibold", children: "Controls" }),
7427
- /* @__PURE__ */ jsxRuntime.jsx(
7428
- "button",
7429
- {
7430
- onClick: () => setIsDrawerOpen(false),
7431
- className: "md:hidden text-secondary hover:text-primary transition-colors p-1",
7432
- type: "button",
7433
- "aria-label": "Close sidebar",
7434
- children: /* @__PURE__ */ jsxRuntime.jsx(
7435
- "svg",
7436
- {
7437
- width: "16",
7438
- height: "16",
7439
- viewBox: "0 0 16 16",
7440
- fill: "none",
7441
- xmlns: "http://www.w3.org/2000/svg",
7442
- children: /* @__PURE__ */ jsxRuntime.jsx(
7443
- "path",
7444
- {
7445
- d: "M12 4L4 12M4 4L12 12",
7446
- stroke: "currentColor",
7447
- strokeWidth: "2",
7448
- strokeLinecap: "round"
7449
- }
7450
- )
7451
- }
7452
- )
7453
- }
7454
- )
7455
- ] }),
7456
- controls
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
  }
@@ -9167,4 +9202,4 @@ exports.useWidgetAPI = useWidgetAPI;
9167
9202
  exports.useWidgetGlobal = useWidgetGlobal;
9168
9203
  exports.useWidgetProps = useWidgetProps;
9169
9204
  exports.useWidgetState = useWidgetState;
9170
- //# sourceMappingURL=simulator-url-BpCa95pE.cjs.map
9205
+ //# sourceMappingURL=simulator-url-oevkxbU4.cjs.map