@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microlee666/dom-to-pptx",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "A client-side library that converts any HTML element into a fully editable PowerPoint slide. **dom-to-pptx** transforms DOM structures into pixel-accurate `.pptx` content, preserving gradients, shadows, rounded images, and responsive layouts. It translates CSS Flexbox/Grid, linear-gradients, box-shadows, and typography into native PowerPoint shapes, enabling precise, design-faithful slide generation directly from the browser.",
|
|
5
5
|
"main": "dist/dom-to-pptx.cjs",
|
|
6
6
|
"module": "dist/dom-to-pptx.mjs",
|
package/src/index.js
CHANGED
|
@@ -1191,16 +1191,36 @@ function prepareRenderItem(
|
|
|
1191
1191
|
const className = (node.className || '').toLowerCase();
|
|
1192
1192
|
|
|
1193
1193
|
// Real badges/pills typically have visible styling (background, border, or large border-radius)
|
|
1194
|
-
const hasVisibleBackground = bgColorObj.hex && bgColorObj.opacity > 0.1;
|
|
1194
|
+
const hasVisibleBackground = (bgColorObj.hex && bgColorObj.opacity > 0.1) || hasGradient;
|
|
1195
1195
|
const hasVisibleBorder = borderWidth > 0;
|
|
1196
1196
|
const hasLargeBorderRadius = borderRadius >= height / 2;
|
|
1197
|
-
const hasBadgeClass = className.includes('badge') || className.includes('pill');
|
|
1197
|
+
const hasBadgeClass = className.includes('badge') || className.includes('pill') || className.includes('tag');
|
|
1198
|
+
|
|
1199
|
+
// Check if it's a small tag/label with rounded corners and short text
|
|
1200
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
1201
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
1202
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
1203
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
1204
|
+
const hasSmallPadding = Math.max(paddingLeft, paddingRight, paddingTop, paddingBottom) <= 12;
|
|
1205
|
+
const hasEvenPadding = Math.abs(paddingTop - paddingBottom) <= 4 && Math.abs(paddingLeft - paddingRight) <= 8;
|
|
1206
|
+
const hasRoundedCorners = borderRadius >= 3;
|
|
1207
|
+
const isInlineBlock = style.display === 'inline-block' || style.display === 'inline-flex';
|
|
1208
|
+
|
|
1209
|
+
// Small tag detection: inline-block with background, rounded corners, small even padding, and short text
|
|
1210
|
+
const isSmallTag =
|
|
1211
|
+
isInlineBlock &&
|
|
1212
|
+
hasVisibleBackground &&
|
|
1213
|
+
hasRoundedCorners &&
|
|
1214
|
+
hasSmallPadding &&
|
|
1215
|
+
hasEvenPadding &&
|
|
1216
|
+
textContent.length <= 10;
|
|
1198
1217
|
|
|
1199
1218
|
// Only consider it a badge if it has visual styling AND short text
|
|
1200
1219
|
const isLikelyBadge =
|
|
1201
|
-
(hasLargeBorderRadius || hasBadgeClass) &&
|
|
1202
|
-
|
|
1203
|
-
|
|
1220
|
+
((hasLargeBorderRadius || hasBadgeClass) &&
|
|
1221
|
+
textContent.length <= 10 &&
|
|
1222
|
+
(hasVisibleBackground || hasVisibleBorder || hasLargeBorderRadius)) ||
|
|
1223
|
+
isSmallTag;
|
|
1204
1224
|
|
|
1205
1225
|
if (isLikelyBadge) {
|
|
1206
1226
|
align = 'center';
|