@pixldocs/canvas-renderer 0.5.36 → 0.5.38
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 +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12072,10 +12072,47 @@ function PixldocsPreview(props) {
|
|
|
12072
12072
|
!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..." }) })
|
|
12073
12073
|
] });
|
|
12074
12074
|
}
|
|
12075
|
+
const PACKAGE_VERSION = "0.5.37";
|
|
12076
|
+
let __underlineFixInstalled = false;
|
|
12077
|
+
function installUnderlineFix(fab) {
|
|
12078
|
+
var _a;
|
|
12079
|
+
if (__underlineFixInstalled) return;
|
|
12080
|
+
const TextProto = (_a = fab.Text) == null ? void 0 : _a.prototype;
|
|
12081
|
+
if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
|
|
12082
|
+
const original = TextProto._renderTextDecoration;
|
|
12083
|
+
TextProto._renderTextDecoration = function patchedRenderTextDecoration(ctx, type) {
|
|
12084
|
+
try {
|
|
12085
|
+
const hasOwn = !!this[type];
|
|
12086
|
+
const hasStyled = typeof this.styleHas === "function" && this.styleHas(type);
|
|
12087
|
+
if (!hasOwn && !hasStyled) {
|
|
12088
|
+
return original.call(this, ctx, type);
|
|
12089
|
+
}
|
|
12090
|
+
const lines = this._textLines;
|
|
12091
|
+
if (Array.isArray(lines)) {
|
|
12092
|
+
this.__charBounds = [];
|
|
12093
|
+
for (let i = 0; i < lines.length; i++) {
|
|
12094
|
+
try {
|
|
12095
|
+
this.getLineWidth(i);
|
|
12096
|
+
} catch {
|
|
12097
|
+
}
|
|
12098
|
+
}
|
|
12099
|
+
}
|
|
12100
|
+
} catch {
|
|
12101
|
+
}
|
|
12102
|
+
return original.call(this, ctx, type);
|
|
12103
|
+
};
|
|
12104
|
+
__underlineFixInstalled = true;
|
|
12105
|
+
console.log(`[canvas-renderer] underline-fix monkey patch installed (v${PACKAGE_VERSION})`);
|
|
12106
|
+
}
|
|
12075
12107
|
class PixldocsRenderer {
|
|
12076
12108
|
constructor(config) {
|
|
12077
12109
|
__publicField(this, "config");
|
|
12078
12110
|
this.config = config;
|
|
12111
|
+
installUnderlineFix(fabric__namespace);
|
|
12112
|
+
try {
|
|
12113
|
+
console.log(`[canvas-renderer] PixldocsRenderer v${PACKAGE_VERSION} initialized`);
|
|
12114
|
+
} catch {
|
|
12115
|
+
}
|
|
12079
12116
|
}
|
|
12080
12117
|
/**
|
|
12081
12118
|
* Render a pre-resolved template config to an image using the full PageCanvas engine.
|
|
@@ -14881,6 +14918,7 @@ async function warmTemplateFromForm(options) {
|
|
|
14881
14918
|
exports.FONT_FALLBACK_DEVANAGARI = FONT_FALLBACK_DEVANAGARI;
|
|
14882
14919
|
exports.FONT_FALLBACK_SYMBOLS = FONT_FALLBACK_SYMBOLS;
|
|
14883
14920
|
exports.FONT_FILES = FONT_FILES;
|
|
14921
|
+
exports.PACKAGE_VERSION = PACKAGE_VERSION;
|
|
14884
14922
|
exports.PixldocsPreview = PixldocsPreview;
|
|
14885
14923
|
exports.PixldocsRenderer = PixldocsRenderer;
|
|
14886
14924
|
exports.applyThemeToConfig = applyThemeToConfig;
|