Skip to content

feat(Dom2Image): update SnapDOM version to 2.24.0 - #1094

Merged
ArgoZhang merged 3 commits into
masterfrom
dev-snap
Aug 12, 2026
Merged

feat(Dom2Image): update SnapDOM version to 2.24.0#1094
ArgoZhang merged 3 commits into
masterfrom
dev-snap

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Aug 12, 2026

Copy link
Copy Markdown
Member

Link issues

fixes #1093

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Update the embedded SnapDOM library to v2.24.0 and expand the Dom2Image options and service API to support richer font handling, output configuration, and improved DOM capture behavior.

New Features:

  • Add configuration types for local font descriptors and font exclusion rules to the Dom2Image options.
  • Expose additional Dom2Image options for output format, filenames, caching, layout reconciliation, placeholders, and proxy/fallback behavior.

Enhancements:

  • Replace the previous SnapDOM implementation with the updated v2.24.0 version including performance and compatibility improvements.
  • Improve IDom2ImageService and DefaultDom2ImageService XML documentation with bilingual comments.
  • Fix the Dom2Image JavaScript stream helper to await the toBlob() result before returning.
  • Add a dedicated DI extension method to register the Dom2Image service with clearer naming.

@bb-auto bb-auto Bot added the enhancement New feature or request label Aug 12, 2026
@bb-auto bb-auto Bot added this to the v10.0.0 milestone Aug 12, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @ArgoZhang, your pull request is larger than the review limit of 150000 diff characters

@sourcery-ai

sourcery-ai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates the embedded SnapDOM library to v2.24.0 and aligns the Blazor Dom2Image integration (options, service API, and JS glue) with the new SnapDOM features, including font embedding, caching, clipping, and download behavior fixes.

Sequence diagram for updated getStream SnapDOM integration

sequenceDiagram
    participant C# as Dom2ImageService
    participant JS as dom2image.js
    participant Snap as snapdom

    C#->>JS: getStream(selector, options)
    JS->>JS: document.querySelector(selector)
    JS->>Snap: snapdom(el, options || {})
    Snap-->>JS: result (snapdom capture object)
    JS->>Snap: result.toBlob()
    Snap-->>JS: Blob
    JS-->>C#: Blob
Loading

File-Level Changes

Change Details Files
Replace the old SnapDOM runtime with the upstream v2.24.0 implementation and adapt the dom2image.js glue code to use its async export APIs correctly.
  • Completely replace the previous snapdom.mjs contents with the upstream SnapDOM v2.24.0 build, including new modules for caching, font embedding, clipping, transforms, and memoized burst captures.
  • Ensure the JS bridge getStream uses await result.toBlob() instead of the non-awaited call to match the new async API surface and prevent returning a pending Promise.
src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs
src/components/BootstrapBlazor.Dom2Image/wwwroot/dom2image.js
Expand Dom2ImageOptions and related C# types to expose the new SnapDOM configuration surface (fonts, caching, proxying, clipping, reconcile/burst, etc.) and improve XML documentation.
  • Introduce Dom2ImageLocalFont and Dom2ImageExcludeFonts classes to describe local fonts and font-exclusion rules that mirror SnapDOM’s font embedding options.
  • Greatly extend Dom2ImageOptions with additional properties (Format, Filename, LocalFonts, IconFonts, ExcludeFonts, FontStylesheetDomains, UseProxy, FallbackURL, Cache, Reconcile, Burst, Invalidate, OuterTransforms, OuterShadows, Placeholders, ResolvePicturePlaceholders, Debug, etc.) and update existing property XML comments to bilingual zh/en descriptions matching SnapDOM semantics.
  • Keep JSON serialization behavior controlled via JsonIgnore attributes, so only explicitly set options are serialized into the JS options object.
src/components/BootstrapBlazor.Dom2Image/Services/Dom2ImageOptions.cs
Improve the Blazor service surface and DI extension docs to be bilingual and aligned with Dom2Image semantics, without changing the runtime behavior.
  • Update IDom2ImageService method XML comments to bilingual zh/en summaries and remove redundant <returns> tags.
  • Annotate DefaultDom2ImageService and BootstrapBlazorDom2ImageServiceExtensions with zh/en XML doc comments that better describe their role (default Html-to-image implementation and Dom2Image service registration).
src/components/BootstrapBlazor.Dom2Image/Services/IDom2ImageService.cs
src/components/BootstrapBlazor.Dom2Image/Services/DefaultDom2ImageService.cs
src/components/BootstrapBlazor.Dom2Image/Extensions/ServiceCollectionExtensions.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#1093 Update the bundled SnapDOM library (snapdom.mjs) used by Dom2Image to version 2.24.0.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang
ArgoZhang merged commit bad5c52 into master Aug 12, 2026
1 check passed
@ArgoZhang
ArgoZhang deleted the dev-snap branch August 12, 2026 07:06

@bb-auto bb-auto Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved by bb-auto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Dom2Image): update SnapDOM version to 2.24.0

1 participant