@pdfme/common 6.1.1-dev.8 → 6.1.2

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/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { PDFME_VERSION } from './version.js';
2
2
  import { MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME } from './constants.js';
3
- import type { ChangeSchemaItem, ChangeSchemas, SchemaPageArray, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, Mode, UIRenderProps, Plugin, Lang, Dict, Size, Schema, SchemaForUI, Font, ColorType, BasePdf, BlankPdf, CustomPdf, Template, CommonOptions, GeneratorOptions, Plugins, PluginRegistry, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, DynamicLayoutArgs, DynamicLayoutCallbackResult, DynamicLayoutPatchArgs, DynamicLayoutResult, GetDynamicLayout } from './types.js';
3
+ import type { ChangeSchemaItem, ChangeSchemas, SchemaPageArray, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, Mode, UIRenderProps, Plugin, Lang, Dict, Size, Schema, SchemaForUI, Font, ColorType, DynamicLayoutRange, DynamicLayoutSplitRange, BasePdf, BlankPdf, CustomPdf, Template, CommonOptions, GeneratorOptions, Plugins, PluginRegistry, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, DynamicLayoutArgs, DynamicLayoutCallbackResult, DynamicLayoutPatchArgs, DynamicLayoutResult, GetDynamicLayout } from './types.js';
4
4
  import type { PdfLinkAnnotationRect } from './helper.js';
5
5
  import type { PageOrientation, PageSize, PageSizePreset } from './pageSize.js';
6
6
  import { cloneDeep, getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, isUrlSafeToFetch, getInternalLinkTarget, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, registerInternalLinkAnchor, registerInternalLinkAnnotation, resetInternalLinkAnnotations, applyInternalLinkAnnotations } from './helper.js';
7
7
  import { PAGE_SIZE_PRESETS, detectPaperSize, resolvePageSize } from './pageSize.js';
8
8
  import { getDynamicTemplate } from './dynamicTemplate.js';
9
+ import { createDynamicLayoutSplitRange, getDynamicLayoutSplitRange } from './splitRange.js';
9
10
  import { replacePlaceholders } from './expression.js';
10
11
  import { pluginRegistry } from './pluginRegistry.js';
11
- export { PDFME_VERSION, MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME, cloneDeep, getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, getDynamicTemplate, replacePlaceholders, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, pluginRegistry, isUrlSafeToFetch, getInternalLinkTarget, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, registerInternalLinkAnchor, registerInternalLinkAnnotation, resetInternalLinkAnnotations, applyInternalLinkAnnotations, PAGE_SIZE_PRESETS, detectPaperSize, resolvePageSize, };
12
- export type { Lang, Dict, Size, Schema, SchemaForUI, Font, ColorType, BasePdf, BlankPdf, CustomPdf, Template, CommonOptions, GeneratorOptions, Plugin, Plugins, PluginRegistry, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, ChangeSchemaItem, ChangeSchemas, SchemaPageArray, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Mode, DynamicLayoutArgs, DynamicLayoutCallbackResult, DynamicLayoutPatchArgs, DynamicLayoutResult, GetDynamicLayout, PdfLinkAnnotationRect, PageOrientation, PageSize, PageSizePreset, };
12
+ export { PDFME_VERSION, MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME, cloneDeep, getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, getDynamicTemplate, replacePlaceholders, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, pluginRegistry, isUrlSafeToFetch, getInternalLinkTarget, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, registerInternalLinkAnchor, registerInternalLinkAnnotation, resetInternalLinkAnnotations, applyInternalLinkAnnotations, PAGE_SIZE_PRESETS, detectPaperSize, resolvePageSize, createDynamicLayoutSplitRange, getDynamicLayoutSplitRange, };
13
+ export type { Lang, Dict, Size, Schema, SchemaForUI, Font, ColorType, DynamicLayoutRange, DynamicLayoutSplitRange, BasePdf, BlankPdf, CustomPdf, Template, CommonOptions, GeneratorOptions, Plugin, Plugins, PluginRegistry, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, ChangeSchemaItem, ChangeSchemas, SchemaPageArray, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Mode, DynamicLayoutArgs, DynamicLayoutCallbackResult, DynamicLayoutPatchArgs, DynamicLayoutResult, GetDynamicLayout, PdfLinkAnnotationRect, PageOrientation, PageSize, PageSizePreset, };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Buffer } from "buffer";
3
3
  import { PDFName } from "@pdfme/pdf-lib";
4
4
  import * as acorn from "acorn";
5
5
  //#region src/version.ts
6
- var PDFME_VERSION = "6.1.1";
6
+ var PDFME_VERSION = "6.1.2";
7
7
  //#endregion
8
8
  //#region src/pageSize.ts
9
9
  var PAGE_SIZE_PRESETS = {
@@ -223,6 +223,11 @@ z.object({
223
223
  height: z.number(),
224
224
  width: z.number()
225
225
  });
226
+ var DynamicLayoutSplitRange = z.object({
227
+ unit: z.string().min(1),
228
+ start: z.number(),
229
+ end: z.number().optional()
230
+ });
226
231
  var Schema = z.object({
227
232
  name: z.string(),
228
233
  type: z.string(),
@@ -237,18 +242,7 @@ var Schema = z.object({
237
242
  opacity: z.number().optional(),
238
243
  readOnly: z.boolean().optional(),
239
244
  required: z.boolean().optional(),
240
- __bodyRange: z.object({
241
- start: z.number(),
242
- end: z.number().optional()
243
- }).optional(),
244
- __itemRange: z.object({
245
- start: z.number(),
246
- end: z.number().optional()
247
- }).optional(),
248
- __textLineRange: z.object({
249
- start: z.number(),
250
- end: z.number().optional()
251
- }).optional(),
245
+ __splitRange: DynamicLayoutSplitRange.optional(),
252
246
  __isSplit: z.boolean().optional()
253
247
  }).passthrough();
254
248
  var SchemaForUIAdditionalInfo = z.object({ id: z.string() });
@@ -1162,6 +1156,21 @@ var getDynamicTemplate = async (arg) => {
1162
1156
  };
1163
1157
  };
1164
1158
  //#endregion
1159
+ //#region src/splitRange.ts
1160
+ var createDynamicLayoutSplitRange = (unit, start, end) => ({
1161
+ unit,
1162
+ start,
1163
+ ...end === void 0 ? {} : { end }
1164
+ });
1165
+ var getDynamicLayoutSplitRange = (schema, unit) => {
1166
+ const range = schema.__splitRange;
1167
+ if (range?.unit !== unit) return void 0;
1168
+ return {
1169
+ start: range.start,
1170
+ ...range.end === void 0 ? {} : { end: range.end }
1171
+ };
1172
+ };
1173
+ //#endregion
1165
1174
  //#region src/pluginRegistry.ts
1166
1175
  /**
1167
1176
  * Wraps plugins collection with utility methods
@@ -1188,6 +1197,6 @@ var pluginRegistry = (plugins) => {
1188
1197
  };
1189
1198
  };
1190
1199
  //#endregion
1191
- export { BLANK_A4_PDF, BLANK_PDF, CUSTOM_A4_PDF, DEFAULT_FONT_NAME, MM_TO_PT_RATIO, PAGE_SIZE_PRESETS, PDFME_VERSION, PT_TO_MM_RATIO, PT_TO_PX_RATIO, ZOOM, applyInternalLinkAnnotations, b64toUint8Array, checkDesignerProps, checkFont, checkGenerateProps, checkInputs, checkPreviewProps, checkTemplate, checkUIOptions, checkUIProps, cloneDeep, detectPaperSize, getB64BasePdf, getDefaultFont, getDynamicTemplate, getFallbackFontName, getInputFromTemplate, getInternalLinkTarget, isBlankPdf, isHexValid, isUrlSafeToFetch, mm2pt, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, pluginRegistry, pt2mm, pt2px, px2mm, registerInternalLinkAnchor, registerInternalLinkAnnotation, replacePlaceholders, resetInternalLinkAnnotations, resolvePageSize };
1200
+ export { BLANK_A4_PDF, BLANK_PDF, CUSTOM_A4_PDF, DEFAULT_FONT_NAME, MM_TO_PT_RATIO, PAGE_SIZE_PRESETS, PDFME_VERSION, PT_TO_MM_RATIO, PT_TO_PX_RATIO, ZOOM, applyInternalLinkAnnotations, b64toUint8Array, checkDesignerProps, checkFont, checkGenerateProps, checkInputs, checkPreviewProps, checkTemplate, checkUIOptions, checkUIProps, cloneDeep, createDynamicLayoutSplitRange, detectPaperSize, getB64BasePdf, getDefaultFont, getDynamicLayoutSplitRange, getDynamicTemplate, getFallbackFontName, getInputFromTemplate, getInternalLinkTarget, isBlankPdf, isHexValid, isUrlSafeToFetch, mm2pt, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, pluginRegistry, pt2mm, pt2px, px2mm, registerInternalLinkAnchor, registerInternalLinkAnnotation, replacePlaceholders, resetInternalLinkAnnotations, resolvePageSize };
1192
1201
 
1193
1202
  //# sourceMappingURL=index.js.map