@jsonpdf/core 0.1.0-alpha.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 JsonPDF
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # @jsonpdf/core
2
+
3
+ Shared foundation for the jsonpdf monorepo — TypeScript types, JSON Schema validation, and utility functions.
4
+
5
+ ## What's inside
6
+
7
+ - **Types** — `Template`, `Section`, `Band`, `Element`, `Style`, `FontDeclaration`, `PageConfig`, and all related interfaces that define the jsonpdf content model.
8
+ - **Schema validation** — JSON Schema definitions and validation powered by [ajv](https://ajv.js.org/). Includes expression-aware schema building for LiquidJS template expressions.
9
+ - **Utilities** — Color parsing/conversion (`parseColor`, `toHex`, `isGradient`), unit conversion (`mmToPoints`, `inchesToPoints`, `pointsToMm`), and ID generation (`generateId`).
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { type Template, validateTemplateSchema, parseColor, mmToPoints } from '@jsonpdf/core';
15
+ ```
16
+
17
+ ## Exports
18
+
19
+ | Category | Exports |
20
+ | ---------- | --------------------------------------------------------------------------------------------------- |
21
+ | Types | `Template`, `Section`, `Band`, `BandType`, `Element`, `Style`, `FontDeclaration`, `PageConfig`, ... |
22
+ | Schema | `templateSchema`, `validateTemplateSchema`, `validateWithSchema`, `applySchemaDefaults` |
23
+ | Expression | `makeExpressionAware`, `buildPluginAwareTemplateSchema` |
24
+ | Colors | `parseColor`, `toHex`, `isGradient` |
25
+ | Units | `mmToPoints`, `inchesToPoints`, `pointsToMm`, `pointsToInches` |
26
+ | IDs | `generateId` |
@@ -0,0 +1,23 @@
1
+ import type { JSONSchema } from './types.js';
2
+ /**
3
+ * Return a copy of a plugin `propsSchema` where each property also accepts
4
+ * Liquid expression strings (`{{ ... }}` or `{% ... %}`).
5
+ *
6
+ * Schema-level keywords like `required`, `additionalProperties`, and `type`
7
+ * are preserved. Only entries in `properties` are wrapped.
8
+ */
9
+ export declare function makeExpressionAware(schema: JSONSchema): JSONSchema;
10
+ /** Plugin schema descriptor used to build the augmented template schema. */
11
+ export interface PluginSchemaEntry {
12
+ type: string;
13
+ propsSchema: JSONSchema;
14
+ }
15
+ /**
16
+ * Deep-clone the base template schema and add `if`/`then` branches
17
+ * (keyed on `element.type`) so that each element's `properties` are
18
+ * validated against the corresponding plugin's `propsSchema` (expression-aware).
19
+ *
20
+ * The result is cached per plugin array reference for `validateWithSchema` WeakMap reuse.
21
+ */
22
+ export declare function buildPluginAwareTemplateSchema(plugins: readonly PluginSchemaEntry[]): JSONSchema;
23
+ //# sourceMappingURL=expression-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expression-schema.d.ts","sourceRoot":"","sources":["../src/expression-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAwB7C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAYlE;AAED,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,UAAU,CAAC;CACzB;AAUD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,GAAG,UAAU,CA8BhG"}
@@ -0,0 +1,78 @@
1
+ import { templateSchema } from './schema.js';
2
+ /** Pattern that matches Liquid expression strings: {{ ... }} or {% ... %}. */
3
+ const EXPRESSION_PATTERN = '\\{\\{|\\{%';
4
+ /** A schema alternative that accepts Liquid expression strings. */
5
+ const expressionString = { type: 'string', pattern: EXPRESSION_PATTERN };
6
+ /**
7
+ * Wrap a single property schema so it also accepts a Liquid expression string.
8
+ * Always wraps in `anyOf: [original, expressionString]`. This avoids issues with
9
+ * `oneOf` semantics where an expression string could match both the original
10
+ * string branch and the expression pattern branch.
11
+ */
12
+ function wrapProperty(schema) {
13
+ // If schema already has the expression pattern, skip wrapping
14
+ if (schema.pattern === EXPRESSION_PATTERN) {
15
+ return schema;
16
+ }
17
+ return { anyOf: [schema, expressionString] };
18
+ }
19
+ /**
20
+ * Return a copy of a plugin `propsSchema` where each property also accepts
21
+ * Liquid expression strings (`{{ ... }}` or `{% ... %}`).
22
+ *
23
+ * Schema-level keywords like `required`, `additionalProperties`, and `type`
24
+ * are preserved. Only entries in `properties` are wrapped.
25
+ */
26
+ export function makeExpressionAware(schema) {
27
+ const result = { ...schema };
28
+ if (schema.properties && typeof schema.properties === 'object') {
29
+ const wrappedProps = {};
30
+ for (const [key, value] of Object.entries(schema.properties)) {
31
+ wrappedProps[key] = wrapProperty(value);
32
+ }
33
+ result.properties = wrappedProps;
34
+ }
35
+ return result;
36
+ }
37
+ /**
38
+ * Cache: one augmented schema per unique plugin set (by reference identity of the array).
39
+ * Uses WeakMap so garbage collection works when the array is discarded.
40
+ * The `validateWithSchema` function also caches compiled validators by schema object identity,
41
+ * so returning the same schema object avoids re-compilation.
42
+ */
43
+ const augmentedSchemaCache = new WeakMap();
44
+ /**
45
+ * Deep-clone the base template schema and add `if`/`then` branches
46
+ * (keyed on `element.type`) so that each element's `properties` are
47
+ * validated against the corresponding plugin's `propsSchema` (expression-aware).
48
+ *
49
+ * The result is cached per plugin array reference for `validateWithSchema` WeakMap reuse.
50
+ */
51
+ export function buildPluginAwareTemplateSchema(plugins) {
52
+ const cached = augmentedSchemaCache.get(plugins);
53
+ if (cached)
54
+ return cached;
55
+ // Deep-clone the base schema
56
+ const schema = JSON.parse(JSON.stringify(templateSchema));
57
+ const defs = schema.$defs;
58
+ if (!defs?.Element) {
59
+ return schema; // Defensive — should never happen
60
+ }
61
+ // Build if/then branches for each plugin
62
+ const branches = plugins.map((plugin) => ({
63
+ if: {
64
+ properties: { type: { const: plugin.type } },
65
+ required: ['type'],
66
+ },
67
+ then: {
68
+ properties: { properties: makeExpressionAware(plugin.propsSchema) },
69
+ },
70
+ }));
71
+ // Attach branches via allOf on the Element $def
72
+ const elementDef = defs.Element;
73
+ const existingAllOf = Array.isArray(elementDef.allOf) ? elementDef.allOf : [];
74
+ elementDef.allOf = [...existingAllOf, ...branches];
75
+ augmentedSchemaCache.set(plugins, schema);
76
+ return schema;
77
+ }
78
+ //# sourceMappingURL=expression-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expression-schema.js","sourceRoot":"","sources":["../src/expression-schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,8EAA8E;AAC9E,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEzC,mEAAmE;AACnE,MAAM,gBAAgB,GAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAErF;;;;;GAKG;AACH,SAAS,YAAY,CAA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;IACzC,MAAM,QAAQ,GAAiB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACtD,EAAE,EAAE;YACF,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE;YAC5C,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,EAAE,UAAU,EAAE,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;SACpE;KACF,CAAC,CAAC,CAAC;IAEJ,gDAAgD;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;IAChC,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,UAAU,CAAC,KAAsB,CAAC,CAAC,CAAC,EAAE,CAAC;IAChG,UAAU,CAAC,KAAK,GAAG,CAAC,GAAG,aAAa,EAAE,GAAG,QAAQ,CAAC,CAAC;IAEnD,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type { JSONSchema, ValidationResult, ValidationError, Template, PageConfig, Section, BandType, Band, Element, ConditionalStyle, RichContent, StyledRun, GradientStop, LinearGradient, RadialGradient, Gradient, BackgroundColor, BorderSide, PaddingValue, Style, FontDeclaration, } from './types.js';
2
+ export { templateSchema } from './schema.js';
3
+ export { validateTemplateSchema, validateWithSchema, applySchemaDefaults } from './validation.js';
4
+ export { makeExpressionAware, buildPluginAwareTemplateSchema } from './expression-schema.js';
5
+ export type { PluginSchemaEntry } from './expression-schema.js';
6
+ export { parseColor, toHex, isGradient, type RGB } from './utils/colors.js';
7
+ export { mmToPoints, inchesToPoints, pointsToMm, pointsToInches } from './utils/units.js';
8
+ export { generateId } from './utils/ids.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,UAAU,EACV,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,cAAc,EACd,cAAc,EACd,QAAQ,EACR,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EACL,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7F,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ // Schema
2
+ export { templateSchema } from './schema.js';
3
+ // Validation
4
+ export { validateTemplateSchema, validateWithSchema, applySchemaDefaults } from './validation.js';
5
+ export { makeExpressionAware, buildPluginAwareTemplateSchema } from './expression-schema.js';
6
+ // Utilities
7
+ export { parseColor, toHex, isGradient } from './utils/colors.js';
8
+ export { mmToPoints, inchesToPoints, pointsToMm, pointsToInches } from './utils/units.js';
9
+ export { generateId } from './utils/ids.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,SAAS;AACT,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,aAAa;AACb,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAG7F,YAAY;AACZ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAY,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { JSONSchema } from './types.js';
2
+ /** JSON Schema (draft 2020-12) that validates Template objects. */
3
+ export declare const templateSchema: JSONSchema;
4
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA8B7C,mEAAmE;AACnE,eAAO,MAAM,cAAc,EAAE,UAuQ5B,CAAC"}
package/dist/schema.js ADDED
@@ -0,0 +1,292 @@
1
+ const bandTypes = [
2
+ 'title',
3
+ 'pageHeader',
4
+ 'pageFooter',
5
+ 'lastPageFooter',
6
+ 'columnHeader',
7
+ 'detail',
8
+ 'columnFooter',
9
+ 'summary',
10
+ 'body',
11
+ 'background',
12
+ 'noData',
13
+ 'groupHeader',
14
+ 'groupFooter',
15
+ ];
16
+ const fontWeightValues = ['normal', 'bold'];
17
+ const fontStyleValues = ['normal', 'italic'];
18
+ const textDecorationValues = [
19
+ 'none',
20
+ 'underline',
21
+ 'line-through',
22
+ 'underline line-through',
23
+ ];
24
+ const textAlignValues = ['left', 'center', 'right', 'justify'];
25
+ const orientationValues = ['portrait', 'landscape'];
26
+ const columnModeValues = ['tile', 'flow'];
27
+ /** JSON Schema (draft 2020-12) that validates Template objects. */
28
+ export const templateSchema = {
29
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
30
+ type: 'object',
31
+ required: [
32
+ 'version',
33
+ 'name',
34
+ 'page',
35
+ 'dataSchema',
36
+ 'defaultStyle',
37
+ 'styles',
38
+ 'fonts',
39
+ 'sections',
40
+ ],
41
+ additionalProperties: false,
42
+ properties: {
43
+ version: { const: '1.0' },
44
+ name: { type: 'string', minLength: 1 },
45
+ description: { type: 'string' },
46
+ author: { type: 'string' },
47
+ license: { type: 'string' },
48
+ page: { $ref: '#/$defs/PageConfig' },
49
+ dataSchema: { type: 'object' },
50
+ defaultStyle: {
51
+ allOf: [{ $ref: '#/$defs/Style' }, { type: 'object', required: ['fontFamily'] }],
52
+ },
53
+ styles: {
54
+ type: 'object',
55
+ additionalProperties: { $ref: '#/$defs/Style' },
56
+ },
57
+ sections: {
58
+ type: 'array',
59
+ minItems: 1,
60
+ items: { $ref: '#/$defs/Section' },
61
+ },
62
+ fonts: {
63
+ type: 'array',
64
+ items: { $ref: '#/$defs/FontDeclaration' },
65
+ },
66
+ },
67
+ $defs: {
68
+ PageConfig: {
69
+ type: 'object',
70
+ required: ['width', 'height', 'margins'],
71
+ additionalProperties: false,
72
+ properties: {
73
+ width: { type: 'number', exclusiveMinimum: 0 },
74
+ height: { type: 'number', exclusiveMinimum: 0 },
75
+ autoHeight: { type: 'boolean' },
76
+ orientation: { type: 'string', enum: [...orientationValues] },
77
+ margins: { $ref: '#/$defs/Margins' },
78
+ },
79
+ },
80
+ Margins: {
81
+ type: 'object',
82
+ required: ['top', 'right', 'bottom', 'left'],
83
+ additionalProperties: false,
84
+ properties: {
85
+ top: { type: 'number', minimum: 0 },
86
+ right: { type: 'number', minimum: 0 },
87
+ bottom: { type: 'number', minimum: 0 },
88
+ left: { type: 'number', minimum: 0 },
89
+ },
90
+ },
91
+ PartialPageConfig: {
92
+ type: 'object',
93
+ additionalProperties: false,
94
+ properties: {
95
+ width: { type: 'number', exclusiveMinimum: 0 },
96
+ height: { type: 'number', exclusiveMinimum: 0 },
97
+ autoHeight: { type: 'boolean' },
98
+ orientation: { type: 'string', enum: [...orientationValues] },
99
+ margins: { $ref: '#/$defs/Margins' },
100
+ },
101
+ },
102
+ Section: {
103
+ type: 'object',
104
+ required: ['id', 'bands'],
105
+ additionalProperties: false,
106
+ properties: {
107
+ id: { type: 'string', minLength: 1 },
108
+ name: { type: 'string' },
109
+ page: { $ref: '#/$defs/PartialPageConfig' },
110
+ columns: { type: 'integer', minimum: 1 },
111
+ columnWidths: { type: 'array', items: { type: 'number', exclusiveMinimum: 0 } },
112
+ columnGap: { type: 'number', minimum: 0 },
113
+ columnMode: { type: 'string', enum: [...columnModeValues] },
114
+ bookmark: { type: 'string' },
115
+ bands: { type: 'array', items: { $ref: '#/$defs/Band' } },
116
+ },
117
+ },
118
+ Band: {
119
+ type: 'object',
120
+ required: ['id', 'type', 'height', 'elements'],
121
+ additionalProperties: false,
122
+ properties: {
123
+ id: { type: 'string', minLength: 1 },
124
+ type: { type: 'string', enum: [...bandTypes] },
125
+ height: { type: 'number', minimum: 0 },
126
+ autoHeight: { type: 'boolean' },
127
+ condition: { type: 'string' },
128
+ dataSource: { type: 'string' },
129
+ itemName: { type: 'string' },
130
+ groupBy: { type: 'string' },
131
+ float: { type: 'boolean' },
132
+ pageBreakBefore: { type: 'boolean' },
133
+ bookmark: { type: 'string' },
134
+ anchor: { type: 'string' },
135
+ backgroundColor: {
136
+ oneOf: [{ type: 'string' }, { $ref: '#/$defs/Gradient' }],
137
+ },
138
+ elements: { type: 'array', items: { $ref: '#/$defs/Element' } },
139
+ },
140
+ },
141
+ Element: {
142
+ type: 'object',
143
+ required: ['id', 'type', 'x', 'y', 'width', 'height', 'properties'],
144
+ additionalProperties: false,
145
+ properties: {
146
+ id: { type: 'string', minLength: 1 },
147
+ type: { type: 'string', minLength: 1 },
148
+ x: { type: 'number' },
149
+ y: { type: 'number' },
150
+ width: { type: 'number', minimum: 0 },
151
+ height: { type: 'number', minimum: 0 },
152
+ rotation: { type: 'number' },
153
+ anchor: { type: 'string' },
154
+ style: { type: 'string' },
155
+ styleOverrides: { $ref: '#/$defs/Style' },
156
+ condition: { type: 'string' },
157
+ conditionalStyles: {
158
+ type: 'array',
159
+ items: { $ref: '#/$defs/ConditionalStyle' },
160
+ },
161
+ properties: { type: 'object' },
162
+ elements: { type: 'array', items: { $ref: '#/$defs/Element' } },
163
+ },
164
+ },
165
+ ConditionalStyle: {
166
+ type: 'object',
167
+ required: ['condition'],
168
+ additionalProperties: false,
169
+ properties: {
170
+ condition: { type: 'string' },
171
+ style: { type: 'string' },
172
+ styleOverrides: { $ref: '#/$defs/Style' },
173
+ },
174
+ },
175
+ RichContent: {
176
+ oneOf: [{ type: 'string' }, { type: 'array', items: { $ref: '#/$defs/StyledRun' } }],
177
+ },
178
+ StyledRun: {
179
+ type: 'object',
180
+ required: ['text'],
181
+ additionalProperties: false,
182
+ properties: {
183
+ text: { type: 'string' },
184
+ style: { type: 'string' },
185
+ styleOverrides: { $ref: '#/$defs/Style' },
186
+ link: { type: 'string' },
187
+ footnote: { $ref: '#/$defs/RichContent' },
188
+ },
189
+ },
190
+ Style: {
191
+ type: 'object',
192
+ additionalProperties: false,
193
+ properties: {
194
+ fontFamily: { type: 'string' },
195
+ fontSize: { type: 'number', exclusiveMinimum: 0 },
196
+ fontWeight: { type: 'string', enum: [...fontWeightValues] },
197
+ fontStyle: { type: 'string', enum: [...fontStyleValues] },
198
+ textDecoration: { type: 'string', enum: [...textDecorationValues] },
199
+ color: { type: 'string' },
200
+ backgroundColor: {
201
+ oneOf: [{ type: 'string' }, { $ref: '#/$defs/Gradient' }],
202
+ },
203
+ textAlign: { type: 'string', enum: [...textAlignValues] },
204
+ lineHeight: { type: 'number', exclusiveMinimum: 0 },
205
+ letterSpacing: { type: 'number' },
206
+ borderWidth: { type: 'number', minimum: 0 },
207
+ borderColor: { type: 'string' },
208
+ borderTop: { $ref: '#/$defs/BorderSide' },
209
+ borderRight: { $ref: '#/$defs/BorderSide' },
210
+ borderBottom: { $ref: '#/$defs/BorderSide' },
211
+ borderLeft: { $ref: '#/$defs/BorderSide' },
212
+ borderRadius: { type: 'number', minimum: 0 },
213
+ padding: { $ref: '#/$defs/Padding' },
214
+ opacity: { type: 'number', minimum: 0, maximum: 1 },
215
+ widows: { type: 'integer', minimum: 1 },
216
+ orphans: { type: 'integer', minimum: 1 },
217
+ },
218
+ },
219
+ BorderSide: {
220
+ type: 'object',
221
+ required: ['width'],
222
+ additionalProperties: false,
223
+ properties: {
224
+ width: { type: 'number', minimum: 0 },
225
+ color: { type: 'string' },
226
+ },
227
+ },
228
+ Padding: {
229
+ oneOf: [
230
+ { type: 'number', minimum: 0 },
231
+ {
232
+ type: 'object',
233
+ required: ['top', 'right', 'bottom', 'left'],
234
+ additionalProperties: false,
235
+ properties: {
236
+ top: { type: 'number', minimum: 0 },
237
+ right: { type: 'number', minimum: 0 },
238
+ bottom: { type: 'number', minimum: 0 },
239
+ left: { type: 'number', minimum: 0 },
240
+ },
241
+ },
242
+ ],
243
+ },
244
+ GradientStop: {
245
+ type: 'object',
246
+ required: ['color', 'position'],
247
+ additionalProperties: false,
248
+ properties: {
249
+ color: { type: 'string' },
250
+ position: { type: 'number', minimum: 0, maximum: 1 },
251
+ },
252
+ },
253
+ Gradient: {
254
+ oneOf: [
255
+ {
256
+ type: 'object',
257
+ required: ['type', 'angle', 'stops'],
258
+ additionalProperties: false,
259
+ properties: {
260
+ type: { const: 'linear' },
261
+ angle: { type: 'number' },
262
+ stops: { type: 'array', minItems: 2, items: { $ref: '#/$defs/GradientStop' } },
263
+ },
264
+ },
265
+ {
266
+ type: 'object',
267
+ required: ['type', 'stops'],
268
+ additionalProperties: false,
269
+ properties: {
270
+ type: { const: 'radial' },
271
+ cx: { type: 'number', minimum: 0, maximum: 1 },
272
+ cy: { type: 'number', minimum: 0, maximum: 1 },
273
+ radius: { type: 'number', minimum: 0, maximum: 1 },
274
+ stops: { type: 'array', minItems: 2, items: { $ref: '#/$defs/GradientStop' } },
275
+ },
276
+ },
277
+ ],
278
+ },
279
+ FontDeclaration: {
280
+ type: 'object',
281
+ required: ['family', 'data'],
282
+ additionalProperties: false,
283
+ properties: {
284
+ family: { type: 'string', minLength: 1 },
285
+ weight: { type: 'number' },
286
+ style: { type: 'string', enum: [...fontStyleValues] },
287
+ data: { type: 'string', minLength: 1 },
288
+ },
289
+ },
290
+ },
291
+ };
292
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG;IAChB,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,cAAc;IACd,QAAQ;IACR,cAAc;IACd,SAAS;IACT,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,aAAa;IACb,aAAa;CACL,CAAC;AAEX,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAU,CAAC;AACrD,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AACtD,MAAM,oBAAoB,GAAG;IAC3B,MAAM;IACN,WAAW;IACX,cAAc;IACd,wBAAwB;CAChB,CAAC;AACX,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AACxE,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,WAAW,CAAU,CAAC;AAC7D,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAEnD,mEAAmE;AACnE,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC,OAAO,EAAE,8CAA8C;IACvD,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE;QACR,SAAS;QACT,MAAM;Q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E,CAAC,EAAE;wBAC9C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;wBAClD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAAE;qBAC/E;iBACF;aACF;SACF;QACD,eAAe,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC5B,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;gBACxC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,EAAE;gBACrD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;aACvC;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,261 @@
1
+ /** A JSON Schema object (draft 2020-12). */
2
+ export type JSONSchema = Record<string, unknown>;
3
+ export interface ValidationResult {
4
+ /** Whether the validated input conforms to the schema. */
5
+ valid: boolean;
6
+ /** List of validation errors (empty when valid). */
7
+ errors: ValidationError[];
8
+ }
9
+ export interface ValidationError {
10
+ /** JSON Pointer path to the invalid property (e.g. "/sections/0/bands/1"). */
11
+ path: string;
12
+ /** Human-readable error description. */
13
+ message: string;
14
+ /** JSON Schema keyword that triggered the error (e.g. "required", "type"). */
15
+ keyword?: string;
16
+ }
17
+ export interface Template {
18
+ /** Template format version. Currently only '1.0'. */
19
+ version: '1.0';
20
+ /** Display name for the template. */
21
+ name: string;
22
+ /** Optional description of what the template produces. */
23
+ description?: string;
24
+ /** Optional author name or organization. */
25
+ author?: string;
26
+ /** Optional license identifier (e.g. "MIT"). */
27
+ license?: string;
28
+ /** Default page configuration applied to all sections. */
29
+ page: PageConfig;
30
+ /** JSON Schema (draft 2020-12) describing the expected input data shape. */
31
+ dataSchema: JSONSchema;
32
+ /** Default style applied as the base layer during style resolution. fontFamily is required. */
33
+ defaultStyle: Style & {
34
+ fontFamily: string;
35
+ };
36
+ /** Named style definitions that can be referenced by elements and styled runs. */
37
+ styles: Record<string, Style>;
38
+ /** Ordered list of document sections. */
39
+ sections: Section[];
40
+ /** Custom font declarations with embedded base64 font data. */
41
+ fonts: FontDeclaration[];
42
+ }
43
+ export interface PageConfig {
44
+ /** Page width in points (1 pt = 1/72 inch). */
45
+ width: number;
46
+ /** Page height in points (1 pt = 1/72 inch). */
47
+ height: number;
48
+ /** When true, page height grows to fit content (ignores declared height). */
49
+ autoHeight?: boolean;
50
+ /** Page orientation hint. Width and height are the canonical dimensions. */
51
+ orientation?: 'portrait' | 'landscape';
52
+ /** Page margins in points. */
53
+ margins: {
54
+ /** Top margin in points. */
55
+ top: number;
56
+ /** Right margin in points. */
57
+ right: number;
58
+ /** Bottom margin in points. */
59
+ bottom: number;
60
+ /** Left margin in points. */
61
+ left: number;
62
+ };
63
+ }
64
+ export interface Section {
65
+ /** Unique section identifier. */
66
+ id: string;
67
+ /** Optional display name for the section. */
68
+ name?: string;
69
+ /** Section-level page config overrides (merged with template-level defaults). */
70
+ page?: Partial<PageConfig>;
71
+ /** Number of columns (default 1). */
72
+ columns?: number;
73
+ /** Relative column width ratios for asymmetric columns (length must match `columns`). */
74
+ columnWidths?: number[];
75
+ /** Gap between columns in points (default 0). */
76
+ columnGap?: number;
77
+ /** Column fill mode: "tile" renders each column independently, "flow" reflows text across columns. */
78
+ columnMode?: 'tile' | 'flow';
79
+ /** Bookmark title for this section in the PDF outline (level 0). */
80
+ bookmark?: string;
81
+ /** Ordered list of bands in this section. */
82
+ bands: Band[];
83
+ }
84
+ export type BandType = 'title' | 'pageHeader' | 'pageFooter' | 'lastPageFooter' | 'columnHeader' | 'detail' | 'columnFooter' | 'summary' | 'body' | 'background' | 'noData' | 'groupHeader' | 'groupFooter';
85
+ export interface Band {
86
+ /** Unique band identifier. */
87
+ id: string;
88
+ /** Band type determining its structural role and rendering order. */
89
+ type: BandType;
90
+ /** Declared band height in points. */
91
+ height: number;
92
+ /** When true, band height grows to fit its tallest element. */
93
+ autoHeight?: boolean;
94
+ /** Raw Liquid expression (without {{ }}) — band renders only when truthy. */
95
+ condition?: string;
96
+ /** Data path or special source (e.g. "_bookmarks") for detail band iteration. */
97
+ dataSource?: string;
98
+ /** Variable name for the current iteration item (default "item"). */
99
+ itemName?: string;
100
+ /** Property path to group detail items by (creates groupHeader/groupFooter pairs). */
101
+ groupBy?: string;
102
+ /** When true, columnFooter floats up to sit just below content instead of fixed at column bottom. */
103
+ float?: boolean;
104
+ /** When true, a page break is inserted before this band. */
105
+ pageBreakBefore?: boolean;
106
+ /** Bookmark title for this band in the PDF outline (level 1). */
107
+ bookmark?: string;
108
+ /** Cross-reference anchor ID for internal links via {{ ref("id") }}. */
109
+ anchor?: string;
110
+ /** Band background color — hex string or gradient object. */
111
+ backgroundColor?: BackgroundColor;
112
+ /** Elements rendered inside this band. */
113
+ elements: Element[];
114
+ }
115
+ export interface Element {
116
+ /** Unique element identifier. */
117
+ id: string;
118
+ /** Plugin type name (e.g. "text", "image", "line", "shape", "table", "chart"). */
119
+ type: string;
120
+ /** Horizontal position in points relative to the band's left edge. */
121
+ x: number;
122
+ /** Vertical position in points relative to the band's top edge. */
123
+ y: number;
124
+ /** Element width in points. */
125
+ width: number;
126
+ /** Element height in points. */
127
+ height: number;
128
+ /** Clockwise rotation in degrees around the element's center. */
129
+ rotation?: number;
130
+ /** Cross-reference anchor ID for internal links via {{ ref("id") }}. */
131
+ anchor?: string;
132
+ /** Named style reference from the template's `styles` map. */
133
+ style?: string;
134
+ /** Inline style overrides merged on top of the named style. */
135
+ styleOverrides?: Partial<Style>;
136
+ /** Raw Liquid expression (without {{ }}) — element renders only when truthy. */
137
+ condition?: string;
138
+ /** Conditional style rules evaluated in order; first matching condition wins. */
139
+ conditionalStyles?: ConditionalStyle[];
140
+ /** Plugin-specific properties (content, src, listType, etc.). */
141
+ properties: Record<string, unknown>;
142
+ /** Child elements for container-like plugins. */
143
+ elements?: Element[];
144
+ }
145
+ export interface ConditionalStyle {
146
+ /** Raw Liquid expression (without {{ }}) — style applies when truthy. */
147
+ condition: string;
148
+ /** Named style reference to apply when condition is met. */
149
+ style?: string;
150
+ /** Inline style overrides to apply when condition is met. */
151
+ styleOverrides?: Partial<Style>;
152
+ }
153
+ export type RichContent = string | StyledRun[];
154
+ export interface StyledRun {
155
+ /** The text content of this run. */
156
+ text: string;
157
+ /** Named style reference from the template's `styles` map. */
158
+ style?: string;
159
+ /** Inline style overrides for this run. */
160
+ styleOverrides?: Partial<Style>;
161
+ /** Hyperlink URL (external) or internal anchor reference (e.g. "#anchorId"). */
162
+ link?: string;
163
+ /** Footnote content displayed at the bottom of the page with a superscript marker. */
164
+ footnote?: RichContent;
165
+ }
166
+ export interface GradientStop {
167
+ /** Hex color string (e.g. "#ff0000"). */
168
+ color: string;
169
+ /** Position along the gradient axis (0–1). */
170
+ position: number;
171
+ }
172
+ export interface LinearGradient {
173
+ /** Discriminator for linear gradients. */
174
+ type: 'linear';
175
+ /** Angle in degrees. 0 = left-to-right, 90 = top-to-bottom. */
176
+ angle: number;
177
+ /** Color stops (minimum 2). */
178
+ stops: GradientStop[];
179
+ }
180
+ export interface RadialGradient {
181
+ /** Discriminator for radial gradients. */
182
+ type: 'radial';
183
+ /** Center X as fraction (0–1, default 0.5). */
184
+ cx?: number;
185
+ /** Center Y as fraction (0–1, default 0.5). */
186
+ cy?: number;
187
+ /** Radius as fraction of the shorter dimension (0–1, default 0.5). */
188
+ radius?: number;
189
+ /** Color stops (minimum 2). */
190
+ stops: GradientStop[];
191
+ }
192
+ export type Gradient = LinearGradient | RadialGradient;
193
+ /** A background color can be a hex string or a gradient object. */
194
+ export type BackgroundColor = string | Gradient;
195
+ export interface BorderSide {
196
+ /** Border width in points. */
197
+ width: number;
198
+ /** Border color as hex string (defaults to borderColor or "#000000"). */
199
+ color?: string;
200
+ }
201
+ export type PaddingValue = number | {
202
+ top: number;
203
+ right: number;
204
+ bottom: number;
205
+ left: number;
206
+ };
207
+ export interface Style {
208
+ /** Font family name (e.g. "Helvetica", "Times-Roman", or a custom font family). */
209
+ fontFamily?: string;
210
+ /** Font size in points (must be > 0). */
211
+ fontSize?: number;
212
+ /** Font weight. */
213
+ fontWeight?: 'normal' | 'bold';
214
+ /** Font style. */
215
+ fontStyle?: 'normal' | 'italic';
216
+ /** Text decoration applied to rendered text. */
217
+ textDecoration?: 'none' | 'underline' | 'line-through' | 'underline line-through';
218
+ /** Text color as hex string (e.g. "#000000"). */
219
+ color?: string;
220
+ /** Background fill — hex string or gradient object. */
221
+ backgroundColor?: BackgroundColor;
222
+ /** Horizontal text alignment. */
223
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
224
+ /** Line height as a multiplier of font size (e.g. 1.2). */
225
+ lineHeight?: number;
226
+ /** Extra spacing between characters in points. */
227
+ letterSpacing?: number;
228
+ /** Uniform border width in points (used when individual borders are not set). */
229
+ borderWidth?: number;
230
+ /** Uniform border color as hex string (used when individual borders are not set). */
231
+ borderColor?: string;
232
+ /** Top border (overrides borderWidth/borderColor for top side). */
233
+ borderTop?: BorderSide;
234
+ /** Right border (overrides borderWidth/borderColor for right side). */
235
+ borderRight?: BorderSide;
236
+ /** Bottom border (overrides borderWidth/borderColor for bottom side). */
237
+ borderBottom?: BorderSide;
238
+ /** Left border (overrides borderWidth/borderColor for left side). */
239
+ borderLeft?: BorderSide;
240
+ /** Border corner radius in points. When set, individual borders are ignored. */
241
+ borderRadius?: number;
242
+ /** Padding inside the element — uniform number or per-side object. */
243
+ padding?: PaddingValue;
244
+ /** Element opacity (0 = fully transparent, 1 = fully opaque). */
245
+ opacity?: number;
246
+ /** Minimum lines of a paragraph to keep at the top of a page/column after a break. */
247
+ widows?: number;
248
+ /** Minimum lines of a paragraph to keep at the bottom of a page/column before a break. */
249
+ orphans?: number;
250
+ }
251
+ export interface FontDeclaration {
252
+ /** Font family name (must match fontFamily references in styles). */
253
+ family: string;
254
+ /** Font weight as a numeric value (e.g. 400 for normal, 700 for bold). */
255
+ weight?: number;
256
+ /** Font style variant. */
257
+ style?: 'normal' | 'italic';
258
+ /** Base64-encoded font file data (.ttf, .otf, .woff). */
259
+ data: string;
260
+ }
261
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIjD,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,KAAK,EAAE,OAAO,CAAC;IACf,oDAAoD;IACpD,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,OAAO,EAAE,KAAK,CAAC;IACf,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,IAAI,EAAE,UAAU,CAAC;IACjB,4EAA4E;IAC5E,UAAU,EAAE,UAAU,CAAC;IACvB,+FAA+F;IAC/F,YAAY,EAAE,KAAK,GAAG;QAAE,UAA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AG,SAAS,CAAC;IACpD,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,uEAAuE;IACvE,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,yEAAyE;IACzE,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,qEAAqE;IACrE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;CACd"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // ---- JSON Schema alias ----
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,8BAA8B"}
@@ -0,0 +1,16 @@
1
+ export interface RGB {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ }
6
+ /**
7
+ * Parse a hex color string to RGB values in the 0–1 range.
8
+ * Supports #RGB and #RRGGBB formats.
9
+ */
10
+ export declare function parseColor(hex: string): RGB;
11
+ import type { Gradient } from '../types.js';
12
+ /** Check if a value is a gradient object (as opposed to a hex string). */
13
+ export declare function isGradient(value: unknown): value is Gradient;
14
+ /** Convert RGB (0–1 range) to a #RRGGBB hex string. Values are clamped to 0–1. */
15
+ export declare function toHex(rgb: RGB): string;
16
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CA+B3C;AAED,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAO5D;AAOD,kFAAkF;AAClF,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAWtC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Parse a hex color string to RGB values in the 0–1 range.
3
+ * Supports #RGB and #RRGGBB formats.
4
+ */
5
+ export function parseColor(hex) {
6
+ if (!hex.startsWith('#')) {
7
+ throw new Error(`Invalid color format: "${hex}" (must start with #)`);
8
+ }
9
+ const raw = hex.slice(1);
10
+ if (raw.length === 3) {
11
+ const c0 = raw[0];
12
+ const c1 = raw[1];
13
+ const c2 = raw[2];
14
+ const r = parseInt(c0 + c0, 16);
15
+ const g = parseInt(c1 + c1, 16);
16
+ const b = parseInt(c2 + c2, 16);
17
+ if (isNaN(r) || isNaN(g) || isNaN(b)) {
18
+ throw new Error(`Invalid color format: "${hex}"`);
19
+ }
20
+ return { r: r / 255, g: g / 255, b: b / 255 };
21
+ }
22
+ if (raw.length === 6) {
23
+ const r = parseInt(raw.slice(0, 2), 16);
24
+ const g = parseInt(raw.slice(2, 4), 16);
25
+ const b = parseInt(raw.slice(4, 6), 16);
26
+ if (isNaN(r) || isNaN(g) || isNaN(b)) {
27
+ throw new Error(`Invalid color format: "${hex}"`);
28
+ }
29
+ return { r: r / 255, g: g / 255, b: b / 255 };
30
+ }
31
+ throw new Error(`Invalid color format: "${hex}" (must be #RGB or #RRGGBB)`);
32
+ }
33
+ /** Check if a value is a gradient object (as opposed to a hex string). */
34
+ export function isGradient(value) {
35
+ return (value !== null &&
36
+ typeof value === 'object' &&
37
+ 'type' in value &&
38
+ (value.type === 'linear' || value.type === 'radial'));
39
+ }
40
+ /** Clamp a value to the 0–1 range. */
41
+ function clamp01(v) {
42
+ return Math.max(0, Math.min(1, v));
43
+ }
44
+ /** Convert RGB (0–1 range) to a #RRGGBB hex string. Values are clamped to 0–1. */
45
+ export function toHex(rgb) {
46
+ const r = Math.round(clamp01(rgb.r) * 255)
47
+ .toString(16)
48
+ .padStart(2, '0');
49
+ const g = Math.round(clamp01(rgb.g) * 255)
50
+ .toString(16)
51
+ .padStart(2, '0');
52
+ const b = Math.round(clamp01(rgb.b) * 255)
53
+ .toString(16)
54
+ .padStart(2, '0');
55
+ return `#${r}${g}${b}`;
56
+ }
57
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,uBAAuB,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEzB,IAAI,GAAG,C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AAG,GAAG,CAAC;SACvC,QAAQ,CAAC,EAAE,CAAC;SACZ,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Generate a unique ID, optionally with a prefix. */
2
+ export declare function generateId(prefix?: string): string;
3
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/utils/ids.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlD"}
@@ -0,0 +1,6 @@
1
+ /** Generate a unique ID, optionally with a prefix. */
2
+ export function generateId(prefix) {
3
+ const uuid = crypto.randomUUID();
4
+ return prefix ? `${prefix}_${uuid}` : uuid;
5
+ }
6
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/utils/ids.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,MAAM,UAAU,UAAU,CAAC,MAAe;IACxC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACjC,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Convert millimeters to points (1 point = 1/72 inch). */
2
+ export declare function mmToPoints(mm: number): number;
3
+ /** Convert inches to points. */
4
+ export declare function inchesToPoints(inches: number): number;
5
+ /** Convert points to millimeters. */
6
+ export declare function pointsToMm(points: number): number;
7
+ /** Convert points to inches. */
8
+ export declare function pointsToInches(points: number): number;
9
+ //# sourceMappingURL=units.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/utils/units.ts"],"names":[],"mappings":"AAGA,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,gCAAgC;AAChC,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,gCAAgC;AAChC,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -0,0 +1,19 @@
1
+ const MM_PER_POINT = 25.4 / 72;
2
+ const POINTS_PER_INCH = 72;
3
+ /** Convert millimeters to points (1 point = 1/72 inch). */
4
+ export function mmToPoints(mm) {
5
+ return mm / MM_PER_POINT;
6
+ }
7
+ /** Convert inches to points. */
8
+ export function inchesToPoints(inches) {
9
+ return inches * POINTS_PER_INCH;
10
+ }
11
+ /** Convert points to millimeters. */
12
+ export function pointsToMm(points) {
13
+ return points * MM_PER_POINT;
14
+ }
15
+ /** Convert points to inches. */
16
+ export function pointsToInches(points) {
17
+ return points / POINTS_PER_INCH;
18
+ }
19
+ //# sourceMappingURL=units.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"units.js","sourceRoot":"","sources":["../../src/utils/units.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,2DAA2D;AAC3D,MAAM,UAAU,UAAU,CAAC,EAAU;IACnC,OAAO,EAAE,GAAG,YAAY,CAAC;AAC3B,CAAC;AAED,gCAAgC;AAChC,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,MAAM,GAAG,eAAe,CAAC;AAClC,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO,MAAM,GAAG,YAAY,CAAC;AAC/B,CAAC;AAED,gCAAgC;AAChC,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,MAAM,GAAG,eAAe,CAAC;AAClC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ValidationResult, JSONSchema } from './types.js';
2
+ import { type PluginSchemaEntry } from './expression-schema.js';
3
+ /** Validate data against the template JSON Schema. */
4
+ export declare function validateTemplateSchema(data: unknown, pluginSchemas?: readonly PluginSchemaEntry[]): ValidationResult;
5
+ /** Validate data against an arbitrary JSON Schema (draft 2020-12). */
6
+ export declare function validateWithSchema(schema: JSONSchema, data: unknown): ValidationResult;
7
+ /**
8
+ * Return a deep copy of `data` with `default` values from the schema filled in
9
+ * for any missing properties. Uses AJV's `useDefaults` option.
10
+ */
11
+ export declare function applySchemaDefaults(schema: JSONSchema, data: Record<string, unknown>): Record<string, unknown>;
12
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AA6BhG,sDAAsD;AACtD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,EACb,aAAa,CAAC,EAAE,SAAS,iBAAiB,EAAE,GAC3C,gBAAgB,CAWlB;AAID,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAYtF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKzB"}
@@ -0,0 +1,63 @@
1
+ import { Ajv2020 } from 'ajv/dist/2020.js';
2
+ import { templateSchema } from './schema.js';
3
+ import { buildPluginAwareTemplateSchema } from './expression-schema.js';
4
+ let cachedAjv = null;
5
+ let cachedValidate = null;
6
+ function getAjv() {
7
+ if (!cachedAjv) {
8
+ cachedAjv = new Ajv2020({ allErrors: true });
9
+ }
10
+ return cachedAjv;
11
+ }
12
+ function getTemplateValidator() {
13
+ if (!cachedValidate) {
14
+ cachedValidate = getAjv().compile(templateSchema);
15
+ }
16
+ return cachedValidate;
17
+ }
18
+ function mapErrors(errors) {
19
+ return (errors ?? []).map((e) => ({
20
+ path: e.instancePath || '/',
21
+ message: e.message ?? 'Unknown validation error',
22
+ keyword: e.keyword,
23
+ }));
24
+ }
25
+ /** Validate data against the template JSON Schema. */
26
+ export function validateTemplateSchema(data, pluginSchemas) {
27
+ if (pluginSchemas?.length) {
28
+ const augmented = buildPluginAwareTemplateSchema(pluginSchemas);
29
+ return validateWithSchema(augmented, data);
30
+ }
31
+ const validate = getTemplateValidator();
32
+ const valid = validate(data);
33
+ if (valid) {
34
+ return { valid: true, errors: [] };
35
+ }
36
+ return { valid: false, errors: mapErrors(validate.errors) };
37
+ }
38
+ const schemaValidators = new WeakMap();
39
+ /** Validate data against an arbitrary JSON Schema (draft 2020-12). */
40
+ export function validateWithSchema(schema, data) {
41
+ let validate = schemaValidators.get(schema);
42
+ if (!validate) {
43
+ const ajv = new Ajv2020({ allErrors: true });
44
+ validate = ajv.compile(schema);
45
+ schemaValidators.set(schema, validate);
46
+ }
47
+ const valid = validate(data);
48
+ if (valid) {
49
+ return { valid: true, errors: [] };
50
+ }
51
+ return { valid: false, errors: mapErrors(validate.errors) };
52
+ }
53
+ /**
54
+ * Return a deep copy of `data` with `default` values from the schema filled in
55
+ * for any missing properties. Uses AJV's `useDefaults` option.
56
+ */
57
+ export function applySchemaDefaults(schema, data) {
58
+ const cloned = structuredClone(data);
59
+ const ajv = new Ajv2020({ useDefaults: true });
60
+ ajv.compile(schema)(cloned);
61
+ return cloned;
62
+ }
63
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 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,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@jsonpdf/core",
3
+ "version": "0.1.0-alpha.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "dependencies": {
18
+ "ajv": "^8.17.1"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc --build",
22
+ "typecheck": "tsc --build --noEmit"
23
+ }
24
+ }