mindcache 3.7.0 → 3.8.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/server.mjs CHANGED
@@ -527,18 +527,23 @@ var MarkdownSerializer = class {
527
527
  /**
528
528
  * Export MindCache data to Markdown format.
529
529
  */
530
- static toMarkdown(mc) {
530
+ static toMarkdown(mc, options) {
531
531
  const now = /* @__PURE__ */ new Date();
532
532
  const lines = [];
533
533
  const appendixEntries = [];
534
534
  let appendixCounter = 0;
535
- lines.push("# MindCache STM Export");
535
+ const name = options?.name || "MindCache Export";
536
+ lines.push(`# ${name}`);
536
537
  lines.push("");
538
+ if (options?.description) {
539
+ lines.push(options.description);
540
+ lines.push("");
541
+ }
537
542
  lines.push(`Export Date: ${now.toISOString().split("T")[0]}`);
538
543
  lines.push("");
539
544
  lines.push("---");
540
545
  lines.push("");
541
- lines.push("## STM Entries");
546
+ lines.push("## Keys & Values");
542
547
  lines.push("");
543
548
  const sortedKeys = mc.getSortedKeys();
544
549
  sortedKeys.forEach((key) => {
@@ -546,9 +551,17 @@ var MarkdownSerializer = class {
546
551
  const value = mc.get_value(key);
547
552
  lines.push(`### ${key}`);
548
553
  const entryType = attributes?.type || "text";
549
- lines.push(`- **Type**: \`${entryType}\``);
550
- lines.push(`- **System Tags**: \`${attributes?.systemTags?.join(", ") || "none"}\``);
551
- lines.push(`- **Z-Index**: \`${attributes?.zIndex ?? 0}\``);
554
+ if (entryType !== "text") {
555
+ lines.push(`- **Type**: \`${entryType}\``);
556
+ }
557
+ const systemTags = attributes?.systemTags;
558
+ if (systemTags && systemTags.length > 0) {
559
+ lines.push(`- **System Tags**: \`${systemTags.join(", ")}\``);
560
+ }
561
+ const zIndex = attributes?.zIndex ?? 0;
562
+ if (zIndex !== 0) {
563
+ lines.push(`- **Z-Index**: \`${zIndex}\``);
564
+ }
552
565
  if (attributes?.contentTags && attributes.contentTags.length > 0) {
553
566
  lines.push(`- **Tags**: \`${attributes.contentTags.join("`, `")}\``);
554
567
  }
@@ -727,7 +740,7 @@ var MarkdownSerializer = class {
727
740
  mc.set_value(currentKey, currentValue.trim(), currentAttributes);
728
741
  }
729
742
  const hasParsedKeys = lines.some((line) => line.startsWith("### ") && !line.startsWith("### Appendix"));
730
- const isSTMExport = markdown.includes("# MindCache STM Export") || markdown.includes("## STM Entries");
743
+ const isSTMExport = markdown.includes("# MindCache STM Export") || markdown.includes("## STM Entries") || markdown.includes("## Keys & Values") || markdown.includes("# MindCache Export");
731
744
  if (!hasParsedKeys && !isSTMExport && markdown.trim().length > 0) {
732
745
  mc.set_value("imported_content", markdown.trim(), {
733
746
  type: "text",
@@ -855,7 +868,7 @@ var MarkdownSerializer = class {
855
868
  }
856
869
  saveEntry();
857
870
  const hasParsedKeys = lines.some((line) => line.startsWith("### ") && !line.startsWith("### Appendix"));
858
- const isSTMExport = markdown.includes("# MindCache STM Export") || markdown.includes("## STM Entries");
871
+ const isSTMExport = markdown.includes("# MindCache STM Export") || markdown.includes("## STM Entries") || markdown.includes("## Keys & Values") || markdown.includes("# MindCache Export");
859
872
  if (!hasParsedKeys && !isSTMExport && markdown.trim().length > 0) {
860
873
  result["imported_content"] = {
861
874
  value: markdown.trim(),
@@ -1586,7 +1599,7 @@ var MindCache = class {
1586
1599
  listeners = {};
1587
1600
  globalListeners = [];
1588
1601
  // Metadata
1589
- version = "3.6.0";
1602
+ version = "3.8.0";
1590
1603
  // Internal flag to prevent sync loops when receiving remote updates
1591
1604
  // (Less critical with Yjs but kept for API compat)
1592
1605
  normalizeSystemTags(tags) {
@@ -2681,9 +2694,10 @@ var MindCache = class {
2681
2694
  }
2682
2695
  /**
2683
2696
  * Export to Markdown format.
2697
+ * @param options Optional name and description for the export
2684
2698
  */
2685
- toMarkdown() {
2686
- return MarkdownSerializer.toMarkdown(this);
2699
+ toMarkdown(options) {
2700
+ return MarkdownSerializer.toMarkdown(this, options);
2687
2701
  }
2688
2702
  /**
2689
2703
  * Import from Markdown format.