@linkiez/dxf-renew 5.3.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 (447) hide show
  1. package/.eslintignore +17 -0
  2. package/.eslintrc.json +61 -0
  3. package/.gitattributes +4 -0
  4. package/.github/instructions/project-en_US.instructions.md +352 -0
  5. package/.github/workflows/release.yml +110 -0
  6. package/.husky/commit-msg +4 -0
  7. package/.husky/pre-commit +1 -0
  8. package/.prettierignore +1 -0
  9. package/.prettierrc.json +6 -0
  10. package/.releaserc.json +76 -0
  11. package/.travis.yml +6 -0
  12. package/.yarn/install-state.gz +0 -0
  13. package/.yarnrc.yml +1 -0
  14. package/CHANGELOG.md +134 -0
  15. package/CONTRIBUTING.md +271 -0
  16. package/LICENSE +21 -0
  17. package/PLAN.md +517 -0
  18. package/README.md +306 -0
  19. package/build.mjs +66 -0
  20. package/commitlint.config.js +25 -0
  21. package/dist/dxf.js +7234 -0
  22. package/docs/CODE_PATTERNS.md +182 -0
  23. package/docs/DIMENSION_SUMMARY.md +248 -0
  24. package/docs/DIMENSION_SUMMARY.pt-BR.md +248 -0
  25. package/docs/IMPLEMENTED-2D-ENTITIES.md +54 -0
  26. package/docs/IMPLEMENTED-2D-ENTITIES.pt-BR.md +54 -0
  27. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +241 -0
  28. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.pt-BR.md +169 -0
  29. package/docs/autocad_2012_pdf_dxf-reference_enu.md +8272 -0
  30. package/examples/dxf.html +36 -0
  31. package/examples/example.es5.js +30 -0
  32. package/examples/example.es6.js +30 -0
  33. package/examples/text-dimension-viewer.html +133 -0
  34. package/lib/Helper.cjs +89 -0
  35. package/lib/Helper.cjs.map +7 -0
  36. package/lib/Helper.js +59 -0
  37. package/lib/Helper.js.map +7 -0
  38. package/lib/applyTransforms.cjs +59 -0
  39. package/lib/applyTransforms.cjs.map +7 -0
  40. package/lib/applyTransforms.js +39 -0
  41. package/lib/applyTransforms.js.map +7 -0
  42. package/lib/cli.cjs +53 -0
  43. package/lib/cli.cjs.map +7 -0
  44. package/lib/cli.js +29 -0
  45. package/lib/cli.js.map +7 -0
  46. package/lib/config.cjs +30 -0
  47. package/lib/config.cjs.map +7 -0
  48. package/lib/config.js +10 -0
  49. package/lib/config.js.map +7 -0
  50. package/lib/constants.cjs +39 -0
  51. package/lib/constants.cjs.map +7 -0
  52. package/lib/constants.js +15 -0
  53. package/lib/constants.js.map +7 -0
  54. package/lib/denormalise.cjs +148 -0
  55. package/lib/denormalise.cjs.map +7 -0
  56. package/lib/denormalise.js +118 -0
  57. package/lib/denormalise.js.map +7 -0
  58. package/lib/dimensionToSVG.cjs +307 -0
  59. package/lib/dimensionToSVG.cjs.map +7 -0
  60. package/lib/dimensionToSVG.js +273 -0
  61. package/lib/dimensionToSVG.js.map +7 -0
  62. package/lib/entityToPolyline.cjs +248 -0
  63. package/lib/entityToPolyline.cjs.map +7 -0
  64. package/lib/entityToPolyline.js +213 -0
  65. package/lib/entityToPolyline.js.map +7 -0
  66. package/lib/getRGBForEntity.cjs +53 -0
  67. package/lib/getRGBForEntity.cjs.map +7 -0
  68. package/lib/getRGBForEntity.js +23 -0
  69. package/lib/getRGBForEntity.js.map +7 -0
  70. package/lib/groupEntitiesByLayer.cjs +34 -0
  71. package/lib/groupEntitiesByLayer.cjs.map +7 -0
  72. package/lib/groupEntitiesByLayer.js +14 -0
  73. package/lib/groupEntitiesByLayer.js.map +7 -0
  74. package/lib/handlers/blocks.cjs +93 -0
  75. package/lib/handlers/blocks.cjs.map +7 -0
  76. package/lib/handlers/blocks.js +63 -0
  77. package/lib/handlers/blocks.js.map +7 -0
  78. package/lib/handlers/entities.cjs +118 -0
  79. package/lib/handlers/entities.cjs.map +7 -0
  80. package/lib/handlers/entities.js +88 -0
  81. package/lib/handlers/entities.js.map +7 -0
  82. package/lib/handlers/entity/arc.cjs +82 -0
  83. package/lib/handlers/entity/arc.cjs.map +7 -0
  84. package/lib/handlers/entity/arc.js +47 -0
  85. package/lib/handlers/entity/arc.js.map +7 -0
  86. package/lib/handlers/entity/attdef.cjs +318 -0
  87. package/lib/handlers/entity/attdef.cjs.map +7 -0
  88. package/lib/handlers/entity/attdef.js +282 -0
  89. package/lib/handlers/entity/attdef.js.map +7 -0
  90. package/lib/handlers/entity/attrib.cjs +52 -0
  91. package/lib/handlers/entity/attrib.cjs.map +7 -0
  92. package/lib/handlers/entity/attrib.js +27 -0
  93. package/lib/handlers/entity/attrib.js.map +7 -0
  94. package/lib/handlers/entity/circle.cjs +73 -0
  95. package/lib/handlers/entity/circle.cjs.map +7 -0
  96. package/lib/handlers/entity/circle.js +38 -0
  97. package/lib/handlers/entity/circle.js.map +7 -0
  98. package/lib/handlers/entity/common.cjs +83 -0
  99. package/lib/handlers/entity/common.cjs.map +7 -0
  100. package/lib/handlers/entity/common.js +63 -0
  101. package/lib/handlers/entity/common.js.map +7 -0
  102. package/lib/handlers/entity/dimension.cjs +203 -0
  103. package/lib/handlers/entity/dimension.cjs.map +7 -0
  104. package/lib/handlers/entity/dimension.js +168 -0
  105. package/lib/handlers/entity/dimension.js.map +7 -0
  106. package/lib/handlers/entity/ellipse.cjs +88 -0
  107. package/lib/handlers/entity/ellipse.cjs.map +7 -0
  108. package/lib/handlers/entity/ellipse.js +53 -0
  109. package/lib/handlers/entity/ellipse.js.map +7 -0
  110. package/lib/handlers/entity/hatch.cjs +470 -0
  111. package/lib/handlers/entity/hatch.cjs.map +7 -0
  112. package/lib/handlers/entity/hatch.js +435 -0
  113. package/lib/handlers/entity/hatch.js.map +7 -0
  114. package/lib/handlers/entity/insert.cjs +106 -0
  115. package/lib/handlers/entity/insert.cjs.map +7 -0
  116. package/lib/handlers/entity/insert.js +71 -0
  117. package/lib/handlers/entity/insert.js.map +7 -0
  118. package/lib/handlers/entity/line.cjs +84 -0
  119. package/lib/handlers/entity/line.cjs.map +7 -0
  120. package/lib/handlers/entity/line.js +49 -0
  121. package/lib/handlers/entity/line.js.map +7 -0
  122. package/lib/handlers/entity/lwpolyline.cjs +82 -0
  123. package/lib/handlers/entity/lwpolyline.cjs.map +7 -0
  124. package/lib/handlers/entity/lwpolyline.js +47 -0
  125. package/lib/handlers/entity/lwpolyline.js.map +7 -0
  126. package/lib/handlers/entity/mtext.cjs +121 -0
  127. package/lib/handlers/entity/mtext.cjs.map +7 -0
  128. package/lib/handlers/entity/mtext.js +85 -0
  129. package/lib/handlers/entity/mtext.js.map +7 -0
  130. package/lib/handlers/entity/ole2Frame.cjs +98 -0
  131. package/lib/handlers/entity/ole2Frame.cjs.map +7 -0
  132. package/lib/handlers/entity/ole2Frame.js +63 -0
  133. package/lib/handlers/entity/ole2Frame.js.map +7 -0
  134. package/lib/handlers/entity/point.cjs +73 -0
  135. package/lib/handlers/entity/point.cjs.map +7 -0
  136. package/lib/handlers/entity/point.js +38 -0
  137. package/lib/handlers/entity/point.js.map +7 -0
  138. package/lib/handlers/entity/polyline.cjs +70 -0
  139. package/lib/handlers/entity/polyline.cjs.map +7 -0
  140. package/lib/handlers/entity/polyline.js +35 -0
  141. package/lib/handlers/entity/polyline.js.map +7 -0
  142. package/lib/handlers/entity/solid.cjs +101 -0
  143. package/lib/handlers/entity/solid.cjs.map +7 -0
  144. package/lib/handlers/entity/solid.js +66 -0
  145. package/lib/handlers/entity/solid.js.map +7 -0
  146. package/lib/handlers/entity/spline.cjs +109 -0
  147. package/lib/handlers/entity/spline.cjs.map +7 -0
  148. package/lib/handlers/entity/spline.js +74 -0
  149. package/lib/handlers/entity/spline.js.map +7 -0
  150. package/lib/handlers/entity/text.cjs +85 -0
  151. package/lib/handlers/entity/text.cjs.map +7 -0
  152. package/lib/handlers/entity/text.js +49 -0
  153. package/lib/handlers/entity/text.js.map +7 -0
  154. package/lib/handlers/entity/threeDFace.cjs +98 -0
  155. package/lib/handlers/entity/threeDFace.cjs.map +7 -0
  156. package/lib/handlers/entity/threeDFace.js +63 -0
  157. package/lib/handlers/entity/threeDFace.js.map +7 -0
  158. package/lib/handlers/entity/vertex.cjs +78 -0
  159. package/lib/handlers/entity/vertex.cjs.map +7 -0
  160. package/lib/handlers/entity/vertex.js +53 -0
  161. package/lib/handlers/entity/vertex.js.map +7 -0
  162. package/lib/handlers/entity/viewport.cjs +153 -0
  163. package/lib/handlers/entity/viewport.cjs.map +7 -0
  164. package/lib/handlers/entity/viewport.js +118 -0
  165. package/lib/handlers/entity/viewport.js.map +7 -0
  166. package/lib/handlers/header.cjs +92 -0
  167. package/lib/handlers/header.cjs.map +7 -0
  168. package/lib/handlers/header.js +72 -0
  169. package/lib/handlers/header.js.map +7 -0
  170. package/lib/handlers/objects.cjs +170 -0
  171. package/lib/handlers/objects.cjs.map +7 -0
  172. package/lib/handlers/objects.js +150 -0
  173. package/lib/handlers/objects.js.map +7 -0
  174. package/lib/handlers/tables.cjs +587 -0
  175. package/lib/handlers/tables.cjs.map +7 -0
  176. package/lib/handlers/tables.js +557 -0
  177. package/lib/handlers/tables.js.map +7 -0
  178. package/lib/index.cjs +60 -0
  179. package/lib/index.cjs.map +7 -0
  180. package/lib/index.js +19 -0
  181. package/lib/index.js.map +7 -0
  182. package/lib/parseString.cjs +118 -0
  183. package/lib/parseString.cjs.map +7 -0
  184. package/lib/parseString.js +88 -0
  185. package/lib/parseString.js.map +7 -0
  186. package/lib/toPolylines.cjs +69 -0
  187. package/lib/toPolylines.cjs.map +7 -0
  188. package/lib/toPolylines.js +39 -0
  189. package/lib/toPolylines.js.map +7 -0
  190. package/lib/toSVG.cjs +395 -0
  191. package/lib/toSVG.cjs.map +7 -0
  192. package/lib/toSVG.js +361 -0
  193. package/lib/toSVG.js.map +7 -0
  194. package/lib/types/arc-entity.cjs +17 -0
  195. package/lib/types/arc-entity.cjs.map +7 -0
  196. package/lib/types/arc-entity.js +1 -0
  197. package/lib/types/arc-entity.js.map +7 -0
  198. package/lib/types/base-entity.cjs +17 -0
  199. package/lib/types/base-entity.cjs.map +7 -0
  200. package/lib/types/base-entity.js +1 -0
  201. package/lib/types/base-entity.js.map +7 -0
  202. package/lib/types/circle-entity.cjs +17 -0
  203. package/lib/types/circle-entity.cjs.map +7 -0
  204. package/lib/types/circle-entity.js +1 -0
  205. package/lib/types/circle-entity.js.map +7 -0
  206. package/lib/types/common.cjs +17 -0
  207. package/lib/types/common.cjs.map +7 -0
  208. package/lib/types/common.js +1 -0
  209. package/lib/types/common.js.map +7 -0
  210. package/lib/types/dimension-entity.cjs +17 -0
  211. package/lib/types/dimension-entity.cjs.map +7 -0
  212. package/lib/types/dimension-entity.js +1 -0
  213. package/lib/types/dimension-entity.js.map +7 -0
  214. package/lib/types/dxf.cjs +17 -0
  215. package/lib/types/dxf.cjs.map +7 -0
  216. package/lib/types/dxf.js +1 -0
  217. package/lib/types/dxf.js.map +7 -0
  218. package/lib/types/ellipse-entity.cjs +17 -0
  219. package/lib/types/ellipse-entity.cjs.map +7 -0
  220. package/lib/types/ellipse-entity.js +1 -0
  221. package/lib/types/ellipse-entity.js.map +7 -0
  222. package/lib/types/entity.cjs +17 -0
  223. package/lib/types/entity.cjs.map +7 -0
  224. package/lib/types/entity.js +1 -0
  225. package/lib/types/entity.js.map +7 -0
  226. package/lib/types/handler-internal.cjs +17 -0
  227. package/lib/types/handler-internal.cjs.map +7 -0
  228. package/lib/types/handler-internal.js +1 -0
  229. package/lib/types/handler-internal.js.map +7 -0
  230. package/lib/types/handler.cjs +17 -0
  231. package/lib/types/handler.cjs.map +7 -0
  232. package/lib/types/handler.js +1 -0
  233. package/lib/types/handler.js.map +7 -0
  234. package/lib/types/hatch-entity.cjs +17 -0
  235. package/lib/types/hatch-entity.cjs.map +7 -0
  236. package/lib/types/hatch-entity.js +1 -0
  237. package/lib/types/hatch-entity.js.map +7 -0
  238. package/lib/types/helper.cjs +17 -0
  239. package/lib/types/helper.cjs.map +7 -0
  240. package/lib/types/helper.js +1 -0
  241. package/lib/types/helper.js.map +7 -0
  242. package/lib/types/index.cjs +77 -0
  243. package/lib/types/index.cjs.map +7 -0
  244. package/lib/types/index.js +29 -0
  245. package/lib/types/index.js.map +7 -0
  246. package/lib/types/insert-entity.cjs +17 -0
  247. package/lib/types/insert-entity.cjs.map +7 -0
  248. package/lib/types/insert-entity.js +1 -0
  249. package/lib/types/insert-entity.js.map +7 -0
  250. package/lib/types/layer-groups.cjs +17 -0
  251. package/lib/types/layer-groups.cjs.map +7 -0
  252. package/lib/types/layer-groups.js +1 -0
  253. package/lib/types/layer-groups.js.map +7 -0
  254. package/lib/types/line-entity.cjs +17 -0
  255. package/lib/types/line-entity.cjs.map +7 -0
  256. package/lib/types/line-entity.js +1 -0
  257. package/lib/types/line-entity.js.map +7 -0
  258. package/lib/types/mtext-entity.cjs +17 -0
  259. package/lib/types/mtext-entity.cjs.map +7 -0
  260. package/lib/types/mtext-entity.js +1 -0
  261. package/lib/types/mtext-entity.js.map +7 -0
  262. package/lib/types/ole2frame-entity.cjs +17 -0
  263. package/lib/types/ole2frame-entity.cjs.map +7 -0
  264. package/lib/types/ole2frame-entity.js +1 -0
  265. package/lib/types/ole2frame-entity.js.map +7 -0
  266. package/lib/types/options.cjs +17 -0
  267. package/lib/types/options.cjs.map +7 -0
  268. package/lib/types/options.js +1 -0
  269. package/lib/types/options.js.map +7 -0
  270. package/lib/types/point-entity.cjs +17 -0
  271. package/lib/types/point-entity.cjs.map +7 -0
  272. package/lib/types/point-entity.js +1 -0
  273. package/lib/types/point-entity.js.map +7 -0
  274. package/lib/types/polyline-entity.cjs +17 -0
  275. package/lib/types/polyline-entity.cjs.map +7 -0
  276. package/lib/types/polyline-entity.js +1 -0
  277. package/lib/types/polyline-entity.js.map +7 -0
  278. package/lib/types/polylines.cjs +17 -0
  279. package/lib/types/polylines.cjs.map +7 -0
  280. package/lib/types/polylines.js +1 -0
  281. package/lib/types/polylines.js.map +7 -0
  282. package/lib/types/solid-entity.cjs +17 -0
  283. package/lib/types/solid-entity.cjs.map +7 -0
  284. package/lib/types/solid-entity.js +1 -0
  285. package/lib/types/solid-entity.js.map +7 -0
  286. package/lib/types/spline-entity.cjs +17 -0
  287. package/lib/types/spline-entity.cjs.map +7 -0
  288. package/lib/types/spline-entity.js +1 -0
  289. package/lib/types/spline-entity.js.map +7 -0
  290. package/lib/types/svg.cjs +17 -0
  291. package/lib/types/svg.cjs.map +7 -0
  292. package/lib/types/svg.js +1 -0
  293. package/lib/types/svg.js.map +7 -0
  294. package/lib/types/tables.cjs +17 -0
  295. package/lib/types/tables.cjs.map +7 -0
  296. package/lib/types/tables.js +1 -0
  297. package/lib/types/tables.js.map +7 -0
  298. package/lib/types/text-entity.cjs +17 -0
  299. package/lib/types/text-entity.cjs.map +7 -0
  300. package/lib/types/text-entity.js +1 -0
  301. package/lib/types/text-entity.js.map +7 -0
  302. package/lib/types/util-types.cjs +17 -0
  303. package/lib/types/util-types.cjs.map +7 -0
  304. package/lib/types/util-types.js +1 -0
  305. package/lib/types/util-types.js.map +7 -0
  306. package/lib/types/vecks.d.cjs +2 -0
  307. package/lib/types/vecks.d.cjs.map +7 -0
  308. package/lib/types/vecks.d.js +1 -0
  309. package/lib/types/vecks.d.js.map +7 -0
  310. package/lib/types/viewport-entity.cjs +17 -0
  311. package/lib/types/viewport-entity.cjs.map +7 -0
  312. package/lib/types/viewport-entity.js +1 -0
  313. package/lib/types/viewport-entity.js.map +7 -0
  314. package/lib/types.cjs +23 -0
  315. package/lib/types.cjs.map +7 -0
  316. package/lib/types.js +2 -0
  317. package/lib/types.js.map +7 -0
  318. package/lib/util/bSpline.cjs +95 -0
  319. package/lib/util/bSpline.cjs.map +7 -0
  320. package/lib/util/bSpline.js +65 -0
  321. package/lib/util/bSpline.js.map +7 -0
  322. package/lib/util/colors.cjs +283 -0
  323. package/lib/util/colors.cjs.map +7 -0
  324. package/lib/util/colors.js +263 -0
  325. package/lib/util/colors.js.map +7 -0
  326. package/lib/util/createArcForLWPolyline.cjs +84 -0
  327. package/lib/util/createArcForLWPolyline.cjs.map +7 -0
  328. package/lib/util/createArcForLWPolyline.js +64 -0
  329. package/lib/util/createArcForLWPolyline.js.map +7 -0
  330. package/lib/util/dxfColorToRGB.cjs +115 -0
  331. package/lib/util/dxfColorToRGB.cjs.map +7 -0
  332. package/lib/util/dxfColorToRGB.js +90 -0
  333. package/lib/util/dxfColorToRGB.js.map +7 -0
  334. package/lib/util/insertKnot.cjs +77 -0
  335. package/lib/util/insertKnot.cjs.map +7 -0
  336. package/lib/util/insertKnot.js +57 -0
  337. package/lib/util/insertKnot.js.map +7 -0
  338. package/lib/util/logger.cjs +53 -0
  339. package/lib/util/logger.cjs.map +7 -0
  340. package/lib/util/logger.js +23 -0
  341. package/lib/util/logger.js.map +7 -0
  342. package/lib/util/rgbToColorAttribute.cjs +32 -0
  343. package/lib/util/rgbToColorAttribute.cjs.map +7 -0
  344. package/lib/util/rgbToColorAttribute.js +12 -0
  345. package/lib/util/rgbToColorAttribute.js.map +7 -0
  346. package/lib/util/rotate.cjs +30 -0
  347. package/lib/util/rotate.cjs.map +7 -0
  348. package/lib/util/rotate.js +10 -0
  349. package/lib/util/rotate.js.map +7 -0
  350. package/lib/util/round10.cjs +38 -0
  351. package/lib/util/round10.cjs.map +7 -0
  352. package/lib/util/round10.js +18 -0
  353. package/lib/util/round10.js.map +7 -0
  354. package/lib/util/toPiecewiseBezier.cjs +90 -0
  355. package/lib/util/toPiecewiseBezier.cjs.map +7 -0
  356. package/lib/util/toPiecewiseBezier.js +54 -0
  357. package/lib/util/toPiecewiseBezier.js.map +7 -0
  358. package/lib/util/transformBoundingBoxAndElement.cjs +80 -0
  359. package/lib/util/transformBoundingBoxAndElement.cjs.map +7 -0
  360. package/lib/util/transformBoundingBoxAndElement.js +60 -0
  361. package/lib/util/transformBoundingBoxAndElement.js.map +7 -0
  362. package/package.json +127 -0
  363. package/src/Helper.ts +71 -0
  364. package/src/applyTransforms.ts +54 -0
  365. package/src/cli.ts +41 -0
  366. package/src/config.ts +10 -0
  367. package/src/constants.ts +14 -0
  368. package/src/denormalise.ts +153 -0
  369. package/src/dimensionToSVG.ts +427 -0
  370. package/src/entityToPolyline.ts +338 -0
  371. package/src/getRGBForEntity.ts +28 -0
  372. package/src/groupEntitiesByLayer.ts +14 -0
  373. package/src/handlers/blocks.ts +65 -0
  374. package/src/handlers/entities.ts +111 -0
  375. package/src/handlers/entity/arc.ts +61 -0
  376. package/src/handlers/entity/attdef.ts +284 -0
  377. package/src/handlers/entity/attrib.ts +29 -0
  378. package/src/handlers/entity/circle.ts +47 -0
  379. package/src/handlers/entity/common.ts +79 -0
  380. package/src/handlers/entity/dimension.ts +217 -0
  381. package/src/handlers/entity/ellipse.ts +55 -0
  382. package/src/handlers/entity/hatch.ts +471 -0
  383. package/src/handlers/entity/insert.ts +73 -0
  384. package/src/handlers/entity/line.ts +56 -0
  385. package/src/handlers/entity/lwpolyline.ts +54 -0
  386. package/src/handlers/entity/mtext.ts +150 -0
  387. package/src/handlers/entity/ole2Frame.ts +64 -0
  388. package/src/handlers/entity/point.ts +47 -0
  389. package/src/handlers/entity/polyline.ts +49 -0
  390. package/src/handlers/entity/solid.ts +73 -0
  391. package/src/handlers/entity/spline.ts +103 -0
  392. package/src/handlers/entity/text.ts +83 -0
  393. package/src/handlers/entity/threeDFace.ts +69 -0
  394. package/src/handlers/entity/vertex.ts +55 -0
  395. package/src/handlers/entity/viewport.ts +119 -0
  396. package/src/handlers/header.ts +73 -0
  397. package/src/handlers/objects.ts +152 -0
  398. package/src/handlers/tables.ts +581 -0
  399. package/src/index.ts +19 -0
  400. package/src/parseString.ts +97 -0
  401. package/src/toPolylines.ts +47 -0
  402. package/src/toSVG.ts +518 -0
  403. package/src/types/README.md +91 -0
  404. package/src/types/arc-entity.ts +10 -0
  405. package/src/types/base-entity.ts +25 -0
  406. package/src/types/circle-entity.ts +8 -0
  407. package/src/types/common.ts +37 -0
  408. package/src/types/dimension-entity.ts +23 -0
  409. package/src/types/dxf.ts +64 -0
  410. package/src/types/ellipse-entity.ts +13 -0
  411. package/src/types/entity.ts +32 -0
  412. package/src/types/handler-internal.ts +51 -0
  413. package/src/types/handler.ts +10 -0
  414. package/src/types/hatch-entity.ts +127 -0
  415. package/src/types/helper.ts +12 -0
  416. package/src/types/index.ts +53 -0
  417. package/src/types/insert-entity.ts +19 -0
  418. package/src/types/layer-groups.ts +8 -0
  419. package/src/types/line-entity.ts +10 -0
  420. package/src/types/mtext-entity.ts +35 -0
  421. package/src/types/ole2frame-entity.ts +35 -0
  422. package/src/types/options.ts +17 -0
  423. package/src/types/point-entity.ts +7 -0
  424. package/src/types/polyline-entity.ts +20 -0
  425. package/src/types/polylines.ts +22 -0
  426. package/src/types/solid-entity.ts +9 -0
  427. package/src/types/spline-entity.ts +12 -0
  428. package/src/types/svg.ts +31 -0
  429. package/src/types/tables.ts +414 -0
  430. package/src/types/text-entity.ts +23 -0
  431. package/src/types/util-types.ts +27 -0
  432. package/src/types/vecks.d.ts +29 -0
  433. package/src/types/viewport-entity.ts +81 -0
  434. package/src/types.ts +5 -0
  435. package/src/util/bSpline.ts +97 -0
  436. package/src/util/colors.ts +266 -0
  437. package/src/util/createArcForLWPolyline.ts +93 -0
  438. package/src/util/diagram.png +0 -0
  439. package/src/util/dxfColorToRGB.ts +106 -0
  440. package/src/util/insertKnot.ts +69 -0
  441. package/src/util/logger.ts +23 -0
  442. package/src/util/rgbToColorAttribute.ts +14 -0
  443. package/src/util/rotate.ts +14 -0
  444. package/src/util/round10.ts +24 -0
  445. package/src/util/toPiecewiseBezier.ts +70 -0
  446. package/src/util/transformBoundingBoxAndElement.ts +74 -0
  447. package/tsconfig.json +34 -0
package/.eslintignore ADDED
@@ -0,0 +1,17 @@
1
+ # Test files
2
+ test/**/*
3
+
4
+ # Build output
5
+ lib/**/*
6
+ dist/**/*
7
+
8
+ # Dependencies
9
+ node_modules/**/*
10
+
11
+ # Configuration files
12
+ *.config.js
13
+ *.config.cjs
14
+ build.mjs
15
+
16
+ # Examples
17
+ examples/**/*
package/.eslintrc.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es6": true,
5
+ "node": true
6
+ },
7
+ "extends": [
8
+ "plugin:react/recommended",
9
+ "standard",
10
+ "standard-react",
11
+ "prettier"
12
+ ],
13
+ "globals": {
14
+ "Atomics": "readonly",
15
+ "SharedArrayBuffer": "readonly",
16
+ "describe": "readonly",
17
+ "it": "readonly",
18
+ "before": "readonly",
19
+ "after": "readonly",
20
+ "beforeEach": "readonly",
21
+ "afterEach": "readonly"
22
+ },
23
+ "parserOptions": {
24
+ "babelOptions": {
25
+ "presets": ["@babel/preset-react"]
26
+ },
27
+ "ecmaFeatures": {
28
+ "jsx": true
29
+ },
30
+ "ecmaVersion": 2018,
31
+ "sourceType": "module"
32
+ },
33
+ "plugins": ["react"],
34
+ "parser": "@babel/eslint-parser",
35
+ "rules": {
36
+ "no-lone-blocks": "off"
37
+ },
38
+ "settings": {
39
+ "react": {
40
+ "version": "detect"
41
+ }
42
+ },
43
+ "overrides": [
44
+ {
45
+ "files": ["*.ts", "*.tsx"],
46
+ "parser": "@typescript-eslint/parser",
47
+ "parserOptions": {
48
+ "ecmaVersion": 2020,
49
+ "sourceType": "module"
50
+ },
51
+ "plugins": ["@typescript-eslint"],
52
+ "extends": [
53
+ "plugin:@typescript-eslint/recommended"
54
+ ],
55
+ "rules": {
56
+ "@typescript-eslint/no-explicit-any": "off",
57
+ "@typescript-eslint/explicit-module-boundary-types": "off"
58
+ }
59
+ }
60
+ ]
61
+ }
package/.gitattributes ADDED
@@ -0,0 +1,4 @@
1
+ /.yarn/** linguist-vendored
2
+ /.yarn/releases/* binary
3
+ /.yarn/plugins/**/* binary
4
+ /.pnp.* binary linguist-generated
@@ -0,0 +1,352 @@
1
+ ---
2
+ applyTo: '**'
3
+ ---
4
+ # GitHub Copilot Instructions for DXF Project
5
+
6
+ ## 🌐 LANGUAGE STANDARDS
7
+
8
+ **CRITICAL: All code, technical documentation, and git commits MUST be in English (en_US)**
9
+
10
+ ### ✅ ALWAYS in English
11
+
12
+ - **Code**: Variables, functions, classes, comments
13
+ ```typescript
14
+ // ✅ Correct
15
+ function parseEntity(entity: Entity): ParsedEntity {
16
+ // Parse DXF entity
17
+ return parsedEntity;
18
+ }
19
+
20
+ // ❌ Wrong
21
+ function parseEntidade(entidade: Entity): EntidadeParseada {
22
+ // Parsear entidade DXF
23
+ return entidadeParseada;
24
+ }
25
+ ```
26
+
27
+ - **Git Commits**: Follow Conventional Commits in English
28
+ ```bash
29
+ ✅ feat(dimension): add DIMSTYLE color support
30
+ ✅ fix(parser): correct POLYLINE bulge parsing
31
+ ✅ docs: update README with installation steps
32
+
33
+ ❌ feat(dimension): adicionar suporte a cores DIMSTYLE
34
+ ❌ fix(parser): corrigir parsing de POLYLINE
35
+ ❌ docs: atualizar README com passos de instalação
36
+ ```
37
+
38
+ - **Technical Documentation**: README.md, API docs, code documentation
39
+ ```markdown
40
+ ✅ ## Installation
41
+ ✅ ### API Reference
42
+ ✅ #### Parameters
43
+
44
+ ❌ ## Instalação
45
+ ❌ ### Referência da API
46
+ ❌ #### Parâmetros
47
+ ```
48
+
49
+ - **Type Definitions**: Interfaces, types, enums
50
+ ```typescript
51
+ ✅ interface DimensionEntity {
52
+ type: 'DIMENSION';
53
+ styleName?: string;
54
+ text?: string;
55
+ }
56
+
57
+ ❌ interface EntidadeDimensao {
58
+ tipo: 'DIMENSION';
59
+ nomeEstilo?: string;
60
+ texto?: string;
61
+ }
62
+ ```
63
+
64
+ - **Error Messages (Technical)**: Log messages, debug output
65
+ ```typescript
66
+ ✅ console.error('Failed to parse DXF entity');
67
+ ✅ throw new Error('Invalid dimension type');
68
+
69
+ ❌ console.error('Falha ao parsear entidade DXF');
70
+ ❌ throw new Error('Tipo de dimensão inválido');
71
+ ```
72
+
73
+ ### 🚫 NEVER in Portuguese
74
+
75
+ - Variable names
76
+ - Function names
77
+ - Class names
78
+ - Type names
79
+ - Code comments
80
+ - Git commit messages
81
+ - Technical documentation files
82
+ - API documentation
83
+ - Test descriptions
84
+ - Configuration files
85
+
86
+ ## 📝 Commit Message Standards
87
+
88
+ ### Format (English only)
89
+
90
+ ```
91
+ <type>(<scope>): <subject>
92
+
93
+ [optional body]
94
+
95
+ [optional footer]
96
+ ```
97
+
98
+ ### Types (English)
99
+
100
+ - `feat`: A new feature
101
+ - `fix`: A bug fix
102
+ - `docs`: Documentation only changes
103
+ - `style`: Changes that don't affect code meaning (formatting, etc)
104
+ - `refactor`: Code change that neither fixes a bug nor adds a feature
105
+ - `perf`: Performance improvement
106
+ - `test`: Adding or correcting tests
107
+ - `build`: Changes to build system or external dependencies
108
+ - `ci`: Changes to CI configuration files and scripts
109
+ - `chore`: Other changes that don't modify src or test files
110
+ - `revert`: Reverts a previous commit
111
+
112
+ ### Examples (English)
113
+
114
+ ```bash
115
+ # New feature
116
+ feat(dimension): add support for DIMSTYLE colors
117
+ feat(parser): implement HATCH entity parsing
118
+
119
+ # Bug fix
120
+ fix(svg): correct arc path calculation
121
+ fix(dimension): resolve text rotation issue
122
+
123
+ # Documentation
124
+ docs: update installation instructions
125
+ docs(api): add examples for toPolylines method
126
+
127
+ # Performance
128
+ perf(svg): optimize spline rendering
129
+ perf(parser): reduce memory allocation in entity handler
130
+
131
+ # Breaking change
132
+ feat!: migrate to pure ESM
133
+
134
+ BREAKING CHANGE: CommonJS is no longer supported. Use import/export syntax.
135
+ ```
136
+
137
+ ## 🏗️ Code Standards
138
+
139
+ ### Naming Conventions (English)
140
+
141
+ ```typescript
142
+ // ✅ Classes: PascalCase (English)
143
+ class DimensionRenderer { }
144
+ class EntityParser { }
145
+
146
+ // ✅ Functions/Methods: camelCase (English)
147
+ function parseString(dxfContent: string) { }
148
+ function renderToSVG(entity: Entity) { }
149
+
150
+ // ✅ Variables: camelCase (English)
151
+ const entityType = 'LINE';
152
+ let boundingBox = new Box2();
153
+
154
+ // ✅ Constants: UPPER_SNAKE_CASE (English)
155
+ const MAX_RECURSION_DEPTH = 100;
156
+ const DEFAULT_LINE_WIDTH = 0.5;
157
+
158
+ // ✅ Interfaces/Types: PascalCase (English)
159
+ interface ParsedDXF { }
160
+ type EntityHandler = (entity: Entity) => void;
161
+
162
+ // ✅ Enums: PascalCase (English)
163
+ enum DimensionType {
164
+ Linear = 0,
165
+ Aligned = 1,
166
+ Angular = 2
167
+ }
168
+ ```
169
+
170
+ ### Comments (English)
171
+
172
+ ```typescript
173
+ // ✅ Correct
174
+ /**
175
+ * Convert DXF color number to SVG RGB string
176
+ * @param colorNumber - DXF color code (0-255)
177
+ * @returns RGB color string in format "rgb(r,g,b)"
178
+ */
179
+ function colorNumberToSVG(colorNumber?: number): string {
180
+ // Handle special cases: ByBlock (0) and ByLayer (256)
181
+ if (colorNumber === 0 || colorNumber === 256) {
182
+ return 'currentColor';
183
+ }
184
+ // ... rest of implementation
185
+ }
186
+
187
+ // ❌ Wrong
188
+ /**
189
+ * Converte número de cor DXF para string RGB SVG
190
+ * @param colorNumber - Código de cor DXF (0-255)
191
+ * @returns String de cor RGB no formato "rgb(r,g,b)"
192
+ */
193
+ function colorNumberToSVG(colorNumber?: number): string {
194
+ // Tratar casos especiais: ByBlock (0) e ByLayer (256)
195
+ if (colorNumber === 0 || colorNumber === 256) {
196
+ return 'currentColor';
197
+ }
198
+ // ... resto da implementação
199
+ }
200
+ ```
201
+
202
+ ### File Names (English)
203
+
204
+ ```
205
+ ✅ dimension-entity.ts
206
+ ✅ color-utils.ts
207
+ ✅ entity-parser.ts
208
+ ✅ svg-renderer.ts
209
+
210
+ ❌ entidade-dimensao.ts
211
+ ❌ utils-cor.ts
212
+ ❌ parser-entidade.ts
213
+ ❌ renderizador-svg.ts
214
+ ```
215
+
216
+ ## 📚 Documentation Standards
217
+
218
+ ### Technical Documentation (English)
219
+
220
+ - README.md: English
221
+ - API.md: English
222
+ - CONTRIBUTING.md: English (with optional Portuguese translation as CONTRIBUTING.pt-BR.md)
223
+ - Code comments: English
224
+ - JSDoc/TSDoc: English
225
+ - Type definitions: English
226
+
227
+ ### User-Facing Content (Can be localized)
228
+
229
+ - Error messages shown to end users
230
+ - UI labels (if applicable)
231
+ - User guides (can have translations)
232
+
233
+ ## 🔧 Configuration Files
234
+
235
+ ### Package.json Scripts (English)
236
+
237
+ ```json
238
+ {
239
+ "scripts": {
240
+ "build": "node build.mjs",
241
+ "test": "mocha --require tsx",
242
+ "lint": "eslint src test",
243
+ "clean": "rimraf dist/ lib/"
244
+ }
245
+ }
246
+ ```
247
+
248
+ ### Commit Configuration (English)
249
+
250
+ ```javascript
251
+ // commitlint.config.js
252
+ export default {
253
+ extends: ['@commitlint/config-conventional'],
254
+ rules: {
255
+ 'type-enum': [
256
+ 2,
257
+ 'always',
258
+ [
259
+ 'feat', // New feature
260
+ 'fix', // Bug fix
261
+ 'docs', // Documentation
262
+ 'style', // Formatting
263
+ 'refactor', // Code refactoring
264
+ 'perf', // Performance
265
+ 'test', // Tests
266
+ 'build', // Build system
267
+ 'ci', // CI/CD
268
+ 'chore', // Maintenance
269
+ 'revert' // Revert
270
+ ]
271
+ ]
272
+ }
273
+ };
274
+ ```
275
+
276
+ ## ✅ Checklist for AI Assistance
277
+
278
+ When providing code or suggestions:
279
+
280
+ - [ ] All variable names in English
281
+ - [ ] All function names in English
282
+ - [ ] All class names in English
283
+ - [ ] All type definitions in English
284
+ - [ ] All comments in English
285
+ - [ ] All commit messages in English
286
+ - [ ] All documentation in English
287
+ - [ ] All error messages (technical) in English
288
+ - [ ] No Portuguese in code or technical content
289
+
290
+ ## 🎯 Examples
291
+
292
+ ### ✅ Correct Pattern
293
+
294
+ ```typescript
295
+ /**
296
+ * Render linear dimension with extension lines and arrows
297
+ */
298
+ function renderLinearDimension(
299
+ entity: DimensionEntity,
300
+ dimStyle?: DimStyleTable,
301
+ ): BoundsAndElement {
302
+ const arrowSize = dimStyle?.dimAsz ?? 2.5;
303
+ const textHeight = dimStyle?.dimTxt ?? 2.5;
304
+
305
+ // Calculate dimension line angle
306
+ const angle = Math.atan2(
307
+ entity.measureEnd.y - entity.measureStart.y,
308
+ entity.measureEnd.x - entity.measureStart.x
309
+ );
310
+
311
+ // ... rest of implementation
312
+ }
313
+ ```
314
+
315
+ ### ❌ Wrong Pattern
316
+
317
+ ```typescript
318
+ /**
319
+ * Renderizar dimensão linear com linhas de extensão e setas
320
+ */
321
+ function renderizarDimensaoLinear(
322
+ entidade: EntidadeDimensao,
323
+ estiloDim?: TabelaEstiloDim,
324
+ ): LimitesEElemento {
325
+ const tamanhoSeta = estiloDim?.dimAsz ?? 2.5;
326
+ const alturaTexto = estiloDim?.dimTxt ?? 2.5;
327
+
328
+ // Calcular ângulo da linha de dimensão
329
+ const angulo = Math.atan2(
330
+ entidade.fimMedicao.y - entidade.inicioMedicao.y,
331
+ entidade.fimMedicao.x - entidade.inicioMedicao.x
332
+ );
333
+
334
+ // ... resto da implementação
335
+ }
336
+ ```
337
+
338
+ ## 🌍 Translation Policy
339
+
340
+ - **Code**: English only, no exceptions
341
+ - **Commits**: English only, no exceptions
342
+ - **Technical Docs**: English (primary), Portuguese translations optional in separate files
343
+ - **User Docs**: Can be localized
344
+ - **Comments**: English only
345
+ - **Error Messages**: Technical errors in English, user-facing errors can be localized
346
+
347
+ ## 📖 Resources
348
+
349
+ - [Conventional Commits](https://www.conventionalcommits.org/en/)
350
+ - [Semantic Versioning](https://semver.org/)
351
+ - [TypeScript Handbook](https://www.typescriptlang.org/docs/)
352
+ - [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html)
@@ -0,0 +1,110 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: read # for checkout
10
+
11
+ jobs:
12
+ test:
13
+ name: Test
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ node-version: [18.x, 20.x, 22.x]
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Setup Node.js ${{ matrix.node-version }}
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: ${{ matrix.node-version }}
28
+
29
+ - name: Enable Corepack
30
+ run: corepack enable
31
+
32
+ - name: Get yarn cache directory path
33
+ id: yarn-cache-dir-path
34
+ run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
35
+
36
+ - name: Cache yarn dependencies
37
+ uses: actions/cache@v4
38
+ with:
39
+ path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
40
+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
41
+ restore-keys: |
42
+ ${{ runner.os }}-yarn-
43
+
44
+ - name: Install dependencies
45
+ run: yarn install --immutable
46
+
47
+ - name: Build
48
+ run: yarn build
49
+
50
+ - name: Run tests
51
+ run: yarn test
52
+
53
+ - name: Run linter
54
+ run: yarn lint
55
+
56
+ release:
57
+ name: Release
58
+ needs: test
59
+ runs-on: ubuntu-latest
60
+ permissions:
61
+ contents: write # to be able to publish a GitHub release
62
+ issues: write # to be able to comment on released issues
63
+ pull-requests: write # to be able to comment on released pull requests
64
+ id-token: write # to enable use of OIDC for npm provenance
65
+ steps:
66
+ - name: Checkout
67
+ uses: actions/checkout@v4
68
+ with:
69
+ fetch-depth: 0
70
+ persist-credentials: false
71
+
72
+ - name: Setup Node.js
73
+ uses: actions/setup-node@v4
74
+ with:
75
+ node-version: 22.x
76
+
77
+ - name: Enable Corepack
78
+ run: corepack enable
79
+
80
+ - name: Get yarn cache directory path
81
+ id: yarn-cache-dir-path
82
+ run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
83
+
84
+ - name: Cache yarn dependencies
85
+ uses: actions/cache@v4
86
+ with:
87
+ path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
88
+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
89
+ restore-keys: |
90
+ ${{ runner.os }}-yarn-
91
+
92
+ - name: Install dependencies
93
+ run: yarn install --immutable
94
+
95
+ - name: Build
96
+ run: yarn build
97
+
98
+ - name: Create tarball for GitHub release
99
+ run: |
100
+ mkdir -p dist
101
+ yarn pack --out dist/%s-%v.tgz
102
+
103
+ - name: Release
104
+ env:
105
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106
+ GIT_AUTHOR_NAME: github-actions[bot]
107
+ GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
108
+ GIT_COMMITTER_NAME: github-actions[bot]
109
+ GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
110
+ run: npx semantic-release
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ yarn commitlint --edit $1
@@ -0,0 +1 @@
1
+ yarn test
@@ -0,0 +1 @@
1
+ CHANGELOG.md
@@ -0,0 +1,6 @@
1
+ {
2
+ "jsxSingleQuote": true,
3
+ "semi": false,
4
+ "singleQuote": true,
5
+ "trailingComma": "all"
6
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "branches": ["main"],
3
+ "plugins": [
4
+ [
5
+ "@semantic-release/commit-analyzer",
6
+ {
7
+ "preset": "conventionalcommits",
8
+ "releaseRules": [
9
+ { "type": "feat", "release": "minor" },
10
+ { "type": "fix", "release": "patch" },
11
+ { "type": "perf", "release": "patch" },
12
+ { "type": "refactor", "release": "patch" },
13
+ { "type": "docs", "release": "patch" },
14
+ { "type": "style", "release": false },
15
+ { "type": "chore", "release": false },
16
+ { "type": "test", "release": false },
17
+ { "type": "build", "release": false },
18
+ { "type": "ci", "release": false },
19
+ { "type": "revert", "release": "patch" },
20
+ { "breaking": true, "release": "major" }
21
+ ]
22
+ }
23
+ ],
24
+ [
25
+ "@semantic-release/release-notes-generator",
26
+ {
27
+ "preset": "conventionalcommits",
28
+ "presetConfig": {
29
+ "types": [
30
+ { "type": "feat", "section": "✨ Features" },
31
+ { "type": "fix", "section": "🐛 Bug Fixes" },
32
+ { "type": "perf", "section": "⚡ Performance Improvements" },
33
+ { "type": "refactor", "section": "♻️ Code Refactoring" },
34
+ { "type": "docs", "section": "📝 Documentation" },
35
+ { "type": "revert", "section": "⏪ Reverts" }
36
+ ]
37
+ }
38
+ }
39
+ ],
40
+ [
41
+ "@semantic-release/changelog",
42
+ {
43
+ "changelogFile": "CHANGELOG.md",
44
+ "changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/)."
45
+ }
46
+ ],
47
+ [
48
+ "@semantic-release/npm",
49
+ {
50
+ "npmPublish": false,
51
+ "tarballDir": "dist"
52
+ }
53
+ ],
54
+ [
55
+ "@semantic-release/github",
56
+ {
57
+ "assets": [
58
+ {
59
+ "path": "dist/*.tgz",
60
+ "label": "npm package"
61
+ }
62
+ ],
63
+ "successComment": "🎉 This ${issue.pull_request ? 'pull request' : 'issue'} is included in [version ${nextRelease.version}](${releases[0].url})",
64
+ "labels": false,
65
+ "releasedLabels": ["released"]
66
+ }
67
+ ],
68
+ [
69
+ "@semantic-release/git",
70
+ {
71
+ "assets": ["CHANGELOG.md", "package.json"],
72
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
73
+ }
74
+ ]
75
+ ]
76
+ }
package/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: node_js
2
+ node_js:
3
+ - '8'
4
+ - '10'
5
+ install: npm install
6
+ sudo: false
Binary file
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules