@linkiez/dxf-renew 7.1.0 → 7.2.3

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 (398) hide show
  1. package/.eslintrc.json +1 -16
  2. package/.yarn/install-state.gz +0 -0
  3. package/ARCHITECTURE.md +163 -0
  4. package/CHANGELOG.md +34 -0
  5. package/README.md +72 -10
  6. package/{PLAN.md → ROADMAP.md} +227 -35
  7. package/build.mjs +28 -0
  8. package/dist/dxf.js +1090 -344
  9. package/docs/FIXTURE_VALIDATION_EZDXF.md +1 -1
  10. package/lib/Helper.cjs +4 -0
  11. package/lib/Helper.cjs.map +3 -3
  12. package/lib/Helper.d.ts +19 -0
  13. package/lib/Helper.d.ts.map +1 -0
  14. package/lib/Helper.js +4 -0
  15. package/lib/Helper.js.map +2 -2
  16. package/lib/applyTransforms.d.ts +12 -0
  17. package/lib/applyTransforms.d.ts.map +1 -0
  18. package/lib/cli.cjs +1 -2
  19. package/lib/cli.cjs.map +1 -1
  20. package/lib/cli.d.ts +3 -0
  21. package/lib/cli.d.ts.map +1 -0
  22. package/lib/config.d.ts +4 -0
  23. package/lib/config.d.ts.map +1 -0
  24. package/lib/constants.d.ts +3 -0
  25. package/lib/constants.d.ts.map +1 -0
  26. package/lib/denormalise.d.ts +3 -0
  27. package/lib/denormalise.d.ts.map +1 -0
  28. package/lib/dimensionToSVG.d.ts +18 -0
  29. package/lib/dimensionToSVG.d.ts.map +1 -0
  30. package/lib/entityToPolyline.cjs +95 -0
  31. package/lib/entityToPolyline.cjs.map +3 -3
  32. package/lib/entityToPolyline.d.ts +48 -0
  33. package/lib/entityToPolyline.d.ts.map +1 -0
  34. package/lib/entityToPolyline.js +95 -0
  35. package/lib/entityToPolyline.js.map +2 -2
  36. package/lib/getRGBForEntity.d.ts +5 -0
  37. package/lib/getRGBForEntity.d.ts.map +1 -0
  38. package/lib/groupEntitiesByLayer.d.ts +3 -0
  39. package/lib/groupEntitiesByLayer.d.ts.map +1 -0
  40. package/lib/handlers/blocks.d.ts +3 -0
  41. package/lib/handlers/blocks.d.ts.map +1 -0
  42. package/lib/handlers/entities.cjs +22 -2
  43. package/lib/handlers/entities.cjs.map +3 -3
  44. package/lib/handlers/entities.d.ts +4 -0
  45. package/lib/handlers/entities.d.ts.map +1 -0
  46. package/lib/handlers/entities.js +22 -2
  47. package/lib/handlers/entities.js.map +2 -2
  48. package/lib/handlers/entity/arc.d.ts +20 -0
  49. package/lib/handlers/entity/arc.d.ts.map +1 -0
  50. package/lib/handlers/entity/attdef.d.ts +11 -0
  51. package/lib/handlers/entity/attdef.d.ts.map +1 -0
  52. package/lib/handlers/entity/attrib.d.ts +9 -0
  53. package/lib/handlers/entity/attrib.d.ts.map +1 -0
  54. package/lib/handlers/entity/circle.d.ts +17 -0
  55. package/lib/handlers/entity/circle.d.ts.map +1 -0
  56. package/lib/handlers/entity/common.d.ts +3 -0
  57. package/lib/handlers/entity/common.d.ts.map +1 -0
  58. package/lib/handlers/entity/dgnUnderlay.d.ts +33 -0
  59. package/lib/handlers/entity/dgnUnderlay.d.ts.map +1 -0
  60. package/lib/handlers/entity/dimension.d.ts +35 -0
  61. package/lib/handlers/entity/dimension.d.ts.map +1 -0
  62. package/lib/handlers/entity/dwfUnderlay.d.ts +33 -0
  63. package/lib/handlers/entity/dwfUnderlay.d.ts.map +1 -0
  64. package/lib/handlers/entity/ellipse.d.ts +10 -0
  65. package/lib/handlers/entity/ellipse.d.ts.map +1 -0
  66. package/lib/handlers/entity/hatch.d.ts +9 -0
  67. package/lib/handlers/entity/hatch.d.ts.map +1 -0
  68. package/lib/handlers/entity/image.d.ts +26 -0
  69. package/lib/handlers/entity/image.d.ts.map +1 -0
  70. package/lib/handlers/entity/insert.d.ts +10 -0
  71. package/lib/handlers/entity/insert.d.ts.map +1 -0
  72. package/lib/handlers/entity/leader.d.ts +48 -0
  73. package/lib/handlers/entity/leader.d.ts.map +1 -0
  74. package/lib/handlers/entity/line.d.ts +16 -0
  75. package/lib/handlers/entity/line.d.ts.map +1 -0
  76. package/lib/handlers/entity/lwpolyline.d.ts +10 -0
  77. package/lib/handlers/entity/lwpolyline.d.ts.map +1 -0
  78. package/lib/handlers/entity/mleader.cjs +69 -0
  79. package/lib/handlers/entity/mleader.cjs.map +7 -0
  80. package/lib/handlers/entity/mleader.d.ts +15 -0
  81. package/lib/handlers/entity/mleader.d.ts.map +1 -0
  82. package/lib/handlers/entity/mleader.js +34 -0
  83. package/lib/handlers/entity/mleader.js.map +7 -0
  84. package/lib/handlers/entity/mline.cjs +91 -0
  85. package/lib/handlers/entity/mline.cjs.map +7 -0
  86. package/lib/handlers/entity/mline.d.ts +17 -0
  87. package/lib/handlers/entity/mline.d.ts.map +1 -0
  88. package/lib/handlers/entity/mline.js +56 -0
  89. package/lib/handlers/entity/mline.js.map +7 -0
  90. package/lib/handlers/entity/mtext.d.ts +62 -0
  91. package/lib/handlers/entity/mtext.d.ts.map +1 -0
  92. package/lib/handlers/entity/ole2Frame.d.ts +9 -0
  93. package/lib/handlers/entity/ole2Frame.d.ts.map +1 -0
  94. package/lib/handlers/entity/oleframe.cjs +98 -0
  95. package/lib/handlers/entity/oleframe.cjs.map +7 -0
  96. package/lib/handlers/entity/oleframe.d.ts +9 -0
  97. package/lib/handlers/entity/oleframe.d.ts.map +1 -0
  98. package/lib/handlers/entity/oleframe.js +63 -0
  99. package/lib/handlers/entity/oleframe.js.map +7 -0
  100. package/lib/handlers/entity/pdfUnderlay.d.ts +33 -0
  101. package/lib/handlers/entity/pdfUnderlay.d.ts.map +1 -0
  102. package/lib/handlers/entity/point.d.ts +17 -0
  103. package/lib/handlers/entity/point.d.ts.map +1 -0
  104. package/lib/handlers/entity/polyline.d.ts +21 -0
  105. package/lib/handlers/entity/polyline.d.ts.map +1 -0
  106. package/lib/handlers/entity/ray.cjs +81 -0
  107. package/lib/handlers/entity/ray.cjs.map +7 -0
  108. package/lib/handlers/entity/ray.d.ts +15 -0
  109. package/lib/handlers/entity/ray.d.ts.map +1 -0
  110. package/lib/handlers/entity/ray.js +46 -0
  111. package/lib/handlers/entity/ray.js.map +7 -0
  112. package/lib/handlers/entity/region.cjs +67 -0
  113. package/lib/handlers/entity/region.cjs.map +7 -0
  114. package/lib/handlers/entity/region.d.ts +14 -0
  115. package/lib/handlers/entity/region.d.ts.map +1 -0
  116. package/lib/handlers/entity/region.js +32 -0
  117. package/lib/handlers/entity/region.js.map +7 -0
  118. package/lib/handlers/entity/shape.cjs +95 -0
  119. package/lib/handlers/entity/shape.cjs.map +7 -0
  120. package/lib/handlers/entity/shape.d.ts +22 -0
  121. package/lib/handlers/entity/shape.d.ts.map +1 -0
  122. package/lib/handlers/entity/shape.js +60 -0
  123. package/lib/handlers/entity/shape.js.map +7 -0
  124. package/lib/handlers/entity/solid.d.ts +15 -0
  125. package/lib/handlers/entity/solid.d.ts.map +1 -0
  126. package/lib/handlers/entity/spline.d.ts +30 -0
  127. package/lib/handlers/entity/spline.d.ts.map +1 -0
  128. package/lib/handlers/entity/table.cjs +71 -0
  129. package/lib/handlers/entity/table.cjs.map +7 -0
  130. package/lib/handlers/entity/table.d.ts +16 -0
  131. package/lib/handlers/entity/table.d.ts.map +1 -0
  132. package/lib/handlers/entity/table.js +36 -0
  133. package/lib/handlers/entity/table.js.map +7 -0
  134. package/lib/handlers/entity/text.d.ts +31 -0
  135. package/lib/handlers/entity/text.d.ts.map +1 -0
  136. package/lib/handlers/entity/threeDFace.d.ts +14 -0
  137. package/lib/handlers/entity/threeDFace.d.ts.map +1 -0
  138. package/lib/handlers/entity/tolerance.d.ts +25 -0
  139. package/lib/handlers/entity/tolerance.d.ts.map +1 -0
  140. package/lib/handlers/entity/trace.cjs +101 -0
  141. package/lib/handlers/entity/trace.cjs.map +7 -0
  142. package/lib/handlers/entity/trace.d.ts +15 -0
  143. package/lib/handlers/entity/trace.d.ts.map +1 -0
  144. package/lib/handlers/entity/trace.js +66 -0
  145. package/lib/handlers/entity/trace.js.map +7 -0
  146. package/lib/handlers/entity/vertex.d.ts +10 -0
  147. package/lib/handlers/entity/vertex.d.ts.map +1 -0
  148. package/lib/handlers/entity/viewport.d.ts +9 -0
  149. package/lib/handlers/entity/viewport.d.ts.map +1 -0
  150. package/lib/handlers/entity/wipeout.cjs +122 -0
  151. package/lib/handlers/entity/wipeout.cjs.map +7 -0
  152. package/lib/handlers/entity/wipeout.d.ts +28 -0
  153. package/lib/handlers/entity/wipeout.d.ts.map +1 -0
  154. package/lib/handlers/entity/wipeout.js +87 -0
  155. package/lib/handlers/entity/wipeout.js.map +7 -0
  156. package/lib/handlers/entity/xline.cjs +81 -0
  157. package/lib/handlers/entity/xline.cjs.map +7 -0
  158. package/lib/handlers/entity/xline.d.ts +15 -0
  159. package/lib/handlers/entity/xline.d.ts.map +1 -0
  160. package/lib/handlers/entity/xline.js +46 -0
  161. package/lib/handlers/entity/xline.js.map +7 -0
  162. package/lib/handlers/header.d.ts +3 -0
  163. package/lib/handlers/header.d.ts.map +1 -0
  164. package/lib/handlers/objects.cjs +43 -1
  165. package/lib/handlers/objects.cjs.map +2 -2
  166. package/lib/handlers/objects.d.ts +3 -0
  167. package/lib/handlers/objects.d.ts.map +1 -0
  168. package/lib/handlers/objects.js +43 -1
  169. package/lib/handlers/objects.js.map +2 -2
  170. package/lib/handlers/tables.cjs +96 -17
  171. package/lib/handlers/tables.cjs.map +2 -2
  172. package/lib/handlers/tables.d.ts +13 -0
  173. package/lib/handlers/tables.d.ts.map +1 -0
  174. package/lib/handlers/tables.js +96 -17
  175. package/lib/handlers/tables.js.map +2 -2
  176. package/lib/index.cjs +5 -2
  177. package/lib/index.cjs.map +3 -3
  178. package/lib/index.d.ts +10 -0
  179. package/lib/index.d.ts.map +1 -0
  180. package/lib/index.js +18 -16
  181. package/lib/index.js.map +3 -3
  182. package/lib/parseString.d.ts +3 -0
  183. package/lib/parseString.d.ts.map +1 -0
  184. package/lib/toJson.cjs +29 -0
  185. package/lib/toJson.cjs.map +7 -0
  186. package/lib/toJson.d.ts +3 -0
  187. package/lib/toJson.d.ts.map +1 -0
  188. package/lib/toJson.js +9 -0
  189. package/lib/toJson.js.map +7 -0
  190. package/lib/toPolylines.d.ts +4 -0
  191. package/lib/toPolylines.d.ts.map +1 -0
  192. package/lib/toSVG.cjs +34 -3
  193. package/lib/toSVG.cjs.map +2 -2
  194. package/lib/toSVG.d.ts +7 -0
  195. package/lib/toSVG.d.ts.map +1 -0
  196. package/lib/toSVG.js +34 -3
  197. package/lib/toSVG.js.map +2 -2
  198. package/lib/types/arc-entity.d.ts +8 -0
  199. package/lib/types/arc-entity.d.ts.map +1 -0
  200. package/lib/types/base-entity.d.ts +22 -0
  201. package/lib/types/base-entity.d.ts.map +1 -0
  202. package/lib/types/circle-entity.d.ts +6 -0
  203. package/lib/types/circle-entity.d.ts.map +1 -0
  204. package/lib/types/common.d.ts +30 -0
  205. package/lib/types/common.d.ts.map +1 -0
  206. package/lib/types/dimension-entity.d.ts +31 -0
  207. package/lib/types/dimension-entity.d.ts.map +1 -0
  208. package/lib/types/dxf.d.ts +55 -0
  209. package/lib/types/dxf.d.ts.map +1 -0
  210. package/lib/types/ellipse-entity.d.ts +11 -0
  211. package/lib/types/ellipse-entity.d.ts.map +1 -0
  212. package/lib/types/entity.cjs.map +1 -1
  213. package/lib/types/entity.d.ts +30 -0
  214. package/lib/types/entity.d.ts.map +1 -0
  215. package/lib/types/handler-internal.d.ts +44 -0
  216. package/lib/types/handler-internal.d.ts.map +1 -0
  217. package/lib/types/handler.d.ts +8 -0
  218. package/lib/types/handler.d.ts.map +1 -0
  219. package/lib/types/hatch-entity.d.ts +116 -0
  220. package/lib/types/hatch-entity.d.ts.map +1 -0
  221. package/lib/types/helper.cjs.map +1 -1
  222. package/lib/types/helper.d.ts +11 -0
  223. package/lib/types/helper.d.ts.map +1 -0
  224. package/lib/types/image-entity.d.ts +25 -0
  225. package/lib/types/image-entity.d.ts.map +1 -0
  226. package/lib/types/index.cjs +20 -0
  227. package/lib/types/index.cjs.map +2 -2
  228. package/lib/types/index.d.ts +43 -0
  229. package/lib/types/index.d.ts.map +1 -0
  230. package/lib/types/index.js +10 -0
  231. package/lib/types/index.js.map +2 -2
  232. package/lib/types/insert-entity.d.ts +16 -0
  233. package/lib/types/insert-entity.d.ts.map +1 -0
  234. package/lib/types/layer-groups.d.ts +6 -0
  235. package/lib/types/layer-groups.d.ts.map +1 -0
  236. package/lib/types/leader-entity.d.ts +28 -0
  237. package/lib/types/leader-entity.d.ts.map +1 -0
  238. package/lib/types/line-entity.d.ts +8 -0
  239. package/lib/types/line-entity.d.ts.map +1 -0
  240. package/lib/types/mleader-entity.cjs +17 -0
  241. package/lib/types/mleader-entity.cjs.map +7 -0
  242. package/lib/types/mleader-entity.d.ts +7 -0
  243. package/lib/types/mleader-entity.d.ts.map +1 -0
  244. package/lib/types/mleader-entity.js +1 -0
  245. package/lib/types/mleader-entity.js.map +7 -0
  246. package/lib/types/mline-entity.cjs +17 -0
  247. package/lib/types/mline-entity.cjs.map +7 -0
  248. package/lib/types/mline-entity.d.ts +10 -0
  249. package/lib/types/mline-entity.d.ts.map +1 -0
  250. package/lib/types/mline-entity.js +1 -0
  251. package/lib/types/mline-entity.js.map +7 -0
  252. package/lib/types/mtext-entity.d.ts +33 -0
  253. package/lib/types/mtext-entity.d.ts.map +1 -0
  254. package/lib/types/ole2frame-entity.d.ts +33 -0
  255. package/lib/types/ole2frame-entity.d.ts.map +1 -0
  256. package/lib/types/oleframe-entity.cjs +17 -0
  257. package/lib/types/oleframe-entity.cjs.map +7 -0
  258. package/lib/types/oleframe-entity.d.ts +33 -0
  259. package/lib/types/oleframe-entity.d.ts.map +1 -0
  260. package/lib/types/oleframe-entity.js +1 -0
  261. package/lib/types/oleframe-entity.js.map +7 -0
  262. package/lib/types/options.cjs.map +1 -1
  263. package/lib/types/options.d.ts +57 -0
  264. package/lib/types/options.d.ts.map +1 -0
  265. package/lib/types/point-entity.d.ts +5 -0
  266. package/lib/types/point-entity.d.ts.map +1 -0
  267. package/lib/types/polyline-entity.d.ts +17 -0
  268. package/lib/types/polyline-entity.d.ts.map +1 -0
  269. package/lib/types/polylines.d.ts +18 -0
  270. package/lib/types/polylines.d.ts.map +1 -0
  271. package/lib/types/ray-entity.cjs +17 -0
  272. package/lib/types/ray-entity.cjs.map +7 -0
  273. package/lib/types/ray-entity.d.ts +10 -0
  274. package/lib/types/ray-entity.d.ts.map +1 -0
  275. package/lib/types/ray-entity.js +1 -0
  276. package/lib/types/ray-entity.js.map +7 -0
  277. package/lib/types/region-entity.cjs +17 -0
  278. package/lib/types/region-entity.cjs.map +7 -0
  279. package/lib/types/region-entity.d.ts +10 -0
  280. package/lib/types/region-entity.d.ts.map +1 -0
  281. package/lib/types/region-entity.js +1 -0
  282. package/lib/types/region-entity.js.map +7 -0
  283. package/lib/types/shape-entity.cjs +17 -0
  284. package/lib/types/shape-entity.cjs.map +7 -0
  285. package/lib/types/shape-entity.d.ts +17 -0
  286. package/lib/types/shape-entity.d.ts.map +1 -0
  287. package/lib/types/shape-entity.js +1 -0
  288. package/lib/types/shape-entity.js.map +7 -0
  289. package/lib/types/solid-entity.d.ts +7 -0
  290. package/lib/types/solid-entity.d.ts.map +1 -0
  291. package/lib/types/spline-entity.d.ts +10 -0
  292. package/lib/types/spline-entity.d.ts.map +1 -0
  293. package/lib/types/svg.d.ts +27 -0
  294. package/lib/types/svg.d.ts.map +1 -0
  295. package/lib/types/table-entity.cjs +17 -0
  296. package/lib/types/table-entity.cjs.map +7 -0
  297. package/lib/types/table-entity.d.ts +12 -0
  298. package/lib/types/table-entity.d.ts.map +1 -0
  299. package/lib/types/table-entity.js +1 -0
  300. package/lib/types/table-entity.js.map +7 -0
  301. package/lib/types/tables.cjs.map +1 -1
  302. package/lib/types/tables.d.ts +549 -0
  303. package/lib/types/tables.d.ts.map +1 -0
  304. package/lib/types/text-entity.d.ts +21 -0
  305. package/lib/types/text-entity.d.ts.map +1 -0
  306. package/lib/types/tolerance-entity.d.ts +14 -0
  307. package/lib/types/tolerance-entity.d.ts.map +1 -0
  308. package/lib/types/trace-entity.cjs +17 -0
  309. package/lib/types/trace-entity.cjs.map +7 -0
  310. package/lib/types/trace-entity.d.ts +10 -0
  311. package/lib/types/trace-entity.d.ts.map +1 -0
  312. package/lib/types/trace-entity.js +1 -0
  313. package/lib/types/trace-entity.js.map +7 -0
  314. package/lib/types/underlay-entity.d.ts +26 -0
  315. package/lib/types/underlay-entity.d.ts.map +1 -0
  316. package/lib/types/util-types.d.ts +22 -0
  317. package/lib/types/util-types.d.ts.map +1 -0
  318. package/lib/types/viewport-entity.d.ts +79 -0
  319. package/lib/types/viewport-entity.d.ts.map +1 -0
  320. package/lib/types/wipeout-entity.cjs +17 -0
  321. package/lib/types/wipeout-entity.cjs.map +7 -0
  322. package/lib/types/wipeout-entity.d.ts +18 -0
  323. package/lib/types/wipeout-entity.d.ts.map +1 -0
  324. package/lib/types/wipeout-entity.js +1 -0
  325. package/lib/types/wipeout-entity.js.map +7 -0
  326. package/lib/types/xline-entity.cjs +17 -0
  327. package/lib/types/xline-entity.cjs.map +7 -0
  328. package/lib/types/xline-entity.d.ts +10 -0
  329. package/lib/types/xline-entity.d.ts.map +1 -0
  330. package/lib/types/xline-entity.js +1 -0
  331. package/lib/types/xline-entity.js.map +7 -0
  332. package/lib/types.d.ts +2 -0
  333. package/lib/types.d.ts.map +1 -0
  334. package/lib/util/bSpline.d.ts +8 -0
  335. package/lib/util/bSpline.d.ts.map +1 -0
  336. package/lib/util/colors.d.ts +5 -0
  337. package/lib/util/colors.d.ts.map +1 -0
  338. package/lib/util/createArcForLWPolyline.d.ts +9 -0
  339. package/lib/util/createArcForLWPolyline.d.ts.map +1 -0
  340. package/lib/util/dxfColorToRGB.d.ts +22 -0
  341. package/lib/util/dxfColorToRGB.d.ts.map +1 -0
  342. package/lib/util/escapeXmlText.d.ts +2 -0
  343. package/lib/util/escapeXmlText.d.ts.map +1 -0
  344. package/lib/util/insertKnot.d.ts +9 -0
  345. package/lib/util/insertKnot.d.ts.map +1 -0
  346. package/lib/util/logger.d.ts +10 -0
  347. package/lib/util/logger.d.ts.map +1 -0
  348. package/lib/util/rgbToColorAttribute.d.ts +7 -0
  349. package/lib/util/rgbToColorAttribute.d.ts.map +1 -0
  350. package/lib/util/rotate.d.ts +9 -0
  351. package/lib/util/rotate.d.ts.map +1 -0
  352. package/lib/util/round10.d.ts +2 -0
  353. package/lib/util/round10.d.ts.map +1 -0
  354. package/lib/util/toPiecewiseBezier.d.ts +18 -0
  355. package/lib/util/toPiecewiseBezier.d.ts.map +1 -0
  356. package/lib/util/transformBoundingBoxAndElement.d.ts +9 -0
  357. package/lib/util/transformBoundingBoxAndElement.d.ts.map +1 -0
  358. package/package.json +5 -19
  359. package/src/Helper.ts +6 -1
  360. package/src/entityToPolyline.ts +124 -2
  361. package/src/handlers/entities.ts +21 -1
  362. package/src/handlers/entity/mleader.ts +46 -0
  363. package/src/handlers/entity/mline.ts +74 -0
  364. package/src/handlers/entity/oleframe.ts +62 -0
  365. package/src/handlers/entity/ray.ts +52 -0
  366. package/src/handlers/entity/region.ts +42 -0
  367. package/src/handlers/entity/shape.ts +73 -0
  368. package/src/handlers/entity/table.ts +49 -0
  369. package/src/handlers/entity/trace.ts +72 -0
  370. package/src/handlers/entity/wipeout.ts +114 -0
  371. package/src/handlers/entity/xline.ts +52 -0
  372. package/src/handlers/objects.ts +64 -8
  373. package/src/handlers/tables.ts +134 -21
  374. package/src/index.ts +9 -18
  375. package/src/toJson.ts +8 -0
  376. package/src/toSVG.ts +45 -3
  377. package/src/types/entity.ts +20 -0
  378. package/src/types/helper.ts +2 -1
  379. package/src/types/index.ts +10 -0
  380. package/src/types/mleader-entity.ts +8 -0
  381. package/src/types/mline-entity.ts +12 -0
  382. package/src/types/oleframe-entity.ts +40 -0
  383. package/src/types/options.ts +7 -0
  384. package/src/types/ray-entity.ts +12 -0
  385. package/src/types/region-entity.ts +11 -0
  386. package/src/types/shape-entity.ts +19 -0
  387. package/src/types/table-entity.ts +14 -0
  388. package/src/types/tables.ts +76 -0
  389. package/src/types/trace-entity.ts +14 -0
  390. package/src/types/wipeout-entity.ts +20 -0
  391. package/src/types/xline-entity.ts +12 -0
  392. package/docs/DIMENSION_SUMMARY.md +0 -254
  393. package/docs/DXF_VERSION_SUPPORT.md +0 -45
  394. package/docs/ENTITY_SVG_ROADMAP.md +0 -96
  395. package/docs/IMPLEMENTED-2D-ENTITIES.md +0 -54
  396. package/docs/README.md +0 -22
  397. package/docs/SVG_RENDERING_INTEGRATION_TESTS.md +0 -119
  398. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +0 -241
package/.eslintrc.json CHANGED
@@ -5,9 +5,7 @@
5
5
  "node": true
6
6
  },
7
7
  "extends": [
8
- "plugin:react/recommended",
9
8
  "standard",
10
- "standard-react",
11
9
  "prettier"
12
10
  ],
13
11
  "globals": {
@@ -21,25 +19,12 @@
21
19
  "afterEach": "readonly"
22
20
  },
23
21
  "parserOptions": {
24
- "babelOptions": {
25
- "presets": ["@babel/preset-react"]
26
- },
27
- "ecmaFeatures": {
28
- "jsx": true
29
- },
30
- "ecmaVersion": 2018,
22
+ "ecmaVersion": 2020,
31
23
  "sourceType": "module"
32
24
  },
33
- "plugins": ["react"],
34
- "parser": "@babel/eslint-parser",
35
25
  "rules": {
36
26
  "no-lone-blocks": "off"
37
27
  },
38
- "settings": {
39
- "react": {
40
- "version": "detect"
41
- }
42
- },
43
28
  "overrides": [
44
29
  {
45
30
  "files": ["*.ts", "*.tsx"],
Binary file
@@ -0,0 +1,163 @@
1
+ # Architecture
2
+
3
+ This document describes the high-level architecture of DXF-Renewed, including the parsing pipeline, denormalisation (INSERT expansion), and rendering outputs.
4
+
5
+ ## Goals
6
+
7
+ - Parse DXF text into a typed model deterministically.
8
+ - Expand INSERT/BLOCK references into a flattened entity list with transforms.
9
+ - Provide multiple output formats:
10
+ - SVG string (`toSVG`)
11
+ - numeric polylines (`toPolylines`)
12
+ - JSON string (`toJson`)
13
+ - Prefer "parse what we can, warn for what we can’t" over throwing, when feasible.
14
+
15
+ ## Project Layout
16
+
17
+ - `src/` — TypeScript source
18
+ - `src/index.ts` — public API exports
19
+ - `src/Helper.ts` — convenience wrapper around parsing + denormalisation + outputs
20
+ - `src/parseString.ts` — main DXF text parser (routes sections)
21
+ - `src/handlers/` — section handlers and entity handlers
22
+ - `src/types/` — public type definitions
23
+ - `src/denormalise.ts` — INSERT expansion + transform stacking
24
+ - `src/toSVG.ts` — SVG renderer
25
+ - `src/toPolylines.ts` + `src/entityToPolyline.ts` — polyline renderer
26
+ - `src/toJson.ts` — JSON serializer for the parsed model
27
+ - `src/util/` — shared helpers (logger, XML escaping, etc.)
28
+ - `test/` — tests and fixtures
29
+ - `test/unit/` — unit tests (Mocha + TSX)
30
+ - `test/integration-browser/` — Playwright browser rendering tests
31
+ - `test/resources/` — DXF fixtures
32
+ - `docs/` — documentation and references
33
+ - `lib/` and `dist/` — build outputs
34
+
35
+ ## Data Flow (End-to-End)
36
+
37
+ Typical usage:
38
+
39
+ 1. `parseString(dxfText)` produces a `ParsedDXF` object.
40
+ 2. `denormalise(parsed)` expands block inserts and returns a flattened `Entity[]`.
41
+ 3. Render or export:
42
+ - `toSVG(parsed)` renders the denormalised entities into an SVG string.
43
+ - `toPolylines(parsed)` converts supported entities into numeric polyline arrays.
44
+ - `toJson(parsed)` serializes the `ParsedDXF` model into a JSON string.
45
+
46
+ The `Helper` class wraps this pipeline:
47
+
48
+ - Constructs from DXF text
49
+ - Exposes `parsed` and `denormalised`
50
+ - Exposes `toSVG()`, `toPolylines()`, and `toJson()`
51
+
52
+ ### Pipeline Diagram
53
+
54
+ ```mermaid
55
+ flowchart LR
56
+ A[DXF text] --> B[parseString]
57
+ B --> C[ParsedDXF]
58
+
59
+ subgraph SectionHandlers[Section handlers]
60
+ H[HEADER]
61
+ T[TABLES]
62
+ BL[BLOCKS]
63
+ E[ENTITIES]
64
+ O[OBJECTS]
65
+ end
66
+
67
+ B -. routes sections .-> SectionHandlers
68
+ SectionHandlers -. populate .-> C
69
+
70
+ C --> D[denormalise]
71
+ D --> E2["Entity[] (flattened + transforms)"]
72
+
73
+ E2 --> S[toSVG]
74
+ E2 --> P[toPolylines]
75
+ C --> J[toJson]
76
+
77
+ S --> S2[SVG string]
78
+ P --> P2[Polyline arrays]
79
+ J --> J2[JSON string]
80
+
81
+ A --> HLP[Helper]
82
+ HLP --> C
83
+ HLP --> E2
84
+ HLP --> S2
85
+ HLP --> P2
86
+ HLP --> J2
87
+ ```
88
+
89
+ ## Parsing
90
+
91
+ ### Tuple Stream
92
+
93
+ The parser converts the DXF text into a tuple stream of `[groupCode, value]` and routes it by section.
94
+
95
+ ### Section Routing
96
+
97
+ `src/parseString.ts` is responsible for splitting tuples into sections and delegating to section handlers:
98
+
99
+ - `src/handlers/header.ts`
100
+ - `src/handlers/tables.ts`
101
+ - `src/handlers/blocks.ts`
102
+ - `src/handlers/entities.ts`
103
+ - `src/handlers/objects.ts`
104
+
105
+ ### Entity Handlers
106
+
107
+ Entity handlers live in `src/handlers/entity/*.ts` and follow a consistent pattern:
108
+
109
+ - Export `TYPE` (DXF entity type string).
110
+ - Export a `process(tuples)` function that reduces group codes into a typed entity.
111
+ - Delegate common fields (layer, color, handle, etc.) to shared parsing helpers.
112
+
113
+ Multi-entity sequences (e.g. `POLYLINE` → `VERTEX`… → `SEQEND`) are handled by sequencing logic in `src/handlers/entities.ts`.
114
+
115
+ ## Denormalisation (INSERT Expansion)
116
+
117
+ `src/denormalise.ts` expands `INSERT` entities into the referenced BLOCK contents.
118
+
119
+ Responsibilities:
120
+
121
+ - Resolve INSERT → BLOCK.
122
+ - Apply transform stacks to expanded entities.
123
+ - Expand rectangular arrays when present.
124
+
125
+ The output is a flat list of entities with an optional `transforms` stack used by renderers.
126
+
127
+ ## Rendering
128
+
129
+ ### SVG (`toSVG`)
130
+
131
+ `src/toSVG.ts` renders the denormalised entities.
132
+
133
+ - Uses native SVG primitives when feasible (`<circle>`, `<ellipse>`, path arcs).
134
+ - Uses polyline approximations for entities that do not have a native SVG primitive or where approximation is acceptable.
135
+ - Unsupported entity types are skipped with a warning.
136
+
137
+ ### Polylines (`toPolylines`)
138
+
139
+ `src/entityToPolyline.ts` is the main conversion point for entities → polylines.
140
+
141
+ - Designed to be pure: same input entity should result in the same polyline output.
142
+ - Options (e.g., interpolation density) should be expressed via `ToPolylinesOptions`.
143
+
144
+ ### JSON (`toJson`)
145
+
146
+ `src/toJson.ts` provides a stable way to serialize the parsed model.
147
+
148
+ - Intended to represent the parsed model 1-to-1.
149
+ - Supports pretty-printing via options.
150
+
151
+ ## Logging & Error Handling
152
+
153
+ - Logging goes through `src/util/logger.ts`.
154
+ - Prefer warnings over exceptions for unsupported features.
155
+ - Parsing should remain resilient: bad/unknown codes should not crash the entire parse when possible.
156
+
157
+ ## Build & Test
158
+
159
+ - Build: TypeScript + esbuild bundling.
160
+ - Unit tests: Mocha executed with `tsx`.
161
+ - Browser integration tests: Playwright (renders fixtures and captures screenshots under `test/rendered/`).
162
+ - Functional manual viewer: Vite dev server under `test/functional/`.
163
+
package/CHANGELOG.md CHANGED
@@ -5,6 +5,40 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
+ ## <small>7.2.3 (2026-01-01)</small>
9
+
10
+ * Revert "ci: publish to GitHub Packages npm registry" ([647277b](https://github.com/linkiez/DXF-Renewed/commit/647277b))
11
+ * Revert "docs: add GitHub Packages install instructions" ([86392ec](https://github.com/linkiez/DXF-Renewed/commit/86392ec))
12
+
13
+ ## <small>7.2.2 (2026-01-01)</small>
14
+
15
+ * Merge pull request #4 from linkiez/fix/emit-types ([acb6440](https://github.com/linkiez/DXF-Renewed/commit/acb6440)), closes [#4](https://github.com/linkiez/DXF-Renewed/issues/4)
16
+ * Update build.mjs ([6b0970c](https://github.com/linkiez/DXF-Renewed/commit/6b0970c))
17
+ * fix(build): avoid import.meta in CJS output ([e5a351f](https://github.com/linkiez/DXF-Renewed/commit/e5a351f))
18
+ * fix(build): emit TypeScript declarations ([1e6af01](https://github.com/linkiez/DXF-Renewed/commit/1e6af01))
19
+
20
+ ## <small>7.2.1 (2026-01-01)</small>
21
+
22
+ * Merge pull request #3 from linkiez/feature/2026.01.01 ([2c51f7d](https://github.com/linkiez/DXF-Renewed/commit/2c51f7d)), closes [#3](https://github.com/linkiez/DXF-Renewed/issues/3)
23
+ * docs: add GitHub Packages install instructions ([5b4671e](https://github.com/linkiez/DXF-Renewed/commit/5b4671e))
24
+ * ci: publish to GitHub Packages npm registry ([a37adda](https://github.com/linkiez/DXF-Renewed/commit/a37adda))
25
+
26
+ ## 7.2.0 (2026-01-01)
27
+
28
+ * Merge pull request #2 from linkiez/feature/2026.01.01 ([c01512f](https://github.com/linkiez/DXF-Renewed/commit/c01512f)), closes [#2](https://github.com/linkiez/DXF-Renewed/issues/2)
29
+ * docs: add architecture diagram ([7f61ef2](https://github.com/linkiez/DXF-Renewed/commit/7f61ef2))
30
+ * docs: clarify supported entities ([8cd47dc](https://github.com/linkiez/DXF-Renewed/commit/8cd47dc))
31
+ * docs: consolidate documentation into PLAN.md ([204abf9](https://github.com/linkiez/DXF-Renewed/commit/204abf9))
32
+ * docs: fix mermaid diagram parsing ([0cedf8d](https://github.com/linkiez/DXF-Renewed/commit/0cedf8d))
33
+ * docs: improve README structure ([3c6659d](https://github.com/linkiez/DXF-Renewed/commit/3c6659d))
34
+ * docs: rename plan to roadmap ([23b060e](https://github.com/linkiez/DXF-Renewed/commit/23b060e))
35
+ * docs: update README progress ([64566b7](https://github.com/linkiez/DXF-Renewed/commit/64566b7))
36
+ * feat: add toJson processor ([94e112c](https://github.com/linkiez/DXF-Renewed/commit/94e112c))
37
+ * feat(entities): add handlers for additional 2D entities ([221ef8b](https://github.com/linkiez/DXF-Renewed/commit/221ef8b))
38
+ * feat(parser): add FIELD/DIMASSOC objects and extra table types ([ef89ed7](https://github.com/linkiez/DXF-Renewed/commit/ef89ed7))
39
+ * feat(render): support LEADER/RAY/XLINE/TRACE/SHAPE/WIPEOUT ([05a7c82](https://github.com/linkiez/DXF-Renewed/commit/05a7c82))
40
+ * chore(tooling): remove babel/react/webpack and migrate functional tests to vite ([dd92031](https://github.com/linkiez/DXF-Renewed/commit/dd92031))
41
+
8
42
  ## 7.1.0 (2026-01-01)
9
43
 
10
44
  * Merge pull request #1 from linkiez/feat/seqend-sequencing ([068c6e1](https://github.com/linkiez/DXF-Renewed/commit/068c6e1)), closes [#1](https://github.com/linkiez/DXF-Renewed/issues/1)
package/README.md CHANGED
@@ -11,6 +11,39 @@ Written in **TypeScript** with full type definitions included. Uses modern ES201
11
11
 
12
12
  > **Note:** This is a renewed and modernized fork of the original [dxf](https://github.com/skymakerolof/dxf) library, with complete TypeScript migration, enhanced performance, and additional features.
13
13
 
14
+ ## TL;DR
15
+
16
+ - Parse: `parseString(dxfText)` → typed `ParsedDXF`
17
+ - Expand blocks: `denormalise(parsed)` → flat `Entity[]` with transforms
18
+ - Render/export:
19
+ - `toSVG(parsed)` → SVG string
20
+ - `toPolylines(parsed)` → numeric polyline arrays
21
+ - `toJson(parsed)` → JSON string
22
+
23
+ ## Features
24
+
25
+ - TypeScript-first public API (strict typing)
26
+ - Deterministic parsing + regression coverage via real DXF fixtures
27
+ - INSERT/BLOCK expansion (denormalisation) with transform stacking
28
+ - SVG rendering for common 2D geometry + annotation entities
29
+ - Polyline output for custom renderers (Canvas/WebGL/etc.)
30
+ - Framework-agnostic (no React/Webpack required)
31
+
32
+ ## Documentation
33
+
34
+ - Project roadmap and progress: [ROADMAP.md](./ROADMAP.md)
35
+ - Architecture overview: [ARCHITECTURE.md](./ARCHITECTURE.md)
36
+
37
+ ## Table of Contents
38
+
39
+ - [Version History](#version-history)
40
+ - [Supported Entities](#supported-entities)
41
+ - [Getting started](#getting-started)
42
+ - [API](#api)
43
+ - [Running the Examples](#running-the-examples)
44
+ - [Tests](#tests)
45
+ - [Build System](#build-system)
46
+
14
47
  ## Version History
15
48
 
16
49
  **Version 2.0** - Complete rewrite from SAX-style parsing to handle nested references properly (inserts, blocks, etc.)
@@ -30,9 +63,9 @@ Written in **TypeScript** with full type definitions included. Uses modern ES201
30
63
 
31
64
  ## Supported Entities
32
65
 
33
- All major geometric entities are **parsed and rendered to SVG**:
66
+ Many common DXF entities are **parsed and rendered to SVG**. Some entities are parsed but currently skipped during SVG rendering.
34
67
 
35
- ### Fully Supported
68
+ ### Rendered to SVG
36
69
 
37
70
  - ✅ **LINE** - Straight line segments
38
71
  - ✅ **CIRCLE** - Native SVG `<circle />` element
@@ -44,16 +77,23 @@ All major geometric entities are **parsed and rendered to SVG**:
44
77
  - ✅ **TEXT** - Single-line text with rotation
45
78
  - ✅ **MTEXT** - Multi-line text with formatting
46
79
  - ✅ **DIMENSION** - Linear, aligned, radial, diameter, and ordinate dimensions
47
- - ✅ **INSERT** - Block references with transformations
48
- - ✅ **POINT** - Point entities
49
80
  - ✅ **SOLID** - Solid-filled triangles and quadrilaterals
50
- - ✅ **3DFACE** - 3D face entities
81
+ - ✅ **TRACE** - Rendered as a filled path outline
82
+ - ✅ **RAY/XLINE** - Rendered as polylines
83
+ - ✅ **WIPEOUT** - Rendered as outline fallback
84
+ - ✅ **LEADER** - Rendered as an SVG path (basic)
85
+ - ✅ **TOLERANCE** - Rendered with SVG text fallback
86
+ - ✅ **SHAPE** - Rendered with SVG text fallback
87
+
88
+ > **INSERT note:** INSERT is supported via denormalisation. The library expands INSERT entities into their referenced BLOCK contents and then renders the resulting entities with transforms applied.
51
89
 
52
90
  ### Parsed (Not Rendered)
53
91
 
54
- - ⚠️ **HATCH** - Parsed but not rendered to SVG
55
- - ⚠️ **STYLE** - Text styles parsed (colors supported, fonts not applied)
92
+ - ⚠️ **POINT** - Parsed but currently not rendered to SVG
93
+ - ⚠️ **3DFACE** - Parsed but currently not rendered to SVG
94
+ - ⚠️ **HATCH** - Parsed but currently not rendered to SVG
56
95
  - ⚠️ **ATTDEF/ATTRIB** - Block attributes parsed
96
+ - ⚠️ **Text styles (STYLE table)** - Parsed (colors supported; fonts are not applied to SVG)
57
97
 
58
98
  ## Getting started
59
99
 
@@ -75,6 +115,9 @@ console.log('svg:', helper.toSVG())
75
115
 
76
116
  // Create polylines (e.g. to render in WebGL)
77
117
  console.log('polylines:', helper.toPolylines())
118
+
119
+ // Create a JSON representation (1-to-1 with the parsed model)
120
+ console.log('json:', helper.toJson({ pretty: true }))
78
121
  ```
79
122
 
80
123
  JavaScript example:
@@ -95,8 +138,28 @@ console.log('svg:', helper.toSVG())
95
138
 
96
139
  // Create polylines (e.g. to render in WebGL)
97
140
  console.log('polylines:', helper.toPolylines())
141
+
142
+ // Create a JSON representation (1-to-1 with the parsed model)
143
+ console.log('json:', helper.toJson({ pretty: true }))
98
144
  ```
99
145
 
146
+ ## API
147
+
148
+ The public API is exported from `src/index.ts`.
149
+
150
+ - `parseString(dxfText: string): ParsedDXF`
151
+ - Parse DXF text into a typed model.
152
+ - `denormalise(parsed: ParsedDXF): Entity[]`
153
+ - Expand `INSERT` entities into their referenced `BLOCK` contents.
154
+ - `toSVG(parsed: ParsedDXF, options?): string`
155
+ - Render the drawing to an SVG string.
156
+ - `toPolylines(parsed: ParsedDXF, options?): any[]`
157
+ - Convert supported entities to polyline arrays.
158
+ - `toJson(parsed: ParsedDXF, options?): string`
159
+ - Serialize the parsed model as JSON.
160
+ - `Helper`
161
+ - Convenience wrapper that exposes `parsed`, `denormalised`, plus `toSVG()`, `toPolylines()`, and `toJson()`.
162
+
100
163
  ## Running the Examples
101
164
 
102
165
  There are examples in the `examples/` directory.
@@ -231,11 +294,11 @@ Running the functional tests in a browser:
231
294
  yarn test:functional
232
295
  ```
233
296
 
234
- Please open `toSVG.html` when the file listing loads in the browser (or open `http://localhost:8030/toSVG.html#/`).
297
+ This starts a Vite dev server and opens `http://localhost:8030/toSVG.html`.
235
298
 
236
299
  ## Development Guidelines
237
300
 
238
- Project documentation index: `docs/README.md`
301
+ Project documentation index: `ROADMAP.md` (see “Documentation (Consolidated)”).
239
302
 
240
303
  ## TypeScript Support
241
304
 
@@ -288,7 +351,6 @@ This project uses [semantic-release](https://semantic-release.gitbook.io/) for a
288
351
 
289
352
  - `main` - Stable production releases (`1.0.0`, `1.1.0`, `2.0.0`)
290
353
 
291
-
292
354
  ### Commit Format
293
355
 
294
356
  ```bash