@sliprail/sdk 0.1.8 → 0.1.10

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 +16 -1
  2. package/package.json +4 -1
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { CSSProperties } from 'react';
1
2
  export type SelectFilesOptions = {
2
3
  type?: 'single-file' | 'multiple-files' | 'directory';
3
4
  extensions?: string[];
@@ -60,6 +61,7 @@ export type LivePreviewContent = {
60
61
  };
61
62
  export type ShortcutContext = SliprailMain & {
62
63
  parameter: any;
64
+ subShortcutId: string;
63
65
  getSettings: (keys?: string[]) => Promise<Record<string, unknown>>;
64
66
  createWindow: (options: WindowOptions) => WindowControl;
65
67
  createStorage: () => KVStorage;
@@ -72,6 +74,15 @@ export type ShortcutContext = SliprailMain & {
72
74
  export type LoadSubShortcutsContext = ShortcutContext & {
73
75
  signal: AbortSignal;
74
76
  };
77
+ export type ShortcutPreview = {
78
+ image: {
79
+ buffer: unknown;
80
+ mimeType: string;
81
+ };
82
+ } | {
83
+ text: string;
84
+ style?: CSSProperties;
85
+ };
75
86
  export type Shortcut = {
76
87
  id: string;
77
88
  displayName: string;
@@ -86,9 +97,13 @@ export type Shortcut = {
86
97
  prependKeywords?: string[];
87
98
  appendKeywords?: string[];
88
99
  handle?: (context: ShortcutContext) => Promise<unknown> | unknown;
89
- subShortcuts?: Shortcut[] | ((context: LoadSubShortcutsContext) => Promise<Shortcut[]> | Shortcut[]);
100
+ subShortcuts?: SubShortcut[] | ((context: LoadSubShortcutsContext) => Promise<SubShortcut[]> | SubShortcut[]);
101
+ subShortcutPreview?: (context: ShortcutContext) => Promise<ShortcutPreview | undefined> | ShortcutPreview | undefined;
90
102
  livePreview?: (parameters: string) => Promise<LivePreviewContent | undefined> | LivePreviewContent | undefined;
91
103
  };
104
+ export type SubShortcut = Shortcut & {
105
+ preview?: ShortcutPreview;
106
+ };
92
107
  export type ExtensionSettingValue = undefined | boolean | string | string[] | ExtensionSettings[];
93
108
  export type ExtensionSettings = Record<string, ExtensionSettingValue>;
94
109
  type CommonSettingOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sliprail/sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
@@ -8,6 +8,9 @@
8
8
  "lib/index.d.ts"
9
9
  ],
10
10
  "types": "lib/index.d.ts",
11
+ "dependencies": {
12
+ "@types/react": "^18.3.23"
13
+ },
11
14
  "devDependencies": {
12
15
  "@types/node": "^20.19.11",
13
16
  "typescript": "5.6.3"