@mlightcad/mtext-parser 1.0.1 → 1.0.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.
- package/dist/parser.cjs.js +3 -3
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.es.js +162 -142
- package/dist/parser.es.js.map +1 -1
- package/dist/parser.umd.js +3 -3
- package/dist/parser.umd.js.map +1 -1
- package/dist/types/parser.d.ts +26 -1
- package/package.json +1 -1
package/dist/types/parser.d.ts
CHANGED
|
@@ -36,7 +36,23 @@ export type TokenData = {
|
|
|
36
36
|
[TokenType.NEW_PARAGRAPH]: null;
|
|
37
37
|
[TokenType.NEW_COLUMN]: null;
|
|
38
38
|
[TokenType.WRAP_AT_DIMLINE]: null;
|
|
39
|
-
[TokenType.PROPERTIES_CHANGED]:
|
|
39
|
+
[TokenType.PROPERTIES_CHANGED]: {
|
|
40
|
+
command: string;
|
|
41
|
+
changes: {
|
|
42
|
+
underline?: boolean;
|
|
43
|
+
overline?: boolean;
|
|
44
|
+
strikeThrough?: boolean;
|
|
45
|
+
aci?: number;
|
|
46
|
+
rgb?: RGB | null;
|
|
47
|
+
align?: MTextLineAlignment;
|
|
48
|
+
fontFace?: FontFace;
|
|
49
|
+
capHeight?: number;
|
|
50
|
+
widthFactor?: number;
|
|
51
|
+
charTrackingFactor?: number;
|
|
52
|
+
oblique?: number;
|
|
53
|
+
paragraph?: Partial<ParagraphProperties>;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
40
56
|
};
|
|
41
57
|
/**
|
|
42
58
|
* Line alignment options for MText
|
|
@@ -191,6 +207,7 @@ export declare class MTextParser {
|
|
|
191
207
|
private continueStroke;
|
|
192
208
|
private yieldPropertyCommands;
|
|
193
209
|
private decoder;
|
|
210
|
+
private lastCtx;
|
|
194
211
|
/**
|
|
195
212
|
* Creates a new MTextParser instance
|
|
196
213
|
* @param content - The MText content to parse
|
|
@@ -220,8 +237,16 @@ export declare class MTextParser {
|
|
|
220
237
|
/**
|
|
221
238
|
* Parse MText properties
|
|
222
239
|
* @param cmd - The property command to parse
|
|
240
|
+
* @returns Property changes if yieldPropertyCommands is true and changes occurred
|
|
223
241
|
*/
|
|
224
242
|
private parseProperties;
|
|
243
|
+
/**
|
|
244
|
+
* Get property changes between two contexts
|
|
245
|
+
* @param oldCtx - The old context
|
|
246
|
+
* @param newCtx - The new context
|
|
247
|
+
* @returns Object containing changed properties
|
|
248
|
+
*/
|
|
249
|
+
private getPropertyChanges;
|
|
225
250
|
/**
|
|
226
251
|
* Parse alignment property
|
|
227
252
|
* @param ctx - The context to update
|