RuneStone 1.0.0
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
{
|
||||
// Type checks the example plugins against the SDK source, as a plugin author checks against the installed package.
|
||||
// `pnpm check` runs it. The file is outside the plugin folders, so no package contains it.
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"lib": ["es2022", "dom", "dom.iterable"],
|
||||
"types": [],
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"@runestone/plugin-sdk": ["../../packages/plugin-sdk/src/index.ts"],
|
||||
"@runestone/plugin-sdk/*": ["../../packages/plugin-sdk/src/*.ts"]
|
||||
}
|
||||
},
|
||||
"include": ["*/**/*.js"]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// @ts-check
|
||||
// JSDoc types from the plugin SDK. `pnpm check` checks this file with fixtures/plugins/tsconfig.json.
|
||||
/** @import { PluginApi } from "@runestone/plugin-sdk" */
|
||||
|
||||
/** @param {PluginApi} api */
|
||||
export function activate(api) {
|
||||
api.registerCommand({ id: "show-overview", title: "Show workspace overview", run: () => api.openView("overview") });
|
||||
api.registerView({
|
||||
id: "overview",
|
||||
title: "Workspace overview",
|
||||
/** @param {HTMLElement} container */
|
||||
async mount(container) {
|
||||
const status = document.createElement("p");
|
||||
status.textContent = "Loading workspace files…";
|
||||
container.append(status);
|
||||
let disposed = false;
|
||||
try {
|
||||
const entries = await api.workspace.list();
|
||||
if (api.signal.aborted || disposed) return;
|
||||
status.textContent = `${entries.length} files and folders in this workspace.`;
|
||||
const list = document.createElement("ul");
|
||||
for (const entry of entries) {
|
||||
const item = document.createElement("li");
|
||||
item.textContent = `${entry.name}${entry.kind === "folder" ? "/" : ""}`;
|
||||
list.append(item);
|
||||
}
|
||||
container.append(list);
|
||||
} catch (error) { status.textContent = String(error); }
|
||||
return () => { disposed = true; container.replaceChildren(); };
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "org.runestone-example.workspace-overview",
|
||||
"name": "Workspace overview",
|
||||
"author": "RuneStone example",
|
||||
"description": "List files and folders in the active workspace.",
|
||||
"version": "1.0.0",
|
||||
"apiVersion": 1,
|
||||
"entry": "main.js",
|
||||
"access": "full-app"
|
||||
}
|
||||
Reference in New Issue
Block a user