@pixldocs/canvas-renderer 0.5.71 → 0.5.72
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/index.cjs +4 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12388,7 +12388,6 @@ function PixldocsPreview(props) {
|
|
|
12388
12388
|
const [resolvedConfig, setResolvedConfig] = react.useState(null);
|
|
12389
12389
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
12390
12390
|
const [fontsReady, setFontsReady] = react.useState(false);
|
|
12391
|
-
const [fontsReadyVersion, setFontsReadyVersion] = react.useState(0);
|
|
12392
12391
|
const [canvasSettled, setCanvasSettled] = react.useState(false);
|
|
12393
12392
|
const [stabilizationPass, setStabilizationPass] = react.useState(0);
|
|
12394
12393
|
const isResolveMode = !("config" in props && props.config);
|
|
@@ -12461,38 +12460,9 @@ function PixldocsPreview(props) {
|
|
|
12461
12460
|
isResolveMode ? props.themeId : void 0
|
|
12462
12461
|
]);
|
|
12463
12462
|
const config = isResolveMode ? resolvedConfig : props.config;
|
|
12464
|
-
react.useEffect(() => {
|
|
12465
|
-
var _a, _b, _c;
|
|
12466
|
-
if (!config) return;
|
|
12467
|
-
let cancelled = false;
|
|
12468
|
-
setCanvasSettled(false);
|
|
12469
|
-
setStabilizationPass(0);
|
|
12470
|
-
console.log(PREVIEW_DEBUG_PREFIX, "config-changed", {
|
|
12471
|
-
pageIndex,
|
|
12472
|
-
pages: ((_a = config.pages) == null ? void 0 : _a.length) ?? 0,
|
|
12473
|
-
underlinedNodes: countUnderlinedNodes(config),
|
|
12474
|
-
isResolveMode
|
|
12475
|
-
});
|
|
12476
|
-
const bump = () => {
|
|
12477
|
-
if (cancelled) return;
|
|
12478
|
-
clearMeasurementCache();
|
|
12479
|
-
clearFabricCharCache();
|
|
12480
|
-
setFontsReadyVersion((v) => {
|
|
12481
|
-
const next = v + 1;
|
|
12482
|
-
console.log(PREVIEW_DEBUG_PREFIX, "font-bump", { pageIndex, next, stabilizationPass });
|
|
12483
|
-
return next;
|
|
12484
|
-
});
|
|
12485
|
-
};
|
|
12486
|
-
(_c = (_b = document.fonts) == null ? void 0 : _b.ready) == null ? void 0 : _c.then(bump);
|
|
12487
|
-
const timeoutId = window.setTimeout(bump, 350);
|
|
12488
|
-
return () => {
|
|
12489
|
-
cancelled = true;
|
|
12490
|
-
window.clearTimeout(timeoutId);
|
|
12491
|
-
};
|
|
12492
|
-
}, [config]);
|
|
12493
12463
|
const previewKey = react.useMemo(
|
|
12494
|
-
() => `${pageIndex}-${
|
|
12495
|
-
[pageIndex,
|
|
12464
|
+
() => `${pageIndex}-${stabilizationPass}`,
|
|
12465
|
+
[pageIndex, stabilizationPass]
|
|
12496
12466
|
);
|
|
12497
12467
|
react.useEffect(() => {
|
|
12498
12468
|
if (isResolveMode) return;
|
|
@@ -12561,7 +12531,7 @@ function PixldocsPreview(props) {
|
|
|
12561
12531
|
!canvasSettled && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12562
12532
|
] });
|
|
12563
12533
|
}
|
|
12564
|
-
const PACKAGE_VERSION = "0.5.
|
|
12534
|
+
const PACKAGE_VERSION = "0.5.72";
|
|
12565
12535
|
let __underlineFixInstalled = false;
|
|
12566
12536
|
function installUnderlineFix(fab) {
|
|
12567
12537
|
var _a;
|
|
@@ -15678,7 +15648,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
15678
15648
|
const hasGradient = !!((_b = (_a = page.backgroundGradient) == null ? void 0 : _a.stops) == null ? void 0 : _b.length);
|
|
15679
15649
|
drawPageBackground(pdf, i, page.width, page.height, page.backgroundColor, page.backgroundGradient);
|
|
15680
15650
|
const shouldStripBg = stripPageBackground ?? hasGradient;
|
|
15681
|
-
const shouldOutlineText = options.outlineText
|
|
15651
|
+
const shouldOutlineText = options.outlineText !== false;
|
|
15682
15652
|
const pageSvg = page.svg;
|
|
15683
15653
|
let processedSvg = await prepareLiveCanvasSvgForPdf(pageSvg, page.width, page.height, `page-${i + 1}`, {
|
|
15684
15654
|
stripPageBackground: shouldStripBg
|