@hiai-gg/docsmint 0.3.7 → 0.3.8
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/backend/src/lib/logger.ts +45 -15
- package/dist/backend/index.js +238 -150
- package/dist/frontend/CategoryDialog-DphkZqIB.js +611 -0
- package/dist/frontend/ConfirmDialog-BLF3x_hr.js +214 -0
- package/dist/frontend/CreateSnapshotDialog-D5vPvFTL.js +216 -0
- package/dist/frontend/DatePicker-CLNTdvTk.js +259 -0
- package/dist/frontend/DeleteDialog-DxYFJivN.js +174 -0
- package/dist/frontend/FolderDialog-CRVZM2Oi.js +250 -0
- package/dist/frontend/FolderNode-C2zG7uii.js +298 -0
- package/dist/frontend/FolderTreeSelector-CyB8y2Sm.js +103 -0
- package/dist/frontend/Icon-CooFj4Ee.js +64 -0
- package/dist/frontend/SettingsDialog-DCM4-N6_.js +1016 -0
- package/dist/frontend/ShareDialog-DYu3RKQu.js +165 -0
- package/dist/frontend/TagCreateDialog-DXQs2bL9.js +260 -0
- package/dist/frontend/camera-iKXDOOWT.js +29 -0
- package/dist/frontend/check-D-UuvBuh.js +25 -0
- package/dist/frontend/chevron-down-CiPtYyFh.js +25 -0
- package/dist/frontend/circle-check-tSPE1V6t.js +29 -0
- package/dist/frontend/clock-DJHbHZb8.js +29 -0
- package/dist/frontend/{bundle-mjs-CP6Owz-8.js → clsx-C7bIvsDS.js} +16 -1
- package/dist/frontend/components/category-dialog.js +1 -1
- package/dist/frontend/components/create-snapshot-dialog.js +1 -1
- package/dist/frontend/components/delete-dialog.js +1 -1
- package/dist/frontend/components/editor/document-editor.js +1364 -1353
- package/dist/frontend/components/editor/document-title.js +25 -25
- package/dist/frontend/components/editor/markdown-toggle.js +45 -45
- package/dist/frontend/components/folder-node.js +1 -1
- package/dist/frontend/components/folder-tree-selector.js +1 -1
- package/dist/frontend/components/save-as-dialog.js +169 -151
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/share-dialog.js +1 -1
- package/dist/frontend/components/sidebar.js +1161 -1153
- package/dist/frontend/components/tag-create-dialog.js +1 -1
- package/dist/frontend/components/version-history.js +188 -187
- package/dist/frontend/copy-GppwRMjX.js +32 -0
- package/dist/frontend/dashboard.js +1188 -1156
- package/dist/frontend/dialog-D6NxYVmy.js +213 -0
- package/dist/frontend/doc-tabs.js +2 -2
- package/dist/frontend/ellipsis-vertical-P9MHvCps.js +530 -0
- package/dist/frontend/extension.js +8 -8
- package/dist/frontend/{floating-layer-anchor-C51M4l6v.js → floating-layer-anchor-CPwucTfd.js} +1414 -1412
- package/dist/frontend/folder-DeWhnD7O.js +45 -0
- package/dist/frontend/folder-refresh.js +1 -1
- package/dist/frontend/input-B5Rak-5G.js +23 -0
- package/dist/frontend/keyboard.js +1 -1
- package/dist/frontend/{keyboard.svelte-D7H8DihC.js → keyboard.svelte-CApmX0vl.js} +53 -53
- package/dist/frontend/label-CW9rxoAb.js +30 -0
- package/dist/frontend/{loader-circle-Bk-WFz9g.js → loader-circle-BA6aLO71.js} +86 -85
- package/dist/frontend/rotate-ccw-B4Q7brmV.js +25 -0
- package/dist/frontend/search.js +680 -654
- package/dist/frontend/select-value-sF86Geyh.js +1446 -0
- package/dist/frontend/shared-document.js +94 -94
- package/dist/frontend/subfolders-refresh-store.svelte-B2dKVmgz.js +65 -0
- package/dist/frontend/tag-HxRazVN_.js +54 -0
- package/dist/frontend/tag-store.svelte-CqrUXo0o.js +29 -0
- package/dist/frontend/textarea-i1720bE7.js +23 -0
- package/dist/frontend/theme.js +1 -1
- package/dist/frontend/theme.svelte-DKfCy12k.js +49 -0
- package/dist/frontend/{utils-C0OW2678.js → utils-CffiyuTo.js} +2 -3
- package/dist/frontend/{utils-D8kmM3ub.js → utils-hzdMVeCv.js} +2 -3
- package/dist/frontend/utils.js +1 -1
- package/dist/frontend/x-CzBsnJ2x.js +25 -0
- package/dist/frontend-ssr/api/attachments.js +2 -0
- package/dist/frontend-ssr/api/categories.js +2 -0
- package/dist/frontend-ssr/api/documents.js +2 -0
- package/dist/frontend-ssr/api/folders.js +2 -0
- package/dist/frontend-ssr/api/settings.js +2 -0
- package/dist/frontend-ssr/api/share.js +2 -0
- package/dist/frontend-ssr/api/tags.js +2 -0
- package/dist/frontend-ssr/assets/CategoryDialog-C2xaZKHq.js +584 -0
- package/dist/frontend-ssr/assets/ConfirmDialog-DjMFKc0V.js +420 -0
- package/dist/frontend-ssr/assets/CreateSnapshotDialog-BRw1xJW1.js +214 -0
- package/dist/frontend-ssr/assets/DatePicker-DnXniwlZ.js +312 -0
- package/dist/frontend-ssr/assets/DeleteDialog-BCfZy3Zn.js +154 -0
- package/dist/frontend-ssr/assets/FolderDialog-Dq7I2cKZ.js +429 -0
- package/dist/frontend-ssr/assets/FolderNode-DRfBfpft.js +171 -0
- package/dist/frontend-ssr/assets/FolderTreeSelector-DZNZ2oI6.js +147 -0
- package/dist/frontend-ssr/assets/Icon-B0Zqppjo.js +231 -0
- package/dist/frontend-ssr/assets/SettingsDialog-CX8Noa8A.js +1107 -0
- package/dist/frontend-ssr/assets/ShareDialog-Cge49ZdJ.js +54 -0
- package/dist/frontend-ssr/assets/TagCreateDialog-EAChgBF-.js +264 -0
- package/dist/frontend-ssr/assets/api-keys-DFqX39MT.js +35 -0
- package/dist/frontend-ssr/assets/attachments-CWBxE3Vz.js +85 -0
- package/dist/frontend-ssr/assets/auth-client-x26kqY8Z.js +1286 -0
- package/dist/frontend-ssr/assets/camera-CdxscTw-.js +84 -0
- package/dist/frontend-ssr/assets/categories-AOqgcsn4.js +75 -0
- package/dist/frontend-ssr/assets/chevron-down-CSSNGNh_.js +80 -0
- package/dist/frontend-ssr/assets/chevron-right-B4p7Sk6X.js +80 -0
- package/dist/frontend-ssr/assets/circle-check-CI1v4vYh.js +84 -0
- package/dist/frontend-ssr/assets/client-DZMkDkDn.js +129 -0
- package/dist/frontend-ssr/assets/clipboard-CXOaoz2W.js +30 -0
- package/dist/frontend-ssr/assets/clock-IL-eX2di.js +84 -0
- package/dist/frontend-ssr/assets/context-jz1GGEUi.js +45 -0
- package/dist/frontend-ssr/assets/copy-CjV57nGQ.js +87 -0
- package/dist/frontend-ssr/assets/db-CnxeO66n.js +65 -0
- package/dist/frontend-ssr/assets/dialog-BOV1u6zP.js +157 -0
- package/dist/frontend-ssr/assets/dndzone-DMvTO_Jz.js +2114 -0
- package/dist/frontend-ssr/assets/document-drop-coordinator-CEaYACsC.js +109 -0
- package/dist/frontend-ssr/assets/documents-BnOTRdTY.js +108 -0
- package/dist/frontend-ssr/assets/editorExtensions-DUzwndMy.js +186 -0
- package/dist/frontend-ssr/assets/ellipsis-vertical-C-0hgkZn.js +555 -0
- package/dist/frontend-ssr/assets/floating-layer-anchor-uzw9K8qN.js +6114 -0
- package/dist/frontend-ssr/assets/folder-DChhG7qN.js +80 -0
- package/dist/frontend-ssr/assets/folders-CTfbS24J.js +127 -0
- package/dist/frontend-ssr/assets/identity-B3uHoDtf.js +99 -0
- package/dist/frontend-ssr/assets/input-DezGsU3y.js +19 -0
- package/dist/frontend-ssr/assets/keyboard.svelte-BgF47N3L.js +174 -0
- package/dist/frontend-ssr/assets/label-Bj8-TfFN.js +21 -0
- package/dist/frontend-ssr/assets/loader-circle-DZsrZ-er.js +80 -0
- package/dist/frontend-ssr/assets/markdown-CjqvGi5W.js +20 -0
- package/dist/frontend-ssr/assets/messages-DhXqlcJI.js +11125 -0
- package/dist/frontend-ssr/assets/resolve-BqHozBXl.js +32 -0
- package/dist/frontend-ssr/assets/rotate-ccw-BlgWwaiq.js +80 -0
- package/dist/frontend-ssr/assets/select-value-DngdSmLI.js +1526 -0
- package/dist/frontend-ssr/assets/settings-E6qSAWM2.js +64 -0
- package/dist/frontend-ssr/assets/share-BTBJelxA.js +30 -0
- package/dist/frontend-ssr/assets/subfolders-refresh-store.svelte-DAh4gT16.js +77 -0
- package/dist/frontend-ssr/assets/tag-GZEuGWk1.js +166 -0
- package/dist/frontend-ssr/assets/tag-store.svelte-DPodKj6Z.js +21 -0
- package/dist/frontend-ssr/assets/tags-BId2wdYd.js +49 -0
- package/dist/frontend-ssr/assets/textarea-Dev-qSEc.js +21 -0
- package/dist/frontend-ssr/assets/theme.svelte-Co0-ssaD.js +67 -0
- package/dist/frontend-ssr/assets/utils-DtlPPXpJ.js +9 -0
- package/dist/frontend-ssr/assets/utils-DvZnctjz.js +23 -0
- package/dist/frontend-ssr/collaboration.js +39 -0
- package/dist/frontend-ssr/components/category-dialog.js +2 -0
- package/dist/frontend-ssr/components/create-snapshot-dialog.js +2 -0
- package/dist/frontend-ssr/components/delete-dialog.js +2 -0
- package/dist/frontend-ssr/components/editor/document-editor.js +2499 -0
- package/dist/frontend-ssr/components/editor/document-title.js +11 -0
- package/dist/frontend-ssr/components/editor/docx-serializer.js +186 -0
- package/dist/frontend-ssr/components/editor/extensions.js +2 -0
- package/dist/frontend-ssr/components/editor/markdown-toggle.js +20 -0
- package/dist/frontend-ssr/components/editor/markdown.js +2 -0
- package/dist/frontend-ssr/components/folder-node.js +2 -0
- package/dist/frontend-ssr/components/folder-tree-selector.js +2 -0
- package/dist/frontend-ssr/components/save-as-dialog.js +280 -0
- package/dist/frontend-ssr/components/settings.js +2 -0
- package/dist/frontend-ssr/components/share-dialog.js +2 -0
- package/dist/frontend-ssr/components/sidebar.js +2033 -0
- package/dist/frontend-ssr/components/tag-create-dialog.js +2 -0
- package/dist/frontend-ssr/components/version-history.js +370 -0
- package/dist/frontend-ssr/dashboard.js +2542 -0
- package/dist/frontend-ssr/doc-tabs.js +23 -0
- package/dist/frontend-ssr/document-drop-coordinator.js +2 -0
- package/dist/frontend-ssr/extension.js +13 -0
- package/dist/frontend-ssr/folder-refresh.js +2 -0
- package/dist/frontend-ssr/i18n.js +10 -0
- package/dist/frontend-ssr/keyboard.js +2 -0
- package/dist/frontend-ssr/offline/identity.js +2 -0
- package/dist/frontend-ssr/search.js +332 -0
- package/dist/frontend-ssr/shared-document.js +273 -0
- package/dist/frontend-ssr/theme.js +9 -0
- package/dist/frontend-ssr/types.js +1 -0
- package/dist/frontend-ssr/utils/clipboard.js +2 -0
- package/dist/frontend-ssr/utils/dndzone.js +2 -0
- package/dist/frontend-ssr/utils.js +2 -0
- package/package.json +22 -1
- package/packages/cli/src/index.ts +1 -1
- package/packages/db/src/schema.ts +3 -0
- package/packages/mcp-server/src/index.ts +1 -1
- package/dist/frontend/CategoryDialog--rIE7FrH.js +0 -580
- package/dist/frontend/ConfirmDialog-Cpzyb55f.js +0 -212
- package/dist/frontend/CreateSnapshotDialog-CmkV-n2A.js +0 -216
- package/dist/frontend/DatePicker-Byynca7V.js +0 -257
- package/dist/frontend/DeleteDialog-ap6nOywZ.js +0 -174
- package/dist/frontend/FolderDialog-DmN_trV0.js +0 -247
- package/dist/frontend/FolderNode-C4B8a2fd.js +0 -317
- package/dist/frontend/FolderTreeSelector-D6ijiZTA.js +0 -100
- package/dist/frontend/Icon-DtNo0N1U.js +0 -64
- package/dist/frontend/SettingsDialog-2kTaTXAs.js +0 -992
- package/dist/frontend/ShareDialog-BBDGNF5n.js +0 -165
- package/dist/frontend/TagCreateDialog-DiLZnJo4.js +0 -258
- package/dist/frontend/camera-B7dAOd4s.js +0 -28
- package/dist/frontend/check-CDwRlG9T.js +0 -24
- package/dist/frontend/chevron-down-B7ZrjUmT.js +0 -24
- package/dist/frontend/circle-check-CDqeMB2d.js +0 -28
- package/dist/frontend/client-Bc5Fzx40.js +0 -2785
- package/dist/frontend/clock-Ck5Sn-Zl.js +0 -28
- package/dist/frontend/clsx-nmtDPO_P.js +0 -16
- package/dist/frontend/copy-CMAA6GP0.js +0 -31
- package/dist/frontend/dialog-BDkiG42a.js +0 -213
- package/dist/frontend/disclose-version-5I57E3LD.js +0 -3
- package/dist/frontend/ellipsis-vertical-BBuPldbW.js +0 -519
- package/dist/frontend/folder-TQjKY4yn.js +0 -44
- package/dist/frontend/index-client-jobkrWVL.js +0 -86
- package/dist/frontend/input-CBI6p4Xl.js +0 -23
- package/dist/frontend/label-C-GkhEp4.js +0 -30
- package/dist/frontend/rotate-ccw-CleZtJ5D.js +0 -24
- package/dist/frontend/select-value-CvrWRkXW.js +0 -1436
- package/dist/frontend/subfolders-refresh-store.svelte-BsheoQma.js +0 -65
- package/dist/frontend/tag-Dx3SmucJ.js +0 -53
- package/dist/frontend/tag-store.svelte-CIaF4sdZ.js +0 -29
- package/dist/frontend/textarea-Dfp78XlL.js +0 -23
- package/dist/frontend/theme.svelte-CROg1Hi5.js +0 -49
- package/dist/frontend/x-DaTdeDXv.js +0 -24
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Bn as share_expires_7d, Gn as share_toggle_password, Hn as share_expires_1h, Jn as share_create_title, Kn as share_password_protection, Ln as share_add, Rn as share_guest_access, Un as share_expires_never, Vn as share_expires_1d, Wn as share_expires, dn as action_close, qn as share_create_link, zn as share_expires_30d } from "./messages-DhXqlcJI.js";
|
|
2
|
+
import "./keyboard.svelte-BgF47N3L.js";
|
|
3
|
+
import * as $ from "svelte/internal/server";
|
|
4
|
+
//#region src/lib/components/ShareDialog.svelte
|
|
5
|
+
function ShareDialog($$renderer, $$props) {
|
|
6
|
+
$$renderer.component(($$renderer) => {
|
|
7
|
+
let { open = false, documentId = "", documentTitle = "", folderId = "", folderName = "", categoryId = "", categoryName = "" } = $$props;
|
|
8
|
+
let usePassword = false;
|
|
9
|
+
let expiresIn = "7d";
|
|
10
|
+
let guestEmail = "";
|
|
11
|
+
let guestEmails = [];
|
|
12
|
+
let creating = false;
|
|
13
|
+
if (open) {
|
|
14
|
+
$$renderer.push("<!--[0-->");
|
|
15
|
+
$$renderer.push(`<div class="fixed inset-0 layer-modal flex items-center justify-center"><button class="absolute inset-0 bg-black/50"${$.attr("aria-label", action_close())}></button> <div class="relative z-10 w-full max-w-md rounded-lg border border-border bg-background p-6 shadow-lg" role="dialog" aria-modal="true"><div class="mb-4 flex items-center justify-between"><h2 class="text-lg font-semibold">${$.escape(share_create_title())} "${$.escape(categoryName || folderName || documentTitle)}"</h2> <button class="rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground"${$.attr("aria-label", action_close())}>✕</button></div> `);
|
|
16
|
+
{
|
|
17
|
+
$$renderer.push("<!--[0-->");
|
|
18
|
+
$$renderer.push(`<div class="space-y-4"><div class="flex items-center justify-between"><span class="text-sm font-medium">${$.escape(share_password_protection())}</span> <button${$.attr_class(`relative inline-flex h-5 w-9 items-center rounded-full transition-colors bg-input`)} role="switch"${$.attr("aria-checked", usePassword)}${$.attr("aria-label", share_toggle_password())}><span${$.attr_class(`inline-block h-4 w-4 rounded-full bg-white shadow transition-transform translate-x-0.5`)}></span></button></div> `);
|
|
19
|
+
$$renderer.push("<!--[-1-->");
|
|
20
|
+
$$renderer.push(`<!--]--> <div class="space-y-2"><span class="text-sm font-medium">${$.escape(share_expires())}</span> <div class="flex gap-2"><!--[-->`);
|
|
21
|
+
const each_array = $.ensure_array_like([
|
|
22
|
+
["1h", share_expires_1h()],
|
|
23
|
+
["1d", share_expires_1d()],
|
|
24
|
+
["7d", share_expires_7d()],
|
|
25
|
+
["30d", share_expires_30d()],
|
|
26
|
+
["never", share_expires_never()]
|
|
27
|
+
]);
|
|
28
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
29
|
+
let [val, label] = each_array[$$index];
|
|
30
|
+
$$renderer.push(`<button${$.attr_class(`rounded-md border px-2.5 py-1 text-xs font-medium transition-colors ${expiresIn === val ? "border-primary bg-primary text-primary-foreground" : "border-border text-muted-foreground hover:bg-accent"}`)}>${$.escape(label)}</button>`);
|
|
31
|
+
}
|
|
32
|
+
$$renderer.push(`<!--]--></div></div> <div class="space-y-2"><span class="text-sm font-medium">${$.escape(share_guest_access())}</span> <div class="flex gap-2"><input type="email"${$.attr("value", guestEmail)} placeholder="guest@email.com" class="flex h-9 flex-1 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"/> <button class="rounded-md border border-border px-3 py-1.5 text-sm font-medium hover:bg-accent">${$.escape(share_add())}</button></div> `);
|
|
33
|
+
if (guestEmails.length > 0) {
|
|
34
|
+
$$renderer.push("<!--[0-->");
|
|
35
|
+
$$renderer.push(`<div class="flex flex-wrap gap-1.5"><!--[-->`);
|
|
36
|
+
const each_array_1 = $.ensure_array_like(guestEmails);
|
|
37
|
+
for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
|
|
38
|
+
let email = each_array_1[$$index_1];
|
|
39
|
+
$$renderer.push(`<span class="inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs">${$.escape(email)} <button class="text-muted-foreground hover:text-foreground">×</button></span>`);
|
|
40
|
+
}
|
|
41
|
+
$$renderer.push(`<!--]--></div>`);
|
|
42
|
+
} else $$renderer.push("<!--[-1-->");
|
|
43
|
+
$$renderer.push(`<!--]--></div> `);
|
|
44
|
+
$$renderer.push("<!--[-1-->");
|
|
45
|
+
$$renderer.push(`<!--]--> <button${$.attr("disabled", creating, true)} class="w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50">${$.escape(share_create_link())}</button></div>`);
|
|
46
|
+
}
|
|
47
|
+
$$renderer.push(`<!--]--></div></div>`);
|
|
48
|
+
} else $$renderer.push("<!--[-1-->");
|
|
49
|
+
$$renderer.push(`<!--]-->`);
|
|
50
|
+
$.bind_props($$props, { open });
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { ShareDialog as t };
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { ar as tags_new, cn as action_loading, fn as action_create, gn as action_save, hn as action_cancel, ir as tags_edit, rr as tags_name_placeholder, vn as error_generic } from "./messages-DhXqlcJI.js";
|
|
2
|
+
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";
|
|
3
|
+
import { t as Label } from "./label-Bj8-TfFN.js";
|
|
4
|
+
import { t as Loader_circle } from "./loader-circle-DZsrZ-er.js";
|
|
5
|
+
import { t as cn } from "./utils-DvZnctjz.js";
|
|
6
|
+
import { t as Input } from "./input-DezGsU3y.js";
|
|
7
|
+
import { c as updateTag, l as updateTagInputSchema, n as createTag, r as createTagInputSchema } from "./tags-BId2wdYd.js";
|
|
8
|
+
import * as $ from "svelte/internal/server";
|
|
9
|
+
//#region src/lib/components/TagCreateDialog.svelte
|
|
10
|
+
function TagCreateDialog($$renderer, $$props) {
|
|
11
|
+
$$renderer.component(($$renderer) => {
|
|
12
|
+
const PRESET_COLORS = [
|
|
13
|
+
"#ef4444",
|
|
14
|
+
"#f97316",
|
|
15
|
+
"#f59e0b",
|
|
16
|
+
"#eab308",
|
|
17
|
+
"#84cc16",
|
|
18
|
+
"#22c55e",
|
|
19
|
+
"#10b981",
|
|
20
|
+
"#06b6d4",
|
|
21
|
+
"#3b82f6",
|
|
22
|
+
"#8b5cf6",
|
|
23
|
+
"#ec4899"
|
|
24
|
+
];
|
|
25
|
+
const DEFAULT_COLOR = PRESET_COLORS[9];
|
|
26
|
+
let { open = false, mode = "create", tag = null, onCreated, onUpdated, onClose } = $$props;
|
|
27
|
+
let name = "";
|
|
28
|
+
let color = DEFAULT_COLOR;
|
|
29
|
+
let nameError = null;
|
|
30
|
+
let submitError = null;
|
|
31
|
+
let submitting = false;
|
|
32
|
+
const isEdit = $.derived(() => mode === "edit");
|
|
33
|
+
const dialogTitle = $.derived(() => isEdit() ? tags_edit() : tags_new());
|
|
34
|
+
const submitLabel = $.derived(() => submitting ? action_loading() : isEdit() ? action_save() : action_create());
|
|
35
|
+
function reset() {
|
|
36
|
+
name = "";
|
|
37
|
+
color = DEFAULT_COLOR;
|
|
38
|
+
nameError = null;
|
|
39
|
+
submitError = null;
|
|
40
|
+
submitting = false;
|
|
41
|
+
}
|
|
42
|
+
function seedFromTag(t) {
|
|
43
|
+
if (!t) {
|
|
44
|
+
reset();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
name = t.name;
|
|
48
|
+
color = t.color ?? DEFAULT_COLOR;
|
|
49
|
+
nameError = null;
|
|
50
|
+
submitError = null;
|
|
51
|
+
submitting = false;
|
|
52
|
+
}
|
|
53
|
+
function close() {
|
|
54
|
+
open = false;
|
|
55
|
+
reset();
|
|
56
|
+
onClose?.();
|
|
57
|
+
}
|
|
58
|
+
function handleOpenChange(next) {
|
|
59
|
+
if (next) seedFromTag(tag);
|
|
60
|
+
else {
|
|
61
|
+
reset();
|
|
62
|
+
open = false;
|
|
63
|
+
onClose?.();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function handleSubmit(e) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
nameError = null;
|
|
69
|
+
submitError = null;
|
|
70
|
+
const trimmed = name.trim();
|
|
71
|
+
if (trimmed.length === 0) {
|
|
72
|
+
nameError = tags_name_placeholder();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (isEdit() && tag) {
|
|
76
|
+
const parsed = updateTagInputSchema.safeParse({
|
|
77
|
+
name: trimmed,
|
|
78
|
+
color
|
|
79
|
+
});
|
|
80
|
+
if (!parsed.success) {
|
|
81
|
+
nameError = parsed.error.issues[0]?.message ?? error_generic();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
doUpdate(tag.id, parsed.data);
|
|
85
|
+
} else {
|
|
86
|
+
const parsed = createTagInputSchema.safeParse({
|
|
87
|
+
name: trimmed,
|
|
88
|
+
color
|
|
89
|
+
});
|
|
90
|
+
if (!parsed.success) {
|
|
91
|
+
nameError = parsed.error.issues[0]?.message ?? error_generic();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
doCreate(parsed.data.name, color);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function doCreate(trimmed, pickedColor) {
|
|
98
|
+
submitting = true;
|
|
99
|
+
try {
|
|
100
|
+
const created = await createTag(trimmed, pickedColor);
|
|
101
|
+
onCreated?.(created);
|
|
102
|
+
close();
|
|
103
|
+
} catch (e) {
|
|
104
|
+
submitError = e instanceof Error ? e.message : error_generic();
|
|
105
|
+
console.error("TagCreateDialog: createTag failed", e);
|
|
106
|
+
} finally {
|
|
107
|
+
submitting = false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function doUpdate(id, data) {
|
|
111
|
+
submitting = true;
|
|
112
|
+
try {
|
|
113
|
+
const updated = await updateTag(id, data);
|
|
114
|
+
onUpdated?.(updated);
|
|
115
|
+
close();
|
|
116
|
+
} catch (e) {
|
|
117
|
+
submitError = e instanceof Error ? e.message : error_generic();
|
|
118
|
+
console.error("TagCreateDialog: updateTag failed", e);
|
|
119
|
+
} finally {
|
|
120
|
+
submitting = false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function handleInputKeydown(e) {
|
|
124
|
+
if (e.key === "Enter" && !submitting) {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
handleSubmit(new Event("submit"));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
let $$settled = true;
|
|
130
|
+
let $$inner_renderer;
|
|
131
|
+
function $$render_inner($$renderer) {
|
|
132
|
+
Dialog($$renderer, {
|
|
133
|
+
onOpenChange: handleOpenChange,
|
|
134
|
+
get open() {
|
|
135
|
+
return open;
|
|
136
|
+
},
|
|
137
|
+
set open($$value) {
|
|
138
|
+
open = $$value;
|
|
139
|
+
$$settled = false;
|
|
140
|
+
},
|
|
141
|
+
children: ($$renderer) => {
|
|
142
|
+
Dialog_header($$renderer, {
|
|
143
|
+
children: ($$renderer) => {
|
|
144
|
+
Dialog_title($$renderer, {
|
|
145
|
+
children: ($$renderer) => {
|
|
146
|
+
$$renderer.push(`<!---->${$.escape(dialogTitle())}`);
|
|
147
|
+
},
|
|
148
|
+
$$slots: { default: true }
|
|
149
|
+
});
|
|
150
|
+
$$renderer.push(`<!----> `);
|
|
151
|
+
Dialog_description($$renderer, {
|
|
152
|
+
children: ($$renderer) => {
|
|
153
|
+
$$renderer.push(`<!---->${$.escape(tags_name_placeholder())}`);
|
|
154
|
+
},
|
|
155
|
+
$$slots: { default: true }
|
|
156
|
+
});
|
|
157
|
+
$$renderer.push(`<!---->`);
|
|
158
|
+
},
|
|
159
|
+
$$slots: { default: true }
|
|
160
|
+
});
|
|
161
|
+
$$renderer.push(`<!----> <form class="space-y-4"><div class="space-y-2">`);
|
|
162
|
+
Label($$renderer, {
|
|
163
|
+
for: "tag-name",
|
|
164
|
+
class: "sr-only",
|
|
165
|
+
children: ($$renderer) => {
|
|
166
|
+
$$renderer.push(`<!---->${$.escape(tags_name_placeholder())}`);
|
|
167
|
+
},
|
|
168
|
+
$$slots: { default: true }
|
|
169
|
+
});
|
|
170
|
+
$$renderer.push(`<!----> `);
|
|
171
|
+
Input($$renderer, {
|
|
172
|
+
id: "tag-name",
|
|
173
|
+
name: "name",
|
|
174
|
+
type: "text",
|
|
175
|
+
placeholder: tags_name_placeholder(),
|
|
176
|
+
maxlength: 50,
|
|
177
|
+
required: true,
|
|
178
|
+
disabled: submitting,
|
|
179
|
+
"aria-invalid": nameError ? "true" : void 0,
|
|
180
|
+
"aria-describedby": nameError ? "tag-name-error" : void 0,
|
|
181
|
+
autocomplete: "off",
|
|
182
|
+
onkeydown: handleInputKeydown,
|
|
183
|
+
get value() {
|
|
184
|
+
return name;
|
|
185
|
+
},
|
|
186
|
+
set value($$value) {
|
|
187
|
+
name = $$value;
|
|
188
|
+
$$settled = false;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
$$renderer.push(`<!----> `);
|
|
192
|
+
if (nameError) {
|
|
193
|
+
$$renderer.push("<!--[0-->");
|
|
194
|
+
$$renderer.push(`<p id="tag-name-error" class="text-xs text-destructive">${$.escape(nameError)}</p>`);
|
|
195
|
+
} else $$renderer.push("<!--[-1-->");
|
|
196
|
+
$$renderer.push(`<!--]--></div> <div class="space-y-2">`);
|
|
197
|
+
Label($$renderer, {
|
|
198
|
+
for: "tag-color",
|
|
199
|
+
class: "text-xs text-muted-foreground",
|
|
200
|
+
children: ($$renderer) => {
|
|
201
|
+
$$renderer.push(`<!---->Color`);
|
|
202
|
+
},
|
|
203
|
+
$$slots: { default: true }
|
|
204
|
+
});
|
|
205
|
+
$$renderer.push(`<!----> <div id="tag-color" class="flex flex-wrap gap-2"><!--[-->`);
|
|
206
|
+
const each_array = $.ensure_array_like(PRESET_COLORS);
|
|
207
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
208
|
+
let preset = each_array[$$index];
|
|
209
|
+
const selected = color === preset;
|
|
210
|
+
$$renderer.push(`<button type="button"${$.attr_class($.clsx(cn("size-6 shrink-0 rounded-full border-2 transition-all", selected ? "scale-110 border-foreground" : "border-transparent hover:scale-105")))}${$.attr_style(`background-color: ${$.stringify(preset)};`)}${$.attr("aria-label", `Color ${$.stringify(preset)}`)}${$.attr("aria-pressed", selected)}${$.attr("disabled", submitting, true)}></button>`);
|
|
211
|
+
}
|
|
212
|
+
$$renderer.push(`<!--]--> <label${$.attr_class($.clsx(cn("relative inline-flex size-6 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-full border-2 transition-all", !PRESET_COLORS.includes(color) ? "scale-110 border-foreground" : "border-transparent hover:scale-105")))}${$.attr_style(`background-color: ${$.stringify(color)};`)} title="Custom color"><input type="color"${$.attr("value", color)}${$.attr("disabled", submitting, true)} class="absolute inset-0 h-full w-full cursor-pointer opacity-0" aria-label="Custom color"/></label></div></div> `);
|
|
213
|
+
if (submitError) {
|
|
214
|
+
$$renderer.push("<!--[0-->");
|
|
215
|
+
$$renderer.push(`<p class="text-xs text-destructive" role="alert">${$.escape(submitError)}</p>`);
|
|
216
|
+
} else $$renderer.push("<!--[-1-->");
|
|
217
|
+
$$renderer.push(`<!--]--></form> `);
|
|
218
|
+
Dialog_footer($$renderer, {
|
|
219
|
+
class: "gap-2 max-sm:flex-col max-sm:items-stretch",
|
|
220
|
+
children: ($$renderer) => {
|
|
221
|
+
Button($$renderer, {
|
|
222
|
+
variant: "outline",
|
|
223
|
+
type: "button",
|
|
224
|
+
onclick: close,
|
|
225
|
+
disabled: submitting,
|
|
226
|
+
children: ($$renderer) => {
|
|
227
|
+
$$renderer.push(`<!---->${$.escape(action_cancel())}`);
|
|
228
|
+
},
|
|
229
|
+
$$slots: { default: true }
|
|
230
|
+
});
|
|
231
|
+
$$renderer.push(`<!----> `);
|
|
232
|
+
Button($$renderer, {
|
|
233
|
+
type: "submit",
|
|
234
|
+
onclick: handleSubmit,
|
|
235
|
+
disabled: submitting || name.trim().length === 0,
|
|
236
|
+
children: ($$renderer) => {
|
|
237
|
+
if (submitting) {
|
|
238
|
+
$$renderer.push("<!--[0-->");
|
|
239
|
+
Loader_circle($$renderer, { class: "mr-1 size-4 animate-spin" });
|
|
240
|
+
} else $$renderer.push("<!--[-1-->");
|
|
241
|
+
$$renderer.push(`<!--]--> ${$.escape(submitLabel())}`);
|
|
242
|
+
},
|
|
243
|
+
$$slots: { default: true }
|
|
244
|
+
});
|
|
245
|
+
$$renderer.push(`<!---->`);
|
|
246
|
+
},
|
|
247
|
+
$$slots: { default: true }
|
|
248
|
+
});
|
|
249
|
+
$$renderer.push(`<!---->`);
|
|
250
|
+
},
|
|
251
|
+
$$slots: { default: true }
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
do {
|
|
255
|
+
$$settled = true;
|
|
256
|
+
$$inner_renderer = $$renderer.copy();
|
|
257
|
+
$$render_inner($$inner_renderer);
|
|
258
|
+
} while (!$$settled);
|
|
259
|
+
$$renderer.subsume($$inner_renderer);
|
|
260
|
+
$.bind_props($$props, { open });
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
export { TagCreateDialog as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as apiFetch } from "./client-DZMkDkDn.js";
|
|
2
|
+
//#region src/lib/api/api-keys.ts
|
|
3
|
+
function listApiKeys() {
|
|
4
|
+
return apiFetch("/api/keys");
|
|
5
|
+
}
|
|
6
|
+
function createGlobalApiKey(name) {
|
|
7
|
+
return apiFetch("/api/keys/global", {
|
|
8
|
+
method: "POST",
|
|
9
|
+
body: { name }
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function createCategoryApiKey(categoryId, name) {
|
|
13
|
+
return apiFetch(`/api/categories/${encodeURIComponent(categoryId)}/keys`, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
body: { name }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function revokeApiKey(id) {
|
|
19
|
+
return apiFetch(`/api/keys/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
20
|
+
}
|
|
21
|
+
async function revealCategoryApiKey(id) {
|
|
22
|
+
return (await apiFetch(`/api/keys/${encodeURIComponent(id)}/secret`)).key;
|
|
23
|
+
}
|
|
24
|
+
function categoryIdFromScopes(scopes) {
|
|
25
|
+
for (const scope of scopes) {
|
|
26
|
+
const match = /^category:([0-9a-f-]{36}):(read|edit|write)$/i.exec(scope);
|
|
27
|
+
if (match?.[1]) return match[1];
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
function apiKeyClipboardValue(key, rawKey) {
|
|
32
|
+
return rawKey ?? key.prefix;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { listApiKeys as a, createGlobalApiKey as i, categoryIdFromScopes as n, revealCategoryApiKey as o, createCategoryApiKey as r, revokeApiKey as s, apiKeyClipboardValue as t };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { n as apiFetch } from "./client-DZMkDkDn.js";
|
|
2
|
+
//#region src/lib/api/attachments.ts
|
|
3
|
+
/**
|
|
4
|
+
* Server-side attachment size limit (bytes). The backend reads this from
|
|
5
|
+
* `ATTACHMENT_MAX_SIZE_MB` (default 25 MB); we hard-code the same default
|
|
6
|
+
* here so the client UI rejects obviously-oversized files before they
|
|
7
|
+
* even hit the network. Operators who change the env var SHOULD also
|
|
8
|
+
* update this constant — they're intentionally separate to avoid a
|
|
9
|
+
* runtime config dependency in the frontend bundle.
|
|
10
|
+
*/
|
|
11
|
+
var MAX_FILE_SIZE = 25 * 1024 * 1024;
|
|
12
|
+
/**
|
|
13
|
+
* Request a presigned PUT URL from the backend. The returned URL is
|
|
14
|
+
* scoped to a single storage object and expires after `expiresIn` seconds.
|
|
15
|
+
* No file bytes cross the wire in this call.
|
|
16
|
+
*/
|
|
17
|
+
function presignAttachment(documentId, file) {
|
|
18
|
+
return apiFetch(`/api/documents/${documentId}/attachments/presign`, {
|
|
19
|
+
method: "POST",
|
|
20
|
+
body: {
|
|
21
|
+
filename: file.name,
|
|
22
|
+
contentType: file.type,
|
|
23
|
+
size: file.size
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Tell the backend to record an attachment row for an object that has
|
|
29
|
+
* already been PUT to storage. The backend verifies the object exists
|
|
30
|
+
* before inserting.
|
|
31
|
+
*/
|
|
32
|
+
function confirmAttachment(documentId, key, file) {
|
|
33
|
+
return apiFetch(`/api/documents/${documentId}/attachments/confirm`, {
|
|
34
|
+
method: "POST",
|
|
35
|
+
body: {
|
|
36
|
+
key,
|
|
37
|
+
filename: file.name,
|
|
38
|
+
contentType: file.type,
|
|
39
|
+
size: file.size
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Upload an image attachment using the presigned-URL flow:
|
|
45
|
+
*
|
|
46
|
+
* 1. POST /attachments/presign — get a signed storage PUT URL (small JSON).
|
|
47
|
+
* 2. PUT <presigned URL> — stream the file bytes to storage directly
|
|
48
|
+
* (NOT through this API process).
|
|
49
|
+
* 3. POST /attachments/confirm — record the row; backend verifies the
|
|
50
|
+
* object actually exists in storage.
|
|
51
|
+
*
|
|
52
|
+
* The orchestration is transparent to callers — they keep calling
|
|
53
|
+
* `uploadAttachment(documentId, file)` exactly as before. Step 2 never
|
|
54
|
+
* touches `/api/*`, so the Bun/Elysia global body-size cap is irrelevant
|
|
55
|
+
* and large images (up to `MAX_FILE_SIZE`) upload without 413.
|
|
56
|
+
*/
|
|
57
|
+
async function uploadAttachment(documentId, file) {
|
|
58
|
+
const presign = await presignAttachment(documentId, file);
|
|
59
|
+
const putController = new AbortController();
|
|
60
|
+
const putTimeout = setTimeout(() => putController.abort(), 5 * 6e4);
|
|
61
|
+
let putResponse;
|
|
62
|
+
try {
|
|
63
|
+
putResponse = await fetch(presign.url, {
|
|
64
|
+
method: "PUT",
|
|
65
|
+
body: file,
|
|
66
|
+
headers: { "Content-Type": file.type },
|
|
67
|
+
signal: putController.signal
|
|
68
|
+
});
|
|
69
|
+
} finally {
|
|
70
|
+
clearTimeout(putTimeout);
|
|
71
|
+
}
|
|
72
|
+
if (!putResponse.ok) throw new Error(`Storage upload failed: ${putResponse.status} ${putResponse.statusText}`);
|
|
73
|
+
return confirmAttachment(documentId, presign.key, file);
|
|
74
|
+
}
|
|
75
|
+
function listAttachments(documentId) {
|
|
76
|
+
return apiFetch(`/api/documents/${documentId}/attachments`);
|
|
77
|
+
}
|
|
78
|
+
function isImageFile(file) {
|
|
79
|
+
return file.type.startsWith("image/");
|
|
80
|
+
}
|
|
81
|
+
function isFileSizeAllowed(file) {
|
|
82
|
+
return file.size <= MAX_FILE_SIZE;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { presignAttachment as a, listAttachments as i, isFileSizeAllowed as n, uploadAttachment as o, isImageFile as r, confirmAttachment as t };
|