79 Commits
Author SHA1 Message Date
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 c14d8acff4 ci: upload coverage with codecov-action v5 (#3691) 2026-10-05 10:11: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
Dolan f342f0d7f0 fix: work through the unresolved review comments on recently merged PRs (#3581) 2026-09-29 16:22:02 +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 e0ff13ee3d chore: organise the demos into a folder for each topic (#3552)
* chore: organise the demos into a folder for each topic

The demos were one flat list of 124 numbered files, which made it hard to
find the one you wanted. Each is now in a folder for its topic, such as
demo/tables/basic-table.ts, with a name that says what it shows instead of
a number.

npm run demo lists every demo and narrows the list as you type. It also
takes a demo's path or name, a topic, or search words.

The demos' images moved to demo/assets/images, as images is now a topic.
The docs' links, the Demos workflow, the shape render script and its
reference images use the new paths and names.

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

* fix: list only a topic's own demos, and drop stale output file names

npm run demo text also offered the text-boxes demos and others with
"text" in their name, so a topic now searches for "text/". Three demos
logged their old numbered file name after writing My Document.docx.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 01:40:45 +01:00
Dolan 6207d0067f feat: native Word charts in docx/charts (#3545) 2026-09-26 10:15:50 +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
DolanandClaude Opus 5.5 8635eede2b ci: run the demos in parallel (#3542)
The Demos workflow ran each demo and each check as a step of its own, one after another. About 200 steps took
4 minutes, half of it in the checks: each started a Node process and two Docker containers. It also had gaps:

- after demos 98 and 103, the check opened the previous demo's document, since those demos write other file names;
- demo 104 never ran, and demo 75 was commented out.

The job is now a matrix of four shards. Each runs every fourth demo in a shell loop and checks document.xml and the
theme against the bundled schemas with xmllint, as before. New demos are picked up without editing the workflow, and
each demo's document is deleted before the next one runs, so each check reads the document its demo wrote. The demos
that don't match the schemas yet are listed in SKIP_VALIDATION.

The validate-docx action is no longer used, so it is removed.


Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 21:12:35 +01:00
Dolan 943124e7da fix(textbox): write a text box's picture in a run, and only that run inside a paragraph (#3541) 2026-09-25 16:28:07 +01:00
DolanandClaude Opus 5.5 e7b568f4e6 feat(shapes): custom shapes with several paths, holes, text areas and connection points (#3539)
- `paths` draws a custom shape from several paths, each filled with the
  shape's fill, not at all, or lighter or darker, and with or without its line
- A closed part of a path inside another is a hole, whichever way round it
  is drawn: parts are turned round so both fill rules cut the same holes
- `textArea` sets where a custom shape's text goes, and "fitText" fits it
- `connectionPoints` gives a custom shape its own connection points
- Connection sites and text areas are guides that keep their share of the
  shape when it is resized, as PowerPoint writes freeforms
- Demo 120, with a reference render, and docs in shapes.md


Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 16:10:17 +01:00
Dolan 764d5423f3 feat: theme colours for text, underlines, borders and shading (#3537) 2026-09-24 23:34:57 +01:00
Dolan 811e5d9b97 feat: write a theme part, with theme fonts for text and theme colours for shapes (#3536) 2026-09-24 20:23:52 +01:00
Dolan 91cd6398e2 feat(shapes): text in document styles, swimlanes, routing, descriptions, percentages and text flows (#3535) 2026-09-24 18:46:00 +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 859ea7ec7b feat(shapes): effects, pattern and picture fills, text layout, custom shapes and richer diagrams (#3523) 2026-09-24 11:52:04 +01:00
DolanandClaude Opus 5.5 ee37e5b38c feat(shapes): connectors and drawing canvases (#3522)
Shapes in a ShapeGroupRun or the new ShapeCanvasRun can have an `id`, and a
child with `type: "connector"` joins two of them:

    { type: "connector", from: "start", to: { id: "step", side: "top" }, route: "elbow" }

The connector is drawn from one shape to the other, so it needs no size or
position. It attaches at the shapes' connection sites (a:stCxn/a:endCxn),
choosing the facing sides unless a side is given, and routes as Word does:
a straight line, or elbow and curved connectors that leave and arrive at right
angles and loop around shapes when they have to.

Word only keeps connectors attached when shapes move on a drawing canvas, so
ShapeCanvasRun writes a wpc:wpc canvas with an optional background and outline.

Connection sites come from the preset shape definitions of ECMA-376:
scripts/generate-preset-shape-geometry.ts extracts each shape's sites and the
guides they depend on, and a small evaluator calculates them for a shape's size
and adjustments. A test also checks the adjustments table against the
definitions.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 09:36:03 +01:00
Dolan 3bd3afd6e4 feat: add shapes with ShapeRun and ShapeGroupRun (#3521)
* feat: Add shapes

* Make API more friendly
2026-09-24 01:54:16 +01:00
DolanandDolan Miu 309b972e10 chore: Upgrade actions (#3458)
Co-authored-by: Dolan Miu <>
2026-06-01 22:27:30 +01:00
DolanandDolan Miu 4934d310c7 chore: Upgrade node-version in GitHub Actions workflow (#3457)
Co-authored-by: Dolan Miu <>
2026-05-27 16:43:25 +01:00
DolanandDolan Miu 224b95a25e docs: Improve documentation, JSDoc comments, and troubleshooting guides (#3433)
* docs: Write documentation and comments

Upgrade and remove dependencies

* Add more demos to the run

* Add more tests to fill coverage to 100%

---------

Co-authored-by: Dolan Miu <>
2026-05-24 17:52:35 +01:00
DolanandDolan Miu 74bf48f8c1 feat: Migrate to new component authoring (#3332)
* feat: Migrate to new component authoring

# Conflicts:
#	src/file/table-of-contents/table-of-contents.ts

# Conflicts:
#	src/file/content-types/content-types.ts
#	src/file/paragraph/properties.ts
#	src/file/table/table-properties/table-properties.ts

# Conflicts:
#	src/file/document/body/section-properties/section-properties.ts
#	src/file/paragraph/run/run.ts
#	src/file/table-of-contents/table-of-contents.ts
#	src/file/table/grid.ts
#	src/file/table/table-cell/table-cell-properties.ts
#	src/file/table/table.ts

* Clarify public api

* Add docs

* Fix tests and linting

* Fix readonly array

* Fix spelling

* Update ToC docs

* Update WPS to use BuilderElement

* Migrate components to use Builder element

Add ESLint rules

* Comment out the template demos

* Ignore demo 90 until we fix schema validation

* Disable demo validation

* Disable doc

* Disable validation for now

---------

Co-authored-by: Dolan Miu <>
2026-02-22 21:23:05 +00:00
Dolan 3539c06e92 docs: Improve inline docs and docs website (#3353)
* docs: Improve inline docs and docs website

* Fix lint

* Fix spelling
2026-02-14 03:54:25 +00:00
Dolan Miu 918672d16d fix: NPM publishing with Trusted Publisher 2026-02-12 02:25:20 +00:00
Dolan Miu d99367c82c chore: Remove npm auth token to use Trusted Publishers 2026-02-12 01:21:24 +00:00
Josh Kelley ff37f3b460 fix: Ensure necessary namespaces are in patched doc (#2698)
* refactor: Extract timestamp properties

In preparation for reworking DocumentAttributes.

* refactor: Consolidate namespaces

* fix: Ensure necessary namespaces are in patched doc

Fixes #2697

* Fix tsc and ESLint errors

* Fix CSpell

* Add a test to fix code coverage failure
2025-01-06 22:19:00 +00:00
Dolan Miu 6e371d42a7 fix: npm publish install 2024-10-14 01:47:59 +01:00
Dolan Miu 6eb11d8842 Revert github action version change 2024-10-13 02:06:22 +01:00
Dolan 07f363fcb7 feat: Add npm publish GitHub Action workflow (#2762)
* feat: Add npm publish GitHub Action workflow

* Fix typo
2024-10-13 01:48:04 +01:00
Dolan 0bcc6910f4 Use codecov token (#2748)
* Use codecov token

* Using env to pass token
2024-10-11 00:22:43 +01:00
Dolan d4ac2a08ee Make demos synchronous (#2494) 2023-12-31 14:14:41 +00:00
Dolan 10b87b5a70 Run demo GitHub Action in parallel (#2484)
* Run demo GitHub Action in parallel

* Fix path of action yml

* Move checkout to demo action

* Prettier format

* Specifying shell

* Try to fix uses

* Fix spelling issue

* Fix demo

* Downloading artifacts too unreliable

Building instead

* Re-name step

Re-use action elsewhere
2023-12-25 15:29:13 +00:00
Dolan 6b6f9d7ed4 Use standard script names for test and prettier (#2483) 2023-12-25 13:02:00 +00:00
Dolan d04c42cbe8 Use esm for ts-node (#2459)
* Use esm for ts-node

* Add esm flag

* Change tsconfig properties

* Use tsx rather than ts-node

* Use tsx

* Remove ts-node
2023-12-22 01:10:54 +00:00
Dolan Miu a9fa31ebac Upgrade testing libraries 2023-06-15 21:15:39 +01:00
Dolan Miu 09ab91eeef Fix tests and build
Remove unused code and dependencies
2023-06-08 13:30:31 +01:00
Dolan Miu 0cbb5fb0a3 Convert to vite and clean up build 2023-06-01 02:05:35 +01:00
Dolan Miu 3e40ae862b Remove demo 30 from CI 2023-03-17 01:15:45 +00:00
Dolan Miu bc0a197ba1 Upgrade codecov 2023-02-02 16:31:12 +00:00
Dolan Miu 473ad2947c Remove demo 2022-12-24 20:30:35 +00:00
Dolan Miu 11bebd42ac #940 - Add positional tab feature
Also add extra run elements as per spec
2022-12-24 19:32:44 +00:00
Dolan 522b21862b #756 Adding alt text feature 2022-10-26 23:09:36 +01:00
Dolan f4ed171f85 Fix demos 2022-10-25 01:13:44 +01:00
Dolan Miu 719f7c8f9e Add cspell to actions 2022-07-06 16:43:58 +01:00
Dolan 00ae5a1a1f Force dependency install 2022-06-13 19:02:40 +01:00
Dolan Miu 3a022c4d2a Remove extraction 2021-12-03 03:34:17 +00:00
Dolan Miu e50a6edbed Disable demo 19 2021-12-03 02:23:03 +00:00
Dolan Miu dd657a9e88 Fix typo 2021-10-31 20:25:52 +00:00
Dolan Miu fe21bb1702 #1256 Add page border demos 2021-10-30 19:34:16 +01:00