javascript-excel 2.0.0-alpha.5 → 2.0.0-alpha.6
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.cjs +396 -13
- package/dist/dom.js +396 -13
- package/dist/import.cjs +1 -1
- package/dist/import.d.cts +1 -1
- package/dist/import.d.ts +1 -1
- package/dist/import.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{pipeline-I8SLmV9S.d.ts → pipeline-BuG_nn_S.d.ts} +3 -0
- package/dist/{pipeline-CctEa86r.d.cts → pipeline-DM7n0aRI.d.cts} +3 -0
- package/dist/{pipeline-BV2q-khO.cjs → pipeline-DwJjPL7r.cjs} +60 -21
- package/dist/{pipeline-Snu8wBXd.js → pipeline-DyWvM9t2.js} +60 -21
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/package.json +1 -1
package/dist/dom.cjs
CHANGED
|
@@ -24,7 +24,16 @@ function autoWidths(rows, options = {}) {
|
|
|
24
24
|
return Array.from(widest, (w) => Math.min(max, Math.max(min, (w ?? 0) + require_sheet_names.AUTO_WIDTH.padding)));
|
|
25
25
|
}
|
|
26
26
|
// src/internal/css-color.ts
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* CSS colour values to RRGGBB, for computed-style mapping in javascript-excel/dom.
|
|
29
|
+
*
|
|
30
|
+
* Browsers serialise computed colours in the space they were authored in, so a computed style
|
|
31
|
+
* can be `rgb()`/`rgba()`, `lab()`, `lch()`, `oklab()`, `oklch()` or `color(<space> …)` (CSS
|
|
32
|
+
* Color 4). Every form is converted to sRGB: through linear sRGB (OKLab), or through CIE XYZ
|
|
33
|
+
* (CIE Lab/LCH in D50 with Bradford adaptation, and the predefined RGB and XYZ spaces). Colours
|
|
34
|
+
* outside sRGB are clipped per channel. `none` components count as 0. The matrices are the ones
|
|
35
|
+
* in the CSS Color 4 sample code.
|
|
36
|
+
*/
|
|
28
37
|
const NAMED = {
|
|
29
38
|
black: "000000",
|
|
30
39
|
white: "FFFFFF",
|
|
@@ -47,6 +56,390 @@ const NAMED = {
|
|
|
47
56
|
navy: "000080",
|
|
48
57
|
orange: "FFA500"
|
|
49
58
|
};
|
|
59
|
+
const mul = (m, v) => [
|
|
60
|
+
m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2],
|
|
61
|
+
m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2],
|
|
62
|
+
m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2]
|
|
63
|
+
];
|
|
64
|
+
const XYZ65_TO_LSRGB = [
|
|
65
|
+
[
|
|
66
|
+
3.2409699419045226,
|
|
67
|
+
-1.537383177570094,
|
|
68
|
+
-.4986107602930034
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
-.9692436362808796,
|
|
72
|
+
1.8759675015077202,
|
|
73
|
+
.04155505740717559
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
.05563007969699366,
|
|
77
|
+
-.20397695888897652,
|
|
78
|
+
1.0569715142428786
|
|
79
|
+
]
|
|
80
|
+
];
|
|
81
|
+
/** Bradford chromatic adaptation, D50 to D65. */
|
|
82
|
+
const D50_TO_D65 = [
|
|
83
|
+
[
|
|
84
|
+
.955473421488075,
|
|
85
|
+
-.02309845494876471,
|
|
86
|
+
.06325924320057072
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
-.0283697093338637,
|
|
90
|
+
1.0099953980813041,
|
|
91
|
+
.021041441191917323
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
.012314014864481998,
|
|
95
|
+
-.020507649298898964,
|
|
96
|
+
1.330365926242124
|
|
97
|
+
]
|
|
98
|
+
];
|
|
99
|
+
const LP3_TO_XYZ65 = [
|
|
100
|
+
[
|
|
101
|
+
.4865709486482162,
|
|
102
|
+
.26566769316909306,
|
|
103
|
+
.1982172852343625
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
.2289745640697488,
|
|
107
|
+
.6917385218365064,
|
|
108
|
+
.079286914093745
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
0,
|
|
112
|
+
.04511338185890264,
|
|
113
|
+
1.043944368900976
|
|
114
|
+
]
|
|
115
|
+
];
|
|
116
|
+
const LA98_TO_XYZ65 = [
|
|
117
|
+
[
|
|
118
|
+
.5766690429101305,
|
|
119
|
+
.1855582379065463,
|
|
120
|
+
.1882286462349947
|
|
121
|
+
],
|
|
122
|
+
[
|
|
123
|
+
.29734497525053605,
|
|
124
|
+
.6273635662554661,
|
|
125
|
+
.07529145849399788
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
.02703136138641234,
|
|
129
|
+
.07068885253582723,
|
|
130
|
+
.9913375368376388
|
|
131
|
+
]
|
|
132
|
+
];
|
|
133
|
+
const LPROPHOTO_TO_XYZ50 = [
|
|
134
|
+
[
|
|
135
|
+
.7977666449006423,
|
|
136
|
+
.13518129740053308,
|
|
137
|
+
.0313477341283922
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
.2880748288194013,
|
|
141
|
+
.711835234241873,
|
|
142
|
+
8993693872564e-17
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
0,
|
|
146
|
+
0,
|
|
147
|
+
.8251046025104602
|
|
148
|
+
]
|
|
149
|
+
];
|
|
150
|
+
const LREC2020_TO_XYZ65 = [
|
|
151
|
+
[
|
|
152
|
+
.6369580483012914,
|
|
153
|
+
.14461690358620832,
|
|
154
|
+
.1688809751641721
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
.2627002120112671,
|
|
158
|
+
.6779980715188708,
|
|
159
|
+
.05930171646986196
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
0,
|
|
163
|
+
.028072693049087428,
|
|
164
|
+
1.060985057710791
|
|
165
|
+
]
|
|
166
|
+
];
|
|
167
|
+
const OKLAB_TO_LMS = [
|
|
168
|
+
[
|
|
169
|
+
1,
|
|
170
|
+
.3963377773761749,
|
|
171
|
+
.2158037573099136
|
|
172
|
+
],
|
|
173
|
+
[
|
|
174
|
+
1,
|
|
175
|
+
-.1055613458156586,
|
|
176
|
+
-.0638541728258133
|
|
177
|
+
],
|
|
178
|
+
[
|
|
179
|
+
1,
|
|
180
|
+
-.0894841775298119,
|
|
181
|
+
-1.2914855480194092
|
|
182
|
+
]
|
|
183
|
+
];
|
|
184
|
+
const LMS_TO_LSRGB = [
|
|
185
|
+
[
|
|
186
|
+
4.076741636075958,
|
|
187
|
+
-3.307711539258063,
|
|
188
|
+
.2309699031821043
|
|
189
|
+
],
|
|
190
|
+
[
|
|
191
|
+
-1.2684379732850315,
|
|
192
|
+
2.609757349287688,
|
|
193
|
+
-.3413193760026573
|
|
194
|
+
],
|
|
195
|
+
[
|
|
196
|
+
-.0041960761386756,
|
|
197
|
+
-.7034186179359363,
|
|
198
|
+
1.7076146940746117
|
|
199
|
+
]
|
|
200
|
+
];
|
|
201
|
+
const signed = (c, f) => Math.sign(c) * f(Math.abs(c));
|
|
202
|
+
/** The sRGB (and display-p3) transfer function, inverse: encoded to linear. */
|
|
203
|
+
const srgbLinear = (c) => signed(c, (a) => a <= .04045 ? a / 12.92 : ((a + .055) / 1.055) ** 2.4);
|
|
204
|
+
const srgbEncode = (c) => signed(c, (a) => a > .0031308 ? 1.055 * a ** (1 / 2.4) - .055 : 12.92 * a);
|
|
205
|
+
const a98Linear = (c) => signed(c, (a) => a ** (563 / 256));
|
|
206
|
+
const prophotoLinear = (c) => signed(c, (a) => a <= 16 / 512 ? a / 16 : a ** 1.8);
|
|
207
|
+
const REC_A = 1.09929682680944;
|
|
208
|
+
const REC_B = .018053968510807;
|
|
209
|
+
const rec2020Linear = (c) => signed(c, (a) => a < REC_B * 4.5 ? a / 4.5 : ((a + REC_A - 1) / REC_A) ** (1 / .45));
|
|
210
|
+
const xyz65ToLinearSrgb = (v) => mul(XYZ65_TO_LSRGB, v);
|
|
211
|
+
const xyz50ToLinearSrgb = (v) => mul(XYZ65_TO_LSRGB, mul(D50_TO_D65, v));
|
|
212
|
+
const D50 = [
|
|
213
|
+
.3457 / .3585,
|
|
214
|
+
1,
|
|
215
|
+
.2958 / .3585
|
|
216
|
+
];
|
|
217
|
+
function labToLinearSrgb(l, a, b) {
|
|
218
|
+
const k = 24389 / 27;
|
|
219
|
+
const e = 216 / 24389;
|
|
220
|
+
const fy = (l + 16) / 116;
|
|
221
|
+
const fx = a / 500 + fy;
|
|
222
|
+
const fz = fy - b / 200;
|
|
223
|
+
const xyz = [
|
|
224
|
+
fx ** 3 > e ? fx ** 3 : (116 * fx - 16) / k,
|
|
225
|
+
l > k * e ? fy ** 3 : l / k,
|
|
226
|
+
fz ** 3 > e ? fz ** 3 : (116 * fz - 16) / k
|
|
227
|
+
];
|
|
228
|
+
return xyz50ToLinearSrgb([
|
|
229
|
+
xyz[0] * D50[0],
|
|
230
|
+
xyz[1] * D50[1],
|
|
231
|
+
xyz[2] * D50[2]
|
|
232
|
+
]);
|
|
233
|
+
}
|
|
234
|
+
function oklabToLinearSrgb(l, a, b) {
|
|
235
|
+
const lms = mul(OKLAB_TO_LMS, [
|
|
236
|
+
l,
|
|
237
|
+
a,
|
|
238
|
+
b
|
|
239
|
+
]);
|
|
240
|
+
return mul(LMS_TO_LSRGB, [
|
|
241
|
+
lms[0] ** 3,
|
|
242
|
+
lms[1] ** 3,
|
|
243
|
+
lms[2] ** 3
|
|
244
|
+
]);
|
|
245
|
+
}
|
|
246
|
+
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();
|
|
247
|
+
const linearToHex = (v) => toHex([
|
|
248
|
+
srgbEncode(v[0]),
|
|
249
|
+
srgbEncode(v[1]),
|
|
250
|
+
srgbEncode(v[2])
|
|
251
|
+
]);
|
|
252
|
+
/** One component: a number, a percentage (scaled so 100% = `pct`), an angle in degrees, or none (0). */
|
|
253
|
+
function num(token, pct) {
|
|
254
|
+
if (token === "none") return 0;
|
|
255
|
+
const m = /^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%|deg|grad|rad|turn)?$/.exec(token);
|
|
256
|
+
if (!m) return void 0;
|
|
257
|
+
const n = parseFloat(m[1]);
|
|
258
|
+
switch (m[2]) {
|
|
259
|
+
case "%": return n * pct / 100;
|
|
260
|
+
case "grad": return n * 360 / 400;
|
|
261
|
+
case "rad": return n * 180 / Math.PI;
|
|
262
|
+
case "turn": return n * 360;
|
|
263
|
+
default: return n;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/** The components and optional alpha of a functional colour, or undefined if it is malformed. */
|
|
267
|
+
function parts(body) {
|
|
268
|
+
const [main, alpha, extra] = body.split("/");
|
|
269
|
+
if (extra !== void 0 || main === void 0) return void 0;
|
|
270
|
+
const c = main.trim().split(/\s*,\s*|\s+/).filter(Boolean);
|
|
271
|
+
const a = alpha?.trim();
|
|
272
|
+
if (a === "") return void 0;
|
|
273
|
+
if (a === void 0 && c.length === 4 && main.includes(",")) return {
|
|
274
|
+
c: c.slice(0, 3),
|
|
275
|
+
alpha: c[3]
|
|
276
|
+
};
|
|
277
|
+
return {
|
|
278
|
+
c,
|
|
279
|
+
alpha: a
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function hueRgb(h, s, l) {
|
|
283
|
+
const f = (n) => {
|
|
284
|
+
const k = (n + h / 30) % 12;
|
|
285
|
+
return l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
|
286
|
+
};
|
|
287
|
+
return [
|
|
288
|
+
f(0),
|
|
289
|
+
f(8),
|
|
290
|
+
f(4)
|
|
291
|
+
];
|
|
292
|
+
}
|
|
293
|
+
/** The predefined colour spaces of color(): encoded components to linear sRGB. */
|
|
294
|
+
const SPACES = {
|
|
295
|
+
srgb: (v) => [
|
|
296
|
+
srgbLinear(v[0]),
|
|
297
|
+
srgbLinear(v[1]),
|
|
298
|
+
srgbLinear(v[2])
|
|
299
|
+
],
|
|
300
|
+
"srgb-linear": (v) => v,
|
|
301
|
+
"display-p3": (v) => xyz65ToLinearSrgb(mul(LP3_TO_XYZ65, [
|
|
302
|
+
srgbLinear(v[0]),
|
|
303
|
+
srgbLinear(v[1]),
|
|
304
|
+
srgbLinear(v[2])
|
|
305
|
+
])),
|
|
306
|
+
"a98-rgb": (v) => xyz65ToLinearSrgb(mul(LA98_TO_XYZ65, [
|
|
307
|
+
a98Linear(v[0]),
|
|
308
|
+
a98Linear(v[1]),
|
|
309
|
+
a98Linear(v[2])
|
|
310
|
+
])),
|
|
311
|
+
"prophoto-rgb": (v) => xyz50ToLinearSrgb(mul(LPROPHOTO_TO_XYZ50, [
|
|
312
|
+
prophotoLinear(v[0]),
|
|
313
|
+
prophotoLinear(v[1]),
|
|
314
|
+
prophotoLinear(v[2])
|
|
315
|
+
])),
|
|
316
|
+
rec2020: (v) => xyz65ToLinearSrgb(mul(LREC2020_TO_XYZ65, [
|
|
317
|
+
rec2020Linear(v[0]),
|
|
318
|
+
rec2020Linear(v[1]),
|
|
319
|
+
rec2020Linear(v[2])
|
|
320
|
+
])),
|
|
321
|
+
xyz: xyz65ToLinearSrgb,
|
|
322
|
+
"xyz-d65": xyz65ToLinearSrgb,
|
|
323
|
+
"xyz-d50": xyz50ToLinearSrgb
|
|
324
|
+
};
|
|
325
|
+
function functional(fn, body) {
|
|
326
|
+
const p = parts(body);
|
|
327
|
+
if (!p) return void 0;
|
|
328
|
+
let space;
|
|
329
|
+
let c = p.c;
|
|
330
|
+
if (fn === "color") {
|
|
331
|
+
space = c[0];
|
|
332
|
+
c = c.slice(1);
|
|
333
|
+
}
|
|
334
|
+
if (c.length !== 3) return void 0;
|
|
335
|
+
if (p.alpha !== void 0) {
|
|
336
|
+
const a = num(p.alpha, 1);
|
|
337
|
+
if (a === void 0) return void 0;
|
|
338
|
+
if (!(a > 0)) return void 0;
|
|
339
|
+
}
|
|
340
|
+
const s = {
|
|
341
|
+
rgb: [
|
|
342
|
+
255,
|
|
343
|
+
255,
|
|
344
|
+
255
|
|
345
|
+
],
|
|
346
|
+
rgba: [
|
|
347
|
+
255,
|
|
348
|
+
255,
|
|
349
|
+
255
|
|
350
|
+
],
|
|
351
|
+
hsl: [
|
|
352
|
+
1,
|
|
353
|
+
100,
|
|
354
|
+
100
|
|
355
|
+
],
|
|
356
|
+
hsla: [
|
|
357
|
+
1,
|
|
358
|
+
100,
|
|
359
|
+
100
|
|
360
|
+
],
|
|
361
|
+
hwb: [
|
|
362
|
+
1,
|
|
363
|
+
100,
|
|
364
|
+
100
|
|
365
|
+
],
|
|
366
|
+
lab: [
|
|
367
|
+
100,
|
|
368
|
+
125,
|
|
369
|
+
125
|
|
370
|
+
],
|
|
371
|
+
lch: [
|
|
372
|
+
100,
|
|
373
|
+
150,
|
|
374
|
+
1
|
|
375
|
+
],
|
|
376
|
+
oklab: [
|
|
377
|
+
1,
|
|
378
|
+
.4,
|
|
379
|
+
.4
|
|
380
|
+
],
|
|
381
|
+
oklch: [
|
|
382
|
+
1,
|
|
383
|
+
.4,
|
|
384
|
+
1
|
|
385
|
+
],
|
|
386
|
+
color: [
|
|
387
|
+
1,
|
|
388
|
+
1,
|
|
389
|
+
1
|
|
390
|
+
]
|
|
391
|
+
}[fn];
|
|
392
|
+
if (!s) return void 0;
|
|
393
|
+
const v = [];
|
|
394
|
+
for (let i = 0; i < 3; i++) {
|
|
395
|
+
const n = num(c[i], s[i]);
|
|
396
|
+
if (n === void 0) return void 0;
|
|
397
|
+
v.push(n);
|
|
398
|
+
}
|
|
399
|
+
const [x, y, z] = v;
|
|
400
|
+
const rad = (deg) => deg * Math.PI / 180;
|
|
401
|
+
switch (fn) {
|
|
402
|
+
case "rgb":
|
|
403
|
+
case "rgba": return toHex([
|
|
404
|
+
x / 255,
|
|
405
|
+
y / 255,
|
|
406
|
+
z / 255
|
|
407
|
+
]);
|
|
408
|
+
case "hsl":
|
|
409
|
+
case "hsla": return toHex(hueRgb((x % 360 + 360) % 360, Math.max(0, y) / 100, z / 100));
|
|
410
|
+
case "hwb": {
|
|
411
|
+
const w = Math.max(0, y) / 100;
|
|
412
|
+
const b = Math.max(0, z) / 100;
|
|
413
|
+
if (w + b >= 1) {
|
|
414
|
+
const g = w / (w + b);
|
|
415
|
+
return toHex([
|
|
416
|
+
g,
|
|
417
|
+
g,
|
|
418
|
+
g
|
|
419
|
+
]);
|
|
420
|
+
}
|
|
421
|
+
return toHex(hueRgb((x % 360 + 360) % 360, 1, .5).map((ch) => ch * (1 - w - b) + w));
|
|
422
|
+
}
|
|
423
|
+
case "lab": return linearToHex(labToLinearSrgb(Math.min(100, Math.max(0, x)), y, z));
|
|
424
|
+
case "lch": {
|
|
425
|
+
const ch = Math.max(0, y);
|
|
426
|
+
return linearToHex(labToLinearSrgb(Math.min(100, Math.max(0, x)), ch * Math.cos(rad(z)), ch * Math.sin(rad(z))));
|
|
427
|
+
}
|
|
428
|
+
case "oklab": return linearToHex(oklabToLinearSrgb(Math.min(1, Math.max(0, x)), y, z));
|
|
429
|
+
case "oklch": {
|
|
430
|
+
const ch = Math.max(0, y);
|
|
431
|
+
return linearToHex(oklabToLinearSrgb(Math.min(1, Math.max(0, x)), ch * Math.cos(rad(z)), ch * Math.sin(rad(z))));
|
|
432
|
+
}
|
|
433
|
+
default: {
|
|
434
|
+
const conv = space === void 0 ? void 0 : SPACES[space];
|
|
435
|
+
return conv ? linearToHex(conv([
|
|
436
|
+
x,
|
|
437
|
+
y,
|
|
438
|
+
z
|
|
439
|
+
])) : void 0;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
50
443
|
/** A CSS colour as RRGGBB, or undefined for transparent or unparseable values. */
|
|
51
444
|
function cssColor(value) {
|
|
52
445
|
const v = value.trim().toLowerCase();
|
|
@@ -61,18 +454,8 @@ function cssColor(value) {
|
|
|
61
454
|
if (hex.length === 8) return hex.slice(6) === "00" ? void 0 : hex.slice(0, 6).toUpperCase();
|
|
62
455
|
return;
|
|
63
456
|
}
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
const ch = (s) => Math.round(Math.min(255, Math.max(0, s.endsWith("%") ? parseFloat(s) * 255 / 100 : parseFloat(s))));
|
|
67
|
-
if (m[4] !== void 0) {
|
|
68
|
-
if (!((m[4].endsWith("%") ? parseFloat(m[4]) / 100 : parseFloat(m[4])) > 0)) return void 0;
|
|
69
|
-
}
|
|
70
|
-
return [
|
|
71
|
-
m[1],
|
|
72
|
-
m[2],
|
|
73
|
-
m[3]
|
|
74
|
-
].map((s) => ch(s).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
75
|
-
}
|
|
457
|
+
const fn = /^([a-z]+)\(\s*([^()]*)\)$/.exec(v);
|
|
458
|
+
if (fn) return functional(fn[1], fn[2]);
|
|
76
459
|
return NAMED[v];
|
|
77
460
|
}
|
|
78
461
|
function isElement(n) {
|
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
|
-
/**
|
|
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
|
|
64
|
-
if (
|
|
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) {
|
package/dist/import.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_pipeline = require("./pipeline-
|
|
2
|
+
const require_pipeline = require("./pipeline-DwJjPL7r.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-
|
|
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-
|
|
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-
|
|
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-DyWvM9t2.js";
|
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ 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.
|
|
13
|
+
const VERSION = "2.0.0-alpha.6";
|
|
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
|
@@ -277,5 +277,5 @@ export declare function encodeRange(r: RangeAddress): string;
|
|
|
277
277
|
/** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
|
|
278
278
|
export declare function decodeRange(ref: string): RangeAddress;
|
|
279
279
|
/** 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.
|
|
280
|
+
export declare const VERSION = "2.0.0-alpha.6";
|
|
281
281
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -277,5 +277,5 @@ export declare function encodeRange(r: RangeAddress): string;
|
|
|
277
277
|
/** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
|
|
278
278
|
export declare function decodeRange(ref: string): RangeAddress;
|
|
279
279
|
/** 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.
|
|
280
|
+
export declare const VERSION = "2.0.0-alpha.6";
|
|
281
281
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -9,5 +9,5 @@ import { n as isDateFormat, t as BUILTIN_NUM_FMTS } from "./numfmt-DCDrX9P1.js";
|
|
|
9
9
|
import { a as decodeRange, c as encodeRange, i as decodeCol, n as MAX_ROWS, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-DUn7-5OS.js";
|
|
10
10
|
// src/index.ts
|
|
11
11
|
/** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
|
|
12
|
-
const VERSION = "2.0.0-alpha.
|
|
12
|
+
const VERSION = "2.0.0-alpha.6";
|
|
13
13
|
export { BUILTIN_NUM_FMTS, CsvError, EnvironmentError, ExcelError, FormatError, LimitError, MAX_COLS, MAX_ROWS, VERSION, ValidationError, XLSX_MIME, cellText, dateToSerial, decodeCell, decodeCol, decodeRange, encodeCell, encodeCol, encodeRange, fromDataset, fromDatasets, isDateFormat, isExcelError, mergeStyles, resolveColor, sanitizeSheetName, serialToDate, toBlob, toDataset, toUint8Array, validateSheetName };
|
|
@@ -60,7 +60,10 @@ type ImportIssueCode = "TYPE" | "REQUIRED" | "MAPPING_MISSING" | "ERROR_CELL" |
|
|
|
60
60
|
interface ImportIssue {
|
|
61
61
|
/** Spreadsheet row (1-based); 0 for column- or file-level issues. */
|
|
62
62
|
row: number;
|
|
63
|
+
/** The key the value has in `data` rows: the schema field with a schema, the column key without one. */
|
|
63
64
|
field?: string | undefined;
|
|
65
|
+
/** The source column's key, for cell- and column-level issues. */
|
|
66
|
+
column?: string | undefined;
|
|
64
67
|
ref?: string | undefined;
|
|
65
68
|
code: ImportIssueCode;
|
|
66
69
|
message: string;
|
|
@@ -60,7 +60,10 @@ type ImportIssueCode = "TYPE" | "REQUIRED" | "MAPPING_MISSING" | "ERROR_CELL" |
|
|
|
60
60
|
interface ImportIssue {
|
|
61
61
|
/** Spreadsheet row (1-based); 0 for column- or file-level issues. */
|
|
62
62
|
row: number;
|
|
63
|
+
/** The key the value has in `data` rows: the schema field with a schema, the column key without one. */
|
|
63
64
|
field?: string | undefined;
|
|
65
|
+
/** The source column's key, for cell- and column-level issues. */
|
|
66
|
+
column?: string | undefined;
|
|
64
67
|
ref?: string | undefined;
|
|
65
68
|
code: ImportIssueCode;
|
|
66
69
|
message: string;
|
|
@@ -386,6 +386,11 @@ function mapColumns(columns, schema, mapping) {
|
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
function applyMapping(dataset, mapping, schema) {
|
|
389
|
+
const { sources: _s, ...result } = applyMappingDetailed(dataset, mapping, schema);
|
|
390
|
+
return result;
|
|
391
|
+
}
|
|
392
|
+
/** @internal applyMapping plus each source column key's key in the rows (columns the mapping drops are absent). */
|
|
393
|
+
function applyMappingDetailed(dataset, mapping, schema) {
|
|
389
394
|
const fields = fieldsOf(schema);
|
|
390
395
|
const byKey = new Map(dataset.columns.map((c, i) => [c.key, {
|
|
391
396
|
...c,
|
|
@@ -456,29 +461,35 @@ function applyMapping(dataset, mapping, schema) {
|
|
|
456
461
|
}
|
|
457
462
|
}
|
|
458
463
|
const required = fields.filter(([name, spec]) => spec.required && plan.some((p) => p.out === name && p.from !== null)).map(([name]) => name);
|
|
464
|
+
const data = dataset.data.map((row, i) => {
|
|
465
|
+
const out = Object.create(null);
|
|
466
|
+
for (const { out: k, from } of plan) out[k] = from === null ? null : row[from] ?? null;
|
|
467
|
+
for (const name of required) {
|
|
468
|
+
const v = out[name];
|
|
469
|
+
if (v === null || v === void 0 || typeof v === "string" && v.trim() === "") {
|
|
470
|
+
const from = plan.find((p) => p.out === name).from;
|
|
471
|
+
const letter = byKey.get(from)?.letter;
|
|
472
|
+
issues.push({
|
|
473
|
+
row: rowNumbers[i],
|
|
474
|
+
field: name,
|
|
475
|
+
column: from,
|
|
476
|
+
...letter ? { ref: `${letter}${rowNumbers[i]}` } : {},
|
|
477
|
+
code: "REQUIRED",
|
|
478
|
+
message: `Row ${rowNumbers[i]}: "${name}" is required.`,
|
|
479
|
+
severity: "error"
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return out;
|
|
484
|
+
});
|
|
485
|
+
const sources = /* @__PURE__ */ new Map();
|
|
486
|
+
for (const p of plan) if (p.from !== null) sources.set(p.from, p.out);
|
|
459
487
|
return {
|
|
460
488
|
columns,
|
|
461
|
-
data
|
|
462
|
-
const out = Object.create(null);
|
|
463
|
-
for (const { out: k, from } of plan) out[k] = from === null ? null : row[from] ?? null;
|
|
464
|
-
for (const name of required) {
|
|
465
|
-
const v = out[name];
|
|
466
|
-
if (v === null || v === void 0 || typeof v === "string" && v.trim() === "") {
|
|
467
|
-
const letter = byKey.get(plan.find((p) => p.out === name).from)?.letter;
|
|
468
|
-
issues.push({
|
|
469
|
-
row: rowNumbers[i],
|
|
470
|
-
field: name,
|
|
471
|
-
...letter ? { ref: `${letter}${rowNumbers[i]}` } : {},
|
|
472
|
-
code: "REQUIRED",
|
|
473
|
-
message: `Row ${rowNumbers[i]}: "${name}" is required.`,
|
|
474
|
-
severity: "error"
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return out;
|
|
479
|
-
}),
|
|
489
|
+
data,
|
|
480
490
|
rowNumbers,
|
|
481
|
-
issues
|
|
491
|
+
issues,
|
|
492
|
+
sources
|
|
482
493
|
};
|
|
483
494
|
}
|
|
484
495
|
// src/internal/import/types.ts
|
|
@@ -740,6 +751,7 @@ function coerceColumns(dataset, types, options = {}) {
|
|
|
740
751
|
issues.push({
|
|
741
752
|
row: rowNumber,
|
|
742
753
|
field: column.key,
|
|
754
|
+
column: column.key,
|
|
743
755
|
...column.letter ? { ref: `${column.letter}${rowNumber}` } : {},
|
|
744
756
|
code: "TYPE",
|
|
745
757
|
message: `${column.letter ? `${column.letter}${rowNumber}` : `Row ${rowNumber}`}: ${JSON.stringify(String(textOf(row[column.key]) ?? row[column.key]))} is not a ${spec.type}.`,
|
|
@@ -783,6 +795,30 @@ function readCap(options) {
|
|
|
783
795
|
const h = options.header ?? "auto";
|
|
784
796
|
return (h === false ? 0 : typeof h === "number" ? h + 1 : typeof h === "object" ? (h.row === void 0 ? 25 : h.row) + h.rows : 25) + rows + 1;
|
|
785
797
|
}
|
|
798
|
+
/**
|
|
799
|
+
* Issues after mapping: `field` becomes the key in the rows, issues on
|
|
800
|
+
* columns the mapping drops go, and a cell with a TYPE issue gets no
|
|
801
|
+
* REQUIRED issue as well (its value didn't convert; it wasn't empty).
|
|
802
|
+
*/
|
|
803
|
+
function renameIssues(issues, sources) {
|
|
804
|
+
const cell = (row, column) => `${row}\u0000${column}`;
|
|
805
|
+
const typed = new Set(issues.filter((i) => i.code === "TYPE" && i.column !== void 0).map((i) => cell(i.row, i.column)));
|
|
806
|
+
const out = [];
|
|
807
|
+
for (const i of issues) {
|
|
808
|
+
if (i.column === void 0) {
|
|
809
|
+
out.push(i);
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
const field = sources.get(i.column);
|
|
813
|
+
if (field === void 0) continue;
|
|
814
|
+
if (i.code === "REQUIRED" && typed.has(cell(i.row, i.column))) continue;
|
|
815
|
+
out.push(i.field === field ? i : {
|
|
816
|
+
...i,
|
|
817
|
+
field
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
return out;
|
|
821
|
+
}
|
|
786
822
|
async function importDataset(input, options = {}) {
|
|
787
823
|
const o = options;
|
|
788
824
|
checkEnum("format", o.format, [
|
|
@@ -997,6 +1033,7 @@ async function importDataset(input, options = {}) {
|
|
|
997
1033
|
issues.push({
|
|
998
1034
|
row: rowNumbers[i],
|
|
999
1035
|
field: c.key,
|
|
1036
|
+
column: c.key,
|
|
1000
1037
|
ref,
|
|
1001
1038
|
code: "ERROR_CELL",
|
|
1002
1039
|
message: `${ref} holds the error ${v.error}; read as empty.`,
|
|
@@ -1047,6 +1084,7 @@ async function importDataset(input, options = {}) {
|
|
|
1047
1084
|
if (inf.ambiguousDates) issues.push({
|
|
1048
1085
|
row: 0,
|
|
1049
1086
|
field: inf.key,
|
|
1087
|
+
column: inf.key,
|
|
1050
1088
|
code: "DATE_ORDER_AMBIGUOUS",
|
|
1051
1089
|
message: `Column "${inf.key}" looks like dates, but the day/month order can't be told from the data; set locale.dateOrder.`,
|
|
1052
1090
|
severity: "warning"
|
|
@@ -1067,13 +1105,14 @@ async function importDataset(input, options = {}) {
|
|
|
1067
1105
|
progress("dataset", .97);
|
|
1068
1106
|
let result;
|
|
1069
1107
|
if (mapped) {
|
|
1070
|
-
const m =
|
|
1108
|
+
const { sources, ...m } = applyMappingDetailed({
|
|
1071
1109
|
columns: typedColumns,
|
|
1072
1110
|
data: coerced.data,
|
|
1073
1111
|
rowNumbers
|
|
1074
1112
|
}, mapped.mapping, o.schema);
|
|
1075
1113
|
issues.push(...m.issues);
|
|
1076
1114
|
result = m;
|
|
1115
|
+
issues.splice(0, issues.length, ...renameIssues(issues, sources));
|
|
1077
1116
|
meta.mapping = mapped.mapping;
|
|
1078
1117
|
meta.unmappedColumns = mapped.unmapped;
|
|
1079
1118
|
} else result = {
|
|
@@ -386,6 +386,11 @@ function mapColumns(columns, schema, mapping) {
|
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
function applyMapping(dataset, mapping, schema) {
|
|
389
|
+
const { sources: _s, ...result } = applyMappingDetailed(dataset, mapping, schema);
|
|
390
|
+
return result;
|
|
391
|
+
}
|
|
392
|
+
/** @internal applyMapping plus each source column key's key in the rows (columns the mapping drops are absent). */
|
|
393
|
+
function applyMappingDetailed(dataset, mapping, schema) {
|
|
389
394
|
const fields = fieldsOf(schema);
|
|
390
395
|
const byKey = new Map(dataset.columns.map((c, i) => [c.key, {
|
|
391
396
|
...c,
|
|
@@ -456,29 +461,35 @@ function applyMapping(dataset, mapping, schema) {
|
|
|
456
461
|
}
|
|
457
462
|
}
|
|
458
463
|
const required = fields.filter(([name, spec]) => spec.required && plan.some((p) => p.out === name && p.from !== null)).map(([name]) => name);
|
|
464
|
+
const data = dataset.data.map((row, i) => {
|
|
465
|
+
const out = Object.create(null);
|
|
466
|
+
for (const { out: k, from } of plan) out[k] = from === null ? null : row[from] ?? null;
|
|
467
|
+
for (const name of required) {
|
|
468
|
+
const v = out[name];
|
|
469
|
+
if (v === null || v === void 0 || typeof v === "string" && v.trim() === "") {
|
|
470
|
+
const from = plan.find((p) => p.out === name).from;
|
|
471
|
+
const letter = byKey.get(from)?.letter;
|
|
472
|
+
issues.push({
|
|
473
|
+
row: rowNumbers[i],
|
|
474
|
+
field: name,
|
|
475
|
+
column: from,
|
|
476
|
+
...letter ? { ref: `${letter}${rowNumbers[i]}` } : {},
|
|
477
|
+
code: "REQUIRED",
|
|
478
|
+
message: `Row ${rowNumbers[i]}: "${name}" is required.`,
|
|
479
|
+
severity: "error"
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return out;
|
|
484
|
+
});
|
|
485
|
+
const sources = /* @__PURE__ */ new Map();
|
|
486
|
+
for (const p of plan) if (p.from !== null) sources.set(p.from, p.out);
|
|
459
487
|
return {
|
|
460
488
|
columns,
|
|
461
|
-
data
|
|
462
|
-
const out = Object.create(null);
|
|
463
|
-
for (const { out: k, from } of plan) out[k] = from === null ? null : row[from] ?? null;
|
|
464
|
-
for (const name of required) {
|
|
465
|
-
const v = out[name];
|
|
466
|
-
if (v === null || v === void 0 || typeof v === "string" && v.trim() === "") {
|
|
467
|
-
const letter = byKey.get(plan.find((p) => p.out === name).from)?.letter;
|
|
468
|
-
issues.push({
|
|
469
|
-
row: rowNumbers[i],
|
|
470
|
-
field: name,
|
|
471
|
-
...letter ? { ref: `${letter}${rowNumbers[i]}` } : {},
|
|
472
|
-
code: "REQUIRED",
|
|
473
|
-
message: `Row ${rowNumbers[i]}: "${name}" is required.`,
|
|
474
|
-
severity: "error"
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return out;
|
|
479
|
-
}),
|
|
489
|
+
data,
|
|
480
490
|
rowNumbers,
|
|
481
|
-
issues
|
|
491
|
+
issues,
|
|
492
|
+
sources
|
|
482
493
|
};
|
|
483
494
|
}
|
|
484
495
|
// src/internal/import/types.ts
|
|
@@ -740,6 +751,7 @@ function coerceColumns(dataset, types, options = {}) {
|
|
|
740
751
|
issues.push({
|
|
741
752
|
row: rowNumber,
|
|
742
753
|
field: column.key,
|
|
754
|
+
column: column.key,
|
|
743
755
|
...column.letter ? { ref: `${column.letter}${rowNumber}` } : {},
|
|
744
756
|
code: "TYPE",
|
|
745
757
|
message: `${column.letter ? `${column.letter}${rowNumber}` : `Row ${rowNumber}`}: ${JSON.stringify(String(textOf(row[column.key]) ?? row[column.key]))} is not a ${spec.type}.`,
|
|
@@ -783,6 +795,30 @@ function readCap(options) {
|
|
|
783
795
|
const h = options.header ?? "auto";
|
|
784
796
|
return (h === false ? 0 : typeof h === "number" ? h + 1 : typeof h === "object" ? (h.row === void 0 ? 25 : h.row) + h.rows : 25) + rows + 1;
|
|
785
797
|
}
|
|
798
|
+
/**
|
|
799
|
+
* Issues after mapping: `field` becomes the key in the rows, issues on
|
|
800
|
+
* columns the mapping drops go, and a cell with a TYPE issue gets no
|
|
801
|
+
* REQUIRED issue as well (its value didn't convert; it wasn't empty).
|
|
802
|
+
*/
|
|
803
|
+
function renameIssues(issues, sources) {
|
|
804
|
+
const cell = (row, column) => `${row}\u0000${column}`;
|
|
805
|
+
const typed = new Set(issues.filter((i) => i.code === "TYPE" && i.column !== void 0).map((i) => cell(i.row, i.column)));
|
|
806
|
+
const out = [];
|
|
807
|
+
for (const i of issues) {
|
|
808
|
+
if (i.column === void 0) {
|
|
809
|
+
out.push(i);
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
const field = sources.get(i.column);
|
|
813
|
+
if (field === void 0) continue;
|
|
814
|
+
if (i.code === "REQUIRED" && typed.has(cell(i.row, i.column))) continue;
|
|
815
|
+
out.push(i.field === field ? i : {
|
|
816
|
+
...i,
|
|
817
|
+
field
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
return out;
|
|
821
|
+
}
|
|
786
822
|
async function importDataset(input, options = {}) {
|
|
787
823
|
const o = options;
|
|
788
824
|
checkEnum("format", o.format, [
|
|
@@ -997,6 +1033,7 @@ async function importDataset(input, options = {}) {
|
|
|
997
1033
|
issues.push({
|
|
998
1034
|
row: rowNumbers[i],
|
|
999
1035
|
field: c.key,
|
|
1036
|
+
column: c.key,
|
|
1000
1037
|
ref,
|
|
1001
1038
|
code: "ERROR_CELL",
|
|
1002
1039
|
message: `${ref} holds the error ${v.error}; read as empty.`,
|
|
@@ -1047,6 +1084,7 @@ async function importDataset(input, options = {}) {
|
|
|
1047
1084
|
if (inf.ambiguousDates) issues.push({
|
|
1048
1085
|
row: 0,
|
|
1049
1086
|
field: inf.key,
|
|
1087
|
+
column: inf.key,
|
|
1050
1088
|
code: "DATE_ORDER_AMBIGUOUS",
|
|
1051
1089
|
message: `Column "${inf.key}" looks like dates, but the day/month order can't be told from the data; set locale.dateOrder.`,
|
|
1052
1090
|
severity: "warning"
|
|
@@ -1067,13 +1105,14 @@ async function importDataset(input, options = {}) {
|
|
|
1067
1105
|
progress("dataset", .97);
|
|
1068
1106
|
let result;
|
|
1069
1107
|
if (mapped) {
|
|
1070
|
-
const m =
|
|
1108
|
+
const { sources, ...m } = applyMappingDetailed({
|
|
1071
1109
|
columns: typedColumns,
|
|
1072
1110
|
data: coerced.data,
|
|
1073
1111
|
rowNumbers
|
|
1074
1112
|
}, mapped.mapping, o.schema);
|
|
1075
1113
|
issues.push(...m.issues);
|
|
1076
1114
|
result = m;
|
|
1115
|
+
issues.splice(0, issues.length, ...renameIssues(issues, sources));
|
|
1077
1116
|
meta.mapping = mapped.mapping;
|
|
1078
1117
|
meta.unmappedColumns = mapped.unmapped;
|
|
1079
1118
|
} else result = {
|
package/dist/worker.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_csv = require("./csv-DyVH9y7S.cjs");
|
|
3
3
|
const require_errors = require("./errors-DOPrrGS4.cjs");
|
|
4
4
|
const require_read = require("./read-CZEWV4rK.cjs");
|
|
5
|
-
const require_pipeline = require("./pipeline-
|
|
5
|
+
const require_pipeline = require("./pipeline-DwJjPL7r.cjs");
|
|
6
6
|
const require_write = require("./write-f9kcYf5K.cjs");
|
|
7
7
|
// src/worker.ts
|
|
8
8
|
/** Marks the library's messages, so an app can use the same worker for its own messages too. */
|
package/dist/worker.d.cts
CHANGED
|
@@ -25,7 +25,7 @@ import { r as BinaryInput } from "./warnings-B1v58nCZ.cjs";
|
|
|
25
25
|
import { CsvParseOptions, CsvParseResult, CsvReadOptions, CsvWriteOptions } from "./csv.cjs";
|
|
26
26
|
import { D as Sheet, j as Workbook, s as CellInput } from "./model-0JikLfuM.cjs";
|
|
27
27
|
import { ReadOptions, ReadResult } from "./read.cjs";
|
|
28
|
-
import { n as ImportDatasetResult, t as ImportDatasetOptions } from "./pipeline-
|
|
28
|
+
import { n as ImportDatasetResult, t as ImportDatasetOptions } from "./pipeline-DM7n0aRI.cjs";
|
|
29
29
|
import { n as WriteOptions, t as Progress } from "./write-DtjfdIFm.cjs";
|
|
30
30
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
|
|
31
31
|
/** The side of a message channel the library uses: a `Worker`, the worker's `self`, or a `MessagePort`. */
|
package/dist/worker.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { r as BinaryInput } from "./warnings-B1v58nCZ.js";
|
|
|
25
25
|
import { CsvParseOptions, CsvParseResult, CsvReadOptions, CsvWriteOptions } from "./csv.js";
|
|
26
26
|
import { D as Sheet, j as Workbook, s as CellInput } from "./model-0JikLfuM.js";
|
|
27
27
|
import { ReadOptions, ReadResult } from "./read.js";
|
|
28
|
-
import { n as ImportDatasetResult, t as ImportDatasetOptions } from "./pipeline-
|
|
28
|
+
import { n as ImportDatasetResult, t as ImportDatasetOptions } from "./pipeline-BuG_nn_S.js";
|
|
29
29
|
import { n as WriteOptions, t as Progress } from "./write-DM6ieuQY.js";
|
|
30
30
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
|
|
31
31
|
/** The side of a message channel the library uses: a `Worker`, the worker's `self`, or a `MessagePort`. */
|
package/dist/worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as toCsv, r as readCsv } from "./csv-pXfaputs.js";
|
|
2
2
|
import { a as LimitError, i as FormatError, n as EnvironmentError, o as ValidationError, r as ExcelError, s as isExcelError, t as CsvError } from "./errors-CvGlfw0E.js";
|
|
3
3
|
import { r as read } from "./read-LWti17lz.js";
|
|
4
|
-
import { t as importDataset } from "./pipeline-
|
|
4
|
+
import { t as importDataset } from "./pipeline-DyWvM9t2.js";
|
|
5
5
|
import { r as toUint8Array } from "./write-DjgWy1PK.js";
|
|
6
6
|
// src/worker.ts
|
|
7
7
|
/** Marks the library's messages, so an app can use the same worker for its own messages too. */
|
package/package.json
CHANGED