@superblocksteam/library 2.0.76 → 2.0.77-next.0

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-DpoYDtf8.js";
1
+ import { S as api_hmr_tracker_default, _ as root_store_default, t as makeWrappedComponent } from "../jsx-wrapper-B2IuiyUY.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";
@@ -739,8 +739,10 @@ var DeployedParentBridge = class {
739
739
  sendClearRuntimeError(_id) {}
740
740
  sendConsoleLog(_data) {}
741
741
  setInteractionMode(_mode) {}
742
+ forwardKeypress(_keys, _eventInfo) {}
742
743
  sendCaptureScreenshotResponse(_callbackId, _dataUrl, _error) {}
743
744
  sendPingAppReadyForScreenshotResponse(_callbackId, _isReady) {}
745
+ updateProfiles(_profiles) {}
744
746
  };
745
747
 
746
748
  //#endregion
@@ -1085,6 +1087,15 @@ var SuperblocksEditorBridge = class SuperblocksEditorBridge {
1085
1087
  payload: { interactionMode: mode }
1086
1088
  });
1087
1089
  }
1090
+ forwardKeypress(keys, eventInfo) {
1091
+ this.sendImmediate({
1092
+ type: "keypress",
1093
+ payload: {
1094
+ keys,
1095
+ eventInfo
1096
+ }
1097
+ });
1098
+ }
1088
1099
  sendCaptureScreenshotResponse(callbackId, dataUrl, error) {
1089
1100
  this.sendImmediate({
1090
1101
  type: "capture-screenshot-response",
@@ -1104,6 +1115,15 @@ var SuperblocksEditorBridge = class SuperblocksEditorBridge {
1104
1115
  }
1105
1116
  });
1106
1117
  }
1118
+ updateProfiles(profiles) {
1119
+ this.sendImmediate({
1120
+ type: "iframe-action-batch",
1121
+ payload: [{
1122
+ type: "UPDATE_PROFILES",
1123
+ payload: profiles
1124
+ }]
1125
+ });
1126
+ }
1107
1127
  queueMessage(message, mergeOptions) {
1108
1128
  if (!this.connectedToParent) this.messagesToSend.push({
1109
1129
  payload: message,
@@ -1141,20 +1161,32 @@ var LocationStore = class {
1141
1161
  if (!this.route) return;
1142
1162
  editorBridge.updateRoute(this.route);
1143
1163
  }
1144
- /**
1145
- * Recursively searches through route tree (including nested children) to find a matching route
1146
- */
1147
- findMatchingRoute(routes, pathname) {
1148
- return matchRoutes(routes, pathname)?.at(-1);
1164
+ matchesToRoutePattern(matches) {
1165
+ if (!matches || matches.length === 0) return void 0;
1166
+ const segments = [];
1167
+ for (const match of matches) {
1168
+ const path = match.route?.path;
1169
+ if (!path) continue;
1170
+ const normalized = path === "*" ? "*" : path.replace(/^\/+/, "");
1171
+ if (!normalized) continue;
1172
+ segments.push(normalized);
1173
+ }
1174
+ if (segments.length === 0) {
1175
+ const fallback = matches.at(-1)?.pathname;
1176
+ return typeof fallback === "string" ? fallback : void 0;
1177
+ }
1178
+ return ("/" + segments.join("/")).replace(/\/{2,}/g, "/");
1149
1179
  }
1150
1180
  locationToRouteInfo(location, routes, params) {
1151
- const match = this.findMatchingRoute(routes, location.pathname);
1181
+ const matches = matchRoutes(routes, location.pathname);
1182
+ const match = matches?.at(-1);
1152
1183
  if (!match?.pathname) return;
1184
+ const routePattern = this.matchesToRoutePattern(matches) ?? match.pathname;
1153
1185
  return {
1154
1186
  hash: location.hash,
1155
1187
  pathname: location.pathname,
1156
1188
  queryParams: getQueryParams(location.search),
1157
- route: match.pathname,
1189
+ route: routePattern,
1158
1190
  routeParams: params
1159
1191
  };
1160
1192
  }
@@ -1559,8 +1591,19 @@ var SuperblocksAppContext = class {
1559
1591
  }
1560
1592
  setProfile(profileName) {
1561
1593
  const profile = this.context?.profiles?.available.find((profile$1) => profile$1.displayName === profileName);
1562
- if (profile && this.context?.profiles) this.context.profiles.selected = profile;
1563
- else if (!profile || !this.context?.profiles) throw new Error(`Profile ${profileName} not found`);
1594
+ if (profile && this.context?.profiles) {
1595
+ this.context.profiles.selected = profile;
1596
+ if (typeof window !== "undefined" && window.parent !== window) try {
1597
+ const serializeProfile = (p) => toJS(p);
1598
+ editorBridge.updateProfiles({
1599
+ available: this.context.profiles.available.map(serializeProfile),
1600
+ selected: serializeProfile(profile),
1601
+ default: serializeProfile(this.context.profiles.default)
1602
+ });
1603
+ } catch (error) {
1604
+ console.error("[SuperblocksAppContext] Failed to sync profile change to parent window:", error);
1605
+ }
1606
+ } else if (!profile || !this.context?.profiles) throw new Error(`Profile ${profileName} not found`);
1564
1607
  }
1565
1608
  updateContext(context$2) {
1566
1609
  this.context = {
@@ -3361,7 +3404,6 @@ var ErrorBoundary = class extends Component {
3361
3404
  };
3362
3405
  }
3363
3406
  componentDidCatch(error, errorInfo) {
3364
- console.error("Uncaught error:", error, errorInfo);
3365
3407
  if (isEditMode()) root_store_default.editStore?.ai.handleRuntimeError({
3366
3408
  id: this.state.id,
3367
3409
  error: String(error),
@@ -3566,4 +3608,4 @@ const useJSXContext = () => {
3566
3608
 
3567
3609
  //#endregion
3568
3610
  export { useSuperblocksProfiles as A, PropsCategory as B, addNewPromise 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 };
3569
- //# sourceMappingURL=jsx-wrapper-DpoYDtf8.js.map
3611
+ //# sourceMappingURL=jsx-wrapper-B2IuiyUY.js.map