Skip to content

Commit 8257cb6

Browse files
authored
feat: paragraph alignment, attachment & spacing; CharFormat width/tracking/oblique; pnpm 10 + CI (#10)
1 parent 7e11f16 commit 8257cb6

13 files changed

Lines changed: 377 additions & 50 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
fetch-depth: 0
2323

2424
- name: Setup pnpm
25-
uses: pnpm/action-setup@v2
25+
uses: pnpm/action-setup@v4
2626
with:
27-
version: 9
27+
version: 10.33.4
2828

2929
- name: Setup Node.js
3030
uses: actions/setup-node@v4
@@ -77,9 +77,9 @@ jobs:
7777
uses: actions/checkout@v4
7878

7979
- name: Setup pnpm
80-
uses: pnpm/action-setup@v2
80+
uses: pnpm/action-setup@v4
8181
with:
82-
version: 9
82+
version: 10.33.4
8383

8484
- name: Setup Node.js
8585
uses: actions/setup-node@v4

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Core packages live under `packages/`:
1313

1414
## Tooling
1515

16-
- Package manager: `pnpm` (repo expects `pnpm@9.15.9`).
16+
- Package manager: `pnpm` (repo expects `pnpm@10.33.4` per root `packageManager`; `engines.pnpm` is `>=10`).
1717
- Language: TypeScript (ESM).
1818
- Demos use Vite (`pnpm --filter <pkg> dev`).
1919

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
{
22
"name": "mtext-input-box-monorepo",
33
"private": true,
4-
"packageManager": "pnpm@9.15.9",
4+
"packageManager": "pnpm@10.33.4",
5+
"engines": {
6+
"pnpm": ">=10"
7+
},
8+
"pnpm": {
9+
"onlyBuiltDependencies": [
10+
"@parcel/watcher",
11+
"esbuild",
12+
"nx",
13+
"vue-demi"
14+
]
15+
},
516
"scripts": {
617
"build": "pnpm --filter @mlightcad/text-box-cursor build && pnpm --filter @mlightcad/mtext-input-box build && pnpm --filter @mlightcad/demo-canvas-cursor build && pnpm --filter @mlightcad/demo-three-cursor build && pnpm --filter @mlightcad/demo-mtext-input-box build",
718
"dev:canvas": "pnpm --filter @mlightcad/demo-canvas-cursor dev",

packages/demo-canvas-cursor/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@mlightcad/text-box-cursor": "workspace:*"
1414
},
1515
"devDependencies": {
16+
"@eslint/js": "^9.34.0",
1617
"@types/node": "^24.4.0",
1718
"@typescript-eslint/eslint-plugin": "^8.41.0",
1819
"@typescript-eslint/parser": "^8.41.0",

packages/demo-mtext-input-box/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"vue": "^3.5.22"
1919
},
2020
"devDependencies": {
21+
"@eslint/js": "^9.34.0",
2122
"@types/diff": "^7.0.1",
2223
"@types/node": "^24.4.0",
2324
"@types/three": "^0.172.0",

packages/demo-three-cursor/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@mlightcad/text-box-cursor": "workspace:*"
1515
},
1616
"devDependencies": {
17+
"@eslint/js": "^9.34.0",
1718
"@types/node": "^24.4.0",
1819
"@typescript-eslint/eslint-plugin": "^8.41.0",
1920
"@typescript-eslint/parser": "^8.41.0",

packages/mtext-input-box/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mlightcad/mtext-input-box",
3-
"version": "0.2.7",
3+
"version": "0.2.8",
44
"type": "module",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -22,10 +22,11 @@
2222
"@mlightcad/text-box-cursor": "workspace:*"
2323
},
2424
"peerDependencies": {
25-
"@mlightcad/mtext-renderer": "^0.10.11",
25+
"@mlightcad/mtext-renderer": "^0.10.13",
2626
"three": "^0.172.0"
2727
},
2828
"devDependencies": {
29+
"@eslint/js": "^9.34.0",
2930
"@types/node": "^24.4.0",
3031
"@types/three": "^0.172.0",
3132
"@typescript-eslint/eslint-plugin": "^8.41.0",

packages/mtext-input-box/src/viewer/format.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { CharFormat } from './types';
2+
import { MTextParagraphAlignment } from '@mlightcad/mtext-renderer';
23

34
export const DEFAULT_FONT_FAMILY = 'simkai';
45

@@ -14,7 +15,11 @@ export function defaultCharFormat(): CharFormat {
1415
strike: false,
1516
script: 'normal',
1617
aci: null,
17-
rgb: 0xffffff
18+
rgb: 0xffffff,
19+
obliqueAngle: 0,
20+
widthFactor: 1,
21+
tracking: 1,
22+
paragraphAlignment: MTextParagraphAlignment.DEFAULT
1823
};
1924
}
2025

@@ -30,6 +35,10 @@ export function sameFormat(a: CharFormat, b: CharFormat): boolean {
3035
a.strike === b.strike &&
3136
a.script === b.script &&
3237
a.aci === b.aci &&
33-
a.rgb === b.rgb
38+
a.rgb === b.rgb &&
39+
a.obliqueAngle === b.obliqueAngle &&
40+
a.widthFactor === b.widthFactor &&
41+
a.tracking === b.tracking &&
42+
a.paragraphAlignment === b.paragraphAlignment
3443
);
3544
}

packages/mtext-input-box/src/viewer/types.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import type { Box, CursorStyle, SelectionStyle } from '@mlightcad/text-box-cursor';
2-
import type { ColorSettings, MTextColor, TextStyle } from '@mlightcad/mtext-renderer';
2+
import type {
3+
ColorSettings,
4+
MTextColor,
5+
MTextParagraphAlignment,
6+
TextStyle
7+
} from '@mlightcad/mtext-renderer';
38
import type * as THREE from 'three';
49

510
/** Vertical script style for a character run. */
@@ -26,6 +31,22 @@ export interface CharFormat {
2631
aci: number | null;
2732
/** Explicit RGB color packed as `0xRRGGBB`. */
2833
rgb: number | null;
34+
/**
35+
* Character slant in degrees (AutoCAD oblique; negative leans the other way).
36+
* Serialized to MTEXT as `\Qangle;`.
37+
*/
38+
obliqueAngle: number;
39+
/** Horizontal scale of characters (width factor). Serialized as `\Wvalue;`. */
40+
widthFactor: number;
41+
/**
42+
* Inter-character spacing factor (MTEXT `\T` tracking). `1` is the default spacing.
43+
*/
44+
tracking: number;
45+
/**
46+
* Paragraph horizontal alignment for the active paragraph (cursor or selection).
47+
* Uses {@link MTextParagraphAlignment} from the shared MTEXT stack (parser / renderer).
48+
*/
49+
paragraphAlignment: MTextParagraphAlignment;
2950
}
3051

3152
/** Internal editor state snapshot used for updates and history-like operations. */

0 commit comments

Comments
 (0)