isorite 0.9.1 → 0.10.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.
- package/dist/core.js +84 -10
- package/dist/main.js +363 -32
- package/notes/algorithms/the-quadtree/subdivision.svg +15 -0
- package/notes/algorithms/the-quadtree.md +2 -0
- package/package.json +1 -1
- package/plugin/server.ts +1 -1
- package/web/_app/immutable/assets/{0.CTbO0owi.css → 0.CPW9fjPu.css} +1 -1
- package/web/_app/immutable/assets/NoteEditor.Wt5vU9Tb.css +1 -0
- package/web/_app/immutable/chunks/{8wVGBFSs.js → -2Meesge.js} +3 -3
- package/web/_app/immutable/chunks/{DDuWClBR.js → 6RXH8WsD.js} +1 -1
- package/web/_app/immutable/chunks/{BL3mLym4.js → 9z49435t.js} +1 -1
- package/web/_app/immutable/chunks/B0A4Snxv.js +6 -0
- package/web/_app/immutable/chunks/B8Qvvm53.js +1 -0
- package/web/_app/immutable/chunks/{DMAYXnpq.js → BA8Hpxhg.js} +1 -1
- package/web/_app/immutable/chunks/{CKSRTWxH.js → BAclEN0O.js} +1 -1
- package/web/_app/immutable/chunks/BJo70SOc.js +1 -0
- package/web/_app/immutable/chunks/{DECNRCf2.js → BLmF1B2i.js} +1 -1
- package/web/_app/immutable/chunks/{CiVjR8gq.js → BTclWEfx.js} +1 -1
- package/web/_app/immutable/chunks/{Cp_JbuGh.js → BWVMfAMh.js} +1 -1
- package/web/_app/immutable/chunks/{D4fLEcOQ.js → BXAOBcPb.js} +1 -1
- package/web/_app/immutable/chunks/BYSDTLqw.js +1 -0
- package/web/_app/immutable/chunks/{B3aPQAYq.js → BcgO-fBX.js} +1 -1
- package/web/_app/immutable/chunks/BimZp6R0.js +523 -0
- package/web/_app/immutable/chunks/{CO2Y5y64.js → Bq2GBAJ0.js} +1 -1
- package/web/_app/immutable/chunks/BqrMZ9MX.js +1 -0
- package/web/_app/immutable/chunks/{BN6xhG8e.js → Bt7VOT5H.js} +1 -1
- package/web/_app/immutable/chunks/{BGbXxNFa.js → BuUzVkG2.js} +1 -1
- package/web/_app/immutable/chunks/{Brxvm_b1.js → By4S_gy5.js} +1 -1
- package/web/_app/immutable/chunks/{CRIvE37b.js → BymwHy7o.js} +1 -1
- package/web/_app/immutable/chunks/{GRrQoDGJ.js → C5MPRibb.js} +1 -1
- package/web/_app/immutable/chunks/CBkjDkEN.js +151 -0
- package/web/_app/immutable/chunks/{BrqJKzQU.js → CD6xPodA.js} +1 -1
- package/web/_app/immutable/chunks/{CEufJyoj.js → CQd9D8Nc.js} +1 -1
- package/web/_app/immutable/chunks/{BrGmYbJT.js → CT_Ry4q8.js} +1 -1
- package/web/_app/immutable/chunks/{CQadubS9.js → C_amgxV1.js} +1 -1
- package/web/_app/immutable/chunks/CiU6tYJv.js +1 -0
- package/web/_app/immutable/chunks/{spNKdrPy.js → CjtKPNlv.js} +1 -1
- package/web/_app/immutable/chunks/{DxLkKbK2.js → Cl5zRP_n.js} +1 -1
- package/web/_app/immutable/chunks/{BXF2XoRC.js → CsRPJjQS.js} +1 -1
- package/web/_app/immutable/chunks/{CETSRtnV.js → CyFLqlvP.js} +1 -1
- package/web/_app/immutable/chunks/{Bq5hCPe1.js → Czz9qOh8.js} +1 -1
- package/web/_app/immutable/chunks/{BguXRgvc.js → D3-rqfsM.js} +1 -1
- package/web/_app/immutable/chunks/{bcQIrid8.js → D5XlJBy8.js} +1 -1
- package/web/_app/immutable/chunks/{TuFg0KqZ.js → D5vocsTl.js} +1 -1
- package/web/_app/immutable/chunks/{CTscJvp6.js → D95RKsvN.js} +1 -1
- package/web/_app/immutable/chunks/{BzI3yqBQ.js → DBC2xjOo.js} +1 -1
- package/web/_app/immutable/chunks/{DII7jNnq.js → DCD8_jrW.js} +1 -1
- package/web/_app/immutable/chunks/{BsLNwr5A.js → DF89zyH-.js} +1 -1
- package/web/_app/immutable/chunks/{DacMdKjW.js → DQjIi5Jv.js} +1 -1
- package/web/_app/immutable/chunks/{C-dfcq9W.js → DRX-TQzj.js} +1 -1
- package/web/_app/immutable/chunks/{BunrC_8P.js → DX4bJJO0.js} +1 -1
- package/web/_app/immutable/chunks/{EQVRMnZU.js → DXK7PB4g.js} +1 -1
- package/web/_app/immutable/chunks/{mbLqADPr.js → DXTK-eyo.js} +1 -1
- package/web/_app/immutable/chunks/{wCTXGvXm.js → DbNETcPs.js} +1 -1
- package/web/_app/immutable/chunks/{CX-xckzu.js → DfCZPwp1.js} +1 -1
- package/web/_app/immutable/chunks/{DKNOMI4Y.js → Dh1lBxfx.js} +1 -1
- package/web/_app/immutable/chunks/{BgczuZKA.js → DkxkvOjx.js} +1 -1
- package/web/_app/immutable/chunks/DlKQFacy.js +1 -0
- package/web/_app/immutable/chunks/{0M1khDs2.js → DlXrOzlh.js} +1 -1
- package/web/_app/immutable/chunks/{B85D_PlV.js → Dpa4Syyy.js} +1 -1
- package/web/_app/immutable/chunks/DshHzxgH.js +1 -0
- package/web/_app/immutable/chunks/{CdY1YAit.js → EMo1IeTW.js} +1 -1
- package/web/_app/immutable/chunks/Iqr2CudW.js +3 -0
- package/web/_app/immutable/chunks/{CoyQYage.js → RFxekmX-.js} +1 -1
- package/web/_app/immutable/chunks/{vk5Wkr31.js → RlApGeew.js} +1 -1
- package/web/_app/immutable/chunks/{CLVUDRRk.js → Xm0YTnxV.js} +1 -1
- package/web/_app/immutable/chunks/c7PFFMl4.js +1 -0
- package/web/_app/immutable/chunks/{CZ8wTb_M.js → gPtCGHiy.js} +1 -1
- package/web/_app/immutable/chunks/{D4SKbj9K.js → oWM_kgYq.js} +1 -1
- package/web/_app/immutable/chunks/{wj7G6pU5.js → rghE0CVz.js} +1 -1
- package/web/_app/immutable/chunks/{B9YLdnR_.js → tUSDgbpy.js} +1 -1
- package/web/_app/immutable/chunks/{DTdlqvEb.js → vfDvz3qP.js} +1 -1
- package/web/_app/immutable/chunks/{BRKS-CCX.js → whhiiiga.js} +1 -1
- package/web/_app/immutable/entry/app.iw6ZIOh2.js +2 -0
- package/web/_app/immutable/entry/start.CFnKMSWs.js +1 -0
- package/web/_app/immutable/nodes/0.BzEgwgsa.js +26 -0
- package/web/_app/immutable/nodes/1.rzuq9VRh.js +1 -0
- package/web/_app/immutable/nodes/2.D_jWsQLW.js +1 -0
- package/web/_app/immutable/nodes/3.BzRx3SiD.js +1 -0
- package/web/_app/immutable/nodes/4.DP2MGav1.js +2 -0
- package/web/_app/immutable/nodes/5.BPS-CCQT.js +5 -0
- package/web/_app/immutable/nodes/6.DQMCyNJ3.js +1 -0
- package/web/_app/immutable/nodes/7.MWEn-qPC.js +1 -0
- package/web/_app/version.json +1 -1
- package/web/index.html +17 -17
- package/web/_app/immutable/assets/NoteEditor.8wWtZK_A.css +0 -1
- package/web/_app/immutable/chunks/CBWiKnLz.js +0 -1
- package/web/_app/immutable/chunks/CHbKgHy3.js +0 -1
- package/web/_app/immutable/chunks/CJ1dhP0p.js +0 -1
- package/web/_app/immutable/chunks/CLkY0zVi.js +0 -1
- package/web/_app/immutable/chunks/D-aFnd2T.js +0 -1
- package/web/_app/immutable/chunks/DRQEUdad.js +0 -1
- package/web/_app/immutable/chunks/DZYaqCwi.js +0 -1
- package/web/_app/immutable/chunks/D_19S_Iu.js +0 -1
- package/web/_app/immutable/chunks/DcgxJ8bF.js +0 -673
- package/web/_app/immutable/chunks/Ddgejj-u.js +0 -1
- package/web/_app/immutable/chunks/nMarIA7J.js +0 -3
- package/web/_app/immutable/chunks/vUsuwDSf.js +0 -6
- package/web/_app/immutable/entry/app.CswuY3sh.js +0 -2
- package/web/_app/immutable/entry/start.D8ZvSyBD.js +0 -1
- package/web/_app/immutable/nodes/0.DBoa3NAQ.js +0 -26
- package/web/_app/immutable/nodes/1.DrwFerb8.js +0 -1
- package/web/_app/immutable/nodes/2.DPmbppXV.js +0 -1
- package/web/_app/immutable/nodes/3.BW7AbIrS.js +0 -1
- package/web/_app/immutable/nodes/4.B5HAyMKs.js +0 -2
- package/web/_app/immutable/nodes/5.BvScSoCM.js +0 -5
- package/web/_app/immutable/nodes/6.Bna6qY2G.js +0 -1
- 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,62 @@ 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
|
+
/** Width and height in pixels, or null. */
|
|
444
|
+
function pictureSize(bytes, type) {
|
|
445
|
+
const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength), n = bytes.length;
|
|
446
|
+
const at = (i, s) => [...s].every((c, k) => bytes[i + k] === c.charCodeAt(0));
|
|
447
|
+
const ok = (w, h) => w > 0 && h > 0 ? {
|
|
448
|
+
width: w,
|
|
449
|
+
height: h
|
|
450
|
+
} : null;
|
|
451
|
+
try {
|
|
452
|
+
if (type === "image/png" && n >= 24 && at(12, "IHDR")) return ok(v.getUint32(16), v.getUint32(20));
|
|
453
|
+
if (type === "image/gif" && n >= 10 && at(0, "GIF")) return ok(v.getUint16(6, true), v.getUint16(8, true));
|
|
454
|
+
if (type === "image/jpeg") {
|
|
455
|
+
for (let i = 2; i + 9 < n;) {
|
|
456
|
+
if (bytes[i] !== 255) return null;
|
|
457
|
+
const m = bytes[i + 1];
|
|
458
|
+
if (m >= 192 && m <= 207 && m !== 196 && m !== 200 && m !== 204) return ok(v.getUint16(i + 7), v.getUint16(i + 5));
|
|
459
|
+
i += 2 + v.getUint16(i + 2);
|
|
460
|
+
}
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
if (type === "image/webp" && n >= 30 && at(0, "RIFF") && at(8, "WEBP")) {
|
|
464
|
+
if (at(12, "VP8 ")) return ok(v.getUint16(26, true) & 16383, v.getUint16(28, true) & 16383);
|
|
465
|
+
if (at(12, "VP8L")) {
|
|
466
|
+
const b = v.getUint32(21, true);
|
|
467
|
+
return ok((b & 16383) + 1, (b >> 14 & 16383) + 1);
|
|
468
|
+
}
|
|
469
|
+
if (at(12, "VP8X")) return ok(1 + (bytes[24] | bytes[25] << 8 | bytes[26] << 16), 1 + (bytes[27] | bytes[28] << 8 | bytes[29] << 16));
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
if (type === "image/svg+xml") {
|
|
473
|
+
const head = new TextDecoder().decode(bytes.subarray(0, 4096)), tag = /<svg\b[^>]*>/i.exec(head)?.[0] ?? "";
|
|
474
|
+
const attr = (name) => new RegExp(`\\s${name}\\s*=\\s*["']\\s*([\\d.]+)\\s*(px)?\\s*["']`, "i").exec(tag);
|
|
475
|
+
const w = attr("width"), h = attr("height");
|
|
476
|
+
if (w && h) return ok(Math.round(Number(w[1])), Math.round(Number(h[1])));
|
|
477
|
+
const box = /\sviewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(tag);
|
|
478
|
+
return box ? ok(Math.round(Number(box[1])), Math.round(Number(box[2]))) : null;
|
|
479
|
+
}
|
|
480
|
+
} catch {}
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
427
484
|
//#region packages/core/src/kinds.ts
|
|
428
485
|
function kindOf(type) {
|
|
429
486
|
const t = type.trim().toLowerCase();
|
|
@@ -507,6 +564,19 @@ function outwardLinks(body) {
|
|
|
507
564
|
}
|
|
508
565
|
seen.add(href);
|
|
509
566
|
}
|
|
567
|
+
for (const { href, embed, alt } of citeRefs(body)) {
|
|
568
|
+
if (!embed || seen.has(href)) continue;
|
|
569
|
+
const c = codeTarget(href);
|
|
570
|
+
if (!c || !pictureType(c.path)) continue;
|
|
571
|
+
out.push({
|
|
572
|
+
kind: "code",
|
|
573
|
+
href,
|
|
574
|
+
text: alt || c.path.split("/").at(-1),
|
|
575
|
+
path: c.path,
|
|
576
|
+
picture: true
|
|
577
|
+
});
|
|
578
|
+
seen.add(href);
|
|
579
|
+
}
|
|
510
580
|
return out;
|
|
511
581
|
}
|
|
512
582
|
//#endregion
|
|
@@ -697,7 +767,7 @@ var Bundle = class Bundle {
|
|
|
697
767
|
concept.links = links;
|
|
698
768
|
concept.outward = outwardLinks(concept.body);
|
|
699
769
|
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)) {
|
|
770
|
+
for (const { href, title, embed, alt } of citeRefs(concept.body)) {
|
|
701
771
|
const path = this.filePath(concept, href), kind = path === null ? null : citeKind(path);
|
|
702
772
|
if (path === null || kind === null) continue;
|
|
703
773
|
const t = strip((title ?? "").toLowerCase());
|
|
@@ -707,10 +777,11 @@ var Bundle = class Bundle {
|
|
|
707
777
|
embed,
|
|
708
778
|
broken: !this.files.has(path),
|
|
709
779
|
rel: rating(title),
|
|
710
|
-
align: t === "left" ? "left" : t === "center" || t === "centre" ? "center" : null
|
|
780
|
+
align: t === "left" ? "left" : t === "center" || t === "centre" ? "center" : null,
|
|
781
|
+
...embed && alt ? { alt } : {}
|
|
711
782
|
};
|
|
712
783
|
concept.cites.push(cite);
|
|
713
|
-
if (cite.broken) this.issue(concept.path, "warning", "broken-link", `broken link to ${path}`);
|
|
784
|
+
if (cite.broken) this.issue(concept.path, "warning", "broken-link", kind === "image" ? `picture not in the notes: ${path}` : `broken link to ${path}`);
|
|
714
785
|
}
|
|
715
786
|
}
|
|
716
787
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -2087,13 +2158,16 @@ function mapModel(base) {
|
|
|
2087
2158
|
s
|
|
2088
2159
|
]);
|
|
2089
2160
|
}
|
|
2161
|
+
const holdsFiles = /* @__PURE__ */ new Set();
|
|
2162
|
+
for (const f of base.files) holdsFiles.add(f.includes("/") ? f.slice(0, f.lastIndexOf("/")) : "");
|
|
2090
2163
|
const dir = (id) => {
|
|
2091
2164
|
const d = base.directories.get(id);
|
|
2092
|
-
|
|
2165
|
+
const children = [...[...d.children].sort().map(dir).filter((c) => c !== null), ...[...d.concepts].sort().map(note)];
|
|
2166
|
+
return id && !children.length && (holdsFiles.has(id) || d.children.length) ? null : {
|
|
2093
2167
|
kind: "dir",
|
|
2094
2168
|
id: "d:" + id,
|
|
2095
2169
|
ref: id,
|
|
2096
|
-
children
|
|
2170
|
+
children
|
|
2097
2171
|
};
|
|
2098
2172
|
};
|
|
2099
2173
|
return {
|
|
@@ -2216,4 +2290,4 @@ function ago(at, now = Date.now()) {
|
|
|
2216
2290
|
/** A moment is named by its last entry: the one the note is shown at. */
|
|
2217
2291
|
const momentKey = (m) => m.ids.at(-1);
|
|
2218
2292
|
//#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 };
|
|
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 };
|