sunpeak 0.10.5 → 0.10.7

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 (35) hide show
  1. package/bin/commands/build.mjs +13 -13
  2. package/bin/commands/mcp.mjs +213 -46
  3. package/bin/commands/push.mjs +3 -4
  4. package/dist/chatgpt/index.cjs +1 -1
  5. package/dist/chatgpt/index.js +1 -1
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.js +2 -2
  8. package/dist/mcp/entry.cjs +2 -1
  9. package/dist/mcp/entry.cjs.map +1 -1
  10. package/dist/mcp/entry.js +2 -1
  11. package/dist/mcp/entry.js.map +1 -1
  12. package/dist/mcp/index.cjs +1 -1
  13. package/dist/mcp/index.js +1 -1
  14. package/dist/mcp/types.d.ts +7 -0
  15. package/dist/{server-CnRhUNGQ.js → server-BLKltt88.js} +124 -28
  16. package/dist/{server-CnRhUNGQ.js.map → server-BLKltt88.js.map} +1 -1
  17. package/dist/{server-B-T6Y3-J.cjs → server-D_oRdZjX.cjs} +124 -28
  18. package/dist/{server-B-T6Y3-J.cjs.map → server-D_oRdZjX.cjs.map} +1 -1
  19. package/dist/{simulator-url-pSDp_VWO.cjs → simulator-url-B6DZi3vV.cjs} +25 -14
  20. package/dist/simulator-url-B6DZi3vV.cjs.map +1 -0
  21. package/dist/{simulator-url-BUKX-wRa.js → simulator-url-izFV6mji.js} +24 -13
  22. package/dist/simulator-url-izFV6mji.js.map +1 -0
  23. package/package.json +1 -1
  24. package/template/dist/albums/albums.js +4 -4
  25. package/template/dist/albums/albums.json +1 -1
  26. package/template/dist/carousel/carousel.js +3 -3
  27. package/template/dist/carousel/carousel.json +1 -1
  28. package/template/dist/map/map.js +8 -8
  29. package/template/dist/map/map.json +1 -1
  30. package/template/dist/review/review.js +3 -3
  31. package/template/dist/review/review.json +1 -1
  32. package/template/node_modules/.vite/deps/_metadata.json +22 -22
  33. package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  34. package/dist/simulator-url-BUKX-wRa.js.map +0 -1
  35. package/dist/simulator-url-pSDp_VWO.cjs.map +0 -1
@@ -165,29 +165,40 @@ function useWidgetState(defaultState) {
165
165
  return typeof defaultState === "function" ? defaultState() : defaultState ?? null;
166
166
  });
167
167
  const hasSentInitialState = React.useRef(false);
168
+ const isLocalUpdate = React.useRef(false);
169
+ const pendingApiState = React.useRef(null);
168
170
  React.useEffect(() => {
169
171
  if (!hasSentInitialState.current && widgetStateFromProvider == null && widgetState != null && api?.setWidgetState) {
170
172
  hasSentInitialState.current = true;
173
+ isLocalUpdate.current = true;
171
174
  api.setWidgetState(widgetState);
172
175
  }
173
176
  }, [api, widgetState, widgetStateFromProvider]);
174
177
  React.useEffect(() => {
178
+ if (pendingApiState.current != null && api?.setWidgetState) {
179
+ isLocalUpdate.current = true;
180
+ api.setWidgetState(pendingApiState.current);
181
+ pendingApiState.current = null;
182
+ }
183
+ });
184
+ React.useEffect(() => {
185
+ if (isLocalUpdate.current) {
186
+ isLocalUpdate.current = false;
187
+ return;
188
+ }
175
189
  if (widgetStateFromProvider != null) {
176
190
  _setWidgetState(widgetStateFromProvider);
177
191
  }
178
192
  }, [widgetStateFromProvider]);
179
- const setWidgetState = React.useCallback(
180
- (state) => {
181
- _setWidgetState((prevState) => {
182
- const newState = typeof state === "function" ? state(prevState) : state;
183
- if (newState != null && api?.setWidgetState) {
184
- api.setWidgetState(newState);
185
- }
186
- return newState;
187
- });
188
- },
189
- [api]
190
- );
193
+ const setWidgetState = React.useCallback((state) => {
194
+ _setWidgetState((prevState) => {
195
+ const newState = typeof state === "function" ? state(prevState) : state;
196
+ if (newState != null) {
197
+ pendingApiState.current = newState;
198
+ }
199
+ return newState;
200
+ });
201
+ }, []);
191
202
  return [widgetState, setWidgetState];
192
203
  }
193
204
  function r(e) {
@@ -5609,7 +5620,7 @@ const useEscCloseStack = (listening, cb) => {
5609
5620
  }, [id, listening, latestCallback]);
5610
5621
  };
5611
5622
  const __vite_import_meta_env__ = { "DEV": false, "MODE": "production" };
5612
- const META_ENV = typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("simulator-url-pSDp_VWO.cjs", document.baseURI).href } !== "undefined" ? __vite_import_meta_env__ : void 0;
5623
+ const META_ENV = typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("simulator-url-B6DZi3vV.cjs", document.baseURI).href } !== "undefined" ? __vite_import_meta_env__ : void 0;
5613
5624
  const NODE_ENV = typeof process !== "undefined" && process.env?.NODE_ENV ? process.env?.NODE_ENV : "production";
5614
5625
  const isDev = NODE_ENV === "development" || !!META_ENV?.DEV;
5615
5626
  const isJSDomLike = typeof navigator !== "undefined" && /(jsdom|happy-dom)/i.test(navigator.userAgent) || typeof globalThis.happyDOM === "object";
@@ -9269,4 +9280,4 @@ exports.useWidgetAPI = useWidgetAPI;
9269
9280
  exports.useWidgetGlobal = useWidgetGlobal;
9270
9281
  exports.useWidgetProps = useWidgetProps;
9271
9282
  exports.useWidgetState = useWidgetState;
9272
- //# sourceMappingURL=simulator-url-pSDp_VWO.cjs.map
9283
+ //# sourceMappingURL=simulator-url-B6DZi3vV.cjs.map