@superblocksteam/library 2.0.59-next.2 → 2.0.59-next.4
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.
- package/dist/{early-console-buffer-SSPd-jq2.js → early-console-buffer-oUqxIuRK.js} +31 -4
- package/dist/early-console-buffer-oUqxIuRK.js.map +1 -0
- package/dist/jsx-dev-runtime/index.d.ts.map +1 -1
- package/dist/jsx-dev-runtime/index.js +7 -282
- package/dist/jsx-dev-runtime/index.js.map +1 -1
- package/dist/{widget-wrapper-naming-DxFT8zmk.js → jsx-wrapper-Ddb528TO.js} +410 -17
- package/dist/jsx-wrapper-Ddb528TO.js.map +1 -0
- package/dist/lib/index.d.ts +498 -20
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +215 -87
- package/dist/lib/index.js.map +1 -1
- package/dist/{logs-CgCPS9qr.js → logs-CQnzO-hw.js} +2 -2
- package/dist/{logs-CgCPS9qr.js.map → logs-CQnzO-hw.js.map} +1 -1
- package/package.json +3 -3
- package/dist/early-console-buffer-SSPd-jq2.js.map +0 -1
- package/dist/widget-wrapper-naming-DxFT8zmk.js.map +0 -1
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import { EditorConfig, EvaluateOrValueComputedArgs, Property, TailwindPropertyKey } from "@superblocksteam/library-shared";
|
|
1
|
+
import { Dim, EditorConfig, EvaluateOrValueComputedArgs, Property, TailwindPropertyKey } from "@superblocksteam/library-shared";
|
|
2
|
+
import * as React$2 from "react";
|
|
2
3
|
import React$1, { LegacyRef, ReactNode } from "react";
|
|
4
|
+
import { DataRouter, Location, Params } from "react-router";
|
|
3
5
|
import { OrchestratorViewMode, PlaceholderInfo, Profile } from "@superblocksteam/shared";
|
|
4
|
-
import { AiContextMode, AiGenerationState, AppToEditorMessage, Catalog, CreateChild, CreateChild as CreateChild$1, DeleteMeLibraryApi, EditOperationPayload, EditOperationType, EditorConfig as EditorConfig$1, Entity, EntityOutputProp, InteractionMode, PayloadAction, PropertyInfo, RuntimeErrorData, SbElement, SourceLocation, TransactionInfo, UrlState, WithBindingIdentifier } from "@superblocksteam/library-shared/types";
|
|
6
|
+
import { AiContextMode, AiGenerationState, AppToEditorMessage, Catalog, CatalogWithInternalDetails, ComponentRegistryShareState, CreateChild, CreateChild as CreateChild$1, CreateRequest, DeleteMeLibraryApi, DeleteRequest, EditOperationPayload, EditOperationType, EditOperations, EditorConfig as EditorConfig$1, Entity, EntityOutputProp, InteractionMode, PayloadAction, PropertyInfo, ReparentRequest, RuntimeErrorData, RuntimeSyncComposite, SbApiRunOptions, SbElement, SbSelector, SetPropertiesRequest, SetPropertyRequest, SourceLocation, TransactionInfo, UrlState, ViteMessage, ViteMessageKind, WithBindingIdentifier } from "@superblocksteam/library-shared/types";
|
|
5
7
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
-
import { Callback, ControlType, DataType, DataTypeString, HeaderType, PropertiesPanelDefinition as PropertiesPanelDefinition$1, PropertiesPanelDisplay, PropertyForData, PropsCategory, Relation, WidgetPropertyDefinition } from "@superblocksteam/library-shared/props";
|
|
8
|
+
import { Callback, ControlType, DataType, DataTypeString, EntityDefinition, HeaderType, PropertiesPanelDefinition as PropertiesPanelDefinition$1, PropertiesPanelDisplay, PropertyForData, PropsCategory, Relation, WidgetPropertyDefinition } from "@superblocksteam/library-shared/props";
|
|
9
|
+
import { Graph } from "@dagrejs/graphlib";
|
|
7
10
|
import { XYCoord } from "react-dnd";
|
|
8
11
|
|
|
12
|
+
//#region src/lib/internal-details/scope/types.d.ts
|
|
13
|
+
declare const AppMode: {
|
|
14
|
+
readonly EDIT: "EDIT";
|
|
15
|
+
readonly PUBLISHED: "PUBLISHED";
|
|
16
|
+
readonly PREVIEW: "PREVIEW";
|
|
17
|
+
};
|
|
18
|
+
type AppMode = (typeof AppMode)[keyof typeof AppMode];
|
|
19
|
+
//#endregion
|
|
9
20
|
//#region src/lib/internal-details/superblocks-context.d.ts
|
|
10
21
|
type User = {
|
|
11
22
|
name: string;
|
|
@@ -41,6 +52,7 @@ declare function useSuperblocksProfiles(): {
|
|
|
41
52
|
profiles: Profiles | undefined;
|
|
42
53
|
setProfile: (profileName: string) => void;
|
|
43
54
|
};
|
|
55
|
+
declare function getAppMode(): AppMode | undefined;
|
|
44
56
|
//#endregion
|
|
45
57
|
//#region src/lib/user-facing/sb-provider.d.ts
|
|
46
58
|
declare const SbProvider: ({
|
|
@@ -106,6 +118,7 @@ interface StreamEvent {
|
|
|
106
118
|
execution: string;
|
|
107
119
|
};
|
|
108
120
|
}
|
|
121
|
+
type RouteInfo = Omit<UrlState, "host" | "hostname" | "href" | "port" | "protocol">;
|
|
109
122
|
type RouteChangePayload = Omit<UrlState, "host" | "hostname" | "href" | "pathname" | "port" | "protocol">;
|
|
110
123
|
type AiUpdatesPayload = {
|
|
111
124
|
parentToChild: {
|
|
@@ -127,6 +140,7 @@ type AiUpdatesPayload = {
|
|
|
127
140
|
childToParent: {
|
|
128
141
|
type: "add-component-to-context";
|
|
129
142
|
component: SbElement;
|
|
143
|
+
label?: string;
|
|
130
144
|
} | {
|
|
131
145
|
type: "toggle-component-in-context";
|
|
132
146
|
component: SbElement;
|
|
@@ -151,6 +165,14 @@ type FromParentToChildMessageTypesMap = {
|
|
|
151
165
|
interactionMode?: InteractionMode;
|
|
152
166
|
/** The value of the authorization header on requests to the dev server. */
|
|
153
167
|
devServerAuthorization: string | undefined;
|
|
168
|
+
/** Timestamp when the parent connection started (for end-to-end metrics) */
|
|
169
|
+
connectionStartTime?: number;
|
|
170
|
+
/** W3C Trace Context headers for linking app websocket span to parent trace */
|
|
171
|
+
traceContext?: Record<string, string>;
|
|
172
|
+
/** Connection type: initial or reconnect */
|
|
173
|
+
connectionType?: "initial" | "reconnect";
|
|
174
|
+
/** Connection target: local, sabs, or default */
|
|
175
|
+
connectionTarget?: string;
|
|
154
176
|
aiState?: {
|
|
155
177
|
generationState: AiGenerationState;
|
|
156
178
|
editingComponents: SbElement[];
|
|
@@ -245,7 +267,6 @@ type FromParentToChildMessageTypesMap = {
|
|
|
245
267
|
"runtime/unsubscribe-component": {
|
|
246
268
|
sourceId: SbElement;
|
|
247
269
|
};
|
|
248
|
-
"sb-reload-app": void;
|
|
249
270
|
};
|
|
250
271
|
type FromParentToChildMessageTypes = keyof FromParentToChildMessageTypesMap;
|
|
251
272
|
type FromChildToParentMessageTypesMap = {
|
|
@@ -345,15 +366,469 @@ type FromChildToParentMessageTypesMap = {
|
|
|
345
366
|
"logout-integration": {
|
|
346
367
|
callbackId: string;
|
|
347
368
|
};
|
|
369
|
+
"app-websocket-connected": {
|
|
370
|
+
success: boolean;
|
|
371
|
+
durationMs: number;
|
|
372
|
+
error?: {
|
|
373
|
+
message: string;
|
|
374
|
+
type: string;
|
|
375
|
+
stack?: string;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
348
378
|
} & AppToEditorMessage<PropertiesPanelDefinition$1>;
|
|
349
379
|
type FromChildToParentMessageTypes = keyof FromChildToParentMessageTypesMap;
|
|
350
380
|
//#endregion
|
|
381
|
+
//#region src/lib/internal-details/location-store.d.ts
|
|
382
|
+
declare class LocationStore {
|
|
383
|
+
route?: RouteInfo;
|
|
384
|
+
rootStore: RootStore;
|
|
385
|
+
constructor(rootStore: RootStore);
|
|
386
|
+
updateLocation(location: Location, routes: DataRouter["routes"], params: Readonly<Params<string>>): void;
|
|
387
|
+
sendLocationToEditor(): void;
|
|
388
|
+
/**
|
|
389
|
+
* Recursively searches through route tree (including nested children) to find a matching route
|
|
390
|
+
*/
|
|
391
|
+
private findMatchingRoute;
|
|
392
|
+
locationToRouteInfo(location: Location, routes: DataRouter["routes"], params: Readonly<Params<string>>): RouteInfo | undefined;
|
|
393
|
+
}
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/lib/internal-details/lib/features/api-store.d.ts
|
|
396
|
+
type ApiResult<T = any> = {
|
|
397
|
+
data?: T;
|
|
398
|
+
error?: string;
|
|
399
|
+
};
|
|
400
|
+
declare class ApiManager {
|
|
401
|
+
readonly rootStore: RootStore;
|
|
402
|
+
agentUrls: string[];
|
|
403
|
+
private token;
|
|
404
|
+
private accessToken;
|
|
405
|
+
private runningApiControllers;
|
|
406
|
+
private waitForInitApiPromise;
|
|
407
|
+
private callContexts;
|
|
408
|
+
constructor(rootStore: RootStore);
|
|
409
|
+
setTokens(token: string, accessToken: string): void;
|
|
410
|
+
isInitialized(): boolean;
|
|
411
|
+
private awaitInitApiIfNeeded;
|
|
412
|
+
loadApiManifest({
|
|
413
|
+
apis
|
|
414
|
+
}: {
|
|
415
|
+
apis?: Record<string, {
|
|
416
|
+
api: DeleteMeLibraryApi;
|
|
417
|
+
scopeId: string;
|
|
418
|
+
}>;
|
|
419
|
+
}): void;
|
|
420
|
+
rerunApiByCallId(callId: string): Promise<ApiResult>;
|
|
421
|
+
runApiByPath({
|
|
422
|
+
path,
|
|
423
|
+
inputs,
|
|
424
|
+
callId,
|
|
425
|
+
callback,
|
|
426
|
+
isTestRun,
|
|
427
|
+
injectedCallerId
|
|
428
|
+
}: {
|
|
429
|
+
path: string;
|
|
430
|
+
inputs: SbApiRunOptions;
|
|
431
|
+
callId?: string;
|
|
432
|
+
callback?: () => Promise<unknown>;
|
|
433
|
+
isTestRun?: boolean;
|
|
434
|
+
injectedCallerId?: string;
|
|
435
|
+
}): Promise<ApiResult>;
|
|
436
|
+
private getHMRCallHash;
|
|
437
|
+
private getCachedHMRExecution;
|
|
438
|
+
private executeApi;
|
|
439
|
+
private executeApiInternal;
|
|
440
|
+
private findError;
|
|
441
|
+
private extractStatusCode;
|
|
442
|
+
cancelApi(apiName: string, _scopeId?: string): Promise<void>;
|
|
443
|
+
}
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/edit-mode/runtime-graph/types.d.ts
|
|
446
|
+
type ComponentNode = {
|
|
447
|
+
selectorId: SbSelector;
|
|
448
|
+
sourceId: SbElement;
|
|
449
|
+
type: any;
|
|
450
|
+
isSbComponent: boolean;
|
|
451
|
+
isHtmlElement: boolean;
|
|
452
|
+
noSelect?: boolean;
|
|
453
|
+
props?: Record<string, unknown>;
|
|
454
|
+
firstRenderedTag: SbSelector | undefined;
|
|
455
|
+
nearestSelectableAncestor: SbSelector | undefined;
|
|
456
|
+
displayName: string;
|
|
457
|
+
};
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/edit-mode/features/runtime-tracking-store.d.ts
|
|
460
|
+
declare class RuntimeTrackingStore {
|
|
461
|
+
readonly editStore: EditStore | undefined;
|
|
462
|
+
constructor(editStore: EditStore | undefined);
|
|
463
|
+
private graph;
|
|
464
|
+
private jsxNodes;
|
|
465
|
+
private sourceNodes;
|
|
466
|
+
registerComponent(selectorId: SbSelector, params: {
|
|
467
|
+
sourceId: SbElement;
|
|
468
|
+
type: any;
|
|
469
|
+
parentSelectorId?: SbSelector;
|
|
470
|
+
isSbComponent: boolean;
|
|
471
|
+
isHtmlElement: boolean;
|
|
472
|
+
noSelect?: boolean;
|
|
473
|
+
}): void;
|
|
474
|
+
getDisplayName(selectorId: SbSelector): string;
|
|
475
|
+
unregisterComponent(selectorId: SbSelector): void;
|
|
476
|
+
getFirstAnchorableTag(selectorId: SbSelector): SbSelector | undefined;
|
|
477
|
+
getNearestSelectableAncestor(selectorId: SbSelector, skipSelf?: boolean): SbSelector | undefined;
|
|
478
|
+
updatePropsForComponent(selectorId: SbSelector, props: Record<string, unknown>): void;
|
|
479
|
+
getComponent(selectorId: SbSelector): ComponentNode | undefined;
|
|
480
|
+
getComponentParent(selectorId: SbSelector): SbSelector;
|
|
481
|
+
getComponentChildren(selectorId: SbSelector): SbSelector[];
|
|
482
|
+
getSelectorIdsForSourceId(sourceId: SbElement): Set<SbSelector>;
|
|
483
|
+
getSourceId(selectorId: SbSelector): SbElement | undefined;
|
|
484
|
+
getClosestAncestorByType(selectorId: SbSelector, type: string): SbSelector | undefined;
|
|
485
|
+
hasRenderedNodes(): boolean;
|
|
486
|
+
}
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/edit-mode/features/ai-store.d.ts
|
|
489
|
+
declare class AiManager {
|
|
490
|
+
private readonly runtimeTrackingStore;
|
|
491
|
+
private _isTaggingEnabled;
|
|
492
|
+
private _isEditing;
|
|
493
|
+
private _editingComponents;
|
|
494
|
+
private _contextMode;
|
|
495
|
+
private _targetedComponents;
|
|
496
|
+
private _targetedSelectors;
|
|
497
|
+
private _hasHadSuccessfulBuild;
|
|
498
|
+
private _hasEverHadSuccessfulBuild;
|
|
499
|
+
constructor(runtimeTrackingStore: RuntimeTrackingStore);
|
|
500
|
+
getIsTaggingEnabled(): boolean;
|
|
501
|
+
getIsEditing(): boolean;
|
|
502
|
+
getShouldShowLoader(): boolean;
|
|
503
|
+
setIsTaggingEnabled(isTaggingEnabled: boolean): void;
|
|
504
|
+
getAiContextMode(): AiContextMode;
|
|
505
|
+
shouldToggleComponentInAiContext(): boolean;
|
|
506
|
+
getTargetedComponents(): `SB-${string}`[];
|
|
507
|
+
isEditingComponent(id: SbElement): boolean;
|
|
508
|
+
isTargetingComponent(id: SbElement): boolean;
|
|
509
|
+
startEditing(): void;
|
|
510
|
+
setEditingComponents(components: SbElement[]): void;
|
|
511
|
+
finishEditing(): void;
|
|
512
|
+
setAiContextMode(mode: AiContextMode, components?: SbElement[]): void;
|
|
513
|
+
addTargetedSelector(selectorId: SbSelector): void;
|
|
514
|
+
toggleTargetedSelector(selectorId: SbSelector): void;
|
|
515
|
+
isTargetedSelector(selectorId: SbSelector): boolean;
|
|
516
|
+
/**
|
|
517
|
+
* Returns true if we are targeting a different selector of the same source id, since in some cases we want to keep
|
|
518
|
+
* the same source targeted, but just highlight another selector of it
|
|
519
|
+
*/
|
|
520
|
+
isAlternateSourceIdTarget(sourceId: SbElement, selectorId: SbSelector): boolean;
|
|
521
|
+
handleRuntimeError(data: RuntimeErrorData): void;
|
|
522
|
+
clearRuntimeError(id: string): void;
|
|
523
|
+
markFirstBuildSuccess(): void;
|
|
524
|
+
private notifyLoaderState;
|
|
525
|
+
private removeAllSharedSelectors;
|
|
526
|
+
private removeAllSelectorsForSource;
|
|
527
|
+
}
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/edit-mode/features/connection-manager.d.ts
|
|
530
|
+
type ConnectionStatus = "pre-init" | "disconnected" | "connecting" | "connected";
|
|
531
|
+
declare class ConnectionManager {
|
|
532
|
+
connectionStatus: ConnectionStatus;
|
|
533
|
+
constructor();
|
|
534
|
+
initializeSocket(): void;
|
|
535
|
+
connect(): void;
|
|
536
|
+
disconnect(): void;
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/edit-mode/features/operation-store.d.ts
|
|
540
|
+
type OptimisticOperation<P> = {
|
|
541
|
+
type: keyof EditOperations;
|
|
542
|
+
payload: P;
|
|
543
|
+
id: string;
|
|
544
|
+
callback?: () => void;
|
|
545
|
+
};
|
|
546
|
+
type ReparentTransaction = OptimisticOperation<ReparentRequest>;
|
|
547
|
+
type SetPropertiesTransaction = OptimisticOperation<SetPropertiesRequest>;
|
|
548
|
+
type SetPropertyTransaction = OptimisticOperation<SetPropertyRequest>;
|
|
549
|
+
type CreateComponentTransaction = OptimisticOperation<CreateRequest>;
|
|
550
|
+
type DeleteComponentsTransaction = OptimisticOperation<DeleteRequest>;
|
|
551
|
+
type PendingTransaction = ReparentTransaction | SetPropertiesTransaction | SetPropertyTransaction | CreateComponentTransaction | DeleteComponentsTransaction;
|
|
552
|
+
declare class OperationManager {
|
|
553
|
+
private pendingTransactions;
|
|
554
|
+
private waitingForBatch;
|
|
555
|
+
private batchOperations;
|
|
556
|
+
private batchOperationTransactionId;
|
|
557
|
+
visibleSourceIds: string[];
|
|
558
|
+
constructor();
|
|
559
|
+
get allPendingTransactions(): PendingTransaction[];
|
|
560
|
+
get pendingReparentOperations(): ReparentTransaction[];
|
|
561
|
+
get pendingDeleteOperations(): DeleteComponentsTransaction[];
|
|
562
|
+
get pendingSetPropertiesOperations(): SetPropertiesTransaction[];
|
|
563
|
+
get hasPendingOperations(): boolean;
|
|
564
|
+
get allNames(): never[];
|
|
565
|
+
private executeOrAddToBatch;
|
|
566
|
+
private addPendingTransaction;
|
|
567
|
+
clearPendingTransactions(transactionIds: string[]): void;
|
|
568
|
+
batchUpdate(performOperations: () => void): void;
|
|
569
|
+
createComponent(payload: CreateRequest): void;
|
|
570
|
+
dropComponent(action: {
|
|
571
|
+
from: {
|
|
572
|
+
source: SourceLocation;
|
|
573
|
+
};
|
|
574
|
+
to: {
|
|
575
|
+
source: SourceLocation;
|
|
576
|
+
};
|
|
577
|
+
propsToChange?: Record<string, PropertyInfo>;
|
|
578
|
+
}): void;
|
|
579
|
+
deleteComponents(sourceIds: SbElement[]): void;
|
|
580
|
+
acknowledgeEditOperation(operation: EditOperationPayload<EditOperationType>): void;
|
|
581
|
+
writeRuntimeProperties(sourceId: SbElement, transactionId: string, updates: Record<string, PropertyInfo<unknown>>): void;
|
|
582
|
+
setWidgetProperties({
|
|
583
|
+
sourceId,
|
|
584
|
+
properties,
|
|
585
|
+
callback
|
|
586
|
+
}: {
|
|
587
|
+
sourceId: SbElement;
|
|
588
|
+
properties: Record<string, PropertyInfo<unknown>>;
|
|
589
|
+
callback?: () => void;
|
|
590
|
+
}): void;
|
|
591
|
+
setWidgetProperty({
|
|
592
|
+
sourceId,
|
|
593
|
+
property,
|
|
594
|
+
value,
|
|
595
|
+
callback
|
|
596
|
+
}: {
|
|
597
|
+
sourceId: SbElement;
|
|
598
|
+
property: string;
|
|
599
|
+
value: PropertyInfo<unknown>;
|
|
600
|
+
callback?: () => void;
|
|
601
|
+
}): void;
|
|
602
|
+
ensureFilesSynced(): Promise<void>;
|
|
603
|
+
generateSourceId(): `SB-${string}`;
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/edit-mode/features/properties-panel-manager.d.ts
|
|
607
|
+
declare class PropertiesPanelManager {
|
|
608
|
+
readonly editStore: EditStore;
|
|
609
|
+
readonly componentsManager: ComponentRegistry;
|
|
610
|
+
private propertiesDefinitions;
|
|
611
|
+
private propertiesPanelTrackerDisposer;
|
|
612
|
+
private _propertyLookupCache;
|
|
613
|
+
private removeHotReloadListener;
|
|
614
|
+
constructor(editStore: EditStore, componentsManager: ComponentRegistry);
|
|
615
|
+
getPropertiesPanel(selectorId: SbSelector): PropertiesPanelDefinition$1;
|
|
616
|
+
trackPropertiesPanel(selectorId: SbSelector): void;
|
|
617
|
+
untrackPropertiesPanel(): void;
|
|
618
|
+
getPropertiesDefinition(type: string): PropertiesDefinition | undefined;
|
|
619
|
+
setPropertiesDefinition(widgetType: string, propertiesDefinition: PropertiesDefinition): void;
|
|
620
|
+
updatePropertiesDefinitionForType(type: string): void;
|
|
621
|
+
computeAndApplySideEffectsForPropertyUpdate(payload: {
|
|
622
|
+
sourceId: SbElement;
|
|
623
|
+
updates: Record<string, PropertyInfo<unknown>>;
|
|
624
|
+
}): Record<SbElement, Record<string, PropertyInfo<unknown>>>;
|
|
625
|
+
/**
|
|
626
|
+
* When a custom component's source code is updated, we want to update the properties definition for that component.
|
|
627
|
+
* 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
|
|
628
|
+
* because Vite just compiled all of those out in library builds, so we inject a listener from the plugin instead.
|
|
629
|
+
* https://github.com/vitejs/vite/blob/v6.2/packages/vite/src/node/plugins/define.ts#L37
|
|
630
|
+
*/
|
|
631
|
+
private attachHotReloadListener;
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/edit-mode/features/resizing-store.d.ts
|
|
635
|
+
type ResizeState = {
|
|
636
|
+
selectorId: SbSelector;
|
|
637
|
+
sourceId: SbElement;
|
|
638
|
+
dragStartX: number;
|
|
639
|
+
dragStartY: number;
|
|
640
|
+
start: {
|
|
641
|
+
width: number;
|
|
642
|
+
height: number;
|
|
643
|
+
};
|
|
644
|
+
resizedPosition: string;
|
|
645
|
+
widthToUpdate: Dim | null;
|
|
646
|
+
heightToUpdate: Dim | null;
|
|
647
|
+
isApplyingResize: boolean;
|
|
648
|
+
};
|
|
649
|
+
declare class ResizingManager {
|
|
650
|
+
private root;
|
|
651
|
+
private _activeResizes;
|
|
652
|
+
constructor(root: RootStore);
|
|
653
|
+
get activeResize(): ResizeState | null | undefined;
|
|
654
|
+
private isLockedAspectRatio;
|
|
655
|
+
startResizing(dragStartX: number, dragStartY: number, selectorId: SbSelector, position: string): void;
|
|
656
|
+
private calculateDimension;
|
|
657
|
+
private handleResizeDimension;
|
|
658
|
+
resizeWidget(currentX: number, currentY: number, selectorId: SbSelector, canResizeWidth: boolean, canResizeHeight: boolean): void;
|
|
659
|
+
pendingResize(sourceId: SbElement): {
|
|
660
|
+
width: Dim | null;
|
|
661
|
+
height: Dim | null;
|
|
662
|
+
} | null;
|
|
663
|
+
get hasAnyPendingResize(): boolean;
|
|
664
|
+
get pendingResizes(): ResizeState[];
|
|
665
|
+
applyResize(selectorId: SbSelector): void;
|
|
666
|
+
}
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/edit-mode/features/ui-store.d.ts
|
|
669
|
+
declare class UIStore {
|
|
670
|
+
readonly root: RootStore;
|
|
671
|
+
readonly editStore: EditStore;
|
|
672
|
+
resizing: ResizingManager;
|
|
673
|
+
private _selectedSourceIds;
|
|
674
|
+
private _selectedSelectorIds;
|
|
675
|
+
private _focusedSelectorId;
|
|
676
|
+
private _rootInstanceData;
|
|
677
|
+
private newComponentSelectPromise;
|
|
678
|
+
constructor(root: RootStore, editStore: EditStore);
|
|
679
|
+
getMostRelevantSelectorIdsForSourceId(sourceId: SbElement): SbSelector[];
|
|
680
|
+
isSourceSelected(sourceId: SbElement): boolean;
|
|
681
|
+
getSelectedSourceIds(): SbElement[];
|
|
682
|
+
getSelectedSelectorIds(): SbSelector[];
|
|
683
|
+
private get focusedSelectorId();
|
|
684
|
+
getFocusedSourceId(): SbElement | null;
|
|
685
|
+
getFocusedSelectorId(): SbSelector | null;
|
|
686
|
+
setSelectedSourceIds(sourceIds: SbElement[]): void;
|
|
687
|
+
private subscribeNewSourceIdsToRuntimeSync;
|
|
688
|
+
setSelectedSelectorIds(selectorIds: SbSelector[]): void;
|
|
689
|
+
setFocusedIds(selectorId: SbSelector | null): void;
|
|
690
|
+
selectWidget(selectorId: SbSelector | null, _addToSelection?: boolean): void;
|
|
691
|
+
/**
|
|
692
|
+
* This is cursed because component selection actually needs to be done by instance ids, but
|
|
693
|
+
* instance IDs are only guaranteed to be stable after the component is rendered, while source IDs
|
|
694
|
+
* are assigned by the source tracker.
|
|
695
|
+
*
|
|
696
|
+
* If _any_ other selection comes in before we select something, we will cancel this reaction
|
|
697
|
+
*/
|
|
698
|
+
selectNewComponentBySourceId(sourceId: SbElement, selectorIdsToIgnore?: Set<`S-${string}`>): Promise<void>;
|
|
699
|
+
}
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region src/edit-mode/runtime-sync/runtime-subscriptions-store.d.ts
|
|
702
|
+
/**
|
|
703
|
+
* MobX store that manages runtime component subscriptions.
|
|
704
|
+
* Tracks which components are subscribed and builds fresh composites on-demand.
|
|
705
|
+
* The subscriptions getter allows startEditorSync reactions to track deep observables
|
|
706
|
+
* from buildComposite, eliminating the need for manual reaction management.
|
|
707
|
+
*/
|
|
708
|
+
declare class RuntimeSubscriptionsStore {
|
|
709
|
+
readonly editStore: EditStore;
|
|
710
|
+
private subscribedSourceIds;
|
|
711
|
+
constructor(editStore: EditStore);
|
|
712
|
+
subscribe(sourceId: SbElement): void;
|
|
713
|
+
unsubscribe(sourceId: SbElement): void;
|
|
714
|
+
clearAll(): void;
|
|
715
|
+
get subscriptions(): Record<SbElement, RuntimeSyncComposite | null>;
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region src/edit-mode/edit-store.d.ts
|
|
719
|
+
declare global {
|
|
720
|
+
interface Window {
|
|
721
|
+
_SB_ENABLE_SESSION_RECORDING?: boolean;
|
|
722
|
+
__SUPERBLOCKS_EDITOR_HOOK__: InstanceType<typeof EditStore>;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
declare class EditStore {
|
|
726
|
+
ui: UIStore;
|
|
727
|
+
operationManager: OperationManager;
|
|
728
|
+
propertiesPanelManager: PropertiesPanelManager;
|
|
729
|
+
runtimeTrackingStore: RuntimeTrackingStore;
|
|
730
|
+
connectionManager: ConnectionManager;
|
|
731
|
+
ai: AiManager;
|
|
732
|
+
runtimeSubscriptionsStore: RuntimeSubscriptionsStore;
|
|
733
|
+
isInitialized: boolean;
|
|
734
|
+
recordingInitialized: boolean;
|
|
735
|
+
interactionMode: InteractionMode;
|
|
736
|
+
lastInteractionMode: InteractionMode;
|
|
737
|
+
private viteMessageListeners;
|
|
738
|
+
constructor(rootStore: RootStore);
|
|
739
|
+
setIsInitialized(isInitialized: boolean): void;
|
|
740
|
+
setInteractionMode(mode: InteractionMode, notifyEditor?: boolean): void;
|
|
741
|
+
onViteMessage<T extends ViteMessageKind, Message extends Extract<ViteMessage, {
|
|
742
|
+
kind: T;
|
|
743
|
+
}>>(kind: T, callback: (message: Message) => void): () => void;
|
|
744
|
+
triggerViteMessage<T extends ViteMessageKind, Message extends Extract<ViteMessage, {
|
|
745
|
+
kind: T;
|
|
746
|
+
}>>(kind: T, message: Message): void;
|
|
747
|
+
startRecording(recording: {
|
|
748
|
+
userId: string;
|
|
749
|
+
appId: string;
|
|
750
|
+
sessionRecordingKey: string;
|
|
751
|
+
}): void;
|
|
752
|
+
}
|
|
753
|
+
//#endregion
|
|
754
|
+
//#region src/lib/internal-details/lib/root-store.d.ts
|
|
755
|
+
declare class RootStore {
|
|
756
|
+
apis: ApiManager;
|
|
757
|
+
componentRegistry: ComponentRegistry;
|
|
758
|
+
editStore?: EditStore;
|
|
759
|
+
locationStore: LocationStore;
|
|
760
|
+
currentPageScopeId: string | undefined;
|
|
761
|
+
applicationId: string | undefined;
|
|
762
|
+
userId: string | undefined;
|
|
763
|
+
windowOriginUrl: string | undefined;
|
|
764
|
+
private editorRegisteredCallbacks;
|
|
765
|
+
constructor();
|
|
766
|
+
setEditStore(editStore: EditStore): void;
|
|
767
|
+
onEditorRegistered(fn: () => void): void;
|
|
768
|
+
}
|
|
769
|
+
//#endregion
|
|
351
770
|
//#region src/lib/internal-details/lib/features/component-registry.d.ts
|
|
352
771
|
type DefaultTagNames = {
|
|
353
772
|
container: string;
|
|
354
773
|
button: string;
|
|
355
774
|
text: string;
|
|
356
775
|
};
|
|
776
|
+
/**
|
|
777
|
+
* TODO: The component registry could be split into two a thin layer always on, and move some stuff to the EditStore.
|
|
778
|
+
* Some of the actions (rename, delete) and some of the data (isDroppable) are editor-only.
|
|
779
|
+
*/
|
|
780
|
+
declare class ComponentRegistry implements ComponentRegistryShareState {
|
|
781
|
+
readonly rootStore: RootStore;
|
|
782
|
+
private _componentRegistry;
|
|
783
|
+
private _componentToType;
|
|
784
|
+
private _defaultContainerType;
|
|
785
|
+
private _defaultButtonType;
|
|
786
|
+
private _defaultTextType;
|
|
787
|
+
constructor(rootStore: RootStore);
|
|
788
|
+
private getOrCreateMetadata;
|
|
789
|
+
addComponent(type: string, rawComponent: React$2.ElementType, propertiesDefinition: PropertiesDefinition): void;
|
|
790
|
+
deleteComponent(type: string): void;
|
|
791
|
+
renameComponent(oldName: string, newName: string): void;
|
|
792
|
+
addManagedProps(type: string, props: ManagedPropsList): void;
|
|
793
|
+
deleteManagedProps(type: string): void;
|
|
794
|
+
addEditorTemplate(type: string, template: EditorTemplate<any>): void;
|
|
795
|
+
getEditorTemplates(type: string): EditorTemplate<any>[] | undefined;
|
|
796
|
+
getEditorConfigFromComponentType(type: any): EditorConfig$1<any> | undefined;
|
|
797
|
+
addEditorConfig(type: string, config: EditorConfig$1): void;
|
|
798
|
+
addInternalProps(type: string, props: Array<{
|
|
799
|
+
path: string;
|
|
800
|
+
factory: () => any;
|
|
801
|
+
}>): void;
|
|
802
|
+
getInternalProps(type: string): Array<{
|
|
803
|
+
path: string;
|
|
804
|
+
factory: () => any;
|
|
805
|
+
}>;
|
|
806
|
+
getEditorConfig(type: string): EditorConfig$1<any> | undefined;
|
|
807
|
+
get entityDefinitions(): Record<string, EntityDefinition>;
|
|
808
|
+
get libraryComponentCatalogs(): CatalogWithInternalDetails[];
|
|
809
|
+
get libraryComponentEditorConfigs(): Record<string, EditorConfig$1<any>>;
|
|
810
|
+
get customComponentList(): string[];
|
|
811
|
+
get containerTypes(): Set<string>;
|
|
812
|
+
get defaultTagNames(): DefaultTagNames;
|
|
813
|
+
get managedPropsRegistry(): Map<string, ManagedPropsList>;
|
|
814
|
+
getManagedProps(type: string): ManagedPropsList;
|
|
815
|
+
/**
|
|
816
|
+
* Get the component type string for a raw component reference.
|
|
817
|
+
* Used for registry-based component identity checking.
|
|
818
|
+
*/
|
|
819
|
+
getTypeForComponent(component: React$2.ComponentType<any>): string | undefined;
|
|
820
|
+
/**
|
|
821
|
+
* Check if a component or element type is registered in the component registry.
|
|
822
|
+
* Accepts both component references and string element names (e.g., "div").
|
|
823
|
+
* Used for component identity checking instead of symbol-based approach.
|
|
824
|
+
*/
|
|
825
|
+
hasComponent(component: React$2.ElementType | string): boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Get the property path with the record identifier if it exists. For example,
|
|
828
|
+
* `columns.columnName.label` becomes `columns.*.label`, for record properties.
|
|
829
|
+
*/
|
|
830
|
+
getPropertyWithRecordIdentifier(type: string, path: string): string;
|
|
831
|
+
}
|
|
357
832
|
//#endregion
|
|
358
833
|
//#region src/lib/internal-details/sb-wrapper.d.ts
|
|
359
834
|
type InjectedProps = {
|
|
@@ -383,9 +858,9 @@ interface EditorTemplate<P extends React$1.ComponentProps<any> = React$1.Compone
|
|
|
383
858
|
* A modal that when drag & dropped on the page will add a trigger button.
|
|
384
859
|
* The modal is closed by default, so the selected component after drop will be the trigger button.
|
|
385
860
|
*/
|
|
386
|
-
create?: (context: CreationContext) => CreateRequest<P> | Array<CreateRequest<P>>;
|
|
861
|
+
create?: (context: CreationContext) => CreateRequest$1<P> | Array<CreateRequest$1<P>>;
|
|
387
862
|
}
|
|
388
|
-
interface CreateRequest<P extends React$1.ComponentProps<any> = React$1.ComponentProps<any>> {
|
|
863
|
+
interface CreateRequest$1<P extends React$1.ComponentProps<any> = React$1.ComponentProps<any>> {
|
|
389
864
|
type: string;
|
|
390
865
|
properties?: PropertyValues<P>;
|
|
391
866
|
createAt?: "root" | "dropLocation";
|
|
@@ -440,16 +915,19 @@ type ManagedProp<T extends DataType = DataType> = PropertyForData<T> & {
|
|
|
440
915
|
contextual?: boolean;
|
|
441
916
|
computedArgs?: EvaluateOrValueComputedArgs;
|
|
442
917
|
};
|
|
918
|
+
type ManagedPropsList = Array<ManagedProp & {
|
|
919
|
+
propertiesPanelDisplay?: PropertiesPanelDisplay<any>;
|
|
920
|
+
}>;
|
|
443
921
|
/**
|
|
444
922
|
* Merges shared and variant properties for union types without creating intersections
|
|
445
923
|
* Variant properties override shared properties with the same key
|
|
446
924
|
*/
|
|
447
|
-
type MergeUnionVariant<SHARED extends Record<string, Prop<any, any>>, VARIANT extends Record<string, Prop<any, any>>> = Omit<SHARED, keyof VARIANT> & VARIANT;
|
|
925
|
+
type MergeUnionVariant<SHARED$1 extends Record<string, Prop<any, any>>, VARIANT extends Record<string, Prop<any, any>>> = Omit<SHARED$1, keyof VARIANT> & VARIANT;
|
|
448
926
|
/**
|
|
449
927
|
* Converts a union type to an intersection type
|
|
450
928
|
* Used to merge multiple section props into a single props type
|
|
451
929
|
*/
|
|
452
|
-
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I extends U) => void) ? I : never;
|
|
930
|
+
type UnionToIntersection<U$1> = (U$1 extends any ? (x: U$1) => void : never) extends ((x: infer I extends U$1) => void) ? I : never;
|
|
453
931
|
/**
|
|
454
932
|
* Controls how default values affect property optionality
|
|
455
933
|
* - RequiredIfDefault: Properties with default values become required
|
|
@@ -579,15 +1057,15 @@ declare class Prop<Type extends DataType, _HasDefault extends boolean = false, _
|
|
|
579
1057
|
* ```
|
|
580
1058
|
*/
|
|
581
1059
|
static record<T extends CompositeInputs>(props: T): RecordProp<T>;
|
|
582
|
-
static union<SHARED extends Record<string, Prop<unknown, boolean>>, VARIANTS extends UnionVariant<SHARED>[] = UnionVariant<SHARED>[]>(props: {
|
|
583
|
-
shared: SHARED;
|
|
584
|
-
variants: VARIANTS;
|
|
585
|
-
}): UnionProp<SHARED, VARIANTS, VARIANTS extends readonly any[] ? { [I in keyof VARIANTS]: SHARED & VARIANTS[I] }[number] : never>;
|
|
1060
|
+
static union<SHARED$1 extends Record<string, Prop<unknown, boolean>>, VARIANTS$1 extends UnionVariant<SHARED$1>[] = UnionVariant<SHARED$1>[]>(props: {
|
|
1061
|
+
shared: SHARED$1;
|
|
1062
|
+
variants: VARIANTS$1;
|
|
1063
|
+
}): UnionProp<SHARED$1, VARIANTS$1, VARIANTS$1 extends readonly any[] ? { [I in keyof VARIANTS$1]: SHARED$1 & VARIANTS$1[I] }[number] : never>;
|
|
586
1064
|
default(de: SingleInputProp<DataType>): Prop<Type, true>;
|
|
587
1065
|
contextual<TContext extends any[] | undefined = any[]>(computedArgs?: EvaluateOrValueComputedArgs): Prop<Type, _HasDefault, TContext>;
|
|
588
1066
|
setName(name: string): this;
|
|
589
1067
|
propertiesPanel<CT extends ControlType>(schema: Omit<Partial<PropertiesPanelDisplay<Type, CT>>, "isTriggerProperty">): this;
|
|
590
|
-
setDisplayProperty<K extends keyof PropertiesPanelDisplay<Type>>(property: K, value: PropertiesPanelDisplay<Type>[K]): this;
|
|
1068
|
+
setDisplayProperty<K$1 extends keyof PropertiesPanelDisplay<Type>>(property: K$1, value: PropertiesPanelDisplay<Type>[K$1]): this;
|
|
591
1069
|
docs(docs: Exclude<PropertyForData<DataType>["docs"], undefined>): this;
|
|
592
1070
|
build(): ManagedProp<Type>;
|
|
593
1071
|
toDefinition(props: Record<string, unknown>): WidgetPropertyDefinition<DataType> | undefined;
|
|
@@ -645,13 +1123,13 @@ declare class FunctionProp<ARGS extends any[] = any[], RETURN = any> extends Pro
|
|
|
645
1123
|
actionPanel(panel?: ActionPanel): this;
|
|
646
1124
|
getActionPanel(): ActionPanel | undefined;
|
|
647
1125
|
}
|
|
648
|
-
type UnionVariant<SHARED extends Record<string, Prop<any>>> = { [K in keyof SHARED]: Prop<any> };
|
|
649
|
-
declare class UnionProp<SHARED extends Record<string, Prop<unknown, boolean>>, VARIANTS extends UnionVariant<SHARED>[] = UnionVariant<SHARED>[], _OUTPUT = (VARIANTS extends readonly any[] ? { [I in keyof VARIANTS]: SHARED & VARIANTS[I] }[number] : never)> extends Prop<any> {
|
|
1126
|
+
type UnionVariant<SHARED$1 extends Record<string, Prop<any>>> = { [K in keyof SHARED$1]: Prop<any> };
|
|
1127
|
+
declare class UnionProp<SHARED$1 extends Record<string, Prop<unknown, boolean>>, VARIANTS$1 extends UnionVariant<SHARED$1>[] = UnionVariant<SHARED$1>[], _OUTPUT = (VARIANTS$1 extends readonly any[] ? { [I in keyof VARIANTS$1]: SHARED$1 & VARIANTS$1[I] }[number] : never)> extends Prop<any> {
|
|
650
1128
|
typeString: "union";
|
|
651
|
-
shared: SHARED;
|
|
652
|
-
variants: VARIANTS;
|
|
653
|
-
constructor(shared: SHARED, variants: VARIANTS);
|
|
654
|
-
getProps(): SHARED & Record<string, Prop<any, false, undefined>>;
|
|
1129
|
+
shared: SHARED$1;
|
|
1130
|
+
variants: VARIANTS$1;
|
|
1131
|
+
constructor(shared: SHARED$1, variants: VARIANTS$1);
|
|
1132
|
+
getProps(): SHARED$1 & Record<string, Prop<any, false, undefined>>;
|
|
655
1133
|
}
|
|
656
1134
|
//#endregion
|
|
657
1135
|
//#region src/lib/user-facing/components/app/props.d.ts
|
|
@@ -782,5 +1260,5 @@ declare const tailwindStylesCategory: (props?: {
|
|
|
782
1260
|
className: string;
|
|
783
1261
|
}>;
|
|
784
1262
|
//#endregion
|
|
785
|
-
export { App, type CreateChild, type CreationContext, type EditorConfig, type EditorTemplate, type FromChildToParentMessageTypes, type FromChildToParentMessageTypesMap, type FromParentToChildMessageTypes, type FromParentToChildMessageTypesMap, PageNotFound, Prop, type PropertiesPanelDefinition, Property, PropsCategory, RouteLoadError, Section, SbProvider as SuperblocksProvider, registerComponent, tailwindStylesCategory, useApiStateful as useApi, useSuperblocksGroups, useSuperblocksProfiles, useSuperblocksUser };
|
|
1263
|
+
export { App, type CreateChild, type CreationContext, type EditorConfig, type EditorTemplate, type FromChildToParentMessageTypes, type FromChildToParentMessageTypesMap, type FromParentToChildMessageTypes, type FromParentToChildMessageTypesMap, PageNotFound, Prop, type PropertiesPanelDefinition, Property, PropsCategory, RouteLoadError, Section, SbProvider as SuperblocksProvider, getAppMode, registerComponent, tailwindStylesCategory, useApiStateful as useApi, useSuperblocksGroups, useSuperblocksProfiles, useSuperblocksUser };
|
|
786
1264
|
//# sourceMappingURL=index.d.ts.map
|