@pdfme/schemas 6.2.6 → 6.2.7-dev.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/{builtins-BW_NgJf9.js → builtins-BU9zSggO.js} +3 -3
- package/dist/{builtins-BW_NgJf9.js.map → builtins-BU9zSggO.js.map} +1 -1
- package/dist/builtins.js +1 -2
- package/dist/dynamicLayout.js +1 -1
- package/dist/{dynamicTemplate-CkX3dzIQ.js → dynamicTemplate-DbxdkEGp.js} +5 -5
- package/dist/{dynamicTemplate-CkX3dzIQ.js.map → dynamicTemplate-DbxdkEGp.js.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/tables.js +1 -1
- package/dist/{utils-C361jF7a.js → utils-CbHtVsNs.js} +2 -2
- package/dist/{utils-C361jF7a.js.map → utils-CbHtVsNs.js.map} +1 -1
- package/dist/utils.js +1 -1
- package/package.json +3 -3
package/dist/tables.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { l as getTableBodyRange, o as createTableBodySplitRange, r as TABLE_BODY_SPLIT_UNIT } from "./splitRange-BkQuwzIU.js";
|
|
2
|
-
import { n as getDynamicLayoutForTable, t as getDynamicHeightsForTable } from "./dynamicTemplate-
|
|
2
|
+
import { n as getDynamicLayoutForTable, t as getDynamicHeightsForTable } from "./dynamicTemplate-DbxdkEGp.js";
|
|
3
3
|
export { TABLE_BODY_SPLIT_UNIT, createTableBodySplitRange, getDynamicHeightsForTable, getDynamicLayoutForTable, getTableBodyRange };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as getDynamicHeightsForTable$1 } from "./dynamicTemplate-
|
|
1
|
+
import { t as getDynamicHeightsForTable$1 } from "./dynamicTemplate-DbxdkEGp.js";
|
|
2
2
|
import { isHexValid, mm2pt } from "@pdfme/common";
|
|
3
3
|
import { cmyk, degrees, degreesToRadians, rgb } from "@pdfme/pdf-lib";
|
|
4
4
|
//#region src/multiVariableText/variables.ts
|
|
@@ -263,4 +263,4 @@ var createSvgStr = (icon, attrs) => {
|
|
|
263
263
|
//#endregion
|
|
264
264
|
export { createSvgStr as a, hex2RgbColor as c, rgbColorToCmykColor as d, rotatePoint as f, visitVariables as g, getVariableNames as h, createErrorElm as i, isEditable as l, countUniqueVariableNames as m, applyAlphaToOpacity as n, getDynamicHeightsForTable as o, splitHexAlpha as p, convertForPdfLayoutProps as r, hex2PrintingColor as s, addAlphaToHex as t, readFile as u };
|
|
265
265
|
|
|
266
|
-
//# sourceMappingURL=utils-
|
|
266
|
+
//# sourceMappingURL=utils-CbHtVsNs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-C361jF7a.js","names":["_getDynamicHeightsForTable"],"sources":["../src/multiVariableText/variables.ts","../src/utils.ts"],"sourcesContent":["export type VariableMatch = {\n name: string;\n startIndex: number;\n endIndex: number;\n};\n\nexport type VariableIndices = Map<number, string>;\n\nexport const visitVariables = (content: string, visitor: (match: VariableMatch) => void): void => {\n let startIndex = -1;\n\n for (let i = 0; i < content.length; i++) {\n const char = content[i];\n\n if (char === '{') {\n // Restart from the latest opener so malformed input behaves like /{([^{}]+)}/g\n // without requiring backtracking.\n startIndex = i;\n continue;\n }\n\n if (char === '}' && startIndex !== -1) {\n const name = content.slice(startIndex + 1, i);\n if (name.length > 0) {\n visitor({ name, startIndex, endIndex: i });\n }\n startIndex = -1;\n }\n }\n};\n\nexport const getVariableIndices = (content: string): VariableIndices => {\n const indices: VariableIndices = new Map();\n\n visitVariables(content, ({ name, startIndex }) => {\n indices.set(startIndex, name);\n });\n\n return indices;\n};\n\nexport const countUniqueVariableNames = (content: string): number => {\n const variableNames = new Set<string>();\n\n visitVariables(content, ({ name }) => {\n variableNames.add(name);\n });\n\n return variableNames.size;\n};\n\nexport const getVariableNames = (content: string): string[] => {\n const variableNames: string[] = [];\n\n visitVariables(content, ({ name }) => {\n variableNames.push(name);\n });\n\n return variableNames;\n};\n","import type * as CSS from 'csstype';\nimport { cmyk, degrees, degreesToRadians, rgb, type Color, type RGB } from '@pdfme/pdf-lib';\nimport { Schema, mm2pt, Mode, isHexValid, ColorType } from '@pdfme/common';\nimport { IconNode } from 'lucide';\nimport { getDynamicHeightsForTable as _getDynamicHeightsForTable } from './tables/dynamicTemplate.js';\nexport { measureTextHeight } from './text/measure.js';\nexport { escapeInlineMarkdown } from './text/inlineMarkdown.js';\nexport { getVariableNames, visitVariables } from './multiVariableText/variables.js';\nexport const convertForPdfLayoutProps = ({\n schema,\n pageHeight,\n applyRotateTranslate = true,\n}: {\n schema: Schema;\n pageHeight: number;\n applyRotateTranslate?: boolean;\n}) => {\n const { width: mmWidth, height: mmHeight, position, rotate, opacity } = schema;\n const { x: mmX, y: mmY } = position;\n\n const rotateDegrees = rotate ? -rotate : 0;\n const width = mm2pt(mmWidth);\n const height = mm2pt(mmHeight);\n let x = mm2pt(mmX);\n // PDF coordinate system is from bottom left, UI is top left, so we need to flip the y axis\n let y = pageHeight - mm2pt(mmY) - height;\n\n if (rotateDegrees && applyRotateTranslate) {\n // If rotating we must pivot around the same point as the UI performs its rotation.\n // The UI performs rotation around the objects center point (the pivot point below),\n // pdflib rotates around the bottom left corner of the object.\n // We must therefore adjust the X and Y by rotating the bottom left corner by this pivot point.\n const pivotPoint = { x: x + width / 2, y: pageHeight - mm2pt(mmY) - height / 2 };\n const rotatedPoint = rotatePoint({ x, y }, pivotPoint, rotateDegrees);\n x = rotatedPoint.x;\n y = rotatedPoint.y;\n }\n\n return {\n position: { x, y },\n height: height,\n width: width,\n rotate: degrees(rotateDegrees),\n opacity,\n };\n};\n\nexport const rotatePoint = (\n point: { x: number; y: number },\n pivot: { x: number; y: number },\n angleDegrees: number,\n): { x: number; y: number } => {\n const angleRadians = degreesToRadians(angleDegrees);\n\n const x =\n Math.cos(angleRadians) * (point.x - pivot.x) -\n Math.sin(angleRadians) * (point.y - pivot.y) +\n pivot.x;\n const y =\n Math.sin(angleRadians) * (point.x - pivot.x) +\n Math.cos(angleRadians) * (point.y - pivot.y) +\n pivot.y;\n\n return { x, y };\n};\n\nexport const getDynamicHeightsForTable = _getDynamicHeightsForTable;\n\n// ----------------------------------------\n\nexport const addAlphaToHex = (hex: string, alphaPercentage: number) => {\n if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(hex)) {\n throw new Error('Invalid HEX color code');\n }\n const alphaValue = Math.round((alphaPercentage / 100) * 255);\n let alphaHex = alphaValue.toString(16);\n if (alphaHex.length === 1) alphaHex = '0' + alphaHex;\n return hex + alphaHex;\n};\n\nexport const isEditable = (mode: Mode, schema: Schema) =>\n mode === 'designer' || (mode === 'form' && schema.readOnly !== true);\n\n// Split a '#RGBA'/'#RRGGBBAA' hex into its opaque color and alpha channel, since\n// pdf-lib colors carry no alpha; alpha must be applied as draw opacity instead.\n// Colors without an alpha channel are passed through with alpha 1. Invalid hex is\n// also passed through untouched (never split) so that downstream color validation\n// still rejects the original string instead of a salvaged color plus a NaN alpha.\nexport const splitHexAlpha = (hexColor: string): { color: string; alpha: number } => {\n if (!hexColor.startsWith('#')) return { color: hexColor, alpha: 1 };\n const hex = hexColor.slice(1);\n if (!/^(?:[0-9a-f]{4}|[0-9a-f]{8})$/i.test(hex)) return { color: hexColor, alpha: 1 };\n const rgbLength = hex.length === 4 ? 3 : 6;\n const alphaHex = hex.slice(rgbLength);\n return {\n color: `#${hex.slice(0, rgbLength)}`,\n alpha: parseInt(alphaHex.length === 1 ? alphaHex.repeat(2) : alphaHex, 16) / 255,\n };\n};\n\n// Multiply a hex color's alpha channel into a draw opacity. An alpha of 1 returns\n// the opacity untouched (including undefined) so that PDFs rendered from colors\n// without an alpha channel stay byte-identical to previous releases: pdf-lib only\n// embeds an ExtGState when the opacity is defined.\nexport const applyAlphaToOpacity = (\n opacity: number | undefined,\n alpha: number,\n): number | undefined => (alpha === 1 ? opacity : (opacity ?? 1) * alpha);\n\nconst hex2rgb = (hex: string) => {\n // Drop any alpha channel; pdf-lib colors cannot represent it.\n hex = splitHexAlpha(hex).color;\n if (hex.slice(0, 1) === '#') hex = hex.slice(1);\n if (hex.length === 3)\n hex =\n hex.slice(0, 1) +\n hex.slice(0, 1) +\n hex.slice(1, 2) +\n hex.slice(1, 2) +\n hex.slice(2, 3) +\n hex.slice(2, 3);\n\n return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map((str) => parseInt(str, 16));\n};\n\nexport const rgbColorToCmykColor = ({ red, green, blue }: RGB) => {\n const key = 1 - Math.max(red, green, blue);\n const cyan = key === 1 ? 0 : (1 - red - key) / (1 - key);\n const magenta = key === 1 ? 0 : (1 - green - key) / (1 - key);\n const yellow = key === 1 ? 0 : (1 - blue - key) / (1 - key);\n\n return cmyk(cyan, magenta, yellow, key);\n};\n\nexport const hex2RgbColor = (hexString: string | undefined) => {\n if (hexString) {\n const isValid = isHexValid(hexString);\n\n if (!isValid) {\n throw new Error(`Invalid hex color value ${hexString}`);\n }\n\n const [r, g, b] = hex2rgb(hexString);\n\n return rgb(r / 255, g / 255, b / 255);\n }\n\n return undefined;\n};\n\nconst hex2CmykColor = (hexString: string | undefined) => {\n if (hexString) {\n const isValid = isHexValid(hexString);\n\n if (!isValid) {\n throw new Error(`Invalid hex color value ${hexString}`);\n }\n\n // Alpha is not flattened here; callers apply it as draw opacity via splitHexAlpha.\n const [r, g, b] = hex2rgb(hexString).map((value) => value / 255);\n\n return rgbColorToCmykColor(rgb(r, g, b));\n }\n\n return undefined;\n};\n\nexport const hex2PrintingColor = (color?: string | Color, colorType?: ColorType) => {\n // if color is already CMYK, RGB or Grayscale, does not required to convert\n if (typeof color === 'object') return color;\n return colorType?.toLowerCase() == 'cmyk' ? hex2CmykColor(color) : hex2RgbColor(color);\n};\n\nexport const readFile = (input: File | FileList | null): Promise<string | ArrayBuffer> =>\n new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n\n fileReader.onload = (e) => {\n if (e.target?.result) {\n resolve(e.target.result);\n }\n };\n\n fileReader.onerror = () => {\n reject(new Error('[@pdfme/schemas] File reading failed'));\n };\n\n let file: File | null = null;\n if (input instanceof FileList && input.length > 0) {\n file = input[0];\n } else if (input instanceof File) {\n file = input;\n }\n\n if (file) {\n fileReader.readAsDataURL(file);\n } else {\n reject(new Error('[@pdfme/schemas] No files provided'));\n }\n });\n\nexport const createErrorElm = () => {\n const container = document.createElement('div');\n const containerStyle: CSS.Properties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n };\n Object.assign(container.style, containerStyle);\n\n const span = document.createElement('span');\n const spanStyle: CSS.Properties = {\n color: 'white',\n background: 'red',\n padding: '0.25rem',\n fontSize: '12pt',\n fontWeight: 'bold',\n borderRadius: '2px',\n fontFamily: \"'Open Sans', sans-serif\",\n };\n Object.assign(span.style, spanStyle);\n\n span.textContent = 'ERROR';\n container.appendChild(span);\n\n return container;\n};\n\nexport const createSvgStr = (icon: IconNode, attrs?: Record<string, string>): string => {\n // In lucide 0.475.0, the icon is an array of elements, not a single SVG element\n // We need to create an SVG wrapper and add the elements as children\n\n const safeTagNames = new Set([\n 'svg',\n 'circle',\n 'ellipse',\n 'g',\n 'line',\n 'path',\n 'polygon',\n 'polyline',\n 'rect',\n ]);\n const safeAttributeNames = new Set([\n 'aria-hidden',\n 'aria-label',\n 'class',\n 'clip-rule',\n 'cx',\n 'cy',\n 'd',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'focusable',\n 'height',\n 'id',\n 'opacity',\n 'points',\n 'preserveAspectRatio',\n 'r',\n 'role',\n 'rx',\n 'ry',\n 'stroke',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke-width',\n 'transform',\n 'vector-effect',\n 'viewBox',\n 'width',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'xmlns:xlink',\n 'y',\n 'y1',\n 'y2',\n ]);\n const escapeHtmlAttribute = (value: string): string =>\n value\n .replaceAll('&', '&')\n .replaceAll('\"', '"')\n .replaceAll(\"'\", ''')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n const escapeHtmlText = (value: string): string =>\n value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');\n const toSafeAttributeString = (attributes: Record<string, string>): string =>\n Object.entries(attributes)\n .filter(\n ([key, value]) =>\n safeAttributeNames.has(key) &&\n value !== undefined &&\n value !== null &&\n !key.toLowerCase().startsWith('on'),\n )\n .map(([key, value]) => `${key}=\"${escapeHtmlAttribute(String(value))}\"`)\n .join(' ');\n const toSafeTagName = (tag: unknown): string => {\n const tagName = String(tag);\n if (!safeTagNames.has(tagName)) {\n throw new Error(`Invalid SVG tag name: ${tagName}`);\n }\n return tagName;\n };\n\n // Handle non-array input\n if (!Array.isArray(icon)) {\n return escapeHtmlText(String(icon));\n }\n\n // Create default SVG attributes\n const svgAttrs = {\n xmlns: 'http://www.w3.org/2000/svg',\n width: '24',\n height: '24',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': '2',\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n ...attrs,\n };\n const svgAttrString = toSafeAttributeString(svgAttrs);\n\n // Helper function to process a single element\n const processElement = (element: unknown): string => {\n if (!Array.isArray(element)) {\n return escapeHtmlText(String(element));\n }\n\n const [tag, attributes = {}, children = []] = element as [\n unknown,\n Record<string, string>,\n unknown[],\n ];\n const tagName = toSafeTagName(tag);\n const attrString = toSafeAttributeString(attributes);\n\n // Process children recursively\n let childrenString = '';\n\n if (Array.isArray(children) && children.length > 0) {\n childrenString = children.map((child) => processElement(child)).join('');\n }\n\n // Return properly formatted element string\n if (childrenString) {\n return `<${String(tagName)}${attrString ? ' ' + String(attrString) : ''}>${childrenString}</${String(tagName)}>`;\n } else {\n // Self-closing tag for empty children\n return `<${String(tagName)}${attrString ? ' ' + String(attrString) : ''}/>`;\n }\n };\n\n // Process all elements and join them\n const elementsString = Array.isArray(icon)\n ? icon.map((element) => processElement(element)).join('')\n : processElement(icon);\n\n // Return the complete SVG string\n return `<svg ${svgAttrString}>${elementsString}</svg>`;\n};\n"],"mappings":";;;;AAQA,IAAa,kBAAkB,SAAiB,YAAkD;CAChG,IAAI,aAAa;CAEjB,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,OAAO,QAAQ;EAErB,IAAI,SAAS,KAAK;GAGhB,aAAa;GACb;EACF;EAEA,IAAI,SAAS,OAAO,eAAe,IAAI;GACrC,MAAM,OAAO,QAAQ,MAAM,aAAa,GAAG,CAAC;GAC5C,IAAI,KAAK,SAAS,GAChB,QAAQ;IAAE;IAAM;IAAY,UAAU;GAAE,CAAC;GAE3C,aAAa;EACf;CACF;AACF;AAYA,IAAa,4BAA4B,YAA4B;CACnE,MAAM,gCAAgB,IAAI,IAAY;CAEtC,eAAe,UAAU,EAAE,WAAW;EACpC,cAAc,IAAI,IAAI;CACxB,CAAC;CAED,OAAO,cAAc;AACvB;AAEA,IAAa,oBAAoB,YAA8B;CAC7D,MAAM,gBAA0B,CAAC;CAEjC,eAAe,UAAU,EAAE,WAAW;EACpC,cAAc,KAAK,IAAI;CACzB,CAAC;CAED,OAAO;AACT;;;ACnDA,IAAa,4BAA4B,EACvC,QACA,YACA,uBAAuB,WAKnB;CACJ,MAAM,EAAE,OAAO,SAAS,QAAQ,UAAU,UAAU,QAAQ,YAAY;CACxE,MAAM,EAAE,GAAG,KAAK,GAAG,QAAQ;CAE3B,MAAM,gBAAgB,SAAS,CAAC,SAAS;CACzC,MAAM,QAAQ,MAAM,OAAO;CAC3B,MAAM,SAAS,MAAM,QAAQ;CAC7B,IAAI,IAAI,MAAM,GAAG;CAEjB,IAAI,IAAI,aAAa,MAAM,GAAG,IAAI;CAElC,IAAI,iBAAiB,sBAAsB;EAKzC,MAAM,aAAa;GAAE,GAAG,IAAI,QAAQ;GAAG,GAAG,aAAa,MAAM,GAAG,I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AAS;EACT,MAAM;EACN,QAAQ;EACR,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;EACnB,GAAG;CAEuC,CAAQ;CAGpD,MAAM,kBAAkB,YAA6B;EACnD,IAAI,CAAC,MAAM,QAAQ,OAAO,GACxB,OAAO,eAAe,OAAO,OAAO,CAAC;EAGvC,MAAM,CAAC,KAAK,aAAa,CAAC,GAAG,WAAW,CAAC,KAAK;EAK9C,MAAM,UAAU,cAAc,GAAG;EACjC,MAAM,aAAa,sBAAsB,UAAU;EAGnD,IAAI,iBAAiB;EAErB,IAAI,MAAM,QAAQ,QAAQ,KAAK,SAAS,SAAS,GAC/C,iBAAiB,SAAS,KAAK,UAAU,eAAe,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE;EAIzE,IAAI,gBACF,OAAO,IAAI,OAAO,OAAO,IAAI,aAAa,MAAM,OAAO,UAAU,IAAI,GAAG,GAAG,eAAe,IAAI,OAAO,OAAO,EAAE;OAG9G,OAAO,IAAI,OAAO,OAAO,IAAI,aAAa,MAAM,OAAO,UAAU,IAAI,GAAG;CAE5E;CAQA,OAAO,QAAQ,cAAc,GALN,MAAM,QAAQ,IAAI,IACrC,KAAK,KAAK,YAAY,eAAe,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IACtD,eAAe,IAAI,EAGwB;AACjD"}
|
|
1
|
+
{"version":3,"file":"utils-CbHtVsNs.js","names":["_getDynamicHeightsForTable"],"sources":["../src/multiVariableText/variables.ts","../src/utils.ts"],"sourcesContent":["export type VariableMatch = {\n name: string;\n startIndex: number;\n endIndex: number;\n};\n\nexport type VariableIndices = Map<number, string>;\n\nexport const visitVariables = (content: string, visitor: (match: VariableMatch) => void): void => {\n let startIndex = -1;\n\n for (let i = 0; i < content.length; i++) {\n const char = content[i];\n\n if (char === '{') {\n // Restart from the latest opener so malformed input behaves like /{([^{}]+)}/g\n // without requiring backtracking.\n startIndex = i;\n continue;\n }\n\n if (char === '}' && startIndex !== -1) {\n const name = content.slice(startIndex + 1, i);\n if (name.length > 0) {\n visitor({ name, startIndex, endIndex: i });\n }\n startIndex = -1;\n }\n }\n};\n\nexport const getVariableIndices = (content: string): VariableIndices => {\n const indices: VariableIndices = new Map();\n\n visitVariables(content, ({ name, startIndex }) => {\n indices.set(startIndex, name);\n });\n\n return indices;\n};\n\nexport const countUniqueVariableNames = (content: string): number => {\n const variableNames = new Set<string>();\n\n visitVariables(content, ({ name }) => {\n variableNames.add(name);\n });\n\n return variableNames.size;\n};\n\nexport const getVariableNames = (content: string): string[] => {\n const variableNames: string[] = [];\n\n visitVariables(content, ({ name }) => {\n variableNames.push(name);\n });\n\n return variableNames;\n};\n","import type * as CSS from 'csstype';\nimport { cmyk, degrees, degreesToRadians, rgb, type Color, type RGB } from '@pdfme/pdf-lib';\nimport { Schema, mm2pt, Mode, isHexValid, ColorType } from '@pdfme/common';\nimport { IconNode } from 'lucide';\nimport { getDynamicHeightsForTable as _getDynamicHeightsForTable } from './tables/dynamicTemplate.js';\nexport { measureTextHeight } from './text/measure.js';\nexport { escapeInlineMarkdown } from './text/inlineMarkdown.js';\nexport { getVariableNames, visitVariables } from './multiVariableText/variables.js';\nexport const convertForPdfLayoutProps = ({\n schema,\n pageHeight,\n applyRotateTranslate = true,\n}: {\n schema: Schema;\n pageHeight: number;\n applyRotateTranslate?: boolean;\n}) => {\n const { width: mmWidth, height: mmHeight, position, rotate, opacity } = schema;\n const { x: mmX, y: mmY } = position;\n\n const rotateDegrees = rotate ? -rotate : 0;\n const width = mm2pt(mmWidth);\n const height = mm2pt(mmHeight);\n let x = mm2pt(mmX);\n // PDF coordinate system is from bottom left, UI is top left, so we need to flip the y axis\n let y = pageHeight - mm2pt(mmY) - height;\n\n if (rotateDegrees && applyRotateTranslate) {\n // If rotating we must pivot around the same point as the UI performs its rotation.\n // The UI performs rotation around the objects center point (the pivot point below),\n // pdflib rotates around the bottom left corner of the object.\n // We must therefore adjust the X and Y by rotating the bottom left corner by this pivot point.\n const pivotPoint = { x: x + width / 2, y: pageHeight - mm2pt(mmY) - height / 2 };\n const rotatedPoint = rotatePoint({ x, y }, pivotPoint, rotateDegrees);\n x = rotatedPoint.x;\n y = rotatedPoint.y;\n }\n\n return {\n position: { x, y },\n height: height,\n width: width,\n rotate: degrees(rotateDegrees),\n opacity,\n };\n};\n\nexport const rotatePoint = (\n point: { x: number; y: number },\n pivot: { x: number; y: number },\n angleDegrees: number,\n): { x: number; y: number } => {\n const angleRadians = degreesToRadians(angleDegrees);\n\n const x =\n Math.cos(angleRadians) * (point.x - pivot.x) -\n Math.sin(angleRadians) * (point.y - pivot.y) +\n pivot.x;\n const y =\n Math.sin(angleRadians) * (point.x - pivot.x) +\n Math.cos(angleRadians) * (point.y - pivot.y) +\n pivot.y;\n\n return { x, y };\n};\n\nexport const getDynamicHeightsForTable = _getDynamicHeightsForTable;\n\n// ----------------------------------------\n\nexport const addAlphaToHex = (hex: string, alphaPercentage: number) => {\n if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(hex)) {\n throw new Error('Invalid HEX color code');\n }\n const alphaValue = Math.round((alphaPercentage / 100) * 255);\n let alphaHex = alphaValue.toString(16);\n if (alphaHex.length === 1) alphaHex = '0' + alphaHex;\n return hex + alphaHex;\n};\n\nexport const isEditable = (mode: Mode, schema: Schema) =>\n mode === 'designer' || (mode === 'form' && schema.readOnly !== true);\n\n// Split a '#RGBA'/'#RRGGBBAA' hex into its opaque color and alpha channel, since\n// pdf-lib colors carry no alpha; alpha must be applied as draw opacity instead.\n// Colors without an alpha channel are passed through with alpha 1. Invalid hex is\n// also passed through untouched (never split) so that downstream color validation\n// still rejects the original string instead of a salvaged color plus a NaN alpha.\nexport const splitHexAlpha = (hexColor: string): { color: string; alpha: number } => {\n if (!hexColor.startsWith('#')) return { color: hexColor, alpha: 1 };\n const hex = hexColor.slice(1);\n if (!/^(?:[0-9a-f]{4}|[0-9a-f]{8})$/i.test(hex)) return { color: hexColor, alpha: 1 };\n const rgbLength = hex.length === 4 ? 3 : 6;\n const alphaHex = hex.slice(rgbLength);\n return {\n color: `#${hex.slice(0, rgbLength)}`,\n alpha: parseInt(alphaHex.length === 1 ? alphaHex.repeat(2) : alphaHex, 16) / 255,\n };\n};\n\n// Multiply a hex color's alpha channel into a draw opacity. An alpha of 1 returns\n// the opacity untouched (including undefined) so that PDFs rendered from colors\n// without an alpha channel stay byte-identical to previous releases: pdf-lib only\n// embeds an ExtGState when the opacity is defined.\nexport const applyAlphaToOpacity = (\n opacity: number | undefined,\n alpha: number,\n): number | undefined => (alpha === 1 ? opacity : (opacity ?? 1) * alpha);\n\nconst hex2rgb = (hex: string) => {\n // Drop any alpha channel; pdf-lib colors cannot represent it.\n hex = splitHexAlpha(hex).color;\n if (hex.slice(0, 1) === '#') hex = hex.slice(1);\n if (hex.length === 3)\n hex =\n hex.slice(0, 1) +\n hex.slice(0, 1) +\n hex.slice(1, 2) +\n hex.slice(1, 2) +\n hex.slice(2, 3) +\n hex.slice(2, 3);\n\n return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map((str) => parseInt(str, 16));\n};\n\nexport const rgbColorToCmykColor = ({ red, green, blue }: RGB) => {\n const key = 1 - Math.max(red, green, blue);\n const cyan = key === 1 ? 0 : (1 - red - key) / (1 - key);\n const magenta = key === 1 ? 0 : (1 - green - key) / (1 - key);\n const yellow = key === 1 ? 0 : (1 - blue - key) / (1 - key);\n\n return cmyk(cyan, magenta, yellow, key);\n};\n\nexport const hex2RgbColor = (hexString: string | undefined) => {\n if (hexString) {\n const isValid = isHexValid(hexString);\n\n if (!isValid) {\n throw new Error(`Invalid hex color value ${hexString}`);\n }\n\n const [r, g, b] = hex2rgb(hexString);\n\n return rgb(r / 255, g / 255, b / 255);\n }\n\n return undefined;\n};\n\nconst hex2CmykColor = (hexString: string | undefined) => {\n if (hexString) {\n const isValid = isHexValid(hexString);\n\n if (!isValid) {\n throw new Error(`Invalid hex color value ${hexString}`);\n }\n\n // Alpha is not flattened here; callers apply it as draw opacity via splitHexAlpha.\n const [r, g, b] = hex2rgb(hexString).map((value) => value / 255);\n\n return rgbColorToCmykColor(rgb(r, g, b));\n }\n\n return undefined;\n};\n\nexport const hex2PrintingColor = (color?: string | Color, colorType?: ColorType) => {\n // if color is already CMYK, RGB or Grayscale, does not required to convert\n if (typeof color === 'object') return color;\n return colorType?.toLowerCase() == 'cmyk' ? hex2CmykColor(color) : hex2RgbColor(color);\n};\n\nexport const readFile = (input: File | FileList | null): Promise<string | ArrayBuffer> =>\n new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n\n fileReader.onload = (e) => {\n if (e.target?.result) {\n resolve(e.target.result);\n }\n };\n\n fileReader.onerror = () => {\n reject(new Error('[@pdfme/schemas] File reading failed'));\n };\n\n let file: File | null = null;\n if (input instanceof FileList && input.length > 0) {\n file = input[0];\n } else if (input instanceof File) {\n file = input;\n }\n\n if (file) {\n fileReader.readAsDataURL(file);\n } else {\n reject(new Error('[@pdfme/schemas] No files provided'));\n }\n });\n\nexport const createErrorElm = () => {\n const container = document.createElement('div');\n const containerStyle: CSS.Properties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n };\n Object.assign(container.style, containerStyle);\n\n const span = document.createElement('span');\n const spanStyle: CSS.Properties = {\n color: 'white',\n background: 'red',\n padding: '0.25rem',\n fontSize: '12pt',\n fontWeight: 'bold',\n borderRadius: '2px',\n fontFamily: \"'Open Sans', sans-serif\",\n };\n Object.assign(span.style, spanStyle);\n\n span.textContent = 'ERROR';\n container.appendChild(span);\n\n return container;\n};\n\nexport const createSvgStr = (icon: IconNode, attrs?: Record<string, string>): string => {\n // In lucide 0.475.0, the icon is an array of elements, not a single SVG element\n // We need to create an SVG wrapper and add the elements as children\n\n const safeTagNames = new Set([\n 'svg',\n 'circle',\n 'ellipse',\n 'g',\n 'line',\n 'path',\n 'polygon',\n 'polyline',\n 'rect',\n ]);\n const safeAttributeNames = new Set([\n 'aria-hidden',\n 'aria-label',\n 'class',\n 'clip-rule',\n 'cx',\n 'cy',\n 'd',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'focusable',\n 'height',\n 'id',\n 'opacity',\n 'points',\n 'preserveAspectRatio',\n 'r',\n 'role',\n 'rx',\n 'ry',\n 'stroke',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke-width',\n 'transform',\n 'vector-effect',\n 'viewBox',\n 'width',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'xmlns:xlink',\n 'y',\n 'y1',\n 'y2',\n ]);\n const escapeHtmlAttribute = (value: string): string =>\n value\n .replaceAll('&', '&')\n .replaceAll('\"', '"')\n .replaceAll(\"'\", ''')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n const escapeHtmlText = (value: string): string =>\n value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');\n const toSafeAttributeString = (attributes: Record<string, string>): string =>\n Object.entries(attributes)\n .filter(\n ([key, value]) =>\n safeAttributeNames.has(key) &&\n value !== undefined &&\n value !== null &&\n !key.toLowerCase().startsWith('on'),\n )\n .map(([key, value]) => `${key}=\"${escapeHtmlAttribute(String(value))}\"`)\n .join(' ');\n const toSafeTagName = (tag: unknown): string => {\n const tagName = String(tag);\n if (!safeTagNames.has(tagName)) {\n throw new Error(`Invalid SVG tag name: ${tagName}`);\n }\n return tagName;\n };\n\n // Handle non-array input\n if (!Array.isArray(icon)) {\n return escapeHtmlText(String(icon));\n }\n\n // Create default SVG attributes\n const svgAttrs = {\n xmlns: 'http://www.w3.org/2000/svg',\n width: '24',\n height: '24',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': '2',\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n ...attrs,\n };\n const svgAttrString = toSafeAttributeString(svgAttrs);\n\n // Helper function to process a single element\n const processElement = (element: unknown): string => {\n if (!Array.isArray(element)) {\n return escapeHtmlText(String(element));\n }\n\n const [tag, attributes = {}, children = []] = element as [\n unknown,\n Record<string, string>,\n unknown[],\n ];\n const tagName = toSafeTagName(tag);\n const attrString = toSafeAttributeString(attributes);\n\n // Process children recursively\n let childrenString = '';\n\n if (Array.isArray(children) && children.length > 0) {\n childrenString = children.map((child) => processElement(child)).join('');\n }\n\n // Return properly formatted element string\n if (childrenString) {\n return `<${String(tagName)}${attrString ? ' ' + String(attrString) : ''}>${childrenString}</${String(tagName)}>`;\n } else {\n // Self-closing tag for empty children\n return `<${String(tagName)}${attrString ? ' ' + String(attrString) : ''}/>`;\n }\n };\n\n // Process all elements and join them\n const elementsString = Array.isArray(icon)\n ? icon.map((element) => processElement(element)).join('')\n : processElement(icon);\n\n // Return the complete SVG string\n return `<svg ${svgAttrString}>${elementsString}</svg>`;\n};\n"],"mappings":";;;;AAQA,IAAa,kBAAkB,SAAiB,YAAkD;CAChG,IAAI,aAAa;CAEjB,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,OAAO,QAAQ;EAErB,IAAI,SAAS,KAAK;GAGhB,aAAa;GACb;EACF;EAEA,IAAI,SAAS,OAAO,eAAe,IAAI;GACrC,MAAM,OAAO,QAAQ,MAAM,aAAa,GAAG,CAAC;GAC5C,IAAI,KAAK,SAAS,GAChB,QAAQ;IAAE;IAAM;IAAY,UAAU;GAAE,CAAC;GAE3C,aAAa;EACf;CACF;AACF;AAYA,IAAa,4BAA4B,YAA4B;CACnE,MAAM,gCAAgB,IAAI,IAAY;CAEtC,eAAe,UAAU,EAAE,WAAW;EACpC,cAAc,IAAI,IAAI;CACxB,CAAC;CAED,OAAO,cAAc;AACvB;AAEA,IAAa,oBAAoB,YAA8B;CAC7D,MAAM,gBAA0B,CAAC;CAEjC,eAAe,UAAU,EAAE,WAAW;EACpC,cAAc,KAAK,IAAI;CACzB,CAAC;CAED,OAAO;AACT;;;ACnDA,IAAa,4BAA4B,EACvC,QACA,YAC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package/dist/utils.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as measureTextHeight, m as escapeInlineMarkdown } from "./measure-BzuDatEc.js";
|
|
2
|
-
import { a as createSvgStr, c as hex2RgbColor, d as rgbColorToCmykColor, f as rotatePoint, g as visitVariables, h as getVariableNames, i as createErrorElm, l as isEditable, n as applyAlphaToOpacity, o as getDynamicHeightsForTable, p as splitHexAlpha, r as convertForPdfLayoutProps, s as hex2PrintingColor, t as addAlphaToHex, u as readFile } from "./utils-
|
|
2
|
+
import { a as createSvgStr, c as hex2RgbColor, d as rgbColorToCmykColor, f as rotatePoint, g as visitVariables, h as getVariableNames, i as createErrorElm, l as isEditable, n as applyAlphaToOpacity, o as getDynamicHeightsForTable, p as splitHexAlpha, r as convertForPdfLayoutProps, s as hex2PrintingColor, t as addAlphaToHex, u as readFile } from "./utils-CbHtVsNs.js";
|
|
3
3
|
export { addAlphaToHex, applyAlphaToOpacity, convertForPdfLayoutProps, createErrorElm, createSvgStr, escapeInlineMarkdown, getDynamicHeightsForTable, getVariableNames, hex2PrintingColor, hex2RgbColor, isEditable, measureTextHeight, readFile, rgbColorToCmykColor, rotatePoint, splitHexAlpha, visitVariables };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfme/schemas",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.7-dev.2",
|
|
4
4
|
"description": "TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pdf",
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
"air-datepicker": "^3.6.0",
|
|
89
89
|
"bwip-js": "^4.11.4",
|
|
90
90
|
"date-fns": "^4.4.0",
|
|
91
|
-
"dompurify": "^3.4.
|
|
91
|
+
"dompurify": "^3.4.17",
|
|
92
92
|
"fontkit": "^2.0.2",
|
|
93
93
|
"jpeg-js": "^0.4.4",
|
|
94
|
-
"lucide": "^1.
|
|
94
|
+
"lucide": "^1.59.0",
|
|
95
95
|
"signature_pad": "^5.1.4"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|