@linkiez/dxf-renew 5.3.1 → 7.1.0

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 (133) hide show
  1. package/{docs/CODE_PATTERNS.md → .github/instructions/code-patterns.instructions.md} +4 -1
  2. package/.github/instructions/exdxf.instruction.md +161 -0
  3. package/.github/instructions/tdd.instructions.md +271 -0
  4. package/.github/workflows/release.yml +4 -5
  5. package/.releaserc.json +1 -1
  6. package/.yarn/install-state.gz +0 -0
  7. package/CHANGELOG.md +59 -0
  8. package/CONTRIBUTING.md +16 -14
  9. package/PLAN.md +34 -84
  10. package/README.md +43 -8
  11. package/dist/dxf.js +1388 -376
  12. package/docs/DIMENSION_SUMMARY.md +11 -5
  13. package/docs/DXF_VERSION_SUPPORT.md +45 -0
  14. package/docs/ENTITY_SVG_ROADMAP.md +96 -0
  15. package/docs/EZDXF_REFERENCE_SITEMAP.md +55 -0
  16. package/docs/FIXTURE_VALIDATION_EZDXF.md +62 -0
  17. package/docs/README.md +22 -0
  18. package/docs/SVG_RENDERING_INTEGRATION_TESTS.md +119 -0
  19. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +1 -1
  20. package/lib/Helper.cjs +2 -2
  21. package/lib/Helper.cjs.map +2 -2
  22. package/lib/Helper.js +2 -2
  23. package/lib/Helper.js.map +2 -2
  24. package/lib/denormalise.cjs +131 -91
  25. package/lib/denormalise.cjs.map +2 -2
  26. package/lib/denormalise.js +131 -91
  27. package/lib/denormalise.js.map +2 -2
  28. package/lib/dimensionToSVG.cjs +318 -53
  29. package/lib/dimensionToSVG.cjs.map +3 -3
  30. package/lib/dimensionToSVG.js +316 -52
  31. package/lib/dimensionToSVG.js.map +2 -2
  32. package/lib/handlers/entities.cjs +90 -26
  33. package/lib/handlers/entities.cjs.map +3 -3
  34. package/lib/handlers/entities.js +90 -26
  35. package/lib/handlers/entities.js.map +3 -3
  36. package/lib/handlers/entity/dgnUnderlay.cjs +106 -0
  37. package/lib/handlers/entity/dgnUnderlay.cjs.map +7 -0
  38. package/lib/handlers/entity/dgnUnderlay.js +71 -0
  39. package/lib/handlers/entity/dgnUnderlay.js.map +7 -0
  40. package/lib/handlers/entity/dimension.cjs +24 -0
  41. package/lib/handlers/entity/dimension.cjs.map +2 -2
  42. package/lib/handlers/entity/dimension.js +24 -0
  43. package/lib/handlers/entity/dimension.js.map +2 -2
  44. package/lib/handlers/entity/dwfUnderlay.cjs +106 -0
  45. package/lib/handlers/entity/dwfUnderlay.cjs.map +7 -0
  46. package/lib/handlers/entity/dwfUnderlay.js +71 -0
  47. package/lib/handlers/entity/dwfUnderlay.js.map +7 -0
  48. package/lib/handlers/entity/image.cjs +123 -0
  49. package/lib/handlers/entity/image.cjs.map +7 -0
  50. package/lib/handlers/entity/image.js +88 -0
  51. package/lib/handlers/entity/image.js.map +7 -0
  52. package/lib/handlers/entity/leader.cjs +148 -0
  53. package/lib/handlers/entity/leader.cjs.map +7 -0
  54. package/lib/handlers/entity/leader.js +113 -0
  55. package/lib/handlers/entity/leader.js.map +7 -0
  56. package/lib/handlers/entity/pdfUnderlay.cjs +106 -0
  57. package/lib/handlers/entity/pdfUnderlay.cjs.map +7 -0
  58. package/lib/handlers/entity/pdfUnderlay.js +71 -0
  59. package/lib/handlers/entity/pdfUnderlay.js.map +7 -0
  60. package/lib/handlers/entity/tolerance.cjs +90 -0
  61. package/lib/handlers/entity/tolerance.cjs.map +7 -0
  62. package/lib/handlers/entity/tolerance.js +55 -0
  63. package/lib/handlers/entity/tolerance.js.map +7 -0
  64. package/lib/handlers/objects.cjs +257 -136
  65. package/lib/handlers/objects.cjs.map +2 -2
  66. package/lib/handlers/objects.js +257 -136
  67. package/lib/handlers/objects.js.map +2 -2
  68. package/lib/toSVG.cjs +71 -8
  69. package/lib/toSVG.cjs.map +3 -3
  70. package/lib/toSVG.js +72 -9
  71. package/lib/toSVG.js.map +2 -2
  72. package/lib/types/dimension-entity.cjs.map +1 -1
  73. package/lib/types/entity.cjs.map +1 -1
  74. package/lib/types/image-entity.cjs +17 -0
  75. package/lib/types/image-entity.cjs.map +7 -0
  76. package/lib/types/image-entity.js +1 -0
  77. package/lib/types/image-entity.js.map +7 -0
  78. package/lib/types/index.cjs +8 -0
  79. package/lib/types/index.cjs.map +2 -2
  80. package/lib/types/index.js +4 -0
  81. package/lib/types/index.js.map +2 -2
  82. package/lib/types/leader-entity.cjs +17 -0
  83. package/lib/types/leader-entity.cjs.map +7 -0
  84. package/lib/types/leader-entity.js +1 -0
  85. package/lib/types/leader-entity.js.map +7 -0
  86. package/lib/types/options.cjs.map +1 -1
  87. package/lib/types/tables.cjs.map +1 -1
  88. package/lib/types/tolerance-entity.cjs +17 -0
  89. package/lib/types/tolerance-entity.cjs.map +7 -0
  90. package/lib/types/tolerance-entity.js +1 -0
  91. package/lib/types/tolerance-entity.js.map +7 -0
  92. package/lib/types/underlay-entity.cjs +17 -0
  93. package/lib/types/underlay-entity.cjs.map +7 -0
  94. package/lib/types/underlay-entity.js +1 -0
  95. package/lib/types/underlay-entity.js.map +7 -0
  96. package/lib/util/escapeXmlText.cjs +27 -0
  97. package/lib/util/escapeXmlText.cjs.map +7 -0
  98. package/lib/util/escapeXmlText.js +7 -0
  99. package/lib/util/escapeXmlText.js.map +7 -0
  100. package/package.json +13 -4
  101. package/playwright.config.cjs +20 -0
  102. package/src/Helper.ts +3 -3
  103. package/src/denormalise.ts +182 -116
  104. package/src/dimensionToSVG.ts +466 -54
  105. package/src/handlers/entities.ts +109 -34
  106. package/src/handlers/entity/dgnUnderlay.ts +94 -0
  107. package/src/handlers/entity/dimension.ts +27 -1
  108. package/src/handlers/entity/dwfUnderlay.ts +94 -0
  109. package/src/handlers/entity/image.ts +118 -0
  110. package/src/handlers/entity/leader.ts +153 -0
  111. package/src/handlers/entity/pdfUnderlay.ts +94 -0
  112. package/src/handlers/entity/tolerance.ts +75 -0
  113. package/src/handlers/objects.ts +323 -139
  114. package/src/toSVG.ts +98 -7
  115. package/src/types/dimension-entity.ts +11 -0
  116. package/src/types/entity.ts +10 -0
  117. package/src/types/image-entity.ts +35 -0
  118. package/src/types/index.ts +4 -0
  119. package/src/types/leader-entity.ts +40 -0
  120. package/src/types/options.ts +41 -0
  121. package/src/types/tables.ts +84 -0
  122. package/src/types/tolerance-entity.ts +20 -0
  123. package/src/types/underlay-entity.ts +35 -0
  124. package/src/util/escapeXmlText.ts +10 -0
  125. package/tools/browser_test_server.cjs +87 -0
  126. package/tools/ezdxf_generate_dimensions_all_types.py +246 -0
  127. package/tools/ezdxf_generate_dimensions_angular_3p.py +59 -0
  128. package/tools/ezdxf_generate_dimensions_large_scale.py +87 -0
  129. package/tools/ezdxf_regenerate_problem_fixtures.py +184 -0
  130. package/tools/ezdxf_validate_fixtures.py +165 -0
  131. package/docs/DIMENSION_SUMMARY.pt-BR.md +0 -248
  132. package/docs/IMPLEMENTED-2D-ENTITIES.pt-BR.md +0 -54
  133. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.pt-BR.md +0 -169
package/PLAN.md CHANGED
@@ -9,6 +9,7 @@ This document describes a phased plan to align this project’s DXF parsing beha
9
9
  - Provide complete 2D coverage for geometry + annotation features typically found in 2D drawings.
10
10
  - Keep backwards compatibility with existing API outputs (`parseString`, `toSVG`, `toPolylines`) where feasible.
11
11
  - Grow test coverage using real DXF fixtures and regression tests.
12
+ - Run final SVG rendering integration tests in a real browser and save PNG artifacts for manual review.
12
13
 
13
14
  ## Non-goals
14
15
 
@@ -16,88 +17,32 @@ This document describes a phased plan to align this project’s DXF parsing beha
16
17
  - Full ObjectARX/.NET API parity (this is a DXF parser, not a CAD kernel).
17
18
  - Perfect fidelity for every proprietary/extension object (fallback behavior is acceptable).
18
19
 
19
- ## References (Autodesk, AutoCAD 2024)
20
+ ## References
20
21
 
21
- Primary reference used for scope/checklists: AutoCAD 2024 Developer and ObjectARX Help → **DXF Reference**.
22
+ ### Primary (ezdxf stable docs)
22
23
 
23
- - Root: <https://help.autodesk.com/view/OARX/2024/ENU/>
24
- - DXF Format entry point (guid): <https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3>
25
-
26
- ## “Sitemap” / Checklist Source (DXF Reference TOC)
27
-
28
- This sitemap is derived from the Autodesk 2024 DXF Reference left navigation (expanded nodes).
29
-
30
- ### DXF Format
31
-
32
- - About the DXF Format (DXF)
33
- - About DXF Formatting Conventions
34
- - About Object and Entity Codes (DXF)
35
- - Group Code Value Types Reference (DXF)
36
- - DXF Group Codes in Numerical Order Reference
37
-
38
- ### Header Section
24
+ Primary reference used for day-to-day implementation details (entities/objects/tables and their attributes):
39
25
 
40
- - About the DXF HEADER Section
41
- - HEADER Section Group Codes (DXF)
26
+ - ezdxf Reference: <https://ezdxf.readthedocs.io/en/stable/reference.html>
27
+ - Curated sitemap for this repo: [docs/EZDXF_REFERENCE_SITEMAP.md](docs/EZDXF_REFERENCE_SITEMAP.md)
28
+ - Setup / extras install: <https://ezdxf.readthedocs.io/en/stable/setup.html#installation-with-extras>
42
29
 
43
- ### Classes Section
30
+ ### Authoritative (Autodesk / ObjectARX)
44
31
 
45
- - About the DXF CLASSES Section
46
- - CLASSES Section Group Codes (DXF)
47
- - Default Class Values (DXF)
32
+ When behavior is ambiguous or disputed, treat Autodesk’s DXF reference as authoritative:
48
33
 
49
- ### Tables Section
50
-
51
- - About the DXF TABLES Section (DXF)
52
- - About Symbol Table Group Codes (DXF)
53
- - Common Symbol Table Group Codes (DXF)
54
- - APPID (DXF)
55
- - BLOCK_RECORD (DXF)
56
- - DIMSTYLE (DXF)
57
- - LAYER (DXF)
58
- - LTYPE (DXF)
59
- - STYLE (DXF)
60
- - UCS (DXF)
61
- - VIEW (DXF)
62
- - VPORT (DXF)
63
-
64
- ### Blocks Section
65
-
66
- - About the DXF BLOCKS Section
67
- - About BLOCKS Section Group Codes (DXF)
68
- - BLOCK (DXF)
69
- - ENDBLK (DXF)
70
-
71
- ### Entities Section
34
+ - Root: <https://help.autodesk.com/view/OARX/2024/ENU/>
35
+ - DXF Format entry point (guid): <https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3>
72
36
 
73
- Autodesk lists many entities (including 3D). For “complete 2D”, the critical subset includes:
37
+ Project documentation index:
74
38
 
75
- - ARC, CIRCLE, LINE
76
- - LWPOLYLINE, POLYLINE (+ VERTEX + SEQEND)
77
- - ELLIPSE, SPLINE
78
- - HATCH, SOLID, TRACE, REGION
79
- - POINT
80
- - TEXT, MTEXT
81
- - DIMENSION, LEADER, MLEADER, TOLERANCE
82
- - INSERT, ATTDEF, ATTRIB
83
- - VIEWPORT
84
- - IMAGE, UNDERLAY, WIPEOUT
85
- - RAY, XLINE
86
- - OLEFRAME, OLE2FRAME
87
- - TABLE (entity)
39
+ - `docs/README.md`
88
40
 
89
- ### Objects Section
41
+ ## “Sitemap” / Checklist Source
90
42
 
91
- For 2D workflows, the most commonly required objects include:
43
+ - Primary navigation for implementation work: [docs/EZDXF_REFERENCE_SITEMAP.md](docs/EZDXF_REFERENCE_SITEMAP.md)
92
44
 
93
- - DICTIONARY / DICTIONARYVAR
94
- - XRECORD
95
- - LAYOUT
96
- - DIMASSOC
97
- - IMAGEDEF / IMAGEDEF_REACTOR
98
- - GROUP
99
- - TABLESTYLE
100
- - FIELD
45
+ Note: do not embed large copies of Autodesk TOCs/spec text in this plan. Keep external links instead so this file stays maintainable.
101
46
 
102
47
  ## Current State (Repository Snapshot)
103
48
 
@@ -121,8 +66,8 @@ Entity parsers currently exist for (see `src/handlers/entities.ts` and `src/hand
121
66
 
122
67
  `src/handlers/objects.ts` currently parses:
123
68
 
124
- - Implemented: LAYOUT (partial).
125
- - Missing from Autodesk TOC subset above: DICTIONARY, XRECORD, DIMASSOC, IMAGEDEF (+ reactor), FIELD, TABLESTYLE, GROUP, etc.
69
+ - Implemented: LAYOUT (partial), DICTIONARY, XRECORD.
70
+ - Missing from Autodesk TOC subset above: DIMASSOC, IMAGEDEF (+ reactor), FIELD, TABLESTYLE, GROUP, etc.
126
71
 
127
72
  ## Project Analysis (Code-Backed)
128
73
 
@@ -228,6 +173,8 @@ There is already substantial fixture coverage in `test/resources/*.dxf` and unit
228
173
 
229
174
  - Rendering tests exist for `toSVG`, `toPolylines`, dimension/text, blocks/inserts, and hatches.
230
175
  - Use this existing corpus to gate each milestone; add only minimal new fixtures per newly-supported feature.
176
+ - When fixtures become too complex, brittle, or hard to assert against, it is acceptable to replace them with simpler, targeted fixtures (including ezdxf-generated ones) as long as the test still covers the intended behavior.
177
+ - After adding or regenerating fixtures, run `yarn validate:fixtures` to ensure DXF structure is sound.
231
178
 
232
179
  ## Milestones
233
180
 
@@ -242,6 +189,8 @@ There is already substantial fixture coverage in `test/resources/*.dxf` and unit
242
189
  - PR 0.1: Add/confirm one “golden” unit test per public API (`parseString`, `toPolylines`, `toSVG`).
243
190
  - PR 0.2: Add a test-only strict mode helper (e.g., fail on unknown entity/table/object types) without changing the runtime default behavior.
244
191
  - PR 0.3: Add 1–3 new fixtures only if existing fixtures don’t cover a targeted feature.
192
+ - If a fixture is too complex for stable assertions, prefer a smaller, focused fixture generated via ezdxf.
193
+ - It is OK to replace or simplify existing fixtures if they remain representative of the behavior under test.
245
194
 
246
195
  - Add/confirm a single “golden” pipeline test per API surface:
247
196
  - `parseString()` parses representative DXFs without throwing.
@@ -398,11 +347,11 @@ The items below are the main gaps to reach “complete 2D” as defined in this
398
347
  | Entity | Parse | Render (SVG) | Render (Polylines) | Block-safe | Minimal implementation checklist |
399
348
  | --- | --- | --- | --- | --- | --- |
400
349
  | SEQEND | Sentinel only | N/A | N/A | N/A | Add `src/handlers/entity/seqend.ts` (optional) or harden sequencing in `src/handlers/entities.ts` + add fixture that stresses POLYLINE/VERTEX/SEQEND ordering |
401
- | LEADER | No | No | No | No | Add `src/types/leader-entity.ts` + export in `src/types/index.ts`; add `src/handlers/entity/leader.ts`; add `toSVG` case (even minimal); add fixture + unit test |
350
+ | LEADER | Yes | Yes | No | No | Add `src/types/leader-entity.ts` + export in `src/types/index.ts`; add `src/handlers/entity/leader.ts`; add `toSVG` case (even minimal); add fixture + unit test |
402
351
  | MLEADER | No | No | No | No | Add `src/types/mleader-entity.ts`; add `src/handlers/entity/mleader.ts`; likely requires OBJECTS support (DICTIONARY/XRECORD) for full fidelity; start with parse-only + safe ignore in render |
403
- | TOLERANCE | No | No | No | No | Add `src/types/tolerance-entity.ts`; add `src/handlers/entity/tolerance.ts`; render as text fallback (SVG only) |
404
- | IMAGE | No | No | No | No | Add `src/types/image-entity.ts`; add `src/handlers/entity/image.ts`; add OBJECTS: IMAGEDEF/IMAGEDEF_REACTOR; render as placeholder rect or ignore safely |
405
- | UNDERLAY | No | No | No | No | Add `src/types/underlay-entity.ts`; add `src/handlers/entity/underlay.ts`; add OBJECTS underlay defs; render placeholder/ignore |
352
+ | TOLERANCE | Yes | Yes | No | No | Add `src/types/tolerance-entity.ts`; add `src/handlers/entity/tolerance.ts`; render as text fallback (SVG only) |
353
+ | IMAGE | Yes | No | No | No | Add `src/types/image-entity.ts`; add `src/handlers/entity/image.ts`; add OBJECTS: IMAGEDEF/IMAGEDEF_REACTOR; render as placeholder rect or ignore safely |
354
+ | UNDERLAY | Yes | No | No | No | Add `src/types/underlay-entity.ts`; add `src/handlers/entity/dwfUnderlay.ts` + `src/handlers/entity/dgnUnderlay.ts`; add OBJECTS: UNDERLAYDEFINITION; render placeholder/ignore |
406
355
  | WIPEOUT | No | No | No | No | Add `src/types/wipeout-entity.ts`; add `src/handlers/entity/wipeout.ts`; render as polygon mask approximation or ignore safely |
407
356
  | RAY | No | No | No | No | Add `src/types/ray-entity.ts`; add `src/handlers/entity/ray.ts`; render as long line (bounded by extents) or ignore |
408
357
  | XLINE | No | No | No | No | Add `src/types/xline-entity.ts`; add `src/handlers/entity/xline.ts`; render as long line (bounded by extents) or ignore |
@@ -426,10 +375,11 @@ The items below are the main gaps to reach “complete 2D” as defined in this
426
375
 
427
376
  | Object | Current status | Primary file(s) to change | Minimal checklist |
428
377
  | --- | --- | --- | --- |
429
- | DICTIONARY | Missing | `src/handlers/objects.ts` (+ new types file if desired) | Group objects by `0`; add DICTIONARY parser; store by handle for lookup |
430
- | XRECORD | Missing | `src/handlers/objects.ts` | Add XRECORD parser; preserve raw records for downstream consumers |
378
+ | DICTIONARY | Implemented | `src/handlers/objects.ts` (+ new types file if desired) | Group objects by `0`; add DICTIONARY parser; store by handle for lookup |
379
+ | XRECORD | Implemented | `src/handlers/objects.ts` | Add XRECORD parser; preserve raw records for downstream consumers |
431
380
  | DIMASSOC | Missing | `src/handlers/objects.ts` | Add DIMASSOC parse with safe unresolved references; add fixture-based test |
432
- | IMAGEDEF / IMAGEDEF_REACTOR | Missing | `src/handlers/objects.ts` | Parse enough to resolve IMAGE entity references; do not crash if external files missing |
381
+ | IMAGEDEF / IMAGEDEF_REACTOR | Implemented | `src/handlers/objects.ts` | Parse enough to resolve IMAGE entity references; do not crash if external files missing |
382
+ | UNDERLAYDEFINITION | Implemented | `src/handlers/objects.ts` | Parse enough to resolve DWFUNDERLAY/DGNUNDERLAY references; do not crash if external files missing |
433
383
  | FIELD | Missing | `src/handlers/objects.ts` | Parse as raw text/value pairs; do not attempt full evaluation initially |
434
384
  | TABLESTYLE | Missing | `src/handlers/objects.ts` | Parse style basics; used later for TABLE entity rendering |
435
385
  | GROUP | Missing | `src/handlers/objects.ts` | Parse group membership; safe ignore if not used |
@@ -447,10 +397,10 @@ This appendix provides an explicit sequence of PRs. The intent is to keep each P
447
397
 
448
398
  ### B.1 Recommended order (high value first)
449
399
 
450
- - **Stabilize existing behavior**: PR B1.1 (POLYLINE/VERTEX/SEQEND sequencing), PR B1.2 (block basepoint for TEXT/MTEXT/DIMENSION).
451
- - **Unblock references and metadata**: PR B1.3 (OBJECTS dispatch + DICTIONARY), PR B1.4 (XRECORD).
452
- - **Enable images/underlays**: PR B1.5 (IMAGEDEF / IMAGEDEF_REACTOR), PR B1.6 (IMAGE entity), PR B1.7 (UNDERLAY defs + UNDERLAY entity).
453
- - **Add remaining common 2D annotation**: PR B1.8 (LEADER), PR B1.9 (TOLERANCE), PR B1.10 (DIMASSOC), PR B1.11 (MLEADER).
400
+ - **Stabilize existing behavior**: PR B1.1 (POLYLINE/VERTEX/SEQEND sequencing), PR B1.2 (block basepoint for TEXT/MTEXT/DIMENSION).
401
+ - **Unblock references and metadata**: PR B1.3 (OBJECTS dispatch + DICTIONARY), PR B1.4 (XRECORD).
402
+ - **Enable images/underlays**: PR B1.5 (IMAGEDEF / IMAGEDEF_REACTOR), PR B1.6 (IMAGE entity), PR B1.7 (UNDERLAY defs + UNDERLAY entity).
403
+ - **Add remaining common 2D annotation**: PR B1.8 (LEADER), PR B1.9 (TOLERANCE), PR B1.10 (DIMASSOC), PR B1.11 (MLEADER).
454
404
 
455
405
  ### B.2 PR templates by feature type
456
406
 
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
+ # DXF-Renewed
2
+
1
3
  [![Build Status](https://travis-ci.org/bjnortier/dxf.svg?branch=master)](https://travis-ci.org/bjnortier/dxf)
2
4
  [![semantic-release: conventionalcommits](https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
3
5
 
4
- # DXF-Renewed
5
-
6
6
  > **⚠️ WARNING: This repository is currently under development and has not been fully tested in production. Use at your own risk.**
7
7
 
8
8
  DXF parser for node/browser.
@@ -24,7 +24,7 @@ Written in **TypeScript** with full type definitions included. Uses modern ES201
24
24
  - 🎯 Full TypeScript codebase with strict type checking
25
25
  - ⚡ Built with esbuild (96% faster than Babel - 18ms vs 447ms)
26
26
  - 📦 Modular type system with 22+ separate type files
27
- - ✅ 100% test coverage maintained (85 tests passing)
27
+ - ✅ Extensive unit tests and browser integration tests
28
28
  - 🎨 Enhanced SVG rendering with TEXT, MTEXT, and DIMENSION support
29
29
  - 📚 Comprehensive type definitions for all DXF entities
30
30
 
@@ -148,6 +148,34 @@ Here's an example you will find in the functional test output:
148
148
 
149
149
  ![svg example image](https://cloud.githubusercontent.com/assets/57994/17583566/e00f5d78-5fb1-11e6-9030-55686f980e6f.png)
150
150
 
151
+ ### DIMENSION auto-scaling
152
+
153
+ DIMENSION rendering supports viewport-based auto-scaling so that arrows and text remain readable across different coordinate scales.
154
+
155
+ ```ts
156
+ import { Helper } from '@linkiez/dxf-renew'
157
+
158
+ const helper = new Helper(dxfString)
159
+
160
+ const svg = helper.toSVG({
161
+ dimension: {
162
+ autoScale: true,
163
+ // Reference used when percentages are not provided.
164
+ autoScaleViewportReference: 40,
165
+ // Optional per-element overrides as a percentage (0..100)
166
+ // of min(viewBoxWidth, viewBoxHeight).
167
+ autoScaleViewportPercentages: {
168
+ arrowSize: 1.5,
169
+ textHeight: 1
170
+ }
171
+ }
172
+ })
173
+ ```
174
+
175
+ When `autoScaleViewportPercentages` is provided (and `autoScale` is enabled), the final size for each configured element is computed as:
176
+
177
+ `size = min(viewBoxWidth, viewBoxHeight) * (percent / 100)`
178
+
151
179
  ## Interpolation
152
180
 
153
181
  The library supports outputting DXFs as interpolated polylines for custom rendering (e.g. WebGL) or other applications:
@@ -189,6 +217,14 @@ Running the unit tests:
189
217
  yarn test
190
218
  ```
191
219
 
220
+ Running the browser integration tests (Playwright):
221
+
222
+ ```bash
223
+ yarn test:integration:browser
224
+ ```
225
+
226
+ These tests render fixtures in a real browser and write deterministic PNG screenshots under `test/rendered/` (overwritten on each run).
227
+
192
228
  Running the functional tests in a browser:
193
229
 
194
230
  ```bash
@@ -199,7 +235,7 @@ Please open `toSVG.html` when the file listing loads in the browser (or open `ht
199
235
 
200
236
  ## Development Guidelines
201
237
 
202
- - Code patterns and best practices: `docs/CODE_PATTERNS.md`
238
+ Project documentation index: `docs/README.md`
203
239
 
204
240
  ## TypeScript Support
205
241
 
@@ -251,8 +287,7 @@ This project uses [semantic-release](https://semantic-release.gitbook.io/) for a
251
287
  **Releases are automatically created** when commits following [Conventional Commits](https://www.conventionalcommits.org/en/) are pushed to:
252
288
 
253
289
  - `main` - Stable production releases (`1.0.0`, `1.1.0`, `2.0.0`)
254
- - `develop` - Pre-releases for testing (`1.1.0-dev.1`, `1.1.0-dev.2`)
255
- - `beta` - Beta pre-releases (`1.1.0-beta.1`, `1.1.0-beta.2`)
290
+
256
291
 
257
292
  ### Commit Format
258
293
 
@@ -276,9 +311,9 @@ To contribute:
276
311
  1. Fork the repository
277
312
  2. Make commits using `yarn commit` (interactive) or following Conventional Commits
278
313
  3. Push to your fork
279
- 4. Open a Pull Request to `develop`
314
+ 4. Open a Pull Request to `main`
280
315
 
281
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines and [docs/SEMANTIC_RELEASE.md](./docs/SEMANTIC_RELEASE.md) for release documentation.
316
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
282
317
 
283
318
  ## Contributors
284
319