@superblocksteam/library 2.0.6-next.3 → 2.0.6-next.31

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 (32) hide show
  1. package/dist/{allPaths-CO-aWzss.js → allPaths-x2mqpZFN.js} +2 -2
  2. package/dist/{allPaths-CO-aWzss.js.map → allPaths-x2mqpZFN.js.map} +1 -1
  3. package/dist/{allPaths-BtYOw5Ru.js → allPaths-xFVQQD0y.js} +2 -2
  4. package/dist/{allPaths-BtYOw5Ru.js.map → allPaths-xFVQQD0y.js.map} +1 -1
  5. package/dist/{allPathsLoader-B3Ii4JGL.js → allPathsLoader-BRtFt6t5.js} +3 -3
  6. package/dist/{allPathsLoader-KDCEbuYo.js.map → allPathsLoader-BRtFt6t5.js.map} +1 -1
  7. package/dist/{allPathsLoader-KDCEbuYo.js → allPathsLoader-BcutVQcb.js} +3 -3
  8. package/dist/{allPathsLoader-B3Ii4JGL.js.map → allPathsLoader-BcutVQcb.js.map} +1 -1
  9. package/dist/{devtools-consolidated-B1B3uBW_.js → devtools-consolidated-Bx5_5I-I.js} +2 -2
  10. package/dist/{devtools-consolidated-B1B3uBW_.js.map → devtools-consolidated-Bx5_5I-I.js.map} +1 -1
  11. package/dist/{index-kjgG33Rg.js → index-CJnCDVsr.js} +325 -172
  12. package/dist/{index-kjgG33Rg.js.map → index-CJnCDVsr.js.map} +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/{splitPathsBySizeLoader-Btq5cpt-.js → splitPathsBySizeLoader-B6PtJR5E.js} +2 -2
  15. package/dist/{splitPathsBySizeLoader-Btq5cpt-.js.map → splitPathsBySizeLoader-B6PtJR5E.js.map} +1 -1
  16. package/dist/{splitPathsBySizeLoader-VThmaq3t.js → splitPathsBySizeLoader-BIQRx5NP.js} +2 -2
  17. package/dist/{splitPathsBySizeLoader-VThmaq3t.js.map → splitPathsBySizeLoader-BIQRx5NP.js.map} +1 -1
  18. package/dist-types/edit-mode/iframe-wrappers.d.ts +1 -0
  19. package/dist-types/edit-mode/source-update-api.d.ts +5 -0
  20. package/dist-types/edit-mode/superblocks-editor-bridge.d.ts +1 -0
  21. package/dist-types/lib/internal-details/is-sb-component.d.ts +5 -1
  22. package/dist-types/lib/internal-details/lib/types.d.ts +3 -0
  23. package/dist-types/lib/triggers/implementations/state/reset-state-var.d.ts +3 -3
  24. package/dist-types/lib/triggers/implementations/state/set-state-var.d.ts +3 -3
  25. package/dist-types/lib/triggers/implementations/timers/control-timer.d.ts +4 -3
  26. package/dist-types/lib/triggers/registry.d.ts +6 -6
  27. package/dist-types/lib/user-facing/build-manifest.d.ts +2 -0
  28. package/dist-types/lib/user-facing/components/grid/index.d.ts +7 -5
  29. package/dist-types/lib/user-facing/sb-event-flow.d.ts +2 -2
  30. package/dist-types/lib/user-facing/sb-provider.d.ts +1 -2
  31. package/package.json +3 -3
  32. package/dist-types/lib/user-facing/components/grid/utils.d.ts +0 -1
@@ -6005,7 +6005,7 @@ const Property = {
6005
6005
  Expression: (value) => PropertyInfo(value, "EXPRESSION"),
6006
6006
  Event: (value) => PropertyInfo(value, "EVENT"),
6007
6007
  Dimension: (value) => PropertyInfo(value, "DIMENSION"),
6008
- Computed: (value, args) => PropertyInfo(value, "COMPUTED", Array.isArray(args) && args.length > 0 ? { args } : {}),
6008
+ Computed: (value, args) => PropertyInfo(value, "COMPUTED", Array.isArray(args) && args.length > 0 || typeof args === "string" ? { args } : {}),
6009
6009
  Any: (value, type5 = "STATIC") => PropertyInfo(value, type5)
6010
6010
  };
6011
6011
  function isPropertyInfo(value) {
@@ -78418,7 +78418,7 @@ const ShowAlertTrigger = {
78418
78418
  const ResetStateVarTrigger = {
78419
78419
  type: TriggerStepType.RESET_STATE_VAR,
78420
78420
  async execute(context2, step) {
78421
- if (step.state === void 0) {
78421
+ if (step.variable === void 0) {
78422
78422
  return;
78423
78423
  }
78424
78424
  context2.rootStore.entityManager.runCode({
@@ -78426,22 +78426,22 @@ const ResetStateVarTrigger = {
78426
78426
  name: context2.name,
78427
78427
  func: () => {
78428
78428
  var _a2;
78429
- return (_a2 = step.state) == null ? void 0 : _a2.set(step.state.defaultValue);
78429
+ return (_a2 = step.variable) == null ? void 0 : _a2.set(step.variable.defaultValue);
78430
78430
  },
78431
78431
  args: []
78432
78432
  });
78433
78433
  },
78434
- create(stateVar) {
78434
+ create(variable) {
78435
78435
  return {
78436
78436
  type: TriggerStepType.RESET_STATE_VAR,
78437
- state: stateVar
78437
+ variable
78438
78438
  };
78439
78439
  }
78440
78440
  };
78441
78441
  const SetStateVarTrigger = {
78442
78442
  type: TriggerStepType.SET_STATE_VAR,
78443
78443
  async execute(context2, step) {
78444
- if (step.state === void 0) {
78444
+ if (step.variable === void 0) {
78445
78445
  return;
78446
78446
  }
78447
78447
  const value = context2.rootStore.entityManager.computeValue({
@@ -78455,15 +78455,15 @@ const SetStateVarTrigger = {
78455
78455
  func: (state, value2) => {
78456
78456
  var _a2;
78457
78457
  if (!state) return;
78458
- (_a2 = step.state) == null ? void 0 : _a2.set(value2);
78458
+ (_a2 = step.variable) == null ? void 0 : _a2.set(value2);
78459
78459
  },
78460
78460
  args: [value]
78461
78461
  });
78462
78462
  },
78463
- create(stateVar, value) {
78463
+ create(variable, value) {
78464
78464
  return {
78465
78465
  type: TriggerStepType.SET_STATE_VAR,
78466
- state: stateVar,
78466
+ variable,
78467
78467
  value
78468
78468
  };
78469
78469
  }
@@ -78471,12 +78471,14 @@ const SetStateVarTrigger = {
78471
78471
  const ControlTimerTrigger = {
78472
78472
  type: TriggerStepType.CONTROL_TIMER,
78473
78473
  async execute(_context, step) {
78474
- console.log("ControlTimerTrigger", step);
78474
+ if (step.timer) {
78475
+ step.timer[step.action]();
78476
+ }
78475
78477
  },
78476
- create(timerId, action2) {
78478
+ create(timer, action2) {
78477
78479
  return {
78478
78480
  type: TriggerStepType.CONTROL_TIMER,
78479
- timerId,
78481
+ timer,
78480
78482
  action: action2
78481
78483
  };
78482
78484
  }
@@ -83504,7 +83506,7 @@ function registerStores(stores) {
83504
83506
  internalStores = { ...internalStores, ...stores };
83505
83507
  if (SUPPORTED_MODES.includes("production")) {
83506
83508
  if (Object.keys(internalStores).length === Object.keys(stores).length) {
83507
- import("./devtools-consolidated-B1B3uBW_.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83509
+ import("./devtools-consolidated-Bx5_5I-I.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83508
83510
  setRegisteredStores(internalStores);
83509
83511
  initializeCustomDevTools();
83510
83512
  }).catch((error) => {
@@ -83517,7 +83519,7 @@ function registerStores(stores) {
83517
83519
  }
83518
83520
  }
83519
83521
  const DevToolsInternal = React__default.lazy(() => {
83520
- return import("./devtools-consolidated-B1B3uBW_.js").then((module2) => ({
83522
+ return import("./devtools-consolidated-Bx5_5I-I.js").then((module2) => ({
83521
83523
  default: module2.CustomDevTools
83522
83524
  }));
83523
83525
  });
@@ -83874,11 +83876,11 @@ class SbEventFlow {
83874
83876
  controlModal(modal, action2) {
83875
83877
  return this.addStep(EventRegistry.controlModal.create(modal, action2));
83876
83878
  }
83877
- static controlTimer(timerId, action2) {
83878
- return SbEventFlow.start().controlTimer(timerId, action2);
83879
+ static controlTimer(stateTimer, action2) {
83880
+ return SbEventFlow.start().controlTimer(stateTimer, action2);
83879
83881
  }
83880
- controlTimer(timerId, action2) {
83881
- return this.addStep(EventRegistry.controlTimer.create(timerId, action2));
83882
+ controlTimer(stateTimer, action2) {
83883
+ return this.addStep(EventRegistry.controlTimer.create(stateTimer, action2));
83882
83884
  }
83883
83885
  static runApis(apis, onSuccess, onError2) {
83884
83886
  return SbEventFlow.start().runApis(apis, onSuccess, onError2);
@@ -84970,6 +84972,12 @@ const _SuperblocksEditorBridge = class _SuperblocksEditorBridge {
84970
84972
  }
84971
84973
  });
84972
84974
  }
84975
+ socketError(message2) {
84976
+ this.sendImmediate({
84977
+ type: "socket/error",
84978
+ payload: { message: message2 }
84979
+ });
84980
+ }
84973
84981
  // Private implementation details
84974
84982
  queueMessage(message2) {
84975
84983
  if (!this.connectedToParent) {
@@ -85448,7 +85456,7 @@ class ApiManager {
85448
85456
  scopeId,
85449
85457
  this.apiNameToDepCandidates[apiName] ?? []
85450
85458
  );
85451
- const orchestratorUrl = `${this.baseUrl}v2/execute`;
85459
+ const orchestratorUrl = new URL("v2/execute", this.baseUrl).href;
85452
85460
  const events2 = [];
85453
85461
  await ((_a2 = this.rootStore.editStore) == null ? void 0 : _a2.operationManager.ensureFilesSynced());
85454
85462
  const abortController = new AbortController();
@@ -86150,24 +86158,50 @@ class OperationAPI {
86150
86158
  });
86151
86159
  this.serverUrl = serverUrl;
86152
86160
  }
86161
+ /**
86162
+ * @throws {Error} if the websocket connection can't be initiated after 3 attempts
86163
+ */
86153
86164
  async connect(peerId, userId) {
86154
- const socket = await connectSocket(this.serverUrl, {
86155
- peerId,
86156
- userId,
86157
- onClose: () => {
86158
- var _a2;
86159
- console.log("App<>Dev box Socket closed, retrying...");
86160
- (_a2 = rootStore.editStore) == null ? void 0 : _a2.connectionManager.disconnect();
86161
- if (this.retryAttempts < 3) {
86162
- this.connect(peerId, userId);
86163
- } else {
86164
- this.socket = void 0;
86165
- }
86166
- this.retryAttempts++;
86165
+ try {
86166
+ const socket = await connectSocket(this.serverUrl, {
86167
+ peerId,
86168
+ userId,
86169
+ onClose: this.handleSocketClose(peerId, userId)
86170
+ });
86171
+ this.retryAttempts = 0;
86172
+ this.socket = socket;
86173
+ } catch {
86174
+ this.retryAttempts++;
86175
+ console.info(
86176
+ `App<>Dev box initial connection failed, retrying attempt ${this.retryAttempts}...`
86177
+ );
86178
+ await this.retryConnection(peerId, userId);
86179
+ }
86180
+ }
86181
+ // Happens after initial connection
86182
+ handleSocketClose(peerId, userId) {
86183
+ return async () => {
86184
+ var _a2;
86185
+ console.info(
86186
+ `App<>Dev box Socket closed, retrying attempt ${this.retryAttempts + 1}...`
86187
+ );
86188
+ (_a2 = rootStore.editStore) == null ? void 0 : _a2.connectionManager.disconnect();
86189
+ await this.retryConnection(peerId, userId);
86190
+ if (this.retryAttempts >= 3) {
86191
+ this.socket = void 0;
86167
86192
  }
86168
- });
86169
- this.retryAttempts = 0;
86170
- this.socket = socket;
86193
+ this.retryAttempts++;
86194
+ };
86195
+ }
86196
+ async retryConnection(peerId, userId) {
86197
+ if (this.retryAttempts < 3) {
86198
+ await this.connect(peerId, userId);
86199
+ } else {
86200
+ console.info(
86201
+ `App<>Dev box Socket closed, failed to reconnect after 3 attempts. Throwing error.`
86202
+ );
86203
+ throw new Error("Failed to reconnect after 3 attempts");
86204
+ }
86171
86205
  }
86172
86206
  }
86173
86207
  const sourceUpdateApi = new OperationAPI(
@@ -86305,12 +86339,13 @@ async function connectSocket(serverUrl, {
86305
86339
  }
86306
86340
  );
86307
86341
  const socket = createISocketClient(isocket);
86342
+ console.log("connected to socket");
86308
86343
  (_b2 = rootStore.editStore) == null ? void 0 : _b2.connectionManager.connect();
86309
86344
  return socket;
86310
86345
  } catch (error) {
86311
86346
  console.error("Error connecting to socket", error);
86312
86347
  (_c2 = rootStore.editStore) == null ? void 0 : _c2.connectionManager.disconnect();
86313
- return void 0;
86348
+ throw error;
86314
86349
  }
86315
86350
  }
86316
86351
  _executeOrAddToBatch_dec = [action], _addPendingTransaction_dec = [action], _clearPendingTransactions_dec = [action], _batchUpdate_dec = [action], _createComponent_dec = [action], _dropComponent_dec = [action], _deleteComponents_dec = [action], _writeRuntimeProperties_dec = [action], _setWidgetProperties_dec = [action], _setWidgetProperty_dec = [action], _renameWidget_dec = [action];
@@ -86952,7 +86987,7 @@ function getPropertyValue$1({
86952
86987
  return property.value;
86953
86988
  }
86954
86989
  function getSbEventFlow(step, scopeId) {
86955
- var _a2, _b2, _c2, _d2, _e2, _f2;
86990
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
86956
86991
  if (!isValidStepDef(step)) {
86957
86992
  return void 0;
86958
86993
  }
@@ -87025,27 +87060,33 @@ function getSbEventFlow(step, scopeId) {
87025
87060
  return SbEventFlow.controlModal(modalEntity, step.direction);
87026
87061
  }
87027
87062
  case "controlTimer": {
87028
- const timerEntity = getEntity(step.name);
87063
+ const timerStep = step;
87064
+ if (!((_a2 = timerStep.timer) == null ? void 0 : _a2.name)) {
87065
+ return void 0;
87066
+ }
87067
+ const timerEntity = getEntity(timerStep.timer.name);
87029
87068
  if (!timerEntity) return void 0;
87030
- return SbEventFlow.controlTimer(step.name, step.command);
87069
+ return SbEventFlow.controlTimer(timerEntity, step.command ?? "start");
87031
87070
  }
87032
87071
  case "setStateVar": {
87033
- const stateEntity = getEntity((_a2 = step.state) == null ? void 0 : _a2.name);
87072
+ const variableStep = step;
87073
+ const stateEntity = getEntity((_b2 = variableStep.variable) == null ? void 0 : _b2.name);
87034
87074
  if (!stateEntity) return void 0;
87035
- const value = isPropertyInfo(step.value) ? getPropertyValue$1({
87036
- property: step.value,
87075
+ const value = isPropertyInfo(variableStep.value) ? getPropertyValue$1({
87076
+ property: variableStep.value,
87037
87077
  scopeId,
87038
- name: getName((_b2 = step.state) == null ? void 0 : _b2.name)
87078
+ name: getName((_c2 = variableStep.variable) == null ? void 0 : _c2.name)
87039
87079
  }) : step.value;
87040
87080
  return SbEventFlow.setStateVar(stateEntity, value);
87041
87081
  }
87042
87082
  case "resetStateVar": {
87043
- const resetStateEntity = getEntity((_c2 = step.state) == null ? void 0 : _c2.name);
87083
+ const variableStep = step;
87084
+ const resetStateEntity = getEntity((_d2 = variableStep.variable) == null ? void 0 : _d2.name);
87044
87085
  if (!resetStateEntity) return void 0;
87045
87086
  return SbEventFlow.resetStateVar(resetStateEntity);
87046
87087
  }
87047
87088
  case "resetComponent": {
87048
- const resetWidgetEntity = getEntity((_d2 = step.widget) == null ? void 0 : _d2.name);
87089
+ const resetWidgetEntity = getEntity((_e2 = step.widget) == null ? void 0 : _e2.name);
87049
87090
  if (!resetWidgetEntity) return void 0;
87050
87091
  return SbEventFlow.resetComponent(
87051
87092
  step.widget,
@@ -87054,7 +87095,7 @@ function getSbEventFlow(step, scopeId) {
87054
87095
  );
87055
87096
  }
87056
87097
  case "setComponentProperty": {
87057
- const setWidgetEntity = getEntity((_e2 = step.widget) == null ? void 0 : _e2.name);
87098
+ const setWidgetEntity = getEntity((_f2 = step.widget) == null ? void 0 : _f2.name);
87058
87099
  if (!setWidgetEntity) return void 0;
87059
87100
  return SbEventFlow.setComponentProperty(
87060
87101
  step.widget,
@@ -87072,7 +87113,7 @@ function getSbEventFlow(step, scopeId) {
87072
87113
  case "setProfile":
87073
87114
  return SbEventFlow.setProfile(step.profileId, step.profileAction);
87074
87115
  case "triggerEvent":
87075
- return SbEventFlow.triggerEvent((_f2 = step.event) == null ? void 0 : _f2.name, step.eventPayload);
87116
+ return SbEventFlow.triggerEvent((_g2 = step.event) == null ? void 0 : _g2.name, step.eventPayload);
87076
87117
  default:
87077
87118
  console.warn("Unhandled runtime step type", step.type);
87078
87119
  return void 0;
@@ -91039,14 +91080,14 @@ function getLoaderFn$1(options) {
91039
91080
  if (!(loader === "all")) return [3, 3];
91040
91081
  return [4, import(
91041
91082
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
91042
- "./allPathsLoader-KDCEbuYo.js"
91083
+ "./allPathsLoader-BRtFt6t5.js"
91043
91084
  )];
91044
91085
  case 2:
91045
91086
  return [2, _b2.sent().allPathsLoader];
91046
91087
  case 3:
91047
91088
  return [4, import(
91048
91089
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
91049
- "./splitPathsBySizeLoader-VThmaq3t.js"
91090
+ "./splitPathsBySizeLoader-BIQRx5NP.js"
91050
91091
  )];
91051
91092
  case 4:
91052
91093
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -111681,14 +111722,18 @@ const ReactiveComponent = observer(function Component2({
111681
111722
  const reactiveProps = useShallowMobxObserver(safeProps);
111682
111723
  const stylePropWithSize = useStyleWithSize(reactiveProps);
111683
111724
  const styleProp = useMemo$2(() => {
111725
+ const styleWithOverflow = {
111726
+ overflow: "auto",
111727
+ ...stylePropWithSize
111728
+ };
111684
111729
  if (reactiveProps.isVisible === false) {
111685
111730
  const existingOpacity = lodashExports.isNumber(stylePropWithSize.opacity) ? stylePropWithSize.opacity : 1;
111686
111731
  return {
111687
- ...stylePropWithSize,
111732
+ ...styleWithOverflow,
111688
111733
  opacity: existingOpacity * INVISIBLE_OPACITY
111689
111734
  };
111690
111735
  }
111691
- return stylePropWithSize;
111736
+ return styleWithOverflow;
111692
111737
  }, [reactiveProps.isVisible, stylePropWithSize]);
111693
111738
  const { setStyle, getFallbackStyle } = useComponentSuspenseStyle();
111694
111739
  useEffect(() => {
@@ -111848,28 +111893,52 @@ const size$2 = ({
111848
111893
  controlType: "WIDTH_DROPDOWN",
111849
111894
  defaultValue: defaults2 == null ? void 0 : defaults2.minWidth,
111850
111895
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.minWidth,
111851
- isVisible: showMinWidth
111896
+ isVisible: function(s3) {
111897
+ var _a2;
111898
+ const hideWidth = ((_a2 = this == null ? void 0 : this.width) == null ? void 0 : _a2.mode) === "px";
111899
+ return Boolean(
111900
+ (showMinWidth ? showMinWidth == null ? void 0 : showMinWidth.call(this, s3) : true) && !hideWidth
111901
+ );
111902
+ }
111852
111903
  });
111853
111904
  const maxWidthProperty = getSizeProp({
111854
111905
  label: "Max width",
111855
111906
  controlType: "WIDTH_DROPDOWN",
111856
111907
  defaultValue: defaults2 == null ? void 0 : defaults2.maxWidth,
111857
111908
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.maxWidth,
111858
- isVisible: showMaxWidth
111909
+ isVisible: function(s3) {
111910
+ var _a2;
111911
+ const hideWidth = ((_a2 = this == null ? void 0 : this.width) == null ? void 0 : _a2.mode) === "px";
111912
+ return Boolean(
111913
+ (showMaxWidth ? showMaxWidth == null ? void 0 : showMaxWidth.call(this, s3) : true) && !hideWidth
111914
+ );
111915
+ }
111859
111916
  });
111860
111917
  const minHeightProperty = getSizeProp({
111861
111918
  label: "Min height",
111862
111919
  controlType: "HEIGHT_DROPDOWN",
111863
111920
  defaultValue: defaults2 == null ? void 0 : defaults2.minHeight,
111864
111921
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.minHeight,
111865
- isVisible: showMinHeight
111922
+ isVisible: function(s3) {
111923
+ var _a2;
111924
+ const hideHeight = ((_a2 = this == null ? void 0 : this.height) == null ? void 0 : _a2.mode) === "px";
111925
+ return Boolean(
111926
+ (showMinHeight ? showMinHeight == null ? void 0 : showMinHeight.call(this, s3) : true) && !hideHeight
111927
+ );
111928
+ }
111866
111929
  });
111867
111930
  const maxHeightProperty = getSizeProp({
111868
111931
  label: "Max height",
111869
111932
  controlType: "HEIGHT_DROPDOWN",
111870
111933
  defaultValue: defaults2 == null ? void 0 : defaults2.maxHeight,
111871
111934
  defaultOnAdd: defaultsOnAdd == null ? void 0 : defaultsOnAdd.maxHeight,
111872
- isVisible: showMaxHeight
111935
+ isVisible: function(s3) {
111936
+ var _a2;
111937
+ const hideHeight = ((_a2 = this == null ? void 0 : this.height) == null ? void 0 : _a2.mode) === "px";
111938
+ return Boolean(
111939
+ (showMaxHeight ? showMaxHeight == null ? void 0 : showMaxHeight.call(this, s3) : true) && !hideHeight
111940
+ );
111941
+ }
111873
111942
  });
111874
111943
  let heightProperty = Prop.dimension().readAndWrite().propertiesPanel({
111875
111944
  label: "Height",
@@ -117530,12 +117599,18 @@ const AddSectionButton = ({
117530
117599
  sectionInstanceId
117531
117600
  }) => {
117532
117601
  const indexForNewSection = placement === "above" ? indexForBaseSection : indexForBaseSection + 1;
117533
- const createSection = useCallback(() => {
117534
- createComponent({
117602
+ const createSection = useCallback(async () => {
117603
+ const newSectionSourceId = await createComponent({
117535
117604
  componentType: "SbSection",
117536
117605
  parent: { id: sectionParentSourceId, index: indexForNewSection },
117537
117606
  scopeName: sectionParentScopeName
117538
117607
  });
117608
+ if (newSectionSourceId) {
117609
+ const newSectionInstanceId = getEditStore().runtimeEntitiesManager.widgets.getAnyInstanceIdForSourceId(
117610
+ newSectionSourceId
117611
+ );
117612
+ getEditStore().ui.selectWidget(newSectionInstanceId);
117613
+ }
117539
117614
  }, [sectionParentSourceId, indexForNewSection, sectionParentScopeName]);
117540
117615
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
117541
117616
  Wrapper$2,
@@ -119823,22 +119898,13 @@ const getStackChildStyle = ({
119823
119898
  (childProps == null ? void 0 : childProps.type) ?? ""
119824
119899
  ) ? Dim.fit() : Dim.fill());
119825
119900
  const widthCss = childCount === 1 && (width == null ? void 0 : width.mode) === "fill" && (parentWidth == null ? void 0 : parentWidth.mode) !== "fit" ? { width: "100%" } : dimToCSS(width, "width", primary === "width");
119826
- const minWidthCss = getMinMaxCss(
119827
- childProps == null ? void 0 : childProps.minWidth,
119828
- "minWidth"
119829
- );
119830
- const maxWidthCss = getMinMaxCss(
119831
- childProps == null ? void 0 : childProps.maxWidth,
119832
- "maxWidth"
119833
- );
119834
- const minHeightCss = getMinMaxCss(
119835
- childProps == null ? void 0 : childProps.minHeight,
119836
- "minHeight"
119837
- );
119838
- const maxHeightCss = getMinMaxCss(
119839
- childProps == null ? void 0 : childProps.maxHeight,
119840
- "maxHeight"
119841
- );
119901
+ const widthInPx = (width == null ? void 0 : width.mode) === "px";
119902
+ const heightInPx = (height == null ? void 0 : height.mode) === "px";
119903
+ const shouldNotShrink = widthInPx && primary === "width" || heightInPx && primary === "height";
119904
+ const minWidthCss = widthInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.minWidth, "minWidth");
119905
+ const maxWidthCss = widthInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.maxWidth, "maxWidth");
119906
+ const minHeightCss = heightInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.minHeight, "minHeight");
119907
+ const maxHeightCss = heightInPx ? {} : getMinMaxCss(childProps == null ? void 0 : childProps.maxHeight, "maxHeight");
119842
119908
  const margin2 = (childProps == null ? void 0 : childProps.margin) ?? {
119843
119909
  top: Dim.px(0),
119844
119910
  bottom: Dim.px(0),
@@ -119848,6 +119914,7 @@ const getStackChildStyle = ({
119848
119914
  const marginCss = { margin: generatePaddingStyle(margin2) };
119849
119915
  const stickyCss = (childProps == null ? void 0 : childProps.sticky) ? { position: "sticky", top: "0px", zIndex: Layers$1.stickySections } : {};
119850
119916
  const style2 = {
119917
+ ...shouldNotShrink ? { flexShrink: 0 } : {},
119851
119918
  ...heightCss,
119852
119919
  ...widthCss,
119853
119920
  ...minHeightCss,
@@ -120058,20 +120125,16 @@ const generateClassName = (seed2) => {
120058
120125
  return `superblocks_widget_${seed2}`;
120059
120126
  };
120060
120127
  const getCanvasClassName = () => "canvas";
120061
- const getChildName = (child) => {
120062
- var _a2;
120063
- return ((_a2 = getBindingIdentifier(child.props.bind)) == null ? void 0 : _a2.entityName) ?? child.props[WIDGET_SOURCE_ID_ATTRIBUTE];
120064
- };
120065
120128
  const calculateRowPositions = (orderedNames, childrenArray, rowHeight, pxHeights) => {
120066
120129
  return orderedNames.reduce(
120067
120130
  (acc, name) => {
120068
120131
  var _a2;
120069
- const child = childrenArray.find((child2) => getChildName(child2) === name);
120132
+ const child = childrenArray.find((child2) => child2.name === name);
120070
120133
  if (!child) {
120071
120134
  return acc;
120072
120135
  }
120073
- const marginTopPx = (((_a2 = child.props.marginTop) == null ? void 0 : _a2.value) ?? 0) * rowHeight;
120074
- const constraintTop = child.props.constraintTop;
120136
+ const marginTopPx = (((_a2 = child.marginTop) == null ? void 0 : _a2.value) ?? 0) * rowHeight;
120137
+ const constraintTop = child.constraintTop;
120075
120138
  const bottomFunc = (name2) => {
120076
120139
  const topRow = acc[name2];
120077
120140
  const pxHeight = pxHeights[name2];
@@ -120096,16 +120159,16 @@ const calculateRowPositions = (orderedNames, childrenArray, rowHeight, pxHeights
120096
120159
  const orderConstraints = (children) => {
120097
120160
  const childrenMap = children.reduce(
120098
120161
  (acc, child) => {
120099
- acc[getChildName(child)] = child;
120162
+ acc[child.name] = child;
120100
120163
  return acc;
120101
120164
  },
120102
120165
  {}
120103
120166
  );
120104
120167
  const constraintsMap = children.reduce(
120105
120168
  (acc, child) => {
120106
- if (child.props.constraintTop) {
120107
- const constraints = Array.isArray(child.props.constraintTop) ? child.props.constraintTop : [child.props.constraintTop];
120108
- acc[getChildName(child)] = constraints.filter(
120169
+ if (child.constraintTop) {
120170
+ const constraints = Array.isArray(child.constraintTop) ? child.constraintTop : [child.constraintTop];
120171
+ acc[child.name] = constraints.filter(
120109
120172
  (constraint) => !!childrenMap[constraint]
120110
120173
  );
120111
120174
  }
@@ -120117,24 +120180,24 @@ const orderConstraints = (children) => {
120117
120180
  const foundItems = /* @__PURE__ */ new Set();
120118
120181
  const itemsLeft = /* @__PURE__ */ new Set();
120119
120182
  children.forEach((child) => {
120120
- const constraints = constraintsMap[getChildName(child)] ?? [];
120183
+ const constraints = constraintsMap[child.name] ?? [];
120121
120184
  const hasNoConstraints = constraints.length === 0;
120122
120185
  if (hasNoConstraints) {
120123
- foundItems.add(getChildName(child));
120124
- orderedNames.push(getChildName(child));
120186
+ foundItems.add(child.name);
120187
+ orderedNames.push(child.name);
120125
120188
  } else {
120126
120189
  itemsLeft.add(child);
120127
120190
  }
120128
120191
  });
120129
120192
  while (itemsLeft.size > 0) {
120130
120193
  itemsLeft.forEach((child) => {
120131
- const constraints = constraintsMap[getChildName(child)] ?? [];
120194
+ const constraints = constraintsMap[child.name] ?? [];
120132
120195
  const constraintsLeft = constraints.filter(
120133
120196
  (constraint) => !foundItems.has(constraint)
120134
120197
  );
120135
120198
  if (constraintsLeft.length === 0) {
120136
- foundItems.add(getChildName(child));
120137
- orderedNames.push(getChildName(child));
120199
+ foundItems.add(child.name);
120200
+ orderedNames.push(child.name);
120138
120201
  itemsLeft.delete(child);
120139
120202
  }
120140
120203
  });
@@ -120185,99 +120248,141 @@ const heightReducer = (state, action2) => {
120185
120248
  }
120186
120249
  };
120187
120250
  const EMPTY_ARRAY$1 = [];
120188
- const InternalGrid = ({
120189
- children = EMPTY_ARRAY$1,
120190
- ...props2
120191
- }) => {
120192
- var _a2, _b2;
120193
- const isEditing = Boolean((_a2 = rootStore.editStore) == null ? void 0 : _a2.isInitialized);
120194
- const { style: style2, ...passThroughProps } = usePassthroughProps(props2);
120195
- const rowHeight = ((_b2 = props2.rowHeight) == null ? void 0 : _b2.value) ?? 12;
120196
- const childrenArray = useMemo$2(() => {
120197
- let childrenArray2 = Array.isArray(children) ? children : [children];
120198
- if (!isEditing) {
120199
- childrenArray2 = childrenArray2.filter(
120200
- (child) => child.props.isVisible !== false
120201
- );
120202
- }
120203
- return childrenArray2;
120204
- }, [children, isEditing]);
120205
- const columns = props2.columns ?? 12;
120206
- const [pxHeights, dispatchHeight] = React__default.useReducer(heightReducer, {});
120207
- const gridPositions = useMemo$2(() => {
120208
- const orderedNames = orderConstraints(childrenArray);
120209
- const rowPos = calculateRowPositions(
120210
- orderedNames,
120211
- childrenArray,
120212
- rowHeight,
120213
- pxHeights
120214
- );
120215
- const positions = childrenArray.reduce(
120216
- (acc, child) => {
120217
- var _a3, _b3, _c2;
120218
- let width = ((_a3 = child.props.width) == null ? void 0 : _a3.value) ?? (child.type.sbType === "SbTable" || child.type.sbType === "SbContainer" ? 6 : 2);
120219
- if (((_b3 = child.props.width) == null ? void 0 : _b3.mode) === "fill") {
120220
- width = columns;
120221
- }
120222
- acc[getChildName(child)] = {
120223
- top: rowPos[getChildName(child)],
120224
- left: ((_c2 = child.props.marginLeft) == null ? void 0 : _c2.value) ?? 0,
120225
- width,
120226
- height: Math.ceil(pxHeights[getChildName(child)] / rowHeight)
120227
- };
120228
- return acc;
120229
- },
120230
- {}
120231
- );
120232
- return positions;
120233
- }, [columns, childrenArray, rowHeight, pxHeights]);
120234
- const gridStyle = React__default.useMemo(() => {
120235
- const spacingValue = 0;
120236
- const columnsSize = `calc(${100 / columns}% - ${(columns - 1) * spacingValue / columns}px)`;
120237
- return {
120238
- display: "grid",
120239
- gridAutoRows: `${rowHeight}px`,
120240
- gap: `${spacingValue}px`,
120241
- gridTemplateColumns: `repeat(${columns}, ${columnsSize})`,
120242
- ...style2
120243
- };
120244
- }, [columns, rowHeight, style2]);
120245
- return /* @__PURE__ */ jsxRuntimeExports.jsx(DragDisplay, { passThroughProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: gridStyle, className: props2.className, children: childrenArray.map((child) => {
120246
- var _a3, _b3;
120247
- const heightMode = ((_a3 = child.props.height) == null ? void 0 : _a3.mode) ?? "fit";
120248
- const top2 = gridPositions[getChildName(child)].top;
120249
- const left2 = gridPositions[getChildName(child)].left;
120250
- const rows = gridPositions[getChildName(child)].height;
120251
- const columns2 = gridPositions[getChildName(child)].width;
120251
+ const GridChild = observer(
120252
+ ({
120253
+ childProps,
120254
+ gridPositions,
120255
+ rowHeight,
120256
+ dispatchHeight,
120257
+ childElement
120258
+ }) => {
120259
+ var _a2, _b2;
120260
+ const heightMode = ((_a2 = childProps.height) == null ? void 0 : _a2.mode) ?? "fit";
120261
+ const top2 = gridPositions[childProps.name].top;
120262
+ const left2 = gridPositions[childProps.name].left;
120263
+ const rows = gridPositions[childProps.name].height;
120264
+ const columns = gridPositions[childProps.name].width;
120252
120265
  const Component3 = heightMode === "fit" ? MeasuredComponent : StaticComponent;
120253
120266
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
120254
120267
  "div",
120255
120268
  {
120256
120269
  style: {
120257
120270
  gridRow: `${top2 + 1} / span ${Math.max(1, rows)}`,
120258
- gridColumn: `${left2 + 1} / span ${Math.max(1, columns2)}`,
120271
+ gridColumn: `${left2 + 1} / span ${Math.max(1, columns)}`,
120259
120272
  width: "100%",
120260
120273
  maxWidth: "100%"
120261
120274
  },
120262
120275
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
120263
120276
  Component3,
120264
120277
  {
120265
- staticHeight: (((_b3 = child.props.height) == null ? void 0 : _b3.value) ?? 0) * rowHeight,
120278
+ staticHeight: (((_b2 = childProps.height) == null ? void 0 : _b2.value) ?? 0) * rowHeight,
120266
120279
  onHeightChanged: (height) => {
120267
120280
  dispatchHeight({
120268
120281
  type: "SET_HEIGHT",
120269
- name: getChildName(child),
120282
+ name: childProps.name,
120270
120283
  height
120271
120284
  });
120272
120285
  },
120273
- children: child
120286
+ children: childElement
120274
120287
  }
120275
120288
  )
120276
120289
  },
120277
- getChildName(child)
120290
+ childProps.name
120278
120291
  );
120279
- }) }) });
120280
- };
120292
+ }
120293
+ );
120294
+ const InternalGrid = observer(
120295
+ ({ children = EMPTY_ARRAY$1, ...props2 }) => {
120296
+ var _a2;
120297
+ const { style: style2, ...passThroughProps } = usePassthroughProps(props2);
120298
+ const rowHeight = ((_a2 = props2.rowHeight) == null ? void 0 : _a2.value) ?? 12;
120299
+ const childrenArray = useObserverMemo(() => {
120300
+ var _a3;
120301
+ const childrenArray2 = Array.isArray(children) ? children : [children];
120302
+ const isEditing = Boolean((_a3 = rootStore.editStore) == null ? void 0 : _a3.isInitialized);
120303
+ const withEvaluatedProps = childrenArray2.reduce((acc, child) => {
120304
+ const bindingIdentifier = getBindingIdentifier(child.props.bind);
120305
+ const entity = bindingIdentifier ? rootStore.entityManager.getEntity(bindingIdentifier.scopeId, {
120306
+ value: bindingIdentifier.entityName,
120307
+ isAnonymous: false
120308
+ }) : null;
120309
+ const marginTop = (entity == null ? void 0 : entity.marginTop) ?? (isDimension(child.props.marginTop) ? child.props.marginTop : void 0);
120310
+ const marginLeft = (entity == null ? void 0 : entity.marginLeft) ?? (isDimension(child.props.marginLeft) ? child.props.marginLeft : void 0);
120311
+ const width = (entity == null ? void 0 : entity.width) ?? (isDimension(child.props.width) ? child.props.width : void 0);
120312
+ const height = (entity == null ? void 0 : entity.height) ?? (isDimension(child.props.height) ? child.props.height : void 0);
120313
+ const constraintTop = (entity == null ? void 0 : entity.constraintTop) ?? child.props.constraintTop;
120314
+ const isVisible2 = (entity == null ? void 0 : entity.isVisible) ?? child.props.isVisible;
120315
+ const gridChild = {
120316
+ marginTop,
120317
+ marginLeft,
120318
+ width,
120319
+ height,
120320
+ constraintTop,
120321
+ name: (bindingIdentifier == null ? void 0 : bindingIdentifier.entityName) ?? child.props[WIDGET_SOURCE_ID_ATTRIBUTE],
120322
+ // source ID as a fallback
120323
+ sbType: isSbComponent(child) ? child.type.sbType : void 0,
120324
+ element: child
120325
+ };
120326
+ if (isVisible2 !== false || isEditing) {
120327
+ acc.push(gridChild);
120328
+ }
120329
+ return acc;
120330
+ }, []);
120331
+ return withEvaluatedProps;
120332
+ }, [children]);
120333
+ const columns = props2.columns ?? 12;
120334
+ const [pxHeights, dispatchHeight] = React__default.useReducer(heightReducer, {});
120335
+ const gridPositions = useMemo$2(() => {
120336
+ const orderedNames = orderConstraints(childrenArray);
120337
+ const rowPos = calculateRowPositions(
120338
+ orderedNames,
120339
+ childrenArray,
120340
+ rowHeight,
120341
+ pxHeights
120342
+ );
120343
+ const positions = childrenArray.reduce(
120344
+ (acc, child) => {
120345
+ var _a3, _b2, _c2;
120346
+ let width = ((_a3 = child.width) == null ? void 0 : _a3.value) ?? (child.sbType === "SbTable" || child.sbType === "SbContainer" ? 6 : 2);
120347
+ if (((_b2 = child.width) == null ? void 0 : _b2.mode) === "fill") {
120348
+ width = columns;
120349
+ }
120350
+ acc[child.name] = {
120351
+ top: rowPos[child.name],
120352
+ left: ((_c2 = child.marginLeft) == null ? void 0 : _c2.value) ?? 0,
120353
+ width,
120354
+ height: Math.ceil(pxHeights[child.name] / rowHeight)
120355
+ };
120356
+ return acc;
120357
+ },
120358
+ {}
120359
+ );
120360
+ return positions;
120361
+ }, [columns, childrenArray, rowHeight, pxHeights]);
120362
+ const gridStyle = React__default.useMemo(() => {
120363
+ const spacingValue = 0;
120364
+ const columnsSize = `calc(${100 / columns}% - ${(columns - 1) * spacingValue / columns}px)`;
120365
+ return {
120366
+ display: "grid",
120367
+ gridAutoRows: `${rowHeight}px`,
120368
+ gap: `${spacingValue}px`,
120369
+ gridTemplateColumns: `repeat(${columns}, ${columnsSize})`,
120370
+ ...style2
120371
+ };
120372
+ }, [columns, rowHeight, style2]);
120373
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(DragDisplay, { passThroughProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: gridStyle, className: props2.className, children: childrenArray.map((child) => /* @__PURE__ */ jsxRuntimeExports.jsx(
120374
+ GridChild,
120375
+ {
120376
+ childProps: child,
120377
+ childElement: child.element,
120378
+ gridPositions,
120379
+ rowHeight,
120380
+ dispatchHeight
120381
+ },
120382
+ child.name
120383
+ )) }) });
120384
+ }
120385
+ );
120281
120386
  const DragDisplay = (props2) => {
120282
120387
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
120283
120388
  "div",
@@ -145512,14 +145617,14 @@ function getLoaderFn(options) {
145512
145617
  if (!(loader === "all")) return [3, 3];
145513
145618
  return [4, import(
145514
145619
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
145515
- "./allPathsLoader-B3Ii4JGL.js"
145620
+ "./allPathsLoader-BcutVQcb.js"
145516
145621
  )];
145517
145622
  case 2:
145518
145623
  return [2, _b2.sent().allPathsLoader];
145519
145624
  case 3:
145520
145625
  return [4, import(
145521
145626
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
145522
- "./splitPathsBySizeLoader-Btq5cpt-.js"
145627
+ "./splitPathsBySizeLoader-B6PtJR5E.js"
145523
145628
  )];
145524
145629
  case 4:
145525
145630
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -162715,7 +162820,7 @@ const propertiesDefinition$9 = {
162715
162820
  placeholder: '[{ "col1": "val1" }]',
162716
162821
  isJSConvertible: false,
162717
162822
  helpText: "Takes in an array of objects to display rows in the table. Bind data from an API using {{}}",
162718
- controlType: "COMPUTED_CODE_EDITOR"
162823
+ controlType: "FUNCTION_CODE_EDITOR"
162719
162824
  }),
162720
162825
  // do not let users set the id property
162721
162826
  // id is managed internally by the table (it's always the key of the column)
@@ -162752,11 +162857,12 @@ const propertiesDefinition$9 = {
162752
162857
  helpText: "Enable per column filtering"
162753
162858
  }),
162754
162859
  defaultFilters: Prop.any().readAndWrite().propertiesPanel({
162755
- controlType: "COMPUTED_CODE_EDITOR",
162860
+ controlType: "FUNCTION_CODE_EDITOR",
162756
162861
  label: "Default filters",
162757
162862
  visibility: "SHOW_NAME",
162758
162863
  isJSConvertible: false,
162759
162864
  isRemovable: true,
162865
+ defaultOnAdd: () => Property.Computed(""),
162760
162866
  helpText: "Allows specifying the filters that will be used on page load",
162761
162867
  isVisible: function() {
162762
162868
  return this.isFilterable && this.pageType !== "server-side";
@@ -162833,6 +162939,8 @@ const propertiesDefinition$9 = {
162833
162939
  label: "Default sort",
162834
162940
  helpText: "Allows specifying the sort options that will be used on page load",
162835
162941
  controlType: "DEFAULT_TABLE_SORT",
162942
+ isRemovable: true,
162943
+ visibility: "SHOW_NAME",
162836
162944
  childrenDisplayMode: {
162837
162945
  type: "popover",
162838
162946
  title: "Default sort"
@@ -162841,6 +162949,8 @@ const propertiesDefinition$9 = {
162841
162949
  defaultSearchText: Prop.string().readAndWrite().propertiesPanel({
162842
162950
  label: "Default search",
162843
162951
  helpText: "Sets the default search text",
162952
+ isRemovable: true,
162953
+ visibility: "SHOW_NAME",
162844
162954
  isVisible: function() {
162845
162955
  return this.enableClientSideSearch !== false;
162846
162956
  }
@@ -182001,7 +182111,7 @@ const propertiesDefinition$8 = {
182001
182111
  isJSConvertible: false,
182002
182112
  helpText: "Allows users to select either a single option or multiple options. Values must be unique.",
182003
182113
  placeholder: "[{label: 'Option 1', value: 'option1'}]",
182004
- controlType: "COMPUTED_CODE_EDITOR"
182114
+ controlType: "FUNCTION_CODE_EDITOR"
182005
182115
  }),
182006
182116
  defaultOptionValue: Prop.string().propertiesPanel({
182007
182117
  label: "Default selected value",
@@ -183845,8 +183955,8 @@ const SbVariable = registerSbEntity(
183845
183955
  );
183846
183956
  const propertiesDefinition$1 = {
183847
183957
  general: Section.category(PropsPanelCategory.Uncategorized).propertiesPanel({ showHeader: false }).children({
183848
- intervalMs: Prop.number().default(3e5).readAndWrite().propertiesPanel({
183849
- label: "Interval (ms)",
183958
+ intervalMs: Prop.number().default(300).readAndWrite().propertiesPanel({
183959
+ label: "Interval",
183850
183960
  helpText: "Sets the interval of the timer",
183851
183961
  placeholder: "1000",
183852
183962
  isJSConvertible: false,
@@ -184638,6 +184748,7 @@ function listenForUrlChange() {
184638
184748
  return observer2;
184639
184749
  }
184640
184750
  const IframeConnected = observer(function IframeConnected2(props2) {
184751
+ var _a2;
184641
184752
  useEffect(() => {
184642
184753
  if (!isEmbeddedBySuperblocksFirstParty()) {
184643
184754
  return;
@@ -184647,7 +184758,18 @@ const IframeConnected = observer(function IframeConnected2(props2) {
184647
184758
  editStore.setIsInitialized(true);
184648
184759
  editorBridge.connected();
184649
184760
  rootStore.setEditStore(editStore);
184650
- await sourceUpdateApi.connect(data2.payload.peerId, data2.payload.userId);
184761
+ try {
184762
+ await sourceUpdateApi.connect(data2.payload.peerId, data2.payload.userId);
184763
+ } catch (error) {
184764
+ console.error(
184765
+ "Error connecting to internal socket from library",
184766
+ error
184767
+ );
184768
+ editorBridge.socketError(
184769
+ "Error connecting to the remote dev server, please refresh the page"
184770
+ );
184771
+ return;
184772
+ }
184651
184773
  editorBridge.updatePropertiesPanels(
184652
184774
  editStore.propertiesPanelManager.getNonDynamicPropertiesPanels()
184653
184775
  );
@@ -184676,6 +184798,10 @@ const IframeConnected = observer(function IframeConnected2(props2) {
184676
184798
  };
184677
184799
  }, []);
184678
184800
  const isPossiblyEditor = useMemo$2(isEmbeddedBySuperblocksFirstParty, []);
184801
+ const connectionStatus = (_a2 = rootStore.editStore) == null ? void 0 : _a2.connectionManager.connectionStatus;
184802
+ if (connectionStatus === "pre-init" || connectionStatus === "connecting") {
184803
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
184804
+ }
184679
184805
  if (isPossiblyEditor && editStore.isInitialized && typeof window !== "undefined") {
184680
184806
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(DnDProvider, { children: [
184681
184807
  /* @__PURE__ */ jsxRuntimeExports.jsx(NewComponentsDragLayer, {}),
@@ -186705,14 +186831,38 @@ console.log = (...args) => {
186705
186831
  } catch {
186706
186832
  }
186707
186833
  };
186834
+ const loadApisIntoLibrary = async function loadApisIntoLibrary2() {
186835
+ var _a2, _b2;
186836
+ {
186837
+ try {
186838
+ const mod2 = await import("./user-facing/build-manifest.js");
186839
+ const apis = ((_a2 = mod2.default) == null ? void 0 : _a2.apis) ?? {};
186840
+ const apiDependencies = ((_b2 = mod2.default) == null ? void 0 : _b2.apiDependencies) ?? [];
186841
+ rootStore.apis.setAllApis(apis);
186842
+ apiDependencies.forEach((dep) => {
186843
+ rootStore.apis.setApiDepCandidates(dep.apiName, dep.params);
186844
+ rootStore.apis.setApiReferences(dep.apiName, dep.dependencies);
186845
+ });
186846
+ } catch (error) {
186847
+ console.error("Error loading apis into library", error);
186848
+ }
186849
+ }
186850
+ };
186708
186851
  const SbProvider = function SbProvider2({
186709
186852
  name = "codemode",
186710
186853
  settings,
186711
- preloadedData,
186712
186854
  children
186713
186855
  }) {
186714
186856
  var _a2, _b2;
186715
186857
  const isEmbedded = typeof window !== "undefined" && window.parent !== window.self;
186858
+ const [isApisInitialized, setIsApisInitialized] = useState(false);
186859
+ const runApiInitialization = useCallback(async () => {
186860
+ await loadApisIntoLibrary();
186861
+ setIsApisInitialized(true);
186862
+ }, []);
186863
+ useEffect(() => {
186864
+ runApiInitialization();
186865
+ }, [runApiInitialization]);
186716
186866
  const [userAccessibleTheme, setUserAccessibleTheme] = useState(DEFAULT_THEME);
186717
186867
  useEffect(() => {
186718
186868
  const mergedTheme = lodashExports.merge(BASE_THEME_V5, settings == null ? void 0 : settings.theme);
@@ -186724,7 +186874,10 @@ const SbProvider = function SbProvider2({
186724
186874
  }, [settings == null ? void 0 : settings.theme, settings == null ? void 0 : settings.themeOverrides]);
186725
186875
  useEffect(() => {
186726
186876
  initializeStyles(name);
186727
- }, [preloadedData, name]);
186877
+ }, [name]);
186878
+ if (!isApisInitialized) {
186879
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
186880
+ }
186728
186881
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
186729
186882
  "div",
186730
186883
  {
@@ -198333,4 +198486,4 @@ export {
198333
198486
  SbTimer as y,
198334
198487
  SbApi as z
198335
198488
  };
198336
- //# sourceMappingURL=index-kjgG33Rg.js.map
198489
+ //# sourceMappingURL=index-CJnCDVsr.js.map