@silverbulletmd/silverbullet 2.7.0 → 2.8.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.
- package/README.md +0 -2
- package/client/plugos/syscalls/client_code_widget.ts +3 -1
- package/client/plugos/syscalls/editor.ts +11 -0
- package/client/plugos/syscalls/index.ts +7 -0
- package/dist/plug-compile.js +1 -1
- package/package.json +1 -1
- package/plug-api/syscalls/editor.ts +5 -0
- package/plug-api/syscalls/index.ts +12 -0
- package/plug-api/types/client.ts +12 -0
package/README.md
CHANGED
|
@@ -27,8 +27,6 @@ SilverBullet's frontend is written in [TypeScript](https://www.typescriptlang.or
|
|
|
27
27
|
|
|
28
28
|
The server backend is written in Go.
|
|
29
29
|
|
|
30
|
-
If you're considering contributing changes, be aware of the [LLM use policy](https://silverbullet.md/LLM%20Use).
|
|
31
|
-
|
|
32
30
|
## Code structure
|
|
33
31
|
* `client/`: The SilverBullet client, implemented with TypeScript
|
|
34
32
|
* `server/`: The SilverBullet server, written in Go
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { SysCallMapping } from "../../plugos/system.ts";
|
|
2
|
+
import type { Client } from "../../client.ts";
|
|
2
3
|
import { reloadAllWidgets } from "../../codemirror/code_widget.ts";
|
|
3
4
|
import { broadcastReload } from "../../components/widget_sandbox_iframe.ts";
|
|
4
5
|
|
|
5
|
-
export function clientCodeWidgetSyscalls(): SysCallMapping {
|
|
6
|
+
export function clientCodeWidgetSyscalls(client: Client): SysCallMapping {
|
|
6
7
|
return {
|
|
7
8
|
"codeWidget.refreshAll": () => {
|
|
9
|
+
client.widgetCache.clearPrewarm();
|
|
8
10
|
broadcastReload();
|
|
9
11
|
return reloadAllWidgets();
|
|
10
12
|
},
|
|
@@ -71,6 +71,8 @@ import type {
|
|
|
71
71
|
UploadFile,
|
|
72
72
|
} from "@silverbulletmd/silverbullet/type/client";
|
|
73
73
|
import { openSearchPanel } from "@codemirror/search";
|
|
74
|
+
import { forceLinting } from "@codemirror/lint";
|
|
75
|
+
import { refreshLintEffect } from "../../codemirror/lint.ts";
|
|
74
76
|
import {
|
|
75
77
|
isValidPath,
|
|
76
78
|
parseToRef,
|
|
@@ -249,6 +251,15 @@ export function editorSyscalls(client: Client): SysCallMapping {
|
|
|
249
251
|
"editor.reloadPage": async () => {
|
|
250
252
|
await client.reloadEditor();
|
|
251
253
|
},
|
|
254
|
+
"editor.forceLint": () => {
|
|
255
|
+
// `forceLinting` alone is a no-op on unchanged content after the
|
|
256
|
+
// linter's internal "scheduled" flag has been cleared; the effect
|
|
257
|
+
// re-arms it via `needsRefresh`.
|
|
258
|
+
client.editorView.dispatch({
|
|
259
|
+
effects: refreshLintEffect.of(null),
|
|
260
|
+
});
|
|
261
|
+
forceLinting(client.editorView);
|
|
262
|
+
},
|
|
252
263
|
"editor.reloadUI": () => {
|
|
253
264
|
location.reload();
|
|
254
265
|
},
|
|
@@ -61,6 +61,13 @@ export function indexSyscalls(
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
+
"index.previewProcessedObjects": (
|
|
65
|
+
_ctx,
|
|
66
|
+
page: string,
|
|
67
|
+
objects: ObjectValue[],
|
|
68
|
+
): Promise<{ tag: string; object: ObjectValue }[]> => {
|
|
69
|
+
return objectIndex.previewProcessedObjects(page, objects);
|
|
70
|
+
},
|
|
64
71
|
"index.getObjectByRef": (
|
|
65
72
|
_ctx,
|
|
66
73
|
page: string,
|
package/dist/plug-compile.js
CHANGED
package/package.json
CHANGED
|
@@ -153,6 +153,11 @@ export function reloadPage(): Promise<void> {
|
|
|
153
153
|
return syscall("editor.reloadPage");
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/** Useful when a plug toggles a piece of state that lint subscribers consult. */
|
|
157
|
+
export function forceLint(): Promise<void> {
|
|
158
|
+
return syscall("editor.forceLint");
|
|
159
|
+
}
|
|
160
|
+
|
|
156
161
|
/**
|
|
157
162
|
* Force reloads the browser UI
|
|
158
163
|
*/
|
|
@@ -27,6 +27,18 @@ export function validateObjects<T>(
|
|
|
27
27
|
return syscall("index.validateObjects", page, objects);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Run the full indexing pipeline (validation, multi-tag expansion,
|
|
32
|
+
* tag transforms) and return the resulting objects each paired with
|
|
33
|
+
* the tag they're indexed under. Read-only — no DB writes.
|
|
34
|
+
*/
|
|
35
|
+
export function previewProcessedObjects(
|
|
36
|
+
page: string,
|
|
37
|
+
objects: ObjectValue[],
|
|
38
|
+
): Promise<{ tag: string; object: ObjectValue }[]> {
|
|
39
|
+
return syscall("index.previewProcessedObjects", page, objects);
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
/**
|
|
31
43
|
* Queries objects using a Lua-based collection query
|
|
32
44
|
* @param tag - The tag to filter objects by
|
package/plug-api/types/client.ts
CHANGED
|
@@ -54,6 +54,18 @@ export type LintDiagnostic = {
|
|
|
54
54
|
to: number;
|
|
55
55
|
severity: "error" | "warning" | "info" | "hint";
|
|
56
56
|
message: string;
|
|
57
|
+
/**
|
|
58
|
+
* Optional HTML rendered into the hover tooltip for this diagnostic.
|
|
59
|
+
* When present, takes precedence over `message` for tooltip display.
|
|
60
|
+
* `message` is still used as a plain-text fallback (e.g. in the lint
|
|
61
|
+
* panel) and as the diagnostic's accessible label.
|
|
62
|
+
*/
|
|
63
|
+
messageHtml?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Optional CSS class added to the inline range mark for this diagnostic,
|
|
66
|
+
* in addition to CodeMirror's default `.cm-lintRange-<severity>` class.
|
|
67
|
+
*/
|
|
68
|
+
markClass?: string;
|
|
57
69
|
};
|
|
58
70
|
|
|
59
71
|
export type UploadFile = {
|