deck-plugin-sdk 0.22.0 → 1.2.0

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 (39) hide show
  1. package/build-plugin.mjs +150 -143
  2. package/package.json +1 -1
  3. package/shim/bridge.js +8 -0
  4. package/shim/p2p.d.ts +4 -0
  5. package/shim/p2p.js +15 -0
  6. package/shim/react-dom.js +19 -0
  7. package/shim/settings.d.ts +1 -1
  8. package/shim/settings.js +3 -0
  9. package/shim/terminals.d.ts +1 -1
  10. package/shim/ui.d.ts +10 -0
  11. package/shim/ui.js +47 -0
  12. package/template/plugin.json +9 -8
  13. package/types/components/ActivityBar.d.ts +20 -0
  14. package/types/components/ContextMenu.d.ts +3 -1
  15. package/types/components/FileIcon.d.ts +7 -0
  16. package/types/components/TabStrip.d.ts +7 -1
  17. package/types/components/menuplace.d.ts +7 -1
  18. package/types/components/useResize.d.ts +12 -0
  19. package/types/core/bridge.d.ts +37 -1
  20. package/types/core/dap.d.ts +181 -0
  21. package/types/core/decode.d.ts +13 -0
  22. package/types/core/icontheme.d.ts +28 -0
  23. package/types/core/inlay.d.ts +37 -0
  24. package/types/core/keys.d.ts +1 -1
  25. package/types/core/keystore.d.ts +16 -2
  26. package/types/core/lsp.d.ts +193 -0
  27. package/types/core/p2p.d.ts +117 -0
  28. package/types/core/patterntokens.d.ts +24 -0
  29. package/types/core/remotepath.d.ts +17 -0
  30. package/types/core/settingsstore.d.ts +1 -0
  31. package/types/core/snippets.d.ts +15 -0
  32. package/types/core/timeFormat.d.ts +12 -0
  33. package/types/modules/editor/MonacoHosts.d.ts +80 -0
  34. package/types/modules/editor/annotations.d.ts +2 -0
  35. package/types/modules/editor/diffline.d.ts +13 -0
  36. package/types/modules/editor/editorstatus.d.ts +16 -0
  37. package/types/modules/editor/models.d.ts +8 -0
  38. package/types/modules/editor/tree.d.ts +59 -0
  39. package/types/modules/editor/viewers.d.ts +41 -0
package/build-plugin.mjs CHANGED
@@ -1,143 +1,150 @@
1
- // Build a Deck plugin: TSX sources -> one plugin.js Deck can import.
2
- //
3
- // The same build Deck's own plugins get, with one difference: the shim is shipped with this
4
- // package rather than generated, because generating it needs Deck's TypeScript sources and the
5
- // point of this package is that you do not have them.
6
- //
7
- // Why a plugin wants a build step at all: JSX, and ordinary imports across as many files as you
8
- // like. It is not rebuilding Deck — it is what a VS Code extension does.
9
- //
10
- // The shim is the whole trick. Deck hands React, its bridge, `listen`, its icons and its
11
- // animation library over on `window.__deck`, and esbuild resolves those module names to files
12
- // that read from there. So your sources import "react" as normal code does, and at run time get
13
- // DECK'S React — which is not an optimisation but a requirement, since two Reacts in one tree
14
- // break hooks.
15
- import { build } from "esbuild";
16
- import { cpSync, existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
17
- import { createRequire } from "node:module";
18
- import { dirname, join } from "node:path";
19
- import { fileURLToPath } from "node:url";
20
-
21
- const sdk = dirname(fileURLToPath(import.meta.url));
22
- const require = createRequire(import.meta.url);
23
-
24
- /** The module names a plugin may import, and the shipped file each resolves to. */
25
- function shimMap(shimDir) {
26
- return {
27
- react: join(shimDir, "react.js"),
28
- "deckreact/jsx-runtime": join(shimDir, "jsx-runtime.js"),
29
- "@tauri-apps/api/event": join(shimDir, "event.js"),
30
- "lucide-react": join(shimDir, "icons.js"),
31
- "framer-motion": join(shimDir, "motion.js"),
32
- };
33
- }
34
-
35
- /**
36
- * Build the plugin in `dir`.
37
- *
38
- * The shim is copied in rather than imported from node_modules, because a plugin's sources refer
39
- * to it by relative path (`../shim/bridge.js`) and that has to resolve on disk. Copied on every
40
- * build so updating the SDK updates the shim, which is the behaviour someone upgrading expects.
41
- */
42
- export async function buildPlugin(dir, { entry = "plugin.tsx" } = {}) {
43
- const manifestPath = join(dir, "plugin.json");
44
- if (!existsSync(manifestPath)) {
45
- throw new Error(`no plugin.json in ${dir}`);
46
- }
47
- const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
48
-
49
- const shimDir = join(dir, "shim");
50
- rmSync(shimDir, { recursive: true, force: true });
51
- cpSync(join(sdk, "shim"), shimDir, { recursive: true });
52
- // The declarations the shim's .d.ts files point at, as ../types/. Copied beside it for the
53
- // same reason: a relative reference has to find something.
54
- const typesDir = join(dir, "types");
55
- rmSync(typesDir, { recursive: true, force: true });
56
- cpSync(join(sdk, "types"), typesDir, { recursive: true });
57
-
58
- // ---- icons and animation, generated per plugin ----
59
- //
60
- // These two cannot be shipped pre-generated like the rest of the shim. They name only the
61
- // exports THIS plugin imports, on purpose: re-exporting the whole package goes through a
62
- // module esbuild cannot see into, which defeats tree-shaking — doing that with lucide took a
63
- // bundle from 403kb to 640kb, larger than just bundling it.
64
- //
65
- // Nothing about this needs Deck's source, only the plugin's own and the real package, so it
66
- // runs here the same way it runs inside the Deck repository.
67
- const sources = readdirSync(join(dir, "src"), { recursive: true })
68
- .filter((f) => typeof f === "string" && /\.tsx?$/.test(f))
69
- .map((f) => readFileSync(join(dir, "src", f), "utf8"));
70
-
71
- for (const [pkg, file, global] of [
72
- ["lucide-react", "icons.js", "icons"],
73
- ["framer-motion", "motion.js", "motion"],
74
- ]) {
75
- const re = new RegExp(String.raw`import\s*\{([^}]*)\}\s*from\s*"${pkg}"`, "g");
76
- const names = [...new Set(sources.flatMap((src) => [...src.matchAll(re)]
77
- .flatMap((m) => m[1].split(",").map((n) => n.trim().split(/\s+as\s+/)[0]).filter(Boolean))))].sort();
78
-
79
- // Checked against the real package, so a typo fails here rather than as a blank icon at run
80
- // time. Only loaded when something is actually imported from it, since framer-motion is an
81
- // optional peer dependency.
82
- if (names.length) {
83
- let real;
84
- try { real = require(pkg); }
85
- catch { throw new Error(`this plugin imports from "${pkg}" — run: npm i ${pkg}`); }
86
- for (const n of names) if (!(n in real)) throw new Error(`${pkg} has no export "${n}"`);
87
- }
88
-
89
- writeFileSync(join(shimDir, file), `// GENERATED by the Deck plugin build — do not edit.
90
- //
91
- // Deck's ${pkg}, so this plugin does not bundle its own copy. Only the names this plugin
92
- // imports: naming every export would defeat tree-shaking and make the bundle larger.
93
- const __src = window.__deck.${global};
94
- ${names.map((n) => `export const ${n} = __src.${n};`).join("\n")}
95
- `);
96
- }
97
-
98
- const shims = shimMap(shimDir);
99
-
100
- await build({
101
- entryPoints: [join(dir, "src", entry)],
102
- outfile: join(dir, "plugin.js"),
103
- bundle: true,
104
- format: "esm",
105
- target: "es2022",
106
- // Nobody reads a plugin bundle; it is loaded by one import() at startup.
107
- minify: true,
108
- jsx: "automatic",
109
- // React comes from Deck, so the automatic runtime must import from the shim rather than a
110
- // "react/jsx-runtime" that does not exist here.
111
- jsxImportSource: "deckreact",
112
- // A .wasm import becomes a Uint8Array inlined in the bundle rather than a sidecar file. A
113
- // plugin is installed as plugin.json + plugin.js, so a file beside them would never arrive.
114
- loader: { ".wasm": "binary" },
115
- // A resolve plugin rather than esbuild's `alias`, which maps package to package while these
116
- // point at single files.
117
- plugins: [{
118
- name: "deck-runtime",
119
- setup(b) {
120
- const filter = new RegExp(`^(${Object.keys(shims)
121
- .map((k) => k.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|")})$`);
122
- b.onResolve({ filter }, (a) => ({ path: shims[a.path] }));
123
- },
124
- }],
125
- logLevel: "info",
126
- });
127
-
128
- // Optional: only a plugin that brings agent-facing tools has one. Built for node, because the
129
- // MCP server runs outside the webview.
130
- if (existsSync(join(dir, "src", "mcp.ts"))) {
131
- await build({
132
- entryPoints: [join(dir, "src", "mcp.ts")],
133
- outfile: join(dir, "mcp.js"),
134
- platform: "node",
135
- format: "esm",
136
- target: "node18",
137
- bundle: true,
138
- logLevel: "info",
139
- });
140
- }
141
-
142
- return manifest;
143
- }
1
+ // Build a Deck plugin: TSX sources -> one plugin.js Deck can import.
2
+ //
3
+ // The same build Deck's own plugins get, with one difference: the shim is shipped with this
4
+ // package rather than generated, because generating it needs Deck's TypeScript sources and the
5
+ // point of this package is that you do not have them.
6
+ //
7
+ // Why a plugin wants a build step at all: JSX, and ordinary imports across as many files as you
8
+ // like. It is not rebuilding Deck — it is what a VS Code extension does.
9
+ //
10
+ // The shim is the whole trick. Deck hands React, its bridge, `listen`, its icons and its
11
+ // animation library over on `window.__deck`, and esbuild resolves those module names to files
12
+ // that read from there. So your sources import "react" as normal code does, and at run time get
13
+ // DECK'S React — which is not an optimisation but a requirement, since two Reacts in one tree
14
+ // break hooks.
15
+ import { build } from "esbuild";
16
+ import { cpSync, existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
17
+ import { createRequire } from "node:module";
18
+ import { dirname, join } from "node:path";
19
+ import { fileURLToPath } from "node:url";
20
+
21
+ const sdk = dirname(fileURLToPath(import.meta.url));
22
+ const require = createRequire(import.meta.url);
23
+
24
+ /** The module names a plugin may import, and the shipped file each resolves to. */
25
+ function shimMap(shimDir) {
26
+ return {
27
+ react: join(shimDir, "react.js"),
28
+ "deckreact/jsx-runtime": join(shimDir, "jsx-runtime.js"),
29
+ // A library compiled with the automatic runtime imports it under its real name.
30
+ "react/jsx-runtime": join(shimDir, "jsx-runtime.js"),
31
+ // Deck's react-dom (needs Deck 1.1); only bundled when a plugin or its library imports it.
32
+ "react-dom": join(shimDir, "react-dom.js"),
33
+ "@tauri-apps/api/event": join(shimDir, "event.js"),
34
+ "lucide-react": join(shimDir, "icons.js"),
35
+ "framer-motion": join(shimDir, "motion.js"),
36
+ };
37
+ }
38
+
39
+ /**
40
+ * Build the plugin in `dir`.
41
+ *
42
+ * The shim is copied in rather than imported from node_modules, because a plugin's sources refer
43
+ * to it by relative path (`../shim/bridge.js`) and that has to resolve on disk. Copied on every
44
+ * build so updating the SDK updates the shim, which is the behaviour someone upgrading expects.
45
+ */
46
+ export async function buildPlugin(dir, { entry = "plugin.tsx" } = {}) {
47
+ const manifestPath = join(dir, "plugin.json");
48
+ if (!existsSync(manifestPath)) {
49
+ throw new Error(`no plugin.json in ${dir}`);
50
+ }
51
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
52
+
53
+ const shimDir = join(dir, "shim");
54
+ rmSync(shimDir, { recursive: true, force: true });
55
+ cpSync(join(sdk, "shim"), shimDir, { recursive: true });
56
+ // The declarations the shim's .d.ts files point at, as ../types/. Copied beside it for the
57
+ // same reason: a relative reference has to find something.
58
+ const typesDir = join(dir, "types");
59
+ rmSync(typesDir, { recursive: true, force: true });
60
+ cpSync(join(sdk, "types"), typesDir, { recursive: true });
61
+
62
+ // ---- icons and animation, generated per plugin ----
63
+ //
64
+ // These two cannot be shipped pre-generated like the rest of the shim. They name only the
65
+ // exports THIS plugin imports, on purpose: re-exporting the whole package goes through a
66
+ // module esbuild cannot see into, which defeats tree-shaking — doing that with lucide took a
67
+ // bundle from 403kb to 640kb, larger than just bundling it.
68
+ //
69
+ // Nothing about this needs Deck's source, only the plugin's own and the real package, so it
70
+ // runs here the same way it runs inside the Deck repository.
71
+ const sources = readdirSync(join(dir, "src"), { recursive: true })
72
+ .filter((f) => typeof f === "string" && /\.tsx?$/.test(f))
73
+ .map((f) => readFileSync(join(dir, "src", f), "utf8"));
74
+
75
+ for (const [pkg, file, global] of [
76
+ ["lucide-react", "icons.js", "icons"],
77
+ ["framer-motion", "motion.js", "motion"],
78
+ ]) {
79
+ const re = new RegExp(String.raw`import\s*\{([^}]*)\}\s*from\s*"${pkg}"`, "g");
80
+ const names = [...new Set(sources.flatMap((src) => [...src.matchAll(re)]
81
+ .flatMap((m) => m[1].split(",").map((n) => n.trim().split(/\s+as\s+/)[0]).filter(Boolean))))].sort();
82
+
83
+ // Checked against the real package, so a typo fails here rather than as a blank icon at run
84
+ // time. Only loaded when something is actually imported from it, since framer-motion is an
85
+ // optional peer dependency.
86
+ if (names.length) {
87
+ let real;
88
+ try { real = require(pkg); }
89
+ catch { throw new Error(`this plugin imports from "${pkg}" — run: npm i ${pkg}`); }
90
+ for (const n of names) if (!(n in real)) throw new Error(`${pkg} has no export "${n}"`);
91
+ }
92
+
93
+ writeFileSync(join(shimDir, file), `// GENERATED by the Deck plugin build — do not edit.
94
+ //
95
+ // Deck's ${pkg}, so this plugin does not bundle its own copy. Only the names this plugin
96
+ // imports: naming every export would defeat tree-shaking and make the bundle larger.
97
+ const __src = window.__deck.${global};
98
+ ${names.map((n) => `export const ${n} = __src.${n};`).join("\n")}
99
+ `);
100
+ }
101
+
102
+ const shims = shimMap(shimDir);
103
+
104
+ await build({
105
+ entryPoints: [join(dir, "src", entry)],
106
+ outfile: join(dir, "plugin.js"),
107
+ bundle: true,
108
+ format: "esm",
109
+ target: "es2022",
110
+ // Nobody reads a plugin bundle; it is loaded by one import() at startup.
111
+ minify: true,
112
+ // A package that ships separate builds picks the production one.
113
+ conditions: ["production"],
114
+ jsx: "automatic",
115
+ // React comes from Deck, so the automatic runtime must import from the shim rather than a
116
+ // "react/jsx-runtime" that does not exist here.
117
+ jsxImportSource: "deckreact",
118
+ // A .wasm import becomes a Uint8Array inlined in the bundle rather than a sidecar file. A
119
+ // plugin is installed as plugin.json + plugin.js, so a file beside them would never arrive.
120
+ // A .css import becomes its text, for the plugin to inject as a <style>, for the same reason.
121
+ loader: { ".wasm": "binary", ".css": "text" },
122
+ // A resolve plugin rather than esbuild's `alias`, which maps package to package while these
123
+ // point at single files.
124
+ plugins: [{
125
+ name: "deck-runtime",
126
+ setup(b) {
127
+ const filter = new RegExp(`^(${Object.keys(shims)
128
+ .map((k) => k.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|")})$`);
129
+ b.onResolve({ filter }, (a) => ({ path: shims[a.path] }));
130
+ },
131
+ }],
132
+ logLevel: "info",
133
+ });
134
+
135
+ // Optional: only a plugin that brings agent-facing tools has one. Built for node, because the
136
+ // MCP server runs outside the webview.
137
+ if (existsSync(join(dir, "src", "mcp.ts"))) {
138
+ await build({
139
+ entryPoints: [join(dir, "src", "mcp.ts")],
140
+ outfile: join(dir, "mcp.js"),
141
+ platform: "node",
142
+ format: "esm",
143
+ target: "node18",
144
+ bundle: true,
145
+ logLevel: "info",
146
+ });
147
+ }
148
+
149
+ return manifest;
150
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deck-plugin-sdk",
3
- "version": "0.22.0",
3
+ "version": "1.2.0",
4
4
  "description": "Build a plugin for Deck, outside the Deck repository.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/shim/bridge.js CHANGED
@@ -9,6 +9,7 @@ const b = () => {
9
9
  return x;
10
10
  };
11
11
 
12
+ export const askSudoPassword = (...a) => b().askSudoPassword(...a);
12
13
  export const backupExport = (...a) => b().backupExport(...a);
13
14
  export const backupInspect = (...a) => b().backupInspect(...a);
14
15
  export const backupRestore = (...a) => b().backupRestore(...a);
@@ -130,7 +131,10 @@ export const googleSignOut = (...a) => b().googleSignOut(...a);
130
131
  export const googleToken = (...a) => b().googleToken(...a);
131
132
  export const historyClear = (...a) => b().historyClear(...a);
132
133
  export const historyDelete = (...a) => b().historyDelete(...a);
134
+ export const httpCancel = (...a) => b().httpCancel(...a);
133
135
  export const httpSend = (...a) => b().httpSend(...a);
136
+ export const httpSendAs = (...a) => b().httpSendAs(...a);
137
+ export const httpSendReply = (...a) => b().httpSendReply(...a);
134
138
  export const importIconPack = (...a) => b().importIconPack(...a);
135
139
  export const installClaudeHooks = (...a) => b().installClaudeHooks(...a);
136
140
  export const installClaudeMcp = (...a) => b().installClaudeMcp(...a);
@@ -174,6 +178,9 @@ export const readMusicSuggestions = (...a) => b().readMusicSuggestions(...a);
174
178
  export const readMusicTaste = (...a) => b().readMusicTaste(...a);
175
179
  export const readTermLayout = (...a) => b().readTermLayout(...a);
176
180
  export const readTrackMeta = (...a) => b().readTrackMeta(...a);
181
+ export const remoteHome = (...a) => b().remoteHome(...a);
182
+ export const remoteStat = (...a) => b().remoteStat(...a);
183
+ export const remoteSudoPassword = (...a) => b().remoteSudoPassword(...a);
177
184
  export const removeClaudeHooks = (...a) => b().removeClaudeHooks(...a);
178
185
  export const removeClaudeMcp = (...a) => b().removeClaudeMcp(...a);
179
186
  export const removeLanguage = (...a) => b().removeLanguage(...a);
@@ -185,6 +192,7 @@ export const setAutostart = (...a) => b().setAutostart(...a);
185
192
  export const setDebugTargets = (...a) => b().setDebugTargets(...a);
186
193
  export const setVaultRoot = (...a) => b().setVaultRoot(...a);
187
194
  export const setWallpaper = (...a) => b().setWallpaper(...a);
195
+ export const sshHosts = (...a) => b().sshHosts(...a);
188
196
  export const sshTunnelClose = (...a) => b().sshTunnelClose(...a);
189
197
  export const sshTunnelList = (...a) => b().sshTunnelList(...a);
190
198
  export const sshTunnelOpen = (...a) => b().sshTunnelOpen(...a);
package/shim/p2p.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ // GENERATED by sdk/gen-shim.mjs — do not edit.
2
+ //
3
+ // Deck's real types, so a plugin is checked against the actual shape.
4
+ export * from "../types/core/p2p";
package/shim/p2p.js ADDED
@@ -0,0 +1,15 @@
1
+ // GENERATED by sdk/gen-shim.mjs — do not edit.
2
+ //
3
+ // Deck's live connections to other Decks. Resolved at USE time like the bridge: a plugin module is evaluated
4
+ // during loadPlugins, and a reference copied out at import time would capture a half-built
5
+ // object. One transport for every plugin, so a fix to it reaches all of them.
6
+ const t = () => {
7
+ const x = window.__deck?.p2p;
8
+ if (!x) throw new Error("window.__deck.p2p is missing — this plugin only runs inside Deck");
9
+ return x;
10
+ };
11
+
12
+ export const cleanCode = (...a) => t().cleanCode(...a);
13
+ export const newCode = (...a) => t().newCode(...a);
14
+ export const selfId = (...a) => t().selfId(...a);
15
+ export const share = (...a) => t().share(...a);
@@ -0,0 +1,19 @@
1
+ // GENERATED by sdk/gen-shim.mjs — do not edit.
2
+ //
3
+ // Deck's react-dom, not a second copy.
4
+ const ReactDOM = window.__deck.ReactDOM;
5
+ export default ReactDOM;
6
+ export const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
7
+ export const createPortal = ReactDOM.createPortal;
8
+ export const flushSync = ReactDOM.flushSync;
9
+ export const preconnect = ReactDOM.preconnect;
10
+ export const prefetchDNS = ReactDOM.prefetchDNS;
11
+ export const preinit = ReactDOM.preinit;
12
+ export const preinitModule = ReactDOM.preinitModule;
13
+ export const preload = ReactDOM.preload;
14
+ export const preloadModule = ReactDOM.preloadModule;
15
+ export const requestFormReset = ReactDOM.requestFormReset;
16
+ export const unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates;
17
+ export const useFormState = ReactDOM.useFormState;
18
+ export const useFormStatus = ReactDOM.useFormStatus;
19
+ export const version = ReactDOM.version;
@@ -1,5 +1,5 @@
1
1
  // GENERATED by sdk/gen-shim.mjs — do not edit.
2
2
  //
3
3
  // Deck's real settings types, so a plugin is checked against the actual shape.
4
- export { useSettings, getSettings, saveSettings } from "../types/core/settingsstore";
4
+ export { useSettings, getSettings, saveSettings, userName } from "../types/core/settingsstore";
5
5
  export type { Settings } from "../types/core/bridge";
package/shim/settings.js CHANGED
@@ -11,3 +11,6 @@ const s = () => {
11
11
  export const useSettings = (...a) => s().use(...a);
12
12
  export const getSettings = (...a) => s().get(...a);
13
13
  export const saveSettings = (...a) => s().save(...a);
14
+ // What to call the user (needs a Deck newer than 1.1): the name set in Settings, else their Google or Windows
15
+ // account's. For a plugin that shows the user to someone else.
16
+ export const userName = (...a) => s().userName(...a);
@@ -1,4 +1,4 @@
1
1
  // GENERATED by sdk/gen-shim.mjs — do not edit.
2
2
  //
3
- // Deck's real terminal types, so a plugin is checked against the actual layout shape.
3
+ // Deck's real types, so a plugin is checked against the actual shape.
4
4
  export * from "../types/core/terminals";
package/shim/ui.d.ts CHANGED
@@ -12,3 +12,13 @@ export * from "../types/components/TreeRow";
12
12
  export * from "../types/components/dragrow";
13
13
  export * from "../types/components/TabStrip";
14
14
  export * from "../types/components/MarkdownToolbar";
15
+ export * from "../types/components/ActivityBar";
16
+ export * from "../types/core/editorsettings";
17
+ export * from "../types/core/keystore";
18
+ export * from "../types/modules/editor/viewers";
19
+ export * from "../types/components/FileIcon";
20
+ export * from "../types/core/icontheme";
21
+ export * from "../types/modules/editor/tree";
22
+ export * from "../types/core/decode";
23
+ export * from "../types/core/keys";
24
+ export * from "../types/modules/editor/MonacoHosts";
package/shim/ui.js CHANGED
@@ -9,13 +9,21 @@ const u = () => {
9
9
  return x;
10
10
  };
11
11
 
12
+ export const ActivityBar = (...a) => u().ActivityBar(...a);
12
13
  export const ConfirmDialog = (...a) => u().ConfirmDialog(...a);
13
14
  export const ContextMenu = (...a) => u().ContextMenu(...a);
14
15
  export const DayPicker = (...a) => u().DayPicker(...a);
15
16
  export const Field = (...a) => u().Field(...a);
17
+ export const FileIcon = (...a) => u().FileIcon(...a);
18
+ export const FontViewer = (...a) => u().FontViewer(...a);
16
19
  export const GhostButton = (...a) => u().GhostButton(...a);
20
+ export const ImageViewer = (...a) => u().ImageViewer(...a);
17
21
  export const MarkdownLive = (...a) => u().MarkdownLive(...a);
18
22
  export const MarkdownToolbar = (...a) => u().MarkdownToolbar(...a);
23
+ export const MediaDiff = (...a) => u().MediaDiff(...a);
24
+ export const MediaViewer = (...a) => u().MediaViewer(...a);
25
+ export const MonacoDiff = (...a) => u().MonacoDiff(...a);
26
+ export const MonacoViewer = (...a) => u().MonacoViewer(...a);
19
27
  export const NamePrompt = (...a) => u().NamePrompt(...a);
20
28
  export const PanelHead = (...a) => u().PanelHead(...a);
21
29
  export const PrimaryButton = (...a) => u().PrimaryButton(...a);
@@ -30,8 +38,47 @@ export const TextInput = (...a) => u().TextInput(...a);
30
38
  export const TimeInput = (...a) => u().TimeInput(...a);
31
39
  export const Toggle = (...a) => u().Toggle(...a);
32
40
  export const TreeRow = (...a) => u().TreeRow(...a);
41
+ export const activeScopes = (...a) => u().activeScopes(...a);
42
+ export const allBindings = (...a) => u().allBindings(...a);
43
+ export const allThemes = (...a) => u().allThemes(...a);
44
+ export const applyLineChanges = (...a) => u().applyLineChanges(...a);
45
+ export const buildChangeTree = (...a) => u().buildChangeTree(...a);
46
+ export const chordFor = (...a) => u().chordFor(...a);
47
+ export const chordIndex = (...a) => u().chordIndex(...a);
48
+ export const claimedOutsideTerminal = (...a) => u().claimedOutsideTerminal(...a);
33
49
  export const cmSurface = (...a) => u().cmSurface(...a);
50
+ export const collectFiles = (...a) => u().collectFiles(...a);
51
+ export const conflict = (...a) => u().conflict(...a);
52
+ export const decodeText = (...a) => u().decodeText(...a);
53
+ export const dispatch = (...a) => u().dispatch(...a);
54
+ export const formatChord = (...a) => u().formatChord(...a);
55
+ export const getEditorSettings = (...a) => u().getEditorSettings(...a);
56
+ export const getOverrides = (...a) => u().getOverrides(...a);
57
+ export const match = (...a) => u().match(...a);
58
+ export const mediaKind = (...a) => u().mediaKind(...a);
59
+ export const monacoOptionsFrom = (...a) => u().monacoOptionsFrom(...a);
60
+ export const normalizeChord = (...a) => u().normalizeChord(...a);
61
+ export const onKey = (...a) => u().onKey(...a);
62
+ export const onKeys = (...a) => u().onKeys(...a);
63
+ export const parseChord = (...a) => u().parseChord(...a);
64
+ export const parseDirty = (...a) => u().parseDirty(...a);
65
+ export const pushScope = (...a) => u().pushScope(...a);
66
+ export const repoLabel = (...a) => u().repoLabel(...a);
67
+ export const resolve = (...a) => u().resolve(...a);
34
68
  export const rowAt = (...a) => u().rowAt(...a);
69
+ export const sameRows = (...a) => u().sameRows(...a);
70
+ export const scopeActive = (...a) => u().scopeActive(...a);
71
+ export const setPluginBindings = (...a) => u().setPluginBindings(...a);
72
+ export const statusColor = (...a) => u().statusColor(...a);
73
+ export const subscribeEditorSettings = (...a) => u().subscribeEditorSettings(...a);
74
+ export const themeById = (...a) => u().themeById(...a);
75
+ export const toMonaco = (...a) => u().toMonaco(...a);
35
76
  export const toast = (...a) => u().toast(...a);
77
+ export const updateEditorSettings = (...a) => u().updateEditorSettings(...a);
78
+ export const useEditorSettings = (...a) => u().useEditorSettings(...a);
79
+ export const useIconThemesVersion = (...a) => u().useIconThemesVersion(...a);
80
+ export const useKeybindings = (...a) => u().useKeybindings(...a);
81
+ export const useNarrow = (...a) => u().useNarrow(...a);
36
82
  export const useResize = (...a) => u().useResize(...a);
37
83
  export const useRowDrag = (...a) => u().useRowDrag(...a);
84
+ export const useScope = (...a) => u().useScope(...a);
@@ -1,8 +1,9 @@
1
- {
2
- "id": "__ID__",
3
- "name": "__NAME__",
4
- "description": "One line on what this is for, shown under its name in Settings.",
5
- "icon": "Sparkles",
6
- "version": "0.1.0",
7
- "minDeck": "0.17.0"
8
- }
1
+ {
2
+ "id": "__ID__",
3
+ "name": "__NAME__",
4
+ "description": "One line on what this is for, shown under its name in Settings.",
5
+ "icon": "Sparkles",
6
+ "color": "#a78bfa",
7
+ "version": "0.1.0",
8
+ "minDeck": "0.17.0"
9
+ }
@@ -0,0 +1,20 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ import type { LucideIcon } from "lucide-react";
3
+ export interface ActivityView<Id extends string> {
4
+ id: Id;
5
+ icon: LucideIcon;
6
+ title: string;
7
+ /** Small count bubble on the icon. Absolutely positioned, so it never affects layout. */
8
+ badge?: number;
9
+ /** Makes this icon a plain action — it opens a menu or dialog instead of switching the panel,
10
+ * and never takes the selected state. Receives its own button for anchoring a popup. */
11
+ onClick?: (el: HTMLElement) => void;
12
+ }
13
+ export default ActivityBar;
14
+ export declare function ActivityBar<Id extends string>({ views, active, onSelect, trailing, }: {
15
+ views: readonly ActivityView<Id>[];
16
+ active: Id;
17
+ onSelect: (id: Id) => void;
18
+ /** Fixed controls pinned to the right — present for every view, or the icons shift. */
19
+ trailing?: React.ReactNode;
20
+ }): import("react").JSX.Element;
@@ -28,7 +28,7 @@ export interface MenuItem {
28
28
  checked?: boolean;
29
29
  }
30
30
  export type MenuEntry = MenuItem | "sep";
31
- export declare function ContextMenu({ x, y, items, alignRight, onClose, onReorder, flipAt }: {
31
+ export declare function ContextMenu({ x, y, items, alignRight, onClose, onReorder, flipAt, up }: {
32
32
  x: number;
33
33
  y: number;
34
34
  items: MenuEntry[];
@@ -36,6 +36,8 @@ export declare function ContextMenu({ x, y, items, alignRight, onClose, onReorde
36
36
  onClose: () => void;
37
37
  /** A submenu flips around its parent row's LEFT edge, not the point it opened at. */
38
38
  flipAt?: number;
39
+ /** Open upward from (x, y) when it fits: a menu from a bottom bar, above the bar's buttons. */
40
+ up?: boolean;
39
41
  /** Called with (draggedId, newIndexAmongDraggableRows) after a drag-sort. */
40
42
  onReorder?: (id: string, toIndex: number) => void;
41
43
  }): import("react").ReactPortal;
@@ -0,0 +1,7 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ import { type IconRef } from "../core/icontheme";
3
+ export declare function FileIcon({ icon, size, tint }: {
4
+ icon: IconRef;
5
+ size?: number;
6
+ tint?: string;
7
+ }): import("react").JSX.Element;
@@ -12,7 +12,7 @@ export interface TabItem {
12
12
  /** Tooltip for the close button; defaults to "Close". */
13
13
  closeTitle?: string;
14
14
  }
15
- export declare function TabStrip({ tabs, activeId, onSelect, onClose, onReorder, onDoubleClick, trailing, }: {
15
+ export declare function TabStrip({ tabs, activeId, onSelect, onClose, onReorder, onDoubleClick, trailing, pill, onAdd, addTitle, }: {
16
16
  tabs: readonly TabItem[];
17
17
  activeId: string | null;
18
18
  onSelect: (id: string) => void;
@@ -22,5 +22,11 @@ export declare function TabStrip({ tabs, activeId, onSelect, onClose, onReorder,
22
22
  onDoubleClick?: (id: string) => void;
23
23
  /** Right-aligned controls after the tabs — view toggles, save state. */
24
24
  trailing?: ReactNode;
25
+ /** Rounded tabs with the active one lit in the accent, the look of the workspace tabs in the
26
+ * title bar, instead of the editor-style boxed row. */
27
+ pill?: boolean;
28
+ /** A + right after the last tab, as the workspace tabs have. */
29
+ onAdd?: () => void;
30
+ addTitle?: string;
25
31
  }): import("react").JSX.Element;
26
32
  export default TabStrip;
@@ -27,4 +27,10 @@ export declare function place(x: number, y: number, width: number, height: numbe
27
27
  *
28
28
  * Left out by a menu raised at a cursor, which has no width and so flips around itself.
29
29
  */
30
- flipAt?: number): Placement;
30
+ flipAt?: number,
31
+ /**
32
+ * Open upward from (x, y) whenever it fits there. For a menu raised from a button in a bottom
33
+ * bar: opening downward fits too (the window's edge is further down), and then covers the very
34
+ * buttons the menu is about.
35
+ */
36
+ up?: boolean): Placement;
@@ -1,4 +1,16 @@
1
1
  // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ /**
3
+ * Whether an element is narrower than `px`, kept current as it resizes.
4
+ *
5
+ * A tool can now be a pane of any width, not the whole window, so a layout with a fixed sidebar
6
+ * asks this about its own box (never the window) and folds the sidebar away when it would leave
7
+ * the content too little room.
8
+ *
9
+ * Returns the answer and a ref callback to put on the element. A callback rather than a ref
10
+ * object, so the measuring starts whenever the element appears: a component that first renders a
11
+ * loading state has no element on its first run, and an effect reading a ref then never ran again.
12
+ */
13
+ export declare function useNarrow(px: number): [boolean, (el: HTMLElement | null) => void];
2
14
  /**
3
15
  * A draggable split. Returns the size in px, the props for the divider, and whether a drag is
4
16
  * in progress — the last so an animated pane can turn its transition off while dragging, or the