@mlightcad/mtext-renderer 0.9.0 → 0.9.2

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.
@@ -0,0 +1,4 @@
1
+ import { CharBox, CharBoxType } from './types';
2
+ import * as THREE from 'three';
3
+ export declare function normalizeBox(box?: THREE.Box3): THREE.Box3 | undefined;
4
+ export declare function buildCharBoxesFromObject(objectCharBoxes: CharBox[], matrixWorld: THREE.Matrix4, charBoxType?: CharBoxType): CharBox[];
@@ -0,0 +1 @@
1
+ export {};
@@ -90,7 +90,8 @@ export declare class MText extends THREE.Object3D {
90
90
  *
91
91
  * Token semantics:
92
92
  * - `CHAR`: `char` is the rendered character, `box` is defined, `children` is empty.
93
- * - `NEW_PARAGRAPH`: `char` is `\n`, `box` is `undefined`, `children` is empty.
93
+ * - `NEW_PARAGRAPH`: `char` is `\n`. The `box` represents a zero-width vertical
94
+ * line whose height equals the current line height. `children` is empty.
94
95
  * - `STACK`: `char` is empty string (`''`), `box` is the union of stack component boxes,
95
96
  * and `children` contains the stack sub-components.
96
97
  *
@@ -3,7 +3,6 @@ import { FontManager } from '../font';
3
3
  import { StyleManager } from './styleManager';
4
4
  import { MTextFlowDirection, TextStyle } from './types';
5
5
  import * as THREE from 'three';
6
- export declare const STACK_DIVIDER_CHAR = "\uE000";
7
6
  export interface MTextFormatOptions {
8
7
  /**
9
8
  * Font size.
@@ -62,14 +62,15 @@ export declare enum MTextAttachmentPoint {
62
62
  *
63
63
  * Semantics by {@link CharBoxType}:
64
64
  * - `CHAR`: `char` is the rendered character, `box` is defined, `children` is empty.
65
- * - `NEW_PARAGRAPH`: `char` is `\n`, `box` is `undefined`, `children` is empty.
65
+ * - `NEW_PARAGRAPH`: `char` is `\n`. The `box` represents a zero-width vertical
66
+ * line whose height equals the current line height. `children` is empty.
66
67
  * - `STACK`: `char` is `''`, `box` is the union box of stack components, `children` contains stack parts.
67
68
  */
68
69
  export interface CharBox {
69
70
  /** Token type. */
70
71
  type: CharBoxType;
71
- /** Token bounding box in local MText coordinates (undefined for `NEW_PARAGRAPH`). */
72
- box?: THREE.Box3;
72
+ /** Token bounding box in local MText coordinates. */
73
+ box: THREE.Box3;
73
74
  /** Token character payload (`''` for `STACK`, `\n` for `NEW_PARAGRAPH`). */
74
75
  char: string;
75
76
  /** Nested token components (currently used by `STACK`). */
@@ -86,6 +87,10 @@ export declare enum CharBoxType {
86
87
  /** Stack token (for fraction-style stacked expressions). */
87
88
  STACK = "STACK"
88
89
  }
90
+ /**
91
+ * Sentinel character used internally to represent a stack divider line.
92
+ */
93
+ export declare const STACK_DIVIDER_CHAR = "\uE000";
89
94
  export interface StyleTraits {
90
95
  /**
91
96
  * Optional layer name. Material is identified by layer and color. So it means different
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/mtext-renderer",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "AutoCAD MText renderer based on Three.js",
5
5
  "license": "MIT",
6
6
  "author": "MLight Lee <mlight.lee@outlook.com>",
@@ -41,7 +41,8 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/opentype.js": "^1.3.8",
44
- "@types/three": "^0.172.0"
44
+ "@types/three": "^0.172.0",
45
+ "vitest": "^3.2.4"
45
46
  },
46
47
  "peerDependencies": {
47
48
  "three": "^0.172.0"
@@ -52,6 +53,7 @@
52
53
  "build:worker": "vite build -c vite.config.worker.ts",
53
54
  "clean": "rimraf dist lib tsconfig.tsbuildinfo",
54
55
  "lint": "eslint src/",
55
- "lint:fix": "eslint --fix --quiet src/"
56
+ "lint:fix": "eslint --fix --quiet src/",
57
+ "test": "vitest run"
56
58
  }
57
59
  }