@mlightcad/mtext-parser 1.0.1 → 1.0.4

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.
@@ -23,6 +23,30 @@ export declare enum TokenType {
23
23
  /** Properties changed token with string data (full command) */
24
24
  PROPERTIES_CHANGED = 9
25
25
  }
26
+ /**
27
+ * Format properties of MText word tokens
28
+ */
29
+ export interface Properties {
30
+ underline?: boolean;
31
+ overline?: boolean;
32
+ strikeThrough?: boolean;
33
+ aci?: number;
34
+ rgb?: RGB | null;
35
+ align?: MTextLineAlignment;
36
+ fontFace?: FontFace;
37
+ capHeight?: number;
38
+ widthFactor?: number;
39
+ charTrackingFactor?: number;
40
+ oblique?: number;
41
+ paragraph?: Partial<ParagraphProperties>;
42
+ }
43
+ /**
44
+ * Changed properties of MText word tokens
45
+ */
46
+ export interface ChangedProperties {
47
+ command: string;
48
+ changes: Properties;
49
+ }
26
50
  /**
27
51
  * Type for token data based on token type
28
52
  */
@@ -36,7 +60,7 @@ export type TokenData = {
36
60
  [TokenType.NEW_PARAGRAPH]: null;
37
61
  [TokenType.NEW_COLUMN]: null;
38
62
  [TokenType.WRAP_AT_DIMLINE]: null;
39
- [TokenType.PROPERTIES_CHANGED]: string;
63
+ [TokenType.PROPERTIES_CHANGED]: ChangedProperties;
40
64
  };
41
65
  /**
42
66
  * Line alignment options for MText
@@ -191,6 +215,7 @@ export declare class MTextParser {
191
215
  private continueStroke;
192
216
  private yieldPropertyCommands;
193
217
  private decoder;
218
+ private lastCtx;
194
219
  /**
195
220
  * Creates a new MTextParser instance
196
221
  * @param content - The MText content to parse
@@ -220,8 +245,16 @@ export declare class MTextParser {
220
245
  /**
221
246
  * Parse MText properties
222
247
  * @param cmd - The property command to parse
248
+ * @returns Property changes if yieldPropertyCommands is true and changes occurred
223
249
  */
224
250
  private parseProperties;
251
+ /**
252
+ * Get property changes between two contexts
253
+ * @param oldCtx - The old context
254
+ * @param newCtx - The new context
255
+ * @returns Object containing changed properties
256
+ */
257
+ private getPropertyChanges;
225
258
  /**
226
259
  * Parse alignment property
227
260
  * @param ctx - The context to update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/mtext-parser",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "AutoCAD MText parser written in TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/parser.cjs.js",