@vicinae/api 0.14.2 → 0.14.4
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/api/alert.js +2 -0
- package/dist/api/proto/ui.d.ts +1 -2
- package/dist/api/proto/ui.js +5 -5
- package/dist/api/toast.d.ts +1 -1
- package/dist/api/toast.js +9 -1
- package/package.json +1 -1
package/dist/api/alert.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.confirmAlert = exports.Alert = void 0;
|
|
4
4
|
const bus_1 = require("./bus");
|
|
5
|
+
const image_1 = require("./image");
|
|
5
6
|
const ui_1 = require("./proto/ui");
|
|
6
7
|
var Alert;
|
|
7
8
|
(function (Alert) {
|
|
@@ -22,6 +23,7 @@ const confirmAlert = async (options) => {
|
|
|
22
23
|
const req = ui_1.ConfirmAlertRequest.create({
|
|
23
24
|
title: options.title,
|
|
24
25
|
description: options.message ?? "Are you sure?",
|
|
26
|
+
icon: options.icon && (0, image_1.serializeProtoImage)(options.icon),
|
|
25
27
|
rememberUserChoice: false,
|
|
26
28
|
primaryAction: {
|
|
27
29
|
title: options.primaryAction?.title ?? "Confirm",
|
package/dist/api/proto/ui.d.ts
CHANGED
|
@@ -80,8 +80,7 @@ export interface RenderRequest {
|
|
|
80
80
|
export interface ConfirmAlertRequest {
|
|
81
81
|
title: string;
|
|
82
82
|
description: string;
|
|
83
|
-
|
|
84
|
-
icon?: string | undefined;
|
|
83
|
+
icon: Image | undefined;
|
|
85
84
|
dismissAction: ConfirmAlertAction | undefined;
|
|
86
85
|
primaryAction: ConfirmAlertAction | undefined;
|
|
87
86
|
rememberUserChoice: boolean;
|
package/dist/api/proto/ui.js
CHANGED
|
@@ -852,7 +852,7 @@ exports.ConfirmAlertRequest = {
|
|
|
852
852
|
writer.uint32(18).string(message.description);
|
|
853
853
|
}
|
|
854
854
|
if (message.icon !== undefined) {
|
|
855
|
-
writer.uint32(26).
|
|
855
|
+
exports.Image.encode(message.icon, writer.uint32(26).fork()).join();
|
|
856
856
|
}
|
|
857
857
|
if (message.dismissAction !== undefined) {
|
|
858
858
|
exports.ConfirmAlertAction.encode(message.dismissAction, writer.uint32(34).fork()).join();
|
|
@@ -890,7 +890,7 @@ exports.ConfirmAlertRequest = {
|
|
|
890
890
|
if (tag !== 26) {
|
|
891
891
|
break;
|
|
892
892
|
}
|
|
893
|
-
message.icon = reader.
|
|
893
|
+
message.icon = exports.Image.decode(reader, reader.uint32());
|
|
894
894
|
continue;
|
|
895
895
|
}
|
|
896
896
|
case 4: {
|
|
@@ -926,7 +926,7 @@ exports.ConfirmAlertRequest = {
|
|
|
926
926
|
return {
|
|
927
927
|
title: isSet(object.title) ? globalThis.String(object.title) : "",
|
|
928
928
|
description: isSet(object.description) ? globalThis.String(object.description) : "",
|
|
929
|
-
icon: isSet(object.icon) ?
|
|
929
|
+
icon: isSet(object.icon) ? exports.Image.fromJSON(object.icon) : undefined,
|
|
930
930
|
dismissAction: isSet(object.dismissAction) ? exports.ConfirmAlertAction.fromJSON(object.dismissAction) : undefined,
|
|
931
931
|
primaryAction: isSet(object.primaryAction) ? exports.ConfirmAlertAction.fromJSON(object.primaryAction) : undefined,
|
|
932
932
|
rememberUserChoice: isSet(object.rememberUserChoice) ? globalThis.Boolean(object.rememberUserChoice) : false,
|
|
@@ -941,7 +941,7 @@ exports.ConfirmAlertRequest = {
|
|
|
941
941
|
obj.description = message.description;
|
|
942
942
|
}
|
|
943
943
|
if (message.icon !== undefined) {
|
|
944
|
-
obj.icon = message.icon;
|
|
944
|
+
obj.icon = exports.Image.toJSON(message.icon);
|
|
945
945
|
}
|
|
946
946
|
if (message.dismissAction !== undefined) {
|
|
947
947
|
obj.dismissAction = exports.ConfirmAlertAction.toJSON(message.dismissAction);
|
|
@@ -961,7 +961,7 @@ exports.ConfirmAlertRequest = {
|
|
|
961
961
|
const message = createBaseConfirmAlertRequest();
|
|
962
962
|
message.title = object.title ?? "";
|
|
963
963
|
message.description = object.description ?? "";
|
|
964
|
-
message.icon = object.icon
|
|
964
|
+
message.icon = (object.icon !== undefined && object.icon !== null) ? exports.Image.fromPartial(object.icon) : undefined;
|
|
965
965
|
message.dismissAction = (object.dismissAction !== undefined && object.dismissAction !== null)
|
|
966
966
|
? exports.ConfirmAlertAction.fromPartial(object.dismissAction)
|
|
967
967
|
: undefined;
|
package/dist/api/toast.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare class Toast {
|
|
|
51
51
|
*/
|
|
52
52
|
get secondaryAction(): Toast.ActionOptions | undefined;
|
|
53
53
|
set secondaryAction(action: Toast.ActionOptions | undefined);
|
|
54
|
+
update(): Promise<void>;
|
|
54
55
|
/**
|
|
55
56
|
* Shows the Toast.
|
|
56
57
|
*
|
|
@@ -63,7 +64,6 @@ export declare class Toast {
|
|
|
63
64
|
* @returns A Promise that resolves when toast is hidden.
|
|
64
65
|
*/
|
|
65
66
|
hide(): Promise<void>;
|
|
66
|
-
private update;
|
|
67
67
|
}
|
|
68
68
|
export declare namespace Toast {
|
|
69
69
|
/**
|
package/dist/api/toast.js
CHANGED
|
@@ -95,6 +95,7 @@ class Toast {
|
|
|
95
95
|
}
|
|
96
96
|
set style(style) {
|
|
97
97
|
this.options.style = style;
|
|
98
|
+
this.update();
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
101
|
* The title of a Toast. Displayed on the top.
|
|
@@ -104,6 +105,7 @@ class Toast {
|
|
|
104
105
|
}
|
|
105
106
|
set title(title) {
|
|
106
107
|
this.options.title = title;
|
|
108
|
+
this.update();
|
|
107
109
|
}
|
|
108
110
|
/**
|
|
109
111
|
* An additional message for the Toast. Useful to show more information, e.g. an identifier of a newly created asset.
|
|
@@ -132,6 +134,13 @@ class Toast {
|
|
|
132
134
|
set secondaryAction(action) {
|
|
133
135
|
this.options.secondaryAction = action;
|
|
134
136
|
}
|
|
137
|
+
async update() {
|
|
138
|
+
await bus_1.bus.turboRequest("ui.showToast", {
|
|
139
|
+
id: this.id,
|
|
140
|
+
title: this.title,
|
|
141
|
+
style: this.styleMap[this.style],
|
|
142
|
+
});
|
|
143
|
+
}
|
|
135
144
|
/**
|
|
136
145
|
* Shows the Toast.
|
|
137
146
|
*
|
|
@@ -173,7 +182,6 @@ class Toast {
|
|
|
173
182
|
async hide() {
|
|
174
183
|
await bus_1.bus.turboRequest("ui.hideToast", { id: this.id });
|
|
175
184
|
}
|
|
176
|
-
update;
|
|
177
185
|
}
|
|
178
186
|
exports.Toast = Toast;
|
|
179
187
|
(function (Toast) {
|