isorite 0.9.1 → 0.11.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 (125) hide show
  1. package/dist/core.js +175 -14
  2. package/dist/main.js +1217 -52
  3. package/notes/algorithms/the-quadtree/subdivision.svg +15 -0
  4. package/notes/algorithms/the-quadtree.md +2 -0
  5. package/package.json +2 -1
  6. package/plugin/server.ts +1 -1
  7. package/web/_app/immutable/assets/{0.CTbO0owi.css → 0.DcsDj0O1.css} +1 -1
  8. package/web/_app/immutable/assets/5.DbDKXCoO.css +1 -0
  9. package/web/_app/immutable/assets/NoteEditor.S3q5lmKq.css +1 -0
  10. package/web/_app/immutable/assets/drawn.CHbcoujQ.css +1 -0
  11. package/web/_app/immutable/chunks/{8wVGBFSs.js → -2Meesge.js} +3 -3
  12. package/web/_app/immutable/chunks/{BL3mLym4.js → 9z49435t.js} +1 -1
  13. package/web/_app/immutable/chunks/{DMAYXnpq.js → BA8Hpxhg.js} +1 -1
  14. package/web/_app/immutable/chunks/{CKSRTWxH.js → BAclEN0O.js} +1 -1
  15. package/web/_app/immutable/chunks/{DECNRCf2.js → BLmF1B2i.js} +1 -1
  16. package/web/_app/immutable/chunks/{CiVjR8gq.js → BTclWEfx.js} +1 -1
  17. package/web/_app/immutable/chunks/{Cp_JbuGh.js → BWVMfAMh.js} +1 -1
  18. package/web/_app/immutable/chunks/{D4fLEcOQ.js → BXAOBcPb.js} +1 -1
  19. package/web/_app/immutable/chunks/BYSDTLqw.js +1 -0
  20. package/web/_app/immutable/chunks/{DDuWClBR.js → BgT6ZdzK.js} +1 -1
  21. package/web/_app/immutable/chunks/{CO2Y5y64.js → Bq2GBAJ0.js} +1 -1
  22. package/web/_app/immutable/chunks/BqrMZ9MX.js +1 -0
  23. package/web/_app/immutable/chunks/{BN6xhG8e.js → Bt7VOT5H.js} +1 -1
  24. package/web/_app/immutable/chunks/{BGbXxNFa.js → BuUzVkG2.js} +1 -1
  25. package/web/_app/immutable/chunks/{Brxvm_b1.js → By4S_gy5.js} +1 -1
  26. package/web/_app/immutable/chunks/{CRIvE37b.js → BymwHy7o.js} +1 -1
  27. package/web/_app/immutable/chunks/{BrqJKzQU.js → CD6xPodA.js} +1 -1
  28. package/web/_app/immutable/chunks/{BXF2XoRC.js → CMeq8te_.js} +1 -1
  29. package/web/_app/immutable/chunks/CODXTnUW.js +523 -0
  30. package/web/_app/immutable/chunks/{CEufJyoj.js → CQd9D8Nc.js} +1 -1
  31. package/web/_app/immutable/chunks/{BrGmYbJT.js → CT_Ry4q8.js} +1 -1
  32. package/web/_app/immutable/chunks/{CQadubS9.js → C_amgxV1.js} +1 -1
  33. package/web/_app/immutable/chunks/{GRrQoDGJ.js → CfL6O_ia.js} +1 -1
  34. package/web/_app/immutable/chunks/{spNKdrPy.js → CjtKPNlv.js} +1 -1
  35. package/web/_app/immutable/chunks/{DxLkKbK2.js → Cl5zRP_n.js} +1 -1
  36. package/web/_app/immutable/chunks/{CETSRtnV.js → CyFLqlvP.js} +1 -1
  37. package/web/_app/immutable/chunks/{Bq5hCPe1.js → Czz9qOh8.js} +1 -1
  38. package/web/_app/immutable/chunks/{BguXRgvc.js → D3-rqfsM.js} +1 -1
  39. package/web/_app/immutable/chunks/{bcQIrid8.js → D5XlJBy8.js} +1 -1
  40. package/web/_app/immutable/chunks/{TuFg0KqZ.js → D5vocsTl.js} +1 -1
  41. package/web/_app/immutable/chunks/{CTscJvp6.js → D95RKsvN.js} +1 -1
  42. package/web/_app/immutable/chunks/{BzI3yqBQ.js → DBC2xjOo.js} +1 -1
  43. package/web/_app/immutable/chunks/DDVefAkE.js +7 -0
  44. package/web/_app/immutable/chunks/{BsLNwr5A.js → DF89zyH-.js} +1 -1
  45. package/web/_app/immutable/chunks/DGmSCGD3.js +1 -0
  46. package/web/_app/immutable/chunks/{DacMdKjW.js → DNjLZcwq.js} +1 -1
  47. package/web/_app/immutable/chunks/{C-dfcq9W.js → DRX-TQzj.js} +1 -1
  48. package/web/_app/immutable/chunks/{BunrC_8P.js → DX4bJJO0.js} +1 -1
  49. package/web/_app/immutable/chunks/{EQVRMnZU.js → DXK7PB4g.js} +1 -1
  50. package/web/_app/immutable/chunks/{mbLqADPr.js → DXTK-eyo.js} +1 -1
  51. package/web/_app/immutable/chunks/{DII7jNnq.js → DaulBP5z.js} +1 -1
  52. package/web/_app/immutable/chunks/{wCTXGvXm.js → DbNETcPs.js} +1 -1
  53. package/web/_app/immutable/chunks/Db_gdTNI.js +1 -0
  54. package/web/_app/immutable/chunks/{CX-xckzu.js → DfCZPwp1.js} +1 -1
  55. package/web/_app/immutable/chunks/{DKNOMI4Y.js → Dh1lBxfx.js} +1 -1
  56. package/web/_app/immutable/chunks/DktGnzDy.js +151 -0
  57. package/web/_app/immutable/chunks/{BgczuZKA.js → DkxkvOjx.js} +1 -1
  58. package/web/_app/immutable/chunks/{0M1khDs2.js → DlXrOzlh.js} +1 -1
  59. package/web/_app/immutable/chunks/{B85D_PlV.js → Dpa4Syyy.js} +1 -1
  60. package/web/_app/immutable/chunks/DshHzxgH.js +1 -0
  61. package/web/_app/immutable/chunks/DuLysVkb.js +1 -0
  62. package/web/_app/immutable/chunks/{CdY1YAit.js → EMo1IeTW.js} +1 -1
  63. package/web/_app/immutable/chunks/F7HCRtmu.js +1 -0
  64. package/web/_app/immutable/chunks/Iqr2CudW.js +3 -0
  65. package/web/_app/immutable/chunks/{CoyQYage.js → RFxekmX-.js} +1 -1
  66. package/web/_app/immutable/chunks/{vk5Wkr31.js → RlApGeew.js} +1 -1
  67. package/web/_app/immutable/chunks/{CLVUDRRk.js → Xm0YTnxV.js} +1 -1
  68. package/web/_app/immutable/chunks/{CZ8wTb_M.js → gPtCGHiy.js} +1 -1
  69. package/web/_app/immutable/chunks/{B3aPQAYq.js → mLFVM17H.js} +1 -1
  70. package/web/_app/immutable/chunks/{D4SKbj9K.js → oWM_kgYq.js} +1 -1
  71. package/web/_app/immutable/chunks/{wj7G6pU5.js → rghE0CVz.js} +1 -1
  72. package/web/_app/immutable/chunks/{B9YLdnR_.js → tUSDgbpy.js} +1 -1
  73. package/web/_app/immutable/chunks/{DTdlqvEb.js → vfDvz3qP.js} +1 -1
  74. package/web/_app/immutable/chunks/{BRKS-CCX.js → whhiiiga.js} +1 -1
  75. package/web/_app/immutable/chunks/wxBqjpRy.js +1 -0
  76. package/web/_app/immutable/entry/app.wp4GfiBT.js +2 -0
  77. package/web/_app/immutable/entry/start.PPXyd7_0.js +1 -0
  78. package/web/_app/immutable/nodes/0.JerS9yOA.js +26 -0
  79. package/web/_app/immutable/nodes/1.C-RxYNx3.js +1 -0
  80. package/web/_app/immutable/nodes/2.Bbkruoyi.js +1 -0
  81. package/web/_app/immutable/nodes/3.BkpGKa9k.js +1 -0
  82. package/web/_app/immutable/nodes/4.Bj25nsxG.js +2 -0
  83. package/web/_app/immutable/nodes/5.D9sfzyBX.js +9 -0
  84. package/web/_app/immutable/nodes/6.Di1re0aR.js +1 -0
  85. package/web/_app/immutable/nodes/7.MWEn-qPC.js +1 -0
  86. package/web/_app/version.json +1 -1
  87. package/web/index.html +18 -17
  88. package/web/kit/chart.js +55 -0
  89. package/web/kit/isorite.css +32 -0
  90. package/web/kit/kit.css +80 -0
  91. package/web/kit/kit.js +543 -0
  92. package/web/kit/licenses/d3.txt +13 -0
  93. package/web/kit/licenses/interval-tree-1d.txt +22 -0
  94. package/web/kit/licenses/isoformat.txt +13 -0
  95. package/web/kit/licenses/katex.txt +21 -0
  96. package/web/kit/licenses/observablehq-plot.txt +13 -0
  97. package/web/kit/licenses/three.txt +21 -0
  98. package/web/kit/math.css +1 -0
  99. package/web/kit/math.js +257 -0
  100. package/web/kit/model.js +4236 -0
  101. package/web/kit/plain.css +16 -0
  102. package/web/_app/immutable/assets/5.TsqJFEFF.css +0 -1
  103. package/web/_app/immutable/assets/NoteEditor.8wWtZK_A.css +0 -1
  104. package/web/_app/immutable/chunks/CBWiKnLz.js +0 -1
  105. package/web/_app/immutable/chunks/CHbKgHy3.js +0 -1
  106. package/web/_app/immutable/chunks/CJ1dhP0p.js +0 -1
  107. package/web/_app/immutable/chunks/CLkY0zVi.js +0 -1
  108. package/web/_app/immutable/chunks/D-aFnd2T.js +0 -1
  109. package/web/_app/immutable/chunks/DRQEUdad.js +0 -1
  110. package/web/_app/immutable/chunks/DZYaqCwi.js +0 -1
  111. package/web/_app/immutable/chunks/D_19S_Iu.js +0 -1
  112. package/web/_app/immutable/chunks/DcgxJ8bF.js +0 -673
  113. package/web/_app/immutable/chunks/Ddgejj-u.js +0 -1
  114. package/web/_app/immutable/chunks/nMarIA7J.js +0 -3
  115. package/web/_app/immutable/chunks/vUsuwDSf.js +0 -6
  116. package/web/_app/immutable/entry/app.CswuY3sh.js +0 -2
  117. package/web/_app/immutable/entry/start.D8ZvSyBD.js +0 -1
  118. package/web/_app/immutable/nodes/0.DBoa3NAQ.js +0 -26
  119. package/web/_app/immutable/nodes/1.DrwFerb8.js +0 -1
  120. package/web/_app/immutable/nodes/2.DPmbppXV.js +0 -1
  121. package/web/_app/immutable/nodes/3.BW7AbIrS.js +0 -1
  122. package/web/_app/immutable/nodes/4.B5HAyMKs.js +0 -2
  123. package/web/_app/immutable/nodes/5.BvScSoCM.js +0 -5
  124. package/web/_app/immutable/nodes/6.Bna6qY2G.js +0 -1
  125. package/web/_app/immutable/nodes/7.BxQaF3lD.js +0 -1
package/dist/core.js CHANGED
@@ -106,7 +106,7 @@ function normpath(p) {
106
106
  }
107
107
  return "/".repeat(initial) + out.join("/") || ".";
108
108
  }
109
- /** SHA-256 as hex, synchronous and dependency-free, so the core runs anywhere. */
109
+ /** SHA-256 as hex, synchronous and dependency-free, so the core runs anywhere: of text (as UTF-8), or of bytes. */
110
110
  function sha256(message) {
111
111
  const K = new Uint32Array([
112
112
  1116352408,
@@ -174,7 +174,7 @@ function sha256(message) {
174
174
  3204031479,
175
175
  3329325298
176
176
  ]);
177
- const data = new TextEncoder().encode(message);
177
+ const data = typeof message === "string" ? new TextEncoder().encode(message) : message;
178
178
  const len = data.length;
179
179
  const padded = new Uint8Array(len + 9 + 63 >> 6 << 6);
180
180
  padded.set(data);
@@ -366,7 +366,7 @@ function linkTexts(body) {
366
366
  return out;
367
367
  }
368
368
  /** Every link and image in a body, in order: where it points, its title, and whether it is an image
369
- * (`![…](…)`, which for an artifact or a picture means "shown here", an embed). */
369
+ * (`![…](…)`, which for an artifact or a picture means "shown here", an embed), with an image's alt text. */
370
370
  function citeRefs(body) {
371
371
  const { tokens } = parse$1(body);
372
372
  const out = [];
@@ -380,7 +380,8 @@ function citeRefs(body) {
380
380
  else if (c.type === "image") out.push({
381
381
  href: c.attrGet("src") ?? "",
382
382
  title: c.attrGet("title"),
383
- embed: true
383
+ embed: true,
384
+ alt: c.content
384
385
  });
385
386
  }
386
387
  return out;
@@ -424,6 +425,94 @@ function section(body, heading) {
424
425
  return null;
425
426
  }
426
427
  //#endregion
428
+ //#region packages/core/src/picture.ts
429
+ const TYPES = {
430
+ png: "image/png",
431
+ jpg: "image/jpeg",
432
+ jpeg: "image/jpeg",
433
+ gif: "image/gif",
434
+ svg: "image/svg+xml",
435
+ webp: "image/webp",
436
+ avif: "image/avif"
437
+ };
438
+ /** A picture's media type, by its extension, or null when the path isn't a picture's (M22). */
439
+ const pictureType = (path) => {
440
+ const dot = path.lastIndexOf(".");
441
+ return dot < 0 || path.lastIndexOf("/") > dot ? null : TYPES[path.slice(dot + 1).toLowerCase()] ?? null;
442
+ };
443
+ const OTHER = {
444
+ html: "text/html",
445
+ htm: "text/html",
446
+ csv: "text/csv",
447
+ tsv: "text/tab-separated-values",
448
+ json: "application/json",
449
+ jsonl: "application/jsonl",
450
+ ndjson: "application/x-ndjson",
451
+ txt: "text/plain",
452
+ tex: "text/plain",
453
+ pdf: "application/pdf",
454
+ glb: "model/gltf-binary",
455
+ gltf: "model/gltf+json",
456
+ stl: "model/stl",
457
+ obj: "model/obj",
458
+ zip: "application/zip",
459
+ parquet: "application/vnd.apache.parquet",
460
+ arrow: "application/vnd.apache.arrow.file",
461
+ npy: "application/octet-stream",
462
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
463
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
464
+ epub: "application/epub+zip",
465
+ odt: "application/vnd.oasis.opendocument.text"
466
+ };
467
+ /** Any file's media type in the notes (M23), by its extension: a picture's, one listed, or octet-stream. Null for a
468
+ * note (Markdown is read as a note, never as a file) and for a path with no extension. */
469
+ const fileType = (path) => {
470
+ const dot = path.lastIndexOf(".");
471
+ if (dot < 0 || path.lastIndexOf("/") > dot) return null;
472
+ const ext = path.slice(dot + 1).toLowerCase();
473
+ return ext === "md" ? null : pictureType(path) ?? OTHER[ext] ?? "application/octet-stream";
474
+ };
475
+ /** Width and height in pixels, or null. */
476
+ function pictureSize(bytes, type) {
477
+ const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength), n = bytes.length;
478
+ const at = (i, s) => [...s].every((c, k) => bytes[i + k] === c.charCodeAt(0));
479
+ const ok = (w, h) => w > 0 && h > 0 ? {
480
+ width: w,
481
+ height: h
482
+ } : null;
483
+ try {
484
+ if (type === "image/png" && n >= 24 && at(12, "IHDR")) return ok(v.getUint32(16), v.getUint32(20));
485
+ if (type === "image/gif" && n >= 10 && at(0, "GIF")) return ok(v.getUint16(6, true), v.getUint16(8, true));
486
+ if (type === "image/jpeg") {
487
+ for (let i = 2; i + 9 < n;) {
488
+ if (bytes[i] !== 255) return null;
489
+ const m = bytes[i + 1];
490
+ if (m >= 192 && m <= 207 && m !== 196 && m !== 200 && m !== 204) return ok(v.getUint16(i + 7), v.getUint16(i + 5));
491
+ i += 2 + v.getUint16(i + 2);
492
+ }
493
+ return null;
494
+ }
495
+ if (type === "image/webp" && n >= 30 && at(0, "RIFF") && at(8, "WEBP")) {
496
+ if (at(12, "VP8 ")) return ok(v.getUint16(26, true) & 16383, v.getUint16(28, true) & 16383);
497
+ if (at(12, "VP8L")) {
498
+ const b = v.getUint32(21, true);
499
+ return ok((b & 16383) + 1, (b >> 14 & 16383) + 1);
500
+ }
501
+ if (at(12, "VP8X")) return ok(1 + (bytes[24] | bytes[25] << 8 | bytes[26] << 16), 1 + (bytes[27] | bytes[28] << 8 | bytes[29] << 16));
502
+ return null;
503
+ }
504
+ if (type === "image/svg+xml") {
505
+ const head = new TextDecoder().decode(bytes.subarray(0, 4096)), tag = /<svg\b[^>]*>/i.exec(head)?.[0] ?? "";
506
+ const attr = (name) => new RegExp(`\\s${name}\\s*=\\s*["']\\s*([\\d.]+)\\s*(px)?\\s*["']`, "i").exec(tag);
507
+ const w = attr("width"), h = attr("height");
508
+ if (w && h) return ok(Math.round(Number(w[1])), Math.round(Number(h[1])));
509
+ const box = /\sviewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(tag);
510
+ return box ? ok(Math.round(Number(box[1])), Math.round(Number(box[2]))) : null;
511
+ }
512
+ } catch {}
513
+ return null;
514
+ }
515
+ //#endregion
427
516
  //#region packages/core/src/kinds.ts
428
517
  function kindOf(type) {
429
518
  const t = type.trim().toLowerCase();
@@ -507,6 +596,19 @@ function outwardLinks(body) {
507
596
  }
508
597
  seen.add(href);
509
598
  }
599
+ for (const { href, embed, alt } of citeRefs(body)) {
600
+ if (!embed || seen.has(href)) continue;
601
+ const c = codeTarget(href);
602
+ if (!c || !pictureType(c.path)) continue;
603
+ out.push({
604
+ kind: "code",
605
+ href,
606
+ text: alt || c.path.split("/").at(-1),
607
+ path: c.path,
608
+ picture: true
609
+ });
610
+ seen.add(href);
611
+ }
510
612
  return out;
511
613
  }
512
614
  //#endregion
@@ -514,10 +616,19 @@ function outwardLinks(body) {
514
616
  /** The base's own instructions, for Iso and any other agent, at the top of the notes (M15). Not a note. */
515
617
  const AGENTS_FILE = "AGENTS.md";
516
618
  const OKF_VERSION = "0.2";
517
- const ARTIFACT = /\.html?$/i;
518
- const IMAGE = /\.(png|jpe?g|gif|svg|webp|avif)$/i;
519
- /** What kind of citable file a path is, or null. */
520
- const citeKind = (path) => ARTIFACT.test(path) ? "artifact" : IMAGE.test(path) ? "image" : null;
619
+ const KINDS$2 = [
620
+ ["artifact", /\.html?$/i],
621
+ ["image", /\.(png|jpe?g|gif|svg|webp|avif)$/i],
622
+ ["data", /\.(csv|tsv|json|jsonl|ndjson|parquet|arrow|feather|npy|npz|xlsx|xls|h5|hdf5|nc)$/i],
623
+ ["document", /\.(pdf|docx?|odt|rtf|epub|pptx?|odp|txt|tex)$/i]
624
+ ];
625
+ /** What kind of file a path is: null for a note, or a path with no extension (a note or a folder named without one);
626
+ * anything not listed is misc rather than dropped. */
627
+ const citeKind = (path) => {
628
+ const name = basename(path);
629
+ if (/\.md$/i.test(name) || !/\.[^.]+$/.test(name.replace(/^\./, ""))) return null;
630
+ return KINDS$2.find(([, re]) => re.test(name))?.[0] ?? "misc";
631
+ };
521
632
  const isEntry = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
522
633
  var Concept = class {
523
634
  id;
@@ -697,7 +808,7 @@ var Bundle = class Bundle {
697
808
  concept.links = links;
698
809
  concept.outward = outwardLinks(concept.body);
699
810
  for (const link of links) if (link.broken) this.issue(concept.path, "warning", "broken-link", `broken link to ${link.target}`);
700
- for (const { href, title, embed } of citeRefs(concept.body)) {
811
+ for (const { href, title, embed, alt } of citeRefs(concept.body)) {
701
812
  const path = this.filePath(concept, href), kind = path === null ? null : citeKind(path);
702
813
  if (path === null || kind === null) continue;
703
814
  const t = strip((title ?? "").toLowerCase());
@@ -707,10 +818,11 @@ var Bundle = class Bundle {
707
818
  embed,
708
819
  broken: !this.files.has(path),
709
820
  rel: rating(title),
710
- align: t === "left" ? "left" : t === "center" || t === "centre" ? "center" : null
821
+ align: t === "left" ? "left" : t === "center" || t === "centre" ? "center" : null,
822
+ ...embed && alt ? { alt } : {}
711
823
  };
712
824
  concept.cites.push(cite);
713
- if (cite.broken) this.issue(concept.path, "warning", "broken-link", `broken link to ${path}`);
825
+ if (cite.broken) this.issue(concept.path, "warning", "broken-link", kind === "image" ? `picture not in the notes: ${path}` : `broken link to ${path}`);
714
826
  }
715
827
  }
716
828
  const byName = /* @__PURE__ */ new Map();
@@ -2087,13 +2199,60 @@ function mapModel(base) {
2087
2199
  s
2088
2200
  ]);
2089
2201
  }
2202
+ const holdsFiles = /* @__PURE__ */ new Set();
2203
+ const parentOf = (p) => p.includes("/") ? p.slice(0, p.lastIndexOf("/")) : "";
2204
+ for (const f of base.files) holdsFiles.add(parentOf(f));
2205
+ const pictureFolder = (d) => {
2206
+ const dd = base.directories.get(d);
2207
+ const here = [...base.files].filter((f) => parentOf(f) === d);
2208
+ return !!d && (!dd || !dd.concepts.length && !dd.children.length) && here.length > 0 && here.every((f) => citeKind(f) === "image");
2209
+ };
2210
+ const refOf = (f) => citeKind(f) === "image" && pictureFolder(parentOf(f)) ? parentOf(f) + "/" : f;
2211
+ const fileEdges = /* @__PURE__ */ new Map();
2212
+ for (const c of base.concepts.values()) for (const x of c.cites) {
2213
+ if (x.broken || !base.files.has(x.target)) continue;
2214
+ const ref = refOf(x.target);
2215
+ if (!fileEdges.has(c.id)) fileEdges.set(c.id, /* @__PURE__ */ new Set());
2216
+ fileEdges.get(c.id).add(ref);
2217
+ }
2218
+ const rankOf = /* @__PURE__ */ new Map();
2219
+ for (const [from, refs] of fileEdges) for (const ref of refs) {
2220
+ edges.push([
2221
+ from,
2222
+ ref,
2223
+ STRENGTH.uses
2224
+ ]);
2225
+ rankOf.set(ref, Math.max(rankOf.get(ref) ?? 0, order.get(from)?.depth ?? 0));
2226
+ }
2227
+ const filesIn = /* @__PURE__ */ new Map();
2228
+ for (const f of [...base.files].sort()) {
2229
+ const of = citeKind(f), ref = of ? refOf(f) : null;
2230
+ if (!of || !ref) continue;
2231
+ const at = ref.endsWith("/") ? parentOf(ref.slice(0, -1)) : parentOf(f);
2232
+ const list = filesIn.get(at) ?? [];
2233
+ if (!list.some((n) => n.ref === ref)) list.push({
2234
+ kind: "concept",
2235
+ id: "f:" + ref,
2236
+ ref,
2237
+ weight: 1,
2238
+ rank: rankOf.get(ref) ?? 0,
2239
+ of
2240
+ });
2241
+ filesIn.set(at, list);
2242
+ }
2090
2243
  const dir = (id) => {
2091
2244
  const d = base.directories.get(id);
2092
- return {
2245
+ if (id && pictureFolder(id)) return null;
2246
+ const children = [
2247
+ ...[...d.children].sort().map(dir).filter((c) => c !== null),
2248
+ ...[...d.concepts].sort().map(note),
2249
+ ...filesIn.get(id) ?? []
2250
+ ];
2251
+ return id && !children.length && (holdsFiles.has(id) || d.children.length) ? null : {
2093
2252
  kind: "dir",
2094
2253
  id: "d:" + id,
2095
2254
  ref: id,
2096
- children: [...[...d.children].sort().map(dir), ...[...d.concepts].sort().map(note)]
2255
+ children
2097
2256
  };
2098
2257
  };
2099
2258
  return {
@@ -2101,6 +2260,8 @@ function mapModel(base) {
2101
2260
  edges
2102
2261
  };
2103
2262
  }
2263
+ /** Whether a map item is a file (M23), not a note: its ref has an extension, or is a folder of pictures. */
2264
+ const isFileRef = (ref) => ref.endsWith("/") || citeKind(ref) !== null;
2104
2265
  /** What lights when a note is chosen on the Atlas (refs, as the map model names notes). Where the base rates its
2105
2266
  * links, only "requires" is followed back; where it rates none, every drawn link is. */
2106
2267
  function reach(model, note) {
@@ -2216,4 +2377,4 @@ function ago(at, now = Date.now()) {
2216
2377
  /** A moment is named by its last entry: the one the note is shown at. */
2217
2378
  const momentKey = (m) => m.ids.at(-1);
2218
2379
  //#endregion
2219
- export { ABOUT, AGENTS_FILE, Bundle, CONFIG_FILE, Concept, DEVICE_RE, DONE, DiffError, Directory, FrontmatterError, GITATTRIBUTES, ID_RE, KINDS, LearnerError, MAX_EVENT_BYTES, OKF_VERSION, OWN_DIR, OWN_FORMAT, RATINGS, SESSION_GAP_MS, SETTINGS_FILE, SNAPSHOT_EVERY, STRENGTH, STUDY_DIR, STUDY_FORMAT, SearchIndex, StudyError, agentName, ago, anchorOf, applyHunks, authors, blocks, change, citeKind, cleanEvent, cmp, cmpTuple, codeTarget, contentHash, describe, diffLines, doneOf, dumpFrontmatter, editFrontmatter, embedFor, embedRefs, findAnchor, findPassage, floatRepr, frontmatterText, hashText, headings, idsOf, impliedLinks, insertAt, iso, journalLine, journalPath, kindOf, legacyId, linkRefs, linkTexts, locate, mapModel, mergeRecords, momentKey, moments, newId, noteIds, outwardLinks, pagerank, parseSettings, parseStudyConfig, parseYaml, passageOf, pending, pyRepr, rating, reach, readJournal, readRecord, reconcile, recordPath, replay, round3, section, sessionMoments, settingsText, sha256, slugify, snippet, spliceText, splitFrontmatter, splitSource, stamp, strengthEdges, strip, stronglyConnected, text, textAt, toTime, tokenize, touched, wordAuthors, written };
2380
+ export { ABOUT, AGENTS_FILE, Bundle, CONFIG_FILE, Concept, DEVICE_RE, DONE, DiffError, Directory, FrontmatterError, GITATTRIBUTES, ID_RE, KINDS, LearnerError, MAX_EVENT_BYTES, OKF_VERSION, OWN_DIR, OWN_FORMAT, RATINGS, SESSION_GAP_MS, SETTINGS_FILE, SNAPSHOT_EVERY, STRENGTH, STUDY_DIR, STUDY_FORMAT, SearchIndex, StudyError, agentName, ago, anchorOf, applyHunks, authors, blocks, change, citeKind, cleanEvent, cmp, cmpTuple, codeTarget, contentHash, describe, diffLines, doneOf, dumpFrontmatter, editFrontmatter, embedFor, embedRefs, fileType, findAnchor, findPassage, floatRepr, frontmatterText, hashText, headings, idsOf, impliedLinks, insertAt, isFileRef, iso, journalLine, journalPath, kindOf, legacyId, linkRefs, linkTexts, locate, mapModel, mergeRecords, momentKey, moments, newId, noteIds, outwardLinks, pagerank, parseSettings, parseStudyConfig, parseYaml, passageOf, pending, pictureSize, pictureType, pyRepr, rating, reach, readJournal, readRecord, reconcile, recordPath, replay, round3, section, sessionMoments, settingsText, sha256, slugify, snippet, spliceText, splitFrontmatter, splitSource, stamp, strengthEdges, strip, stronglyConnected, text, textAt, toTime, tokenize, touched, wordAuthors, written };