@office-kit/xlsx 0.11.1 → 0.13.0

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.
Files changed (75) hide show
  1. package/README.md +4 -1
  2. package/dist/cell/cell.d.ts +44 -9
  3. package/dist/cell/index.d.ts +1 -1
  4. package/dist/{cell-BucgGwl3.mjs → cell-Df3cKRIl.mjs} +72 -30
  5. package/dist/cell-Df3cKRIl.mjs.map +1 -0
  6. package/dist/{cell-style-DuvS_Lsg.mjs → cell-style-BFmJOmcx.mjs} +130 -93
  7. package/dist/cell-style-BFmJOmcx.mjs.map +1 -0
  8. package/dist/cell.mjs +2 -2
  9. package/dist/{coordinate-96Ecci4d.mjs → coordinate-Bt5Gni2I.mjs} +19 -8
  10. package/dist/coordinate-Bt5Gni2I.mjs.map +1 -0
  11. package/dist/{defined-names-CviWmtQg.mjs → defined-names-Ctu3F6ls.mjs} +4 -3
  12. package/dist/defined-names-Ctu3F6ls.mjs.map +1 -0
  13. package/dist/{differential-DvKU8fJt.mjs → differential-H9SjEeIU.mjs} +2 -2
  14. package/dist/{differential-DvKU8fJt.mjs.map → differential-H9SjEeIU.mjs.map} +1 -1
  15. package/dist/{drawing-BxzLuryn.mjs → drawing-ZJ3h4VHD.mjs} +2 -2
  16. package/dist/{drawing-BxzLuryn.mjs.map → drawing-ZJ3h4VHD.mjs.map} +1 -1
  17. package/dist/drawing.mjs +1 -1
  18. package/dist/{inference-BrI9uIY4.mjs → inference-BMvv9cUY.mjs} +18 -3
  19. package/dist/inference-BMvv9cUY.mjs.map +1 -0
  20. package/dist/io/save.d.ts +15 -3
  21. package/dist/io.mjs +2 -2
  22. package/dist/{load-Bghb1YHY.mjs → load-CJdGh50R.mjs} +6 -6
  23. package/dist/{load-Bghb1YHY.mjs.map → load-CJdGh50R.mjs.map} +1 -1
  24. package/dist/node.mjs +1 -1
  25. package/dist/{save-Bqcf8w3g.mjs → save-CjarR7Rp.mjs} +10 -8
  26. package/dist/save-CjarR7Rp.mjs.map +1 -0
  27. package/dist/streaming/write-only.d.ts +18 -14
  28. package/dist/streaming.mjs +21 -51
  29. package/dist/streaming.mjs.map +1 -1
  30. package/dist/styles/cell-style.d.ts +78 -32
  31. package/dist/styles/fonts.d.ts +10 -1
  32. package/dist/styles/index.d.ts +3 -3
  33. package/dist/styles/stylesheet.d.ts +26 -0
  34. package/dist/styles.mjs +4 -4
  35. package/dist/{stylesheet-writer-HxaX7bGy.mjs → stylesheet-writer-D7Uug85X.mjs} +31 -18
  36. package/dist/stylesheet-writer-D7Uug85X.mjs.map +1 -0
  37. package/dist/{table-1P8we2gS.mjs → table-Ccro4rrz.mjs} +11 -9
  38. package/dist/table-Ccro4rrz.mjs.map +1 -0
  39. package/dist/utils/coordinate.d.ts +30 -4
  40. package/dist/utils/formula-text.d.ts +7 -0
  41. package/dist/utils/index.d.ts +1 -1
  42. package/dist/utils.mjs +2 -2
  43. package/dist/workbook/calc-properties.d.ts +8 -1
  44. package/dist/workbook/index.d.ts +1 -1
  45. package/dist/{workbook-BlZVXiyG.mjs → workbook-B15-T4cs.mjs} +6 -6
  46. package/dist/{workbook-BlZVXiyG.mjs.map → workbook-B15-T4cs.mjs.map} +1 -1
  47. package/dist/workbook.mjs +45 -3
  48. package/dist/workbook.mjs.map +1 -1
  49. package/dist/worksheet/cell-range.d.ts +10 -3
  50. package/dist/worksheet/data-validations.d.ts +1 -1
  51. package/dist/worksheet/index.d.ts +3 -3
  52. package/dist/worksheet/table-validate.d.ts +7 -0
  53. package/dist/worksheet/table.d.ts +4 -1
  54. package/dist/worksheet/views.d.ts +5 -0
  55. package/dist/worksheet/worksheet.d.ts +106 -65
  56. package/dist/worksheet/writer.d.ts +7 -0
  57. package/dist/{worksheet-C5Ensf_j.mjs → worksheet-4xW-i8j9.mjs} +235 -51
  58. package/dist/worksheet-4xW-i8j9.mjs.map +1 -0
  59. package/dist/worksheet.mjs +3 -3
  60. package/dist/{writer-IyFccCRJ.mjs → writer-Z7cF_CBk.mjs} +60 -8
  61. package/dist/writer-Z7cF_CBk.mjs.map +1 -0
  62. package/dist/zip/index.d.ts +1 -1
  63. package/dist/zip/writer.d.ts +20 -1
  64. package/dist/zip.mjs +1 -1
  65. package/package.json +1 -1
  66. package/dist/cell-BucgGwl3.mjs.map +0 -1
  67. package/dist/cell-style-DuvS_Lsg.mjs.map +0 -1
  68. package/dist/coordinate-96Ecci4d.mjs.map +0 -1
  69. package/dist/defined-names-CviWmtQg.mjs.map +0 -1
  70. package/dist/inference-BrI9uIY4.mjs.map +0 -1
  71. package/dist/save-Bqcf8w3g.mjs.map +0 -1
  72. package/dist/stylesheet-writer-HxaX7bGy.mjs.map +0 -1
  73. package/dist/table-1P8we2gS.mjs.map +0 -1
  74. package/dist/worksheet-C5Ensf_j.mjs.map +0 -1
  75. package/dist/writer-IyFccCRJ.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"drawing-BxzLuryn.mjs","names":[],"sources":["../src/drawing/image.ts","../src/drawing/anchor.ts","../src/drawing/drawing.ts"],"sourcesContent":["// Image embedding.\n//\n// `XlsxImage` is the workbook-level handle for any image referenced from a\n// worksheet drawing (or chart `<a:blipFill>`). Bytes are kept verbatim so\n// re-saving never re-encodes; format / width / height are detected from the\n// file header so callers don't have to specify them.\n\nimport { OpenXmlIoError } from '../utils/exceptions.js';\n\nexport type XlsxImageFormat = 'png' | 'jpeg' | 'gif' | 'bmp' | 'webp' | 'tiff' | 'svg' | 'emf' | 'wmf';\n\n/**\n * Map from image format to the Content-Types Default extension that Excel uses\n * in `[Content_Types].xml`. SVG / EMF / WMF use the same extension as the\n * format string; PNG/JPEG/GIF/BMP do too. WebP and TIFF use their canonical\n * short names.\n */\nexport const IMAGE_FORMAT_EXTENSION: Readonly<Record<XlsxImageFormat, string>> = {\n png: 'png',\n jpeg: 'jpeg',\n gif: 'gif',\n bmp: 'bmp',\n webp: 'webp',\n tiff: 'tiff',\n svg: 'svg',\n emf: 'emf',\n wmf: 'wmf',\n};\n\n/** Map from image format to its IANA `image/*` MIME type. */\nexport const IMAGE_FORMAT_MIME: Readonly<Record<XlsxImageFormat, string>> = {\n png: 'image/png',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n bmp: 'image/bmp',\n webp: 'image/webp',\n tiff: 'image/tiff',\n svg: 'image/svg+xml',\n emf: 'image/x-emf',\n wmf: 'image/x-wmf',\n};\n\nexport interface XlsxImage {\n bytes: Uint8Array;\n format: XlsxImageFormat;\n /** Pixel width. Zero when dimensions can't be determined for the format. */\n width: number;\n /** Pixel height. Zero when dimensions can't be determined for the format. */\n height: number;\n /** ZIP archive path, e.g. `xl/media/image3.png`. Set by the writer. */\n path?: string;\n /** rels-resolved id used by `<a:blip r:embed=\"...\">`. Set by the loader. */\n rId?: string;\n}\n\n// ---- Magic-byte format detection ------------------------------------------\n\nconst startsWith = (bytes: Uint8Array, sig: ReadonlyArray<number>, offset = 0): boolean => {\n if (bytes.length < offset + sig.length) return false;\n for (let i = 0; i < sig.length; i++) {\n if (bytes[offset + i] !== sig[i]) return false;\n }\n return true;\n};\n\nconst PNG_SIG = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\nconst JPEG_SIG = [0xff, 0xd8, 0xff];\nconst GIF87 = [0x47, 0x49, 0x46, 0x38, 0x37, 0x61];\nconst GIF89 = [0x47, 0x49, 0x46, 0x38, 0x39, 0x61];\nconst BMP_SIG = [0x42, 0x4d];\nconst RIFF_SIG = [0x52, 0x49, 0x46, 0x46];\nconst WEBP_TAG = [0x57, 0x45, 0x42, 0x50];\nconst TIFF_LE = [0x49, 0x49, 0x2a, 0x00];\nconst TIFF_BE = [0x4d, 0x4d, 0x00, 0x2a];\nconst EMF_SIG = [0x01, 0x00, 0x00, 0x00];\nconst EMF_TAG = [0x20, 0x45, 0x4d, 0x46]; // ' EMF' at offset 40\nconst WMF_SIG_PLACEABLE = [0xd7, 0xcd, 0xc6, 0x9a];\nconst WMF_SIG_BARE = [0x01, 0x00, 0x09, 0x00];\n\nconst isSvg = (bytes: Uint8Array): boolean => {\n // Inspect the first ~512 bytes for an `<svg` tag (with optional XML / DOCTYPE\n // preamble).\n const head = new TextDecoder('utf-8', { fatal: false }).decode(bytes.subarray(0, Math.min(bytes.length, 512)));\n return /<svg\\b/i.test(head);\n};\n\nexport function detectImageFormat(bytes: Uint8Array): XlsxImageFormat | undefined {\n if (startsWith(bytes, PNG_SIG)) return 'png';\n if (startsWith(bytes, JPEG_SIG)) return 'jpeg';\n if (startsWith(bytes, GIF87) || startsWith(bytes, GIF89)) return 'gif';\n if (startsWith(bytes, BMP_SIG)) return 'bmp';\n if (startsWith(bytes, RIFF_SIG) && startsWith(bytes, WEBP_TAG, 8)) return 'webp';\n if (startsWith(bytes, TIFF_LE) || startsWith(bytes, TIFF_BE)) return 'tiff';\n if (startsWith(bytes, EMF_SIG) && startsWith(bytes, EMF_TAG, 40)) return 'emf';\n if (startsWith(bytes, WMF_SIG_PLACEABLE) || startsWith(bytes, WMF_SIG_BARE)) return 'wmf';\n if (isSvg(bytes)) return 'svg';\n return undefined;\n}\n\n// ---- Per-format dimension extraction --------------------------------------\n\nconst readU32BE = (bytes: Uint8Array, offset: number): number =>\n ((bytes[offset] ?? 0) << 24) |\n ((bytes[offset + 1] ?? 0) << 16) |\n ((bytes[offset + 2] ?? 0) << 8) |\n (bytes[offset + 3] ?? 0);\n\nconst readU16LE = (bytes: Uint8Array, offset: number): number => (bytes[offset] ?? 0) | ((bytes[offset + 1] ?? 0) << 8);\n\nconst readU16BE = (bytes: Uint8Array, offset: number): number => ((bytes[offset] ?? 0) << 8) | (bytes[offset + 1] ?? 0);\n\ninterface Dimensions {\n width: number;\n height: number;\n}\n\nconst pngDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n // PNG: 8-byte signature, 4-byte chunk-length, 4-byte type (\"IHDR\"), then\n // 4-byte width, 4-byte height (both big-endian).\n if (bytes.length < 24) return undefined;\n if (bytes[12] !== 0x49 || bytes[13] !== 0x48 || bytes[14] !== 0x44 || bytes[15] !== 0x52) {\n return undefined;\n }\n return { width: readU32BE(bytes, 16), height: readU32BE(bytes, 20) };\n};\n\nconst gifDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n if (bytes.length < 10) return undefined;\n return { width: readU16LE(bytes, 6), height: readU16LE(bytes, 8) };\n};\n\nconst bmpDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n if (bytes.length < 26) return undefined;\n // BITMAPINFOHEADER: width (LE int32) at offset 18, height at offset 22.\n // Height can be negative for top-down bitmaps; we report absolute pixels.\n const w = (bytes[18] ?? 0) | ((bytes[19] ?? 0) << 8) | ((bytes[20] ?? 0) << 16) | ((bytes[21] ?? 0) << 24);\n const hRaw = (bytes[22] ?? 0) | ((bytes[23] ?? 0) << 8) | ((bytes[24] ?? 0) << 16) | ((bytes[25] ?? 0) << 24);\n // Treat width as signed; for height take absolute value (top-down bitmaps\n // store negative).\n const wSigned = (w | 0) >>> 0 > 0x7fffffff ? (w | 0) - 0x100000000 : w;\n const hSigned = (hRaw | 0) >>> 0 > 0x7fffffff ? (hRaw | 0) - 0x100000000 : hRaw;\n return { width: wSigned, height: Math.abs(hSigned) };\n};\n\nconst jpegDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n // Walk the marker stream until an SOFn (FFC0..FFCF, excluding FFC4/C8/CC).\n let i = 2; // skip SOI (FFD8)\n while (i + 9 < bytes.length) {\n if (bytes[i] !== 0xff) return undefined;\n let marker = bytes[i + 1] ?? 0;\n while (marker === 0xff) {\n // Padding bytes. Advance to the next non-FF.\n i += 1;\n marker = bytes[i + 1] ?? 0;\n }\n i += 2;\n const isSof = marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc;\n const len = readU16BE(bytes, i);\n if (isSof) {\n // SOF segment: 2 bytes length, 1 byte precision, 2 bytes height, 2 bytes\n // width.\n if (i + 7 > bytes.length) return undefined;\n const height = readU16BE(bytes, i + 3);\n const width = readU16BE(bytes, i + 5);\n return { width, height };\n }\n i += len;\n }\n return undefined;\n};\n\nconst webpDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n // RIFF header is 12 bytes; chunk type is at offset 12.\n if (bytes.length < 30) return undefined;\n // VP8 (lossy): \"VP8 \" chunk; width / height at offset 26 / 28 (LE 14-bit each\n // + 2 unused bits).\n if (\n bytes[12] === 0x56 && // V\n bytes[13] === 0x50 && // P\n bytes[14] === 0x38 && // 8\n bytes[15] === 0x20 // space\n ) {\n const w = readU16LE(bytes, 26) & 0x3fff;\n const h = readU16LE(bytes, 28) & 0x3fff;\n return { width: w, height: h };\n }\n // VP8L (lossless): 14-bit width-1 / height-1 packed little-endian starting at\n // offset 21.\n if (\n bytes[12] === 0x56 &&\n bytes[13] === 0x50 &&\n bytes[14] === 0x38 &&\n bytes[15] === 0x4c // L\n ) {\n if (bytes.length < 25) return undefined;\n const b0 = bytes[21] ?? 0;\n const b1 = bytes[22] ?? 0;\n const b2 = bytes[23] ?? 0;\n const b3 = bytes[24] ?? 0;\n const w = (b0 | (b1 << 8)) & 0x3fff;\n const h = ((b1 >> 6) | (b2 << 2) | ((b3 & 0x0f) << 10)) & 0x3fff;\n return { width: w + 1, height: h + 1 };\n }\n // VP8X (extended): width-1 (24 bits) / height-1 (24 bits) at offset 24 / 27.\n if (\n bytes[12] === 0x56 &&\n bytes[13] === 0x50 &&\n bytes[14] === 0x38 &&\n bytes[15] === 0x58 // X\n ) {\n if (bytes.length < 30) return undefined;\n const w = (bytes[24] ?? 0) | ((bytes[25] ?? 0) << 8) | ((bytes[26] ?? 0) << 16);\n const h = (bytes[27] ?? 0) | ((bytes[28] ?? 0) << 8) | ((bytes[29] ?? 0) << 16);\n return { width: w + 1, height: h + 1 };\n }\n return undefined;\n};\n\nexport function detectImageDimensions(bytes: Uint8Array, format: XlsxImageFormat): Dimensions {\n let dims: Dimensions | undefined;\n switch (format) {\n case 'png':\n dims = pngDimensions(bytes);\n break;\n case 'jpeg':\n dims = jpegDimensions(bytes);\n break;\n case 'gif':\n dims = gifDimensions(bytes);\n break;\n case 'bmp':\n dims = bmpDimensions(bytes);\n break;\n case 'webp':\n dims = webpDimensions(bytes);\n break;\n default:\n // tiff / svg / emf / wmf — readers can fall back to 0 and Excel will\n // assign defaults.\n dims = undefined;\n }\n return dims ?? { width: 0, height: 0 };\n}\n\n// ---- Public factory --------------------------------------------------------\n\n/**\n * Build an `XlsxImage` from raw bytes. Detects the format and dimensions\n * automatically. Caller may pass an explicit `format` to override detection\n * (e.g. when bytes were read from a `data:` URL with a known MIME type) or\n * `width`/`height` to skip the parser.\n */\nexport function loadImage(\n bytes: Uint8Array,\n opts: { format?: XlsxImageFormat; width?: number; height?: number } = {},\n): XlsxImage {\n const format = opts.format ?? detectImageFormat(bytes);\n if (!format) {\n throw new OpenXmlIoError('loadImage: could not determine image format from bytes');\n }\n const dims =\n opts.width !== undefined && opts.height !== undefined\n ? { width: opts.width, height: opts.height }\n : detectImageDimensions(bytes, format);\n return { bytes, format, width: dims.width, height: dims.height };\n}\n","// DrawingML anchors.\n//\n// An anchor positions a drawing (chart / image / shape) inside a worksheet.\n// ECMA-376 §20.5.2 defines three kinds:\n//\n// absolute — fixed (x, y) and (cx, cy) in EMU; ignores cell layout. oneCell —\n// pinned at `from` cell, fixed extent. Resizes with the\n// cell only on its top-left corner.\n// twoCell — anchored to `from` and `to` cells. Resizes / moves with\n// both corners depending on `editAs`.\n//\n// Coordinates are EMU (English Metric Units). 1 inch = 914400 EMU, 1 cm =\n// 360000 EMU, 1 px = 9525 EMU at 96 dpi.\n\nimport { columnIndexFromLetter } from '../utils/coordinate.js';\nimport { OpenXmlSchemaError } from '../utils/exceptions.js';\nimport { emuFromPx } from '../utils/units.js';\n\n/** EMU = English Metric Units. Drawing coordinates are stored in EMU on the wire. */\nexport interface Point2D {\n /** Horizontal offset in EMU. */\n x: number;\n /** Vertical offset in EMU. */\n y: number;\n}\n\nexport interface PositiveSize2D {\n cx: number;\n cy: number;\n}\n\n/**\n * `from` / `to` corners reference a cell by 0-based column + row index plus an\n * EMU offset within the cell. Excel's wire format is 0-based here even though\n * cell references in formulas / sheetData are 1-based.\n */\nexport interface AnchorMarker {\n col: number;\n colOff: number;\n row: number;\n rowOff: number;\n}\n\nexport type DrawingAnchor =\n | { kind: 'absolute'; pos: Point2D; ext: PositiveSize2D }\n | { kind: 'oneCell'; from: AnchorMarker; ext: PositiveSize2D }\n | { kind: 'twoCell'; from: AnchorMarker; to: AnchorMarker; editAs?: 'twoCell' | 'oneCell' | 'absolute' };\n\nconst A1_RE = /^([A-Za-z]{1,3})([1-9][0-9]*)$/;\n\n/**\n * Convert a cell ref (\"A1\", \"C5\") to a 0-based AnchorMarker with `colOff =\n * rowOff = 0`. Throws on malformed refs.\n */\nexport function anchorMarkerFromCellRef(ref: string): AnchorMarker {\n const m = A1_RE.exec(ref);\n if (!m || m[1] === undefined || m[2] === undefined) {\n throw new OpenXmlSchemaError(`anchorMarkerFromCellRef: invalid coordinate \"${ref}\"`);\n }\n const col = columnIndexFromLetter(m[1]) - 1; // 0-based\n const row = Number.parseInt(m[2], 10) - 1; // 0-based\n return { col, colOff: 0, row, rowOff: 0 };\n}\n\n/** Build an absolute anchor from an (x, y, cx, cy) EMU bundle. */\nexport function makeAbsoluteAnchor(opts: { x: number; y: number; cx: number; cy: number }): DrawingAnchor {\n return { kind: 'absolute', pos: { x: opts.x, y: opts.y }, ext: { cx: opts.cx, cy: opts.cy } };\n}\n\n/** Build a one-cell anchor pinned at `from` with an explicit pixel extent. */\nexport function makeOneCellAnchor(opts: {\n from: string | AnchorMarker;\n widthPx: number;\n heightPx: number;\n}): DrawingAnchor {\n const from = typeof opts.from === 'string' ? anchorMarkerFromCellRef(opts.from) : opts.from;\n return {\n kind: 'oneCell',\n from,\n ext: { cx: emuFromPx(opts.widthPx), cy: emuFromPx(opts.heightPx) },\n };\n}\n\n/**\n * Build a two-cell anchor from cell-ref pairs (or pre-built markers). Defaults\n * to `editAs='twoCell'` — drag both corners with the cells.\n */\nexport function makeTwoCellAnchor(opts: {\n from: string | AnchorMarker;\n to: string | AnchorMarker;\n editAs?: 'twoCell' | 'oneCell' | 'absolute';\n}): DrawingAnchor {\n const from = typeof opts.from === 'string' ? anchorMarkerFromCellRef(opts.from) : opts.from;\n const to = typeof opts.to === 'string' ? anchorMarkerFromCellRef(opts.to) : opts.to;\n return {\n kind: 'twoCell',\n from,\n to,\n ...(opts.editAs !== undefined ? { editAs: opts.editAs } : {}),\n };\n}\n","// Spreadsheet drawing data model.\n//\n// A `Drawing` is the per-worksheet `xl/drawings/drawingN.xml` part — a list of\n// anchor entries, each carrying a content variant (chart, picture, shape,\n// connector, group). Charts and pictures are modeled; everything else is kept\n// as the verbatim source XML so it survives a round-trip untouched.\n\nimport type { ChartSpace } from '../chart/chart.js';\nimport type { CxChartSpace } from '../chart/cx/chartex.js';\nimport type { DrawingAnchor } from './anchor.js';\nimport type { ShapeProperties } from './dml/shape-properties.js';\nimport type { XlsxImage } from './image.js';\n\n/** Reference to a chart part — the chart's drawing-rels rId resolves to xl/charts/chartN.xml. */\nexport interface ChartReference {\n /** Drawing-rels rId pointing at the chart part. Populated on read; the writer assigns its own. */\n rId?: string;\n /**\n * Legacy ECMA-376 chart payload (`c:chartSpace`). Stage-1 supports BarChart\n * end-to-end; other chart kinds populate this field as their parsers /\n * writers land.\n */\n space?: ChartSpace;\n /**\n * Excel-2016 chartex payload (`cx:chartSpace`). Mutually exclusive with\n * {@link space} for any given drawing item; the parser sniffs the root\n * element and populates whichever is appropriate.\n */\n cxSpace?: CxChartSpace;\n /**\n * `true` when the resolved chart part is a chartex (`cx:`) chart. Set by the\n * package writer so the drawing emitter knows to use the chartex\n * `<a:graphicData uri>` instead of the legacy chart URI — Excel rejects the\n * workbook when the URI doesn't match the chart's actual root namespace.\n */\n isCx?: boolean;\n}\n\n/** Reference to an embedded picture inside a worksheet drawing. */\nexport interface PictureReference {\n /** Drawing-rels rId pointing at the embedded image. Populated on read; the writer assigns its own. */\n rId?: string;\n /** Resolved image bytes + metadata. Populated on read; the writer reads it back. */\n image?: XlsxImage;\n /** Picture display name (`<xdr:cNvPr name=\"...\">`). */\n name?: string;\n /** Optional alt-text description. */\n descr?: string;\n /** Hidden flag (`<xdr:cNvPr hidden=\"1\"/>`). */\n hidden?: boolean;\n /** Per-picture shape properties (extra fill / line / rotation). */\n spPr?: ShapeProperties;\n}\n\nexport interface DrawingItem {\n anchor: DrawingAnchor;\n content:\n | { kind: 'chart'; chart: ChartReference }\n | { kind: 'picture'; picture: PictureReference }\n | { kind: 'unsupported'; rawTag: string };\n /**\n * The whole source anchor element, captured verbatim. Set by the reader for\n * `unsupported` content — a plain shape, a group, a connector — because the\n * model has no slot for its geometry, text or `<xdr:clientData>` attributes.\n * When present the writer emits it as-is instead of rebuilding the anchor\n * from {@link anchor} + {@link content}.\n */\n raw?: import('../xml/tree.js').XmlNode;\n}\n\nexport interface Drawing {\n items: DrawingItem[];\n /**\n * `<xdr:wsDr>` children that aren't anchors — in practice Excel's\n * `<mc:AlternateContent>` wrapper around an anchor that needs a newer\n * feature. Kept verbatim together with the `items` index they sat before, so\n * document order (which is z-order) survives a round-trip.\n */\n rawChildren?: Array<{ beforeItem: number; node: import('../xml/tree.js').XmlNode }>;\n /**\n * Drawing-rels entries the verbatim nodes above reference (`r:embed` on a\n * picture inside a group, `r:id` on a shape's hyperlink, …). Carried over\n * from the source part under their original ids so those references still\n * resolve after a re-save; the writer allocates its own ids around them.\n */\n rawRels?: import('../packaging/relationships.js').Relationships;\n}\n\nexport function makeDrawing(items: DrawingItem[] = []): Drawing {\n return { items };\n}\n\nexport function makeChartDrawingItem(anchor: DrawingAnchor, chart: ChartReference = {}): DrawingItem {\n return { anchor, content: { kind: 'chart', chart } };\n}\n\nexport function makePictureDrawingItem(anchor: DrawingAnchor, picture: PictureReference | XlsxImage): DrawingItem {\n // Distinguish raw image bytes from a full PictureReference by checking the\n // discriminator: XlsxImage carries `format`, PictureReference doesn't.\n const ref: PictureReference = 'format' in picture ? { image: picture as XlsxImage } : (picture as PictureReference);\n return { anchor, content: { kind: 'picture', picture: ref } };\n}\n\n// ---- Worksheet ergonomic helpers ----------------------------------------\n\nimport { loadImage } from './image.js';\nimport { makeOneCellAnchor } from './anchor.js';\nimport type { Worksheet } from '../worksheet/worksheet.js';\n\n/**\n * Drop an image onto a worksheet at a single-cell anchor. Lazy-allocates\n * `ws.drawing` (as `makeDrawing([])`) on first call and appends a picture\n * DrawingItem.\n *\n * `image` accepts either an `XlsxImage` (already loaded via `loadImage`) or raw\n * image bytes — in the bytes case, this helper sniffs the format with\n * `loadImage` itself.\n *\n * `at` is a cell ref like `\"C3\"`. Override `widthPx` / `heightPx` to scale;\n * otherwise the helper uses 96×96 defaults that look fine for typical icons.\n */\nexport const addImageAt = (\n ws: Worksheet,\n at: string,\n image: XlsxImage | Uint8Array,\n opts: { widthPx?: number; heightPx?: number } = {},\n): DrawingItem => {\n const xlsxImage: XlsxImage = image instanceof Uint8Array ? loadImage(image) : image;\n const anchor = makeOneCellAnchor({\n from: at,\n widthPx: opts.widthPx ?? 96,\n heightPx: opts.heightPx ?? 96,\n });\n const item = makePictureDrawingItem(anchor, xlsxImage);\n if (!ws.drawing) ws.drawing = makeDrawing([]);\n ws.drawing.items.push(item);\n return item;\n};\n\n/**\n * Anchor a chart to a worksheet at a single-cell ref. Lazy-allocates\n * `ws.drawing`. `chart` is the same `ChartReference` shape `makeChart\n * DrawingItem` accepts (`{ space }` for legacy chart, `{ cxSpace }` for\n * chartex).\n */\nexport const addChartAt = (\n ws: Worksheet,\n at: string,\n chart: ChartReference,\n opts: { widthPx?: number; heightPx?: number } = {},\n): DrawingItem => {\n const anchor = makeOneCellAnchor({\n from: at,\n widthPx: opts.widthPx ?? 480,\n heightPx: opts.heightPx ?? 320,\n });\n const item = makeChartDrawingItem(anchor, chart);\n if (!ws.drawing) ws.drawing = makeDrawing([]);\n ws.drawing.items.push(item);\n return item;\n};\n\n/**\n * Read-only snapshot of every picture DrawingItem on the sheet. Returns the\n * matching items (each with its anchor + picture reference). Empty array when\n * the sheet has no drawing or only non-picture items.\n */\nexport const listImagesOnSheet = (ws: Worksheet): ReadonlyArray<DrawingItem> => {\n if (!ws.drawing) return [];\n return ws.drawing.items.filter((it) => it.content.kind === 'picture');\n};\n\n/**\n * Read-only snapshot of every chart DrawingItem on the sheet. Each item has its\n * anchor + chart reference.\n */\nexport const listChartsOnSheet = (ws: Worksheet): ReadonlyArray<DrawingItem> => {\n if (!ws.drawing) return [];\n return ws.drawing.items.filter((it) => it.content.kind === 'chart');\n};\n\n/**\n * Drop every DrawingItem from the worksheet. Returns the count removed. The\n * `ws.drawing` field itself is left in place (empty) so subsequent `addImageAt`\n * / `addChartAt` calls don't have to re-allocate.\n */\nexport const removeAllDrawingItems = (ws: Worksheet): number => {\n if (!ws.drawing) return 0;\n const n = ws.drawing.items.length;\n ws.drawing.items = [];\n return n;\n};\n\n/**\n * Drop every picture DrawingItem from the worksheet, leaving charts and any\n * other content kinds untouched. Returns the count removed.\n */\nexport const removeAllImages = (ws: Worksheet): number => {\n if (!ws.drawing) return 0;\n const before = ws.drawing.items.length;\n ws.drawing.items = ws.drawing.items.filter((it) => it.content.kind !== 'picture');\n return before - ws.drawing.items.length;\n};\n\n/**\n * Drop every chart DrawingItem from the worksheet, leaving pictures and any\n * other content kinds untouched. Returns the count removed.\n */\nexport const removeAllCharts = (ws: Worksheet): number => {\n if (!ws.drawing) return 0;\n const before = ws.drawing.items.length;\n ws.drawing.items = ws.drawing.items.filter((it) => it.content.kind !== 'chart');\n return before - ws.drawing.items.length;\n};\n"],"mappings":";;;;;;;;;;AAiBA,MAAa,yBAAoE;CAC/E,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;AACP;;AAGA,MAAa,oBAA+D;CAC1E,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,K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AQ,QAAQ,GAAG,QAAQ,MAAM,QAAQ,OAAO,GAAG,QAAQ,SAAS,SAAS;CAChF,OAAO,SAAS,GAAG,QAAQ,MAAM;AACnC;;;;;AAMA,MAAa,mBAAmB,OAA0B;CACxD,IAAI,CAAC,GAAG,SAAS,OAAO;CACxB,MAAM,SAAS,GAAG,QAAQ,MAAM;CAChC,GAAG,QAAQ,QAAQ,GAAG,QAAQ,MAAM,QAAQ,OAAO,GAAG,QAAQ,SAAS,OAAO;CAC9E,OAAO,SAAS,GAAG,QAAQ,MAAM;AACnC"}
1
+ {"version":3,"file":"drawing-ZJ3h4VHD.mjs","names":[],"sources":["../src/drawing/image.ts","../src/drawing/anchor.ts","../src/drawing/drawing.ts"],"sourcesContent":["// Image embedding.\n//\n// `XlsxImage` is the workbook-level handle for any image referenced from a\n// worksheet drawing (or chart `<a:blipFill>`). Bytes are kept verbatim so\n// re-saving never re-encodes; format / width / height are detected from the\n// file header so callers don't have to specify them.\n\nimport { OpenXmlIoError } from '../utils/exceptions.js';\n\nexport type XlsxImageFormat = 'png' | 'jpeg' | 'gif' | 'bmp' | 'webp' | 'tiff' | 'svg' | 'emf' | 'wmf';\n\n/**\n * Map from image format to the Content-Types Default extension that Excel uses\n * in `[Content_Types].xml`. SVG / EMF / WMF use the same extension as the\n * format string; PNG/JPEG/GIF/BMP do too. WebP and TIFF use their canonical\n * short names.\n */\nexport const IMAGE_FORMAT_EXTENSION: Readonly<Record<XlsxImageFormat, string>> = {\n png: 'png',\n jpeg: 'jpeg',\n gif: 'gif',\n bmp: 'bmp',\n webp: 'webp',\n tiff: 'tiff',\n svg: 'svg',\n emf: 'emf',\n wmf: 'wmf',\n};\n\n/** Map from image format to its IANA `image/*` MIME type. */\nexport const IMAGE_FORMAT_MIME: Readonly<Record<XlsxImageFormat, string>> = {\n png: 'image/png',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n bmp: 'image/bmp',\n webp: 'image/webp',\n tiff: 'image/tiff',\n svg: 'image/svg+xml',\n emf: 'image/x-emf',\n wmf: 'image/x-wmf',\n};\n\nexport interface XlsxImage {\n bytes: Uint8Array;\n format: XlsxImageFormat;\n /** Pixel width. Zero when dimensions can't be determined for the format. */\n width: number;\n /** Pixel height. Zero when dimensions can't be determined for the format. */\n height: number;\n /** ZIP archive path, e.g. `xl/media/image3.png`. Set by the writer. */\n path?: string;\n /** rels-resolved id used by `<a:blip r:embed=\"...\">`. Set by the loader. */\n rId?: string;\n}\n\n// ---- Magic-byte format detection ------------------------------------------\n\nconst startsWith = (bytes: Uint8Array, sig: ReadonlyArray<number>, offset = 0): boolean => {\n if (bytes.length < offset + sig.length) return false;\n for (let i = 0; i < sig.length; i++) {\n if (bytes[offset + i] !== sig[i]) return false;\n }\n return true;\n};\n\nconst PNG_SIG = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\nconst JPEG_SIG = [0xff, 0xd8, 0xff];\nconst GIF87 = [0x47, 0x49, 0x46, 0x38, 0x37, 0x61];\nconst GIF89 = [0x47, 0x49, 0x46, 0x38, 0x39, 0x61];\nconst BMP_SIG = [0x42, 0x4d];\nconst RIFF_SIG = [0x52, 0x49, 0x46, 0x46];\nconst WEBP_TAG = [0x57, 0x45, 0x42, 0x50];\nconst TIFF_LE = [0x49, 0x49, 0x2a, 0x00];\nconst TIFF_BE = [0x4d, 0x4d, 0x00, 0x2a];\nconst EMF_SIG = [0x01, 0x00, 0x00, 0x00];\nconst EMF_TAG = [0x20, 0x45, 0x4d, 0x46]; // ' EMF' at offset 40\nconst WMF_SIG_PLACEABLE = [0xd7, 0xcd, 0xc6, 0x9a];\nconst WMF_SIG_BARE = [0x01, 0x00, 0x09, 0x00];\n\nconst isSvg = (bytes: Uint8Array): boolean => {\n // Inspect the first ~512 bytes for an `<svg` tag (with optional XML / DOCTYPE\n // preamble).\n const head = new TextDecoder('utf-8', { fatal: false }).decode(bytes.subarray(0, Math.min(bytes.length, 512)));\n return /<svg\\b/i.test(head);\n};\n\nexport function detectImageFormat(bytes: Uint8Array): XlsxImageFormat | undefined {\n if (startsWith(bytes, PNG_SIG)) return 'png';\n if (startsWith(bytes, JPEG_SIG)) return 'jpeg';\n if (startsWith(bytes, GIF87) || startsWith(bytes, GIF89)) return 'gif';\n if (startsWith(bytes, BMP_SIG)) return 'bmp';\n if (startsWith(bytes, RIFF_SIG) && startsWith(bytes, WEBP_TAG, 8)) return 'webp';\n if (startsWith(bytes, TIFF_LE) || startsWith(bytes, TIFF_BE)) return 'tiff';\n if (startsWith(bytes, EMF_SIG) && startsWith(bytes, EMF_TAG, 40)) return 'emf';\n if (startsWith(bytes, WMF_SIG_PLACEABLE) || startsWith(bytes, WMF_SIG_BARE)) return 'wmf';\n if (isSvg(bytes)) return 'svg';\n return undefined;\n}\n\n// ---- Per-format dimension extraction --------------------------------------\n\nconst readU32BE = (bytes: Uint8Array, offset: number): number =>\n ((bytes[offset] ?? 0) << 24) |\n ((bytes[offset + 1] ?? 0) << 16) |\n ((bytes[offset + 2] ?? 0) << 8) |\n (bytes[offset + 3] ?? 0);\n\nconst readU16LE = (bytes: Uint8Array, offset: number): number => (bytes[offset] ?? 0) | ((bytes[offset + 1] ?? 0) << 8);\n\nconst readU16BE = (bytes: Uint8Array, offset: number): number => ((bytes[offset] ?? 0) << 8) | (bytes[offset + 1] ?? 0);\n\ninterface Dimensions {\n width: number;\n height: number;\n}\n\nconst pngDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n // PNG: 8-byte signature, 4-byte chunk-length, 4-byte type (\"IHDR\"), then\n // 4-byte width, 4-byte height (both big-endian).\n if (bytes.length < 24) return undefined;\n if (bytes[12] !== 0x49 || bytes[13] !== 0x48 || bytes[14] !== 0x44 || bytes[15] !== 0x52) {\n return undefined;\n }\n return { width: readU32BE(bytes, 16), height: readU32BE(bytes, 20) };\n};\n\nconst gifDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n if (bytes.length < 10) return undefined;\n return { width: readU16LE(bytes, 6), height: readU16LE(bytes, 8) };\n};\n\nconst bmpDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n if (bytes.length < 26) return undefined;\n // BITMAPINFOHEADER: width (LE int32) at offset 18, height at offset 22.\n // Height can be negative for top-down bitmaps; we report absolute pixels.\n const w = (bytes[18] ?? 0) | ((bytes[19] ?? 0) << 8) | ((bytes[20] ?? 0) << 16) | ((bytes[21] ?? 0) << 24);\n const hRaw = (bytes[22] ?? 0) | ((bytes[23] ?? 0) << 8) | ((bytes[24] ?? 0) << 16) | ((bytes[25] ?? 0) << 24);\n // Treat width as signed; for height take absolute value (top-down bitmaps\n // store negative).\n const wSigned = (w | 0) >>> 0 > 0x7fffffff ? (w | 0) - 0x100000000 : w;\n const hSigned = (hRaw | 0) >>> 0 > 0x7fffffff ? (hRaw | 0) - 0x100000000 : hRaw;\n return { width: wSigned, height: Math.abs(hSigned) };\n};\n\nconst jpegDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n // Walk the marker stream until an SOFn (FFC0..FFCF, excluding FFC4/C8/CC).\n let i = 2; // skip SOI (FFD8)\n while (i + 9 < bytes.length) {\n if (bytes[i] !== 0xff) return undefined;\n let marker = bytes[i + 1] ?? 0;\n while (marker === 0xff) {\n // Padding bytes. Advance to the next non-FF.\n i += 1;\n marker = bytes[i + 1] ?? 0;\n }\n i += 2;\n const isSof = marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc;\n const len = readU16BE(bytes, i);\n if (isSof) {\n // SOF segment: 2 bytes length, 1 byte precision, 2 bytes height, 2 bytes\n // width.\n if (i + 7 > bytes.length) return undefined;\n const height = readU16BE(bytes, i + 3);\n const width = readU16BE(bytes, i + 5);\n return { width, height };\n }\n i += len;\n }\n return undefined;\n};\n\nconst webpDimensions = (bytes: Uint8Array): Dimensions | undefined => {\n // RIFF header is 12 bytes; chunk type is at offset 12.\n if (bytes.length < 30) return undefined;\n // VP8 (lossy): \"VP8 \" chunk; width / height at offset 26 / 28 (LE 14-bit each\n // + 2 unused bits).\n if (\n bytes[12] === 0x56 && // V\n bytes[13] === 0x50 && // P\n bytes[14] === 0x38 && // 8\n bytes[15] === 0x20 // space\n ) {\n const w = readU16LE(bytes, 26) & 0x3fff;\n const h = readU16LE(bytes, 28) & 0x3fff;\n return { width: w, height: h };\n }\n // VP8L (lossless): 14-bit width-1 / height-1 packed little-endian starting at\n // offset 21.\n if (\n bytes[12] === 0x56 &&\n bytes[13] === 0x50 &&\n bytes[14] === 0x38 &&\n bytes[15] === 0x4c // L\n ) {\n if (bytes.length < 25) return undefined;\n const b0 = bytes[21] ?? 0;\n const b1 = bytes[22] ?? 0;\n const b2 = bytes[23] ?? 0;\n const b3 = bytes[24] ?? 0;\n const w = (b0 | (b1 << 8)) & 0x3fff;\n const h = ((b1 >> 6) | (b2 << 2) | ((b3 & 0x0f) << 10)) & 0x3fff;\n return { width: w + 1, height: h + 1 };\n }\n // VP8X (extended): width-1 (24 bits) / height-1 (24 bits) at offset 24 / 27.\n if (\n bytes[12] === 0x56 &&\n bytes[13] === 0x50 &&\n bytes[14] === 0x38 &&\n bytes[15] === 0x58 // X\n ) {\n if (bytes.length < 30) return undefined;\n const w = (bytes[24] ?? 0) | ((bytes[25] ?? 0) << 8) | ((bytes[26] ?? 0) << 16);\n const h = (bytes[27] ?? 0) | ((bytes[28] ?? 0) << 8) | ((bytes[29] ?? 0) << 16);\n return { width: w + 1, height: h + 1 };\n }\n return undefined;\n};\n\nexport function detectImageDimensions(bytes: Uint8Array, format: XlsxImageFormat): Dimensions {\n let dims: Dimensions | undefined;\n switch (format) {\n case 'png':\n dims = pngDimensions(bytes);\n break;\n case 'jpeg':\n dims = jpegDimensions(bytes);\n break;\n case 'gif':\n dims = gifDimensions(bytes);\n break;\n case 'bmp':\n dims = bmpDimensions(bytes);\n break;\n case 'webp':\n dims = webpDimensions(bytes);\n break;\n default:\n // tiff / svg / emf / wmf — readers can fall back to 0 and Excel will\n // assign defaults.\n dims = undefined;\n }\n return dims ?? { width: 0, height: 0 };\n}\n\n// ---- Public factory --------------------------------------------------------\n\n/**\n * Build an `XlsxImage` from raw bytes. Detects the format and dimensions\n * automatically. Caller may pass an explicit `format` to override detection\n * (e.g. when bytes were read from a `data:` URL with a known MIME type) or\n * `width`/`height` to skip the parser.\n */\nexport function loadImage(\n bytes: Uint8Array,\n opts: { format?: XlsxImageFormat; width?: number; height?: number } = {},\n): XlsxImage {\n const format = opts.format ?? detectImageFormat(bytes);\n if (!format) {\n throw new OpenXmlIoError('loadImage: could not determine image format from bytes');\n }\n const dims =\n opts.width !== undefined && opts.height !== undefined\n ? { width: opts.width, height: opts.height }\n : detectImageDimensions(bytes, format);\n return { bytes, format, width: dims.width, height: dims.height };\n}\n","// DrawingML anchors.\n//\n// An anchor positions a drawing (chart / image / shape) inside a worksheet.\n// ECMA-376 §20.5.2 defines three kinds:\n//\n// absolute — fixed (x, y) and (cx, cy) in EMU; ignores cell layout. oneCell —\n// pinned at `from` cell, fixed extent. Resizes with the\n// cell only on its top-left corner.\n// twoCell — anchored to `from` and `to` cells. Resizes / moves with\n// both corners depending on `editAs`.\n//\n// Coordinates are EMU (English Metric Units). 1 inch = 914400 EMU, 1 cm =\n// 360000 EMU, 1 px = 9525 EMU at 96 dpi.\n\nimport { columnIndexFromLetter } from '../utils/coordinate.js';\nimport { OpenXmlSchemaError } from '../utils/exceptions.js';\nimport { emuFromPx } from '../utils/units.js';\n\n/** EMU = English Metric Units. Drawing coordinates are stored in EMU on the wire. */\nexport interface Point2D {\n /** Horizontal offset in EMU. */\n x: number;\n /** Vertical offset in EMU. */\n y: number;\n}\n\nexport interface PositiveSize2D {\n cx: number;\n cy: number;\n}\n\n/**\n * `from` / `to` corners reference a cell by 0-based column + row index plus an\n * EMU offset within the cell. Excel's wire format is 0-based here even though\n * cell references in formulas / sheetData are 1-based.\n */\nexport interface AnchorMarker {\n col: number;\n colOff: number;\n row: number;\n rowOff: number;\n}\n\nexport type DrawingAnchor =\n | { kind: 'absolute'; pos: Point2D; ext: PositiveSize2D }\n | { kind: 'oneCell'; from: AnchorMarker; ext: PositiveSize2D }\n | { kind: 'twoCell'; from: AnchorMarker; to: AnchorMarker; editAs?: 'twoCell' | 'oneCell' | 'absolute' };\n\nconst A1_RE = /^([A-Za-z]{1,3})([1-9][0-9]*)$/;\n\n/**\n * Convert a cell ref (\"A1\", \"C5\") to a 0-based AnchorMarker with `colOff =\n * rowOff = 0`. Throws on malformed refs.\n */\nexport function anchorMarkerFromCellRef(ref: string): AnchorMarker {\n const m = A1_RE.exec(ref);\n if (!m || m[1] === undefined || m[2] === undefined) {\n throw new OpenXmlSchemaError(`anchorMarkerFromCellRef: invalid coordinate \"${ref}\"`);\n }\n const col = columnIndexFromLetter(m[1]) - 1; // 0-based\n const row = Number.parseInt(m[2], 10) - 1; // 0-based\n return { col, colOff: 0, row, rowOff: 0 };\n}\n\n/** Build an absolute anchor from an (x, y, cx, cy) EMU bundle. */\nexport function makeAbsoluteAnchor(opts: { x: number; y: number; cx: number; cy: number }): DrawingAnchor {\n return { kind: 'absolute', pos: { x: opts.x, y: opts.y }, ext: { cx: opts.cx, cy: opts.cy } };\n}\n\n/** Build a one-cell anchor pinned at `from` with an explicit pixel extent. */\nexport function makeOneCellAnchor(opts: {\n from: string | AnchorMarker;\n widthPx: number;\n heightPx: number;\n}): DrawingAnchor {\n const from = typeof opts.from === 'string' ? anchorMarkerFromCellRef(opts.from) : opts.from;\n return {\n kind: 'oneCell',\n from,\n ext: { cx: emuFromPx(opts.widthPx), cy: emuFromPx(opts.heightPx) },\n };\n}\n\n/**\n * Build a two-cell anchor from cell-ref pairs (or pre-built markers). Defaults\n * to `editAs='twoCell'` — drag both corners with the cells.\n */\nexport function makeTwoCellAnchor(opts: {\n from: string | AnchorMarker;\n to: string | AnchorMarker;\n editAs?: 'twoCell' | 'oneCell' | 'absolute';\n}): DrawingAnchor {\n const from = typeof opts.from === 'string' ? anchorMarkerFromCellRef(opts.from) : opts.from;\n const to = typeof opts.to === 'string' ? anchorMarkerFromCellRef(opts.to) : opts.to;\n return {\n kind: 'twoCell',\n from,\n to,\n ...(opts.editAs !== undefined ? { editAs: opts.editAs } : {}),\n };\n}\n","// Spreadsheet drawing data model.\n//\n// A `Drawing` is the per-worksheet `xl/drawings/drawingN.xml` part — a list of\n// anchor entries, each carrying a content variant (chart, picture, shape,\n// connector, group). Charts and pictures are modeled; everything else is kept\n// as the verbatim source XML so it survives a round-trip untouched.\n\nimport type { ChartSpace } from '../chart/chart.js';\nimport type { CxChartSpace } from '../chart/cx/chartex.js';\nimport type { DrawingAnchor } from './anchor.js';\nimport type { ShapeProperties } from './dml/shape-properties.js';\nimport type { XlsxImage } from './image.js';\n\n/** Reference to a chart part — the chart's drawing-rels rId resolves to xl/charts/chartN.xml. */\nexport interface ChartReference {\n /** Drawing-rels rId pointing at the chart part. Populated on read; the writer assigns its own. */\n rId?: string;\n /**\n * Legacy ECMA-376 chart payload (`c:chartSpace`). Stage-1 supports BarChart\n * end-to-end; other chart kinds populate this field as their parsers /\n * writers land.\n */\n space?: ChartSpace;\n /**\n * Excel-2016 chartex payload (`cx:chartSpace`). Mutually exclusive with\n * {@link space} for any given drawing item; the parser sniffs the root\n * element and populates whichever is appropriate.\n */\n cxSpace?: CxChartSpace;\n /**\n * `true` when the resolved chart part is a chartex (`cx:`) chart. Set by the\n * package writer so the drawing emitter knows to use the chartex\n * `<a:graphicData uri>` instead of the legacy chart URI — Excel rejects the\n * workbook when the URI doesn't match the chart's actual root namespace.\n */\n isCx?: boolean;\n}\n\n/** Reference to an embedded picture inside a worksheet drawing. */\nexport interface PictureReference {\n /** Drawing-rels rId pointing at the embedded image. Populated on read; the writer assigns its own. */\n rId?: string;\n /** Resolved image bytes + metadata. Populated on read; the writer reads it back. */\n image?: XlsxImage;\n /** Picture display name (`<xdr:cNvPr name=\"...\">`). */\n name?: string;\n /** Optional alt-text description. */\n descr?: string;\n /** Hidden flag (`<xdr:cNvPr hidden=\"1\"/>`). */\n hidden?: boolean;\n /** Per-picture shape properties (extra fill / line / rotation). */\n spPr?: ShapeProperties;\n}\n\nexport interface DrawingItem {\n anchor: DrawingAnchor;\n content:\n | { kind: 'chart'; chart: ChartReference }\n | { kind: 'picture'; picture: PictureReference }\n | { kind: 'unsupported'; rawTag: string };\n /**\n * The whole source anchor element, captured verbatim. Set by the reader for\n * `unsupported` content — a plain shape, a group, a connector — because the\n * model has no slot for its geometry, text or `<xdr:clientData>` attributes.\n * When present the writer emits it as-is instead of rebuilding the anchor\n * from {@link anchor} + {@link content}.\n */\n raw?: import('../xml/tree.js').XmlNode;\n}\n\nexport interface Drawing {\n items: DrawingItem[];\n /**\n * `<xdr:wsDr>` children that aren't anchors — in practice Excel's\n * `<mc:AlternateContent>` wrapper around an anchor that needs a newer\n * feature. Kept verbatim together with the `items` index they sat before, so\n * document order (which is z-order) survives a round-trip.\n */\n rawChildren?: Array<{ beforeItem: number; node: import('../xml/tree.js').XmlNode }>;\n /**\n * Drawing-rels entries the verbatim nodes above reference (`r:embed` on a\n * picture inside a group, `r:id` on a shape's hyperlink, …). Carried over\n * from the source part under their original ids so those references still\n * resolve after a re-save; the writer allocates its own ids around them.\n */\n rawRels?: import('../packaging/relationships.js').Relationships;\n}\n\nexport function makeDrawing(items: DrawingItem[] = []): Drawing {\n return { items };\n}\n\nexport function makeChartDrawingItem(anchor: DrawingAnchor, chart: ChartReference = {}): DrawingItem {\n return { anchor, content: { kind: 'chart', chart } };\n}\n\nexport function makePictureDrawingItem(anchor: DrawingAnchor, picture: PictureReference | XlsxImage): DrawingItem {\n // Distinguish raw image bytes from a full PictureReference by checking the\n // discriminator: XlsxImage carries `format`, PictureReference doesn't.\n const ref: PictureReference = 'format' in picture ? { image: picture as XlsxImage } : (picture as PictureReference);\n return { anchor, content: { kind: 'picture', picture: ref } };\n}\n\n// ---- Worksheet ergonomic helpers ----------------------------------------\n\nimport { loadImage } from './image.js';\nimport { makeOneCellAnchor } from './anchor.js';\nimport type { Worksheet } from '../worksheet/worksheet.js';\n\n/**\n * Drop an image onto a worksheet at a single-cell anchor. Lazy-allocates\n * `ws.drawing` (as `makeDrawing([])`) on first call and appends a picture\n * DrawingItem.\n *\n * `image` accepts either an `XlsxImage` (already loaded via `loadImage`) or raw\n * image bytes — in the bytes case, this helper sniffs the format with\n * `loadImage` itself.\n *\n * `at` is a cell ref like `\"C3\"`. Override `widthPx` / `heightPx` to scale;\n * otherwise the helper uses 96×96 defaults that look fine for typical icons.\n */\nexport const addImageAt = (\n ws: Worksheet,\n at: string,\n image: XlsxImage | Uint8Array,\n opts: { widthPx?: number; heightPx?: number } = {},\n): DrawingItem => {\n const xlsxImage: XlsxImage = image instanceof Uint8Array ? loadImage(image) : image;\n const anchor = makeOneCellAnchor({\n from: at,\n widthPx: opts.widthPx ?? 96,\n heightPx: opts.heightPx ?? 96,\n });\n const item = makePictureDrawingItem(anchor, xlsxImage);\n if (!ws.drawing) ws.drawing = makeDrawing([]);\n ws.drawing.items.push(item);\n return item;\n};\n\n/**\n * Anchor a chart to a worksheet at a single-cell ref. Lazy-allocates\n * `ws.drawing`. `chart` is the same `ChartReference` shape `makeChart\n * DrawingItem` accepts (`{ space }` for legacy chart, `{ cxSpace }` for\n * chartex).\n */\nexport const addChartAt = (\n ws: Worksheet,\n at: string,\n chart: ChartReference,\n opts: { widthPx?: number; heightPx?: number } = {},\n): DrawingItem => {\n const anchor = makeOneCellAnchor({\n from: at,\n widthPx: opts.widthPx ?? 480,\n heightPx: opts.heightPx ?? 320,\n });\n const item = makeChartDrawingItem(anchor, chart);\n if (!ws.drawing) ws.drawing = makeDrawing([]);\n ws.drawing.items.push(item);\n return item;\n};\n\n/**\n * Read-only snapshot of every picture DrawingItem on the sheet. Returns the\n * matching items (each with its anchor + picture reference). Empty array when\n * the sheet has no drawing or only non-picture items.\n */\nexport const listImagesOnSheet = (ws: Worksheet): ReadonlyArray<DrawingItem> => {\n if (!ws.drawing) return [];\n return ws.drawing.items.filter((it) => it.content.kind === 'picture');\n};\n\n/**\n * Read-only snapshot of every chart DrawingItem on the sheet. Each item has its\n * anchor + chart reference.\n */\nexport const listChartsOnSheet = (ws: Worksheet): ReadonlyArray<DrawingItem> => {\n if (!ws.drawing) return [];\n return ws.drawing.items.filter((it) => it.content.kind === 'chart');\n};\n\n/**\n * Drop every DrawingItem from the worksheet. Returns the count removed. The\n * `ws.drawing` field itself is left in place (empty) so subsequent `addImageAt`\n * / `addChartAt` calls don't have to re-allocate.\n */\nexport const removeAllDrawingItems = (ws: Worksheet): number => {\n if (!ws.drawing) return 0;\n const n = ws.drawing.items.length;\n ws.drawing.items = [];\n return n;\n};\n\n/**\n * Drop every picture DrawingItem from the worksheet, leaving charts and any\n * other content kinds untouched. Returns the count removed.\n */\nexport const removeAllImages = (ws: Worksheet): number => {\n if (!ws.drawing) return 0;\n const before = ws.drawing.items.length;\n ws.drawing.items = ws.drawing.items.filter((it) => it.content.kind !== 'picture');\n return before - ws.drawing.items.length;\n};\n\n/**\n * Drop every chart DrawingItem from the worksheet, leaving pictures and any\n * other content kinds untouched. Returns the count removed.\n */\nexport const removeAllCharts = (ws: Worksheet): number => {\n if (!ws.drawing) return 0;\n const before = ws.drawing.items.length;\n ws.drawing.items = ws.drawing.items.filter((it) => it.content.kind !== 'chart');\n return before - ws.drawing.items.length;\n};\n"],"mappings":";;;;;;;;;;AAiBA,MAAa,yBAAoE;CAC/E,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;AACP;;AAGA,MAAa,oBAA+D;CAC1E,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;AACP;AAiBA,MAAM,cAAc,OAAmB,KAA4B,SAAS,MAAe;CACzF,IAAI,MAAM,SAAS,SAAS,IAAI,QAAQ,OAAO;CAC/C,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAC9B,IAAI,MAAM,SAA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GAAG,QAAQ,MAAM;CAChC,GAAG,QAAQ,QAAQ,GAAG,QAAQ,MAAM,QAAQ,OAAO,GAAG,QAAQ,SAAS,OAAO;CAC9E,OAAO,SAAS,GAAG,QAAQ,MAAM;AACnC"}
package/dist/drawing.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as makeChartDrawingItem, c as removeAllCharts, f as makeOneCellAnchor, h as loadImage, i as listImagesOnSheet, l as removeAllDrawingItems, n as addImageAt, o as makeDrawing, r as listChartsOnSheet, s as makePictureDrawingItem, t as addChartAt, u as removeAllImages } from "./drawing-BxzLuryn.mjs";
1
+ import { a as makeChartDrawingItem, c as removeAllCharts, f as makeOneCellAnchor, h as loadImage, i as listImagesOnSheet, l as removeAllDrawingItems, n as addImageAt, o as makeDrawing, r as listChartsOnSheet, s as makePictureDrawingItem, t as addChartAt, u as removeAllImages } from "./drawing-ZJ3h4VHD.mjs";
2
2
  import { a as makeSchemeColor, i as makeColor, n as VALUED_COLOR_MOD_KINDS, o as makeSrgbColor, r as VALUELESS_COLOR_MOD_KINDS, t as SCHEME_COLOR_NAMES } from "./colors-ovWAwnZI.mjs";
3
3
  //#region src/drawing/dml/shape-properties.ts
4
4
  const makeShapeProperties = (opts = {}) => ({
@@ -1,3 +1,18 @@
1
+ //#region src/utils/formula-text.ts
2
+ const EQUALS_SIGN_CODE = 61;
3
+ /** True iff `text` is spelled the way a spreadsheet UI shows a formula. */
4
+ function startsWithEquals(text) {
5
+ return text.charCodeAt(0) === EQUALS_SIGN_CODE;
6
+ }
7
+ /**
8
+ * Drop the leading `=` OOXML formula text must not carry, and the whitespace
9
+ * around it: `' =SUM(A1)'` would otherwise keep the `=` in the stored text.
10
+ */
11
+ function normalizeFormulaText(text) {
12
+ const trimmed = text.trim();
13
+ return startsWithEquals(trimmed) ? trimmed.slice(1).trim() : trimmed;
14
+ }
15
+ //#endregion
1
16
  //#region src/utils/inference.ts
2
17
  /** Excel error tokens. Anything outside this set is treated as a string. */
3
18
  const ERROR_CODES = /* @__PURE__ */ new Set([
@@ -30,13 +45,13 @@ function inferCellType(value) {
30
45
  if (typeof value === "number") return "n";
31
46
  if (value instanceof Date) return "d";
32
47
  if (typeof value === "string") {
33
- if (value.length > 0 && value.charCodeAt(0) === 61) return "f";
48
+ if (startsWithEquals(value)) return "f";
34
49
  if (ERROR_CODES.has(value)) return "e";
35
50
  return "s";
36
51
  }
37
52
  return "n";
38
53
  }
39
54
  //#endregion
40
- export { inferCellType as n, ERROR_CODES as t };
55
+ export { startsWithEquals as i, inferCellType as n, normalizeFormulaText as r, ERROR_CODES as t };
41
56
 
42
- //# sourceMappingURL=inference-BrI9uIY4.mjs.map
57
+ //# sourceMappingURL=inference-BMvv9cUY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inference-BMvv9cUY.mjs","names":[],"sources":["../src/utils/formula-text.ts","../src/utils/inference.ts"],"sourcesContent":["// Formula-text normalisation, shared by every path that carries a formula.\n//\n// A spreadsheet UI shows `=SUM(A1:A3)`, but OOXML stores the text without the\n// leading `=` (ECMA-376 §18.3.1.40) in `<f>`, `<formula1>`, `<cfRule>`'s\n// `<formula>` and `<definedName>` alike, and Excel reports a file that carries\n// one as damaged. The `make*` constructors normalise what a caller hands them,\n// and the serialisers normalise again: the model interfaces are public, so a\n// caller can build one as a literal and reach the writer without passing a\n// constructor.\n\nconst EQUALS_SIGN_CODE = 61;\n\n/** True iff `text` is spelled the way a spreadsheet UI shows a formula. */\nexport function startsWithEquals(text: string): boolean {\n return text.charCodeAt(0) === EQUALS_SIGN_CODE;\n}\n\n/**\n * Drop the leading `=` OOXML formula text must not carry, and the whitespace\n * around it: `' =SUM(A1)'` would otherwise keep the `=` in the stored text.\n */\nexport function normalizeFormulaText(text: string): string {\n const trimmed = text.trim();\n return startsWithEquals(trimmed) ? trimmed.slice(1).trim() : trimmed;\n}\n","// Cell-value type inference. Maps a JS runtime value to the OOXML cell\n// `t` attribute value. Mirrors openpyxl's `Cell._bind_value` /\n// `_TYPES` / error-code path in openpyxl/openpyxl/cell/cell.py.\n\nimport { startsWithEquals } from './formula-text.js';\n\n/**\n * OOXML `t` attribute values. Note that 'inlineStr' is treated\n * separately — the writer chooses between 's' (shared string) and\n * 'inlineStr' based on workbook settings, not the value itself.\n */\nexport type CellDataType = 'n' | 's' | 'b' | 'd' | 'f' | 'e';\n\n/** Excel error tokens. Anything outside this set is treated as a string. */\nexport const ERROR_CODES: ReadonlySet<string> = new Set([\n '#NULL!',\n '#DIV/0!',\n '#VALUE!',\n '#REF!',\n '#NAME?',\n '#NUM!',\n '#N/A',\n '#GETTING_DATA',\n]);\n\n/**\n * Infer the cell `t` attribute for a runtime value.\n *\n * - `boolean` → 'b'\n * - `number` → 'n' (incl. integer numerics; date inference is left to\n * the caller because Excel decides on type via the cell's number\n * format, not the raw value)\n * - `Date` → 'd'\n * - string starting with `=` → 'f' (formula)\n * - string in {@link ERROR_CODES} → 'e'\n * - any other string → 's'\n * - `null` / `undefined` → 'n' (empty)\n *\n * Throws nothing — returns 'n' as the no-information fallback.\n */\nexport function inferCellType(value: unknown): CellDataType {\n if (typeof value === 'boolean') return 'b';\n if (typeof value === 'number') return 'n';\n if (value instanceof Date) return 'd';\n if (typeof value === 'string') {\n if (startsWithEquals(value)) return 'f';\n if (ERROR_CODES.has(value)) return 'e';\n return 's';\n }\n return 'n';\n}\n"],"mappings":";AAUA,MAAM,mBAAmB;;AAGzB,SAAgB,iBAAiB,MAAuB;CACtD,OAAO,KAAK,WAAW,CAAC,MAAM;AAChC;;;;;AAMA,SAAgB,qBAAqB,MAAsB;CACzD,MAAM,UAAU,KAAK,KAAK;CAC1B,OAAO,iBAAiB,OAAO,IAAI,QAAQ,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI;AAC/D;;;;ACVA,MAAa,8BAAmC,IAAI,IAAI;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;;;;;;;;AAiBD,SAAgB,cAAc,OAA8B;CAC1D,IAAI,OAAO,UAAU,WAAW,OAAO;CACvC,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,iBAAiB,MAAM,OAAO;CAClC,IAAI,OAAO,UAAU,UAAU;EAC7B,IAAI,iBAAiB,KAAK,GAAG,OAAO;EACpC,IAAI,YAAY,IAAI,KAAK,GAAG,OAAO;EACnC,OAAO;CACT;CACA,OAAO;AACT"}
package/dist/io/save.d.ts CHANGED
@@ -1,8 +1,20 @@
1
1
  import type { XlsxSink } from '../io/sink.js';
2
2
  import { type Workbook } from '../workbook/workbook.js';
3
+ import { type CompressionLevel } from '../zip/writer.js';
3
4
  export interface SaveOptions {
4
- /** Reserved — passes through to the underlying ZIP writer when implemented. */
5
- compressionLevel?: number;
5
+ /**
6
+ * Last-modified timestamp for every ZIP entry. Left unset, fflate stamps the
7
+ * wall clock into each local header and central-directory record, so saving
8
+ * the same workbook twice produces different bytes. Pin it and the output is
9
+ * byte-identical for identical input on any machine, which is what
10
+ * golden-file tests and content-addressed caches need.
11
+ *
12
+ * Recorded as the date's UTC wall time, to ZIP's two-second resolution; the
13
+ * year has to fall in 1980-2099, the range supported by the ZIP backend.
14
+ */
15
+ mtime?: Date;
16
+ /** Deflate level, 0 (no compression) to 9 (smallest). Defaults to fflate's own 6. */
17
+ compressionLevel?: CompressionLevel;
6
18
  }
7
19
  /** Convenience: serialise a Workbook to an in-memory `Uint8Array` xlsx.
8
20
  *
@@ -11,4 +23,4 @@ export interface SaveOptions {
11
23
  */
12
24
  export declare function workbookToBytes(wb: Workbook, opts?: SaveOptions): Promise<Uint8Array>;
13
25
  /** Save a workbook through the given sink. Returns once `finalize()` resolves. */
14
- export declare function saveWorkbook(wb: Workbook, sink: XlsxSink, _opts?: SaveOptions): Promise<void>;
26
+ export declare function saveWorkbook(wb: Workbook, sink: XlsxSink, opts?: SaveOptions): Promise<void>;
package/dist/io.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as OpenXmlIoError } from "./exceptions-D-CFwxgm.mjs";
2
- import { t as loadWorkbook } from "./load-Bghb1YHY.mjs";
3
- import { n as workbookToBytes, t as saveWorkbook } from "./save-Bqcf8w3g.mjs";
2
+ import { t as loadWorkbook } from "./load-CJdGh50R.mjs";
3
+ import { n as workbookToBytes, t as saveWorkbook } from "./save-CjarR7Rp.mjs";
4
4
  //#region src/io/browser.ts
5
5
  /**
6
6
  * Wrap a Blob (or File, since File extends Blob) as an XlsxSource. The
@@ -1,13 +1,13 @@
1
1
  import { o as OpenXmlSchemaError } from "./exceptions-D-CFwxgm.mjs";
2
- import { h as loadImage } from "./drawing-BxzLuryn.mjs";
2
+ import { h as loadImage } from "./drawing-ZJ3h4VHD.mjs";
3
3
  import { At as parseQName, a as findChildren, c as ARC_CONTENT_TYPES, f as ARC_ROOT_RELS, ft as SHEET_MAIN_NS, g as ARC_WORKBOOK, h as ARC_THEME, i as findChild, jt as qname, l as ARC_CORE, lt as REL_NS, m as ARC_STYLE, p as ARC_SHARED_STRINGS, q as MARKUP_COMPAT_NS, s as ARC_APP, u as ARC_CUSTOM } from "./tree-BX-sRRVp.mjs";
4
- import { D as findUserShapesRId, O as parseChartXml, T as parseChartExXml, _ as parseChartsheetXml, a as parseCommentsXml, b as parseWorksheetXml, c as NumberFormatSchema, d as BorderSchema, f as AlignmentSchema, h as parseDrawingXml, l as FontSchema, n as parseTableXml, p as collectRawRelIds, s as ProtectionSchema, u as fillFromTree, w as isChartExBytes, x as parseUserShapesXml } from "./stylesheet-writer-HxaX7bGy.mjs";
4
+ import { D as findUserShapesRId, O as parseChartXml, T as parseChartExXml, _ as parseChartsheetXml, a as parseCommentsXml, b as parseWorksheetXml, c as NumberFormatSchema, d as BorderSchema, f as AlignmentSchema, h as parseDrawingXml, l as FontSchema, n as parseTableXml, p as collectRawRelIds, s as ProtectionSchema, u as fillFromTree, w as isChartExBytes, x as parseUserShapesXml } from "./stylesheet-writer-D7Uug85X.mjs";
5
5
  import { n as parseXmlDocument, t as parseXml } from "./parser-By6RWZVW.mjs";
6
6
  import { t as fromTree } from "./serialize-BC2Wu3bR.mjs";
7
7
  import { B as corePropsFromBytes, Q as findById, _ as customPropsFromBytes, c as extendedPropsFromBytes, et as indexRelsById, nt as relsFromBytes, o as manifestFromBytes, tt as makeRelationships } from "./manifest-pLmx7KYh.mjs";
8
- import { Zt as stableStringify, ft as makeStylesheet } from "./cell-style-DuvS_Lsg.mjs";
9
- import { k as parseSharedStringsXml, r as createWorkbook } from "./workbook-BlZVXiyG.mjs";
10
- import { a as makeDefinedName } from "./defined-names-CviWmtQg.mjs";
8
+ import { en as stableStringify, ht as makeStylesheet } from "./cell-style-BFmJOmcx.mjs";
9
+ import { k as parseSharedStringsXml, r as createWorkbook } from "./workbook-B15-T4cs.mjs";
10
+ import { a as makeDefinedName } from "./defined-names-Ctu3F6ls.mjs";
11
11
  import { t as openZip } from "./reader-BNaUTVCy.mjs";
12
12
  //#region src/styles/stylesheet-reader.ts
13
13
  const STYLESHEET_TAG = qname(SHEET_MAIN_NS, "styleSheet");
@@ -1169,4 +1169,4 @@ function capturePassthrough(archive, manifest, wb, roots, vml) {
1169
1169
  //#endregion
1170
1170
  export { parseStylesheetXml as i, parseDate1904 as n, resolveRelTarget as r, loadWorkbook as t };
1171
1171
 
1172
- //# sourceMappingURL=load-Bghb1YHY.mjs.map
1172
+ //# sourceMappingURL=load-CJdGh50R.mjs.map