@quario/csv 0.3.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.0] - 2026-09-05
11
+
12
+ ### Added
13
+
14
+ - **Spans keep the record rectangular.** A cell covering several columns writes
15
+ its value in the first field it covers and leaves the rest empty, so every
16
+ record is the same width. This target reads no geometry, so there is nothing
17
+ here for a merge to mean.
18
+
19
+ ## [0.4.0] - 2026-09-03
20
+
21
+ ### Changed
22
+
23
+ - Requires quario ^0.4.0
24
+
10
25
  ## [0.3.0] - 2026-09-02
11
26
 
12
27
  ### Changed
package/lib/index.js CHANGED
@@ -46,8 +46,23 @@ export function csv() {
46
46
  // record. Splits never nest, so one buffer is enough.
47
47
  /** @type {string[] | null} */
48
48
  let split = null;
49
+ // A record is rectangular, always: a cell covering several columns puts
50
+ // its value in the first field it covers and leaves the rest empty
51
+ // (docs/adr/0047). This target reads no styles and has no geometry to
52
+ // honour, so a merge is not a thing it could mean. Data rows carry no
53
+ // spans, so for them this is `map(field)`.
54
+ /** @type {(cells: any[]) => string[]} */
55
+ let spread = (cells) => {
56
+ /** @type {string[]} */
57
+ let fields = [];
58
+ for (let cell of cells) {
59
+ fields.push(field(cell));
60
+ for (let covered = 1; covered < (cell.span || 1); covered++) fields.push("");
61
+ }
62
+ return fields;
63
+ };
49
64
  let record = (/** @type {any} */ event) => {
50
- out += event.cells.map(field).join(",") + "\n";
65
+ out += spread(event.cells).join(",") + "\n";
51
66
  };
52
67
  await walk(stream(data), {
53
68
  "report-start": (event) => {
@@ -74,7 +89,11 @@ export function csv() {
74
89
  },
75
90
  "table-start": (event) => {
76
91
  out +=
77
- event.columns.map((/** @type {any} */ column) => field(column.header)).join(",") + "\n";
92
+ spread(
93
+ event.columns
94
+ .filter((/** @type {any} */ column) => column.header)
95
+ .map((/** @type {any} */ column) => column.header),
96
+ ).join(",") + "\n";
78
97
  },
79
98
  row: record,
80
99
  "total-row": record,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quario/csv",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "The CSV render target for quario — in the makings, not yet released",
5
5
  "homepage": "https://getquario.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -38,12 +38,12 @@
38
38
  "devDependencies": {
39
39
  "@arethetypeswrong/cli": "^0.18.3",
40
40
  "@size-limit/preset-small-lib": "^13.0.3",
41
- "quario": "^0.3.0",
41
+ "quario": "^0.5.0",
42
42
  "size-limit": "^13.0.3",
43
43
  "typescript": "^7.0.2"
44
44
  },
45
45
  "peerDependencies": {
46
- "quario": "^0.3.0"
46
+ "quario": "^0.5.0"
47
47
  },
48
48
  "size-limit": [
49
49
  {