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.
@@ -7379,9 +7379,34 @@ const Segment = ({ children, ...restProps }) => {
7379
7379
  return jsx(Item2, { className: s.SegmentedControlOption, ...restProps, onPointerEnter: handlePressableMouseEnter, children: jsx("span", { className: "relative", children }) });
7380
7380
  };
7381
7381
  SegmentedControl.Option = Segment;
7382
+ const DEFAULT_SIDEBAR_WIDTH = 224;
7382
7383
  function SimpleSidebar({ children, controls }) {
7383
7384
  const [isDrawerOpen, setIsDrawerOpen] = React.useState(false);
7385
+ const [sidebarWidth, setSidebarWidth] = React.useState(DEFAULT_SIDEBAR_WIDTH);
7386
+ const [isResizing, setIsResizing] = React.useState(false);
7387
+ const handleMouseDown = React.useCallback((e) => {
7388
+ e.preventDefault();
7389
+ setIsResizing(true);
7390
+ }, []);
7391
+ React.useEffect(() => {
7392
+ if (!isResizing) return;
7393
+ const handleMouseMove = (e) => {
7394
+ const maxWidth = Math.floor(window.innerWidth / 3);
7395
+ const newWidth = Math.min(maxWidth, Math.max(DEFAULT_SIDEBAR_WIDTH, e.clientX));
7396
+ setSidebarWidth(newWidth);
7397
+ };
7398
+ const handleMouseUp = () => {
7399
+ setIsResizing(false);
7400
+ };
7401
+ document.addEventListener("mousemove", handleMouseMove);
7402
+ document.addEventListener("mouseup", handleMouseUp);
7403
+ return () => {
7404
+ document.removeEventListener("mousemove", handleMouseMove);
7405
+ document.removeEventListener("mouseup", handleMouseUp);
7406
+ };
7407
+ }, [isResizing]);
7384
7408
  return /* @__PURE__ */ jsxs("div", { className: "sunpeak-simulator-root flex h-screen w-full overflow-hidden relative", children: [
7409
+ isResizing && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 cursor-col-resize" }),
7385
7410
  isDrawerOpen && /* @__PURE__ */ jsx(
7386
7411
  "div",
7387
7412
  {
@@ -7393,50 +7418,60 @@ function SimpleSidebar({ children, controls }) {
7393
7418
  }
7394
7419
  }
7395
7420
  ),
7396
- /* @__PURE__ */ jsx(
7421
+ /* @__PURE__ */ jsxs(
7397
7422
  "aside",
7398
7423
  {
7399
7424
  className: `
7400
- w-56 flex flex-col border-r border-subtle bg-sidebar
7401
- md:relative md:z-auto
7425
+ relative flex flex-col border-r border-subtle bg-sidebar
7426
+ md:z-auto
7402
7427
  max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:z-[100]
7403
- max-md:transition-transform max-md:duration-300
7428
+ max-md:transition-transform max-md:duration-300 max-md:!w-2/3
7404
7429
  ${isDrawerOpen ? "max-md:translate-x-0" : "max-md:-translate-x-full"}
7405
7430
  `,
7406
- children: /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto min-h-0 px-3 pb-3 pt-0", children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: /* @__PURE__ */ jsxs("div", { children: [
7407
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between sticky top-0 bg-sidebar z-10 py-2", children: [
7408
- /* @__PURE__ */ jsx("h2", { className: "text-xs font-semibold", children: "Controls" }),
7409
- /* @__PURE__ */ jsx(
7410
- "button",
7411
- {
7412
- onClick: () => setIsDrawerOpen(false),
7413
- className: "md:hidden text-secondary hover:text-primary transition-colors p-1",
7414
- type: "button",
7415
- "aria-label": "Close sidebar",
7416
- children: /* @__PURE__ */ jsx(
7417
- "svg",
7418
- {
7419
- width: "16",
7420
- height: "16",
7421
- viewBox: "0 0 16 16",
7422
- fill: "none",
7423
- xmlns: "http://www.w3.org/2000/svg",
7424
- children: /* @__PURE__ */ jsx(
7425
- "path",
7426
- {
7427
- d: "M12 4L4 12M4 4L12 12",
7428
- stroke: "currentColor",
7429
- strokeWidth: "2",
7430
- strokeLinecap: "round"
7431
- }
7432
- )
7433
- }
7434
- )
7435
- }
7436
- )
7437
- ] }),
7438
- controls
7439
- ] }) }) })
7431
+ style: { width: sidebarWidth },
7432
+ children: [
7433
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto min-h-0 px-3 pb-3 pt-0", children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: /* @__PURE__ */ jsxs("div", { children: [
7434
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between sticky top-0 bg-sidebar z-10 py-2", children: [
7435
+ /* @__PURE__ */ jsx("h2", { className: "text-xs font-semibold", children: "Controls" }),
7436
+ /* @__PURE__ */ jsx(
7437
+ "button",
7438
+ {
7439
+ onClick: () => setIsDrawerOpen(false),
7440
+ className: "md:hidden text-secondary hover:text-primary transition-colors p-1",
7441
+ type: "button",
7442
+ "aria-label": "Close sidebar",
7443
+ children: /* @__PURE__ */ jsx(
7444
+ "svg",
7445
+ {
7446
+ width: "16",
7447
+ height: "16",
7448
+ viewBox: "0 0 16 16",
7449
+ fill: "none",
7450
+ xmlns: "http://www.w3.org/2000/svg",
7451
+ children: /* @__PURE__ */ jsx(
7452
+ "path",
7453
+ {
7454
+ d: "M12 4L4 12M4 4L12 12",
7455
+ stroke: "currentColor",
7456
+ strokeWidth: "2",
7457
+ strokeLinecap: "round"
7458
+ }
7459
+ )
7460
+ }
7461
+ )
7462
+ }
7463
+ )
7464
+ ] }),
7465
+ controls
7466
+ ] }) }) }),
7467
+ /* @__PURE__ */ jsx(
7468
+ "div",
7469
+ {
7470
+ onMouseDown: handleMouseDown,
7471
+ 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"
7472
+ }
7473
+ )
7474
+ ]
7440
7475
  }
7441
7476
  ),
7442
7477
  /* @__PURE__ */ jsxs("main", { className: "flex-1 overflow-auto relative", children: [
@@ -7546,7 +7581,7 @@ function SidebarTextarea({
7546
7581
  placeholder,
7547
7582
  rows,
7548
7583
  size: "2xs",
7549
- className: "text-[10px] font-mono resize-y",
7584
+ className: "text-[10px] font-mono resize-y [&>textarea]:!h-full [&>textarea]:!max-h-none [&>textarea]:!min-h-0",
7550
7585
  style: { whiteSpace: "pre", overflowX: "auto", overflowWrap: "normal" },
7551
7586
  invalid: !!error
7552
7587
  }
@@ -9151,4 +9186,4 @@ export {
9151
9186
  getAPI as v,
9152
9187
  resetProviderCache as w
9153
9188
  };
9154
- //# sourceMappingURL=simulator-url-q5tHLc4-.js.map
9189
+ //# sourceMappingURL=simulator-url-wBi-pko3.js.map