@lapis-notes/api 0.1.0 → 0.1.3
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/CHANGELOG.md +39 -0
- package/README.md +5 -0
- package/dist/app-database-host.d.ts +1 -0
- package/dist/app-database-host.js +1 -0
- package/dist/browser-sync-security.d.ts +45 -0
- package/dist/browser-sync-security.js +189 -0
- package/dist/build-tools/vite.d.ts +15 -0
- package/dist/build-tools/vite.js +36 -0
- package/dist/cache.svelte.d.ts +1 -1
- package/dist/cache.svelte.js +4 -1
- package/dist/components/editor/editor.css +54 -2
- package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte +18 -5
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.d.ts +0 -2
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.js +0 -14
- package/dist/components/editor/language-service/index.js +23 -2
- package/dist/components/icon/icon-list.svelte.d.ts +1 -1
- package/dist/components/select/select.svelte.d.ts +1 -1
- package/dist/context.svelte.d.ts +11 -1
- package/dist/context.svelte.js +38 -1
- package/dist/docs-api.d.ts +2 -0
- package/dist/docs-api.js +1 -0
- package/dist/generated/plugin-host-modules.schema.generated.d.ts +443 -13
- package/dist/generated/plugin-host-modules.schema.generated.js +970 -306
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/language-service/manager.d.ts +5 -0
- package/dist/language-service/manager.js +58 -14
- package/dist/lapis-extension.d.ts +1 -1
- package/dist/lapis-extension.js +12 -0
- package/dist/nostr-signer.d.ts +68 -0
- package/dist/nostr-signer.js +49 -0
- package/dist/plugin-asset-server.d.ts +1 -0
- package/dist/plugin-asset-server.js +3 -0
- package/dist/plugin-capability-facade.d.ts +1 -1
- package/dist/plugin-capability-facade.js +6 -0
- package/dist/plugin-distribution/catalog-media.d.ts +4 -0
- package/dist/plugin-distribution/catalog-media.js +40 -0
- package/dist/plugin-distribution/download-stats.d.ts +4 -0
- package/dist/plugin-distribution/download-stats.js +19 -0
- package/dist/plugin-distribution/index.d.ts +4 -0
- package/dist/plugin-distribution/index.js +4 -0
- package/dist/plugin-distribution/installer.d.ts +3 -0
- package/dist/plugin-distribution/installer.js +26 -3
- package/dist/plugin-distribution/manager.d.ts +71 -5
- package/dist/plugin-distribution/manager.js +376 -37
- package/dist/plugin-distribution/nostr-registry-adapter.d.ts +29 -0
- package/dist/plugin-distribution/nostr-registry-adapter.js +152 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.d.ts +43 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.js +64 -1
- package/dist/plugin-distribution/plugin-bundle.d.ts +14 -0
- package/dist/plugin-distribution/plugin-bundle.js +46 -7
- package/dist/plugin-distribution/plugin-markdown.d.ts +6 -0
- package/dist/plugin-distribution/plugin-markdown.js +94 -0
- package/dist/plugin-distribution/registry-client.d.ts +6 -1
- package/dist/plugin-distribution/registry-client.js +32 -10
- package/dist/plugin-distribution/registry-source-state.d.ts +15 -0
- package/dist/plugin-distribution/registry-source-state.js +42 -0
- package/dist/plugin-distribution/schemas.d.ts +2511 -2824
- package/dist/plugin-distribution/schemas.js +111 -42
- package/dist/plugin-distribution/types.d.ts +116 -5
- package/dist/plugin-distribution-host.d.ts +4 -0
- package/dist/plugin-distribution-host.js +2 -0
- package/dist/plugin-install-progress.js +1 -1
- package/dist/plugin-manager.d.ts +3 -0
- package/dist/plugin-manager.js +21 -13
- package/dist/plugin-settings.d.ts +21 -0
- package/dist/plugin-settings.js +41 -0
- package/dist/plugin.d.ts +13 -0
- package/dist/plugin.js +56 -0
- package/dist/registry-schema/catalog-v1.d.ts +4143 -0
- package/dist/registry-schema/catalog-v1.js +172 -0
- package/dist/registry-schema/catalog-v2.d.ts +5275 -0
- package/dist/registry-schema/catalog-v2.js +137 -0
- package/dist/registry-schema/index.d.ts +1 -0
- package/dist/registry-schema/index.js +1 -0
- package/dist/registry-schema/release-notes.d.ts +5 -0
- package/dist/registry-schema/release-notes.js +21 -0
- package/dist/server-host.d.ts +28 -0
- package/dist/server-host.js +17 -0
- package/dist/storage/app-database.d.ts +37 -2
- package/dist/storage/app-database.js +41 -1
- package/dist/storage/browser-coordinated-app-database.d.ts +3 -1
- package/dist/storage/browser-coordinated-app-database.js +8 -0
- package/dist/storage/browser.d.ts +4 -1
- package/dist/storage/browser.js +84 -0
- package/dist/storage/desktop-native.d.ts +4 -2
- package/dist/storage/desktop-native.js +90 -1
- package/dist/storage/fs.d.ts +17 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/memory-vault-adapter.d.ts +3 -1
- package/dist/storage/memory-vault-adapter.js +60 -0
- package/dist/storage/remote-app-database.d.ts +19 -0
- package/dist/storage/remote-app-database.js +130 -0
- package/dist/storage/task-projection.d.ts +2 -1
- package/dist/storage/task-projection.js +7 -2
- package/dist/storage/turso-app-database.d.ts +3 -1
- package/dist/storage/turso-app-database.js +45 -0
- package/dist/storage/vault-session.js +11 -0
- package/dist/storage/vault-state.d.ts +1 -1
- package/dist/storage/vault.svelte.d.ts +3 -1
- package/dist/storage/vault.svelte.js +76 -3
- package/dist/sync-host-security.d.ts +285 -0
- package/dist/sync-host-security.js +2237 -0
- package/dist/sync-host.d.ts +179 -0
- package/dist/sync-host.js +769 -0
- package/dist/workspace.svelte.d.ts +1 -1
- package/dist/workspace.svelte.js +1 -1
- package/package.json +48 -10
package/dist/context.svelte.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ import { DailyDocumentProviderRegistry } from "./daily-document-provider";
|
|
|
30
30
|
import { AppToolRegistry } from "./agent-tools";
|
|
31
31
|
import { MarkdownExtensionRegistry } from "./markdown-extension-registry";
|
|
32
32
|
import { MarkdownFileSurfaceRegistry } from "./markdown-file-surface-registry";
|
|
33
|
+
import { NostrSignerHost, type NostrSignerBroker } from "./nostr-signer";
|
|
34
|
+
import { SyncHostService, type SyncHostServiceOptions } from "./sync-host";
|
|
33
35
|
export interface AppWorkspaceShellApplicationProperties {
|
|
34
36
|
/** Application name shown by the shell's About surface. */
|
|
35
37
|
name?: string;
|
|
@@ -60,9 +62,14 @@ export type AppStateProperties = {
|
|
|
60
62
|
createCommunityPluginDependencyResolver?: PluginDependencyResolverFactory;
|
|
61
63
|
pluginAssetServer?: PluginAssetServer;
|
|
62
64
|
pluginDistributionOptions?: AppPluginDistributionOptions;
|
|
65
|
+
/** Host-owned Nostr account, keychain, and remote-signer implementation. */
|
|
66
|
+
nostrSignerBroker?: NostrSignerBroker;
|
|
67
|
+
syncHost?: SyncHostServiceOptions;
|
|
63
68
|
workspaceShell?: AppWorkspaceShellProperties;
|
|
64
69
|
markdownRenderer: (markdown: string, el: HTMLElement, sourcePath: string, component: Component) => Promise<void>;
|
|
65
70
|
};
|
|
71
|
+
/** Renderer-safe application properties exposed to plugins and views. */
|
|
72
|
+
export type AppPublicProperties = Pick<AppStateProperties, "version" | "configPath" | "workspaceShell" | "markdownRenderer">;
|
|
66
73
|
export type AppPluginDistributionOptions = Omit<DefaultPluginDistributionManagerOptions, "adapter" | "appVersion" | "platform" | "workspaceTrusted" | "pluginManager">;
|
|
67
74
|
export type ExtType = Extension | ((context: Record<string, any>) => Extension);
|
|
68
75
|
/**
|
|
@@ -146,7 +153,7 @@ export declare class SecretStorage {
|
|
|
146
153
|
* @public
|
|
147
154
|
*/
|
|
148
155
|
export declare class App {
|
|
149
|
-
readonly props:
|
|
156
|
+
readonly props: AppPublicProperties;
|
|
150
157
|
readonly i18n: LocalizationManager;
|
|
151
158
|
readonly workspace: Workspace;
|
|
152
159
|
readonly vault: Vault;
|
|
@@ -166,6 +173,7 @@ export declare class App {
|
|
|
166
173
|
readonly urls: AppUrlService;
|
|
167
174
|
readonly workspaceTrust: WorkspaceTrustService;
|
|
168
175
|
readonly pluginDistribution: DefaultPluginDistributionManager;
|
|
176
|
+
readonly nostr: NostrSignerHost;
|
|
169
177
|
mardownPostProcessor: Array<MarkdownPostProcessor>;
|
|
170
178
|
mardownCodeBlockPostProcessor: Record<string, Array<MarkdownPostProcessor>>;
|
|
171
179
|
markdownDirectiveRenderers: Record<string, MarkdownDirectiveRenderer>;
|
|
@@ -239,6 +247,8 @@ export declare class App {
|
|
|
239
247
|
setting(id: "options" | "core-plugins" | "community-plugins"): import("./settings.svelte").SettingGroup;
|
|
240
248
|
}
|
|
241
249
|
export type AppState = App;
|
|
250
|
+
/** Transfer the mounting host's sync controller exactly once. */
|
|
251
|
+
export declare function takeHostSyncService(app: App): SyncHostService;
|
|
242
252
|
declare global {
|
|
243
253
|
var app: App;
|
|
244
254
|
}
|
package/dist/context.svelte.js
CHANGED
|
@@ -21,6 +21,7 @@ import { bindRuntimePluginDiagnostics } from "./diagnostics";
|
|
|
21
21
|
import { ContextKeyService } from "./context-keys.svelte";
|
|
22
22
|
import { StatusBarManager } from "./status-bar.svelte";
|
|
23
23
|
import { AppUrlService } from "./app-url";
|
|
24
|
+
import { NostrSignerHost } from "./nostr-signer";
|
|
24
25
|
import { WorkspaceTrustService } from "./workspace-trust";
|
|
25
26
|
import { DefaultPluginDistributionManager, } from "./plugin-distribution";
|
|
26
27
|
import { ConfigurationOptionSourceRegistry } from "./configuration-option-source-registry";
|
|
@@ -32,8 +33,21 @@ import { AppSkillRegistry, AppSlashCommandRegistry, } from "./agent-skills";
|
|
|
32
33
|
import { AppResultViewRegistry } from "./agent-result-views";
|
|
33
34
|
import { MarkdownExtensionRegistry } from "./markdown-extension-registry";
|
|
34
35
|
import { MarkdownFileSurfaceRegistry } from "./markdown-file-surface-registry";
|
|
36
|
+
import { SyncHostService, } from "./sync-host";
|
|
35
37
|
import { installApplicationCompatibility, resolveApplication, } from "./application-compatibility";
|
|
36
38
|
import { provideApplicationState, useApplicationState, } from "./application-state.svelte";
|
|
39
|
+
const hostSyncServices = new WeakMap();
|
|
40
|
+
/**
|
|
41
|
+
* Transfer the host-only sync controller to the mounting host exactly once.
|
|
42
|
+
* Plugins receive only their scoped capability facade through Plugin.syncHost.
|
|
43
|
+
*/
|
|
44
|
+
export function takeHostSyncService(app) {
|
|
45
|
+
const service = hostSyncServices.get(app);
|
|
46
|
+
if (!service)
|
|
47
|
+
throw new Error("The host sync controller is unavailable");
|
|
48
|
+
hostSyncServices.delete(app);
|
|
49
|
+
return service;
|
|
50
|
+
}
|
|
37
51
|
export { getApplicationCompatibility, installApplicationCompatibility, resolveApplication, } from "./application-compatibility";
|
|
38
52
|
export { provideApplicationState, useApplicationState, } from "./application-state.svelte";
|
|
39
53
|
/**
|
|
@@ -131,6 +145,8 @@ export class App {
|
|
|
131
145
|
urls = new AppUrlService(this);
|
|
132
146
|
workspaceTrust;
|
|
133
147
|
pluginDistribution;
|
|
148
|
+
nostr;
|
|
149
|
+
#syncHost;
|
|
134
150
|
mardownPostProcessor = $state([]);
|
|
135
151
|
mardownCodeBlockPostProcessor = $state({});
|
|
136
152
|
markdownDirectiveRenderers = $state({});
|
|
@@ -174,7 +190,13 @@ export class App {
|
|
|
174
190
|
* @public
|
|
175
191
|
*/
|
|
176
192
|
constructor(props) {
|
|
177
|
-
this.props =
|
|
193
|
+
this.props = Object.freeze({
|
|
194
|
+
version: props.version,
|
|
195
|
+
configPath: props.configPath,
|
|
196
|
+
workspaceShell: props.workspaceShell,
|
|
197
|
+
markdownRenderer: props.markdownRenderer,
|
|
198
|
+
});
|
|
199
|
+
this.nostr = new NostrSignerHost(props.nostrSignerBroker);
|
|
178
200
|
const adapter = props.session?.vaultAdapter ?? props.adapter;
|
|
179
201
|
if (!adapter) {
|
|
180
202
|
throw new Error("App requires a vault adapter or vault session");
|
|
@@ -207,6 +229,19 @@ export class App {
|
|
|
207
229
|
this.configuration = new Configuration(this, props.configPath);
|
|
208
230
|
this.workspace.bindConfiguration();
|
|
209
231
|
this.vault = new Vault(adapter);
|
|
232
|
+
this.#syncHost = new SyncHostService(this.appDatabase, this.vault, Date.now, {
|
|
233
|
+
...props.syncHost,
|
|
234
|
+
flushOpenEditor: async (path) => {
|
|
235
|
+
const active = this.workspace.activeEditor;
|
|
236
|
+
if (!active?.editor || !active.file)
|
|
237
|
+
return { flushed: false, path };
|
|
238
|
+
if (path && active.file.path !== path)
|
|
239
|
+
return { flushed: false, path };
|
|
240
|
+
await active.editor.flushChanges();
|
|
241
|
+
return { flushed: true, path: active.file.path };
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
hostSyncServices.set(this, this.#syncHost);
|
|
210
245
|
this.workspaceTrust = new WorkspaceTrustService(adapter);
|
|
211
246
|
this.metadataCache = new MetadataCache(this);
|
|
212
247
|
installVaultMaintenanceCommands(this);
|
|
@@ -216,6 +251,8 @@ export class App {
|
|
|
216
251
|
: undefined,
|
|
217
252
|
createCommunityPluginDependencyResolver: props.createCommunityPluginDependencyResolver,
|
|
218
253
|
pluginAssetServer: props.pluginAssetServer,
|
|
254
|
+
createSyncHostCapabilities: (pluginId, grants) => this.#syncHost.forPlugin(pluginId, grants),
|
|
255
|
+
revokeSyncHostCapabilities: (pluginId) => this.#syncHost.revokePlugin(pluginId),
|
|
219
256
|
});
|
|
220
257
|
this.workspace.bindPlugins();
|
|
221
258
|
const languageServiceDiagnostics = this.workspace.diagnostics.createCollection("lapis:language-service", {
|
package/dist/docs-api.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export type { AppSafeModeFailure, AppSafeModeState, AppStateProperties, } from "
|
|
|
10
10
|
export { getApplicationCompatibility, installApplicationCompatibility, resolveApplication, } from "./application-compatibility";
|
|
11
11
|
export { provideApplicationState, useApplicationState, } from "./application-state.svelte";
|
|
12
12
|
export { Plugin, resolvePluginDataPath } from "./plugin";
|
|
13
|
+
export { DeclarativePluginSettingTab } from "./plugin-settings";
|
|
14
|
+
export type { PluginSettingsDefinition, PluginSettingsRegistration, WorkspaceCustomFieldAdapter, WorkspaceCustomSetting, WorkspaceCustomSettingProps, WorkspaceObjectCollectionSetting, WorkspaceObjectProperty, WorkspaceObjectRowAction, WorkspaceOutputSetting, WorkspaceSettingField, WorkspaceSettingsSection, WorkspaceSettingsSource, } from "./plugin-settings";
|
|
13
15
|
export type { PluginManifest, PluginRuntimeOptions, PluginSource, } from "./plugin";
|
|
14
16
|
export type { LapisExtensionContributions, LapisExtensionKind, LapisExtensionManifest, LapisExtensionPermission, LapisExtensionRuntimeHost, LapisPluginClassification, } from "./lapis-extension";
|
|
15
17
|
export { PluginManager } from "./plugin-manager";
|
package/dist/docs-api.js
CHANGED
|
@@ -9,6 +9,7 @@ export { App, createDefaultAppSafeModeState, RenderContext, SecretStorage, } fro
|
|
|
9
9
|
export { getApplicationCompatibility, installApplicationCompatibility, resolveApplication, } from "./application-compatibility";
|
|
10
10
|
export { provideApplicationState, useApplicationState, } from "./application-state.svelte";
|
|
11
11
|
export { Plugin, resolvePluginDataPath } from "./plugin";
|
|
12
|
+
export { DeclarativePluginSettingTab } from "./plugin-settings";
|
|
12
13
|
export { PluginManager } from "./plugin-manager";
|
|
13
14
|
export { AppUrlService } from "./app-url";
|
|
14
15
|
export { FileManager } from "./file-manager";
|