@sliprail/sdk 0.1.21 → 0.1.22

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/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[];
@@ -79,6 +80,7 @@ export type ShortcutContext = SliprailMain & {
79
80
  getWindows: (options?: GetWindowsOptions) => WindowControl[];
80
81
  channel: WindowChannel | undefined;
81
82
  ai: SliprailAI;
83
+ activity: SliprailActivity;
82
84
  toPreviewUrl: (filePath: string) => string;
83
85
  events: {
84
86
  on: (event: 'settingsChange', callback: () => unknown) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sliprail/sdk",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",