@pstdio/workbench 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.d.ts CHANGED
@@ -2,6 +2,7 @@ import { BoxProps } from '@chakra-ui/react';
2
2
  import { ComponentType } from 'react';
3
3
  import { Context } from 'react';
4
4
  import { FileIconThemePreferenceOption as FileIconThemePreferenceOption_2 } from '@pstdio/ui';
5
+ import { FileUploadValue } from '@pstdio/ui';
5
6
  import { IconProps } from '@chakra-ui/react';
6
7
  import { JSX } from 'react/jsx-runtime';
7
8
  import { JSXElementConstructor } from 'react';
@@ -111,7 +112,13 @@ declare interface Command {
111
112
  params?: CommandParamSchema;
112
113
  }
113
114
 
115
+ export declare interface CommandFilesParamValue {
116
+ refs: string[];
117
+ uploads: FileUploadValue[];
118
+ }
119
+
114
120
  declare interface CommandHandler<TArgs = unknown, TResult = unknown> {
121
+ prepareArgs?(args: TArgs, context?: WorkbenchCommandExecutionContext, onArgsChange?: (args: TArgs) => void): TArgs | Promise<TArgs>;
115
122
  execute(args: TArgs, context?: WorkbenchCommandExecutionContext): TResult | Promise<TResult>;
116
123
  isEnabled?(args: TArgs): boolean;
117
124
  isVisible?(args: TArgs): boolean;
@@ -168,6 +175,8 @@ declare interface CommandParamDescriptor {
168
175
  options?: CommandParamOption[];
169
176
  templateType?: string;
170
177
  resourceType?: string;
178
+ accept?: string;
179
+ multiple?: boolean;
171
180
  metadata?: Record<string, unknown>;
172
181
  }
173
182
 
@@ -208,7 +217,7 @@ declare interface CommandParamsRequest {
208
217
  context?: WorkbenchCommandExecutionContext;
209
218
  }
210
219
 
211
- export declare type CommandParamValue = string | boolean | string[] | undefined;
220
+ export declare type CommandParamValue = string | boolean | string[] | CommandFilesParamValue | undefined;
212
221
 
213
222
  declare interface CommandRegistry {
214
223
  store: WorkbenchStore<CommandRegistryStoreState>;
@@ -218,6 +227,7 @@ declare interface CommandRegistry {
218
227
  isCommandEnabled(id: string, args?: unknown): boolean;
219
228
  isCommandVisible(id: string, args?: unknown): boolean;
220
229
  isCommandToggled(id: string, args?: unknown): boolean;
230
+ prepareCommandArgs(id: string, args: unknown, context?: WorkbenchCommandExecutionContext, onArgsChange?: (args: unknown) => void): Promise<unknown>;
221
231
  executeCommand(id: string, args?: unknown, context?: WorkbenchCommandExecutionContext): Promise<unknown>;
222
232
  onDidExecuteError(listener: WorkbenchCommandExecutionErrorListener): Disposable_2;
223
233
  }
@@ -341,6 +351,8 @@ declare interface ControlsUpdateValueInput {
341
351
  resource?: ResourceRef;
342
352
  }
343
353
 
354
+ export declare const createCommandFilesParamValue: (input?: Partial<CommandFilesParamValue>) => CommandFilesParamValue;
355
+
344
356
  export declare const createControllerTerminalBridge: (terminal: WorkbenchTerminalController, options?: ControllerTerminalBridgeOptions) => TerminalBridge;
345
357
 
346
358
  export declare const createTreeContextMenuItems: (input: CreateTreeContextMenuItemsInput) => ListRowActionMenuItem[];
@@ -575,10 +587,21 @@ declare interface FileIconThemeRegistry {
575
587
 
576
588
  declare interface FileRendererContent {
577
589
  fileName?: string;
590
+ /** Workspace-relative path shown above the file preview. */
591
+ filePath?: string;
578
592
  mimeType?: string;
579
593
  content?: string;
580
594
  dataUrl?: string;
581
595
  placeholder?: string;
596
+ /** Override contribution-level save support for one loaded file. */
597
+ editable?: boolean;
598
+ /** Request Monaco for text that automatic dispatch would open as markdown. */
599
+ textRenderer?: "automatic" | "monaco";
600
+ /** Represent a deliberate no-file selection without an editable blank document. */
601
+ emptyState?: {
602
+ title: string;
603
+ description?: string;
604
+ };
582
605
  /** Ordered backing-store revision when one is available. */
583
606
  revision?: string;
584
607
  }
@@ -658,6 +681,8 @@ declare interface HistoryStoreState {
658
681
  hydrating: boolean;
659
682
  }
660
683
 
684
+ export declare const isCommandFilesParamValue: (value: unknown) => value is CommandFilesParamValue;
685
+
661
686
  export declare const isSettingsScopeVisible: (scope: SettingsScope | undefined, hasProjectScope: boolean) => boolean;
662
687
 
663
688
  declare interface KanbanRendererContribution<TRow extends KanbanRendererRow = KanbanRendererRow> {
@@ -1113,7 +1138,7 @@ declare interface PreferenceScopeRef {
1113
1138
  declare type PreferenceValue = boolean | number | string | string[] | number[] | boolean[] | Record<string, unknown>;
1114
1139
 
1115
1140
  /** Narrows an editor value back to what a command param can carry. */
1116
- export declare const readCommandParamValue: (value: ParamValue) => CommandParamValue;
1141
+ export declare const readCommandParamValue: (value: ParamValue, entry?: CommandParamEntry) => CommandParamValue;
1117
1142
 
1118
1143
  declare interface RegisteredCommand extends RegisteredContributionMetadata {
1119
1144
  command: Command;
@@ -1191,7 +1216,9 @@ declare interface RegisteredWorkbenchNotification extends RegisteredContribution
1191
1216
 
1192
1217
  declare type ResolvedResourceHierarchyProvider = Required<ResourceHierarchyProvider>;
1193
1218
 
1194
- declare type ResolvedResourcePresenter = Required<ResourcePresenter>;
1219
+ declare type ResolvedResourcePresenter = Omit<ResourcePresenter, "priority"> & {
1220
+ priority: number;
1221
+ };
1195
1222
 
1196
1223
  declare interface ResourceBrowseEntry {
1197
1224
  resource: ResourceRef;
@@ -1253,6 +1280,7 @@ declare interface ResourcePresenter {
1253
1280
  priority?: number;
1254
1281
  canOpen(resource: ResourceRef): boolean;
1255
1282
  open(resource: ResourceRef, input: OpenResourceInput): WorkbenchPanelInstance | Promise<WorkbenchPanelInstance>;
1283
+ afterOpen?(resource: ResourceRef, instance: WorkbenchPanelInstance, input: OpenResourceInput): void;
1256
1284
  }
1257
1285
 
1258
1286
  declare interface ResourceProvider {
@@ -1483,11 +1511,13 @@ declare interface TreeNode {
1483
1511
  target?: NavigationTarget;
1484
1512
  /** Visual row variant for non-data rows such as placeholders. */
1485
1513
  rowVariant?: TreeNodeRowVariant;
1514
+ inlineInput?: TreeNodeInlineInput;
1486
1515
  actions?: TreeAction[];
1487
1516
  contextMenuActions?: TreeAction[];
1488
1517
  contextMenuPath?: MenuPath;
1489
1518
  menuPath?: MenuPath;
1490
1519
  menuPlacement?: "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "left-start";
1520
+ showContextMenuTrigger?: boolean;
1491
1521
  collapsible?: boolean;
1492
1522
  disabled?: boolean;
1493
1523
  children?: TreeNode[];
@@ -1498,6 +1528,18 @@ declare interface TreeNode {
1498
1528
  canHide?: boolean;
1499
1529
  /** When false, the node stays fixed within its Sidenav group. */
1500
1530
  canReorder?: boolean;
1531
+ /** Allow this node to be moved to another tree location. */
1532
+ canDrag?: boolean;
1533
+ /** Allow movable nodes to be dropped on this node. */
1534
+ canDrop?: boolean;
1535
+ }
1536
+
1537
+ declare interface TreeNodeInlineInput {
1538
+ ariaLabel: string;
1539
+ defaultValue?: string;
1540
+ placeholder?: string;
1541
+ onCommit(value: string): Promise<void> | void;
1542
+ onCancel?(): void;
1501
1543
  }
1502
1544
 
1503
1545
  declare type TreeNodeRowVariant = "empty-state";
@@ -1506,6 +1548,8 @@ declare interface TreeRendererContribution {
1506
1548
  id: string;
1507
1549
  title: string;
1508
1550
  icon?: string;
1551
+ searchable?: boolean;
1552
+ searchPlaceholder?: string;
1509
1553
  when?: string;
1510
1554
  defaultExpandedSectionIds?: string[];
1511
1555
  defaultExpandedNodeIds?: string[];
@@ -1513,6 +1557,7 @@ declare interface TreeRendererContribution {
1513
1557
  getHeader?(ctx: TreeContext): Promise<TreeNode[]> | TreeNode[];
1514
1558
  getFooter?(ctx: TreeContext): Promise<TreeNode[]> | TreeNode[];
1515
1559
  getChildren(node: TreeNode, ctx: TreeContext): Promise<TreeNode[]> | TreeNode[];
1560
+ moveNode?(source: TreeNode, target: TreeNode | undefined, ctx: TreeContext): Promise<void> | void;
1516
1561
  }
1517
1562
 
1518
1563
  declare type TreeRendererImplementation = (input: WorkbenchPanelRenderInput & {
@@ -2150,6 +2195,7 @@ export declare interface WorkbenchOverlayWidgetConfig {
2150
2195
  scrollBehavior?: "inside" | "outside";
2151
2196
  closeOnEscape?: boolean;
2152
2197
  closeOnInteractOutside?: boolean;
2198
+ /** Controls dialog semantics. Every workbench overlay blocks background pointer input. */
2153
2199
  modal?: boolean;
2154
2200
  preventScroll?: boolean;
2155
2201
  trapFocus?: boolean;