@imggion/html2realpdf 0.1.14 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/snapshot.js CHANGED
@@ -1805,32 +1805,51 @@ function materializeComputedStyle(original, target, options, diagnostics, isSnap
1805
1805
  }
1806
1806
  }
1807
1807
  const declarations = [];
1808
- const authoredInsets = preserveAuthoredInsets && position !== "static"
1809
- ? authoredInsetOverrides(original, computed, view)
1810
- : undefined;
1811
- const properties = isSvgElement(original)
1812
- ? [...SUPPORTED_COMPUTED_PROPERTIES, ...SVG_COMPUTED_PROPERTIES]
1813
- : SUPPORTED_COMPUTED_PROPERTIES;
1808
+ let authoredInsets = undefined;
1809
+ if (preserveAuthoredInsets && position !== "static") {
1810
+ authoredInsets = authoredInsetOverrides(original, computed, view);
1811
+ }
1812
+ let properties = SUPPORTED_COMPUTED_PROPERTIES;
1813
+ if (isSvgElement(original)) {
1814
+ properties = [...SUPPORTED_COMPUTED_PROPERTIES, ...SVG_COMPUTED_PROPERTIES];
1815
+ }
1814
1816
  for (const property of properties) {
1815
- const nativePage = property === "page" ? computed.getPropertyValue("page").trim() : "";
1816
- const mirroredPage = property === "page" ? computed.getPropertyValue(AUTHORED_PAGE_MIRROR).trim() : "";
1817
- const authoredFlowDimension = isFlowDimension(property)
1818
- ? computed.getPropertyValue(AUTHORED_FLOW_DIMENSION_MIRRORS[property]).trim()
1819
- : "";
1820
- const authoredAutoMargin = isAutoMargin(property)
1821
- ? computed.getPropertyValue(AUTHORED_AUTO_MARGIN_MIRRORS[property]).trim()
1822
- : "";
1823
- const value = property === "display"
1824
- ? display
1825
- : property === "page"
1826
- ? nativePage && nativePage !== "auto" ? nativePage : mirroredPage || nativePage
1827
- : options.layoutContext === "page" && authoredAutoMargin === "auto"
1828
- ? "auto"
1829
- : authoredFlowDimension.endsWith("%")
1830
- ? authoredFlowDimension
1831
- : authoredInsets && property in authoredInsets
1832
- ? authoredInsets[property]
1833
- : computed.getPropertyValue(property);
1817
+ let value = computed.getPropertyValue(property);
1818
+ let authoredFlowDimension = "";
1819
+ if (property === "display") {
1820
+ value = display;
1821
+ }
1822
+ else if (property === "page") {
1823
+ const nativePage = value.trim();
1824
+ const mirroredPage = computed.getPropertyValue(AUTHORED_PAGE_MIRROR).trim();
1825
+ if (nativePage && nativePage !== "auto") {
1826
+ value = nativePage;
1827
+ }
1828
+ else if (mirroredPage) {
1829
+ value = mirroredPage;
1830
+ }
1831
+ else {
1832
+ value = nativePage;
1833
+ }
1834
+ }
1835
+ else {
1836
+ let authoredAutoMargin = "";
1837
+ if (isFlowDimension(property)) {
1838
+ authoredFlowDimension = computed.getPropertyValue(AUTHORED_FLOW_DIMENSION_MIRRORS[property]).trim();
1839
+ }
1840
+ if (isAutoMargin(property)) {
1841
+ authoredAutoMargin = computed.getPropertyValue(AUTHORED_AUTO_MARGIN_MIRRORS[property]).trim();
1842
+ }
1843
+ if (options.layoutContext === "page" && authoredAutoMargin === "auto") {
1844
+ value = "auto";
1845
+ }
1846
+ else if (authoredFlowDimension.endsWith("%")) {
1847
+ value = authoredFlowDimension;
1848
+ }
1849
+ else if (authoredInsets && property in authoredInsets) {
1850
+ value = authoredInsets[property];
1851
+ }
1852
+ }
1834
1853
  if (isFlowDimension(property)) {
1835
1854
  if (authoredFlowDimension === "auto" || !shouldMaterializeFlowDimension(original, property, isSnapshotRoot, options.layoutContext))
1836
1855
  continue;