Repository navigation
Releases
v0.7.0
Added
- Fail-safe: a document with tracked changes no longer draws deleted text as live
text. last-word's model is gaining tracked-changes authoring: arevisionkey on
runs (insert,delete,moveFrom,moveTo,format), on paragraph and heading
blocks and on list items. This viewer cannot show revisions, and before this it drew
them as if they were not there, so deleted text read as part of the document. Now,
when adoccarries anyrevision: a run that was deleted or moved away
(delete,moveFrom) is not drawn, on the pages or in the measuring copy, and its
footnote is not numbered; inserted, moved-here and reformatted text draws as
before; a block-level mark keeps its text. A notice above the pages says so
(TRACKED_CHANGES_NOTICE, handledata-lw-tracked-changes-noticewith
data-lw-revisions, the count), and the root gainsdata-lw-tracked-changes. A
revisionthis viewer cannot read counts as deleted: hiding text under a notice is
recoverable, showing deleted text as live is not. The viewer never changes the
model: the revisions are still there for the host to write back. This is a guard,
not support; there is no review UI. New exports:hasRevisions(doc),
revisionPaths(doc)(JSON Pointers) andisDeletedRun(run);onLayoutgains
revisions(the same pointers), absent when there are none. A document without
revisions draws exactly as before; nothing to do.
Changed
-
CI: the lab-certificate gate verifies against the lab's rotated key list.
The lab's first signing key is retired: certificates it already issued still
verify, and nothing new it signs ever can. Consumers do nothing. -
Docs:
AGENTS.mdis now the guide to using this package (install, its entries on the Fancy MCP catalog server, API essentials, traps), and it ships in the package. The contributor notes it held moved toCONTRIBUTING.md, andCLAUDE.mdis now a symlink to it. The README points to the MCP server and toAGENTS.md. No code changed; nothing to do. -
CI: re-pin org third-party allowlist to 2614224
v0.6.0
What you must do: to see charts drawn, install the optional peer:
npm install @particle-academy/fancy-echarts echarts. Without it nothing
breaks and nothing moves: charts stay sized placeholders, as in 0.5.0, now with
a development warning. Page breaks do not move either way: a chart's box is the
same size as before.
Fixed
- Charts draw as charts (last-word-ui#1). Every chart block from
last-word's native charts drew as a dashed "Chart: <title>" placeholder,
although the.docxwas correct. The block's EChartsoptionis now drawn
by fancy-echarts'EChartat the block's size, inside the page: column, bar,
line and pie. The sheet is white paper in every colour scheme, so the chart
gets an explicit light theme (left unset, fancy-echarts picks its dark theme
from the OS and draws light text on the white page), a transparent
background, the SVG renderer (sharp under the page scale and in print) and no
animation. The block's own keys win over each default. - The viewer has a box while it lays out. Until the font loaded and the
first layout ran (up toFONT_LOAD_TIMEOUT_MS, 3 s),DocViewer's root held
only the offscreen measuring copy, so it was 0 px high: the page jumped when
the sheets arrived, and a kit-site inspector measuring early saw a viewer
with no box at all. It now draws one blank sheet (data-lw-pending) at the
first page's scaled size and marks the rootaria-busy="true"until the
pages replace it. Measuring, page breaks andonLayoutare unchanged.
Nothing to do; if you style the viewer,[data-lw-pending]is the new handle.
Added
@particle-academy/fancy-echarts(>=6.1.0 <7.0.0) as an optional peer.
It is imported dynamically on first use, in the browser only, so a document
with no charts loads no charting engine and server rendering draws the empty,
sized box with no hydration mismatch.renderChartprop onDocViewer: draw a chart yourself, given
{ block, option, width, height, title }. Returnundefinedto leave a
chart to the default.pageChartOption(),OFFICE_PALETTE, and theChartRenderArgsand
RenderCharttypes.- Chart blocks carry
data-lw-chart. Without fancy-echarts, a placeholder
still carriesdata-lw-chart-placeholder, and a development warning (once)
names the package to install and therenderChartalternative.
Changed
- The hidden measuring copy draws a chart's box only, never the chart, so a
chart is never initialised twice. The box is the size it was, so page breaks
do not move. - Releases need a lab-run certificate.
publish.ymlgains a read-only
lab-certificatejob that every publishing job needs: a tag is published only
when the fancy-labs lab has certified that exact version and commit. Consumers
do nothing; this changes how releases are cut, not what the package does.
v0.5.0
Added
- Mixed page orientation. A
pageBreakcarryingpagechanges the page from there on: each page is drawn at its own size and margins, with its own bands, and its text measured at its own width.marginsmerge side by side, every other key is replaced whole,firstHeader/firstFooterare never inherited and on a break mean the first page after it, and even bands follow the page number.{section}counts the stretches and{sectionpages}is the page count of the current one, as Word'sSECTIONandSECTIONPAGES. One scale serves every page, from the widest. docStretches(),blockStretches(),packInput(),pageClassIn().paginate()takes astretchon a break item andfirstEvenPageHeight;pageCapacity()a stretch's first page index.onLayoutreportspageSizeswhen the document's page changes partway.pageWidthandpageHeightstay the first page's.
Changed
- The notice no longer fires for a
pageon a top-level break, because that is drawn now. It still fires for what the writers refuse (a nestedpage, a background on a break, page keys straight on a break, a top-levelsections), in new words. Consumer action: none, unless you comparedLAYOUT_NOTICE's text. tests/fixtures/viewer-agreement.jsonhas a tenth case, recorded in headless Chromium; the first nine did not move.
v0.4.1
What you must do: nothing. A document with a colSpan of 1000 or less draws
exactly as it did.
Security
- A table cell's column span had no upper limit here either, so a very small
document could cost a browser tab far more than its size.tableGrid()clamps a
colSpanto 1000 (MAX_COL_SPAN, last-word's limit) and no longer spends memory
on each slot a span covers. The viewer still never refuses a document.
Consumer action: upgrade. If you vendoreddoc-viewerwithfancy-cli,
add it again to take the fix: a vendored copy does not update itself.
v0.4.0
What you must do: nothing. A document with one page setup draws exactly as
before, with no new element and no new onLayout key. Under Tailwind, your build
needs react-fancy's classes as it already does.
Added
- A visible notice when a document asks for mixed page layout (mixed page
orientation, stage 1).pageBreak.page, page keys written straight on a break
(pageBreak.orientation,.margins, ...) and a top-levelsectionswere silently
ignored, so a landscape section drew as portrait with nothing said. The document
still draws, one page setup as before, under a react-fancyCallout
(data-lw-layout-notice) in light and dark.onLayoutgainsnotShown, JSON
Pointers to what it ignored, present only when there is something to report. New
exports:LAYOUT_NOTICE,unshownLayout(doc). Per-page geometry comes in a later
release; consumer action: none. Those near-miss keys andsectionsdo not
exist:pageBreak.pageis the form, andlast-wordrefuses all of them on write
until it can honour the first.
v0.3.0
What you must do: probably nothing, but expect page breaks to move. Calibri
and default text now draws in a bundled font with kerning off, so a document
can break differently from 0.2.0, on every machine, including ones that had
real Calibri or only Arial. That is the point: the count is now the same
everywhere and matches last-word's Agent::layout(). Under a strict CSP you
already import styles.css; allow its font files in font-src. On the
CommonJS build, import styles.css too, or the viewer reports
font: "fallback".
Added
- A bundled Carlito (1.104, from googlefonts/carlito, unmodified, SIL OFL
1.1 with a NOTICE infonts/), declared as"LW Carlito"in regular, bold,
italic and bold italic. Metric-compatible with Calibri: every printable
ASCII and Latin-1 advance is equal in all four styles. The package now
publishesfonts/(about 2.7 MB of TTF; Carlito is not published as woff2
upstream, and these are the files as published). A browser fetches only the
faces a document uses. styles.cssdeclares the same@font-facerules, with URLs relative to the
stylesheet, for the strict-CSP route.DocViewerLayout.font:"carlito","fallback"or"unused", and
data-lw-fonton the root, so a caller can tell a deterministic page count
from one that depends on the machine.FONT_LOAD_TIMEOUT_MS(3000) and theViewerFonttype.demo/agreement.html: the harness that renders documents in the viewer and
records the page layout last-word'slayout()is held to. The fixtures it
produced are intests/fixtures/viewer-agreement.json(the same bytes as in
last-word; both pin the sha256).
Changed
- Calibri and unspecified text draws in the bundled Carlito, first in the
stack, ahead ofCalibri,Carlito,Segoe UIandArial. Pages may
break differently from 0.2.0 on any machine: where real Calibri was
installed, because kerning is now off; where it was not, because the text is
no longer in Segoe UI or Arial. Every other explicit font keeps its stack,
and its breaks still depend on the machine. - Kerning and ligatures are off (
font-kerning: none,
font-variant-ligatures: none), as in Word by default, and
text-rendering: geometricPrecision. - The viewer waits for the font before it measures. No pages and no
onLayoutuntil the faces the document draws have loaded (or 3 s pass).
0.2.0 drew pages in the fallback first and re-laid them out when web fonts
arrived, soonLayoutcould report a count that changed a moment later.
v0.2.0
Renders last-word 0.16.0's band variants and field tokens. Consumer action:
none. Both new props are optional, and a document without the new page keys
or tokens renders exactly as it did on 0.1.1. Pass filename and now only
if your bands use {filename}, {date} or {time}.
Added
- First-page and even-page bands:
page.firstHeader,page.firstFooter,
page.evenHeaderandpage.evenFooter, in the same forms aspage.header
(a one-line band or{blocks}). Page 1 draws the first variant when
present, even pages (2, 4, ...) the even variant, every other page the
default.{"blocks": []}as a variant blanks that page's band. Each band
carriesdata-lw-band-variant(default,firstoreven). - Per-page body heights. Each page's body is sized by the bands it
actually draws, so a tall first-page letterhead moves only page 1's body
down.paginate()takes optionalfirstPageHeightandevenPageHeight
besidepageHeight, and eachPageLayoutreports itscapacity. Without
the new options, pagination is unchanged. - Field tokens in band text:
{section}and{sectionpages}(a Doc is one
section:1and the page total),{author}(doc.meta.author),{title}
(the top-leveldoc.title; there is nometa.title),{filename}, and
{date}/{time}in the browser locale, or{date:FORMAT}/
{time:FORMAT}with a Word date-time picture (d to dddd, M to MMMM, yy,
yyyy, h, hh, H, HH, m, mm, s, ss, am/pm, AM/PM, single-quoted literals,
English names). Tokens follow last-word's grammar exactly; anything else in
braces stays literal. In the body every token stays literal text. Values
render as plain text only. - Props:
filename(what{filename}shows; empty when absent) andnow
(a Date or an ISO string; the moment{date}/{time}show, for
deterministic output). - Exports:
pageCapacity,pageBand,pageClass,bandSlot,
pageBodyBoxes,formatDatePicture,resolveNow, and theBandKind,
BandSlot,PageClass,BandHeightsandDocMetatypes.PageFields
gains optionalsection,sectionPages,author,title,filenameand
now;substituteFields(text, { page, pages })still works as before.
v0.1.1
Changed
- Test environment:
jsdommoved from 26 to 30 (devDependency only). jsdom 26
pulled inwhatwg-encoding, which is deprecated upstream and printed a
deprecation warning on everynpm ci. Nothing in the published package
changes. Consumer action: none.