@superblocksteam/library 2.0.102-next.0 → 2.0.102-next.1

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,6 +1,6 @@
1
1
  import { Callback, ControlType, DataType, DataTypeString, EntityDefinition, HeaderType, PropertiesPanelDefinition as PropertiesPanelDefinition$1, PropertiesPanelDisplay, PropertyForData, PropsCategory, Relation, WidgetPropertyDefinition } from "@superblocksteam/library-shared/props";
2
- import { DataRouter, Location, Params } from "react-router";
3
2
  import { Dim, EditorConfig, EvaluateOrValueComputedArgs, Property, TailwindPropertyKey } from "@superblocksteam/library-shared";
3
+ import { DataRouter, Location, Params } from "react-router";
4
4
  import * as React$2 from "react";
5
5
  import React$1, { LegacyRef, ReactNode, createElement } from "react";
6
6
  import { OrchestratorViewMode, PlaceholderInfo, Profile } from "@superblocksteam/shared";
@@ -32,11 +32,10 @@ type Group = {
32
32
  name: string;
33
33
  size: number;
34
34
  };
35
- type DataTag = Profile;
36
35
  type DataTags = {
37
- available: DataTag[];
38
- selected?: DataTag;
39
- default: DataTag;
36
+ available: Profile[];
37
+ selected?: Profile;
38
+ default: Profile;
40
39
  };
41
40
  /** @deprecated Use DataTags instead */
42
41
  type Profiles = DataTags;
@@ -87,395 +86,56 @@ declare const SbProvider: ({
87
86
  context?: SuperblocksAppContext;
88
87
  }) => react_jsx_runtime0.JSX.Element;
89
88
  //#endregion
90
- //#region src/lib/internal-details/lib/evaluator/entity-types.d.ts
91
- type SingleInputProp<T = EntityOutputProp, ARGS extends any[] = any[]> = T extends Callback ? Callback<ARGS> : T;
92
- type NestedInputProp<T, ARGS extends any[] = any[]> = T extends object ? { [K in keyof T]: SingleInputProp<T[K], ARGS> | NestedInputProp<T[K], ARGS> } : never;
93
- type InputProp<T = EntityOutputProp, ARGS extends any[] = any[]> = SingleInputProp<T, ARGS> | NestedInputProp<T, ARGS>;
94
- type EntityFunction<ARGS extends any[] = any[], R = EntityOutputProp> = (this: Entity, ...ARGS: ARGS) => R;
95
- //#endregion
96
- //#region src/edit-mode/runtime-graph/types.d.ts
97
- type ComponentNode = {
98
- selectorId: SbSelector;
99
- sourceId: SbElement;
100
- type: any;
101
- isSbComponent: boolean;
102
- isHtmlElement: boolean;
103
- noSelect?: boolean;
104
- props?: Record<string, unknown>;
105
- firstRenderedTag: SbSelector | undefined;
106
- nearestSelectableAncestor: SbSelector | undefined;
107
- displayName: string;
89
+ //#region src/lib/internal-details/lib/types.d.ts
90
+ type ExecutionError = {
91
+ name?: string;
92
+ message: string;
93
+ formPath: string;
94
+ blockPath: string;
95
+ handled?: boolean;
108
96
  };
109
- //#endregion
110
- //#region src/edit-mode/features/runtime-tracking-store.d.ts
111
- declare class RuntimeTrackingStore {
112
- readonly editStore: EditStore | undefined;
113
- constructor(editStore: EditStore | undefined);
114
- private graph;
115
- private jsxNodes;
116
- private sourceNodes;
117
- private disabledComponents;
118
- registerComponent(selectorId: SbSelector, params: {
119
- sourceId: SbElement;
120
- type: any;
121
- parentSelectorId?: SbSelector;
122
- isSbComponent: boolean;
123
- isHtmlElement: boolean;
124
- noSelect?: boolean;
125
- }): void;
126
- getDisplayName(selectorId: SbSelector): string;
127
- unregisterComponent(selectorId: SbSelector): void;
128
- getFirstAnchorableTag(selectorId: SbSelector): SbSelector | undefined;
129
- getNearestSelectableAncestor(selectorId: SbSelector, skipSelf?: boolean): SbSelector | undefined;
130
- updatePropsForComponent(selectorId: SbSelector, props: Record<string, unknown>): void;
131
- getComponent(selectorId: SbSelector): ComponentNode | undefined;
132
- getComponentParent(selectorId: SbSelector): SbSelector;
133
- getComponentChildren(selectorId: SbSelector): SbSelector[];
134
- getSelectorIdsForSourceId(sourceId: SbElement): Set<SbSelector>;
135
- getSourceId(selectorId: SbSelector): SbElement | undefined;
136
- getClosestAncestorByType(selectorId: SbSelector, type: string): SbSelector | undefined;
137
- hasRenderedNodes(): boolean;
138
- getDisabledComponents(): SbSelector[];
139
- /**
140
- * Given a selectorId that represents a DOM element, walks up the component tree
141
- * to find the outermost registered component whose firstRenderedTag matches this selectorId.
142
- * This is used to select the component when clicking on its root DOM element.
143
- *
144
- * IMPORTANT: This only returns a component if the anchorSelectorId is the IMMEDIATE parent
145
- * of the component (i.e., the component doesn't have any intermediate nodes between itself
146
- * and the anchor). This prevents inner HTML elements from being treated as component roots.
147
- *
148
- * ONLY returns registered components (isSbComponent: true). Unregistered wrapper components
149
- * are treated as transparent and skipped.
150
- *
151
- * Returns undefined if no registered component has this as its firstRenderedTag.
152
- */
153
- getOutermostComponentForFirstRenderedTag(anchorSelectorId: SbSelector): SbSelector | undefined;
154
- }
155
- //#endregion
156
- //#region src/edit-mode/features/ai-store.d.ts
157
- declare class AiManager {
158
- private readonly runtimeTrackingStore;
159
- private _isTaggingEnabled;
160
- private _isEditing;
161
- private _editingComponents;
162
- private _contextMode;
163
- private _targetedComponents;
164
- private _targetedSelectors;
165
- private _hasHadSuccessfulBuild;
166
- private _hasEverHadSuccessfulBuild;
167
- constructor(runtimeTrackingStore: RuntimeTrackingStore);
168
- getIsTaggingEnabled(): boolean;
169
- getIsEditing(): boolean;
170
- getShouldShowLoader(): boolean;
171
- setIsTaggingEnabled(isTaggingEnabled: boolean): void;
172
- getAiContextMode(): AiContextMode;
173
- shouldToggleComponentInAiContext(): boolean;
174
- getTargetedComponents(): `SB-${string}`[];
175
- getTargetedSelectors(): `S-${string}`[];
176
- isEditingComponent(id: SbElement): boolean;
177
- isTargetingComponent(id: SbElement): boolean;
178
- startEditing(): void;
179
- setEditingComponents(components: SbElement[]): void;
180
- finishEditing(): void;
181
- setAiContextMode(mode: AiContextMode, components?: {
182
- id: SbElement;
183
- selectorId?: SbSelector;
184
- }[]): void;
185
- addTargetedSelector(selectorId: SbSelector): void;
186
- toggleTargetedSelector(selectorId: SbSelector): void;
187
- isTargetedSelector(selectorId: SbSelector): boolean;
188
- /**
189
- * Returns true if we are targeting a different selector of the same source id, since in some cases we want to keep
190
- * the same source targeted, but just highlight another selector of it
191
- */
192
- isAlternateSourceIdTarget(sourceId: SbElement, selectorId: SbSelector): boolean;
193
- handleRuntimeError(data: RuntimeErrorData): void;
194
- clearRuntimeError(id: string): void;
195
- markFirstBuildSuccess(): void;
196
- private notifyLoaderState;
197
- private removeAllSharedSelectors;
198
- private removeAllSelectorsForSource;
199
- }
200
- //#endregion
201
- //#region src/edit-mode/features/connection-manager.d.ts
202
- type ConnectionStatus = "pre-init" | "disconnected" | "connecting" | "connected";
203
- declare class ConnectionManager {
204
- connectionStatus: ConnectionStatus;
205
- constructor();
206
- initializeSocket(): void;
207
- connect(): void;
208
- disconnect(): void;
209
- }
210
- //#endregion
211
- //#region src/edit-mode/features/operation-store.d.ts
212
- type OptimisticOperation<P> = {
213
- type: keyof EditOperations;
214
- payload: P;
215
- id: string;
216
- callback?: () => void;
97
+ type ExecutionEventRequest = {
98
+ summary: string;
99
+ metadata: {
100
+ placeHoldersInfo?: Record<string, PlaceholderInfo>;
101
+ };
217
102
  };
218
- type ReparentTransaction = OptimisticOperation<ReparentRequest>;
219
- type SetPropertiesTransaction = OptimisticOperation<SetPropertiesRequest>;
220
- type SetPropertyTransaction = OptimisticOperation<SetPropertyRequest>;
221
- type CreateComponentTransaction = OptimisticOperation<CreateRequest>;
222
- type DeleteComponentsTransaction = OptimisticOperation<DeleteRequest>;
223
- type PendingTransaction = ReparentTransaction | SetPropertiesTransaction | SetPropertyTransaction | CreateComponentTransaction | DeleteComponentsTransaction;
224
- declare class OperationManager {
225
- private pendingTransactions;
226
- private waitingForBatch;
227
- private batchOperations;
228
- private batchOperationTransactionId;
229
- visibleSourceIds: string[];
230
- constructor();
231
- get allPendingTransactions(): PendingTransaction[];
232
- get pendingDeleteOperations(): DeleteComponentsTransaction[];
233
- get pendingSetPropertiesOperations(): SetPropertiesTransaction[];
234
- get hasPendingOperations(): boolean;
235
- get allNames(): never[];
236
- private executeOrAddToBatch;
237
- private addPendingTransaction;
238
- clearPendingTransactions(transactionIds: string[]): void;
239
- batchUpdate(performOperations: () => void): void;
240
- createComponent(payload: CreateRequest): void;
241
- dropComponent(action: {
242
- from: {
243
- source: SourceLocation;
103
+ type Resolutions = Record<string,
104
+ // name of the field: eg: "range", for the range field let's say the code is {{[1,2,3]}}
105
+ {
106
+ value: any;
107
+ bindings: any[];
108
+ }>;
109
+ type ExecutionEvent = {
110
+ name: string;
111
+ type: string;
112
+ timestamp: string;
113
+ start?: Record<string, unknown>;
114
+ end?: {
115
+ performance?: {
116
+ start: string | number;
117
+ finish: string | number;
118
+ total: string | number;
119
+ execution: string | number;
120
+ overhead: string | number;
244
121
  };
245
- to: {
246
- source: SourceLocation;
122
+ error?: ExecutionError;
123
+ output?: {
124
+ result?: any;
125
+ request?: string;
126
+ requestV2?: ExecutionEventRequest;
127
+ stdout?: Array<string>;
128
+ stderr?: Array<string>;
247
129
  };
248
- propsToChange?: Record<string, PropertyInfo>;
249
- }): void;
250
- deleteComponents(sourceIds: SbElement[]): void;
251
- acknowledgeEditOperation(operation: EditOperationPayload<EditOperationType>): void;
252
- writeRuntimeProperties(sourceId: SbElement, transactionId: string, updates: Record<string, PropertyInfo<unknown>>): void;
253
- setWidgetProperties({
254
- sourceId,
255
- properties,
256
- callback
257
- }: {
258
- sourceId: SbElement;
259
- properties: Record<string, PropertyInfo<unknown>>;
260
- callback?: () => void;
261
- }): void;
262
- setWidgetProperty({
263
- sourceId,
264
- property,
265
- value,
266
- callback
267
- }: {
268
- sourceId: SbElement;
269
- property: string;
270
- value: PropertyInfo<unknown>;
271
- callback?: () => void;
272
- }): void;
273
- ensureFilesSynced(): Promise<void>;
274
- generateSourceId(): `SB-${string}`;
275
- }
276
- //#endregion
277
- //#region src/edit-mode/features/properties-panel-manager.d.ts
278
- declare class PropertiesPanelManager {
279
- readonly editStore: EditStore;
280
- readonly componentsManager: ComponentRegistry;
281
- private propertiesDefinitions;
282
- private propertiesPanelTrackerDisposer;
283
- private _propertyLookupCache;
284
- private removeHotReloadListener;
285
- constructor(editStore: EditStore, componentsManager: ComponentRegistry);
286
- getPropertiesPanel(selectorId: SbSelector): PropertiesPanelDefinition$1;
287
- trackPropertiesPanel(selectorId: SbSelector): void;
288
- untrackPropertiesPanel(): void;
289
- getPropertiesDefinition(type: string): PropertiesDefinition | undefined;
290
- setPropertiesDefinition(widgetType: string, propertiesDefinition: PropertiesDefinition): void;
291
- updatePropertiesDefinitionForType(type: string): void;
292
- computeAndApplySideEffectsForPropertyUpdate(payload: {
293
- sourceId: SbElement;
294
- updates: Record<string, PropertyInfo<unknown>>;
295
- }): Record<SbElement, Record<string, PropertyInfo<unknown>>>;
296
- /**
297
- * When a custom component's source code is updated, we want to update the properties definition for that component.
298
- * In order to do that, we need to listen to vite's hot reload events. We can't put import.meta.hot calls in the library
299
- * because Vite just compiled all of those out in library builds, so we inject a listener from the plugin instead.
300
- * https://github.com/vitejs/vite/blob/v6.2/packages/vite/src/node/plugins/define.ts#L37
301
- */
302
- private attachHotReloadListener;
303
- }
304
- //#endregion
305
- //#region src/edit-mode/features/resizing-store.d.ts
306
- type ResizeState = {
307
- selectorId: SbSelector;
308
- sourceId: SbElement;
309
- dragStartX: number;
310
- dragStartY: number;
311
- start: {
312
- width: number;
313
- height: number;
314
- };
315
- resizedPosition: string;
316
- widthToUpdate: Dim | null;
317
- heightToUpdate: Dim | null;
318
- isApplyingResize: boolean;
319
- };
320
- declare class ResizingManager {
321
- private root;
322
- private _activeResizes;
323
- constructor(root: RootStore);
324
- get activeResize(): ResizeState | null | undefined;
325
- private isLockedAspectRatio;
326
- startResizing(dragStartX: number, dragStartY: number, selectorId: SbSelector, position: string): void;
327
- private calculateDimension;
328
- private handleResizeDimension;
329
- resizeWidget(currentX: number, currentY: number, selectorId: SbSelector, canResizeWidth: boolean, canResizeHeight: boolean): void;
330
- pendingResize(sourceId: SbElement): {
331
- width: Dim | null;
332
- height: Dim | null;
333
- } | null;
334
- get hasAnyPendingResize(): boolean;
335
- get pendingResizes(): ResizeState[];
336
- applyResize(selectorId: SbSelector): void;
337
- }
338
- //#endregion
339
- //#region src/edit-mode/features/ui-store.d.ts
340
- declare class UIStore {
341
- readonly root: RootStore;
342
- readonly editStore: EditStore;
343
- resizing: ResizingManager;
344
- private _selectedSourceIds;
345
- private _selectedSelectorIds;
346
- private _focusedSelectorId;
347
- private _rootInstanceData;
348
- private newComponentSelectPromise;
349
- constructor(root: RootStore, editStore: EditStore);
350
- getMostRelevantSelectorIdsForSourceId(sourceId: SbElement): SbSelector[];
351
- isSourceSelected(sourceId: SbElement): boolean;
352
- getSelectedSourceIds(): SbElement[];
353
- getSelectedSelectorIds(): SbSelector[];
354
- private get focusedSelectorId();
355
- getFocusedSourceId(): SbElement | null;
356
- getFocusedSelectorId(): SbSelector | null;
357
- setSelectedSourceIds(sourceIds: SbElement[]): void;
358
- private subscribeNewSourceIdsToRuntimeSync;
359
- setSelectedSelectorIds(selectorIds: SbSelector[]): void;
360
- setFocusedIds(selectorId: SbSelector | null): void;
361
- selectWidget(selectorId: SbSelector | null, _addToSelection?: boolean): void;
362
- /**
363
- * This is cursed because component selection actually needs to be done by instance ids, but
364
- * instance IDs are only guaranteed to be stable after the component is rendered, while source IDs
365
- * are assigned by the source tracker.
366
- *
367
- * If _any_ other selection comes in before we select something, we will cancel this reaction
368
- */
369
- selectNewComponentBySourceId(sourceId: SbElement, selectorIdsToIgnore?: Set<`S-${string}`>): Promise<void>;
370
- }
371
- //#endregion
372
- //#region src/edit-mode/runtime-sync/runtime-subscriptions-store.d.ts
373
- /**
374
- * MobX store that manages runtime component subscriptions.
375
- * Tracks which components are subscribed and builds fresh composites on-demand.
376
- * The subscriptions getter allows startEditorSync reactions to track deep observables
377
- * from buildComposite, eliminating the need for manual reaction management.
378
- */
379
- declare class RuntimeSubscriptionsStore {
380
- readonly editStore: EditStore;
381
- private subscribedSourceIds;
382
- constructor(editStore: EditStore);
383
- subscribe(sourceId: SbElement): void;
384
- unsubscribe(sourceId: SbElement): void;
385
- clearAll(): void;
386
- get subscriptions(): Record<SbElement, RuntimeSyncComposite | null>;
387
- }
388
- //#endregion
389
- //#region src/edit-mode/edit-store.d.ts
390
- declare global {
391
- interface Window {
392
- _SB_ENABLE_SESSION_RECORDING?: boolean;
393
- __SUPERBLOCKS_EDITOR_HOOK__: InstanceType<typeof EditStore>;
394
- }
395
- }
396
- declare class EditStore {
397
- ui: UIStore;
398
- operationManager: OperationManager;
399
- propertiesPanelManager: PropertiesPanelManager;
400
- runtimeTrackingStore: RuntimeTrackingStore;
401
- connectionManager: ConnectionManager;
402
- ai: AiManager;
403
- runtimeSubscriptionsStore: RuntimeSubscriptionsStore;
404
- isInitialized: boolean;
405
- recordingInitialized: boolean;
406
- interactionMode: InteractionMode;
407
- lastInteractionMode: InteractionMode;
408
- isDesignModeLocked: boolean;
409
- designModeDisabled: boolean;
410
- private viteMessageListeners;
411
- constructor(rootStore: RootStore);
412
- setIsInitialized(isInitialized: boolean): void;
413
- setDesignModeDisabled(disabled: boolean): void;
414
- setInteractionMode(mode: InteractionMode, notifyEditor?: boolean): void;
415
- setDesignModeLocked(locked: boolean): void;
416
- onViteMessage<T extends ViteMessageKind, Message extends Extract<ViteMessage, {
417
- kind: T;
418
- }>>(kind: T, callback: (message: Message) => void): () => void;
419
- triggerViteMessage<T extends ViteMessageKind, Message extends Extract<ViteMessage, {
420
- kind: T;
421
- }>>(kind: T, message: Message): void;
422
- startRecording(recording: {
423
- userId: string;
424
- appId: string;
425
- sessionRecordingKey: string;
426
- }): void;
427
- }
428
- //#endregion
429
- //#region src/lib/internal-details/lib/types.d.ts
430
- type ExecutionError = {
431
- name?: string;
432
- message: string;
433
- formPath: string;
434
- blockPath: string;
435
- handled?: boolean;
436
- };
437
- type ExecutionEventRequest = {
438
- summary: string;
439
- metadata: {
440
- placeHoldersInfo?: Record<string, PlaceholderInfo>;
441
- };
442
- };
443
- type Resolutions = Record<string,
444
- // name of the field: eg: "range", for the range field let's say the code is {{[1,2,3]}}
445
- {
446
- value: any;
447
- bindings: any[];
448
- }>;
449
- type ExecutionEvent = {
450
- name: string;
451
- type: string;
452
- timestamp: string;
453
- start?: Record<string, unknown>;
454
- end?: {
455
- performance?: {
456
- start: string | number;
457
- finish: string | number;
458
- total: string | number;
459
- execution: string | number;
460
- overhead: string | number;
461
- };
462
- error?: ExecutionError;
463
- output?: {
464
- result?: any;
465
- request?: string;
466
- requestV2?: ExecutionEventRequest;
467
- stdout?: Array<string>;
468
- stderr?: Array<string>;
469
- };
470
- resolved?: Resolutions;
471
- };
472
- parent: string;
473
- };
474
- interface StreamEvent {
475
- result: {
476
- event: ExecutionEvent;
477
- execution: string;
478
- };
130
+ resolved?: Resolutions;
131
+ };
132
+ parent: string;
133
+ };
134
+ interface StreamEvent {
135
+ result: {
136
+ event: ExecutionEvent;
137
+ execution: string;
138
+ };
479
139
  }
480
140
  type RouteInfo = Omit<UrlState, "host" | "hostname" | "href" | "port" | "protocol">;
481
141
  /**
@@ -1023,135 +683,468 @@ type FromChildToParentMessageTypesMap = {
1023
683
  diagnostics?: unknown[];
1024
684
  };
1025
685
  /**
1026
- * Notify the parent when an SDK API execution fails.
686
+ * Notify the parent when an SDK API execution fails.
687
+ */
688
+ "sdk-api-execution-failed": {
689
+ executionId: string;
690
+ apiName: string;
691
+ error: {
692
+ code: string;
693
+ message: string;
694
+ };
695
+ durationMs: number;
696
+ diagnostics?: unknown[];
697
+ };
698
+ } & AppToEditorMessage<PropertiesPanelDefinition$1>;
699
+ type FromChildToParentMessageTypes = keyof FromChildToParentMessageTypesMap;
700
+ //#endregion
701
+ //#region src/lib/internal-details/location-store.d.ts
702
+ declare class LocationStore {
703
+ route?: RouteInfo;
704
+ rootStore: RootStore;
705
+ constructor(rootStore: RootStore);
706
+ updateLocation(location: Location, routes: DataRouter["routes"], params: Readonly<Params<string>>): void;
707
+ sendLocationToEditor(): void;
708
+ private matchesToRoutePattern;
709
+ locationToRouteInfo(location: Location, routes: DataRouter["routes"], params: Readonly<Params<string>>): RouteInfo | undefined;
710
+ }
711
+ //#endregion
712
+ //#region src/lib/internal-details/lib/features/api-store.d.ts
713
+ type ApiResult<T = any> = {
714
+ data?: T;
715
+ error?: string;
716
+ };
717
+ declare class ApiManager {
718
+ readonly rootStore: RootStore;
719
+ /**
720
+ * Pre-filtered agent URLs for the current profile, sent by the parent.
721
+ * Used as fallback for cloud orgs where URLs come from
722
+ * SUPERBLOCKS_UI_AGENT_BASE_URL rather than agent metadata.
723
+ */
724
+ private _agentUrls;
725
+ /**
726
+ * Full on-premise agent metadata (all profiles) from the parent,
727
+ * enabling local profile-based filtering without a postMessage
728
+ * round-trip. Empty for cloud orgs.
729
+ */
730
+ private _agents;
731
+ /**
732
+ * DP routing config mapping profile keys to DP URLs, sent by the parent.
733
+ * Only populated when dataPlaneGatewayEnabled is true.
734
+ */
735
+ private _dpRoutingConfig;
736
+ private token;
737
+ private accessToken;
738
+ private runningApiControllers;
739
+ private waitForInitApiPromise;
740
+ private waitForBootstrapPromise;
741
+ private resolveBootstrapPromise;
742
+ private callContexts;
743
+ constructor(rootStore: RootStore);
744
+ set agentUrls(urls: string[]);
745
+ set agents(agents: AgentInfo[]);
746
+ set dpRoutingConfig(config: Record<string, string>);
747
+ setTokens(token: string, accessToken: string): void;
748
+ isInitialized(): boolean;
749
+ /**
750
+ * Get agent URLs for the given profile by filtering locally stored
751
+ * agent metadata. Falls back to the pre-filtered `_agentUrls` when
752
+ * no full agent metadata is available (cloud orgs or legacy parents).
753
+ */
754
+ private getAgentUrlsForProfile;
755
+ /**
756
+ * Selects a random agent URL from the available agents and returns it normalized
757
+ * (with trailing slash) to ensure proper URL path joining.
758
+ */
759
+ private getRandomAgentBaseUrl;
760
+ private awaitInitApiIfNeeded;
761
+ private awaitBootstrapIfNeeded;
762
+ notifyBootstrapComplete(): void;
763
+ loadApiManifest({
764
+ apis
765
+ }: {
766
+ apis?: Record<string, {
767
+ api: DeleteMeLibraryApi;
768
+ scopeId: string;
769
+ }>;
770
+ }): void;
771
+ rerunApiByCallId(callId: string): Promise<ApiResult>;
772
+ runApiByPath({
773
+ path,
774
+ inputs,
775
+ callId,
776
+ callback,
777
+ isTestRun,
778
+ injectedCallerId
779
+ }: {
780
+ path: string;
781
+ inputs: SbApiRunOptions;
782
+ callId?: string;
783
+ callback?: () => Promise<unknown>;
784
+ isTestRun?: boolean;
785
+ injectedCallerId?: string;
786
+ }): Promise<ApiResult>;
787
+ private getHMRCallHash;
788
+ private getCachedHMRExecution;
789
+ private executeApi;
790
+ private executeApiInternal;
791
+ private findError;
792
+ private extractStatusCode;
793
+ /**
794
+ * Extract step-level logs from execution events.
795
+ * Captures console.log (stdout), console.error (stderr), output, and errors for each step.
796
+ */
797
+ private extractStepLogs;
798
+ /**
799
+ * Execute an SDK API directly via the orchestrator's v3/execute endpoint.
800
+ * Reads execution context (profile, branch, tokens) from rootStore so the
801
+ * caller doesn't need to resolve them through the parent frame.
802
+ */
803
+ executeSdkApiV3(apiName: string, inputs: Record<string, unknown>, options?: {
804
+ signal?: AbortSignal;
805
+ }): Promise<{
806
+ success: boolean;
807
+ output?: unknown;
808
+ error?: {
809
+ code: string;
810
+ message: string;
811
+ };
812
+ diagnostics?: unknown[];
813
+ }>;
814
+ cancelApi(apiName: string, _scopeId?: string): Promise<void>;
815
+ }
816
+ //#endregion
817
+ //#region src/edit-mode/runtime-graph/types.d.ts
818
+ type ComponentNode = {
819
+ selectorId: SbSelector;
820
+ sourceId: SbElement;
821
+ type: any;
822
+ isSbComponent: boolean;
823
+ isHtmlElement: boolean;
824
+ noSelect?: boolean;
825
+ props?: Record<string, unknown>;
826
+ firstRenderedTag: SbSelector | undefined;
827
+ nearestSelectableAncestor: SbSelector | undefined;
828
+ displayName: string;
829
+ };
830
+ //#endregion
831
+ //#region src/edit-mode/features/runtime-tracking-store.d.ts
832
+ declare class RuntimeTrackingStore {
833
+ readonly editStore: EditStore | undefined;
834
+ constructor(editStore: EditStore | undefined);
835
+ private graph;
836
+ private jsxNodes;
837
+ private sourceNodes;
838
+ private disabledComponents;
839
+ registerComponent(selectorId: SbSelector, params: {
840
+ sourceId: SbElement;
841
+ type: any;
842
+ parentSelectorId?: SbSelector;
843
+ isSbComponent: boolean;
844
+ isHtmlElement: boolean;
845
+ noSelect?: boolean;
846
+ }): void;
847
+ getDisplayName(selectorId: SbSelector): string;
848
+ unregisterComponent(selectorId: SbSelector): void;
849
+ getFirstAnchorableTag(selectorId: SbSelector): SbSelector | undefined;
850
+ getNearestSelectableAncestor(selectorId: SbSelector, skipSelf?: boolean): SbSelector | undefined;
851
+ updatePropsForComponent(selectorId: SbSelector, props: Record<string, unknown>): void;
852
+ getComponent(selectorId: SbSelector): ComponentNode | undefined;
853
+ getComponentParent(selectorId: SbSelector): SbSelector;
854
+ getComponentChildren(selectorId: SbSelector): SbSelector[];
855
+ getSelectorIdsForSourceId(sourceId: SbElement): Set<SbSelector>;
856
+ getSourceId(selectorId: SbSelector): SbElement | undefined;
857
+ getClosestAncestorByType(selectorId: SbSelector, type: string): SbSelector | undefined;
858
+ hasRenderedNodes(): boolean;
859
+ getDisabledComponents(): SbSelector[];
860
+ /**
861
+ * Given a selectorId that represents a DOM element, walks up the component tree
862
+ * to find the outermost registered component whose firstRenderedTag matches this selectorId.
863
+ * This is used to select the component when clicking on its root DOM element.
864
+ *
865
+ * IMPORTANT: This only returns a component if the anchorSelectorId is the IMMEDIATE parent
866
+ * of the component (i.e., the component doesn't have any intermediate nodes between itself
867
+ * and the anchor). This prevents inner HTML elements from being treated as component roots.
868
+ *
869
+ * ONLY returns registered components (isSbComponent: true). Unregistered wrapper components
870
+ * are treated as transparent and skipped.
871
+ *
872
+ * Returns undefined if no registered component has this as its firstRenderedTag.
873
+ */
874
+ getOutermostComponentForFirstRenderedTag(anchorSelectorId: SbSelector): SbSelector | undefined;
875
+ }
876
+ //#endregion
877
+ //#region src/edit-mode/features/ai-store.d.ts
878
+ declare class AiManager {
879
+ private readonly runtimeTrackingStore;
880
+ private _isTaggingEnabled;
881
+ private _isEditing;
882
+ private _editingComponents;
883
+ private _contextMode;
884
+ private _targetedComponents;
885
+ private _targetedSelectors;
886
+ private _hasHadSuccessfulBuild;
887
+ private _hasEverHadSuccessfulBuild;
888
+ constructor(runtimeTrackingStore: RuntimeTrackingStore);
889
+ getIsTaggingEnabled(): boolean;
890
+ getIsEditing(): boolean;
891
+ getShouldShowLoader(): boolean;
892
+ setIsTaggingEnabled(isTaggingEnabled: boolean): void;
893
+ getAiContextMode(): AiContextMode;
894
+ shouldToggleComponentInAiContext(): boolean;
895
+ getTargetedComponents(): `SB-${string}`[];
896
+ getTargetedSelectors(): `S-${string}`[];
897
+ isEditingComponent(id: SbElement): boolean;
898
+ isTargetingComponent(id: SbElement): boolean;
899
+ startEditing(): void;
900
+ setEditingComponents(components: SbElement[]): void;
901
+ finishEditing(): void;
902
+ setAiContextMode(mode: AiContextMode, components?: {
903
+ id: SbElement;
904
+ selectorId?: SbSelector;
905
+ }[]): void;
906
+ addTargetedSelector(selectorId: SbSelector): void;
907
+ toggleTargetedSelector(selectorId: SbSelector): void;
908
+ isTargetedSelector(selectorId: SbSelector): boolean;
909
+ /**
910
+ * Returns true if we are targeting a different selector of the same source id, since in some cases we want to keep
911
+ * the same source targeted, but just highlight another selector of it
912
+ */
913
+ isAlternateSourceIdTarget(sourceId: SbElement, selectorId: SbSelector): boolean;
914
+ handleRuntimeError(data: RuntimeErrorData): void;
915
+ clearRuntimeError(id: string): void;
916
+ markFirstBuildSuccess(): void;
917
+ private notifyLoaderState;
918
+ private removeAllSharedSelectors;
919
+ private removeAllSelectorsForSource;
920
+ }
921
+ //#endregion
922
+ //#region src/edit-mode/features/connection-manager.d.ts
923
+ type ConnectionStatus = "pre-init" | "disconnected" | "connecting" | "connected";
924
+ declare class ConnectionManager {
925
+ connectionStatus: ConnectionStatus;
926
+ constructor();
927
+ initializeSocket(): void;
928
+ connect(): void;
929
+ disconnect(): void;
930
+ }
931
+ //#endregion
932
+ //#region src/edit-mode/features/operation-store.d.ts
933
+ type OptimisticOperation<P> = {
934
+ type: keyof EditOperations;
935
+ payload: P;
936
+ id: string;
937
+ callback?: () => void;
938
+ };
939
+ type ReparentTransaction = OptimisticOperation<ReparentRequest>;
940
+ type SetPropertiesTransaction = OptimisticOperation<SetPropertiesRequest>;
941
+ type SetPropertyTransaction = OptimisticOperation<SetPropertyRequest>;
942
+ type CreateComponentTransaction = OptimisticOperation<CreateRequest>;
943
+ type DeleteComponentsTransaction = OptimisticOperation<DeleteRequest>;
944
+ type PendingTransaction = ReparentTransaction | SetPropertiesTransaction | SetPropertyTransaction | CreateComponentTransaction | DeleteComponentsTransaction;
945
+ declare class OperationManager {
946
+ private pendingTransactions;
947
+ private waitingForBatch;
948
+ private batchOperations;
949
+ private batchOperationTransactionId;
950
+ visibleSourceIds: string[];
951
+ constructor();
952
+ get allPendingTransactions(): PendingTransaction[];
953
+ get pendingDeleteOperations(): DeleteComponentsTransaction[];
954
+ get pendingSetPropertiesOperations(): SetPropertiesTransaction[];
955
+ get hasPendingOperations(): boolean;
956
+ get allNames(): never[];
957
+ private executeOrAddToBatch;
958
+ private addPendingTransaction;
959
+ clearPendingTransactions(transactionIds: string[]): void;
960
+ batchUpdate(performOperations: () => void): void;
961
+ createComponent(payload: CreateRequest): void;
962
+ dropComponent(action: {
963
+ from: {
964
+ source: SourceLocation;
965
+ };
966
+ to: {
967
+ source: SourceLocation;
968
+ };
969
+ propsToChange?: Record<string, PropertyInfo>;
970
+ }): void;
971
+ deleteComponents(sourceIds: SbElement[]): void;
972
+ acknowledgeEditOperation(operation: EditOperationPayload<EditOperationType>): void;
973
+ writeRuntimeProperties(sourceId: SbElement, transactionId: string, updates: Record<string, PropertyInfo<unknown>>): void;
974
+ setWidgetProperties({
975
+ sourceId,
976
+ properties,
977
+ callback
978
+ }: {
979
+ sourceId: SbElement;
980
+ properties: Record<string, PropertyInfo<unknown>>;
981
+ callback?: () => void;
982
+ }): void;
983
+ setWidgetProperty({
984
+ sourceId,
985
+ property,
986
+ value,
987
+ callback
988
+ }: {
989
+ sourceId: SbElement;
990
+ property: string;
991
+ value: PropertyInfo<unknown>;
992
+ callback?: () => void;
993
+ }): void;
994
+ ensureFilesSynced(): Promise<void>;
995
+ generateSourceId(): `SB-${string}`;
996
+ }
997
+ //#endregion
998
+ //#region src/edit-mode/features/properties-panel-manager.d.ts
999
+ declare class PropertiesPanelManager {
1000
+ readonly editStore: EditStore;
1001
+ readonly componentsManager: ComponentRegistry;
1002
+ private propertiesDefinitions;
1003
+ private propertiesPanelTrackerDisposer;
1004
+ private _propertyLookupCache;
1005
+ private removeHotReloadListener;
1006
+ constructor(editStore: EditStore, componentsManager: ComponentRegistry);
1007
+ getPropertiesPanel(selectorId: SbSelector): PropertiesPanelDefinition$1;
1008
+ trackPropertiesPanel(selectorId: SbSelector): void;
1009
+ untrackPropertiesPanel(): void;
1010
+ getPropertiesDefinition(type: string): PropertiesDefinition | undefined;
1011
+ setPropertiesDefinition(widgetType: string, propertiesDefinition: PropertiesDefinition): void;
1012
+ updatePropertiesDefinitionForType(type: string): void;
1013
+ computeAndApplySideEffectsForPropertyUpdate(payload: {
1014
+ sourceId: SbElement;
1015
+ updates: Record<string, PropertyInfo<unknown>>;
1016
+ }): Record<SbElement, Record<string, PropertyInfo<unknown>>>;
1017
+ /**
1018
+ * When a custom component's source code is updated, we want to update the properties definition for that component.
1019
+ * In order to do that, we need to listen to vite's hot reload events. We can't put import.meta.hot calls in the library
1020
+ * because Vite just compiled all of those out in library builds, so we inject a listener from the plugin instead.
1021
+ * https://github.com/vitejs/vite/blob/v6.2/packages/vite/src/node/plugins/define.ts#L37
1027
1022
  */
1028
- "sdk-api-execution-failed": {
1029
- executionId: string;
1030
- apiName: string;
1031
- error: {
1032
- code: string;
1033
- message: string;
1034
- };
1035
- durationMs: number;
1036
- diagnostics?: unknown[];
1037
- };
1038
- } & AppToEditorMessage<PropertiesPanelDefinition$1>;
1039
- type FromChildToParentMessageTypes = keyof FromChildToParentMessageTypesMap;
1040
- //#endregion
1041
- //#region src/lib/internal-details/location-store.d.ts
1042
- declare class LocationStore {
1043
- route?: RouteInfo;
1044
- rootStore: RootStore;
1045
- constructor(rootStore: RootStore);
1046
- updateLocation(location: Location, routes: DataRouter["routes"], params: Readonly<Params<string>>): void;
1047
- sendLocationToEditor(): void;
1048
- private matchesToRoutePattern;
1049
- locationToRouteInfo(location: Location, routes: DataRouter["routes"], params: Readonly<Params<string>>): RouteInfo | undefined;
1023
+ private attachHotReloadListener;
1050
1024
  }
1051
1025
  //#endregion
1052
- //#region src/lib/internal-details/lib/features/api-store.d.ts
1053
- type ApiResult<T = any> = {
1054
- data?: T;
1055
- error?: string;
1026
+ //#region src/edit-mode/features/resizing-store.d.ts
1027
+ type ResizeState = {
1028
+ selectorId: SbSelector;
1029
+ sourceId: SbElement;
1030
+ dragStartX: number;
1031
+ dragStartY: number;
1032
+ start: {
1033
+ width: number;
1034
+ height: number;
1035
+ };
1036
+ resizedPosition: string;
1037
+ widthToUpdate: Dim | null;
1038
+ heightToUpdate: Dim | null;
1039
+ isApplyingResize: boolean;
1056
1040
  };
1057
- declare class ApiManager {
1058
- readonly rootStore: RootStore;
1059
- /**
1060
- * Pre-filtered agent URLs for the current profile, sent by the parent.
1061
- * Used as fallback for cloud orgs where URLs come from
1062
- * SUPERBLOCKS_UI_AGENT_BASE_URL rather than agent metadata.
1063
- */
1064
- private _agentUrls;
1065
- /**
1066
- * Full on-premise agent metadata (all profiles) from the parent,
1067
- * enabling local profile-based filtering without a postMessage
1068
- * round-trip. Empty for cloud orgs.
1069
- */
1070
- private _agents;
1041
+ declare class ResizingManager {
1042
+ private root;
1043
+ private _activeResizes;
1044
+ constructor(root: RootStore);
1045
+ get activeResize(): ResizeState | null | undefined;
1046
+ private isLockedAspectRatio;
1047
+ startResizing(dragStartX: number, dragStartY: number, selectorId: SbSelector, position: string): void;
1048
+ private calculateDimension;
1049
+ private handleResizeDimension;
1050
+ resizeWidget(currentX: number, currentY: number, selectorId: SbSelector, canResizeWidth: boolean, canResizeHeight: boolean): void;
1051
+ pendingResize(sourceId: SbElement): {
1052
+ width: Dim | null;
1053
+ height: Dim | null;
1054
+ } | null;
1055
+ get hasAnyPendingResize(): boolean;
1056
+ get pendingResizes(): ResizeState[];
1057
+ applyResize(selectorId: SbSelector): void;
1058
+ }
1059
+ //#endregion
1060
+ //#region src/edit-mode/features/ui-store.d.ts
1061
+ declare class UIStore {
1062
+ readonly root: RootStore;
1063
+ readonly editStore: EditStore;
1064
+ resizing: ResizingManager;
1065
+ private _selectedSourceIds;
1066
+ private _selectedSelectorIds;
1067
+ private _focusedSelectorId;
1068
+ private _rootInstanceData;
1069
+ private newComponentSelectPromise;
1070
+ constructor(root: RootStore, editStore: EditStore);
1071
+ getMostRelevantSelectorIdsForSourceId(sourceId: SbElement): SbSelector[];
1072
+ isSourceSelected(sourceId: SbElement): boolean;
1073
+ getSelectedSourceIds(): SbElement[];
1074
+ getSelectedSelectorIds(): SbSelector[];
1075
+ private get focusedSelectorId();
1076
+ getFocusedSourceId(): SbElement | null;
1077
+ getFocusedSelectorId(): SbSelector | null;
1078
+ setSelectedSourceIds(sourceIds: SbElement[]): void;
1079
+ private subscribeNewSourceIdsToRuntimeSync;
1080
+ setSelectedSelectorIds(selectorIds: SbSelector[]): void;
1081
+ setFocusedIds(selectorId: SbSelector | null): void;
1082
+ selectWidget(selectorId: SbSelector | null, _addToSelection?: boolean): void;
1071
1083
  /**
1072
- * DP routing config mapping profile keys to DP URLs, sent by the parent.
1073
- * Only populated when dataPlaneGatewayEnabled is true.
1084
+ * This is cursed because component selection actually needs to be done by instance ids, but
1085
+ * instance IDs are only guaranteed to be stable after the component is rendered, while source IDs
1086
+ * are assigned by the source tracker.
1087
+ *
1088
+ * If _any_ other selection comes in before we select something, we will cancel this reaction
1074
1089
  */
1075
- private _dpRoutingConfig;
1076
- private token;
1077
- private accessToken;
1078
- private runningApiControllers;
1079
- private waitForInitApiPromise;
1080
- private waitForBootstrapPromise;
1081
- private resolveBootstrapPromise;
1082
- private callContexts;
1090
+ selectNewComponentBySourceId(sourceId: SbElement, selectorIdsToIgnore?: Set<`S-${string}`>): Promise<void>;
1091
+ }
1092
+ //#endregion
1093
+ //#region src/edit-mode/runtime-sync/runtime-subscriptions-store.d.ts
1094
+ /**
1095
+ * MobX store that manages runtime component subscriptions.
1096
+ * Tracks which components are subscribed and builds fresh composites on-demand.
1097
+ * The subscriptions getter allows startEditorSync reactions to track deep observables
1098
+ * from buildComposite, eliminating the need for manual reaction management.
1099
+ */
1100
+ declare class RuntimeSubscriptionsStore {
1101
+ readonly editStore: EditStore;
1102
+ private subscribedSourceIds;
1103
+ constructor(editStore: EditStore);
1104
+ subscribe(sourceId: SbElement): void;
1105
+ unsubscribe(sourceId: SbElement): void;
1106
+ clearAll(): void;
1107
+ get subscriptions(): Record<SbElement, RuntimeSyncComposite | null>;
1108
+ }
1109
+ //#endregion
1110
+ //#region src/edit-mode/edit-store.d.ts
1111
+ declare global {
1112
+ interface Window {
1113
+ _SB_ENABLE_SESSION_RECORDING?: boolean;
1114
+ __SUPERBLOCKS_EDITOR_HOOK__: InstanceType<typeof EditStore>;
1115
+ }
1116
+ }
1117
+ declare class EditStore {
1118
+ ui: UIStore;
1119
+ operationManager: OperationManager;
1120
+ propertiesPanelManager: PropertiesPanelManager;
1121
+ runtimeTrackingStore: RuntimeTrackingStore;
1122
+ connectionManager: ConnectionManager;
1123
+ ai: AiManager;
1124
+ runtimeSubscriptionsStore: RuntimeSubscriptionsStore;
1125
+ isInitialized: boolean;
1126
+ recordingInitialized: boolean;
1127
+ interactionMode: InteractionMode;
1128
+ lastInteractionMode: InteractionMode;
1129
+ isDesignModeLocked: boolean;
1130
+ designModeDisabled: boolean;
1131
+ private viteMessageListeners;
1083
1132
  constructor(rootStore: RootStore);
1084
- set agentUrls(urls: string[]);
1085
- set agents(agents: AgentInfo[]);
1086
- set dpRoutingConfig(config: Record<string, string>);
1087
- setTokens(token: string, accessToken: string): void;
1088
- isInitialized(): boolean;
1089
- /**
1090
- * Get agent URLs for the given profile by filtering locally stored
1091
- * agent metadata. Falls back to the pre-filtered `_agentUrls` when
1092
- * no full agent metadata is available (cloud orgs or legacy parents).
1093
- */
1094
- private getAgentUrlsForProfile;
1095
- /**
1096
- * Selects a random agent URL from the available agents and returns it normalized
1097
- * (with trailing slash) to ensure proper URL path joining.
1098
- */
1099
- private getRandomAgentBaseUrl;
1100
- private awaitInitApiIfNeeded;
1101
- private awaitBootstrapIfNeeded;
1102
- notifyBootstrapComplete(): void;
1103
- loadApiManifest({
1104
- apis
1105
- }: {
1106
- apis?: Record<string, {
1107
- api: DeleteMeLibraryApi;
1108
- scopeId: string;
1109
- }>;
1133
+ setIsInitialized(isInitialized: boolean): void;
1134
+ setDesignModeDisabled(disabled: boolean): void;
1135
+ setInteractionMode(mode: InteractionMode, notifyEditor?: boolean): void;
1136
+ setDesignModeLocked(locked: boolean): void;
1137
+ onViteMessage<T extends ViteMessageKind, Message extends Extract<ViteMessage, {
1138
+ kind: T;
1139
+ }>>(kind: T, callback: (message: Message) => void): () => void;
1140
+ triggerViteMessage<T extends ViteMessageKind, Message extends Extract<ViteMessage, {
1141
+ kind: T;
1142
+ }>>(kind: T, message: Message): void;
1143
+ startRecording(recording: {
1144
+ userId: string;
1145
+ appId: string;
1146
+ sessionRecordingKey: string;
1110
1147
  }): void;
1111
- rerunApiByCallId(callId: string): Promise<ApiResult>;
1112
- runApiByPath({
1113
- path,
1114
- inputs,
1115
- callId,
1116
- callback,
1117
- isTestRun,
1118
- injectedCallerId
1119
- }: {
1120
- path: string;
1121
- inputs: SbApiRunOptions;
1122
- callId?: string;
1123
- callback?: () => Promise<unknown>;
1124
- isTestRun?: boolean;
1125
- injectedCallerId?: string;
1126
- }): Promise<ApiResult>;
1127
- private getHMRCallHash;
1128
- private getCachedHMRExecution;
1129
- private executeApi;
1130
- private executeApiInternal;
1131
- private findError;
1132
- private extractStatusCode;
1133
- /**
1134
- * Extract step-level logs from execution events.
1135
- * Captures console.log (stdout), console.error (stderr), output, and errors for each step.
1136
- */
1137
- private extractStepLogs;
1138
- /**
1139
- * Execute an SDK API directly via the orchestrator's v3/execute endpoint.
1140
- * Reads execution context (profile, branch, tokens) from rootStore so the
1141
- * caller doesn't need to resolve them through the parent frame.
1142
- */
1143
- executeSdkApiV3(apiName: string, inputs: Record<string, unknown>, options?: {
1144
- signal?: AbortSignal;
1145
- }): Promise<{
1146
- success: boolean;
1147
- output?: unknown;
1148
- error?: {
1149
- code: string;
1150
- message: string;
1151
- };
1152
- diagnostics?: unknown[];
1153
- }>;
1154
- cancelApi(apiName: string, _scopeId?: string): Promise<void>;
1155
1148
  }
1156
1149
  //#endregion
1157
1150
  //#region src/lib/internal-details/lib/root-store.d.ts
@@ -1399,6 +1392,12 @@ type SbComponentProps<El = HTMLElement> = {
1399
1392
  loading?: boolean;
1400
1393
  } & Omit<React.HTMLAttributes<El>, "height" | "width">;
1401
1394
  //#endregion
1395
+ //#region src/lib/internal-details/lib/evaluator/entity-types.d.ts
1396
+ type SingleInputProp<T = EntityOutputProp, ARGS extends any[] = any[]> = T extends Callback ? Callback<ARGS> : T;
1397
+ type NestedInputProp<T, ARGS extends any[] = any[]> = T extends object ? { [K in keyof T]: SingleInputProp<T[K], ARGS> | NestedInputProp<T[K], ARGS> } : never;
1398
+ type InputProp<T = EntityOutputProp, ARGS extends any[] = any[]> = SingleInputProp<T, ARGS> | NestedInputProp<T, ARGS>;
1399
+ type EntityFunction<ARGS extends any[] = any[], R = EntityOutputProp> = (this: Entity, ...ARGS: ARGS) => R;
1400
+ //#endregion
1402
1401
  //#region src/lib/user-facing/properties-panel/props-builder.d.ts
1403
1402
  type Exact<T, Shape> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
1404
1403
  type ManagedProp<T extends DataType = DataType> = PropertyForData<T> & {