deck-plugin-sdk 1.6.0 → 1.6.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deck-plugin-sdk",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Build a plugin for Deck, outside the Deck repository.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -5,5 +5,5 @@
5
5
  "icon": "Sparkles",
6
6
  "color": "#a78bfa",
7
7
  "version": "0.1.0",
8
- "minDeck": "1.6.0"
8
+ "minDeck": "1.6.1"
9
9
  }
@@ -357,6 +357,11 @@ export interface Settings {
357
357
  browserDefaultAsk?: boolean;
358
358
  /** Sites (by host) an agent may use in the browser without asking; localhost and files always. */
359
359
  browserAgentSites: string[];
360
+ /**
361
+ * Where a file type opens, by extension (".pdf"): "editor", "browser" or "plugin:<id>". A type
362
+ * not listed is Automatic (see `openerFor` in fileview.ts).
363
+ */
364
+ openWith?: Record<string, string>;
360
365
  }
361
366
  /** The bookmarks bar setting, older true/false values included. */
362
367
  export declare const bookmarksBarMode: (s: Settings) => "always" | "home" | "never";
@@ -29,7 +29,26 @@ export declare const fileOpeners: {
29
29
  /** The id of the plugin that opens `path` (by its extension), or undefined: the Editor's. */
30
30
  export declare function pluginForFile(path: string): string | undefined;
31
31
  /**
32
- * Open `path` in the plugin that claims its type, as a tab of its own. False when no plugin does,
33
- * so the caller opens it in the Editor as before. Every way Deck opens a file asks this first.
32
+ * The files Deck's browser opens: the types defaultbrowser.rs registers with Windows (FILE_TYPES
33
+ * there), so a choice offered here is one Windows can hand over too.
34
34
  */
35
- export declare function openWithPlugin(path: string): boolean;
35
+ export declare const BROWSER_TYPES: string[];
36
+ /** Where a file opens: the Editor, a browser tab, or a plugin's pane (`plugin:<id>`). */
37
+ export type Opener = "editor" | "browser" | `plugin:${string}`;
38
+ /** The user's choice per extension (Settings, `openWith`); a type with none is Automatic. */
39
+ export declare const openPrefs: {
40
+ current: Record<string, string>;
41
+ };
42
+ /**
43
+ * Where `path` opens. The user's choice for its type wins, where it still can (the plugin is
44
+ * loaded, the file is local for a browser tab); otherwise Automatic: `hint`, how it was opened
45
+ * (a page Windows handed Deck as the browser), then the plugin that claims the type, then the Editor.
46
+ */
47
+ export declare function openerFor(path: string, hint?: Opener, prefs?: Record<string, string>): Opener;
48
+ /** `C:\a b\x.html` as file:///C:/a%20b/x.html, for a browser tab. */
49
+ export declare const fileUrl: (path: string) => string;
50
+ /**
51
+ * Open `path` where its type opens (`openerFor`), as a tab of its own. False when that is the
52
+ * Editor, which the caller opens it in. Every way Deck opens a file asks this first.
53
+ */
54
+ export declare function openByType(path: string, hint?: Opener): boolean;