sunpeak 0.5.41 → 0.6.4

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.
Files changed (45) hide show
  1. package/README.md +1 -0
  2. package/bin/commands/build.mjs +4 -4
  3. package/bin/sunpeak.js +129 -6
  4. package/dist/chatgpt/conversation.d.ts +2 -1
  5. package/dist/chatgpt/globals.css +7 -0
  6. package/dist/index.cjs +99 -12
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.js +99 -12
  9. package/dist/index.js.map +1 -1
  10. package/dist/mcp/entry.cjs +2 -2
  11. package/dist/mcp/entry.cjs.map +1 -1
  12. package/dist/mcp/entry.js +2 -2
  13. package/dist/mcp/entry.js.map +1 -1
  14. package/dist/mcp/index.cjs +1 -1
  15. package/dist/mcp/index.js +1 -1
  16. package/dist/{server-DpriZ4jT.cjs → server-CQGbJWbk.cjs} +17 -8
  17. package/dist/{server-DpriZ4jT.cjs.map → server-CQGbJWbk.cjs.map} +1 -1
  18. package/dist/{server-SBlanUcf.js → server-DGCvp1RA.js} +17 -8
  19. package/dist/{server-SBlanUcf.js.map → server-DGCvp1RA.js.map} +1 -1
  20. package/dist/style.css +101 -11
  21. package/package.json +1 -1
  22. package/template/.sunpeak/dev.tsx +3 -3
  23. package/template/README.md +3 -3
  24. package/template/dist/chatgpt/albums.js +2 -2
  25. package/template/dist/chatgpt/carousel.js +1 -1
  26. package/template/dist/chatgpt/counter.js +1 -1
  27. package/template/node_modules/.vite/deps/_metadata.json +17 -17
  28. package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  29. package/template/src/components/album/album-carousel.test.tsx +84 -0
  30. package/template/src/components/album/album-carousel.tsx +168 -0
  31. package/template/src/components/album/albums.test.tsx +2 -2
  32. package/template/src/components/album/albums.tsx +3 -3
  33. package/template/src/components/album/index.ts +1 -0
  34. package/template/src/components/carousel/index.ts +1 -0
  35. package/template/src/components/index.ts +0 -2
  36. package/template/src/{components/resources → resources}/albums-resource.test.tsx +1 -1
  37. package/template/src/{components/resources → resources}/albums-resource.tsx +1 -1
  38. package/template/src/{components/resources → resources}/carousel-resource.test.tsx +1 -4
  39. package/template/src/{components/resources → resources}/carousel-resource.tsx +1 -2
  40. package/template/src/components/card/index.ts +0 -1
  41. /package/template/src/components/{card → carousel}/card.test.tsx +0 -0
  42. /package/template/src/components/{card → carousel}/card.tsx +0 -0
  43. /package/template/src/{components/resources → resources}/counter-resource.test.tsx +0 -0
  44. /package/template/src/{components/resources → resources}/counter-resource.tsx +0 -0
  45. /package/template/src/{components/resources → resources}/index.ts +0 -0
package/dist/index.js CHANGED
@@ -5687,6 +5687,7 @@ const preventDefaultHandler = (evt) => {
5687
5687
  };
5688
5688
  const Check = (props) => jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: jsx("path", { fillRule: "evenodd", d: "M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z", clipRule: "evenodd" }) });
5689
5689
  const ChevronDownVector = (props) => jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 16 9", fill: "currentColor", ...props, children: jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z" }) });
5690
+ const ChevronRight = (props) => jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: jsx("path", { fillRule: "evenodd", d: "M8.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L14.586 12 8.293 5.707a1 1 0 0 1 0-1.414Z", clipRule: "evenodd" }) });
5690
5691
  const CloseBold = (props) => jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.83071 5.83077C6.33839 5.32309 7.16151 5.32309 7.66919 5.83077L12 10.1615L16.3307 5.83077C16.8384 5.32309 17.6615 5.32309 18.1692 5.83077C18.6769 6.33845 18.6769 7.16157 18.1692 7.66925L13.8384 12L18.1692 16.3308C18.6769 16.8385 18.6769 17.6616 18.1692 18.1693C17.6615 18.6769 16.8384 18.6769 16.3307 18.1693L12 13.8385L7.66919 18.1693C7.16151 18.6769 6.33839 18.6769 5.83071 18.1693C5.32303 17.6616 5.32303 16.8385 5.83071 16.3308L10.1615 12L5.83071 7.66925C5.32303 7.16157 5.32303 6.33845 5.83071 5.83077Z", fill: "currentColor" }) });
5691
5692
  const DropdownVector = (props) => jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 10 16", fill: "currentColor", ...props, children: jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z" }) });
5692
5693
  const Info = (props) => jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: [jsx("path", { d: "M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z" }), jsx("path", { fillRule: "evenodd", d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z", clipRule: "evenodd" })] });
@@ -7359,12 +7360,78 @@ const Segment = ({ children, ...restProps }) => {
7359
7360
  };
7360
7361
  SegmentedControl.Option = Segment;
7361
7362
  function SimpleSidebar({ children, controls }) {
7362
- return /* @__PURE__ */ jsxs("div", { className: "flex h-screen w-full overflow-hidden", children: [
7363
- /* @__PURE__ */ jsx("aside", { className: "max-md:hidden md:flex w-56 flex-col border-r border-subtle bg-sidebar overflow-hidden", 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: [
7364
- /* @__PURE__ */ jsx("h2", { className: "text-xs font-semibold sticky top-0 bg-sidebar z-10 py-2", children: "Controls" }),
7365
- controls
7366
- ] }) }) }) }),
7367
- /* @__PURE__ */ jsx("main", { className: "flex-1 overflow-auto", children })
7363
+ const [isDrawerOpen, setIsDrawerOpen] = React.useState(false);
7364
+ return /* @__PURE__ */ jsxs("div", { className: "sunpeak-simulator-root flex h-screen w-full overflow-hidden relative", children: [
7365
+ isDrawerOpen && /* @__PURE__ */ jsx(
7366
+ "div",
7367
+ {
7368
+ className: "md:hidden fixed inset-0 bg-black/50 z-40 pointer-events-auto",
7369
+ onClick: (e) => {
7370
+ if (e.target === e.currentTarget) {
7371
+ setIsDrawerOpen(false);
7372
+ }
7373
+ }
7374
+ }
7375
+ ),
7376
+ /* @__PURE__ */ jsx(
7377
+ "aside",
7378
+ {
7379
+ className: `
7380
+ w-56 flex flex-col border-r border-subtle bg-sidebar
7381
+ md:relative md:z-auto
7382
+ max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:z-[100]
7383
+ max-md:transition-transform max-md:duration-300
7384
+ ${isDrawerOpen ? "max-md:translate-x-0" : "max-md:-translate-x-full"}
7385
+ `,
7386
+ 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: [
7387
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between sticky top-0 bg-sidebar z-10 py-2", children: [
7388
+ /* @__PURE__ */ jsx("h2", { className: "text-xs font-semibold", children: "Controls" }),
7389
+ /* @__PURE__ */ jsx(
7390
+ "button",
7391
+ {
7392
+ onClick: () => setIsDrawerOpen(false),
7393
+ className: "md:hidden text-secondary hover:text-primary transition-colors p-1",
7394
+ type: "button",
7395
+ "aria-label": "Close sidebar",
7396
+ children: /* @__PURE__ */ jsx(
7397
+ "svg",
7398
+ {
7399
+ width: "16",
7400
+ height: "16",
7401
+ viewBox: "0 0 16 16",
7402
+ fill: "none",
7403
+ xmlns: "http://www.w3.org/2000/svg",
7404
+ children: /* @__PURE__ */ jsx(
7405
+ "path",
7406
+ {
7407
+ d: "M12 4L4 12M4 4L12 12",
7408
+ stroke: "currentColor",
7409
+ strokeWidth: "2",
7410
+ strokeLinecap: "round"
7411
+ }
7412
+ )
7413
+ }
7414
+ )
7415
+ }
7416
+ )
7417
+ ] }),
7418
+ controls
7419
+ ] }) }) })
7420
+ }
7421
+ ),
7422
+ /* @__PURE__ */ jsxs("main", { className: "flex-1 overflow-auto relative", children: [
7423
+ /* @__PURE__ */ jsx(
7424
+ "button",
7425
+ {
7426
+ onClick: () => setIsDrawerOpen(true),
7427
+ className: "md:hidden fixed top-18 left-0 z-30 bg-sidebar border-r border-t border-b border-subtle rounded-r-md p-2 shadow-lg hover:bg-primary/10 transition-colors",
7428
+ type: "button",
7429
+ "aria-label": "Open sidebar",
7430
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
7431
+ }
7432
+ ),
7433
+ children
7434
+ ] })
7368
7435
  ] });
7369
7436
  }
7370
7437
  function SidebarControl({ label, children }) {
@@ -7486,9 +7553,10 @@ const SCREEN_WIDTHS = {
7486
7553
  function Conversation({
7487
7554
  children,
7488
7555
  screenWidth,
7489
- appName = "Sunpeak App",
7556
+ appName = "Sunpeak",
7490
7557
  appIcon,
7491
- userMessage = "What have you got for me today?"
7558
+ userMessage = "What have you got for me today?",
7559
+ resourceMeta
7492
7560
  }) {
7493
7561
  const displayMode = useDisplayMode() ?? "inline";
7494
7562
  const api = useWidgetAPI();
@@ -7522,7 +7590,25 @@ function Conversation({
7522
7590
  }
7523
7591
  ) }),
7524
7592
  /* @__PURE__ */ jsx("div", { className: "text-primary flex items-center justify-center text-base", children: appName }),
7525
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end" })
7593
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxs(
7594
+ Button,
7595
+ {
7596
+ variant: "outline",
7597
+ color: "primary",
7598
+ className: "bg-token-bg-primary",
7599
+ onClick: () => {
7600
+ const widgetDomain = resourceMeta == null ? void 0 : resourceMeta["openai/widgetDomain"];
7601
+ if ((api == null ? void 0 : api.openExternal) && widgetDomain) {
7602
+ api.openExternal({ href: widgetDomain });
7603
+ }
7604
+ },
7605
+ children: [
7606
+ appIcon && /* @__PURE__ */ jsx("span", { className: "me-2 h-4 w-4 flex items-center justify-center", children: appIcon }),
7607
+ "Open in ",
7608
+ appName
7609
+ ]
7610
+ }
7611
+ ) })
7526
7612
  ] }),
7527
7613
  /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden flex-1 min-h-0", children: /* @__PURE__ */ jsx("div", { className: "h-full w-full max-w-full overflow-auto", children }) }),
7528
7614
  /* @__PURE__ */ jsx("footer", { className: "bg-surface", children: /* @__PURE__ */ jsx("div", { className: "max-w-[48rem] mx-auto px-4 py-4", children: /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
@@ -7597,7 +7683,7 @@ function Conversation({
7597
7683
  children: /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col gap-1 empty:hidden", children: displayMode === "pip" ? /* @__PURE__ */ jsxs(
7598
7684
  "div",
7599
7685
  {
7600
- className: "no-scrollbar @w-xl/main:top-4 fixed start-4 end-4 top-4 z-50 mx-auto max-w-[40rem] lg:max-w-[48rem] sm:start-0 sm:end-0 sm:top-[3.25rem] sm:w-full overflow-visible",
7686
+ className: "no-scrollbar @w-xl/main:top-4 fixed start-4 end-4 top-12 z-50 mx-auto max-w-[40rem] lg:max-w-[48rem] sm:start-0 sm:end-0 sm:top-[3.25rem] sm:w-full overflow-visible",
7601
7687
  style: { maxHeight: "480px" },
7602
7688
  children: [
7603
7689
  /* @__PURE__ */ jsx(
@@ -7614,7 +7700,7 @@ function Conversation({
7614
7700
  children: /* @__PURE__ */ jsx(CloseBold, { className: "h-4 w-4" })
7615
7701
  }
7616
7702
  ),
7617
- /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden h-full rounded-2xl sm:rounded-3xl shadow-[0px_0px_0px_1px_#fff3,0px_6px_20px_rgba(0,0,0,0.1)] md:-mx-4", children: /* @__PURE__ */ jsx("div", { className: "h-full w-full max-w-full overflow-auto bg-[#212121]", children }) })
7703
+ /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden h-full rounded-2xl sm:rounded-3xl shadow-[0px_0px_0px_1px_#fff3,0px_6px_20px_rgba(0,0,0,0.1)] md:-mx-4", children: /* @__PURE__ */ jsx("div", { className: "h-full w-full max-w-full overflow-auto bg-white dark:bg-[#212121]", children }) })
7618
7704
  ]
7619
7705
  }
7620
7706
  ) : /* @__PURE__ */ jsx("div", { className: "no-scrollbar relative mb-2 @w-sm/main:w-full mx-0 max-sm:-mx-[1rem] max-sm:w-[100cqw] max-sm:overflow-hidden overflow-visible", children: /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden h-full", children }) }) })
@@ -7831,7 +7917,7 @@ const DEFAULT_DISPLAY_MODE = "inline";
7831
7917
  function ChatGPTSimulator({
7832
7918
  children,
7833
7919
  simulations = [],
7834
- appName = "Sunpeak App",
7920
+ appName = "Sunpeak",
7835
7921
  appIcon
7836
7922
  }) {
7837
7923
  const [screenWidth, setScreenWidth] = React.useState("full");
@@ -8325,6 +8411,7 @@ function ChatGPTSimulator({
8325
8411
  appName,
8326
8412
  appIcon,
8327
8413
  userMessage,
8414
+ resourceMeta: selectedSim == null ? void 0 : selectedSim.resource._meta,
8328
8415
  children: content
8329
8416
  },
8330
8417
  selectedKey