isorite 0.10.0 → 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 (59) hide show
  1. package/dist/core.js +94 -7
  2. package/dist/main.js +864 -30
  3. package/package.json +2 -1
  4. package/web/_app/immutable/assets/{0.CPW9fjPu.css → 0.DcsDj0O1.css} +1 -1
  5. package/web/_app/immutable/assets/5.DbDKXCoO.css +1 -0
  6. package/web/_app/immutable/assets/NoteEditor.S3q5lmKq.css +1 -0
  7. package/web/_app/immutable/assets/drawn.CHbcoujQ.css +1 -0
  8. package/web/_app/immutable/chunks/{6RXH8WsD.js → BgT6ZdzK.js} +1 -1
  9. package/web/_app/immutable/chunks/{CsRPJjQS.js → CMeq8te_.js} +1 -1
  10. package/web/_app/immutable/chunks/CODXTnUW.js +523 -0
  11. package/web/_app/immutable/chunks/{C5MPRibb.js → CfL6O_ia.js} +1 -1
  12. package/web/_app/immutable/chunks/DDVefAkE.js +7 -0
  13. package/web/_app/immutable/chunks/DGmSCGD3.js +1 -0
  14. package/web/_app/immutable/chunks/{DQjIi5Jv.js → DNjLZcwq.js} +1 -1
  15. package/web/_app/immutable/chunks/{DCD8_jrW.js → DaulBP5z.js} +1 -1
  16. package/web/_app/immutable/chunks/{B8Qvvm53.js → Db_gdTNI.js} +1 -1
  17. package/web/_app/immutable/chunks/{CBkjDkEN.js → DktGnzDy.js} +14 -14
  18. package/web/_app/immutable/chunks/{CiU6tYJv.js → DuLysVkb.js} +1 -1
  19. package/web/_app/immutable/chunks/{DlKQFacy.js → F7HCRtmu.js} +1 -1
  20. package/web/_app/immutable/chunks/{BcgO-fBX.js → mLFVM17H.js} +1 -1
  21. package/web/_app/immutable/chunks/wxBqjpRy.js +1 -0
  22. package/web/_app/immutable/entry/app.wp4GfiBT.js +2 -0
  23. package/web/_app/immutable/entry/start.PPXyd7_0.js +1 -0
  24. package/web/_app/immutable/nodes/0.JerS9yOA.js +26 -0
  25. package/web/_app/immutable/nodes/{1.rzuq9VRh.js → 1.C-RxYNx3.js} +1 -1
  26. package/web/_app/immutable/nodes/2.Bbkruoyi.js +1 -0
  27. package/web/_app/immutable/nodes/3.BkpGKa9k.js +1 -0
  28. package/web/_app/immutable/nodes/{4.DP2MGav1.js → 4.Bj25nsxG.js} +1 -1
  29. package/web/_app/immutable/nodes/5.D9sfzyBX.js +9 -0
  30. package/web/_app/immutable/nodes/6.Di1re0aR.js +1 -0
  31. package/web/_app/version.json +1 -1
  32. package/web/index.html +16 -15
  33. package/web/kit/chart.js +55 -0
  34. package/web/kit/isorite.css +32 -0
  35. package/web/kit/kit.css +80 -0
  36. package/web/kit/kit.js +543 -0
  37. package/web/kit/licenses/d3.txt +13 -0
  38. package/web/kit/licenses/interval-tree-1d.txt +22 -0
  39. package/web/kit/licenses/isoformat.txt +13 -0
  40. package/web/kit/licenses/katex.txt +21 -0
  41. package/web/kit/licenses/observablehq-plot.txt +13 -0
  42. package/web/kit/licenses/three.txt +21 -0
  43. package/web/kit/math.css +1 -0
  44. package/web/kit/math.js +257 -0
  45. package/web/kit/model.js +4236 -0
  46. package/web/kit/plain.css +16 -0
  47. package/web/_app/immutable/assets/5.TsqJFEFF.css +0 -1
  48. package/web/_app/immutable/assets/NoteEditor.Wt5vU9Tb.css +0 -1
  49. package/web/_app/immutable/chunks/B0A4Snxv.js +0 -6
  50. package/web/_app/immutable/chunks/BJo70SOc.js +0 -1
  51. package/web/_app/immutable/chunks/BimZp6R0.js +0 -523
  52. package/web/_app/immutable/chunks/c7PFFMl4.js +0 -1
  53. package/web/_app/immutable/entry/app.iw6ZIOh2.js +0 -2
  54. package/web/_app/immutable/entry/start.CFnKMSWs.js +0 -1
  55. package/web/_app/immutable/nodes/0.BzEgwgsa.js +0 -26
  56. package/web/_app/immutable/nodes/2.D_jWsQLW.js +0 -1
  57. package/web/_app/immutable/nodes/3.BzRx3SiD.js +0 -1
  58. package/web/_app/immutable/nodes/5.BPS-CCQT.js +0 -5
  59. package/web/_app/immutable/nodes/6.DQMCyNJ3.js +0 -1
package/dist/core.js CHANGED
@@ -440,6 +440,38 @@ const pictureType = (path) => {
440
440
  const dot = path.lastIndexOf(".");
441
441
  return dot < 0 || path.lastIndexOf("/") > dot ? null : TYPES[path.slice(dot + 1).toLowerCase()] ?? null;
442
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
+ };
443
475
  /** Width and height in pixels, or null. */
444
476
  function pictureSize(bytes, type) {
445
477
  const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength), n = bytes.length;
@@ -584,10 +616,19 @@ function outwardLinks(body) {
584
616
  /** The base's own instructions, for Iso and any other agent, at the top of the notes (M15). Not a note. */
585
617
  const AGENTS_FILE = "AGENTS.md";
586
618
  const OKF_VERSION = "0.2";
587
- const ARTIFACT = /\.html?$/i;
588
- const IMAGE = /\.(png|jpe?g|gif|svg|webp|avif)$/i;
589
- /** What kind of citable file a path is, or null. */
590
- 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
+ };
591
632
  const isEntry = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
592
633
  var Concept = class {
593
634
  id;
@@ -2159,10 +2200,54 @@ function mapModel(base) {
2159
2200
  ]);
2160
2201
  }
2161
2202
  const holdsFiles = /* @__PURE__ */ new Set();
2162
- for (const f of base.files) holdsFiles.add(f.includes("/") ? f.slice(0, f.lastIndexOf("/")) : "");
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
+ }
2163
2243
  const dir = (id) => {
2164
2244
  const d = base.directories.get(id);
2165
- const children = [...[...d.children].sort().map(dir).filter((c) => c !== null), ...[...d.concepts].sort().map(note)];
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
+ ];
2166
2251
  return id && !children.length && (holdsFiles.has(id) || d.children.length) ? null : {
2167
2252
  kind: "dir",
2168
2253
  id: "d:" + id,
@@ -2175,6 +2260,8 @@ function mapModel(base) {
2175
2260
  edges
2176
2261
  };
2177
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;
2178
2265
  /** What lights when a note is chosen on the Atlas (refs, as the map model names notes). Where the base rates its
2179
2266
  * links, only "requires" is followed back; where it rates none, every drawn link is. */
2180
2267
  function reach(model, note) {
@@ -2290,4 +2377,4 @@ function ago(at, now = Date.now()) {
2290
2377
  /** A moment is named by its last entry: the one the note is shown at. */
2291
2378
  const momentKey = (m) => m.ids.at(-1);
2292
2379
  //#endregion
2293
- 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, 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 };
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 };