@sliprail/sdk 0.1.12 → 0.1.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/lib/index.d.ts +18 -7
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export type WindowOptions = {
|
|
|
41
41
|
onClose?: () => void;
|
|
42
42
|
};
|
|
43
43
|
export type WindowControl = {
|
|
44
|
+
shortcutId: string;
|
|
44
45
|
close: () => void;
|
|
45
46
|
show: () => void;
|
|
46
47
|
hide: () => void;
|
|
@@ -59,6 +60,10 @@ export type LivePreviewContent = {
|
|
|
59
60
|
content: string;
|
|
60
61
|
type?: 'info' | 'warn' | 'error' | 'hint';
|
|
61
62
|
};
|
|
63
|
+
type WindowScope = 'shortcut' | 'extension';
|
|
64
|
+
export type GetWindowsOptions = {
|
|
65
|
+
scope?: WindowScope;
|
|
66
|
+
};
|
|
62
67
|
/**
|
|
63
68
|
* @public
|
|
64
69
|
*/
|
|
@@ -69,7 +74,7 @@ export type ShortcutContext = SliprailMain & {
|
|
|
69
74
|
getSettings: (keys?: string[]) => Promise<Record<string, unknown>>;
|
|
70
75
|
createWindow: (options: WindowOptions) => WindowControl;
|
|
71
76
|
createStorage: () => KVStorage;
|
|
72
|
-
getWindows: () => WindowControl[];
|
|
77
|
+
getWindows: (options?: GetWindowsOptions) => WindowControl[];
|
|
73
78
|
channel: WindowChannel | undefined;
|
|
74
79
|
events: {
|
|
75
80
|
on: (event: 'settingsChange', callback: () => unknown) => void;
|
|
@@ -88,14 +93,20 @@ export type ShortcutPreview = {
|
|
|
88
93
|
style?: CSSProperties;
|
|
89
94
|
};
|
|
90
95
|
export type ShortcutContextMenu = {
|
|
91
|
-
displayName:
|
|
96
|
+
displayName: LocalizedString;
|
|
92
97
|
executeShortcutId: string;
|
|
93
98
|
};
|
|
99
|
+
export type SupportedLanguage = 'en' | 'zh-hans';
|
|
100
|
+
export type LocalizedString = string | ({
|
|
101
|
+
en: string;
|
|
102
|
+
} & {
|
|
103
|
+
[key in Exclude<SupportedLanguage, 'en'>]?: string;
|
|
104
|
+
});
|
|
94
105
|
export type Shortcut = {
|
|
95
106
|
id: string;
|
|
96
|
-
displayName:
|
|
107
|
+
displayName: LocalizedString;
|
|
97
108
|
hidden?: boolean;
|
|
98
|
-
description?:
|
|
109
|
+
description?: LocalizedString;
|
|
99
110
|
icon?: string | {
|
|
100
111
|
src: string;
|
|
101
112
|
template?: boolean;
|
|
@@ -118,9 +129,9 @@ export type ExtensionSettingValue = undefined | boolean | string | string[] | Ex
|
|
|
118
129
|
export type ExtensionSettings = Record<string, ExtensionSettingValue>;
|
|
119
130
|
type CommonSettingOptions = {
|
|
120
131
|
id: string;
|
|
121
|
-
displayName:
|
|
132
|
+
displayName: LocalizedString;
|
|
122
133
|
prependDescription?: string | string[];
|
|
123
|
-
description?:
|
|
134
|
+
description?: LocalizedString;
|
|
124
135
|
defaultValue?: unknown;
|
|
125
136
|
refreshOnOtherChange?: boolean | string | string[];
|
|
126
137
|
showRefreshOnError?: boolean;
|
|
@@ -192,7 +203,7 @@ export type SettingDefinition = BooleanSetting | NumberSetting | StringSetting |
|
|
|
192
203
|
*/
|
|
193
204
|
export type Extension = {
|
|
194
205
|
id?: string;
|
|
195
|
-
name?:
|
|
206
|
+
name?: LocalizedString;
|
|
196
207
|
role?: string;
|
|
197
208
|
icon?: string | {
|
|
198
209
|
src: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sliprail/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.mjs",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@types/react": "^18.3.24"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@types/node": "^20.19.
|
|
15
|
+
"@types/node": "^20.19.25",
|
|
16
16
|
"typescript": "5.6.3"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|