@sliprail/sdk 0.1.21 → 0.1.23

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.
@@ -0,0 +1,29 @@
1
+ import { LocalizedString } from './index';
2
+ export type ActivityState = 'running' | 'paused' | 'completed' | 'failed' | 'canceled';
3
+ export type ActivityUpdateOptions = {
4
+ progressFraction?: number;
5
+ statusText?: LocalizedString;
6
+ state?: ActivityState;
7
+ };
8
+ export type Activity = {
9
+ id: string;
10
+ update: (options: ActivityUpdateOptions) => void;
11
+ };
12
+ export type ActivityOptions = {
13
+ title: LocalizedString;
14
+ subtitle?: LocalizedString;
15
+ statusText?: LocalizedString;
16
+ progressFraction?: number;
17
+ onClick?: () => void | Promise<void>;
18
+ onAbort?: () => void | Promise<void>;
19
+ onPause?: () => void | Promise<void>;
20
+ onResume?: () => void | Promise<void>;
21
+ };
22
+ /**
23
+ * @public
24
+ */
25
+ export type SliprailActivity = {
26
+ create: (options: ActivityOptions) => Activity;
27
+ get: (id: string) => Activity | undefined;
28
+ list: () => Activity[];
29
+ };
package/lib/ai.d.ts CHANGED
@@ -80,6 +80,7 @@ export type AIChunk = {
80
80
  type: 'done';
81
81
  reason: 'error';
82
82
  error: string;
83
+ code?: string;
83
84
  };
84
85
  export type AIResponse = AsyncIterable<AIChunk>;
85
86
  export type AISessionSummary = {
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { CSSProperties } from 'react';
2
2
  import type { SliprailAI } from './ai';
3
+ import { SliprailActivity } from './activity';
3
4
  export type SelectFilesOptions = {
4
5
  type?: 'single-file' | 'multiple-files' | 'directory';
5
6
  extensions?: string[];
@@ -66,10 +67,23 @@ type WindowScope = 'shortcut' | 'extension';
66
67
  export type GetWindowsOptions = {
67
68
  scope?: WindowScope;
68
69
  };
70
+ export type ShortcutFile = {
71
+ name: string;
72
+ type: string;
73
+ size: number;
74
+ lastModified: number;
75
+ } & ({
76
+ path: string;
77
+ data?: never;
78
+ } | {
79
+ data: ArrayBuffer;
80
+ path?: never;
81
+ });
69
82
  /**
70
83
  * @public
71
84
  */
72
85
  export type ShortcutContext = SliprailMain & {
86
+ files?: ShortcutFile[];
73
87
  parameter: any;
74
88
  subShortcutId: string;
75
89
  subShortcutFilter: string | undefined;
@@ -79,6 +93,7 @@ export type ShortcutContext = SliprailMain & {
79
93
  getWindows: (options?: GetWindowsOptions) => WindowControl[];
80
94
  channel: WindowChannel | undefined;
81
95
  ai: SliprailAI;
96
+ activity: SliprailActivity;
82
97
  toPreviewUrl: (filePath: string) => string;
83
98
  events: {
84
99
  on: (event: 'settingsChange', callback: () => unknown) => void;
@@ -121,12 +136,15 @@ export type Shortcut = {
121
136
  };
122
137
  prependKeywords?: string[];
123
138
  appendKeywords?: string[];
139
+ acceptsParameter?: boolean;
140
+ acceptsFiles?: boolean;
124
141
  handle?: (context: ShortcutContext) => Promise<unknown> | unknown;
125
142
  subShortcutFilters?: string[];
126
143
  subShortcuts?: SubShortcut[] | ((context: LoadSubShortcutsContext) => Promise<SubShortcut[]> | SubShortcut[]);
127
144
  onSubShortcutContextMenu?: (context: ShortcutContext) => ShortcutContextMenu[] | Promise<ShortcutContextMenu[]>;
128
145
  subShortcutPreview?: (context: ShortcutContext) => Promise<ShortcutPreview | undefined> | ShortcutPreview | undefined;
129
146
  livePreview?: (parameters: string) => Promise<LivePreviewContent | undefined> | LivePreviewContent | undefined;
147
+ selectedItemAutoHeight?: boolean;
130
148
  };
131
149
  export type SubShortcut = Shortcut & {
132
150
  preview?: ShortcutPreview;
@@ -233,7 +251,7 @@ export type SliprailMain = {
233
251
  saveTextFile: (options: {
234
252
  filename: string;
235
253
  content: string;
236
- }) => Promise<void>;
254
+ }) => Promise<boolean>;
237
255
  writeFilesToClipboard: (paths: string[]) => void;
238
256
  cutFilesToClipboard: (paths: string[]) => void;
239
257
  selectFiles: (options?: SelectFilesOptions) => Promise<string[]>;
@@ -276,6 +294,8 @@ export type SliprailRenderer = {
276
294
  openUrl: (url: string) => void;
277
295
  openPath: (path: string) => void;
278
296
  openFileLocation: (path: string) => void;
297
+ getPathForFile: (file: File) => string;
298
+ readFile: (path: string) => Promise<Uint8Array>;
279
299
  writeFilesToClipboard: (paths: string[]) => void;
280
300
  cutFilesToClipboard: (paths: string[]) => void;
281
301
  deleteFiles: (paths: string[]) => void;
@@ -284,9 +304,9 @@ export type SliprailRenderer = {
284
304
  saveTextFile: (options: {
285
305
  filename: string;
286
306
  content: string;
287
- }) => Promise<void>;
307
+ }) => Promise<boolean>;
288
308
  saveFile: (file: File) => Promise<void>;
289
- saveBase64File: (filename: string, base64Content: string) => Promise<void>;
309
+ saveBase64File: (filename: string, base64Content: string) => Promise<boolean>;
290
310
  debugLog: (...logs: unknown[]) => void;
291
311
  };
292
312
  declare global {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sliprail/sdk",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
@@ -9,19 +9,19 @@
9
9
  ],
10
10
  "types": "lib/index.d.ts",
11
11
  "dependencies": {
12
- "@types/react": "^18.3.27"
12
+ "@types/react": "^19.2.17"
13
13
  },
14
14
  "devDependencies": {
15
- "@types/node": "^20.19.37",
16
- "typescript": "5.9.3"
15
+ "@types/node": "^24.13.3",
16
+ "typescript": "6.0.3"
17
17
  },
18
18
  "engines": {
19
- "node": ">=20"
19
+ "node": ">=22"
20
20
  },
21
21
  "magis": {
22
22
  "doc": {
23
23
  "backUrl": {
24
- "url": "https://sliprail.fengcen.io",
24
+ "url": "https://sliprail.com",
25
25
  "title": "Sliprail",
26
26
  "logo": "../../../packages/react-commons/src/assets/sliprail.svg"
27
27
  }