sunpeak 0.9.6 → 0.9.8

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.
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4
4
  var _a, _b;
5
5
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
6
6
  import * as React from "react";
7
- import React__default, { useSyncExternalStore, useState, useEffect, useCallback, useLayoutEffect, useRef, useId as useId$1, Children, isValidElement, cloneElement, createContext, useReducer, useMemo, use } from "react";
7
+ import React__default, { useSyncExternalStore, useState, useRef, useEffect, useCallback, useLayoutEffect, useId as useId$1, Children, isValidElement, cloneElement, createContext, useReducer, useMemo, use } from "react";
8
8
  import * as ReactDOM from "react-dom";
9
9
  import ReactDOM__default from "react-dom";
10
10
  const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
@@ -39,19 +39,38 @@ class OpenAiProvider {
39
39
  };
40
40
  }
41
41
  getAPI() {
42
- var _a2, _b2, _c, _d, _e, _f, _g;
43
42
  if (typeof window === "undefined" || !window.openai) {
44
43
  return null;
45
44
  }
46
- const api = window.openai;
47
45
  return {
48
- callTool: (_a2 = api.callTool) == null ? void 0 : _a2.bind(api),
49
- sendFollowUpMessage: (_b2 = api.sendFollowUpMessage) == null ? void 0 : _b2.bind(api),
50
- openExternal: (_c = api.openExternal) == null ? void 0 : _c.bind(api),
51
- requestDisplayMode: (_d = api.requestDisplayMode) == null ? void 0 : _d.bind(api),
52
- requestModal: (_e = api.requestModal) == null ? void 0 : _e.bind(api),
53
- notifyIntrinsicHeight: (_f = api.notifyIntrinsicHeight) == null ? void 0 : _f.bind(api),
54
- setWidgetState: (_g = api.setWidgetState) == null ? void 0 : _g.bind(api)
46
+ callTool: (...args) => {
47
+ var _a2, _b2;
48
+ return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.callTool) == null ? void 0 : _b2.call(_a2, ...args);
49
+ },
50
+ sendFollowUpMessage: (...args) => {
51
+ var _a2, _b2;
52
+ return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.sendFollowUpMessage) == null ? void 0 : _b2.call(_a2, ...args);
53
+ },
54
+ openExternal: (...args) => {
55
+ var _a2, _b2;
56
+ return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.openExternal) == null ? void 0 : _b2.call(_a2, ...args);
57
+ },
58
+ requestDisplayMode: (...args) => {
59
+ var _a2, _b2;
60
+ return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.requestDisplayMode) == null ? void 0 : _b2.call(_a2, ...args);
61
+ },
62
+ requestModal: (...args) => {
63
+ var _a2, _b2;
64
+ return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.requestModal) == null ? void 0 : _b2.call(_a2, ...args);
65
+ },
66
+ notifyIntrinsicHeight: (...args) => {
67
+ var _a2, _b2;
68
+ return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.notifyIntrinsicHeight) == null ? void 0 : _b2.call(_a2, ...args);
69
+ },
70
+ setWidgetState: (...args) => {
71
+ var _a2, _b2;
72
+ return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.setWidgetState) == null ? void 0 : _b2.call(_a2, ...args);
73
+ }
55
74
  };
56
75
  }
57
76
  }
@@ -154,8 +173,17 @@ function useWidgetState(defaultState) {
154
173
  }
155
174
  return typeof defaultState === "function" ? defaultState() : defaultState ?? null;
156
175
  });
176
+ const hasSentInitialState = useRef(false);
177
+ useEffect(() => {
178
+ if (!hasSentInitialState.current && widgetStateFromProvider == null && widgetState != null && (api == null ? void 0 : api.setWidgetState)) {
179
+ hasSentInitialState.current = true;
180
+ api.setWidgetState(widgetState);
181
+ }
182
+ }, [api, widgetState, widgetStateFromProvider]);
157
183
  useEffect(() => {
158
- _setWidgetState(widgetStateFromProvider);
184
+ if (widgetStateFromProvider != null) {
185
+ _setWidgetState(widgetStateFromProvider);
186
+ }
159
187
  }, [widgetStateFromProvider]);
160
188
  const setWidgetState = useCallback(
161
189
  (state) => {
@@ -7502,9 +7530,11 @@ function SidebarTextarea({
7502
7530
  onFocus,
7503
7531
  onBlur,
7504
7532
  placeholder,
7505
- rows = 2,
7533
+ maxRows = 8,
7506
7534
  error
7507
7535
  }) {
7536
+ const contentRows = (value == null ? void 0 : value.split("\n").length) ?? 1;
7537
+ const rows = Math.min(contentRows, maxRows);
7508
7538
  return /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
7509
7539
  /* @__PURE__ */ jsx(
7510
7540
  Textarea,
@@ -7516,7 +7546,8 @@ function SidebarTextarea({
7516
7546
  placeholder,
7517
7547
  rows,
7518
7548
  size: "2xs",
7519
- className: "text-[10px] font-mono",
7549
+ className: "text-[10px] font-mono resize-y",
7550
+ style: { whiteSpace: "pre", overflowX: "auto", overflowWrap: "normal" },
7520
7551
  invalid: !!error
7521
7552
  }
7522
7553
  ),
@@ -8358,8 +8389,8 @@ class MockOpenAI {
8358
8389
  console.log("Mock notifyIntrinsicHeight:", height);
8359
8390
  }
8360
8391
  async setWidgetState(state) {
8361
- this.widgetState = state;
8362
- this.emitUpdate({ widgetState: state });
8392
+ this.widgetState = { ...this.widgetState, ...state };
8393
+ this.emitUpdate({ widgetState: this.widgetState });
8363
8394
  }
8364
8395
  setTheme(theme) {
8365
8396
  this.theme = theme;
@@ -8570,11 +8601,17 @@ function ChatGPTSimulator({
8570
8601
  // eslint-disable-next-line react-hooks/exhaustive-deps -- only initialize once
8571
8602
  []
8572
8603
  );
8604
+ if (typeof window !== "undefined") {
8605
+ window.openai = mock;
8606
+ resetProviderCache();
8607
+ }
8573
8608
  useEffect(() => {
8574
8609
  var _a2, _b2;
8575
8610
  if (selectedSim) {
8576
8611
  mock.toolInput = ((_a2 = selectedSim.callToolRequestParams) == null ? void 0 : _a2.arguments) ?? {};
8577
- mock.widgetState = selectedSim.widgetState ?? null;
8612
+ if (selectedSim.widgetState !== void 0) {
8613
+ mock.setWidgetStateExternal(selectedSim.widgetState);
8614
+ }
8578
8615
  mock.toolOutput = ((_b2 = selectedSim.callToolResult) == null ? void 0 : _b2.structuredContent) ?? null;
8579
8616
  }
8580
8617
  }, [selectedSimulationName, selectedSim, mock]);
@@ -8586,7 +8623,7 @@ function ChatGPTSimulator({
8586
8623
  const safeArea = useSafeArea();
8587
8624
  const view = useView();
8588
8625
  const toolInput = useToolInput();
8589
- const [widgetState] = useWidgetState();
8626
+ const widgetState = useWidgetGlobal("widgetState");
8590
8627
  const toolResponseMetadata = useToolResponseMetadata();
8591
8628
  const toolOutput = useWidgetProps();
8592
8629
  const [toolInputJson, setToolInputJson] = useState(
@@ -8610,12 +8647,6 @@ function ChatGPTSimulator({
8610
8647
  const [toolResponseMetadataError, setToolResponseMetadataError] = useState("");
8611
8648
  const [widgetStateError, setWidgetStateError] = useState("");
8612
8649
  const [viewParamsError, setViewParamsError] = useState("");
8613
- useLayoutEffect(() => {
8614
- if (mock && typeof window !== "undefined") {
8615
- window.openai = mock;
8616
- resetProviderCache();
8617
- }
8618
- }, [mock]);
8619
8650
  useEffect(() => {
8620
8651
  if (mock) {
8621
8652
  mock.emitUpdate({
@@ -8704,11 +8735,15 @@ function ChatGPTSimulator({
8704
8735
  SimpleSidebar,
8705
8736
  {
8706
8737
  controls: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
8707
- simulationNames.length > 0 && /* @__PURE__ */ jsx(SidebarControl, { label: "Simulation", children: /* @__PURE__ */ jsx(
8738
+ simulationNames.length > 1 && /* @__PURE__ */ jsx(SidebarControl, { label: "Simulation", children: /* @__PURE__ */ jsx(
8708
8739
  SidebarSelect,
8709
8740
  {
8710
8741
  value: selectedSimulationName,
8711
- onChange: (value) => setSelectedSimulationName(value),
8742
+ onChange: (value) => {
8743
+ const newSim = simulations[value];
8744
+ mock.setWidgetStateExternal((newSim == null ? void 0 : newSim.widgetState) ?? null);
8745
+ setSelectedSimulationName(value);
8746
+ },
8712
8747
  options: simulationNames.map((name) => {
8713
8748
  const sim = simulations[name];
8714
8749
  const resourceTitle = sim.resource.title || sim.resource.name;
@@ -8733,237 +8768,254 @@ function ChatGPTSimulator({
8733
8768
  ]
8734
8769
  }
8735
8770
  ) }),
8736
- /* @__PURE__ */ jsx(SidebarControl, { label: "Theme", children: /* @__PURE__ */ jsx(
8737
- SidebarToggle,
8738
- {
8739
- value: theme,
8740
- onChange: (value) => mock.setTheme(value),
8741
- options: [
8742
- { value: "light", label: "Light" },
8743
- { value: "dark", label: "Dark" }
8744
- ]
8745
- }
8746
- ) }),
8747
- /* @__PURE__ */ jsx(SidebarControl, { label: "Display Mode", children: /* @__PURE__ */ jsx(
8748
- SidebarToggle,
8749
- {
8750
- value: displayMode,
8751
- onChange: (value) => {
8752
- const newMode = value;
8753
- if (isMobileWidth(screenWidth) && newMode === "pip") {
8754
- mock.setDisplayMode("fullscreen");
8755
- } else {
8756
- mock.setDisplayMode(newMode);
8757
- }
8758
- },
8759
- options: [
8760
- { value: "inline", label: "Inline" },
8761
- { value: "pip", label: "PiP" },
8762
- { value: "fullscreen", label: "Full" }
8763
- ]
8764
- }
8765
- ) }),
8766
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
8767
- /* @__PURE__ */ jsx(SidebarControl, { label: "Locale", children: /* @__PURE__ */ jsx(
8768
- SidebarInput,
8771
+ /* @__PURE__ */ jsx(SidebarCollapsibleControl, { label: "Runtime Globals", defaultCollapsed: false, children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
8772
+ /* @__PURE__ */ jsx(SidebarControl, { label: "Theme", children: /* @__PURE__ */ jsx(
8773
+ SidebarToggle,
8769
8774
  {
8770
- value: locale,
8771
- onChange: (value) => mock.setLocale(value),
8772
- placeholder: "e.g. en-US"
8775
+ value: theme,
8776
+ onChange: (value) => mock.setTheme(value),
8777
+ options: [
8778
+ { value: "light", label: "Light" },
8779
+ { value: "dark", label: "Dark" }
8780
+ ]
8773
8781
  }
8774
8782
  ) }),
8775
- /* @__PURE__ */ jsx(SidebarControl, { label: "Max Height (PiP)", children: /* @__PURE__ */ jsx(
8776
- SidebarInput,
8783
+ /* @__PURE__ */ jsx(SidebarControl, { label: "Display Mode", children: /* @__PURE__ */ jsx(
8784
+ SidebarToggle,
8777
8785
  {
8778
- type: "number",
8779
- value: displayMode === "pip" && maxHeight !== void 0 ? String(maxHeight) : "",
8786
+ value: displayMode,
8780
8787
  onChange: (value) => {
8781
- if (displayMode === "pip") {
8782
- mock.setMaxHeight(value ? Number(value) : 480);
8788
+ const newMode = value;
8789
+ if (isMobileWidth(screenWidth) && newMode === "pip") {
8790
+ mock.setDisplayMode("fullscreen");
8791
+ } else {
8792
+ mock.setDisplayMode(newMode);
8783
8793
  }
8784
8794
  },
8785
- placeholder: displayMode === "pip" ? "480" : "-",
8786
- disabled: displayMode !== "pip"
8787
- }
8788
- ) })
8789
- ] }),
8790
- /* @__PURE__ */ jsx(SidebarControl, { label: "User Agent - Device", children: /* @__PURE__ */ jsx(
8791
- SidebarSelect,
8792
- {
8793
- value: (userAgent == null ? void 0 : userAgent.device.type) ?? "desktop",
8794
- onChange: (value) => {
8795
- const deviceType = value;
8796
- let capabilities;
8797
- switch (deviceType) {
8798
- case "mobile":
8799
- capabilities = { hover: false, touch: true };
8800
- break;
8801
- case "tablet":
8802
- capabilities = { hover: false, touch: true };
8803
- break;
8804
- case "desktop":
8805
- capabilities = { hover: true, touch: false };
8806
- break;
8807
- case "unknown":
8808
- default:
8809
- capabilities = { hover: true, touch: false };
8810
- break;
8811
- }
8812
- mock.setUserAgent({
8813
- ...userAgent,
8814
- device: { type: deviceType },
8815
- capabilities
8816
- });
8817
- },
8818
- options: [
8819
- { value: "mobile", label: "Mobile" },
8820
- { value: "tablet", label: "Tablet" },
8821
- { value: "desktop", label: "Desktop" },
8822
- { value: "unknown", label: "Unknown" }
8823
- ]
8824
- }
8825
- ) }),
8826
- /* @__PURE__ */ jsx("div", { className: "pl-4", children: /* @__PURE__ */ jsx(SidebarControl, { label: "Capabilities", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
8827
- /* @__PURE__ */ jsx(
8828
- SidebarCheckbox,
8829
- {
8830
- checked: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
8831
- onChange: (checked) => mock.setUserAgent({
8832
- ...userAgent,
8833
- device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
8834
- capabilities: {
8835
- hover: checked,
8836
- touch: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false
8837
- }
8838
- }),
8839
- label: "Hover"
8795
+ options: [
8796
+ { value: "inline", label: "Inline" },
8797
+ { value: "pip", label: "PiP" },
8798
+ { value: "fullscreen", label: "Full" }
8799
+ ]
8840
8800
  }
8841
- ),
8842
- /* @__PURE__ */ jsx(
8843
- SidebarCheckbox,
8844
- {
8845
- checked: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false,
8846
- onChange: (checked) => mock.setUserAgent({
8847
- ...userAgent,
8848
- device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
8849
- capabilities: {
8850
- hover: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
8851
- touch: checked
8852
- }
8853
- }),
8854
- label: "Touch"
8855
- }
8856
- )
8857
- ] }) }) }),
8858
- /* @__PURE__ */ jsx(SidebarControl, { label: "Safe Area Insets", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-1", children: [
8859
- /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
8860
- /* @__PURE__ */ jsx("label", { className: "text-[9px] text-secondary", children: "Top" }),
8861
- /* @__PURE__ */ jsx(
8801
+ ) }),
8802
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
8803
+ /* @__PURE__ */ jsx(SidebarControl, { label: "Locale", children: /* @__PURE__ */ jsx(
8862
8804
  SidebarInput,
8863
8805
  {
8864
- type: "number",
8865
- value: String((safeArea == null ? void 0 : safeArea.insets.top) ?? 0),
8866
- onChange: (value) => mock.setSafeArea({
8867
- insets: {
8868
- ...safeArea == null ? void 0 : safeArea.insets,
8869
- top: Number(value),
8870
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8871
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8872
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
8873
- }
8874
- })
8806
+ value: locale,
8807
+ onChange: (value) => mock.setLocale(value),
8808
+ placeholder: "e.g. en-US"
8875
8809
  }
8876
- )
8877
- ] }),
8878
- /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
8879
- /* @__PURE__ */ jsx("label", { className: "text-[9px] text-secondary", children: "Bottom" }),
8880
- /* @__PURE__ */ jsx(
8810
+ ) }),
8811
+ /* @__PURE__ */ jsx(SidebarControl, { label: "Max Height (PiP)", children: /* @__PURE__ */ jsx(
8881
8812
  SidebarInput,
8882
8813
  {
8883
8814
  type: "number",
8884
- value: String((safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0),
8885
- onChange: (value) => mock.setSafeArea({
8886
- insets: {
8887
- ...safeArea == null ? void 0 : safeArea.insets,
8888
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8889
- bottom: Number(value),
8890
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8891
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
8815
+ value: displayMode === "pip" && maxHeight !== void 0 ? String(maxHeight) : "",
8816
+ onChange: (value) => {
8817
+ if (displayMode === "pip") {
8818
+ mock.setMaxHeight(value ? Number(value) : 480);
8892
8819
  }
8893
- })
8820
+ },
8821
+ placeholder: displayMode === "pip" ? "480" : "-",
8822
+ disabled: displayMode !== "pip"
8894
8823
  }
8895
- )
8824
+ ) })
8896
8825
  ] }),
8897
- /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
8898
- /* @__PURE__ */ jsx("label", { className: "text-[9px] text-secondary", children: "Left" }),
8826
+ /* @__PURE__ */ jsx(SidebarControl, { label: "User Agent - Device", children: /* @__PURE__ */ jsx(
8827
+ SidebarSelect,
8828
+ {
8829
+ value: (userAgent == null ? void 0 : userAgent.device.type) ?? "desktop",
8830
+ onChange: (value) => {
8831
+ const deviceType = value;
8832
+ let capabilities;
8833
+ switch (deviceType) {
8834
+ case "mobile":
8835
+ capabilities = { hover: false, touch: true };
8836
+ break;
8837
+ case "tablet":
8838
+ capabilities = { hover: false, touch: true };
8839
+ break;
8840
+ case "desktop":
8841
+ capabilities = { hover: true, touch: false };
8842
+ break;
8843
+ case "unknown":
8844
+ default:
8845
+ capabilities = { hover: true, touch: false };
8846
+ break;
8847
+ }
8848
+ mock.setUserAgent({
8849
+ ...userAgent,
8850
+ device: { type: deviceType },
8851
+ capabilities
8852
+ });
8853
+ },
8854
+ options: [
8855
+ { value: "mobile", label: "Mobile" },
8856
+ { value: "tablet", label: "Tablet" },
8857
+ { value: "desktop", label: "Desktop" },
8858
+ { value: "unknown", label: "Unknown" }
8859
+ ]
8860
+ }
8861
+ ) }),
8862
+ /* @__PURE__ */ jsx("div", { className: "pl-4", children: /* @__PURE__ */ jsx(SidebarControl, { label: "Capabilities", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
8899
8863
  /* @__PURE__ */ jsx(
8900
- SidebarInput,
8864
+ SidebarCheckbox,
8901
8865
  {
8902
- type: "number",
8903
- value: String((safeArea == null ? void 0 : safeArea.insets.left) ?? 0),
8904
- onChange: (value) => mock.setSafeArea({
8905
- insets: {
8906
- ...safeArea == null ? void 0 : safeArea.insets,
8907
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8908
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8909
- left: Number(value),
8910
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
8866
+ checked: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
8867
+ onChange: (checked) => mock.setUserAgent({
8868
+ ...userAgent,
8869
+ device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
8870
+ capabilities: {
8871
+ hover: checked,
8872
+ touch: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false
8911
8873
  }
8912
- })
8874
+ }),
8875
+ label: "Hover"
8913
8876
  }
8914
- )
8915
- ] }),
8916
- /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
8917
- /* @__PURE__ */ jsx("label", { className: "text-[9px] text-secondary", children: "Right" }),
8877
+ ),
8918
8878
  /* @__PURE__ */ jsx(
8919
- SidebarInput,
8879
+ SidebarCheckbox,
8920
8880
  {
8921
- type: "number",
8922
- value: String((safeArea == null ? void 0 : safeArea.insets.right) ?? 0),
8923
- onChange: (value) => mock.setSafeArea({
8924
- insets: {
8925
- ...safeArea == null ? void 0 : safeArea.insets,
8926
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8927
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8928
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8929
- right: Number(value)
8881
+ checked: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false,
8882
+ onChange: (checked) => mock.setUserAgent({
8883
+ ...userAgent,
8884
+ device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
8885
+ capabilities: {
8886
+ hover: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
8887
+ touch: checked
8930
8888
  }
8931
- })
8889
+ }),
8890
+ label: "Touch"
8932
8891
  }
8933
8892
  )
8934
- ] })
8893
+ ] }) }) }),
8894
+ /* @__PURE__ */ jsx(SidebarControl, { label: "Safe Area Insets", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-4 gap-1", children: [
8895
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
8896
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-secondary", children: "↑" }),
8897
+ /* @__PURE__ */ jsx(
8898
+ SidebarInput,
8899
+ {
8900
+ type: "number",
8901
+ value: String((safeArea == null ? void 0 : safeArea.insets.top) ?? 0),
8902
+ onChange: (value) => mock.setSafeArea({
8903
+ insets: {
8904
+ ...safeArea == null ? void 0 : safeArea.insets,
8905
+ top: Number(value),
8906
+ bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8907
+ left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8908
+ right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
8909
+ }
8910
+ })
8911
+ }
8912
+ )
8913
+ ] }),
8914
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
8915
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-secondary", children: "↓" }),
8916
+ /* @__PURE__ */ jsx(
8917
+ SidebarInput,
8918
+ {
8919
+ type: "number",
8920
+ value: String((safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0),
8921
+ onChange: (value) => mock.setSafeArea({
8922
+ insets: {
8923
+ ...safeArea == null ? void 0 : safeArea.insets,
8924
+ top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8925
+ bottom: Number(value),
8926
+ left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8927
+ right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
8928
+ }
8929
+ })
8930
+ }
8931
+ )
8932
+ ] }),
8933
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
8934
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-secondary", children: "←" }),
8935
+ /* @__PURE__ */ jsx(
8936
+ SidebarInput,
8937
+ {
8938
+ type: "number",
8939
+ value: String((safeArea == null ? void 0 : safeArea.insets.left) ?? 0),
8940
+ onChange: (value) => mock.setSafeArea({
8941
+ insets: {
8942
+ ...safeArea == null ? void 0 : safeArea.insets,
8943
+ top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8944
+ bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8945
+ left: Number(value),
8946
+ right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
8947
+ }
8948
+ })
8949
+ }
8950
+ )
8951
+ ] }),
8952
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
8953
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-secondary", children: "→" }),
8954
+ /* @__PURE__ */ jsx(
8955
+ SidebarInput,
8956
+ {
8957
+ type: "number",
8958
+ value: String((safeArea == null ? void 0 : safeArea.insets.right) ?? 0),
8959
+ onChange: (value) => mock.setSafeArea({
8960
+ insets: {
8961
+ ...safeArea == null ? void 0 : safeArea.insets,
8962
+ top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8963
+ bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8964
+ left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8965
+ right: Number(value)
8966
+ }
8967
+ })
8968
+ }
8969
+ )
8970
+ ] })
8971
+ ] }) }),
8972
+ /* @__PURE__ */ jsx(SidebarControl, { label: "View Mode", children: /* @__PURE__ */ jsx(
8973
+ SidebarSelect,
8974
+ {
8975
+ value: (view == null ? void 0 : view.mode) ?? "default",
8976
+ onChange: (value) => mock.setView(
8977
+ value === "default" ? null : {
8978
+ mode: value,
8979
+ params: view == null ? void 0 : view.params
8980
+ }
8981
+ ),
8982
+ options: [
8983
+ { value: "default", label: "Default (null)" },
8984
+ { value: "modal", label: "Modal" }
8985
+ ]
8986
+ }
8987
+ ) }),
8988
+ view && view.mode !== "default" && /* @__PURE__ */ jsx(SidebarControl, { label: "View Params (JSON)", children: /* @__PURE__ */ jsx(
8989
+ SidebarTextarea,
8990
+ {
8991
+ value: viewParamsJson,
8992
+ onChange: (json) => validateJSON(json, setViewParamsJson, setViewParamsError),
8993
+ onFocus: () => setEditingField("viewParams"),
8994
+ onBlur: () => commitJSON(viewParamsJson, setViewParamsError, (parsed) => {
8995
+ if (view) {
8996
+ mock.setView({ ...view, params: parsed ?? void 0 });
8997
+ }
8998
+ }),
8999
+ error: viewParamsError,
9000
+ maxRows: 2
9001
+ }
9002
+ ) }),
9003
+ /* @__PURE__ */ jsx(SidebarCollapsibleControl, { label: "Widget State (JSON)", defaultCollapsed: false, children: /* @__PURE__ */ jsx(
9004
+ SidebarTextarea,
9005
+ {
9006
+ value: widgetStateJson,
9007
+ onChange: (json) => validateJSON(json, setWidgetStateJson, setWidgetStateError),
9008
+ onFocus: () => setEditingField("widgetState"),
9009
+ onBlur: () => commitJSON(
9010
+ widgetStateJson,
9011
+ setWidgetStateError,
9012
+ (parsed) => mock.setWidgetStateExternal(parsed)
9013
+ ),
9014
+ error: widgetStateError,
9015
+ maxRows: 8
9016
+ }
9017
+ ) })
8935
9018
  ] }) }),
8936
- /* @__PURE__ */ jsx(SidebarControl, { label: "View Mode", children: /* @__PURE__ */ jsx(
8937
- SidebarSelect,
8938
- {
8939
- value: (view == null ? void 0 : view.mode) ?? "default",
8940
- onChange: (value) => mock.setView(
8941
- value === "default" ? null : {
8942
- mode: value,
8943
- params: view == null ? void 0 : view.params
8944
- }
8945
- ),
8946
- options: [
8947
- { value: "default", label: "Default (null)" },
8948
- { value: "modal", label: "Modal" }
8949
- ]
8950
- }
8951
- ) }),
8952
- view && view.mode !== "default" && /* @__PURE__ */ jsx(SidebarControl, { label: "View Params (JSON)", children: /* @__PURE__ */ jsx(
8953
- SidebarTextarea,
8954
- {
8955
- value: viewParamsJson,
8956
- onChange: (json) => validateJSON(json, setViewParamsJson, setViewParamsError),
8957
- onFocus: () => setEditingField("viewParams"),
8958
- onBlur: () => commitJSON(viewParamsJson, setViewParamsError, (parsed) => {
8959
- if (view) {
8960
- mock.setView({ ...view, params: parsed ?? void 0 });
8961
- }
8962
- }),
8963
- error: viewParamsError,
8964
- rows: 2
8965
- }
8966
- ) }),
8967
9019
  /* @__PURE__ */ jsx(SidebarCollapsibleControl, { label: "Tool Input (JSON)", children: /* @__PURE__ */ jsx(
8968
9020
  SidebarTextarea,
8969
9021
  {
@@ -8976,7 +9028,7 @@ function ChatGPTSimulator({
8976
9028
  (parsed) => mock.setToolInput(parsed ?? {})
8977
9029
  ),
8978
9030
  error: toolInputError,
8979
- rows: 8
9031
+ maxRows: 8
8980
9032
  }
8981
9033
  ) }),
8982
9034
  /* @__PURE__ */ jsx(SidebarCollapsibleControl, { label: "Tool Output (JSON)", children: /* @__PURE__ */ jsx(
@@ -8991,7 +9043,7 @@ function ChatGPTSimulator({
8991
9043
  (parsed) => mock.setToolOutput(parsed)
8992
9044
  ),
8993
9045
  error: toolOutputError,
8994
- rows: 8
9046
+ maxRows: 8
8995
9047
  }
8996
9048
  ) }),
8997
9049
  /* @__PURE__ */ jsx(SidebarCollapsibleControl, { label: "Tool Response Metadata (JSON)", children: /* @__PURE__ */ jsx(
@@ -9006,22 +9058,7 @@ function ChatGPTSimulator({
9006
9058
  (parsed) => mock.setToolResponseMetadata(parsed)
9007
9059
  ),
9008
9060
  error: toolResponseMetadataError,
9009
- rows: 8
9010
- }
9011
- ) }),
9012
- /* @__PURE__ */ jsx(SidebarCollapsibleControl, { label: "Widget State (JSON)", children: /* @__PURE__ */ jsx(
9013
- SidebarTextarea,
9014
- {
9015
- value: widgetStateJson,
9016
- onChange: (json) => validateJSON(json, setWidgetStateJson, setWidgetStateError),
9017
- onFocus: () => setEditingField("widgetState"),
9018
- onBlur: () => commitJSON(
9019
- widgetStateJson,
9020
- setWidgetStateError,
9021
- (parsed) => mock.setWidgetStateExternal(parsed)
9022
- ),
9023
- error: widgetStateError,
9024
- rows: 8
9061
+ maxRows: 8
9025
9062
  }
9026
9063
  ) })
9027
9064
  ] }),
@@ -9114,4 +9151,4 @@ export {
9114
9151
  getAPI as v,
9115
9152
  resetProviderCache as w
9116
9153
  };
9117
- //# sourceMappingURL=simulator-url-BOSS60NS.js.map
9154
+ //# sourceMappingURL=simulator-url-q5tHLc4-.js.map