@microsoft/vscode-ui 1.0.1-alpha.0b334ce1c.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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) Microsoft Corporation.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # VS Code UI
2
+
3
+ The package implements shared capabilities for User Interactions of Teams Toolkit IDE Extensions through API contracts defined in the [api](/packages/api).
4
+
5
+ ## Data Collection.
6
+
7
+ The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
8
+
9
+ ## Code of Conduct
10
+
11
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
12
+
13
+ ## Contributing
14
+
15
+ There are many ways in which you can participate in the project, for example:
16
+
17
+ - [Submit bugs and feature requests](https://github.com/OfficeDev/TeamsFx/issues), and help us verify as they are checked in
18
+ - Review [source code changes](https://github.com/OfficeDev/TeamsFx/pulls)
19
+
20
+ If you are interested in fixing issues and contributing directly to the code base, please see the [Contributing Guide](./CONTRIBUTING.md).
21
+
22
+ ## Reporting Security Issues
23
+
24
+ **Please do not report security vulnerabilities through public GitHub issues.**
25
+
26
+ Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
27
+
28
+ If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
29
+
30
+ You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
31
+
32
+ ## Trademarks
33
+
34
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
35
+
36
+ ## License
37
+
38
+ Copyright (c) Microsoft Corporation. All rights reserved.
39
+
40
+ Licensed under the [MIT](LICENSE.txt) license.
@@ -0,0 +1,14 @@
1
+ import { UserError } from "@microsoft/teamsfx-api";
2
+ export declare class UserCancelError extends UserError {
3
+ constructor(message: string, displayMessage: string);
4
+ }
5
+ export declare class EmptyOptionsError extends UserError {
6
+ constructor(message: string, displayMessage: string);
7
+ }
8
+ export declare class InternalUIError extends UserError {
9
+ constructor(message: string, displayMessage: string);
10
+ }
11
+ export declare class ScriptTimeoutError extends UserError {
12
+ constructor(message: string, displayMessage: string);
13
+ }
14
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CASpD;AAED,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CASpD;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CASpD;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CASpD"}
package/build/error.js ADDED
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT license.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.ScriptTimeoutError = exports.InternalUIError = exports.EmptyOptionsError = exports.UserCancelError = void 0;
6
+ const teamsfx_api_1 = require("@microsoft/teamsfx-api");
7
+ class UserCancelError extends teamsfx_api_1.UserError {
8
+ constructor(message, displayMessage) {
9
+ super({
10
+ source: "UI",
11
+ name: "UserCancelError",
12
+ message: message,
13
+ displayMessage: displayMessage,
14
+ categories: ["internal"],
15
+ });
16
+ }
17
+ }
18
+ exports.UserCancelError = UserCancelError;
19
+ class EmptyOptionsError extends teamsfx_api_1.UserError {
20
+ constructor(message, displayMessage) {
21
+ super({
22
+ source: "UI",
23
+ name: "EmptyOptionsError",
24
+ message: message,
25
+ displayMessage: displayMessage,
26
+ categories: ["internal"],
27
+ });
28
+ }
29
+ }
30
+ exports.EmptyOptionsError = EmptyOptionsError;
31
+ class InternalUIError extends teamsfx_api_1.UserError {
32
+ constructor(message, displayMessage) {
33
+ super({
34
+ source: "UI",
35
+ name: "InternalUIError",
36
+ message: message,
37
+ displayMessage: displayMessage,
38
+ categories: ["internal"],
39
+ });
40
+ }
41
+ }
42
+ exports.InternalUIError = InternalUIError;
43
+ class ScriptTimeoutError extends teamsfx_api_1.UserError {
44
+ constructor(message, displayMessage) {
45
+ super({
46
+ source: "UI",
47
+ name: "ScriptTimeoutError",
48
+ message: message,
49
+ displayMessage: displayMessage,
50
+ categories: ["external"],
51
+ });
52
+ }
53
+ }
54
+ exports.ScriptTimeoutError = ScriptTimeoutError;
55
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,wDAAmD;AAEnD,MAAa,eAAgB,SAAQ,uBAAS;IAC5C,YAAY,OAAe,EAAE,cAAsB;QACjD,KAAK,CAAC;YACJ,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE,OAAO;YAChB,cAAc,EAAE,cAAc;YAC9B,UAAU,EAAE,CAAC,UAAU,CAAC;SACzB,CAAC,CAAC;IACL,CAAC;CACF;AAVD,0CAUC;AAED,MAAa,iBAAkB,SAAQ,uBAAS;IAC9C,YAAY,OAAe,EAAE,cAAsB;QACjD,KAAK,CAAC;YACJ,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,OAAO;YAChB,cAAc,EAAE,cAAc;YAC9B,UAAU,EAAE,CAAC,UAAU,CAAC;SACzB,CAAC,CAAC;IACL,CAAC;CACF;AAVD,8CAUC;AAED,MAAa,eAAgB,SAAQ,uBAAS;IAC5C,YAAY,OAAe,EAAE,cAAsB;QACjD,KAAK,CAAC;YACJ,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE,OAAO;YAChB,cAAc,EAAE,cAAc;YAC9B,UAAU,EAAE,CAAC,UAAU,CAAC;SACzB,CAAC,CAAC;IACL,CAAC;CACF;AAVD,0CAUC;AAED,MAAa,kBAAmB,SAAQ,uBAAS;IAC/C,YAAY,OAAe,EAAE,cAAsB;QACjD,KAAK,CAAC;YACJ,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,OAAO;YAChB,cAAc,EAAE,cAAc;YAC9B,UAAU,EAAE,CAAC,UAAU,CAAC;SACzB,CAAC,CAAC;IACL,CAAC;CACF;AAVD,gDAUC"}
@@ -0,0 +1,5 @@
1
+ export * from "./ui";
2
+ export * from "./progressHandler";
3
+ export * from "./localize";
4
+ export * from "./error";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,MAAM,CAAC;AACrB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
package/build/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // Copyright (c) Microsoft Corporation.
5
+ // Licensed under the MIT license.
6
+ tslib_1.__exportStar(require("./ui"), exports);
7
+ tslib_1.__exportStar(require("./progressHandler"), exports);
8
+ tslib_1.__exportStar(require("./localize"), exports);
9
+ tslib_1.__exportStar(require("./error"), exports);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,+CAAqB;AACrB,4DAAkC;AAClC,qDAA2B;AAC3B,kDAAwB"}
@@ -0,0 +1,33 @@
1
+ export interface Localizer {
2
+ loadingOptionsPlaceholder(): string;
3
+ loadingDefaultPlaceholder(): string;
4
+ loadingOptionsTimeoutMessage(): string;
5
+ multiSelectKeyboardPlaceholder(): string;
6
+ defaultFolder(): string;
7
+ browse(): string;
8
+ emptyOptionErrorMessage(): string;
9
+ emptyOptionErrorDisplayMessage(): string;
10
+ cancelErrorMessage(): string;
11
+ cancelErrorDisplayMessage(): string;
12
+ internalErrorMessage(action: string): string;
13
+ internalErrorDisplayMessage(action: string): string;
14
+ commandTimeoutErrorMessage(command: string): string;
15
+ commandTimeoutErrorDisplayMessage(command: string): string;
16
+ }
17
+ export declare class DefaultLocalizer implements Localizer {
18
+ commandTimeoutErrorMessage(command: string): string;
19
+ commandTimeoutErrorDisplayMessage(command: string): string;
20
+ internalErrorDisplayMessage(action: string): string;
21
+ internalErrorMessage(action: string): string;
22
+ cancelErrorMessage(): string;
23
+ cancelErrorDisplayMessage(): string;
24
+ emptyOptionErrorMessage(): string;
25
+ emptyOptionErrorDisplayMessage(): string;
26
+ browse(): string;
27
+ defaultFolder(): string;
28
+ multiSelectKeyboardPlaceholder(): string;
29
+ loadingOptionsTimeoutMessage(): string;
30
+ loadingDefaultPlaceholder(): string;
31
+ loadingOptionsPlaceholder(): string;
32
+ }
33
+ //# sourceMappingURL=localize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localize.d.ts","sourceRoot":"","sources":["../src/localize.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,yBAAyB,IAAI,MAAM,CAAC;IACpC,yBAAyB,IAAI,MAAM,CAAC;IACpC,4BAA4B,IAAI,MAAM,CAAC;IACvC,8BAA8B,IAAI,MAAM,CAAC;IACzC,aAAa,IAAI,MAAM,CAAC;IACxB,MAAM,IAAI,MAAM,CAAC;IACjB,uBAAuB,IAAI,MAAM,CAAC;IAClC,8BAA8B,IAAI,MAAM,CAAC;IACzC,kBAAkB,IAAI,MAAM,CAAC;IAC7B,yBAAyB,IAAI,MAAM,CAAC;IACpC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7C,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACpD,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACpD,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED,qBAAa,gBAAiB,YAAW,SAAS;IAChD,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAGnD,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAG1D,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAGnD,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAG5C,kBAAkB,IAAI,MAAM;IAG5B,yBAAyB,IAAI,MAAM;IAGnC,uBAAuB,IAAI,MAAM;IAGjC,8BAA8B,IAAI,MAAM;IAGxC,MAAM,IAAI,MAAM;IAGhB,aAAa,IAAI,MAAM;IAGvB,8BAA8B,IAAI,MAAM;IAGxC,4BAA4B,IAAI,MAAM;IAGtC,yBAAyB,IAAI,MAAM;IAGnC,yBAAyB,IAAI,MAAM;CAGpC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT license.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.DefaultLocalizer = void 0;
6
+ class DefaultLocalizer {
7
+ commandTimeoutErrorMessage(command) {
8
+ return "Execute command timeout: " + command;
9
+ }
10
+ commandTimeoutErrorDisplayMessage(command) {
11
+ return "Execute command timeout: " + command;
12
+ }
13
+ internalErrorDisplayMessage(action) {
14
+ return "VS Code failed to operate: " + action;
15
+ }
16
+ internalErrorMessage(action) {
17
+ return "VS Code failed to operate: " + action;
18
+ }
19
+ cancelErrorMessage() {
20
+ return "User canceled.";
21
+ }
22
+ cancelErrorDisplayMessage() {
23
+ return "User canceled.";
24
+ }
25
+ emptyOptionErrorMessage() {
26
+ return "Empty options.";
27
+ }
28
+ emptyOptionErrorDisplayMessage() {
29
+ return "Empty options.";
30
+ }
31
+ browse() {
32
+ return "Browse...";
33
+ }
34
+ defaultFolder() {
35
+ return "Default folder";
36
+ }
37
+ multiSelectKeyboardPlaceholder() {
38
+ return " (Space key to check/uncheck)";
39
+ }
40
+ loadingOptionsTimeoutMessage() {
41
+ return "Loading options timeout.";
42
+ }
43
+ loadingDefaultPlaceholder() {
44
+ return "Loading default value...";
45
+ }
46
+ loadingOptionsPlaceholder() {
47
+ return "Loading options...";
48
+ }
49
+ }
50
+ exports.DefaultLocalizer = DefaultLocalizer;
51
+ //# sourceMappingURL=localize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localize.js","sourceRoot":"","sources":["../src/localize.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAmBlC,MAAa,gBAAgB;IAC3B,0BAA0B,CAAC,OAAe;QACxC,OAAO,2BAA2B,GAAG,OAAO,CAAC;IAC/C,CAAC;IACD,iCAAiC,CAAC,OAAe;QAC/C,OAAO,2BAA2B,GAAG,OAAO,CAAC;IAC/C,CAAC;IACD,2BAA2B,CAAC,MAAc;QACxC,OAAO,6BAA6B,GAAG,MAAM,CAAC;IAChD,CAAC;IACD,oBAAoB,CAAC,MAAc;QACjC,OAAO,6BAA6B,GAAG,MAAM,CAAC;IAChD,CAAC;IACD,kBAAkB;QAChB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,yBAAyB;QACvB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,uBAAuB;QACrB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,8BAA8B;QAC5B,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,MAAM;QACJ,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,aAAa;QACX,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,8BAA8B;QAC5B,OAAO,+BAA+B,CAAC;IACzC,CAAC;IACD,4BAA4B;QAC1B,OAAO,0BAA0B,CAAC;IACpC,CAAC;IACD,yBAAyB;QACvB,OAAO,0BAA0B,CAAC;IACpC,CAAC;IACD,yBAAyB;QACvB,OAAO,oBAAoB,CAAC;IAC9B,CAAC;CACF;AA3CD,4CA2CC"}
@@ -0,0 +1,17 @@
1
+ import { IProgressHandler } from "@microsoft/teamsfx-api";
2
+ export declare class ProgressHandler implements IProgressHandler {
3
+ private totalSteps;
4
+ private currentStep;
5
+ private title;
6
+ private detail?;
7
+ private ended;
8
+ private mutex;
9
+ private view;
10
+ private resolve?;
11
+ constructor(title: string, totalSteps: number, view?: "output" | "terminal");
12
+ private generateWholeMessage;
13
+ start(detail?: string): Promise<void>;
14
+ end(success: boolean): Promise<undefined>;
15
+ next(detail?: string): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=progressHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progressHandler.d.ts","sourceRoot":"","sources":["../src/progressHandler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAM,MAAM,wBAAwB,CAAC;AAE9D,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,OAAO,CAAC,CAA2B;gBAE/B,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,QAAQ,GAAG,UAAqB;IASrF,OAAO,CAAC,oBAAoB;IAoBrB,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBrC,GAAG,CAAC,OAAO,EAAE,OAAO;IAQd,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM;CAUlC"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT license.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.ProgressHandler = void 0;
6
+ const tslib_1 = require("tslib");
7
+ const async_mutex_1 = require("async-mutex");
8
+ const util = tslib_1.__importStar(require("util"));
9
+ const vscode_1 = require("vscode");
10
+ const teamsfx_api_1 = require("@microsoft/teamsfx-api");
11
+ class ProgressHandler {
12
+ constructor(title, totalSteps, view = "output") {
13
+ this.totalSteps = totalSteps;
14
+ this.currentStep = 0;
15
+ this.title = title;
16
+ this.ended = false;
17
+ this.mutex = new async_mutex_1.Mutex();
18
+ this.view = view;
19
+ }
20
+ generateWholeMessage() {
21
+ const head = this.title;
22
+ const step = `[${this.currentStep}/${this.totalSteps}]`;
23
+ let tail = "";
24
+ if (this.view === "output") {
25
+ tail = ` ${util.format("Check [Output panel](%s) for details.", "command:fx-extension.showOutputChannel")}`;
26
+ }
27
+ else if (this.view === "terminal") {
28
+ tail = ` ${util.format("Check [terminal window](%s) for details.", "command:workbench.action.terminal.focus")}`;
29
+ }
30
+ const detail = this.detail ? ` ${this.detail}` : " Prepare task.";
31
+ return util.format("%s%s%s", `${head}: ${step}`, detail, tail);
32
+ }
33
+ start(detail) {
34
+ this.resolve = undefined;
35
+ this.currentStep = 0;
36
+ this.ended = false;
37
+ this.detail = detail;
38
+ void vscode_1.window.withProgress({
39
+ location: vscode_1.ProgressLocation.Notification,
40
+ cancellable: false,
41
+ }, async (progress) => {
42
+ do {
43
+ const status = { message: this.generateWholeMessage() };
44
+ progress.report(status);
45
+ await new Promise((_resolve) => (this.resolve = _resolve));
46
+ } while (!this.ended);
47
+ return teamsfx_api_1.ok(null);
48
+ });
49
+ return Promise.resolve(undefined);
50
+ }
51
+ end(success) {
52
+ this.ended = true;
53
+ if (this.resolve) {
54
+ this.resolve(null);
55
+ }
56
+ return Promise.resolve(undefined);
57
+ }
58
+ async next(detail) {
59
+ await this.mutex.runExclusive(() => {
60
+ this.detail = detail;
61
+ this.currentStep++;
62
+ this.totalSteps = Math.max(this.currentStep, this.totalSteps);
63
+ if (this.resolve) {
64
+ this.resolve(null);
65
+ }
66
+ });
67
+ }
68
+ }
69
+ exports.ProgressHandler = ProgressHandler;
70
+ //# sourceMappingURL=progressHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progressHandler.js","sourceRoot":"","sources":["../src/progressHandler.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,6CAAoC;AACpC,mDAA6B;AAC7B,mCAAkD;AAClD,wDAA8D;AAE9D,MAAa,eAAe;IAW1B,YAAY,KAAa,EAAE,UAAkB,EAAE,OAA8B,QAAQ;QACnF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEO,oBAAoB;QAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC;QACxD,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC1B,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CACpB,uCAAuC,EACvC,wCAAwC,CACzC,E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AAG,IAAI,CAAC;QAClB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACpB;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAAe;QAC/B,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC9D,IAAI,IAAI,CAAC,OAAO,EAAE;gBAChB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlFD,0CAkFC"}
package/build/ui.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { QuickPickItem } from "vscode";
2
+ import { Colors, ConfirmConfig, ConfirmResult, ExecuteFuncConfig, FxError, InputResult, InputTextConfig, InputTextResult, IProgressHandler, MultiSelectConfig, MultiSelectResult, Result, SelectFileConfig, SelectFileResult, SelectFilesConfig, SelectFilesResult, SelectFolderConfig, SelectFolderResult, SingleFileOrInputConfig, SingleSelectConfig, SingleSelectResult, UserInteraction } from "@microsoft/teamsfx-api";
3
+ import { Localizer } from "./localize";
4
+ export declare function sleep(ms: number): Promise<void>;
5
+ export interface FxQuickPickItem extends QuickPickItem {
6
+ id: string;
7
+ data?: unknown;
8
+ }
9
+ /***
10
+ * This is the default implementation of UserInteraction in vscode.
11
+ */
12
+ export declare class VSCodeUI implements UserInteraction {
13
+ terminalName: string;
14
+ assembleError: (e: any) => FxError;
15
+ localizer: Localizer;
16
+ constructor(terminalName: string, assembleError: (e: any) => FxError, localizer?: Localizer);
17
+ selectOption(config: SingleSelectConfig): Promise<Result<SingleSelectResult, FxError>>;
18
+ selectOptions(config: MultiSelectConfig): Promise<Result<MultiSelectResult, FxError>>;
19
+ inputText(config: InputTextConfig): Promise<Result<InputTextResult, FxError>>;
20
+ selectFolder(config: SelectFolderConfig): Promise<Result<SelectFolderResult, FxError>>;
21
+ selectFile(config: SelectFileConfig): Promise<Result<SelectFileResult, FxError>>;
22
+ selectFiles(config: SelectFilesConfig): Promise<Result<SelectFilesResult, FxError>>;
23
+ selectFileInQuickPick(config: SelectFileConfig, type: "file" | "files", defaultValue?: string): Promise<Result<SelectFileResult, FxError>>;
24
+ selectFileInQuickPick(config: SelectFilesConfig, type: "file" | "files", defaultValue?: string): Promise<Result<SelectFilesResult, FxError>>;
25
+ openUrl(link: string): Promise<Result<boolean, FxError>>;
26
+ selectFileOrInput(config: SingleFileOrInputConfig): Promise<Result<InputResult<string>, FxError>>;
27
+ confirm(config: ConfirmConfig): Promise<Result<ConfirmResult, FxError>>;
28
+ showMessage(level: "info" | "warn" | "error", message: string, modal: boolean, ...items: string[]): Promise<Result<string | undefined, FxError>>;
29
+ showMessage(level: "info" | "warn" | "error", message: Array<{
30
+ content: string;
31
+ color: Colors;
32
+ }>, modal: boolean, ...items: string[]): Promise<Result<string | undefined, FxError>>;
33
+ createProgressBar(title: string, totalSteps: number): IProgressHandler;
34
+ executeFunction(config: ExecuteFuncConfig): Promise<unknown>;
35
+ runCommand(args: {
36
+ cmd: string;
37
+ workingDirectory?: string | undefined;
38
+ shell?: string | undefined;
39
+ timeout?: number | undefined;
40
+ env?: {
41
+ [k: string]: string;
42
+ } | undefined;
43
+ shellName?: string;
44
+ iconPath?: string;
45
+ }): Promise<Result<string, FxError>>;
46
+ openFile(filePath: string): Promise<Result<boolean, FxError>>;
47
+ }
48
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAKA,OAAO,EAQL,aAA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