yamlover 0.3.4 → 0.3.5

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 (137) hide show
  1. package/bin/yamlover.js +199 -112
  2. package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  3. package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  4. package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  5. package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  6. package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  7. package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  8. package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  9. package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  10. package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  11. package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  12. package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  13. package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  14. package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  15. package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  16. package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  17. package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  18. package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  19. package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  20. package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  21. package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  22. package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  23. package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  24. package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  25. package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  26. package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  27. package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  28. package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  29. package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  30. package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  31. package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  32. package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  33. package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  34. package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  35. package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  36. package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  37. package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  38. package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  39. package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  40. package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  41. package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  42. package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  43. package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  44. package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  45. package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  46. package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  47. package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  48. package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  49. package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  50. package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  51. package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  52. package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  53. package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  54. package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  55. package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  56. package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  57. package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  58. package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  59. package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  60. package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  61. package/dist/client/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
  62. package/dist/client/assets/decoded-DRWSdzgb.js +1 -0
  63. package/dist/client/assets/djvu-CD0wXtTp.js +1 -0
  64. package/dist/client/assets/docx-BP_KsH_m.js +230 -0
  65. package/dist/client/assets/heic-B_4kLge_.js +66 -0
  66. package/dist/client/assets/imagemap-j0tV2wtS.js +1 -0
  67. package/dist/client/assets/index-BiwY33f2.js +617 -0
  68. package/dist/client/assets/index-wTjOzmSY.css +1 -0
  69. package/dist/client/assets/map-Cb9TTMM9.js +1 -0
  70. package/dist/client/assets/paged-DK_n72xc.js +1 -0
  71. package/dist/client/assets/panzoom-CIGW-MKW.css +1 -0
  72. package/dist/client/assets/panzoom-tORQ67Sx.js +4 -0
  73. package/dist/client/assets/pdf-DfMLV_Qu.js +12 -0
  74. package/dist/client/assets/pdf-m5e3jsV4.css +1 -0
  75. package/dist/client/assets/pdf.worker.min-qwK7q_zL.mjs +28 -0
  76. package/dist/client/assets/psd-CVyrW016.js +11 -0
  77. package/dist/client/assets/spreadsheet-QnPEhgjy.js +38 -0
  78. package/dist/client/assets/tiff-BswbwivW.js +1 -0
  79. package/{index.html → dist/client/index.html} +2 -1
  80. package/package.json +18 -21
  81. package/src/client/App.tsx +0 -424
  82. package/src/client/NodeView.tsx +0 -422
  83. package/src/client/TaskStrip.tsx +0 -34
  84. package/src/client/Tree.tsx +0 -97
  85. package/src/client/api.ts +0 -213
  86. package/src/client/icons.ts +0 -91
  87. package/src/client/links.tsx +0 -108
  88. package/src/client/live.ts +0 -42
  89. package/src/client/main.tsx +0 -10
  90. package/src/client/paste-html.ts +0 -228
  91. package/src/client/paste-links.ts +0 -42
  92. package/src/client/paths.ts +0 -139
  93. package/src/client/render.tsx +0 -339
  94. package/src/client/renderers/annotate.tsx +0 -641
  95. package/src/client/renderers/asciidoc.tsx +0 -36
  96. package/src/client/renderers/chapter.tsx +0 -142
  97. package/src/client/renderers/csv.tsx +0 -234
  98. package/src/client/renderers/decoded.tsx +0 -72
  99. package/src/client/renderers/djvu.tsx +0 -271
  100. package/src/client/renderers/djvuWorker.ts +0 -99
  101. package/src/client/renderers/doc.tsx +0 -40
  102. package/src/client/renderers/docx.tsx +0 -49
  103. package/src/client/renderers/epub.tsx +0 -147
  104. package/src/client/renderers/explorer.tsx +0 -294
  105. package/src/client/renderers/fb2.tsx +0 -149
  106. package/src/client/renderers/headings.ts +0 -69
  107. package/src/client/renderers/heic.tsx +0 -23
  108. package/src/client/renderers/imagemap.tsx +0 -170
  109. package/src/client/renderers/kml.ts +0 -46
  110. package/src/client/renderers/latex.tsx +0 -37
  111. package/src/client/renderers/map.tsx +0 -205
  112. package/src/client/renderers/marklower.tsx +0 -120
  113. package/src/client/renderers/markup.tsx +0 -64
  114. package/src/client/renderers/media.tsx +0 -19
  115. package/src/client/renderers/paged.ts +0 -137
  116. package/src/client/renderers/panzoom.ts +0 -101
  117. package/src/client/renderers/pdf.tsx +0 -316
  118. package/src/client/renderers/plaintext.tsx +0 -120
  119. package/src/client/renderers/plantuml.tsx +0 -83
  120. package/src/client/renderers/psd.tsx +0 -25
  121. package/src/client/renderers/registry.tsx +0 -411
  122. package/src/client/renderers/rtf.tsx +0 -210
  123. package/src/client/renderers/spreadsheet.tsx +0 -105
  124. package/src/client/renderers/tag.tsx +0 -113
  125. package/src/client/renderers/text.tsx +0 -42
  126. package/src/client/renderers/tiff.tsx +0 -33
  127. package/src/client/styles.css +0 -1212
  128. package/src/client/vendor/README.md +0 -30
  129. package/src/client/vite-env.d.ts +0 -31
  130. package/src/server/api.ts +0 -147
  131. package/src/server/embed.ts +0 -187
  132. package/src/server/engine-api.ts +0 -1563
  133. package/src/server/gitignore.ts +0 -81
  134. package/src/server/node-kind.ts +0 -61
  135. package/src/server/tasks.ts +0 -83
  136. package/src/server/yamlover.ts +0 -1133
  137. /package/{src/client/vendor/djvu.js → dist/client/assets/djvu-Ci0lFKxE.js} +0 -0
@@ -1,81 +0,0 @@
1
- /**
2
- * gitignore.ts — a predicate telling whether an absolute path is git-ignored.
3
- *
4
- * It honors `.gitignore` files from the repository root down to the file's
5
- * parent (nested `.gitignore`s included), plus an always-ignored `.git`. Built
6
- * once per server and handed to the materializer (see `setIgnoreFilter`), it only
7
- * filters *undescribed* (stray) entries — schema-described children are always
8
- * kept.
9
- */
10
-
11
- import fs from "node:fs";
12
- import path from "node:path";
13
- import ignore, { type Ignore } from "ignore";
14
-
15
- export function buildGitIgnore(dataRoot: string): (absPath: string) => boolean {
16
- const gitRoot = findGitRoot(dataRoot) ?? dataRoot;
17
- const cache = new Map<string, Ignore | null>(); // dir → its .gitignore matcher
18
-
19
- const matcherFor = (dir: string): Ignore | null => {
20
- if (!cache.has(dir)) {
21
- let ig: Ignore | null = null;
22
- try {
23
- const gi = path.join(dir, ".gitignore");
24
- if (fs.statSync(gi).isFile()) ig = ignore().add(fs.readFileSync(gi, "utf-8"));
25
- } catch {
26
- /* no .gitignore here */
27
- }
28
- cache.set(dir, ig);
29
- }
30
- return cache.get(dir)!;
31
- };
32
-
33
- return (absPath: string): boolean => {
34
- const fromRoot = path.relative(gitRoot, absPath);
35
- if (fromRoot === ".git" || fromRoot.startsWith(".git" + path.sep)) return true;
36
-
37
- // A directory must be tested with a trailing slash, otherwise a `dir/`
38
- // pattern (e.g. `node_modules/`) does not match the bare name.
39
- let isDir = false;
40
- try {
41
- isDir = fs.statSync(absPath).isDirectory();
42
- } catch {
43
- /* gone */
44
- }
45
-
46
- // Test the path against every .gitignore from the repo root down to its
47
- // parent directory; each file's patterns are relative to its own location.
48
- const rel = path.relative(gitRoot, path.dirname(absPath));
49
- const segs = rel === "" ? [] : rel.split(path.sep);
50
- let dir = gitRoot;
51
- const dirs = [gitRoot];
52
- for (const s of segs) {
53
- dir = path.join(dir, s);
54
- dirs.push(dir);
55
- }
56
- for (const d of dirs) {
57
- const ig = matcherFor(d);
58
- if (!ig) continue;
59
- const relToDir = path.relative(d, absPath);
60
- if (!relToDir) continue;
61
- if (ig.ignores(relToDir) || (isDir && ig.ignores(relToDir + "/"))) return true;
62
- }
63
- return false;
64
- };
65
- }
66
-
67
- function findGitRoot(start: string): string | null {
68
- let dir = path.resolve(start);
69
- // If start is a file, begin at its directory.
70
- try {
71
- if (!fs.statSync(dir).isDirectory()) dir = path.dirname(dir);
72
- } catch {
73
- return null;
74
- }
75
- for (;;) {
76
- if (fs.existsSync(path.join(dir, ".git"))) return dir;
77
- const parent = path.dirname(dir);
78
- if (parent === dir) return null;
79
- dir = parent;
80
- }
81
- }
@@ -1,61 +0,0 @@
1
- // Node-KIND classification — how a Store node is presented (the `type:` the client routes on). Kept
2
- // in its own module (no http/fs/gitignore deps) so it can be unit-tested under `node --test` against
3
- // a Store, independently of the HTTP layer (engine-api.ts), which only Vite can load (node:sqlite).
4
- import type { NodeRow, Store } from "../../../engine/ts/src/index.ts";
5
-
6
- // One ordered container, classified for display: a pure-keyed mapping is `object`, a pure-keyless
7
- // one `array`; a mapping mixing keyed + keyless OWNED entries is `mix`; a scalar/blob that ALSO
8
- // carries OWNED fields is `omni` (the `!!mix`/`!!var` shapes); plain scalars/blobs are
9
- // `scalar`/`binary`.
10
- export type Kind = "object" | "array" | "scalar" | "binary" | "omni" | "mix";
11
-
12
- /** A node's OWNED entries — the ones it authors, that constitute its content: containment children
13
- * and forward `*` refs. A `~` back-edge (a REVERSE member, e.g. tag membership) is an upstream
14
- * relation the node does NOT own, so it is excluded — it must not change the node's type. */
15
- export function ownedEntries(s: Store, p: string): ReturnType<Store["entries"]> {
16
- return s.entries(p).filter((e) => e.kind !== "back");
17
- }
18
-
19
- /** A node's display {@link Kind}. A scalar/blob carrying OWNED fields is `omni`; a mapping that
20
- * mixes keyed and keyless OWNED entries is `mix`; otherwise object|array|scalar|binary. The
21
- * `is_array` flag marks a pure-keyless container. Reverse (`~`) members never count — a tagged PDF
22
- * is still a `binary`, not an `omni` (they are upstream relations, not owned content). */
23
- export function displayKind(s: Store, p: string, row: NodeRow): Kind {
24
- const ents = ownedEntries(s, p);
25
- if (row.type === "blob") return ents.length ? "omni" : "binary";
26
- if (row.type === "scalar") return ents.length ? "omni" : "scalar";
27
- if (!ents.length) return row.is_array ? "array" : "object"; // empty container
28
- if (row.is_array) return "array";
29
- return ents.some((e) => e.label === null) ? "mix" : "object";
30
- }
31
-
32
- // Internal kind → the JSON-Schema-style `type:` name shown in the header/TOC and the schema view.
33
- // The YAML-tag shapes `!!mix`/`!!var` get full-word schema names (cf. !!seq→array, !!map→object):
34
- // `mix` → "mixed", `omni` → "variant". Scalars resolve to their JSON-ish primitive type.
35
- export function typeName(s: Store, p: string, row: NodeRow): string {
36
- const k = displayKind(s, p, row);
37
- if (k === "scalar") return scalarType(row.value);
38
- if (k === "mix") return "mixed";
39
- if (k === "omni") return "variant";
40
- return k; // object | array | binary
41
- }
42
-
43
- export function scalarType(v: unknown): string {
44
- if (v === null) return "null";
45
- if (typeof v === "boolean") return "boolean";
46
- if (typeof v === "number") return Number.isInteger(v) ? "integer" : "number";
47
- return "string";
48
- }
49
-
50
- /** The three TYPE FACETS the client dispatches on (TYPES.md §1): the scalar self-VALUE's type
51
- * (`null|boolean|integer|number|string|binary`, or null when there is no value facet), and
52
- * whether the node OWNS any KEYED / ORDINAL (keyless) elements. Reverse `~` members are excluded
53
- * (ownedEntries) — a tagged node keeps its facets, so a renderer can tolerate the extra keys. */
54
- export function facetsOf(s: Store, p: string, row: NodeRow): { valueType: string | null; hasKeyed: boolean; hasOrdinal: boolean } {
55
- const ents = ownedEntries(s, p);
56
- return {
57
- valueType: row.type === "scalar" ? scalarType(row.value) : row.type === "blob" ? "binary" : null,
58
- hasKeyed: ents.some((e) => e.label !== null),
59
- hasOrdinal: ents.some((e) => e.label === null),
60
- };
61
- }
@@ -1,83 +0,0 @@
1
- // tasks.ts — the server's LONG-RUNNING TASK registry. Anything slow (the initial index, the
2
- // background hasher, a watcher reconcile, …) registers here and reports progress; every state
3
- // change is emitted (engine-api pushes it to the UI over the existing /api/events SSE stream
4
- // as a `{type:"task", task}` frame) and GET /api/tasks snapshots in-flight tasks for a freshly
5
- // loaded page. Generic on purpose: a future slow operation is just `registry.start(label)`.
6
-
7
- export interface TaskProgress {
8
- done: number;
9
- total?: number; // absent ⇒ indeterminate (the UI shows an activity bar, not a percent)
10
- message?: string; // human-readable detail (current path, "writing index…", …)
11
- }
12
-
13
- export interface TaskInfo {
14
- id: string;
15
- label: string;
16
- state: "running" | "done" | "error";
17
- progress: TaskProgress;
18
- startedAt: number; // epoch ms
19
- finishedAt?: number;
20
- error?: string;
21
- }
22
-
23
- export interface TaskHandle {
24
- readonly id: string;
25
- /** Report progress. Throttled (state changes are not) so a per-file caller cannot flood SSE. */
26
- progress(done: number, total?: number, message?: string): void;
27
- done(): void;
28
- fail(err: unknown): void;
29
- }
30
-
31
- const PROGRESS_EMIT_MS = 150; // at most one progress frame per task per this interval
32
- const KEEP_FINISHED_MS = 5_000; // finished tasks stay listed briefly so completion is visible
33
-
34
- export class TaskRegistry {
35
- private seq = 0;
36
- private readonly tasks = new Map<string, TaskInfo>();
37
- private readonly lastEmit = new Map<string, number>();
38
-
39
- constructor(private readonly emit: (t: TaskInfo) => void) {}
40
-
41
- start(label: string): TaskHandle {
42
- const id = "t" + ++this.seq;
43
- const info: TaskInfo = { id, label, state: "running", progress: { done: 0 }, startedAt: Date.now() };
44
- this.tasks.set(id, info);
45
- this.send(info, true);
46
- const finish = (state: "done" | "error", error?: string): void => {
47
- if (info.state !== "running") return; // done/fail are one-shot
48
- info.state = state;
49
- info.finishedAt = Date.now();
50
- if (error !== undefined) info.error = error;
51
- this.send(info, true);
52
- };
53
- return {
54
- id,
55
- progress: (done, total, message) => {
56
- if (info.state !== "running") return;
57
- info.progress = { done, ...(total !== undefined && { total }), ...(message !== undefined && { message }) };
58
- this.send(info, false);
59
- },
60
- done: () => finish("done"),
61
- fail: (err) => finish("error", String((err as Error)?.message ?? err)),
62
- };
63
- }
64
-
65
- /** Running tasks + ones finished within the last few seconds (pruning the rest). */
66
- list(): TaskInfo[] {
67
- const now = Date.now();
68
- for (const [id, t] of this.tasks) {
69
- if (t.state !== "running" && now - (t.finishedAt ?? 0) > KEEP_FINISHED_MS) {
70
- this.tasks.delete(id);
71
- this.lastEmit.delete(id);
72
- }
73
- }
74
- return [...this.tasks.values()].map((t) => ({ ...t, progress: { ...t.progress } }));
75
- }
76
-
77
- private send(t: TaskInfo, always: boolean): void {
78
- const now = Date.now();
79
- if (!always && now - (this.lastEmit.get(t.id) ?? 0) < PROGRESS_EMIT_MS) return;
80
- this.lastEmit.set(t.id, now);
81
- this.emit({ ...t, progress: { ...t.progress } });
82
- }
83
- }