@hiai-gg/docsmint 0.3.9 → 0.4.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/dist/backend/index.js +1 -1
- package/dist/frontend/FolderNode--l1g8bcL.js +298 -0
- package/dist/frontend/{SettingsDialog-BHh68rTB.js → SettingsDialog-LyZUxxku.js} +132 -132
- package/dist/frontend/Sidebar-BsJsD1mJ.js +2021 -0
- package/dist/frontend/api/categories.js +1 -1
- package/dist/frontend/api/documents.js +1 -1
- package/dist/frontend/api/folders.js +1 -1
- package/dist/frontend/app-shell.js +118 -111
- package/dist/frontend/{categories-izQovv2w.js → categories-Drnns7N6.js} +14 -14
- package/dist/frontend/components/folder-node.js +1 -1
- package/dist/frontend/components/save-as-dialog.js +2 -2
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/sidebar.js +1 -1
- package/dist/frontend/dashboard.js +524 -522
- package/dist/frontend/{documents-BsDkvzCm.js → documents-Bc7b_MSZ.js} +15 -15
- package/dist/frontend/{folders-CTuV_JtU.js → folders-ONG03Dkv.js} +10 -10
- package/dist/frontend/route-context-BqQQ5c4i.js +29 -0
- package/dist/frontend/search.js +309 -309
- package/dist/frontend/{tag-store.svelte-CqrUXo0o.js → tag-store.svelte-CG7RrlDT.js} +1 -1
- package/dist/frontend-ssr/api/categories.js +1 -1
- package/dist/frontend-ssr/api/documents.js +1 -1
- package/dist/frontend-ssr/api/folders.js +1 -1
- package/dist/frontend-ssr/app-shell.js +12 -3
- package/dist/frontend-ssr/assets/{FolderNode-BZ0Q2QUS.js → FolderNode-CpHrpOED.js} +5 -3
- package/dist/frontend-ssr/assets/{SettingsDialog-B8L_YqNA.js → SettingsDialog-Dg97vv83.js} +4 -3
- package/dist/frontend-ssr/assets/{Sidebar-EHuUAx3W.js → Sidebar-CrDk_HYY.js} +28 -24
- package/dist/frontend-ssr/assets/{categories-AOqgcsn4.js → categories-CTCtdv7V.js} +10 -10
- package/dist/frontend-ssr/assets/{documents-BnOTRdTY.js → documents-PObdTOiT.js} +8 -8
- package/dist/frontend-ssr/assets/{folders-CTfbS24J.js → folders-BX30gHv6.js} +10 -10
- package/dist/frontend-ssr/assets/route-context-uca_b2Px.js +36 -0
- package/dist/frontend-ssr/assets/{tag-store.svelte-DPodKj6Z.js → tag-store.svelte-DvgUduhd.js} +1 -1
- package/dist/frontend-ssr/components/folder-node.js +1 -1
- package/dist/frontend-ssr/components/save-as-dialog.js +1 -1
- package/dist/frontend-ssr/components/settings.js +1 -1
- package/dist/frontend-ssr/components/sidebar.js +1 -1
- package/dist/frontend-ssr/dashboard.js +32 -24
- package/dist/frontend-ssr/search.js +6 -4
- package/package.json +1 -1
- package/packages/cli/src/index.ts +1 -1
- package/packages/mcp-server/src/index.ts +1 -1
- package/dist/frontend/FolderNode-C6FJv99G.js +0 -298
- package/dist/frontend/Sidebar-Cu3JrKDC.js +0 -2021
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as setDocumentCategory, c as updateCategoryInputSchema, i as listCategories, n as createCategoryInputSchema, o as setFolderCategory, r as deleteCategory, s as updateCategory, t as createCategory } from "../assets/categories-
|
|
1
|
+
import { a as setDocumentCategory, c as updateCategoryInputSchema, i as listCategories, n as createCategoryInputSchema, o as setFolderCategory, r as deleteCategory, s as updateCategory, t as createCategory } from "../assets/categories-CTCtdv7V.js";
|
|
2
2
|
export { createCategory, createCategoryInputSchema, deleteCategory, listCategories, setDocumentCategory, setFolderCategory, updateCategory, updateCategoryInputSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as importDocument, c as updateDocument, i as getDocument, n as createDocument, o as importDocuments, r as deleteDocument, s as listDocuments, t as clearDocumentsCache } from "../assets/documents-
|
|
1
|
+
import { a as importDocument, c as updateDocument, i as getDocument, n as createDocument, o as importDocuments, r as deleteDocument, s as listDocuments, t as clearDocumentsCache } from "../assets/documents-PObdTOiT.js";
|
|
2
2
|
export { clearDocumentsCache, createDocument, deleteDocument, getDocument, importDocument, importDocuments, listDocuments, updateDocument };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getFolder, c as updateFolder, i as duplicateDocument, n as deleteDocument, o as getFolderPath, r as deleteFolder, s as listFolders, t as createFolder } from "../assets/folders-
|
|
1
|
+
import { a as getFolder, c as updateFolder, i as duplicateDocument, n as deleteDocument, o as getFolderPath, r as deleteFolder, s as listFolders, t as createFolder } from "../assets/folders-BX30gHv6.js";
|
|
2
2
|
export { createFolder, deleteDocument, deleteFolder, duplicateDocument, getFolder, getFolderPath, listFolders, updateFolder };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { T as scroll_to_top_aria } from "./assets/messages-CvqpZNJe.js";
|
|
2
2
|
import { t as Icon } from "./assets/Icon-B0Zqppjo.js";
|
|
3
|
-
import { n as searchPreferences, r as editorPreferences } from "./assets/SettingsDialog-
|
|
4
|
-
import { t as Sidebar } from "./assets/Sidebar-
|
|
3
|
+
import { n as searchPreferences, r as editorPreferences } from "./assets/SettingsDialog-Dg97vv83.js";
|
|
4
|
+
import { t as Sidebar } from "./assets/Sidebar-CrDk_HYY.js";
|
|
5
|
+
import { a as provideDocsmintRouteAdapter, i as provideDocsmintRequestAdapter } from "./assets/route-context-uca_b2Px.js";
|
|
5
6
|
import { t as HiaiDocsExtensionProvider } from "./assets/HiaiDocsExtensionProvider-DAM-lX4R.js";
|
|
6
7
|
import * as $ from "svelte/internal/server";
|
|
7
8
|
import { onDestroy } from "svelte";
|
|
@@ -221,7 +222,15 @@ function ScrollToTop($$renderer, $$props) {
|
|
|
221
222
|
//#region src/lib/hosts/DocsmintAppShellHost.svelte
|
|
222
223
|
function DocsmintAppShellHost($$renderer, $$props) {
|
|
223
224
|
$$renderer.component(($$renderer) => {
|
|
224
|
-
const { route, extensions = {}, children } = $$props;
|
|
225
|
+
const { route, request = { fetch }, extensions = {}, children } = $$props;
|
|
226
|
+
provideDocsmintRouteAdapter({
|
|
227
|
+
get pathname() {
|
|
228
|
+
return route.pathname;
|
|
229
|
+
},
|
|
230
|
+
resolve: (path) => route.resolve(path),
|
|
231
|
+
navigate: (path, options) => route.navigate?.(path, options)
|
|
232
|
+
});
|
|
233
|
+
provideDocsmintRequestAdapter({ fetch: (...args) => request.fetch(...args) });
|
|
225
234
|
editorPreferences.init();
|
|
226
235
|
searchPreferences.init();
|
|
227
236
|
let mainElement = null;
|
|
@@ -2,16 +2,18 @@ import { Lr as dashboard_new_document, Or as doc_share, _r as folders_delete, un
|
|
|
2
2
|
import { t as Chevron_right } from "./chevron-right-B4p7Sk6X.js";
|
|
3
3
|
import { t as Folder } from "./folder-DChhG7qN.js";
|
|
4
4
|
import { a as Dropdown_menu, i as Dropdown_menu_content, o as Ellipsis_vertical, r as Dropdown_menu_item, t as Dropdown_menu_trigger } from "./dropdown-menu-Bj5rbqbB.js";
|
|
5
|
+
import { n as getDocsmintRouteAdapter, r as navigateDocsmintRoute, t as getDocsmintRequestAdapter } from "./route-context-uca_b2Px.js";
|
|
5
6
|
import { t as cn } from "./utils-DvZnctjz.js";
|
|
6
7
|
import "./dndzone-DMvTO_Jz.js";
|
|
7
8
|
import "./subfolders-refresh-store.svelte-DAh4gT16.js";
|
|
8
9
|
import * as $ from "svelte/internal/server";
|
|
9
|
-
import { goto } from "$app/navigation";
|
|
10
10
|
import { page } from "$app/state";
|
|
11
11
|
import "svelte/animate";
|
|
12
12
|
//#region src/lib/components/sidebar/FolderNode.svelte
|
|
13
13
|
function FolderNode($$renderer, $$props) {
|
|
14
14
|
$$renderer.component(($$renderer) => {
|
|
15
|
+
const route = getDocsmintRouteAdapter();
|
|
16
|
+
getDocsmintRequestAdapter();
|
|
15
17
|
let { folder, depth = 0, folderDocsMap, expandedFolderIds, isDraggingGlobal, isDraggingFolder = false, isDraggingDoc = false, dragDisabled, folderFlipDurationMs, documentFlipDurationMs, draggedDocId = null, onToggleFolder, onScheduleFolderExpand, onClearExpandTimer, onRename, onDelete, onCreateSubfolder, onShare, onConsiderDocs, onFinalizeDocs, onConsiderSubfolders, onFinalizeSubfolders, onDropOnFolder, docRowInner, copyButton, docMenu } = $$props;
|
|
16
18
|
let subfolderZone = [];
|
|
17
19
|
const isExpanded = $.derived(() => expandedFolderIds.has(folder.id));
|
|
@@ -45,7 +47,7 @@ function FolderNode($$renderer, $$props) {
|
|
|
45
47
|
align: "end",
|
|
46
48
|
children: ($$renderer) => {
|
|
47
49
|
Dropdown_menu_item($$renderer, {
|
|
48
|
-
onSelect: () =>
|
|
50
|
+
onSelect: () => navigateDocsmintRoute(route, "/folders/" + folder.id),
|
|
49
51
|
children: ($$renderer) => {
|
|
50
52
|
$$renderer.push(`<!---->${$.escape(action_go_to())}`);
|
|
51
53
|
},
|
|
@@ -53,7 +55,7 @@ function FolderNode($$renderer, $$props) {
|
|
|
53
55
|
});
|
|
54
56
|
$$renderer.push(`<!----> `);
|
|
55
57
|
Dropdown_menu_item($$renderer, {
|
|
56
|
-
onSelect: () =>
|
|
58
|
+
onSelect: () => navigateDocsmintRoute(route, `/docs/new?folder=${folder.id}`),
|
|
57
59
|
children: ($$renderer) => {
|
|
58
60
|
$$renderer.push(`<!---->${$.escape(dashboard_new_document())}`);
|
|
59
61
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { An as theme_system, Cn as confirm_password, Dn as settings_name, En as settings_save, Fn as settings_account, In as settings_profile, Ln as settings_title, Mn as theme_light, Nn as settings_theme, On as settings_email_change_warning, Pn as settings_appearance, Sn as change_password, Tn as password_label, bn as auth_logout, fn as action_close, jn as theme_dark, kn as settings_email, wn as new_password, xn as auth_password } from "./messages-CvqpZNJe.js";
|
|
2
2
|
import { t as Icon } from "./Icon-B0Zqppjo.js";
|
|
3
|
+
import { n as getDocsmintRouteAdapter, r as navigateDocsmintRoute } from "./route-context-uca_b2Px.js";
|
|
3
4
|
import { t as cn } from "./utils-DtlPPXpJ.js";
|
|
4
5
|
import { a as Dialog, i as Dialog_description, n as Dialog_header, o as Button, r as Dialog_footer, t as Dialog_title } from "./dialog-BOV1u6zP.js";
|
|
5
6
|
import { t as Input } from "./input-DezGsU3y.js";
|
|
@@ -7,7 +8,7 @@ import { t as Label } from "./label-Bj8-TfFN.js";
|
|
|
7
8
|
import { r as signOut } from "./auth-client-x26kqY8Z.js";
|
|
8
9
|
import { r as getProfile } from "./settings-Bk5Hk9Vq.js";
|
|
9
10
|
import { a as listApiKeys, i as createGlobalApiKey, n as categoryIdFromScopes, o as revealCategoryApiKey, s as revokeApiKey, t as apiKeyClipboardValue } from "./api-keys-DFqX39MT.js";
|
|
10
|
-
import { i as listCategories } from "./categories-
|
|
11
|
+
import { i as listCategories } from "./categories-CTCtdv7V.js";
|
|
11
12
|
import { t as getFrontendExtensions } from "./context-jz1GGEUi.js";
|
|
12
13
|
import { t as resolveExtensions } from "./resolve-BqHozBXl.js";
|
|
13
14
|
import { a as resolveOfflineIdentity, t as disableOfflineAccess } from "./identity-B3uHoDtf.js";
|
|
@@ -15,7 +16,6 @@ import { n as getOfflineDB, t as deleteOfflineDB } from "./db-CnxeO66n.js";
|
|
|
15
16
|
import { t as themeStore } from "./theme.svelte-Co0-ssaD.js";
|
|
16
17
|
import * as $ from "svelte/internal/server";
|
|
17
18
|
import { onMount } from "svelte";
|
|
18
|
-
import { goto } from "$app/navigation";
|
|
19
19
|
import { page } from "$app/state";
|
|
20
20
|
//#region ../node_modules/.bun/lucide-svelte@1.0.1+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/log-out.svelte
|
|
21
21
|
function Log_out($$renderer, $$props) {
|
|
@@ -610,13 +610,14 @@ function SettingsDialog($$renderer, $$props) {
|
|
|
610
610
|
}
|
|
611
611
|
];
|
|
612
612
|
let loggingOut = false;
|
|
613
|
+
const route = getDocsmintRouteAdapter();
|
|
613
614
|
async function handleLogout() {
|
|
614
615
|
loggingOut = true;
|
|
615
616
|
try {
|
|
616
617
|
await cleanupOfflineData();
|
|
617
618
|
await signOut();
|
|
618
619
|
open = false;
|
|
619
|
-
|
|
620
|
+
navigateDocsmintRoute(route, "/login");
|
|
620
621
|
} catch {
|
|
621
622
|
loggingOut = false;
|
|
622
623
|
}
|
|
@@ -6,34 +6,34 @@ import { t as Chevron_right } from "./chevron-right-B4p7Sk6X.js";
|
|
|
6
6
|
import { t as Clock } from "./clock-IL-eX2di.js";
|
|
7
7
|
import { t as Copy } from "./copy-CjV57nGQ.js";
|
|
8
8
|
import { t as Folder } from "./folder-DChhG7qN.js";
|
|
9
|
-
import { t as SettingsDialog } from "./SettingsDialog-
|
|
9
|
+
import { t as SettingsDialog } from "./SettingsDialog-Dg97vv83.js";
|
|
10
10
|
import { n as Search, t as Tag } from "./tag-GZEuGWk1.js";
|
|
11
11
|
import { a as Dropdown_menu, i as Dropdown_menu_content, o as Ellipsis_vertical, r as Dropdown_menu_item, t as Dropdown_menu_trigger } from "./dropdown-menu-Bj5rbqbB.js";
|
|
12
12
|
import { t as Loader_circle } from "./loader-circle-DZsrZ-er.js";
|
|
13
|
+
import { n as getDocsmintRouteAdapter, o as resolveDocsmintRoute, r as navigateDocsmintRoute, t as getDocsmintRequestAdapter } from "./route-context-uca_b2Px.js";
|
|
13
14
|
import { t as cn } from "./utils-DvZnctjz.js";
|
|
14
15
|
import { a as Dialog, i as Dialog_description, n as Dialog_header, o as Button, r as Dialog_footer, t as Dialog_title } from "./dialog-BOV1u6zP.js";
|
|
15
16
|
import { t as Input } from "./input-DezGsU3y.js";
|
|
16
17
|
import { t as Label } from "./label-Bj8-TfFN.js";
|
|
17
18
|
import { n as apiFetch } from "./client-DZMkDkDn.js";
|
|
18
|
-
import { i as listCategories, r as deleteCategory } from "./categories-
|
|
19
|
+
import { i as listCategories, r as deleteCategory } from "./categories-CTCtdv7V.js";
|
|
19
20
|
import { t as getFrontendExtensions } from "./context-jz1GGEUi.js";
|
|
20
21
|
import { t as resolveExtensions } from "./resolve-BqHozBXl.js";
|
|
21
22
|
import { n as SHADOW_ITEM_MARKER_PROPERTY_NAME } from "./dndzone-DMvTO_Jz.js";
|
|
22
|
-
import { c as updateDocument, r as deleteDocument, s as listDocuments, t as clearDocumentsCache } from "./documents-
|
|
23
|
-
import { c as updateFolder, r as deleteFolder, s as listFolders, t as createFolder } from "./folders-
|
|
23
|
+
import { c as updateDocument, r as deleteDocument, s as listDocuments, t as clearDocumentsCache } from "./documents-PObdTOiT.js";
|
|
24
|
+
import { c as updateFolder, r as deleteFolder, s as listFolders, t as createFolder } from "./folders-BX30gHv6.js";
|
|
24
25
|
import { t as DeleteDialog } from "./DeleteDialog-tBYaP0L3.js";
|
|
25
26
|
import { t as ShareDialog } from "./ShareDialog-vMvJLRfn.js";
|
|
26
27
|
import { t as CategoryDialog } from "./CategoryDialog-BcGW8-Kf.js";
|
|
27
28
|
import { n as createDocumentPlacementWriter, t as createDocumentDropCoordinator } from "./document-drop-coordinator-CEaYACsC.js";
|
|
28
29
|
import { a as getFolderFromRegistry, c as getPendingDocumentPlacement, f as registerDocument, n as bumpSubfoldersRefresh, p as registerFolder, r as getDocumentFromRegistry, t as acknowledgeDocumentPlacement, u as publishDocumentPlacement } from "./subfolders-refresh-store.svelte-DAh4gT16.js";
|
|
29
|
-
import { t as FolderNode } from "./FolderNode-
|
|
30
|
-
import { i as setSelectedTag, n as refreshDocs, r as refreshTags, t as getSelectedTag } from "./tag-store.svelte-
|
|
30
|
+
import { t as FolderNode } from "./FolderNode-CpHrpOED.js";
|
|
31
|
+
import { i as setSelectedTag, n as refreshDocs, r as refreshTags, t as getSelectedTag } from "./tag-store.svelte-DvgUduhd.js";
|
|
31
32
|
import { t as ConfirmDialog } from "./ConfirmDialog-DjMFKc0V.js";
|
|
32
33
|
import { i as deleteTag, o as listTags } from "./tags-BId2wdYd.js";
|
|
33
34
|
import { t as TagCreateDialog } from "./TagCreateDialog-B0DPEfmQ.js";
|
|
34
35
|
import * as $ from "svelte/internal/server";
|
|
35
36
|
import { onDestroy, onMount } from "svelte";
|
|
36
|
-
import { goto } from "$app/navigation";
|
|
37
37
|
import { page } from "$app/state";
|
|
38
38
|
import "svelte/animate";
|
|
39
39
|
//#region ../node_modules/.bun/lucide-svelte@1.0.1+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/panel-left-close.svelte
|
|
@@ -296,6 +296,7 @@ function SearchBar($$renderer, $$props) {
|
|
|
296
296
|
$$renderer.component(($$renderer) => {
|
|
297
297
|
const { class: className } = $$props;
|
|
298
298
|
let query = "";
|
|
299
|
+
getDocsmintRouteAdapter();
|
|
299
300
|
$$renderer.push(`<div${$.attr_class($.clsx(cn("relative", className)))}>`);
|
|
300
301
|
Search($$renderer, { class: "pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" });
|
|
301
302
|
$$renderer.push(`<!----> <input type="text"${$.attr("value", query)}${$.attr("placeholder", search_placeholder())}${$.attr_class($.clsx(cn("flex h-9 w-full rounded-md border border-input bg-transparent pl-9 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "pr-3")))}/> `);
|
|
@@ -312,6 +313,8 @@ function docRowInner($$renderer, doc) {
|
|
|
312
313
|
}
|
|
313
314
|
function FolderTree($$renderer, $$props) {
|
|
314
315
|
$$renderer.component(($$renderer) => {
|
|
316
|
+
const route = getDocsmintRouteAdapter();
|
|
317
|
+
const request = getDocsmintRequestAdapter();
|
|
315
318
|
/**
|
|
316
319
|
* Identifies where a doc dndzone lives in the tree. Every doc zone
|
|
317
320
|
* (folder content, category root-doc bucket, Uncategorized root)
|
|
@@ -450,7 +453,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
450
453
|
}
|
|
451
454
|
async function loadFolders() {
|
|
452
455
|
try {
|
|
453
|
-
folders = ((await listFolders(null))[0]?.children ?? []).map((f) => {
|
|
456
|
+
folders = ((await listFolders(null, false, request.fetch))[0]?.children ?? []).map((f) => {
|
|
454
457
|
registerFolder(f.id, f.parentId ?? null, f.categoryId ?? null, f.order ?? 0);
|
|
455
458
|
return {
|
|
456
459
|
id: f.id,
|
|
@@ -468,7 +471,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
468
471
|
}
|
|
469
472
|
async function loadCategories() {
|
|
470
473
|
try {
|
|
471
|
-
const loaded = await listCategories();
|
|
474
|
+
const loaded = await listCategories(request.fetch);
|
|
472
475
|
const ids = /* @__PURE__ */ new Set();
|
|
473
476
|
for (const category of loaded) {
|
|
474
477
|
if (ids.has(category.id)) throw new Error(`Categories response contains duplicate id: ${category.id}`);
|
|
@@ -487,7 +490,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
487
490
|
const res = await listDocuments({
|
|
488
491
|
limit: 100,
|
|
489
492
|
...tag ? { tag } : {}
|
|
490
|
-
});
|
|
493
|
+
}, request.fetch);
|
|
491
494
|
if (generation !== documentsLoadGeneration) return;
|
|
492
495
|
documents = res.items.map((doc) => getPendingDocumentPlacement(doc.id) ? {
|
|
493
496
|
...doc,
|
|
@@ -522,7 +525,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
522
525
|
resyncZonesFromDocuments();
|
|
523
526
|
}
|
|
524
527
|
const writeDocumentPlacement = createDocumentPlacementWriter({
|
|
525
|
-
patch: (documentId, placement) => updateDocument(documentId, placement),
|
|
528
|
+
patch: (documentId, placement) => updateDocument(documentId, placement, request.fetch),
|
|
526
529
|
optimistic: (documentId, placement) => publishDocumentPlacement(documentId, placement.folderId, placement.categoryId),
|
|
527
530
|
acknowledge: acknowledgeDocumentPlacement,
|
|
528
531
|
rollback: rollbackDocumentPlacement,
|
|
@@ -595,7 +598,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
595
598
|
name,
|
|
596
599
|
parentId,
|
|
597
600
|
categoryId: newFolderCategoryId
|
|
598
|
-
});
|
|
601
|
+
}, request.fetch);
|
|
599
602
|
await loadFolders();
|
|
600
603
|
if (parentId) {
|
|
601
604
|
expandedFolderIds = new Set(expandedFolderIds).add(parentId);
|
|
@@ -780,7 +783,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
780
783
|
try {
|
|
781
784
|
await Promise.all(updates.map((u) => {
|
|
782
785
|
const { folderId, ...patchBody } = u;
|
|
783
|
-
return updateFolder(folderId, patchBody);
|
|
786
|
+
return updateFolder(folderId, patchBody, request.fetch);
|
|
784
787
|
}));
|
|
785
788
|
await refresh();
|
|
786
789
|
resyncBucketFolders();
|
|
@@ -818,8 +821,8 @@ function FolderTree($$renderer, $$props) {
|
|
|
818
821
|
}
|
|
819
822
|
renameSubmitting = true;
|
|
820
823
|
try {
|
|
821
|
-
if (target.kind === "folder") await updateFolder(target.id, { name: trimmed });
|
|
822
|
-
else await updateDocument(target.id, { title: trimmed });
|
|
824
|
+
if (target.kind === "folder") await updateFolder(target.id, { name: trimmed }, request.fetch);
|
|
825
|
+
else await updateDocument(target.id, { title: trimmed }, request.fetch);
|
|
823
826
|
closeRenameDialog();
|
|
824
827
|
await refresh();
|
|
825
828
|
refreshDocs();
|
|
@@ -872,8 +875,8 @@ function FolderTree($$renderer, $$props) {
|
|
|
872
875
|
async function confirmDelete() {
|
|
873
876
|
const target = deleteTarget;
|
|
874
877
|
if (!target) return;
|
|
875
|
-
if (target.kind === "folder") await deleteFolder(target.id);
|
|
876
|
-
else await deleteDocument(target.id);
|
|
878
|
+
if (target.kind === "folder") await deleteFolder(target.id, request.fetch);
|
|
879
|
+
else await deleteDocument(target.id, request.fetch);
|
|
877
880
|
await refresh();
|
|
878
881
|
refreshDocs();
|
|
879
882
|
}
|
|
@@ -907,11 +910,11 @@ function FolderTree($$renderer, $$props) {
|
|
|
907
910
|
if (categoryDialogMode === "edit" && selectedCategory) savedCategory = await apiFetch(`/api/categories/${encodeURIComponent(selectedCategory.id)}`, {
|
|
908
911
|
method: "PATCH",
|
|
909
912
|
body
|
|
910
|
-
});
|
|
913
|
+
}, request.fetch);
|
|
911
914
|
else savedCategory = await apiFetch("/api/categories", {
|
|
912
915
|
method: "POST",
|
|
913
916
|
body
|
|
914
|
-
});
|
|
917
|
+
}, request.fetch);
|
|
915
918
|
await refresh();
|
|
916
919
|
return savedCategory;
|
|
917
920
|
} finally {
|
|
@@ -922,7 +925,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
922
925
|
if (!selectedCategory) return;
|
|
923
926
|
categoryBusy = true;
|
|
924
927
|
try {
|
|
925
|
-
await deleteCategory(selectedCategory.id);
|
|
928
|
+
await deleteCategory(selectedCategory.id, request.fetch);
|
|
926
929
|
await refresh();
|
|
927
930
|
} finally {
|
|
928
931
|
categoryBusy = false;
|
|
@@ -1103,7 +1106,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
1103
1106
|
align: "end",
|
|
1104
1107
|
children: ($$renderer) => {
|
|
1105
1108
|
Dropdown_menu_item($$renderer, {
|
|
1106
|
-
onSelect: () =>
|
|
1109
|
+
onSelect: () => navigateDocsmintRoute(route, `/?category=${bucket.category.id}`),
|
|
1107
1110
|
children: ($$renderer) => {
|
|
1108
1111
|
$$renderer.push(`<!---->${$.escape(action_go_to())}`);
|
|
1109
1112
|
},
|
|
@@ -1111,7 +1114,7 @@ function FolderTree($$renderer, $$props) {
|
|
|
1111
1114
|
});
|
|
1112
1115
|
$$renderer.push(`<!----> `);
|
|
1113
1116
|
Dropdown_menu_item($$renderer, {
|
|
1114
|
-
onSelect: () =>
|
|
1117
|
+
onSelect: () => navigateDocsmintRoute(route, `/docs/new?category=${bucket.category.id}`),
|
|
1115
1118
|
children: ($$renderer) => {
|
|
1116
1119
|
$$renderer.push(`<!---->${$.escape(dashboard_new_document())}`);
|
|
1117
1120
|
},
|
|
@@ -1888,6 +1891,7 @@ function TagList($$renderer, $$props) {
|
|
|
1888
1891
|
function Sidebar($$renderer, $$props) {
|
|
1889
1892
|
$$renderer.component(($$renderer) => {
|
|
1890
1893
|
let { mobile = false, mobileOpen = false, element = null } = $$props;
|
|
1894
|
+
const route = getDocsmintRouteAdapter();
|
|
1891
1895
|
let collapsed = false;
|
|
1892
1896
|
let showSettings = false;
|
|
1893
1897
|
const isCollapsed = $.derived(() => !mobile && collapsed);
|
|
@@ -1940,7 +1944,7 @@ function Sidebar($$renderer, $$props) {
|
|
|
1940
1944
|
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
1941
1945
|
let extension = each_array[$$index];
|
|
1942
1946
|
const Icon = extension.icon;
|
|
1943
|
-
$$renderer.push(`<a${$.attr("href", extension.href
|
|
1947
|
+
$$renderer.push(`<a${$.attr("href", extension.href ? resolveDocsmintRoute(route, extension.href) : "#")}${$.attr("aria-disabled", extension.disabled)} class="flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground aria-disabled:pointer-events-none aria-disabled:opacity-50">`);
|
|
1944
1948
|
if (Icon) {
|
|
1945
1949
|
$$renderer.push("<!--[0-->");
|
|
1946
1950
|
if (Icon) {
|
|
@@ -1977,7 +1981,7 @@ function Sidebar($$renderer, $$props) {
|
|
|
1977
1981
|
for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
|
|
1978
1982
|
let extension = each_array_1[$$index_1];
|
|
1979
1983
|
const Icon = extension.icon;
|
|
1980
|
-
$$renderer.push(`<a${$.attr("href", extension.href
|
|
1984
|
+
$$renderer.push(`<a${$.attr("href", extension.href ? resolveDocsmintRoute(route, extension.href) : "#")}${$.attr("aria-disabled", extension.disabled)} class="flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground aria-disabled:pointer-events-none aria-disabled:opacity-50"${$.attr("title", extension.label)}${$.attr("aria-label", extension.label)}>`);
|
|
1981
1985
|
if (Icon) {
|
|
1982
1986
|
$$renderer.push("<!--[0-->");
|
|
1983
1987
|
if (Icon) {
|
|
@@ -34,42 +34,42 @@ function listCategories(fetcher) {
|
|
|
34
34
|
* Create a new category. The backend enforces name uniqueness per owner
|
|
35
35
|
* and returns 409 if a category with the same name already exists.
|
|
36
36
|
*/
|
|
37
|
-
function createCategory(inputOrName) {
|
|
37
|
+
function createCategory(inputOrName, fetcher) {
|
|
38
38
|
const input = createCategoryInputSchema.parse(typeof inputOrName === "string" ? { name: inputOrName } : inputOrName);
|
|
39
39
|
return apiFetch("/api/categories", {
|
|
40
40
|
method: "POST",
|
|
41
41
|
body: JSON.stringify(input)
|
|
42
|
-
});
|
|
42
|
+
}, fetcher);
|
|
43
43
|
}
|
|
44
44
|
/** Rename a category or update its order. */
|
|
45
|
-
function updateCategory(id, data) {
|
|
45
|
+
function updateCategory(id, data, fetcher) {
|
|
46
46
|
const input = updateCategoryInputSchema.parse(data);
|
|
47
47
|
return apiFetch(`/api/categories/${encodeURIComponent(id)}`, {
|
|
48
48
|
method: "PATCH",
|
|
49
49
|
body: JSON.stringify(input)
|
|
50
|
-
});
|
|
50
|
+
}, fetcher);
|
|
51
51
|
}
|
|
52
52
|
/** Delete a category. The backend uses `ON DELETE SET NULL` to detach
|
|
53
53
|
* the category from any folders/documents. */
|
|
54
|
-
function deleteCategory(id) {
|
|
55
|
-
return apiFetch(`/api/categories/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
54
|
+
function deleteCategory(id, fetcher) {
|
|
55
|
+
return apiFetch(`/api/categories/${encodeURIComponent(id)}`, { method: "DELETE" }, fetcher);
|
|
56
56
|
}
|
|
57
57
|
/** Assign (or clear) the category on a document. Uses the existing
|
|
58
58
|
* `PATCH /api/documents/:id` endpoint which already accepts a
|
|
59
59
|
* `categoryId` field (see `backend/src/api/routes/documents.ts`).
|
|
60
60
|
* Pass `null` to remove the category from the document. */
|
|
61
|
-
function setDocumentCategory(docId, categoryId) {
|
|
61
|
+
function setDocumentCategory(docId, categoryId, fetcher) {
|
|
62
62
|
return apiFetch(`/api/documents/${encodeURIComponent(docId)}`, {
|
|
63
63
|
method: "PATCH",
|
|
64
64
|
body: JSON.stringify({ categoryId })
|
|
65
|
-
});
|
|
65
|
+
}, fetcher);
|
|
66
66
|
}
|
|
67
67
|
/** Assign (or clear) the category on a folder. Pass `null` to clear. */
|
|
68
|
-
function setFolderCategory(folderId, categoryId) {
|
|
68
|
+
function setFolderCategory(folderId, categoryId, fetcher) {
|
|
69
69
|
return apiFetch(`/api/folders/${encodeURIComponent(folderId)}`, {
|
|
70
70
|
method: "PATCH",
|
|
71
71
|
body: JSON.stringify({ categoryId })
|
|
72
|
-
});
|
|
72
|
+
}, fetcher);
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
75
75
|
export { setDocumentCategory as a, updateCategoryInputSchema as c, listCategories as i, createCategoryInputSchema as n, setFolderCategory as o, deleteCategory as r, updateCategory as s, createCategory as t };
|
|
@@ -67,18 +67,18 @@ function createDocument(data, fetcher) {
|
|
|
67
67
|
body: JSON.stringify(data)
|
|
68
68
|
}, fetcher);
|
|
69
69
|
}
|
|
70
|
-
function updateDocument(id, data) {
|
|
70
|
+
function updateDocument(id, data, fetcher) {
|
|
71
71
|
clearDocumentsCache();
|
|
72
72
|
return apiFetch(`/api/documents/${id}`, {
|
|
73
73
|
method: "PATCH",
|
|
74
74
|
body: JSON.stringify(data)
|
|
75
|
-
});
|
|
75
|
+
}, fetcher);
|
|
76
76
|
}
|
|
77
|
-
function deleteDocument(id) {
|
|
77
|
+
function deleteDocument(id, fetcher) {
|
|
78
78
|
clearDocumentsCache();
|
|
79
|
-
return apiFetch(`/api/documents/${id}`, { method: "DELETE" });
|
|
79
|
+
return apiFetch(`/api/documents/${id}`, { method: "DELETE" }, fetcher);
|
|
80
80
|
}
|
|
81
|
-
function importDocument(file, folderId) {
|
|
81
|
+
function importDocument(file, folderId, fetcher) {
|
|
82
82
|
clearDocumentsCache();
|
|
83
83
|
const formData = new FormData();
|
|
84
84
|
formData.append("file", file);
|
|
@@ -86,7 +86,7 @@ function importDocument(file, folderId) {
|
|
|
86
86
|
return apiFetch("/api/documents/import", {
|
|
87
87
|
method: "POST",
|
|
88
88
|
body: formData
|
|
89
|
-
});
|
|
89
|
+
}, fetcher);
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* Import one or more documents. Accepts any combination of supported
|
|
@@ -94,7 +94,7 @@ function importDocument(file, folderId) {
|
|
|
94
94
|
* a multipart body with multiple `file` parts and returns an
|
|
95
95
|
* `ImportResponse` describing per-file success/failure.
|
|
96
96
|
*/
|
|
97
|
-
function importDocuments(files, folderId) {
|
|
97
|
+
function importDocuments(files, folderId, fetcher) {
|
|
98
98
|
clearDocumentsCache();
|
|
99
99
|
const formData = new FormData();
|
|
100
100
|
for (const file of files) formData.append("file", file);
|
|
@@ -102,7 +102,7 @@ function importDocuments(files, folderId) {
|
|
|
102
102
|
return apiFetch("/api/documents/import", {
|
|
103
103
|
method: "POST",
|
|
104
104
|
body: formData
|
|
105
|
-
});
|
|
105
|
+
}, fetcher);
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
108
|
export { importDocument as a, updateDocument as c, getDocument as i, createDocument as n, importDocuments as o, deleteDocument as r, listDocuments as s, clearDocumentsCache as t };
|
|
@@ -95,33 +95,33 @@ async function getFolderPath(folderId, fetcher) {
|
|
|
95
95
|
return path;
|
|
96
96
|
}
|
|
97
97
|
/** Create a new folder. Backend: `POST /api/folders`. */
|
|
98
|
-
async function createFolder(data) {
|
|
98
|
+
async function createFolder(data, fetcher) {
|
|
99
99
|
return toFolder(await apiFetch("/api/folders", {
|
|
100
100
|
method: "POST",
|
|
101
101
|
body: JSON.stringify(data)
|
|
102
|
-
}));
|
|
102
|
+
}, fetcher));
|
|
103
103
|
}
|
|
104
104
|
/** Update a folder (rename or move). Backend: `PATCH /api/folders/:id`. */
|
|
105
|
-
async function updateFolder(id, data) {
|
|
105
|
+
async function updateFolder(id, data, fetcher) {
|
|
106
106
|
return toFolder(await apiFetch(`/api/folders/${encodeURIComponent(id)}`, {
|
|
107
107
|
method: "PATCH",
|
|
108
108
|
body: JSON.stringify(data)
|
|
109
|
-
}));
|
|
109
|
+
}, fetcher));
|
|
110
110
|
}
|
|
111
111
|
/** Delete a folder. Backend: `DELETE /api/folders/:id`. */
|
|
112
|
-
async function deleteFolder(id) {
|
|
113
|
-
await apiFetch(`/api/folders/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
112
|
+
async function deleteFolder(id, fetcher) {
|
|
113
|
+
await apiFetch(`/api/folders/${encodeURIComponent(id)}`, { method: "DELETE" }, fetcher);
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Duplicate a document. The new copy is suffixed with ` (Copy)` on the title.
|
|
117
117
|
* Backend: `POST /api/documents/:id/duplicate`.
|
|
118
118
|
*/
|
|
119
|
-
async function duplicateDocument(docId) {
|
|
120
|
-
return toDocument(await apiFetch(`/api/documents/${encodeURIComponent(docId)}/duplicate`, { method: "POST" }));
|
|
119
|
+
async function duplicateDocument(docId, fetcher) {
|
|
120
|
+
return toDocument(await apiFetch(`/api/documents/${encodeURIComponent(docId)}/duplicate`, { method: "POST" }, fetcher));
|
|
121
121
|
}
|
|
122
122
|
/** Delete a document. Backend: `DELETE /api/documents/:id`. */
|
|
123
|
-
async function deleteDocument(docId) {
|
|
124
|
-
await apiFetch(`/api/documents/${encodeURIComponent(docId)}`, { method: "DELETE" });
|
|
123
|
+
async function deleteDocument(docId, fetcher) {
|
|
124
|
+
await apiFetch(`/api/documents/${encodeURIComponent(docId)}`, { method: "DELETE" }, fetcher);
|
|
125
125
|
}
|
|
126
126
|
//#endregion
|
|
127
127
|
export { getFolder as a, updateFolder as c, duplicateDocument as i, deleteDocument as n, getFolderPath as o, deleteFolder as r, listFolders as s, createFolder as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getContext, setContext } from "svelte";
|
|
2
|
+
import { goto } from "$app/navigation";
|
|
3
|
+
//#region src/lib/hosts/route-context.ts
|
|
4
|
+
var ROUTE_ADAPTER = Symbol("docsmint-route-adapter");
|
|
5
|
+
var REQUEST_ADAPTER = Symbol("docsmint-request-adapter");
|
|
6
|
+
var standaloneRoute = {
|
|
7
|
+
pathname: "/",
|
|
8
|
+
resolve: (path) => path,
|
|
9
|
+
navigate: (path, options) => goto(path, options)
|
|
10
|
+
};
|
|
11
|
+
/** Makes a route adapter available to every public host child. */
|
|
12
|
+
function provideDocsmintRouteAdapter(adapter) {
|
|
13
|
+
setContext(ROUTE_ADAPTER, adapter);
|
|
14
|
+
}
|
|
15
|
+
function provideDocsmintRequestAdapter(adapter) {
|
|
16
|
+
setContext(REQUEST_ADAPTER, adapter);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Reads the embedding route adapter, preserving the standalone SvelteKit
|
|
20
|
+
* behaviour when a public host is rendered without DocsmintAppShellHost.
|
|
21
|
+
*/
|
|
22
|
+
function getDocsmintRouteAdapter() {
|
|
23
|
+
return getContext(ROUTE_ADAPTER) ?? standaloneRoute;
|
|
24
|
+
}
|
|
25
|
+
function getDocsmintRequestAdapter() {
|
|
26
|
+
return getContext(REQUEST_ADAPTER) ?? { fetch };
|
|
27
|
+
}
|
|
28
|
+
function resolveDocsmintRoute(route, path) {
|
|
29
|
+
return /^(?:[a-z][a-z\d+.-]*:|#|\/\/)/i.test(path) ? path : route.resolve(path);
|
|
30
|
+
}
|
|
31
|
+
function navigateDocsmintRoute(route, path, options) {
|
|
32
|
+
const resolved = resolveDocsmintRoute(route, path);
|
|
33
|
+
return route.navigate?.(resolved, options) ?? goto(resolved, options);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { provideDocsmintRouteAdapter as a, provideDocsmintRequestAdapter as i, getDocsmintRouteAdapter as n, resolveDocsmintRoute as o, navigateDocsmintRoute as r, getDocsmintRequestAdapter as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as FolderNode } from "../assets/FolderNode-
|
|
1
|
+
import { t as FolderNode } from "../assets/FolderNode-CpHrpOED.js";
|
|
2
2
|
export { FolderNode };
|
|
@@ -4,7 +4,7 @@ import { t as FolderTreeSelector } from "../assets/FolderTreeSelector-DZNZ2oI6.j
|
|
|
4
4
|
import { t as Loader_circle } from "../assets/loader-circle-DZsrZ-er.js";
|
|
5
5
|
import { a as Dialog, i as Dialog_description, n as Dialog_header, o as Button, r as Dialog_footer, t as Dialog_title } from "../assets/dialog-BOV1u6zP.js";
|
|
6
6
|
import { t as Label } from "../assets/label-Bj8-TfFN.js";
|
|
7
|
-
import "../assets/categories-
|
|
7
|
+
import "../assets/categories-CTCtdv7V.js";
|
|
8
8
|
import { a as Select, i as Select_content, n as Select_trigger, r as Select_item, t as Select_value } from "../assets/select-value-6Lk0ToYd.js";
|
|
9
9
|
import { d as refreshFolders } from "../assets/subfolders-refresh-store.svelte-DAh4gT16.js";
|
|
10
10
|
import * as $ from "svelte/internal/server";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SettingsDialog } from "../assets/SettingsDialog-
|
|
1
|
+
import { t as SettingsDialog } from "../assets/SettingsDialog-Dg97vv83.js";
|
|
2
2
|
export { SettingsDialog };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Sidebar } from "../assets/Sidebar-
|
|
1
|
+
import { t as Sidebar } from "../assets/Sidebar-CrDk_HYY.js";
|
|
2
2
|
export { Sidebar };
|