@ai-matrx/alchemy 0.8.3 → 0.8.5
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 +17 -1
- package/dist/core.cjs +8 -47
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +8 -47
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +8 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -47
- package/dist/index.js.map +1 -1
- package/dist/operate-xlsx.cjs +34007 -18
- package/dist/operate-xlsx.cjs.map +1 -1
- package/dist/operate-xlsx.js +34011 -5
- package/dist/operate-xlsx.js.map +1 -1
- package/dist/operate.cjs +8 -47
- package/dist/operate.cjs.map +1 -1
- package/dist/operate.js +8 -47
- package/dist/operate.js.map +1 -1
- package/dist/react-bar.cjs +2 -2
- package/dist/react-bar.cjs.map +1 -1
- package/dist/react-bar.js +2 -2
- package/dist/react-bar.js.map +1 -1
- package/dist/react-menu.cjs +2 -2
- package/dist/react-menu.cjs.map +1 -1
- package/dist/react-menu.js +2 -2
- package/dist/react-menu.js.map +1 -1
- package/dist/react-overflow.cjs.map +1 -1
- package/dist/react-overflow.js.map +1 -1
- package/dist/react-selection.cjs +2 -2
- package/dist/react-selection.cjs.map +1 -1
- package/dist/react-selection.js +2 -2
- package/dist/react-selection.js.map +1 -1
- package/dist/react-sheet.cjs +3 -3
- package/dist/react-sheet.cjs.map +1 -1
- package/dist/react-sheet.js +3 -3
- package/dist/react-sheet.js.map +1 -1
- package/package.json +5 -5
package/dist/operate.cjs
CHANGED
|
@@ -5,8 +5,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
|
|
8
|
+
var __esm = (fn, res, err) => function __init() {
|
|
9
|
+
if (err) throw err[0];
|
|
10
|
+
try {
|
|
11
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw err = [e], e;
|
|
14
|
+
}
|
|
10
15
|
};
|
|
11
16
|
var __export = (target, all) => {
|
|
12
17
|
for (var name in all)
|
|
@@ -1357,50 +1362,6 @@ var init_document = __esm({
|
|
|
1357
1362
|
}
|
|
1358
1363
|
});
|
|
1359
1364
|
|
|
1360
|
-
// src/operate/formats/xlsx.ts
|
|
1361
|
-
var xlsx_exports = {};
|
|
1362
|
-
__export(xlsx_exports, {
|
|
1363
|
-
xlsxEngine: () => xlsxEngine
|
|
1364
|
-
});
|
|
1365
|
-
var cell, xlsxEngine;
|
|
1366
|
-
var init_xlsx = __esm({
|
|
1367
|
-
"src/operate/formats/xlsx.ts"() {
|
|
1368
|
-
"use strict";
|
|
1369
|
-
init_core();
|
|
1370
|
-
cell = (value) => value === void 0 || value === null ? null : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value);
|
|
1371
|
-
xlsxEngine = {
|
|
1372
|
-
async build(draft, options, signal) {
|
|
1373
|
-
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1374
|
-
const p = draft.payload;
|
|
1375
|
-
if (p.kind !== "rows") throw new ContentTransferError("unsupported-format", "An Excel workbook needs table rows. Download it as CSV or JSON instead.");
|
|
1376
|
-
const columns = p.columns.filter(
|
|
1377
|
-
(c) => c.visible && c.exportable !== false && c.classification !== "secret" && c.classification !== "credential"
|
|
1378
|
-
);
|
|
1379
|
-
const XLSX = await import("xlsx");
|
|
1380
|
-
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1381
|
-
const sheet = XLSX.utils.aoa_to_sheet([columns.map((c) => c.label), ...p.rows.map((row) => columns.map((c) => cell(readTransferCell(row, c))))]);
|
|
1382
|
-
const book = XLSX.utils.book_new();
|
|
1383
|
-
const filename = options.filename ?? "export.xlsx";
|
|
1384
|
-
const sheetName = filename.replace(/\.xlsx$/i, "").replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31) || "Data";
|
|
1385
|
-
XLSX.utils.book_append_sheet(book, sheet, sheetName);
|
|
1386
|
-
const written = XLSX.write(book, { type: "array", bookType: "xlsx", compression: true });
|
|
1387
|
-
return sealTransferArtifact({
|
|
1388
|
-
snapshotId: draft.snapshotId,
|
|
1389
|
-
draftRevision: draft.revision,
|
|
1390
|
-
format: "xlsx",
|
|
1391
|
-
plainText: serialize(draft, "tsv", { spreadsheetSafe: true }).plainText,
|
|
1392
|
-
file: {
|
|
1393
|
-
filename,
|
|
1394
|
-
mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1395
|
-
bytes: written instanceof Uint8Array ? written : new Uint8Array(written)
|
|
1396
|
-
},
|
|
1397
|
-
omissions: draft.omissions.map((o) => ({ ...o }))
|
|
1398
|
-
});
|
|
1399
|
-
}
|
|
1400
|
-
};
|
|
1401
|
-
}
|
|
1402
|
-
});
|
|
1403
|
-
|
|
1404
1365
|
// src/operate.ts
|
|
1405
1366
|
var operate_exports = {};
|
|
1406
1367
|
__export(operate_exports, {
|
|
@@ -1575,7 +1536,7 @@ var FORMAT_ADAPTERS = Object.freeze([
|
|
|
1575
1536
|
modes: ["download"],
|
|
1576
1537
|
runsOn: "client",
|
|
1577
1538
|
supports: isRows,
|
|
1578
|
-
load: lazy(async () => (await
|
|
1539
|
+
load: lazy(async () => (await import("@ai-matrx/alchemy/operate/formats/xlsx")).xlsxEngine)
|
|
1579
1540
|
},
|
|
1580
1541
|
{
|
|
1581
1542
|
id: "pdf",
|