@superblocksteam/library 2.0.70-next.1 → 2.0.70-next.3

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,4 +1,4 @@
1
- import { S as api_hmr_tracker_default, _ as root_store_default, t as makeWrappedComponent } from "../jsx-wrapper-DrDoDS8j.js";
1
+ import { S as api_hmr_tracker_default, _ as root_store_default, t as makeWrappedComponent } from "../jsx-wrapper-DT5FMME0.js";
2
2
  import "../utils-Clb3lSiX.js";
3
3
  import { SOURCE_ID_ATTRIBUTE } from "@superblocksteam/library-shared";
4
4
  import * as ReactJsxDevRuntime from "react/jsx-dev-runtime";
@@ -703,7 +703,6 @@ var DeployedParentBridge = class {
703
703
  connected() {}
704
704
  sendReady() {}
705
705
  sendLoadError(_error) {}
706
- sendAppFrameWillReload() {}
707
706
  sendNotification(_type, _message, _description) {}
708
707
  selectWidgets(_sourceIds, _selectorIdHint) {}
709
708
  editOpRequest(_type, _payload) {}
@@ -801,12 +800,6 @@ var SuperblocksEditorBridge = class SuperblocksEditorBridge {
801
800
  payload: { error }
802
801
  }, true);
803
802
  }
804
- sendAppFrameWillReload() {
805
- this.sendImmediate({
806
- type: "sb-app-frame-will-reload",
807
- payload: void 0
808
- }, true);
809
- }
810
803
  sendNotification(type, message, description) {
811
804
  this.queueMessage({
812
805
  type: "codeMode/sendNotification",
@@ -1657,120 +1650,6 @@ function rejectById(id, payload) {
1657
1650
  }
1658
1651
  }
1659
1652
 
1660
- //#endregion
1661
- //#region src/lib/internal-details/lib/features/api-activity-tracker.ts
1662
- /**
1663
- * Tracks in-flight API requests to enable waiting for APIs to settle
1664
- * before capturing screenshots. This is used by the screenshot handler
1665
- * to avoid capturing loading states.
1666
- */
1667
- const API_ACTIVITY_EVENT = "sb-api-activity-changed";
1668
- var ApiActivityTracker = class {
1669
- inFlightTokens = /* @__PURE__ */ new Set();
1670
- lastActivityTime = Date.now();
1671
- eventTarget = new EventTarget();
1672
- /**
1673
- * Call when an API request starts.
1674
- * Returns a unique token that must be passed to trackEnd().
1675
- */
1676
- trackStart() {
1677
- const token = Symbol("api-request");
1678
- this.inFlightTokens.add(token);
1679
- this.lastActivityTime = Date.now();
1680
- console.log(`[ApiActivityTracker] API started. In-flight count: ${this.inFlightTokens.size}`);
1681
- this.emitChange();
1682
- return token;
1683
- }
1684
- /**
1685
- * Call when an API request completes (success, error, or cancellation).
1686
- * The token must match the one returned by trackStart().
1687
- * Calling with an unknown or already-ended token is a no-op (guards against double trackEnd).
1688
- */
1689
- trackEnd(token) {
1690
- if (!this.inFlightTokens.has(token)) return;
1691
- this.inFlightTokens.delete(token);
1692
- this.lastActivityTime = Date.now();
1693
- console.log(`[ApiActivityTracker] API finished. In-flight count: ${this.inFlightTokens.size}`);
1694
- this.emitChange();
1695
- }
1696
- /**
1697
- * Get the current in-flight count.
1698
- */
1699
- get inFlightCount() {
1700
- return this.inFlightTokens.size;
1701
- }
1702
- /**
1703
- * Get the current API activity state.
1704
- */
1705
- getState() {
1706
- return {
1707
- inFlightCount: this.inFlightTokens.size,
1708
- lastActivityTime: this.lastActivityTime
1709
- };
1710
- }
1711
- /**
1712
- * Check if there are any in-flight API requests.
1713
- */
1714
- isIdle() {
1715
- return this.inFlightTokens.size === 0;
1716
- }
1717
- /**
1718
- * Wait for all APIs to become idle, with a timeout.
1719
- * Resolves when either:
1720
- * - All in-flight requests complete
1721
- * - The timeout is reached
1722
- *
1723
- * @param timeoutMs Maximum time to wait (default: 10000ms)
1724
- * @returns Promise that resolves with { timedOut: boolean }
1725
- */
1726
- waitForIdle(timeoutMs = 1e4) {
1727
- return new Promise((resolve) => {
1728
- if (this.isIdle()) {
1729
- console.log(`[ApiActivityTracker] waitForIdle: Already idle, resolving immediately`);
1730
- resolve({ timedOut: false });
1731
- return;
1732
- }
1733
- console.log(`[ApiActivityTracker] waitForIdle: Waiting for ${this.inFlightTokens.size} in-flight request(s) to complete (timeout: ${timeoutMs}ms)`);
1734
- let resolved = false;
1735
- const timeoutId = setTimeout(() => {
1736
- if (resolved) return;
1737
- if (this.isIdle()) {
1738
- resolved = true;
1739
- this.eventTarget.removeEventListener(API_ACTIVITY_EVENT, handleChange);
1740
- console.log(`[ApiActivityTracker] waitForIdle: All APIs now idle, proceeding`);
1741
- resolve({ timedOut: false });
1742
- return;
1743
- }
1744
- console.warn(`[ApiActivityTracker] Timeout waiting for APIs to become idle after ${timeoutMs}ms. ${this.inFlightTokens.size} request(s) still in flight.`);
1745
- this.eventTarget.removeEventListener(API_ACTIVITY_EVENT, handleChange);
1746
- resolve({ timedOut: true });
1747
- }, timeoutMs);
1748
- const handleChange = () => {
1749
- if (resolved) return;
1750
- if (this.isIdle()) {
1751
- resolved = true;
1752
- clearTimeout(timeoutId);
1753
- this.eventTarget.removeEventListener(API_ACTIVITY_EVENT, handleChange);
1754
- console.log(`[ApiActivityTracker] waitForIdle: All APIs now idle, proceeding`);
1755
- resolve({ timedOut: false });
1756
- }
1757
- };
1758
- this.eventTarget.addEventListener(API_ACTIVITY_EVENT, handleChange);
1759
- });
1760
- }
1761
- /**
1762
- * Reset the tracker state. Useful for testing.
1763
- */
1764
- reset() {
1765
- this.inFlightTokens.clear();
1766
- this.lastActivityTime = Date.now();
1767
- }
1768
- emitChange() {
1769
- this.eventTarget.dispatchEvent(new Event(API_ACTIVITY_EVENT));
1770
- }
1771
- };
1772
- const apiActivityTracker = new ApiActivityTracker();
1773
-
1774
1653
  //#endregion
1775
1654
  //#region src/lib/internal-details/lib/features/api-hmr-tracker.ts
1776
1655
  var ApiHmrTracker = class ApiHmrTracker {
@@ -2258,28 +2137,23 @@ var ApiManager = class {
2258
2137
  console.debug("[api-store.runApiByPath] Extracted apiName:", apiName);
2259
2138
  editorBridge.setApiStarted(apiName);
2260
2139
  console.debug("[api-store.runApiByPath] Executing API internally...");
2261
- const activityToken = isEditMode() ? apiActivityTracker.trackStart() : void 0;
2262
- try {
2263
- const result = await this.executeApi({
2264
- apiId: apiName,
2265
- apiName,
2266
- path,
2267
- inputs,
2268
- options: inputs ?? {},
2269
- callId,
2270
- isTestRun,
2271
- callback,
2272
- injectedCallerId
2273
- });
2274
- console.debug("[api-store.runApiByPath] Execution complete, calling setApiResponse for:", apiName);
2275
- editorBridge.setApiResponse(apiName, result.parsedResult);
2276
- return {
2277
- data: result.data,
2278
- error: result.error
2279
- };
2280
- } finally {
2281
- if (activityToken) apiActivityTracker.trackEnd(activityToken);
2282
- }
2140
+ const result = await this.executeApi({
2141
+ apiId: apiName,
2142
+ apiName,
2143
+ path,
2144
+ inputs,
2145
+ options: inputs ?? {},
2146
+ callId,
2147
+ isTestRun,
2148
+ callback,
2149
+ injectedCallerId
2150
+ });
2151
+ console.debug("[api-store.runApiByPath] Execution complete, calling setApiResponse for:", apiName);
2152
+ editorBridge.setApiResponse(apiName, result.parsedResult);
2153
+ return {
2154
+ data: result.data,
2155
+ error: result.error
2156
+ };
2283
2157
  }
2284
2158
  getHMRCallHash(params) {
2285
2159
  return `${params.injectedCallerId ?? ""}-${params.apiId}`;
@@ -3671,5 +3545,5 @@ const useJSXContext = () => {
3671
3545
  };
3672
3546
 
3673
3547
  //#endregion
3674
- export { useSuperblocksProfiles as A, PropsCategory as B, apiActivityTracker as C, getAppMode as D, SuperblocksContextProvider as E, iframeMessageHandler as F, createPropertiesPanelDefinition as H, isEmbeddedBySuperblocksFirstParty as I, isEditMode as L, sendNotification as M, colors as N, useSuperblocksContext as O, editorBridge as P, createManagedPropsList as R, api_hmr_tracker_default as S, resolveById as T, getEditStore as U, Section as V, root_store_default as _, FixWithClarkButton as a, createIframeSpan as b, ErrorContent as c, ErrorMessage as d, ErrorStack as f, StyledClarkIcon as g, SecondaryButton as h, getWidgetRectAnchorName as i, useSuperblocksUser as j, useSuperblocksGroups as k, ErrorDetails as l, ErrorTitle as m, useJSXContext as n, ActionsContainer as o, ErrorSummary as p, getWidgetAnchorName as r, ErrorContainer as s, makeWrappedComponent as t, ErrorIconContainer as u, startEditorSync as v, rejectById as w, getContextFromTraceHeaders as x, generateId as y, Prop as z };
3675
- //# sourceMappingURL=jsx-wrapper-DrDoDS8j.js.map
3548
+ export { useSuperblocksUser as A, Section as B, rejectById as C, useSuperblocksContext as D, getAppMode as E, isEmbeddedBySuperblocksFirstParty as F, getEditStore as H, isEditMode as I, createManagedPropsList as L, colors as M, editorBridge as N, useSuperblocksGroups as O, iframeMessageHandler as P, Prop as R, api_hmr_tracker_default as S, SuperblocksContextProvider as T, createPropertiesPanelDefinition as V, root_store_default as _, FixWithClarkButton as a, createIframeSpan as b, ErrorContent as c, ErrorMessage as d, ErrorStack as f, StyledClarkIcon as g, SecondaryButton as h, getWidgetRectAnchorName as i, sendNotification as j, useSuperblocksProfiles as k, ErrorDetails as l, ErrorTitle as m, useJSXContext as n, ActionsContainer as o, ErrorSummary as p, getWidgetAnchorName as r, ErrorContainer as s, makeWrappedComponent as t, ErrorIconContainer as u, startEditorSync as v, resolveById as w, getContextFromTraceHeaders as x, generateId as y, PropsCategory as z };
3549
+ //# sourceMappingURL=jsx-wrapper-DT5FMME0.js.map