isorite 0.1.0 → 0.2.0-trial.1

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 (76) hide show
  1. package/dist/core.js +125 -2
  2. package/dist/main.js +2277 -363
  3. package/package.json +2 -1
  4. package/plugin/server.ts +9 -8
  5. package/plugin/tour.ts +5 -8
  6. package/web/_app/immutable/assets/0.s5xqevrq.css +1 -0
  7. package/web/_app/immutable/assets/4.PVZR2_N5.css +1 -0
  8. package/web/_app/immutable/assets/5.DCxNIgyW.css +1 -0
  9. package/web/_app/immutable/assets/9.CFA9_nYZ.css +1 -0
  10. package/web/_app/immutable/assets/FolderField._A4_sc1Z.css +1 -0
  11. package/web/_app/immutable/assets/NoteEditor.ChlpmyHO.css +1 -0
  12. package/web/_app/immutable/assets/NoteList.F579Zvj_.css +1 -0
  13. package/web/_app/immutable/assets/{Timeline.UMF1LjSO.css → Timeline.KTc3LKuK.css} +1 -1
  14. package/web/_app/immutable/assets/Tutorial.DOfsM49T.css +1 -0
  15. package/web/_app/immutable/chunks/B0NIb88Q.js +1 -0
  16. package/web/_app/immutable/chunks/{B-si2ell.js → BRnMDye8.js} +1 -1
  17. package/web/_app/immutable/chunks/C38XJeNJ.js +1 -0
  18. package/web/_app/immutable/chunks/C8UdwlAg.js +3 -0
  19. package/web/_app/immutable/chunks/CEQ-cFxt.js +667 -0
  20. package/web/_app/immutable/chunks/CRzLMJPS.js +1 -0
  21. package/web/_app/immutable/chunks/CWITxcMm.js +13 -0
  22. package/web/_app/immutable/chunks/Ch0511Wu.js +1 -0
  23. package/web/_app/immutable/chunks/D56iKolu.js +1 -0
  24. package/web/_app/immutable/chunks/DAVQx5al.js +1 -0
  25. package/web/_app/immutable/chunks/DP2vIlnJ.js +20 -0
  26. package/web/_app/immutable/chunks/DTwIGCa8.js +1 -0
  27. package/web/_app/immutable/chunks/DhKewaLD.js +1 -0
  28. package/web/_app/immutable/chunks/Dm229u8R.js +1 -0
  29. package/web/_app/immutable/chunks/GgEyipRh.js +1 -0
  30. package/web/_app/immutable/entry/app.C_YVtBm3.js +2 -0
  31. package/web/_app/immutable/entry/start.36VrMTu2.js +1 -0
  32. package/web/_app/immutable/nodes/0.CgaPlR93.js +14 -0
  33. package/web/_app/immutable/nodes/1.CeByL9Re.js +1 -0
  34. package/web/_app/immutable/nodes/2.DUNH537j.js +1 -0
  35. package/web/_app/immutable/nodes/3.CaAED8T_.js +1 -0
  36. package/web/_app/immutable/nodes/4.BBhoqQg0.js +2 -0
  37. package/web/_app/immutable/nodes/5.CkVNYg2h.js +5 -0
  38. package/web/_app/immutable/nodes/6.CYRn28m8.js +1 -0
  39. package/web/_app/immutable/nodes/7.BYBNXM1A.js +1 -0
  40. package/web/_app/immutable/nodes/8.BdGwzJFT.js +1 -0
  41. package/web/_app/immutable/nodes/9.NF5w8YC2.js +486 -0
  42. package/web/_app/immutable/workers/worker-rKDNrEKQ.js +1 -0
  43. package/web/_app/version.json +1 -1
  44. package/web/icon-180.png +0 -0
  45. package/web/icon-192.png +0 -0
  46. package/web/icon-512.png +0 -0
  47. package/web/icon-maskable-512.png +0 -0
  48. package/web/index.html +35 -12
  49. package/web/manifest.webmanifest +14 -0
  50. package/web/_app/immutable/assets/0.CbWSsYpm.css +0 -1
  51. package/web/_app/immutable/assets/3.Bgs8n1LK.css +0 -1
  52. package/web/_app/immutable/assets/4.CCFEPTFN.css +0 -1
  53. package/web/_app/immutable/assets/5.BCvLF9Xz.css +0 -1
  54. package/web/_app/immutable/assets/6.kPo5mcJx.css +0 -1
  55. package/web/_app/immutable/assets/NoteEditor.Bp-YDqYj.css +0 -1
  56. package/web/_app/immutable/chunks/BD1Dpm2e.js +0 -3
  57. package/web/_app/immutable/chunks/C0fpmehI.js +0 -1
  58. package/web/_app/immutable/chunks/CWYACT2V.js +0 -1
  59. package/web/_app/immutable/chunks/CdQZ-ArP.js +0 -1
  60. package/web/_app/immutable/chunks/DN3dk6rD.js +0 -147
  61. package/web/_app/immutable/chunks/DtAOoM-T.js +0 -1
  62. package/web/_app/immutable/chunks/DykrN7z5.js +0 -535
  63. package/web/_app/immutable/chunks/cmGruEKS.js +0 -1
  64. package/web/_app/immutable/chunks/gRYnlonl.js +0 -1
  65. package/web/_app/immutable/entry/app.DgJiXIYs.js +0 -2
  66. package/web/_app/immutable/entry/start.l9vV7NaJ.js +0 -1
  67. package/web/_app/immutable/nodes/0.DWPeBju2.js +0 -1
  68. package/web/_app/immutable/nodes/1.CJVDS8FT.js +0 -1
  69. package/web/_app/immutable/nodes/2.o8ItfT-a.js +0 -1
  70. package/web/_app/immutable/nodes/3.uhHyOPGK.js +0 -13
  71. package/web/_app/immutable/nodes/4.BYKkAZTp.js +0 -2
  72. package/web/_app/immutable/nodes/5.BzEQO7Xv.js +0 -4
  73. package/web/_app/immutable/nodes/6.GxiAUa6J.js +0 -1
  74. package/web/_app/immutable/nodes/7.d2Ere8Jb.js +0 -1
  75. package/web/_app/immutable/nodes/8.CvPHZL8j.js +0 -1
  76. package/web/_app/immutable/workers/worker-d9GxGKde.js +0 -1
package/dist/core.js CHANGED
@@ -1467,6 +1467,111 @@ function authors(entries) {
1467
1467
  }
1468
1468
  return owners;
1469
1469
  }
1470
+ /** A line's words, spaces and marks, in order: what is compared to tell who wrote what within a line. */
1471
+ const tokens = (line) => line.match(/\s+|[\p{L}\p{N}_]+|[^\s\p{L}\p{N}_]/gu) ?? [];
1472
+ /** Who wrote each word of the note as the journal last has it, line by line, as runs. Where a change replaced
1473
+ * lines, the old and the new are compared word by word, so a word kept keeps its writer and only the words put in
1474
+ * are the changer's. Text kept from a proposal is its proposer's, as in `authors`. Null when the chain is broken. */
1475
+ function wordAuthors(entries) {
1476
+ const proposers = /* @__PURE__ */ new Map();
1477
+ let lines = null, text = null;
1478
+ const line = (l, who) => {
1479
+ const t = tokens(l);
1480
+ return {
1481
+ t,
1482
+ w: t.map(() => who)
1483
+ };
1484
+ };
1485
+ for (const e of entries) {
1486
+ if (e.kind === "proposal") proposers.set(e.id, e.who);
1487
+ if (!isChange(e)) continue;
1488
+ const who = e.why === "keep" && e.proposal ? proposers.get(e.proposal) ?? e.who : e.who;
1489
+ if (lines === null || text === null) {
1490
+ if (e.text === void 0) return null;
1491
+ text = e.text.split("\n");
1492
+ lines = text.map((l) => line(l, who));
1493
+ continue;
1494
+ }
1495
+ if (hashText(text.join("\n")) !== e.before) return null;
1496
+ const next = [];
1497
+ let at = 0;
1498
+ for (const h of e.hunks) {
1499
+ next.push(...lines.slice(at, h.at));
1500
+ const old = lines.slice(h.at, h.at + h.del.length);
1501
+ const a = [], aw = [];
1502
+ old.forEach((l, k) => {
1503
+ if (k) {
1504
+ a.push("\n");
1505
+ aw.push("");
1506
+ }
1507
+ a.push(...l.t);
1508
+ aw.push(...l.w);
1509
+ });
1510
+ const b = [];
1511
+ h.ins.forEach((l, k) => {
1512
+ if (k) b.push("\n");
1513
+ b.push(...tokens(l));
1514
+ });
1515
+ const bw = b.map(() => who);
1516
+ const kept = [];
1517
+ let i = 0, j = 0;
1518
+ for (const d of diffLines(a, b)) {
1519
+ while (i < d.at) {
1520
+ kept.push([j, i]);
1521
+ i++;
1522
+ j++;
1523
+ }
1524
+ i += d.del.length;
1525
+ j += d.ins.length;
1526
+ }
1527
+ while (i < a.length && j < b.length) {
1528
+ kept.push([j, i]);
1529
+ i++;
1530
+ j++;
1531
+ }
1532
+ const words = (ts) => ts.filter((t) => /[\p{L}\p{N}]/u.test(t)).length;
1533
+ if (kept.filter(([jj]) => /[\p{L}\p{N}]/u.test(b[jj])).length * 2 >= words(b)) for (const [jj, ii] of kept) bw[jj] = aw[ii];
1534
+ let cur = {
1535
+ t: [],
1536
+ w: []
1537
+ };
1538
+ const made = [];
1539
+ b.forEach((tok, k) => {
1540
+ if (tok === "\n") {
1541
+ made.push(cur);
1542
+ cur = {
1543
+ t: [],
1544
+ w: []
1545
+ };
1546
+ } else {
1547
+ cur.t.push(tok);
1548
+ cur.w.push(bw[k]);
1549
+ }
1550
+ });
1551
+ if (h.ins.length) made.push(cur);
1552
+ next.push(...made);
1553
+ at = h.at + h.del.length;
1554
+ }
1555
+ next.push(...lines.slice(at));
1556
+ lines = next;
1557
+ text = applyHunks(text, e.hunks);
1558
+ }
1559
+ return (lines ?? []).map((l) => {
1560
+ const runs = [];
1561
+ let pos = 0;
1562
+ l.t.forEach((tok, k) => {
1563
+ const who = l.w[k], last = runs.at(-1);
1564
+ if (last && last.who === who && last.to === pos) last.to += tok.length;
1565
+ else runs.push({
1566
+ from: pos,
1567
+ to: pos + tok.length,
1568
+ who
1569
+ });
1570
+ pos += tok.length;
1571
+ });
1572
+ return runs;
1573
+ });
1574
+ }
1470
1575
  /** The note as it was after an entry. */
1471
1576
  const textAt = (entries, id) => replay(entries, id)?.text ?? null;
1472
1577
  /** The entry for a change of the note's file to `after`, or null when nothing changed. The difference is taken
@@ -1678,7 +1783,8 @@ function moments(entries) {
1678
1783
  const what = e.why === "start" ? e.who === "external" ? "found" : "wrote" : e.why === "edit" ? "edited" : e.why === "restore" ? "restored" : e.why === "keep" ? "kept" : e.why === "move" ? "moved" : "changed elsewhere";
1679
1784
  out.push({
1680
1785
  ...base,
1681
- what
1786
+ what,
1787
+ ...e.asked ? { asked: e.asked } : {}
1682
1788
  });
1683
1789
  }
1684
1790
  }
@@ -1867,6 +1973,18 @@ function mapModel(base, study = null) {
1867
1973
  edges
1868
1974
  };
1869
1975
  }
1976
+ /** The map without the study base: its folders and notes, and the edges to them, left out. The Atlas draws study
1977
+ * folders only in its Understand lens (M10). */
1978
+ function withoutStudy(model) {
1979
+ const strip = (d) => ({
1980
+ ...d,
1981
+ children: d.children.filter((c) => !c.study).map((c) => c.kind === "dir" ? strip(c) : c)
1982
+ });
1983
+ return {
1984
+ root: strip(model.root),
1985
+ edges: model.edges.filter(([a, b]) => !a.startsWith("@") && !b.startsWith("@"))
1986
+ };
1987
+ }
1870
1988
  /** What lights when a note is chosen on the Atlas (refs, as the map model names notes). Where the base rates its
1871
1989
  * links, only "requires" is followed back; where it rates none, every drawn link is. A study note requires what it tests. */
1872
1990
  function reach(model, note) {
@@ -2047,6 +2165,11 @@ function understanding(events, now = Date.now()) {
2047
2165
  s.last = when;
2048
2166
  s.evidence.push(e.id);
2049
2167
  }
2168
+ } else if (e.event === "understood" && typeof e.note === "string") {
2169
+ const s = at(e.note), by = e.by;
2170
+ s.level = clamp(s.level + (typeof by === "number" && Number.isFinite(by) ? Math.max(-1, Math.min(1, by)) : 0));
2171
+ s.last = when;
2172
+ s.evidence.push(e.id);
2050
2173
  } else if (e.event === "moved" && typeof e.from === "string" && typeof e.to === "string") {
2051
2174
  const s = state.get(e.from);
2052
2175
  if (s) {
@@ -2310,4 +2433,4 @@ function ago(at, now = Date.now()) {
2310
2433
  /** A moment is named by its last entry: the one the note is shown at. */
2311
2434
  const momentKey = (m) => m.ids.at(-1);
2312
2435
  //#endregion
2313
- export { Bundle, CONFIG_FILE, Concept, DEVICE_RE, DiffError, Directory, ExerciseError, FrontmatterError, GITATTRIBUTES, ID_RE, INTERVALS, KINDS, LEVELS, LearnerError, MAX_EVENT_BYTES, MAX_WHY, OKF_VERSION, RATINGS, SESSION_GAP_MS, SNAPSHOT_EVERY, STRENGTH, STUDY_DIR, STUDY_FORMAT, STUDY_PREFIX, SearchIndex, StudyError, WORKING, agentName, ago, anchorOf, applyHunks, authors, blocks, change, citeKind, cleanEvent, cmp, cmpTuple, contentHash, describe, diffLines, dumpFrontmatter, dumpStudyConfig, editFrontmatter, exercise, exerciseText, findAnchor, findPassage, floatRepr, frontmatterText, hashText, headings, impliedLinks, insertAt, isStudyId, iso, journalLine, journalPath, legacyId, linkRefs, locate, lowest, mapModel, markingReply, mergeRecords, momentKey, moments, newId, noteIds, pagerank, parseStudyConfig, parseYaml, passageOf, pending, placeMarks, pyRepr, rating, reach, readJournal, readRecord, reconcile, recordPath, replay, round3, section, sessionMoments, sha256, slugify, snippet, spliceText, splitFrontmatter, splitSource, sprout, stamp, stepOf, strengthEdges, strip, stronglyConnected, studyId, studyList, testsOf, text, textAt, toTime, tokenize, touched, understanding, withNext, written };
2436
+ export { Bundle, CONFIG_FILE, Concept, DEVICE_RE, DiffError, Directory, ExerciseError, FrontmatterError, GITATTRIBUTES, ID_RE, INTERVALS, KINDS, LEVELS, LearnerError, MAX_EVENT_BYTES, MAX_WHY, OKF_VERSION, RATINGS, SESSION_GAP_MS, SNAPSHOT_EVERY, STRENGTH, STUDY_DIR, STUDY_FORMAT, STUDY_PREFIX, SearchIndex, StudyError, WORKING, agentName, ago, anchorOf, applyHunks, authors, blocks, change, citeKind, cleanEvent, cmp, cmpTuple, contentHash, describe, diffLines, dumpFrontmatter, dumpStudyConfig, editFrontmatter, exercise, exerciseText, findAnchor, findPassage, floatRepr, frontmatterText, hashText, headings, impliedLinks, insertAt, isStudyId, iso, journalLine, journalPath, legacyId, linkRefs, locate, lowest, mapModel, markingReply, mergeRecords, momentKey, moments, newId, noteIds, pagerank, parseStudyConfig, parseYaml, passageOf, pending, placeMarks, pyRepr, rating, reach, readJournal, readRecord, reconcile, recordPath, replay, round3, section, sessionMoments, sha256, slugify, snippet, spliceText, splitFrontmatter, splitSource, sprout, stamp, stepOf, strengthEdges, strip, stronglyConnected, studyId, studyList, testsOf, text, textAt, toTime, tokenize, touched, understanding, withNext, withoutStudy, wordAuthors, written };