apple-notes-mcp 2.8.18 → 2.8.20
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/build/index.js +35 -16
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -39331,6 +39331,15 @@ function embeddedMessage(field) {
|
|
|
39331
39331
|
return decodeMessage(bytes);
|
|
39332
39332
|
}
|
|
39333
39333
|
|
|
39334
|
+
// src/utils/checklistRuns.ts
|
|
39335
|
+
function checklistRunLineStart(text, position, length) {
|
|
39336
|
+
const end = position + length;
|
|
39337
|
+
let anchor = position;
|
|
39338
|
+
while (anchor < end && text[anchor] === "\n") anchor++;
|
|
39339
|
+
if (anchor === end) anchor = position;
|
|
39340
|
+
return anchor === 0 ? 0 : text.lastIndexOf("\n", anchor - 1) + 1;
|
|
39341
|
+
}
|
|
39342
|
+
|
|
39334
39343
|
// src/utils/checklistParser.ts
|
|
39335
39344
|
var CHECKLIST_STYLE_TYPE = 103;
|
|
39336
39345
|
var NOTES_DB_PATH = path.join(
|
|
@@ -39398,6 +39407,9 @@ function parseChecklistFromProtobuf(data) {
|
|
|
39398
39407
|
const attributeRuns = getFields(noteBodyFields, 5);
|
|
39399
39408
|
if (attributeRuns.length === 0) return null;
|
|
39400
39409
|
const lines = noteText.split("\n");
|
|
39410
|
+
const lineStarts = [];
|
|
39411
|
+
for (let i = 0, start = 0; i < lines.length; start += lines[i].length + 1, i++)
|
|
39412
|
+
lineStarts.push(start);
|
|
39401
39413
|
const items = [];
|
|
39402
39414
|
let charPos = 0;
|
|
39403
39415
|
const seenLines = /* @__PURE__ */ new Set();
|
|
@@ -39414,18 +39426,13 @@ function parseChecklistFromProtobuf(data) {
|
|
|
39414
39426
|
const checklistField = getField(styleFields, 5);
|
|
39415
39427
|
const checklistFields = embeddedMessage(checklistField);
|
|
39416
39428
|
const done = checklistFields ? varintValue(getField(checklistFields, 2)) ?? 0 : 0;
|
|
39417
|
-
|
|
39418
|
-
|
|
39419
|
-
|
|
39420
|
-
|
|
39421
|
-
|
|
39422
|
-
|
|
39423
|
-
|
|
39424
|
-
done: done === 1
|
|
39425
|
-
});
|
|
39426
|
-
break;
|
|
39427
|
-
}
|
|
39428
|
-
lineStart = lineEnd + 1;
|
|
39429
|
+
const lineIdx = charPos <= noteText.length ? lineStarts.indexOf(checklistRunLineStart(noteText, charPos, runLength)) : -1;
|
|
39430
|
+
if (lineIdx !== -1 && !seenLines.has(lineIdx)) {
|
|
39431
|
+
seenLines.add(lineIdx);
|
|
39432
|
+
items.push({
|
|
39433
|
+
text: lines[lineIdx],
|
|
39434
|
+
done: done === 1
|
|
39435
|
+
});
|
|
39429
39436
|
}
|
|
39430
39437
|
}
|
|
39431
39438
|
}
|
|
@@ -39616,7 +39623,7 @@ function parseRichNote(data, nativeTags = []) {
|
|
|
39616
39623
|
const checklist = embeddedMessage(getField(paragraph, 5));
|
|
39617
39624
|
const rawId = checklist && getField(checklist, 1)?.value;
|
|
39618
39625
|
const itemId = rawId instanceof Uint8Array ? Buffer.from(rawId).toString("hex") : "";
|
|
39619
|
-
const start = text
|
|
39626
|
+
const start = checklistRunLineStart(text, position, length);
|
|
39620
39627
|
if (itemId && !checklistItems.some((item) => item.id === itemId))
|
|
39621
39628
|
checklistItems.push({
|
|
39622
39629
|
id: itemId,
|
|
@@ -42910,10 +42917,22 @@ function appendMarkdownHtml(markdown) {
|
|
|
42910
42917
|
|
|
42911
42918
|
// src/utils/noteRevision.ts
|
|
42912
42919
|
var INLINE_TAG = /^<\/?(?:b|i|u|s|strike|em|strong|span|a|font|sub|sup|code|tt|small|big|mark)\b/i;
|
|
42920
|
+
var LEGACY_ENTITIES = {
|
|
42921
|
+
nbsp: " ",
|
|
42922
|
+
quot: '"',
|
|
42923
|
+
lt: "<",
|
|
42924
|
+
gt: ">",
|
|
42925
|
+
amp: "&"
|
|
42926
|
+
};
|
|
42913
42927
|
function comparableVisibleText(html) {
|
|
42914
|
-
return html.replace(/<br\s*\/?\s*>/gi, " ").replace(/<[^>]*>/g, (tag) => INLINE_TAG.test(tag) ? "" : " ").replace(
|
|
42915
|
-
|
|
42916
|
-
(_match,
|
|
42928
|
+
return html.replace(/<br\s*\/?\s*>/gi, " ").replace(/<[^>]*>/g, (tag) => INLINE_TAG.test(tag) ? "" : " ").replace(
|
|
42929
|
+
/&(?:(nbsp|quot|lt|gt|amp);?|apos;|#(\d+);|#x([0-9a-f]+);)/gi,
|
|
42930
|
+
(_match, legacy, dec, hex2) => {
|
|
42931
|
+
if (legacy) return LEGACY_ENTITIES[legacy.toLowerCase()];
|
|
42932
|
+
if (dec) return String.fromCodePoint(Number(dec));
|
|
42933
|
+
if (hex2) return String.fromCodePoint(Number.parseInt(hex2, 16));
|
|
42934
|
+
return "'";
|
|
42935
|
+
}
|
|
42917
42936
|
).replace(/\s+/g, " ").trim();
|
|
42918
42937
|
}
|
|
42919
42938
|
|
package/package.json
CHANGED