@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/plugin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { matchesProjectionSource } from "./storage/index-projection";
|
|
2
|
+
import { resolveWorkspaceHostBinding } from "./workspace-host-internal";
|
|
2
3
|
import { dirname, joinPath } from "./storage";
|
|
3
4
|
import { Component } from "./view.svelte";
|
|
4
5
|
function isPromiseLike(value) {
|
|
@@ -48,6 +49,10 @@ export class Plugin extends Component {
|
|
|
48
49
|
#registeredViewTypes = new Set();
|
|
49
50
|
#requestedCapabilities = [];
|
|
50
51
|
#grantedCapabilities = [];
|
|
52
|
+
#runtimeConfigured = false;
|
|
53
|
+
#syncHostCapabilities = null;
|
|
54
|
+
#createSyncHostCapabilities = null;
|
|
55
|
+
#revokeSyncHostCapabilities = null;
|
|
51
56
|
constructor(app, manifest) {
|
|
52
57
|
super();
|
|
53
58
|
this.app = app;
|
|
@@ -66,6 +71,7 @@ export class Plugin extends Component {
|
|
|
66
71
|
* @public
|
|
67
72
|
*/
|
|
68
73
|
configureRuntime(options = {}) {
|
|
74
|
+
this.#runtimeConfigured = true;
|
|
69
75
|
if (options.basePath !== undefined) {
|
|
70
76
|
this.basePath = options.basePath;
|
|
71
77
|
}
|
|
@@ -88,6 +94,12 @@ export class Plugin extends Component {
|
|
|
88
94
|
if (options.grantedCapabilities !== undefined) {
|
|
89
95
|
this.#grantedCapabilities = [...options.grantedCapabilities];
|
|
90
96
|
}
|
|
97
|
+
if (options.createSyncHostCapabilities !== undefined) {
|
|
98
|
+
this.#createSyncHostCapabilities = options.createSyncHostCapabilities;
|
|
99
|
+
}
|
|
100
|
+
if (options.revokeSyncHostCapabilities !== undefined) {
|
|
101
|
+
this.#revokeSyncHostCapabilities = options.revokeSyncHostCapabilities;
|
|
102
|
+
}
|
|
91
103
|
}
|
|
92
104
|
/**
|
|
93
105
|
* Enable the plugin and run its `onload()` lifecycle.
|
|
@@ -161,6 +173,13 @@ export class Plugin extends Component {
|
|
|
161
173
|
get id() {
|
|
162
174
|
return this.manifest.id;
|
|
163
175
|
}
|
|
176
|
+
/** Host-authenticated durable capabilities for sync and similar plugins. */
|
|
177
|
+
get syncHost() {
|
|
178
|
+
if (!this.#createSyncHostCapabilities) {
|
|
179
|
+
throw new Error(`Plugin ${this.id} has no host capability runtime`);
|
|
180
|
+
}
|
|
181
|
+
return (this.#syncHostCapabilities ??= this.#createSyncHostCapabilities());
|
|
182
|
+
}
|
|
164
183
|
getDataPath() {
|
|
165
184
|
return resolvePluginDataPath(this.manifest.id, this.source, this.basePath);
|
|
166
185
|
}
|
|
@@ -217,6 +236,8 @@ export class Plugin extends Component {
|
|
|
217
236
|
}
|
|
218
237
|
async disable() {
|
|
219
238
|
if (!this.loaded) {
|
|
239
|
+
this.#revokeSyncHostCapabilities?.();
|
|
240
|
+
this.#syncHostCapabilities = null;
|
|
220
241
|
this.#runtimeState = "disabled";
|
|
221
242
|
this.#failureMessage = null;
|
|
222
243
|
return;
|
|
@@ -224,6 +245,8 @@ export class Plugin extends Component {
|
|
|
224
245
|
this.#runtimeState = "disabling";
|
|
225
246
|
try {
|
|
226
247
|
await this.unloadAsync();
|
|
248
|
+
this.#revokeSyncHostCapabilities?.();
|
|
249
|
+
this.#syncHostCapabilities = null;
|
|
227
250
|
this.#runtimeState = "disabled";
|
|
228
251
|
this.#failureMessage = null;
|
|
229
252
|
this.emit("disable");
|
|
@@ -740,6 +763,39 @@ export class Plugin extends Component {
|
|
|
740
763
|
setting.removeItem(settingTab.plugin.manifest.id);
|
|
741
764
|
});
|
|
742
765
|
}
|
|
766
|
+
/**
|
|
767
|
+
* Register one controlled declarative settings definition with Workspace
|
|
768
|
+
* Settings. Source-backed values remain owned by the plugin.
|
|
769
|
+
*
|
|
770
|
+
* @public
|
|
771
|
+
*/
|
|
772
|
+
registerSettingsSection(definition) {
|
|
773
|
+
if (this.source === "community" && !this.app.workspaceTrust.trusted) {
|
|
774
|
+
throw new Error(`Plugin ${this.manifest.id} cannot register settings while the workspace is untrusted`);
|
|
775
|
+
}
|
|
776
|
+
const binding = resolveWorkspaceHostBinding(this.app.workspace);
|
|
777
|
+
if (!binding) {
|
|
778
|
+
throw new Error("Workspace host binding is not initialized");
|
|
779
|
+
}
|
|
780
|
+
const unregister = binding.controller.settings.registerDefinition(definition);
|
|
781
|
+
let disposed = false;
|
|
782
|
+
const registration = {
|
|
783
|
+
definition,
|
|
784
|
+
open: (fieldId) => !disposed &&
|
|
785
|
+
binding.controller.settings.open({
|
|
786
|
+
sectionId: definition.section.id,
|
|
787
|
+
fieldId,
|
|
788
|
+
}),
|
|
789
|
+
dispose: () => {
|
|
790
|
+
if (disposed)
|
|
791
|
+
return;
|
|
792
|
+
disposed = true;
|
|
793
|
+
unregister();
|
|
794
|
+
},
|
|
795
|
+
};
|
|
796
|
+
this.register(() => registration.dispose());
|
|
797
|
+
return registration;
|
|
798
|
+
}
|
|
743
799
|
}
|
|
744
800
|
function defaultPluginProvenance(source) {
|
|
745
801
|
switch (source) {
|