@pdfme/schemas 5.3.8-dev.56 → 5.3.8-dev.58

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.
Files changed (81) hide show
  1. package/dist/cjs/src/barcodes/propPanel.js +3 -3
  2. package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
  3. package/dist/cjs/src/checkbox/index.js +1 -1
  4. package/dist/cjs/src/multiVariableText/propPanel.js +14 -9
  5. package/dist/cjs/src/multiVariableText/propPanel.js.map +1 -1
  6. package/dist/cjs/src/multiVariableText/uiRender.js +14 -4
  7. package/dist/cjs/src/multiVariableText/uiRender.js.map +1 -1
  8. package/dist/cjs/src/radioGroup/index.js +1 -1
  9. package/dist/cjs/src/shapes/line.js +1 -1
  10. package/dist/cjs/src/shapes/rectAndEllipse.js +8 -4
  11. package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -1
  12. package/dist/cjs/src/tables/helper.js +4 -4
  13. package/dist/cjs/src/tables/tableHelper.js.map +1 -1
  14. package/dist/cjs/src/text/pdfRender.js +1 -1
  15. package/dist/cjs/src/text/pdfRender.js.map +1 -1
  16. package/dist/cjs/src/text/uiRender.js.map +1 -1
  17. package/dist/cjs/src/utils.js +13 -17
  18. package/dist/cjs/src/utils.js.map +1 -1
  19. package/dist/esm/src/barcodes/propPanel.js +3 -3
  20. package/dist/esm/src/barcodes/propPanel.js.map +1 -1
  21. package/dist/esm/src/checkbox/index.js +1 -1
  22. package/dist/esm/src/multiVariableText/propPanel.js +14 -9
  23. package/dist/esm/src/multiVariableText/propPanel.js.map +1 -1
  24. package/dist/esm/src/multiVariableText/uiRender.js +15 -5
  25. package/dist/esm/src/multiVariableText/uiRender.js.map +1 -1
  26. package/dist/esm/src/radioGroup/index.js +1 -1
  27. package/dist/esm/src/shapes/line.js +1 -1
  28. package/dist/esm/src/shapes/rectAndEllipse.js +8 -4
  29. package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -1
  30. package/dist/esm/src/tables/helper.js +4 -4
  31. package/dist/esm/src/tables/tableHelper.js.map +1 -1
  32. package/dist/esm/src/text/pdfRender.js +1 -1
  33. package/dist/esm/src/text/pdfRender.js.map +1 -1
  34. package/dist/esm/src/text/uiRender.js.map +1 -1
  35. package/dist/esm/src/utils.js +13 -17
  36. package/dist/esm/src/utils.js.map +1 -1
  37. package/dist/node/src/barcodes/propPanel.js +3 -3
  38. package/dist/node/src/barcodes/propPanel.js.map +1 -1
  39. package/dist/node/src/checkbox/index.js +1 -1
  40. package/dist/node/src/multiVariableText/propPanel.js +14 -9
  41. package/dist/node/src/multiVariableText/propPanel.js.map +1 -1
  42. package/dist/node/src/multiVariableText/uiRender.js +14 -4
  43. package/dist/node/src/multiVariableText/uiRender.js.map +1 -1
  44. package/dist/node/src/radioGroup/index.js +1 -1
  45. package/dist/node/src/shapes/line.js +1 -1
  46. package/dist/node/src/shapes/rectAndEllipse.js +8 -4
  47. package/dist/node/src/shapes/rectAndEllipse.js.map +1 -1
  48. package/dist/node/src/tables/helper.js +4 -4
  49. package/dist/node/src/tables/tableHelper.js.map +1 -1
  50. package/dist/node/src/text/pdfRender.js +1 -1
  51. package/dist/node/src/text/pdfRender.js.map +1 -1
  52. package/dist/node/src/text/uiRender.js.map +1 -1
  53. package/dist/node/src/utils.js +13 -17
  54. package/dist/node/src/utils.js.map +1 -1
  55. package/package.json +1 -1
  56. package/src/barcodes/helper.ts +1 -2
  57. package/src/barcodes/index.ts +1 -1
  58. package/src/barcodes/pdfRender.ts +1 -1
  59. package/src/barcodes/propPanel.ts +3 -4
  60. package/src/checkbox/index.ts +1 -1
  61. package/src/date/helper.ts +3 -3
  62. package/src/graphics/imagehelper.ts +1 -1
  63. package/src/graphics/svg.ts +3 -3
  64. package/src/multiVariableText/helper.ts +3 -3
  65. package/src/multiVariableText/propPanel.ts +17 -14
  66. package/src/multiVariableText/uiRender.ts +21 -18
  67. package/src/radioGroup/index.ts +2 -2
  68. package/src/select/index.ts +1 -1
  69. package/src/shapes/line.ts +1 -1
  70. package/src/shapes/rectAndEllipse.ts +10 -4
  71. package/src/tables/cell.ts +4 -4
  72. package/src/tables/classes.ts +5 -5
  73. package/src/tables/dynamicTemplate.ts +1 -1
  74. package/src/tables/helper.ts +6 -6
  75. package/src/tables/pdfRender.ts +3 -3
  76. package/src/tables/tableHelper.ts +13 -10
  77. package/src/tables/uiRender.ts +5 -5
  78. package/src/text/helper.ts +5 -5
  79. package/src/text/pdfRender.ts +3 -3
  80. package/src/text/uiRender.ts +13 -5
  81. package/src/utils.ts +27 -31
@@ -70,7 +70,11 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
70
70
  };
71
71
  const font = options?.font || getDefaultFont();
72
72
  const fontKitFont = await getFontKitFont(schema.fontName, font, _cache);
73
- const textBlock = buildStyledTextContainer(arg, fontKitFont, usePlaceholder ? placeholder : value);
73
+ const textBlock = buildStyledTextContainer(
74
+ arg,
75
+ fontKitFont,
76
+ usePlaceholder ? placeholder : value,
77
+ );
74
78
 
75
79
  const processedText = replaceUnsupportedChars(value, fontKitFont);
76
80
 
@@ -82,7 +86,7 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
82
86
  (l, i) =>
83
87
  `<span style="letter-spacing:${
84
88
  String(value).length === i + 1 ? 0 : 'inherit'
85
- };">${l}</span>`
89
+ };">${l}</span>`,
86
90
  )
87
91
  .join('');
88
92
  return;
@@ -115,7 +119,7 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
115
119
  fontKitFont,
116
120
  dynamicFontSize ?? schema.fontSize ?? DEFAULT_FONT_SIZE,
117
121
  schema.lineHeight ?? DEFAULT_LINE_HEIGHT,
118
- schema.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT
122
+ schema.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT,
119
123
  );
120
124
  textBlock.style.paddingTop = `${newTopAdj}px`;
121
125
  textBlock.style.marginBottom = `${newBottomAdj}px`;
@@ -150,7 +154,11 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
150
154
  }
151
155
  };
152
156
 
153
- export const buildStyledTextContainer = (arg: UIRenderProps<TextSchema>, fontKitFont: FontKitFont, value: string) => {
157
+ export const buildStyledTextContainer = (
158
+ arg: UIRenderProps<TextSchema>,
159
+ fontKitFont: FontKitFont,
160
+ value: string,
161
+ ) => {
154
162
  const { schema, rootElement, mode, options, _cache } = arg;
155
163
  const font = options?.font || getDefaultFont();
156
164
 
@@ -171,7 +179,7 @@ export const buildStyledTextContainer = (arg: UIRenderProps<TextSchema>, fontKit
171
179
  fontKitFont,
172
180
  dynamicFontSize ?? schema.fontSize ?? DEFAULT_FONT_SIZE,
173
181
  schema.lineHeight ?? DEFAULT_LINE_HEIGHT,
174
- schema.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT
182
+ schema.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT,
175
183
  );
176
184
 
177
185
  const topAdjustment = topAdj.toString();
package/src/utils.ts CHANGED
@@ -45,7 +45,7 @@ export const convertForPdfLayoutProps = ({
45
45
  export const rotatePoint = (
46
46
  point: { x: number; y: number },
47
47
  pivot: { x: number; y: number },
48
- angleDegrees: number
48
+ angleDegrees: number,
49
49
  ): { x: number; y: number } => {
50
50
  const angleRadians = degreesToRadians(angleDegrees);
51
51
 
@@ -148,10 +148,8 @@ const hex2CmykColor = (hexString: string | undefined) => {
148
148
 
149
149
  export const hex2PrintingColor = (color?: string | Color, colorType?: ColorType) => {
150
150
  // if color is already CMYK, RGB or Grayscale, does not required to convert
151
- if (typeof color === 'object') return color
152
- return colorType?.toLowerCase() == 'cmyk'
153
- ? hex2CmykColor(color)
154
- : hex2RgbColor(color);
151
+ if (typeof color === 'object') return color;
152
+ return colorType?.toLowerCase() == 'cmyk' ? hex2CmykColor(color) : hex2RgbColor(color);
155
153
  };
156
154
 
157
155
  export const readFile = (input: File | FileList | null): Promise<string | ArrayBuffer> =>
@@ -214,54 +212,52 @@ export const createErrorElm = () => {
214
212
  export const createSvgStr = (icon: IconNode, attrs?: Record<string, string>): string => {
215
213
  // In lucide 0.475.0, the icon is an array of elements, not a single SVG element
216
214
  // We need to create an SVG wrapper and add the elements as children
217
-
215
+
218
216
  // Handle non-array input
219
217
  if (!Array.isArray(icon)) {
220
218
  return String(icon);
221
219
  }
222
-
220
+
223
221
  // Create default SVG attributes
224
222
  const svgAttrs = {
225
- xmlns: "http://www.w3.org/2000/svg",
226
- width: "24",
227
- height: "24",
228
- viewBox: "0 0 24 24",
229
- fill: "none",
230
- stroke: "currentColor",
231
- "stroke-width": "2",
232
- "stroke-linecap": "round",
233
- "stroke-linejoin": "round",
234
- ...(attrs || {})
223
+ xmlns: 'http://www.w3.org/2000/svg',
224
+ width: '24',
225
+ height: '24',
226
+ viewBox: '0 0 24 24',
227
+ fill: 'none',
228
+ stroke: 'currentColor',
229
+ 'stroke-width': '2',
230
+ 'stroke-linecap': 'round',
231
+ 'stroke-linejoin': 'round',
232
+ ...(attrs || {}),
235
233
  };
236
-
234
+
237
235
  // Format SVG attributes string
238
236
  const svgAttrString = Object.entries(svgAttrs)
239
237
  .map(([key, value]) => `${key}="${value}"`)
240
238
  .join(' ');
241
-
239
+
242
240
  // Helper function to process a single element
243
241
  const processElement = (element: any): string => {
244
242
  if (!Array.isArray(element)) {
245
243
  return String(element);
246
244
  }
247
-
245
+
248
246
  const [tag, attributes = {}, children = []] = element;
249
247
  const tagName = String(tag);
250
-
248
+
251
249
  // Format attributes string
252
250
  const attrString = Object.entries(attributes)
253
251
  .map(([key, value]) => `${key}="${value}"`)
254
252
  .join(' ');
255
-
253
+
256
254
  // Process children recursively
257
255
  let childrenString = '';
258
-
256
+
259
257
  if (Array.isArray(children) && children.length > 0) {
260
- childrenString = children
261
- .map(child => processElement(child))
262
- .join('');
258
+ childrenString = children.map((child) => processElement(child)).join('');
263
259
  }
264
-
260
+
265
261
  // Return properly formatted element string
266
262
  if (childrenString) {
267
263
  return `<${tagName}${attrString ? ' ' + attrString : ''}>${childrenString}</${tagName}>`;
@@ -270,12 +266,12 @@ export const createSvgStr = (icon: IconNode, attrs?: Record<string, string>): st
270
266
  return `<${tagName}${attrString ? ' ' + attrString : ''}/>`;
271
267
  }
272
268
  };
273
-
269
+
274
270
  // Process all elements and join them
275
- const elementsString = Array.isArray(icon)
276
- ? icon.map(element => processElement(element)).join('')
271
+ const elementsString = Array.isArray(icon)
272
+ ? icon.map((element) => processElement(element)).join('')
277
273
  : processElement(icon);
278
-
274
+
279
275
  // Return the complete SVG string
280
276
  return `<svg ${svgAttrString}>${elementsString}</svg>`;
281
277
  };