boxpdf-html 1.0.0 → 1.1.1

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/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  fontFamily,
4
4
  htmlToBoxpdf
5
- } from "./chunk-23KN7BKZ.js";
5
+ } from "./chunk-PGLA67N2.js";
6
6
 
7
7
  // src/cli.ts
8
8
  import { existsSync, readFileSync, writeFileSync } from "fs";
package/dist/index.cjs CHANGED
@@ -462,7 +462,13 @@ var supportedCssProperties = /* @__PURE__ */ new Set([
462
462
  "min-width",
463
463
  "max-width",
464
464
  "height",
465
+ "min-height",
466
+ "max-height",
465
467
  "aspect-ratio",
468
+ "align-self",
469
+ "flex-wrap",
470
+ "opacity",
471
+ "letter-spacing",
466
472
  "margin",
467
473
  "margin-block",
468
474
  "margin-inline",
@@ -786,6 +792,31 @@ function applyDeclaration(out, property, rawValue, fontSize) {
786
792
  case "height":
787
793
  out.height = parseLength(value, fontSize);
788
794
  break;
795
+ case "min-height":
796
+ out.minHeight = parseLength(value, fontSize);
797
+ break;
798
+ case "max-height":
799
+ out.maxHeight = parseLength(value, fontSize);
800
+ break;
801
+ case "align-self":
802
+ if (value === "flex-start") out.alignSelf = "start";
803
+ else if (value === "flex-end") out.alignSelf = "end";
804
+ else if (["start", "center", "end", "stretch", "baseline"].includes(value)) {
805
+ out.alignSelf = value;
806
+ }
807
+ break;
808
+ case "flex-wrap":
809
+ if (value === "wrap") out.flexWrap = "wrap";
810
+ else if (value === "nowrap") out.flexWrap = "nowrap";
811
+ break;
812
+ case "opacity": {
813
+ const n = Number(value);
814
+ if (Number.isFinite(n)) out.opacity = Math.max(0, Math.min(1, n));
815
+ break;
816
+ }
817
+ case "letter-spacing":
818
+ if (value !== "normal") out.letterSpacing = parseLength(value, fontSize);
819
+ break;
789
820
  case "aspect-ratio":
790
821
  out.aspectRatio = parseAspectRatio(value);
791
822
  break;
@@ -1615,6 +1646,8 @@ function renderBlock(node, options, warnings, stretch = node.style.display === "
1615
1646
  {
1616
1647
  width: cssBoxWidth(node),
1617
1648
  height: cssBoxHeight(node),
1649
+ minHeight: node.style.minHeight,
1650
+ maxHeight: node.style.maxHeight,
1618
1651
  margin: node.style.margin,
1619
1652
  padding: layoutPadding(node),
1620
1653
  gap: node.style.gap ?? 0,
@@ -1630,6 +1663,8 @@ function renderBlock(node, options, warnings, stretch = node.style.display === "
1630
1663
  bottom: node.style.bottom,
1631
1664
  left: node.style.left,
1632
1665
  zIndex: node.style.zIndex,
1666
+ opacity: node.style.opacity,
1667
+ alignSelf: node.style.alignSelf,
1633
1668
  align: stretch ? "stretch" : "start"
1634
1669
  },
1635
1670
  ...children
@@ -1729,11 +1764,14 @@ function renderFlex(node, options, warnings) {
1729
1764
  const style = {
1730
1765
  width,
1731
1766
  height: cssBoxHeight(node),
1767
+ minHeight: node.style.minHeight,
1768
+ maxHeight: node.style.maxHeight,
1732
1769
  margin: node.style.margin,
1733
1770
  padding: layoutPadding(node),
1734
1771
  gap: node.style.gap ?? 0,
1735
1772
  align: node.style.alignItems,
1736
1773
  justify: children.justify,
1774
+ wrap: node.style.flexWrap === "wrap",
1737
1775
  background: node.style.background,
1738
1776
  backgroundImage: backgroundImage(node, options),
1739
1777
  border: border(node),
@@ -1745,7 +1783,9 @@ function renderFlex(node, options, warnings) {
1745
1783
  right: node.style.right,
1746
1784
  bottom: node.style.bottom,
1747
1785
  left: node.style.left,
1748
- zIndex: node.style.zIndex
1786
+ zIndex: node.style.zIndex,
1787
+ opacity: node.style.opacity,
1788
+ alignSelf: node.style.alignSelf
1749
1789
  };
1750
1790
  return node.style.flexDirection.startsWith("row") ? (0, import_boxpdf.hstack)(style, ...children.nodes) : (0, import_boxpdf.vstack)(style, ...children.nodes);
1751
1791
  }
@@ -1787,6 +1827,8 @@ function renderGrid(node, options, warnings) {
1787
1827
  {
1788
1828
  width: cssBoxWidth(node),
1789
1829
  height: cssBoxHeight(node),
1830
+ minHeight: node.style.minHeight,
1831
+ maxHeight: node.style.maxHeight,
1790
1832
  margin: node.style.margin,
1791
1833
  padding: layoutPadding(node),
1792
1834
  gap: node.style.rowGap ?? node.style.gap ?? 0,
@@ -1801,7 +1843,9 @@ function renderGrid(node, options, warnings) {
1801
1843
  right: node.style.right,
1802
1844
  bottom: node.style.bottom,
1803
1845
  left: node.style.left,
1804
- zIndex: node.style.zIndex
1846
+ zIndex: node.style.zIndex,
1847
+ opacity: node.style.opacity,
1848
+ alignSelf: node.style.alignSelf
1805
1849
  },
1806
1850
  ...rows
1807
1851
  );
@@ -2329,7 +2373,8 @@ function textOptions(node, options) {
2329
2373
  width: node.style.width,
2330
2374
  wrap: shouldWrap(node.style),
2331
2375
  align: node.style.textAlign,
2332
- margin: node.style.margin
2376
+ margin: node.style.margin,
2377
+ opacity: node.style.opacity
2333
2378
  };
2334
2379
  }
2335
2380
  function runStyle(node, options) {
@@ -2339,7 +2384,8 @@ function runStyle(node, options) {
2339
2384
  color: node.style.color ?? options.defaultColor,
2340
2385
  lineHeight: node.style.lineHeight,
2341
2386
  underline: node.style.textDecorationLine === "underline",
2342
- strikethrough: node.style.textDecorationLine === "line-through"
2387
+ strikethrough: node.style.textDecorationLine === "line-through",
2388
+ letterSpacing: node.style.letterSpacing
2343
2389
  };
2344
2390
  }
2345
2391
  function fontFor(node, options) {
@@ -2498,7 +2544,13 @@ function defaultsForTag(tag, inherited) {
2498
2544
  maxWidthPercent: void 0,
2499
2545
  maxWidthCalc: void 0,
2500
2546
  height: void 0,
2547
+ minHeight: void 0,
2548
+ maxHeight: void 0,
2501
2549
  aspectRatio: void 0,
2550
+ alignSelf: void 0,
2551
+ flexWrap: void 0,
2552
+ opacity: void 0,
2553
+ letterSpacing: void 0,
2502
2554
  position: void 0,
2503
2555
  top: void 0,
2504
2556
  right: void 0,
@@ -2580,13 +2632,22 @@ function inherit(style) {
2580
2632
  maxWidthPercent: void 0,
2581
2633
  maxWidthCalc: void 0,
2582
2634
  height: void 0,
2635
+ minHeight: void 0,
2636
+ maxHeight: void 0,
2583
2637
  aspectRatio: void 0,
2638
+ alignSelf: void 0,
2639
+ flexWrap: void 0,
2640
+ opacity: void 0,
2584
2641
  position: void 0,
2585
2642
  top: void 0,
2586
2643
  right: void 0,
2587
2644
  bottom: void 0,
2588
2645
  left: void 0,
2589
2646
  zIndex: void 0,
2647
+ flexDirection: "row",
2648
+ alignItems: "stretch",
2649
+ justifyContent: "start",
2650
+ gap: void 0,
2590
2651
  columnGap: void 0,
2591
2652
  rowGap: void 0,
2592
2653
  gridTemplateColumns: void 0,