ofs-dxf-ts 1.0.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 (97) hide show
  1. package/API.md +411 -0
  2. package/CHANGELOG.md +26 -0
  3. package/LICENSE +21 -0
  4. package/README.md +119 -0
  5. package/dist/core/dxf-builder.d.ts +348 -0
  6. package/dist/core/dxf-builder.js +549 -0
  7. package/dist/core/dxf-document.d.ts +220 -0
  8. package/dist/core/dxf-document.js +529 -0
  9. package/dist/core/dxf-entities.d.ts +327 -0
  10. package/dist/core/dxf-entities.js +22 -0
  11. package/dist/core/dxf-serializer.d.ts +48 -0
  12. package/dist/core/dxf-serializer.js +595 -0
  13. package/dist/core/hatch-patterns.d.ts +15 -0
  14. package/dist/core/hatch-patterns.js +214 -0
  15. package/dist/core/modelspace.d.ts +106 -0
  16. package/dist/core/modelspace.js +351 -0
  17. package/dist/geometry/math.utils.d.ts +8 -0
  18. package/dist/geometry/math.utils.js +43 -0
  19. package/dist/geometry/offset.utils.d.ts +32 -0
  20. package/dist/geometry/offset.utils.js +87 -0
  21. package/dist/geometry/polyline.utils.d.ts +10 -0
  22. package/dist/geometry/polyline.utils.js +63 -0
  23. package/dist/geometry/text.utils.d.ts +15 -0
  24. package/dist/geometry/text.utils.js +28 -0
  25. package/dist/index.d.ts +23 -0
  26. package/dist/index.js +29 -0
  27. package/dist/parser/auto-cad-color-index.d.ts +8 -0
  28. package/dist/parser/auto-cad-color-index.js +265 -0
  29. package/dist/parser/dim-style-codes.d.ts +5 -0
  30. package/dist/parser/dim-style-codes.js +32 -0
  31. package/dist/parser/dxf-parser.d.ts +16 -0
  32. package/dist/parser/dxf-parser.js +824 -0
  33. package/dist/parser/entities/3dface.d.ts +5 -0
  34. package/dist/parser/entities/3dface.js +76 -0
  35. package/dist/parser/entities/arc.d.ts +5 -0
  36. package/dist/parser/entities/arc.js +34 -0
  37. package/dist/parser/entities/attdef.d.ts +5 -0
  38. package/dist/parser/entities/attdef.js +86 -0
  39. package/dist/parser/entities/attribute.d.ts +5 -0
  40. package/dist/parser/entities/attribute.js +106 -0
  41. package/dist/parser/entities/circle.d.ts +5 -0
  42. package/dist/parser/entities/circle.js +40 -0
  43. package/dist/parser/entities/dimension.d.ts +5 -0
  44. package/dist/parser/entities/dimension.js +65 -0
  45. package/dist/parser/entities/ellipse.d.ts +5 -0
  46. package/dist/parser/entities/ellipse.js +42 -0
  47. package/dist/parser/entities/hatch.d.ts +5 -0
  48. package/dist/parser/entities/hatch.js +321 -0
  49. package/dist/parser/entities/insert.d.ts +5 -0
  50. package/dist/parser/entities/insert.js +52 -0
  51. package/dist/parser/entities/line.d.ts +5 -0
  52. package/dist/parser/entities/line.js +30 -0
  53. package/dist/parser/entities/lwpolyline.d.ts +5 -0
  54. package/dist/parser/entities/lwpolyline.js +101 -0
  55. package/dist/parser/entities/mtext.d.ts +5 -0
  56. package/dist/parser/entities/mtext.js +54 -0
  57. package/dist/parser/entities/point.d.ts +5 -0
  58. package/dist/parser/entities/point.js +30 -0
  59. package/dist/parser/entities/polyline.d.ts +5 -0
  60. package/dist/parser/entities/polyline.js +85 -0
  61. package/dist/parser/entities/solid.d.ts +5 -0
  62. package/dist/parser/entities/solid.js +35 -0
  63. package/dist/parser/entities/spline.d.ts +5 -0
  64. package/dist/parser/entities/spline.js +69 -0
  65. package/dist/parser/entities/text.d.ts +5 -0
  66. package/dist/parser/entities/text.js +47 -0
  67. package/dist/parser/entities/vertex.d.ts +5 -0
  68. package/dist/parser/entities/vertex.js +59 -0
  69. package/dist/parser/extended-data-parser.d.ts +18 -0
  70. package/dist/parser/extended-data-parser.js +100 -0
  71. package/dist/parser/index.d.ts +10 -0
  72. package/dist/parser/index.js +9 -0
  73. package/dist/parser/log.d.ts +14 -0
  74. package/dist/parser/log.js +39 -0
  75. package/dist/parser/parse-helpers.d.ts +23 -0
  76. package/dist/parser/parse-helpers.js +128 -0
  77. package/dist/parser/scanner.d.ts +29 -0
  78. package/dist/parser/scanner.js +143 -0
  79. package/dist/parser/types.d.ts +78 -0
  80. package/dist/parser/types.js +5 -0
  81. package/dist/symbols/slope-symbol.d.ts +21 -0
  82. package/dist/symbols/slope-symbol.js +81 -0
  83. package/dist/symbols/structures.d.ts +9 -0
  84. package/dist/symbols/structures.js +120 -0
  85. package/dist/template/blank-document.d.ts +13 -0
  86. package/dist/template/blank-document.js +13 -0
  87. package/dist/template/block-registry.d.ts +16 -0
  88. package/dist/template/block-registry.js +135 -0
  89. package/dist/template/index.d.ts +17 -0
  90. package/dist/template/index.js +17 -0
  91. package/dist/template/template-injector.d.ts +45 -0
  92. package/dist/template/template-injector.js +487 -0
  93. package/dist/template/template-reader.d.ts +28 -0
  94. package/dist/template/template-reader.js +80 -0
  95. package/dist/types/index.d.ts +24 -0
  96. package/dist/types/index.js +8 -0
  97. package/package.json +59 -0
@@ -0,0 +1,43 @@
1
+ export function formatDistance(distance) {
2
+ const km = Math.floor(distance / 1000);
3
+ const meters = Math.floor(distance % 1000);
4
+ const metersStr = meters.toString().padStart(3, '0');
5
+ return `KM ${km}+${metersStr}`;
6
+ }
7
+ export function calculateDistance(p1, p2) {
8
+ return Math.hypot(p2[0] - p1[0], p2[1] - p1[1]);
9
+ }
10
+ export function calculateAzimuth(x1, y1, x2, y2) {
11
+ const dx = x2 - x1;
12
+ const dy = y2 - y1;
13
+ // Note: math.atan2(dx, dy) in Python returns angle from Y-axis.
14
+ // In TS Math.atan2(y, x) is standard, but to replicate python `atan2(dx, dy)`:
15
+ let azimuthRad = Math.atan2(dx, dy);
16
+ let azimuthDeg = (azimuthRad * 180) / Math.PI;
17
+ if (azimuthDeg < 0) {
18
+ azimuthDeg += 360; // Normalize to 0-360°
19
+ }
20
+ return azimuthDeg;
21
+ }
22
+ export function rotatePoint(x, y, angleDeg, shiftX, shiftY) {
23
+ const rad = (angleDeg * Math.PI) / 180;
24
+ const xNew = x * Math.cos(rad) - y * Math.sin(rad) + shiftX;
25
+ const yNew = x * Math.sin(rad) + y * Math.cos(rad) + shiftY;
26
+ return [xNew, yNew, 0];
27
+ }
28
+ export function rotatePointAzimuth(x, y, azimuthDeg, shiftX, shiftY) {
29
+ // Convert azimuth to math angle (counterclockwise from X-axis)
30
+ const thetaDeg = 90 - azimuthDeg;
31
+ return rotatePoint(x, y, thetaDeg, shiftX, shiftY);
32
+ }
33
+ export function isPointInBounds(x, y, xmin, ymin, xmax, ymax) {
34
+ return x >= xmin && x <= xmax && y >= ymin && y <= ymax;
35
+ }
36
+ export function snapBound(value, step, direction = 'down') {
37
+ if (direction === 'down') {
38
+ return Math.floor(value / step) * step;
39
+ }
40
+ else {
41
+ return Math.ceil(value / step) * step;
42
+ }
43
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Planar polyline offset in drawing units (e.g. UTM meters).
3
+ *
4
+ * Every segment is shifted along its normal and neighbouring shifted segments
5
+ * meet at their intersection (miter join). A corner whose miter point would lie
6
+ * further than `miterLimit × distance` from the vertex is beveled instead, so
7
+ * sharp turns do not produce long spikes.
8
+ */
9
+ import { Coordinate, Coordinate3D } from '../types/index.js';
10
+ export interface LineOffsetOptions {
11
+ /** Treat the points as a closed ring. Default: true when the first and last point coincide. */
12
+ closed?: boolean;
13
+ /** Longest allowed miter as a multiple of the offset distance (default 4). */
14
+ miterLimit?: number;
15
+ }
16
+ /**
17
+ * Offset a polyline to one side.
18
+ *
19
+ * @param points polyline vertices ([x, y] or [x, y, z]; z is ignored)
20
+ * @param distance positive = left of the direction of travel, negative = right
21
+ * @returns the offset vertices — a ring given with a repeated first point is
22
+ * returned the same way; degenerate input returns `[]`
23
+ */
24
+ export declare function offsetPolyline(points: readonly (Coordinate | Coordinate3D)[], distance: number, opts?: LineOffsetOptions): Coordinate[];
25
+ /**
26
+ * Offset a polyline to both sides — e.g. canal banks around a centerline.
27
+ * Distances are in drawing units (UTM meters); returned z values are 0.
28
+ */
29
+ export declare function getLineOffset(points: readonly (Coordinate | Coordinate3D)[], offsetDistance?: number, opts?: LineOffsetOptions): {
30
+ left: Coordinate3D[];
31
+ right: Coordinate3D[];
32
+ };
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Planar polyline offset in drawing units (e.g. UTM meters).
3
+ *
4
+ * Every segment is shifted along its normal and neighbouring shifted segments
5
+ * meet at their intersection (miter join). A corner whose miter point would lie
6
+ * further than `miterLimit × distance` from the vertex is beveled instead, so
7
+ * sharp turns do not produce long spikes.
8
+ */
9
+ const EPS = 1e-9;
10
+ const samePoint = (a, b) => Math.abs(a[0] - b[0]) <= EPS && Math.abs(a[1] - b[1]) <= EPS;
11
+ /**
12
+ * Offset a polyline to one side.
13
+ *
14
+ * @param points polyline vertices ([x, y] or [x, y, z]; z is ignored)
15
+ * @param distance positive = left of the direction of travel, negative = right
16
+ * @returns the offset vertices — a ring given with a repeated first point is
17
+ * returned the same way; degenerate input returns `[]`
18
+ */
19
+ export function offsetPolyline(points, distance, opts = {}) {
20
+ // Zero-length segments have no direction: drop consecutive duplicates.
21
+ const pts = [];
22
+ for (const p of points) {
23
+ if (!pts.length || !samePoint(p, pts[pts.length - 1]))
24
+ pts.push([p[0], p[1]]);
25
+ }
26
+ const repeatsStart = pts.length > 2 && samePoint(pts[0], pts[pts.length - 1]);
27
+ let closed = opts.closed ?? repeatsStart;
28
+ if (closed && repeatsStart)
29
+ pts.pop();
30
+ if (closed && pts.length < 3)
31
+ closed = false;
32
+ if (pts.length < 2)
33
+ return [];
34
+ const n = pts.length;
35
+ const segments = closed ? n : n - 1;
36
+ // Left unit normal of each segment.
37
+ const nx = new Float64Array(segments);
38
+ const ny = new Float64Array(segments);
39
+ for (let i = 0; i < segments; i++) {
40
+ const a = pts[i];
41
+ const b = pts[(i + 1) % n];
42
+ const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
43
+ nx[i] = -(b[1] - a[1]) / len;
44
+ ny[i] = (b[0] - a[0]) / len;
45
+ }
46
+ const limit = opts.miterLimit ?? 4;
47
+ const out = [];
48
+ const shifted = (p, seg) => [p[0] + nx[seg] * distance, p[1] + ny[seg] * distance];
49
+ for (let k = 0; k < n; k++) {
50
+ const p = pts[k];
51
+ if (!closed && k === 0) {
52
+ out.push(shifted(p, 0));
53
+ continue;
54
+ }
55
+ if (!closed && k === n - 1) {
56
+ out.push(shifted(p, segments - 1));
57
+ continue;
58
+ }
59
+ const prev = k === 0 ? segments - 1 : k - 1;
60
+ const next = k;
61
+ // The miter direction is the sum of both normals; |sum| = 2·cos(half the turn angle).
62
+ const mx = nx[prev] + nx[next];
63
+ const my = ny[prev] + ny[next];
64
+ const cosHalf = Math.hypot(mx, my) / 2;
65
+ if (cosHalf > EPS && 1 / cosHalf <= limit) {
66
+ const s = distance / (2 * cosHalf * cosHalf);
67
+ out.push([p[0] + mx * s, p[1] + my * s]);
68
+ }
69
+ else {
70
+ out.push(shifted(p, prev), shifted(p, next));
71
+ }
72
+ }
73
+ if (closed && repeatsStart)
74
+ out.push([out[0][0], out[0][1]]);
75
+ return out;
76
+ }
77
+ /**
78
+ * Offset a polyline to both sides — e.g. canal banks around a centerline.
79
+ * Distances are in drawing units (UTM meters); returned z values are 0.
80
+ */
81
+ export function getLineOffset(points, offsetDistance = 1, opts = {}) {
82
+ const to3D = (pts) => pts.map(p => [p[0], p[1], 0]);
83
+ return {
84
+ left: to3D(offsetPolyline(points, offsetDistance, opts)),
85
+ right: to3D(offsetPolyline(points, -offsetDistance, opts)),
86
+ };
87
+ }
@@ -0,0 +1,10 @@
1
+ import { Coordinate } from '../types/index.js';
2
+ export declare function kmPointPolyline(points: Coordinate[], targetDistance: number): {
3
+ point: Coordinate;
4
+ az: number;
5
+ };
6
+ export declare function dividePolylineWithDistance(coords: Coordinate[], segmentLength?: number): {
7
+ points: Coordinate[];
8
+ distances: number[];
9
+ angles: number[];
10
+ };
@@ -0,0 +1,63 @@
1
+ import { calculateAzimuth, calculateDistance } from './math.utils.js';
2
+ export function kmPointPolyline(points, targetDistance) {
3
+ let totalDistance = 0;
4
+ for (let i = 0; i < points.length - 1; i++) {
5
+ const [x1, y1] = points[i];
6
+ const [x2, y2] = points[i + 1];
7
+ const az = calculateAzimuth(x1, y1, x2, y2);
8
+ const segmentLength = Math.hypot(x2 - x1, y2 - y1);
9
+ if (totalDistance + segmentLength >= targetDistance) {
10
+ // Remaining distance in this segment
11
+ const remain = targetDistance - totalDistance;
12
+ const ratio = remain / segmentLength;
13
+ const x = x1 + (x2 - x1) * ratio;
14
+ const y = y1 + (y2 - y1) * ratio;
15
+ return { point: [x, y], az };
16
+ }
17
+ totalDistance += segmentLength;
18
+ }
19
+ // If targetDistance > total length -> return last point
20
+ const lastPoint = points[points.length - 1];
21
+ let az = 0;
22
+ if (points.length >= 2) {
23
+ const [x1, y1] = points[points.length - 2];
24
+ const [x2, y2] = points[points.length - 1];
25
+ az = calculateAzimuth(x1, y1, x2, y2);
26
+ }
27
+ return { point: lastPoint, az };
28
+ }
29
+ export function dividePolylineWithDistance(coords, segmentLength = 100) {
30
+ if (coords.length === 0)
31
+ return { points: [], distances: [], angles: [] };
32
+ const newPoints = [coords[0]];
33
+ const distances = [0];
34
+ const angles = [];
35
+ let totalDistance = 0;
36
+ let firstLoop = true;
37
+ let az = 0;
38
+ for (let i = 1; i < coords.length; i++) {
39
+ const [x1, y1] = coords[i - 1];
40
+ const [x2, y2] = coords[i];
41
+ az = calculateAzimuth(x1, y1, x2, y2);
42
+ if (firstLoop) {
43
+ angles.push(az);
44
+ firstLoop = false;
45
+ }
46
+ const segmentDist = calculateDistance([x1, y1], [x2, y2]);
47
+ while (totalDistance + segmentLength <= segmentDist) {
48
+ totalDistance += segmentLength;
49
+ const t = totalDistance / segmentDist;
50
+ const newX = x1 + t * (x2 - x1);
51
+ const newY = y1 + t * (y2 - y1);
52
+ newPoints.push([newX, newY]);
53
+ distances.push(distances[distances.length - 1] + segmentLength);
54
+ angles.push(az);
55
+ }
56
+ totalDistance -= segmentDist;
57
+ }
58
+ newPoints.push(coords[coords.length - 1]);
59
+ const lastDist = calculateDistance(newPoints[newPoints.length - 2], newPoints[newPoints.length - 1]);
60
+ distances.push(distances[distances.length - 1] + lastDist);
61
+ angles.push(az);
62
+ return { points: newPoints, distances, angles };
63
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Text measurement helpers.
3
+ *
4
+ * DXF carries no font metrics, so widths are estimates: count the characters
5
+ * that advance the pen (Thai above/below vowels and tone marks do not) and
6
+ * multiply by an average glyph width.
7
+ */
8
+ /** Number of characters in `text` that take horizontal space. */
9
+ export declare function visibleCharCount(text: string): number;
10
+ /**
11
+ * Estimated width of a single line of text.
12
+ * @param widthFactor average glyph advance as a fraction of the text height
13
+ * (≈0.6–0.7 for Thai TrueType fonts, ≈0.9 for txt.shx)
14
+ */
15
+ export declare function estimateTextWidth(text: string, height: number, widthFactor?: number): number;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Text measurement helpers.
3
+ *
4
+ * DXF carries no font metrics, so widths are estimates: count the characters
5
+ * that advance the pen (Thai above/below vowels and tone marks do not) and
6
+ * multiply by an average glyph width.
7
+ */
8
+ /** Thai combining marks that sit above/below a base character (no advance). */
9
+ function isThaiCombining(code) {
10
+ return code === 0x0e31 || (code >= 0x0e34 && code <= 0x0e3a) || (code >= 0x0e47 && code <= 0x0e4e);
11
+ }
12
+ /** Number of characters in `text` that take horizontal space. */
13
+ export function visibleCharCount(text) {
14
+ let n = 0;
15
+ for (const ch of text) {
16
+ if (!isThaiCombining(ch.codePointAt(0)))
17
+ n++;
18
+ }
19
+ return n;
20
+ }
21
+ /**
22
+ * Estimated width of a single line of text.
23
+ * @param widthFactor average glyph advance as a fraction of the text height
24
+ * (≈0.6–0.7 for Thai TrueType fonts, ≈0.9 for txt.shx)
25
+ */
26
+ export function estimateTextWidth(text, height, widthFactor = 0.75) {
27
+ return visibleCharCount(text) * height * widthFactor;
28
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * onfarm-dxf-ts — public API.
3
+ *
4
+ * A pure, API-agnostic, browser-first DXF generation library. Feed it plain
5
+ * coordinates, labels and style options (optionally on top of a DXF template)
6
+ * and it produces a DXF string/file. It knows nothing about any backend.
7
+ */
8
+ export { DxfBuilder } from './core/dxf-builder.js';
9
+ export type { CalloutOptions, ImageOptions } from './core/dxf-builder.js';
10
+ export { DxfDocument } from './core/dxf-document.js';
11
+ export { Modelspace } from './core/modelspace.js';
12
+ export * from './core/dxf-entities.js';
13
+ export * from './core/hatch-patterns.js';
14
+ export * from './types/index.js';
15
+ export * from './template/index.js';
16
+ export { DxfParser } from './parser/index.js';
17
+ export type { ParsedDxf, DxfBlock as ParsedDxfBlock, DxfEntity as ParsedDxfEntity, DxfPoint as ParsedDxfPoint, } from './parser/index.js';
18
+ export * from './geometry/math.utils.js';
19
+ export * from './geometry/polyline.utils.js';
20
+ export * from './geometry/offset.utils.js';
21
+ export * from './geometry/text.utils.js';
22
+ export * from './symbols/structures.js';
23
+ export * from './symbols/slope-symbol.js';
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * onfarm-dxf-ts — public API.
3
+ *
4
+ * A pure, API-agnostic, browser-first DXF generation library. Feed it plain
5
+ * coordinates, labels and style options (optionally on top of a DXF template)
6
+ * and it produces a DXF string/file. It knows nothing about any backend.
7
+ */
8
+ // Core engine
9
+ export { DxfBuilder } from './core/dxf-builder.js';
10
+ export { DxfDocument } from './core/dxf-document.js';
11
+ export { Modelspace } from './core/modelspace.js';
12
+ export * from './core/dxf-entities.js';
13
+ export * from './core/hatch-patterns.js';
14
+ // Generic types (Coordinate, Coordinate3D, OnfarmLine)
15
+ export * from './types/index.js';
16
+ // Template handling (block registry; reader/injector live in core for now)
17
+ export * from './template/index.js';
18
+ // Internal DXF parser (TypeScript port of dxf-parser — no external dependency).
19
+ // DxfEntity/DxfPoint are renamed with a Parsed- prefix to avoid clashing with
20
+ // the builder-side types exported from core/dxf-entities.
21
+ export { DxfParser } from './parser/index.js';
22
+ // Geometry utilities (pure math — azimuth, polyline division, offsets)
23
+ export * from './geometry/math.utils.js';
24
+ export * from './geometry/polyline.utils.js';
25
+ export * from './geometry/offset.utils.js';
26
+ export * from './geometry/text.utils.js';
27
+ // Parametric symbol generators (check / box / culvert / flume / siphon …)
28
+ export * from './symbols/structures.js';
29
+ export * from './symbols/slope-symbol.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * AutoCad files sometimes use an indexed color value between 1 and 255 inclusive.
3
+ * Each value corresponds to a color. index 1 is red, that is 16711680 or 0xFF0000.
4
+ * index 0 and 256, while included in this array, are actually reserved for inheritance
5
+ * values in AutoCad so they should not be used for index color lookups.
6
+ */
7
+ declare const AUTO_CAD_COLOR_INDEX: readonly number[];
8
+ export default AUTO_CAD_COLOR_INDEX;
@@ -0,0 +1,265 @@
1
+ /**
2
+ * AutoCad files sometimes use an indexed color value between 1 and 255 inclusive.
3
+ * Each value corresponds to a color. index 1 is red, that is 16711680 or 0xFF0000.
4
+ * index 0 and 256, while included in this array, are actually reserved for inheritance
5
+ * values in AutoCad so they should not be used for index color lookups.
6
+ */
7
+ const AUTO_CAD_COLOR_INDEX = [
8
+ 0,
9
+ 16711680,
10
+ 16776960,
11
+ 65280,
12
+ 65535,
13
+ 255,
14
+ 16711935,
15
+ 16777215,
16
+ 8421504,
17
+ 12632256,
18
+ 16711680,
19
+ 16744319,
20
+ 13369344,
21
+ 13395558,
22
+ 10027008,
23
+ 10046540,
24
+ 8323072,
25
+ 8339263,
26
+ 4980736,
27
+ 4990502,
28
+ 16727808,
29
+ 16752511,
30
+ 13382400,
31
+ 13401958,
32
+ 10036736,
33
+ 10051404,
34
+ 8331008,
35
+ 8343359,
36
+ 4985600,
37
+ 4992806,
38
+ 16744192,
39
+ 16760703,
40
+ 13395456,
41
+ 13408614,
42
+ 10046464,
43
+ 10056268,
44
+ 8339200,
45
+ 8347455,
46
+ 4990464,
47
+ 4995366,
48
+ 16760576,
49
+ 16768895,
50
+ 13408512,
51
+ 13415014,
52
+ 10056192,
53
+ 10061132,
54
+ 8347392,
55
+ 8351551,
56
+ 4995328,
57
+ 4997670,
58
+ 16776960,
59
+ 16777087,
60
+ 13421568,
61
+ 13421670,
62
+ 10000384,
63
+ 10000460,
64
+ 8355584,
65
+ 8355647,
66
+ 5000192,
67
+ 5000230,
68
+ 12582656,
69
+ 14679935,
70
+ 10079232,
71
+ 11717734,
72
+ 7510016,
73
+ 8755276,
74
+ 6258432,
75
+ 7307071,
76
+ 3755008,
77
+ 4344870,
78
+ 8388352,
79
+ 12582783,
80
+ 6736896,
81
+ 10079334,
82
+ 5019648,
83
+ 7510092,
84
+ 4161280,
85
+ 6258495,
86
+ 2509824,
87
+ 3755046,
88
+ 4194048,
89
+ 10485631,
90
+ 3394560,
91
+ 8375398,
92
+ 2529280,
93
+ 6264908,
94
+ 2064128,
95
+ 5209919,
96
+ 1264640,
97
+ 3099686,
98
+ 65280,
99
+ 8388479,
100
+ 52224,
101
+ 6736998,
102
+ 38912,
103
+ 5019724,
104
+ 32512,
105
+ 4161343,
106
+ 19456,
107
+ 2509862,
108
+ 65343,
109
+ 8388511,
110
+ 52275,
111
+ 6737023,
112
+ 38950,
113
+ 5019743,
114
+ 32543,
115
+ 4161359,
116
+ 19475,
117
+ 2509871,
118
+ 65407,
119
+ 8388543,
120
+ 52326,
121
+ 6737049,
122
+ 38988,
123
+ 5019762,
124
+ 32575,
125
+ 4161375,
126
+ 19494,
127
+ 2509881,
128
+ 65471,
129
+ 8388575,
130
+ 52377,
131
+ 6737074,
132
+ 39026,
133
+ 5019781,
134
+ 32607,
135
+ 4161391,
136
+ 19513,
137
+ 2509890,
138
+ 65535,
139
+ 8388607,
140
+ 52428,
141
+ 6737100,
142
+ 39064,
143
+ 5019800,
144
+ 32639,
145
+ 4161407,
146
+ 19532,
147
+ 2509900,
148
+ 49151,
149
+ 8380415,
150
+ 39372,
151
+ 6730444,
152
+ 29336,
153
+ 5014936,
154
+ 24447,
155
+ 4157311,
156
+ 14668,
157
+ 2507340,
158
+ 32767,
159
+ 8372223,
160
+ 26316,
161
+ 6724044,
162
+ 19608,
163
+ 5010072,
164
+ 16255,
165
+ 4153215,
166
+ 9804,
167
+ 2505036,
168
+ 16383,
169
+ 8364031,
170
+ 13260,
171
+ 6717388,
172
+ 9880,
173
+ 5005208,
174
+ 8063,
175
+ 4149119,
176
+ 4940,
177
+ 2502476,
178
+ 255,
179
+ 8355839,
180
+ 204,
181
+ 6710988,
182
+ 152,
183
+ 5000344,
184
+ 127,
185
+ 4145023,
186
+ 76,
187
+ 2500172,
188
+ 4129023,
189
+ 10452991,
190
+ 3342540,
191
+ 8349388,
192
+ 2490520,
193
+ 6245528,
194
+ 2031743,
195
+ 5193599,
196
+ 1245260,
197
+ 3089996,
198
+ 8323327,
199
+ 12550143,
200
+ 6684876,
201
+ 10053324,
202
+ 4980888,
203
+ 7490712,
204
+ 4128895,
205
+ 6242175,
206
+ 2490444,
207
+ 3745356,
208
+ 12517631,
209
+ 14647295,
210
+ 10027212,
211
+ 11691724,
212
+ 7471256,
213
+ 8735896,
214
+ 6226047,
215
+ 7290751,
216
+ 3735628,
217
+ 4335180,
218
+ 16711935,
219
+ 16744447,
220
+ 13369548,
221
+ 13395660,
222
+ 9961624,
223
+ 9981080,
224
+ 8323199,
225
+ 8339327,
226
+ 4980812,
227
+ 4990540,
228
+ 16711871,
229
+ 16744415,
230
+ 13369497,
231
+ 13395634,
232
+ 9961586,
233
+ 9981061,
234
+ 8323167,
235
+ 8339311,
236
+ 4980793,
237
+ 4990530,
238
+ 16711807,
239
+ 16744383,
240
+ 13369446,
241
+ 13395609,
242
+ 9961548,
243
+ 9981042,
244
+ 8323135,
245
+ 8339295,
246
+ 4980774,
247
+ 4990521,
248
+ 16711743,
249
+ 16744351,
250
+ 13369395,
251
+ 13395583,
252
+ 9961510,
253
+ 9981023,
254
+ 8323103,
255
+ 8339279,
256
+ 4980755,
257
+ 4990511,
258
+ 3355443,
259
+ 5987163,
260
+ 8684676,
261
+ 11382189,
262
+ 14079702,
263
+ 16777215
264
+ ];
265
+ export default AUTO_CAD_COLOR_INDEX;
@@ -0,0 +1,5 @@
1
+ /** Dimension style variables are used either in DIMSTYLE table or in DIMENSION entity style
2
+ * override in XDATA.
3
+ */
4
+ declare const codes: ReadonlyMap<number, string>;
5
+ export default codes;
@@ -0,0 +1,32 @@
1
+ /** Dimension style variables are used either in DIMSTYLE table or in DIMENSION entity style
2
+ * override in XDATA.
3
+ */
4
+ const codes = new Map([
5
+ [140, 'DIMTXT'],
6
+ [142, 'DIMTSZ'],
7
+ [144, 'DIMLFAC'],
8
+ [147, 'DIMGAP'],
9
+ [173, 'DIMSAH'],
10
+ [175, 'DIMSOXD'],
11
+ [176, 'DIMCLRD'],
12
+ [177, 'DIMCLRE'],
13
+ [178, 'DIMCLRT'],
14
+ [271, 'DIMDEC'],
15
+ [278, 'DIMDSEP'],
16
+ [281, 'DIMSD1'],
17
+ [282, 'DIMSD2'],
18
+ [3, 'DIMPOST'],
19
+ [40, 'DIMSCALE'],
20
+ [41, 'DIMASZ'],
21
+ [42, 'DIMEXO'],
22
+ [44, 'DIMEXE'],
23
+ [45, 'DIMRND'],
24
+ [46, 'DIMDLE'],
25
+ [5, 'DIMBLK'],
26
+ [6, 'DIMBLK1'],
27
+ [7, 'DIMBLK2'],
28
+ [75, 'DIMSE1'],
29
+ [76, 'DIMSE2'],
30
+ [78, 'DIMZIN'],
31
+ ]);
32
+ export default codes;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * DxfParser — TypeScript port of the `dxf-parser` package (see parser-raw/
3
+ * for the original JS source). Parses a DXF string into structured data:
4
+ * header, tables (layers, line types, styles, …), blocks and entities.
5
+ *
6
+ * Browser-first: only `parseSync(source: string)` is provided (the original's
7
+ * Node-stream `parseStream` was dropped).
8
+ */
9
+ import { IEntityParserType, ParsedDxf } from './types.js';
10
+ export default class DxfParser {
11
+ private _entityHandlers;
12
+ constructor();
13
+ registerEntityHandler(handlerType: IEntityParserType): void;
14
+ parseSync(source: string): ParsedDxf | null;
15
+ private _parse;
16
+ }