documonster 0.1.0 → 0.1.1
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/browser/modules/excel/surface/workbook.browser.d.ts +1 -1
- package/dist/browser/modules/excel/surface/workbook.browser.js +1 -1
- package/dist/cjs/modules/excel/surface/workbook.browser.js +6 -1
- package/dist/esm/modules/excel/surface/workbook.browser.js +1 -1
- package/dist/iife/documonster.archive.iife.js +1 -1
- package/dist/iife/documonster.archive.iife.min.js +1 -1
- package/dist/iife/documonster.csv.iife.js +1 -1
- package/dist/iife/documonster.csv.iife.min.js +1 -1
- package/dist/iife/documonster.excel.iife.js +124 -1
- package/dist/iife/documonster.excel.iife.js.map +1 -1
- package/dist/iife/documonster.excel.iife.min.js +51 -51
- package/dist/iife/documonster.formula.iife.js +1 -1
- package/dist/iife/documonster.formula.iife.min.js +1 -1
- package/dist/iife/documonster.markdown.iife.js +1 -1
- package/dist/iife/documonster.markdown.iife.min.js +1 -1
- package/dist/iife/documonster.pdf.iife.js +1 -1
- package/dist/iife/documonster.pdf.iife.min.js +1 -1
- package/dist/iife/documonster.stream.iife.js +1 -1
- package/dist/iife/documonster.stream.iife.min.js +1 -1
- package/dist/iife/documonster.word.iife.js +1 -1
- package/dist/iife/documonster.word.iife.js.map +1 -1
- package/dist/iife/documonster.word.iife.min.js +1 -1
- package/dist/iife/documonster.xml.iife.js +1 -1
- package/dist/iife/documonster.xml.iife.min.js +1 -1
- package/dist/types/modules/excel/surface/workbook.browser.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Node file-path `readFile` / `writeFile`). The `.browser` same-name swap
|
|
7
7
|
* selects the browser xlsx binding.
|
|
8
8
|
*/
|
|
9
|
-
export { createWorkbook as create, addWorksheet, getWorksheet, getWorksheets, removeWorksheet, addChartsheet, addPivotChartsheet, getChartsheet, getChartsheets, removeChartsheet, renameChartsheet, copyChartsheet, replaceChartsheetChart, getDefinedNames, eachSheet, importSheet, protectWorkbook as protect, unprotectWorkbook as unprotect, addExternalLink, getExternalLink, registerPerson, registerFunction, unregisterFunction, getWorkbookModel as getModel, setWorkbookModel as setModel, createStreamWriter, createStreamReader } from "../core/workbook.browser.js";
|
|
9
|
+
export { createWorkbook as create, addWorksheet, getWorksheet, getWorksheets, removeWorksheet, addChartsheet, addPivotChartsheet, getChartsheet, getChartsheets, removeChartsheet, renameChartsheet, copyChartsheet, replaceChartsheetChart, getDefinedNames, eachSheet, importSheet, protectWorkbook as protect, unprotectWorkbook as unprotect, addExternalLink, getExternalLink, registerPerson, registerFunction, unregisterFunction, defineCellStyle, getCellStyle, listCellStyles, removeCellStyle, useBuiltinCellStyle, getWorkbookModel as getModel, setWorkbookModel as setModel, createStreamWriter, createStreamReader } from "../core/workbook.browser.js";
|
|
10
10
|
export { toBuffer, read, readStream, writeStream, getXlsxIo } from "../core/xlsx-io.js";
|
|
11
11
|
/** A workbook handle (opaque to consumers). */
|
|
12
12
|
export type { WorkbookData as Handle } from "../core/workbook-core.js";
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* Node file-path `readFile` / `writeFile`). The `.browser` same-name swap
|
|
7
7
|
* selects the browser xlsx binding.
|
|
8
8
|
*/
|
|
9
|
-
export { createWorkbook as create, addWorksheet, getWorksheet, getWorksheets, removeWorksheet, addChartsheet, addPivotChartsheet, getChartsheet, getChartsheets, removeChartsheet, renameChartsheet, copyChartsheet, replaceChartsheetChart, getDefinedNames, eachSheet, importSheet, protectWorkbook as protect, unprotectWorkbook as unprotect, addExternalLink, getExternalLink, registerPerson, registerFunction, unregisterFunction, getWorkbookModel as getModel, setWorkbookModel as setModel, createStreamWriter, createStreamReader } from "../core/workbook.browser.js";
|
|
9
|
+
export { createWorkbook as create, addWorksheet, getWorksheet, getWorksheets, removeWorksheet, addChartsheet, addPivotChartsheet, getChartsheet, getChartsheets, removeChartsheet, renameChartsheet, copyChartsheet, replaceChartsheetChart, getDefinedNames, eachSheet, importSheet, protectWorkbook as protect, unprotectWorkbook as unprotect, addExternalLink, getExternalLink, registerPerson, registerFunction, unregisterFunction, defineCellStyle, getCellStyle, listCellStyles, removeCellStyle, useBuiltinCellStyle, getWorkbookModel as getModel, setWorkbookModel as setModel, createStreamWriter, createStreamReader } from "../core/workbook.browser.js";
|
|
10
10
|
export { toBuffer, read, readStream, writeStream, getXlsxIo } from "../core/xlsx-io.browser.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getXlsxIo = exports.writeStream = exports.readStream = exports.read = exports.toBuffer = exports.createStreamReader = exports.createStreamWriter = exports.setModel = exports.getModel = exports.unregisterFunction = exports.registerFunction = exports.registerPerson = exports.getExternalLink = exports.addExternalLink = exports.unprotect = exports.protect = exports.importSheet = exports.eachSheet = exports.getDefinedNames = exports.replaceChartsheetChart = exports.copyChartsheet = exports.renameChartsheet = exports.removeChartsheet = exports.getChartsheets = exports.getChartsheet = exports.addPivotChartsheet = exports.addChartsheet = exports.removeWorksheet = exports.getWorksheets = exports.getWorksheet = exports.addWorksheet = exports.create = void 0;
|
|
3
|
+
exports.getXlsxIo = exports.writeStream = exports.readStream = exports.read = exports.toBuffer = exports.createStreamReader = exports.createStreamWriter = exports.setModel = exports.getModel = exports.useBuiltinCellStyle = exports.removeCellStyle = exports.listCellStyles = exports.getCellStyle = exports.defineCellStyle = exports.unregisterFunction = exports.registerFunction = exports.registerPerson = exports.getExternalLink = exports.addExternalLink = exports.unprotect = exports.protect = exports.importSheet = exports.eachSheet = exports.getDefinedNames = exports.replaceChartsheetChart = exports.copyChartsheet = exports.renameChartsheet = exports.removeChartsheet = exports.getChartsheets = exports.getChartsheet = exports.addPivotChartsheet = exports.addChartsheet = exports.removeWorksheet = exports.getWorksheets = exports.getWorksheet = exports.addWorksheet = exports.create = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* `Workbook` namespace surface — browser entry.
|
|
6
6
|
*
|
|
@@ -33,6 +33,11 @@ Object.defineProperty(exports, "getExternalLink", { enumerable: true, get: funct
|
|
|
33
33
|
Object.defineProperty(exports, "registerPerson", { enumerable: true, get: function () { return workbook_browser_1.registerPerson; } });
|
|
34
34
|
Object.defineProperty(exports, "registerFunction", { enumerable: true, get: function () { return workbook_browser_1.registerFunction; } });
|
|
35
35
|
Object.defineProperty(exports, "unregisterFunction", { enumerable: true, get: function () { return workbook_browser_1.unregisterFunction; } });
|
|
36
|
+
Object.defineProperty(exports, "defineCellStyle", { enumerable: true, get: function () { return workbook_browser_1.defineCellStyle; } });
|
|
37
|
+
Object.defineProperty(exports, "getCellStyle", { enumerable: true, get: function () { return workbook_browser_1.getCellStyle; } });
|
|
38
|
+
Object.defineProperty(exports, "listCellStyles", { enumerable: true, get: function () { return workbook_browser_1.listCellStyles; } });
|
|
39
|
+
Object.defineProperty(exports, "removeCellStyle", { enumerable: true, get: function () { return workbook_browser_1.removeCellStyle; } });
|
|
40
|
+
Object.defineProperty(exports, "useBuiltinCellStyle", { enumerable: true, get: function () { return workbook_browser_1.useBuiltinCellStyle; } });
|
|
36
41
|
Object.defineProperty(exports, "getModel", { enumerable: true, get: function () { return workbook_browser_1.getWorkbookModel; } });
|
|
37
42
|
Object.defineProperty(exports, "setModel", { enumerable: true, get: function () { return workbook_browser_1.setWorkbookModel; } });
|
|
38
43
|
Object.defineProperty(exports, "createStreamWriter", { enumerable: true, get: function () { return workbook_browser_1.createStreamWriter; } });
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* Node file-path `readFile` / `writeFile`). The `.browser` same-name swap
|
|
7
7
|
* selects the browser xlsx binding.
|
|
8
8
|
*/
|
|
9
|
-
export { createWorkbook as create, addWorksheet, getWorksheet, getWorksheets, removeWorksheet, addChartsheet, addPivotChartsheet, getChartsheet, getChartsheets, removeChartsheet, renameChartsheet, copyChartsheet, replaceChartsheetChart, getDefinedNames, eachSheet, importSheet, protectWorkbook as protect, unprotectWorkbook as unprotect, addExternalLink, getExternalLink, registerPerson, registerFunction, unregisterFunction, getWorkbookModel as getModel, setWorkbookModel as setModel, createStreamWriter, createStreamReader } from "../core/workbook.browser.js";
|
|
9
|
+
export { createWorkbook as create, addWorksheet, getWorksheet, getWorksheets, removeWorksheet, addChartsheet, addPivotChartsheet, getChartsheet, getChartsheets, removeChartsheet, renameChartsheet, copyChartsheet, replaceChartsheetChart, getDefinedNames, eachSheet, importSheet, protectWorkbook as protect, unprotectWorkbook as unprotect, addExternalLink, getExternalLink, registerPerson, registerFunction, unregisterFunction, defineCellStyle, getCellStyle, listCellStyles, removeCellStyle, useBuiltinCellStyle, getWorkbookModel as getModel, setWorkbookModel as setModel, createStreamWriter, createStreamReader } from "../core/workbook.browser.js";
|
|
10
10
|
export { toBuffer, read, readStream, writeStream, getXlsxIo } from "../core/xlsx-io.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* documonster v0.1.
|
|
2
|
+
* documonster v0.1.1
|
|
3
3
|
* Zero-dependency TypeScript toolkit for Excel, Word, PDF, CSV, Markdown, XML & ZIP — one API across Node.js, Bun & browsers.
|
|
4
4
|
* (c) 2026 cjnoname
|
|
5
5
|
* Released under the Apache-2.0 License
|
|
@@ -9072,6 +9072,90 @@ this.Documonster = this.Documonster || {};
|
|
|
9072
9072
|
return type === "histogram" || type === "pareto" || type === "waterfall" || type === "boxWhisker";
|
|
9073
9073
|
}
|
|
9074
9074
|
//#endregion
|
|
9075
|
+
//#region src/modules/excel/core/builtin-cell-styles.ts
|
|
9076
|
+
const THEME_DARK1 = { theme: 1 };
|
|
9077
|
+
const HEADING_BLUE = { argb: "FF1F4E79" };
|
|
9078
|
+
const TITLE_BLUE = { argb: "FF1F4E79" };
|
|
9079
|
+
const GOOD_TEXT = { argb: "FF006100" };
|
|
9080
|
+
const GOOD_FILL = { argb: "FFC6EFCE" };
|
|
9081
|
+
const BAD_TEXT = { argb: "FF9C0006" };
|
|
9082
|
+
const BAD_FILL = { argb: "FFFFC7CE" };
|
|
9083
|
+
const NEUTRAL_TEXT = { argb: "FF9C6500" };
|
|
9084
|
+
const NEUTRAL_FILL = { argb: "FFFFEB9C" };
|
|
9085
|
+
function solidFill(argb) {
|
|
9086
|
+
return {
|
|
9087
|
+
type: "pattern",
|
|
9088
|
+
pattern: "solid",
|
|
9089
|
+
fgColor: { argb }
|
|
9090
|
+
};
|
|
9091
|
+
}
|
|
9092
|
+
const BUILTIN_CELL_STYLES = {
|
|
9093
|
+
Title: {
|
|
9094
|
+
name: "Title",
|
|
9095
|
+
builtinId: 15,
|
|
9096
|
+
font: {
|
|
9097
|
+
name: "Calibri Light",
|
|
9098
|
+
size: 18,
|
|
9099
|
+
bold: false,
|
|
9100
|
+
color: TITLE_BLUE
|
|
9101
|
+
}
|
|
9102
|
+
},
|
|
9103
|
+
Heading1: {
|
|
9104
|
+
name: "Heading 1",
|
|
9105
|
+
builtinId: 16,
|
|
9106
|
+
font: {
|
|
9107
|
+
size: 15,
|
|
9108
|
+
bold: true,
|
|
9109
|
+
color: HEADING_BLUE
|
|
9110
|
+
}
|
|
9111
|
+
},
|
|
9112
|
+
Heading2: {
|
|
9113
|
+
name: "Heading 2",
|
|
9114
|
+
builtinId: 17,
|
|
9115
|
+
font: {
|
|
9116
|
+
size: 13,
|
|
9117
|
+
bold: true,
|
|
9118
|
+
color: HEADING_BLUE
|
|
9119
|
+
}
|
|
9120
|
+
},
|
|
9121
|
+
Heading3: {
|
|
9122
|
+
name: "Heading 3",
|
|
9123
|
+
builtinId: 18,
|
|
9124
|
+
font: {
|
|
9125
|
+
size: 11,
|
|
9126
|
+
bold: true,
|
|
9127
|
+
color: HEADING_BLUE
|
|
9128
|
+
}
|
|
9129
|
+
},
|
|
9130
|
+
Heading4: {
|
|
9131
|
+
name: "Heading 4",
|
|
9132
|
+
builtinId: 19,
|
|
9133
|
+
font: {
|
|
9134
|
+
size: 11,
|
|
9135
|
+
bold: true,
|
|
9136
|
+
color: THEME_DARK1
|
|
9137
|
+
}
|
|
9138
|
+
},
|
|
9139
|
+
Good: {
|
|
9140
|
+
name: "Good",
|
|
9141
|
+
builtinId: 26,
|
|
9142
|
+
font: { color: GOOD_TEXT },
|
|
9143
|
+
fill: solidFill(GOOD_FILL.argb)
|
|
9144
|
+
},
|
|
9145
|
+
Bad: {
|
|
9146
|
+
name: "Bad",
|
|
9147
|
+
builtinId: 27,
|
|
9148
|
+
font: { color: BAD_TEXT },
|
|
9149
|
+
fill: solidFill(BAD_FILL.argb)
|
|
9150
|
+
},
|
|
9151
|
+
Neutral: {
|
|
9152
|
+
name: "Neutral",
|
|
9153
|
+
builtinId: 28,
|
|
9154
|
+
font: { color: NEUTRAL_TEXT },
|
|
9155
|
+
fill: solidFill(NEUTRAL_FILL.argb)
|
|
9156
|
+
}
|
|
9157
|
+
};
|
|
9158
|
+
//#endregion
|
|
9075
9159
|
//#region src/modules/excel/xlsx/rel-type.ts
|
|
9076
9160
|
var RelType;
|
|
9077
9161
|
var init_rel_type = __esmMin((() => {
|
|
@@ -9165,10 +9249,44 @@ this.Documonster = this.Documonster || {};
|
|
|
9165
9249
|
if (typeof name !== "string" || name === "") throw new WorksheetNameError("Named cell style name must be a non-empty string.");
|
|
9166
9250
|
if (name === "Normal") throw new WorksheetNameError("The built-in \"Normal\" cell style cannot be redefined.");
|
|
9167
9251
|
}
|
|
9252
|
+
/**
|
|
9253
|
+
* Define (or replace) a workbook-level named cell style such as "Heading 1".
|
|
9254
|
+
* Cells reference it via `Style.styleName` (e.g. `Cell.applyCellStyle`).
|
|
9255
|
+
*
|
|
9256
|
+
* The reserved built-in "Normal" style (builtinId 0) cannot be redefined; it is
|
|
9257
|
+
* always emitted implicitly as `cellStyleXfs[0]`.
|
|
9258
|
+
*/
|
|
9259
|
+
function defineCellStyle(wb, name, style) {
|
|
9260
|
+
validateCellStyleName(name);
|
|
9261
|
+
if (!wb._cellStyles) wb._cellStyles = /* @__PURE__ */ new Map();
|
|
9262
|
+
wb._cellStyles.set(name, {
|
|
9263
|
+
...style,
|
|
9264
|
+
name
|
|
9265
|
+
});
|
|
9266
|
+
}
|
|
9168
9267
|
/** Get a workbook-level named cell style by name, or `undefined` if absent. */
|
|
9169
9268
|
function getCellStyle(wb, name) {
|
|
9170
9269
|
return wb._cellStyles?.get(name);
|
|
9171
9270
|
}
|
|
9271
|
+
/** List all workbook-level named cell styles in definition order. */
|
|
9272
|
+
function listCellStyles(wb) {
|
|
9273
|
+
return wb._cellStyles ? [...wb._cellStyles.values()] : [];
|
|
9274
|
+
}
|
|
9275
|
+
/** Remove a named cell style. Returns `true` if it existed. */
|
|
9276
|
+
function removeCellStyle(wb, name) {
|
|
9277
|
+
return wb._cellStyles ? wb._cellStyles.delete(name) : false;
|
|
9278
|
+
}
|
|
9279
|
+
/**
|
|
9280
|
+
* Define one of the built-in Excel cell-style presets (e.g. "Heading1") on the
|
|
9281
|
+
* workbook and return its OOXML style name (e.g. "Heading 1") for use with
|
|
9282
|
+
* `Cell.applyCellStyle`. Built-in presets carry the correct `builtinId`, which
|
|
9283
|
+
* accessibility software relies on to recognise the style's semantic role.
|
|
9284
|
+
*/
|
|
9285
|
+
function useBuiltinCellStyle(wb, id) {
|
|
9286
|
+
const { name, ...style } = BUILTIN_CELL_STYLES[id];
|
|
9287
|
+
defineCellStyle(wb, name, style);
|
|
9288
|
+
return name;
|
|
9289
|
+
}
|
|
9172
9290
|
function removeWorksheetEx(wb, worksheet) {
|
|
9173
9291
|
const tables = worksheet.tables;
|
|
9174
9292
|
if (tables) for (const tableName of Object.keys(tables)) wb._tableNames.delete(tableName.toLowerCase());
|
|
@@ -73764,7 +73882,9 @@ self.onmessage = async function(event) {
|
|
|
73764
73882
|
create: () => createWorkbook,
|
|
73765
73883
|
createStreamReader: () => createStreamReader,
|
|
73766
73884
|
createStreamWriter: () => createStreamWriter,
|
|
73885
|
+
defineCellStyle: () => defineCellStyle,
|
|
73767
73886
|
eachSheet: () => eachSheet,
|
|
73887
|
+
getCellStyle: () => getCellStyle,
|
|
73768
73888
|
getChartsheet: () => getChartsheet,
|
|
73769
73889
|
getChartsheets: () => getChartsheets,
|
|
73770
73890
|
getDefinedNames: () => getDefinedNames,
|
|
@@ -73774,11 +73894,13 @@ self.onmessage = async function(event) {
|
|
|
73774
73894
|
getWorksheets: () => getWorksheets,
|
|
73775
73895
|
getXlsxIo: () => getXlsxIo,
|
|
73776
73896
|
importSheet: () => importSheet,
|
|
73897
|
+
listCellStyles: () => listCellStyles,
|
|
73777
73898
|
protect: () => protectWorkbook,
|
|
73778
73899
|
read: () => read,
|
|
73779
73900
|
readStream: () => readStream,
|
|
73780
73901
|
registerFunction: () => registerFunction,
|
|
73781
73902
|
registerPerson: () => registerPerson,
|
|
73903
|
+
removeCellStyle: () => removeCellStyle,
|
|
73782
73904
|
removeChartsheet: () => removeChartsheet,
|
|
73783
73905
|
removeWorksheet: () => removeWorksheet,
|
|
73784
73906
|
renameChartsheet: () => renameChartsheet,
|
|
@@ -73787,6 +73909,7 @@ self.onmessage = async function(event) {
|
|
|
73787
73909
|
toBuffer: () => toBuffer,
|
|
73788
73910
|
unprotect: () => unprotectWorkbook,
|
|
73789
73911
|
unregisterFunction: () => unregisterFunction,
|
|
73912
|
+
useBuiltinCellStyle: () => useBuiltinCellStyle,
|
|
73790
73913
|
writeStream: () => writeStream
|
|
73791
73914
|
});
|
|
73792
73915
|
//#endregion
|