takumi-html@0.8.0
render, renderSvg, measure, and the WASM renderAsDataUrl accept an HTML string in place of a node tree. The markup is parsed in Rust, and the CSS of its <style> elements follows the css option. A <style> with a media attribute applies only where its query matches. takumi-html adds parse_html, which returns that CSS with the tree. fromHtml from @takumi-rs/helpers/html is deprecated in favor of passing the string and will be removed in v3.
An <input> of type text, search, tel, url, email, password, or number now draws its value inside the field, as Chromium does. The field takes Chromium's default font, border, and padding, sizes itself from the size attribute, centers its text vertically, and sits on the baseline of its line. A password shows a dot for each character, a number field with an invalid value shows nothing, and a disabled field turns gray. <input type="hidden"> takes no space. These inputs used to draw nothing, not even their author-set width.
It recovers from less malformed markup than html5ever. It implies <html>, <head>, <body>, <tbody>, and the end tags of p, li, dt, dd, option, and table rows and cells, but does not reconstruct misnested formatting elements or move stray table content out of the table.
takumi_core::html holds from_html, parse_html, FromHtml, FromHtmlOptions, StylePresets, and HtmlError, behind the html feature. takumi-html now only re-exports that module, so depend on takumi-core with features = ["html"] instead, adding html-svg-nodes where takumi-html's svg feature kept inline <svg> as nodes. The takumi crate's from-html feature and its takumi::html re-export work as before.
A <textarea> now takes Chromium's default monospace font, border, and padding, and sizes itself from cols and rows with room for a scrollbar. Its text keeps its line breaks and, unless the field is disabled or read-only, its spaces. It wraps inside the field, which clips it in both axes even under overflow: visible, as Chromium does. A disabled textarea turns gray. A textarea used to render as inline text with its line breaks collapsed.
takumi@2.19.0
- @takumi-rs/wasm@2.19.0
- @takumi-rs/image-response@2.19.0
- @takumi-rs/helpers@2.19.0
- takumi-js@2.19.0
- @takumi-rs/core@2.19.0
- takumi@2.19.0
Nitro's bun preset used to answer every request with a 500 and ENOENT ... _libs/@takumi-rs/[object WebAssembly.Module]. The WASM packages now load their binary through unwasm there, as they do on other Nitro presets.
render, renderSvg, measure, and the WASM renderAsDataUrl accept an HTML string in place of a node tree. The markup is parsed in Rust, and the CSS of its <style> elements follows the css option. A <style> with a media attribute applies only where its query matches. takumi-html adds parse_html, which returns that CSS with the tree. fromHtml from @takumi-rs/helpers/html is deprecated in favor of passing the string and will be removed in v3.
renderer.prepare(source, options) styles an HTML string or node tree, fetches the images it draws, and loads the font subsets its text uses. render, renderSvg, and measure take the prepared source with only output options such as format. renderer.prepareAnimation(options) does the same for every scene of an animation, and renderAnimation takes its result. prepareImages from @takumi-rs/helpers is deprecated in favor of prepare.
takumi-js renders through prepare, so it fetches the images the styled tree draws. An image that css, a <style> element, or a ::before rule sets now renders, an image under display: none is no longer fetched, and a custom fetch now receives relative URLs such as /logo.png.
takumi-paint and takumi-pdf take HTML strings as @takumi-rs/core and @takumi-rs/wasm do, and takumi-pdf takes them for header and footer bands too. A renderAnimation scene can be an HTML string, its <style> rules applying to the animation. With emoji: "from-font", takumi-js hands HTML to the renderer instead of parsing it in JavaScript.
When fonts holds unicodeRange subsets, as googleFonts returns, a render now loads only the subsets that font matching reaches for each character, through that text's own font stack, weight, and style. With font-family: Inter, "Noto Sans JP", Latin text no longer loads Noto Sans JP's Latin subset, and a bold subset loads only when bold text uses it.
The text comes from the styled tree, so a subset needed only by a stylesheet's generated content, a list marker, text-transform, the text elements of an SVG image, or a takumi-pdf page counter now loads. collectCodepoints, LIST_MARKER_CHARACTERS, and subsetFonts are deprecated.
Editors now flag imports from @takumi-rs/image-response, which only re-exports takumi-js/response, and from @takumi-rs/wasm/vite, which resolves to the same loader as @takumi-rs/wasm/auto under Vite. Both keep working and will be removed in v3.
PdfRenderer.prepare and Painter.prepare, and the shared prepare each package exports, fetch the images a document draws and load the font subsets its text uses, a PDF's header, footer, and page bands included. render, measure, and paint take the prepared document, a PDF with only file options such as metadata and pdfa.
Without a fetchCache, every render used to download each emoji's SVG again. Emoji images from the emoji providers are now kept across renders in a cache of up to 8 MB per fetch function. Other remote images still need a fetchCache to be reused. The fluent and fluentFlat sets now load from a pinned commit of shuding/fluentui-emoji-unicode, as the other sets load from a pinned version, so a cached image cannot go stale.
The entry holds glue internal to the renderer packages, which no longer import it. Its exports keep working and will be removed in v3. Import types such as FontLoader and ImagesInput from the renderer package you use.
A Nitro build with exportConditions: ["!unwasm"] picked @takumi-rs/core, but every request failed with TypeError: __exportAll is not a function. It now renders with the native addon, and the bun preset no longer bundles the WASM binary next to it.
FontResource::into_resolved now also limits the cmap to the unicode_range and hashes the font, so registering a resolved font takes the same short time whatever its size. @takumi-rs/core registers fonts on the JavaScript thread after decompressing them in the background, and renders no longer wait on a lock while fonts load. The font cache budget now counts a unicode-range subset by the bytes it keeps.
takumi-core@0.35.0
counter-reset, counter-increment, and counter-set change named counters, and content writes them with counter(name) or counters(name, "."), in any list-style-type style. Counters follow the document order Chrome counts in, including the implicit list-item counter of ol, ul, and li, and contain: style keeps the counters inside an element from reaching the rest of the page. ::after reads a counter after the element's children change it, so a section can close with how many items it held.
List markers and the list-item counter now number as Chrome does: an <ol reversed> counts down from start, or from its item count when it has no start, and a box with contain: style numbers the list items inside it from 1. An item's counter-set or counter-increment of list-item moves its marker too. start now applies only to an <ol>, and value only to an <li>.
An <input> of type text, search, tel, url, email, password, or number now draws its value inside the field, as Chromium does. The field takes Chromium's default font, border, and padding, sizes itself from the size attribute, centers its text vertically, and sits on the baseline of its line. A password shows a dot for each character, a number field with an invalid value shows nothing, and a disabled field turns gray. <input type="hidden"> takes no space. These inputs used to draw nothing, not even their author-set width.
Selectors used to split an element's class attribute on any Unicode whitespace, so class="a b" matched .a as an ancestor. It now splits on ASCII whitespace, as HTML does, and a b is one class. The same applies to the page counter classes in PDFs.
An item hidden with display: none, or inside a hidden element, used to take the next number in its list, so the visible item after it skipped one. It now takes none, as Chromium numbers only items that get a box. Hidden subtrees are also no longer styled, which makes measuring a tree with a large hidden section about a third faster.
A box with overflow: hidden that breaks across pages used to clip each page to its own piece of the box, so a child that a transform moved past the page end lost the part that belongs on the next page. Each page now clips to the whole box, as Chromium prints it. Rounded corners on such a box also curve over its whole height on every page, so a PDF holds back a page until the box that starts on it ends.
Content clipped by overflow: hidden no longer adds pages
A box with overflow other than visible on the block axis that ends on a page used to keep breaking its overflowing children, so the clipped content added blank pages after it. The box now stops breaking on the page where it ends, as Chromium does, and its clipped content stays on that page.
takumi_core::html holds from_html, parse_html, FromHtml, FromHtmlOptions, StylePresets, and HtmlError, behind the html feature. takumi-html now only re-exports that module, so depend on takumi-core with features = ["html"] instead, adding html-svg-nodes where takumi-html's svg feature kept inline <svg> as nodes. The takumi crate's from-html feature and its takumi::html re-export work as before.
RenderNode::needs and takumi_raster::needs report the images a node tree looks up by URL and the fonts its text would load, read from the styled tree. Stylesheet and Tailwind rules, display: none, generated content, list markers, text-transform, and the text elements of SVG images count as they will render.
Register a font that is still downloading with Fonts::register_pending and a PendingFontFace. Font matching treats it as a loading @font-face, and needs reports its id when the text reaches it before a loaded font with the glyph, as Blink starts loading a face.
A <textarea> now takes Chromium's default monospace font, border, and padding, and sizes itself from cols and rows with room for a scrollbar. Its text keeps its line breaks and, unless the field is disabled or read-only, its spaces. It wraps inside the field, which clips it in both axes even under overflow: visible, as Chromium does. A disabled textarea turns gray. A textarea used to render as inline text with its line breaks collapsed.
SVG images, filter: url(data:image/svg+xml,...) references, and SVG sizing now go through takumi's own markup parser instead of roxmltree, which leaves the binaries. An SVG that is not well-formed XML renders what the parser recovers instead of failing to load, entities a DTD declares stay unexpanded, and a referenced filter keeps only its fe* primitives, so a <script> or other element inside the <filter> no longer reaches the SVG output.
:disabled, :enabled, :checked, :indeterminate, :placeholder-shown, :read-only, :read-write, :required, and :optional now match by the element's attributes, as HTML defines them. A control inside <fieldset disabled> counts as disabled, and an <option> counts as checked when its <select> would show it selected. These selectors used to match nothing, so their rules never applied.
PNG decoding is 13 to 85% faster natively and 13 to 81% faster in WebAssembly on most images, with the largest gains on flat graphics such as social cards, emoji, and icons, and on paletted and interlaced images. The decoded pixels are unchanged.
FontResource::into_resolved now also limits the cmap to the unicode_range and hashes the font, so registering a resolved font takes the same short time whatever its size. @takumi-rs/core registers fonts on the JavaScript thread after decompressing them in the background, and renders no longer wait on a lock while fonts load. The font cache budget now counts a unicode-range subset by the bytes it keeps.
takumi-pdf@0.19.0
PdfRenderer.prepare and Painter.prepare, and the shared prepare each package exports, fetch the images a document draws and load the font subsets its text uses, a PDF's header, footer, and page bands included. render, measure, and paint take the prepared document, a PDF with only file options such as metadata and pdfa.
Pass signal to stop a render before it reads the document or draws it, as @takumi-rs/core renders take one.
Nitro's bun preset used to answer every request with a 500 and ENOENT ... _libs/@takumi-rs/[object WebAssembly.Module]. The WASM packages now load their binary through unwasm there, as they do on other Nitro presets.
Selectors used to split an element's class attribute on any Unicode whitespace, so class="a b" matched .a as an ancestor. It now splits on ASCII whitespace, as HTML does, and a b is one class. The same applies to the page counter classes in PDFs.
takumi-paint and takumi-pdf take HTML strings as @takumi-rs/core and @takumi-rs/wasm do, and takumi-pdf takes them for header and footer bands too. A renderAnimation scene can be an HTML string, its <style> rules applying to the animation. With emoji: "from-font", takumi-js hands HTML to the renderer instead of parsing it in JavaScript.
When fonts holds unicodeRange subsets, as googleFonts returns, a render now loads only the subsets that font matching reaches for each character, through that text's own font stack, weight, and style. With font-family: Inter, "Noto Sans JP", Latin text no longer loads Noto Sans JP's Latin subset, and a bold subset loads only when bold text uses it.
The text comes from the styled tree, so a subset needed only by a stylesheet's generated content, a list marker, text-transform, the text elements of an SVG image, or a takumi-pdf page counter now loads. collectCodepoints, LIST_MARKER_CHARACTERS, and subsetFonts are deprecated.
takumi-pdf no longer takes stylesheets. Pass CSS through css, which takes one string or a list. The subsetOf and subsetRank font fields are gone from both packages. Register each subset under its family name with its unicodeRange.
takumi-svg@0.3.34
Published takumi-svg@0.3.34.
takumi-paint@0.5.0
PdfRenderer.prepare and Painter.prepare, and the shared prepare each package exports, fetch the images a document draws and load the font subsets its text uses, a PDF's header, footer, and page bands included. render, measure, and paint take the prepared document, a PDF with only file options such as metadata and pdfa.
Nitro's bun preset used to answer every request with a 500 and ENOENT ... _libs/@takumi-rs/[object WebAssembly.Module]. The WASM packages now load their binary through unwasm there, as they do on other Nitro presets.
takumi-paint and takumi-pdf take HTML strings as @takumi-rs/core and @takumi-rs/wasm do, and takumi-pdf takes them for header and footer bands too. A renderAnimation scene can be an HTML string, its <style> rules applying to the animation. With emoji: "from-font", takumi-js hands HTML to the renderer instead of parsing it in JavaScript.
When fonts holds unicodeRange subsets, as googleFonts returns, a render now loads only the subsets that font matching reaches for each character, through that text's own font stack, weight, and style. With font-family: Inter, "Noto Sans JP", Latin text no longer loads Noto Sans JP's Latin subset, and a bold subset loads only when bold text uses it.
The text comes from the styled tree, so a subset needed only by a stylesheet's generated content, a list marker, text-transform, the text elements of an SVG image, or a takumi-pdf page counter now loads. collectCodepoints, LIST_MARKER_CHARACTERS, and subsetFonts are deprecated.
takumi-pdf no longer takes stylesheets. Pass CSS through css, which takes one string or a list. The subsetOf and subsetRank font fields are gone from both packages. Register each subset under its family name with its unicodeRange.
takumi-raster@0.6.0
RenderNode::needs and takumi_raster::needs report the images a node tree looks up by URL and the fonts its text would load, read from the styled tree. Stylesheet and Tailwind rules, display: none, generated content, list markers, text-transform, and the text elements of SVG images count as they will render.
Register a font that is still downloading with Fonts::register_pending and a PendingFontFace. Font matching treats it as a loading @font-face, and needs reports its id when the text reaches it before a loaded font with the glyph, as Blink starts loading a face.
takumi-raster@0.5.11
Ancestor overflow clips and an element's clip-path and mask-image now apply after filtering, preserving source pixels for blur and drop shadows. Rounded mask images follow the border box, and raster backdrop filters respect opacity, ancestor clips, and nested effect isolation. In takumi-core, the paint property tree exposes separate effect stages and filter clip boundaries through EffectNode::kind and ClipNode::kind, and PropertySink::pop_clip receives the clip being removed.
takumi-html@0.7.1
Published takumi-html@0.7.1.