@pptb/types 1.0.13 → 1.0.14
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/README.md +16 -0
- package/package.json +1 -1
- package/toolboxAPI.d.ts +28 -3
package/README.md
CHANGED
|
@@ -103,6 +103,16 @@ if (filePath) {
|
|
|
103
103
|
console.log("File saved to:", filePath);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
// Select a folder for exporting assets
|
|
107
|
+
const targetFolder = await toolboxAPI.utils.selectPath({
|
|
108
|
+
type: "folder",
|
|
109
|
+
title: "Choose export directory",
|
|
110
|
+
defaultPath: "/Users/me/Downloads",
|
|
111
|
+
});
|
|
112
|
+
if (!targetFolder) {
|
|
113
|
+
console.log("User canceled folder selection");
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
// Get current theme
|
|
107
117
|
const theme = await toolboxAPI.utils.getCurrentTheme();
|
|
108
118
|
console.log("Current theme:", theme); // "light" or "dark"
|
|
@@ -288,6 +298,12 @@ Core platform features organized into namespaces:
|
|
|
288
298
|
|
|
289
299
|
- Opens a save dialog and writes the content. Returns the saved file path or null if canceled
|
|
290
300
|
|
|
301
|
+
- **selectPath(options?: SelectPathOptions)**: Promise<string | null>
|
|
302
|
+
|
|
303
|
+
- Opens a native dialog to select either a file or folder (defaults to file)
|
|
304
|
+
- Supports custom titles, button labels, default paths, and filters when selecting files
|
|
305
|
+
- Returns the selected path or null if the user cancels
|
|
306
|
+
|
|
291
307
|
- **getCurrentTheme()**: Promise<"light" | "dark">
|
|
292
308
|
|
|
293
309
|
- Returns the current UI theme setting
|
package/package.json
CHANGED
package/toolboxAPI.d.ts
CHANGED
|
@@ -27,6 +27,26 @@ declare namespace ToolBoxAPI {
|
|
|
27
27
|
duration?: number; // Duration in milliseconds, 0 for persistent
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* File dialog filter definition
|
|
32
|
+
*/
|
|
33
|
+
export interface FileDialogFilter {
|
|
34
|
+
name: string;
|
|
35
|
+
extensions: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Options for selecting a file or folder path
|
|
40
|
+
*/
|
|
41
|
+
export interface SelectPathOptions {
|
|
42
|
+
type?: "file" | "folder";
|
|
43
|
+
title?: string;
|
|
44
|
+
message?: string;
|
|
45
|
+
buttonLabel?: string;
|
|
46
|
+
defaultPath?: string;
|
|
47
|
+
filters?: FileDialogFilter[];
|
|
48
|
+
}
|
|
49
|
+
|
|
30
50
|
/**
|
|
31
51
|
* Event types that can be emitted by the ToolBox
|
|
32
52
|
*/
|
|
@@ -128,17 +148,17 @@ declare namespace ToolBoxAPI {
|
|
|
128
148
|
* Get the currently active Dataverse connection
|
|
129
149
|
*/
|
|
130
150
|
getActiveConnection: () => Promise<DataverseConnection | null>;
|
|
131
|
-
|
|
151
|
+
|
|
132
152
|
/**
|
|
133
153
|
* Get the secondary connection for multi-connection tools
|
|
134
154
|
*/
|
|
135
155
|
getSecondaryConnection: () => Promise<DataverseConnection | null>;
|
|
136
|
-
|
|
156
|
+
|
|
137
157
|
/**
|
|
138
158
|
* Get the secondary connection URL for multi-connection tools
|
|
139
159
|
*/
|
|
140
160
|
getSecondaryConnectionUrl: () => Promise<string | null>;
|
|
141
|
-
|
|
161
|
+
|
|
142
162
|
/**
|
|
143
163
|
* Get the secondary connection ID for multi-connection tools
|
|
144
164
|
*/
|
|
@@ -164,6 +184,11 @@ declare namespace ToolBoxAPI {
|
|
|
164
184
|
*/
|
|
165
185
|
saveFile: (defaultPath: string, content: any) => Promise<string | null>;
|
|
166
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Open a native dialog to select either a file or a folder and return the chosen path
|
|
189
|
+
*/
|
|
190
|
+
selectPath: (options?: SelectPathOptions) => Promise<string | null>;
|
|
191
|
+
|
|
167
192
|
/**
|
|
168
193
|
* Get the current UI theme (light or dark)
|
|
169
194
|
*/
|