@ai-matrx/rich-content 0.2.35 → 0.2.36
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.36
|
|
4
|
+
|
|
5
|
+
- `tableToDelimited(table, "\t")` goes through THE one writer (kit `toDelimited`, formula-guarded like the CSV): a cell holding a tab, a quote or a line break is quoted instead of collapsed to a space.
|
|
6
|
+
- The diagram block's "Screenshot" PDF variants are a picture of a surface: Alchemy `renderElement` → `pagesToPdf` → kit `downloadFile` (as the org chart's export), no longer html2canvas `captureToPDF` (AP-2 fifth check).
|
|
7
|
+
|
|
8
|
+
**Consumer action:** a test asserting the old flattened TSV (`z w` for `z\tw`) now reads `"z\tw"` quoted.
|
|
9
|
+
|
|
3
10
|
## 0.2.35
|
|
4
11
|
|
|
5
12
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Diagram Block Printer
|
|
3
3
|
*
|
|
4
4
|
* Two output strategies:
|
|
5
|
-
* 1. "capture" variants —
|
|
6
|
-
*
|
|
5
|
+
* 1. "capture" variants — a picture of the live ReactFlow surface: Alchemy's
|
|
6
|
+
* `renderElement` (the SVG foreignObject renderer, so oklch/lab CSS paints as
|
|
7
|
+
* the browser paints it) → print's `pagesToPdf` (through /operate/capture)
|
|
8
|
+
* → kit `downloadFile` — the same path as the org chart's export
|
|
7
9
|
* 2. "svg-export" variant — walk the diagram JSON and emit a pure SVG
|
|
8
10
|
* placed inside a styled print document → browser print dialog
|
|
9
11
|
*
|
|
@@ -2,18 +2,22 @@ import {
|
|
|
2
2
|
openPrintWindow
|
|
3
3
|
} from "@ai-matrx/print/core";
|
|
4
4
|
async function captureDiagramToPDF(element, diagram, settings) {
|
|
5
|
-
const {
|
|
5
|
+
const { renderElement, pagesToPdf } = await import("@ai-matrx/alchemy/operate/capture");
|
|
6
|
+
const { downloadFile } = await import("@ai-matrx/kit/download");
|
|
6
7
|
const orientation = settings["orientation"] ?? "landscape";
|
|
7
8
|
const paperSize = settings["paperSize"] ?? "a4";
|
|
8
9
|
const isDark = settings["darkMode"] ?? false;
|
|
9
10
|
const background = isDark ? "#111827" : "#ffffff";
|
|
10
|
-
await
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
background,
|
|
14
|
-
filename: diagram.title.replace(/[^a-z0-9]/gi, "_").toLowerCase() || "diagram",
|
|
15
|
-
scale: settings["highRes"] ? 3 : 2
|
|
11
|
+
const canvas = await renderElement(element, {
|
|
12
|
+
pixelRatio: settings["highRes"] ? 3 : 2,
|
|
13
|
+
backgroundColor: background
|
|
16
14
|
});
|
|
15
|
+
const pdf = await pagesToPdf(
|
|
16
|
+
[{ image: canvas, imageType: "JPEG", quality: 0.92, compression: "FAST", placement: { top: 24, right: 24, bottom: 24, left: 24 } }],
|
|
17
|
+
{ orientation, unit: "pt", format: paperSize }
|
|
18
|
+
);
|
|
19
|
+
const name = diagram.title.replace(/[^a-z0-9]/gi, "_").toLowerCase() || "diagram";
|
|
20
|
+
downloadFile(`${name}.pdf`, pdf, "application/pdf");
|
|
17
21
|
}
|
|
18
22
|
const SVG_COLORS = {
|
|
19
23
|
start: { bg: "#dcfce7", border: "#16a34a", text: "#14532d" },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tableToCsv } from "../../display/tables/table-csv.js";
|
|
2
|
+
import { toDelimited } from "@ai-matrx/kit/delimited";
|
|
2
3
|
import { unwrapCodeSpans } from "@ai-matrx/content-ir/source";
|
|
3
4
|
import {
|
|
4
5
|
findTableEnd,
|
|
@@ -29,8 +30,7 @@ function parseFirstMarkdownTable(content) {
|
|
|
29
30
|
}
|
|
30
31
|
function tableToDelimited(table, delimiter) {
|
|
31
32
|
if (delimiter === ",") return tableToCsv(table.headers, table.rows);
|
|
32
|
-
|
|
33
|
-
return [table.headers, ...table.rows].map((row) => row.map(flat).join(" ")).join("\n");
|
|
33
|
+
return toDelimited([table.headers, ...table.rows], { format: "tsv" });
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
36
|
cleanCell,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/rich-content",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"description": "The AI Matrx formatted-text engine: the one markdown renderer, streaming markdown, the block splitter and renderer, the generic blocks, <RichContent> levels, the rich-document action registry and menus, copy, and the selection toolbar — as portable React.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -131,20 +131,20 @@
|
|
|
131
131
|
"unist-util-visit-parents": "^6.0.2",
|
|
132
132
|
"yaml": "^2.9.1",
|
|
133
133
|
"@ai-matrx/alchemy": "latest",
|
|
134
|
-
"@ai-matrx/content-ir": "latest",
|
|
135
134
|
"@ai-matrx/canvas": "latest",
|
|
136
|
-
"@ai-matrx/
|
|
135
|
+
"@ai-matrx/agents": "latest",
|
|
136
|
+
"@ai-matrx/content-ir": "latest",
|
|
137
137
|
"@ai-matrx/data": "latest",
|
|
138
|
-
"@ai-matrx/
|
|
138
|
+
"@ai-matrx/content-ir-react": "latest",
|
|
139
139
|
"@ai-matrx/diff": "latest",
|
|
140
|
-
"@ai-matrx/
|
|
141
|
-
"@ai-matrx/icons": "latest",
|
|
140
|
+
"@ai-matrx/design-system": "latest",
|
|
142
141
|
"@ai-matrx/media": "latest",
|
|
143
142
|
"@ai-matrx/print": "latest",
|
|
144
143
|
"@ai-matrx/records": "latest",
|
|
145
144
|
"@ai-matrx/records-ui": "latest",
|
|
146
145
|
"@ai-matrx/tap-target": "latest",
|
|
147
|
-
"@ai-matrx/kit": "latest"
|
|
146
|
+
"@ai-matrx/kit": "latest",
|
|
147
|
+
"@ai-matrx/icons": "latest"
|
|
148
148
|
},
|
|
149
149
|
"peerDependencies": {
|
|
150
150
|
"react": ">=19.0.0",
|