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