@lapis-notes/workspace 0.2.0 → 0.3.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 +108 -9
- package/README.md +4 -0
- package/dist/WorkspaceShell.svelte +19 -2
- package/dist/WorkspaceShell.svelte.d.ts +3 -1
- package/dist/desktop/DesktopRecoveryBanner.css +46 -0
- package/dist/desktop/DesktopRecoveryBanner.svelte +70 -0
- package/dist/desktop/DesktopRecoveryBanner.svelte.d.ts +15 -0
- package/dist/desktop/DesktopVaultLauncher.svelte +278 -0
- package/dist/desktop/DesktopVaultLauncher.svelte.d.ts +17 -0
- package/dist/desktop/DesktopVaultLauncherDialogs.svelte +136 -0
- package/dist/desktop/DesktopVaultLauncherDialogs.svelte.d.ts +9 -0
- package/dist/desktop/DesktopWorkspaceStartup.css +8 -0
- package/dist/desktop/DesktopWorkspaceStartup.svelte +34 -0
- package/dist/desktop/DesktopWorkspaceStartup.svelte.d.ts +9 -0
- package/dist/desktop/desktop-vault-launcher-controls.css +142 -0
- package/dist/desktop/desktop-vault-launcher.css +181 -0
- package/dist/desktop/desktop-vault-launcher.d.ts +30 -0
- package/dist/desktop/desktop-vault-launcher.js +26 -0
- package/dist/desktop/desktop-vault-launcher.svelte.d.ts +36 -0
- package/dist/desktop/desktop-vault-launcher.svelte.js +140 -0
- package/dist/desktop/lapis-logo.svg +471 -0
- package/dist/file-conflicts/ConflictReview.svelte +145 -0
- package/dist/file-conflicts/ConflictReview.svelte.d.ts +8 -0
- package/dist/file-conflicts/ConflictReviewControls.svelte +66 -0
- package/dist/file-conflicts/ConflictReviewControls.svelte.d.ts +12 -0
- package/dist/file-conflicts/conflict-review-state.svelte.d.ts +22 -0
- package/dist/file-conflicts/conflict-review-state.svelte.js +59 -0
- package/dist/file-conflicts/conflict-review-view.d.ts +19 -0
- package/dist/file-conflicts/conflict-review-view.js +50 -0
- package/dist/file-conflicts/register-conflict-reviews.d.ts +7 -0
- package/dist/file-conflicts/register-conflict-reviews.js +132 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/plugin-management/CorePluginsSettingsPage.svelte +47 -16
- package/dist/plugin-management/PluginBrowser.svelte +63 -7
- package/dist/plugin-management/PluginRegistryToolbar.svelte.d.ts +1 -1
- package/dist/plugin-management/plugin-browser-model.d.ts +1 -0
- package/dist/plugin-management/plugin-browser-model.js +11 -2
- package/dist/plugin-management/plugin-browser-navigation.d.ts +1 -1
- package/dist/plugin-management/plugin-browser-navigation.js +4 -2
- package/dist/plugin-management/plugin-registry-controller.svelte.js +5 -1
- package/dist/plugin-management/plugins-view.svelte.d.ts +2 -1
- package/dist/plugin-management/plugins-view.svelte.js +6 -2
- package/dist/plugin-management/register-plugin-management-settings.js +7 -6
- package/package.json +5 -4
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { fuzzySearch } from "@lapis-notes/ui";
|
|
2
|
+
import { getVaultProfileLocation, } from "./desktop-vault-launcher";
|
|
3
|
+
function formatError(error) {
|
|
4
|
+
return error instanceof Error ? error.message : String(error);
|
|
5
|
+
}
|
|
6
|
+
/** State from the Deno chooser, shared without depending on a native bridge. */
|
|
7
|
+
export class DesktopVaultLauncherState {
|
|
8
|
+
host;
|
|
9
|
+
recentVaults = $state.raw([]);
|
|
10
|
+
recentVaultQuery = $state("");
|
|
11
|
+
recentVaultDialogOpen = $state(false);
|
|
12
|
+
settingsOpen = $state(false);
|
|
13
|
+
appearanceMode = $state("system");
|
|
14
|
+
activeActionId = $state(null);
|
|
15
|
+
renameDialogOpen = $state(false);
|
|
16
|
+
renameDialogName = $state("");
|
|
17
|
+
renameTarget = $state.raw(null);
|
|
18
|
+
actionError = $state("");
|
|
19
|
+
actionMessage = $state("");
|
|
20
|
+
constructor(host) {
|
|
21
|
+
this.host = host;
|
|
22
|
+
}
|
|
23
|
+
get inlineRecentVaults() {
|
|
24
|
+
return this.recentVaults.slice(0, 4);
|
|
25
|
+
}
|
|
26
|
+
get filteredRecentVaults() {
|
|
27
|
+
const entries = this.recentVaults.map((profile) => ({
|
|
28
|
+
profile,
|
|
29
|
+
name: profile.name,
|
|
30
|
+
location: getVaultProfileLocation(profile),
|
|
31
|
+
kind: profile.kind,
|
|
32
|
+
}));
|
|
33
|
+
return this.recentVaultQuery.trim()
|
|
34
|
+
? fuzzySearch(entries, this.recentVaultQuery, {
|
|
35
|
+
keys: ["name", "location", "kind"],
|
|
36
|
+
}).map((result) => result.item)
|
|
37
|
+
: entries;
|
|
38
|
+
}
|
|
39
|
+
applyAppearance(mode) {
|
|
40
|
+
const dark = mode === "system"
|
|
41
|
+
? (globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ??
|
|
42
|
+
false)
|
|
43
|
+
: mode === "dark";
|
|
44
|
+
for (const name of ["dark", "theme-dark"])
|
|
45
|
+
document.documentElement.classList.toggle(name, dark);
|
|
46
|
+
for (const name of ["light", "theme-light"])
|
|
47
|
+
document.documentElement.classList.toggle(name, !dark);
|
|
48
|
+
}
|
|
49
|
+
async refresh() {
|
|
50
|
+
try {
|
|
51
|
+
[this.recentVaults, this.appearanceMode] = await Promise.all([
|
|
52
|
+
this.host.listProfiles(),
|
|
53
|
+
this.host.getAppearance(),
|
|
54
|
+
]);
|
|
55
|
+
this.applyAppearance(this.appearanceMode);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
this.actionError = formatError(error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async invoke(action) {
|
|
62
|
+
this.actionError = "";
|
|
63
|
+
this.actionMessage = "";
|
|
64
|
+
try {
|
|
65
|
+
await action();
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
this.actionError = formatError(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async runAction(profile, action, message = "") {
|
|
72
|
+
this.activeActionId = profile.id;
|
|
73
|
+
this.actionError = "";
|
|
74
|
+
this.actionMessage = "";
|
|
75
|
+
try {
|
|
76
|
+
await action();
|
|
77
|
+
await this.refresh();
|
|
78
|
+
this.actionMessage = message;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
this.actionError = formatError(error);
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
this.activeActionId = null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
openRenameDialog(profile) {
|
|
88
|
+
this.renameTarget = profile;
|
|
89
|
+
this.renameDialogName = profile.name;
|
|
90
|
+
this.renameDialogOpen = true;
|
|
91
|
+
}
|
|
92
|
+
async submitRename() {
|
|
93
|
+
if (!this.renameTarget || !this.host.rename)
|
|
94
|
+
return;
|
|
95
|
+
const name = this.renameDialogName.trim();
|
|
96
|
+
if (!name) {
|
|
97
|
+
this.actionError = "Vault name is required";
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const profile = this.renameTarget;
|
|
101
|
+
await this.runAction(profile, () => this.host.rename(profile, name), "Vault renamed");
|
|
102
|
+
if (!this.actionError)
|
|
103
|
+
this.renameDialogOpen = false;
|
|
104
|
+
}
|
|
105
|
+
async moveRecentVault(profile) {
|
|
106
|
+
if (!this.host.move)
|
|
107
|
+
return;
|
|
108
|
+
this.activeActionId = profile.id;
|
|
109
|
+
this.actionError = "";
|
|
110
|
+
this.actionMessage = "";
|
|
111
|
+
try {
|
|
112
|
+
if (!(await this.host.move(profile)))
|
|
113
|
+
return;
|
|
114
|
+
await this.refresh();
|
|
115
|
+
this.actionMessage = "Vault moved";
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
this.actionError = formatError(error);
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
this.activeActionId = null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
copyVaultId(profile) {
|
|
125
|
+
return this.runAction(profile, () => this.host.copyId(profile), "Vault ID copied");
|
|
126
|
+
}
|
|
127
|
+
revealRecentVault(profile) {
|
|
128
|
+
return this.runAction(profile, () => this.host.reveal(profile));
|
|
129
|
+
}
|
|
130
|
+
removeRecentVault(profile) {
|
|
131
|
+
return this.runAction(profile, () => this.host.remove(profile), "Vault removed from recent projects");
|
|
132
|
+
}
|
|
133
|
+
async updateAppearance(mode) {
|
|
134
|
+
await this.invoke(async () => {
|
|
135
|
+
await this.host.saveAppearance(mode);
|
|
136
|
+
this.appearanceMode = mode;
|
|
137
|
+
this.applyAppearance(mode);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|