@pixldocs/canvas-renderer 0.5.170 → 0.5.172
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-CtWVrKc-.cjs → index-DYtJJzdk.cjs} +168 -13
- package/dist/{index-CtWVrKc-.cjs.map → index-DYtJJzdk.cjs.map} +1 -1
- package/dist/{index-BvYxWljO.js → index-DuI8QJDd.js} +183 -28
- package/dist/{index-BvYxWljO.js.map → index-DuI8QJDd.js.map} +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +51 -0
- package/dist/index.js +16 -15
- package/dist/{vectorPdfExport-BnFtIh0l.cjs → vectorPdfExport-CDOztP1H.cjs} +4 -4
- package/dist/{vectorPdfExport-BnFtIh0l.cjs.map → vectorPdfExport-CDOztP1H.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BD0zlq42.js → vectorPdfExport-wH2x4QIj.js} +4 -4
- package/dist/{vectorPdfExport-BD0zlq42.js.map → vectorPdfExport-wH2x4QIj.js.map} +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-DYtJJzdk.cjs");
|
|
4
4
|
exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
|
|
5
5
|
exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
|
|
6
6
|
exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
|
|
@@ -25,6 +25,7 @@ exports.extractFontFamiliesFromSvgs = index.extractFontFamiliesFromSvgs;
|
|
|
25
25
|
exports.getEmbeddedJsPDFFontName = index.getEmbeddedJsPDFFontName;
|
|
26
26
|
exports.getProxiedImageUrl = index.getProxiedImageUrl;
|
|
27
27
|
exports.getPublishedTemplate = index.getPublishedTemplate;
|
|
28
|
+
exports.getTemplateForm = index.getTemplateForm;
|
|
28
29
|
exports.isBundledAssetUrl = index.isBundledAssetUrl;
|
|
29
30
|
exports.isFontAvailable = index.isFontAvailable;
|
|
30
31
|
exports.isPrivateUrl = index.isPrivateUrl;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -243,6 +243,16 @@ export declare function getPublishedTemplate(options: {
|
|
|
243
243
|
supabaseAnonKey: string;
|
|
244
244
|
}): Promise<PublishedTemplate | null>;
|
|
245
245
|
|
|
246
|
+
export declare function getTemplateForm(options: GetTemplateFormOptions): Promise<TemplateForm>;
|
|
247
|
+
|
|
248
|
+
export declare interface GetTemplateFormOptions {
|
|
249
|
+
templateId: string;
|
|
250
|
+
/** Optional — when omitted we read the template row and auto-detect from `template.form_schema_id`. */
|
|
251
|
+
formSchemaId?: string;
|
|
252
|
+
supabaseUrl: string;
|
|
253
|
+
supabaseAnonKey: string;
|
|
254
|
+
}
|
|
255
|
+
|
|
246
256
|
export { InferredSection }
|
|
247
257
|
|
|
248
258
|
export { isBundledAssetUrl }
|
|
@@ -481,6 +491,13 @@ export declare class PixldocsRenderer {
|
|
|
481
491
|
*/
|
|
482
492
|
private renderPdfViaClientExport;
|
|
483
493
|
private getExpectedImageCount;
|
|
494
|
+
/**
|
|
495
|
+
* Collects ids of nodes that the renderer expects to produce a renderable
|
|
496
|
+
* fabric image. Excludes SVG sources because those are loaded as Groups,
|
|
497
|
+
* not HTMLImageElement-backed Images, and would otherwise inflate the
|
|
498
|
+
* `expected` counter forever.
|
|
499
|
+
*/
|
|
500
|
+
private getExpectedImageIds;
|
|
484
501
|
private waitForCanvasImages;
|
|
485
502
|
private waitForCanvasScene;
|
|
486
503
|
private waitForRelevantFonts;
|
|
@@ -547,6 +564,19 @@ export declare interface RendererConfig {
|
|
|
547
564
|
imageProxyUrl?: string;
|
|
548
565
|
/** Optional: pixel ratio for high-DPI rendering (default: 2) */
|
|
549
566
|
pixelRatio?: number;
|
|
567
|
+
/**
|
|
568
|
+
* Maximum time (ms) to wait for canvas image assets before bailing out.
|
|
569
|
+
* Default: 15000. Lower this (e.g. 3000) for thumbnail/preview use-cases.
|
|
570
|
+
*/
|
|
571
|
+
assetWaitTimeoutMs?: number;
|
|
572
|
+
/**
|
|
573
|
+
* Once the scene is settled (fabric+dom+canvas ready) and no new asset
|
|
574
|
+
* progress has been seen for this many ms, resolve early even if the
|
|
575
|
+
* expected counter hasn't matched. Default: 1500.
|
|
576
|
+
*/
|
|
577
|
+
assetWaitEarlyExitMs?: number;
|
|
578
|
+
/** Verbose asset-wait diagnostics. Default: false. */
|
|
579
|
+
debug?: boolean;
|
|
550
580
|
}
|
|
551
581
|
|
|
552
582
|
/** Options for renderFromForm — matches the server API payload */
|
|
@@ -777,6 +807,27 @@ export declare interface TemplateConfigPage {
|
|
|
777
807
|
boundRepeatablePageId?: string;
|
|
778
808
|
}
|
|
779
809
|
|
|
810
|
+
export declare interface TemplateForm {
|
|
811
|
+
templateId: string;
|
|
812
|
+
templateName: string;
|
|
813
|
+
/** 0 = free, >0 = paid (watermark applies on rendered output). */
|
|
814
|
+
price: number;
|
|
815
|
+
/**
|
|
816
|
+
* The bound form_schema id, if any. Pass this back as `formSchemaId` when
|
|
817
|
+
* rendering. `null` indicates a manual-fields template — pass the
|
|
818
|
+
* sectionState as-is to `renderFromForm` (without `formSchemaId`).
|
|
819
|
+
*/
|
|
820
|
+
formSchemaId: string | null;
|
|
821
|
+
/** Inferred section/field structure — drives the edit UI. */
|
|
822
|
+
sections: InferredSection[];
|
|
823
|
+
/**
|
|
824
|
+
* Pre-seeded section state: defaults from the template's `default_data`
|
|
825
|
+
* (V2) or saved default form values, falling back to empty values. Use
|
|
826
|
+
* this as the initial value of your form state.
|
|
827
|
+
*/
|
|
828
|
+
initialSectionState: SectionFormState;
|
|
829
|
+
}
|
|
830
|
+
|
|
780
831
|
export declare interface ThemeConfig {
|
|
781
832
|
variables?: Record<string, {
|
|
782
833
|
value: string;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, b, M, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0 } from "./index-
|
|
1
|
+
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, b, M, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1 } from "./index-DuI8QJDd.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEPLOYMENT_VERSION_MARKER,
|
|
4
4
|
F as FONT_FALLBACK_DEVANAGARI,
|
|
@@ -24,19 +24,20 @@ export {
|
|
|
24
24
|
L as getEmbeddedJsPDFFontName,
|
|
25
25
|
b as getProxiedImageUrl,
|
|
26
26
|
M as getPublishedTemplate,
|
|
27
|
-
N as
|
|
28
|
-
O as
|
|
29
|
-
Q as
|
|
30
|
-
R as
|
|
31
|
-
S as
|
|
32
|
-
U as
|
|
33
|
-
V as
|
|
34
|
-
W as
|
|
35
|
-
X as
|
|
36
|
-
Y as
|
|
37
|
-
Z as
|
|
38
|
-
_ as
|
|
39
|
-
$ as
|
|
40
|
-
a0 as
|
|
27
|
+
N as getTemplateForm,
|
|
28
|
+
O as isBundledAssetUrl,
|
|
29
|
+
Q as isFontAvailable,
|
|
30
|
+
R as isPrivateUrl,
|
|
31
|
+
S as listPublishedTemplates,
|
|
32
|
+
U as loadGoogleFontCSS,
|
|
33
|
+
V as normalizeFontFamily,
|
|
34
|
+
W as resolveFontWeight,
|
|
35
|
+
X as resolveFromForm,
|
|
36
|
+
Y as resolveTemplateData,
|
|
37
|
+
Z as rewriteSvgFontsForJsPDF,
|
|
38
|
+
_ as setAutoShrinkDebug,
|
|
39
|
+
$ as setBundledAssetPrefixes,
|
|
40
|
+
a0 as warmResolvedTemplateForPreview,
|
|
41
|
+
a1 as warmTemplateFromForm
|
|
41
42
|
};
|
|
42
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jspdf = require("jspdf");
|
|
4
4
|
const svg2pdf_js = require("svg2pdf.js");
|
|
5
5
|
const fabric = require("fabric");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-DYtJJzdk.cjs");
|
|
7
7
|
const pdfFonts = require("./pdfFonts-BTEVnYX8.cjs");
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -2519,7 +2519,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2519
2519
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2520
2520
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2521
2521
|
try {
|
|
2522
|
-
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-
|
|
2522
|
+
const { getNormalizedSvgUrl } = await Promise.resolve().then(() => require("./index-DYtJJzdk.cjs")).then((n) => n.canvasImageLoader);
|
|
2523
2523
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2524
2524
|
} catch {
|
|
2525
2525
|
return null;
|
|
@@ -3300,7 +3300,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3300
3300
|
}
|
|
3301
3301
|
let fetchUrl = imageUrl;
|
|
3302
3302
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3303
|
-
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-
|
|
3303
|
+
const { isPrivateUrl } = await Promise.resolve().then(() => require("./index-DYtJJzdk.cjs")).then((n) => n.canvasImageLoader);
|
|
3304
3304
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3305
3305
|
const proxyUrl = new URL(`${index.API_URL}/image-proxy`);
|
|
3306
3306
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5282,4 +5282,4 @@ exports.exportMultiPagePdf = exportMultiPagePdf;
|
|
|
5282
5282
|
exports.logTextMeasurementDiagnostic = logTextMeasurementDiagnostic;
|
|
5283
5283
|
exports.preparePagesForExport = preparePagesForExport;
|
|
5284
5284
|
exports.rewriteSvgFontsForJsPDFWithSourceMeta = rewriteSvgFontsForJsPDFWithSourceMeta;
|
|
5285
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5285
|
+
//# sourceMappingURL=vectorPdfExport-CDOztP1H.cjs.map
|