Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions packages/excel-builder-vanilla-types/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Generated by dts-bundle-generator v9.5.1

import { ZipOptions } from 'fflate';

export type XMLNodeOption = {
attributes?: {
[key: string]: any;
Expand Down Expand Up @@ -470,6 +468,40 @@ export interface ChartOptions {
showSeriesName?: boolean;
};
}
/**
* Options for compressing data into a DEFLATE format
*/
export interface DeflateOptions {
/**
* The level of compression to use, ranging from 0-9 (default: 6).
* 0 will store the data without compression.
* 1 is fastest but compresses the worst, 9 is slowest but compresses the best.
*/
level?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
/**
* The memory level to use, ranging from 0-12. Increasing this increases speed and compression ratio at the cost of memory.
* The default value is automatically determined based on the size of the input data.
*/
mem?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
/** A buffer containing common byte sequences in the input data that can be used to significantly improve compression ratios.*/
dictionary?: Uint8Array;
}
/** Attributes for files added to a ZIP archive object */
export interface ZipAttributes {
/** The operating system of origin for this file, 0 (the default) */
os?: number;
/** The file's attributes*/
attrs?: number;
/** Extra metadata to add to the file. */
extra?: Record<number, Uint8Array>;
/** The comment to attach to the file. */
comment?: string;
/** When the file was last modified. Defaults to the current time. */
mtime?: Date | string | number;
}
/** Options for creating a ZIP archive */
export interface ZipOptions extends DeflateOptions, ZipAttributes {
}
/**
* @module Excel/Util
*/
Expand Down
3 changes: 0 additions & 3 deletions packages/excel-builder-vanilla-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,5 @@
"funding": {
"type": "ko_fi",
"url": "https://ko-fi.com/ghiscoding"
},
"dependencies": {
"fflate": "catalog:"
}
}
3 changes: 2 additions & 1 deletion packages/excel-builder-vanilla/src/factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { strToU8, type ZipOptions, zip } from 'fflate';
import { strToU8, zip } from 'fflate';

import { Workbook } from './Excel/Workbook.js';
import type { ZipOptions } from './interfaces.js';

type InferOutputByType<T extends 'Blob' | 'Uint8Array'> = T extends 'Blob' ? Blob : T extends 'Uint8Array' ? Uint8Array : any;

Expand Down
38 changes: 38 additions & 0 deletions packages/excel-builder-vanilla/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,41 @@ export interface ChartOptions {
showSeriesName?: boolean;
};
}

// --
// inlined fflate interface to avoid direct dependency in the @excel-builder-vanilla/types package
/**
* Options for compressing data into a DEFLATE format
*/
export interface DeflateOptions {
/**
* The level of compression to use, ranging from 0-9 (default: 6).
* 0 will store the data without compression.
* 1 is fastest but compresses the worst, 9 is slowest but compresses the best.
*/
level?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
/**
* The memory level to use, ranging from 0-12. Increasing this increases speed and compression ratio at the cost of memory.
* The default value is automatically determined based on the size of the input data.
*/
mem?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
/** A buffer containing common byte sequences in the input data that can be used to significantly improve compression ratios.*/
dictionary?: Uint8Array;
}

/** Attributes for files added to a ZIP archive object */
export interface ZipAttributes {
/** The operating system of origin for this file, 0 (the default) */
os?: number;
/** The file's attributes*/
attrs?: number;
/** Extra metadata to add to the file. */
extra?: Record<number, Uint8Array>;
/** The comment to attach to the file. */
comment?: string;
/** When the file was last modified. Defaults to the current time. */
mtime?: Date | string | number;
}

/** Options for creating a ZIP archive */
export interface ZipOptions extends DeflateOptions, ZipAttributes {}
3 changes: 2 additions & 1 deletion packages/excel-builder-vanilla/src/streaming.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { strToU8, type ZipOptions, zipSync } from 'fflate';
import { strToU8, zipSync } from 'fflate';

import type { Workbook } from './Excel/Workbook.js';
import { base64ToUint8Array } from './factory.js';
import type { ZipOptions } from './interfaces.js';

export interface ExcelFileStreamOptions {
chunkSize?: number;
Expand Down
8 changes: 2 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.