@campxdev/pdfme 1.1.0 → 1.2.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.
Files changed (394) hide show
  1. package/dist/cjs/chunks/{helper-DU7Bm8ZQ.js → helper-C2o2tpNj.js} +2 -1
  2. package/dist/cjs/chunks/{index-Co0Y0KJj.js → index-CXm3doOM.js} +31 -4
  3. package/dist/cjs/chunks/{index-mgS9yYj7.js → index-dHRmLCnu.js} +4 -4
  4. package/dist/cjs/chunks/{index-BzWo8eqh.js → index-qB7eb2BC.js} +2 -2
  5. package/dist/cjs/chunks/{pluginRegistry-DlJQZP6L.js → pluginRegistry-Ba3ANzzx.js} +1 -1
  6. package/dist/cjs/common.js +3 -3
  7. package/dist/cjs/converter.js +1 -1
  8. package/dist/cjs/generator.js +3 -3
  9. package/dist/cjs/index.js +5 -5
  10. package/dist/cjs/print-designer-editor.js +223 -128
  11. package/dist/cjs/schemas.js +3 -3
  12. package/dist/cjs/ui.js +106 -83
  13. package/dist/esm/chunks/{helper-C8LqGaF4.js → helper-D7XF1bxK.js} +2 -1
  14. package/dist/esm/chunks/{index-d0iAk7OA.js → index-D1FuD_XZ.js} +3 -3
  15. package/dist/esm/chunks/{index-Rwcd_Vzj.js → index-pDt5vVVj.js} +4 -4
  16. package/dist/esm/chunks/{index-CwqHuiCe.js → index-qTsnfbi7.js} +32 -5
  17. package/dist/esm/chunks/{pluginRegistry-C0a91XEw.js → pluginRegistry-DEA2P0ud.js} +1 -1
  18. package/dist/esm/common.js +3 -3
  19. package/dist/esm/converter.js +1 -1
  20. package/dist/esm/generator.js +3 -3
  21. package/dist/esm/index.js +5 -5
  22. package/dist/esm/print-designer-editor.js +224 -129
  23. package/dist/esm/schemas.js +5 -5
  24. package/dist/esm/ui.js +106 -83
  25. package/dist/types/_vendors/common/constants.d.ts +20 -0
  26. package/dist/types/_vendors/common/dynamicTemplate.d.ts +27 -0
  27. package/dist/types/_vendors/common/expression.d.ts +6 -0
  28. package/dist/types/_vendors/common/fontData.d.ts +29 -0
  29. package/dist/types/_vendors/common/helper.d.ts +37 -0
  30. package/dist/types/_vendors/common/index.d.ts +9 -0
  31. package/dist/types/_vendors/common/pluginRegistry.d.ts +5 -0
  32. package/dist/types/_vendors/common/schema.d.ts +822 -0
  33. package/dist/types/_vendors/common/types.d.ts +189 -0
  34. package/dist/types/_vendors/common/version.d.ts +1 -0
  35. package/dist/types/_vendors/converter/img2pdf.d.ts +12 -0
  36. package/dist/types/_vendors/converter/index.browser.d.ts +8 -0
  37. package/dist/types/_vendors/converter/index.node.d.ts +8 -0
  38. package/dist/types/_vendors/converter/pdf2img.d.ts +17 -0
  39. package/dist/types/_vendors/converter/pdf2size.d.ts +10 -0
  40. package/dist/types/_vendors/generator/constants.d.ts +1 -0
  41. package/dist/types/_vendors/generator/generate.d.ts +3 -0
  42. package/dist/types/_vendors/generator/helper.d.ts +29 -0
  43. package/dist/types/_vendors/generator/index.d.ts +2 -0
  44. package/dist/types/_vendors/generator/types.d.ts +20 -0
  45. package/dist/types/_vendors/manipulator/index.d.ts +46 -0
  46. package/dist/types/_vendors/pdf-lib/api/Embeddable.d.ts +7 -0
  47. package/dist/types/_vendors/pdf-lib/api/PDFDocument.d.ts +778 -0
  48. package/dist/types/_vendors/pdf-lib/api/PDFDocumentOptions.d.ts +38 -0
  49. package/dist/types/_vendors/pdf-lib/api/PDFEmbeddedFile.d.ts +38 -0
  50. package/dist/types/_vendors/pdf-lib/api/PDFEmbeddedPage.d.ts +73 -0
  51. package/dist/types/_vendors/pdf-lib/api/PDFFont.d.ts +94 -0
  52. package/dist/types/_vendors/pdf-lib/api/PDFImage.d.ts +95 -0
  53. package/dist/types/_vendors/pdf-lib/api/PDFJavaScript.d.ts +38 -0
  54. package/dist/types/_vendors/pdf-lib/api/PDFPage.d.ts +910 -0
  55. package/dist/types/_vendors/pdf-lib/api/PDFPageOptions.d.ts +172 -0
  56. package/dist/types/_vendors/pdf-lib/api/StandardFonts.d.ts +16 -0
  57. package/dist/types/_vendors/pdf-lib/api/colors.d.ts +34 -0
  58. package/dist/types/_vendors/pdf-lib/api/errors.d.ts +42 -0
  59. package/dist/types/_vendors/pdf-lib/api/form/PDFButton.d.ts +137 -0
  60. package/dist/types/_vendors/pdf-lib/api/form/PDFCheckBox.d.ts +142 -0
  61. package/dist/types/_vendors/pdf-lib/api/form/PDFDropdown.d.ts +402 -0
  62. package/dist/types/_vendors/pdf-lib/api/form/PDFField.d.ts +203 -0
  63. package/dist/types/_vendors/pdf-lib/api/form/PDFForm.d.ts +411 -0
  64. package/dist/types/_vendors/pdf-lib/api/form/PDFOptionList.d.ts +335 -0
  65. package/dist/types/_vendors/pdf-lib/api/form/PDFRadioGroup.d.ts +252 -0
  66. package/dist/types/_vendors/pdf-lib/api/form/PDFSignature.d.ts +29 -0
  67. package/dist/types/_vendors/pdf-lib/api/form/PDFTextField.d.ts +537 -0
  68. package/dist/types/_vendors/pdf-lib/api/form/appearances.d.ts +41 -0
  69. package/dist/types/_vendors/pdf-lib/api/form/index.d.ts +10 -0
  70. package/dist/types/_vendors/pdf-lib/api/image/alignment.d.ts +5 -0
  71. package/dist/types/_vendors/pdf-lib/api/image/index.d.ts +1 -0
  72. package/dist/types/_vendors/pdf-lib/api/index.d.ts +20 -0
  73. package/dist/types/_vendors/pdf-lib/api/objects.d.ts +4 -0
  74. package/dist/types/_vendors/pdf-lib/api/operations.d.ts +226 -0
  75. package/dist/types/_vendors/pdf-lib/api/operators.d.ts +90 -0
  76. package/dist/types/_vendors/pdf-lib/api/rotations.d.ts +38 -0
  77. package/dist/types/_vendors/pdf-lib/api/sizes.d.ts +52 -0
  78. package/dist/types/_vendors/pdf-lib/api/svg.d.ts +70 -0
  79. package/dist/types/_vendors/pdf-lib/api/svgPath.d.ts +2 -0
  80. package/dist/types/_vendors/pdf-lib/api/text/alignment.d.ts +5 -0
  81. package/dist/types/_vendors/pdf-lib/api/text/index.d.ts +2 -0
  82. package/dist/types/_vendors/pdf-lib/api/text/layout.d.ts +54 -0
  83. package/dist/types/_vendors/pdf-lib/core/PDFContext.d.ts +84 -0
  84. package/dist/types/_vendors/pdf-lib/core/PDFObjectCopier.d.ts +37 -0
  85. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroButton.d.ts +21 -0
  86. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroCheckBox.d.ts +13 -0
  87. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroChoice.d.ts +20 -0
  88. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroComboBox.d.ts +9 -0
  89. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroField.d.ts +36 -0
  90. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroForm.d.ts +20 -0
  91. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroListBox.d.ts +9 -0
  92. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroNonTerminal.d.ts +13 -0
  93. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroPushButton.d.ts +9 -0
  94. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroRadioButton.d.ts +13 -0
  95. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroSignature.d.ts +7 -0
  96. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroTerminal.d.ts +16 -0
  97. package/dist/types/_vendors/pdf-lib/core/acroform/PDFAcroText.d.ts +22 -0
  98. package/dist/types/_vendors/pdf-lib/core/acroform/flags.d.ts +141 -0
  99. package/dist/types/_vendors/pdf-lib/core/acroform/index.d.ts +15 -0
  100. package/dist/types/_vendors/pdf-lib/core/acroform/utils.d.ts +6 -0
  101. package/dist/types/_vendors/pdf-lib/core/annotation/AppearanceCharacteristics.d.ts +33 -0
  102. package/dist/types/_vendors/pdf-lib/core/annotation/BorderStyle.d.ts +11 -0
  103. package/dist/types/_vendors/pdf-lib/core/annotation/PDFAnnotation.d.ts +51 -0
  104. package/dist/types/_vendors/pdf-lib/core/annotation/PDFWidgetAnnotation.d.ts +26 -0
  105. package/dist/types/_vendors/pdf-lib/core/annotation/flags.d.ts +79 -0
  106. package/dist/types/_vendors/pdf-lib/core/annotation/index.d.ts +4 -0
  107. package/dist/types/_vendors/pdf-lib/core/crypto.d.ts +95 -0
  108. package/dist/types/_vendors/pdf-lib/core/document/PDFCrossRefSection.d.ts +27 -0
  109. package/dist/types/_vendors/pdf-lib/core/document/PDFHeader.d.ts +10 -0
  110. package/dist/types/_vendors/pdf-lib/core/document/PDFTrailer.d.ts +9 -0
  111. package/dist/types/_vendors/pdf-lib/core/document/PDFTrailerDict.d.ts +10 -0
  112. package/dist/types/_vendors/pdf-lib/core/embedders/CMap.d.ts +3 -0
  113. package/dist/types/_vendors/pdf-lib/core/embedders/CustomFontEmbedder.d.ts +44 -0
  114. package/dist/types/_vendors/pdf-lib/core/embedders/CustomFontSubsetEmbedder.d.ts +20 -0
  115. package/dist/types/_vendors/pdf-lib/core/embedders/FileEmbedder.d.ts +33 -0
  116. package/dist/types/_vendors/pdf-lib/core/embedders/FontFlags.d.ts +13 -0
  117. package/dist/types/_vendors/pdf-lib/core/embedders/JavaScriptEmbedder.d.ts +10 -0
  118. package/dist/types/_vendors/pdf-lib/core/embedders/JpegEmbedder.d.ts +23 -0
  119. package/dist/types/_vendors/pdf-lib/core/embedders/PDFPageEmbedder.d.ts +37 -0
  120. package/dist/types/_vendors/pdf-lib/core/embedders/PngEmbedder.d.ts +19 -0
  121. package/dist/types/_vendors/pdf-lib/core/embedders/StandardFontEmbedder.d.ts +36 -0
  122. package/dist/types/_vendors/pdf-lib/core/errors.d.ts +91 -0
  123. package/dist/types/_vendors/pdf-lib/core/index.d.ts +47 -0
  124. package/dist/types/_vendors/pdf-lib/core/interactive/ViewerPreferences.d.ts +347 -0
  125. package/dist/types/_vendors/pdf-lib/core/objects/PDFArray.d.ts +63 -0
  126. package/dist/types/_vendors/pdf-lib/core/objects/PDFBool.d.ts +13 -0
  127. package/dist/types/_vendors/pdf-lib/core/objects/PDFDict.d.ts +62 -0
  128. package/dist/types/_vendors/pdf-lib/core/objects/PDFHexString.d.ts +16 -0
  129. package/dist/types/_vendors/pdf-lib/core/objects/PDFInvalidObject.d.ts +11 -0
  130. package/dist/types/_vendors/pdf-lib/core/objects/PDFName.d.ts +41 -0
  131. package/dist/types/_vendors/pdf-lib/core/objects/PDFNull.d.ts +10 -0
  132. package/dist/types/_vendors/pdf-lib/core/objects/PDFNumber.d.ts +15 -0
  133. package/dist/types/_vendors/pdf-lib/core/objects/PDFObject.d.ts +8 -0
  134. package/dist/types/_vendors/pdf-lib/core/objects/PDFRawStream.d.ts +16 -0
  135. package/dist/types/_vendors/pdf-lib/core/objects/PDFRef.d.ts +13 -0
  136. package/dist/types/_vendors/pdf-lib/core/objects/PDFStream.d.ts +16 -0
  137. package/dist/types/_vendors/pdf-lib/core/objects/PDFString.d.ts +16 -0
  138. package/dist/types/_vendors/pdf-lib/core/operators/PDFOperator.d.ts +19 -0
  139. package/dist/types/_vendors/pdf-lib/core/operators/PDFOperatorNames.d.ts +76 -0
  140. package/dist/types/_vendors/pdf-lib/core/parser/BaseParser.d.ts +14 -0
  141. package/dist/types/_vendors/pdf-lib/core/parser/ByteStream.d.ts +26 -0
  142. package/dist/types/_vendors/pdf-lib/core/parser/PDFObjectParser.d.ts +31 -0
  143. package/dist/types/_vendors/pdf-lib/core/parser/PDFObjectStreamParser.d.ts +13 -0
  144. package/dist/types/_vendors/pdf-lib/core/parser/PDFParser.d.ts +46 -0
  145. package/dist/types/_vendors/pdf-lib/core/parser/PDFXRefStreamParser.d.ts +21 -0
  146. package/dist/types/_vendors/pdf-lib/core/streams/Ascii85Stream.d.ts +9 -0
  147. package/dist/types/_vendors/pdf-lib/core/streams/AsciiHexStream.d.ts +9 -0
  148. package/dist/types/_vendors/pdf-lib/core/streams/DecodeStream.d.ts +26 -0
  149. package/dist/types/_vendors/pdf-lib/core/streams/DecryptStream.d.ts +12 -0
  150. package/dist/types/_vendors/pdf-lib/core/streams/FlateStream.d.ts +13 -0
  151. package/dist/types/_vendors/pdf-lib/core/streams/LZWStream.d.ts +12 -0
  152. package/dist/types/_vendors/pdf-lib/core/streams/RunLengthStream.d.ts +8 -0
  153. package/dist/types/_vendors/pdf-lib/core/streams/Stream.d.ts +34 -0
  154. package/dist/types/_vendors/pdf-lib/core/streams/decode.d.ts +3 -0
  155. package/dist/types/_vendors/pdf-lib/core/structures/PDFCatalog.d.ts +27 -0
  156. package/dist/types/_vendors/pdf-lib/core/structures/PDFContentStream.d.ts +15 -0
  157. package/dist/types/_vendors/pdf-lib/core/structures/PDFCrossRefStream.d.ts +53 -0
  158. package/dist/types/_vendors/pdf-lib/core/structures/PDFFlateStream.d.ts +13 -0
  159. package/dist/types/_vendors/pdf-lib/core/structures/PDFObjectStream.d.ts +20 -0
  160. package/dist/types/_vendors/pdf-lib/core/structures/PDFPageLeaf.d.ts +54 -0
  161. package/dist/types/_vendors/pdf-lib/core/structures/PDFPageTree.d.ts +41 -0
  162. package/dist/types/_vendors/pdf-lib/core/syntax/CharCodes.d.ts +61 -0
  163. package/dist/types/_vendors/pdf-lib/core/syntax/Delimiters.d.ts +1 -0
  164. package/dist/types/_vendors/pdf-lib/core/syntax/Irregular.d.ts +1 -0
  165. package/dist/types/_vendors/pdf-lib/core/syntax/Keywords.d.ts +22 -0
  166. package/dist/types/_vendors/pdf-lib/core/syntax/Numeric.d.ts +3 -0
  167. package/dist/types/_vendors/pdf-lib/core/syntax/Whitespace.d.ts +1 -0
  168. package/dist/types/_vendors/pdf-lib/core/writers/PDFStreamWriter.d.ts +19 -0
  169. package/dist/types/_vendors/pdf-lib/core/writers/PDFWriter.d.ts +29 -0
  170. package/dist/types/_vendors/pdf-lib/index.d.ts +4 -0
  171. package/dist/types/_vendors/pdf-lib/types/fontkit.d.ts +597 -0
  172. package/dist/types/_vendors/pdf-lib/types/index.d.ts +25 -0
  173. package/dist/types/_vendors/pdf-lib/types/matrix.d.ts +21 -0
  174. package/dist/types/_vendors/pdf-lib/utils/Cache.d.ts +10 -0
  175. package/dist/types/_vendors/pdf-lib/utils/arrays.d.ts +16 -0
  176. package/dist/types/_vendors/pdf-lib/utils/async.d.ts +5 -0
  177. package/dist/types/_vendors/pdf-lib/utils/base64.d.ts +10 -0
  178. package/dist/types/_vendors/pdf-lib/utils/elements/Arc.d.ts +22 -0
  179. package/dist/types/_vendors/pdf-lib/utils/elements/Circle.d.ts +14 -0
  180. package/dist/types/_vendors/pdf-lib/utils/elements/Ellipse.d.ts +20 -0
  181. package/dist/types/_vendors/pdf-lib/utils/elements/GraphElement.d.ts +6 -0
  182. package/dist/types/_vendors/pdf-lib/utils/elements/Line.d.ts +23 -0
  183. package/dist/types/_vendors/pdf-lib/utils/elements/Plot.d.ts +11 -0
  184. package/dist/types/_vendors/pdf-lib/utils/elements/Point.d.ts +18 -0
  185. package/dist/types/_vendors/pdf-lib/utils/elements/Rectangle.d.ts +21 -0
  186. package/dist/types/_vendors/pdf-lib/utils/elements/Segment.d.ts +19 -0
  187. package/dist/types/_vendors/pdf-lib/utils/elements/index.d.ts +9 -0
  188. package/dist/types/_vendors/pdf-lib/utils/errors.d.ts +1 -0
  189. package/dist/types/_vendors/pdf-lib/utils/index.d.ts +11 -0
  190. package/dist/types/_vendors/pdf-lib/utils/intersections.d.ts +9 -0
  191. package/dist/types/_vendors/pdf-lib/utils/maths.d.ts +45 -0
  192. package/dist/types/_vendors/pdf-lib/utils/numbers.d.ts +23 -0
  193. package/dist/types/_vendors/pdf-lib/utils/objects.d.ts +15 -0
  194. package/dist/types/_vendors/pdf-lib/utils/pdfDocEncoding.d.ts +7 -0
  195. package/dist/types/_vendors/pdf-lib/utils/png.d.ts +17 -0
  196. package/dist/types/_vendors/pdf-lib/utils/rng.d.ts +13 -0
  197. package/dist/types/_vendors/pdf-lib/utils/strings.d.ts +25 -0
  198. package/dist/types/_vendors/pdf-lib/utils/unicode.d.ts +186 -0
  199. package/dist/types/_vendors/pdf-lib/utils/validators.d.ts +26 -0
  200. package/dist/types/_vendors/print-designer-editor/Canvas.d.ts +12 -0
  201. package/dist/types/_vendors/print-designer-editor/PdfmeProvider.d.ts +4 -0
  202. package/dist/types/_vendors/print-designer-editor/PropPanel.d.ts +10 -0
  203. package/dist/types/_vendors/print-designer-editor/SchemaList.d.ts +10 -0
  204. package/dist/types/_vendors/print-designer-editor/index.d.ts +14 -0
  205. package/dist/types/_vendors/print-designer-editor/plugins.d.ts +1 -0
  206. package/dist/types/_vendors/print-designer-editor/types.d.ts +64 -0
  207. package/dist/types/_vendors/print-designer-editor/useDesigner.d.ts +84 -0
  208. package/dist/types/_vendors/print-designer-editor/useDesignerContext.d.ts +1 -0
  209. package/dist/types/_vendors/print-designer-editor/utils.d.ts +9 -0
  210. package/dist/types/_vendors/schemas/barcodes/constants.d.ts +4 -0
  211. package/dist/types/_vendors/schemas/barcodes/helper.d.ts +21 -0
  212. package/dist/types/_vendors/schemas/barcodes/index.d.ts +4 -0
  213. package/dist/types/_vendors/schemas/barcodes/pdfRender.d.ts +3 -0
  214. package/dist/types/_vendors/schemas/barcodes/propPanel.d.ts +3 -0
  215. package/dist/types/_vendors/schemas/barcodes/types.d.ts +10 -0
  216. package/dist/types/_vendors/schemas/barcodes/uiRender.d.ts +3 -0
  217. package/dist/types/_vendors/schemas/checkbox/index.d.ts +6 -0
  218. package/dist/types/_vendors/schemas/constants.d.ts +2 -0
  219. package/dist/types/_vendors/schemas/date/date.d.ts +2 -0
  220. package/dist/types/_vendors/schemas/date/dateTime.d.ts +2 -0
  221. package/dist/types/_vendors/schemas/date/helper.d.ts +8 -0
  222. package/dist/types/_vendors/schemas/date/time.d.ts +2 -0
  223. package/dist/types/_vendors/schemas/date/types.d.ts +17 -0
  224. package/dist/types/_vendors/schemas/dynamicTable/engine/core/cell.d.ts +17 -0
  225. package/dist/types/_vendors/schemas/dynamicTable/engine/core/index.d.ts +2 -0
  226. package/dist/types/_vendors/schemas/dynamicTable/engine/core/settings-validator.d.ts +10 -0
  227. package/dist/types/_vendors/schemas/dynamicTable/engine/core/table.d.ts +130 -0
  228. package/dist/types/_vendors/schemas/dynamicTable/engine/engines/layout.engine.d.ts +66 -0
  229. package/dist/types/_vendors/schemas/dynamicTable/engine/engines/overflow.engine.d.ts +36 -0
  230. package/dist/types/_vendors/schemas/dynamicTable/engine/index.d.ts +16 -0
  231. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/core/cell.interface.d.ts +13 -0
  232. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/core/index.d.ts +1 -0
  233. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/engines/index.d.ts +1 -0
  234. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/engines/layout-engine.interface.d.ts +36 -0
  235. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/index.d.ts +5 -0
  236. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/rules/index.d.ts +3 -0
  237. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/rules/rule-engine.interface.d.ts +21 -0
  238. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/rules/rule-registry.interface.d.ts +19 -0
  239. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/stores/cell-registry.interface.d.ts +12 -0
  240. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/stores/index.d.ts +3 -0
  241. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/stores/merge-registry.interface.d.ts +42 -0
  242. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/stores/structure-store.interface.d.ts +31 -0
  243. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/table/index.d.ts +1 -0
  244. package/dist/types/_vendors/schemas/dynamicTable/engine/interfaces/table/table.inteface.d.ts +63 -0
  245. package/dist/types/_vendors/schemas/dynamicTable/engine/renderers/types/renderable-types.d.ts +79 -0
  246. package/dist/types/_vendors/schemas/dynamicTable/engine/renderers/types/serialization.types.d.ts +46 -0
  247. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/ast.types.d.ts +117 -0
  248. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/compiler.d.ts +54 -0
  249. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/evaluator.d.ts +36 -0
  250. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/extract-deps.d.ts +8 -0
  251. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/functions/registry.d.ts +47 -0
  252. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/index.d.ts +20 -0
  253. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/lexer.d.ts +36 -0
  254. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/parser.d.ts +45 -0
  255. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/range-resolver.d.ts +25 -0
  256. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/scope-vocabulary.d.ts +25 -0
  257. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/text-measurer.d.ts +88 -0
  258. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/expression/var-catalog.d.ts +34 -0
  259. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/index.d.ts +13 -0
  260. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/rule-engine.d.ts +36 -0
  261. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/rule-matcher.d.ts +28 -0
  262. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/rule-registry.d.ts +32 -0
  263. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/types/evaluation.types.d.ts +178 -0
  264. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/types/index.d.ts +5 -0
  265. package/dist/types/_vendors/schemas/dynamicTable/engine/rules/types/rule.types.d.ts +78 -0
  266. package/dist/types/_vendors/schemas/dynamicTable/engine/stores/cell-registry.store.d.ts +20 -0
  267. package/dist/types/_vendors/schemas/dynamicTable/engine/stores/merge-registry.stores.d.ts +51 -0
  268. package/dist/types/_vendors/schemas/dynamicTable/engine/stores/structure.store.d.ts +39 -0
  269. package/dist/types/_vendors/schemas/dynamicTable/engine/styles/defaults.d.ts +7 -0
  270. package/dist/types/_vendors/schemas/dynamicTable/engine/styles/index.d.ts +2 -0
  271. package/dist/types/_vendors/schemas/dynamicTable/engine/styles/resolve.d.ts +12 -0
  272. package/dist/types/_vendors/schemas/dynamicTable/engine/types/common.d.ts +138 -0
  273. package/dist/types/_vendors/schemas/dynamicTable/engine/types/index.d.ts +1 -0
  274. package/dist/types/_vendors/schemas/dynamicTable/engine/types/rule-target.types.d.ts +89 -0
  275. package/dist/types/_vendors/schemas/dynamicTable/helpers/cellSchemaMapper.d.ts +21 -0
  276. package/dist/types/_vendors/schemas/dynamicTable/helpers/cellStyleControls.d.ts +6 -0
  277. package/dist/types/_vendors/schemas/dynamicTable/helpers/domUtils.d.ts +24 -0
  278. package/dist/types/_vendors/schemas/dynamicTable/helpers/propPanelWidgets.d.ts +13 -0
  279. package/dist/types/_vendors/schemas/dynamicTable/helpers/regionStyleControls.d.ts +5 -0
  280. package/dist/types/_vendors/schemas/dynamicTable/helpers/toast.d.ts +5 -0
  281. package/dist/types/_vendors/schemas/dynamicTable/helpers/widgets/settingsWidgets.d.ts +16 -0
  282. package/dist/types/_vendors/schemas/dynamicTable/helpers/widgets/structureWidget.d.ts +13 -0
  283. package/dist/types/_vendors/schemas/dynamicTable/helpers/widgets/styleWidgets.d.ts +20 -0
  284. package/dist/types/_vendors/schemas/dynamicTable/index.d.ts +4 -0
  285. package/dist/types/_vendors/schemas/dynamicTable/instanceManager.d.ts +18 -0
  286. package/dist/types/_vendors/schemas/dynamicTable/pdfRender.d.ts +8 -0
  287. package/dist/types/_vendors/schemas/dynamicTable/propPanel.d.ts +15 -0
  288. package/dist/types/_vendors/schemas/dynamicTable/types.d.ts +39 -0
  289. package/dist/types/_vendors/schemas/dynamicTable/uiComponents/addRemoveButtons.d.ts +6 -0
  290. package/dist/types/_vendors/schemas/dynamicTable/uiComponents/cellResizeInteractions.d.ts +17 -0
  291. package/dist/types/_vendors/schemas/dynamicTable/uiComponents/cellSelection.d.ts +16 -0
  292. package/dist/types/_vendors/schemas/dynamicTable/uiComponents/createButton.d.ts +14 -0
  293. package/dist/types/_vendors/schemas/dynamicTable/uiComponents/index.d.ts +4 -0
  294. package/dist/types/_vendors/schemas/dynamicTable/uiRender.d.ts +26 -0
  295. package/dist/types/_vendors/schemas/graphics/image.d.ts +5 -0
  296. package/dist/types/_vendors/schemas/graphics/imagehelper.d.ts +4 -0
  297. package/dist/types/_vendors/schemas/graphics/signature.d.ts +5 -0
  298. package/dist/types/_vendors/schemas/graphics/svg.d.ts +4 -0
  299. package/dist/types/_vendors/schemas/index.d.ts +22 -0
  300. package/dist/types/_vendors/schemas/insertVariableWidget.d.ts +9 -0
  301. package/dist/types/_vendors/schemas/multiVariableText/helper.d.ts +3 -0
  302. package/dist/types/_vendors/schemas/multiVariableText/index.d.ts +4 -0
  303. package/dist/types/_vendors/schemas/multiVariableText/pdfRender.d.ts +3 -0
  304. package/dist/types/_vendors/schemas/multiVariableText/propPanel.d.ts +3 -0
  305. package/dist/types/_vendors/schemas/multiVariableText/types.d.ts +5 -0
  306. package/dist/types/_vendors/schemas/multiVariableText/uiRender.d.ts +3 -0
  307. package/dist/types/_vendors/schemas/radioGroup/index.d.ts +7 -0
  308. package/dist/types/_vendors/schemas/select/index.d.ts +7 -0
  309. package/dist/types/_vendors/schemas/shapes/line.d.ts +6 -0
  310. package/dist/types/_vendors/schemas/shapes/rectAndEllipse.d.ts +175 -0
  311. package/dist/types/_vendors/schemas/tables/cell.d.ts +4 -0
  312. package/dist/types/_vendors/schemas/tables/classes.d.ts +69 -0
  313. package/dist/types/_vendors/schemas/tables/dynamicTemplate.d.ts +7 -0
  314. package/dist/types/_vendors/schemas/tables/helper.d.ts +265 -0
  315. package/dist/types/_vendors/schemas/tables/index.d.ts +4 -0
  316. package/dist/types/_vendors/schemas/tables/pdfRender.d.ts +3 -0
  317. package/dist/types/_vendors/schemas/tables/propPanel.d.ts +3 -0
  318. package/dist/types/_vendors/schemas/tables/tableHelper.d.ts +10 -0
  319. package/dist/types/_vendors/schemas/tables/types.d.ts +88 -0
  320. package/dist/types/_vendors/schemas/tables/uiRender.d.ts +3 -0
  321. package/dist/types/_vendors/schemas/text/constants.d.ts +23 -0
  322. package/dist/types/_vendors/schemas/text/extraFormatter.d.ts +27 -0
  323. package/dist/types/_vendors/schemas/text/helper.d.ts +40 -0
  324. package/dist/types/_vendors/schemas/text/icons/index.d.ts +11 -0
  325. package/dist/types/_vendors/schemas/text/index.d.ts +4 -0
  326. package/dist/types/_vendors/schemas/text/pdfRender.d.ts +3 -0
  327. package/dist/types/_vendors/schemas/text/propPanel.d.ts +3 -0
  328. package/dist/types/_vendors/schemas/text/types.d.ts +30 -0
  329. package/dist/types/_vendors/schemas/text/uiRender.d.ts +11 -0
  330. package/dist/types/_vendors/schemas/utils.d.ts +40 -0
  331. package/dist/types/_vendors/schemas/variableBarcode/helper.d.ts +10 -0
  332. package/dist/types/_vendors/schemas/variableBarcode/index.d.ts +6 -0
  333. package/dist/types/_vendors/schemas/variableBarcode/pdfRender.d.ts +3 -0
  334. package/dist/types/_vendors/schemas/variableBarcode/propPanel.d.ts +4 -0
  335. package/dist/types/_vendors/schemas/variableBarcode/types.d.ts +7 -0
  336. package/dist/types/_vendors/schemas/variableBarcode/uiRender.d.ts +3 -0
  337. package/dist/types/_vendors/ui/Designer.d.ts +23 -0
  338. package/dist/types/_vendors/ui/Form.d.ts +26 -0
  339. package/dist/types/_vendors/ui/Viewer.d.ts +17 -0
  340. package/dist/types/_vendors/ui/class.d.ts +89 -0
  341. package/dist/types/_vendors/ui/components/AppContextProvider.d.ts +11 -0
  342. package/dist/types/_vendors/ui/components/CtlBar.d.ts +18 -0
  343. package/dist/types/_vendors/ui/components/Designer/Canvas/Guides.d.ts +9 -0
  344. package/dist/types/_vendors/ui/components/Designer/Canvas/Mask.d.ts +4 -0
  345. package/dist/types/_vendors/ui/components/Designer/Canvas/Moveable.d.ts +37 -0
  346. package/dist/types/_vendors/ui/components/Designer/Canvas/Padding.d.ts +6 -0
  347. package/dist/types/_vendors/ui/components/Designer/Canvas/Selecto.d.ts +10 -0
  348. package/dist/types/_vendors/ui/components/Designer/Canvas/index.d.ts +22 -0
  349. package/dist/types/_vendors/ui/components/Designer/LeftSidebar.d.ts +8 -0
  350. package/dist/types/_vendors/ui/components/Designer/PluginIcon.d.ts +10 -0
  351. package/dist/types/_vendors/ui/components/Designer/RightSidebar/DetailView/AlignWidget.d.ts +4 -0
  352. package/dist/types/_vendors/ui/components/Designer/RightSidebar/DetailView/ButtonGroupWidget.d.ts +4 -0
  353. package/dist/types/_vendors/ui/components/Designer/RightSidebar/DetailView/WidgetRenderer.d.ts +7 -0
  354. package/dist/types/_vendors/ui/components/Designer/RightSidebar/DetailView/index.d.ts +9 -0
  355. package/dist/types/_vendors/ui/components/Designer/RightSidebar/ListView/Item.d.ts +45 -0
  356. package/dist/types/_vendors/ui/components/Designer/RightSidebar/ListView/SelectableSortableContainer.d.ts +4 -0
  357. package/dist/types/_vendors/ui/components/Designer/RightSidebar/ListView/SelectableSortableItem.d.ts +14 -0
  358. package/dist/types/_vendors/ui/components/Designer/RightSidebar/ListView/index.d.ts +4 -0
  359. package/dist/types/_vendors/ui/components/Designer/RightSidebar/index.d.ts +4 -0
  360. package/dist/types/_vendors/ui/components/Designer/RightSidebar/layout.d.ts +15 -0
  361. package/dist/types/_vendors/ui/components/Designer/index.d.ts +11 -0
  362. package/dist/types/_vendors/ui/components/ErrorScreen.d.ts +7 -0
  363. package/dist/types/_vendors/ui/components/Paper.d.ts +20 -0
  364. package/dist/types/_vendors/ui/components/Preview.d.ts +15 -0
  365. package/dist/types/_vendors/ui/components/Renderer.d.ts +13 -0
  366. package/dist/types/_vendors/ui/components/Root.d.ts +9 -0
  367. package/dist/types/_vendors/ui/components/Spinner.d.ts +3 -0
  368. package/dist/types/_vendors/ui/components/StaticSchema.d.ts +10 -0
  369. package/dist/types/_vendors/ui/components/UnitPager.d.ts +10 -0
  370. package/dist/types/_vendors/ui/constants.d.ts +11 -0
  371. package/dist/types/_vendors/ui/contexts.d.ts +10 -0
  372. package/dist/types/_vendors/ui/helper.d.ts +73 -0
  373. package/dist/types/_vendors/ui/hooks.d.ts +46 -0
  374. package/dist/types/_vendors/ui/i18n.d.ts +3 -0
  375. package/dist/types/_vendors/ui/index.d.ts +4 -0
  376. package/dist/types/_vendors/ui/theme.d.ts +2 -0
  377. package/dist/types/_vendors/ui/types.d.ts +19 -0
  378. package/dist/types/common.d.ts +1 -2
  379. package/dist/types/converter.d.ts +1 -2
  380. package/dist/types/generator.d.ts +1 -2
  381. package/dist/types/index.d.ts +7 -9
  382. package/dist/types/manipulator.d.ts +1 -2
  383. package/dist/types/print-designer-editor.d.ts +1 -2
  384. package/dist/types/schemas.d.ts +1 -2
  385. package/dist/types/ui.d.ts +1 -2
  386. package/package.json +12 -11
  387. package/dist/types/common.d.ts.map +0 -1
  388. package/dist/types/converter.d.ts.map +0 -1
  389. package/dist/types/generator.d.ts.map +0 -1
  390. package/dist/types/index.d.ts.map +0 -1
  391. package/dist/types/manipulator.d.ts.map +0 -1
  392. package/dist/types/print-designer-editor.d.ts.map +0 -1
  393. package/dist/types/schemas.d.ts.map +0 -1
  394. package/dist/types/ui.d.ts.map +0 -1
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Parser — converts tokens into an AST (Abstract Syntax Tree).
3
+ * Uses recursive descent parsing with operator precedence.
4
+ *
5
+ * Input: Token[] from Lexer
6
+ * Output: ExprNode AST
7
+ */
8
+ import type { Token } from './lexer';
9
+ import type { ExprNode } from './ast.types';
10
+ export declare class ParseError extends Error {
11
+ message: string;
12
+ position: number;
13
+ constructor(message: string, position: number);
14
+ }
15
+ /**
16
+ * Parser — builds AST from token stream.
17
+ */
18
+ export declare class Parser {
19
+ private tokens;
20
+ private pos;
21
+ constructor(tokens: Token[]);
22
+ /**
23
+ * Parse tokens into an ExprNode AST.
24
+ */
25
+ parse(): ExprNode;
26
+ /** Lowest precedence: OR */
27
+ private parseExpression;
28
+ private parseOr;
29
+ private parseAnd;
30
+ private parseEquality;
31
+ private parseComparison;
32
+ private parseAdditive;
33
+ private parseMultiplicative;
34
+ private parseUnary;
35
+ private parsePostfix;
36
+ private parsePrimary;
37
+ private parseArguments;
38
+ private parseObjectLiteral;
39
+ private check;
40
+ private match;
41
+ private advance;
42
+ private current;
43
+ private previous;
44
+ private isAtEnd;
45
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * RangeResolver — resolves range notation strings to ICell[] arrays.
3
+ *
4
+ * Notations:
5
+ * - "col:0" → all cells in column 0
6
+ * - "col:self" → all cells in the target column (rule scope)
7
+ * - "row:3" → all cells in row 3
8
+ * - "row:self" → all cells in the target row (rule scope)
9
+ * - "r0c0:r2c3" → rectangular selection (rows 0-2, cols 0-3)
10
+ * - "body" → all body cells
11
+ * - "self" → selection rect (for selection-scoped rules)
12
+ */
13
+ import type { ICell } from '../../interfaces/core/cell.interface';
14
+ import type { EvalContext } from '../types/evaluation.types';
15
+ export declare class RangeResolverError extends Error {
16
+ message: string;
17
+ constructor(message: string);
18
+ }
19
+ /**
20
+ * Resolve a range notation string to an array of cells.
21
+ * @param notation - range notation (e.g., "col:0", "row:self", "r0c0:r2c3", "body")
22
+ * @param ctx - evaluation context with cellRegistry, structureStore
23
+ * @returns array of ICell objects
24
+ */
25
+ export declare function resolveRangeRef(notation: string, ctx: EvalContext): ICell[];
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Palette Dictionary — what condition/result items users can pick per rule scope.
3
+ * Canvas uses this to render the condition builder UI.
4
+ * Engine evaluates the resulting expression strings; never reads this file.
5
+ */
6
+ export type RuleScope = 'table' | 'region' | 'column' | 'row' | 'cell' | 'selection';
7
+ export type ReturnType = 'string' | 'number' | 'boolean';
8
+ /** A single palette item the user can pick from the condition builder */
9
+ export interface PaletteItem {
10
+ /** Display label in canvas UI */
11
+ label: string;
12
+ /** The expression string to insert (e.g., "cell.value", "SUM(col:self)") */
13
+ exprTemplate: string;
14
+ /** What type this item evaluates to (for operator compatibility checking) */
15
+ returnType: ReturnType;
16
+ /** Whether this item needs additional parameters (e.g., CELL needs row, col) */
17
+ requiresParams?: boolean;
18
+ /** Help text for canvas tooltip */
19
+ description?: string;
20
+ }
21
+ /**
22
+ * Scope → Palette mapping.
23
+ * When canvas user selects a scope, show only items from that scope's palette.
24
+ */
25
+ export declare const SCOPE_VOCABULARY: Record<RuleScope, PaletteItem[]>;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * TextMeasurer — pure engine-side text measurement.
3
+ * No renderer involved; uses font metric approximation.
4
+ *
5
+ * Font metric approximation:
6
+ * charHeight = fontSize × 0.353 mm (based on 72 DPI standard)
7
+ * charWidth = charHeight × 0.6 (monospace-ish approximation)
8
+ *
9
+ * This allows overflow detection and font size fitting without a renderer.
10
+ */
11
+ import type { ICell } from '../../interfaces/core/cell.interface';
12
+ export interface TextMetrics {
13
+ width: number;
14
+ height: number;
15
+ }
16
+ export interface FontStyle {
17
+ fontName?: string;
18
+ fontSize: number;
19
+ }
20
+ /**
21
+ * TextMeasurer — estimates text dimensions based on font metrics.
22
+ */
23
+ export declare class TextMeasurer {
24
+ /**
25
+ * Measure text dimensions (width and height).
26
+ * @param text - text to measure
27
+ * @param style - font size and family
28
+ * @returns width and height in mm
29
+ */
30
+ static measureText(text: string, style: FontStyle): TextMetrics;
31
+ /**
32
+ * Check if text overflows a cell.
33
+ * @param cell - the cell to check
34
+ * @returns true if text overflows bounds
35
+ */
36
+ static cellOverflows(cell: ICell): boolean;
37
+ /**
38
+ * Find the largest font size that fits content in a cell.
39
+ * Iterates downward from current size until content fits or hits floor.
40
+ *
41
+ * @param text - text to fit
42
+ * @param style - current font style
43
+ * @param cellWidth - available width in mm
44
+ * @param cellHeight - available height in mm
45
+ * @param minFontSize - minimum acceptable font size (default 6)
46
+ * @returns font size that fits, or minFontSize if nothing fits
47
+ */
48
+ static findFittingFontSize(text: string, style: FontStyle, cellWidth: number, cellHeight: number, minFontSize?: number): number;
49
+ /**
50
+ * Wrap text to fit within a width, calculating resulting height.
51
+ * Simple word-wrap approximation (splits on spaces).
52
+ *
53
+ * @param text - text to wrap
54
+ * @param width - target width in mm
55
+ * @param fontSize - font size in pt
56
+ * @returns wrapped text and its height
57
+ */
58
+ /**
59
+ * Measure the required height for text wrapped within a given width.
60
+ * Accounts for lineHeight and characterSpacing from the cell style.
61
+ *
62
+ * @param text - text to measure
63
+ * @param availableWidth - available width in mm (after padding)
64
+ * @param style - fontSize (pt), lineHeight (multiplier), characterSpacing (pt)
65
+ * @returns required height in mm
66
+ */
67
+ static measureRequiredHeight(text: string, availableWidth: number, style: {
68
+ fontSize: number;
69
+ lineHeight?: number;
70
+ characterSpacing?: number;
71
+ }): number;
72
+ /**
73
+ * Measure the required width for text as a single line (no wrapping).
74
+ * Finds the widest line among newline-split lines.
75
+ *
76
+ * @param text - text to measure
77
+ * @param style - fontSize (pt), characterSpacing (pt)
78
+ * @returns required width in mm
79
+ */
80
+ static measureRequiredWidth(text: string, style: {
81
+ fontSize: number;
82
+ characterSpacing?: number;
83
+ }): number;
84
+ static wrapText(text: string, width: number, fontSize: number): {
85
+ text: string;
86
+ height: number;
87
+ };
88
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Variable Catalog — hardcoded Var definitions that the engine understands.
3
+ * Maps dot-path vars (e.g., "cell.value") to resolver functions.
4
+ *
5
+ * Canvas uses the catalog to show autocomplete / pick-list.
6
+ * Engine uses resolvers to evaluate Var nodes at runtime.
7
+ */
8
+ import type { EvalContext } from '../types/evaluation.types';
9
+ export interface VarDef {
10
+ /** Dot-path for this var (e.g., "cell.value") */
11
+ path: string;
12
+ /** Human-readable description */
13
+ description: string;
14
+ /** Return type (for operator compatibility checking) */
15
+ returnType: 'string' | 'number' | 'boolean';
16
+ /** Resolver function: given context, returns the value */
17
+ resolve: (ctx: EvalContext) => string | number | boolean | null | undefined;
18
+ }
19
+ /**
20
+ * Catalog of all variables the engine understands.
21
+ * Exported so canvas UI can display these as options.
22
+ */
23
+ export declare const VAR_CATALOG: Record<string, VarDef>;
24
+ /**
25
+ * Resolve a dot-path var against the given context.
26
+ * @param path - dot-path like "cell.value" or "table.rowCount"
27
+ * @param ctx - evaluation context
28
+ * @returns the resolved value, or null if var not found
29
+ */
30
+ export declare function resolveVar(path: string, ctx: EvalContext): string | number | boolean | null | undefined;
31
+ /**
32
+ * Get the list of all available var paths (for canvas UI).
33
+ */
34
+ export declare function getAvailableVars(): VarDef[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Barrel export for the entire rules module.
3
+ */
4
+ export * from './expression';
5
+ export type { Rule, RulePayload, RuleInput, RuleUpdate } from './types/rule.types';
6
+ export type { EvalContext, RuleOutput, StylePatch, DeltaInstruction, ComputedValue, ValidationResult as RuleValidationResult, RenderFlag, VisibilityFlag, LockFlag, EvaluationResult, ResolvedCell, RuleEvaluationStats, } from './types/evaluation.types';
7
+ export { RuleRegistry, ruleRegistry } from './rule-registry';
8
+ export type { IRuleRegistry, MatchContext } from '../interfaces/rules';
9
+ export { RuleEngine } from './rule-engine';
10
+ export type { IRuleEngine } from '../interfaces/rules';
11
+ export { matchesCell } from './rule-matcher';
12
+ export { SCOPE_VOCABULARY } from './expression/scope-vocabulary';
13
+ export type { RuleScope } from './expression/scope-vocabulary';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * RuleEngine — evaluates rules against cells and stores results.
3
+ *
4
+ * For each cell: find matching rules via RuleRegistry → evaluate condition AST →
5
+ * if true, evaluate result AST → classify output into EvaluationResult.
6
+ */
7
+ import type { IRuleEngine } from '../interfaces/rules/rule-engine.interface';
8
+ import type { IRuleRegistry } from '../interfaces/rules/rule-registry.interface';
9
+ import type { ICellRegistry } from '../interfaces/stores/cell-registry.interface';
10
+ import type { IStructureStore } from '../interfaces/stores/structure-store.interface';
11
+ import type { ITable } from '../interfaces/table/table.inteface';
12
+ import type { ICell } from '../interfaces/core';
13
+ import type { RulePayload } from './types/rule.types';
14
+ import type { EvaluationResult, ResolvedCell } from './types/evaluation.types';
15
+ export declare class RuleEngine implements IRuleEngine {
16
+ private ruleRegistry;
17
+ private cellRegistry;
18
+ private structureStore;
19
+ private table;
20
+ private results;
21
+ constructor(ruleRegistry: IRuleRegistry, cellRegistry: ICellRegistry, structureStore: IStructureStore, table: ITable);
22
+ evaluateCell(cell: ICell): EvaluationResult;
23
+ evaluateAll(): void;
24
+ getResult(cellId: string): EvaluationResult | undefined;
25
+ getAllResults(): ReadonlyMap<string, EvaluationResult>;
26
+ resolveCell(cell: ICell): ResolvedCell;
27
+ clearResults(): void;
28
+ exportRules(): RulePayload[];
29
+ importRules(payloads: RulePayload[]): void;
30
+ private buildMatchContext;
31
+ private buildEvalContext;
32
+ private evaluateCellWithContext;
33
+ private evaluateRule;
34
+ private classifyOutput;
35
+ private walkTree;
36
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * RuleMatcher — pure function that checks whether a rule's target matches a given cell.
3
+ *
4
+ * Used by RuleRegistry.getRulesForCell() to filter applicable rules.
5
+ */
6
+ import type { ICell } from '../interfaces/core';
7
+ import type { ICellRegistry } from '../interfaces/stores/cell-registry.interface';
8
+ import type { IStructureStore } from '../interfaces/stores/structure-store.interface';
9
+ import type { Rule } from './types/rule.types';
10
+ export interface MatchContext {
11
+ /** Number of layout grid rows occupied by theader. body rowIndex = cell.layout.row - theaderDepth */
12
+ theaderDepth: number;
13
+ /** Number of layout grid cols occupied by lheader. body colIndex = cell.layout.col - lheaderDepth */
14
+ lheaderDepth: number;
15
+ /** For column(headerName) resolution */
16
+ structureStore: IStructureStore;
17
+ /** For reading theader leaf cell rawValue */
18
+ cellRegistry: ICellRegistry;
19
+ }
20
+ /**
21
+ * Check whether a rule's target matches the given cell.
22
+ */
23
+ export declare function matchesCell(rule: Rule, cell: ICell, ctx: MatchContext): boolean;
24
+ /**
25
+ * Resolve a theader leaf cell's rawValue to a 0-based body column index.
26
+ * Returns undefined if no leaf cell with that name is found.
27
+ */
28
+ export declare function resolveHeaderNameToColIndex(headerName: string, ctx: MatchContext): number | undefined;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * RuleRegistry — stores rules and answers "which rules apply to this cell?"
3
+ *
4
+ * Manages CRUD, AST compilation, valueDeps extraction, and the depIndex
5
+ * for reactive re-evaluation.
6
+ */
7
+ import type { IRuleRegistry } from '../interfaces/rules';
8
+ import type { ICell } from '../interfaces/core';
9
+ import type { Rule, RuleInput, RulePayload, RuleUpdate } from './types/rule.types';
10
+ import type { RuleScope } from '../types/rule-target.types';
11
+ import { type MatchContext } from './rule-matcher';
12
+ export declare class RuleRegistry implements IRuleRegistry {
13
+ private rules;
14
+ private depIndex;
15
+ addRule(input: RuleInput): string;
16
+ removeRule(ruleId: string): void;
17
+ updateRule(ruleId: string, update: RuleUpdate): boolean;
18
+ getRule(ruleId: string): Rule | undefined;
19
+ getAll(): Rule[];
20
+ enableRule(ruleId: string): void;
21
+ disableRule(ruleId: string): void;
22
+ getRulesForCell(cell: ICell, ctx: MatchContext): Rule[];
23
+ getRulesByScope(scope: RuleScope): Rule[];
24
+ searchByLabel(query: string): Rule[];
25
+ getRulesByValueDep(depKey: string): Rule[];
26
+ export(): RulePayload[];
27
+ import(payloads: RulePayload[]): void;
28
+ private buildRule;
29
+ private addToDep;
30
+ private removeFromDep;
31
+ }
32
+ export declare const ruleRegistry: RuleRegistry;
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Types for rule evaluation — context, outputs, and resolved results.
3
+ */
4
+ import type { ICell } from '../../interfaces/core/cell.interface';
5
+ import type { IStructureStore } from '../../interfaces/stores/structure-store.interface';
6
+ import type { ICellRegistry } from '../../interfaces/stores/cell-registry.interface';
7
+ import type { CellStyle } from '../../types';
8
+ import { ITable } from '../../interfaces';
9
+ /**
10
+ * EvalContext — the runtime environment for expression evaluation.
11
+ * Passed to the evaluator so expressions can resolve Vars, FnCalls, and RangeRefs.
12
+ */
13
+ export interface EvalContext {
14
+ /** The cell currently being evaluated (if applicable) */
15
+ cell?: ICell;
16
+ /** The table instance (for accessing stores, counts, etc.) */
17
+ table: ITable;
18
+ /** Direct access to cell store for lookups */
19
+ cellRegistry: ICellRegistry;
20
+ /** Direct access to structure store for topology queries */
21
+ structureStore: IStructureStore;
22
+ /** Current row index (for relative "self" resolution in row-scoped rules) */
23
+ rowIndex?: number;
24
+ /** Current column index (for relative "self" resolution in column-scoped rules) */
25
+ colIndex?: number;
26
+ /** Current selection rect (for "self" resolution in selection-scoped rules) */
27
+ selectionRect?: {
28
+ rowStart: number;
29
+ colStart: number;
30
+ rowEnd: number;
31
+ colEnd: number;
32
+ };
33
+ }
34
+ /**
35
+ * RuleOutput — what a rule's result expression evaluates to.
36
+ * Union of all possible side-effects a rule can produce.
37
+ */
38
+ export type RuleOutput = StylePatch | DeltaInstruction | ComputedValue | ValidationResult | RenderFlag | VisibilityFlag | LockFlag;
39
+ /**
40
+ * StylePatch — partial style override (never stored on cell, merged at display time).
41
+ * Uses Partial<CellStyle> for pdfme compatibility.
42
+ */
43
+ export interface StylePatch {
44
+ type: 'style';
45
+ style: Partial<CellStyle>;
46
+ }
47
+ /**
48
+ * DeltaInstruction — request to LayoutEngine to adjust geometry.
49
+ * Only ever increases dimensions; never decreases without explicit user action.
50
+ */
51
+ export type DeltaInstruction = {
52
+ type: 'row-height-min';
53
+ rowIndex: number;
54
+ minHeight: number;
55
+ } | {
56
+ type: 'col-width-min';
57
+ colIndex: number;
58
+ minWidth: number;
59
+ };
60
+ /**
61
+ * ComputedValue — rule computes a new value for the cell.
62
+ * Replaces cell.computedValue in the EvaluationResult.
63
+ */
64
+ export interface ComputedValue {
65
+ type: 'computedValue';
66
+ value: string | number;
67
+ }
68
+ /**
69
+ * ValidationResult — rule performs validation and produces error/warning.
70
+ * Stored in EvaluationResult for renderer to display.
71
+ */
72
+ export interface ValidationResult {
73
+ type: 'validation';
74
+ valid: boolean;
75
+ message?: string;
76
+ severity?: 'error' | 'warning' | 'info';
77
+ }
78
+ /**
79
+ * RenderFlag — flags for renderer (e.g., clip overflowing text).
80
+ * Stored in EvaluationResult for renderer to interpret.
81
+ */
82
+ export interface RenderFlag {
83
+ type: 'renderFlag';
84
+ clip?: boolean;
85
+ wrap?: boolean;
86
+ }
87
+ /**
88
+ * VisibilityFlag — hide or show the cell.
89
+ */
90
+ export interface VisibilityFlag {
91
+ type: 'visibility';
92
+ hidden: boolean;
93
+ }
94
+ /**
95
+ * LockFlag — lock/unlock the cell for editing.
96
+ */
97
+ export interface LockFlag {
98
+ type: 'lock';
99
+ locked: boolean;
100
+ }
101
+ /**
102
+ * EvaluationResult — the complete result of evaluating all rules for one cell.
103
+ * Collected per cell after all matching rules have fired.
104
+ */
105
+ export interface EvaluationResult {
106
+ /** Cell ID being evaluated */
107
+ cellId: string;
108
+ /** Merged style patches from all rules (lower priority rules applied first) */
109
+ stylePatches: StylePatch[];
110
+ /** Geometry delta instructions from overflow/layout rules */
111
+ deltaInstructions: DeltaInstruction[];
112
+ /** Computed value (if any rule produced one) */
113
+ computedValue?: string | number;
114
+ /** Validation result (if any rule validated) */
115
+ validationResult?: ValidationResult;
116
+ /** Render flags (clip, wrap, etc.) */
117
+ renderFlags: RenderFlag[];
118
+ /** Visibility state */
119
+ hidden?: boolean;
120
+ /** Lock state */
121
+ locked?: boolean;
122
+ /** List of rule IDs that evaluated for this cell (for debugging) */
123
+ firedRuleIds: string[];
124
+ }
125
+ /**
126
+ * ResolvedCell — the final renderer-agnostic snapshot of a cell.
127
+ * Output of the entire evaluation pipeline; both canvas and PDF renderers consume this.
128
+ * No rule logic in renderers — they just draw what's in ResolvedCell.
129
+ */
130
+ export interface ResolvedCell {
131
+ /** Cell ID */
132
+ cellId: string;
133
+ /** Display value (rawValue or computedValue from rules) */
134
+ displayValue: string | number;
135
+ /** Layout geometry */
136
+ layout: {
137
+ row: number;
138
+ col: number;
139
+ rowSpan: number;
140
+ colSpan: number;
141
+ x: number;
142
+ y: number;
143
+ width: number;
144
+ height: number;
145
+ };
146
+ /** Resolved style (base cell style + merged patches from rules) */
147
+ resolvedStyle: CellStyle;
148
+ /** Overflow handling mode */
149
+ overflowMode?: 'clip' | 'wrap' | 'increase-height' | 'increase-width';
150
+ /** Render flags */
151
+ renderFlags: {
152
+ clip?: boolean;
153
+ wrap?: boolean;
154
+ };
155
+ /** Visibility */
156
+ hidden?: boolean;
157
+ /** Edit lock */
158
+ locked?: boolean;
159
+ /** Validation state */
160
+ validation?: {
161
+ valid: boolean;
162
+ message?: string;
163
+ severity?: 'error' | 'warning' | 'info';
164
+ };
165
+ }
166
+ /**
167
+ * RuleEvaluationStats — for debugging and performance monitoring.
168
+ * Tracks which rules fired and how long evaluation took.
169
+ */
170
+ export interface RuleEvaluationStats {
171
+ cellId: string;
172
+ firedRuleIds: string[];
173
+ evaluationTimeMs: number;
174
+ evaluationErrors: Array<{
175
+ ruleId: string;
176
+ error: Error;
177
+ }>;
178
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Barrel export for all rule type definitions.
3
+ */
4
+ export type { Rule, RulePayload, RuleInput, RuleUpdate } from './rule.types';
5
+ export type { EvalContext, RuleOutput, StylePatch, DeltaInstruction, ComputedValue, ValidationResult, RenderFlag, VisibilityFlag, LockFlag, EvaluationResult, ResolvedCell, RuleEvaluationStats, } from './evaluation.types';
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Rule — the unified shape for all rules (prebuilt and user-created).
3
+ * Canvas stores condition and result as strings; engine compiles them to AST on first use.
4
+ */
5
+ import type { RuleTarget } from '../../types/rule-target.types';
6
+ import type { ExprNode } from '../expression/ast.types';
7
+ /**
8
+ * A single rule that applies conditions to cells and produces results.
9
+ *
10
+ * Rules are stored with expression strings (so canvas can edit them).
11
+ * The engine compiles strings to AST once and caches the AST.
12
+ * AST cache fields are never serialized to storage.
13
+ */
14
+ export interface Rule {
15
+ /** Unique identifier for this rule (assigned by RuleRegistry) */
16
+ ruleId: string;
17
+ /** Which cells this rule applies to (scope + selector) */
18
+ target: RuleTarget;
19
+ /** Condition expression as string (e.g., "cell.value > 100", "always")
20
+ * Canvas stores and edits this directly.
21
+ * Evaluates to boolean at runtime.
22
+ */
23
+ condition: string;
24
+ /** Result expression as string (e.g., "{ style: { backgroundColor: 'red' } }")
25
+ * Canvas stores and edits this directly.
26
+ * Evaluates to RuleOutput shape at runtime.
27
+ */
28
+ result: string;
29
+ /**
30
+ * Compiled AST cache for condition expression.
31
+ * NOT serialized to storage — regenerated on first evaluation.
32
+ * @internal
33
+ */
34
+ _conditionAst?: ExprNode;
35
+ /**
36
+ * Compiled AST cache for result expression.
37
+ * NOT serialized to storage — regenerated on first evaluation.
38
+ * @internal
39
+ */
40
+ _resultAst?: ExprNode;
41
+ /** Priority determines evaluation order when multiple rules target the same cell.
42
+ * Lower number = higher priority (evaluates first).
43
+ * Default: 0 (lowest priority, can be overridden).
44
+ * Prebuilt rules typically use 0; user rules can use higher values.
45
+ */
46
+ priority: number;
47
+ /** Whether this rule is active. Disabled rules are indexed but not evaluated. */
48
+ enabled: boolean;
49
+ /** Optional human-readable label for canvas UI */
50
+ label?: string;
51
+ /**
52
+ * Dependency keys auto-extracted from result AST.
53
+ * Used by value-dependency-index for reactive re-firing.
54
+ *
55
+ * Examples:
56
+ * - "cell.value" → this rule reads cell.value
57
+ * - "col:2" → this rule reads column 2 (any cell in it)
58
+ * - "row:3" → this rule reads row 3 (any cell in it)
59
+ * - "table.rowCount"→ this rule reads table.rowCount
60
+ *
61
+ * When any of these keys' values change, this rule is re-evaluated.
62
+ */
63
+ valueDeps: string[];
64
+ }
65
+ /**
66
+ * Serializable rule payload (for storage/API).
67
+ * Excludes AST cache fields (_conditionAst, _resultAst).
68
+ */
69
+ export type RulePayload = Omit<Rule, '_conditionAst' | '_resultAst'>;
70
+ /**
71
+ * Rule creation input (canvas or programmatic).
72
+ * ruleId and valueDeps are assigned by the registry.
73
+ */
74
+ export type RuleInput = Omit<Rule, 'ruleId' | 'valueDeps' | '_conditionAst' | '_resultAst'>;
75
+ /**
76
+ * Partial rule update (e.g., enable/disable, change priority, edit condition).
77
+ */
78
+ export type RuleUpdate = Partial<RuleInput>;
@@ -0,0 +1,20 @@
1
+ import { ICell, ICellRegistry } from "../interfaces";
2
+ import { CellPayload, CellStyle, OverflowMode, Region } from "../types";
3
+ /** @deprecated Import from '../styles' instead */
4
+ export { defaultCellStyle } from "../styles/defaults";
5
+ /** @deprecated Use defaultCellStyle from '../styles' instead */
6
+ export { defaultCellStyle as defaultStyle } from "../styles/defaults";
7
+ export declare class CellRegistry implements ICellRegistry {
8
+ private cellsById;
9
+ private cellsByAddress;
10
+ private cellIdToAddress;
11
+ constructor();
12
+ setCellAddress(cellId: string, address: string): void;
13
+ clearCellAddress(cellId: string): void;
14
+ createCell(region: Region, rawValue?: string, style?: Partial<CellStyle>, isDynamic?: boolean): string;
15
+ createCellWithId(cellId: string, region: Region, rawValue?: string, style?: Partial<CellStyle>, isDynamic?: boolean, computedValue?: string | number, overflow?: OverflowMode): string;
16
+ deleteCell(cellId: string): void;
17
+ getCellByAddress(address: string): ICell | undefined;
18
+ getCellById(cellId: string): ICell | undefined;
19
+ updateCell(cellId: string, payload: CellPayload): void;
20
+ }
@@ -0,0 +1,51 @@
1
+ import { IMergeRegistry, IStructureStore } from "../interfaces";
2
+ import { Rect } from "../types/common";
3
+ export declare class MergeRegistry implements IMergeRegistry {
4
+ private mergeRegistry;
5
+ private structureStore;
6
+ constructor(structureStore: IStructureStore);
7
+ /**
8
+ * Create a merge for the given rectangle
9
+ * Validates the merge before adding it
10
+ */
11
+ createMerge(rect: Rect): void;
12
+ /**
13
+ * Delete a merge by its root cell ID
14
+ * The root cell ID is the primary key in the merge registry
15
+ */
16
+ deleteMerge(cellId: string): void;
17
+ /**
18
+ * Get merge by root cell ID
19
+ * Returns the merge rectangle if it exists
20
+ */
21
+ getMergeByRootId(cellId: string): Rect | undefined;
22
+ /**
23
+ * Find a merge that contains a specific cell by its ID
24
+ * Returns the merge rectangle and the root cell ID if found
25
+ * Useful when you have a cell ID and need to find its merge
26
+ */
27
+ findMergeByContainedCell(cellId: string): {
28
+ rootCellId: string;
29
+ merge: Rect;
30
+ } | undefined;
31
+ /**
32
+ * Check if a cell is part of any merge
33
+ * Returns true if the cell ID is a merge root
34
+ */
35
+ isMergeRoot(cellId: string): boolean;
36
+ /**
37
+ * Get all cells that are merge roots
38
+ * These are the cellIds that have merges associated with them
39
+ */
40
+ getMergeRoots(): string[];
41
+ /**
42
+ * Validate if a merge rectangle is valid for the table structure
43
+ *
44
+ * For body/undefined regions: validates against full table bounds
45
+ * For header regions (theader, lheader, rheader, footer): skips strict validation
46
+ * since header bounds are region-local and validated at layout time
47
+ */
48
+ isValidMerge(rect: Rect): boolean;
49
+ private isChild;
50
+ getMergeSet(): Map<string, Rect>;
51
+ }