@signiphi/pdf-compose 0.1.0-beta.5 → 0.1.0-beta.7
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/components/DocumentGenerator.d.ts +3 -0
- package/dist/components/DocumentGenerator.d.ts.map +1 -0
- package/dist/components/EditorPanel.d.ts +15 -0
- package/dist/components/EditorPanel.d.ts.map +1 -0
- package/dist/components/EditorToolbar.d.ts +11 -0
- package/dist/components/EditorToolbar.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.d.ts +18 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/FieldEditPopover.d.ts +12 -0
- package/dist/components/FieldEditPopover.d.ts.map +1 -0
- package/dist/components/FieldInsertPopover.d.ts +12 -0
- package/dist/components/FieldInsertPopover.d.ts.map +1 -0
- package/dist/components/FieldNodeView.d.ts +3 -0
- package/dist/components/FieldNodeView.d.ts.map +1 -0
- package/dist/components/FieldOverlay.d.ts +9 -0
- package/dist/components/FieldOverlay.d.ts.map +1 -0
- package/dist/components/GeneratePanel.d.ts +15 -0
- package/dist/components/GeneratePanel.d.ts.map +1 -0
- package/dist/components/PreviewPanel.d.ts +12 -0
- package/dist/components/PreviewPanel.d.ts.map +1 -0
- package/dist/components/VariableEditPopover.d.ts +12 -0
- package/dist/components/VariableEditPopover.d.ts.map +1 -0
- package/dist/components/VariableInsertPopover.d.ts +13 -0
- package/dist/components/VariableInsertPopover.d.ts.map +1 -0
- package/dist/components/VariableNodeView.d.ts +3 -0
- package/dist/components/VariableNodeView.d.ts.map +1 -0
- package/dist/components/WatermarkNodeView.d.ts +3 -0
- package/dist/components/WatermarkNodeView.d.ts.map +1 -0
- package/dist/contexts/ThemeContext.d.ts +19 -0
- package/dist/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/extensions/columns-node.d.ts +4 -0
- package/dist/extensions/columns-node.d.ts.map +1 -0
- package/dist/extensions/field-node.d.ts +31 -0
- package/dist/extensions/field-node.d.ts.map +1 -0
- package/dist/extensions/panel-node.d.ts +3 -0
- package/dist/extensions/panel-node.d.ts.map +1 -0
- package/dist/extensions/repeat-node.d.ts +3 -0
- package/dist/extensions/repeat-node.d.ts.map +1 -0
- package/dist/extensions/subtotals-node.d.ts +3 -0
- package/dist/extensions/subtotals-node.d.ts.map +1 -0
- package/dist/extensions/variable-node.d.ts +18 -0
- package/dist/extensions/variable-node.d.ts.map +1 -0
- package/dist/extensions/watermark-node.d.ts +3 -0
- package/dist/extensions/watermark-node.d.ts.map +1 -0
- package/dist/hooks/useDocumentGenerator.d.ts +46 -0
- package/dist/hooks/useDocumentGenerator.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/dist/lib/ui/button.d.ts +12 -0
- package/dist/lib/ui/button.d.ts.map +1 -0
- package/dist/lib/ui/index.d.ts +10 -0
- package/dist/lib/ui/index.d.ts.map +1 -0
- package/dist/lib/ui/input.d.ts +6 -0
- package/dist/lib/ui/input.d.ts.map +1 -0
- package/dist/lib/ui/label.d.ts +8 -0
- package/dist/lib/ui/label.d.ts.map +1 -0
- package/dist/lib/ui/popover.d.ts +8 -0
- package/dist/lib/ui/popover.d.ts.map +1 -0
- package/dist/lib/ui/select.d.ts +14 -0
- package/dist/lib/ui/select.d.ts.map +1 -0
- package/dist/lib/ui/toggle-group.d.ts +13 -0
- package/dist/lib/ui/toggle-group.d.ts.map +1 -0
- package/dist/lib/ui/tooltip.d.ts +8 -0
- package/dist/lib/ui/tooltip.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/types/index.d.ts +204 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/error-helpers.d.ts +27 -0
- package/dist/utils/error-helpers.d.ts.map +1 -0
- package/dist/utils/field-helpers.d.ts +31 -0
- package/dist/utils/field-helpers.d.ts.map +1 -0
- package/dist/utils/markdown-parser.d.ts +6 -0
- package/dist/utils/markdown-parser.d.ts.map +1 -0
- package/dist/utils/markdown-validator.d.ts +13 -0
- package/dist/utils/markdown-validator.d.ts.map +1 -0
- package/dist/utils/markdown-writer.d.ts +6 -0
- package/dist/utils/markdown-writer.d.ts.map +1 -0
- package/dist/utils/pdf-generator.d.ts +27 -0
- package/dist/utils/pdf-generator.d.ts.map +1 -0
- package/dist/utils/pdf-metadata.d.ts +58 -0
- package/dist/utils/pdf-metadata.d.ts.map +1 -0
- package/dist/utils/pdf-preview.d.ts +7 -0
- package/dist/utils/pdf-preview.d.ts.map +1 -0
- package/dist/utils/template-pipeline.d.ts +21 -0
- package/dist/utils/template-pipeline.d.ts.map +1 -0
- package/dist/utils/theme-helpers.d.ts +21 -0
- package/dist/utils/theme-helpers.d.ts.map +1 -0
- package/dist/utils/variable-helpers.d.ts +46 -0
- package/dist/utils/variable-helpers.d.ts.map +1 -0
- package/dist/utils/xml-template-parser.d.ts +9 -0
- package/dist/utils/xml-template-parser.d.ts.map +1 -0
- package/package.json +7 -3
- package/src/styles/index.d.ts +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { JSONContent } from '@tiptap/core';
|
|
2
|
+
import type { DocumentGeneratorVariable } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Extract all unique variables from TipTap content.
|
|
5
|
+
* Deduplicates by varName (same name = same variable).
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractVariablesFromContent(content: JSONContent): DocumentGeneratorVariable[];
|
|
8
|
+
/**
|
|
9
|
+
* Replace variable nodes in TipTap content with plain text nodes.
|
|
10
|
+
* Returns a new content tree (does not mutate the input).
|
|
11
|
+
*/
|
|
12
|
+
export declare function replaceVariablesInContent(content: JSONContent, values: Record<string, string>): JSONContent;
|
|
13
|
+
/**
|
|
14
|
+
* Auto-generate a snake_case variable name from a label.
|
|
15
|
+
*/
|
|
16
|
+
export declare function labelToVarName(label: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a variable value is zero-like (empty, zero, or formatted zero).
|
|
19
|
+
* Matches: "", " ", "0", "0.00", "$0.00", "-0.00", etc.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isZeroLike(value: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Walk TipTap content tree and remove table rows or paragraphs
|
|
24
|
+
* that contain a variableNode with suppressZero='true' whose
|
|
25
|
+
* resolved value is zero-like.
|
|
26
|
+
*
|
|
27
|
+
* Call this BEFORE replaceVariablesInContent so the variable nodes
|
|
28
|
+
* still carry their attrs (varName, suppressZero).
|
|
29
|
+
*/
|
|
30
|
+
export declare function suppressZeroContent(content: JSONContent, values: Record<string, string>): JSONContent;
|
|
31
|
+
/**
|
|
32
|
+
* Expand `repeatBlock` nodes by cloning their inner content for each item
|
|
33
|
+
* in the data array. Variable names inside the repeat are remapped from
|
|
34
|
+
* `operation_X` → `{dataKey}_{index}_{X}`.
|
|
35
|
+
*
|
|
36
|
+
* The data array is stored as a JSON string in `values[dataKey]`.
|
|
37
|
+
* Returns the expanded content tree and an enriched values dict with
|
|
38
|
+
* flattened indexed keys (e.g. `operations_0_opcode`, `operations_1_opcode`).
|
|
39
|
+
*
|
|
40
|
+
* Call this BEFORE suppressZeroContent / replaceVariablesInContent.
|
|
41
|
+
*/
|
|
42
|
+
export declare function expandRepeatContent(content: JSONContent, values: Record<string, string>): {
|
|
43
|
+
content: JSONContent;
|
|
44
|
+
values: Record<string, string>;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=variable-helpers.d.ts.map
|
|
@@ -0,0 +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,CAuBb;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,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,WAAW,CAgDb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EACpB,MAAM,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocumentGeneratorVariable } from '../types';
|
|
2
|
+
export interface XmlTemplateParseResult {
|
|
3
|
+
markdown: string;
|
|
4
|
+
variables: DocumentGeneratorVariable[];
|
|
5
|
+
reportName: string;
|
|
6
|
+
warnings: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function parseXmlTemplate(xmlString: string): XmlTemplateParseResult;
|
|
9
|
+
//# sourceMappingURL=xml-template-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-template-parser.d.ts","sourceRoot":"","sources":["../../src/utils/xml-template-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,yBAAyB,EAAE,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AA21BD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB,CAwI1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signiphi/pdf-compose",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
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",
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
"require": "./dist/index.js",
|
|
17
17
|
"default": "./dist/index.js"
|
|
18
18
|
},
|
|
19
|
-
"./styles":
|
|
19
|
+
"./styles": {
|
|
20
|
+
"types": "./dist/styles/index.d.ts",
|
|
21
|
+
"import": "./dist/styles/index.css",
|
|
22
|
+
"default": "./dist/styles/index.css"
|
|
23
|
+
},
|
|
20
24
|
"./styles/source": "./src/styles/index.css",
|
|
21
25
|
"./src/styles/index.css": "./src/styles/index.css",
|
|
22
26
|
"./dist/styles/index.css": "./dist/styles/index.css"
|
|
@@ -27,7 +31,7 @@
|
|
|
27
31
|
"README.md"
|
|
28
32
|
],
|
|
29
33
|
"scripts": {
|
|
30
|
-
"build": "tsup && node -e \"require('fs').mkdirSync('dist/styles', {recursive: true})\" && postcss src/styles/index.css -o dist/styles/index.css",
|
|
34
|
+
"build": "tsup && tsc --emitDeclarationOnly --declaration --outDir dist && node -e \"require('fs').mkdirSync('dist/styles', {recursive: true})\" && postcss src/styles/index.css -o dist/styles/index.css && node -e \"require('fs').copyFileSync('src/styles/index.d.ts','dist/styles/index.d.ts')\"",
|
|
31
35
|
"dev": "tsup --watch",
|
|
32
36
|
"type-check": "tsc --noEmit"
|
|
33
37
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|