544 Commits
Author SHA1 Message Date
Dolan 8fed97ef52 chore: Version bump to 9.16.2 (#3950) 2026-11-29 00:27:01 +08:00
DolanandClaude Opus 5.5 c693e08796 chore: Version bump to 9.16.1 (#3943)
Claude-Session: https://claude.ai/code/session_01QzDw6XmyL15QG62FS8rSGv

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 22:18:33 +08:00
DolanandClaude Opus 5.5 4da55df933 build(deps-dev): bump typescript-eslint packages from 8.72.2 to 8.74.0 (#3939)
* build(deps-dev): bump typescript-eslint packages from 8.72.2 to 8.74.0

Bumps typescript-eslint, @typescript-eslint/parser and
@typescript-eslint/eslint-plugin together. Each release peers on the other
two at the same version, so the separate Dependabot PRs (#3923, #3924,
#3925) each failed npm ci.

* build: resolve typescript-eslint's optional @typescript/native peer to our own

typescript-eslint 8.73 and later have an optional peer on
@typescript/native >=7.1.0-dev, which our TypeScript 7.0.2 alias doesn't
satisfy. npm 11 lets that through, but npm 10 (Node 20 and 22, and the
ubuntu-24.04 runner of the shape demos job) wants that day's 7.1 dev build
and fails npm ci as the lockfile doesn't have it. The override points the
peer at the @typescript/native we already install, which typescript-eslint
doesn't use while TypeScript 6 is "typescript".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 16:07:57 +08:00
dependabot[bot]andClaude Opus 5.5 8a10b95f07 build(deps-dev): bump eslint-plugin-unicorn from 79.0.0 to 80.0.0 (#3921)
* build(deps-dev): bump eslint-plugin-unicorn from 79.0.0 to 80.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 79.0.0 to 80.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v79.0.0...v80.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 80.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* style: write CheckBoxSymbolElement's attributes with a ternary for unicorn 80

eslint-plugin-unicorn 80 reports the if/else as unicorn/prefer-ternary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 16:07:53 +08:00
Dolan f227ee1b1d chore: Version bump to 9.16.0 (#3919) 2026-11-19 04:18:10 +00:00
Dolan dc8bd21a0c chore: Version bump to 9.15.4 (#3905) 2026-11-14 02:18:56 +00:00
dependabot[bot] ea1ff9db46 build(deps-dev): bump jsdom from 30.1.3 to 31.0.0 (#3893)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 30.1.3 to 31.0.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Commits](https://github.com/jsdom/jsdom/compare/v30.1.3...v31.0.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-version: 31.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-14 00:31:10 +00:00
DolanandClaude Opus 5.5 ebd29699d5 chore: Version bump to 9.15.3 (#3891)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 23:07:42 +00:00
Dolan aa47895fe8 chore: Version bump to 9.15.2 (#3883) 2026-11-03 15:45:20 +00:00
dependabot[bot] 5639a7fff2 build(deps-dev): bump glob from 13.0.6 to 14.0.3 (#3878)
Bumps [glob](https://github.com/isaacs/node-glob) from 13.0.6 to 14.0.3.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v13.0.6...v14.0.3)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 14.0.3
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-03 14:48:25 +00:00
DolanandClaude Opus 5.5 11c85a281c chore: Version bump to 9.15.1 (#3875)
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 15:09:32 +00:00
dependabot[bot] 4eafe77be3 build(deps-dev): bump eslint-plugin-unicorn from 78.0.0 to 79.0.0 (#3849) 2026-10-27 11:51:51 +00:00
DolanandClaude Opus 5.5 67dab3d525 chore: Version bump to 9.15.0 (#3846)
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 20:32:34 +00:00
DolanandClaude Opus 5.5 2e07d2d688 perf: make the browser bundle 29 KB smaller, zipping with fflate and hashing with docx's own SHA-1 and SHA-256 (#3834) (#3836)
* build(deps): add fflate, to zip and unzip packages in place of JSZip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* perf: hash with docx's own SHA-1 and SHA-256, in place of hash.js

hash.js was about 6.5 KB of a browser bundle, minified and gzipped, as its whole library is bundled for the two hashes
docx uses: SHA-1 for the names of media files (`hashedId`) and SHA-256 for the password that protects a document. It
hasn't had a release since 2018, and brought `inherits` and `minimalistic-assert` with it. The platforms' own hashes
can't replace it, as browsers only hash asynchronously and documents are written synchronously.

The hashes are the same: they match FIPS 180-4's examples and node:crypto, and the password hash Word accepts is
unchanged. They are also faster: hashing a 5 MB image takes about half the time, and a password's 100,000 rounds about
130 ms rather than 155 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* perf: zip and unzip with fflate, in place of JSZip

JSZip was about 30 KB of a browser bundle, minified and gzipped, as its prebuilt browser file brings its own copy of
pako and more. fflate's zipSync and unzipSync, the only parts docx needs, are about 6 KB. Together with the hashes, the
bundle of a page that packs a document goes from 123 KB to 94 KB.

Nothing changes for users:
- Packer and patchDocument give each output type as JSZip gave it, including "string" and "binarystring" as a
  character for each byte, a Blob with the .docx or .docm MIME type, and the same errors for "nodebuffer" without
  Buffer, a Blob without Blob, and "text", which JSZip never gave.
- patchDocument and patchDetector still take a JSZip instance, which is read through its generateAsync, so the types
  no longer import jszip. They also still take the other forms JSZip read: a string with a character for each byte, an
  array of bytes, a Blob, an ArrayBuffer and bytes from another realm.
- A part's text keeps a byte order mark at its start, as it did.
- Packer.toStream still compiles synchronously, so it throws as before, and gives the document a turn of the event
  loop later.

Zipping is now synchronous, and faster: packing a document with 5,000 paragraphs and 5 MB of images takes 83 ms
rather than 182 ms.

The zip files no longer have folder entries, which JSZip added for each folder. Word doesn't write them, and nothing
reads them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test: test the packer and the patcher's zip reading without JSZip

These specs mocked JSZip or read the JSZip instance the compiler returned. They now build real zip files and read
what the Packer and the patcher give, so they test the zipping too:
- loadZip reads every form a template can be given in, a JSZip instance through its generateAsync, and leaves out
  folders
- Packer.toStream throws when the document can't be written, and gives it even to a listener added after an await
- toBlob, toArrayBuffer and toStream give real zip files, rather than what a mocked compiler gave

The counts of the files in a package no longer include the folder entries JSZip added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test: test zipping, unzipping and each output type of a zip file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* chore: read and write .docx files in the scripts with fflate, in place of JSZip

docx is replacing JSZip with fflate (#3834), and jszip is leaving package.json, so the scripts that read documents
(compare-layout.ts, the layout probes' line checkers) and the probes that edit docx's output before writing it use
fflate's unzipSync and zipSync. They leave out folder entries when they unzip, as Word's own files have none, and zip
at level 6. The written documents have the same files in the same order, with the same contents, as before.

check-api.ts's comment no longer says the built declarations import jszip. Those of releases up to 9.14.0 still do,
and the import, which no longer resolves, is any there, which the check accepts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* fix: load Node's types from docx's declarations, which JSZip's used to load

The declarations use Node's types, such as Buffer and NodeJS.ReadableStream. They had them because they imported
JSZip's declarations, which reference Node's types. Without JSZip, a project that doesn't load every @types package,
such as one with `types` set, or TypeScript 6's default, would find no Buffer in docx's types, and docx's own optional
entries didn't build. The reference is kept in the built declarations with `preserve="true"`, as TypeScript otherwise
leaves it out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test: read and make zip files with fflate in the specs of charts, embedded files, macros, shapes and the core, in place of JSZip

jszip is leaving docx's dependencies, so these specs read packed documents and make changed templates with the helpers
in tests/zip, which unzip and zip with fflate, as docx now does. Each test checks what it checked before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test: read and make zip files with fflate in the specs of docx/html, docx/layout and the patcher, in place of JSZip

jszip is leaving docx's dependencies, as docx now zips and unzips with fflate, so these specs read packed documents
and make templates with the helpers in src/tests/zip.ts. Templates that were JSZip instances are now zip files' bytes,
and the specs read text and bytes from the unzipped files directly, so some helpers that only awaited JSZip are no
longer asynchronous.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test: patch real zip files in patchDocument's spec, rather than mocking JSZip

JSZip is leaving the dependencies. The spec mocked JSZip.loadAsync and passed an empty Buffer as the template, so
patchDocument never unzipped anything. Each template is now a real zip file, made with the specs' zip helper, so the
tests exercise the unzipping too. The tests of a template opened with JSZip pass an object with generateAsync, which
is how a JSZip instance is read now.

The path keys of the templates are covered by one file-level naming-convention exception, in place of the comments on
each patch key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* build(deps): remove jszip, as nothing uses it now

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* fix: refuse a zip file's entry of the wrong size before taking memory for it, and inflate only what patchDetector reads

fflate takes room for the size a zip file gives an entry before inflating it, so a template of a few hundred bytes
could make docx take 4 GB, which fails in a browser or a process with a memory limit. JSZip refused such an entry
("uncompressed data size mismatch"). An entry whose given size is more than DEFLATE can inflate its data to (1032
times) is now refused before fflate takes the room, and one that inflates to less than its given size after.

JSZip also inflated only the entries that were read, so patchDetector, which reads only the XML parts in word/, never
inflated a template's images or embedded files. unzipFiles and loadZip now take the paths to read, and patchDetector
gives them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* fix: refuse a zip file whose entries claim more compressed data than the zip file holds, before taking memory for them

The size an entry inflates to was checked against its compressed size, but that is also read from the zip file, so an
entry could claim compressed data larger than the zip file and pass. The entries docx reads now have their compressed
sizes added up, and a total larger than the zip file is refused before fflate takes room for the entry. Together with
DEFLATE's ratio, that keeps the room taken to 1032 times the zip file's size, as a real zip bomb's is.

The tests damage the entry's data too, so only a refusal before inflating gives their error: without either check, each
fails with fflate's own error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 00:08:58 +01:00
Dolan MiuandClaude Opus 5.5 07286f3bee chore: Version bump to 9.14.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c
2026-10-23 04:15:59 +01:00
DolanandClaude Opus 5.5 b87383272d feat: cite sources and list them in a bibliography, in each of Word's styles, from docx/bibliography (#557) (#3814)
* feat(bibliography): the sources part, the styles' framework, and Word's output to test against

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): citations and bibliographies, written as Word's content controls and fields

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test(bibliography): keep the empty paragraphs in corpus s's bibliographies of GB7714 and ISO 690

The fixtures' generator left out the paragraphs of corpus s's bibliographies that have
no text, though Word's styles write them: GB7714 and ISO 690 write an entry for a source
with no author, title or other field as an empty paragraph, which Word keeps. Corpora a
to d, Word's own output, keep empty paragraphs between entries too. Each of these
fixtures gets back its 15 empty paragraphs, from the oracle, with the others as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in GB7714, as Word does

GB.XSL and ISO690.XSL share nearly every template, so the shared ones go
in one family module, iso-690-family.ts, with the few that differ chosen by
the variant: GB7714 cites a source with no author or year by its tag, and
the two styles put the space after a website's or a report's production
company by different fields.

The module also reads the styles' HTML as Word's import does: spaces
collapse, a space falls between two elements and at the end of a copied
variable before the end of a paragraph, and a copied element with nothing
in it leaves its formatting on for the rest of the bibliography.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in ISO 690 by first element and date, as Word does

ISO690.XSL is GB.XSL's twin, so the style is the ISO 690 variant of the
family module: a source with a title but no author or year is cited by
nothing, "()", where GB7714 cites it by its tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in ISO 690 by numerical reference, as Word does

ISO690Nmerical.XSL cites a source by its number, with the pages or volume
cited after it, such as "(1 p. 5)", and lists the sources in the order the
document cites them. Its entries are the ISO 690 family's, with the main
contributors after the start of a journal article or conference paper.

The style copies each entry from a variable, so Word reads an entry whose
bold has nothing in it, such as one with no author, as bold that stays on
for the rest of the bibliography. An empty xsl:value-of in an element ends
it as usual, so a miscellaneous source with no publication doesn't leave
italics on, as Word's own bibliography of such a source shows; libxslt's
output differs from Word's there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* chore(bibliography): spell the styles' names and Word's abbreviations

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test(bibliography): keep the empty entries of corpus s in the GOST and SIST02 fixtures

Word writes an empty paragraph for a source whose entry is empty in a style,
such as a miscellaneous source with no fields in GOST, as Word's style writes an
empty <p> for it. gen-fixtures.mjs dropped every empty paragraph of corpus s, so
the fixtures had fewer entries than the bibliography. They're rewritten from the
oracle with them, and gen-fixtures.mjs needs the same change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in GOST, as Word does

Ports Word's GOST - Name Sort (GostName.XSL) and GOST - Title Sort
(GostTitle.XSL). They share everything but how an entry starts, how the
bibliography is sorted, and a few templates, so both are written from one module,
gost-family.ts: Name Sort starts an entry with its authors in bold and leaves the
people who are those authors out of the rest; Title Sort starts it with its title
in bold, sorts by title, then the main author's names, counts an organization as a
book section's author, and writes an interview's responsibilities only when one
of the first three isn't empty.

The ports follow the templates where they do what they don't look like they do:
_MaxAuthor is read without a $, so every author is listed up to three; a role is
written only when one of its people has a last name; a location with neither a
city nor a publisher is the source's distributor; and an entry of nothing but
spaces is left empty, with no dot.

Their output matches Word's for corpora a to d and the oracle's for corpus s, and
the oracle's for 8 seeds of 300 random sources each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test(bibliography): end SIST02's corpus s entries without a space, as Word does

Word's SIST02 style, run with libxslt, ends an entry that ends with a bold or
italic element with a line break, which the oracle reads as a space. Word for
Mac shows none: corpus b has "<b>MoraLuz</b> <i>Bread.</i>" and
"<i>Untitled Notes.</i>", with nothing after them. Corpus s's expected
bibliography is regenerated with the oracle reading no space at the end of a
SIST02 paragraph, which changes 14 entries such as "<b>—.</b> ".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in SIST02, as Word does

Word's SIST02 style (SIST02.XSL), with its own full-width punctuation and
empty spaces, its name patterns, and Word's reading of its HTML: a space
between two bold or italic elements that follow each other, even an empty
one, and none at the end of an entry. Its quirks are kept, such as "ed."
after any number of editors, "Vol. 5..", "[Cited: ]" for a date accessed
with only a day, and "—." for an article whose title is the one before's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test(bibliography): keep the empty paragraphs of corpus s's APA bibliography

Word's APA style writes a paragraph for each source, empty for a source it
has nothing to write for, such as a case with no title, number, court or date.
The fixtures' generator left out empty paragraphs, so corpus s's expected
bibliography was two entries short of what the style writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in APA, as Word does

Word's APASixthEditionOfficeOnline.xsl, written in TypeScript: citations such
as "(Baker, 2010)", with the title when another source has the same first
author and initials when another first author has the same last name, and
the bibliography sorted by author, with a hanging indent.

It follows the XSL, including its quirks: the editors of a conference's
proceedings are always "Ed.", a work of art's date has no space after it
without an artist, and Word reads a space after an entry that ends in
italics, where MSXML writes a line break at the end of the copy of the
entry. Its citations and bibliographies are Word's for every source of the
four corpora Word wrote, and Word's XSL's for corpus s and for random sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in Harvard - Anglia, as Word does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in Chicago, as Word does

Ported from Word's CHICAGO.XSL, template by template, including its quirks:
a space after an entry that ends with a title in italics, as Word's XSLT
writes a line break there, "eds." left out after a list of editors, as
Word's English has none, and no space before "Edited by" after the title
of an interview. Tested against Word's own output for the probes' corpora,
and against Word's XSL for the synthetic corpus and the branches neither
reaches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test(bibliography): keep the empty paragraph Turabian writes for an artwork with nothing to write

Corpus s's fixture left out the paragraph Word writes for an artwork with no artist, title, institution, city or
publication title, which Turabian writes as an empty paragraph.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in Turabian, as Word does

Turabian's citations are Chicago's, and it finds a source's authors and sorts its bibliography as Chicago does, so
it shares those with Chicago, from chicago-family.ts. Its entries end with where and when the source was published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in IEEE, as Word does

Written from Word's IEEE2006OfficeOnline.xsl: citations such as "[1, p. 50]", and a
bibliography that is a table of each source's number and entry, in the order the sources are
cited. Its people are written with the style's own templates for initials, and some of its
words are English written into the style, such as "Available:".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* test(bibliography): keep the empty paragraph MLA writes for an artwork with nothing to write

Corpus s's MLA fixture left out the empty paragraph Word writes for the work of art with none of its fields, as its generator dropped empty paragraphs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): write citations and bibliographies in MLA, as Word does

MLA, seventh edition, written from Word's MLASeventhEditionOfficeOnline.xsl: citations such as "(Baker 50)", with the title when the authors don't tell a source apart, and a bibliography sorted by the people each source is named by, with "—" for the same people as the entry before.

It writes what Word's style writes, including where that isn't what MLA asks for: editors named first with no "eds." after several of them, an organization as a performer with no "Perf." before it, an interview's title without its italics when its interviewer follows, no space between a sound recording's album and its producer when it has neither composers nor a title, and a space after an entry that ends with italics, as Word reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* fix(bibliography): name the style as Word for Mac finds it, and write bibliographies' paragraphs as Word does

Word for Mac only finds a style named with a slash before its file, and opens a document with
a backslash in APA. A bibliography of no sources is Word's bold "Invalid source specified.",
and IEEE's table has an empty paragraph after it, as Word writes them when it updates the
fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* feat(bibliography): docx/bibliography, with sources, citations and bibliographies in each of Word's styles (#557)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* fix(bibliography): reject a style named after a property every object has

createBibliography looked the style up in an ordinary object, so a name such as "toString" or "__proto__" found an inherited value, got past the check and failed later, when the document was packed. It now checks the style is one of the definitions' own keys, and throws the documented error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

* fix(bibliography): throw for a source whose type isn't one of SourceType's

A source with an unknown type, such as Word's own name "InternetSite" for SourceType.WEBSITE, was kept with no type and failed later in a style, with a TypeError. wordSourceOf now throws when the source is given, saying which source and type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:49:43 +01:00
Dolan 1bfacd5c83 fix: declare that docx needs Node.js 16 or later (#3807) 2026-10-20 14:33:39 +01:00
Dolan 437d455034 feat: embed files in a document as OLE objects, from docx/embedded-files (#719) (#3802) 2026-10-20 12:49:44 +01:00
Dolan MiuandClaude Opus 5.5 c98bc7351b chore: Version bump to 9.13.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c
2026-10-19 23:54:18 +01:00
DolanandClaude Opus 5.5 ea08b9677c feat: write macro-enabled documents with VBA macros, from docx/macros (#471) (#3791)
* feat: write macro-enabled documents with VBA macros, from docx/macros (#471)

A document's macros, the macros option, make it a macro-enabled
document (.docm): its main part has the macro-enabled content type, it
has the VBA project, word/vbaProject.bin, and Packer gives it a .docm's
MIME type. The events of the document the macros handle, such as
Document_Open, are listed in word/vbaData.xml, as Word only runs the
handlers of the events listed there.

createMacros, in a new entry, docx/macros, writes the macros from VBA
code: ThisDocument's, modules and class modules. It writes the VBA
project as [MS-OVBA] describes, in a compound file ([MS-CFB]), without
a compiled cache, so Word compiles the code when it first runs it, and
lists the events ThisDocument has handlers for. A vbaProject.bin from a
.docm Word saved goes in macros too, with the events it handles.

Checked in Word for Mac 16.114: Document_Open runs when the document
opens, and so do macros in modules that use class modules and Office's
library. LibreOffice imports the modules, and the Open XML SDK validator
passes the demos for each version of Office since 2010. The demos
workflow now validates a .docm as it does a .docx.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix: give a character beyond U+FFFF as two ChrW in createMacros' error

createMacros' error for a character Windows-1252 doesn't have said to
write it with ChrW and its code point, such as ChrW(&H1F600) for an
emoji. ChrW only takes a UTF-16 code unit, up to &HFFFF, so that fails
in Word. The error now gives one ChrW for each code unit: the surrogate
pair, ChrW(&HD83D) & ChrW(&HDE00), which Word for Mac turns into the
emoji. The docs say so too.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* docs: say how to run the macros of a .docm downloaded in Word for Windows

The macros docs said Word asks whether to enable a .docm's macros when
it opens. Word for Windows doesn't for a file from the internet, such
as a .docm a web page made with docx and the browser downloaded: it
blocks its macros without an Enable Content button. The docs now say to
unblock the file in its Properties, that an organization's policy can
still block macros, and that Word for Mac isn't affected.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 00:13:28 +01:00
Dolan 7907016816 fix: read and write XML without xml and xml-js, which are no longer maintained (#3779) 2026-10-17 09:44:22 +01:00
Dolan MiuandClaude Opus 5.5 35496dfb15 chore: Version bump to 9.12.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:50:39 +01:00
937869645c build(deps-dev): bump eslint-plugin-unicorn from 77.0.0 to 78.0.0 (#3771)
* build(deps-dev): bump eslint-plugin-unicorn from 77.0.0 to 78.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 77.0.0 to 78.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v77.0.0...v78.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 78.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* style: Write the if-then-return branches unicorn 78 flags as ternaries

eslint-plugin-unicorn 78 widens prefer-ternary to an if that returns
followed by a return, which it reports in six places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:32:01 +01:00
Dolan b4ea918c5c chore: Version bump to 9.11.0 (#3758) 2026-10-13 15:49:29 +01:00
Dolan a61c85d64e feat: docx/html, HTML as a document's content (#2632) (#3752) 2026-10-13 14:53:26 +01:00
Dolan MiuandClaude Opus 5.5 c9be7acae6 chore: Version bump to 9.10.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 13:48:07 +01:00
003f348248 build(deps-dev): bump typescript from 5.9.3 to 7.0.2 (#3566)
* build(deps-dev): bump typescript from 5.9.3 to 7.0.2

Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 7.0.2.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.9.3...v7.0.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 7.0.2
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* build: build with TypeScript 7, keeping TypeScript 6 for tools

TypeScript 7 has no JavaScript API yet, which typescript-eslint, typedoc,
vite-plugin-dts and our build scripts all import. Following the
TypeScript team's setup, "typescript" is now @typescript/typescript6 for
those tools, and TypeScript 7 is installed as @typescript/native, which
provides tsc.

- tsconfig: TypeScript 7 removed baseUrl, so the paths are relative to
  the tsconfig instead, with tests/* added for the specs that imported
  through baseUrl
- vite.config: API Extractor uses its own TypeScript's lib files, as the
  entries build already does. Pointed at TypeScript 6's, it can't follow
  Readonly

The built package is byte-identical to master's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 12:17:47 +01:00
dependabot[bot] dac09364ce build(deps-dev): bump pixelmatch from 7.2.0 to 8.0.0 (#3743)
Bumps [pixelmatch](https://github.com/mapbox/pixelmatch) from 7.2.0 to 8.0.0.
- [Release notes](https://github.com/mapbox/pixelmatch/releases)
- [Commits](https://github.com/mapbox/pixelmatch/compare/v7.2.0...v8.0.0)

---
updated-dependencies:
- dependency-name: pixelmatch
  dependency-version: 8.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-09 19:01:14 +01:00
Dolan Miu 66901347b8 chore: Version bump to 9.9.0 2026-10-07 01:11:36 +01:00
dependabot[bot] a7594748ee build(deps-dev): bump eslint-plugin-unicorn from 76.0.0 to 77.0.0 (#3721)
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 76.0.0 to 77.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v76.0.0...v77.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 77.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-07 00:29:01 +01:00
dependabot[bot] e9b879acd9 build(deps-dev): bump eslint-plugin-jsdoc from 64.5.4 to 65.0.0 (#3642) 2026-10-02 16:27:35 +01:00
Dolan 0307c6556d feat: docx/layout, which writes the page numbers of tables of contents and page references (#3591) 2026-09-30 10:46:29 +01:00
DolanandClaude Opus 5.5 0e8ff7a731 chore: Version bump to 9.8.1 (#3572)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:45:54 +01:00
DolanandClaude Opus 5.5 d152b80ee7 chore: remove @types/inquirer, since inquirer ships its own types (#3569)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:17:24 +01:00
dependabot[bot] a56f38383e build(deps-dev): bump eslint-plugin-functional from 9.0.5 to 10.0.1 (#3562)
Bumps [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional) from 9.0.5 to 10.0.1.
- [Release notes](https://github.com/eslint-functional/eslint-plugin-functional/releases)
- [Changelog](https://github.com/eslint-functional/eslint-plugin-functional/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-functional/eslint-plugin-functional/compare/v9.0.5...v10.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-functional
  dependency-version: 10.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-28 13:01:19 +01:00
DolanandClaude Opus 5.5 c169dd1a83 feat: live examples in the docs, which run, draw the document next to the code, and can be edited and downloaded (#3556)
* feat: live examples in the docs, which run, draw the document next to the code, and can be edited and downloaded

The docs' code examples were plain snippets, often fragments that couldn't run. A code block marked ```ts live is now
an example readers can see and change: the page runs it with docx, draws the document it makes next to the code with
docx-preview, and offers the .docx to download. Clicking the code opens an editor (Monaco) that knows docx's types,
the pages are drawn again as the code changes, and View closes the editor. Split, Code and Preview show the code and
the pages side by side, or one of them. The demos a page includes are live too.

Every example in the docs that builds or patches a document is now live: 443 of them, each a whole file with its
imports, so it runs as written. Code about other things, such as installing, bundlers or servers, stays plain.

Running them showed docs that were wrong, fixed here:
- Landscape: docx swaps a landscape page's width and height itself, so the docs' swapped sizes made a tall page
  marked as landscape
- Comments: `comments.children` takes plain objects, not `new Comment(...)`
- Custom properties are text only
- APIs that no longer exist: MathText, Row, `.then` on Packer.toStream, patchDocument(buffer, ...),
  createParagraph().heading1(), a border's `value`, TextRun's `.break()`
- The templates and patcher examples read files that aren't in the repository. They now patch the templates in
  demo/assets, or make their own

`npm run build.docs` copies docx's browser builds into docs/live-examples/lib, so the docs use the docx they
describe, and the Pages workflow runs it. The folder is gitignored, and cspell and ESLint skip it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* docs: the bullet examples draw a bullet, and the patcher's usage writes the patched document

"ὠ" is U+1F60, a Greek omega, since \u takes four hex digits, so the two live bullet examples on
the numbering page drew it as each item's bullet. They use "•" now. The patcher's usage example
now awaits patchDocument and writes the document it makes, as the example after it does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 13:00:29 +01:00
DolanandClaude Opus 5.5 fa24a5eda4 chore: Version bump (#3555)
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 23:16:32 +01:00
Dolan 7ada74f6d1 feat: docx/math, with matrices, cases, equations lined up with numbers, and brackets of any characters (#3553) 2026-09-27 17:30:38 +01:00
Dolan 6207d0067f feat: native Word charts in docx/charts (#3545) 2026-09-26 10:15:50 +01:00
f96066bd7e build(deps-dev): bump eslint-plugin-unicorn from 64.0.0 to 76.0.0 (#3526)
* build(deps-dev): bump eslint-plugin-unicorn from 64.0.0 to 76.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 64.0.0 to 76.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v64.0.0...v76.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 76.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* style: use ternaries where eslint-plugin-unicorn 76 prefer-ternary asks for them

The newer prefer-ternary rule also flags an early `if` return followed by a
final return. Rewrite those spots as ternaries and drop a disable directive
the rule no longer needs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 00:27:10 +01:00
DolanandClaude Opus 5.5 2a1cc45dcb fix: make every demo's document valid, and check them all with the Open XML SDK validator (#3543)
* fix(demos): give each image its type, and each revision in demo 98 an id of its own

ImageRun's type is required, but 11 demos left it out. The image was then written as <hash>.undefined, which isn't in
the package's content types, so Word can't open it and the Open XML SDK validator stops there. The demos now give the
type of the file or base64 data they read, as demos 5 and 114 do.

Demo 98 gave the same revision id to each mark of one change, such as every cell of an inserted row. Word needs each
w:ins, w:del, w:cellIns, w:cellDel and property change to have an id of its own, so they are now numbered in order.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(shapes): write a custom dash or gap of 0 as the smallest length Office accepts

A custom dash of length 0 with round caps draws dots, as demo 111 does. ISO allows a:ds d="0", but Office's schema
wants d and sp to be at least 1, so the Open XML SDK validator rejected it. A dash or gap of 0 is now written as 1,
a thousandth of a percent of the line width.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(numbering): write a level's alignment as left, center or right

Office's schema only allows left, center and right in w:lvlJc, where a paragraph's w:jc takes every AlignmentType.
Levels default to AlignmentType.START, so every numbering part failed the Open XML SDK validator.

A level's alignment is now written as Office allows: START and the justified alignments as left, END as right.
The alignment option's type is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(numbering): write a level's children in the schema's order

A level wrote w:suff before w:isLgl, and w:pStyle after w:lvlJc. CT_Lvl puts w:pStyle after w:numFmt, and w:isLgl
before w:suff, so a level with a paragraph style, or with legal numbering and a suffix, didn't match the schema.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(demos): write demo 19's base64 string as the document it encodes

Demo 19 wrote the base64 text itself to My Document.docx, which isn't a document, so Word can't open the file and it
can't be checked. It now decodes the string before writing it, which also shows that the string is the whole document.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix: write paragraph borders in the schema's order

Paragraph borders were written top, bottom, left, right, where CT_PBdr wants
top, left, bottom, right, between. Word files with left or right paragraph
borders didn't match the schema, which the Open XML SDK reports as an
unexpected element.

Table, cell and page borders were already in their schemas' order.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix: stop writing w:highlightCs, which is in no schema

Every highlight was written twice: as w:highlight and as w:highlightCs. There
is no w:highlightCs in WordprocessingML, so documents with highlighted text
didn't match the schema, and the Open XML SDK reports it as an invalid element
in the run properties. w:highlight already highlights all of a run's text,
complex script included.

highlightComplexScript is kept, deprecated, and has no effect.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix: write tab stop positions as whole twips

A tab stop's position was written as given, so one worked out as a fraction,
such as TabStopPosition.MAX / 4 * 3 (6769.5), was written as a decimal. w:pos
is ST_SignedTwipsMeasure, a whole number of twips, so the document didn't
match the schema. Positions are now rounded down, as indents already are.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix: write shading without a pattern as clear shading

w:shd's w:val is required, but shading given only a fill or a color, with no
type, was written without it. The document didn't match the schema, and the
Open XML SDK reports a missing required attribute. Shading with no type is now
written with w:val="clear", the fill color only, which is what Word writes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(fonts): write an embedded font's key in upper case

w:fontKey is an ST_Guid, whose pattern only allows upper-case hex digits, but the key docx generates is lower case,
so the Open XML SDK validator rejected the font table of every document with an embedded font. The key is now written
in upper case. The font is obfuscated with the same bytes either way, since the obfuscation reads the hex digits in
either case.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(textbox): stop writing insetmode on a VML text box

A VML text box was written with insetmode="auto", without the o: prefix it needs. With the prefix, the Open XML SDK
validator still rejects it, as Office only takes o:insetmode on the shape. It's no longer written: its default, custom,
uses the inset attribute, which defaults to Word's usual margins when it's left out, as it always is for a text box.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(patcher): put merged run properties in the schema's order

With keepOriginalStyles, a patched run that has run properties of its own takes the placeholder's too. They were
written with the placeholder's first and the run's after, so a run with a font whose placeholder had a size got w:sz
before w:rFonts. ISO 29500 allows any order, but Office's schema doesn't, and the Open XML SDK validator rejected
demo 89. The merged properties are now put in Office's order: CT_RPr's elements, then Word 2010's text effects and
OpenType features, then any it doesn't know, then w:rPrChange.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(styles): write each style id once, and the document defaults first

Two styles could share an id, which a styles part doesn't allow:

- with externalStyles, docx's default styles were written in front of the external ones, so a style such as Heading1
  was there twice, as were w:docDefaults. The external w:docDefaults and w:latentStyles also came after docx's styles,
  where CT_Styles wants them first;
- a paragraph or character style with a default style's id, such as Heading2, was written after the default one
  instead of replacing it.

Styles now writes the document defaults, then the latent styles, then the styles, and a style replaces an earlier one
with its id. So external styles take the place of docx's default styles, docx's fill in the ones they leave out, and
paragraph and character styles take the place of the default ones.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(settings): write the settings in the schema's order

w:evenAndOddHeaders and w:updateFields were written before w:defaultTabStop and the hyphenation settings, and
w:hyphenationZone before w:consecutiveHyphenLimit, where CT_Settings wants them after. Word's validator rejected
settings.xml whenever a default tab stop or hyphenation was set, as in demo 75.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(settings): write the compatibility mode last in w:compat

w:compatSetting was written first in w:compat, where CT_Compat puts it after every other element, so a document with
any compatibility option, as in demo 76, didn't match the schema.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(sections): write a section's previous properties after the document grid

w:sectPrChange was written before w:docGrid, where CT_SectPr puts it after every other element, so a section with a
tracked change, as in demo 98, didn't match the schema.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(tables): write a floating table's overlap beside w:tblpPr

The float option's overlap was written as w:tblOverlap inside w:tblpPr, which CT_TblPPr doesn't allow children in, so
a floating table with an overlap, as in demo 34, didn't match the schema. It's now written in w:tblPr right after
w:tblpPr, where CT_TblPrBase puts it. createTableFloatProperties no longer writes it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(tables): write a row's cantSplit and tblHeader, and a table's bidiVisual, as off when false

These were written as w:val="false". ISO allows that, but Office's schema only takes on and off for them, so Word's
validator rejected a row with cantSplit or tableHeader set to false, as in demo 98's row revision, and a table with
visuallyRightToLeft set to false. Off is now written as "off", which both schemas accept.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(tables): write a table's cell spacing after its alignment

w:tblCellSpacing was written last in w:tblPr, after w:tblLook, where CT_TblPrBase puts it between w:jc and w:tblInd.
Word's validator rejected any table with cellSpacing and another property after it, such as the borders every table
has.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(math): write sums, integrals and pre-scripts in the schema's order

- A sum or integral without a limit left out its m:sub or m:sup. CT_Nary needs
  both, so a hidden limit is now written empty, as Word writes it
- m:naryPr wrote supHide before subHide; the schema wants subHide first
- m:sPre wrote the base before the scripts; the schema wants sub, sup, e

The other math structures already match shared-math.xsd.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix: write a run given in a run's children beside it, not inside it

A FootnoteReferenceRun in a TextRun's children, as demo 60 has, wrote a w:r
inside a w:r, which the schema doesn't allow.

- A run with a run in its children now ends before it. The inner run, such as
  the footnote reference with its own style, comes next, and the children
  after it go in a run with the outer run's properties, as Word writes it
- The same goes for a DeletedTextRun's children
- A component can now be written as several side by side (writtenAs), which
  the serializer and the patcher use for such a run

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* ci: check the demos with the Open XML SDK validator, with none left out

Every demo's document now passes Microsoft's Open XML SDK validator, which checks each part against Office's schemas,
so the demos are checked with it instead of xmllint, and the list of demos left unchecked is gone.

xmllint only checked document.xml and the theme against the bundled schemas, which are Word 2007's: they don't declare
the Word 2010 extensions that templates and shapes use (w14:paraId, w14:checkbox, wps, wpg, mc:AlternateContent), so
26 demos weren't checked at all. The validator understands them, checks every part, and found the bugs fixed before
this. The validator is 80 MB, so it's installed only in this workflow rather than as a dependency.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(styles): let the default styles given in styles.default take the place of external ones

With externalStyles, a default style given in styles.default, such as heading1, or the document defaults given as
document, was replaced by the external style with its id, so the option did nothing. Now the external styles replace
only the default styles that weren't given, and the ones given replace the external ones.

Before, both were written, the default one first. ISO 29500 has the first of two styles with an id keep it, so the
style given in styles.default was the one that applied, as it is again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(tables): write a cell's merge revision before its previous properties

w:cellMerge was written after w:tcPrChange, where CT_TcPr puts it before, so a cell with both a merge revision and a
property revision didn't match the schema, which the Open XML SDK validator reports as an unexpected element.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(numbering): leave highlight, math and revision out of a level's run properties

Office's schema doesn't allow w:highlight, w:oMath or w:rPrChange in a numbering level's run properties, so the Open
XML SDK validator rejected the numbering part of a document whose level's run style had a highlight. None of them
applies to a level's number, so they're no longer written. The option's type is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* fix(demos): make parrots.bmp a bitmap

demo/images/parrots.bmp, the bitmap demos 5, 23 and 114 show, held PNG data, so those documents had a part typed
image/bmp that wasn't a BMP. It's now the same picture as a 24-bit BMP, with the same pixels.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* Add schemas and validators

* Fix dependencies

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 00:02:19 +01:00
dependabot[bot] 1e66c0e986 build(deps-dev): bump eslint-plugin-jsdoc from 63.0.0 to 64.5.4 (#3527)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 63.0.0 to 64.5.4.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v63.0.0...v64.5.4)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-version: 64.5.4
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-25 21:18:21 +01:00
dependabot[bot] 4090b83653 build(deps-dev): bump jsdom from 29.1.1 to 30.1.0 (#3532)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 29.1.1 to 30.1.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Commits](https://github.com/jsdom/jsdom/compare/v29.1.1...v30.1.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-version: 30.1.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-25 21:18:05 +01:00
dependabot[bot] c06577432e build(deps-dev): bump @vitest/ui from 4.1.7 to 5.0.1 (#3531)
Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 4.1.7 to 5.0.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v5.0.1/packages/ui)

---
updated-dependencies:
- dependency-name: "@vitest/ui"
  dependency-version: 5.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-25 21:17:41 +01:00
dependabot[bot] 7bb5129aa0 build(deps): bump @types/node from 25.9.1 to 26.6.2 (#3530)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.1 to 26.6.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 26.6.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-25 21:17:32 +01:00
dependabot[bot] 8d97524e21 build(deps-dev): bump execa from 9.6.1 to 10.0.1 (#3524)
Bumps [execa](https://github.com/sindresorhus/execa) from 9.6.1 to 10.0.1.
- [Release notes](https://github.com/sindresorhus/execa/releases)
- [Commits](https://github.com/sindresorhus/execa/compare/v9.6.1...v10.0.1)

---
updated-dependencies:
- dependency-name: execa
  dependency-version: 10.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-25 21:17:16 +01:00
Dolan 494ed78138 feat: shapes in docx/shapes and watermarks in docx/watermarks (#3534) 2026-09-24 15:38:43 +01:00
Dolan bf7eb857df feat(shapes): automatic layout, text sizing, connector polish and visual regression tests (#3533) 2026-09-24 13:18:04 +01:00
Dolan Miu 7909e4a3db chore: Version bump 2026-09-23 14:27:01 +01:00
d97520abce build(deps-dev): bump eslint from 9.39.2 to 10.11.0 (#3516)
* build(deps-dev): bump eslint from 9.39.2 to 10.11.0

Bumps [eslint](https://github.com/eslint/eslint) from 9.39.2 to 10.11.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v9.39.2...v10.11.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 10.11.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: Fix lint for ESLint 10

ESLint 10 no longer pulls in @eslint/js or globals transitively, so the
config failed to load. Add both as explicit devDependencies.

eslint-plugin-import 2.x crashes on ESLint 10 (it reads the removed
context.parserOptions) and has no release supporting it. Replace it with
eslint-plugin-import-x, the maintained fork, using the resolver-next API
with the TypeScript and Node resolvers. Rule configuration is unchanged
apart from the import/ -> import-x/ prefix.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 14:23:39 +01:00