docgen-utils 1.0.31 → 1.0.32
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/bundle.js +88 -239
- package/dist/bundle.min.js +107 -107
- package/dist/cli.js +6165 -82
- package/dist/packages/cli/commands/export-slides.d.ts +4 -9
- package/dist/packages/cli/commands/export-slides.d.ts.map +1 -1
- package/dist/packages/cli/commands/export-slides.js +233 -100
- package/dist/packages/cli/commands/export-slides.js.map +1 -1
- package/dist/packages/slides/convert.d.ts +2 -0
- package/dist/packages/slides/convert.d.ts.map +1 -1
- package/dist/packages/slides/convert.js +36 -28
- package/dist/packages/slides/convert.js.map +1 -1
- package/dist/packages/slides/createPresentation.d.ts.map +1 -1
- package/dist/packages/slides/createPresentation.js +18 -18
- package/dist/packages/slides/createPresentation.js.map +1 -1
- package/dist/packages/slides/parse.d.ts.map +1 -1
- package/dist/packages/slides/parse.js +8 -211
- package/dist/packages/slides/parse.js.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -65537,22 +65537,6 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
65537
65537
|
return void 0;
|
|
65538
65538
|
return parsed;
|
|
65539
65539
|
}
|
|
65540
|
-
function getEffectiveZIndex(element, win) {
|
|
65541
|
-
let current = element;
|
|
65542
|
-
while (current && current !== win.document.body && current !== win.document.documentElement) {
|
|
65543
|
-
const computed = win.getComputedStyle(current);
|
|
65544
|
-
const position = computed.position;
|
|
65545
|
-
const isPositioned = position === "absolute" || position === "relative" || position === "fixed" || position === "sticky";
|
|
65546
|
-
if (isPositioned) {
|
|
65547
|
-
const zIndex = extractZIndex(computed);
|
|
65548
|
-
if (zIndex !== void 0) {
|
|
65549
|
-
return zIndex;
|
|
65550
|
-
}
|
|
65551
|
-
}
|
|
65552
|
-
current = current.parentElement;
|
|
65553
|
-
}
|
|
65554
|
-
return void 0;
|
|
65555
|
-
}
|
|
65556
65540
|
function getEffectiveOpacity(element, win) {
|
|
65557
65541
|
let effectiveOpacity = 1;
|
|
65558
65542
|
let current = element;
|
|
@@ -67449,7 +67433,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67449
67433
|
cssTriangle: null,
|
|
67450
67434
|
customGeometry: null
|
|
67451
67435
|
},
|
|
67452
|
-
zIndex:
|
|
67436
|
+
zIndex: extractZIndex(computed2)
|
|
67453
67437
|
};
|
|
67454
67438
|
elements.push(shapeElement);
|
|
67455
67439
|
if (hasBorder && !hasUniformBorder) {
|
|
@@ -67531,8 +67515,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67531
67515
|
rotate: null,
|
|
67532
67516
|
cssTriangle: null,
|
|
67533
67517
|
customGeometry: points
|
|
67534
|
-
}
|
|
67535
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67518
|
+
}
|
|
67536
67519
|
};
|
|
67537
67520
|
elements.push(borderLeftShape);
|
|
67538
67521
|
} else {
|
|
@@ -67560,8 +67543,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67560
67543
|
rotate: null,
|
|
67561
67544
|
cssTriangle: null,
|
|
67562
67545
|
customGeometry: null
|
|
67563
|
-
}
|
|
67564
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67546
|
+
}
|
|
67565
67547
|
};
|
|
67566
67548
|
elements.push(borderLeftShape);
|
|
67567
67549
|
}
|
|
@@ -67632,8 +67614,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67632
67614
|
rotate: null,
|
|
67633
67615
|
cssTriangle: null,
|
|
67634
67616
|
customGeometry: points
|
|
67635
|
-
}
|
|
67636
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67617
|
+
}
|
|
67637
67618
|
};
|
|
67638
67619
|
elements.push(borderRightShape);
|
|
67639
67620
|
} else {
|
|
@@ -67661,8 +67642,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67661
67642
|
rotate: null,
|
|
67662
67643
|
cssTriangle: null,
|
|
67663
67644
|
customGeometry: null
|
|
67664
|
-
}
|
|
67665
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67645
|
+
}
|
|
67666
67646
|
};
|
|
67667
67647
|
elements.push(borderRightShape);
|
|
67668
67648
|
}
|
|
@@ -67737,8 +67717,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67737
67717
|
rotate: null,
|
|
67738
67718
|
cssTriangle: null,
|
|
67739
67719
|
customGeometry: points
|
|
67740
|
-
}
|
|
67741
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67720
|
+
}
|
|
67742
67721
|
};
|
|
67743
67722
|
elements.push(borderTopShape);
|
|
67744
67723
|
} else {
|
|
@@ -67766,8 +67745,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67766
67745
|
rotate: null,
|
|
67767
67746
|
cssTriangle: null,
|
|
67768
67747
|
customGeometry: null
|
|
67769
|
-
}
|
|
67770
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67748
|
+
}
|
|
67771
67749
|
};
|
|
67772
67750
|
elements.push(borderTopShape);
|
|
67773
67751
|
}
|
|
@@ -67837,8 +67815,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67837
67815
|
rotate: null,
|
|
67838
67816
|
cssTriangle: null,
|
|
67839
67817
|
customGeometry: points
|
|
67840
|
-
}
|
|
67841
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67818
|
+
}
|
|
67842
67819
|
};
|
|
67843
67820
|
elements.push(borderBottomShape);
|
|
67844
67821
|
} else {
|
|
@@ -67866,8 +67843,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67866
67843
|
rotate: null,
|
|
67867
67844
|
cssTriangle: null,
|
|
67868
67845
|
customGeometry: null
|
|
67869
|
-
}
|
|
67870
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
67846
|
+
}
|
|
67871
67847
|
};
|
|
67872
67848
|
elements.push(borderBottomShape);
|
|
67873
67849
|
}
|
|
@@ -67964,7 +67940,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
67964
67940
|
cssTriangle: null,
|
|
67965
67941
|
customGeometry: null
|
|
67966
67942
|
},
|
|
67967
|
-
zIndex:
|
|
67943
|
+
zIndex: extractZIndex(computed2)
|
|
67968
67944
|
};
|
|
67969
67945
|
elements.push(shapeElement);
|
|
67970
67946
|
if (hasBorder && !hasUniformBorder) {
|
|
@@ -68046,8 +68022,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68046
68022
|
rotate: null,
|
|
68047
68023
|
cssTriangle: null,
|
|
68048
68024
|
customGeometry: points
|
|
68049
|
-
}
|
|
68050
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68025
|
+
}
|
|
68051
68026
|
};
|
|
68052
68027
|
elements.push(borderLeftShape);
|
|
68053
68028
|
} else {
|
|
@@ -68075,8 +68050,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68075
68050
|
rotate: null,
|
|
68076
68051
|
cssTriangle: null,
|
|
68077
68052
|
customGeometry: null
|
|
68078
|
-
}
|
|
68079
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68053
|
+
}
|
|
68080
68054
|
};
|
|
68081
68055
|
elements.push(borderLeftShape);
|
|
68082
68056
|
}
|
|
@@ -68147,8 +68121,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68147
68121
|
rotate: null,
|
|
68148
68122
|
cssTriangle: null,
|
|
68149
68123
|
customGeometry: points
|
|
68150
|
-
}
|
|
68151
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68124
|
+
}
|
|
68152
68125
|
};
|
|
68153
68126
|
elements.push(borderRightShape);
|
|
68154
68127
|
} else {
|
|
@@ -68176,8 +68149,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68176
68149
|
rotate: null,
|
|
68177
68150
|
cssTriangle: null,
|
|
68178
68151
|
customGeometry: null
|
|
68179
|
-
}
|
|
68180
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68152
|
+
}
|
|
68181
68153
|
};
|
|
68182
68154
|
elements.push(borderRightShape);
|
|
68183
68155
|
}
|
|
@@ -68252,8 +68224,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68252
68224
|
rotate: null,
|
|
68253
68225
|
cssTriangle: null,
|
|
68254
68226
|
customGeometry: points
|
|
68255
|
-
}
|
|
68256
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68227
|
+
}
|
|
68257
68228
|
};
|
|
68258
68229
|
elements.push(borderTopShape);
|
|
68259
68230
|
} else {
|
|
@@ -68281,8 +68252,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68281
68252
|
rotate: null,
|
|
68282
68253
|
cssTriangle: null,
|
|
68283
68254
|
customGeometry: null
|
|
68284
|
-
}
|
|
68285
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68255
|
+
}
|
|
68286
68256
|
};
|
|
68287
68257
|
elements.push(borderTopShape);
|
|
68288
68258
|
}
|
|
@@ -68432,8 +68402,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68432
68402
|
lineSpacing: lineHeightMultiplier2 * pxToPoints(computed22.fontSize),
|
|
68433
68403
|
fontFill: spanFontFill,
|
|
68434
68404
|
...extractAlpha(computed22.color) !== null ? { transparency: extractAlpha(computed22.color) } : {}
|
|
68435
|
-
}
|
|
68436
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68405
|
+
}
|
|
68437
68406
|
};
|
|
68438
68407
|
elements.push(textElement);
|
|
68439
68408
|
processed.add(el);
|
|
@@ -68591,10 +68560,6 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68591
68560
|
if (hasOpacity && !maskApplied) {
|
|
68592
68561
|
imageElement.transparency = Math.round((1 - imgOpacity) * 100);
|
|
68593
68562
|
}
|
|
68594
|
-
const imgZIndex = getEffectiveZIndex(el, win);
|
|
68595
|
-
if (imgZIndex !== void 0) {
|
|
68596
|
-
imageElement.zIndex = imgZIndex;
|
|
68597
|
-
}
|
|
68598
68563
|
elements.push(imageElement);
|
|
68599
68564
|
processed.add(el);
|
|
68600
68565
|
return;
|
|
@@ -68741,8 +68706,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68741
68706
|
h: displayH
|
|
68742
68707
|
},
|
|
68743
68708
|
sizing: null,
|
|
68744
|
-
transparency: svgEffectiveOpacity < 1 ? Math.round((1 - svgEffectiveOpacity) * 100) : void 0
|
|
68745
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68709
|
+
transparency: svgEffectiveOpacity < 1 ? Math.round((1 - svgEffectiveOpacity) * 100) : void 0
|
|
68746
68710
|
};
|
|
68747
68711
|
elements.push(imageElement);
|
|
68748
68712
|
processed.add(el);
|
|
@@ -68806,8 +68770,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68806
68770
|
w: pxToInch(rect2.width),
|
|
68807
68771
|
h: pxToInch(rect2.height)
|
|
68808
68772
|
},
|
|
68809
|
-
sizing: null
|
|
68810
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68773
|
+
sizing: null
|
|
68811
68774
|
};
|
|
68812
68775
|
elements.push(imageElement);
|
|
68813
68776
|
}
|
|
@@ -68840,8 +68803,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68840
68803
|
h: pxToInch(blurResult.h)
|
|
68841
68804
|
},
|
|
68842
68805
|
sizing: null,
|
|
68843
|
-
rectRadius: 0
|
|
68844
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68806
|
+
rectRadius: 0
|
|
68845
68807
|
};
|
|
68846
68808
|
elements.push(imgElement);
|
|
68847
68809
|
processed.add(el);
|
|
@@ -68871,8 +68833,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68871
68833
|
h: pxToInch(rect2.height)
|
|
68872
68834
|
},
|
|
68873
68835
|
sizing: null,
|
|
68874
|
-
rectRadius: 0
|
|
68875
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68836
|
+
rectRadius: 0
|
|
68876
68837
|
};
|
|
68877
68838
|
elements.push(imgElement);
|
|
68878
68839
|
hasConicGradientImage = true;
|
|
@@ -68946,8 +68907,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68946
68907
|
rotate: triRotation,
|
|
68947
68908
|
cssTriangle: { direction: triangleDirection },
|
|
68948
68909
|
customGeometry: null
|
|
68949
|
-
}
|
|
68950
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68910
|
+
}
|
|
68951
68911
|
};
|
|
68952
68912
|
elements.push(triangleShape);
|
|
68953
68913
|
processed.add(el);
|
|
@@ -68984,8 +68944,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
68984
68944
|
},
|
|
68985
68945
|
sizing: null,
|
|
68986
68946
|
rectRadius: 0,
|
|
68987
|
-
transparency: effOp < 1 ? Math.round((1 - effOp) * 100) : void 0
|
|
68988
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
68947
|
+
transparency: effOp < 1 ? Math.round((1 - effOp) * 100) : void 0
|
|
68989
68948
|
};
|
|
68990
68949
|
elements.push(imgElement);
|
|
68991
68950
|
}
|
|
@@ -69096,8 +69055,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69096
69055
|
rotate: null,
|
|
69097
69056
|
cssTriangle: null,
|
|
69098
69057
|
customGeometry: points
|
|
69099
|
-
}
|
|
69100
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69058
|
+
}
|
|
69101
69059
|
});
|
|
69102
69060
|
} else {
|
|
69103
69061
|
borderShapes.push({
|
|
@@ -69124,8 +69082,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69124
69082
|
rotate: null,
|
|
69125
69083
|
cssTriangle: null,
|
|
69126
69084
|
customGeometry: null
|
|
69127
|
-
}
|
|
69128
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69085
|
+
}
|
|
69129
69086
|
});
|
|
69130
69087
|
}
|
|
69131
69088
|
}
|
|
@@ -69197,8 +69154,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69197
69154
|
rotate: null,
|
|
69198
69155
|
cssTriangle: null,
|
|
69199
69156
|
customGeometry: points
|
|
69200
|
-
}
|
|
69201
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69157
|
+
}
|
|
69202
69158
|
});
|
|
69203
69159
|
} else {
|
|
69204
69160
|
borderShapes.push({
|
|
@@ -69225,8 +69181,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69225
69181
|
rotate: null,
|
|
69226
69182
|
cssTriangle: null,
|
|
69227
69183
|
customGeometry: null
|
|
69228
|
-
}
|
|
69229
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69184
|
+
}
|
|
69230
69185
|
});
|
|
69231
69186
|
}
|
|
69232
69187
|
}
|
|
@@ -69299,8 +69254,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69299
69254
|
rotate: null,
|
|
69300
69255
|
cssTriangle: null,
|
|
69301
69256
|
customGeometry: points
|
|
69302
|
-
}
|
|
69303
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69257
|
+
}
|
|
69304
69258
|
});
|
|
69305
69259
|
} else {
|
|
69306
69260
|
borderShapes.push({
|
|
@@ -69327,8 +69281,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69327
69281
|
rotate: null,
|
|
69328
69282
|
cssTriangle: null,
|
|
69329
69283
|
customGeometry: null
|
|
69330
|
-
}
|
|
69331
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69284
|
+
}
|
|
69332
69285
|
});
|
|
69333
69286
|
}
|
|
69334
69287
|
}
|
|
@@ -69397,8 +69350,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69397
69350
|
rotate: null,
|
|
69398
69351
|
cssTriangle: null,
|
|
69399
69352
|
customGeometry: points
|
|
69400
|
-
}
|
|
69401
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69353
|
+
}
|
|
69402
69354
|
});
|
|
69403
69355
|
} else {
|
|
69404
69356
|
borderShapes.push({
|
|
@@ -69425,8 +69377,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69425
69377
|
rotate: null,
|
|
69426
69378
|
cssTriangle: null,
|
|
69427
69379
|
customGeometry: null
|
|
69428
|
-
}
|
|
69429
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69380
|
+
}
|
|
69430
69381
|
});
|
|
69431
69382
|
}
|
|
69432
69383
|
}
|
|
@@ -69448,8 +69399,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
69448
69399
|
sizing: {
|
|
69449
69400
|
type: bgImageSize === "cover" ? "cover" : bgImageSize === "contain" ? "contain" : "cover",
|
|
69450
69401
|
position: bgImagePosition
|
|
69451
|
-
}
|
|
69452
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
69402
|
+
}
|
|
69453
69403
|
};
|
|
69454
69404
|
elements.push(bgImgElement);
|
|
69455
69405
|
}
|
|
@@ -70349,7 +70299,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70349
70299
|
return points;
|
|
70350
70300
|
})() : null
|
|
70351
70301
|
},
|
|
70352
|
-
zIndex:
|
|
70302
|
+
zIndex: extractZIndex(computed2)
|
|
70353
70303
|
};
|
|
70354
70304
|
if (hasPadding && shapeElement.style && (shapeText || shapeTextRuns && shapeTextRuns.length > 0)) {
|
|
70355
70305
|
let effectiveLeftPadding = paddingLeft;
|
|
@@ -70386,58 +70336,6 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70386
70336
|
tc.querySelectorAll("*").forEach((desc) => processed.delete(desc));
|
|
70387
70337
|
});
|
|
70388
70338
|
}
|
|
70389
|
-
if (!shouldMergeText && hasDirectText && directTextContent) {
|
|
70390
|
-
const range2 = win.document.createRange();
|
|
70391
|
-
let foundTextNode = false;
|
|
70392
|
-
for (const node of Array.from(el.childNodes)) {
|
|
70393
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
|
70394
|
-
const text2 = (node.textContent || "").trim();
|
|
70395
|
-
if (text2) {
|
|
70396
|
-
if (!foundTextNode) {
|
|
70397
|
-
range2.setStart(node, 0);
|
|
70398
|
-
foundTextNode = true;
|
|
70399
|
-
}
|
|
70400
|
-
range2.setEnd(node, node.textContent?.length || 0);
|
|
70401
|
-
}
|
|
70402
|
-
}
|
|
70403
|
-
}
|
|
70404
|
-
if (foundTextNode) {
|
|
70405
|
-
const textRect = range2.getBoundingClientRect();
|
|
70406
|
-
if (textRect.width > 0 && textRect.height > 0) {
|
|
70407
|
-
const isBold = parseInt(computed2.fontWeight) >= 600;
|
|
70408
|
-
const isItalic = computed2.fontStyle === "italic";
|
|
70409
|
-
const isUnderline = computed2.textDecoration && computed2.textDecoration.includes("underline");
|
|
70410
|
-
let displayText = directTextContent;
|
|
70411
|
-
if (computed2.textTransform && computed2.textTransform !== "none") {
|
|
70412
|
-
displayText = applyTextTransform2(displayText, computed2.textTransform);
|
|
70413
|
-
}
|
|
70414
|
-
const directTextElement = {
|
|
70415
|
-
type: "p",
|
|
70416
|
-
text: displayText,
|
|
70417
|
-
position: {
|
|
70418
|
-
x: pxToInch(textRect.left),
|
|
70419
|
-
y: pxToInch(textRect.top),
|
|
70420
|
-
w: pxToInch(textRect.width),
|
|
70421
|
-
h: pxToInch(textRect.height)
|
|
70422
|
-
},
|
|
70423
|
-
style: {
|
|
70424
|
-
fontSize: pxToPoints(computed2.fontSize),
|
|
70425
|
-
fontFace: extractFontFace(computed2.fontFamily),
|
|
70426
|
-
color: rgbToHex(computed2.color),
|
|
70427
|
-
bold: isBold,
|
|
70428
|
-
italic: isItalic,
|
|
70429
|
-
underline: isUnderline ? true : void 0,
|
|
70430
|
-
valign: "middle",
|
|
70431
|
-
align: "left",
|
|
70432
|
-
...extractLetterSpacing(computed2) !== null ? { charSpacing: extractLetterSpacing(computed2) } : {},
|
|
70433
|
-
...extractAlpha(computed2.color) !== null ? { transparency: extractAlpha(computed2.color) } : {}
|
|
70434
|
-
},
|
|
70435
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
70436
|
-
};
|
|
70437
|
-
elements.push(directTextElement);
|
|
70438
|
-
}
|
|
70439
|
-
}
|
|
70440
|
-
}
|
|
70441
70339
|
if (shouldSplitTextFromClippedShape && overflowClipGeometry) {
|
|
70442
70340
|
const originalArea = originalShapeW * originalShapeH;
|
|
70443
70341
|
const clippedArea = clippedShapeW * clippedShapeH;
|
|
@@ -70480,8 +70378,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70480
70378
|
cssTriangle: null,
|
|
70481
70379
|
customGeometry: null
|
|
70482
70380
|
// NO custom geometry - PPTX doesn't clip text to paths
|
|
70483
|
-
}
|
|
70484
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
70381
|
+
}
|
|
70485
70382
|
};
|
|
70486
70383
|
if (hasPadding && clippedTextShape.style) {
|
|
70487
70384
|
clippedTextShape.style.margin = [
|
|
@@ -70524,8 +70421,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70524
70421
|
rotate: null,
|
|
70525
70422
|
cssTriangle: null,
|
|
70526
70423
|
customGeometry: null
|
|
70527
|
-
}
|
|
70528
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
70424
|
+
}
|
|
70529
70425
|
};
|
|
70530
70426
|
elements.push(extraShape);
|
|
70531
70427
|
}
|
|
@@ -70652,59 +70548,6 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70652
70548
|
} else if (directText) {
|
|
70653
70549
|
extractedText = directText;
|
|
70654
70550
|
}
|
|
70655
|
-
if (isPlainDivFlexRow && directText && hasStructuralChildren) {
|
|
70656
|
-
const range2 = win.document.createRange();
|
|
70657
|
-
let foundTextNode = false;
|
|
70658
|
-
for (const node of Array.from(el.childNodes)) {
|
|
70659
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
|
70660
|
-
const text2 = (node.textContent || "").trim();
|
|
70661
|
-
if (text2) {
|
|
70662
|
-
if (!foundTextNode) {
|
|
70663
|
-
range2.setStart(node, 0);
|
|
70664
|
-
foundTextNode = true;
|
|
70665
|
-
}
|
|
70666
|
-
range2.setEnd(node, node.textContent?.length || 0);
|
|
70667
|
-
}
|
|
70668
|
-
}
|
|
70669
|
-
}
|
|
70670
|
-
if (foundTextNode) {
|
|
70671
|
-
const textRect = range2.getBoundingClientRect();
|
|
70672
|
-
if (textRect.width > 0 && textRect.height > 0) {
|
|
70673
|
-
const computed22 = win.getComputedStyle(el);
|
|
70674
|
-
const isBold = parseInt(computed22.fontWeight) >= 600;
|
|
70675
|
-
const isItalic = computed22.fontStyle === "italic";
|
|
70676
|
-
const isUnderline = computed22.textDecoration && computed22.textDecoration.includes("underline");
|
|
70677
|
-
let displayText = directText;
|
|
70678
|
-
if (computed22.textTransform && computed22.textTransform !== "none") {
|
|
70679
|
-
displayText = applyTextTransform2(displayText, computed22.textTransform);
|
|
70680
|
-
}
|
|
70681
|
-
const flexDirectTextElement = {
|
|
70682
|
-
type: "p",
|
|
70683
|
-
text: displayText,
|
|
70684
|
-
position: {
|
|
70685
|
-
x: pxToInch(textRect.left),
|
|
70686
|
-
y: pxToInch(textRect.top),
|
|
70687
|
-
w: pxToInch(textRect.width),
|
|
70688
|
-
h: pxToInch(textRect.height)
|
|
70689
|
-
},
|
|
70690
|
-
style: {
|
|
70691
|
-
fontSize: pxToPoints(computed22.fontSize),
|
|
70692
|
-
fontFace: extractFontFace(computed22.fontFamily),
|
|
70693
|
-
color: rgbToHex(computed22.color),
|
|
70694
|
-
bold: isBold,
|
|
70695
|
-
italic: isItalic,
|
|
70696
|
-
underline: isUnderline ? true : void 0,
|
|
70697
|
-
valign: "middle",
|
|
70698
|
-
align: "left",
|
|
70699
|
-
...extractLetterSpacing(computed22) !== null ? { charSpacing: extractLetterSpacing(computed22) } : {},
|
|
70700
|
-
...extractAlpha(computed22.color) !== null ? { transparency: extractAlpha(computed22.color) } : {}
|
|
70701
|
-
},
|
|
70702
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
70703
|
-
};
|
|
70704
|
-
elements.push(flexDirectTextElement);
|
|
70705
|
-
}
|
|
70706
|
-
}
|
|
70707
|
-
}
|
|
70708
70551
|
if (extractedText && !hasStructuralChildren) {
|
|
70709
70552
|
const computed22 = win.getComputedStyle(el);
|
|
70710
70553
|
const fontSizePx2 = parseFloat(computed22.fontSize);
|
|
@@ -70832,8 +70675,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70832
70675
|
valign: hasPadding ? "top" : "middle",
|
|
70833
70676
|
lineSpacing: lineHeightMultiplier2 * pxToPoints(computed22.fontSize),
|
|
70834
70677
|
margin: hasPadding ? [paddingLeft * PT_PER_PX, paddingRight * PT_PER_PX, paddingBottom * PT_PER_PX, paddingTop * PT_PER_PX] : void 0
|
|
70835
|
-
}
|
|
70836
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
70678
|
+
}
|
|
70837
70679
|
};
|
|
70838
70680
|
if (baseRunOptions.transparency !== void 0 && baseRunOptions.transparency > 0) {
|
|
70839
70681
|
textElement.style.transparency = baseRunOptions.transparency;
|
|
@@ -70909,8 +70751,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70909
70751
|
align: liComputed2.textAlign === "start" ? "left" : liComputed2.textAlign,
|
|
70910
70752
|
valign: "top",
|
|
70911
70753
|
lineSpacing: pxToPoints(liComputed2.lineHeight)
|
|
70912
|
-
}
|
|
70913
|
-
zIndex: getEffectiveZIndex(liEl, win)
|
|
70754
|
+
}
|
|
70914
70755
|
};
|
|
70915
70756
|
elements.push(textElement);
|
|
70916
70757
|
processed.add(liEl);
|
|
@@ -70958,8 +70799,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
70958
70799
|
paraSpaceBefore: 0,
|
|
70959
70800
|
paraSpaceAfter: pxToPoints(liComputed.marginBottom),
|
|
70960
70801
|
margin: [marginLeft, 0, 0, 0]
|
|
70961
|
-
}
|
|
70962
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
70802
|
+
}
|
|
70963
70803
|
};
|
|
70964
70804
|
elements.push(listElement);
|
|
70965
70805
|
liElements.forEach((li) => processed.add(li));
|
|
@@ -71185,8 +71025,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71185
71025
|
type: el.tagName.toLowerCase(),
|
|
71186
71026
|
text: runs,
|
|
71187
71027
|
position: { x: pxToInch(x), y: pxToInch(y), w: pxToInch(w), h: pxToInch(h) },
|
|
71188
|
-
style: baseStyle
|
|
71189
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
71028
|
+
style: baseStyle
|
|
71190
71029
|
};
|
|
71191
71030
|
elements.push(textElement);
|
|
71192
71031
|
} else {
|
|
@@ -71202,8 +71041,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71202
71041
|
bold: isBold && !shouldSkipBold(computed.fontFamily),
|
|
71203
71042
|
italic: computed.fontStyle === "italic",
|
|
71204
71043
|
underline: computed.textDecoration.includes("underline")
|
|
71205
|
-
}
|
|
71206
|
-
zIndex: getEffectiveZIndex(el, win)
|
|
71044
|
+
}
|
|
71207
71045
|
};
|
|
71208
71046
|
elements.push(textElement);
|
|
71209
71047
|
}
|
|
@@ -71232,17 +71070,12 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71232
71070
|
const pseudoElements = extractPseudoElements(htmlDiv, win);
|
|
71233
71071
|
elements.push(...pseudoElements);
|
|
71234
71072
|
});
|
|
71235
|
-
|
|
71236
|
-
|
|
71237
|
-
const
|
|
71238
|
-
|
|
71239
|
-
if (zIndexA !== zIndexB) {
|
|
71240
|
-
return zIndexA - zIndexB;
|
|
71241
|
-
}
|
|
71242
|
-
return a.originalIndex - b.originalIndex;
|
|
71073
|
+
elements.sort((a, b) => {
|
|
71074
|
+
const zIndexA = "zIndex" in a && a.zIndex !== void 0 ? a.zIndex : 0;
|
|
71075
|
+
const zIndexB = "zIndex" in b && b.zIndex !== void 0 ? b.zIndex : 0;
|
|
71076
|
+
return zIndexA - zIndexB;
|
|
71243
71077
|
});
|
|
71244
|
-
|
|
71245
|
-
return { background, elements: sortedElements, placeholders, errors };
|
|
71078
|
+
return { background, elements, placeholders, errors };
|
|
71246
71079
|
}
|
|
71247
71080
|
|
|
71248
71081
|
// packages/slides/convert.js
|
|
@@ -71359,24 +71192,38 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71359
71192
|
return null;
|
|
71360
71193
|
return { x, y, w, h };
|
|
71361
71194
|
}
|
|
71362
|
-
async function
|
|
71363
|
-
|
|
71364
|
-
|
|
71365
|
-
|
|
71366
|
-
|
|
71367
|
-
|
|
71368
|
-
|
|
71369
|
-
} catch (e) {
|
|
71370
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
71371
|
-
console.warn(`Could not fetch image ${src}: ${message}`);
|
|
71372
|
-
return null;
|
|
71195
|
+
async function addElementsToSlide(elements, slide, pres) {
|
|
71196
|
+
const imageUrls = /* @__PURE__ */ new Set();
|
|
71197
|
+
for (const el of elements) {
|
|
71198
|
+
if (el.type === "image" || el.type === "backgroundImage" || el.type === "slideBackgroundImage") {
|
|
71199
|
+
if (el.src && !el.src.startsWith("data:")) {
|
|
71200
|
+
imageUrls.add(el.src);
|
|
71201
|
+
}
|
|
71373
71202
|
}
|
|
71374
71203
|
}
|
|
71375
|
-
|
|
71376
|
-
|
|
71204
|
+
const imageCache = /* @__PURE__ */ new Map();
|
|
71205
|
+
if (imageUrls.size > 0) {
|
|
71206
|
+
const fetchPromises = Array.from(imageUrls).map(async (url) => {
|
|
71207
|
+
try {
|
|
71208
|
+
const dataUrl = await fetchImageAsDataUrl(url);
|
|
71209
|
+
imageCache.set(url, { data: dataUrl });
|
|
71210
|
+
} catch (e) {
|
|
71211
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
71212
|
+
console.warn(`Could not fetch image ${url}: ${message}`);
|
|
71213
|
+
imageCache.set(url, null);
|
|
71214
|
+
}
|
|
71215
|
+
});
|
|
71216
|
+
await Promise.all(fetchPromises);
|
|
71217
|
+
}
|
|
71218
|
+
const getCachedImageSource = (src) => {
|
|
71219
|
+
if (src.startsWith("data:")) {
|
|
71220
|
+
return { data: src };
|
|
71221
|
+
}
|
|
71222
|
+
return imageCache.get(src) ?? null;
|
|
71223
|
+
};
|
|
71377
71224
|
for (const el of elements) {
|
|
71378
71225
|
if (el.type === "slideBackgroundImage") {
|
|
71379
|
-
const imgSrc =
|
|
71226
|
+
const imgSrc = getCachedImageSource(el.src);
|
|
71380
71227
|
if (!imgSrc) {
|
|
71381
71228
|
console.warn(`Skipping slide background image (CORS failure): ${el.src}`);
|
|
71382
71229
|
continue;
|
|
@@ -71422,7 +71269,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71422
71269
|
el.position.h = clipped.h;
|
|
71423
71270
|
}
|
|
71424
71271
|
if (el.type === "image") {
|
|
71425
|
-
const imgSrc =
|
|
71272
|
+
const imgSrc = getCachedImageSource(el.src);
|
|
71426
71273
|
if (!imgSrc) {
|
|
71427
71274
|
console.warn(`Skipping image (CORS failure): ${el.src}`);
|
|
71428
71275
|
continue;
|
|
@@ -71455,7 +71302,7 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71455
71302
|
imageOptions.transparency = el.transparency;
|
|
71456
71303
|
slide.addImage(imageOptions);
|
|
71457
71304
|
} else if (el.type === "backgroundImage") {
|
|
71458
|
-
const imgSrc =
|
|
71305
|
+
const imgSrc = getCachedImageSource(el.src);
|
|
71459
71306
|
if (!imgSrc) {
|
|
71460
71307
|
console.warn(`Skipping background image (CORS failure): ${el.src}`);
|
|
71461
71308
|
continue;
|
|
@@ -71872,16 +71719,17 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71872
71719
|
resolve();
|
|
71873
71720
|
};
|
|
71874
71721
|
iframe.onload = resolveOnce;
|
|
71875
|
-
setTimeout(resolveOnce,
|
|
71722
|
+
setTimeout(resolveOnce, 1e3);
|
|
71876
71723
|
});
|
|
71877
71724
|
const doc = iframe.contentDocument || iframe.contentWindow.document;
|
|
71878
71725
|
const iframeWin = iframe.contentWindow;
|
|
71726
|
+
const waitPromises = [];
|
|
71879
71727
|
if (iframeWin && iframeWin.document.fonts && iframeWin.document.fonts.ready) {
|
|
71880
|
-
|
|
71881
|
-
iframeWin.document.fonts.ready
|
|
71882
|
-
|
|
71883
|
-
|
|
71884
|
-
]);
|
|
71728
|
+
waitPromises.push(Promise.race([
|
|
71729
|
+
iframeWin.document.fonts.ready.then(() => {
|
|
71730
|
+
}),
|
|
71731
|
+
new Promise((r) => setTimeout(r, 500))
|
|
71732
|
+
]));
|
|
71885
71733
|
}
|
|
71886
71734
|
const images = doc.querySelectorAll("img");
|
|
71887
71735
|
if (images.length > 0) {
|
|
@@ -71894,12 +71742,13 @@ ${generateStylesCss(styleMap, themeFonts)}
|
|
|
71894
71742
|
img.onerror = () => resolve();
|
|
71895
71743
|
});
|
|
71896
71744
|
});
|
|
71897
|
-
|
|
71898
|
-
Promise.all(imagePromises)
|
|
71899
|
-
|
|
71900
|
-
|
|
71901
|
-
]);
|
|
71745
|
+
waitPromises.push(Promise.race([
|
|
71746
|
+
Promise.all(imagePromises).then(() => {
|
|
71747
|
+
}),
|
|
71748
|
+
new Promise((r) => setTimeout(r, 500))
|
|
71749
|
+
]));
|
|
71902
71750
|
}
|
|
71751
|
+
await Promise.all(waitPromises);
|
|
71903
71752
|
return { iframe, doc };
|
|
71904
71753
|
}
|
|
71905
71754
|
async function addSlideFromHtml(source, pres, options = {}) {
|