@vicinae/api 0.20.12 → 0.20.13

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.
@@ -19,7 +19,7 @@ export declare namespace ActionPanel {
19
19
  type Props = {
20
20
  title: string;
21
21
  icon?: Image.ImageLike;
22
- shortcut?: Keyboard.Shortcut;
22
+ shortcut?: Keyboard.Shortcut | Keyboard.Shortcut.Common;
23
23
  onOpen?: () => void;
24
24
  children: ReactNode;
25
25
  };
@@ -49,6 +49,14 @@ export declare namespace Action {
49
49
  app?: Application;
50
50
  };
51
51
  }
52
+ namespace Trash {
53
+ type PathArg = PathLike | PathLike[];
54
+ export type Props = BaseActionProps & {
55
+ paths: PathArg;
56
+ onTrash?: (paths: PathArg) => void;
57
+ };
58
+ export {};
59
+ }
52
60
  namespace Paste {
53
61
  type Props = BaseActionProps & {
54
62
  content: string;
@@ -114,9 +122,13 @@ export declare const Action: React.FC<ActionProps> & {
114
122
  Paste: React.FC<Action.Paste.Props>;
115
123
  SubmitForm: React.FC<Action.SubmitForm.Props>;
116
124
  OpenInBrowser: React.FC<Action.OpenInBrowser.Props>;
125
+ OpenWith: () => null;
126
+ Trash: React.FC<Action.Trash.Props>;
117
127
  ShowInFinder: React.FC<Action.ShowInFinderProps.Props>;
118
128
  RunInTerminal: React.FC<Action.RunInTerminal.Props>;
119
129
  CreateQuicklink: React.FC<Action.CreateQuicklink.Props>;
130
+ ToggleQuickLook: (props: any) => null;
131
+ CreateSnippet: (props: any) => null;
120
132
  PickDate: React.FC<BaseActionProps> & {
121
133
  isFullDay: () => false;
122
134
  };
@@ -37,6 +37,50 @@ const Open = ({ target, app, ...props }) => {
37
37
  (0, utils_1.open)(target, app);
38
38
  } }));
39
39
  };
40
+ // TODO: export when action panel is less buggy
41
+ const OpenWith = () => null;
42
+ /*
43
+ const OpenWith: React.FC<Action.OpenWith.Props> = ({
44
+ path,
45
+ title = "Open with...",
46
+ shortcut,
47
+ icon,
48
+ ...props
49
+ }) => {
50
+ const [apps, setApps] = useState<Application[]>([]);
51
+
52
+ const fetchApps = () => {
53
+ getApplications(path).then(setApps);
54
+ };
55
+
56
+ return (
57
+ <ActionPanel.Submenu
58
+ title={title}
59
+ icon={icon}
60
+ shortcut={shortcut}
61
+ onOpen={() => {
62
+ fetchApps();
63
+ }}
64
+ >
65
+ {apps.map((app) => (
66
+ <Action
67
+ key={app.id}
68
+ title={`Open in ${app.name}`}
69
+ icon={app.icon}
70
+ onAction={() => props.onOpen?.(path)}
71
+ />
72
+ ))}
73
+ </ActionPanel.Submenu>
74
+ );
75
+ };
76
+ */
77
+ const Trash = ({ title, paths, ...props }) => {
78
+ const actionTitle = title ?? `Delete item${Array.isArray(paths) ? "s" : ""}`;
79
+ return ((0, jsx_runtime_1.jsx)(ActionRoot, { title: actionTitle, ...props, onAction: async () => {
80
+ await (0, utils_1.trash)(paths);
81
+ props.onTrash?.(paths);
82
+ } }));
83
+ };
40
84
  const OpenInBrowser = ({ url, title = "Open in Browser", ...props }) => {
41
85
  return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, title: title, onAction: async () => {
42
86
  await (0, utils_1.open)(url);
@@ -101,6 +145,14 @@ const RunInTerminal = ({ args, options, icon = icon_1.Icon.Terminal, ...props })
101
145
  (0, utils_1.runInTerminal)(args, options).then(() => (0, controls_1.closeMainWindow)());
102
146
  } }));
103
147
  };
148
+ // TODO: provide actual implementation, one day?
149
+ const ToggleQuickLook = (props) => {
150
+ return null;
151
+ };
152
+ // TODO: provide actual implementation, one day?
153
+ const CreateSnippet = (props) => {
154
+ return null;
155
+ };
104
156
  /**
105
157
  * @category Actions
106
158
  */
@@ -111,9 +163,13 @@ exports.Action = Object.assign(ActionRoot, {
111
163
  Paste,
112
164
  SubmitForm,
113
165
  OpenInBrowser,
166
+ OpenWith,
167
+ Trash,
114
168
  ShowInFinder,
115
169
  RunInTerminal,
116
170
  CreateQuicklink,
171
+ ToggleQuickLook,
172
+ CreateSnippet,
117
173
  PickDate: Object.assign(PickDate, {
118
174
  // TODO: to implement too
119
175
  isFullDay: () => false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vicinae/api",
3
- "version": "0.20.12",
3
+ "version": "0.20.13",
4
4
  "description": "TypeScript SDK to build Vicinae extensions",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",