@signiphi/pdf-compose 0.1.0-beta.8 → 0.1.0-beta.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-parser.d.ts","sourceRoot":"","sources":["../../src/utils/markdown-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAiqBhD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAI9D"}
1
+ {"version":3,"file":"markdown-parser.d.ts","sourceRoot":"","sources":["../../src/utils/markdown-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAkqBhD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAI9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-writer.d.ts","sourceRoot":"","sources":["../../src/utils/markdown-writer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA6RhD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAMzD"}
1
+ {"version":3,"file":"markdown-writer.d.ts","sourceRoot":"","sources":["../../src/utils/markdown-writer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA8RhD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAMzD"}
@@ -22,7 +22,8 @@ export interface HeadlessPdfOptions {
22
22
  /**
23
23
  * Generate a PDF from TipTap JSON content with variable values applied.
24
24
  *
25
- * Pipeline: expand repeats -> suppress zeros -> replace variables -> render PDF.
25
+ * Pipeline: expand repeats -> expand block variables -> suppress zeros ->
26
+ * replace variables -> render PDF.
26
27
  * Pure function — no React, no DOM, no editor instance required.
27
28
  */
28
29
  export declare function generatePdfFromTiptap(content: JSONContent, values: Record<string, string>, options?: HeadlessPdfOptions): Promise<HeadlessPdfResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"template-pipeline.d.ts","sourceRoot":"","sources":["../../src/utils/template-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG9E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAClC,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,sDAAsD;IACtD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,gEAAgE;IAChE,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAiB5B;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAG5B"}
1
+ {"version":3,"file":"template-pipeline.d.ts","sourceRoot":"","sources":["../../src/utils/template-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG9E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAClC,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,sDAAsD;IACtD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,gEAAgE;IAChE,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAkB5B;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAG5B"}
@@ -10,6 +10,34 @@ export declare function extractVariablesFromContent(content: JSONContent): Docum
10
10
  * Returns a new content tree (does not mutate the input).
11
11
  */
12
12
  export declare function replaceVariablesInContent(content: JSONContent, values: Record<string, string>): JSONContent;
13
+ /**
14
+ * Expand block-level variables into parsed markdown blocks.
15
+ *
16
+ * A variable renders as a *block* (its value parsed as extended markdown and
17
+ * spliced in as block nodes — headings, tables, lists, etc.) when it is the
18
+ * sole content of a paragraph AND either:
19
+ * - the token carries `block:true`, or
20
+ * - the resolved value contains a newline (auto-detect — a multi-line value
21
+ * can never render meaningfully as inline text).
22
+ *
23
+ * Variables mixed inline with other content always stay plain-text
24
+ * substitutions. An empty block value removes the paragraph entirely so
25
+ * optional sections (checklists, inspections) collapse without a gap.
26
+ *
27
+ * Safety rails:
28
+ * - Form-field and watermark tokens inside *values* are stripped — fields
29
+ * and document-wide watermarks may only come from the template, never
30
+ * from data (a description containing `{{field|type:signature|...}}`
31
+ * must not inject a signable field; `:::watermark{text:PAID}` must not
32
+ * stamp every page).
33
+ * - Inside table cells, expansion only happens when every parsed block is a
34
+ * paragraph or heading (the cell renderer can't draw nested tables/lists —
35
+ * splicing them there would silently drop content).
36
+ *
37
+ * Call this AFTER expandRepeatContent and BEFORE suppressZeroContent /
38
+ * replaceVariablesInContent.
39
+ */
40
+ export declare function expandBlockVariables(content: JSONContent, values: Record<string, string>): JSONContent;
13
41
  /**
14
42
  * Auto-generate a snake_case variable name from a label.
15
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"variable-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/variable-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,WAAW,GAAG,yBAAyB,EAAE,CAuB7F;AAeD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,WAAW,CA+Bb;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIjD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,CA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,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CA+F1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signiphi/pdf-compose",
3
- "version": "0.1.0-beta.8",
3
+ "version": "0.1.0-beta.9",
4
4
  "description": "Markdown-based document composer with field placeholders for the signiphi signing pipeline",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",