@pixldocs/canvas-renderer 0.5.35 → 0.5.37
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 +19 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +19 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -217,6 +217,12 @@ export declare function loadGoogleFontCSS(rawFontFamily: string): Promise<void>;
|
|
|
217
217
|
*/
|
|
218
218
|
export declare function normalizeFontFamily(fontStack: string): string;
|
|
219
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Package version banner. Bump alongside package.json so we can confirm
|
|
222
|
+
* (via browser:log) that the deployed bundle matches the expected build.
|
|
223
|
+
*/
|
|
224
|
+
export declare const PACKAGE_VERSION = "0.5.37";
|
|
225
|
+
|
|
220
226
|
export declare interface PageSettings {
|
|
221
227
|
backgroundColor?: string;
|
|
222
228
|
backgroundGradient?: any;
|
package/dist/index.js
CHANGED
|
@@ -12053,10 +12053,15 @@ function PixldocsPreview(props) {
|
|
|
12053
12053
|
!canvasSettled && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12054
12054
|
] });
|
|
12055
12055
|
}
|
|
12056
|
+
const PACKAGE_VERSION = "0.5.37";
|
|
12056
12057
|
class PixldocsRenderer {
|
|
12057
12058
|
constructor(config) {
|
|
12058
12059
|
__publicField(this, "config");
|
|
12059
12060
|
this.config = config;
|
|
12061
|
+
try {
|
|
12062
|
+
console.log(`[canvas-renderer] PixldocsRenderer v${PACKAGE_VERSION} initialized`);
|
|
12063
|
+
} catch {
|
|
12064
|
+
}
|
|
12060
12065
|
}
|
|
12061
12066
|
/**
|
|
12062
12067
|
* Render a pre-resolved template config to an image using the full PageCanvas engine.
|
|
@@ -12722,40 +12727,30 @@ class PixldocsRenderer {
|
|
|
12722
12727
|
const fabricInstance = this.getFabricCanvasFromContainer(container);
|
|
12723
12728
|
if (!(fabricInstance == null ? void 0 : fabricInstance.getObjects)) return;
|
|
12724
12729
|
const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
|
|
12725
|
-
const
|
|
12726
|
-
clearFabricCharCache();
|
|
12727
|
-
clearMeasurementCache();
|
|
12728
|
-
};
|
|
12729
|
-
const resyncTextboxWidths = (obj) => {
|
|
12730
|
+
const primeCharBounds = (obj) => {
|
|
12730
12731
|
if (obj instanceof fabric.Textbox) {
|
|
12731
|
-
const
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
obj.scaleX = savedScaleX;
|
|
12740
|
-
}
|
|
12741
|
-
if (Math.abs((obj.scaleY ?? 1) - savedScaleY) > 0.01) {
|
|
12742
|
-
obj.scaleY = savedScaleY;
|
|
12732
|
+
const lines = obj._textLines;
|
|
12733
|
+
if (Array.isArray(lines)) {
|
|
12734
|
+
for (let i = 0; i < lines.length; i++) {
|
|
12735
|
+
try {
|
|
12736
|
+
obj.getLineWidth(i);
|
|
12737
|
+
} catch {
|
|
12738
|
+
}
|
|
12739
|
+
}
|
|
12743
12740
|
}
|
|
12744
|
-
obj.setCoords();
|
|
12745
12741
|
obj.dirty = true;
|
|
12746
12742
|
return;
|
|
12747
12743
|
}
|
|
12748
12744
|
if (obj instanceof fabric.Group) {
|
|
12749
|
-
obj.getObjects().forEach(
|
|
12745
|
+
obj.getObjects().forEach(primeCharBounds);
|
|
12750
12746
|
obj.dirty = true;
|
|
12751
12747
|
}
|
|
12752
12748
|
};
|
|
12753
|
-
|
|
12754
|
-
await waitForPaint();
|
|
12755
|
-
fabricInstance.getObjects().forEach(resyncTextboxWidths);
|
|
12749
|
+
fabricInstance.getObjects().forEach(primeCharBounds);
|
|
12756
12750
|
(_a = fabricInstance.calcOffset) == null ? void 0 : _a.call(fabricInstance);
|
|
12757
12751
|
(_b = fabricInstance.renderAll) == null ? void 0 : _b.call(fabricInstance);
|
|
12758
|
-
|
|
12752
|
+
await waitForPaint();
|
|
12753
|
+
(_c = fabricInstance.renderAll) == null ? void 0 : _c.call(fabricInstance);
|
|
12759
12754
|
await waitForPaint();
|
|
12760
12755
|
}
|
|
12761
12756
|
}
|
|
@@ -14873,6 +14868,7 @@ export {
|
|
|
14873
14868
|
FONT_FALLBACK_DEVANAGARI,
|
|
14874
14869
|
FONT_FALLBACK_SYMBOLS,
|
|
14875
14870
|
FONT_FILES,
|
|
14871
|
+
PACKAGE_VERSION,
|
|
14876
14872
|
PixldocsPreview,
|
|
14877
14873
|
PixldocsRenderer,
|
|
14878
14874
|
applyThemeToConfig,
|