@hiai-gg/docsmint 2.0.3 → 2.1.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/README.md +68 -3
- package/dist/backend/index.js +22540 -2807
- package/dist/backend-account-runtime-cleanup.js +2 -1
- package/dist/backend-api-key-facade.js +2 -1
- package/dist/backend-pipeline-cancellation.js +2 -1
- package/dist/client.d.ts +33 -7
- package/dist/client.js +55 -1
- package/dist/frontend/{HiAiEditor-DDpfdQEg.js → HiAiEditor-D6ad_auS.js} +2 -2
- package/dist/frontend/{SettingsDialog-DzlYW50I.js → SettingsDialog-B8Oswuqb.js} +4 -4
- package/dist/frontend/{Sidebar-rFiVen96.js → Sidebar-BV0IDqTS.js} +1 -1
- package/dist/frontend/api/settings.js +1 -1
- package/dist/frontend/app-shell.js +45 -36
- package/dist/frontend/{auth-client-CXR-7mIO.js → auth-client-C5EyWdAF.js} +416 -349
- package/dist/frontend/components/editor/compact-editor.js +1 -1
- package/dist/frontend/components/editor/document-editor.js +1 -1
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/sidebar.js +1 -1
- package/dist/frontend/{db-Dya0HRhS.js → db-CgTtukT4.js} +1 -1
- package/dist/frontend/{identity-BOA7Jejv.js → identity-CNhtuCJV.js} +1 -1
- package/dist/frontend/offline/identity.js +1 -1
- package/dist/frontend/{settings-BRcYFQa_.js → settings-CHx4wBwb.js} +1 -1
- package/dist/frontend-ssr/api/settings.js +1 -1
- package/dist/frontend-ssr/app-shell.js +2 -2
- package/dist/frontend-ssr/assets/{HiAiEditor-Bj6tiE97.js → HiAiEditor-Cj3B2Dt6.js} +2 -2
- package/dist/frontend-ssr/assets/{SettingsDialog-h4SFwpUa.js → SettingsDialog-DAT-Zxu0.js} +4 -4
- package/dist/frontend-ssr/assets/{Sidebar-BFBpsd3L.js → Sidebar-B_Ey6QNL.js} +1 -1
- package/dist/frontend-ssr/assets/{auth-client-BC4hSFKF.js → auth-client-CITU3xkE.js} +308 -227
- package/dist/frontend-ssr/assets/{db-C3rFdTZa.js → db-DxRzq-kx.js} +1 -1
- package/dist/frontend-ssr/assets/{identity-DNIo1bgc.js → identity-B7ngLQzZ.js} +1 -1
- package/dist/frontend-ssr/assets/{settings-DWCpfCPj.js → settings-BRxvn30Y.js} +1 -1
- package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
- package/dist/frontend-ssr/components/editor/document-editor.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/offline/identity.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lifecycle-runtime.js +4 -1
- package/dist/mcp-cli.js +301 -22
- package/dist/mcp-server.d.ts +92 -23
- package/dist/mcp-server.js +469 -22
- package/dist/types.d.ts +68 -1
- package/package.json +2 -2
- package/packages/cli/src/index.ts +1 -1
- package/packages/db/src/schema.ts +3 -1
- package/server.json +2 -2
|
@@ -149,10 +149,11 @@ var accounts = pgTable("accounts", {
|
|
|
149
149
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
150
150
|
userId: uuid("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
151
151
|
accountId: text("account_id").notNull(),
|
|
152
|
-
issuer: text("issuer")
|
|
152
|
+
issuer: text("issuer"),
|
|
153
153
|
providerId: text("provider_id").notNull(),
|
|
154
154
|
accessToken: text("access_token"),
|
|
155
155
|
refreshToken: text("refresh_token"),
|
|
156
|
+
idToken: text("id_token"),
|
|
156
157
|
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
157
158
|
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
158
159
|
scope: text("scope"),
|
|
@@ -149,10 +149,11 @@ var accounts = pgTable("accounts", {
|
|
|
149
149
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
150
150
|
userId: uuid("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
151
151
|
accountId: text("account_id").notNull(),
|
|
152
|
-
issuer: text("issuer")
|
|
152
|
+
issuer: text("issuer"),
|
|
153
153
|
providerId: text("provider_id").notNull(),
|
|
154
154
|
accessToken: text("access_token"),
|
|
155
155
|
refreshToken: text("refresh_token"),
|
|
156
|
+
idToken: text("id_token"),
|
|
156
157
|
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
157
158
|
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
158
159
|
scope: text("scope"),
|
|
@@ -149,10 +149,11 @@ var accounts = pgTable("accounts", {
|
|
|
149
149
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
150
150
|
userId: uuid("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
151
151
|
accountId: text("account_id").notNull(),
|
|
152
|
-
issuer: text("issuer")
|
|
152
|
+
issuer: text("issuer"),
|
|
153
153
|
providerId: text("provider_id").notNull(),
|
|
154
154
|
accessToken: text("access_token"),
|
|
155
155
|
refreshToken: text("refresh_token"),
|
|
156
|
+
idToken: text("id_token"),
|
|
156
157
|
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
157
158
|
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
158
159
|
scope: text("scope"),
|
package/dist/client.d.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { DocsApiKeyCreated, DocsApiKeyListResponse, DocsAttachment, DocsAttachmentConfirmInput, DocsAttachmentListResponse, DocsAttachmentPresignInput, DocsAttachmentPresignResponse, DocsCategory, DocsCategoryListItem, DocsCategoryInput, DocsCategoryUpdate, DocsDocument, DocsDocumentCreateInput, DocsDocumentCursorPage, DocsDocumentIndexRefresh, DocsDocumentIndexStatus, DocsDocumentKnowledgeSummary, DocsDocumentListResponse, DocsDocumentPipeline, DocsPipelineWarningRetry, DocsDocumentUpdateInput, DocsFolder, DocsFolderCreateInput, DocsFolderUpdateInput, DocsGraphEntitiesResponse, DocsGraphRelatedResponse, DocsGraphSearchResponse, DocsHealthResponse, DocsRequestContext, DocsSearchOptions, DocsSearchResponse, DocsSearchSuggestItem, DocsSharedContent, DocsShareLink, DocsShareListResponse, DocsShareRole, DocsTag, DocsTrashResponse, DocsVersion, DocsVersionDiff } from "./types.js";
|
|
11
11
|
export interface DocsClientConfig {
|
|
12
|
+
/** Explicit API prefix. Existing clients keep /api; no endpoint probing is performed. */
|
|
13
|
+
apiPrefix?: "/api" | "/api/v1";
|
|
12
14
|
/** Base URL of the DocsMint API, e.g. `http://localhost:50700`. */
|
|
13
15
|
baseUrl: string;
|
|
14
16
|
/** Bearer token used as `Authorization: Bearer <apiKey>`. */
|
|
@@ -70,17 +72,12 @@ export declare class DocsClient {
|
|
|
70
72
|
getDocMarkdown(id: string, context?: DocsRequestContext): Promise<string>;
|
|
71
73
|
updateDoc(id: string, updates: DocsDocumentUpdateInput, context?: DocsRequestContext): Promise<DocsDocument>;
|
|
72
74
|
deleteDoc(id: string, context?: DocsRequestContext): Promise<void>;
|
|
73
|
-
listDocs(options?:
|
|
74
|
-
folderId?: string;
|
|
75
|
-
tag?: string;
|
|
76
|
-
page?: number;
|
|
77
|
-
limit?: number;
|
|
78
|
-
}, context?: DocsRequestContext): Promise<DocsDocumentListResponse>;
|
|
75
|
+
listDocs(options?: import("./types.js").DocsListOptions, context?: DocsRequestContext): Promise<DocsDocumentListResponse>;
|
|
79
76
|
/**
|
|
80
77
|
* List documents through the bounded cursor API. Cursors are opaque and
|
|
81
78
|
* bound by the server to the authenticated workspace and category scope.
|
|
82
79
|
*/
|
|
83
|
-
listDocuments(options?: {
|
|
80
|
+
listDocuments(options?: Omit<import("./types.js").DocsListOptions, "page" | "sortBy"> & {
|
|
84
81
|
categoryId?: string;
|
|
85
82
|
cursor?: string;
|
|
86
83
|
limit?: number;
|
|
@@ -99,6 +96,8 @@ export declare class DocsClient {
|
|
|
99
96
|
* Convenience alias for `getDocMarkdown` — both go through the same
|
|
100
97
|
* `/api/documents/:id/export` endpoint on the backend.
|
|
101
98
|
*/
|
|
99
|
+
/** Read portable markdown and authorized document metadata in one request. */
|
|
100
|
+
exportDocWithMetadata(id: string, context?: DocsRequestContext): Promise<import("./types.js").DocsDocumentExport>;
|
|
102
101
|
exportDoc(id: string, context?: DocsRequestContext): Promise<string>;
|
|
103
102
|
/**
|
|
104
103
|
* Import a document from raw content. Posts JSON to
|
|
@@ -146,6 +145,9 @@ export declare class DocsClient {
|
|
|
146
145
|
revokeApiKey(id: string, context?: DocsRequestContext): Promise<{
|
|
147
146
|
success: true;
|
|
148
147
|
}>;
|
|
148
|
+
/** Inspect credentials without reading a document or selecting a workspace. */
|
|
149
|
+
whoami(context?: DocsRequestContext): Promise<import("./types.js").DocsIdentity>;
|
|
150
|
+
listWorkspaces(context?: DocsRequestContext): Promise<import("./types.js").DocsWorkspaceDescriptor[]>;
|
|
149
151
|
search(query: string, options?: DocsSearchOptions, context?: DocsRequestContext): Promise<DocsSearchResponse>;
|
|
150
152
|
/**
|
|
151
153
|
* Product-facing search contract. The retrieval choice is explicitly typed
|
|
@@ -234,3 +236,27 @@ export declare class DocsClient {
|
|
|
234
236
|
private snapshotContext;
|
|
235
237
|
private toBlob;
|
|
236
238
|
}
|
|
239
|
+
/** Canonical camelCase view without removing legacy wire aliases. */
|
|
240
|
+
export declare function normalizeDocsSearchResult(result: import("./types.js").DocsSearchResult): {
|
|
241
|
+
folderId: string | null;
|
|
242
|
+
folderName: string | null;
|
|
243
|
+
categoryId: string | null;
|
|
244
|
+
categoryName: string | null;
|
|
245
|
+
createdAt: string;
|
|
246
|
+
updatedAt: string;
|
|
247
|
+
effectiveCategoryId?: string | null;
|
|
248
|
+
effectiveCategoryName?: string | null;
|
|
249
|
+
workspaceId?: string | null;
|
|
250
|
+
workspaceSlug?: string | null;
|
|
251
|
+
url?: string | null;
|
|
252
|
+
id: string;
|
|
253
|
+
title: string;
|
|
254
|
+
snippet: string;
|
|
255
|
+
score: number;
|
|
256
|
+
folder_id: string | null;
|
|
257
|
+
folder_name: string | null;
|
|
258
|
+
created_at: string;
|
|
259
|
+
updated_at: string;
|
|
260
|
+
tags?: DocsTag[];
|
|
261
|
+
chunks?: import("./types.js").DocsSearchChunk[];
|
|
262
|
+
};
|
package/dist/client.js
CHANGED
|
@@ -76,11 +76,15 @@ export class DocsTimeoutError extends DocsNetworkError {
|
|
|
76
76
|
export class DocsClient {
|
|
77
77
|
config;
|
|
78
78
|
constructor(config) {
|
|
79
|
+
if (config.apiPrefix !== undefined && config.apiPrefix !== "/api" && config.apiPrefix !== "/api/v1") {
|
|
80
|
+
throw new Error("DocsClient: apiPrefix must be /api or /api/v1");
|
|
81
|
+
}
|
|
79
82
|
if (!config.baseUrl) {
|
|
80
83
|
throw new Error("DocsClient: `baseUrl` is required");
|
|
81
84
|
}
|
|
82
85
|
this.config = {
|
|
83
86
|
baseUrl: config.baseUrl.replace(/\/+$/, ""),
|
|
87
|
+
apiPrefix: config.apiPrefix ?? "/api",
|
|
84
88
|
apiKey: config.apiKey,
|
|
85
89
|
requestContext: this.snapshotContext(config.requestContext),
|
|
86
90
|
fetch: config.fetch ?? fetch,
|
|
@@ -126,6 +130,16 @@ export class DocsClient {
|
|
|
126
130
|
return this.request("GET", "/api/documents", {
|
|
127
131
|
query: this.cleanQuery({
|
|
128
132
|
folderId: options?.folderId,
|
|
133
|
+
categoryId: options?.categoryId,
|
|
134
|
+
visibility: options?.visibility,
|
|
135
|
+
rootOnly: options?.rootOnly,
|
|
136
|
+
tagIds: options?.tagIds?.join(","),
|
|
137
|
+
tagMatch: options?.tagMatch,
|
|
138
|
+
q: options?.q,
|
|
139
|
+
updatedFrom: options?.updatedFrom,
|
|
140
|
+
updatedTo: options?.updatedTo,
|
|
141
|
+
sortBy: options?.sortBy,
|
|
142
|
+
sortOrder: options?.sortOrder,
|
|
129
143
|
tag: options?.tag,
|
|
130
144
|
page: options?.page,
|
|
131
145
|
limit: options?.limit,
|
|
@@ -140,6 +154,15 @@ export class DocsClient {
|
|
|
140
154
|
return this.request("GET", "/api/documents/cursor", {
|
|
141
155
|
query: this.cleanQuery({
|
|
142
156
|
categoryId: options.categoryId,
|
|
157
|
+
folderId: options.folderId,
|
|
158
|
+
rootOnly: options.rootOnly,
|
|
159
|
+
tag: options.tag,
|
|
160
|
+
tagIds: options.tagIds?.join(","),
|
|
161
|
+
tagMatch: options.tagMatch,
|
|
162
|
+
visibility: options.visibility,
|
|
163
|
+
q: options.q,
|
|
164
|
+
updatedFrom: options.updatedFrom,
|
|
165
|
+
updatedTo: options.updatedTo,
|
|
143
166
|
cursor: options.cursor,
|
|
144
167
|
limit: options.limit,
|
|
145
168
|
sortBy: options.sortBy,
|
|
@@ -175,6 +198,16 @@ export class DocsClient {
|
|
|
175
198
|
* Convenience alias for `getDocMarkdown` — both go through the same
|
|
176
199
|
* `/api/documents/:id/export` endpoint on the backend.
|
|
177
200
|
*/
|
|
201
|
+
/** Read portable markdown and authorized document metadata in one request. */
|
|
202
|
+
async exportDocWithMetadata(id, context) {
|
|
203
|
+
const response = await this.fetchRaw("GET", `/api/documents/${encodeURIComponent(id)}/export`, { query: { format: "json" } }, context);
|
|
204
|
+
if (!response.ok)
|
|
205
|
+
throw await this.toApiError(response);
|
|
206
|
+
if (response.headers.get("content-type")?.includes("json"))
|
|
207
|
+
return response.json();
|
|
208
|
+
// Older servers return portable markdown even when an unknown format is supplied.
|
|
209
|
+
return { markdown: await response.text() };
|
|
210
|
+
}
|
|
178
211
|
async exportDoc(id, context) {
|
|
179
212
|
return this.getDocMarkdown(id, context);
|
|
180
213
|
}
|
|
@@ -267,6 +300,13 @@ export class DocsClient {
|
|
|
267
300
|
async revokeApiKey(id, context) {
|
|
268
301
|
return this.request("DELETE", `/api/keys/${encodeURIComponent(id)}`, undefined, context);
|
|
269
302
|
}
|
|
303
|
+
/** Inspect credentials without reading a document or selecting a workspace. */
|
|
304
|
+
async whoami(context) {
|
|
305
|
+
return this.request("GET", "/api/whoami", undefined, context);
|
|
306
|
+
}
|
|
307
|
+
async listWorkspaces(context) {
|
|
308
|
+
return this.request("GET", "/api/workspaces", undefined, context);
|
|
309
|
+
}
|
|
270
310
|
// ── Search ───────────────────────────────────────────────────────────
|
|
271
311
|
async search(query, options, context) {
|
|
272
312
|
return this.request("GET", "/api/search", {
|
|
@@ -284,6 +324,7 @@ export class DocsClient {
|
|
|
284
324
|
graphHops: options?.graphHops,
|
|
285
325
|
graphBoost: options?.graphBoost,
|
|
286
326
|
includeChunks: options?.includeChunks,
|
|
327
|
+
includeDiagnostics: options?.includeDiagnostics,
|
|
287
328
|
}),
|
|
288
329
|
}, context);
|
|
289
330
|
}
|
|
@@ -516,7 +557,8 @@ export class DocsClient {
|
|
|
516
557
|
throw this.wrapNetworkError(lastError, requestContext?.requestId);
|
|
517
558
|
}
|
|
518
559
|
buildUrl(path, query) {
|
|
519
|
-
|
|
560
|
+
const resolvedPath = path.startsWith("/api/") ? `${this.config.apiPrefix}${path.slice(4)}` : path;
|
|
561
|
+
let url = `${this.config.baseUrl}${resolvedPath}`;
|
|
520
562
|
if (query && Object.keys(query).length > 0) {
|
|
521
563
|
const params = new URLSearchParams();
|
|
522
564
|
for (const [key, value] of Object.entries(query)) {
|
|
@@ -677,3 +719,15 @@ export class DocsClient {
|
|
|
677
719
|
throw new Error("DocsClient.uploadAttachment: unsupported file type");
|
|
678
720
|
}
|
|
679
721
|
}
|
|
722
|
+
/** Canonical camelCase view without removing legacy wire aliases. */
|
|
723
|
+
export function normalizeDocsSearchResult(result) {
|
|
724
|
+
return {
|
|
725
|
+
...result,
|
|
726
|
+
folderId: result.folderId === undefined ? result.folder_id : result.folderId,
|
|
727
|
+
folderName: result.folderName === undefined ? result.folder_name : result.folderName,
|
|
728
|
+
categoryId: result.effectiveCategoryId ?? result.categoryId ?? null,
|
|
729
|
+
categoryName: result.effectiveCategoryName ?? result.categoryName ?? null,
|
|
730
|
+
createdAt: result.createdAt ?? result.created_at,
|
|
731
|
+
updatedAt: result.updatedAt ?? result.updated_at,
|
|
732
|
+
};
|
|
733
|
+
}
|
|
@@ -14,8 +14,8 @@ import { t as je } from "./version_create_snapshot-3bu-0qzH.js";
|
|
|
14
14
|
import { a as Me } from "./route-context-DYQlUfzL.js";
|
|
15
15
|
import { a as Ne, n as Pe, o as Fe, r as Ie, s as Le, t as Re } from "./dialog-a_ZcpEC5.js";
|
|
16
16
|
import { t as ze } from "./input-Q_7qCfnU.js";
|
|
17
|
-
import { n as Be } from "./db-
|
|
18
|
-
import { a as Ve } from "./identity-
|
|
17
|
+
import { n as Be } from "./db-CgTtukT4.js";
|
|
18
|
+
import { a as Ve } from "./identity-CNhtuCJV.js";
|
|
19
19
|
import { A as He, C as S, D as Ue, E as C, O as w, S as We, T as Ge, g as Ke, h as qe, j as Je, k as Ye, v as Xe, w as Ze, x as T } from "./lib-aUbBbIW2.js";
|
|
20
20
|
import { n as Qe, t as E } from "./dist-CcHOStsA.js";
|
|
21
21
|
import { h as $e, u as D } from "./keyboard.svelte-CApmX0vl.js";
|
|
@@ -8,14 +8,14 @@ import { t as D } from "./utils-BlHvR6OL.js";
|
|
|
8
8
|
import { a as ne, i as re, n as ie, o as ae, r as oe, s as O, t as se } from "./dialog-a_ZcpEC5.js";
|
|
9
9
|
import { t as k } from "./input-Q_7qCfnU.js";
|
|
10
10
|
import { t as A } from "./label-Dj8FDEhf.js";
|
|
11
|
-
import { r as ce, t as le } from "./auth-client-
|
|
12
|
-
import { a as ue, r as de } from "./settings-
|
|
11
|
+
import { r as ce, t as le } from "./auth-client-C5EyWdAF.js";
|
|
12
|
+
import { a as ue, r as de } from "./settings-CHx4wBwb.js";
|
|
13
13
|
import { a as j, i as M, n as N, o as fe, s as P, t as F } from "./api-keys-DIwAdYkg.js";
|
|
14
14
|
import { i as I } from "./categories-C8AAkhCR.js";
|
|
15
15
|
import { t as pe } from "./context-D0zPFXZ4.js";
|
|
16
16
|
import { t as me } from "./resolve-BG4HgzpN.js";
|
|
17
|
-
import { n as L, t as R } from "./db-
|
|
18
|
-
import { a as z, t as B } from "./identity-
|
|
17
|
+
import { n as L, t as R } from "./db-CgTtukT4.js";
|
|
18
|
+
import { a as z, t as B } from "./identity-CNhtuCJV.js";
|
|
19
19
|
import { t as V } from "./editor-preferences.svelte-Bt_A9k7n.js";
|
|
20
20
|
import { n as H, r as U, t as W } from "./search-preferences-B1GdbdUc.js";
|
|
21
21
|
import { t as he } from "./theme.svelte-BRdxXd-B.js";
|
|
@@ -7,7 +7,7 @@ import { t as o } from "./copy-CRzvfZGb.js";
|
|
|
7
7
|
import { t as s } from "./ellipsis-vertical-qxNgoXu-.js";
|
|
8
8
|
import { a as c, i as l, r as u, t as d } from "./share-context-BJ4GF4yT.js";
|
|
9
9
|
import { t as f } from "./loader-circle-D3t5NkvC.js";
|
|
10
|
-
import { t as p } from "./SettingsDialog-
|
|
10
|
+
import { t as p } from "./SettingsDialog-B8Oswuqb.js";
|
|
11
11
|
import { n as m, t as h } from "./tag-qbTBLj-g.js";
|
|
12
12
|
import { t as g } from "./x-CvSSnrjl.js";
|
|
13
13
|
import { t as _ } from "./action_cancel-Cuxsznzz.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "../settings-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "../settings-CHx4wBwb.js";
|
|
2
2
|
export { i as deleteAccount, n as getEmbeddingConfig, r as getProfile, t as updateEmbeddingConfig, e as updateProfile };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./Icon-3EYzvNyk.js";
|
|
2
2
|
import { n as t, t as n } from "./share-context-BJ4GF4yT.js";
|
|
3
|
-
import { n as r } from "./SettingsDialog-
|
|
4
|
-
import { t as i } from "./Sidebar-
|
|
3
|
+
import { n as r } from "./SettingsDialog-B8Oswuqb.js";
|
|
4
|
+
import { t as i } from "./Sidebar-BV0IDqTS.js";
|
|
5
5
|
import { t as a } from "./scroll_to_top_aria-CvkNF_Hu.js";
|
|
6
6
|
import { o, r as s } from "./route-context-DYQlUfzL.js";
|
|
7
7
|
import { t as c } from "./editor-preferences.svelte-Bt_A9k7n.js";
|
|
@@ -185,8 +185,17 @@ function D(e, t) {
|
|
|
185
185
|
}
|
|
186
186
|
p.delegate(["click"]);
|
|
187
187
|
//#endregion
|
|
188
|
+
//#region src/lib/stores/mobile-sidebar-focus.ts
|
|
189
|
+
function O(e, t, n, r = requestAnimationFrame) {
|
|
190
|
+
r(() => {
|
|
191
|
+
if (n()) return;
|
|
192
|
+
let r = e?.isConnected ? e : t();
|
|
193
|
+
r?.isConnected && r.focus();
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
188
197
|
//#region src/lib/stores/mobile-sidebar-gesture.ts
|
|
189
|
-
function
|
|
198
|
+
function k(e = {}) {
|
|
190
199
|
let t = e.edgeWidth ?? 36, n = e.openDistance ?? 40, r = e.scrollTolerance ?? 12, i = null, a = !1;
|
|
191
200
|
return {
|
|
192
201
|
start(e) {
|
|
@@ -208,21 +217,21 @@ function O(e = {}) {
|
|
|
208
217
|
}
|
|
209
218
|
//#endregion
|
|
210
219
|
//#region src/lib/hosts/mutation-refresh.ts
|
|
211
|
-
var
|
|
220
|
+
var A = {
|
|
212
221
|
documents: !1,
|
|
213
222
|
folders: !1,
|
|
214
223
|
tags: !1
|
|
215
224
|
};
|
|
216
|
-
function
|
|
225
|
+
function j(e, t) {
|
|
217
226
|
let n = (t?.method ?? (e instanceof Request ? e.method : "GET")).toUpperCase();
|
|
218
227
|
if (![
|
|
219
228
|
"POST",
|
|
220
229
|
"PUT",
|
|
221
230
|
"PATCH",
|
|
222
231
|
"DELETE"
|
|
223
|
-
].includes(n)) return
|
|
232
|
+
].includes(n)) return A;
|
|
224
233
|
let r = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, i = new URL(r, "http://docsmint.local").pathname;
|
|
225
|
-
return /\/keys(?:\/|$)/.test(i) ?
|
|
234
|
+
return /\/keys(?:\/|$)/.test(i) ? A : /^\/api\/(?:v1\/)?tags(?:\/|$)/.test(i) || /^\/api\/(?:v1\/)?documents\/[^/]+\/tags(?:\/|$)/.test(i) ? {
|
|
226
235
|
documents: !0,
|
|
227
236
|
folders: !1,
|
|
228
237
|
tags: !0
|
|
@@ -230,24 +239,24 @@ function A(e, t) {
|
|
|
230
239
|
documents: !0,
|
|
231
240
|
folders: !0,
|
|
232
241
|
tags: !1
|
|
233
|
-
} :
|
|
242
|
+
} : A;
|
|
234
243
|
}
|
|
235
|
-
function
|
|
244
|
+
function M(e) {
|
|
236
245
|
return e.documents || e.folders || e.tags;
|
|
237
246
|
}
|
|
238
247
|
//#endregion
|
|
239
248
|
//#region src/lib/hosts/realtime-context.ts
|
|
240
|
-
var
|
|
241
|
-
function
|
|
242
|
-
g(
|
|
249
|
+
var N = Symbol("docsmint-realtime-adapter");
|
|
250
|
+
function P(e) {
|
|
251
|
+
g(N, e);
|
|
243
252
|
}
|
|
244
|
-
function
|
|
245
|
-
return m(
|
|
253
|
+
function F() {
|
|
254
|
+
return m(N);
|
|
246
255
|
}
|
|
247
256
|
//#endregion
|
|
248
257
|
//#region src/lib/hosts/DocsmintAppShellHost.svelte
|
|
249
|
-
var
|
|
250
|
-
function
|
|
258
|
+
var I = p.from_html("<div data-mobile-sidebar-edge=\"\" aria-hidden=\"true\" class=\"fixed inset-y-0 left-0 z-20 w-9 md:hidden\" style=\"touch-action: pan-y;\"></div>"), L = p.from_html("<button type=\"button\" tabindex=\"-1\" aria-label=\"Close navigation menu\" class=\"fixed inset-0 z-40 bg-black/50\"></button>"), R = p.from_html("<div class=\"flex h-screen\" data-docsmint-app-shell-host=\"\"><!> <main id=\"main-content\" class=\"relative flex-1 overflow-auto\"><!></main></div> <!> <!> <!>", 1), z = p.from_html("<!> <!>", 1);
|
|
259
|
+
function B(e, n) {
|
|
251
260
|
p.push(n, !0);
|
|
252
261
|
let a = p.prop(n, "request", 19, () => ({ fetch })), m = p.prop(n, "extensions", 19, () => ({}));
|
|
253
262
|
s({
|
|
@@ -257,33 +266,33 @@ function z(e, n) {
|
|
|
257
266
|
resolve: (e) => n.route.resolve(e),
|
|
258
267
|
navigate: (e, t) => n.route.navigate?.(e, t)
|
|
259
268
|
}), o({ fetch: async (...e) => {
|
|
260
|
-
let t = await a().fetch(...e), n =
|
|
261
|
-
return t.ok &&
|
|
269
|
+
let t = await a().fetch(...e), n = j(e[0], e[1]);
|
|
270
|
+
return t.ok && M(n) && (n.documents && u(), n.folders && l(), n.tags && d()), t;
|
|
262
271
|
} });
|
|
263
272
|
let h = _(() => n.realtime);
|
|
264
|
-
h &&
|
|
273
|
+
h && P(h), t({ get displayMode() {
|
|
265
274
|
return n.share?.displayMode ?? "standalone";
|
|
266
275
|
} }), c.init(), r.init();
|
|
267
|
-
let g = p.state(null), v = p.state(null), y = p.state(null), b = p.state(!1), w =
|
|
276
|
+
let g = p.state(null), v = p.state(null), y = p.state(null), b = p.state(!1), w = k();
|
|
268
277
|
function E(e) {
|
|
269
278
|
w.start({
|
|
270
279
|
x: e.clientX,
|
|
271
280
|
y: e.clientY
|
|
272
281
|
}), e.currentTarget.setPointerCapture(e.pointerId);
|
|
273
282
|
}
|
|
274
|
-
function
|
|
283
|
+
function A(e) {
|
|
275
284
|
w.move({
|
|
276
285
|
x: e.clientX,
|
|
277
286
|
y: e.clientY
|
|
278
287
|
}) === "open" && (e.preventDefault(), S());
|
|
279
288
|
}
|
|
280
|
-
function
|
|
289
|
+
function N(e) {
|
|
281
290
|
w.end({
|
|
282
291
|
x: e.clientX,
|
|
283
292
|
y: e.clientY
|
|
284
293
|
}) === "open" && S();
|
|
285
294
|
}
|
|
286
|
-
let
|
|
295
|
+
let F = [
|
|
287
296
|
"a[href]",
|
|
288
297
|
"button:not([disabled])",
|
|
289
298
|
"input:not([disabled])",
|
|
@@ -302,7 +311,7 @@ function z(e, n) {
|
|
|
302
311
|
if (!p.get(b) || !x.open || !p.get(v)) return;
|
|
303
312
|
let e = document.activeElement instanceof HTMLElement ? document.activeElement : p.get(y), t = document.body.style.overflow;
|
|
304
313
|
document.body.style.overflow = "hidden";
|
|
305
|
-
let n = () => Array.from(p.get(v)?.querySelectorAll(
|
|
314
|
+
let n = () => Array.from(p.get(v)?.querySelectorAll(F) ?? []).filter((e) => !e.hasAttribute("disabled")), r = (e) => {
|
|
306
315
|
let t = e.target instanceof Element ? e.target.closest("[role=\"dialog\"]") : null;
|
|
307
316
|
if (t && t !== p.get(v)) return;
|
|
308
317
|
if (e.key === "Escape") {
|
|
@@ -322,16 +331,16 @@ function z(e, n) {
|
|
|
322
331
|
(n().at(0) ?? p.get(v))?.focus();
|
|
323
332
|
});
|
|
324
333
|
return () => {
|
|
325
|
-
cancelAnimationFrame(i), document.removeEventListener("keydown", r), document.body.style.overflow = t, e
|
|
334
|
+
cancelAnimationFrame(i), document.removeEventListener("keydown", r), document.body.style.overflow = t, O(e, () => p.get(y), () => x.open);
|
|
326
335
|
};
|
|
327
336
|
});
|
|
328
|
-
var
|
|
329
|
-
f(
|
|
337
|
+
var B = z(), V = p.first_child(B);
|
|
338
|
+
f(V, {
|
|
330
339
|
get extensions() {
|
|
331
340
|
return m();
|
|
332
341
|
},
|
|
333
342
|
children: (e, t) => {
|
|
334
|
-
var r =
|
|
343
|
+
var r = R(), a = p.first_child(r), o = p.child(a);
|
|
335
344
|
i(o, {
|
|
336
345
|
get mobile() {
|
|
337
346
|
return p.get(b);
|
|
@@ -358,14 +367,14 @@ function z(e, n) {
|
|
|
358
367
|
}
|
|
359
368
|
});
|
|
360
369
|
var u = p.sibling(l, 2), d = (e) => {
|
|
361
|
-
var t =
|
|
362
|
-
p.delegated("pointerdown", t, E), p.delegated("pointermove", t,
|
|
370
|
+
var t = I();
|
|
371
|
+
p.delegated("pointerdown", t, E), p.delegated("pointermove", t, A), p.delegated("pointerup", t, N), p.event("pointercancel", t, () => w.cancel()), p.append(e, t);
|
|
363
372
|
};
|
|
364
373
|
p.if(u, (e) => {
|
|
365
374
|
p.get(b) && !x.open && e(d);
|
|
366
375
|
});
|
|
367
376
|
var f = p.sibling(u, 2), m = (e) => {
|
|
368
|
-
var t =
|
|
377
|
+
var t = L();
|
|
369
378
|
p.delegated("click", t, function(...e) {
|
|
370
379
|
C?.apply(this, e);
|
|
371
380
|
}), p.append(e, t);
|
|
@@ -376,7 +385,7 @@ function z(e, n) {
|
|
|
376
385
|
},
|
|
377
386
|
$$slots: { default: !0 }
|
|
378
387
|
});
|
|
379
|
-
var
|
|
388
|
+
var H = p.sibling(V, 2), U = (e) => {
|
|
380
389
|
{
|
|
381
390
|
let t = p.derived(() => n.route.pathname.startsWith("/docs/"));
|
|
382
391
|
D(e, {
|
|
@@ -389,9 +398,9 @@ function z(e, n) {
|
|
|
389
398
|
});
|
|
390
399
|
}
|
|
391
400
|
};
|
|
392
|
-
p.if(
|
|
393
|
-
c.showScrollToTop && e(
|
|
394
|
-
}), p.append(e,
|
|
401
|
+
p.if(H, (e) => {
|
|
402
|
+
c.showScrollToTop && e(U);
|
|
403
|
+
}), p.append(e, B), p.pop();
|
|
395
404
|
}
|
|
396
405
|
p.delegate([
|
|
397
406
|
"pointerdown",
|
|
@@ -400,4 +409,4 @@ p.delegate([
|
|
|
400
409
|
"click"
|
|
401
410
|
]);
|
|
402
411
|
//#endregion
|
|
403
|
-
export {
|
|
412
|
+
export { B as DocsmintAppShellHost, F as getDocsmintRealtimeAdapter, n as getDocsmintShareAdapter };
|