@quario/csv 0.4.0 → 0.6.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.6.0] - 2026-09-07
11
+
12
+ ### Changed
13
+
14
+ - Requires quario ^0.6.0
15
+
16
+ ## [0.5.0] - 2026-09-05
17
+
18
+ ### Added
19
+
20
+ - **Spans keep the record rectangular.** A cell covering several columns writes
21
+ its value in the first field it covers and leaves the rest empty, so every
22
+ record is the same width. This target reads no geometry, so there is nothing
23
+ here for a merge to mean.
24
+
10
25
  ## [0.4.0] - 2026-09-03
11
26
 
12
27
  ### Changed
package/README.md CHANGED
@@ -82,12 +82,13 @@ blocks the host. Render-time failures reject with located errors.
82
82
 
83
83
  The banded walk flattened as records in render order: report-header items, then per group
84
84
  instance its header items, nested content, and footer items, then the table's header record,
85
- data records, and total record, then report-footer items. Grouping exists as that order
85
+ data records, and total records, then report-footer items. Grouping exists as that order
86
86
  alone. Group boundaries add no records of their own, and `break: "page"` and `reset: "page"`
87
87
  are ignored. This target is unpaginated: `report-start.page` band closures are ignored.
88
88
 
89
- Each item takes one record with one field. A report that is one table and no other bands has
90
- its column headers as record 1; any other band makes the file ragged.
89
+ Each item takes one record with one field; a split takes one record with a field per slot, and a
90
+ spanning cell writes empty fields for the columns it covers so positions hold. A report that is one
91
+ table and no other bands has its column headers as record 1; any other band makes the file ragged.
91
92
 
92
93
  ### Typed fields
93
94
 
@@ -105,8 +106,8 @@ A hidden cell keeps its column slot as an empty field.
105
106
 
106
107
  ### Unread
107
108
 
108
- `style`, column `width`, page columns, page bands, and images: nothing looks at them. An
109
- image emits no record.
109
+ `style`, column `width`, slot `width`, page columns, page bands, and images: nothing looks at
110
+ them. An image emits no record, though an image in a slot still writes its empty field.
110
111
 
111
112
  ### Text shape
112
113
 
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) => {
@@ -73,8 +88,7 @@ export function csv() {
73
88
  split = null;
74
89
  },
75
90
  "table-start": (event) => {
76
- out +=
77
- event.columns.map((/** @type {any} */ column) => field(column.header)).join(",") + "\n";
91
+ out += spread(event.header.cells).join(",") + "\n";
78
92
  },
79
93
  row: record,
80
94
  "total-row": record,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quario/csv",
3
- "version": "0.4.0",
3
+ "version": "0.6.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.4.0",
41
+ "quario": "^0.6.0",
42
42
  "size-limit": "^13.0.3",
43
43
  "typescript": "^7.0.2"
44
44
  },
45
45
  "peerDependencies": {
46
- "quario": "^0.4.0"
46
+ "quario": "^0.6.0"
47
47
  },
48
48
  "size-limit": [
49
49
  {