@microlee666/dom-to-pptx 1.1.5 → 1.1.6
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/.claude/settings.local.json +2 -1
- package/cli/dom-to-pptx.bundle.js +25 -5
- package/dist/dom-to-pptx.bundle.js +25 -5
- package/dist/dom-to-pptx.cjs +25 -5
- package/dist/dom-to-pptx.cjs.map +1 -1
- package/dist/dom-to-pptx.mjs +25 -5
- package/dist/dom-to-pptx.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.js +25 -5
package/dist/dom-to-pptx.mjs
CHANGED
|
@@ -2751,16 +2751,36 @@ function prepareRenderItem(
|
|
|
2751
2751
|
const className = (node.className || '').toLowerCase();
|
|
2752
2752
|
|
|
2753
2753
|
// Real badges/pills typically have visible styling (background, border, or large border-radius)
|
|
2754
|
-
const hasVisibleBackground = bgColorObj.hex && bgColorObj.opacity > 0.1;
|
|
2754
|
+
const hasVisibleBackground = (bgColorObj.hex && bgColorObj.opacity > 0.1) || hasGradient;
|
|
2755
2755
|
const hasVisibleBorder = borderWidth > 0;
|
|
2756
2756
|
const hasLargeBorderRadius = borderRadius >= height / 2;
|
|
2757
|
-
const hasBadgeClass = className.includes('badge') || className.includes('pill');
|
|
2757
|
+
const hasBadgeClass = className.includes('badge') || className.includes('pill') || className.includes('tag');
|
|
2758
|
+
|
|
2759
|
+
// Check if it's a small tag/label with rounded corners and short text
|
|
2760
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
2761
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
2762
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
2763
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
2764
|
+
const hasSmallPadding = Math.max(paddingLeft, paddingRight, paddingTop, paddingBottom) <= 12;
|
|
2765
|
+
const hasEvenPadding = Math.abs(paddingTop - paddingBottom) <= 4 && Math.abs(paddingLeft - paddingRight) <= 8;
|
|
2766
|
+
const hasRoundedCorners = borderRadius >= 3;
|
|
2767
|
+
const isInlineBlock = style.display === 'inline-block' || style.display === 'inline-flex';
|
|
2768
|
+
|
|
2769
|
+
// Small tag detection: inline-block with background, rounded corners, small even padding, and short text
|
|
2770
|
+
const isSmallTag =
|
|
2771
|
+
isInlineBlock &&
|
|
2772
|
+
hasVisibleBackground &&
|
|
2773
|
+
hasRoundedCorners &&
|
|
2774
|
+
hasSmallPadding &&
|
|
2775
|
+
hasEvenPadding &&
|
|
2776
|
+
textContent.length <= 10;
|
|
2758
2777
|
|
|
2759
2778
|
// Only consider it a badge if it has visual styling AND short text
|
|
2760
2779
|
const isLikelyBadge =
|
|
2761
|
-
(hasLargeBorderRadius || hasBadgeClass) &&
|
|
2762
|
-
|
|
2763
|
-
|
|
2780
|
+
((hasLargeBorderRadius || hasBadgeClass) &&
|
|
2781
|
+
textContent.length <= 10 &&
|
|
2782
|
+
(hasVisibleBackground || hasVisibleBorder || hasLargeBorderRadius)) ||
|
|
2783
|
+
isSmallTag;
|
|
2764
2784
|
|
|
2765
2785
|
if (isLikelyBadge) {
|
|
2766
2786
|
align = 'center';
|