@sliprail/sdk 0.1.9 → 0.1.11

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 -3
  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[];
@@ -61,6 +62,7 @@ export type LivePreviewContent = {
61
62
  export type ShortcutContext = SliprailMain & {
62
63
  parameter: any;
63
64
  subShortcutId: string;
65
+ subShortcutFilter: string | undefined;
64
66
  getSettings: (keys?: string[]) => Promise<Record<string, unknown>>;
65
67
  createWindow: (options: WindowOptions) => WindowControl;
66
68
  createStorage: () => KVStorage;
@@ -80,7 +82,12 @@ export type ShortcutPreview = {
80
82
  };
81
83
  } | {
82
84
  text: string;
83
- } | undefined | void;
85
+ style?: CSSProperties;
86
+ };
87
+ export type ShortcutContextMenu = {
88
+ displayName: string;
89
+ executeShortcutId: string;
90
+ };
84
91
  export type Shortcut = {
85
92
  id: string;
86
93
  displayName: string;
@@ -95,10 +102,15 @@ export type Shortcut = {
95
102
  prependKeywords?: string[];
96
103
  appendKeywords?: string[];
97
104
  handle?: (context: ShortcutContext) => Promise<unknown> | unknown;
98
- subShortcuts?: Shortcut[] | ((context: LoadSubShortcutsContext) => Promise<Shortcut[]> | Shortcut[]);
99
- subShortcutPreview?: (context: ShortcutContext) => Promise<ShortcutPreview> | ShortcutPreview;
105
+ subShortcutFilters?: string[];
106
+ subShortcuts?: SubShortcut[] | ((context: LoadSubShortcutsContext) => Promise<SubShortcut[]> | SubShortcut[]);
107
+ onSubShortcutContextMenu?: (context: ShortcutContext) => ShortcutContextMenu[] | Promise<ShortcutContextMenu[]>;
108
+ subShortcutPreview?: (context: ShortcutContext) => Promise<ShortcutPreview | undefined> | ShortcutPreview | undefined;
100
109
  livePreview?: (parameters: string) => Promise<LivePreviewContent | undefined> | LivePreviewContent | undefined;
101
110
  };
111
+ export type SubShortcut = Shortcut & {
112
+ preview?: ShortcutPreview;
113
+ };
102
114
  export type ExtensionSettingValue = undefined | boolean | string | string[] | ExtensionSettings[];
103
115
  export type ExtensionSettings = Record<string, ExtensionSettingValue>;
104
116
  type CommonSettingOptions = {
@@ -234,6 +246,7 @@ export type SliprailRenderer = {
234
246
  extensionId: string;
235
247
  shortcutId: string;
236
248
  parameter?: string;
249
+ subShortcutId?: string;
237
250
  }) => Promise<unknown>;
238
251
  getParameters: () => Promise<Record<string, unknown>>;
239
252
  openExtensionSettings: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sliprail/sdk",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
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"