javascript-excel 2.0.0-alpha.5 → 2.0.0-alpha.7

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/dom.js CHANGED
@@ -23,7 +23,16 @@ function autoWidths(rows, options = {}) {
23
23
  return Array.from(widest, (w) => Math.min(max, Math.max(min, (w ?? 0) + AUTO_WIDTH.padding)));
24
24
  }
25
25
  // src/internal/css-color.ts
26
- /** CSS colour values to RRGGBB, for computed-style mapping in javascript-excel/dom. */
26
+ /**
27
+ * CSS colour values to RRGGBB, for computed-style mapping in javascript-excel/dom.
28
+ *
29
+ * Browsers serialise computed colours in the space they were authored in, so a computed style
30
+ * can be `rgb()`/`rgba()`, `lab()`, `lch()`, `oklab()`, `oklch()` or `color(<space> …)` (CSS
31
+ * Color 4). Every form is converted to sRGB: through linear sRGB (OKLab), or through CIE XYZ
32
+ * (CIE Lab/LCH in D50 with Bradford adaptation, and the predefined RGB and XYZ spaces). Colours
33
+ * outside sRGB are clipped per channel. `none` components count as 0. The matrices are the ones
34
+ * in the CSS Color 4 sample code.
35
+ */
27
36
  const NAMED = {
28
37
  black: "000000",
29
38
  white: "FFFFFF",
@@ -46,6 +55,390 @@ const NAMED = {
46
55
  navy: "000080",
47
56
  orange: "FFA500"
48
57
  };
58
+ const mul = (m, v) => [
59
+ m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2],
60
+ m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2],
61
+ m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2]
62
+ ];
63
+ const XYZ65_TO_LSRGB = [
64
+ [
65
+ 3.2409699419045226,
66
+ -1.537383177570094,
67
+ -.4986107602930034
68
+ ],
69
+ [
70
+ -.9692436362808796,
71
+ 1.8759675015077202,
72
+ .04155505740717559
73
+ ],
74
+ [
75
+ .05563007969699366,
76
+ -.20397695888897652,
77
+ 1.0569715142428786
78
+ ]
79
+ ];
80
+ /** Bradford chromatic adaptation, D50 to D65. */
81
+ const D50_TO_D65 = [
82
+ [
83
+ .955473421488075,
84
+ -.02309845494876471,
85
+ .06325924320057072
86
+ ],
87
+ [
88
+ -.0283697093338637,
89
+ 1.0099953980813041,
90
+ .021041441191917323
91
+ ],
92
+ [
93
+ .012314014864481998,
94
+ -.020507649298898964,
95
+ 1.330365926242124
96
+ ]
97
+ ];
98
+ const LP3_TO_XYZ65 = [
99
+ [
100
+ .4865709486482162,
101
+ .26566769316909306,
102
+ .1982172852343625
103
+ ],
104
+ [
105
+ .2289745640697488,
106
+ .6917385218365064,
107
+ .079286914093745
108
+ ],
109
+ [
110
+ 0,
111
+ .04511338185890264,
112
+ 1.043944368900976
113
+ ]
114
+ ];
115
+ const LA98_TO_XYZ65 = [
116
+ [
117
+ .5766690429101305,
118
+ .1855582379065463,
119
+ .1882286462349947
120
+ ],
121
+ [
122
+ .29734497525053605,
123
+ .6273635662554661,
124
+ .07529145849399788
125
+ ],
126
+ [
127
+ .02703136138641234,
128
+ .07068885253582723,
129
+ .9913375368376388
130
+ ]
131
+ ];
132
+ const LPROPHOTO_TO_XYZ50 = [
133
+ [
134
+ .7977666449006423,
135
+ .13518129740053308,
136
+ .0313477341283922
137
+ ],
138
+ [
139
+ .2880748288194013,
140
+ .711835234241873,
141
+ 8993693872564e-17
142
+ ],
143
+ [
144
+ 0,
145
+ 0,
146
+ .8251046025104602
147
+ ]
148
+ ];
149
+ const LREC2020_TO_XYZ65 = [
150
+ [
151
+ .6369580483012914,
152
+ .14461690358620832,
153
+ .1688809751641721
154
+ ],
155
+ [
156
+ .2627002120112671,
157
+ .6779980715188708,
158
+ .05930171646986196
159
+ ],
160
+ [
161
+ 0,
162
+ .028072693049087428,
163
+ 1.060985057710791
164
+ ]
165
+ ];
166
+ const OKLAB_TO_LMS = [
167
+ [
168
+ 1,
169
+ .3963377773761749,
170
+ .2158037573099136
171
+ ],
172
+ [
173
+ 1,
174
+ -.1055613458156586,
175
+ -.0638541728258133
176
+ ],
177
+ [
178
+ 1,
179
+ -.0894841775298119,
180
+ -1.2914855480194092
181
+ ]
182
+ ];
183
+ const LMS_TO_LSRGB = [
184
+ [
185
+ 4.076741636075958,
186
+ -3.307711539258063,
187
+ .2309699031821043
188
+ ],
189
+ [
190
+ -1.2684379732850315,
191
+ 2.609757349287688,
192
+ -.3413193760026573
193
+ ],
194
+ [
195
+ -.0041960761386756,
196
+ -.7034186179359363,
197
+ 1.7076146940746117
198
+ ]
199
+ ];
200
+ const signed = (c, f) => Math.sign(c) * f(Math.abs(c));
201
+ /** The sRGB (and display-p3) transfer function, inverse: encoded to linear. */
202
+ const srgbLinear = (c) => signed(c, (a) => a <= .04045 ? a / 12.92 : ((a + .055) / 1.055) ** 2.4);
203
+ const srgbEncode = (c) => signed(c, (a) => a > .0031308 ? 1.055 * a ** (1 / 2.4) - .055 : 12.92 * a);
204
+ const a98Linear = (c) => signed(c, (a) => a ** (563 / 256));
205
+ const prophotoLinear = (c) => signed(c, (a) => a <= 16 / 512 ? a / 16 : a ** 1.8);
206
+ const REC_A = 1.09929682680944;
207
+ const REC_B = .018053968510807;
208
+ const rec2020Linear = (c) => signed(c, (a) => a < REC_B * 4.5 ? a / 4.5 : ((a + REC_A - 1) / REC_A) ** (1 / .45));
209
+ const xyz65ToLinearSrgb = (v) => mul(XYZ65_TO_LSRGB, v);
210
+ const xyz50ToLinearSrgb = (v) => mul(XYZ65_TO_LSRGB, mul(D50_TO_D65, v));
211
+ const D50 = [
212
+ .3457 / .3585,
213
+ 1,
214
+ .2958 / .3585
215
+ ];
216
+ function labToLinearSrgb(l, a, b) {
217
+ const k = 24389 / 27;
218
+ const e = 216 / 24389;
219
+ const fy = (l + 16) / 116;
220
+ const fx = a / 500 + fy;
221
+ const fz = fy - b / 200;
222
+ const xyz = [
223
+ fx ** 3 > e ? fx ** 3 : (116 * fx - 16) / k,
224
+ l > k * e ? fy ** 3 : l / k,
225
+ fz ** 3 > e ? fz ** 3 : (116 * fz - 16) / k
226
+ ];
227
+ return xyz50ToLinearSrgb([
228
+ xyz[0] * D50[0],
229
+ xyz[1] * D50[1],
230
+ xyz[2] * D50[2]
231
+ ]);
232
+ }
233
+ function oklabToLinearSrgb(l, a, b) {
234
+ const lms = mul(OKLAB_TO_LMS, [
235
+ l,
236
+ a,
237
+ b
238
+ ]);
239
+ return mul(LMS_TO_LSRGB, [
240
+ lms[0] ** 3,
241
+ lms[1] ** 3,
242
+ lms[2] ** 3
243
+ ]);
244
+ }
245
+ const toHex = (encoded) => encoded.map((c) => Math.round(Math.min(1, Math.max(0, Number.isFinite(c) ? c : 0)) * 255).toString(16).padStart(2, "0")).join("").toUpperCase();
246
+ const linearToHex = (v) => toHex([
247
+ srgbEncode(v[0]),
248
+ srgbEncode(v[1]),
249
+ srgbEncode(v[2])
250
+ ]);
251
+ /** One component: a number, a percentage (scaled so 100% = `pct`), an angle in degrees, or none (0). */
252
+ function num(token, pct) {
253
+ if (token === "none") return 0;
254
+ const m = /^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%|deg|grad|rad|turn)?$/.exec(token);
255
+ if (!m) return void 0;
256
+ const n = parseFloat(m[1]);
257
+ switch (m[2]) {
258
+ case "%": return n * pct / 100;
259
+ case "grad": return n * 360 / 400;
260
+ case "rad": return n * 180 / Math.PI;
261
+ case "turn": return n * 360;
262
+ default: return n;
263
+ }
264
+ }
265
+ /** The components and optional alpha of a functional colour, or undefined if it is malformed. */
266
+ function parts(body) {
267
+ const [main, alpha, extra] = body.split("/");
268
+ if (extra !== void 0 || main === void 0) return void 0;
269
+ const c = main.trim().split(/\s*,\s*|\s+/).filter(Boolean);
270
+ const a = alpha?.trim();
271
+ if (a === "") return void 0;
272
+ if (a === void 0 && c.length === 4 && main.includes(",")) return {
273
+ c: c.slice(0, 3),
274
+ alpha: c[3]
275
+ };
276
+ return {
277
+ c,
278
+ alpha: a
279
+ };
280
+ }
281
+ function hueRgb(h, s, l) {
282
+ const f = (n) => {
283
+ const k = (n + h / 30) % 12;
284
+ return l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1));
285
+ };
286
+ return [
287
+ f(0),
288
+ f(8),
289
+ f(4)
290
+ ];
291
+ }
292
+ /** The predefined colour spaces of color(): encoded components to linear sRGB. */
293
+ const SPACES = {
294
+ srgb: (v) => [
295
+ srgbLinear(v[0]),
296
+ srgbLinear(v[1]),
297
+ srgbLinear(v[2])
298
+ ],
299
+ "srgb-linear": (v) => v,
300
+ "display-p3": (v) => xyz65ToLinearSrgb(mul(LP3_TO_XYZ65, [
301
+ srgbLinear(v[0]),
302
+ srgbLinear(v[1]),
303
+ srgbLinear(v[2])
304
+ ])),
305
+ "a98-rgb": (v) => xyz65ToLinearSrgb(mul(LA98_TO_XYZ65, [
306
+ a98Linear(v[0]),
307
+ a98Linear(v[1]),
308
+ a98Linear(v[2])
309
+ ])),
310
+ "prophoto-rgb": (v) => xyz50ToLinearSrgb(mul(LPROPHOTO_TO_XYZ50, [
311
+ prophotoLinear(v[0]),
312
+ prophotoLinear(v[1]),
313
+ prophotoLinear(v[2])
314
+ ])),
315
+ rec2020: (v) => xyz65ToLinearSrgb(mul(LREC2020_TO_XYZ65, [
316
+ rec2020Linear(v[0]),
317
+ rec2020Linear(v[1]),
318
+ rec2020Linear(v[2])
319
+ ])),
320
+ xyz: xyz65ToLinearSrgb,
321
+ "xyz-d65": xyz65ToLinearSrgb,
322
+ "xyz-d50": xyz50ToLinearSrgb
323
+ };
324
+ function functional(fn, body) {
325
+ const p = parts(body);
326
+ if (!p) return void 0;
327
+ let space;
328
+ let c = p.c;
329
+ if (fn === "color") {
330
+ space = c[0];
331
+ c = c.slice(1);
332
+ }
333
+ if (c.length !== 3) return void 0;
334
+ if (p.alpha !== void 0) {
335
+ const a = num(p.alpha, 1);
336
+ if (a === void 0) return void 0;
337
+ if (!(a > 0)) return void 0;
338
+ }
339
+ const s = {
340
+ rgb: [
341
+ 255,
342
+ 255,
343
+ 255
344
+ ],
345
+ rgba: [
346
+ 255,
347
+ 255,
348
+ 255
349
+ ],
350
+ hsl: [
351
+ 1,
352
+ 100,
353
+ 100
354
+ ],
355
+ hsla: [
356
+ 1,
357
+ 100,
358
+ 100
359
+ ],
360
+ hwb: [
361
+ 1,
362
+ 100,
363
+ 100
364
+ ],
365
+ lab: [
366
+ 100,
367
+ 125,
368
+ 125
369
+ ],
370
+ lch: [
371
+ 100,
372
+ 150,
373
+ 1
374
+ ],
375
+ oklab: [
376
+ 1,
377
+ .4,
378
+ .4
379
+ ],
380
+ oklch: [
381
+ 1,
382
+ .4,
383
+ 1
384
+ ],
385
+ color: [
386
+ 1,
387
+ 1,
388
+ 1
389
+ ]
390
+ }[fn];
391
+ if (!s) return void 0;
392
+ const v = [];
393
+ for (let i = 0; i < 3; i++) {
394
+ const n = num(c[i], s[i]);
395
+ if (n === void 0) return void 0;
396
+ v.push(n);
397
+ }
398
+ const [x, y, z] = v;
399
+ const rad = (deg) => deg * Math.PI / 180;
400
+ switch (fn) {
401
+ case "rgb":
402
+ case "rgba": return toHex([
403
+ x / 255,
404
+ y / 255,
405
+ z / 255
406
+ ]);
407
+ case "hsl":
408
+ case "hsla": return toHex(hueRgb((x % 360 + 360) % 360, Math.max(0, y) / 100, z / 100));
409
+ case "hwb": {
410
+ const w = Math.max(0, y) / 100;
411
+ const b = Math.max(0, z) / 100;
412
+ if (w + b >= 1) {
413
+ const g = w / (w + b);
414
+ return toHex([
415
+ g,
416
+ g,
417
+ g
418
+ ]);
419
+ }
420
+ return toHex(hueRgb((x % 360 + 360) % 360, 1, .5).map((ch) => ch * (1 - w - b) + w));
421
+ }
422
+ case "lab": return linearToHex(labToLinearSrgb(Math.min(100, Math.max(0, x)), y, z));
423
+ case "lch": {
424
+ const ch = Math.max(0, y);
425
+ return linearToHex(labToLinearSrgb(Math.min(100, Math.max(0, x)), ch * Math.cos(rad(z)), ch * Math.sin(rad(z))));
426
+ }
427
+ case "oklab": return linearToHex(oklabToLinearSrgb(Math.min(1, Math.max(0, x)), y, z));
428
+ case "oklch": {
429
+ const ch = Math.max(0, y);
430
+ return linearToHex(oklabToLinearSrgb(Math.min(1, Math.max(0, x)), ch * Math.cos(rad(z)), ch * Math.sin(rad(z))));
431
+ }
432
+ default: {
433
+ const conv = space === void 0 ? void 0 : SPACES[space];
434
+ return conv ? linearToHex(conv([
435
+ x,
436
+ y,
437
+ z
438
+ ])) : void 0;
439
+ }
440
+ }
441
+ }
49
442
  /** A CSS colour as RRGGBB, or undefined for transparent or unparseable values. */
50
443
  function cssColor(value) {
51
444
  const v = value.trim().toLowerCase();
@@ -60,18 +453,8 @@ function cssColor(value) {
60
453
  if (hex.length === 8) return hex.slice(6) === "00" ? void 0 : hex.slice(0, 6).toUpperCase();
61
454
  return;
62
455
  }
63
- const m = /^rgba?\(\s*([\d.]+%?)[\s,]+([\d.]+%?)[\s,]+([\d.]+%?)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/.exec(v);
64
- if (m) {
65
- const ch = (s) => Math.round(Math.min(255, Math.max(0, s.endsWith("%") ? parseFloat(s) * 255 / 100 : parseFloat(s))));
66
- if (m[4] !== void 0) {
67
- if (!((m[4].endsWith("%") ? parseFloat(m[4]) / 100 : parseFloat(m[4])) > 0)) return void 0;
68
- }
69
- return [
70
- m[1],
71
- m[2],
72
- m[3]
73
- ].map((s) => ch(s).toString(16).padStart(2, "0")).join("").toUpperCase();
74
- }
456
+ const fn = /^([a-z]+)\(\s*([^()]*)\)$/.exec(v);
457
+ if (fn) return functional(fn[1], fn[2]);
75
458
  return NAMED[v];
76
459
  }
77
460
  function isElement(n) {
@@ -64,6 +64,36 @@ function throttleProgress(cb, intervalMs = 50) {
64
64
  cb(out);
65
65
  };
66
66
  }
67
+ function macrotask() {
68
+ const g = globalThis;
69
+ const si = g.setImmediate;
70
+ if (typeof si === "function") return () => new Promise((r) => void si(r));
71
+ const MC = g.MessageChannel;
72
+ if (typeof MC === "function") return () => new Promise((r) => {
73
+ const ch = new MC();
74
+ ch.port1.onmessage = () => {
75
+ ch.port1.close();
76
+ r();
77
+ };
78
+ ch.port2.postMessage(null);
79
+ });
80
+ const st = g.setTimeout;
81
+ if (typeof st === "function") return () => new Promise((r) => void st(r, 0));
82
+ return () => Promise.resolve();
83
+ }
84
+ /** A check to await between chunks of work: yields a macrotask once `budgetMs` has passed. */
85
+ function createYielder(budgetMs = 16) {
86
+ const perf = globalThis.performance;
87
+ const now = perf && typeof perf.now === "function" ? () => perf.now() : () => Date.now();
88
+ const wait = macrotask();
89
+ let last = now();
90
+ return () => {
91
+ if (now() - last < budgetMs) return void 0;
92
+ return wait().then(() => {
93
+ last = now();
94
+ });
95
+ };
96
+ }
67
97
  // src/internal/platform.ts
68
98
  /**
69
99
  * Minimal structural types for the web platform APIs the engine uses.
@@ -108,6 +138,8 @@ function decodeUtf8Strict(bytes) {
108
138
  return strictDecoder.decode(bytes);
109
139
  }
110
140
  const ignore = () => {};
141
+ /** Compressed bytes written to the decompressor at a time. */
142
+ const INFLATE_SLICE = 262144;
111
143
  async function deflateRaw(chunks, signal) {
112
144
  throwIfAborted(signal);
113
145
  const stream = createStream("compress");
@@ -142,7 +174,10 @@ async function* inflateRaw(data, limits, signal) {
142
174
  const stream = createStream("decompress");
143
175
  const writer = stream.writable.getWriter();
144
176
  const reader = stream.readable.getReader();
145
- const writing = writer.write(data).then(() => writer.close());
177
+ const writing = (async () => {
178
+ for (let at = 0; at < data.length; at += INFLATE_SLICE) await writer.write(data.subarray(at, at + INFLATE_SLICE));
179
+ await writer.close();
180
+ })();
146
181
  writing.catch(ignore);
147
182
  let produced = 0;
148
183
  let finished = false;
@@ -251,4 +286,4 @@ function fromDosDateTime(date, time) {
251
286
  const day = Math.max(1, date & 31);
252
287
  return new Date(Date.UTC(year, month, day, time >>> 11, time >>> 5 & 63, (time & 31) * 2));
253
288
  }
254
- export { decodeUtf8Strict as a, ByteWriter as c, nativeCodec as i, concatBytes as l, toDosDateTime as n, encodeUtf8 as o, crc32 as r, throttleProgress as s, fromDosDateTime as t, throwIfAborted as u };
289
+ export { decodeUtf8Strict as a, throttleProgress as c, throwIfAborted as d, nativeCodec as i, ByteWriter as l, toDosDateTime as n, encodeUtf8 as o, crc32 as r, createYielder as s, fromDosDateTime as t, concatBytes as u };
@@ -64,6 +64,36 @@ function throttleProgress(cb, intervalMs = 50) {
64
64
  cb(out);
65
65
  };
66
66
  }
67
+ function macrotask() {
68
+ const g = globalThis;
69
+ const si = g.setImmediate;
70
+ if (typeof si === "function") return () => new Promise((r) => void si(r));
71
+ const MC = g.MessageChannel;
72
+ if (typeof MC === "function") return () => new Promise((r) => {
73
+ const ch = new MC();
74
+ ch.port1.onmessage = () => {
75
+ ch.port1.close();
76
+ r();
77
+ };
78
+ ch.port2.postMessage(null);
79
+ });
80
+ const st = g.setTimeout;
81
+ if (typeof st === "function") return () => new Promise((r) => void st(r, 0));
82
+ return () => Promise.resolve();
83
+ }
84
+ /** A check to await between chunks of work: yields a macrotask once `budgetMs` has passed. */
85
+ function createYielder(budgetMs = 16) {
86
+ const perf = globalThis.performance;
87
+ const now = perf && typeof perf.now === "function" ? () => perf.now() : () => Date.now();
88
+ const wait = macrotask();
89
+ let last = now();
90
+ return () => {
91
+ if (now() - last < budgetMs) return void 0;
92
+ return wait().then(() => {
93
+ last = now();
94
+ });
95
+ };
96
+ }
67
97
  // src/internal/platform.ts
68
98
  /**
69
99
  * Minimal structural types for the web platform APIs the engine uses.
@@ -108,6 +138,8 @@ function decodeUtf8Strict(bytes) {
108
138
  return strictDecoder.decode(bytes);
109
139
  }
110
140
  const ignore = () => {};
141
+ /** Compressed bytes written to the decompressor at a time. */
142
+ const INFLATE_SLICE = 262144;
111
143
  async function deflateRaw(chunks, signal) {
112
144
  throwIfAborted(signal);
113
145
  const stream = createStream("compress");
@@ -142,7 +174,10 @@ async function* inflateRaw(data, limits, signal) {
142
174
  const stream = createStream("decompress");
143
175
  const writer = stream.writable.getWriter();
144
176
  const reader = stream.readable.getReader();
145
- const writing = writer.write(data).then(() => writer.close());
177
+ const writing = (async () => {
178
+ for (let at = 0; at < data.length; at += INFLATE_SLICE) await writer.write(data.subarray(at, at + INFLATE_SLICE));
179
+ await writer.close();
180
+ })();
146
181
  writing.catch(ignore);
147
182
  let produced = 0;
148
183
  let finished = false;
@@ -269,6 +304,12 @@ Object.defineProperty(exports, "crc32", {
269
304
  return crc32;
270
305
  }
271
306
  });
307
+ Object.defineProperty(exports, "createYielder", {
308
+ enumerable: true,
309
+ get: function() {
310
+ return createYielder;
311
+ }
312
+ });
272
313
  Object.defineProperty(exports, "decodeUtf8Strict", {
273
314
  enumerable: true,
274
315
  get: function() {
package/dist/import.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_pipeline = require("./pipeline-BV2q-khO.cjs");
2
+ const require_pipeline = require("./pipeline-CwLNDrKo.cjs");
3
3
  exports.applyMapping = require_pipeline.applyMapping;
4
4
  exports.coerceColumns = require_pipeline.coerceColumns;
5
5
  exports.detectHeader = require_pipeline.detectHeader;
package/dist/import.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * (docs/api.md §5.6). Header detection, type inference, locale-aware
4
4
  * parsing and column mapping, plus the `importDataset` pipeline.
5
5
  */
6
- import { A as parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-CctEa86r.cjs";
6
+ import { A as parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-DM7n0aRI.cjs";
7
7
  import { a as BlobType, i as BlobLike, n as ExcelWarningCode, r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.cjs";
8
8
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
9
9
  import { ReadLimits, SheetInfo } from "./read.cjs";
package/dist/import.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * (docs/api.md §5.6). Header detection, type inference, locale-aware
4
4
  * parsing and column mapping, plus the `importDataset` pipeline.
5
5
  */
6
- import { A as parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-I8SLmV9S.js";
6
+ import { A as parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-BuG_nn_S.js";
7
7
  import { a as BlobType, i as BlobLike, n as ExcelWarningCode, r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.js";
8
8
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
9
9
  import { ReadLimits, SheetInfo } from "./read.js";
package/dist/import.js CHANGED
@@ -1 +1 @@
1
- export { i as applyMapping, n as coerceColumns, o as detectHeader, t as importDataset, r as inferColumnTypes, a as mapColumns, s as parseDate, c as parseNumber } from "./pipeline-Snu8wBXd.js";
1
+ export { i as applyMapping, n as coerceColumns, o as detectHeader, t as importDataset, r as inferColumnTypes, a as mapColumns, s as parseDate, c as parseNumber } from "./pipeline-B9-qglvn.js";
package/dist/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_errors = require("./errors-DOPrrGS4.cjs");
3
- const require_write = require("./write-f9kcYf5K.cjs");
3
+ const require_write = require("./write-CXnhqht-.cjs");
4
4
  const require_dates = require("./dates-CA1dCizp.cjs");
5
5
  const require_sheet_names = require("./sheet-names-B8U5RAW0.cjs");
6
6
  const require_colors = require("./colors-oBpjx97l.cjs");
7
7
  const require_cells = require("./cells-CPXU722t.cjs");
8
- const require_dataset = require("./dataset-UUZCzsi3.cjs");
8
+ const require_dataset = require("./dataset-CLc6y5j8.cjs");
9
9
  const require_numfmt = require("./numfmt-BmEbm78Y.cjs");
10
10
  const require_address = require("./address-DZBHchLv.cjs");
11
11
  // src/index.ts
12
12
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
13
- const VERSION = "2.0.0-alpha.5";
13
+ const VERSION = "2.0.0-alpha.7";
14
14
  exports.BUILTIN_NUM_FMTS = require_numfmt.BUILTIN_NUM_FMTS;
15
15
  exports.CsvError = require_errors.CsvError;
16
16
  exports.EnvironmentError = require_errors.EnvironmentError;
package/dist/index.d.cts CHANGED
@@ -170,8 +170,14 @@ interface DatasetOptions<T> {
170
170
  /** COERCION_FAILED and NON_FINITE_NUMBER. */
171
171
  onWarning?: ((w: ExcelWarning) => void) | undefined;
172
172
  }
173
- /** A block for `fromDatasets`, optionally offset from the previous one. */
173
+ /** A block for `fromDatasets`: placed below or to the right of the previous one, optionally offset. */
174
174
  type DatasetBlock<T> = Dataset<T> & {
175
+ /**
176
+ * 'below' (default): `gap` empty rows below the lowest row used so far by the previous
177
+ * row of blocks, at the origin column. 'right': on the previous block's top row, `gap`
178
+ * empty columns after its last column.
179
+ */
180
+ placement?: "below" | "right" | undefined;
175
181
  offset?: {
176
182
  rows?: number | undefined;
177
183
  cols?: number | undefined;
@@ -180,10 +186,14 @@ type DatasetBlock<T> = Dataset<T> & {
180
186
  /** Builds a sheet from `{ columns, data }`. */
181
187
  export declare function fromDataset<T>(dataset: Dataset<T>, options?: DatasetOptions<T>): Sheet;
182
188
  /**
183
- * Stacks several datasets on one sheet (replaces the old xSteps/ySteps).
184
- * Each block starts `gap` empty rows (default 1) below the previous one, or
189
+ * Places several datasets on one sheet (replaces the old xSteps/ySteps).
190
+ * A block with placement 'below' (the default) starts `gap` empty rows
191
+ * (default 1) below the lowest row used by the previous row of blocks, or
185
192
  * `offset.rows` rows when given, and `offset.cols` columns right of the
186
- * origin. Freeze and filter apply to the first block with header rows.
193
+ * origin. A block with placement 'right' starts on the previous block's top
194
+ * row (moved down by `offset.rows`), `gap` empty columns plus `offset.cols`
195
+ * after the previous block's last column. Freeze and filter apply to the
196
+ * first block with header rows.
187
197
  */
188
198
  export declare function fromDatasets(blocks: Array<DatasetBlock<any>>, options?: DatasetOptions<any> & {
189
199
  gap?: number | undefined;
@@ -277,5 +287,5 @@ export declare function encodeRange(r: RangeAddress): string;
277
287
  /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
278
288
  export declare function decodeRange(ref: string): RangeAddress;
279
289
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
280
- export declare const VERSION = "2.0.0-alpha.5";
290
+ export declare const VERSION = "2.0.0-alpha.7";
281
291
  export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColorContext, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, toBlob, toUint8Array };