@hiai-gg/docsmint 0.5.8 → 0.6.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.
Files changed (45) hide show
  1. package/LICENSE +39 -8
  2. package/README.md +67 -43
  3. package/dist/backend/index.js +53 -14
  4. package/dist/client.d.ts +3 -1
  5. package/dist/client.js +2 -0
  6. package/dist/frontend/{CategoryDialog-BYAFjX7E.js → CategoryDialog-CbXBMBZB.js} +3 -3
  7. package/dist/frontend/HiAiEditor-DSVG3GNd.js +2986 -0
  8. package/dist/frontend/SettingsDialog-BDNgf5rv.js +969 -0
  9. package/dist/frontend/ShareDialog-2Mty7hm4.js +258 -0
  10. package/dist/frontend/{Sidebar-B-zCJT9i.js → Sidebar-DX08utdV.js} +15 -15
  11. package/dist/frontend/app-shell.js +122 -65
  12. package/dist/frontend/components/category-dialog.js +1 -1
  13. package/dist/frontend/components/editor/compact-editor.d.ts +3 -0
  14. package/dist/frontend/components/editor/compact-editor.js +36 -0
  15. package/dist/frontend/components/editor/document-editor.js +2 -2986
  16. package/dist/frontend/components/settings.js +1 -1
  17. package/dist/frontend/components/share-dialog.d.ts +2 -1
  18. package/dist/frontend/components/share-dialog.js +1 -1
  19. package/dist/frontend/components/sidebar.js +1 -1
  20. package/dist/frontend/dashboard.js +1 -1
  21. package/dist/frontend/editor-preferences.d.ts +4 -0
  22. package/dist/frontend/editor-preferences.js +2 -0
  23. package/dist/frontend/editor-preferences.svelte-Bt_A9k7n.js +61 -0
  24. package/dist/frontend/frontend.css +1 -1
  25. package/dist/frontend-ssr/app-shell.js +46 -2
  26. package/dist/frontend-ssr/assets/{CategoryDialog-BLxVoynx.js → CategoryDialog-QHEv_9N4.js} +4 -4
  27. package/dist/frontend-ssr/assets/HiAiEditor-CUOJmKzT.js +2358 -0
  28. package/dist/frontend-ssr/assets/{SettingsDialog-DVp0OxPO.js → SettingsDialog-BjJIiVLc.js} +2 -64
  29. package/dist/frontend-ssr/assets/{ShareDialog-BZd28sg-.js → ShareDialog-C9C-XTm4.js} +1 -1
  30. package/dist/frontend-ssr/assets/{Sidebar-CO9LZRPa.js → Sidebar-C2sUfGNk.js} +18 -18
  31. package/dist/frontend-ssr/assets/editor-preferences.svelte-iI5jJM1x.js +65 -0
  32. package/dist/frontend-ssr/components/category-dialog.js +1 -1
  33. package/dist/frontend-ssr/components/editor/compact-editor.js +19 -0
  34. package/dist/frontend-ssr/components/editor/document-editor.js +1 -2357
  35. package/dist/frontend-ssr/components/settings.js +1 -1
  36. package/dist/frontend-ssr/components/share-dialog.js +1 -1
  37. package/dist/frontend-ssr/components/sidebar.js +1 -1
  38. package/dist/frontend-ssr/dashboard.js +1 -1
  39. package/dist/frontend-ssr/editor-preferences.js +2 -0
  40. package/dist/types.d.ts +5 -0
  41. package/package.json +16 -2
  42. package/packages/cli/src/index.ts +1 -1
  43. package/packages/mcp-server/src/index.ts +1 -1
  44. package/dist/frontend/SettingsDialog-CyZSOjLE.js +0 -1024
  45. package/dist/frontend/ShareDialog-BC-Jl6v1.js +0 -257
@@ -1,8 +1,9 @@
1
1
  import { t as e } from "./Icon-Db-o32_E.js";
2
- import { n as t, r as n } from "./SettingsDialog-CyZSOjLE.js";
3
- import { t as r } from "./Sidebar-B-zCJT9i.js";
4
- import { D as i } from "./messages-DIovIZrK.js";
5
- import { o as a, r as o } from "./route-context-DYQlUfzL.js";
2
+ import { n as t } from "./SettingsDialog-BDNgf5rv.js";
3
+ import { t as n } from "./Sidebar-DX08utdV.js";
4
+ import { D as r } from "./messages-DIovIZrK.js";
5
+ import { o as i, r as a } from "./route-context-DYQlUfzL.js";
6
+ import { t as o } from "./editor-preferences.svelte-Bt_A9k7n.js";
6
7
  import { d as s } from "./subfolders-refresh-store.svelte-DxP21a1c.js";
7
8
  import { a as c, o as l } from "./tag-store.svelte-ogVCMCbv.js";
8
9
  import { t as u } from "./HiaiDocsExtensionProvider-OSn96BBw.js";
@@ -67,12 +68,15 @@ var v = d.state(!1), y = {
67
68
  }
68
69
  };
69
70
  function b() {
71
+ d.set(v, !0);
72
+ }
73
+ function x() {
70
74
  d.set(v, !1);
71
75
  }
72
76
  //#endregion
73
77
  //#region src/lib/components/MobileSidebarToggle.svelte
74
- var x = d.from_html("<button type=\"button\" class=\"mobile-sidebar-toggle fixed left-3 top-3 flex size-11 items-center justify-center rounded-md border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-accent md:hidden\" style=\"top: calc(0.75rem + env(safe-area-inset-top));\"><!></button>");
75
- function S(e, t) {
78
+ var S = d.from_html("<button type=\"button\" class=\"mobile-sidebar-toggle fixed left-3 top-3 flex size-11 items-center justify-center rounded-md border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-accent md:hidden\" style=\"top: calc(0.75rem + env(safe-area-inset-top));\"><!></button>");
79
+ function C(e, t) {
76
80
  d.push(t, !0);
77
81
  let n = d.prop(t, "buttonRef", 15, null), r = d.prop(t, "controls", 3, "mobile-navigation"), i = d.state(!1);
78
82
  function a() {
@@ -95,7 +99,7 @@ function S(e, t) {
95
99
  y.toggle();
96
100
  }
97
101
  var s = d.comment(), c = d.first_child(s), l = (e) => {
98
- var t = x();
102
+ var t = S();
99
103
  _(d.child(t), { class: "size-5" }), d.reset(t), d.bind_this(t, (e) => n(e), () => n()), d.template_effect(() => {
100
104
  d.set_attribute(t, "aria-label", y.open ? "Close navigation menu" : "Open navigation menu"), d.set_attribute(t, "aria-expanded", y.open), d.set_attribute(t, "aria-controls", r());
101
105
  }), d.delegated("click", t, o), d.append(e, t);
@@ -107,12 +111,12 @@ function S(e, t) {
107
111
  d.delegate(["click"]);
108
112
  //#endregion
109
113
  //#region src/lib/components/ScrollToTop.svelte
110
- var C = d.from_html("<button type=\"button\"><!></button>");
111
- function w(e, t) {
114
+ var w = d.from_html("<button type=\"button\"><!></button>");
115
+ function T(e, t) {
112
116
  d.push(t, !0);
113
- let n = d.prop(t, "avoidEditorToolbar", 3, !1), r = d.state(!1), a = null, o = d.state("none"), s = d.state(void 0);
117
+ let n = d.prop(t, "avoidEditorToolbar", 3, !1), i = d.state(!1), a = null, o = d.state("none"), s = d.state(void 0);
114
118
  function c() {
115
- d.set(r, (a ? a.scrollTop : window.scrollY) > 300);
119
+ d.set(i, (a ? a.scrollTop : window.scrollY) > 300);
116
120
  }
117
121
  function l() {
118
122
  a ? a.scrollTo({
@@ -137,7 +141,7 @@ function w(e, t) {
137
141
  window.removeEventListener("scroll", c);
138
142
  });
139
143
  }), p(() => {
140
- f(), d.set(r, !1);
144
+ f(), d.set(i, !1);
141
145
  }), d.user_effect(() => {
142
146
  if (!n() || typeof document > "u") {
143
147
  d.set(o, "none"), d.set(s, void 0);
@@ -169,33 +173,55 @@ function w(e, t) {
169
173
  t.disconnect(), r.disconnect(), window.removeEventListener("resize", e);
170
174
  };
171
175
  });
172
- var m = C();
176
+ var m = w();
173
177
  let h, _;
174
178
  g(d.child(m), { class: "size-5" }), d.reset(m), d.template_effect((e, t) => {
175
- h = d.set_class(m, 1, `scroll-to-top fixed bottom-6 right-6 z-50 inline-flex size-10 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-md transition-all hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${d.get(r) ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`, null, h, {
179
+ h = d.set_class(m, 1, `scroll-to-top fixed bottom-6 right-6 z-50 inline-flex size-10 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-md transition-all hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${d.get(i) ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`, null, h, {
176
180
  "above-editor-toolbar": d.get(o) === "toolbar",
177
181
  "below-editor-fab": d.get(o) === "fab"
178
182
  }), d.set_attribute(m, "aria-label", e), d.set_attribute(m, "title", t), _ = d.set_style(m, "", _, { bottom: d.get(s) });
179
- }, [() => i(), () => i()]), d.delegated("click", m, l), d.append(e, m), d.pop();
183
+ }, [() => r(), () => r()]), d.delegated("click", m, l), d.append(e, m), d.pop();
180
184
  }
181
185
  d.delegate(["click"]);
182
186
  //#endregion
187
+ //#region src/lib/stores/mobile-sidebar-gesture.ts
188
+ function E(e = {}) {
189
+ let t = e.edgeWidth ?? 36, n = e.openDistance ?? 40, r = e.scrollTolerance ?? 12, i = null, a = !1;
190
+ return {
191
+ start(e) {
192
+ return i = e.x <= t ? e : null, a = !1, i ? "tracking" : "idle";
193
+ },
194
+ move(e) {
195
+ if (!i || a) return a ? "cancelled" : "idle";
196
+ let t = e.x - i.x, o = Math.abs(e.y - i.y);
197
+ return o > r && o > Math.abs(t) ? (a = !0, "cancelled") : t >= n && o <= Math.max(r * 2, t) ? (i = null, "open") : "tracking";
198
+ },
199
+ end(e) {
200
+ let t = this.move(e);
201
+ return i = null, a = !1, t === "open" ? "open" : "idle";
202
+ },
203
+ cancel() {
204
+ i = null, a = !1;
205
+ }
206
+ };
207
+ }
208
+ //#endregion
183
209
  //#region src/lib/hosts/mutation-refresh.ts
184
- var T = {
210
+ var D = {
185
211
  documents: !1,
186
212
  folders: !1,
187
213
  tags: !1
188
214
  };
189
- function E(e, t) {
215
+ function O(e, t) {
190
216
  let n = (t?.method ?? (e instanceof Request ? e.method : "GET")).toUpperCase();
191
217
  if (![
192
218
  "POST",
193
219
  "PUT",
194
220
  "PATCH",
195
221
  "DELETE"
196
- ].includes(n)) return T;
222
+ ].includes(n)) return D;
197
223
  let r = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, i = new URL(r, "http://docsmint.local").pathname;
198
- return /\/keys(?:\/|$)/.test(i) ? T : /^\/api\/(?:v1\/)?tags(?:\/|$)/.test(i) || /^\/api\/(?:v1\/)?documents\/[^/]+\/tags(?:\/|$)/.test(i) ? {
224
+ return /\/keys(?:\/|$)/.test(i) ? D : /^\/api\/(?:v1\/)?tags(?:\/|$)/.test(i) || /^\/api\/(?:v1\/)?documents\/[^/]+\/tags(?:\/|$)/.test(i) ? {
199
225
  documents: !0,
200
226
  folders: !1,
201
227
  tags: !0
@@ -203,39 +229,58 @@ function E(e, t) {
203
229
  documents: !0,
204
230
  folders: !0,
205
231
  tags: !1
206
- } : T;
232
+ } : D;
207
233
  }
208
- function D(e) {
234
+ function k(e) {
209
235
  return e.documents || e.folders || e.tags;
210
236
  }
211
237
  //#endregion
212
238
  //#region src/lib/hosts/realtime-context.ts
213
- var O = Symbol("docsmint-realtime-adapter");
214
- function k(e) {
215
- m(O, e);
239
+ var A = Symbol("docsmint-realtime-adapter");
240
+ function j(e) {
241
+ m(A, e);
216
242
  }
217
- function A() {
218
- return f(O);
243
+ function M() {
244
+ return f(A);
219
245
  }
220
246
  //#endregion
221
247
  //#region src/lib/hosts/DocsmintAppShellHost.svelte
222
- var j = d.from_html("<button type=\"button\" tabindex=\"-1\" aria-label=\"Close navigation menu\" class=\"fixed inset-0 z-40 bg-black/50\"></button>"), M = d.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), N = d.from_html("<!> <!>", 1);
223
- function P(e, i) {
224
- d.push(i, !0);
225
- let f = d.prop(i, "request", 19, () => ({ fetch })), p = d.prop(i, "extensions", 19, () => ({}));
226
- o({
248
+ var N = d.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>"), P = d.from_html("<button type=\"button\" tabindex=\"-1\" aria-label=\"Close navigation menu\" class=\"fixed inset-0 z-40 bg-black/50\"></button>"), F = d.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), I = d.from_html("<!> <!>", 1);
249
+ function L(e, r) {
250
+ d.push(r, !0);
251
+ let f = d.prop(r, "request", 19, () => ({ fetch })), p = d.prop(r, "extensions", 19, () => ({}));
252
+ a({
227
253
  get pathname() {
228
- return i.route.pathname;
254
+ return r.route.pathname;
229
255
  },
230
- resolve: (e) => i.route.resolve(e),
231
- navigate: (e, t) => i.route.navigate?.(e, t)
232
- }), a({ fetch: async (...e) => {
233
- let t = await f().fetch(...e), n = E(e[0], e[1]);
234
- return t.ok && D(n) && (n.documents && c(), n.folders && s(), n.tags && l()), t;
256
+ resolve: (e) => r.route.resolve(e),
257
+ navigate: (e, t) => r.route.navigate?.(e, t)
258
+ }), i({ fetch: async (...e) => {
259
+ let t = await f().fetch(...e), n = O(e[0], e[1]);
260
+ return t.ok && k(n) && (n.documents && c(), n.folders && s(), n.tags && l()), t;
235
261
  } });
236
- let m = h(() => i.realtime);
237
- m && k(m), n.init(), t.init();
238
- let g = d.state(null), _ = d.state(null), v = d.state(null), x = d.state(!1), C = [
262
+ let m = h(() => r.realtime);
263
+ m && j(m), o.init(), t.init();
264
+ let g = d.state(null), _ = d.state(null), v = d.state(null), S = d.state(!1), w = E();
265
+ function D(e) {
266
+ w.start({
267
+ x: e.clientX,
268
+ y: e.clientY
269
+ }), e.currentTarget.setPointerCapture(e.pointerId);
270
+ }
271
+ function A(e) {
272
+ w.move({
273
+ x: e.clientX,
274
+ y: e.clientY
275
+ }) === "open" && (e.preventDefault(), b());
276
+ }
277
+ function M(e) {
278
+ w.end({
279
+ x: e.clientX,
280
+ y: e.clientY
281
+ }) === "open" && b();
282
+ }
283
+ let L = [
239
284
  "a[href]",
240
285
  "button:not([disabled])",
241
286
  "input:not([disabled])",
@@ -245,20 +290,20 @@ function P(e, i) {
245
290
  ].join(",");
246
291
  d.user_effect(() => {
247
292
  let e = window.matchMedia("(max-width: 767px)"), t = () => {
248
- d.set(x, e.matches, !0), d.get(x) || b();
293
+ d.set(S, e.matches, !0), d.get(S) || x();
249
294
  };
250
295
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
251
296
  }), d.user_effect(() => {
252
- i.route.pathname, b();
297
+ r.route.pathname, x();
253
298
  }), d.user_effect(() => {
254
- if (!d.get(x) || !y.open || !d.get(_)) return;
299
+ if (!d.get(S) || !y.open || !d.get(_)) return;
255
300
  let e = document.activeElement instanceof HTMLElement ? document.activeElement : d.get(v), t = document.body.style.overflow;
256
301
  document.body.style.overflow = "hidden";
257
- let n = () => Array.from(d.get(_)?.querySelectorAll(C) ?? []).filter((e) => !e.hasAttribute("disabled")), r = (e) => {
302
+ let n = () => Array.from(d.get(_)?.querySelectorAll(L) ?? []).filter((e) => !e.hasAttribute("disabled")), r = (e) => {
258
303
  let t = e.target instanceof Element ? e.target.closest("[role=\"dialog\"]") : null;
259
304
  if (t && t !== d.get(_)) return;
260
305
  if (e.key === "Escape") {
261
- e.preventDefault(), b();
306
+ e.preventDefault(), x();
262
307
  return;
263
308
  }
264
309
  if (e.key !== "Tab") return;
@@ -277,16 +322,16 @@ function P(e, i) {
277
322
  cancelAnimationFrame(i), document.removeEventListener("keydown", r), document.body.style.overflow = t, e?.isConnected && e.focus();
278
323
  };
279
324
  });
280
- var T = N(), O = d.first_child(T);
281
- u(O, {
325
+ var R = I(), z = d.first_child(R);
326
+ u(z, {
282
327
  get extensions() {
283
328
  return p();
284
329
  },
285
330
  children: (e, t) => {
286
- var n = M(), a = d.first_child(n), o = d.child(a);
287
- r(o, {
331
+ var i = F(), a = d.first_child(i), o = d.child(a);
332
+ n(o, {
288
333
  get mobile() {
289
- return d.get(x);
334
+ return d.get(S);
290
335
  },
291
336
  get mobileOpen() {
292
337
  return y.open;
@@ -299,9 +344,9 @@ function P(e, i) {
299
344
  }
300
345
  });
301
346
  var s = d.sibling(o, 2), c = d.child(s);
302
- d.snippet(c, () => i.children), d.reset(s), d.bind_this(s, (e) => d.set(g, e), () => d.get(g)), d.reset(a);
347
+ d.snippet(c, () => r.children), d.reset(s), d.bind_this(s, (e) => d.set(g, e), () => d.get(g)), d.reset(a);
303
348
  var l = d.sibling(a, 2);
304
- S(l, {
349
+ C(l, {
305
350
  get buttonRef() {
306
351
  return d.get(v);
307
352
  },
@@ -310,21 +355,28 @@ function P(e, i) {
310
355
  }
311
356
  });
312
357
  var u = d.sibling(l, 2), f = (e) => {
313
- var t = j();
358
+ var t = N();
359
+ d.delegated("pointerdown", t, D), d.delegated("pointermove", t, A), d.delegated("pointerup", t, M), d.event("pointercancel", t, () => w.cancel()), d.append(e, t);
360
+ };
361
+ d.if(u, (e) => {
362
+ d.get(S) && !y.open && e(f);
363
+ });
364
+ var p = d.sibling(u, 2), m = (e) => {
365
+ var t = P();
314
366
  d.delegated("click", t, function(...e) {
315
- b?.apply(this, e);
367
+ x?.apply(this, e);
316
368
  }), d.append(e, t);
317
369
  };
318
- d.if(u, (e) => {
319
- d.get(x) && y.open && e(f);
320
- }), d.template_effect(() => s.inert = d.get(x) && y.open), d.append(e, n);
370
+ d.if(p, (e) => {
371
+ d.get(S) && y.open && e(m);
372
+ }), d.template_effect(() => s.inert = d.get(S) && y.open), d.append(e, i);
321
373
  },
322
374
  $$slots: { default: !0 }
323
375
  });
324
- var A = d.sibling(O, 2), P = (e) => {
376
+ var B = d.sibling(z, 2), V = (e) => {
325
377
  {
326
- let t = d.derived(() => i.route.pathname.startsWith("/docs/"));
327
- w(e, {
378
+ let t = d.derived(() => r.route.pathname.startsWith("/docs/"));
379
+ T(e, {
328
380
  get scrollTarget() {
329
381
  return d.get(g);
330
382
  },
@@ -334,10 +386,15 @@ function P(e, i) {
334
386
  });
335
387
  }
336
388
  };
337
- d.if(A, (e) => {
338
- n.showScrollToTop && e(P);
339
- }), d.append(e, T), d.pop();
389
+ d.if(B, (e) => {
390
+ o.showScrollToTop && e(V);
391
+ }), d.append(e, R), d.pop();
340
392
  }
341
- d.delegate(["click"]);
393
+ d.delegate([
394
+ "pointerdown",
395
+ "pointermove",
396
+ "pointerup",
397
+ "click"
398
+ ]);
342
399
  //#endregion
343
- export { P as DocsmintAppShellHost, A as getDocsmintRealtimeAdapter };
400
+ export { L as DocsmintAppShellHost, M as getDocsmintRealtimeAdapter };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../CategoryDialog-BYAFjX7E.js";
1
+ import { t as e } from "../CategoryDialog-CbXBMBZB.js";
2
2
  export { e as CategoryDialog };
@@ -0,0 +1,3 @@
1
+ import type { Component } from "svelte";
2
+ export interface EditorOutput { markdown: string; json: object; }
3
+ export declare const CompactEditor: Component<{ content?: string; contentJson?: object; placeholder?: string; onUpdate?: (output: EditorOutput) => void; editable?: boolean; documentId?: string; documentUpdatedAt?: string; }>;
@@ -0,0 +1,36 @@
1
+ import { t as e } from "../../HiAiEditor-DSVG3GNd.js";
2
+ import "svelte/internal/disclose-version";
3
+ import * as t from "svelte/internal/client";
4
+ //#region src/lib/components/editor/CompactEditor.svelte
5
+ function n(n, r) {
6
+ let i = t.prop(r, "content", 3, ""), a = t.prop(r, "onUpdate", 3, (e) => {}), o = t.prop(r, "editable", 3, !0), s = t.prop(r, "collaboration", 3, null), c = t.prop(r, "documentId", 3, ""), l = t.prop(r, "documentUpdatedAt", 3, "");
7
+ e(n, {
8
+ get content() {
9
+ return i();
10
+ },
11
+ get contentJson() {
12
+ return r.contentJson;
13
+ },
14
+ get placeholder() {
15
+ return r.placeholder;
16
+ },
17
+ get onUpdate() {
18
+ return a();
19
+ },
20
+ get editable() {
21
+ return o();
22
+ },
23
+ get collaboration() {
24
+ return s();
25
+ },
26
+ get documentId() {
27
+ return c();
28
+ },
29
+ get documentUpdatedAt() {
30
+ return l();
31
+ },
32
+ minimalToolbar: !0
33
+ });
34
+ }
35
+ //#endregion
36
+ export { n as CompactEditor };