@pixldocs/canvas-renderer 0.5.181 → 0.5.182
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 +11 -2
- package/dist/{index-DQBzPXXr.cjs → index-CUINpGhe.cjs} +9 -8
- package/dist/{index-DQBzPXXr.cjs.map → index-CUINpGhe.cjs.map} +1 -1
- package/dist/{index-Ck5VHk_Q.js → index-CcCXKYy6.js} +52 -51
- package/dist/{index-Ck5VHk_Q.js.map → index-CcCXKYy6.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +37 -37
- package/dist/previewBlur-D1laq3kn.cjs +104 -0
- package/dist/previewBlur-D1laq3kn.cjs.map +1 -0
- package/dist/previewBlur-ceEQYSVv.js +104 -0
- package/dist/previewBlur-ceEQYSVv.js.map +1 -0
- package/dist/{vectorPdfExport-DPng52xI.cjs → vectorPdfExport-0dwbE8Kn.cjs} +4 -4
- package/dist/{vectorPdfExport-DPng52xI.cjs.map → vectorPdfExport-0dwbE8Kn.cjs.map} +1 -1
- package/dist/{vectorPdfExport-KXmgWTkZ.js → vectorPdfExport-BpRBLtU-.js} +4 -4
- package/dist/{vectorPdfExport-KXmgWTkZ.js.map → vectorPdfExport-BpRBLtU-.js.map} +1 -1
- package/package.json +1 -1
- package/dist/previewBlur-BB8gxlmo.cjs +0 -51
- package/dist/previewBlur-BB8gxlmo.cjs.map +0 -1
- package/dist/previewBlur-Dj6dSSNO.js +0 -51
- package/dist/previewBlur-Dj6dSSNO.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const BLOCK_CHAR = "█";
|
|
4
|
-
function redactText(input) {
|
|
5
|
-
if (!input) return BLOCK_CHAR.repeat(4);
|
|
6
|
-
return input.replace(/\S/g, BLOCK_CHAR);
|
|
7
|
-
}
|
|
8
|
-
function processNode(node, inheritedBlur) {
|
|
9
|
-
if (!node || typeof node !== "object") return;
|
|
10
|
-
const blur = inheritedBlur || node.previewBlur === true;
|
|
11
|
-
if (node.type === "group") {
|
|
12
|
-
const children = node.children || node.elements;
|
|
13
|
-
if (children && Array.isArray(children)) {
|
|
14
|
-
for (const child of children) processNode(child, blur);
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (!blur) return;
|
|
19
|
-
if (node.type === "text") {
|
|
20
|
-
if (typeof node.text === "string") {
|
|
21
|
-
node.text = redactText(node.text);
|
|
22
|
-
} else {
|
|
23
|
-
node.text = BLOCK_CHAR.repeat(6);
|
|
24
|
-
}
|
|
25
|
-
if (node.formattingEnabled) {
|
|
26
|
-
node.formattingEnabled = false;
|
|
27
|
-
}
|
|
28
|
-
node.fill = "#6b6b6b";
|
|
29
|
-
if (node.fillGradient) node.fillGradient = void 0;
|
|
30
|
-
node.underline = false;
|
|
31
|
-
node.linethrough = false;
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (node.type === "image") {
|
|
35
|
-
node.src = void 0;
|
|
36
|
-
node.fill = "#6b6b6b";
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function injectPreviewBlur(config) {
|
|
41
|
-
const cloned = typeof structuredClone === "function" ? structuredClone(config) : JSON.parse(JSON.stringify(config));
|
|
42
|
-
for (const page of cloned.pages || []) {
|
|
43
|
-
const children = page.children || page.elements;
|
|
44
|
-
if (children && Array.isArray(children)) {
|
|
45
|
-
for (const child of children) processNode(child, false);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return cloned;
|
|
49
|
-
}
|
|
50
|
-
exports.injectPreviewBlur = injectPreviewBlur;
|
|
51
|
-
//# sourceMappingURL=previewBlur-BB8gxlmo.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"previewBlur-BB8gxlmo.cjs","sources":["../../../src/lib/previewBlur.ts"],"sourcesContent":["/**\n * Preview Blur (anti-screenshot) injector.\n *\n * Walks a TemplateConfig and, for every element marked `previewBlur: true`,\n * redacts its visible content so users can't take usable screenshots from\n * the watermarked preview. Currently implemented for TEXT elements by\n * replacing every printable character with `█` (full-block) — this keeps\n * the layout perfectly stable across the client and EC2 rendering pipelines\n * (no bbox math, no overlay siblings, no group disruption).\n *\n * Images and groups are placeholders for now: images get fill darkened and\n * src cleared (renders as a solid box of original dimensions); groups have\n * their flag propagated to descendants.\n *\n * Only invoke this when watermark is also being injected — the gate must\n * match exactly, otherwise paid downloads would also be redacted.\n */\n\nimport type { TemplateConfig } from '@/types/editor';\n\nconst BLOCK_CHAR = '█';\n\nfunction redactText(input: string): string {\n if (!input) return BLOCK_CHAR.repeat(4);\n // Preserve whitespace + line breaks so wrapping / line count stay identical.\n return input.replace(/\\S/g, BLOCK_CHAR);\n}\n\nfunction processNode(node: any, inheritedBlur: boolean): void {\n if (!node || typeof node !== 'object') return;\n const blur = inheritedBlur || node.previewBlur === true;\n\n if (node.type === 'group') {\n // Propagate to descendants; group itself has no visual to redact.\n const children = (node.children || node.elements) as any[] | undefined;\n if (children && Array.isArray(children)) {\n for (const child of children) processNode(child, blur);\n }\n return;\n }\n\n if (!blur) return;\n\n if (node.type === 'text') {\n // Keep the same character count (so width/wrap stays) but redacted.\n if (typeof node.text === 'string') {\n node.text = redactText(node.text);\n } else {\n node.text = BLOCK_CHAR.repeat(6);\n }\n // Inline-formatted text would expose markers; strip them.\n if (node.formattingEnabled) {\n node.formattingEnabled = false;\n }\n // Neutral muted fill so it reads as redacted, not as styled text.\n node.fill = '#6b6b6b';\n if (node.fillGradient) node.fillGradient = undefined;\n node.underline = false;\n node.linethrough = false;\n return;\n }\n\n if (node.type === 'image') {\n node.src = undefined;\n node.fill = '#6b6b6b';\n return;\n }\n}\n\n/**\n * Returns a deep-cloned config with every `previewBlur: true` element\n * redacted. Original config is NOT mutated. Safe to chain after\n * `injectWatermark()`.\n */\nexport function injectPreviewBlur(config: TemplateConfig): TemplateConfig {\n // Structured clone keeps full fidelity (and avoids JSON-stringify dropping\n // class instances) — fallback to JSON for older runtimes.\n const cloned: TemplateConfig =\n typeof structuredClone === 'function'\n ? structuredClone(config)\n : JSON.parse(JSON.stringify(config));\n\n for (const page of cloned.pages || []) {\n const children = (page as any).children || (page as any).elements;\n if (children && Array.isArray(children)) {\n for (const child of children) processNode(child, false);\n }\n }\n return cloned;\n}\n\nexport function hasAnyPreviewBlur(config: TemplateConfig): boolean {\n function walk(node: any): boolean {\n if (!node || typeof node !== 'object') return false;\n if (node.previewBlur === true) return true;\n const children = node.children || node.elements;\n if (Array.isArray(children)) {\n for (const c of children) if (walk(c)) return true;\n }\n return false;\n }\n for (const page of config.pages || []) if (walk(page)) return true;\n return false;\n}"],"names":[],"mappings":";;AAoBA,MAAM,aAAa;AAEnB,SAAS,WAAW,OAAuB;AACzC,MAAI,CAAC,MAAO,QAAO,WAAW,OAAO,CAAC;AAEtC,SAAO,MAAM,QAAQ,OAAO,UAAU;AACxC;AAEA,SAAS,YAAY,MAAW,eAA8B;AAC5D,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU;AACvC,QAAM,OAAO,iBAAiB,KAAK,gBAAgB;AAEnD,MAAI,KAAK,SAAS,SAAS;AAEzB,UAAM,WAAY,KAAK,YAAY,KAAK;AACxC,QAAI,YAAY,MAAM,QAAQ,QAAQ,GAAG;AACvC,iBAAW,SAAS,SAAU,aAAY,OAAO,IAAI;AAAA,IACvD;AACA;AAAA,EACF;AAEA,MAAI,CAAC,KAAM;AAEX,MAAI,KAAK,SAAS,QAAQ;AAExB,QAAI,OAAO,KAAK,SAAS,UAAU;AACjC,WAAK,OAAO,WAAW,KAAK,IAAI;AAAA,IAClC,OAAO;AACL,WAAK,OAAO,WAAW,OAAO,CAAC;AAAA,IACjC;AAEA,QAAI,KAAK,mBAAmB;AAC1B,WAAK,oBAAoB;AAAA,IAC3B;AAEA,SAAK,OAAO;AACZ,QAAI,KAAK,aAAc,MAAK,eAAe;AAC3C,SAAK,YAAY;AACjB,SAAK,cAAc;AACnB;AAAA,EACF;AAEA,MAAI,KAAK,SAAS,SAAS;AACzB,SAAK,MAAM;AACX,SAAK,OAAO;AACZ;AAAA,EACF;AACF;AAOO,SAAS,kBAAkB,QAAwC;AAGxE,QAAM,SACJ,OAAO,oBAAoB,aACvB,gBAAgB,MAAM,IACtB,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC;AAEvC,aAAW,QAAQ,OAAO,SAAS,CAAA,GAAI;AACrC,UAAM,WAAY,KAAa,YAAa,KAAa;AACzD,QAAI,YAAY,MAAM,QAAQ,QAAQ,GAAG;AACvC,iBAAW,SAAS,SAAU,aAAY,OAAO,KAAK;AAAA,IACxD;AAAA,EACF;AACA,SAAO;AACT;;"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const BLOCK_CHAR = "█";
|
|
2
|
-
function redactText(input) {
|
|
3
|
-
if (!input) return BLOCK_CHAR.repeat(4);
|
|
4
|
-
return input.replace(/\S/g, BLOCK_CHAR);
|
|
5
|
-
}
|
|
6
|
-
function processNode(node, inheritedBlur) {
|
|
7
|
-
if (!node || typeof node !== "object") return;
|
|
8
|
-
const blur = inheritedBlur || node.previewBlur === true;
|
|
9
|
-
if (node.type === "group") {
|
|
10
|
-
const children = node.children || node.elements;
|
|
11
|
-
if (children && Array.isArray(children)) {
|
|
12
|
-
for (const child of children) processNode(child, blur);
|
|
13
|
-
}
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (!blur) return;
|
|
17
|
-
if (node.type === "text") {
|
|
18
|
-
if (typeof node.text === "string") {
|
|
19
|
-
node.text = redactText(node.text);
|
|
20
|
-
} else {
|
|
21
|
-
node.text = BLOCK_CHAR.repeat(6);
|
|
22
|
-
}
|
|
23
|
-
if (node.formattingEnabled) {
|
|
24
|
-
node.formattingEnabled = false;
|
|
25
|
-
}
|
|
26
|
-
node.fill = "#6b6b6b";
|
|
27
|
-
if (node.fillGradient) node.fillGradient = void 0;
|
|
28
|
-
node.underline = false;
|
|
29
|
-
node.linethrough = false;
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (node.type === "image") {
|
|
33
|
-
node.src = void 0;
|
|
34
|
-
node.fill = "#6b6b6b";
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function injectPreviewBlur(config) {
|
|
39
|
-
const cloned = typeof structuredClone === "function" ? structuredClone(config) : JSON.parse(JSON.stringify(config));
|
|
40
|
-
for (const page of cloned.pages || []) {
|
|
41
|
-
const children = page.children || page.elements;
|
|
42
|
-
if (children && Array.isArray(children)) {
|
|
43
|
-
for (const child of children) processNode(child, false);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return cloned;
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
injectPreviewBlur
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=previewBlur-Dj6dSSNO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"previewBlur-Dj6dSSNO.js","sources":["../../../src/lib/previewBlur.ts"],"sourcesContent":["/**\n * Preview Blur (anti-screenshot) injector.\n *\n * Walks a TemplateConfig and, for every element marked `previewBlur: true`,\n * redacts its visible content so users can't take usable screenshots from\n * the watermarked preview. Currently implemented for TEXT elements by\n * replacing every printable character with `█` (full-block) — this keeps\n * the layout perfectly stable across the client and EC2 rendering pipelines\n * (no bbox math, no overlay siblings, no group disruption).\n *\n * Images and groups are placeholders for now: images get fill darkened and\n * src cleared (renders as a solid box of original dimensions); groups have\n * their flag propagated to descendants.\n *\n * Only invoke this when watermark is also being injected — the gate must\n * match exactly, otherwise paid downloads would also be redacted.\n */\n\nimport type { TemplateConfig } from '@/types/editor';\n\nconst BLOCK_CHAR = '█';\n\nfunction redactText(input: string): string {\n if (!input) return BLOCK_CHAR.repeat(4);\n // Preserve whitespace + line breaks so wrapping / line count stay identical.\n return input.replace(/\\S/g, BLOCK_CHAR);\n}\n\nfunction processNode(node: any, inheritedBlur: boolean): void {\n if (!node || typeof node !== 'object') return;\n const blur = inheritedBlur || node.previewBlur === true;\n\n if (node.type === 'group') {\n // Propagate to descendants; group itself has no visual to redact.\n const children = (node.children || node.elements) as any[] | undefined;\n if (children && Array.isArray(children)) {\n for (const child of children) processNode(child, blur);\n }\n return;\n }\n\n if (!blur) return;\n\n if (node.type === 'text') {\n // Keep the same character count (so width/wrap stays) but redacted.\n if (typeof node.text === 'string') {\n node.text = redactText(node.text);\n } else {\n node.text = BLOCK_CHAR.repeat(6);\n }\n // Inline-formatted text would expose markers; strip them.\n if (node.formattingEnabled) {\n node.formattingEnabled = false;\n }\n // Neutral muted fill so it reads as redacted, not as styled text.\n node.fill = '#6b6b6b';\n if (node.fillGradient) node.fillGradient = undefined;\n node.underline = false;\n node.linethrough = false;\n return;\n }\n\n if (node.type === 'image') {\n node.src = undefined;\n node.fill = '#6b6b6b';\n return;\n }\n}\n\n/**\n * Returns a deep-cloned config with every `previewBlur: true` element\n * redacted. Original config is NOT mutated. Safe to chain after\n * `injectWatermark()`.\n */\nexport function injectPreviewBlur(config: TemplateConfig): TemplateConfig {\n // Structured clone keeps full fidelity (and avoids JSON-stringify dropping\n // class instances) — fallback to JSON for older runtimes.\n const cloned: TemplateConfig =\n typeof structuredClone === 'function'\n ? structuredClone(config)\n : JSON.parse(JSON.stringify(config));\n\n for (const page of cloned.pages || []) {\n const children = (page as any).children || (page as any).elements;\n if (children && Array.isArray(children)) {\n for (const child of children) processNode(child, false);\n }\n }\n return cloned;\n}\n\nexport function hasAnyPreviewBlur(config: TemplateConfig): boolean {\n function walk(node: any): boolean {\n if (!node || typeof node !== 'object') return false;\n if (node.previewBlur === true) return true;\n const children = node.children || node.elements;\n if (Array.isArray(children)) {\n for (const c of children) if (walk(c)) return true;\n }\n return false;\n }\n for (const page of config.pages || []) if (walk(page)) return true;\n return false;\n}"],"names":[],"mappings":"AAoBA,MAAM,aAAa;AAEnB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