@lapis-notes/api 0.1.4 → 0.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.
- package/CHANGELOG.md +193 -0
- package/README.md +19 -0
- package/dist/__tests__/fixtures/indexed-mutations.json +6862 -0
- package/dist/__tests__/fixtures/memory-storage.json +309 -0
- package/dist/__tests__/fixtures/native-facade-contract.json +3224 -0
- package/dist/__tests__/fixtures/projection-query.json +195 -0
- package/dist/__tests__/fixtures/projection-values.json +60 -0
- package/dist/__tests__/fixtures/search-preparation.json +1513 -0
- package/dist/__tests__/fixtures/search-retrieval.json +15409 -0
- package/dist/__tests__/fixtures/search-semantic-model.json +3691 -0
- package/dist/__tests__/fixtures/search-semantic-retrieval.json +6603 -0
- package/dist/__tests__/fixtures/search-storage.json +409 -0
- package/dist/__tests__/fixtures/task-projection.json +428 -0
- package/dist/__tests__/indexed-mutation-support.js +262 -0
- package/dist/__tests__/projection-query-support.js +40 -0
- package/dist/__tests__/search-retrieval-support.js +47 -0
- package/dist/app-database-host.d.ts +1 -0
- package/dist/app-shell-plugin-persistence.d.ts +3 -2
- package/dist/app-shell-plugin-persistence.js +37 -3
- package/dist/cache.svelte.d.ts +8 -1
- package/dist/cache.svelte.js +103 -5
- package/dist/command.svelte.js +29 -2
- package/dist/components/editor/editor.css +4 -0
- package/dist/components/editor/editor.svelte +21 -9
- package/dist/components/editor/embedded-editor-surface.js +3 -1
- package/dist/components/editor/inline-title-alignment.d.ts +3 -0
- package/dist/components/editor/inline-title-alignment.js +57 -0
- package/dist/configuration.svelte.d.ts +270 -206
- package/dist/configuration.svelte.js +161 -86
- package/dist/context.svelte.d.ts +21 -3
- package/dist/context.svelte.js +63 -20
- package/dist/diagnostics.d.ts +8 -0
- package/dist/diagnostics.js +6 -0
- package/dist/editor-save-context.d.ts +12 -1
- package/dist/editor-save-context.js +32 -1
- package/dist/editor-view-registry.d.ts +10 -0
- package/dist/editor-view-registry.js +44 -4
- package/dist/editor.svelte.js +128 -37
- package/dist/embed-registry.d.ts +10 -0
- package/dist/embed-registry.js +15 -0
- package/dist/file-editing-failures.d.ts +2 -0
- package/dist/file-editing-failures.js +29 -0
- package/dist/file-editing-native-issues.d.ts +19 -0
- package/dist/file-editing-native-issues.js +65 -0
- package/dist/file-editing-sessions.d.ts +56 -8
- package/dist/file-editing-sessions.js +185 -15
- package/dist/file-manager.d.ts +8 -1
- package/dist/file-manager.js +37 -3
- package/dist/file-state-store.d.ts +5 -0
- package/dist/file-state-store.js +34 -0
- package/dist/file-text-conflicts.d.ts +25 -0
- package/dist/file-text-conflicts.js +35 -0
- package/dist/file-text-mutation.d.ts +13 -0
- package/dist/file-text-mutation.js +100 -0
- package/dist/file-text-persistence.d.ts +36 -0
- package/dist/file-text-persistence.js +234 -0
- package/dist/file-text-state-writer.d.ts +34 -0
- package/dist/file-text-state-writer.js +183 -0
- package/dist/files-configuration.d.ts +20 -0
- package/dist/files-configuration.js +47 -0
- package/dist/generated/plugin-host-modules.schema.generated.d.ts +87 -37
- package/dist/generated/plugin-host-modules.schema.generated.js +102 -37
- package/dist/glob.d.ts +3 -0
- package/dist/glob.js +2 -1
- package/dist/icons/changes.d.ts +3 -0
- package/dist/icons/changes.js +16 -0
- package/dist/icons/index.d.ts +5 -1
- package/dist/icons/index.js +44 -3
- package/dist/icons/registry.d.ts +35 -0
- package/dist/icons/registry.js +154 -0
- package/dist/icons/safe-svg.d.ts +2 -0
- package/dist/icons/safe-svg.js +44 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/lapis-extension.d.ts +6 -2
- package/dist/lapis-extension.js +2 -0
- package/dist/metadata.svelte.js +45 -2
- package/dist/native-background-indexing.d.ts +48 -0
- package/dist/native-background-indexing.js +208 -0
- package/dist/native-database-protocol.d.ts +29 -0
- package/dist/native-database-protocol.js +1 -0
- package/dist/native-editing-intent-lease.d.ts +17 -0
- package/dist/native-editing-intent-lease.js +188 -0
- package/dist/native-editing-intents-protocol.d.ts +70 -0
- package/dist/native-editing-intents-protocol.js +1 -0
- package/dist/native-editing-intents.d.ts +8 -0
- package/dist/native-editing-intents.js +1 -0
- package/dist/native-editing-problems.d.ts +3 -0
- package/dist/native-editing-problems.js +180 -0
- package/dist/native-editing-recovery.d.ts +24 -0
- package/dist/native-editing-recovery.js +198 -0
- package/dist/native-editing-session.d.ts +51 -0
- package/dist/native-editing-session.js +251 -0
- package/dist/native-history-index-protocol.d.ts +80 -0
- package/dist/native-history-index-protocol.js +1 -0
- package/dist/native-history-index.d.ts +6 -0
- package/dist/native-history-index.js +1 -0
- package/dist/native-indexing-protocol.d.ts +63 -0
- package/dist/native-indexing-protocol.js +1 -0
- package/dist/native-participant-protocol.d.ts +67 -0
- package/dist/native-participant-protocol.js +3 -0
- package/dist/native-queue-protocol.d.ts +73 -0
- package/dist/native-queue-protocol.js +3 -0
- package/dist/native-tasks-protocol.d.ts +264 -0
- package/dist/native-tasks-protocol.js +1 -0
- package/dist/native-tasks.d.ts +35 -0
- package/dist/native-tasks.js +79 -0
- package/dist/native-turn-protocol.d.ts +81 -0
- package/dist/native-turn-protocol.js +1 -0
- package/dist/native-turns.d.ts +29 -0
- package/dist/native-turns.js +2 -0
- package/dist/plugin-asset-server.js +3 -2
- package/dist/plugin-dependency-resolver.d.ts +1 -1
- package/dist/plugin-distribution/compatibility.d.ts +1 -1
- package/dist/plugin-distribution/compatibility.js +10 -5
- package/dist/plugin-distribution/installed-plugin-state.js +2 -1
- package/dist/plugin-distribution/installer.d.ts +6 -0
- package/dist/plugin-distribution/installer.js +90 -37
- package/dist/plugin-distribution/manager.d.ts +4 -1
- package/dist/plugin-distribution/manager.js +12 -5
- package/dist/plugin-distribution/registry-cache.js +2 -1
- package/dist/plugin-distribution/registry-source-state.js +2 -1
- package/dist/plugin-distribution/schemas.d.ts +26 -8
- package/dist/plugin-distribution/schemas.js +2 -1
- package/dist/plugin-distribution/types.d.ts +4 -0
- package/dist/plugin-manager.d.ts +20 -4
- package/dist/plugin-manager.js +228 -64
- package/dist/plugin-runtime-entry.d.ts +1 -1
- package/dist/plugin-runtime-entry.js +16 -0
- package/dist/plugin.d.ts +18 -2
- package/dist/plugin.js +93 -39
- package/dist/registry-schema/catalog-v1.d.ts +60 -9
- package/dist/registry-schema/catalog-v1.js +2 -1
- package/dist/registry-schema/catalog-v2.d.ts +60 -9
- package/dist/registry-schema/catalog-v2.js +1 -1
- package/dist/search-result-provider.d.ts +95 -0
- package/dist/search-result-provider.js +42 -0
- package/dist/status-bar.svelte.d.ts +26 -20
- package/dist/status-bar.svelte.js +1 -0
- package/dist/storage/app-database.d.ts +6 -2
- package/dist/storage/app-database.js +41 -34
- package/dist/storage/desktop-native.d.ts +5 -3
- package/dist/storage/desktop-native.js +59 -6
- package/dist/storage/directory-watcher.d.ts +27 -0
- package/dist/storage/directory-watcher.js +201 -0
- package/dist/storage/fs.d.ts +14 -27
- package/dist/storage/fs.js +2 -168
- package/dist/storage/index-projection.js +33 -15
- package/dist/storage/memory-vault-adapter.d.ts +2 -0
- package/dist/storage/memory-vault-adapter.js +14 -1
- package/dist/storage/path.d.ts +6 -2
- package/dist/storage/path.js +8 -2
- package/dist/storage/projection-query-candidates.d.ts +3 -0
- package/dist/storage/projection-query-candidates.js +69 -0
- package/dist/storage/remote-app-database.d.ts +2 -2
- package/dist/storage/remote-app-database.js +1 -1
- package/dist/storage/runtime.d.ts +3 -0
- package/dist/storage/runtime.js +3 -0
- package/dist/storage/search-embedding-record.d.ts +3 -0
- package/dist/storage/search-embedding-record.js +18 -0
- package/dist/storage/turso-app-database.d.ts +2 -0
- package/dist/storage/turso-app-database.js +67 -30
- package/dist/storage/vault-listing.d.ts +3 -0
- package/dist/storage/vault-listing.js +36 -0
- package/dist/storage/vault-reconciliation.d.ts +19 -0
- package/dist/storage/vault-reconciliation.js +137 -0
- package/dist/storage/vault-session.d.ts +8 -0
- package/dist/storage/vault-session.js +10 -2
- package/dist/storage/vault.svelte.d.ts +53 -4
- package/dist/storage/vault.svelte.js +223 -87
- package/dist/sync-host.d.ts +12 -3
- package/dist/sync-host.js +5 -1
- package/dist/vault-change-views.d.ts +4 -0
- package/dist/vault-change-views.js +43 -0
- package/dist/vault-changes.d.ts +37 -0
- package/dist/vault-changes.js +228 -0
- package/dist/view.svelte.d.ts +182 -149
- package/dist/view.svelte.js +11 -2
- package/dist/workspace-close-guard.d.ts +3 -0
- package/dist/workspace-close-guard.js +35 -0
- package/dist/workspace-host-internal.js +10 -2
- package/dist/workspace-layout-normalizer.d.ts +4 -2
- package/dist/workspace-layout-normalizer.js +5 -5
- package/dist/workspace-view-document.d.ts +3 -0
- package/dist/workspace-view-document.js +12 -0
- package/dist/workspace.svelte.d.ts +13 -2
- package/dist/workspace.svelte.js +371 -82
- package/package.json +45 -8
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { tick } from "svelte";
|
|
2
|
+
/** Keep the App's persistence barrier held through destructive shell changes. */
|
|
3
|
+
export function workspaceCloseGuard(workspace, hostDocuments = () => []) {
|
|
4
|
+
return async (ids, remove) => {
|
|
5
|
+
const targets = ids.map((id) => {
|
|
6
|
+
const leaf = workspace.getLeafById(id);
|
|
7
|
+
const view = leaf?.view;
|
|
8
|
+
return { id, leaf, view, scope: view?.getClosePersistenceScope?.() };
|
|
9
|
+
});
|
|
10
|
+
const documents = new Set(ids.map((id) => workspace.getCommandHostDocument(workspace.getCommandHostIdForLeaf(workspace.getLeafById(id)))));
|
|
11
|
+
for (const doc of hostDocuments())
|
|
12
|
+
documents.add(doc);
|
|
13
|
+
for (const doc of documents) {
|
|
14
|
+
const active = doc?.activeElement;
|
|
15
|
+
active?.blur?.();
|
|
16
|
+
}
|
|
17
|
+
await tick();
|
|
18
|
+
const registry = workspace.app.fileEditingSessions;
|
|
19
|
+
await registry.settleOperations();
|
|
20
|
+
await workspace.flushLayout();
|
|
21
|
+
const layoutOnly = targets.length > 0 &&
|
|
22
|
+
targets.every(({ id, leaf, view, scope }) => scope === "layout" &&
|
|
23
|
+
leaf &&
|
|
24
|
+
workspace.getLeafById(id) === leaf &&
|
|
25
|
+
leaf.view === view &&
|
|
26
|
+
view?.getClosePersistenceScope?.() === "layout");
|
|
27
|
+
if (layoutOnly) {
|
|
28
|
+
remove();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await registry.guard(undefined, async () => {
|
|
32
|
+
remove();
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
const HOST_BINDING = Symbol.for("lapis.workspaceHostBinding");
|
|
1
2
|
const workspaceHostBindings = new WeakMap();
|
|
2
3
|
export function setWorkspaceHostBinding(workspace, binding) {
|
|
3
|
-
|
|
4
|
+
const frozen = Object.freeze(binding);
|
|
5
|
+
workspaceHostBindings.set(workspace, frozen);
|
|
6
|
+
Object.defineProperty(workspace, HOST_BINDING, {
|
|
7
|
+
configurable: true,
|
|
8
|
+
enumerable: false,
|
|
9
|
+
value: frozen,
|
|
10
|
+
});
|
|
4
11
|
}
|
|
5
12
|
export function resolveWorkspaceHostBinding(workspace) {
|
|
6
|
-
return workspaceHostBindings.get(workspace)
|
|
13
|
+
return (workspaceHostBindings.get(workspace) ??
|
|
14
|
+
workspace[HOST_BINDING]);
|
|
7
15
|
}
|
|
@@ -62,7 +62,7 @@ type WorkspaceBottomPanelJson = WorkspaceTabsJson & {
|
|
|
62
62
|
type WorkspaceWindowJson = {
|
|
63
63
|
id: string;
|
|
64
64
|
type: "floating";
|
|
65
|
-
mode?: "floating";
|
|
65
|
+
mode?: "floating" | "popout";
|
|
66
66
|
displayState?: "collapsed" | "minimized";
|
|
67
67
|
direction: "horizontal" | "vertical";
|
|
68
68
|
sizes: number[];
|
|
@@ -88,5 +88,7 @@ export type WorkspaceJson = {
|
|
|
88
88
|
* Always returns a structurally valid {@link WorkspaceJson} even when the input
|
|
89
89
|
* is `null`, empty, partial, or corrupted.
|
|
90
90
|
*/
|
|
91
|
-
export declare function normalizeWorkspaceJson(raw: unknown
|
|
91
|
+
export declare function normalizeWorkspaceJson(raw: unknown, options?: {
|
|
92
|
+
preservePopouts?: boolean;
|
|
93
|
+
}): WorkspaceJson;
|
|
92
94
|
export {};
|
|
@@ -226,14 +226,14 @@ function normalizeBottomPanel(raw) {
|
|
|
226
226
|
: "0px",
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
function normalizeFloatingWindow(raw) {
|
|
229
|
+
function normalizeFloatingWindow(raw, preservePopouts = false) {
|
|
230
230
|
if (!raw || typeof raw !== "object")
|
|
231
231
|
return null;
|
|
232
232
|
const r = raw;
|
|
233
233
|
if (r.type !== "floating")
|
|
234
234
|
return null;
|
|
235
235
|
// Popout windows cannot be restored across sessions — drop them.
|
|
236
|
-
if (r.mode === "popout")
|
|
236
|
+
if (r.mode === "popout" && !preservePopouts)
|
|
237
237
|
return null;
|
|
238
238
|
const children = (Array.isArray(r.children) ? r.children : [])
|
|
239
239
|
.map(normalizeSplitChild)
|
|
@@ -249,7 +249,7 @@ function normalizeFloatingWindow(raw) {
|
|
|
249
249
|
return {
|
|
250
250
|
id: ensureId(r.id),
|
|
251
251
|
type: "floating",
|
|
252
|
-
mode: "floating",
|
|
252
|
+
mode: r.mode === "popout" ? "popout" : "floating",
|
|
253
253
|
...(displayState !== undefined ? { displayState } : {}),
|
|
254
254
|
direction: ensureDirection(r.direction),
|
|
255
255
|
sizes: repairSizes(r.sizes, children.length),
|
|
@@ -283,11 +283,11 @@ function hasAnyLeaf(nodes) {
|
|
|
283
283
|
* Always returns a structurally valid {@link WorkspaceJson} even when the input
|
|
284
284
|
* is `null`, empty, partial, or corrupted.
|
|
285
285
|
*/
|
|
286
|
-
export function normalizeWorkspaceJson(raw) {
|
|
286
|
+
export function normalizeWorkspaceJson(raw, options = {}) {
|
|
287
287
|
const r = raw && typeof raw === "object" ? raw : {};
|
|
288
288
|
const floating = Array.isArray(r.floating)
|
|
289
289
|
? r.floating
|
|
290
|
-
.map(normalizeFloatingWindow)
|
|
290
|
+
.map((window) => normalizeFloatingWindow(window, options.preservePopouts))
|
|
291
291
|
.filter((w) => w !== null)
|
|
292
292
|
: [];
|
|
293
293
|
return {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Retarget a retained editor's DOM services when its view changes document. */
|
|
2
|
+
export function attachWorkspaceView(target, leaf) {
|
|
3
|
+
target.replaceChildren(leaf.containerEl);
|
|
4
|
+
const editor = leaf.view.editor;
|
|
5
|
+
const node = target.getRootNode();
|
|
6
|
+
const root = node.nodeType === 9 || node.nodeType === 11
|
|
7
|
+
? node
|
|
8
|
+
: target.ownerDocument;
|
|
9
|
+
if (editor?.view && editor.view.root !== root) {
|
|
10
|
+
editor.view.setRoot(root);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -7,7 +7,8 @@ import { SidebarState, type SidebarStateProps } from "@lapis-notes/ui/sidebar-cu
|
|
|
7
7
|
import { HistoryManager } from "./history.svelte";
|
|
8
8
|
import type { TransactionSpec } from "@codemirror/state";
|
|
9
9
|
import type { App } from "./context.svelte";
|
|
10
|
-
import {
|
|
10
|
+
import type { DiagnosticLocation, DiagnosticsManager } from "./diagnostics";
|
|
11
|
+
import { EditorViewRegistry, type EditorViewContribution, type ExtensionRegistrationOptions, type RegisteredEditorViewContribution } from "./editor-view-registry";
|
|
11
12
|
/** @public */
|
|
12
13
|
export type Constructor<T> = abstract new (...args: any[]) => T;
|
|
13
14
|
/**
|
|
@@ -472,6 +473,10 @@ export declare class Workspace extends EventDispatcher<{
|
|
|
472
473
|
containerEl: HTMLElement;
|
|
473
474
|
private saveLayoutDebounced;
|
|
474
475
|
requestSaveLayout(event?: WorkspaceLayoutChangeEvent): void;
|
|
476
|
+
/** Await serialized layout persistence before the owning host tears down. */
|
|
477
|
+
flushLayout(): Promise<void>;
|
|
478
|
+
/** Await admitted App Shell plugin transitions and their persistence. */
|
|
479
|
+
flushPluginChanges(): Promise<void>;
|
|
475
480
|
private withoutLayoutPersistence;
|
|
476
481
|
private dispatchLayoutDropEvent;
|
|
477
482
|
willShowLayoutDropOverlay(options: Omit<WorkspaceLayoutDropEvent, "defaultPrevented" | "preventDefault">): WorkspaceLayoutDropEvent;
|
|
@@ -533,6 +538,9 @@ export declare class Workspace extends EventDispatcher<{
|
|
|
533
538
|
bindConfiguration(): void;
|
|
534
539
|
/** Dispose the API-owned shell controller and its compatibility bridges. */
|
|
535
540
|
disposeWorkspaceHost(): Promise<void>;
|
|
541
|
+
readonly diagnostics: DiagnosticsManager;
|
|
542
|
+
/** Register an owned opener for application-specific diagnostic resources. */
|
|
543
|
+
registerDiagnosticOpener(opener: (location: DiagnosticLocation) => boolean | Promise<boolean>): () => void;
|
|
536
544
|
getMostRecentLeaf(): WorkspaceLeaf | null;
|
|
537
545
|
getVisibleHintTargets(): WorkspaceHintTarget[];
|
|
538
546
|
changeLayout(workspace: WorkspaceJson | any): Promise<void>;
|
|
@@ -571,7 +579,9 @@ export declare class Workspace extends EventDispatcher<{
|
|
|
571
579
|
view?: RegisteredEditorViewContribution;
|
|
572
580
|
} | undefined;
|
|
573
581
|
private resolveEditorAssociationViewType;
|
|
574
|
-
|
|
582
|
+
getFileIconForPath(path: string): string | undefined;
|
|
583
|
+
onFileIconsChanged(listener: () => void): () => void;
|
|
584
|
+
registerExtensions(extensions: string[], viewType: string, options?: ExtensionRegistrationOptions): () => void;
|
|
575
585
|
unregisterExtensions(extensions: string[], viewType: string): void;
|
|
576
586
|
determineViewType(type: string): string | undefined;
|
|
577
587
|
determineViewTypeForPath(path: string): string | undefined;
|
|
@@ -607,6 +617,7 @@ export declare class Workspace extends EventDispatcher<{
|
|
|
607
617
|
* @public
|
|
608
618
|
*/
|
|
609
619
|
getActiveFile(): TFile | null;
|
|
620
|
+
reconcileFileReference(oldPath: string, file: TFile | null): void;
|
|
610
621
|
/**
|
|
611
622
|
* Iterate through all leaves, including main area leaves, floating leaves,
|
|
612
623
|
* and sidebar leaves.
|