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.cjs CHANGED
@@ -443,7 +443,13 @@ var supportedCssProperties = /* @__PURE__ */ new Set([
443
443
  "min-width",
444
444
  "max-width",
445
445
  "height",
446
+ "min-height",
447
+ "max-height",
446
448
  "aspect-ratio",
449
+ "align-self",
450
+ "flex-wrap",
451
+ "opacity",
452
+ "letter-spacing",
447
453
  "margin",
448
454
  "margin-block",
449
455
  "margin-inline",
@@ -767,6 +773,31 @@ function applyDeclaration(out, property, rawValue, fontSize) {
767
773
  case "height":
768
774
  out.height = parseLength(value, fontSize);
769
775
  break;
776
+ case "min-height":
777
+ out.minHeight = parseLength(value, fontSize);
778
+ break;
779
+ case "max-height":
780
+ out.maxHeight = parseLength(value, fontSize);
781
+ break;
782
+ case "align-self":
783
+ if (value === "flex-start") out.alignSelf = "start";
784
+ else if (value === "flex-end") out.alignSelf = "end";
785
+ else if (["start", "center", "end", "stretch", "baseline"].includes(value)) {
786
+ out.alignSelf = value;
787
+ }
788
+ break;
789
+ case "flex-wrap":
790
+ if (value === "wrap") out.flexWrap = "wrap";
791
+ else if (value === "nowrap") out.flexWrap = "nowrap";
792
+ break;
793
+ case "opacity": {
794
+ const n = Number(value);
795
+ if (Number.isFinite(n)) out.opacity = Math.max(0, Math.min(1, n));
796
+ break;
797
+ }
798
+ case "letter-spacing":
799
+ if (value !== "normal") out.letterSpacing = parseLength(value, fontSize);
800
+ break;
770
801
  case "aspect-ratio":
771
802
  out.aspectRatio = parseAspectRatio(value);
772
803
  break;
@@ -1596,6 +1627,8 @@ function renderBlock(node, options, warnings, stretch = node.style.display === "
1596
1627
  {
1597
1628
  width: cssBoxWidth(node),
1598
1629
  height: cssBoxHeight(node),
1630
+ minHeight: node.style.minHeight,
1631
+ maxHeight: node.style.maxHeight,
1599
1632
  margin: node.style.margin,
1600
1633
  padding: layoutPadding(node),
1601
1634
  gap: node.style.gap ?? 0,
@@ -1611,6 +1644,8 @@ function renderBlock(node, options, warnings, stretch = node.style.display === "
1611
1644
  bottom: node.style.bottom,
1612
1645
  left: node.style.left,
1613
1646
  zIndex: node.style.zIndex,
1647
+ opacity: node.style.opacity,
1648
+ alignSelf: node.style.alignSelf,
1614
1649
  align: stretch ? "stretch" : "start"
1615
1650
  },
1616
1651
  ...children
@@ -1710,11 +1745,14 @@ function renderFlex(node, options, warnings) {
1710
1745
  const style = {
1711
1746
  width,
1712
1747
  height: cssBoxHeight(node),
1748
+ minHeight: node.style.minHeight,
1749
+ maxHeight: node.style.maxHeight,
1713
1750
  margin: node.style.margin,
1714
1751
  padding: layoutPadding(node),
1715
1752
  gap: node.style.gap ?? 0,
1716
1753
  align: node.style.alignItems,
1717
1754
  justify: children.justify,
1755
+ wrap: node.style.flexWrap === "wrap",
1718
1756
  background: node.style.background,
1719
1757
  backgroundImage: backgroundImage(node, options),
1720
1758
  border: border(node),
@@ -1726,7 +1764,9 @@ function renderFlex(node, options, warnings) {
1726
1764
  right: node.style.right,
1727
1765
  bottom: node.style.bottom,
1728
1766
  left: node.style.left,
1729
- zIndex: node.style.zIndex
1767
+ zIndex: node.style.zIndex,
1768
+ opacity: node.style.opacity,
1769
+ alignSelf: node.style.alignSelf
1730
1770
  };
1731
1771
  return node.style.flexDirection.startsWith("row") ? (0, import_boxpdf.hstack)(style, ...children.nodes) : (0, import_boxpdf.vstack)(style, ...children.nodes);
1732
1772
  }
@@ -1768,6 +1808,8 @@ function renderGrid(node, options, warnings) {
1768
1808
  {
1769
1809
  width: cssBoxWidth(node),
1770
1810
  height: cssBoxHeight(node),
1811
+ minHeight: node.style.minHeight,
1812
+ maxHeight: node.style.maxHeight,
1771
1813
  margin: node.style.margin,
1772
1814
  padding: layoutPadding(node),
1773
1815
  gap: node.style.rowGap ?? node.style.gap ?? 0,
@@ -1782,7 +1824,9 @@ function renderGrid(node, options, warnings) {
1782
1824
  right: node.style.right,
1783
1825
  bottom: node.style.bottom,
1784
1826
  left: node.style.left,
1785
- zIndex: node.style.zIndex
1827
+ zIndex: node.style.zIndex,
1828
+ opacity: node.style.opacity,
1829
+ alignSelf: node.style.alignSelf
1786
1830
  },
1787
1831
  ...rows
1788
1832
  );
@@ -2310,7 +2354,8 @@ function textOptions(node, options) {
2310
2354
  width: node.style.width,
2311
2355
  wrap: shouldWrap(node.style),
2312
2356
  align: node.style.textAlign,
2313
- margin: node.style.margin
2357
+ margin: node.style.margin,
2358
+ opacity: node.style.opacity
2314
2359
  };
2315
2360
  }
2316
2361
  function runStyle(node, options) {
@@ -2320,7 +2365,8 @@ function runStyle(node, options) {
2320
2365
  color: node.style.color ?? options.defaultColor,
2321
2366
  lineHeight: node.style.lineHeight,
2322
2367
  underline: node.style.textDecorationLine === "underline",
2323
- strikethrough: node.style.textDecorationLine === "line-through"
2368
+ strikethrough: node.style.textDecorationLine === "line-through",
2369
+ letterSpacing: node.style.letterSpacing
2324
2370
  };
2325
2371
  }
2326
2372
  function fontFor(node, options) {
@@ -2479,7 +2525,13 @@ function defaultsForTag(tag, inherited) {
2479
2525
  maxWidthPercent: void 0,
2480
2526
  maxWidthCalc: void 0,
2481
2527
  height: void 0,
2528
+ minHeight: void 0,
2529
+ maxHeight: void 0,
2482
2530
  aspectRatio: void 0,
2531
+ alignSelf: void 0,
2532
+ flexWrap: void 0,
2533
+ opacity: void 0,
2534
+ letterSpacing: void 0,
2483
2535
  position: void 0,
2484
2536
  top: void 0,
2485
2537
  right: void 0,
@@ -2561,13 +2613,22 @@ function inherit(style) {
2561
2613
  maxWidthPercent: void 0,
2562
2614
  maxWidthCalc: void 0,
2563
2615
  height: void 0,
2616
+ minHeight: void 0,
2617
+ maxHeight: void 0,
2564
2618
  aspectRatio: void 0,
2619
+ alignSelf: void 0,
2620
+ flexWrap: void 0,
2621
+ opacity: void 0,
2565
2622
  position: void 0,
2566
2623
  top: void 0,
2567
2624
  right: void 0,
2568
2625
  bottom: void 0,
2569
2626
  left: void 0,
2570
2627
  zIndex: void 0,
2628
+ flexDirection: "row",
2629
+ alignItems: "stretch",
2630
+ justifyContent: "start",
2631
+ gap: void 0,
2571
2632
  columnGap: void 0,
2572
2633
  rowGap: void 0,
2573
2634
  gridTemplateColumns: void 0,