@sliprail/sdk 0.1.10 → 0.1.12

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +19 -0
  2. package/package.json +12 -3
package/lib/index.d.ts CHANGED
@@ -59,9 +59,13 @@ export type LivePreviewContent = {
59
59
  content: string;
60
60
  type?: 'info' | 'warn' | 'error' | 'hint';
61
61
  };
62
+ /**
63
+ * @public
64
+ */
62
65
  export type ShortcutContext = SliprailMain & {
63
66
  parameter: any;
64
67
  subShortcutId: string;
68
+ subShortcutFilter: string | undefined;
65
69
  getSettings: (keys?: string[]) => Promise<Record<string, unknown>>;
66
70
  createWindow: (options: WindowOptions) => WindowControl;
67
71
  createStorage: () => KVStorage;
@@ -83,6 +87,10 @@ export type ShortcutPreview = {
83
87
  text: string;
84
88
  style?: CSSProperties;
85
89
  };
90
+ export type ShortcutContextMenu = {
91
+ displayName: string;
92
+ executeShortcutId: string;
93
+ };
86
94
  export type Shortcut = {
87
95
  id: string;
88
96
  displayName: string;
@@ -97,7 +105,9 @@ export type Shortcut = {
97
105
  prependKeywords?: string[];
98
106
  appendKeywords?: string[];
99
107
  handle?: (context: ShortcutContext) => Promise<unknown> | unknown;
108
+ subShortcutFilters?: string[];
100
109
  subShortcuts?: SubShortcut[] | ((context: LoadSubShortcutsContext) => Promise<SubShortcut[]> | SubShortcut[]);
110
+ onSubShortcutContextMenu?: (context: ShortcutContext) => ShortcutContextMenu[] | Promise<ShortcutContextMenu[]>;
101
111
  subShortcutPreview?: (context: ShortcutContext) => Promise<ShortcutPreview | undefined> | ShortcutPreview | undefined;
102
112
  livePreview?: (parameters: string) => Promise<LivePreviewContent | undefined> | LivePreviewContent | undefined;
103
113
  };
@@ -177,6 +187,9 @@ type StatusWarning = {
177
187
  };
178
188
  export type ExtensionStatus = StatusOk | StatusLoading | StatusError | StatusWarning;
179
189
  export type SettingDefinition = BooleanSetting | NumberSetting | StringSetting | ArrayStringSetting | ArrayObjectSetting;
190
+ /**
191
+ * @public
192
+ */
180
193
  export type Extension = {
181
194
  id?: string;
182
195
  name?: string;
@@ -215,6 +228,7 @@ export type SliprailMain = {
215
228
  message: string;
216
229
  }) => any;
217
230
  showAlert: (message: string) => void;
231
+ showConfirm: (message: string) => Promise<boolean>;
218
232
  writeTextToClipboard: (content: string) => void;
219
233
  writeHTMLToClipboard: (content: {
220
234
  html: string;
@@ -239,6 +253,7 @@ export type SliprailRenderer = {
239
253
  extensionId: string;
240
254
  shortcutId: string;
241
255
  parameter?: string;
256
+ subShortcutId?: string;
242
257
  }) => Promise<unknown>;
243
258
  getParameters: () => Promise<Record<string, unknown>>;
244
259
  openExtensionSettings: () => void;
@@ -260,6 +275,10 @@ export type SliprailRenderer = {
260
275
  debugLog: (...logs: unknown[]) => void;
261
276
  };
262
277
  declare global {
278
+ /**
279
+ * @public
280
+ * A global constant that can be called in the sliprail extension window.
281
+ */
263
282
  var sliprail: SliprailRenderer;
264
283
  }
265
284
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sliprail/sdk",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
@@ -9,13 +9,22 @@
9
9
  ],
10
10
  "types": "lib/index.d.ts",
11
11
  "dependencies": {
12
- "@types/react": "^18.3.23"
12
+ "@types/react": "^18.3.24"
13
13
  },
14
14
  "devDependencies": {
15
- "@types/node": "^20.19.11",
15
+ "@types/node": "^20.19.24",
16
16
  "typescript": "5.6.3"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=20"
20
+ },
21
+ "magis": {
22
+ "doc": {
23
+ "backUrl": {
24
+ "url": "https://sliprail.fengcen.io",
25
+ "title": "Sliprail",
26
+ "logo": "../../../packages/react-commons/src/assets/sliprail.svg"
27
+ }
28
+ }
20
29
  }
21
30
  }