@pixldocs/canvas-renderer 0.5.186 → 0.5.187
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/README.md +74 -0
- package/dist/{index-Xg0sHfrw.js → index-C9H38u7P.js} +242 -65
- package/dist/index-C9H38u7P.js.map +1 -0
- package/dist/{index-_ogxqALr.cjs → index-DgMi1JSR.cjs} +199 -22
- package/dist/index-DgMi1JSR.cjs.map +1 -0
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +47 -0
- package/dist/index.js +40 -37
- package/dist/{vectorPdfExport-v3mr9nks.js → vectorPdfExport-BkERGCkM.js} +4 -4
- package/dist/{vectorPdfExport-v3mr9nks.js.map → vectorPdfExport-BkERGCkM.js.map} +1 -1
- package/dist/{vectorPdfExport-Dh3el4F0.cjs → vectorPdfExport-BknzMTNP.cjs} +4 -4
- package/dist/{vectorPdfExport-Dh3el4F0.cjs.map → vectorPdfExport-BknzMTNP.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Xg0sHfrw.js.map +0 -1
- package/dist/index-_ogxqALr.cjs.map +0 -1
- package/dist/previewBlur-CDBjIIjX.js +0 -104
- package/dist/previewBlur-CDBjIIjX.js.map +0 -1
- package/dist/previewBlur-D2aWUrre.cjs +0 -104
- package/dist/previewBlur-D2aWUrre.cjs.map +0 -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-DgMi1JSR.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;
|
|
@@ -26,12 +26,15 @@ exports.getEmbeddedJsPDFFontName = index.getEmbeddedJsPDFFontName;
|
|
|
26
26
|
exports.getProxiedImageUrl = index.getProxiedImageUrl;
|
|
27
27
|
exports.getPublishedTemplate = index.getPublishedTemplate;
|
|
28
28
|
exports.getTemplateForm = index.getTemplateForm;
|
|
29
|
+
exports.hasAnyPreviewBlur = index.hasAnyPreviewBlur;
|
|
30
|
+
exports.injectPreviewBlur = index.injectPreviewBlur;
|
|
29
31
|
exports.isBundledAssetUrl = index.isBundledAssetUrl;
|
|
30
32
|
exports.isFontAvailable = index.isFontAvailable;
|
|
31
33
|
exports.isPrivateUrl = index.isPrivateUrl;
|
|
32
34
|
exports.listPublishedTemplates = index.listPublishedTemplates;
|
|
33
35
|
exports.loadGoogleFontCSS = index.loadGoogleFontCSS;
|
|
34
36
|
exports.normalizeFontFamily = index.normalizeFontFamily;
|
|
37
|
+
exports.resolveBlurElementExactIdsFromFlatFormKeys = index.resolveBlurElementExactIdsFromFlatFormKeys;
|
|
35
38
|
exports.resolveFontWeight = index.resolveFontWeight;
|
|
36
39
|
exports.resolveFromForm = index.resolveFromForm;
|
|
37
40
|
exports.resolveTemplateData = index.resolveTemplateData;
|
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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FormConfig } from '../../../src/lib/formsApi';
|
|
2
2
|
import { getProxiedImageUrl } from '../../../src/lib/canvasImageLoader';
|
|
3
|
+
import { hasAnyPreviewBlur } from '../../../src/lib/previewBlur';
|
|
3
4
|
import { InferredSection } from '../../../src/lib/inferFormSchemaFromTemplate';
|
|
5
|
+
import { injectPreviewBlur } from '../../../src/lib/previewBlur';
|
|
4
6
|
import { isBundledAssetUrl } from '../../../src/lib/canvasImageLoader';
|
|
5
7
|
import { isPrivateUrl } from '../../../src/lib/canvasImageLoader';
|
|
6
8
|
import { jsPDF } from 'jspdf';
|
|
@@ -253,8 +255,12 @@ export declare interface GetTemplateFormOptions {
|
|
|
253
255
|
supabaseAnonKey: string;
|
|
254
256
|
}
|
|
255
257
|
|
|
258
|
+
export { hasAnyPreviewBlur }
|
|
259
|
+
|
|
256
260
|
export { InferredSection }
|
|
257
261
|
|
|
262
|
+
export { injectPreviewBlur }
|
|
263
|
+
|
|
258
264
|
export { isBundledAssetUrl }
|
|
259
265
|
|
|
260
266
|
/** Check if a font is in our local mapping */
|
|
@@ -415,6 +421,25 @@ declare interface PixldocsPreviewBaseProps {
|
|
|
415
421
|
blurFieldIds?: string[];
|
|
416
422
|
/** Exact element-id matches (no base-id stripping). */
|
|
417
423
|
blurElementExactIds?: string[];
|
|
424
|
+
/**
|
|
425
|
+
* Flat form-keys (the same keys you'd build for
|
|
426
|
+
* `applyFormDataToConfig` — e.g.
|
|
427
|
+
* `field_<treeNodeId>_<entryIdx1>_<fieldKey>` or the nested variant)
|
|
428
|
+
* to apply the live frosted-glass overlay to. The package walks
|
|
429
|
+
* `config.__cloneIdMap` for you and resolves each key to its cloned
|
|
430
|
+
* element ids across every page / repeatable entry.
|
|
431
|
+
*
|
|
432
|
+
* By default only keys ending in `_value` are honoured (the typical
|
|
433
|
+
* "blur biodata row values, keep labels sharp" pattern). Pass
|
|
434
|
+
* `blurFlatFormKeyOptions={{ bindings: 'all' }}` to opt out.
|
|
435
|
+
*
|
|
436
|
+
* For watermarked PNG/PDF exports, call
|
|
437
|
+
* `resolveBlurElementExactIdsFromFlatFormKeys(config, keys)` and feed
|
|
438
|
+
* the result to `injectPreviewBlur(config, { extraElementExactIds })`.
|
|
439
|
+
*/
|
|
440
|
+
blurFlatFormKeys?: string[];
|
|
441
|
+
/** Tuning knobs for `blurFlatFormKeys` resolution. */
|
|
442
|
+
blurFlatFormKeyOptions?: ResolveBlurOptions;
|
|
418
443
|
}
|
|
419
444
|
|
|
420
445
|
/** Mode 1: Pre-resolved config */
|
|
@@ -660,6 +685,28 @@ export declare interface RenderResult {
|
|
|
660
685
|
pixelHeight: number;
|
|
661
686
|
}
|
|
662
687
|
|
|
688
|
+
/**
|
|
689
|
+
* Resolve a list of flat form keys to the exact cloned canvas element ids
|
|
690
|
+
* they bind to (across all pages and repeatable instances) by walking
|
|
691
|
+
* `config.__cloneIdMap`.
|
|
692
|
+
*
|
|
693
|
+
* Unknown keys are silently ignored — never blur something we can't
|
|
694
|
+
* positively identify.
|
|
695
|
+
*/
|
|
696
|
+
export declare function resolveBlurElementExactIdsFromFlatFormKeys(config: TemplateConfig, flatFormKeys: Iterable<string>, options?: ResolveBlurOptions): string[];
|
|
697
|
+
|
|
698
|
+
export declare interface ResolveBlurOptions {
|
|
699
|
+
/**
|
|
700
|
+
* Restrict resolution to flat keys that bind the **value** column of a
|
|
701
|
+
* dynamic field row (i.e. keys ending in `_value`). This is the typical
|
|
702
|
+
* biodata teaser pattern — blur values, leave labels / section titles /
|
|
703
|
+
* full-name / photo sharp. Default: `'value'`.
|
|
704
|
+
*
|
|
705
|
+
* Pass `'all'` to resolve every key regardless of suffix.
|
|
706
|
+
*/
|
|
707
|
+
bindings?: 'value' | 'all';
|
|
708
|
+
}
|
|
709
|
+
|
|
663
710
|
export declare interface ResolvedTemplate {
|
|
664
711
|
config: TemplateConfig;
|
|
665
712
|
templateName: string;
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
import { D, F, q, s,
|
|
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, a2, a3, a4 } from "./index-C9H38u7P.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEPLOYMENT_VERSION_MARKER,
|
|
4
4
|
F as FONT_FALLBACK_DEVANAGARI,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
o as FONT_FALLBACK_MATH,
|
|
6
|
+
q as FONT_FALLBACK_SYMBOLS,
|
|
7
|
+
s as FONT_FILES,
|
|
8
8
|
P as PACKAGE_VERSION,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
9
|
+
t as PixldocsPreview,
|
|
10
|
+
u as PixldocsRenderer,
|
|
11
|
+
v as applyThemeToConfig,
|
|
12
|
+
w as assemblePdfFromSvgs,
|
|
13
|
+
x as awaitFontsForConfig,
|
|
14
|
+
y as collectFontDescriptorsFromConfig,
|
|
15
|
+
z as collectFontsFromConfig,
|
|
16
|
+
B as collectImageUrls,
|
|
17
|
+
C as configHasAutoShrinkText,
|
|
18
|
+
E as dumpSvgTextDiagnostics,
|
|
19
|
+
G as embedFont,
|
|
20
|
+
H as embedFontsForConfig,
|
|
21
|
+
I as embedFontsInPdf,
|
|
22
|
+
J as ensureFontsForResolvedConfig,
|
|
23
|
+
K as extractFontFamiliesFromSvgs,
|
|
24
|
+
L as getEmbeddedJsPDFFontName,
|
|
25
|
+
b as getProxiedImageUrl,
|
|
26
|
+
M as getPublishedTemplate,
|
|
27
|
+
N as getTemplateForm,
|
|
28
|
+
O as hasAnyPreviewBlur,
|
|
29
|
+
Q as injectPreviewBlur,
|
|
30
|
+
R as isBundledAssetUrl,
|
|
31
|
+
S as isFontAvailable,
|
|
32
|
+
U as isPrivateUrl,
|
|
33
|
+
V as listPublishedTemplates,
|
|
34
|
+
W as loadGoogleFontCSS,
|
|
35
|
+
X as normalizeFontFamily,
|
|
36
|
+
Y as resolveBlurElementExactIdsFromFlatFormKeys,
|
|
37
|
+
Z as resolveFontWeight,
|
|
38
|
+
_ as resolveFromForm,
|
|
39
|
+
$ as resolveTemplateData,
|
|
40
|
+
a0 as rewriteSvgFontsForJsPDF,
|
|
41
|
+
a1 as setAutoShrinkDebug,
|
|
42
|
+
a2 as setBundledAssetPrefixes,
|
|
43
|
+
a3 as warmResolvedTemplateForPreview,
|
|
44
|
+
a4 as warmTemplateFromForm
|
|
42
45
|
};
|
|
43
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsPDF, ShadingPattern } from "jspdf";
|
|
2
2
|
import { svg2pdf } from "svg2pdf.js";
|
|
3
3
|
import * as fabric from "fabric";
|
|
4
|
-
import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade,
|
|
4
|
+
import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, d as bakeEdgeFade, i as isElement, e as isGroup, j as buildRoundedTrianglePath, A as API_URL, k as getImageProxyFetchOptions, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-C9H38u7P.js";
|
|
5
5
|
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-DhEaMTZl.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
@@ -2506,7 +2506,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2506
2506
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2507
2507
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2508
2508
|
try {
|
|
2509
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2509
|
+
const { getNormalizedSvgUrl } = await import("./index-C9H38u7P.js").then((n) => n.a5);
|
|
2510
2510
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2511
2511
|
} catch {
|
|
2512
2512
|
return null;
|
|
@@ -3297,7 +3297,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3297
3297
|
}
|
|
3298
3298
|
let fetchUrl = imageUrl;
|
|
3299
3299
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3300
|
-
const { isPrivateUrl } = await import("./index-
|
|
3300
|
+
const { isPrivateUrl } = await import("./index-C9H38u7P.js").then((n) => n.a5);
|
|
3301
3301
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3302
3302
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3303
3303
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5293,4 +5293,4 @@ export {
|
|
|
5293
5293
|
preparePagesForExport,
|
|
5294
5294
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5295
5295
|
};
|
|
5296
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5296
|
+
//# sourceMappingURL=vectorPdfExport-BkERGCkM.js.map
|