@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
|
@@ -64963,16 +64963,36 @@
|
|
|
64963
64963
|
const className = (node.className || '').toLowerCase();
|
|
64964
64964
|
|
|
64965
64965
|
// Real badges/pills typically have visible styling (background, border, or large border-radius)
|
|
64966
|
-
const hasVisibleBackground = bgColorObj.hex && bgColorObj.opacity > 0.1;
|
|
64966
|
+
const hasVisibleBackground = (bgColorObj.hex && bgColorObj.opacity > 0.1) || hasGradient;
|
|
64967
64967
|
const hasVisibleBorder = borderWidth > 0;
|
|
64968
64968
|
const hasLargeBorderRadius = borderRadius >= height / 2;
|
|
64969
|
-
const hasBadgeClass = className.includes('badge') || className.includes('pill');
|
|
64969
|
+
const hasBadgeClass = className.includes('badge') || className.includes('pill') || className.includes('tag');
|
|
64970
|
+
|
|
64971
|
+
// Check if it's a small tag/label with rounded corners and short text
|
|
64972
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
64973
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
64974
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
64975
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
64976
|
+
const hasSmallPadding = Math.max(paddingLeft, paddingRight, paddingTop, paddingBottom) <= 12;
|
|
64977
|
+
const hasEvenPadding = Math.abs(paddingTop - paddingBottom) <= 4 && Math.abs(paddingLeft - paddingRight) <= 8;
|
|
64978
|
+
const hasRoundedCorners = borderRadius >= 3;
|
|
64979
|
+
const isInlineBlock = style.display === 'inline-block' || style.display === 'inline-flex';
|
|
64980
|
+
|
|
64981
|
+
// Small tag detection: inline-block with background, rounded corners, small even padding, and short text
|
|
64982
|
+
const isSmallTag =
|
|
64983
|
+
isInlineBlock &&
|
|
64984
|
+
hasVisibleBackground &&
|
|
64985
|
+
hasRoundedCorners &&
|
|
64986
|
+
hasSmallPadding &&
|
|
64987
|
+
hasEvenPadding &&
|
|
64988
|
+
textContent.length <= 10;
|
|
64970
64989
|
|
|
64971
64990
|
// Only consider it a badge if it has visual styling AND short text
|
|
64972
64991
|
const isLikelyBadge =
|
|
64973
|
-
(hasLargeBorderRadius || hasBadgeClass) &&
|
|
64974
|
-
|
|
64975
|
-
|
|
64992
|
+
((hasLargeBorderRadius || hasBadgeClass) &&
|
|
64993
|
+
textContent.length <= 10 &&
|
|
64994
|
+
(hasVisibleBackground || hasVisibleBorder || hasLargeBorderRadius)) ||
|
|
64995
|
+
isSmallTag;
|
|
64976
64996
|
|
|
64977
64997
|
if (isLikelyBadge) {
|
|
64978
64998
|
align = 'center';
|
|
@@ -64963,16 +64963,36 @@
|
|
|
64963
64963
|
const className = (node.className || '').toLowerCase();
|
|
64964
64964
|
|
|
64965
64965
|
// Real badges/pills typically have visible styling (background, border, or large border-radius)
|
|
64966
|
-
const hasVisibleBackground = bgColorObj.hex && bgColorObj.opacity > 0.1;
|
|
64966
|
+
const hasVisibleBackground = (bgColorObj.hex && bgColorObj.opacity > 0.1) || hasGradient;
|
|
64967
64967
|
const hasVisibleBorder = borderWidth > 0;
|
|
64968
64968
|
const hasLargeBorderRadius = borderRadius >= height / 2;
|
|
64969
|
-
const hasBadgeClass = className.includes('badge') || className.includes('pill');
|
|
64969
|
+
const hasBadgeClass = className.includes('badge') || className.includes('pill') || className.includes('tag');
|
|
64970
|
+
|
|
64971
|
+
// Check if it's a small tag/label with rounded corners and short text
|
|
64972
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
64973
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
64974
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
64975
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
64976
|
+
const hasSmallPadding = Math.max(paddingLeft, paddingRight, paddingTop, paddingBottom) <= 12;
|
|
64977
|
+
const hasEvenPadding = Math.abs(paddingTop - paddingBottom) <= 4 && Math.abs(paddingLeft - paddingRight) <= 8;
|
|
64978
|
+
const hasRoundedCorners = borderRadius >= 3;
|
|
64979
|
+
const isInlineBlock = style.display === 'inline-block' || style.display === 'inline-flex';
|
|
64980
|
+
|
|
64981
|
+
// Small tag detection: inline-block with background, rounded corners, small even padding, and short text
|
|
64982
|
+
const isSmallTag =
|
|
64983
|
+
isInlineBlock &&
|
|
64984
|
+
hasVisibleBackground &&
|
|
64985
|
+
hasRoundedCorners &&
|
|
64986
|
+
hasSmallPadding &&
|
|
64987
|
+
hasEvenPadding &&
|
|
64988
|
+
textContent.length <= 10;
|
|
64970
64989
|
|
|
64971
64990
|
// Only consider it a badge if it has visual styling AND short text
|
|
64972
64991
|
const isLikelyBadge =
|
|
64973
|
-
(hasLargeBorderRadius || hasBadgeClass) &&
|
|
64974
|
-
|
|
64975
|
-
|
|
64992
|
+
((hasLargeBorderRadius || hasBadgeClass) &&
|
|
64993
|
+
textContent.length <= 10 &&
|
|
64994
|
+
(hasVisibleBackground || hasVisibleBorder || hasLargeBorderRadius)) ||
|
|
64995
|
+
isSmallTag;
|
|
64976
64996
|
|
|
64977
64997
|
if (isLikelyBadge) {
|
|
64978
64998
|
align = 'center';
|
package/dist/dom-to-pptx.cjs
CHANGED
|
@@ -2781,16 +2781,36 @@ function prepareRenderItem(
|
|
|
2781
2781
|
const className = (node.className || '').toLowerCase();
|
|
2782
2782
|
|
|
2783
2783
|
// Real badges/pills typically have visible styling (background, border, or large border-radius)
|
|
2784
|
-
const hasVisibleBackground = bgColorObj.hex && bgColorObj.opacity > 0.1;
|
|
2784
|
+
const hasVisibleBackground = (bgColorObj.hex && bgColorObj.opacity > 0.1) || hasGradient;
|
|
2785
2785
|
const hasVisibleBorder = borderWidth > 0;
|
|
2786
2786
|
const hasLargeBorderRadius = borderRadius >= height / 2;
|
|
2787
|
-
const hasBadgeClass = className.includes('badge') || className.includes('pill');
|
|
2787
|
+
const hasBadgeClass = className.includes('badge') || className.includes('pill') || className.includes('tag');
|
|
2788
|
+
|
|
2789
|
+
// Check if it's a small tag/label with rounded corners and short text
|
|
2790
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
2791
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
2792
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
2793
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
2794
|
+
const hasSmallPadding = Math.max(paddingLeft, paddingRight, paddingTop, paddingBottom) <= 12;
|
|
2795
|
+
const hasEvenPadding = Math.abs(paddingTop - paddingBottom) <= 4 && Math.abs(paddingLeft - paddingRight) <= 8;
|
|
2796
|
+
const hasRoundedCorners = borderRadius >= 3;
|
|
2797
|
+
const isInlineBlock = style.display === 'inline-block' || style.display === 'inline-flex';
|
|
2798
|
+
|
|
2799
|
+
// Small tag detection: inline-block with background, rounded corners, small even padding, and short text
|
|
2800
|
+
const isSmallTag =
|
|
2801
|
+
isInlineBlock &&
|
|
2802
|
+
hasVisibleBackground &&
|
|
2803
|
+
hasRoundedCorners &&
|
|
2804
|
+
hasSmallPadding &&
|
|
2805
|
+
hasEvenPadding &&
|
|
2806
|
+
textContent.length <= 10;
|
|
2788
2807
|
|
|
2789
2808
|
// Only consider it a badge if it has visual styling AND short text
|
|
2790
2809
|
const isLikelyBadge =
|
|
2791
|
-
(hasLargeBorderRadius || hasBadgeClass) &&
|
|
2792
|
-
|
|
2793
|
-
|
|
2810
|
+
((hasLargeBorderRadius || hasBadgeClass) &&
|
|
2811
|
+
textContent.length <= 10 &&
|
|
2812
|
+
(hasVisibleBackground || hasVisibleBorder || hasLargeBorderRadius)) ||
|
|
2813
|
+
isSmallTag;
|
|
2794
2814
|
|
|
2795
2815
|
if (isLikelyBadge) {
|
|
2796
2816
|
align = 'center';
|