@pstdio/workbench 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -153,6 +153,7 @@ export declare interface CommandParamDescriptor {
153
153
  accept?: string;
154
154
  multiple?: boolean;
155
155
  metadata?: Record<string, unknown>;
156
+ resolvedFrom?: "resource";
156
157
  }
157
158
 
158
159
  export declare interface CommandParamOption {
@@ -352,7 +353,13 @@ export declare interface ControlsUpdateValueInput {
352
353
  resource?: ResourceRef;
353
354
  }
354
355
 
355
- export declare const createResourceBreadcrumbItems: (resources: ResourceRegistry, resource: ResourceRef | undefined) => WorkbenchBreadcrumbItem[];
356
+ export declare const createResourceBreadcrumbItems: (resources: ResourceRegistry, resource: ResourceRef | undefined, views?: WorkbenchViewRegistry) => WorkbenchBreadcrumbItem[];
357
+
358
+ export declare const createStatusBarRegistry: (input: CreateWorkbenchStatusBarRegistryInput) => WorkbenchStatusBarRegistry;
359
+
360
+ export declare const createStatusRegistry: () => WorkbenchStatusRegistry;
361
+
362
+ export declare const createViewRegistry: (input: CreateWorkbenchViewRegistryInput) => WorkbenchViewRegistry;
356
363
 
357
364
  export declare const createWorkbenchCore: (input?: CreateWorkbenchCoreInput) => WorkbenchCore;
358
365
 
@@ -382,6 +389,15 @@ export declare const createWorkbenchSelectionResourceMetadata: (resource: Pick<R
382
389
  "workbench.selectionResourceUri": string;
383
390
  };
384
391
 
392
+ declare interface CreateWorkbenchStatusBarRegistryInput {
393
+ hasView(viewId: string): boolean;
394
+ }
395
+
396
+ declare interface CreateWorkbenchViewRegistryInput {
397
+ getPanel(panelId: string): unknown;
398
+ openPanel(panelId: string, input?: OpenWorkbenchPanelInput): WorkbenchPanelInstance | Promise<WorkbenchPanelInstance>;
399
+ }
400
+
385
401
  /**
386
402
  * Renders its own page. `render` returns `unknown` so core stays React-free — the
387
403
  * React layer treats the result as a node, exactly like WorkbenchRendererRegistration.
@@ -666,11 +682,12 @@ export declare interface HistoryController {
666
682
  restore(): HistoryEntry | undefined;
667
683
  flush(): void;
668
684
  clear(): void;
685
+ migrateState(transform: (state: HistoryStoreState) => HistoryStoreState): void;
669
686
  }
670
687
 
671
688
  export declare type HistoryEntry = WorkbenchNavigationEntry;
672
689
 
673
- declare interface HistoryStoreState {
690
+ export declare interface HistoryStoreState {
674
691
  entries: readonly WorkbenchNavigationEntry[];
675
692
  cursor: number;
676
693
  recentlyClosed: readonly WorkbenchNavigationEntry[];
@@ -679,6 +696,8 @@ declare interface HistoryStoreState {
679
696
 
680
697
  export declare const isWorkbenchModePanelAvailable: (mode: WorkbenchModeContribution | undefined, panel: WorkbenchPanelRegion) => boolean;
681
698
 
699
+ export declare const isWorkbenchViewHierarchyNode: (node: WorkbenchHierarchyNode) => node is WorkbenchViewHierarchyNode;
700
+
682
701
  export declare interface KanbanRendererContribution<TRow extends KanbanRendererRow = KanbanRendererRow> {
683
702
  id: string;
684
703
  title: string;
@@ -985,11 +1004,14 @@ declare interface MenuRegistryStoreState {
985
1004
  export declare interface NavigationDispatcherContext {
986
1005
  canOpenResource?(resource: ResourceRef): boolean;
987
1006
  canOpenPanel?(panelId: string): boolean;
1007
+ canOpenView?(viewId: string): boolean;
988
1008
  canExecuteCommand?(commandId: string): boolean;
989
1009
  createCheckpoint?(): undefined | (() => void);
990
1010
  openResource(resource: ResourceRef, input?: OpenResourceInput): Promise<unknown>;
991
1011
  openPanel(panelId: string, input?: OpenWorkbenchPanelInput): unknown;
1012
+ openView(viewId: string, input?: OpenWorkbenchViewInput): Promise<unknown> | unknown;
992
1013
  executeCommand(commandId: string, args?: unknown): Promise<unknown> | unknown;
1014
+ openHref?(href: string): Promise<unknown> | unknown;
993
1015
  }
994
1016
 
995
1017
  export declare interface NavigationParser {
@@ -1030,7 +1052,12 @@ export declare interface NavigationTargetCompound {
1030
1052
  targets: readonly NavigationTargetItem[];
1031
1053
  }
1032
1054
 
1033
- export declare type NavigationTargetItem = NavigationTargetResource | NavigationTargetPanel | NavigationTargetCommand;
1055
+ declare interface NavigationTargetHref {
1056
+ kind: "href";
1057
+ href: string;
1058
+ }
1059
+
1060
+ export declare type NavigationTargetItem = NavigationTargetResource | NavigationTargetView | NavigationTargetPanel | NavigationTargetCommand | NavigationTargetHref;
1034
1061
 
1035
1062
  export declare interface NavigationTargetPanel {
1036
1063
  kind: "panel";
@@ -1044,6 +1071,12 @@ export declare interface NavigationTargetResource {
1044
1071
  input?: OpenResourceInput;
1045
1072
  }
1046
1073
 
1074
+ export declare interface NavigationTargetView {
1075
+ kind: "view";
1076
+ viewId: string;
1077
+ input?: OpenWorkbenchViewInput;
1078
+ }
1079
+
1047
1080
  declare const NO_GROUPING = "none";
1048
1081
 
1049
1082
  export declare interface NotificationRegistry {
@@ -1060,7 +1093,8 @@ export declare interface OpenResourceInput {
1060
1093
  }
1061
1094
 
1062
1095
  declare interface OpenWidgetInput {
1063
- resource?: ResourceRef;
1096
+ viewId?: string | null;
1097
+ resource?: ResourceRef | null;
1064
1098
  title?: string;
1065
1099
  region?: WorkbenchRegion;
1066
1100
  role?: WorkbenchWidgetRole;
@@ -1078,7 +1112,10 @@ declare interface OpenWidgetInput {
1078
1112
  }
1079
1113
 
1080
1114
  export declare interface OpenWorkbenchPanelInput {
1081
- resource?: ResourceRef;
1115
+ /** Set by the view registry. Low-level layout callers should leave this undefined. */
1116
+ viewId?: string | null;
1117
+ /** `null` explicitly clears an existing singleton placement's resource binding. */
1118
+ resource?: ResourceRef | null;
1082
1119
  title?: string;
1083
1120
  region?: WorkbenchRegion;
1084
1121
  role?: WorkbenchWidgetRole;
@@ -1090,6 +1127,8 @@ export declare interface OpenWorkbenchPanelInput {
1090
1127
  strategy?: WorkbenchPanelOpenStrategy;
1091
1128
  }
1092
1129
 
1130
+ export declare type OpenWorkbenchViewInput = Omit<OpenWorkbenchPanelInput, "viewId">;
1131
+
1093
1132
  export declare interface PersistedCompositionLayout {
1094
1133
  regions: Partial<Record<DockedCompositionRegion, PersistedCompositionRegionState>>;
1095
1134
  }
@@ -1104,7 +1143,7 @@ export declare interface PersistedTreeRendererStates {
1104
1143
  }
1105
1144
 
1106
1145
  export declare interface PersistedWorkbenchHistory extends Omit<HistoryStoreState, "hydrating"> {
1107
- version: 1;
1146
+ version: 1 | 2;
1108
1147
  }
1109
1148
 
1110
1149
  declare interface PersistedWorkbenchPanels {
@@ -1234,6 +1273,10 @@ declare interface RegisteredWorkbenchNotification extends RegisteredContribution
1234
1273
  metadata?: Record<string, unknown>;
1235
1274
  }
1236
1275
 
1276
+ declare type RegisteredWorkbenchStatusSet = WorkbenchStatusSetContribution & RegisteredContributionMetadata;
1277
+
1278
+ export declare type RegisteredWorkbenchView = WorkbenchViewContribution & RegisteredContributionMetadata;
1279
+
1237
1280
  export declare const resolveAnchorRegion: (anchorId: AnchorId) => "status" | "nav" | "activity" | "sidenav-header" | "sidenav" | "main-header" | "main-left-menu" | "main" | "main-right-menu" | "secondary-header" | "secondary-left-menu" | "secondary" | "secondary-right-menu" | "side-header" | "side-left-menu" | "side" | "side-right-menu" | "overlay";
1238
1281
 
1239
1282
  export declare const resolveComposition: (input: ResolveCompositionInput) => ResolvedComposition;
@@ -1304,7 +1347,7 @@ export declare const resourceContextMenuPath: (resourceKind: string) => MenuPath
1304
1347
 
1305
1348
  export declare interface ResourceHierarchyCycle {
1306
1349
  code: typeof resourceHierarchyCycleCode;
1307
- path: ResourceRef[];
1350
+ path: WorkbenchHierarchyNode[];
1308
1351
  repeatedUri: string;
1309
1352
  }
1310
1353
 
@@ -1314,7 +1357,7 @@ export declare interface ResourceHierarchyProvider {
1314
1357
  id: string;
1315
1358
  priority?: number;
1316
1359
  canResolve(resource: ResourceRef): boolean;
1317
- getParent(resource: ResourceRef): ResourceRef | undefined;
1360
+ getParent(resource: ResourceRef): WorkbenchHierarchyNode | undefined;
1318
1361
  }
1319
1362
 
1320
1363
  export declare interface ResourceKindContribution {
@@ -1373,7 +1416,7 @@ export declare interface ResourceRegistry {
1373
1416
  listResources(query: string): readonly ResourceBrowseEntry[];
1374
1417
  registerHierarchyProvider(provider: ResourceHierarchyProvider): Disposable_2;
1375
1418
  listHierarchyProviders(): ResolvedResourceHierarchyProvider[];
1376
- walkHierarchy(resource: ResourceRef | undefined): ResourceRef[];
1419
+ walkHierarchy(resource: ResourceRef | undefined): WorkbenchHierarchyNode[];
1377
1420
  onDidDetectHierarchyCycle(listener: (cycle: ResourceHierarchyCycle) => void): Disposable_2;
1378
1421
  isOpeningResource(): boolean;
1379
1422
  openResource(resource: ResourceRef, input?: OpenResourceInput): Promise<WorkbenchPanelInstance>;
@@ -1799,6 +1842,7 @@ declare interface WorkbenchCompositionRegionPanels {
1799
1842
 
1800
1843
  export declare interface WorkbenchCore extends WorkbenchCoreContributionContext {
1801
1844
  host: WorkbenchHost;
1845
+ layout: WorkbenchLayoutModel;
1802
1846
  registerModule(module: WorkbenchModuleContribution): Disposable_2;
1803
1847
  unregisterModule(moduleId: string): void;
1804
1848
  }
@@ -1814,7 +1858,7 @@ declare interface WorkbenchCoreContributionContext {
1814
1858
  history: HistoryController;
1815
1859
  keybindings: KeybindingRegistry;
1816
1860
  lastResource: WorkbenchLastResourceController;
1817
- layout: WorkbenchLayoutModel;
1861
+ layout: WorkbenchModuleLayoutModel;
1818
1862
  modes: WorkbenchModeRegistry;
1819
1863
  navigation: NavigationRegistry;
1820
1864
  navigator: WorkbenchNavigator;
@@ -1823,7 +1867,10 @@ declare interface WorkbenchCoreContributionContext {
1823
1867
  preferences: PreferenceRegistry;
1824
1868
  renderers: WorkbenchRenderers;
1825
1869
  resources: ResourceRegistry;
1870
+ views: WorkbenchViewRegistry;
1826
1871
  settings: SettingsRegistry;
1872
+ statusBar: WorkbenchStatusBarRegistry;
1873
+ statuses: WorkbenchStatusRegistry;
1827
1874
  shell: WorkbenchShellController;
1828
1875
  sidePanel: WorkbenchSidePanelController;
1829
1876
  terminal: WorkbenchTerminalController;
@@ -1859,6 +1906,8 @@ declare interface WorkbenchFocusState {
1859
1906
  activeRegion: WorkbenchFocusRegionId | undefined;
1860
1907
  }
1861
1908
 
1909
+ export declare type WorkbenchHierarchyNode = ResourceRef | WorkbenchViewHierarchyNode;
1910
+
1862
1911
  declare interface WorkbenchHistoryPersistence {
1863
1912
  getHistory(scope?: string): PersistedWorkbenchHistory | undefined;
1864
1913
  setHistory(state: PersistedWorkbenchHistory, scope?: string): void;
@@ -1902,11 +1951,16 @@ export declare interface WorkbenchLocationEligibility {
1902
1951
  resourceKinds?: string[];
1903
1952
  resourceIds?: string[];
1904
1953
  canOpen?(resource: ResourceRef): boolean;
1954
+ canOpenLocation?(location: {
1955
+ resource?: ResourceRef;
1956
+ viewId?: string;
1957
+ }): boolean;
1905
1958
  }
1906
1959
 
1907
1960
  declare interface WorkbenchLocationRef {
1908
1961
  key: string;
1909
1962
  modeId?: string;
1963
+ viewId?: string;
1910
1964
  resource?: ResourceRef;
1911
1965
  contributionId?: string;
1912
1966
  instanceKey?: string;
@@ -1977,6 +2031,8 @@ export declare interface WorkbenchModuleContribution {
1977
2031
 
1978
2032
  export declare type WorkbenchModuleContributionContext = WorkbenchModuleContext;
1979
2033
 
2034
+ declare type WorkbenchModuleLayoutModel = Omit<WorkbenchLayoutModel, "registerWidget">;
2035
+
1980
2036
  declare interface WorkbenchNavigationCommit {
1981
2037
  modeId: string | undefined;
1982
2038
  resource: ResourceRef | undefined;
@@ -1985,14 +2041,15 @@ declare interface WorkbenchNavigationCommit {
1985
2041
 
1986
2042
  declare type WorkbenchNavigationDiagnosticCode = "navigation_mode_missing" | "navigation_resource_missing" | "navigation_resource_incompatible" | "navigation_default_missing" | "navigation_target_stale";
1987
2043
 
1988
- declare interface WorkbenchNavigationEntry {
2044
+ export declare interface WorkbenchNavigationEntry {
1989
2045
  entryId: string;
1990
2046
  recordedAt: number;
1991
2047
  location: WorkbenchLocationRef;
1992
2048
  selectedSubPanels: Partial<Record<WorkbenchPanelRegion, WorkbenchSubPanelRef>>;
1993
- kind: "resource" | "widget" | "mode";
2049
+ kind: "resource" | "view" | "widget" | "mode";
1994
2050
  modeId?: string;
1995
2051
  resource?: ResourceRef;
2052
+ viewId?: string;
1996
2053
  widgetId?: string;
1997
2054
  contributionId?: string;
1998
2055
  title?: string;
@@ -2111,6 +2168,7 @@ export declare interface WorkbenchPanelContribution {
2111
2168
  export declare interface WorkbenchPanelInstance {
2112
2169
  instanceId: string;
2113
2170
  panelId: string;
2171
+ viewId?: string;
2114
2172
  ownerId?: string;
2115
2173
  source?: ContributionSource;
2116
2174
  resource?: ResourceRef;
@@ -2340,6 +2398,52 @@ export declare interface WorkbenchSnapshot {
2340
2398
  layout: WorkbenchLayout;
2341
2399
  }
2342
2400
 
2401
+ export declare interface WorkbenchStatusBarItem {
2402
+ id: string;
2403
+ viewId: string;
2404
+ slot: WorkbenchStatusBarSlot;
2405
+ order?: number;
2406
+ isVisible?(): boolean;
2407
+ }
2408
+
2409
+ export declare interface WorkbenchStatusBarRegistry {
2410
+ store: WorkbenchStore<WorkbenchStatusBarRegistryState>;
2411
+ registerItem(item: WorkbenchStatusBarItem): Disposable_2;
2412
+ getItem(id: string): WorkbenchStatusBarItem | undefined;
2413
+ listItems(): WorkbenchStatusBarItem[];
2414
+ listVisibleItems(slot?: WorkbenchStatusBarSlot): WorkbenchStatusBarItem[];
2415
+ }
2416
+
2417
+ export declare interface WorkbenchStatusBarRegistryState {
2418
+ items: Record<string, WorkbenchStatusBarItem>;
2419
+ }
2420
+
2421
+ export declare type WorkbenchStatusBarSlot = "leading" | "trailing";
2422
+
2423
+ export declare interface WorkbenchStatusRegistry {
2424
+ store: WorkbenchStore<WorkbenchStatusRegistryState>;
2425
+ registerStatusSet(contribution: WorkbenchStatusSetContribution, metadata?: ContributionMetadata): Disposable_2;
2426
+ getStatusSet(id: string): RegisteredWorkbenchStatusSet | undefined;
2427
+ listStatusSets(): RegisteredWorkbenchStatusSet[];
2428
+ getStatuses(id: string): readonly WorkflowStatus[] | undefined;
2429
+ load(id: string): Promise<readonly WorkflowStatus[]>;
2430
+ query(id: string): Promise<readonly WorkflowStatus[]>;
2431
+ save(id: string, statuses: readonly WorkflowStatus[]): Promise<readonly WorkflowStatus[]>;
2432
+ }
2433
+
2434
+ export declare interface WorkbenchStatusRegistryState {
2435
+ statusSets: Record<string, RegisteredWorkbenchStatusSet>;
2436
+ values: Record<string, readonly WorkflowStatus[]>;
2437
+ }
2438
+
2439
+ export declare interface WorkbenchStatusSetContribution {
2440
+ id: string;
2441
+ title: string;
2442
+ actions?: readonly WorkflowStatusAction[];
2443
+ query(): Promise<readonly WorkflowStatus[]> | readonly WorkflowStatus[];
2444
+ save?(statuses: readonly WorkflowStatus[]): Promise<readonly WorkflowStatus[]> | readonly WorkflowStatus[];
2445
+ }
2446
+
2343
2447
  declare interface WorkbenchStore<TState> {
2344
2448
  getState(): TState;
2345
2449
  getInitialState(): TState;
@@ -2361,7 +2465,7 @@ declare type WorkbenchSubPanelContribution = Omit<WidgetContribution, "region" |
2361
2465
  fallbackRegion?: WorkbenchPanelRegion;
2362
2466
  } & WorkbenchPanelMenusContribution;
2363
2467
 
2364
- declare interface WorkbenchSubPanelRef {
2468
+ export declare interface WorkbenchSubPanelRef {
2365
2469
  contributionId: string;
2366
2470
  resourceUri?: string;
2367
2471
  instanceKey?: string;
@@ -2384,6 +2488,7 @@ export declare interface WorkbenchTerminalController {
2384
2488
  setSessionOpener(opener: WorkbenchTerminalSessionOpener | null): void;
2385
2489
  /** Opens a session; the live adapter stays host-side and only the id is returned. */
2386
2490
  open(input: {
2491
+ bindingId?: string;
2387
2492
  request: WorkbenchTerminalSessionRequest;
2388
2493
  title?: string;
2389
2494
  }): Promise<{
@@ -2402,6 +2507,7 @@ export declare interface WorkbenchTerminalController {
2402
2507
  sessionId: string;
2403
2508
  signal?: string;
2404
2509
  }): Promise<void>;
2510
+ killBinding(bindingId: string): Promise<void>;
2405
2511
  subscribe(sessionId: string, sink: WorkbenchTerminalSessionSink): () => void;
2406
2512
  getSession(sessionId: string): WorkbenchTerminalSessionModel | undefined;
2407
2513
  listSessions(): WorkbenchTerminalSessionModel[];
@@ -2467,9 +2573,60 @@ export declare const workbenchTopHeaderLeadingMenuPath: MenuPath;
2467
2573
 
2468
2574
  export declare const workbenchTopHeaderTrailingMenuPath: MenuPath;
2469
2575
 
2576
+ export declare interface WorkbenchViewContribution {
2577
+ id: string;
2578
+ panelId: string;
2579
+ title?: string;
2580
+ icon?: string;
2581
+ path?: string;
2582
+ pathAliases?: readonly string[];
2583
+ aliases?: readonly string[];
2584
+ resource?: ResourceRef;
2585
+ canResolve?(): boolean;
2586
+ resolveInput?(input: OpenWorkbenchViewInput): OpenWorkbenchPanelInput;
2587
+ }
2588
+
2589
+ export declare interface WorkbenchViewHierarchyNode {
2590
+ type: "view";
2591
+ viewId: string;
2592
+ label?: string;
2593
+ icon?: string;
2594
+ }
2595
+
2596
+ export declare const workbenchViewIdContextKey = "workbench.view.id";
2597
+
2598
+ export declare interface WorkbenchViewOpenEvent {
2599
+ viewId: string;
2600
+ input: OpenWorkbenchViewInput;
2601
+ instance: WorkbenchPanelInstance;
2602
+ }
2603
+
2604
+ export declare interface WorkbenchViewRegistry {
2605
+ store: WorkbenchStore<WorkbenchViewRegistryStoreState>;
2606
+ registerView(view: WorkbenchViewContribution, metadata?: ContributionMetadata): Disposable_2;
2607
+ getView(viewId: string): RegisteredWorkbenchView | undefined;
2608
+ listViews(): RegisteredWorkbenchView[];
2609
+ resolveViewId(viewId: string): string | undefined;
2610
+ resolvePath(path: string): {
2611
+ kind: "view";
2612
+ viewId: string;
2613
+ } | undefined;
2614
+ canResolveView(viewId: string): boolean;
2615
+ isOpeningView(): boolean;
2616
+ openView(viewId: string, input?: OpenWorkbenchViewInput): Promise<WorkbenchPanelInstance>;
2617
+ onDidOpenView(listener: (event: WorkbenchViewOpenEvent) => void): Disposable_2;
2618
+ }
2619
+
2620
+ export declare interface WorkbenchViewRegistryStoreState {
2621
+ views: Record<string, RegisteredWorkbenchView>;
2622
+ aliases: Record<string, string>;
2623
+ paths: Record<string, string>;
2624
+ }
2625
+
2470
2626
  export declare interface WorkbenchWidgetPlacement {
2471
2627
  widgetId: string;
2472
2628
  contributionId: string;
2629
+ viewId?: string;
2473
2630
  ownerId?: string;
2474
2631
  source?: ContributionSource;
2475
2632
  resource?: ResourceRef;
@@ -2493,4 +2650,27 @@ declare interface WorkbenchWidgetTab {
2493
2650
  customMenuRendererId?: string;
2494
2651
  }
2495
2652
 
2653
+ export declare interface WorkflowStatus {
2654
+ id: string;
2655
+ label: string;
2656
+ color: string;
2657
+ icon?: string | null;
2658
+ sortOrder: number;
2659
+ isDefault?: boolean;
2660
+ board?: WorkflowStatusBoardRules;
2661
+ }
2662
+
2663
+ export declare interface WorkflowStatusAction {
2664
+ id: string;
2665
+ label: string;
2666
+ icon?: string;
2667
+ }
2668
+
2669
+ export declare interface WorkflowStatusBoardRules {
2670
+ canCreate?: boolean;
2671
+ canDragIn?: boolean;
2672
+ canDragOut?: boolean;
2673
+ actions?: readonly string[];
2674
+ }
2675
+
2496
2676
  export { }